app.js 1.4 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975
  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, {
  40. /******/ configurable: false,
  41. /******/ enumerable: true,
  42. /******/ get: getter
  43. /******/ });
  44. /******/ }
  45. /******/ };
  46. /******/
  47. /******/ // getDefaultExport function for compatibility with non-harmony modules
  48. /******/ __webpack_require__.n = function(module) {
  49. /******/ var getter = module && module.__esModule ?
  50. /******/ function getDefault() { return module['default']; } :
  51. /******/ function getModuleExports() { return module; };
  52. /******/ __webpack_require__.d(getter, 'a', getter);
  53. /******/ return getter;
  54. /******/ };
  55. /******/
  56. /******/ // Object.prototype.hasOwnProperty.call
  57. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  58. /******/
  59. /******/ // __webpack_public_path__
  60. /******/ __webpack_require__.p = "/";
  61. /******/
  62. /******/ // Load entry module and return exports
  63. /******/ return __webpack_require__(__webpack_require__.s = 0);
  64. /******/ })
  65. /************************************************************************/
  66. /******/ ({
  67. /***/ "./node_modules/axios/index.js":
  68. /***/ (function(module, exports, __webpack_require__) {
  69. module.exports = __webpack_require__("./node_modules/axios/lib/axios.js");
  70. /***/ }),
  71. /***/ "./node_modules/axios/lib/adapters/xhr.js":
  72. /***/ (function(module, exports, __webpack_require__) {
  73. "use strict";
  74. var utils = __webpack_require__("./node_modules/axios/lib/utils.js");
  75. var settle = __webpack_require__("./node_modules/axios/lib/core/settle.js");
  76. var buildURL = __webpack_require__("./node_modules/axios/lib/helpers/buildURL.js");
  77. var parseHeaders = __webpack_require__("./node_modules/axios/lib/helpers/parseHeaders.js");
  78. var isURLSameOrigin = __webpack_require__("./node_modules/axios/lib/helpers/isURLSameOrigin.js");
  79. var createError = __webpack_require__("./node_modules/axios/lib/core/createError.js");
  80. var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__("./node_modules/axios/lib/helpers/btoa.js");
  81. module.exports = function xhrAdapter(config) {
  82. return new Promise(function dispatchXhrRequest(resolve, reject) {
  83. var requestData = config.data;
  84. var requestHeaders = config.headers;
  85. if (utils.isFormData(requestData)) {
  86. delete requestHeaders['Content-Type']; // Let the browser set it
  87. }
  88. var request = new XMLHttpRequest();
  89. var loadEvent = 'onreadystatechange';
  90. var xDomain = false;
  91. // For IE 8/9 CORS support
  92. // Only supports POST and GET calls and doesn't returns the response headers.
  93. // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
  94. if ("development" !== 'test' &&
  95. typeof window !== 'undefined' &&
  96. window.XDomainRequest && !('withCredentials' in request) &&
  97. !isURLSameOrigin(config.url)) {
  98. request = new window.XDomainRequest();
  99. loadEvent = 'onload';
  100. xDomain = true;
  101. request.onprogress = function handleProgress() {};
  102. request.ontimeout = function handleTimeout() {};
  103. }
  104. // HTTP basic authentication
  105. if (config.auth) {
  106. var username = config.auth.username || '';
  107. var password = config.auth.password || '';
  108. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  109. }
  110. request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
  111. // Set the request timeout in MS
  112. request.timeout = config.timeout;
  113. // Listen for ready state
  114. request[loadEvent] = function handleLoad() {
  115. if (!request || (request.readyState !== 4 && !xDomain)) {
  116. return;
  117. }
  118. // The request errored out and we didn't get a response, this will be
  119. // handled by onerror instead
  120. // With one exception: request that using file: protocol, most browsers
  121. // will return status as 0 even though it's a successful request
  122. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  123. return;
  124. }
  125. // Prepare the response
  126. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  127. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  128. var response = {
  129. data: responseData,
  130. // IE sends 1223 instead of 204 (https://github.com/axios/axios/issues/201)
  131. status: request.status === 1223 ? 204 : request.status,
  132. statusText: request.status === 1223 ? 'No Content' : request.statusText,
  133. headers: responseHeaders,
  134. config: config,
  135. request: request
  136. };
  137. settle(resolve, reject, response);
  138. // Clean up request
  139. request = null;
  140. };
  141. // Handle low level network errors
  142. request.onerror = function handleError() {
  143. // Real errors are hidden from us by the browser
  144. // onerror should only fire if it's a network error
  145. reject(createError('Network Error', config, null, request));
  146. // Clean up request
  147. request = null;
  148. };
  149. // Handle timeout
  150. request.ontimeout = function handleTimeout() {
  151. reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
  152. request));
  153. // Clean up request
  154. request = null;
  155. };
  156. // Add xsrf header
  157. // This is only done if running in a standard browser environment.
  158. // Specifically not if we're in a web worker, or react-native.
  159. if (utils.isStandardBrowserEnv()) {
  160. var cookies = __webpack_require__("./node_modules/axios/lib/helpers/cookies.js");
  161. // Add xsrf header
  162. var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
  163. cookies.read(config.xsrfCookieName) :
  164. undefined;
  165. if (xsrfValue) {
  166. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  167. }
  168. }
  169. // Add headers to the request
  170. if ('setRequestHeader' in request) {
  171. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  172. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  173. // Remove Content-Type if data is undefined
  174. delete requestHeaders[key];
  175. } else {
  176. // Otherwise add header to the request
  177. request.setRequestHeader(key, val);
  178. }
  179. });
  180. }
  181. // Add withCredentials to request if needed
  182. if (config.withCredentials) {
  183. request.withCredentials = true;
  184. }
  185. // Add responseType to request if needed
  186. if (config.responseType) {
  187. try {
  188. request.responseType = config.responseType;
  189. } catch (e) {
  190. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  191. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  192. if (config.responseType !== 'json') {
  193. throw e;
  194. }
  195. }
  196. }
  197. // Handle progress if needed
  198. if (typeof config.onDownloadProgress === 'function') {
  199. request.addEventListener('progress', config.onDownloadProgress);
  200. }
  201. // Not all browsers support upload events
  202. if (typeof config.onUploadProgress === 'function' && request.upload) {
  203. request.upload.addEventListener('progress', config.onUploadProgress);
  204. }
  205. if (config.cancelToken) {
  206. // Handle cancellation
  207. config.cancelToken.promise.then(function onCanceled(cancel) {
  208. if (!request) {
  209. return;
  210. }
  211. request.abort();
  212. reject(cancel);
  213. // Clean up request
  214. request = null;
  215. });
  216. }
  217. if (requestData === undefined) {
  218. requestData = null;
  219. }
  220. // Send the request
  221. request.send(requestData);
  222. });
  223. };
  224. /***/ }),
  225. /***/ "./node_modules/axios/lib/axios.js":
  226. /***/ (function(module, exports, __webpack_require__) {
  227. "use strict";
  228. var utils = __webpack_require__("./node_modules/axios/lib/utils.js");
  229. var bind = __webpack_require__("./node_modules/axios/lib/helpers/bind.js");
  230. var Axios = __webpack_require__("./node_modules/axios/lib/core/Axios.js");
  231. var defaults = __webpack_require__("./node_modules/axios/lib/defaults.js");
  232. /**
  233. * Create an instance of Axios
  234. *
  235. * @param {Object} defaultConfig The default config for the instance
  236. * @return {Axios} A new instance of Axios
  237. */
  238. function createInstance(defaultConfig) {
  239. var context = new Axios(defaultConfig);
  240. var instance = bind(Axios.prototype.request, context);
  241. // Copy axios.prototype to instance
  242. utils.extend(instance, Axios.prototype, context);
  243. // Copy context to instance
  244. utils.extend(instance, context);
  245. return instance;
  246. }
  247. // Create the default instance to be exported
  248. var axios = createInstance(defaults);
  249. // Expose Axios class to allow class inheritance
  250. axios.Axios = Axios;
  251. // Factory for creating new instances
  252. axios.create = function create(instanceConfig) {
  253. return createInstance(utils.merge(defaults, instanceConfig));
  254. };
  255. // Expose Cancel & CancelToken
  256. axios.Cancel = __webpack_require__("./node_modules/axios/lib/cancel/Cancel.js");
  257. axios.CancelToken = __webpack_require__("./node_modules/axios/lib/cancel/CancelToken.js");
  258. axios.isCancel = __webpack_require__("./node_modules/axios/lib/cancel/isCancel.js");
  259. // Expose all/spread
  260. axios.all = function all(promises) {
  261. return Promise.all(promises);
  262. };
  263. axios.spread = __webpack_require__("./node_modules/axios/lib/helpers/spread.js");
  264. module.exports = axios;
  265. // Allow use of default import syntax in TypeScript
  266. module.exports.default = axios;
  267. /***/ }),
  268. /***/ "./node_modules/axios/lib/cancel/Cancel.js":
  269. /***/ (function(module, exports, __webpack_require__) {
  270. "use strict";
  271. /**
  272. * A `Cancel` is an object that is thrown when an operation is canceled.
  273. *
  274. * @class
  275. * @param {string=} message The message.
  276. */
  277. function Cancel(message) {
  278. this.message = message;
  279. }
  280. Cancel.prototype.toString = function toString() {
  281. return 'Cancel' + (this.message ? ': ' + this.message : '');
  282. };
  283. Cancel.prototype.__CANCEL__ = true;
  284. module.exports = Cancel;
  285. /***/ }),
  286. /***/ "./node_modules/axios/lib/cancel/CancelToken.js":
  287. /***/ (function(module, exports, __webpack_require__) {
  288. "use strict";
  289. var Cancel = __webpack_require__("./node_modules/axios/lib/cancel/Cancel.js");
  290. /**
  291. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  292. *
  293. * @class
  294. * @param {Function} executor The executor function.
  295. */
  296. function CancelToken(executor) {
  297. if (typeof executor !== 'function') {
  298. throw new TypeError('executor must be a function.');
  299. }
  300. var resolvePromise;
  301. this.promise = new Promise(function promiseExecutor(resolve) {
  302. resolvePromise = resolve;
  303. });
  304. var token = this;
  305. executor(function cancel(message) {
  306. if (token.reason) {
  307. // Cancellation has already been requested
  308. return;
  309. }
  310. token.reason = new Cancel(message);
  311. resolvePromise(token.reason);
  312. });
  313. }
  314. /**
  315. * Throws a `Cancel` if cancellation has been requested.
  316. */
  317. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  318. if (this.reason) {
  319. throw this.reason;
  320. }
  321. };
  322. /**
  323. * Returns an object that contains a new `CancelToken` and a function that, when called,
  324. * cancels the `CancelToken`.
  325. */
  326. CancelToken.source = function source() {
  327. var cancel;
  328. var token = new CancelToken(function executor(c) {
  329. cancel = c;
  330. });
  331. return {
  332. token: token,
  333. cancel: cancel
  334. };
  335. };
  336. module.exports = CancelToken;
  337. /***/ }),
  338. /***/ "./node_modules/axios/lib/cancel/isCancel.js":
  339. /***/ (function(module, exports, __webpack_require__) {
  340. "use strict";
  341. module.exports = function isCancel(value) {
  342. return !!(value && value.__CANCEL__);
  343. };
  344. /***/ }),
  345. /***/ "./node_modules/axios/lib/core/Axios.js":
  346. /***/ (function(module, exports, __webpack_require__) {
  347. "use strict";
  348. var defaults = __webpack_require__("./node_modules/axios/lib/defaults.js");
  349. var utils = __webpack_require__("./node_modules/axios/lib/utils.js");
  350. var InterceptorManager = __webpack_require__("./node_modules/axios/lib/core/InterceptorManager.js");
  351. var dispatchRequest = __webpack_require__("./node_modules/axios/lib/core/dispatchRequest.js");
  352. /**
  353. * Create a new instance of Axios
  354. *
  355. * @param {Object} instanceConfig The default config for the instance
  356. */
  357. function Axios(instanceConfig) {
  358. this.defaults = instanceConfig;
  359. this.interceptors = {
  360. request: new InterceptorManager(),
  361. response: new InterceptorManager()
  362. };
  363. }
  364. /**
  365. * Dispatch a request
  366. *
  367. * @param {Object} config The config specific for this request (merged with this.defaults)
  368. */
  369. Axios.prototype.request = function request(config) {
  370. /*eslint no-param-reassign:0*/
  371. // Allow for axios('example/url'[, config]) a la fetch API
  372. if (typeof config === 'string') {
  373. config = utils.merge({
  374. url: arguments[0]
  375. }, arguments[1]);
  376. }
  377. config = utils.merge(defaults, {method: 'get'}, this.defaults, config);
  378. config.method = config.method.toLowerCase();
  379. // Hook up interceptors middleware
  380. var chain = [dispatchRequest, undefined];
  381. var promise = Promise.resolve(config);
  382. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  383. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  384. });
  385. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  386. chain.push(interceptor.fulfilled, interceptor.rejected);
  387. });
  388. while (chain.length) {
  389. promise = promise.then(chain.shift(), chain.shift());
  390. }
  391. return promise;
  392. };
  393. // Provide aliases for supported request methods
  394. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  395. /*eslint func-names:0*/
  396. Axios.prototype[method] = function(url, config) {
  397. return this.request(utils.merge(config || {}, {
  398. method: method,
  399. url: url
  400. }));
  401. };
  402. });
  403. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  404. /*eslint func-names:0*/
  405. Axios.prototype[method] = function(url, data, config) {
  406. return this.request(utils.merge(config || {}, {
  407. method: method,
  408. url: url,
  409. data: data
  410. }));
  411. };
  412. });
  413. module.exports = Axios;
  414. /***/ }),
  415. /***/ "./node_modules/axios/lib/core/InterceptorManager.js":
  416. /***/ (function(module, exports, __webpack_require__) {
  417. "use strict";
  418. var utils = __webpack_require__("./node_modules/axios/lib/utils.js");
  419. function InterceptorManager() {
  420. this.handlers = [];
  421. }
  422. /**
  423. * Add a new interceptor to the stack
  424. *
  425. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  426. * @param {Function} rejected The function to handle `reject` for a `Promise`
  427. *
  428. * @return {Number} An ID used to remove interceptor later
  429. */
  430. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  431. this.handlers.push({
  432. fulfilled: fulfilled,
  433. rejected: rejected
  434. });
  435. return this.handlers.length - 1;
  436. };
  437. /**
  438. * Remove an interceptor from the stack
  439. *
  440. * @param {Number} id The ID that was returned by `use`
  441. */
  442. InterceptorManager.prototype.eject = function eject(id) {
  443. if (this.handlers[id]) {
  444. this.handlers[id] = null;
  445. }
  446. };
  447. /**
  448. * Iterate over all the registered interceptors
  449. *
  450. * This method is particularly useful for skipping over any
  451. * interceptors that may have become `null` calling `eject`.
  452. *
  453. * @param {Function} fn The function to call for each interceptor
  454. */
  455. InterceptorManager.prototype.forEach = function forEach(fn) {
  456. utils.forEach(this.handlers, function forEachHandler(h) {
  457. if (h !== null) {
  458. fn(h);
  459. }
  460. });
  461. };
  462. module.exports = InterceptorManager;
  463. /***/ }),
  464. /***/ "./node_modules/axios/lib/core/createError.js":
  465. /***/ (function(module, exports, __webpack_require__) {
  466. "use strict";
  467. var enhanceError = __webpack_require__("./node_modules/axios/lib/core/enhanceError.js");
  468. /**
  469. * Create an Error with the specified message, config, error code, request and response.
  470. *
  471. * @param {string} message The error message.
  472. * @param {Object} config The config.
  473. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  474. * @param {Object} [request] The request.
  475. * @param {Object} [response] The response.
  476. * @returns {Error} The created error.
  477. */
  478. module.exports = function createError(message, config, code, request, response) {
  479. var error = new Error(message);
  480. return enhanceError(error, config, code, request, response);
  481. };
  482. /***/ }),
  483. /***/ "./node_modules/axios/lib/core/dispatchRequest.js":
  484. /***/ (function(module, exports, __webpack_require__) {
  485. "use strict";
  486. var utils = __webpack_require__("./node_modules/axios/lib/utils.js");
  487. var transformData = __webpack_require__("./node_modules/axios/lib/core/transformData.js");
  488. var isCancel = __webpack_require__("./node_modules/axios/lib/cancel/isCancel.js");
  489. var defaults = __webpack_require__("./node_modules/axios/lib/defaults.js");
  490. var isAbsoluteURL = __webpack_require__("./node_modules/axios/lib/helpers/isAbsoluteURL.js");
  491. var combineURLs = __webpack_require__("./node_modules/axios/lib/helpers/combineURLs.js");
  492. /**
  493. * Throws a `Cancel` if cancellation has been requested.
  494. */
  495. function throwIfCancellationRequested(config) {
  496. if (config.cancelToken) {
  497. config.cancelToken.throwIfRequested();
  498. }
  499. }
  500. /**
  501. * Dispatch a request to the server using the configured adapter.
  502. *
  503. * @param {object} config The config that is to be used for the request
  504. * @returns {Promise} The Promise to be fulfilled
  505. */
  506. module.exports = function dispatchRequest(config) {
  507. throwIfCancellationRequested(config);
  508. // Support baseURL config
  509. if (config.baseURL && !isAbsoluteURL(config.url)) {
  510. config.url = combineURLs(config.baseURL, config.url);
  511. }
  512. // Ensure headers exist
  513. config.headers = config.headers || {};
  514. // Transform request data
  515. config.data = transformData(
  516. config.data,
  517. config.headers,
  518. config.transformRequest
  519. );
  520. // Flatten headers
  521. config.headers = utils.merge(
  522. config.headers.common || {},
  523. config.headers[config.method] || {},
  524. config.headers || {}
  525. );
  526. utils.forEach(
  527. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  528. function cleanHeaderConfig(method) {
  529. delete config.headers[method];
  530. }
  531. );
  532. var adapter = config.adapter || defaults.adapter;
  533. return adapter(config).then(function onAdapterResolution(response) {
  534. throwIfCancellationRequested(config);
  535. // Transform response data
  536. response.data = transformData(
  537. response.data,
  538. response.headers,
  539. config.transformResponse
  540. );
  541. return response;
  542. }, function onAdapterRejection(reason) {
  543. if (!isCancel(reason)) {
  544. throwIfCancellationRequested(config);
  545. // Transform response data
  546. if (reason && reason.response) {
  547. reason.response.data = transformData(
  548. reason.response.data,
  549. reason.response.headers,
  550. config.transformResponse
  551. );
  552. }
  553. }
  554. return Promise.reject(reason);
  555. });
  556. };
  557. /***/ }),
  558. /***/ "./node_modules/axios/lib/core/enhanceError.js":
  559. /***/ (function(module, exports, __webpack_require__) {
  560. "use strict";
  561. /**
  562. * Update an Error with the specified config, error code, and response.
  563. *
  564. * @param {Error} error The error to update.
  565. * @param {Object} config The config.
  566. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  567. * @param {Object} [request] The request.
  568. * @param {Object} [response] The response.
  569. * @returns {Error} The error.
  570. */
  571. module.exports = function enhanceError(error, config, code, request, response) {
  572. error.config = config;
  573. if (code) {
  574. error.code = code;
  575. }
  576. error.request = request;
  577. error.response = response;
  578. return error;
  579. };
  580. /***/ }),
  581. /***/ "./node_modules/axios/lib/core/settle.js":
  582. /***/ (function(module, exports, __webpack_require__) {
  583. "use strict";
  584. var createError = __webpack_require__("./node_modules/axios/lib/core/createError.js");
  585. /**
  586. * Resolve or reject a Promise based on response status.
  587. *
  588. * @param {Function} resolve A function that resolves the promise.
  589. * @param {Function} reject A function that rejects the promise.
  590. * @param {object} response The response.
  591. */
  592. module.exports = function settle(resolve, reject, response) {
  593. var validateStatus = response.config.validateStatus;
  594. // Note: status is not exposed by XDomainRequest
  595. if (!response.status || !validateStatus || validateStatus(response.status)) {
  596. resolve(response);
  597. } else {
  598. reject(createError(
  599. 'Request failed with status code ' + response.status,
  600. response.config,
  601. null,
  602. response.request,
  603. response
  604. ));
  605. }
  606. };
  607. /***/ }),
  608. /***/ "./node_modules/axios/lib/core/transformData.js":
  609. /***/ (function(module, exports, __webpack_require__) {
  610. "use strict";
  611. var utils = __webpack_require__("./node_modules/axios/lib/utils.js");
  612. /**
  613. * Transform the data for a request or a response
  614. *
  615. * @param {Object|String} data The data to be transformed
  616. * @param {Array} headers The headers for the request or response
  617. * @param {Array|Function} fns A single function or Array of functions
  618. * @returns {*} The resulting transformed data
  619. */
  620. module.exports = function transformData(data, headers, fns) {
  621. /*eslint no-param-reassign:0*/
  622. utils.forEach(fns, function transform(fn) {
  623. data = fn(data, headers);
  624. });
  625. return data;
  626. };
  627. /***/ }),
  628. /***/ "./node_modules/axios/lib/defaults.js":
  629. /***/ (function(module, exports, __webpack_require__) {
  630. "use strict";
  631. /* WEBPACK VAR INJECTION */(function(process) {
  632. var utils = __webpack_require__("./node_modules/axios/lib/utils.js");
  633. var normalizeHeaderName = __webpack_require__("./node_modules/axios/lib/helpers/normalizeHeaderName.js");
  634. var DEFAULT_CONTENT_TYPE = {
  635. 'Content-Type': 'application/x-www-form-urlencoded'
  636. };
  637. function setContentTypeIfUnset(headers, value) {
  638. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  639. headers['Content-Type'] = value;
  640. }
  641. }
  642. function getDefaultAdapter() {
  643. var adapter;
  644. if (typeof XMLHttpRequest !== 'undefined') {
  645. // For browsers use XHR adapter
  646. adapter = __webpack_require__("./node_modules/axios/lib/adapters/xhr.js");
  647. } else if (typeof process !== 'undefined') {
  648. // For node use HTTP adapter
  649. adapter = __webpack_require__("./node_modules/axios/lib/adapters/xhr.js");
  650. }
  651. return adapter;
  652. }
  653. var defaults = {
  654. adapter: getDefaultAdapter(),
  655. transformRequest: [function transformRequest(data, headers) {
  656. normalizeHeaderName(headers, 'Content-Type');
  657. if (utils.isFormData(data) ||
  658. utils.isArrayBuffer(data) ||
  659. utils.isBuffer(data) ||
  660. utils.isStream(data) ||
  661. utils.isFile(data) ||
  662. utils.isBlob(data)
  663. ) {
  664. return data;
  665. }
  666. if (utils.isArrayBufferView(data)) {
  667. return data.buffer;
  668. }
  669. if (utils.isURLSearchParams(data)) {
  670. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  671. return data.toString();
  672. }
  673. if (utils.isObject(data)) {
  674. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  675. return JSON.stringify(data);
  676. }
  677. return data;
  678. }],
  679. transformResponse: [function transformResponse(data) {
  680. /*eslint no-param-reassign:0*/
  681. if (typeof data === 'string') {
  682. try {
  683. data = JSON.parse(data);
  684. } catch (e) { /* Ignore */ }
  685. }
  686. return data;
  687. }],
  688. /**
  689. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  690. * timeout is not created.
  691. */
  692. timeout: 0,
  693. xsrfCookieName: 'XSRF-TOKEN',
  694. xsrfHeaderName: 'X-XSRF-TOKEN',
  695. maxContentLength: -1,
  696. validateStatus: function validateStatus(status) {
  697. return status >= 200 && status < 300;
  698. }
  699. };
  700. defaults.headers = {
  701. common: {
  702. 'Accept': 'application/json, text/plain, */*'
  703. }
  704. };
  705. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  706. defaults.headers[method] = {};
  707. });
  708. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  709. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  710. });
  711. module.exports = defaults;
  712. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/process/browser.js")))
  713. /***/ }),
  714. /***/ "./node_modules/axios/lib/helpers/bind.js":
  715. /***/ (function(module, exports, __webpack_require__) {
  716. "use strict";
  717. module.exports = function bind(fn, thisArg) {
  718. return function wrap() {
  719. var args = new Array(arguments.length);
  720. for (var i = 0; i < args.length; i++) {
  721. args[i] = arguments[i];
  722. }
  723. return fn.apply(thisArg, args);
  724. };
  725. };
  726. /***/ }),
  727. /***/ "./node_modules/axios/lib/helpers/btoa.js":
  728. /***/ (function(module, exports, __webpack_require__) {
  729. "use strict";
  730. // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
  731. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  732. function E() {
  733. this.message = 'String contains an invalid character';
  734. }
  735. E.prototype = new Error;
  736. E.prototype.code = 5;
  737. E.prototype.name = 'InvalidCharacterError';
  738. function btoa(input) {
  739. var str = String(input);
  740. var output = '';
  741. for (
  742. // initialize result and counter
  743. var block, charCode, idx = 0, map = chars;
  744. // if the next str index does not exist:
  745. // change the mapping table to "="
  746. // check if d has no fractional digits
  747. str.charAt(idx | 0) || (map = '=', idx % 1);
  748. // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
  749. output += map.charAt(63 & block >> 8 - idx % 1 * 8)
  750. ) {
  751. charCode = str.charCodeAt(idx += 3 / 4);
  752. if (charCode > 0xFF) {
  753. throw new E();
  754. }
  755. block = block << 8 | charCode;
  756. }
  757. return output;
  758. }
  759. module.exports = btoa;
  760. /***/ }),
  761. /***/ "./node_modules/axios/lib/helpers/buildURL.js":
  762. /***/ (function(module, exports, __webpack_require__) {
  763. "use strict";
  764. var utils = __webpack_require__("./node_modules/axios/lib/utils.js");
  765. function encode(val) {
  766. return encodeURIComponent(val).
  767. replace(/%40/gi, '@').
  768. replace(/%3A/gi, ':').
  769. replace(/%24/g, '$').
  770. replace(/%2C/gi, ',').
  771. replace(/%20/g, '+').
  772. replace(/%5B/gi, '[').
  773. replace(/%5D/gi, ']');
  774. }
  775. /**
  776. * Build a URL by appending params to the end
  777. *
  778. * @param {string} url The base of the url (e.g., http://www.google.com)
  779. * @param {object} [params] The params to be appended
  780. * @returns {string} The formatted url
  781. */
  782. module.exports = function buildURL(url, params, paramsSerializer) {
  783. /*eslint no-param-reassign:0*/
  784. if (!params) {
  785. return url;
  786. }
  787. var serializedParams;
  788. if (paramsSerializer) {
  789. serializedParams = paramsSerializer(params);
  790. } else if (utils.isURLSearchParams(params)) {
  791. serializedParams = params.toString();
  792. } else {
  793. var parts = [];
  794. utils.forEach(params, function serialize(val, key) {
  795. if (val === null || typeof val === 'undefined') {
  796. return;
  797. }
  798. if (utils.isArray(val)) {
  799. key = key + '[]';
  800. } else {
  801. val = [val];
  802. }
  803. utils.forEach(val, function parseValue(v) {
  804. if (utils.isDate(v)) {
  805. v = v.toISOString();
  806. } else if (utils.isObject(v)) {
  807. v = JSON.stringify(v);
  808. }
  809. parts.push(encode(key) + '=' + encode(v));
  810. });
  811. });
  812. serializedParams = parts.join('&');
  813. }
  814. if (serializedParams) {
  815. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  816. }
  817. return url;
  818. };
  819. /***/ }),
  820. /***/ "./node_modules/axios/lib/helpers/combineURLs.js":
  821. /***/ (function(module, exports, __webpack_require__) {
  822. "use strict";
  823. /**
  824. * Creates a new URL by combining the specified URLs
  825. *
  826. * @param {string} baseURL The base URL
  827. * @param {string} relativeURL The relative URL
  828. * @returns {string} The combined URL
  829. */
  830. module.exports = function combineURLs(baseURL, relativeURL) {
  831. return relativeURL
  832. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  833. : baseURL;
  834. };
  835. /***/ }),
  836. /***/ "./node_modules/axios/lib/helpers/cookies.js":
  837. /***/ (function(module, exports, __webpack_require__) {
  838. "use strict";
  839. var utils = __webpack_require__("./node_modules/axios/lib/utils.js");
  840. module.exports = (
  841. utils.isStandardBrowserEnv() ?
  842. // Standard browser envs support document.cookie
  843. (function standardBrowserEnv() {
  844. return {
  845. write: function write(name, value, expires, path, domain, secure) {
  846. var cookie = [];
  847. cookie.push(name + '=' + encodeURIComponent(value));
  848. if (utils.isNumber(expires)) {
  849. cookie.push('expires=' + new Date(expires).toGMTString());
  850. }
  851. if (utils.isString(path)) {
  852. cookie.push('path=' + path);
  853. }
  854. if (utils.isString(domain)) {
  855. cookie.push('domain=' + domain);
  856. }
  857. if (secure === true) {
  858. cookie.push('secure');
  859. }
  860. document.cookie = cookie.join('; ');
  861. },
  862. read: function read(name) {
  863. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  864. return (match ? decodeURIComponent(match[3]) : null);
  865. },
  866. remove: function remove(name) {
  867. this.write(name, '', Date.now() - 86400000);
  868. }
  869. };
  870. })() :
  871. // Non standard browser env (web workers, react-native) lack needed support.
  872. (function nonStandardBrowserEnv() {
  873. return {
  874. write: function write() {},
  875. read: function read() { return null; },
  876. remove: function remove() {}
  877. };
  878. })()
  879. );
  880. /***/ }),
  881. /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
  882. /***/ (function(module, exports, __webpack_require__) {
  883. "use strict";
  884. /**
  885. * Determines whether the specified URL is absolute
  886. *
  887. * @param {string} url The URL to test
  888. * @returns {boolean} True if the specified URL is absolute, otherwise false
  889. */
  890. module.exports = function isAbsoluteURL(url) {
  891. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  892. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  893. // by any combination of letters, digits, plus, period, or hyphen.
  894. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  895. };
  896. /***/ }),
  897. /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
  898. /***/ (function(module, exports, __webpack_require__) {
  899. "use strict";
  900. var utils = __webpack_require__("./node_modules/axios/lib/utils.js");
  901. module.exports = (
  902. utils.isStandardBrowserEnv() ?
  903. // Standard browser envs have full support of the APIs needed to test
  904. // whether the request URL is of the same origin as current location.
  905. (function standardBrowserEnv() {
  906. var msie = /(msie|trident)/i.test(navigator.userAgent);
  907. var urlParsingNode = document.createElement('a');
  908. var originURL;
  909. /**
  910. * Parse a URL to discover it's components
  911. *
  912. * @param {String} url The URL to be parsed
  913. * @returns {Object}
  914. */
  915. function resolveURL(url) {
  916. var href = url;
  917. if (msie) {
  918. // IE needs attribute set twice to normalize properties
  919. urlParsingNode.setAttribute('href', href);
  920. href = urlParsingNode.href;
  921. }
  922. urlParsingNode.setAttribute('href', href);
  923. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  924. return {
  925. href: urlParsingNode.href,
  926. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  927. host: urlParsingNode.host,
  928. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  929. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  930. hostname: urlParsingNode.hostname,
  931. port: urlParsingNode.port,
  932. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  933. urlParsingNode.pathname :
  934. '/' + urlParsingNode.pathname
  935. };
  936. }
  937. originURL = resolveURL(window.location.href);
  938. /**
  939. * Determine if a URL shares the same origin as the current location
  940. *
  941. * @param {String} requestURL The URL to test
  942. * @returns {boolean} True if URL shares the same origin, otherwise false
  943. */
  944. return function isURLSameOrigin(requestURL) {
  945. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  946. return (parsed.protocol === originURL.protocol &&
  947. parsed.host === originURL.host);
  948. };
  949. })() :
  950. // Non standard browser envs (web workers, react-native) lack needed support.
  951. (function nonStandardBrowserEnv() {
  952. return function isURLSameOrigin() {
  953. return true;
  954. };
  955. })()
  956. );
  957. /***/ }),
  958. /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
  959. /***/ (function(module, exports, __webpack_require__) {
  960. "use strict";
  961. var utils = __webpack_require__("./node_modules/axios/lib/utils.js");
  962. module.exports = function normalizeHeaderName(headers, normalizedName) {
  963. utils.forEach(headers, function processHeader(value, name) {
  964. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  965. headers[normalizedName] = value;
  966. delete headers[name];
  967. }
  968. });
  969. };
  970. /***/ }),
  971. /***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
  972. /***/ (function(module, exports, __webpack_require__) {
  973. "use strict";
  974. var utils = __webpack_require__("./node_modules/axios/lib/utils.js");
  975. // Headers whose duplicates are ignored by node
  976. // c.f. https://nodejs.org/api/http.html#http_message_headers
  977. var ignoreDuplicateOf = [
  978. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  979. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  980. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  981. 'referer', 'retry-after', 'user-agent'
  982. ];
  983. /**
  984. * Parse headers into an object
  985. *
  986. * ```
  987. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  988. * Content-Type: application/json
  989. * Connection: keep-alive
  990. * Transfer-Encoding: chunked
  991. * ```
  992. *
  993. * @param {String} headers Headers needing to be parsed
  994. * @returns {Object} Headers parsed into an object
  995. */
  996. module.exports = function parseHeaders(headers) {
  997. var parsed = {};
  998. var key;
  999. var val;
  1000. var i;
  1001. if (!headers) { return parsed; }
  1002. utils.forEach(headers.split('\n'), function parser(line) {
  1003. i = line.indexOf(':');
  1004. key = utils.trim(line.substr(0, i)).toLowerCase();
  1005. val = utils.trim(line.substr(i + 1));
  1006. if (key) {
  1007. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1008. return;
  1009. }
  1010. if (key === 'set-cookie') {
  1011. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1012. } else {
  1013. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1014. }
  1015. }
  1016. });
  1017. return parsed;
  1018. };
  1019. /***/ }),
  1020. /***/ "./node_modules/axios/lib/helpers/spread.js":
  1021. /***/ (function(module, exports, __webpack_require__) {
  1022. "use strict";
  1023. /**
  1024. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1025. *
  1026. * Common use case would be to use `Function.prototype.apply`.
  1027. *
  1028. * ```js
  1029. * function f(x, y, z) {}
  1030. * var args = [1, 2, 3];
  1031. * f.apply(null, args);
  1032. * ```
  1033. *
  1034. * With `spread` this example can be re-written.
  1035. *
  1036. * ```js
  1037. * spread(function(x, y, z) {})([1, 2, 3]);
  1038. * ```
  1039. *
  1040. * @param {Function} callback
  1041. * @returns {Function}
  1042. */
  1043. module.exports = function spread(callback) {
  1044. return function wrap(arr) {
  1045. return callback.apply(null, arr);
  1046. };
  1047. };
  1048. /***/ }),
  1049. /***/ "./node_modules/axios/lib/utils.js":
  1050. /***/ (function(module, exports, __webpack_require__) {
  1051. "use strict";
  1052. var bind = __webpack_require__("./node_modules/axios/lib/helpers/bind.js");
  1053. var isBuffer = __webpack_require__("./node_modules/is-buffer/index.js");
  1054. /*global toString:true*/
  1055. // utils is a library of generic helper functions non-specific to axios
  1056. var toString = Object.prototype.toString;
  1057. /**
  1058. * Determine if a value is an Array
  1059. *
  1060. * @param {Object} val The value to test
  1061. * @returns {boolean} True if value is an Array, otherwise false
  1062. */
  1063. function isArray(val) {
  1064. return toString.call(val) === '[object Array]';
  1065. }
  1066. /**
  1067. * Determine if a value is an ArrayBuffer
  1068. *
  1069. * @param {Object} val The value to test
  1070. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  1071. */
  1072. function isArrayBuffer(val) {
  1073. return toString.call(val) === '[object ArrayBuffer]';
  1074. }
  1075. /**
  1076. * Determine if a value is a FormData
  1077. *
  1078. * @param {Object} val The value to test
  1079. * @returns {boolean} True if value is an FormData, otherwise false
  1080. */
  1081. function isFormData(val) {
  1082. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  1083. }
  1084. /**
  1085. * Determine if a value is a view on an ArrayBuffer
  1086. *
  1087. * @param {Object} val The value to test
  1088. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  1089. */
  1090. function isArrayBufferView(val) {
  1091. var result;
  1092. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1093. result = ArrayBuffer.isView(val);
  1094. } else {
  1095. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1096. }
  1097. return result;
  1098. }
  1099. /**
  1100. * Determine if a value is a String
  1101. *
  1102. * @param {Object} val The value to test
  1103. * @returns {boolean} True if value is a String, otherwise false
  1104. */
  1105. function isString(val) {
  1106. return typeof val === 'string';
  1107. }
  1108. /**
  1109. * Determine if a value is a Number
  1110. *
  1111. * @param {Object} val The value to test
  1112. * @returns {boolean} True if value is a Number, otherwise false
  1113. */
  1114. function isNumber(val) {
  1115. return typeof val === 'number';
  1116. }
  1117. /**
  1118. * Determine if a value is undefined
  1119. *
  1120. * @param {Object} val The value to test
  1121. * @returns {boolean} True if the value is undefined, otherwise false
  1122. */
  1123. function isUndefined(val) {
  1124. return typeof val === 'undefined';
  1125. }
  1126. /**
  1127. * Determine if a value is an Object
  1128. *
  1129. * @param {Object} val The value to test
  1130. * @returns {boolean} True if value is an Object, otherwise false
  1131. */
  1132. function isObject(val) {
  1133. return val !== null && typeof val === 'object';
  1134. }
  1135. /**
  1136. * Determine if a value is a Date
  1137. *
  1138. * @param {Object} val The value to test
  1139. * @returns {boolean} True if value is a Date, otherwise false
  1140. */
  1141. function isDate(val) {
  1142. return toString.call(val) === '[object Date]';
  1143. }
  1144. /**
  1145. * Determine if a value is a File
  1146. *
  1147. * @param {Object} val The value to test
  1148. * @returns {boolean} True if value is a File, otherwise false
  1149. */
  1150. function isFile(val) {
  1151. return toString.call(val) === '[object File]';
  1152. }
  1153. /**
  1154. * Determine if a value is a Blob
  1155. *
  1156. * @param {Object} val The value to test
  1157. * @returns {boolean} True if value is a Blob, otherwise false
  1158. */
  1159. function isBlob(val) {
  1160. return toString.call(val) === '[object Blob]';
  1161. }
  1162. /**
  1163. * Determine if a value is a Function
  1164. *
  1165. * @param {Object} val The value to test
  1166. * @returns {boolean} True if value is a Function, otherwise false
  1167. */
  1168. function isFunction(val) {
  1169. return toString.call(val) === '[object Function]';
  1170. }
  1171. /**
  1172. * Determine if a value is a Stream
  1173. *
  1174. * @param {Object} val The value to test
  1175. * @returns {boolean} True if value is a Stream, otherwise false
  1176. */
  1177. function isStream(val) {
  1178. return isObject(val) && isFunction(val.pipe);
  1179. }
  1180. /**
  1181. * Determine if a value is a URLSearchParams object
  1182. *
  1183. * @param {Object} val The value to test
  1184. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1185. */
  1186. function isURLSearchParams(val) {
  1187. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1188. }
  1189. /**
  1190. * Trim excess whitespace off the beginning and end of a string
  1191. *
  1192. * @param {String} str The String to trim
  1193. * @returns {String} The String freed of excess whitespace
  1194. */
  1195. function trim(str) {
  1196. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1197. }
  1198. /**
  1199. * Determine if we're running in a standard browser environment
  1200. *
  1201. * This allows axios to run in a web worker, and react-native.
  1202. * Both environments support XMLHttpRequest, but not fully standard globals.
  1203. *
  1204. * web workers:
  1205. * typeof window -> undefined
  1206. * typeof document -> undefined
  1207. *
  1208. * react-native:
  1209. * navigator.product -> 'ReactNative'
  1210. */
  1211. function isStandardBrowserEnv() {
  1212. if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
  1213. return false;
  1214. }
  1215. return (
  1216. typeof window !== 'undefined' &&
  1217. typeof document !== 'undefined'
  1218. );
  1219. }
  1220. /**
  1221. * Iterate over an Array or an Object invoking a function for each item.
  1222. *
  1223. * If `obj` is an Array callback will be called passing
  1224. * the value, index, and complete array for each item.
  1225. *
  1226. * If 'obj' is an Object callback will be called passing
  1227. * the value, key, and complete object for each property.
  1228. *
  1229. * @param {Object|Array} obj The object to iterate
  1230. * @param {Function} fn The callback to invoke for each item
  1231. */
  1232. function forEach(obj, fn) {
  1233. // Don't bother if no value provided
  1234. if (obj === null || typeof obj === 'undefined') {
  1235. return;
  1236. }
  1237. // Force an array if not already something iterable
  1238. if (typeof obj !== 'object') {
  1239. /*eslint no-param-reassign:0*/
  1240. obj = [obj];
  1241. }
  1242. if (isArray(obj)) {
  1243. // Iterate over array values
  1244. for (var i = 0, l = obj.length; i < l; i++) {
  1245. fn.call(null, obj[i], i, obj);
  1246. }
  1247. } else {
  1248. // Iterate over object keys
  1249. for (var key in obj) {
  1250. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1251. fn.call(null, obj[key], key, obj);
  1252. }
  1253. }
  1254. }
  1255. }
  1256. /**
  1257. * Accepts varargs expecting each argument to be an object, then
  1258. * immutably merges the properties of each object and returns result.
  1259. *
  1260. * When multiple objects contain the same key the later object in
  1261. * the arguments list will take precedence.
  1262. *
  1263. * Example:
  1264. *
  1265. * ```js
  1266. * var result = merge({foo: 123}, {foo: 456});
  1267. * console.log(result.foo); // outputs 456
  1268. * ```
  1269. *
  1270. * @param {Object} obj1 Object to merge
  1271. * @returns {Object} Result of all merge properties
  1272. */
  1273. function merge(/* obj1, obj2, obj3, ... */) {
  1274. var result = {};
  1275. function assignValue(val, key) {
  1276. if (typeof result[key] === 'object' && typeof val === 'object') {
  1277. result[key] = merge(result[key], val);
  1278. } else {
  1279. result[key] = val;
  1280. }
  1281. }
  1282. for (var i = 0, l = arguments.length; i < l; i++) {
  1283. forEach(arguments[i], assignValue);
  1284. }
  1285. return result;
  1286. }
  1287. /**
  1288. * Extends object a by mutably adding to it the properties of object b.
  1289. *
  1290. * @param {Object} a The object to be extended
  1291. * @param {Object} b The object to copy properties from
  1292. * @param {Object} thisArg The object to bind function to
  1293. * @return {Object} The resulting value of object a
  1294. */
  1295. function extend(a, b, thisArg) {
  1296. forEach(b, function assignValue(val, key) {
  1297. if (thisArg && typeof val === 'function') {
  1298. a[key] = bind(val, thisArg);
  1299. } else {
  1300. a[key] = val;
  1301. }
  1302. });
  1303. return a;
  1304. }
  1305. module.exports = {
  1306. isArray: isArray,
  1307. isArrayBuffer: isArrayBuffer,
  1308. isBuffer: isBuffer,
  1309. isFormData: isFormData,
  1310. isArrayBufferView: isArrayBufferView,
  1311. isString: isString,
  1312. isNumber: isNumber,
  1313. isObject: isObject,
  1314. isUndefined: isUndefined,
  1315. isDate: isDate,
  1316. isFile: isFile,
  1317. isBlob: isBlob,
  1318. isFunction: isFunction,
  1319. isStream: isStream,
  1320. isURLSearchParams: isURLSearchParams,
  1321. isStandardBrowserEnv: isStandardBrowserEnv,
  1322. forEach: forEach,
  1323. merge: merge,
  1324. extend: extend,
  1325. trim: trim
  1326. };
  1327. /***/ }),
  1328. /***/ "./node_modules/babel-loader/lib/index.js?{\"cacheDirectory\":true,\"presets\":[[\"env\",{\"modules\":false,\"targets\":{\"browsers\":[\"> 2%\"],\"uglify\":true}}]],\"plugins\":[\"transform-object-rest-spread\",[\"transform-runtime\",{\"polyfill\":false,\"helpers\":false}]]}!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./resources/assets/js/components/ExampleComponent.vue":
  1329. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1330. "use strict";
  1331. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  1332. //
  1333. //
  1334. //
  1335. //
  1336. //
  1337. //
  1338. //
  1339. //
  1340. //
  1341. //
  1342. //
  1343. //
  1344. //
  1345. //
  1346. //
  1347. //
  1348. /* harmony default export */ __webpack_exports__["default"] = ({
  1349. mounted: function mounted() {
  1350. console.log('Component mounted.');
  1351. }
  1352. });
  1353. /***/ }),
  1354. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  1355. /***/ (function(module, exports, __webpack_require__) {
  1356. /*!
  1357. * Bootstrap v4.3.1 (https://getbootstrap.com/)
  1358. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  1359. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1360. */
  1361. (function (global, factory) {
  1362. true ? factory(exports, __webpack_require__("./node_modules/jquery/dist/jquery.js"), __webpack_require__("./node_modules/popper.js/dist/esm/popper.js")) :
  1363. typeof define === 'function' && define.amd ? define(['exports', 'jquery', 'popper.js'], factory) :
  1364. (global = global || self, factory(global.bootstrap = {}, global.jQuery, global.Popper));
  1365. }(this, function (exports, $, Popper) { 'use strict';
  1366. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  1367. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  1368. function _defineProperties(target, props) {
  1369. for (var i = 0; i < props.length; i++) {
  1370. var descriptor = props[i];
  1371. descriptor.enumerable = descriptor.enumerable || false;
  1372. descriptor.configurable = true;
  1373. if ("value" in descriptor) descriptor.writable = true;
  1374. Object.defineProperty(target, descriptor.key, descriptor);
  1375. }
  1376. }
  1377. function _createClass(Constructor, protoProps, staticProps) {
  1378. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  1379. if (staticProps) _defineProperties(Constructor, staticProps);
  1380. return Constructor;
  1381. }
  1382. function _defineProperty(obj, key, value) {
  1383. if (key in obj) {
  1384. Object.defineProperty(obj, key, {
  1385. value: value,
  1386. enumerable: true,
  1387. configurable: true,
  1388. writable: true
  1389. });
  1390. } else {
  1391. obj[key] = value;
  1392. }
  1393. return obj;
  1394. }
  1395. function _objectSpread(target) {
  1396. for (var i = 1; i < arguments.length; i++) {
  1397. var source = arguments[i] != null ? arguments[i] : {};
  1398. var ownKeys = Object.keys(source);
  1399. if (typeof Object.getOwnPropertySymbols === 'function') {
  1400. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
  1401. return Object.getOwnPropertyDescriptor(source, sym).enumerable;
  1402. }));
  1403. }
  1404. ownKeys.forEach(function (key) {
  1405. _defineProperty(target, key, source[key]);
  1406. });
  1407. }
  1408. return target;
  1409. }
  1410. function _inheritsLoose(subClass, superClass) {
  1411. subClass.prototype = Object.create(superClass.prototype);
  1412. subClass.prototype.constructor = subClass;
  1413. subClass.__proto__ = superClass;
  1414. }
  1415. /**
  1416. * --------------------------------------------------------------------------
  1417. * Bootstrap (v4.3.1): util.js
  1418. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1419. * --------------------------------------------------------------------------
  1420. */
  1421. /**
  1422. * ------------------------------------------------------------------------
  1423. * Private TransitionEnd Helpers
  1424. * ------------------------------------------------------------------------
  1425. */
  1426. var TRANSITION_END = 'transitionend';
  1427. var MAX_UID = 1000000;
  1428. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  1429. function toType(obj) {
  1430. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  1431. }
  1432. function getSpecialTransitionEndEvent() {
  1433. return {
  1434. bindType: TRANSITION_END,
  1435. delegateType: TRANSITION_END,
  1436. handle: function handle(event) {
  1437. if ($(event.target).is(this)) {
  1438. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  1439. }
  1440. return undefined; // eslint-disable-line no-undefined
  1441. }
  1442. };
  1443. }
  1444. function transitionEndEmulator(duration) {
  1445. var _this = this;
  1446. var called = false;
  1447. $(this).one(Util.TRANSITION_END, function () {
  1448. called = true;
  1449. });
  1450. setTimeout(function () {
  1451. if (!called) {
  1452. Util.triggerTransitionEnd(_this);
  1453. }
  1454. }, duration);
  1455. return this;
  1456. }
  1457. function setTransitionEndSupport() {
  1458. $.fn.emulateTransitionEnd = transitionEndEmulator;
  1459. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  1460. }
  1461. /**
  1462. * --------------------------------------------------------------------------
  1463. * Public Util Api
  1464. * --------------------------------------------------------------------------
  1465. */
  1466. var Util = {
  1467. TRANSITION_END: 'bsTransitionEnd',
  1468. getUID: function getUID(prefix) {
  1469. do {
  1470. // eslint-disable-next-line no-bitwise
  1471. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  1472. } while (document.getElementById(prefix));
  1473. return prefix;
  1474. },
  1475. getSelectorFromElement: function getSelectorFromElement(element) {
  1476. var selector = element.getAttribute('data-target');
  1477. if (!selector || selector === '#') {
  1478. var hrefAttr = element.getAttribute('href');
  1479. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  1480. }
  1481. try {
  1482. return document.querySelector(selector) ? selector : null;
  1483. } catch (err) {
  1484. return null;
  1485. }
  1486. },
  1487. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  1488. if (!element) {
  1489. return 0;
  1490. } // Get transition-duration of the element
  1491. var transitionDuration = $(element).css('transition-duration');
  1492. var transitionDelay = $(element).css('transition-delay');
  1493. var floatTransitionDuration = parseFloat(transitionDuration);
  1494. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  1495. if (!floatTransitionDuration && !floatTransitionDelay) {
  1496. return 0;
  1497. } // If multiple durations are defined, take the first
  1498. transitionDuration = transitionDuration.split(',')[0];
  1499. transitionDelay = transitionDelay.split(',')[0];
  1500. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  1501. },
  1502. reflow: function reflow(element) {
  1503. return element.offsetHeight;
  1504. },
  1505. triggerTransitionEnd: function triggerTransitionEnd(element) {
  1506. $(element).trigger(TRANSITION_END);
  1507. },
  1508. // TODO: Remove in v5
  1509. supportsTransitionEnd: function supportsTransitionEnd() {
  1510. return Boolean(TRANSITION_END);
  1511. },
  1512. isElement: function isElement(obj) {
  1513. return (obj[0] || obj).nodeType;
  1514. },
  1515. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  1516. for (var property in configTypes) {
  1517. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  1518. var expectedTypes = configTypes[property];
  1519. var value = config[property];
  1520. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  1521. if (!new RegExp(expectedTypes).test(valueType)) {
  1522. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  1523. }
  1524. }
  1525. }
  1526. },
  1527. findShadowRoot: function findShadowRoot(element) {
  1528. if (!document.documentElement.attachShadow) {
  1529. return null;
  1530. } // Can find the shadow root otherwise it'll return the document
  1531. if (typeof element.getRootNode === 'function') {
  1532. var root = element.getRootNode();
  1533. return root instanceof ShadowRoot ? root : null;
  1534. }
  1535. if (element instanceof ShadowRoot) {
  1536. return element;
  1537. } // when we don't find a shadow root
  1538. if (!element.parentNode) {
  1539. return null;
  1540. }
  1541. return Util.findShadowRoot(element.parentNode);
  1542. }
  1543. };
  1544. setTransitionEndSupport();
  1545. /**
  1546. * ------------------------------------------------------------------------
  1547. * Constants
  1548. * ------------------------------------------------------------------------
  1549. */
  1550. var NAME = 'alert';
  1551. var VERSION = '4.3.1';
  1552. var DATA_KEY = 'bs.alert';
  1553. var EVENT_KEY = "." + DATA_KEY;
  1554. var DATA_API_KEY = '.data-api';
  1555. var JQUERY_NO_CONFLICT = $.fn[NAME];
  1556. var Selector = {
  1557. DISMISS: '[data-dismiss="alert"]'
  1558. };
  1559. var Event = {
  1560. CLOSE: "close" + EVENT_KEY,
  1561. CLOSED: "closed" + EVENT_KEY,
  1562. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  1563. };
  1564. var ClassName = {
  1565. ALERT: 'alert',
  1566. FADE: 'fade',
  1567. SHOW: 'show'
  1568. /**
  1569. * ------------------------------------------------------------------------
  1570. * Class Definition
  1571. * ------------------------------------------------------------------------
  1572. */
  1573. };
  1574. var Alert =
  1575. /*#__PURE__*/
  1576. function () {
  1577. function Alert(element) {
  1578. this._element = element;
  1579. } // Getters
  1580. var _proto = Alert.prototype;
  1581. // Public
  1582. _proto.close = function close(element) {
  1583. var rootElement = this._element;
  1584. if (element) {
  1585. rootElement = this._getRootElement(element);
  1586. }
  1587. var customEvent = this._triggerCloseEvent(rootElement);
  1588. if (customEvent.isDefaultPrevented()) {
  1589. return;
  1590. }
  1591. this._removeElement(rootElement);
  1592. };
  1593. _proto.dispose = function dispose() {
  1594. $.removeData(this._element, DATA_KEY);
  1595. this._element = null;
  1596. } // Private
  1597. ;
  1598. _proto._getRootElement = function _getRootElement(element) {
  1599. var selector = Util.getSelectorFromElement(element);
  1600. var parent = false;
  1601. if (selector) {
  1602. parent = document.querySelector(selector);
  1603. }
  1604. if (!parent) {
  1605. parent = $(element).closest("." + ClassName.ALERT)[0];
  1606. }
  1607. return parent;
  1608. };
  1609. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  1610. var closeEvent = $.Event(Event.CLOSE);
  1611. $(element).trigger(closeEvent);
  1612. return closeEvent;
  1613. };
  1614. _proto._removeElement = function _removeElement(element) {
  1615. var _this = this;
  1616. $(element).removeClass(ClassName.SHOW);
  1617. if (!$(element).hasClass(ClassName.FADE)) {
  1618. this._destroyElement(element);
  1619. return;
  1620. }
  1621. var transitionDuration = Util.getTransitionDurationFromElement(element);
  1622. $(element).one(Util.TRANSITION_END, function (event) {
  1623. return _this._destroyElement(element, event);
  1624. }).emulateTransitionEnd(transitionDuration);
  1625. };
  1626. _proto._destroyElement = function _destroyElement(element) {
  1627. $(element).detach().trigger(Event.CLOSED).remove();
  1628. } // Static
  1629. ;
  1630. Alert._jQueryInterface = function _jQueryInterface(config) {
  1631. return this.each(function () {
  1632. var $element = $(this);
  1633. var data = $element.data(DATA_KEY);
  1634. if (!data) {
  1635. data = new Alert(this);
  1636. $element.data(DATA_KEY, data);
  1637. }
  1638. if (config === 'close') {
  1639. data[config](this);
  1640. }
  1641. });
  1642. };
  1643. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  1644. return function (event) {
  1645. if (event) {
  1646. event.preventDefault();
  1647. }
  1648. alertInstance.close(this);
  1649. };
  1650. };
  1651. _createClass(Alert, null, [{
  1652. key: "VERSION",
  1653. get: function get() {
  1654. return VERSION;
  1655. }
  1656. }]);
  1657. return Alert;
  1658. }();
  1659. /**
  1660. * ------------------------------------------------------------------------
  1661. * Data Api implementation
  1662. * ------------------------------------------------------------------------
  1663. */
  1664. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  1665. /**
  1666. * ------------------------------------------------------------------------
  1667. * jQuery
  1668. * ------------------------------------------------------------------------
  1669. */
  1670. $.fn[NAME] = Alert._jQueryInterface;
  1671. $.fn[NAME].Constructor = Alert;
  1672. $.fn[NAME].noConflict = function () {
  1673. $.fn[NAME] = JQUERY_NO_CONFLICT;
  1674. return Alert._jQueryInterface;
  1675. };
  1676. /**
  1677. * ------------------------------------------------------------------------
  1678. * Constants
  1679. * ------------------------------------------------------------------------
  1680. */
  1681. var NAME$1 = 'button';
  1682. var VERSION$1 = '4.3.1';
  1683. var DATA_KEY$1 = 'bs.button';
  1684. var EVENT_KEY$1 = "." + DATA_KEY$1;
  1685. var DATA_API_KEY$1 = '.data-api';
  1686. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  1687. var ClassName$1 = {
  1688. ACTIVE: 'active',
  1689. BUTTON: 'btn',
  1690. FOCUS: 'focus'
  1691. };
  1692. var Selector$1 = {
  1693. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  1694. DATA_TOGGLE: '[data-toggle="buttons"]',
  1695. INPUT: 'input:not([type="hidden"])',
  1696. ACTIVE: '.active',
  1697. BUTTON: '.btn'
  1698. };
  1699. var Event$1 = {
  1700. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  1701. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1)
  1702. /**
  1703. * ------------------------------------------------------------------------
  1704. * Class Definition
  1705. * ------------------------------------------------------------------------
  1706. */
  1707. };
  1708. var Button =
  1709. /*#__PURE__*/
  1710. function () {
  1711. function Button(element) {
  1712. this._element = element;
  1713. } // Getters
  1714. var _proto = Button.prototype;
  1715. // Public
  1716. _proto.toggle = function toggle() {
  1717. var triggerChangeEvent = true;
  1718. var addAriaPressed = true;
  1719. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLE)[0];
  1720. if (rootElement) {
  1721. var input = this._element.querySelector(Selector$1.INPUT);
  1722. if (input) {
  1723. if (input.type === 'radio') {
  1724. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  1725. triggerChangeEvent = false;
  1726. } else {
  1727. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  1728. if (activeElement) {
  1729. $(activeElement).removeClass(ClassName$1.ACTIVE);
  1730. }
  1731. }
  1732. }
  1733. if (triggerChangeEvent) {
  1734. if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
  1735. return;
  1736. }
  1737. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  1738. $(input).trigger('change');
  1739. }
  1740. input.focus();
  1741. addAriaPressed = false;
  1742. }
  1743. }
  1744. if (addAriaPressed) {
  1745. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  1746. }
  1747. if (triggerChangeEvent) {
  1748. $(this._element).toggleClass(ClassName$1.ACTIVE);
  1749. }
  1750. };
  1751. _proto.dispose = function dispose() {
  1752. $.removeData(this._element, DATA_KEY$1);
  1753. this._element = null;
  1754. } // Static
  1755. ;
  1756. Button._jQueryInterface = function _jQueryInterface(config) {
  1757. return this.each(function () {
  1758. var data = $(this).data(DATA_KEY$1);
  1759. if (!data) {
  1760. data = new Button(this);
  1761. $(this).data(DATA_KEY$1, data);
  1762. }
  1763. if (config === 'toggle') {
  1764. data[config]();
  1765. }
  1766. });
  1767. };
  1768. _createClass(Button, null, [{
  1769. key: "VERSION",
  1770. get: function get() {
  1771. return VERSION$1;
  1772. }
  1773. }]);
  1774. return Button;
  1775. }();
  1776. /**
  1777. * ------------------------------------------------------------------------
  1778. * Data Api implementation
  1779. * ------------------------------------------------------------------------
  1780. */
  1781. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  1782. event.preventDefault();
  1783. var button = event.target;
  1784. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  1785. button = $(button).closest(Selector$1.BUTTON);
  1786. }
  1787. Button._jQueryInterface.call($(button), 'toggle');
  1788. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  1789. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  1790. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  1791. });
  1792. /**
  1793. * ------------------------------------------------------------------------
  1794. * jQuery
  1795. * ------------------------------------------------------------------------
  1796. */
  1797. $.fn[NAME$1] = Button._jQueryInterface;
  1798. $.fn[NAME$1].Constructor = Button;
  1799. $.fn[NAME$1].noConflict = function () {
  1800. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  1801. return Button._jQueryInterface;
  1802. };
  1803. /**
  1804. * ------------------------------------------------------------------------
  1805. * Constants
  1806. * ------------------------------------------------------------------------
  1807. */
  1808. var NAME$2 = 'carousel';
  1809. var VERSION$2 = '4.3.1';
  1810. var DATA_KEY$2 = 'bs.carousel';
  1811. var EVENT_KEY$2 = "." + DATA_KEY$2;
  1812. var DATA_API_KEY$2 = '.data-api';
  1813. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  1814. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  1815. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  1816. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  1817. var SWIPE_THRESHOLD = 40;
  1818. var Default = {
  1819. interval: 5000,
  1820. keyboard: true,
  1821. slide: false,
  1822. pause: 'hover',
  1823. wrap: true,
  1824. touch: true
  1825. };
  1826. var DefaultType = {
  1827. interval: '(number|boolean)',
  1828. keyboard: 'boolean',
  1829. slide: '(boolean|string)',
  1830. pause: '(string|boolean)',
  1831. wrap: 'boolean',
  1832. touch: 'boolean'
  1833. };
  1834. var Direction = {
  1835. NEXT: 'next',
  1836. PREV: 'prev',
  1837. LEFT: 'left',
  1838. RIGHT: 'right'
  1839. };
  1840. var Event$2 = {
  1841. SLIDE: "slide" + EVENT_KEY$2,
  1842. SLID: "slid" + EVENT_KEY$2,
  1843. KEYDOWN: "keydown" + EVENT_KEY$2,
  1844. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  1845. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  1846. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  1847. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  1848. TOUCHEND: "touchend" + EVENT_KEY$2,
  1849. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  1850. POINTERUP: "pointerup" + EVENT_KEY$2,
  1851. DRAG_START: "dragstart" + EVENT_KEY$2,
  1852. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  1853. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  1854. };
  1855. var ClassName$2 = {
  1856. CAROUSEL: 'carousel',
  1857. ACTIVE: 'active',
  1858. SLIDE: 'slide',
  1859. RIGHT: 'carousel-item-right',
  1860. LEFT: 'carousel-item-left',
  1861. NEXT: 'carousel-item-next',
  1862. PREV: 'carousel-item-prev',
  1863. ITEM: 'carousel-item',
  1864. POINTER_EVENT: 'pointer-event'
  1865. };
  1866. var Selector$2 = {
  1867. ACTIVE: '.active',
  1868. ACTIVE_ITEM: '.active.carousel-item',
  1869. ITEM: '.carousel-item',
  1870. ITEM_IMG: '.carousel-item img',
  1871. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  1872. INDICATORS: '.carousel-indicators',
  1873. DATA_SLIDE: '[data-slide], [data-slide-to]',
  1874. DATA_RIDE: '[data-ride="carousel"]'
  1875. };
  1876. var PointerType = {
  1877. TOUCH: 'touch',
  1878. PEN: 'pen'
  1879. /**
  1880. * ------------------------------------------------------------------------
  1881. * Class Definition
  1882. * ------------------------------------------------------------------------
  1883. */
  1884. };
  1885. var Carousel =
  1886. /*#__PURE__*/
  1887. function () {
  1888. function Carousel(element, config) {
  1889. this._items = null;
  1890. this._interval = null;
  1891. this._activeElement = null;
  1892. this._isPaused = false;
  1893. this._isSliding = false;
  1894. this.touchTimeout = null;
  1895. this.touchStartX = 0;
  1896. this.touchDeltaX = 0;
  1897. this._config = this._getConfig(config);
  1898. this._element = element;
  1899. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  1900. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  1901. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  1902. this._addEventListeners();
  1903. } // Getters
  1904. var _proto = Carousel.prototype;
  1905. // Public
  1906. _proto.next = function next() {
  1907. if (!this._isSliding) {
  1908. this._slide(Direction.NEXT);
  1909. }
  1910. };
  1911. _proto.nextWhenVisible = function nextWhenVisible() {
  1912. // Don't call next when the page isn't visible
  1913. // or the carousel or its parent isn't visible
  1914. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  1915. this.next();
  1916. }
  1917. };
  1918. _proto.prev = function prev() {
  1919. if (!this._isSliding) {
  1920. this._slide(Direction.PREV);
  1921. }
  1922. };
  1923. _proto.pause = function pause(event) {
  1924. if (!event) {
  1925. this._isPaused = true;
  1926. }
  1927. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  1928. Util.triggerTransitionEnd(this._element);
  1929. this.cycle(true);
  1930. }
  1931. clearInterval(this._interval);
  1932. this._interval = null;
  1933. };
  1934. _proto.cycle = function cycle(event) {
  1935. if (!event) {
  1936. this._isPaused = false;
  1937. }
  1938. if (this._interval) {
  1939. clearInterval(this._interval);
  1940. this._interval = null;
  1941. }
  1942. if (this._config.interval && !this._isPaused) {
  1943. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  1944. }
  1945. };
  1946. _proto.to = function to(index) {
  1947. var _this = this;
  1948. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  1949. var activeIndex = this._getItemIndex(this._activeElement);
  1950. if (index > this._items.length - 1 || index < 0) {
  1951. return;
  1952. }
  1953. if (this._isSliding) {
  1954. $(this._element).one(Event$2.SLID, function () {
  1955. return _this.to(index);
  1956. });
  1957. return;
  1958. }
  1959. if (activeIndex === index) {
  1960. this.pause();
  1961. this.cycle();
  1962. return;
  1963. }
  1964. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  1965. this._slide(direction, this._items[index]);
  1966. };
  1967. _proto.dispose = function dispose() {
  1968. $(this._element).off(EVENT_KEY$2);
  1969. $.removeData(this._element, DATA_KEY$2);
  1970. this._items = null;
  1971. this._config = null;
  1972. this._element = null;
  1973. this._interval = null;
  1974. this._isPaused = null;
  1975. this._isSliding = null;
  1976. this._activeElement = null;
  1977. this._indicatorsElement = null;
  1978. } // Private
  1979. ;
  1980. _proto._getConfig = function _getConfig(config) {
  1981. config = _objectSpread({}, Default, config);
  1982. Util.typeCheckConfig(NAME$2, config, DefaultType);
  1983. return config;
  1984. };
  1985. _proto._handleSwipe = function _handleSwipe() {
  1986. var absDeltax = Math.abs(this.touchDeltaX);
  1987. if (absDeltax <= SWIPE_THRESHOLD) {
  1988. return;
  1989. }
  1990. var direction = absDeltax / this.touchDeltaX; // swipe left
  1991. if (direction > 0) {
  1992. this.prev();
  1993. } // swipe right
  1994. if (direction < 0) {
  1995. this.next();
  1996. }
  1997. };
  1998. _proto._addEventListeners = function _addEventListeners() {
  1999. var _this2 = this;
  2000. if (this._config.keyboard) {
  2001. $(this._element).on(Event$2.KEYDOWN, function (event) {
  2002. return _this2._keydown(event);
  2003. });
  2004. }
  2005. if (this._config.pause === 'hover') {
  2006. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  2007. return _this2.pause(event);
  2008. }).on(Event$2.MOUSELEAVE, function (event) {
  2009. return _this2.cycle(event);
  2010. });
  2011. }
  2012. if (this._config.touch) {
  2013. this._addTouchEventListeners();
  2014. }
  2015. };
  2016. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  2017. var _this3 = this;
  2018. if (!this._touchSupported) {
  2019. return;
  2020. }
  2021. var start = function start(event) {
  2022. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2023. _this3.touchStartX = event.originalEvent.clientX;
  2024. } else if (!_this3._pointerEvent) {
  2025. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  2026. }
  2027. };
  2028. var move = function move(event) {
  2029. // ensure swiping with one touch and not pinching
  2030. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  2031. _this3.touchDeltaX = 0;
  2032. } else {
  2033. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  2034. }
  2035. };
  2036. var end = function end(event) {
  2037. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2038. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  2039. }
  2040. _this3._handleSwipe();
  2041. if (_this3._config.pause === 'hover') {
  2042. // If it's a touch-enabled device, mouseenter/leave are fired as
  2043. // part of the mouse compatibility events on first tap - the carousel
  2044. // would stop cycling until user tapped out of it;
  2045. // here, we listen for touchend, explicitly pause the carousel
  2046. // (as if it's the second time we tap on it, mouseenter compat event
  2047. // is NOT fired) and after a timeout (to allow for mouse compatibility
  2048. // events to fire) we explicitly restart cycling
  2049. _this3.pause();
  2050. if (_this3.touchTimeout) {
  2051. clearTimeout(_this3.touchTimeout);
  2052. }
  2053. _this3.touchTimeout = setTimeout(function (event) {
  2054. return _this3.cycle(event);
  2055. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  2056. }
  2057. };
  2058. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  2059. return e.preventDefault();
  2060. });
  2061. if (this._pointerEvent) {
  2062. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  2063. return start(event);
  2064. });
  2065. $(this._element).on(Event$2.POINTERUP, function (event) {
  2066. return end(event);
  2067. });
  2068. this._element.classList.add(ClassName$2.POINTER_EVENT);
  2069. } else {
  2070. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  2071. return start(event);
  2072. });
  2073. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  2074. return move(event);
  2075. });
  2076. $(this._element).on(Event$2.TOUCHEND, function (event) {
  2077. return end(event);
  2078. });
  2079. }
  2080. };
  2081. _proto._keydown = function _keydown(event) {
  2082. if (/input|textarea/i.test(event.target.tagName)) {
  2083. return;
  2084. }
  2085. switch (event.which) {
  2086. case ARROW_LEFT_KEYCODE:
  2087. event.preventDefault();
  2088. this.prev();
  2089. break;
  2090. case ARROW_RIGHT_KEYCODE:
  2091. event.preventDefault();
  2092. this.next();
  2093. break;
  2094. default:
  2095. }
  2096. };
  2097. _proto._getItemIndex = function _getItemIndex(element) {
  2098. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  2099. return this._items.indexOf(element);
  2100. };
  2101. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  2102. var isNextDirection = direction === Direction.NEXT;
  2103. var isPrevDirection = direction === Direction.PREV;
  2104. var activeIndex = this._getItemIndex(activeElement);
  2105. var lastItemIndex = this._items.length - 1;
  2106. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  2107. if (isGoingToWrap && !this._config.wrap) {
  2108. return activeElement;
  2109. }
  2110. var delta = direction === Direction.PREV ? -1 : 1;
  2111. var itemIndex = (activeIndex + delta) % this._items.length;
  2112. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  2113. };
  2114. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  2115. var targetIndex = this._getItemIndex(relatedTarget);
  2116. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  2117. var slideEvent = $.Event(Event$2.SLIDE, {
  2118. relatedTarget: relatedTarget,
  2119. direction: eventDirectionName,
  2120. from: fromIndex,
  2121. to: targetIndex
  2122. });
  2123. $(this._element).trigger(slideEvent);
  2124. return slideEvent;
  2125. };
  2126. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  2127. if (this._indicatorsElement) {
  2128. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  2129. $(indicators).removeClass(ClassName$2.ACTIVE);
  2130. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  2131. if (nextIndicator) {
  2132. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  2133. }
  2134. }
  2135. };
  2136. _proto._slide = function _slide(direction, element) {
  2137. var _this4 = this;
  2138. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2139. var activeElementIndex = this._getItemIndex(activeElement);
  2140. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  2141. var nextElementIndex = this._getItemIndex(nextElement);
  2142. var isCycling = Boolean(this._interval);
  2143. var directionalClassName;
  2144. var orderClassName;
  2145. var eventDirectionName;
  2146. if (direction === Direction.NEXT) {
  2147. directionalClassName = ClassName$2.LEFT;
  2148. orderClassName = ClassName$2.NEXT;
  2149. eventDirectionName = Direction.LEFT;
  2150. } else {
  2151. directionalClassName = ClassName$2.RIGHT;
  2152. orderClassName = ClassName$2.PREV;
  2153. eventDirectionName = Direction.RIGHT;
  2154. }
  2155. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  2156. this._isSliding = false;
  2157. return;
  2158. }
  2159. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  2160. if (slideEvent.isDefaultPrevented()) {
  2161. return;
  2162. }
  2163. if (!activeElement || !nextElement) {
  2164. // Some weirdness is happening, so we bail
  2165. return;
  2166. }
  2167. this._isSliding = true;
  2168. if (isCycling) {
  2169. this.pause();
  2170. }
  2171. this._setActiveIndicatorElement(nextElement);
  2172. var slidEvent = $.Event(Event$2.SLID, {
  2173. relatedTarget: nextElement,
  2174. direction: eventDirectionName,
  2175. from: activeElementIndex,
  2176. to: nextElementIndex
  2177. });
  2178. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  2179. $(nextElement).addClass(orderClassName);
  2180. Util.reflow(nextElement);
  2181. $(activeElement).addClass(directionalClassName);
  2182. $(nextElement).addClass(directionalClassName);
  2183. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  2184. if (nextElementInterval) {
  2185. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  2186. this._config.interval = nextElementInterval;
  2187. } else {
  2188. this._config.interval = this._config.defaultInterval || this._config.interval;
  2189. }
  2190. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  2191. $(activeElement).one(Util.TRANSITION_END, function () {
  2192. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  2193. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  2194. _this4._isSliding = false;
  2195. setTimeout(function () {
  2196. return $(_this4._element).trigger(slidEvent);
  2197. }, 0);
  2198. }).emulateTransitionEnd(transitionDuration);
  2199. } else {
  2200. $(activeElement).removeClass(ClassName$2.ACTIVE);
  2201. $(nextElement).addClass(ClassName$2.ACTIVE);
  2202. this._isSliding = false;
  2203. $(this._element).trigger(slidEvent);
  2204. }
  2205. if (isCycling) {
  2206. this.cycle();
  2207. }
  2208. } // Static
  2209. ;
  2210. Carousel._jQueryInterface = function _jQueryInterface(config) {
  2211. return this.each(function () {
  2212. var data = $(this).data(DATA_KEY$2);
  2213. var _config = _objectSpread({}, Default, $(this).data());
  2214. if (typeof config === 'object') {
  2215. _config = _objectSpread({}, _config, config);
  2216. }
  2217. var action = typeof config === 'string' ? config : _config.slide;
  2218. if (!data) {
  2219. data = new Carousel(this, _config);
  2220. $(this).data(DATA_KEY$2, data);
  2221. }
  2222. if (typeof config === 'number') {
  2223. data.to(config);
  2224. } else if (typeof action === 'string') {
  2225. if (typeof data[action] === 'undefined') {
  2226. throw new TypeError("No method named \"" + action + "\"");
  2227. }
  2228. data[action]();
  2229. } else if (_config.interval && _config.ride) {
  2230. data.pause();
  2231. data.cycle();
  2232. }
  2233. });
  2234. };
  2235. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  2236. var selector = Util.getSelectorFromElement(this);
  2237. if (!selector) {
  2238. return;
  2239. }
  2240. var target = $(selector)[0];
  2241. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  2242. return;
  2243. }
  2244. var config = _objectSpread({}, $(target).data(), $(this).data());
  2245. var slideIndex = this.getAttribute('data-slide-to');
  2246. if (slideIndex) {
  2247. config.interval = false;
  2248. }
  2249. Carousel._jQueryInterface.call($(target), config);
  2250. if (slideIndex) {
  2251. $(target).data(DATA_KEY$2).to(slideIndex);
  2252. }
  2253. event.preventDefault();
  2254. };
  2255. _createClass(Carousel, null, [{
  2256. key: "VERSION",
  2257. get: function get() {
  2258. return VERSION$2;
  2259. }
  2260. }, {
  2261. key: "Default",
  2262. get: function get() {
  2263. return Default;
  2264. }
  2265. }]);
  2266. return Carousel;
  2267. }();
  2268. /**
  2269. * ------------------------------------------------------------------------
  2270. * Data Api implementation
  2271. * ------------------------------------------------------------------------
  2272. */
  2273. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  2274. $(window).on(Event$2.LOAD_DATA_API, function () {
  2275. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  2276. for (var i = 0, len = carousels.length; i < len; i++) {
  2277. var $carousel = $(carousels[i]);
  2278. Carousel._jQueryInterface.call($carousel, $carousel.data());
  2279. }
  2280. });
  2281. /**
  2282. * ------------------------------------------------------------------------
  2283. * jQuery
  2284. * ------------------------------------------------------------------------
  2285. */
  2286. $.fn[NAME$2] = Carousel._jQueryInterface;
  2287. $.fn[NAME$2].Constructor = Carousel;
  2288. $.fn[NAME$2].noConflict = function () {
  2289. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  2290. return Carousel._jQueryInterface;
  2291. };
  2292. /**
  2293. * ------------------------------------------------------------------------
  2294. * Constants
  2295. * ------------------------------------------------------------------------
  2296. */
  2297. var NAME$3 = 'collapse';
  2298. var VERSION$3 = '4.3.1';
  2299. var DATA_KEY$3 = 'bs.collapse';
  2300. var EVENT_KEY$3 = "." + DATA_KEY$3;
  2301. var DATA_API_KEY$3 = '.data-api';
  2302. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  2303. var Default$1 = {
  2304. toggle: true,
  2305. parent: ''
  2306. };
  2307. var DefaultType$1 = {
  2308. toggle: 'boolean',
  2309. parent: '(string|element)'
  2310. };
  2311. var Event$3 = {
  2312. SHOW: "show" + EVENT_KEY$3,
  2313. SHOWN: "shown" + EVENT_KEY$3,
  2314. HIDE: "hide" + EVENT_KEY$3,
  2315. HIDDEN: "hidden" + EVENT_KEY$3,
  2316. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  2317. };
  2318. var ClassName$3 = {
  2319. SHOW: 'show',
  2320. COLLAPSE: 'collapse',
  2321. COLLAPSING: 'collapsing',
  2322. COLLAPSED: 'collapsed'
  2323. };
  2324. var Dimension = {
  2325. WIDTH: 'width',
  2326. HEIGHT: 'height'
  2327. };
  2328. var Selector$3 = {
  2329. ACTIVES: '.show, .collapsing',
  2330. DATA_TOGGLE: '[data-toggle="collapse"]'
  2331. /**
  2332. * ------------------------------------------------------------------------
  2333. * Class Definition
  2334. * ------------------------------------------------------------------------
  2335. */
  2336. };
  2337. var Collapse =
  2338. /*#__PURE__*/
  2339. function () {
  2340. function Collapse(element, config) {
  2341. this._isTransitioning = false;
  2342. this._element = element;
  2343. this._config = this._getConfig(config);
  2344. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  2345. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  2346. for (var i = 0, len = toggleList.length; i < len; i++) {
  2347. var elem = toggleList[i];
  2348. var selector = Util.getSelectorFromElement(elem);
  2349. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  2350. return foundElem === element;
  2351. });
  2352. if (selector !== null && filterElement.length > 0) {
  2353. this._selector = selector;
  2354. this._triggerArray.push(elem);
  2355. }
  2356. }
  2357. this._parent = this._config.parent ? this._getParent() : null;
  2358. if (!this._config.parent) {
  2359. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  2360. }
  2361. if (this._config.toggle) {
  2362. this.toggle();
  2363. }
  2364. } // Getters
  2365. var _proto = Collapse.prototype;
  2366. // Public
  2367. _proto.toggle = function toggle() {
  2368. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  2369. this.hide();
  2370. } else {
  2371. this.show();
  2372. }
  2373. };
  2374. _proto.show = function show() {
  2375. var _this = this;
  2376. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  2377. return;
  2378. }
  2379. var actives;
  2380. var activesData;
  2381. if (this._parent) {
  2382. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  2383. if (typeof _this._config.parent === 'string') {
  2384. return elem.getAttribute('data-parent') === _this._config.parent;
  2385. }
  2386. return elem.classList.contains(ClassName$3.COLLAPSE);
  2387. });
  2388. if (actives.length === 0) {
  2389. actives = null;
  2390. }
  2391. }
  2392. if (actives) {
  2393. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  2394. if (activesData && activesData._isTransitioning) {
  2395. return;
  2396. }
  2397. }
  2398. var startEvent = $.Event(Event$3.SHOW);
  2399. $(this._element).trigger(startEvent);
  2400. if (startEvent.isDefaultPrevented()) {
  2401. return;
  2402. }
  2403. if (actives) {
  2404. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  2405. if (!activesData) {
  2406. $(actives).data(DATA_KEY$3, null);
  2407. }
  2408. }
  2409. var dimension = this._getDimension();
  2410. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  2411. this._element.style[dimension] = 0;
  2412. if (this._triggerArray.length) {
  2413. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  2414. }
  2415. this.setTransitioning(true);
  2416. var complete = function complete() {
  2417. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  2418. _this._element.style[dimension] = '';
  2419. _this.setTransitioning(false);
  2420. $(_this._element).trigger(Event$3.SHOWN);
  2421. };
  2422. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  2423. var scrollSize = "scroll" + capitalizedDimension;
  2424. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  2425. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  2426. this._element.style[dimension] = this._element[scrollSize] + "px";
  2427. };
  2428. _proto.hide = function hide() {
  2429. var _this2 = this;
  2430. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  2431. return;
  2432. }
  2433. var startEvent = $.Event(Event$3.HIDE);
  2434. $(this._element).trigger(startEvent);
  2435. if (startEvent.isDefaultPrevented()) {
  2436. return;
  2437. }
  2438. var dimension = this._getDimension();
  2439. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  2440. Util.reflow(this._element);
  2441. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  2442. var triggerArrayLength = this._triggerArray.length;
  2443. if (triggerArrayLength > 0) {
  2444. for (var i = 0; i < triggerArrayLength; i++) {
  2445. var trigger = this._triggerArray[i];
  2446. var selector = Util.getSelectorFromElement(trigger);
  2447. if (selector !== null) {
  2448. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  2449. if (!$elem.hasClass(ClassName$3.SHOW)) {
  2450. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  2451. }
  2452. }
  2453. }
  2454. }
  2455. this.setTransitioning(true);
  2456. var complete = function complete() {
  2457. _this2.setTransitioning(false);
  2458. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  2459. };
  2460. this._element.style[dimension] = '';
  2461. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  2462. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  2463. };
  2464. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  2465. this._isTransitioning = isTransitioning;
  2466. };
  2467. _proto.dispose = function dispose() {
  2468. $.removeData(this._element, DATA_KEY$3);
  2469. this._config = null;
  2470. this._parent = null;
  2471. this._element = null;
  2472. this._triggerArray = null;
  2473. this._isTransitioning = null;
  2474. } // Private
  2475. ;
  2476. _proto._getConfig = function _getConfig(config) {
  2477. config = _objectSpread({}, Default$1, config);
  2478. config.toggle = Boolean(config.toggle); // Coerce string values
  2479. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  2480. return config;
  2481. };
  2482. _proto._getDimension = function _getDimension() {
  2483. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  2484. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  2485. };
  2486. _proto._getParent = function _getParent() {
  2487. var _this3 = this;
  2488. var parent;
  2489. if (Util.isElement(this._config.parent)) {
  2490. parent = this._config.parent; // It's a jQuery object
  2491. if (typeof this._config.parent.jquery !== 'undefined') {
  2492. parent = this._config.parent[0];
  2493. }
  2494. } else {
  2495. parent = document.querySelector(this._config.parent);
  2496. }
  2497. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  2498. var children = [].slice.call(parent.querySelectorAll(selector));
  2499. $(children).each(function (i, element) {
  2500. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  2501. });
  2502. return parent;
  2503. };
  2504. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  2505. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  2506. if (triggerArray.length) {
  2507. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  2508. }
  2509. } // Static
  2510. ;
  2511. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  2512. var selector = Util.getSelectorFromElement(element);
  2513. return selector ? document.querySelector(selector) : null;
  2514. };
  2515. Collapse._jQueryInterface = function _jQueryInterface(config) {
  2516. return this.each(function () {
  2517. var $this = $(this);
  2518. var data = $this.data(DATA_KEY$3);
  2519. var _config = _objectSpread({}, Default$1, $this.data(), typeof config === 'object' && config ? config : {});
  2520. if (!data && _config.toggle && /show|hide/.test(config)) {
  2521. _config.toggle = false;
  2522. }
  2523. if (!data) {
  2524. data = new Collapse(this, _config);
  2525. $this.data(DATA_KEY$3, data);
  2526. }
  2527. if (typeof config === 'string') {
  2528. if (typeof data[config] === 'undefined') {
  2529. throw new TypeError("No method named \"" + config + "\"");
  2530. }
  2531. data[config]();
  2532. }
  2533. });
  2534. };
  2535. _createClass(Collapse, null, [{
  2536. key: "VERSION",
  2537. get: function get() {
  2538. return VERSION$3;
  2539. }
  2540. }, {
  2541. key: "Default",
  2542. get: function get() {
  2543. return Default$1;
  2544. }
  2545. }]);
  2546. return Collapse;
  2547. }();
  2548. /**
  2549. * ------------------------------------------------------------------------
  2550. * Data Api implementation
  2551. * ------------------------------------------------------------------------
  2552. */
  2553. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  2554. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  2555. if (event.currentTarget.tagName === 'A') {
  2556. event.preventDefault();
  2557. }
  2558. var $trigger = $(this);
  2559. var selector = Util.getSelectorFromElement(this);
  2560. var selectors = [].slice.call(document.querySelectorAll(selector));
  2561. $(selectors).each(function () {
  2562. var $target = $(this);
  2563. var data = $target.data(DATA_KEY$3);
  2564. var config = data ? 'toggle' : $trigger.data();
  2565. Collapse._jQueryInterface.call($target, config);
  2566. });
  2567. });
  2568. /**
  2569. * ------------------------------------------------------------------------
  2570. * jQuery
  2571. * ------------------------------------------------------------------------
  2572. */
  2573. $.fn[NAME$3] = Collapse._jQueryInterface;
  2574. $.fn[NAME$3].Constructor = Collapse;
  2575. $.fn[NAME$3].noConflict = function () {
  2576. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  2577. return Collapse._jQueryInterface;
  2578. };
  2579. /**
  2580. * ------------------------------------------------------------------------
  2581. * Constants
  2582. * ------------------------------------------------------------------------
  2583. */
  2584. var NAME$4 = 'dropdown';
  2585. var VERSION$4 = '4.3.1';
  2586. var DATA_KEY$4 = 'bs.dropdown';
  2587. var EVENT_KEY$4 = "." + DATA_KEY$4;
  2588. var DATA_API_KEY$4 = '.data-api';
  2589. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  2590. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  2591. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  2592. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  2593. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  2594. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  2595. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  2596. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  2597. var Event$4 = {
  2598. HIDE: "hide" + EVENT_KEY$4,
  2599. HIDDEN: "hidden" + EVENT_KEY$4,
  2600. SHOW: "show" + EVENT_KEY$4,
  2601. SHOWN: "shown" + EVENT_KEY$4,
  2602. CLICK: "click" + EVENT_KEY$4,
  2603. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  2604. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  2605. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  2606. };
  2607. var ClassName$4 = {
  2608. DISABLED: 'disabled',
  2609. SHOW: 'show',
  2610. DROPUP: 'dropup',
  2611. DROPRIGHT: 'dropright',
  2612. DROPLEFT: 'dropleft',
  2613. MENURIGHT: 'dropdown-menu-right',
  2614. MENULEFT: 'dropdown-menu-left',
  2615. POSITION_STATIC: 'position-static'
  2616. };
  2617. var Selector$4 = {
  2618. DATA_TOGGLE: '[data-toggle="dropdown"]',
  2619. FORM_CHILD: '.dropdown form',
  2620. MENU: '.dropdown-menu',
  2621. NAVBAR_NAV: '.navbar-nav',
  2622. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  2623. };
  2624. var AttachmentMap = {
  2625. TOP: 'top-start',
  2626. TOPEND: 'top-end',
  2627. BOTTOM: 'bottom-start',
  2628. BOTTOMEND: 'bottom-end',
  2629. RIGHT: 'right-start',
  2630. RIGHTEND: 'right-end',
  2631. LEFT: 'left-start',
  2632. LEFTEND: 'left-end'
  2633. };
  2634. var Default$2 = {
  2635. offset: 0,
  2636. flip: true,
  2637. boundary: 'scrollParent',
  2638. reference: 'toggle',
  2639. display: 'dynamic'
  2640. };
  2641. var DefaultType$2 = {
  2642. offset: '(number|string|function)',
  2643. flip: 'boolean',
  2644. boundary: '(string|element)',
  2645. reference: '(string|element)',
  2646. display: 'string'
  2647. /**
  2648. * ------------------------------------------------------------------------
  2649. * Class Definition
  2650. * ------------------------------------------------------------------------
  2651. */
  2652. };
  2653. var Dropdown =
  2654. /*#__PURE__*/
  2655. function () {
  2656. function Dropdown(element, config) {
  2657. this._element = element;
  2658. this._popper = null;
  2659. this._config = this._getConfig(config);
  2660. this._menu = this._getMenuElement();
  2661. this._inNavbar = this._detectNavbar();
  2662. this._addEventListeners();
  2663. } // Getters
  2664. var _proto = Dropdown.prototype;
  2665. // Public
  2666. _proto.toggle = function toggle() {
  2667. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  2668. return;
  2669. }
  2670. var parent = Dropdown._getParentFromElement(this._element);
  2671. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  2672. Dropdown._clearMenus();
  2673. if (isActive) {
  2674. return;
  2675. }
  2676. var relatedTarget = {
  2677. relatedTarget: this._element
  2678. };
  2679. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  2680. $(parent).trigger(showEvent);
  2681. if (showEvent.isDefaultPrevented()) {
  2682. return;
  2683. } // Disable totally Popper.js for Dropdown in Navbar
  2684. if (!this._inNavbar) {
  2685. /**
  2686. * Check for Popper dependency
  2687. * Popper - https://popper.js.org
  2688. */
  2689. if (typeof Popper === 'undefined') {
  2690. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  2691. }
  2692. var referenceElement = this._element;
  2693. if (this._config.reference === 'parent') {
  2694. referenceElement = parent;
  2695. } else if (Util.isElement(this._config.reference)) {
  2696. referenceElement = this._config.reference; // Check if it's jQuery element
  2697. if (typeof this._config.reference.jquery !== 'undefined') {
  2698. referenceElement = this._config.reference[0];
  2699. }
  2700. } // If boundary is not `scrollParent`, then set position to `static`
  2701. // to allow the menu to "escape" the scroll parent's boundaries
  2702. // https://github.com/twbs/bootstrap/issues/24251
  2703. if (this._config.boundary !== 'scrollParent') {
  2704. $(parent).addClass(ClassName$4.POSITION_STATIC);
  2705. }
  2706. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  2707. } // If this is a touch-enabled device we add extra
  2708. // empty mouseover listeners to the body's immediate children;
  2709. // only needed because of broken event delegation on iOS
  2710. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  2711. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  2712. $(document.body).children().on('mouseover', null, $.noop);
  2713. }
  2714. this._element.focus();
  2715. this._element.setAttribute('aria-expanded', true);
  2716. $(this._menu).toggleClass(ClassName$4.SHOW);
  2717. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  2718. };
  2719. _proto.show = function show() {
  2720. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  2721. return;
  2722. }
  2723. var relatedTarget = {
  2724. relatedTarget: this._element
  2725. };
  2726. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  2727. var parent = Dropdown._getParentFromElement(this._element);
  2728. $(parent).trigger(showEvent);
  2729. if (showEvent.isDefaultPrevented()) {
  2730. return;
  2731. }
  2732. $(this._menu).toggleClass(ClassName$4.SHOW);
  2733. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  2734. };
  2735. _proto.hide = function hide() {
  2736. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  2737. return;
  2738. }
  2739. var relatedTarget = {
  2740. relatedTarget: this._element
  2741. };
  2742. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  2743. var parent = Dropdown._getParentFromElement(this._element);
  2744. $(parent).trigger(hideEvent);
  2745. if (hideEvent.isDefaultPrevented()) {
  2746. return;
  2747. }
  2748. $(this._menu).toggleClass(ClassName$4.SHOW);
  2749. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  2750. };
  2751. _proto.dispose = function dispose() {
  2752. $.removeData(this._element, DATA_KEY$4);
  2753. $(this._element).off(EVENT_KEY$4);
  2754. this._element = null;
  2755. this._menu = null;
  2756. if (this._popper !== null) {
  2757. this._popper.destroy();
  2758. this._popper = null;
  2759. }
  2760. };
  2761. _proto.update = function update() {
  2762. this._inNavbar = this._detectNavbar();
  2763. if (this._popper !== null) {
  2764. this._popper.scheduleUpdate();
  2765. }
  2766. } // Private
  2767. ;
  2768. _proto._addEventListeners = function _addEventListeners() {
  2769. var _this = this;
  2770. $(this._element).on(Event$4.CLICK, function (event) {
  2771. event.preventDefault();
  2772. event.stopPropagation();
  2773. _this.toggle();
  2774. });
  2775. };
  2776. _proto._getConfig = function _getConfig(config) {
  2777. config = _objectSpread({}, this.constructor.Default, $(this._element).data(), config);
  2778. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  2779. return config;
  2780. };
  2781. _proto._getMenuElement = function _getMenuElement() {
  2782. if (!this._menu) {
  2783. var parent = Dropdown._getParentFromElement(this._element);
  2784. if (parent) {
  2785. this._menu = parent.querySelector(Selector$4.MENU);
  2786. }
  2787. }
  2788. return this._menu;
  2789. };
  2790. _proto._getPlacement = function _getPlacement() {
  2791. var $parentDropdown = $(this._element.parentNode);
  2792. var placement = AttachmentMap.BOTTOM; // Handle dropup
  2793. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  2794. placement = AttachmentMap.TOP;
  2795. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  2796. placement = AttachmentMap.TOPEND;
  2797. }
  2798. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  2799. placement = AttachmentMap.RIGHT;
  2800. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  2801. placement = AttachmentMap.LEFT;
  2802. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  2803. placement = AttachmentMap.BOTTOMEND;
  2804. }
  2805. return placement;
  2806. };
  2807. _proto._detectNavbar = function _detectNavbar() {
  2808. return $(this._element).closest('.navbar').length > 0;
  2809. };
  2810. _proto._getOffset = function _getOffset() {
  2811. var _this2 = this;
  2812. var offset = {};
  2813. if (typeof this._config.offset === 'function') {
  2814. offset.fn = function (data) {
  2815. data.offsets = _objectSpread({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
  2816. return data;
  2817. };
  2818. } else {
  2819. offset.offset = this._config.offset;
  2820. }
  2821. return offset;
  2822. };
  2823. _proto._getPopperConfig = function _getPopperConfig() {
  2824. var popperConfig = {
  2825. placement: this._getPlacement(),
  2826. modifiers: {
  2827. offset: this._getOffset(),
  2828. flip: {
  2829. enabled: this._config.flip
  2830. },
  2831. preventOverflow: {
  2832. boundariesElement: this._config.boundary
  2833. }
  2834. } // Disable Popper.js if we have a static display
  2835. };
  2836. if (this._config.display === 'static') {
  2837. popperConfig.modifiers.applyStyle = {
  2838. enabled: false
  2839. };
  2840. }
  2841. return popperConfig;
  2842. } // Static
  2843. ;
  2844. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  2845. return this.each(function () {
  2846. var data = $(this).data(DATA_KEY$4);
  2847. var _config = typeof config === 'object' ? config : null;
  2848. if (!data) {
  2849. data = new Dropdown(this, _config);
  2850. $(this).data(DATA_KEY$4, data);
  2851. }
  2852. if (typeof config === 'string') {
  2853. if (typeof data[config] === 'undefined') {
  2854. throw new TypeError("No method named \"" + config + "\"");
  2855. }
  2856. data[config]();
  2857. }
  2858. });
  2859. };
  2860. Dropdown._clearMenus = function _clearMenus(event) {
  2861. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  2862. return;
  2863. }
  2864. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  2865. for (var i = 0, len = toggles.length; i < len; i++) {
  2866. var parent = Dropdown._getParentFromElement(toggles[i]);
  2867. var context = $(toggles[i]).data(DATA_KEY$4);
  2868. var relatedTarget = {
  2869. relatedTarget: toggles[i]
  2870. };
  2871. if (event && event.type === 'click') {
  2872. relatedTarget.clickEvent = event;
  2873. }
  2874. if (!context) {
  2875. continue;
  2876. }
  2877. var dropdownMenu = context._menu;
  2878. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  2879. continue;
  2880. }
  2881. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  2882. continue;
  2883. }
  2884. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  2885. $(parent).trigger(hideEvent);
  2886. if (hideEvent.isDefaultPrevented()) {
  2887. continue;
  2888. } // If this is a touch-enabled device we remove the extra
  2889. // empty mouseover listeners we added for iOS support
  2890. if ('ontouchstart' in document.documentElement) {
  2891. $(document.body).children().off('mouseover', null, $.noop);
  2892. }
  2893. toggles[i].setAttribute('aria-expanded', 'false');
  2894. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  2895. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  2896. }
  2897. };
  2898. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  2899. var parent;
  2900. var selector = Util.getSelectorFromElement(element);
  2901. if (selector) {
  2902. parent = document.querySelector(selector);
  2903. }
  2904. return parent || element.parentNode;
  2905. } // eslint-disable-next-line complexity
  2906. ;
  2907. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  2908. // If not input/textarea:
  2909. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  2910. // If input/textarea:
  2911. // - If space key => not a dropdown command
  2912. // - If key is other than escape
  2913. // - If key is not up or down => not a dropdown command
  2914. // - If trigger inside the menu => not a dropdown command
  2915. 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$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
  2916. return;
  2917. }
  2918. event.preventDefault();
  2919. event.stopPropagation();
  2920. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  2921. return;
  2922. }
  2923. var parent = Dropdown._getParentFromElement(this);
  2924. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  2925. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  2926. if (event.which === ESCAPE_KEYCODE) {
  2927. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  2928. $(toggle).trigger('focus');
  2929. }
  2930. $(this).trigger('click');
  2931. return;
  2932. }
  2933. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS));
  2934. if (items.length === 0) {
  2935. return;
  2936. }
  2937. var index = items.indexOf(event.target);
  2938. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  2939. // Up
  2940. index--;
  2941. }
  2942. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  2943. // Down
  2944. index++;
  2945. }
  2946. if (index < 0) {
  2947. index = 0;
  2948. }
  2949. items[index].focus();
  2950. };
  2951. _createClass(Dropdown, null, [{
  2952. key: "VERSION",
  2953. get: function get() {
  2954. return VERSION$4;
  2955. }
  2956. }, {
  2957. key: "Default",
  2958. get: function get() {
  2959. return Default$2;
  2960. }
  2961. }, {
  2962. key: "DefaultType",
  2963. get: function get() {
  2964. return DefaultType$2;
  2965. }
  2966. }]);
  2967. return Dropdown;
  2968. }();
  2969. /**
  2970. * ------------------------------------------------------------------------
  2971. * Data Api implementation
  2972. * ------------------------------------------------------------------------
  2973. */
  2974. $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
  2975. event.preventDefault();
  2976. event.stopPropagation();
  2977. Dropdown._jQueryInterface.call($(this), 'toggle');
  2978. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  2979. e.stopPropagation();
  2980. });
  2981. /**
  2982. * ------------------------------------------------------------------------
  2983. * jQuery
  2984. * ------------------------------------------------------------------------
  2985. */
  2986. $.fn[NAME$4] = Dropdown._jQueryInterface;
  2987. $.fn[NAME$4].Constructor = Dropdown;
  2988. $.fn[NAME$4].noConflict = function () {
  2989. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  2990. return Dropdown._jQueryInterface;
  2991. };
  2992. /**
  2993. * ------------------------------------------------------------------------
  2994. * Constants
  2995. * ------------------------------------------------------------------------
  2996. */
  2997. var NAME$5 = 'modal';
  2998. var VERSION$5 = '4.3.1';
  2999. var DATA_KEY$5 = 'bs.modal';
  3000. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3001. var DATA_API_KEY$5 = '.data-api';
  3002. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  3003. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3004. var Default$3 = {
  3005. backdrop: true,
  3006. keyboard: true,
  3007. focus: true,
  3008. show: true
  3009. };
  3010. var DefaultType$3 = {
  3011. backdrop: '(boolean|string)',
  3012. keyboard: 'boolean',
  3013. focus: 'boolean',
  3014. show: 'boolean'
  3015. };
  3016. var Event$5 = {
  3017. HIDE: "hide" + EVENT_KEY$5,
  3018. HIDDEN: "hidden" + EVENT_KEY$5,
  3019. SHOW: "show" + EVENT_KEY$5,
  3020. SHOWN: "shown" + EVENT_KEY$5,
  3021. FOCUSIN: "focusin" + EVENT_KEY$5,
  3022. RESIZE: "resize" + EVENT_KEY$5,
  3023. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  3024. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  3025. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  3026. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  3027. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  3028. };
  3029. var ClassName$5 = {
  3030. SCROLLABLE: 'modal-dialog-scrollable',
  3031. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  3032. BACKDROP: 'modal-backdrop',
  3033. OPEN: 'modal-open',
  3034. FADE: 'fade',
  3035. SHOW: 'show'
  3036. };
  3037. var Selector$5 = {
  3038. DIALOG: '.modal-dialog',
  3039. MODAL_BODY: '.modal-body',
  3040. DATA_TOGGLE: '[data-toggle="modal"]',
  3041. DATA_DISMISS: '[data-dismiss="modal"]',
  3042. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  3043. STICKY_CONTENT: '.sticky-top'
  3044. /**
  3045. * ------------------------------------------------------------------------
  3046. * Class Definition
  3047. * ------------------------------------------------------------------------
  3048. */
  3049. };
  3050. var Modal =
  3051. /*#__PURE__*/
  3052. function () {
  3053. function Modal(element, config) {
  3054. this._config = this._getConfig(config);
  3055. this._element = element;
  3056. this._dialog = element.querySelector(Selector$5.DIALOG);
  3057. this._backdrop = null;
  3058. this._isShown = false;
  3059. this._isBodyOverflowing = false;
  3060. this._ignoreBackdropClick = false;
  3061. this._isTransitioning = false;
  3062. this._scrollbarWidth = 0;
  3063. } // Getters
  3064. var _proto = Modal.prototype;
  3065. // Public
  3066. _proto.toggle = function toggle(relatedTarget) {
  3067. return this._isShown ? this.hide() : this.show(relatedTarget);
  3068. };
  3069. _proto.show = function show(relatedTarget) {
  3070. var _this = this;
  3071. if (this._isShown || this._isTransitioning) {
  3072. return;
  3073. }
  3074. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3075. this._isTransitioning = true;
  3076. }
  3077. var showEvent = $.Event(Event$5.SHOW, {
  3078. relatedTarget: relatedTarget
  3079. });
  3080. $(this._element).trigger(showEvent);
  3081. if (this._isShown || showEvent.isDefaultPrevented()) {
  3082. return;
  3083. }
  3084. this._isShown = true;
  3085. this._checkScrollbar();
  3086. this._setScrollbar();
  3087. this._adjustDialog();
  3088. this._setEscapeEvent();
  3089. this._setResizeEvent();
  3090. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  3091. return _this.hide(event);
  3092. });
  3093. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  3094. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  3095. if ($(event.target).is(_this._element)) {
  3096. _this._ignoreBackdropClick = true;
  3097. }
  3098. });
  3099. });
  3100. this._showBackdrop(function () {
  3101. return _this._showElement(relatedTarget);
  3102. });
  3103. };
  3104. _proto.hide = function hide(event) {
  3105. var _this2 = this;
  3106. if (event) {
  3107. event.preventDefault();
  3108. }
  3109. if (!this._isShown || this._isTransitioning) {
  3110. return;
  3111. }
  3112. var hideEvent = $.Event(Event$5.HIDE);
  3113. $(this._element).trigger(hideEvent);
  3114. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3115. return;
  3116. }
  3117. this._isShown = false;
  3118. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3119. if (transition) {
  3120. this._isTransitioning = true;
  3121. }
  3122. this._setEscapeEvent();
  3123. this._setResizeEvent();
  3124. $(document).off(Event$5.FOCUSIN);
  3125. $(this._element).removeClass(ClassName$5.SHOW);
  3126. $(this._element).off(Event$5.CLICK_DISMISS);
  3127. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  3128. if (transition) {
  3129. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3130. $(this._element).one(Util.TRANSITION_END, function (event) {
  3131. return _this2._hideModal(event);
  3132. }).emulateTransitionEnd(transitionDuration);
  3133. } else {
  3134. this._hideModal();
  3135. }
  3136. };
  3137. _proto.dispose = function dispose() {
  3138. [window, this._element, this._dialog].forEach(function (htmlElement) {
  3139. return $(htmlElement).off(EVENT_KEY$5);
  3140. });
  3141. /**
  3142. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  3143. * Do not move `document` in `htmlElements` array
  3144. * It will remove `Event.CLICK_DATA_API` event that should remain
  3145. */
  3146. $(document).off(Event$5.FOCUSIN);
  3147. $.removeData(this._element, DATA_KEY$5);
  3148. this._config = null;
  3149. this._element = null;
  3150. this._dialog = null;
  3151. this._backdrop = null;
  3152. this._isShown = null;
  3153. this._isBodyOverflowing = null;
  3154. this._ignoreBackdropClick = null;
  3155. this._isTransitioning = null;
  3156. this._scrollbarWidth = null;
  3157. };
  3158. _proto.handleUpdate = function handleUpdate() {
  3159. this._adjustDialog();
  3160. } // Private
  3161. ;
  3162. _proto._getConfig = function _getConfig(config) {
  3163. config = _objectSpread({}, Default$3, config);
  3164. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  3165. return config;
  3166. };
  3167. _proto._showElement = function _showElement(relatedTarget) {
  3168. var _this3 = this;
  3169. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3170. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  3171. // Don't move modal's DOM position
  3172. document.body.appendChild(this._element);
  3173. }
  3174. this._element.style.display = 'block';
  3175. this._element.removeAttribute('aria-hidden');
  3176. this._element.setAttribute('aria-modal', true);
  3177. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE)) {
  3178. this._dialog.querySelector(Selector$5.MODAL_BODY).scrollTop = 0;
  3179. } else {
  3180. this._element.scrollTop = 0;
  3181. }
  3182. if (transition) {
  3183. Util.reflow(this._element);
  3184. }
  3185. $(this._element).addClass(ClassName$5.SHOW);
  3186. if (this._config.focus) {
  3187. this._enforceFocus();
  3188. }
  3189. var shownEvent = $.Event(Event$5.SHOWN, {
  3190. relatedTarget: relatedTarget
  3191. });
  3192. var transitionComplete = function transitionComplete() {
  3193. if (_this3._config.focus) {
  3194. _this3._element.focus();
  3195. }
  3196. _this3._isTransitioning = false;
  3197. $(_this3._element).trigger(shownEvent);
  3198. };
  3199. if (transition) {
  3200. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  3201. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  3202. } else {
  3203. transitionComplete();
  3204. }
  3205. };
  3206. _proto._enforceFocus = function _enforceFocus() {
  3207. var _this4 = this;
  3208. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  3209. .on(Event$5.FOCUSIN, function (event) {
  3210. if (document !== event.target && _this4._element !== event.target && $(_this4._element).has(event.target).length === 0) {
  3211. _this4._element.focus();
  3212. }
  3213. });
  3214. };
  3215. _proto._setEscapeEvent = function _setEscapeEvent() {
  3216. var _this5 = this;
  3217. if (this._isShown && this._config.keyboard) {
  3218. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  3219. if (event.which === ESCAPE_KEYCODE$1) {
  3220. event.preventDefault();
  3221. _this5.hide();
  3222. }
  3223. });
  3224. } else if (!this._isShown) {
  3225. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  3226. }
  3227. };
  3228. _proto._setResizeEvent = function _setResizeEvent() {
  3229. var _this6 = this;
  3230. if (this._isShown) {
  3231. $(window).on(Event$5.RESIZE, function (event) {
  3232. return _this6.handleUpdate(event);
  3233. });
  3234. } else {
  3235. $(window).off(Event$5.RESIZE);
  3236. }
  3237. };
  3238. _proto._hideModal = function _hideModal() {
  3239. var _this7 = this;
  3240. this._element.style.display = 'none';
  3241. this._element.setAttribute('aria-hidden', true);
  3242. this._element.removeAttribute('aria-modal');
  3243. this._isTransitioning = false;
  3244. this._showBackdrop(function () {
  3245. $(document.body).removeClass(ClassName$5.OPEN);
  3246. _this7._resetAdjustments();
  3247. _this7._resetScrollbar();
  3248. $(_this7._element).trigger(Event$5.HIDDEN);
  3249. });
  3250. };
  3251. _proto._removeBackdrop = function _removeBackdrop() {
  3252. if (this._backdrop) {
  3253. $(this._backdrop).remove();
  3254. this._backdrop = null;
  3255. }
  3256. };
  3257. _proto._showBackdrop = function _showBackdrop(callback) {
  3258. var _this8 = this;
  3259. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  3260. if (this._isShown && this._config.backdrop) {
  3261. this._backdrop = document.createElement('div');
  3262. this._backdrop.className = ClassName$5.BACKDROP;
  3263. if (animate) {
  3264. this._backdrop.classList.add(animate);
  3265. }
  3266. $(this._backdrop).appendTo(document.body);
  3267. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  3268. if (_this8._ignoreBackdropClick) {
  3269. _this8._ignoreBackdropClick = false;
  3270. return;
  3271. }
  3272. if (event.target !== event.currentTarget) {
  3273. return;
  3274. }
  3275. if (_this8._config.backdrop === 'static') {
  3276. _this8._element.focus();
  3277. } else {
  3278. _this8.hide();
  3279. }
  3280. });
  3281. if (animate) {
  3282. Util.reflow(this._backdrop);
  3283. }
  3284. $(this._backdrop).addClass(ClassName$5.SHOW);
  3285. if (!callback) {
  3286. return;
  3287. }
  3288. if (!animate) {
  3289. callback();
  3290. return;
  3291. }
  3292. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3293. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  3294. } else if (!this._isShown && this._backdrop) {
  3295. $(this._backdrop).removeClass(ClassName$5.SHOW);
  3296. var callbackRemove = function callbackRemove() {
  3297. _this8._removeBackdrop();
  3298. if (callback) {
  3299. callback();
  3300. }
  3301. };
  3302. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3303. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3304. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  3305. } else {
  3306. callbackRemove();
  3307. }
  3308. } else if (callback) {
  3309. callback();
  3310. }
  3311. } // ----------------------------------------------------------------------
  3312. // the following methods are used to handle overflowing modals
  3313. // todo (fat): these should probably be refactored out of modal.js
  3314. // ----------------------------------------------------------------------
  3315. ;
  3316. _proto._adjustDialog = function _adjustDialog() {
  3317. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  3318. if (!this._isBodyOverflowing && isModalOverflowing) {
  3319. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  3320. }
  3321. if (this._isBodyOverflowing && !isModalOverflowing) {
  3322. this._element.style.paddingRight = this._scrollbarWidth + "px";
  3323. }
  3324. };
  3325. _proto._resetAdjustments = function _resetAdjustments() {
  3326. this._element.style.paddingLeft = '';
  3327. this._element.style.paddingRight = '';
  3328. };
  3329. _proto._checkScrollbar = function _checkScrollbar() {
  3330. var rect = document.body.getBoundingClientRect();
  3331. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  3332. this._scrollbarWidth = this._getScrollbarWidth();
  3333. };
  3334. _proto._setScrollbar = function _setScrollbar() {
  3335. var _this9 = this;
  3336. if (this._isBodyOverflowing) {
  3337. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  3338. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  3339. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  3340. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  3341. $(fixedContent).each(function (index, element) {
  3342. var actualPadding = element.style.paddingRight;
  3343. var calculatedPadding = $(element).css('padding-right');
  3344. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px");
  3345. }); // Adjust sticky content margin
  3346. $(stickyContent).each(function (index, element) {
  3347. var actualMargin = element.style.marginRight;
  3348. var calculatedMargin = $(element).css('margin-right');
  3349. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px");
  3350. }); // Adjust body padding
  3351. var actualPadding = document.body.style.paddingRight;
  3352. var calculatedPadding = $(document.body).css('padding-right');
  3353. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  3354. }
  3355. $(document.body).addClass(ClassName$5.OPEN);
  3356. };
  3357. _proto._resetScrollbar = function _resetScrollbar() {
  3358. // Restore fixed content padding
  3359. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  3360. $(fixedContent).each(function (index, element) {
  3361. var padding = $(element).data('padding-right');
  3362. $(element).removeData('padding-right');
  3363. element.style.paddingRight = padding ? padding : '';
  3364. }); // Restore sticky content
  3365. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  3366. $(elements).each(function (index, element) {
  3367. var margin = $(element).data('margin-right');
  3368. if (typeof margin !== 'undefined') {
  3369. $(element).css('margin-right', margin).removeData('margin-right');
  3370. }
  3371. }); // Restore body padding
  3372. var padding = $(document.body).data('padding-right');
  3373. $(document.body).removeData('padding-right');
  3374. document.body.style.paddingRight = padding ? padding : '';
  3375. };
  3376. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  3377. // thx d.walsh
  3378. var scrollDiv = document.createElement('div');
  3379. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  3380. document.body.appendChild(scrollDiv);
  3381. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  3382. document.body.removeChild(scrollDiv);
  3383. return scrollbarWidth;
  3384. } // Static
  3385. ;
  3386. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  3387. return this.each(function () {
  3388. var data = $(this).data(DATA_KEY$5);
  3389. var _config = _objectSpread({}, Default$3, $(this).data(), typeof config === 'object' && config ? config : {});
  3390. if (!data) {
  3391. data = new Modal(this, _config);
  3392. $(this).data(DATA_KEY$5, data);
  3393. }
  3394. if (typeof config === 'string') {
  3395. if (typeof data[config] === 'undefined') {
  3396. throw new TypeError("No method named \"" + config + "\"");
  3397. }
  3398. data[config](relatedTarget);
  3399. } else if (_config.show) {
  3400. data.show(relatedTarget);
  3401. }
  3402. });
  3403. };
  3404. _createClass(Modal, null, [{
  3405. key: "VERSION",
  3406. get: function get() {
  3407. return VERSION$5;
  3408. }
  3409. }, {
  3410. key: "Default",
  3411. get: function get() {
  3412. return Default$3;
  3413. }
  3414. }]);
  3415. return Modal;
  3416. }();
  3417. /**
  3418. * ------------------------------------------------------------------------
  3419. * Data Api implementation
  3420. * ------------------------------------------------------------------------
  3421. */
  3422. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  3423. var _this10 = this;
  3424. var target;
  3425. var selector = Util.getSelectorFromElement(this);
  3426. if (selector) {
  3427. target = document.querySelector(selector);
  3428. }
  3429. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread({}, $(target).data(), $(this).data());
  3430. if (this.tagName === 'A' || this.tagName === 'AREA') {
  3431. event.preventDefault();
  3432. }
  3433. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  3434. if (showEvent.isDefaultPrevented()) {
  3435. // Only register focus restorer if modal will actually get shown
  3436. return;
  3437. }
  3438. $target.one(Event$5.HIDDEN, function () {
  3439. if ($(_this10).is(':visible')) {
  3440. _this10.focus();
  3441. }
  3442. });
  3443. });
  3444. Modal._jQueryInterface.call($(target), config, this);
  3445. });
  3446. /**
  3447. * ------------------------------------------------------------------------
  3448. * jQuery
  3449. * ------------------------------------------------------------------------
  3450. */
  3451. $.fn[NAME$5] = Modal._jQueryInterface;
  3452. $.fn[NAME$5].Constructor = Modal;
  3453. $.fn[NAME$5].noConflict = function () {
  3454. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  3455. return Modal._jQueryInterface;
  3456. };
  3457. /**
  3458. * --------------------------------------------------------------------------
  3459. * Bootstrap (v4.3.1): tools/sanitizer.js
  3460. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3461. * --------------------------------------------------------------------------
  3462. */
  3463. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  3464. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  3465. var DefaultWhitelist = {
  3466. // Global attributes allowed on any supplied element below.
  3467. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  3468. a: ['target', 'href', 'title', 'rel'],
  3469. area: [],
  3470. b: [],
  3471. br: [],
  3472. col: [],
  3473. code: [],
  3474. div: [],
  3475. em: [],
  3476. hr: [],
  3477. h1: [],
  3478. h2: [],
  3479. h3: [],
  3480. h4: [],
  3481. h5: [],
  3482. h6: [],
  3483. i: [],
  3484. img: ['src', 'alt', 'title', 'width', 'height'],
  3485. li: [],
  3486. ol: [],
  3487. p: [],
  3488. pre: [],
  3489. s: [],
  3490. small: [],
  3491. span: [],
  3492. sub: [],
  3493. sup: [],
  3494. strong: [],
  3495. u: [],
  3496. ul: []
  3497. /**
  3498. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  3499. *
  3500. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  3501. */
  3502. };
  3503. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  3504. /**
  3505. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  3506. *
  3507. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  3508. */
  3509. var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
  3510. function allowedAttribute(attr, allowedAttributeList) {
  3511. var attrName = attr.nodeName.toLowerCase();
  3512. if (allowedAttributeList.indexOf(attrName) !== -1) {
  3513. if (uriAttrs.indexOf(attrName) !== -1) {
  3514. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  3515. }
  3516. return true;
  3517. }
  3518. var regExp = allowedAttributeList.filter(function (attrRegex) {
  3519. return attrRegex instanceof RegExp;
  3520. }); // Check if a regular expression validates the attribute.
  3521. for (var i = 0, l = regExp.length; i < l; i++) {
  3522. if (attrName.match(regExp[i])) {
  3523. return true;
  3524. }
  3525. }
  3526. return false;
  3527. }
  3528. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  3529. if (unsafeHtml.length === 0) {
  3530. return unsafeHtml;
  3531. }
  3532. if (sanitizeFn && typeof sanitizeFn === 'function') {
  3533. return sanitizeFn(unsafeHtml);
  3534. }
  3535. var domParser = new window.DOMParser();
  3536. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  3537. var whitelistKeys = Object.keys(whiteList);
  3538. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  3539. var _loop = function _loop(i, len) {
  3540. var el = elements[i];
  3541. var elName = el.nodeName.toLowerCase();
  3542. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  3543. el.parentNode.removeChild(el);
  3544. return "continue";
  3545. }
  3546. var attributeList = [].slice.call(el.attributes);
  3547. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  3548. attributeList.forEach(function (attr) {
  3549. if (!allowedAttribute(attr, whitelistedAttributes)) {
  3550. el.removeAttribute(attr.nodeName);
  3551. }
  3552. });
  3553. };
  3554. for (var i = 0, len = elements.length; i < len; i++) {
  3555. var _ret = _loop(i, len);
  3556. if (_ret === "continue") continue;
  3557. }
  3558. return createdDocument.body.innerHTML;
  3559. }
  3560. /**
  3561. * ------------------------------------------------------------------------
  3562. * Constants
  3563. * ------------------------------------------------------------------------
  3564. */
  3565. var NAME$6 = 'tooltip';
  3566. var VERSION$6 = '4.3.1';
  3567. var DATA_KEY$6 = 'bs.tooltip';
  3568. var EVENT_KEY$6 = "." + DATA_KEY$6;
  3569. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  3570. var CLASS_PREFIX = 'bs-tooltip';
  3571. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  3572. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  3573. var DefaultType$4 = {
  3574. animation: 'boolean',
  3575. template: 'string',
  3576. title: '(string|element|function)',
  3577. trigger: 'string',
  3578. delay: '(number|object)',
  3579. html: 'boolean',
  3580. selector: '(string|boolean)',
  3581. placement: '(string|function)',
  3582. offset: '(number|string|function)',
  3583. container: '(string|element|boolean)',
  3584. fallbackPlacement: '(string|array)',
  3585. boundary: '(string|element)',
  3586. sanitize: 'boolean',
  3587. sanitizeFn: '(null|function)',
  3588. whiteList: 'object'
  3589. };
  3590. var AttachmentMap$1 = {
  3591. AUTO: 'auto',
  3592. TOP: 'top',
  3593. RIGHT: 'right',
  3594. BOTTOM: 'bottom',
  3595. LEFT: 'left'
  3596. };
  3597. var Default$4 = {
  3598. animation: true,
  3599. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  3600. trigger: 'hover focus',
  3601. title: '',
  3602. delay: 0,
  3603. html: false,
  3604. selector: false,
  3605. placement: 'top',
  3606. offset: 0,
  3607. container: false,
  3608. fallbackPlacement: 'flip',
  3609. boundary: 'scrollParent',
  3610. sanitize: true,
  3611. sanitizeFn: null,
  3612. whiteList: DefaultWhitelist
  3613. };
  3614. var HoverState = {
  3615. SHOW: 'show',
  3616. OUT: 'out'
  3617. };
  3618. var Event$6 = {
  3619. HIDE: "hide" + EVENT_KEY$6,
  3620. HIDDEN: "hidden" + EVENT_KEY$6,
  3621. SHOW: "show" + EVENT_KEY$6,
  3622. SHOWN: "shown" + EVENT_KEY$6,
  3623. INSERTED: "inserted" + EVENT_KEY$6,
  3624. CLICK: "click" + EVENT_KEY$6,
  3625. FOCUSIN: "focusin" + EVENT_KEY$6,
  3626. FOCUSOUT: "focusout" + EVENT_KEY$6,
  3627. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  3628. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  3629. };
  3630. var ClassName$6 = {
  3631. FADE: 'fade',
  3632. SHOW: 'show'
  3633. };
  3634. var Selector$6 = {
  3635. TOOLTIP: '.tooltip',
  3636. TOOLTIP_INNER: '.tooltip-inner',
  3637. ARROW: '.arrow'
  3638. };
  3639. var Trigger = {
  3640. HOVER: 'hover',
  3641. FOCUS: 'focus',
  3642. CLICK: 'click',
  3643. MANUAL: 'manual'
  3644. /**
  3645. * ------------------------------------------------------------------------
  3646. * Class Definition
  3647. * ------------------------------------------------------------------------
  3648. */
  3649. };
  3650. var Tooltip =
  3651. /*#__PURE__*/
  3652. function () {
  3653. function Tooltip(element, config) {
  3654. /**
  3655. * Check for Popper dependency
  3656. * Popper - https://popper.js.org
  3657. */
  3658. if (typeof Popper === 'undefined') {
  3659. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  3660. } // private
  3661. this._isEnabled = true;
  3662. this._timeout = 0;
  3663. this._hoverState = '';
  3664. this._activeTrigger = {};
  3665. this._popper = null; // Protected
  3666. this.element = element;
  3667. this.config = this._getConfig(config);
  3668. this.tip = null;
  3669. this._setListeners();
  3670. } // Getters
  3671. var _proto = Tooltip.prototype;
  3672. // Public
  3673. _proto.enable = function enable() {
  3674. this._isEnabled = true;
  3675. };
  3676. _proto.disable = function disable() {
  3677. this._isEnabled = false;
  3678. };
  3679. _proto.toggleEnabled = function toggleEnabled() {
  3680. this._isEnabled = !this._isEnabled;
  3681. };
  3682. _proto.toggle = function toggle(event) {
  3683. if (!this._isEnabled) {
  3684. return;
  3685. }
  3686. if (event) {
  3687. var dataKey = this.constructor.DATA_KEY;
  3688. var context = $(event.currentTarget).data(dataKey);
  3689. if (!context) {
  3690. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  3691. $(event.currentTarget).data(dataKey, context);
  3692. }
  3693. context._activeTrigger.click = !context._activeTrigger.click;
  3694. if (context._isWithActiveTrigger()) {
  3695. context._enter(null, context);
  3696. } else {
  3697. context._leave(null, context);
  3698. }
  3699. } else {
  3700. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  3701. this._leave(null, this);
  3702. return;
  3703. }
  3704. this._enter(null, this);
  3705. }
  3706. };
  3707. _proto.dispose = function dispose() {
  3708. clearTimeout(this._timeout);
  3709. $.removeData(this.element, this.constructor.DATA_KEY);
  3710. $(this.element).off(this.constructor.EVENT_KEY);
  3711. $(this.element).closest('.modal').off('hide.bs.modal');
  3712. if (this.tip) {
  3713. $(this.tip).remove();
  3714. }
  3715. this._isEnabled = null;
  3716. this._timeout = null;
  3717. this._hoverState = null;
  3718. this._activeTrigger = null;
  3719. if (this._popper !== null) {
  3720. this._popper.destroy();
  3721. }
  3722. this._popper = null;
  3723. this.element = null;
  3724. this.config = null;
  3725. this.tip = null;
  3726. };
  3727. _proto.show = function show() {
  3728. var _this = this;
  3729. if ($(this.element).css('display') === 'none') {
  3730. throw new Error('Please use show on visible elements');
  3731. }
  3732. var showEvent = $.Event(this.constructor.Event.SHOW);
  3733. if (this.isWithContent() && this._isEnabled) {
  3734. $(this.element).trigger(showEvent);
  3735. var shadowRoot = Util.findShadowRoot(this.element);
  3736. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  3737. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  3738. return;
  3739. }
  3740. var tip = this.getTipElement();
  3741. var tipId = Util.getUID(this.constructor.NAME);
  3742. tip.setAttribute('id', tipId);
  3743. this.element.setAttribute('aria-describedby', tipId);
  3744. this.setContent();
  3745. if (this.config.animation) {
  3746. $(tip).addClass(ClassName$6.FADE);
  3747. }
  3748. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  3749. var attachment = this._getAttachment(placement);
  3750. this.addAttachmentClass(attachment);
  3751. var container = this._getContainer();
  3752. $(tip).data(this.constructor.DATA_KEY, this);
  3753. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  3754. $(tip).appendTo(container);
  3755. }
  3756. $(this.element).trigger(this.constructor.Event.INSERTED);
  3757. this._popper = new Popper(this.element, tip, {
  3758. placement: attachment,
  3759. modifiers: {
  3760. offset: this._getOffset(),
  3761. flip: {
  3762. behavior: this.config.fallbackPlacement
  3763. },
  3764. arrow: {
  3765. element: Selector$6.ARROW
  3766. },
  3767. preventOverflow: {
  3768. boundariesElement: this.config.boundary
  3769. }
  3770. },
  3771. onCreate: function onCreate(data) {
  3772. if (data.originalPlacement !== data.placement) {
  3773. _this._handlePopperPlacementChange(data);
  3774. }
  3775. },
  3776. onUpdate: function onUpdate(data) {
  3777. return _this._handlePopperPlacementChange(data);
  3778. }
  3779. });
  3780. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  3781. // empty mouseover listeners to the body's immediate children;
  3782. // only needed because of broken event delegation on iOS
  3783. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3784. if ('ontouchstart' in document.documentElement) {
  3785. $(document.body).children().on('mouseover', null, $.noop);
  3786. }
  3787. var complete = function complete() {
  3788. if (_this.config.animation) {
  3789. _this._fixTransition();
  3790. }
  3791. var prevHoverState = _this._hoverState;
  3792. _this._hoverState = null;
  3793. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  3794. if (prevHoverState === HoverState.OUT) {
  3795. _this._leave(null, _this);
  3796. }
  3797. };
  3798. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  3799. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  3800. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3801. } else {
  3802. complete();
  3803. }
  3804. }
  3805. };
  3806. _proto.hide = function hide(callback) {
  3807. var _this2 = this;
  3808. var tip = this.getTipElement();
  3809. var hideEvent = $.Event(this.constructor.Event.HIDE);
  3810. var complete = function complete() {
  3811. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  3812. tip.parentNode.removeChild(tip);
  3813. }
  3814. _this2._cleanTipClass();
  3815. _this2.element.removeAttribute('aria-describedby');
  3816. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  3817. if (_this2._popper !== null) {
  3818. _this2._popper.destroy();
  3819. }
  3820. if (callback) {
  3821. callback();
  3822. }
  3823. };
  3824. $(this.element).trigger(hideEvent);
  3825. if (hideEvent.isDefaultPrevented()) {
  3826. return;
  3827. }
  3828. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  3829. // empty mouseover listeners we added for iOS support
  3830. if ('ontouchstart' in document.documentElement) {
  3831. $(document.body).children().off('mouseover', null, $.noop);
  3832. }
  3833. this._activeTrigger[Trigger.CLICK] = false;
  3834. this._activeTrigger[Trigger.FOCUS] = false;
  3835. this._activeTrigger[Trigger.HOVER] = false;
  3836. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  3837. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  3838. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3839. } else {
  3840. complete();
  3841. }
  3842. this._hoverState = '';
  3843. };
  3844. _proto.update = function update() {
  3845. if (this._popper !== null) {
  3846. this._popper.scheduleUpdate();
  3847. }
  3848. } // Protected
  3849. ;
  3850. _proto.isWithContent = function isWithContent() {
  3851. return Boolean(this.getTitle());
  3852. };
  3853. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  3854. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  3855. };
  3856. _proto.getTipElement = function getTipElement() {
  3857. this.tip = this.tip || $(this.config.template)[0];
  3858. return this.tip;
  3859. };
  3860. _proto.setContent = function setContent() {
  3861. var tip = this.getTipElement();
  3862. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  3863. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  3864. };
  3865. _proto.setElementContent = function setElementContent($element, content) {
  3866. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  3867. // Content is a DOM node or a jQuery
  3868. if (this.config.html) {
  3869. if (!$(content).parent().is($element)) {
  3870. $element.empty().append(content);
  3871. }
  3872. } else {
  3873. $element.text($(content).text());
  3874. }
  3875. return;
  3876. }
  3877. if (this.config.html) {
  3878. if (this.config.sanitize) {
  3879. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  3880. }
  3881. $element.html(content);
  3882. } else {
  3883. $element.text(content);
  3884. }
  3885. };
  3886. _proto.getTitle = function getTitle() {
  3887. var title = this.element.getAttribute('data-original-title');
  3888. if (!title) {
  3889. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  3890. }
  3891. return title;
  3892. } // Private
  3893. ;
  3894. _proto._getOffset = function _getOffset() {
  3895. var _this3 = this;
  3896. var offset = {};
  3897. if (typeof this.config.offset === 'function') {
  3898. offset.fn = function (data) {
  3899. data.offsets = _objectSpread({}, data.offsets, _this3.config.offset(data.offsets, _this3.element) || {});
  3900. return data;
  3901. };
  3902. } else {
  3903. offset.offset = this.config.offset;
  3904. }
  3905. return offset;
  3906. };
  3907. _proto._getContainer = function _getContainer() {
  3908. if (this.config.container === false) {
  3909. return document.body;
  3910. }
  3911. if (Util.isElement(this.config.container)) {
  3912. return $(this.config.container);
  3913. }
  3914. return $(document).find(this.config.container);
  3915. };
  3916. _proto._getAttachment = function _getAttachment(placement) {
  3917. return AttachmentMap$1[placement.toUpperCase()];
  3918. };
  3919. _proto._setListeners = function _setListeners() {
  3920. var _this4 = this;
  3921. var triggers = this.config.trigger.split(' ');
  3922. triggers.forEach(function (trigger) {
  3923. if (trigger === 'click') {
  3924. $(_this4.element).on(_this4.constructor.Event.CLICK, _this4.config.selector, function (event) {
  3925. return _this4.toggle(event);
  3926. });
  3927. } else if (trigger !== Trigger.MANUAL) {
  3928. var eventIn = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN;
  3929. var eventOut = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT;
  3930. $(_this4.element).on(eventIn, _this4.config.selector, function (event) {
  3931. return _this4._enter(event);
  3932. }).on(eventOut, _this4.config.selector, function (event) {
  3933. return _this4._leave(event);
  3934. });
  3935. }
  3936. });
  3937. $(this.element).closest('.modal').on('hide.bs.modal', function () {
  3938. if (_this4.element) {
  3939. _this4.hide();
  3940. }
  3941. });
  3942. if (this.config.selector) {
  3943. this.config = _objectSpread({}, this.config, {
  3944. trigger: 'manual',
  3945. selector: ''
  3946. });
  3947. } else {
  3948. this._fixTitle();
  3949. }
  3950. };
  3951. _proto._fixTitle = function _fixTitle() {
  3952. var titleType = typeof this.element.getAttribute('data-original-title');
  3953. if (this.element.getAttribute('title') || titleType !== 'string') {
  3954. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  3955. this.element.setAttribute('title', '');
  3956. }
  3957. };
  3958. _proto._enter = function _enter(event, context) {
  3959. var dataKey = this.constructor.DATA_KEY;
  3960. context = context || $(event.currentTarget).data(dataKey);
  3961. if (!context) {
  3962. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  3963. $(event.currentTarget).data(dataKey, context);
  3964. }
  3965. if (event) {
  3966. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  3967. }
  3968. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  3969. context._hoverState = HoverState.SHOW;
  3970. return;
  3971. }
  3972. clearTimeout(context._timeout);
  3973. context._hoverState = HoverState.SHOW;
  3974. if (!context.config.delay || !context.config.delay.show) {
  3975. context.show();
  3976. return;
  3977. }
  3978. context._timeout = setTimeout(function () {
  3979. if (context._hoverState === HoverState.SHOW) {
  3980. context.show();
  3981. }
  3982. }, context.config.delay.show);
  3983. };
  3984. _proto._leave = function _leave(event, context) {
  3985. var dataKey = this.constructor.DATA_KEY;
  3986. context = context || $(event.currentTarget).data(dataKey);
  3987. if (!context) {
  3988. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  3989. $(event.currentTarget).data(dataKey, context);
  3990. }
  3991. if (event) {
  3992. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  3993. }
  3994. if (context._isWithActiveTrigger()) {
  3995. return;
  3996. }
  3997. clearTimeout(context._timeout);
  3998. context._hoverState = HoverState.OUT;
  3999. if (!context.config.delay || !context.config.delay.hide) {
  4000. context.hide();
  4001. return;
  4002. }
  4003. context._timeout = setTimeout(function () {
  4004. if (context._hoverState === HoverState.OUT) {
  4005. context.hide();
  4006. }
  4007. }, context.config.delay.hide);
  4008. };
  4009. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4010. for (var trigger in this._activeTrigger) {
  4011. if (this._activeTrigger[trigger]) {
  4012. return true;
  4013. }
  4014. }
  4015. return false;
  4016. };
  4017. _proto._getConfig = function _getConfig(config) {
  4018. var dataAttributes = $(this.element).data();
  4019. Object.keys(dataAttributes).forEach(function (dataAttr) {
  4020. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  4021. delete dataAttributes[dataAttr];
  4022. }
  4023. });
  4024. config = _objectSpread({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
  4025. if (typeof config.delay === 'number') {
  4026. config.delay = {
  4027. show: config.delay,
  4028. hide: config.delay
  4029. };
  4030. }
  4031. if (typeof config.title === 'number') {
  4032. config.title = config.title.toString();
  4033. }
  4034. if (typeof config.content === 'number') {
  4035. config.content = config.content.toString();
  4036. }
  4037. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4038. if (config.sanitize) {
  4039. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  4040. }
  4041. return config;
  4042. };
  4043. _proto._getDelegateConfig = function _getDelegateConfig() {
  4044. var config = {};
  4045. if (this.config) {
  4046. for (var key in this.config) {
  4047. if (this.constructor.Default[key] !== this.config[key]) {
  4048. config[key] = this.config[key];
  4049. }
  4050. }
  4051. }
  4052. return config;
  4053. };
  4054. _proto._cleanTipClass = function _cleanTipClass() {
  4055. var $tip = $(this.getTipElement());
  4056. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4057. if (tabClass !== null && tabClass.length) {
  4058. $tip.removeClass(tabClass.join(''));
  4059. }
  4060. };
  4061. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4062. var popperInstance = popperData.instance;
  4063. this.tip = popperInstance.popper;
  4064. this._cleanTipClass();
  4065. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4066. };
  4067. _proto._fixTransition = function _fixTransition() {
  4068. var tip = this.getTipElement();
  4069. var initConfigAnimation = this.config.animation;
  4070. if (tip.getAttribute('x-placement') !== null) {
  4071. return;
  4072. }
  4073. $(tip).removeClass(ClassName$6.FADE);
  4074. this.config.animation = false;
  4075. this.hide();
  4076. this.show();
  4077. this.config.animation = initConfigAnimation;
  4078. } // Static
  4079. ;
  4080. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4081. return this.each(function () {
  4082. var data = $(this).data(DATA_KEY$6);
  4083. var _config = typeof config === 'object' && config;
  4084. if (!data && /dispose|hide/.test(config)) {
  4085. return;
  4086. }
  4087. if (!data) {
  4088. data = new Tooltip(this, _config);
  4089. $(this).data(DATA_KEY$6, data);
  4090. }
  4091. if (typeof config === 'string') {
  4092. if (typeof data[config] === 'undefined') {
  4093. throw new TypeError("No method named \"" + config + "\"");
  4094. }
  4095. data[config]();
  4096. }
  4097. });
  4098. };
  4099. _createClass(Tooltip, null, [{
  4100. key: "VERSION",
  4101. get: function get() {
  4102. return VERSION$6;
  4103. }
  4104. }, {
  4105. key: "Default",
  4106. get: function get() {
  4107. return Default$4;
  4108. }
  4109. }, {
  4110. key: "NAME",
  4111. get: function get() {
  4112. return NAME$6;
  4113. }
  4114. }, {
  4115. key: "DATA_KEY",
  4116. get: function get() {
  4117. return DATA_KEY$6;
  4118. }
  4119. }, {
  4120. key: "Event",
  4121. get: function get() {
  4122. return Event$6;
  4123. }
  4124. }, {
  4125. key: "EVENT_KEY",
  4126. get: function get() {
  4127. return EVENT_KEY$6;
  4128. }
  4129. }, {
  4130. key: "DefaultType",
  4131. get: function get() {
  4132. return DefaultType$4;
  4133. }
  4134. }]);
  4135. return Tooltip;
  4136. }();
  4137. /**
  4138. * ------------------------------------------------------------------------
  4139. * jQuery
  4140. * ------------------------------------------------------------------------
  4141. */
  4142. $.fn[NAME$6] = Tooltip._jQueryInterface;
  4143. $.fn[NAME$6].Constructor = Tooltip;
  4144. $.fn[NAME$6].noConflict = function () {
  4145. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  4146. return Tooltip._jQueryInterface;
  4147. };
  4148. /**
  4149. * ------------------------------------------------------------------------
  4150. * Constants
  4151. * ------------------------------------------------------------------------
  4152. */
  4153. var NAME$7 = 'popover';
  4154. var VERSION$7 = '4.3.1';
  4155. var DATA_KEY$7 = 'bs.popover';
  4156. var EVENT_KEY$7 = "." + DATA_KEY$7;
  4157. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  4158. var CLASS_PREFIX$1 = 'bs-popover';
  4159. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  4160. var Default$5 = _objectSpread({}, Tooltip.Default, {
  4161. placement: 'right',
  4162. trigger: 'click',
  4163. content: '',
  4164. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  4165. });
  4166. var DefaultType$5 = _objectSpread({}, Tooltip.DefaultType, {
  4167. content: '(string|element|function)'
  4168. });
  4169. var ClassName$7 = {
  4170. FADE: 'fade',
  4171. SHOW: 'show'
  4172. };
  4173. var Selector$7 = {
  4174. TITLE: '.popover-header',
  4175. CONTENT: '.popover-body'
  4176. };
  4177. var Event$7 = {
  4178. HIDE: "hide" + EVENT_KEY$7,
  4179. HIDDEN: "hidden" + EVENT_KEY$7,
  4180. SHOW: "show" + EVENT_KEY$7,
  4181. SHOWN: "shown" + EVENT_KEY$7,
  4182. INSERTED: "inserted" + EVENT_KEY$7,
  4183. CLICK: "click" + EVENT_KEY$7,
  4184. FOCUSIN: "focusin" + EVENT_KEY$7,
  4185. FOCUSOUT: "focusout" + EVENT_KEY$7,
  4186. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  4187. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  4188. /**
  4189. * ------------------------------------------------------------------------
  4190. * Class Definition
  4191. * ------------------------------------------------------------------------
  4192. */
  4193. };
  4194. var Popover =
  4195. /*#__PURE__*/
  4196. function (_Tooltip) {
  4197. _inheritsLoose(Popover, _Tooltip);
  4198. function Popover() {
  4199. return _Tooltip.apply(this, arguments) || this;
  4200. }
  4201. var _proto = Popover.prototype;
  4202. // Overrides
  4203. _proto.isWithContent = function isWithContent() {
  4204. return this.getTitle() || this._getContent();
  4205. };
  4206. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4207. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  4208. };
  4209. _proto.getTipElement = function getTipElement() {
  4210. this.tip = this.tip || $(this.config.template)[0];
  4211. return this.tip;
  4212. };
  4213. _proto.setContent = function setContent() {
  4214. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  4215. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  4216. var content = this._getContent();
  4217. if (typeof content === 'function') {
  4218. content = content.call(this.element);
  4219. }
  4220. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  4221. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  4222. } // Private
  4223. ;
  4224. _proto._getContent = function _getContent() {
  4225. return this.element.getAttribute('data-content') || this.config.content;
  4226. };
  4227. _proto._cleanTipClass = function _cleanTipClass() {
  4228. var $tip = $(this.getTipElement());
  4229. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  4230. if (tabClass !== null && tabClass.length > 0) {
  4231. $tip.removeClass(tabClass.join(''));
  4232. }
  4233. } // Static
  4234. ;
  4235. Popover._jQueryInterface = function _jQueryInterface(config) {
  4236. return this.each(function () {
  4237. var data = $(this).data(DATA_KEY$7);
  4238. var _config = typeof config === 'object' ? config : null;
  4239. if (!data && /dispose|hide/.test(config)) {
  4240. return;
  4241. }
  4242. if (!data) {
  4243. data = new Popover(this, _config);
  4244. $(this).data(DATA_KEY$7, data);
  4245. }
  4246. if (typeof config === 'string') {
  4247. if (typeof data[config] === 'undefined') {
  4248. throw new TypeError("No method named \"" + config + "\"");
  4249. }
  4250. data[config]();
  4251. }
  4252. });
  4253. };
  4254. _createClass(Popover, null, [{
  4255. key: "VERSION",
  4256. // Getters
  4257. get: function get() {
  4258. return VERSION$7;
  4259. }
  4260. }, {
  4261. key: "Default",
  4262. get: function get() {
  4263. return Default$5;
  4264. }
  4265. }, {
  4266. key: "NAME",
  4267. get: function get() {
  4268. return NAME$7;
  4269. }
  4270. }, {
  4271. key: "DATA_KEY",
  4272. get: function get() {
  4273. return DATA_KEY$7;
  4274. }
  4275. }, {
  4276. key: "Event",
  4277. get: function get() {
  4278. return Event$7;
  4279. }
  4280. }, {
  4281. key: "EVENT_KEY",
  4282. get: function get() {
  4283. return EVENT_KEY$7;
  4284. }
  4285. }, {
  4286. key: "DefaultType",
  4287. get: function get() {
  4288. return DefaultType$5;
  4289. }
  4290. }]);
  4291. return Popover;
  4292. }(Tooltip);
  4293. /**
  4294. * ------------------------------------------------------------------------
  4295. * jQuery
  4296. * ------------------------------------------------------------------------
  4297. */
  4298. $.fn[NAME$7] = Popover._jQueryInterface;
  4299. $.fn[NAME$7].Constructor = Popover;
  4300. $.fn[NAME$7].noConflict = function () {
  4301. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  4302. return Popover._jQueryInterface;
  4303. };
  4304. /**
  4305. * ------------------------------------------------------------------------
  4306. * Constants
  4307. * ------------------------------------------------------------------------
  4308. */
  4309. var NAME$8 = 'scrollspy';
  4310. var VERSION$8 = '4.3.1';
  4311. var DATA_KEY$8 = 'bs.scrollspy';
  4312. var EVENT_KEY$8 = "." + DATA_KEY$8;
  4313. var DATA_API_KEY$6 = '.data-api';
  4314. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  4315. var Default$6 = {
  4316. offset: 10,
  4317. method: 'auto',
  4318. target: ''
  4319. };
  4320. var DefaultType$6 = {
  4321. offset: 'number',
  4322. method: 'string',
  4323. target: '(string|element)'
  4324. };
  4325. var Event$8 = {
  4326. ACTIVATE: "activate" + EVENT_KEY$8,
  4327. SCROLL: "scroll" + EVENT_KEY$8,
  4328. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  4329. };
  4330. var ClassName$8 = {
  4331. DROPDOWN_ITEM: 'dropdown-item',
  4332. DROPDOWN_MENU: 'dropdown-menu',
  4333. ACTIVE: 'active'
  4334. };
  4335. var Selector$8 = {
  4336. DATA_SPY: '[data-spy="scroll"]',
  4337. ACTIVE: '.active',
  4338. NAV_LIST_GROUP: '.nav, .list-group',
  4339. NAV_LINKS: '.nav-link',
  4340. NAV_ITEMS: '.nav-item',
  4341. LIST_ITEMS: '.list-group-item',
  4342. DROPDOWN: '.dropdown',
  4343. DROPDOWN_ITEMS: '.dropdown-item',
  4344. DROPDOWN_TOGGLE: '.dropdown-toggle'
  4345. };
  4346. var OffsetMethod = {
  4347. OFFSET: 'offset',
  4348. POSITION: 'position'
  4349. /**
  4350. * ------------------------------------------------------------------------
  4351. * Class Definition
  4352. * ------------------------------------------------------------------------
  4353. */
  4354. };
  4355. var ScrollSpy =
  4356. /*#__PURE__*/
  4357. function () {
  4358. function ScrollSpy(element, config) {
  4359. var _this = this;
  4360. this._element = element;
  4361. this._scrollElement = element.tagName === 'BODY' ? window : element;
  4362. this._config = this._getConfig(config);
  4363. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  4364. this._offsets = [];
  4365. this._targets = [];
  4366. this._activeTarget = null;
  4367. this._scrollHeight = 0;
  4368. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  4369. return _this._process(event);
  4370. });
  4371. this.refresh();
  4372. this._process();
  4373. } // Getters
  4374. var _proto = ScrollSpy.prototype;
  4375. // Public
  4376. _proto.refresh = function refresh() {
  4377. var _this2 = this;
  4378. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  4379. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  4380. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  4381. this._offsets = [];
  4382. this._targets = [];
  4383. this._scrollHeight = this._getScrollHeight();
  4384. var targets = [].slice.call(document.querySelectorAll(this._selector));
  4385. targets.map(function (element) {
  4386. var target;
  4387. var targetSelector = Util.getSelectorFromElement(element);
  4388. if (targetSelector) {
  4389. target = document.querySelector(targetSelector);
  4390. }
  4391. if (target) {
  4392. var targetBCR = target.getBoundingClientRect();
  4393. if (targetBCR.width || targetBCR.height) {
  4394. // TODO (fat): remove sketch reliance on jQuery position/offset
  4395. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  4396. }
  4397. }
  4398. return null;
  4399. }).filter(function (item) {
  4400. return item;
  4401. }).sort(function (a, b) {
  4402. return a[0] - b[0];
  4403. }).forEach(function (item) {
  4404. _this2._offsets.push(item[0]);
  4405. _this2._targets.push(item[1]);
  4406. });
  4407. };
  4408. _proto.dispose = function dispose() {
  4409. $.removeData(this._element, DATA_KEY$8);
  4410. $(this._scrollElement).off(EVENT_KEY$8);
  4411. this._element = null;
  4412. this._scrollElement = null;
  4413. this._config = null;
  4414. this._selector = null;
  4415. this._offsets = null;
  4416. this._targets = null;
  4417. this._activeTarget = null;
  4418. this._scrollHeight = null;
  4419. } // Private
  4420. ;
  4421. _proto._getConfig = function _getConfig(config) {
  4422. config = _objectSpread({}, Default$6, typeof config === 'object' && config ? config : {});
  4423. if (typeof config.target !== 'string') {
  4424. var id = $(config.target).attr('id');
  4425. if (!id) {
  4426. id = Util.getUID(NAME$8);
  4427. $(config.target).attr('id', id);
  4428. }
  4429. config.target = "#" + id;
  4430. }
  4431. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  4432. return config;
  4433. };
  4434. _proto._getScrollTop = function _getScrollTop() {
  4435. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  4436. };
  4437. _proto._getScrollHeight = function _getScrollHeight() {
  4438. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  4439. };
  4440. _proto._getOffsetHeight = function _getOffsetHeight() {
  4441. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  4442. };
  4443. _proto._process = function _process() {
  4444. var scrollTop = this._getScrollTop() + this._config.offset;
  4445. var scrollHeight = this._getScrollHeight();
  4446. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  4447. if (this._scrollHeight !== scrollHeight) {
  4448. this.refresh();
  4449. }
  4450. if (scrollTop >= maxScroll) {
  4451. var target = this._targets[this._targets.length - 1];
  4452. if (this._activeTarget !== target) {
  4453. this._activate(target);
  4454. }
  4455. return;
  4456. }
  4457. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  4458. this._activeTarget = null;
  4459. this._clear();
  4460. return;
  4461. }
  4462. var offsetLength = this._offsets.length;
  4463. for (var i = offsetLength; i--;) {
  4464. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  4465. if (isActiveTarget) {
  4466. this._activate(this._targets[i]);
  4467. }
  4468. }
  4469. };
  4470. _proto._activate = function _activate(target) {
  4471. this._activeTarget = target;
  4472. this._clear();
  4473. var queries = this._selector.split(',').map(function (selector) {
  4474. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  4475. });
  4476. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  4477. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  4478. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  4479. $link.addClass(ClassName$8.ACTIVE);
  4480. } else {
  4481. // Set triggered link as active
  4482. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  4483. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  4484. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).addClass(ClassName$8.ACTIVE); // Handle special case when .nav-link is inside .nav-item
  4485. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  4486. }
  4487. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  4488. relatedTarget: target
  4489. });
  4490. };
  4491. _proto._clear = function _clear() {
  4492. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  4493. return node.classList.contains(ClassName$8.ACTIVE);
  4494. }).forEach(function (node) {
  4495. return node.classList.remove(ClassName$8.ACTIVE);
  4496. });
  4497. } // Static
  4498. ;
  4499. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  4500. return this.each(function () {
  4501. var data = $(this).data(DATA_KEY$8);
  4502. var _config = typeof config === 'object' && config;
  4503. if (!data) {
  4504. data = new ScrollSpy(this, _config);
  4505. $(this).data(DATA_KEY$8, data);
  4506. }
  4507. if (typeof config === 'string') {
  4508. if (typeof data[config] === 'undefined') {
  4509. throw new TypeError("No method named \"" + config + "\"");
  4510. }
  4511. data[config]();
  4512. }
  4513. });
  4514. };
  4515. _createClass(ScrollSpy, null, [{
  4516. key: "VERSION",
  4517. get: function get() {
  4518. return VERSION$8;
  4519. }
  4520. }, {
  4521. key: "Default",
  4522. get: function get() {
  4523. return Default$6;
  4524. }
  4525. }]);
  4526. return ScrollSpy;
  4527. }();
  4528. /**
  4529. * ------------------------------------------------------------------------
  4530. * Data Api implementation
  4531. * ------------------------------------------------------------------------
  4532. */
  4533. $(window).on(Event$8.LOAD_DATA_API, function () {
  4534. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  4535. var scrollSpysLength = scrollSpys.length;
  4536. for (var i = scrollSpysLength; i--;) {
  4537. var $spy = $(scrollSpys[i]);
  4538. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  4539. }
  4540. });
  4541. /**
  4542. * ------------------------------------------------------------------------
  4543. * jQuery
  4544. * ------------------------------------------------------------------------
  4545. */
  4546. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  4547. $.fn[NAME$8].Constructor = ScrollSpy;
  4548. $.fn[NAME$8].noConflict = function () {
  4549. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  4550. return ScrollSpy._jQueryInterface;
  4551. };
  4552. /**
  4553. * ------------------------------------------------------------------------
  4554. * Constants
  4555. * ------------------------------------------------------------------------
  4556. */
  4557. var NAME$9 = 'tab';
  4558. var VERSION$9 = '4.3.1';
  4559. var DATA_KEY$9 = 'bs.tab';
  4560. var EVENT_KEY$9 = "." + DATA_KEY$9;
  4561. var DATA_API_KEY$7 = '.data-api';
  4562. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  4563. var Event$9 = {
  4564. HIDE: "hide" + EVENT_KEY$9,
  4565. HIDDEN: "hidden" + EVENT_KEY$9,
  4566. SHOW: "show" + EVENT_KEY$9,
  4567. SHOWN: "shown" + EVENT_KEY$9,
  4568. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  4569. };
  4570. var ClassName$9 = {
  4571. DROPDOWN_MENU: 'dropdown-menu',
  4572. ACTIVE: 'active',
  4573. DISABLED: 'disabled',
  4574. FADE: 'fade',
  4575. SHOW: 'show'
  4576. };
  4577. var Selector$9 = {
  4578. DROPDOWN: '.dropdown',
  4579. NAV_LIST_GROUP: '.nav, .list-group',
  4580. ACTIVE: '.active',
  4581. ACTIVE_UL: '> li > .active',
  4582. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  4583. DROPDOWN_TOGGLE: '.dropdown-toggle',
  4584. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  4585. /**
  4586. * ------------------------------------------------------------------------
  4587. * Class Definition
  4588. * ------------------------------------------------------------------------
  4589. */
  4590. };
  4591. var Tab =
  4592. /*#__PURE__*/
  4593. function () {
  4594. function Tab(element) {
  4595. this._element = element;
  4596. } // Getters
  4597. var _proto = Tab.prototype;
  4598. // Public
  4599. _proto.show = function show() {
  4600. var _this = this;
  4601. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  4602. return;
  4603. }
  4604. var target;
  4605. var previous;
  4606. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  4607. var selector = Util.getSelectorFromElement(this._element);
  4608. if (listElement) {
  4609. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  4610. previous = $.makeArray($(listElement).find(itemSelector));
  4611. previous = previous[previous.length - 1];
  4612. }
  4613. var hideEvent = $.Event(Event$9.HIDE, {
  4614. relatedTarget: this._element
  4615. });
  4616. var showEvent = $.Event(Event$9.SHOW, {
  4617. relatedTarget: previous
  4618. });
  4619. if (previous) {
  4620. $(previous).trigger(hideEvent);
  4621. }
  4622. $(this._element).trigger(showEvent);
  4623. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  4624. return;
  4625. }
  4626. if (selector) {
  4627. target = document.querySelector(selector);
  4628. }
  4629. this._activate(this._element, listElement);
  4630. var complete = function complete() {
  4631. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  4632. relatedTarget: _this._element
  4633. });
  4634. var shownEvent = $.Event(Event$9.SHOWN, {
  4635. relatedTarget: previous
  4636. });
  4637. $(previous).trigger(hiddenEvent);
  4638. $(_this._element).trigger(shownEvent);
  4639. };
  4640. if (target) {
  4641. this._activate(target, target.parentNode, complete);
  4642. } else {
  4643. complete();
  4644. }
  4645. };
  4646. _proto.dispose = function dispose() {
  4647. $.removeData(this._element, DATA_KEY$9);
  4648. this._element = null;
  4649. } // Private
  4650. ;
  4651. _proto._activate = function _activate(element, container, callback) {
  4652. var _this2 = this;
  4653. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  4654. var active = activeElements[0];
  4655. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  4656. var complete = function complete() {
  4657. return _this2._transitionComplete(element, active, callback);
  4658. };
  4659. if (active && isTransitioning) {
  4660. var transitionDuration = Util.getTransitionDurationFromElement(active);
  4661. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4662. } else {
  4663. complete();
  4664. }
  4665. };
  4666. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  4667. if (active) {
  4668. $(active).removeClass(ClassName$9.ACTIVE);
  4669. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  4670. if (dropdownChild) {
  4671. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  4672. }
  4673. if (active.getAttribute('role') === 'tab') {
  4674. active.setAttribute('aria-selected', false);
  4675. }
  4676. }
  4677. $(element).addClass(ClassName$9.ACTIVE);
  4678. if (element.getAttribute('role') === 'tab') {
  4679. element.setAttribute('aria-selected', true);
  4680. }
  4681. Util.reflow(element);
  4682. if (element.classList.contains(ClassName$9.FADE)) {
  4683. element.classList.add(ClassName$9.SHOW);
  4684. }
  4685. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  4686. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  4687. if (dropdownElement) {
  4688. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  4689. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  4690. }
  4691. element.setAttribute('aria-expanded', true);
  4692. }
  4693. if (callback) {
  4694. callback();
  4695. }
  4696. } // Static
  4697. ;
  4698. Tab._jQueryInterface = function _jQueryInterface(config) {
  4699. return this.each(function () {
  4700. var $this = $(this);
  4701. var data = $this.data(DATA_KEY$9);
  4702. if (!data) {
  4703. data = new Tab(this);
  4704. $this.data(DATA_KEY$9, data);
  4705. }
  4706. if (typeof config === 'string') {
  4707. if (typeof data[config] === 'undefined') {
  4708. throw new TypeError("No method named \"" + config + "\"");
  4709. }
  4710. data[config]();
  4711. }
  4712. });
  4713. };
  4714. _createClass(Tab, null, [{
  4715. key: "VERSION",
  4716. get: function get() {
  4717. return VERSION$9;
  4718. }
  4719. }]);
  4720. return Tab;
  4721. }();
  4722. /**
  4723. * ------------------------------------------------------------------------
  4724. * Data Api implementation
  4725. * ------------------------------------------------------------------------
  4726. */
  4727. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  4728. event.preventDefault();
  4729. Tab._jQueryInterface.call($(this), 'show');
  4730. });
  4731. /**
  4732. * ------------------------------------------------------------------------
  4733. * jQuery
  4734. * ------------------------------------------------------------------------
  4735. */
  4736. $.fn[NAME$9] = Tab._jQueryInterface;
  4737. $.fn[NAME$9].Constructor = Tab;
  4738. $.fn[NAME$9].noConflict = function () {
  4739. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  4740. return Tab._jQueryInterface;
  4741. };
  4742. /**
  4743. * ------------------------------------------------------------------------
  4744. * Constants
  4745. * ------------------------------------------------------------------------
  4746. */
  4747. var NAME$a = 'toast';
  4748. var VERSION$a = '4.3.1';
  4749. var DATA_KEY$a = 'bs.toast';
  4750. var EVENT_KEY$a = "." + DATA_KEY$a;
  4751. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  4752. var Event$a = {
  4753. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  4754. HIDE: "hide" + EVENT_KEY$a,
  4755. HIDDEN: "hidden" + EVENT_KEY$a,
  4756. SHOW: "show" + EVENT_KEY$a,
  4757. SHOWN: "shown" + EVENT_KEY$a
  4758. };
  4759. var ClassName$a = {
  4760. FADE: 'fade',
  4761. HIDE: 'hide',
  4762. SHOW: 'show',
  4763. SHOWING: 'showing'
  4764. };
  4765. var DefaultType$7 = {
  4766. animation: 'boolean',
  4767. autohide: 'boolean',
  4768. delay: 'number'
  4769. };
  4770. var Default$7 = {
  4771. animation: true,
  4772. autohide: true,
  4773. delay: 500
  4774. };
  4775. var Selector$a = {
  4776. DATA_DISMISS: '[data-dismiss="toast"]'
  4777. /**
  4778. * ------------------------------------------------------------------------
  4779. * Class Definition
  4780. * ------------------------------------------------------------------------
  4781. */
  4782. };
  4783. var Toast =
  4784. /*#__PURE__*/
  4785. function () {
  4786. function Toast(element, config) {
  4787. this._element = element;
  4788. this._config = this._getConfig(config);
  4789. this._timeout = null;
  4790. this._setListeners();
  4791. } // Getters
  4792. var _proto = Toast.prototype;
  4793. // Public
  4794. _proto.show = function show() {
  4795. var _this = this;
  4796. $(this._element).trigger(Event$a.SHOW);
  4797. if (this._config.animation) {
  4798. this._element.classList.add(ClassName$a.FADE);
  4799. }
  4800. var complete = function complete() {
  4801. _this._element.classList.remove(ClassName$a.SHOWING);
  4802. _this._element.classList.add(ClassName$a.SHOW);
  4803. $(_this._element).trigger(Event$a.SHOWN);
  4804. if (_this._config.autohide) {
  4805. _this.hide();
  4806. }
  4807. };
  4808. this._element.classList.remove(ClassName$a.HIDE);
  4809. this._element.classList.add(ClassName$a.SHOWING);
  4810. if (this._config.animation) {
  4811. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4812. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4813. } else {
  4814. complete();
  4815. }
  4816. };
  4817. _proto.hide = function hide(withoutTimeout) {
  4818. var _this2 = this;
  4819. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  4820. return;
  4821. }
  4822. $(this._element).trigger(Event$a.HIDE);
  4823. if (withoutTimeout) {
  4824. this._close();
  4825. } else {
  4826. this._timeout = setTimeout(function () {
  4827. _this2._close();
  4828. }, this._config.delay);
  4829. }
  4830. };
  4831. _proto.dispose = function dispose() {
  4832. clearTimeout(this._timeout);
  4833. this._timeout = null;
  4834. if (this._element.classList.contains(ClassName$a.SHOW)) {
  4835. this._element.classList.remove(ClassName$a.SHOW);
  4836. }
  4837. $(this._element).off(Event$a.CLICK_DISMISS);
  4838. $.removeData(this._element, DATA_KEY$a);
  4839. this._element = null;
  4840. this._config = null;
  4841. } // Private
  4842. ;
  4843. _proto._getConfig = function _getConfig(config) {
  4844. config = _objectSpread({}, Default$7, $(this._element).data(), typeof config === 'object' && config ? config : {});
  4845. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  4846. return config;
  4847. };
  4848. _proto._setListeners = function _setListeners() {
  4849. var _this3 = this;
  4850. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  4851. return _this3.hide(true);
  4852. });
  4853. };
  4854. _proto._close = function _close() {
  4855. var _this4 = this;
  4856. var complete = function complete() {
  4857. _this4._element.classList.add(ClassName$a.HIDE);
  4858. $(_this4._element).trigger(Event$a.HIDDEN);
  4859. };
  4860. this._element.classList.remove(ClassName$a.SHOW);
  4861. if (this._config.animation) {
  4862. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4863. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4864. } else {
  4865. complete();
  4866. }
  4867. } // Static
  4868. ;
  4869. Toast._jQueryInterface = function _jQueryInterface(config) {
  4870. return this.each(function () {
  4871. var $element = $(this);
  4872. var data = $element.data(DATA_KEY$a);
  4873. var _config = typeof config === 'object' && config;
  4874. if (!data) {
  4875. data = new Toast(this, _config);
  4876. $element.data(DATA_KEY$a, data);
  4877. }
  4878. if (typeof config === 'string') {
  4879. if (typeof data[config] === 'undefined') {
  4880. throw new TypeError("No method named \"" + config + "\"");
  4881. }
  4882. data[config](this);
  4883. }
  4884. });
  4885. };
  4886. _createClass(Toast, null, [{
  4887. key: "VERSION",
  4888. get: function get() {
  4889. return VERSION$a;
  4890. }
  4891. }, {
  4892. key: "DefaultType",
  4893. get: function get() {
  4894. return DefaultType$7;
  4895. }
  4896. }, {
  4897. key: "Default",
  4898. get: function get() {
  4899. return Default$7;
  4900. }
  4901. }]);
  4902. return Toast;
  4903. }();
  4904. /**
  4905. * ------------------------------------------------------------------------
  4906. * jQuery
  4907. * ------------------------------------------------------------------------
  4908. */
  4909. $.fn[NAME$a] = Toast._jQueryInterface;
  4910. $.fn[NAME$a].Constructor = Toast;
  4911. $.fn[NAME$a].noConflict = function () {
  4912. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  4913. return Toast._jQueryInterface;
  4914. };
  4915. /**
  4916. * --------------------------------------------------------------------------
  4917. * Bootstrap (v4.3.1): index.js
  4918. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4919. * --------------------------------------------------------------------------
  4920. */
  4921. (function () {
  4922. if (typeof $ === 'undefined') {
  4923. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  4924. }
  4925. var version = $.fn.jquery.split(' ')[0].split('.');
  4926. var minMajor = 1;
  4927. var ltMajor = 2;
  4928. var minMinor = 9;
  4929. var minPatch = 1;
  4930. var maxMajor = 4;
  4931. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  4932. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  4933. }
  4934. })();
  4935. exports.Util = Util;
  4936. exports.Alert = Alert;
  4937. exports.Button = Button;
  4938. exports.Carousel = Carousel;
  4939. exports.Collapse = Collapse;
  4940. exports.Dropdown = Dropdown;
  4941. exports.Modal = Modal;
  4942. exports.Popover = Popover;
  4943. exports.Scrollspy = ScrollSpy;
  4944. exports.Tab = Tab;
  4945. exports.Toast = Toast;
  4946. exports.Tooltip = Tooltip;
  4947. Object.defineProperty(exports, '__esModule', { value: true });
  4948. }));
  4949. //# sourceMappingURL=bootstrap.js.map
  4950. /***/ }),
  4951. /***/ "./node_modules/bootstrap4c-chosen/src/scss/build.scss":
  4952. /***/ (function(module, exports) {
  4953. // removed by extract-text-webpack-plugin
  4954. /***/ }),
  4955. /***/ "./node_modules/is-buffer/index.js":
  4956. /***/ (function(module, exports) {
  4957. /*!
  4958. * Determine if an object is a Buffer
  4959. *
  4960. * @author Feross Aboukhadijeh <https://feross.org>
  4961. * @license MIT
  4962. */
  4963. // The _isBuffer check is for Safari 5-7 support, because it's missing
  4964. // Object.prototype.constructor. Remove this eventually
  4965. module.exports = function (obj) {
  4966. return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
  4967. }
  4968. function isBuffer (obj) {
  4969. return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
  4970. }
  4971. // For Node v0.10 support. Remove this eventually.
  4972. function isSlowBuffer (obj) {
  4973. return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
  4974. }
  4975. /***/ }),
  4976. /***/ "./node_modules/jquery/dist/jquery.js":
  4977. /***/ (function(module, exports, __webpack_require__) {
  4978. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  4979. * jQuery JavaScript Library v3.3.1
  4980. * https://jquery.com/
  4981. *
  4982. * Includes Sizzle.js
  4983. * https://sizzlejs.com/
  4984. *
  4985. * Copyright JS Foundation and other contributors
  4986. * Released under the MIT license
  4987. * https://jquery.org/license
  4988. *
  4989. * Date: 2018-01-20T17:24Z
  4990. */
  4991. ( function( global, factory ) {
  4992. "use strict";
  4993. if ( typeof module === "object" && typeof module.exports === "object" ) {
  4994. // For CommonJS and CommonJS-like environments where a proper `window`
  4995. // is present, execute the factory and get jQuery.
  4996. // For environments that do not have a `window` with a `document`
  4997. // (such as Node.js), expose a factory as module.exports.
  4998. // This accentuates the need for the creation of a real `window`.
  4999. // e.g. var jQuery = require("jquery")(window);
  5000. // See ticket #14549 for more info.
  5001. module.exports = global.document ?
  5002. factory( global, true ) :
  5003. function( w ) {
  5004. if ( !w.document ) {
  5005. throw new Error( "jQuery requires a window with a document" );
  5006. }
  5007. return factory( w );
  5008. };
  5009. } else {
  5010. factory( global );
  5011. }
  5012. // Pass this if window is not defined yet
  5013. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  5014. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  5015. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  5016. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  5017. // enough that all such attempts are guarded in a try block.
  5018. "use strict";
  5019. var arr = [];
  5020. var document = window.document;
  5021. var getProto = Object.getPrototypeOf;
  5022. var slice = arr.slice;
  5023. var concat = arr.concat;
  5024. var push = arr.push;
  5025. var indexOf = arr.indexOf;
  5026. var class2type = {};
  5027. var toString = class2type.toString;
  5028. var hasOwn = class2type.hasOwnProperty;
  5029. var fnToString = hasOwn.toString;
  5030. var ObjectFunctionString = fnToString.call( Object );
  5031. var support = {};
  5032. var isFunction = function isFunction( obj ) {
  5033. // Support: Chrome <=57, Firefox <=52
  5034. // In some browsers, typeof returns "function" for HTML <object> elements
  5035. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  5036. // We don't want to classify *any* DOM node as a function.
  5037. return typeof obj === "function" && typeof obj.nodeType !== "number";
  5038. };
  5039. var isWindow = function isWindow( obj ) {
  5040. return obj != null && obj === obj.window;
  5041. };
  5042. var preservedScriptAttributes = {
  5043. type: true,
  5044. src: true,
  5045. noModule: true
  5046. };
  5047. function DOMEval( code, doc, node ) {
  5048. doc = doc || document;
  5049. var i,
  5050. script = doc.createElement( "script" );
  5051. script.text = code;
  5052. if ( node ) {
  5053. for ( i in preservedScriptAttributes ) {
  5054. if ( node[ i ] ) {
  5055. script[ i ] = node[ i ];
  5056. }
  5057. }
  5058. }
  5059. doc.head.appendChild( script ).parentNode.removeChild( script );
  5060. }
  5061. function toType( obj ) {
  5062. if ( obj == null ) {
  5063. return obj + "";
  5064. }
  5065. // Support: Android <=2.3 only (functionish RegExp)
  5066. return typeof obj === "object" || typeof obj === "function" ?
  5067. class2type[ toString.call( obj ) ] || "object" :
  5068. typeof obj;
  5069. }
  5070. /* global Symbol */
  5071. // Defining this global in .eslintrc.json would create a danger of using the global
  5072. // unguarded in another place, it seems safer to define global only for this module
  5073. var
  5074. version = "3.3.1",
  5075. // Define a local copy of jQuery
  5076. jQuery = function( selector, context ) {
  5077. // The jQuery object is actually just the init constructor 'enhanced'
  5078. // Need init if jQuery is called (just allow error to be thrown if not included)
  5079. return new jQuery.fn.init( selector, context );
  5080. },
  5081. // Support: Android <=4.0 only
  5082. // Make sure we trim BOM and NBSP
  5083. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  5084. jQuery.fn = jQuery.prototype = {
  5085. // The current version of jQuery being used
  5086. jquery: version,
  5087. constructor: jQuery,
  5088. // The default length of a jQuery object is 0
  5089. length: 0,
  5090. toArray: function() {
  5091. return slice.call( this );
  5092. },
  5093. // Get the Nth element in the matched element set OR
  5094. // Get the whole matched element set as a clean array
  5095. get: function( num ) {
  5096. // Return all the elements in a clean array
  5097. if ( num == null ) {
  5098. return slice.call( this );
  5099. }
  5100. // Return just the one element from the set
  5101. return num < 0 ? this[ num + this.length ] : this[ num ];
  5102. },
  5103. // Take an array of elements and push it onto the stack
  5104. // (returning the new matched element set)
  5105. pushStack: function( elems ) {
  5106. // Build a new jQuery matched element set
  5107. var ret = jQuery.merge( this.constructor(), elems );
  5108. // Add the old object onto the stack (as a reference)
  5109. ret.prevObject = this;
  5110. // Return the newly-formed element set
  5111. return ret;
  5112. },
  5113. // Execute a callback for every element in the matched set.
  5114. each: function( callback ) {
  5115. return jQuery.each( this, callback );
  5116. },
  5117. map: function( callback ) {
  5118. return this.pushStack( jQuery.map( this, function( elem, i ) {
  5119. return callback.call( elem, i, elem );
  5120. } ) );
  5121. },
  5122. slice: function() {
  5123. return this.pushStack( slice.apply( this, arguments ) );
  5124. },
  5125. first: function() {
  5126. return this.eq( 0 );
  5127. },
  5128. last: function() {
  5129. return this.eq( -1 );
  5130. },
  5131. eq: function( i ) {
  5132. var len = this.length,
  5133. j = +i + ( i < 0 ? len : 0 );
  5134. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  5135. },
  5136. end: function() {
  5137. return this.prevObject || this.constructor();
  5138. },
  5139. // For internal use only.
  5140. // Behaves like an Array's method, not like a jQuery method.
  5141. push: push,
  5142. sort: arr.sort,
  5143. splice: arr.splice
  5144. };
  5145. jQuery.extend = jQuery.fn.extend = function() {
  5146. var options, name, src, copy, copyIsArray, clone,
  5147. target = arguments[ 0 ] || {},
  5148. i = 1,
  5149. length = arguments.length,
  5150. deep = false;
  5151. // Handle a deep copy situation
  5152. if ( typeof target === "boolean" ) {
  5153. deep = target;
  5154. // Skip the boolean and the target
  5155. target = arguments[ i ] || {};
  5156. i++;
  5157. }
  5158. // Handle case when target is a string or something (possible in deep copy)
  5159. if ( typeof target !== "object" && !isFunction( target ) ) {
  5160. target = {};
  5161. }
  5162. // Extend jQuery itself if only one argument is passed
  5163. if ( i === length ) {
  5164. target = this;
  5165. i--;
  5166. }
  5167. for ( ; i < length; i++ ) {
  5168. // Only deal with non-null/undefined values
  5169. if ( ( options = arguments[ i ] ) != null ) {
  5170. // Extend the base object
  5171. for ( name in options ) {
  5172. src = target[ name ];
  5173. copy = options[ name ];
  5174. // Prevent never-ending loop
  5175. if ( target === copy ) {
  5176. continue;
  5177. }
  5178. // Recurse if we're merging plain objects or arrays
  5179. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  5180. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  5181. if ( copyIsArray ) {
  5182. copyIsArray = false;
  5183. clone = src && Array.isArray( src ) ? src : [];
  5184. } else {
  5185. clone = src && jQuery.isPlainObject( src ) ? src : {};
  5186. }
  5187. // Never move original objects, clone them
  5188. target[ name ] = jQuery.extend( deep, clone, copy );
  5189. // Don't bring in undefined values
  5190. } else if ( copy !== undefined ) {
  5191. target[ name ] = copy;
  5192. }
  5193. }
  5194. }
  5195. }
  5196. // Return the modified object
  5197. return target;
  5198. };
  5199. jQuery.extend( {
  5200. // Unique for each copy of jQuery on the page
  5201. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  5202. // Assume jQuery is ready without the ready module
  5203. isReady: true,
  5204. error: function( msg ) {
  5205. throw new Error( msg );
  5206. },
  5207. noop: function() {},
  5208. isPlainObject: function( obj ) {
  5209. var proto, Ctor;
  5210. // Detect obvious negatives
  5211. // Use toString instead of jQuery.type to catch host objects
  5212. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  5213. return false;
  5214. }
  5215. proto = getProto( obj );
  5216. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  5217. if ( !proto ) {
  5218. return true;
  5219. }
  5220. // Objects with prototype are plain iff they were constructed by a global Object function
  5221. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  5222. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  5223. },
  5224. isEmptyObject: function( obj ) {
  5225. /* eslint-disable no-unused-vars */
  5226. // See https://github.com/eslint/eslint/issues/6125
  5227. var name;
  5228. for ( name in obj ) {
  5229. return false;
  5230. }
  5231. return true;
  5232. },
  5233. // Evaluates a script in a global context
  5234. globalEval: function( code ) {
  5235. DOMEval( code );
  5236. },
  5237. each: function( obj, callback ) {
  5238. var length, i = 0;
  5239. if ( isArrayLike( obj ) ) {
  5240. length = obj.length;
  5241. for ( ; i < length; i++ ) {
  5242. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  5243. break;
  5244. }
  5245. }
  5246. } else {
  5247. for ( i in obj ) {
  5248. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  5249. break;
  5250. }
  5251. }
  5252. }
  5253. return obj;
  5254. },
  5255. // Support: Android <=4.0 only
  5256. trim: function( text ) {
  5257. return text == null ?
  5258. "" :
  5259. ( text + "" ).replace( rtrim, "" );
  5260. },
  5261. // results is for internal usage only
  5262. makeArray: function( arr, results ) {
  5263. var ret = results || [];
  5264. if ( arr != null ) {
  5265. if ( isArrayLike( Object( arr ) ) ) {
  5266. jQuery.merge( ret,
  5267. typeof arr === "string" ?
  5268. [ arr ] : arr
  5269. );
  5270. } else {
  5271. push.call( ret, arr );
  5272. }
  5273. }
  5274. return ret;
  5275. },
  5276. inArray: function( elem, arr, i ) {
  5277. return arr == null ? -1 : indexOf.call( arr, elem, i );
  5278. },
  5279. // Support: Android <=4.0 only, PhantomJS 1 only
  5280. // push.apply(_, arraylike) throws on ancient WebKit
  5281. merge: function( first, second ) {
  5282. var len = +second.length,
  5283. j = 0,
  5284. i = first.length;
  5285. for ( ; j < len; j++ ) {
  5286. first[ i++ ] = second[ j ];
  5287. }
  5288. first.length = i;
  5289. return first;
  5290. },
  5291. grep: function( elems, callback, invert ) {
  5292. var callbackInverse,
  5293. matches = [],
  5294. i = 0,
  5295. length = elems.length,
  5296. callbackExpect = !invert;
  5297. // Go through the array, only saving the items
  5298. // that pass the validator function
  5299. for ( ; i < length; i++ ) {
  5300. callbackInverse = !callback( elems[ i ], i );
  5301. if ( callbackInverse !== callbackExpect ) {
  5302. matches.push( elems[ i ] );
  5303. }
  5304. }
  5305. return matches;
  5306. },
  5307. // arg is for internal usage only
  5308. map: function( elems, callback, arg ) {
  5309. var length, value,
  5310. i = 0,
  5311. ret = [];
  5312. // Go through the array, translating each of the items to their new values
  5313. if ( isArrayLike( elems ) ) {
  5314. length = elems.length;
  5315. for ( ; i < length; i++ ) {
  5316. value = callback( elems[ i ], i, arg );
  5317. if ( value != null ) {
  5318. ret.push( value );
  5319. }
  5320. }
  5321. // Go through every key on the object,
  5322. } else {
  5323. for ( i in elems ) {
  5324. value = callback( elems[ i ], i, arg );
  5325. if ( value != null ) {
  5326. ret.push( value );
  5327. }
  5328. }
  5329. }
  5330. // Flatten any nested arrays
  5331. return concat.apply( [], ret );
  5332. },
  5333. // A global GUID counter for objects
  5334. guid: 1,
  5335. // jQuery.support is not used in Core but other projects attach their
  5336. // properties to it so it needs to exist.
  5337. support: support
  5338. } );
  5339. if ( typeof Symbol === "function" ) {
  5340. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  5341. }
  5342. // Populate the class2type map
  5343. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  5344. function( i, name ) {
  5345. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  5346. } );
  5347. function isArrayLike( obj ) {
  5348. // Support: real iOS 8.2 only (not reproducible in simulator)
  5349. // `in` check used to prevent JIT error (gh-2145)
  5350. // hasOwn isn't used here due to false negatives
  5351. // regarding Nodelist length in IE
  5352. var length = !!obj && "length" in obj && obj.length,
  5353. type = toType( obj );
  5354. if ( isFunction( obj ) || isWindow( obj ) ) {
  5355. return false;
  5356. }
  5357. return type === "array" || length === 0 ||
  5358. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  5359. }
  5360. var Sizzle =
  5361. /*!
  5362. * Sizzle CSS Selector Engine v2.3.3
  5363. * https://sizzlejs.com/
  5364. *
  5365. * Copyright jQuery Foundation and other contributors
  5366. * Released under the MIT license
  5367. * http://jquery.org/license
  5368. *
  5369. * Date: 2016-08-08
  5370. */
  5371. (function( window ) {
  5372. var i,
  5373. support,
  5374. Expr,
  5375. getText,
  5376. isXML,
  5377. tokenize,
  5378. compile,
  5379. select,
  5380. outermostContext,
  5381. sortInput,
  5382. hasDuplicate,
  5383. // Local document vars
  5384. setDocument,
  5385. document,
  5386. docElem,
  5387. documentIsHTML,
  5388. rbuggyQSA,
  5389. rbuggyMatches,
  5390. matches,
  5391. contains,
  5392. // Instance-specific data
  5393. expando = "sizzle" + 1 * new Date(),
  5394. preferredDoc = window.document,
  5395. dirruns = 0,
  5396. done = 0,
  5397. classCache = createCache(),
  5398. tokenCache = createCache(),
  5399. compilerCache = createCache(),
  5400. sortOrder = function( a, b ) {
  5401. if ( a === b ) {
  5402. hasDuplicate = true;
  5403. }
  5404. return 0;
  5405. },
  5406. // Instance methods
  5407. hasOwn = ({}).hasOwnProperty,
  5408. arr = [],
  5409. pop = arr.pop,
  5410. push_native = arr.push,
  5411. push = arr.push,
  5412. slice = arr.slice,
  5413. // Use a stripped-down indexOf as it's faster than native
  5414. // https://jsperf.com/thor-indexof-vs-for/5
  5415. indexOf = function( list, elem ) {
  5416. var i = 0,
  5417. len = list.length;
  5418. for ( ; i < len; i++ ) {
  5419. if ( list[i] === elem ) {
  5420. return i;
  5421. }
  5422. }
  5423. return -1;
  5424. },
  5425. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  5426. // Regular expressions
  5427. // http://www.w3.org/TR/css3-selectors/#whitespace
  5428. whitespace = "[\\x20\\t\\r\\n\\f]",
  5429. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  5430. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  5431. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  5432. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  5433. // Operator (capture 2)
  5434. "*([*^$|!~]?=)" + whitespace +
  5435. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  5436. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  5437. "*\\]",
  5438. pseudos = ":(" + identifier + ")(?:\\((" +
  5439. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  5440. // 1. quoted (capture 3; capture 4 or capture 5)
  5441. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  5442. // 2. simple (capture 6)
  5443. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  5444. // 3. anything else (capture 2)
  5445. ".*" +
  5446. ")\\)|)",
  5447. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  5448. rwhitespace = new RegExp( whitespace + "+", "g" ),
  5449. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  5450. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  5451. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  5452. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  5453. rpseudo = new RegExp( pseudos ),
  5454. ridentifier = new RegExp( "^" + identifier + "$" ),
  5455. matchExpr = {
  5456. "ID": new RegExp( "^#(" + identifier + ")" ),
  5457. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  5458. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  5459. "ATTR": new RegExp( "^" + attributes ),
  5460. "PSEUDO": new RegExp( "^" + pseudos ),
  5461. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  5462. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  5463. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  5464. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  5465. // For use in libraries implementing .is()
  5466. // We use this for POS matching in `select`
  5467. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  5468. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  5469. },
  5470. rinputs = /^(?:input|select|textarea|button)$/i,
  5471. rheader = /^h\d$/i,
  5472. rnative = /^[^{]+\{\s*\[native \w/,
  5473. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  5474. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  5475. rsibling = /[+~]/,
  5476. // CSS escapes
  5477. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  5478. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  5479. funescape = function( _, escaped, escapedWhitespace ) {
  5480. var high = "0x" + escaped - 0x10000;
  5481. // NaN means non-codepoint
  5482. // Support: Firefox<24
  5483. // Workaround erroneous numeric interpretation of +"0x"
  5484. return high !== high || escapedWhitespace ?
  5485. escaped :
  5486. high < 0 ?
  5487. // BMP codepoint
  5488. String.fromCharCode( high + 0x10000 ) :
  5489. // Supplemental Plane codepoint (surrogate pair)
  5490. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  5491. },
  5492. // CSS string/identifier serialization
  5493. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  5494. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  5495. fcssescape = function( ch, asCodePoint ) {
  5496. if ( asCodePoint ) {
  5497. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  5498. if ( ch === "\0" ) {
  5499. return "\uFFFD";
  5500. }
  5501. // Control characters and (dependent upon position) numbers get escaped as code points
  5502. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  5503. }
  5504. // Other potentially-special ASCII characters get backslash-escaped
  5505. return "\\" + ch;
  5506. },
  5507. // Used for iframes
  5508. // See setDocument()
  5509. // Removing the function wrapper causes a "Permission Denied"
  5510. // error in IE
  5511. unloadHandler = function() {
  5512. setDocument();
  5513. },
  5514. disabledAncestor = addCombinator(
  5515. function( elem ) {
  5516. return elem.disabled === true && ("form" in elem || "label" in elem);
  5517. },
  5518. { dir: "parentNode", next: "legend" }
  5519. );
  5520. // Optimize for push.apply( _, NodeList )
  5521. try {
  5522. push.apply(
  5523. (arr = slice.call( preferredDoc.childNodes )),
  5524. preferredDoc.childNodes
  5525. );
  5526. // Support: Android<4.0
  5527. // Detect silently failing push.apply
  5528. arr[ preferredDoc.childNodes.length ].nodeType;
  5529. } catch ( e ) {
  5530. push = { apply: arr.length ?
  5531. // Leverage slice if possible
  5532. function( target, els ) {
  5533. push_native.apply( target, slice.call(els) );
  5534. } :
  5535. // Support: IE<9
  5536. // Otherwise append directly
  5537. function( target, els ) {
  5538. var j = target.length,
  5539. i = 0;
  5540. // Can't trust NodeList.length
  5541. while ( (target[j++] = els[i++]) ) {}
  5542. target.length = j - 1;
  5543. }
  5544. };
  5545. }
  5546. function Sizzle( selector, context, results, seed ) {
  5547. var m, i, elem, nid, match, groups, newSelector,
  5548. newContext = context && context.ownerDocument,
  5549. // nodeType defaults to 9, since context defaults to document
  5550. nodeType = context ? context.nodeType : 9;
  5551. results = results || [];
  5552. // Return early from calls with invalid selector or context
  5553. if ( typeof selector !== "string" || !selector ||
  5554. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  5555. return results;
  5556. }
  5557. // Try to shortcut find operations (as opposed to filters) in HTML documents
  5558. if ( !seed ) {
  5559. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  5560. setDocument( context );
  5561. }
  5562. context = context || document;
  5563. if ( documentIsHTML ) {
  5564. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  5565. // (excepting DocumentFragment context, where the methods don't exist)
  5566. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  5567. // ID selector
  5568. if ( (m = match[1]) ) {
  5569. // Document context
  5570. if ( nodeType === 9 ) {
  5571. if ( (elem = context.getElementById( m )) ) {
  5572. // Support: IE, Opera, Webkit
  5573. // TODO: identify versions
  5574. // getElementById can match elements by name instead of ID
  5575. if ( elem.id === m ) {
  5576. results.push( elem );
  5577. return results;
  5578. }
  5579. } else {
  5580. return results;
  5581. }
  5582. // Element context
  5583. } else {
  5584. // Support: IE, Opera, Webkit
  5585. // TODO: identify versions
  5586. // getElementById can match elements by name instead of ID
  5587. if ( newContext && (elem = newContext.getElementById( m )) &&
  5588. contains( context, elem ) &&
  5589. elem.id === m ) {
  5590. results.push( elem );
  5591. return results;
  5592. }
  5593. }
  5594. // Type selector
  5595. } else if ( match[2] ) {
  5596. push.apply( results, context.getElementsByTagName( selector ) );
  5597. return results;
  5598. // Class selector
  5599. } else if ( (m = match[3]) && support.getElementsByClassName &&
  5600. context.getElementsByClassName ) {
  5601. push.apply( results, context.getElementsByClassName( m ) );
  5602. return results;
  5603. }
  5604. }
  5605. // Take advantage of querySelectorAll
  5606. if ( support.qsa &&
  5607. !compilerCache[ selector + " " ] &&
  5608. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  5609. if ( nodeType !== 1 ) {
  5610. newContext = context;
  5611. newSelector = selector;
  5612. // qSA looks outside Element context, which is not what we want
  5613. // Thanks to Andrew Dupont for this workaround technique
  5614. // Support: IE <=8
  5615. // Exclude object elements
  5616. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  5617. // Capture the context ID, setting it first if necessary
  5618. if ( (nid = context.getAttribute( "id" )) ) {
  5619. nid = nid.replace( rcssescape, fcssescape );
  5620. } else {
  5621. context.setAttribute( "id", (nid = expando) );
  5622. }
  5623. // Prefix every selector in the list
  5624. groups = tokenize( selector );
  5625. i = groups.length;
  5626. while ( i-- ) {
  5627. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  5628. }
  5629. newSelector = groups.join( "," );
  5630. // Expand context for sibling selectors
  5631. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  5632. context;
  5633. }
  5634. if ( newSelector ) {
  5635. try {
  5636. push.apply( results,
  5637. newContext.querySelectorAll( newSelector )
  5638. );
  5639. return results;
  5640. } catch ( qsaError ) {
  5641. } finally {
  5642. if ( nid === expando ) {
  5643. context.removeAttribute( "id" );
  5644. }
  5645. }
  5646. }
  5647. }
  5648. }
  5649. }
  5650. // All others
  5651. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  5652. }
  5653. /**
  5654. * Create key-value caches of limited size
  5655. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  5656. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  5657. * deleting the oldest entry
  5658. */
  5659. function createCache() {
  5660. var keys = [];
  5661. function cache( key, value ) {
  5662. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  5663. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  5664. // Only keep the most recent entries
  5665. delete cache[ keys.shift() ];
  5666. }
  5667. return (cache[ key + " " ] = value);
  5668. }
  5669. return cache;
  5670. }
  5671. /**
  5672. * Mark a function for special use by Sizzle
  5673. * @param {Function} fn The function to mark
  5674. */
  5675. function markFunction( fn ) {
  5676. fn[ expando ] = true;
  5677. return fn;
  5678. }
  5679. /**
  5680. * Support testing using an element
  5681. * @param {Function} fn Passed the created element and returns a boolean result
  5682. */
  5683. function assert( fn ) {
  5684. var el = document.createElement("fieldset");
  5685. try {
  5686. return !!fn( el );
  5687. } catch (e) {
  5688. return false;
  5689. } finally {
  5690. // Remove from its parent by default
  5691. if ( el.parentNode ) {
  5692. el.parentNode.removeChild( el );
  5693. }
  5694. // release memory in IE
  5695. el = null;
  5696. }
  5697. }
  5698. /**
  5699. * Adds the same handler for all of the specified attrs
  5700. * @param {String} attrs Pipe-separated list of attributes
  5701. * @param {Function} handler The method that will be applied
  5702. */
  5703. function addHandle( attrs, handler ) {
  5704. var arr = attrs.split("|"),
  5705. i = arr.length;
  5706. while ( i-- ) {
  5707. Expr.attrHandle[ arr[i] ] = handler;
  5708. }
  5709. }
  5710. /**
  5711. * Checks document order of two siblings
  5712. * @param {Element} a
  5713. * @param {Element} b
  5714. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  5715. */
  5716. function siblingCheck( a, b ) {
  5717. var cur = b && a,
  5718. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  5719. a.sourceIndex - b.sourceIndex;
  5720. // Use IE sourceIndex if available on both nodes
  5721. if ( diff ) {
  5722. return diff;
  5723. }
  5724. // Check if b follows a
  5725. if ( cur ) {
  5726. while ( (cur = cur.nextSibling) ) {
  5727. if ( cur === b ) {
  5728. return -1;
  5729. }
  5730. }
  5731. }
  5732. return a ? 1 : -1;
  5733. }
  5734. /**
  5735. * Returns a function to use in pseudos for input types
  5736. * @param {String} type
  5737. */
  5738. function createInputPseudo( type ) {
  5739. return function( elem ) {
  5740. var name = elem.nodeName.toLowerCase();
  5741. return name === "input" && elem.type === type;
  5742. };
  5743. }
  5744. /**
  5745. * Returns a function to use in pseudos for buttons
  5746. * @param {String} type
  5747. */
  5748. function createButtonPseudo( type ) {
  5749. return function( elem ) {
  5750. var name = elem.nodeName.toLowerCase();
  5751. return (name === "input" || name === "button") && elem.type === type;
  5752. };
  5753. }
  5754. /**
  5755. * Returns a function to use in pseudos for :enabled/:disabled
  5756. * @param {Boolean} disabled true for :disabled; false for :enabled
  5757. */
  5758. function createDisabledPseudo( disabled ) {
  5759. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  5760. return function( elem ) {
  5761. // Only certain elements can match :enabled or :disabled
  5762. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  5763. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  5764. if ( "form" in elem ) {
  5765. // Check for inherited disabledness on relevant non-disabled elements:
  5766. // * listed form-associated elements in a disabled fieldset
  5767. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  5768. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  5769. // * option elements in a disabled optgroup
  5770. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  5771. // All such elements have a "form" property.
  5772. if ( elem.parentNode && elem.disabled === false ) {
  5773. // Option elements defer to a parent optgroup if present
  5774. if ( "label" in elem ) {
  5775. if ( "label" in elem.parentNode ) {
  5776. return elem.parentNode.disabled === disabled;
  5777. } else {
  5778. return elem.disabled === disabled;
  5779. }
  5780. }
  5781. // Support: IE 6 - 11
  5782. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  5783. return elem.isDisabled === disabled ||
  5784. // Where there is no isDisabled, check manually
  5785. /* jshint -W018 */
  5786. elem.isDisabled !== !disabled &&
  5787. disabledAncestor( elem ) === disabled;
  5788. }
  5789. return elem.disabled === disabled;
  5790. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  5791. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  5792. // even exist on them, let alone have a boolean value.
  5793. } else if ( "label" in elem ) {
  5794. return elem.disabled === disabled;
  5795. }
  5796. // Remaining elements are neither :enabled nor :disabled
  5797. return false;
  5798. };
  5799. }
  5800. /**
  5801. * Returns a function to use in pseudos for positionals
  5802. * @param {Function} fn
  5803. */
  5804. function createPositionalPseudo( fn ) {
  5805. return markFunction(function( argument ) {
  5806. argument = +argument;
  5807. return markFunction(function( seed, matches ) {
  5808. var j,
  5809. matchIndexes = fn( [], seed.length, argument ),
  5810. i = matchIndexes.length;
  5811. // Match elements found at the specified indexes
  5812. while ( i-- ) {
  5813. if ( seed[ (j = matchIndexes[i]) ] ) {
  5814. seed[j] = !(matches[j] = seed[j]);
  5815. }
  5816. }
  5817. });
  5818. });
  5819. }
  5820. /**
  5821. * Checks a node for validity as a Sizzle context
  5822. * @param {Element|Object=} context
  5823. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  5824. */
  5825. function testContext( context ) {
  5826. return context && typeof context.getElementsByTagName !== "undefined" && context;
  5827. }
  5828. // Expose support vars for convenience
  5829. support = Sizzle.support = {};
  5830. /**
  5831. * Detects XML nodes
  5832. * @param {Element|Object} elem An element or a document
  5833. * @returns {Boolean} True iff elem is a non-HTML XML node
  5834. */
  5835. isXML = Sizzle.isXML = function( elem ) {
  5836. // documentElement is verified for cases where it doesn't yet exist
  5837. // (such as loading iframes in IE - #4833)
  5838. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  5839. return documentElement ? documentElement.nodeName !== "HTML" : false;
  5840. };
  5841. /**
  5842. * Sets document-related variables once based on the current document
  5843. * @param {Element|Object} [doc] An element or document object to use to set the document
  5844. * @returns {Object} Returns the current document
  5845. */
  5846. setDocument = Sizzle.setDocument = function( node ) {
  5847. var hasCompare, subWindow,
  5848. doc = node ? node.ownerDocument || node : preferredDoc;
  5849. // Return early if doc is invalid or already selected
  5850. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  5851. return document;
  5852. }
  5853. // Update global variables
  5854. document = doc;
  5855. docElem = document.documentElement;
  5856. documentIsHTML = !isXML( document );
  5857. // Support: IE 9-11, Edge
  5858. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  5859. if ( preferredDoc !== document &&
  5860. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  5861. // Support: IE 11, Edge
  5862. if ( subWindow.addEventListener ) {
  5863. subWindow.addEventListener( "unload", unloadHandler, false );
  5864. // Support: IE 9 - 10 only
  5865. } else if ( subWindow.attachEvent ) {
  5866. subWindow.attachEvent( "onunload", unloadHandler );
  5867. }
  5868. }
  5869. /* Attributes
  5870. ---------------------------------------------------------------------- */
  5871. // Support: IE<8
  5872. // Verify that getAttribute really returns attributes and not properties
  5873. // (excepting IE8 booleans)
  5874. support.attributes = assert(function( el ) {
  5875. el.className = "i";
  5876. return !el.getAttribute("className");
  5877. });
  5878. /* getElement(s)By*
  5879. ---------------------------------------------------------------------- */
  5880. // Check if getElementsByTagName("*") returns only elements
  5881. support.getElementsByTagName = assert(function( el ) {
  5882. el.appendChild( document.createComment("") );
  5883. return !el.getElementsByTagName("*").length;
  5884. });
  5885. // Support: IE<9
  5886. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  5887. // Support: IE<10
  5888. // Check if getElementById returns elements by name
  5889. // The broken getElementById methods don't pick up programmatically-set names,
  5890. // so use a roundabout getElementsByName test
  5891. support.getById = assert(function( el ) {
  5892. docElem.appendChild( el ).id = expando;
  5893. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  5894. });
  5895. // ID filter and find
  5896. if ( support.getById ) {
  5897. Expr.filter["ID"] = function( id ) {
  5898. var attrId = id.replace( runescape, funescape );
  5899. return function( elem ) {
  5900. return elem.getAttribute("id") === attrId;
  5901. };
  5902. };
  5903. Expr.find["ID"] = function( id, context ) {
  5904. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  5905. var elem = context.getElementById( id );
  5906. return elem ? [ elem ] : [];
  5907. }
  5908. };
  5909. } else {
  5910. Expr.filter["ID"] = function( id ) {
  5911. var attrId = id.replace( runescape, funescape );
  5912. return function( elem ) {
  5913. var node = typeof elem.getAttributeNode !== "undefined" &&
  5914. elem.getAttributeNode("id");
  5915. return node && node.value === attrId;
  5916. };
  5917. };
  5918. // Support: IE 6 - 7 only
  5919. // getElementById is not reliable as a find shortcut
  5920. Expr.find["ID"] = function( id, context ) {
  5921. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  5922. var node, i, elems,
  5923. elem = context.getElementById( id );
  5924. if ( elem ) {
  5925. // Verify the id attribute
  5926. node = elem.getAttributeNode("id");
  5927. if ( node && node.value === id ) {
  5928. return [ elem ];
  5929. }
  5930. // Fall back on getElementsByName
  5931. elems = context.getElementsByName( id );
  5932. i = 0;
  5933. while ( (elem = elems[i++]) ) {
  5934. node = elem.getAttributeNode("id");
  5935. if ( node && node.value === id ) {
  5936. return [ elem ];
  5937. }
  5938. }
  5939. }
  5940. return [];
  5941. }
  5942. };
  5943. }
  5944. // Tag
  5945. Expr.find["TAG"] = support.getElementsByTagName ?
  5946. function( tag, context ) {
  5947. if ( typeof context.getElementsByTagName !== "undefined" ) {
  5948. return context.getElementsByTagName( tag );
  5949. // DocumentFragment nodes don't have gEBTN
  5950. } else if ( support.qsa ) {
  5951. return context.querySelectorAll( tag );
  5952. }
  5953. } :
  5954. function( tag, context ) {
  5955. var elem,
  5956. tmp = [],
  5957. i = 0,
  5958. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  5959. results = context.getElementsByTagName( tag );
  5960. // Filter out possible comments
  5961. if ( tag === "*" ) {
  5962. while ( (elem = results[i++]) ) {
  5963. if ( elem.nodeType === 1 ) {
  5964. tmp.push( elem );
  5965. }
  5966. }
  5967. return tmp;
  5968. }
  5969. return results;
  5970. };
  5971. // Class
  5972. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  5973. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  5974. return context.getElementsByClassName( className );
  5975. }
  5976. };
  5977. /* QSA/matchesSelector
  5978. ---------------------------------------------------------------------- */
  5979. // QSA and matchesSelector support
  5980. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  5981. rbuggyMatches = [];
  5982. // qSa(:focus) reports false when true (Chrome 21)
  5983. // We allow this because of a bug in IE8/9 that throws an error
  5984. // whenever `document.activeElement` is accessed on an iframe
  5985. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  5986. // See https://bugs.jquery.com/ticket/13378
  5987. rbuggyQSA = [];
  5988. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  5989. // Build QSA regex
  5990. // Regex strategy adopted from Diego Perini
  5991. assert(function( el ) {
  5992. // Select is set to empty string on purpose
  5993. // This is to test IE's treatment of not explicitly
  5994. // setting a boolean content attribute,
  5995. // since its presence should be enough
  5996. // https://bugs.jquery.com/ticket/12359
  5997. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  5998. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  5999. "<option selected=''></option></select>";
  6000. // Support: IE8, Opera 11-12.16
  6001. // Nothing should be selected when empty strings follow ^= or $= or *=
  6002. // The test attribute must be unknown in Opera but "safe" for WinRT
  6003. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  6004. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  6005. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  6006. }
  6007. // Support: IE8
  6008. // Boolean attributes and "value" are not treated correctly
  6009. if ( !el.querySelectorAll("[selected]").length ) {
  6010. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  6011. }
  6012. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  6013. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  6014. rbuggyQSA.push("~=");
  6015. }
  6016. // Webkit/Opera - :checked should return selected option elements
  6017. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  6018. // IE8 throws error here and will not see later tests
  6019. if ( !el.querySelectorAll(":checked").length ) {
  6020. rbuggyQSA.push(":checked");
  6021. }
  6022. // Support: Safari 8+, iOS 8+
  6023. // https://bugs.webkit.org/show_bug.cgi?id=136851
  6024. // In-page `selector#id sibling-combinator selector` fails
  6025. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  6026. rbuggyQSA.push(".#.+[+~]");
  6027. }
  6028. });
  6029. assert(function( el ) {
  6030. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  6031. "<select disabled='disabled'><option/></select>";
  6032. // Support: Windows 8 Native Apps
  6033. // The type and name attributes are restricted during .innerHTML assignment
  6034. var input = document.createElement("input");
  6035. input.setAttribute( "type", "hidden" );
  6036. el.appendChild( input ).setAttribute( "name", "D" );
  6037. // Support: IE8
  6038. // Enforce case-sensitivity of name attribute
  6039. if ( el.querySelectorAll("[name=d]").length ) {
  6040. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  6041. }
  6042. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  6043. // IE8 throws error here and will not see later tests
  6044. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  6045. rbuggyQSA.push( ":enabled", ":disabled" );
  6046. }
  6047. // Support: IE9-11+
  6048. // IE's :disabled selector does not pick up the children of disabled fieldsets
  6049. docElem.appendChild( el ).disabled = true;
  6050. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  6051. rbuggyQSA.push( ":enabled", ":disabled" );
  6052. }
  6053. // Opera 10-11 does not throw on post-comma invalid pseudos
  6054. el.querySelectorAll("*,:x");
  6055. rbuggyQSA.push(",.*:");
  6056. });
  6057. }
  6058. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  6059. docElem.webkitMatchesSelector ||
  6060. docElem.mozMatchesSelector ||
  6061. docElem.oMatchesSelector ||
  6062. docElem.msMatchesSelector) )) ) {
  6063. assert(function( el ) {
  6064. // Check to see if it's possible to do matchesSelector
  6065. // on a disconnected node (IE 9)
  6066. support.disconnectedMatch = matches.call( el, "*" );
  6067. // This should fail with an exception
  6068. // Gecko does not error, returns false instead
  6069. matches.call( el, "[s!='']:x" );
  6070. rbuggyMatches.push( "!=", pseudos );
  6071. });
  6072. }
  6073. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  6074. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  6075. /* Contains
  6076. ---------------------------------------------------------------------- */
  6077. hasCompare = rnative.test( docElem.compareDocumentPosition );
  6078. // Element contains another
  6079. // Purposefully self-exclusive
  6080. // As in, an element does not contain itself
  6081. contains = hasCompare || rnative.test( docElem.contains ) ?
  6082. function( a, b ) {
  6083. var adown = a.nodeType === 9 ? a.documentElement : a,
  6084. bup = b && b.parentNode;
  6085. return a === bup || !!( bup && bup.nodeType === 1 && (
  6086. adown.contains ?
  6087. adown.contains( bup ) :
  6088. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  6089. ));
  6090. } :
  6091. function( a, b ) {
  6092. if ( b ) {
  6093. while ( (b = b.parentNode) ) {
  6094. if ( b === a ) {
  6095. return true;
  6096. }
  6097. }
  6098. }
  6099. return false;
  6100. };
  6101. /* Sorting
  6102. ---------------------------------------------------------------------- */
  6103. // Document order sorting
  6104. sortOrder = hasCompare ?
  6105. function( a, b ) {
  6106. // Flag for duplicate removal
  6107. if ( a === b ) {
  6108. hasDuplicate = true;
  6109. return 0;
  6110. }
  6111. // Sort on method existence if only one input has compareDocumentPosition
  6112. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  6113. if ( compare ) {
  6114. return compare;
  6115. }
  6116. // Calculate position if both inputs belong to the same document
  6117. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  6118. a.compareDocumentPosition( b ) :
  6119. // Otherwise we know they are disconnected
  6120. 1;
  6121. // Disconnected nodes
  6122. if ( compare & 1 ||
  6123. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  6124. // Choose the first element that is related to our preferred document
  6125. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  6126. return -1;
  6127. }
  6128. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  6129. return 1;
  6130. }
  6131. // Maintain original order
  6132. return sortInput ?
  6133. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  6134. 0;
  6135. }
  6136. return compare & 4 ? -1 : 1;
  6137. } :
  6138. function( a, b ) {
  6139. // Exit early if the nodes are identical
  6140. if ( a === b ) {
  6141. hasDuplicate = true;
  6142. return 0;
  6143. }
  6144. var cur,
  6145. i = 0,
  6146. aup = a.parentNode,
  6147. bup = b.parentNode,
  6148. ap = [ a ],
  6149. bp = [ b ];
  6150. // Parentless nodes are either documents or disconnected
  6151. if ( !aup || !bup ) {
  6152. return a === document ? -1 :
  6153. b === document ? 1 :
  6154. aup ? -1 :
  6155. bup ? 1 :
  6156. sortInput ?
  6157. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  6158. 0;
  6159. // If the nodes are siblings, we can do a quick check
  6160. } else if ( aup === bup ) {
  6161. return siblingCheck( a, b );
  6162. }
  6163. // Otherwise we need full lists of their ancestors for comparison
  6164. cur = a;
  6165. while ( (cur = cur.parentNode) ) {
  6166. ap.unshift( cur );
  6167. }
  6168. cur = b;
  6169. while ( (cur = cur.parentNode) ) {
  6170. bp.unshift( cur );
  6171. }
  6172. // Walk down the tree looking for a discrepancy
  6173. while ( ap[i] === bp[i] ) {
  6174. i++;
  6175. }
  6176. return i ?
  6177. // Do a sibling check if the nodes have a common ancestor
  6178. siblingCheck( ap[i], bp[i] ) :
  6179. // Otherwise nodes in our document sort first
  6180. ap[i] === preferredDoc ? -1 :
  6181. bp[i] === preferredDoc ? 1 :
  6182. 0;
  6183. };
  6184. return document;
  6185. };
  6186. Sizzle.matches = function( expr, elements ) {
  6187. return Sizzle( expr, null, null, elements );
  6188. };
  6189. Sizzle.matchesSelector = function( elem, expr ) {
  6190. // Set document vars if needed
  6191. if ( ( elem.ownerDocument || elem ) !== document ) {
  6192. setDocument( elem );
  6193. }
  6194. // Make sure that attribute selectors are quoted
  6195. expr = expr.replace( rattributeQuotes, "='$1']" );
  6196. if ( support.matchesSelector && documentIsHTML &&
  6197. !compilerCache[ expr + " " ] &&
  6198. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  6199. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  6200. try {
  6201. var ret = matches.call( elem, expr );
  6202. // IE 9's matchesSelector returns false on disconnected nodes
  6203. if ( ret || support.disconnectedMatch ||
  6204. // As well, disconnected nodes are said to be in a document
  6205. // fragment in IE 9
  6206. elem.document && elem.document.nodeType !== 11 ) {
  6207. return ret;
  6208. }
  6209. } catch (e) {}
  6210. }
  6211. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  6212. };
  6213. Sizzle.contains = function( context, elem ) {
  6214. // Set document vars if needed
  6215. if ( ( context.ownerDocument || context ) !== document ) {
  6216. setDocument( context );
  6217. }
  6218. return contains( context, elem );
  6219. };
  6220. Sizzle.attr = function( elem, name ) {
  6221. // Set document vars if needed
  6222. if ( ( elem.ownerDocument || elem ) !== document ) {
  6223. setDocument( elem );
  6224. }
  6225. var fn = Expr.attrHandle[ name.toLowerCase() ],
  6226. // Don't get fooled by Object.prototype properties (jQuery #13807)
  6227. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  6228. fn( elem, name, !documentIsHTML ) :
  6229. undefined;
  6230. return val !== undefined ?
  6231. val :
  6232. support.attributes || !documentIsHTML ?
  6233. elem.getAttribute( name ) :
  6234. (val = elem.getAttributeNode(name)) && val.specified ?
  6235. val.value :
  6236. null;
  6237. };
  6238. Sizzle.escape = function( sel ) {
  6239. return (sel + "").replace( rcssescape, fcssescape );
  6240. };
  6241. Sizzle.error = function( msg ) {
  6242. throw new Error( "Syntax error, unrecognized expression: " + msg );
  6243. };
  6244. /**
  6245. * Document sorting and removing duplicates
  6246. * @param {ArrayLike} results
  6247. */
  6248. Sizzle.uniqueSort = function( results ) {
  6249. var elem,
  6250. duplicates = [],
  6251. j = 0,
  6252. i = 0;
  6253. // Unless we *know* we can detect duplicates, assume their presence
  6254. hasDuplicate = !support.detectDuplicates;
  6255. sortInput = !support.sortStable && results.slice( 0 );
  6256. results.sort( sortOrder );
  6257. if ( hasDuplicate ) {
  6258. while ( (elem = results[i++]) ) {
  6259. if ( elem === results[ i ] ) {
  6260. j = duplicates.push( i );
  6261. }
  6262. }
  6263. while ( j-- ) {
  6264. results.splice( duplicates[ j ], 1 );
  6265. }
  6266. }
  6267. // Clear input after sorting to release objects
  6268. // See https://github.com/jquery/sizzle/pull/225
  6269. sortInput = null;
  6270. return results;
  6271. };
  6272. /**
  6273. * Utility function for retrieving the text value of an array of DOM nodes
  6274. * @param {Array|Element} elem
  6275. */
  6276. getText = Sizzle.getText = function( elem ) {
  6277. var node,
  6278. ret = "",
  6279. i = 0,
  6280. nodeType = elem.nodeType;
  6281. if ( !nodeType ) {
  6282. // If no nodeType, this is expected to be an array
  6283. while ( (node = elem[i++]) ) {
  6284. // Do not traverse comment nodes
  6285. ret += getText( node );
  6286. }
  6287. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  6288. // Use textContent for elements
  6289. // innerText usage removed for consistency of new lines (jQuery #11153)
  6290. if ( typeof elem.textContent === "string" ) {
  6291. return elem.textContent;
  6292. } else {
  6293. // Traverse its children
  6294. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  6295. ret += getText( elem );
  6296. }
  6297. }
  6298. } else if ( nodeType === 3 || nodeType === 4 ) {
  6299. return elem.nodeValue;
  6300. }
  6301. // Do not include comment or processing instruction nodes
  6302. return ret;
  6303. };
  6304. Expr = Sizzle.selectors = {
  6305. // Can be adjusted by the user
  6306. cacheLength: 50,
  6307. createPseudo: markFunction,
  6308. match: matchExpr,
  6309. attrHandle: {},
  6310. find: {},
  6311. relative: {
  6312. ">": { dir: "parentNode", first: true },
  6313. " ": { dir: "parentNode" },
  6314. "+": { dir: "previousSibling", first: true },
  6315. "~": { dir: "previousSibling" }
  6316. },
  6317. preFilter: {
  6318. "ATTR": function( match ) {
  6319. match[1] = match[1].replace( runescape, funescape );
  6320. // Move the given value to match[3] whether quoted or unquoted
  6321. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  6322. if ( match[2] === "~=" ) {
  6323. match[3] = " " + match[3] + " ";
  6324. }
  6325. return match.slice( 0, 4 );
  6326. },
  6327. "CHILD": function( match ) {
  6328. /* matches from matchExpr["CHILD"]
  6329. 1 type (only|nth|...)
  6330. 2 what (child|of-type)
  6331. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  6332. 4 xn-component of xn+y argument ([+-]?\d*n|)
  6333. 5 sign of xn-component
  6334. 6 x of xn-component
  6335. 7 sign of y-component
  6336. 8 y of y-component
  6337. */
  6338. match[1] = match[1].toLowerCase();
  6339. if ( match[1].slice( 0, 3 ) === "nth" ) {
  6340. // nth-* requires argument
  6341. if ( !match[3] ) {
  6342. Sizzle.error( match[0] );
  6343. }
  6344. // numeric x and y parameters for Expr.filter.CHILD
  6345. // remember that false/true cast respectively to 0/1
  6346. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  6347. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  6348. // other types prohibit arguments
  6349. } else if ( match[3] ) {
  6350. Sizzle.error( match[0] );
  6351. }
  6352. return match;
  6353. },
  6354. "PSEUDO": function( match ) {
  6355. var excess,
  6356. unquoted = !match[6] && match[2];
  6357. if ( matchExpr["CHILD"].test( match[0] ) ) {
  6358. return null;
  6359. }
  6360. // Accept quoted arguments as-is
  6361. if ( match[3] ) {
  6362. match[2] = match[4] || match[5] || "";
  6363. // Strip excess characters from unquoted arguments
  6364. } else if ( unquoted && rpseudo.test( unquoted ) &&
  6365. // Get excess from tokenize (recursively)
  6366. (excess = tokenize( unquoted, true )) &&
  6367. // advance to the next closing parenthesis
  6368. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  6369. // excess is a negative index
  6370. match[0] = match[0].slice( 0, excess );
  6371. match[2] = unquoted.slice( 0, excess );
  6372. }
  6373. // Return only captures needed by the pseudo filter method (type and argument)
  6374. return match.slice( 0, 3 );
  6375. }
  6376. },
  6377. filter: {
  6378. "TAG": function( nodeNameSelector ) {
  6379. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  6380. return nodeNameSelector === "*" ?
  6381. function() { return true; } :
  6382. function( elem ) {
  6383. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  6384. };
  6385. },
  6386. "CLASS": function( className ) {
  6387. var pattern = classCache[ className + " " ];
  6388. return pattern ||
  6389. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  6390. classCache( className, function( elem ) {
  6391. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  6392. });
  6393. },
  6394. "ATTR": function( name, operator, check ) {
  6395. return function( elem ) {
  6396. var result = Sizzle.attr( elem, name );
  6397. if ( result == null ) {
  6398. return operator === "!=";
  6399. }
  6400. if ( !operator ) {
  6401. return true;
  6402. }
  6403. result += "";
  6404. return operator === "=" ? result === check :
  6405. operator === "!=" ? result !== check :
  6406. operator === "^=" ? check && result.indexOf( check ) === 0 :
  6407. operator === "*=" ? check && result.indexOf( check ) > -1 :
  6408. operator === "$=" ? check && result.slice( -check.length ) === check :
  6409. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  6410. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  6411. false;
  6412. };
  6413. },
  6414. "CHILD": function( type, what, argument, first, last ) {
  6415. var simple = type.slice( 0, 3 ) !== "nth",
  6416. forward = type.slice( -4 ) !== "last",
  6417. ofType = what === "of-type";
  6418. return first === 1 && last === 0 ?
  6419. // Shortcut for :nth-*(n)
  6420. function( elem ) {
  6421. return !!elem.parentNode;
  6422. } :
  6423. function( elem, context, xml ) {
  6424. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  6425. dir = simple !== forward ? "nextSibling" : "previousSibling",
  6426. parent = elem.parentNode,
  6427. name = ofType && elem.nodeName.toLowerCase(),
  6428. useCache = !xml && !ofType,
  6429. diff = false;
  6430. if ( parent ) {
  6431. // :(first|last|only)-(child|of-type)
  6432. if ( simple ) {
  6433. while ( dir ) {
  6434. node = elem;
  6435. while ( (node = node[ dir ]) ) {
  6436. if ( ofType ?
  6437. node.nodeName.toLowerCase() === name :
  6438. node.nodeType === 1 ) {
  6439. return false;
  6440. }
  6441. }
  6442. // Reverse direction for :only-* (if we haven't yet done so)
  6443. start = dir = type === "only" && !start && "nextSibling";
  6444. }
  6445. return true;
  6446. }
  6447. start = [ forward ? parent.firstChild : parent.lastChild ];
  6448. // non-xml :nth-child(...) stores cache data on `parent`
  6449. if ( forward && useCache ) {
  6450. // Seek `elem` from a previously-cached index
  6451. // ...in a gzip-friendly way
  6452. node = parent;
  6453. outerCache = node[ expando ] || (node[ expando ] = {});
  6454. // Support: IE <9 only
  6455. // Defend against cloned attroperties (jQuery gh-1709)
  6456. uniqueCache = outerCache[ node.uniqueID ] ||
  6457. (outerCache[ node.uniqueID ] = {});
  6458. cache = uniqueCache[ type ] || [];
  6459. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  6460. diff = nodeIndex && cache[ 2 ];
  6461. node = nodeIndex && parent.childNodes[ nodeIndex ];
  6462. while ( (node = ++nodeIndex && node && node[ dir ] ||
  6463. // Fallback to seeking `elem` from the start
  6464. (diff = nodeIndex = 0) || start.pop()) ) {
  6465. // When found, cache indexes on `parent` and break
  6466. if ( node.nodeType === 1 && ++diff && node === elem ) {
  6467. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  6468. break;
  6469. }
  6470. }
  6471. } else {
  6472. // Use previously-cached element index if available
  6473. if ( useCache ) {
  6474. // ...in a gzip-friendly way
  6475. node = elem;
  6476. outerCache = node[ expando ] || (node[ expando ] = {});
  6477. // Support: IE <9 only
  6478. // Defend against cloned attroperties (jQuery gh-1709)
  6479. uniqueCache = outerCache[ node.uniqueID ] ||
  6480. (outerCache[ node.uniqueID ] = {});
  6481. cache = uniqueCache[ type ] || [];
  6482. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  6483. diff = nodeIndex;
  6484. }
  6485. // xml :nth-child(...)
  6486. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  6487. if ( diff === false ) {
  6488. // Use the same loop as above to seek `elem` from the start
  6489. while ( (node = ++nodeIndex && node && node[ dir ] ||
  6490. (diff = nodeIndex = 0) || start.pop()) ) {
  6491. if ( ( ofType ?
  6492. node.nodeName.toLowerCase() === name :
  6493. node.nodeType === 1 ) &&
  6494. ++diff ) {
  6495. // Cache the index of each encountered element
  6496. if ( useCache ) {
  6497. outerCache = node[ expando ] || (node[ expando ] = {});
  6498. // Support: IE <9 only
  6499. // Defend against cloned attroperties (jQuery gh-1709)
  6500. uniqueCache = outerCache[ node.uniqueID ] ||
  6501. (outerCache[ node.uniqueID ] = {});
  6502. uniqueCache[ type ] = [ dirruns, diff ];
  6503. }
  6504. if ( node === elem ) {
  6505. break;
  6506. }
  6507. }
  6508. }
  6509. }
  6510. }
  6511. // Incorporate the offset, then check against cycle size
  6512. diff -= last;
  6513. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  6514. }
  6515. };
  6516. },
  6517. "PSEUDO": function( pseudo, argument ) {
  6518. // pseudo-class names are case-insensitive
  6519. // http://www.w3.org/TR/selectors/#pseudo-classes
  6520. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  6521. // Remember that setFilters inherits from pseudos
  6522. var args,
  6523. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  6524. Sizzle.error( "unsupported pseudo: " + pseudo );
  6525. // The user may use createPseudo to indicate that
  6526. // arguments are needed to create the filter function
  6527. // just as Sizzle does
  6528. if ( fn[ expando ] ) {
  6529. return fn( argument );
  6530. }
  6531. // But maintain support for old signatures
  6532. if ( fn.length > 1 ) {
  6533. args = [ pseudo, pseudo, "", argument ];
  6534. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  6535. markFunction(function( seed, matches ) {
  6536. var idx,
  6537. matched = fn( seed, argument ),
  6538. i = matched.length;
  6539. while ( i-- ) {
  6540. idx = indexOf( seed, matched[i] );
  6541. seed[ idx ] = !( matches[ idx ] = matched[i] );
  6542. }
  6543. }) :
  6544. function( elem ) {
  6545. return fn( elem, 0, args );
  6546. };
  6547. }
  6548. return fn;
  6549. }
  6550. },
  6551. pseudos: {
  6552. // Potentially complex pseudos
  6553. "not": markFunction(function( selector ) {
  6554. // Trim the selector passed to compile
  6555. // to avoid treating leading and trailing
  6556. // spaces as combinators
  6557. var input = [],
  6558. results = [],
  6559. matcher = compile( selector.replace( rtrim, "$1" ) );
  6560. return matcher[ expando ] ?
  6561. markFunction(function( seed, matches, context, xml ) {
  6562. var elem,
  6563. unmatched = matcher( seed, null, xml, [] ),
  6564. i = seed.length;
  6565. // Match elements unmatched by `matcher`
  6566. while ( i-- ) {
  6567. if ( (elem = unmatched[i]) ) {
  6568. seed[i] = !(matches[i] = elem);
  6569. }
  6570. }
  6571. }) :
  6572. function( elem, context, xml ) {
  6573. input[0] = elem;
  6574. matcher( input, null, xml, results );
  6575. // Don't keep the element (issue #299)
  6576. input[0] = null;
  6577. return !results.pop();
  6578. };
  6579. }),
  6580. "has": markFunction(function( selector ) {
  6581. return function( elem ) {
  6582. return Sizzle( selector, elem ).length > 0;
  6583. };
  6584. }),
  6585. "contains": markFunction(function( text ) {
  6586. text = text.replace( runescape, funescape );
  6587. return function( elem ) {
  6588. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  6589. };
  6590. }),
  6591. // "Whether an element is represented by a :lang() selector
  6592. // is based solely on the element's language value
  6593. // being equal to the identifier C,
  6594. // or beginning with the identifier C immediately followed by "-".
  6595. // The matching of C against the element's language value is performed case-insensitively.
  6596. // The identifier C does not have to be a valid language name."
  6597. // http://www.w3.org/TR/selectors/#lang-pseudo
  6598. "lang": markFunction( function( lang ) {
  6599. // lang value must be a valid identifier
  6600. if ( !ridentifier.test(lang || "") ) {
  6601. Sizzle.error( "unsupported lang: " + lang );
  6602. }
  6603. lang = lang.replace( runescape, funescape ).toLowerCase();
  6604. return function( elem ) {
  6605. var elemLang;
  6606. do {
  6607. if ( (elemLang = documentIsHTML ?
  6608. elem.lang :
  6609. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  6610. elemLang = elemLang.toLowerCase();
  6611. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  6612. }
  6613. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  6614. return false;
  6615. };
  6616. }),
  6617. // Miscellaneous
  6618. "target": function( elem ) {
  6619. var hash = window.location && window.location.hash;
  6620. return hash && hash.slice( 1 ) === elem.id;
  6621. },
  6622. "root": function( elem ) {
  6623. return elem === docElem;
  6624. },
  6625. "focus": function( elem ) {
  6626. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  6627. },
  6628. // Boolean properties
  6629. "enabled": createDisabledPseudo( false ),
  6630. "disabled": createDisabledPseudo( true ),
  6631. "checked": function( elem ) {
  6632. // In CSS3, :checked should return both checked and selected elements
  6633. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  6634. var nodeName = elem.nodeName.toLowerCase();
  6635. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  6636. },
  6637. "selected": function( elem ) {
  6638. // Accessing this property makes selected-by-default
  6639. // options in Safari work properly
  6640. if ( elem.parentNode ) {
  6641. elem.parentNode.selectedIndex;
  6642. }
  6643. return elem.selected === true;
  6644. },
  6645. // Contents
  6646. "empty": function( elem ) {
  6647. // http://www.w3.org/TR/selectors/#empty-pseudo
  6648. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  6649. // but not by others (comment: 8; processing instruction: 7; etc.)
  6650. // nodeType < 6 works because attributes (2) do not appear as children
  6651. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  6652. if ( elem.nodeType < 6 ) {
  6653. return false;
  6654. }
  6655. }
  6656. return true;
  6657. },
  6658. "parent": function( elem ) {
  6659. return !Expr.pseudos["empty"]( elem );
  6660. },
  6661. // Element/input types
  6662. "header": function( elem ) {
  6663. return rheader.test( elem.nodeName );
  6664. },
  6665. "input": function( elem ) {
  6666. return rinputs.test( elem.nodeName );
  6667. },
  6668. "button": function( elem ) {
  6669. var name = elem.nodeName.toLowerCase();
  6670. return name === "input" && elem.type === "button" || name === "button";
  6671. },
  6672. "text": function( elem ) {
  6673. var attr;
  6674. return elem.nodeName.toLowerCase() === "input" &&
  6675. elem.type === "text" &&
  6676. // Support: IE<8
  6677. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  6678. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  6679. },
  6680. // Position-in-collection
  6681. "first": createPositionalPseudo(function() {
  6682. return [ 0 ];
  6683. }),
  6684. "last": createPositionalPseudo(function( matchIndexes, length ) {
  6685. return [ length - 1 ];
  6686. }),
  6687. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  6688. return [ argument < 0 ? argument + length : argument ];
  6689. }),
  6690. "even": createPositionalPseudo(function( matchIndexes, length ) {
  6691. var i = 0;
  6692. for ( ; i < length; i += 2 ) {
  6693. matchIndexes.push( i );
  6694. }
  6695. return matchIndexes;
  6696. }),
  6697. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  6698. var i = 1;
  6699. for ( ; i < length; i += 2 ) {
  6700. matchIndexes.push( i );
  6701. }
  6702. return matchIndexes;
  6703. }),
  6704. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  6705. var i = argument < 0 ? argument + length : argument;
  6706. for ( ; --i >= 0; ) {
  6707. matchIndexes.push( i );
  6708. }
  6709. return matchIndexes;
  6710. }),
  6711. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  6712. var i = argument < 0 ? argument + length : argument;
  6713. for ( ; ++i < length; ) {
  6714. matchIndexes.push( i );
  6715. }
  6716. return matchIndexes;
  6717. })
  6718. }
  6719. };
  6720. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  6721. // Add button/input type pseudos
  6722. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  6723. Expr.pseudos[ i ] = createInputPseudo( i );
  6724. }
  6725. for ( i in { submit: true, reset: true } ) {
  6726. Expr.pseudos[ i ] = createButtonPseudo( i );
  6727. }
  6728. // Easy API for creating new setFilters
  6729. function setFilters() {}
  6730. setFilters.prototype = Expr.filters = Expr.pseudos;
  6731. Expr.setFilters = new setFilters();
  6732. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  6733. var matched, match, tokens, type,
  6734. soFar, groups, preFilters,
  6735. cached = tokenCache[ selector + " " ];
  6736. if ( cached ) {
  6737. return parseOnly ? 0 : cached.slice( 0 );
  6738. }
  6739. soFar = selector;
  6740. groups = [];
  6741. preFilters = Expr.preFilter;
  6742. while ( soFar ) {
  6743. // Comma and first run
  6744. if ( !matched || (match = rcomma.exec( soFar )) ) {
  6745. if ( match ) {
  6746. // Don't consume trailing commas as valid
  6747. soFar = soFar.slice( match[0].length ) || soFar;
  6748. }
  6749. groups.push( (tokens = []) );
  6750. }
  6751. matched = false;
  6752. // Combinators
  6753. if ( (match = rcombinators.exec( soFar )) ) {
  6754. matched = match.shift();
  6755. tokens.push({
  6756. value: matched,
  6757. // Cast descendant combinators to space
  6758. type: match[0].replace( rtrim, " " )
  6759. });
  6760. soFar = soFar.slice( matched.length );
  6761. }
  6762. // Filters
  6763. for ( type in Expr.filter ) {
  6764. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  6765. (match = preFilters[ type ]( match ))) ) {
  6766. matched = match.shift();
  6767. tokens.push({
  6768. value: matched,
  6769. type: type,
  6770. matches: match
  6771. });
  6772. soFar = soFar.slice( matched.length );
  6773. }
  6774. }
  6775. if ( !matched ) {
  6776. break;
  6777. }
  6778. }
  6779. // Return the length of the invalid excess
  6780. // if we're just parsing
  6781. // Otherwise, throw an error or return tokens
  6782. return parseOnly ?
  6783. soFar.length :
  6784. soFar ?
  6785. Sizzle.error( selector ) :
  6786. // Cache the tokens
  6787. tokenCache( selector, groups ).slice( 0 );
  6788. };
  6789. function toSelector( tokens ) {
  6790. var i = 0,
  6791. len = tokens.length,
  6792. selector = "";
  6793. for ( ; i < len; i++ ) {
  6794. selector += tokens[i].value;
  6795. }
  6796. return selector;
  6797. }
  6798. function addCombinator( matcher, combinator, base ) {
  6799. var dir = combinator.dir,
  6800. skip = combinator.next,
  6801. key = skip || dir,
  6802. checkNonElements = base && key === "parentNode",
  6803. doneName = done++;
  6804. return combinator.first ?
  6805. // Check against closest ancestor/preceding element
  6806. function( elem, context, xml ) {
  6807. while ( (elem = elem[ dir ]) ) {
  6808. if ( elem.nodeType === 1 || checkNonElements ) {
  6809. return matcher( elem, context, xml );
  6810. }
  6811. }
  6812. return false;
  6813. } :
  6814. // Check against all ancestor/preceding elements
  6815. function( elem, context, xml ) {
  6816. var oldCache, uniqueCache, outerCache,
  6817. newCache = [ dirruns, doneName ];
  6818. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  6819. if ( xml ) {
  6820. while ( (elem = elem[ dir ]) ) {
  6821. if ( elem.nodeType === 1 || checkNonElements ) {
  6822. if ( matcher( elem, context, xml ) ) {
  6823. return true;
  6824. }
  6825. }
  6826. }
  6827. } else {
  6828. while ( (elem = elem[ dir ]) ) {
  6829. if ( elem.nodeType === 1 || checkNonElements ) {
  6830. outerCache = elem[ expando ] || (elem[ expando ] = {});
  6831. // Support: IE <9 only
  6832. // Defend against cloned attroperties (jQuery gh-1709)
  6833. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  6834. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  6835. elem = elem[ dir ] || elem;
  6836. } else if ( (oldCache = uniqueCache[ key ]) &&
  6837. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  6838. // Assign to newCache so results back-propagate to previous elements
  6839. return (newCache[ 2 ] = oldCache[ 2 ]);
  6840. } else {
  6841. // Reuse newcache so results back-propagate to previous elements
  6842. uniqueCache[ key ] = newCache;
  6843. // A match means we're done; a fail means we have to keep checking
  6844. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  6845. return true;
  6846. }
  6847. }
  6848. }
  6849. }
  6850. }
  6851. return false;
  6852. };
  6853. }
  6854. function elementMatcher( matchers ) {
  6855. return matchers.length > 1 ?
  6856. function( elem, context, xml ) {
  6857. var i = matchers.length;
  6858. while ( i-- ) {
  6859. if ( !matchers[i]( elem, context, xml ) ) {
  6860. return false;
  6861. }
  6862. }
  6863. return true;
  6864. } :
  6865. matchers[0];
  6866. }
  6867. function multipleContexts( selector, contexts, results ) {
  6868. var i = 0,
  6869. len = contexts.length;
  6870. for ( ; i < len; i++ ) {
  6871. Sizzle( selector, contexts[i], results );
  6872. }
  6873. return results;
  6874. }
  6875. function condense( unmatched, map, filter, context, xml ) {
  6876. var elem,
  6877. newUnmatched = [],
  6878. i = 0,
  6879. len = unmatched.length,
  6880. mapped = map != null;
  6881. for ( ; i < len; i++ ) {
  6882. if ( (elem = unmatched[i]) ) {
  6883. if ( !filter || filter( elem, context, xml ) ) {
  6884. newUnmatched.push( elem );
  6885. if ( mapped ) {
  6886. map.push( i );
  6887. }
  6888. }
  6889. }
  6890. }
  6891. return newUnmatched;
  6892. }
  6893. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  6894. if ( postFilter && !postFilter[ expando ] ) {
  6895. postFilter = setMatcher( postFilter );
  6896. }
  6897. if ( postFinder && !postFinder[ expando ] ) {
  6898. postFinder = setMatcher( postFinder, postSelector );
  6899. }
  6900. return markFunction(function( seed, results, context, xml ) {
  6901. var temp, i, elem,
  6902. preMap = [],
  6903. postMap = [],
  6904. preexisting = results.length,
  6905. // Get initial elements from seed or context
  6906. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  6907. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  6908. matcherIn = preFilter && ( seed || !selector ) ?
  6909. condense( elems, preMap, preFilter, context, xml ) :
  6910. elems,
  6911. matcherOut = matcher ?
  6912. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  6913. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  6914. // ...intermediate processing is necessary
  6915. [] :
  6916. // ...otherwise use results directly
  6917. results :
  6918. matcherIn;
  6919. // Find primary matches
  6920. if ( matcher ) {
  6921. matcher( matcherIn, matcherOut, context, xml );
  6922. }
  6923. // Apply postFilter
  6924. if ( postFilter ) {
  6925. temp = condense( matcherOut, postMap );
  6926. postFilter( temp, [], context, xml );
  6927. // Un-match failing elements by moving them back to matcherIn
  6928. i = temp.length;
  6929. while ( i-- ) {
  6930. if ( (elem = temp[i]) ) {
  6931. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  6932. }
  6933. }
  6934. }
  6935. if ( seed ) {
  6936. if ( postFinder || preFilter ) {
  6937. if ( postFinder ) {
  6938. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  6939. temp = [];
  6940. i = matcherOut.length;
  6941. while ( i-- ) {
  6942. if ( (elem = matcherOut[i]) ) {
  6943. // Restore matcherIn since elem is not yet a final match
  6944. temp.push( (matcherIn[i] = elem) );
  6945. }
  6946. }
  6947. postFinder( null, (matcherOut = []), temp, xml );
  6948. }
  6949. // Move matched elements from seed to results to keep them synchronized
  6950. i = matcherOut.length;
  6951. while ( i-- ) {
  6952. if ( (elem = matcherOut[i]) &&
  6953. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  6954. seed[temp] = !(results[temp] = elem);
  6955. }
  6956. }
  6957. }
  6958. // Add elements to results, through postFinder if defined
  6959. } else {
  6960. matcherOut = condense(
  6961. matcherOut === results ?
  6962. matcherOut.splice( preexisting, matcherOut.length ) :
  6963. matcherOut
  6964. );
  6965. if ( postFinder ) {
  6966. postFinder( null, results, matcherOut, xml );
  6967. } else {
  6968. push.apply( results, matcherOut );
  6969. }
  6970. }
  6971. });
  6972. }
  6973. function matcherFromTokens( tokens ) {
  6974. var checkContext, matcher, j,
  6975. len = tokens.length,
  6976. leadingRelative = Expr.relative[ tokens[0].type ],
  6977. implicitRelative = leadingRelative || Expr.relative[" "],
  6978. i = leadingRelative ? 1 : 0,
  6979. // The foundational matcher ensures that elements are reachable from top-level context(s)
  6980. matchContext = addCombinator( function( elem ) {
  6981. return elem === checkContext;
  6982. }, implicitRelative, true ),
  6983. matchAnyContext = addCombinator( function( elem ) {
  6984. return indexOf( checkContext, elem ) > -1;
  6985. }, implicitRelative, true ),
  6986. matchers = [ function( elem, context, xml ) {
  6987. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  6988. (checkContext = context).nodeType ?
  6989. matchContext( elem, context, xml ) :
  6990. matchAnyContext( elem, context, xml ) );
  6991. // Avoid hanging onto element (issue #299)
  6992. checkContext = null;
  6993. return ret;
  6994. } ];
  6995. for ( ; i < len; i++ ) {
  6996. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  6997. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  6998. } else {
  6999. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  7000. // Return special upon seeing a positional matcher
  7001. if ( matcher[ expando ] ) {
  7002. // Find the next relative operator (if any) for proper handling
  7003. j = ++i;
  7004. for ( ; j < len; j++ ) {
  7005. if ( Expr.relative[ tokens[j].type ] ) {
  7006. break;
  7007. }
  7008. }
  7009. return setMatcher(
  7010. i > 1 && elementMatcher( matchers ),
  7011. i > 1 && toSelector(
  7012. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  7013. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  7014. ).replace( rtrim, "$1" ),
  7015. matcher,
  7016. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  7017. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  7018. j < len && toSelector( tokens )
  7019. );
  7020. }
  7021. matchers.push( matcher );
  7022. }
  7023. }
  7024. return elementMatcher( matchers );
  7025. }
  7026. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  7027. var bySet = setMatchers.length > 0,
  7028. byElement = elementMatchers.length > 0,
  7029. superMatcher = function( seed, context, xml, results, outermost ) {
  7030. var elem, j, matcher,
  7031. matchedCount = 0,
  7032. i = "0",
  7033. unmatched = seed && [],
  7034. setMatched = [],
  7035. contextBackup = outermostContext,
  7036. // We must always have either seed elements or outermost context
  7037. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  7038. // Use integer dirruns iff this is the outermost matcher
  7039. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  7040. len = elems.length;
  7041. if ( outermost ) {
  7042. outermostContext = context === document || context || outermost;
  7043. }
  7044. // Add elements passing elementMatchers directly to results
  7045. // Support: IE<9, Safari
  7046. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  7047. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  7048. if ( byElement && elem ) {
  7049. j = 0;
  7050. if ( !context && elem.ownerDocument !== document ) {
  7051. setDocument( elem );
  7052. xml = !documentIsHTML;
  7053. }
  7054. while ( (matcher = elementMatchers[j++]) ) {
  7055. if ( matcher( elem, context || document, xml) ) {
  7056. results.push( elem );
  7057. break;
  7058. }
  7059. }
  7060. if ( outermost ) {
  7061. dirruns = dirrunsUnique;
  7062. }
  7063. }
  7064. // Track unmatched elements for set filters
  7065. if ( bySet ) {
  7066. // They will have gone through all possible matchers
  7067. if ( (elem = !matcher && elem) ) {
  7068. matchedCount--;
  7069. }
  7070. // Lengthen the array for every element, matched or not
  7071. if ( seed ) {
  7072. unmatched.push( elem );
  7073. }
  7074. }
  7075. }
  7076. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  7077. // makes the latter nonnegative.
  7078. matchedCount += i;
  7079. // Apply set filters to unmatched elements
  7080. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  7081. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  7082. // no element matchers and no seed.
  7083. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  7084. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  7085. // numerically zero.
  7086. if ( bySet && i !== matchedCount ) {
  7087. j = 0;
  7088. while ( (matcher = setMatchers[j++]) ) {
  7089. matcher( unmatched, setMatched, context, xml );
  7090. }
  7091. if ( seed ) {
  7092. // Reintegrate element matches to eliminate the need for sorting
  7093. if ( matchedCount > 0 ) {
  7094. while ( i-- ) {
  7095. if ( !(unmatched[i] || setMatched[i]) ) {
  7096. setMatched[i] = pop.call( results );
  7097. }
  7098. }
  7099. }
  7100. // Discard index placeholder values to get only actual matches
  7101. setMatched = condense( setMatched );
  7102. }
  7103. // Add matches to results
  7104. push.apply( results, setMatched );
  7105. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  7106. if ( outermost && !seed && setMatched.length > 0 &&
  7107. ( matchedCount + setMatchers.length ) > 1 ) {
  7108. Sizzle.uniqueSort( results );
  7109. }
  7110. }
  7111. // Override manipulation of globals by nested matchers
  7112. if ( outermost ) {
  7113. dirruns = dirrunsUnique;
  7114. outermostContext = contextBackup;
  7115. }
  7116. return unmatched;
  7117. };
  7118. return bySet ?
  7119. markFunction( superMatcher ) :
  7120. superMatcher;
  7121. }
  7122. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  7123. var i,
  7124. setMatchers = [],
  7125. elementMatchers = [],
  7126. cached = compilerCache[ selector + " " ];
  7127. if ( !cached ) {
  7128. // Generate a function of recursive functions that can be used to check each element
  7129. if ( !match ) {
  7130. match = tokenize( selector );
  7131. }
  7132. i = match.length;
  7133. while ( i-- ) {
  7134. cached = matcherFromTokens( match[i] );
  7135. if ( cached[ expando ] ) {
  7136. setMatchers.push( cached );
  7137. } else {
  7138. elementMatchers.push( cached );
  7139. }
  7140. }
  7141. // Cache the compiled function
  7142. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  7143. // Save selector and tokenization
  7144. cached.selector = selector;
  7145. }
  7146. return cached;
  7147. };
  7148. /**
  7149. * A low-level selection function that works with Sizzle's compiled
  7150. * selector functions
  7151. * @param {String|Function} selector A selector or a pre-compiled
  7152. * selector function built with Sizzle.compile
  7153. * @param {Element} context
  7154. * @param {Array} [results]
  7155. * @param {Array} [seed] A set of elements to match against
  7156. */
  7157. select = Sizzle.select = function( selector, context, results, seed ) {
  7158. var i, tokens, token, type, find,
  7159. compiled = typeof selector === "function" && selector,
  7160. match = !seed && tokenize( (selector = compiled.selector || selector) );
  7161. results = results || [];
  7162. // Try to minimize operations if there is only one selector in the list and no seed
  7163. // (the latter of which guarantees us context)
  7164. if ( match.length === 1 ) {
  7165. // Reduce context if the leading compound selector is an ID
  7166. tokens = match[0] = match[0].slice( 0 );
  7167. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  7168. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  7169. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  7170. if ( !context ) {
  7171. return results;
  7172. // Precompiled matchers will still verify ancestry, so step up a level
  7173. } else if ( compiled ) {
  7174. context = context.parentNode;
  7175. }
  7176. selector = selector.slice( tokens.shift().value.length );
  7177. }
  7178. // Fetch a seed set for right-to-left matching
  7179. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  7180. while ( i-- ) {
  7181. token = tokens[i];
  7182. // Abort if we hit a combinator
  7183. if ( Expr.relative[ (type = token.type) ] ) {
  7184. break;
  7185. }
  7186. if ( (find = Expr.find[ type ]) ) {
  7187. // Search, expanding context for leading sibling combinators
  7188. if ( (seed = find(
  7189. token.matches[0].replace( runescape, funescape ),
  7190. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  7191. )) ) {
  7192. // If seed is empty or no tokens remain, we can return early
  7193. tokens.splice( i, 1 );
  7194. selector = seed.length && toSelector( tokens );
  7195. if ( !selector ) {
  7196. push.apply( results, seed );
  7197. return results;
  7198. }
  7199. break;
  7200. }
  7201. }
  7202. }
  7203. }
  7204. // Compile and execute a filtering function if one is not provided
  7205. // Provide `match` to avoid retokenization if we modified the selector above
  7206. ( compiled || compile( selector, match ) )(
  7207. seed,
  7208. context,
  7209. !documentIsHTML,
  7210. results,
  7211. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  7212. );
  7213. return results;
  7214. };
  7215. // One-time assignments
  7216. // Sort stability
  7217. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  7218. // Support: Chrome 14-35+
  7219. // Always assume duplicates if they aren't passed to the comparison function
  7220. support.detectDuplicates = !!hasDuplicate;
  7221. // Initialize against the default document
  7222. setDocument();
  7223. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  7224. // Detached nodes confoundingly follow *each other*
  7225. support.sortDetached = assert(function( el ) {
  7226. // Should return 1, but returns 4 (following)
  7227. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  7228. });
  7229. // Support: IE<8
  7230. // Prevent attribute/property "interpolation"
  7231. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  7232. if ( !assert(function( el ) {
  7233. el.innerHTML = "<a href='#'></a>";
  7234. return el.firstChild.getAttribute("href") === "#" ;
  7235. }) ) {
  7236. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  7237. if ( !isXML ) {
  7238. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  7239. }
  7240. });
  7241. }
  7242. // Support: IE<9
  7243. // Use defaultValue in place of getAttribute("value")
  7244. if ( !support.attributes || !assert(function( el ) {
  7245. el.innerHTML = "<input/>";
  7246. el.firstChild.setAttribute( "value", "" );
  7247. return el.firstChild.getAttribute( "value" ) === "";
  7248. }) ) {
  7249. addHandle( "value", function( elem, name, isXML ) {
  7250. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  7251. return elem.defaultValue;
  7252. }
  7253. });
  7254. }
  7255. // Support: IE<9
  7256. // Use getAttributeNode to fetch booleans when getAttribute lies
  7257. if ( !assert(function( el ) {
  7258. return el.getAttribute("disabled") == null;
  7259. }) ) {
  7260. addHandle( booleans, function( elem, name, isXML ) {
  7261. var val;
  7262. if ( !isXML ) {
  7263. return elem[ name ] === true ? name.toLowerCase() :
  7264. (val = elem.getAttributeNode( name )) && val.specified ?
  7265. val.value :
  7266. null;
  7267. }
  7268. });
  7269. }
  7270. return Sizzle;
  7271. })( window );
  7272. jQuery.find = Sizzle;
  7273. jQuery.expr = Sizzle.selectors;
  7274. // Deprecated
  7275. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  7276. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  7277. jQuery.text = Sizzle.getText;
  7278. jQuery.isXMLDoc = Sizzle.isXML;
  7279. jQuery.contains = Sizzle.contains;
  7280. jQuery.escapeSelector = Sizzle.escape;
  7281. var dir = function( elem, dir, until ) {
  7282. var matched = [],
  7283. truncate = until !== undefined;
  7284. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  7285. if ( elem.nodeType === 1 ) {
  7286. if ( truncate && jQuery( elem ).is( until ) ) {
  7287. break;
  7288. }
  7289. matched.push( elem );
  7290. }
  7291. }
  7292. return matched;
  7293. };
  7294. var siblings = function( n, elem ) {
  7295. var matched = [];
  7296. for ( ; n; n = n.nextSibling ) {
  7297. if ( n.nodeType === 1 && n !== elem ) {
  7298. matched.push( n );
  7299. }
  7300. }
  7301. return matched;
  7302. };
  7303. var rneedsContext = jQuery.expr.match.needsContext;
  7304. function nodeName( elem, name ) {
  7305. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  7306. };
  7307. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  7308. // Implement the identical functionality for filter and not
  7309. function winnow( elements, qualifier, not ) {
  7310. if ( isFunction( qualifier ) ) {
  7311. return jQuery.grep( elements, function( elem, i ) {
  7312. return !!qualifier.call( elem, i, elem ) !== not;
  7313. } );
  7314. }
  7315. // Single element
  7316. if ( qualifier.nodeType ) {
  7317. return jQuery.grep( elements, function( elem ) {
  7318. return ( elem === qualifier ) !== not;
  7319. } );
  7320. }
  7321. // Arraylike of elements (jQuery, arguments, Array)
  7322. if ( typeof qualifier !== "string" ) {
  7323. return jQuery.grep( elements, function( elem ) {
  7324. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  7325. } );
  7326. }
  7327. // Filtered directly for both simple and complex selectors
  7328. return jQuery.filter( qualifier, elements, not );
  7329. }
  7330. jQuery.filter = function( expr, elems, not ) {
  7331. var elem = elems[ 0 ];
  7332. if ( not ) {
  7333. expr = ":not(" + expr + ")";
  7334. }
  7335. if ( elems.length === 1 && elem.nodeType === 1 ) {
  7336. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  7337. }
  7338. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  7339. return elem.nodeType === 1;
  7340. } ) );
  7341. };
  7342. jQuery.fn.extend( {
  7343. find: function( selector ) {
  7344. var i, ret,
  7345. len = this.length,
  7346. self = this;
  7347. if ( typeof selector !== "string" ) {
  7348. return this.pushStack( jQuery( selector ).filter( function() {
  7349. for ( i = 0; i < len; i++ ) {
  7350. if ( jQuery.contains( self[ i ], this ) ) {
  7351. return true;
  7352. }
  7353. }
  7354. } ) );
  7355. }
  7356. ret = this.pushStack( [] );
  7357. for ( i = 0; i < len; i++ ) {
  7358. jQuery.find( selector, self[ i ], ret );
  7359. }
  7360. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  7361. },
  7362. filter: function( selector ) {
  7363. return this.pushStack( winnow( this, selector || [], false ) );
  7364. },
  7365. not: function( selector ) {
  7366. return this.pushStack( winnow( this, selector || [], true ) );
  7367. },
  7368. is: function( selector ) {
  7369. return !!winnow(
  7370. this,
  7371. // If this is a positional/relative selector, check membership in the returned set
  7372. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  7373. typeof selector === "string" && rneedsContext.test( selector ) ?
  7374. jQuery( selector ) :
  7375. selector || [],
  7376. false
  7377. ).length;
  7378. }
  7379. } );
  7380. // Initialize a jQuery object
  7381. // A central reference to the root jQuery(document)
  7382. var rootjQuery,
  7383. // A simple way to check for HTML strings
  7384. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  7385. // Strict HTML recognition (#11290: must start with <)
  7386. // Shortcut simple #id case for speed
  7387. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  7388. init = jQuery.fn.init = function( selector, context, root ) {
  7389. var match, elem;
  7390. // HANDLE: $(""), $(null), $(undefined), $(false)
  7391. if ( !selector ) {
  7392. return this;
  7393. }
  7394. // Method init() accepts an alternate rootjQuery
  7395. // so migrate can support jQuery.sub (gh-2101)
  7396. root = root || rootjQuery;
  7397. // Handle HTML strings
  7398. if ( typeof selector === "string" ) {
  7399. if ( selector[ 0 ] === "<" &&
  7400. selector[ selector.length - 1 ] === ">" &&
  7401. selector.length >= 3 ) {
  7402. // Assume that strings that start and end with <> are HTML and skip the regex check
  7403. match = [ null, selector, null ];
  7404. } else {
  7405. match = rquickExpr.exec( selector );
  7406. }
  7407. // Match html or make sure no context is specified for #id
  7408. if ( match && ( match[ 1 ] || !context ) ) {
  7409. // HANDLE: $(html) -> $(array)
  7410. if ( match[ 1 ] ) {
  7411. context = context instanceof jQuery ? context[ 0 ] : context;
  7412. // Option to run scripts is true for back-compat
  7413. // Intentionally let the error be thrown if parseHTML is not present
  7414. jQuery.merge( this, jQuery.parseHTML(
  7415. match[ 1 ],
  7416. context && context.nodeType ? context.ownerDocument || context : document,
  7417. true
  7418. ) );
  7419. // HANDLE: $(html, props)
  7420. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  7421. for ( match in context ) {
  7422. // Properties of context are called as methods if possible
  7423. if ( isFunction( this[ match ] ) ) {
  7424. this[ match ]( context[ match ] );
  7425. // ...and otherwise set as attributes
  7426. } else {
  7427. this.attr( match, context[ match ] );
  7428. }
  7429. }
  7430. }
  7431. return this;
  7432. // HANDLE: $(#id)
  7433. } else {
  7434. elem = document.getElementById( match[ 2 ] );
  7435. if ( elem ) {
  7436. // Inject the element directly into the jQuery object
  7437. this[ 0 ] = elem;
  7438. this.length = 1;
  7439. }
  7440. return this;
  7441. }
  7442. // HANDLE: $(expr, $(...))
  7443. } else if ( !context || context.jquery ) {
  7444. return ( context || root ).find( selector );
  7445. // HANDLE: $(expr, context)
  7446. // (which is just equivalent to: $(context).find(expr)
  7447. } else {
  7448. return this.constructor( context ).find( selector );
  7449. }
  7450. // HANDLE: $(DOMElement)
  7451. } else if ( selector.nodeType ) {
  7452. this[ 0 ] = selector;
  7453. this.length = 1;
  7454. return this;
  7455. // HANDLE: $(function)
  7456. // Shortcut for document ready
  7457. } else if ( isFunction( selector ) ) {
  7458. return root.ready !== undefined ?
  7459. root.ready( selector ) :
  7460. // Execute immediately if ready is not present
  7461. selector( jQuery );
  7462. }
  7463. return jQuery.makeArray( selector, this );
  7464. };
  7465. // Give the init function the jQuery prototype for later instantiation
  7466. init.prototype = jQuery.fn;
  7467. // Initialize central reference
  7468. rootjQuery = jQuery( document );
  7469. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  7470. // Methods guaranteed to produce a unique set when starting from a unique set
  7471. guaranteedUnique = {
  7472. children: true,
  7473. contents: true,
  7474. next: true,
  7475. prev: true
  7476. };
  7477. jQuery.fn.extend( {
  7478. has: function( target ) {
  7479. var targets = jQuery( target, this ),
  7480. l = targets.length;
  7481. return this.filter( function() {
  7482. var i = 0;
  7483. for ( ; i < l; i++ ) {
  7484. if ( jQuery.contains( this, targets[ i ] ) ) {
  7485. return true;
  7486. }
  7487. }
  7488. } );
  7489. },
  7490. closest: function( selectors, context ) {
  7491. var cur,
  7492. i = 0,
  7493. l = this.length,
  7494. matched = [],
  7495. targets = typeof selectors !== "string" && jQuery( selectors );
  7496. // Positional selectors never match, since there's no _selection_ context
  7497. if ( !rneedsContext.test( selectors ) ) {
  7498. for ( ; i < l; i++ ) {
  7499. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  7500. // Always skip document fragments
  7501. if ( cur.nodeType < 11 && ( targets ?
  7502. targets.index( cur ) > -1 :
  7503. // Don't pass non-elements to Sizzle
  7504. cur.nodeType === 1 &&
  7505. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  7506. matched.push( cur );
  7507. break;
  7508. }
  7509. }
  7510. }
  7511. }
  7512. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  7513. },
  7514. // Determine the position of an element within the set
  7515. index: function( elem ) {
  7516. // No argument, return index in parent
  7517. if ( !elem ) {
  7518. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  7519. }
  7520. // Index in selector
  7521. if ( typeof elem === "string" ) {
  7522. return indexOf.call( jQuery( elem ), this[ 0 ] );
  7523. }
  7524. // Locate the position of the desired element
  7525. return indexOf.call( this,
  7526. // If it receives a jQuery object, the first element is used
  7527. elem.jquery ? elem[ 0 ] : elem
  7528. );
  7529. },
  7530. add: function( selector, context ) {
  7531. return this.pushStack(
  7532. jQuery.uniqueSort(
  7533. jQuery.merge( this.get(), jQuery( selector, context ) )
  7534. )
  7535. );
  7536. },
  7537. addBack: function( selector ) {
  7538. return this.add( selector == null ?
  7539. this.prevObject : this.prevObject.filter( selector )
  7540. );
  7541. }
  7542. } );
  7543. function sibling( cur, dir ) {
  7544. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  7545. return cur;
  7546. }
  7547. jQuery.each( {
  7548. parent: function( elem ) {
  7549. var parent = elem.parentNode;
  7550. return parent && parent.nodeType !== 11 ? parent : null;
  7551. },
  7552. parents: function( elem ) {
  7553. return dir( elem, "parentNode" );
  7554. },
  7555. parentsUntil: function( elem, i, until ) {
  7556. return dir( elem, "parentNode", until );
  7557. },
  7558. next: function( elem ) {
  7559. return sibling( elem, "nextSibling" );
  7560. },
  7561. prev: function( elem ) {
  7562. return sibling( elem, "previousSibling" );
  7563. },
  7564. nextAll: function( elem ) {
  7565. return dir( elem, "nextSibling" );
  7566. },
  7567. prevAll: function( elem ) {
  7568. return dir( elem, "previousSibling" );
  7569. },
  7570. nextUntil: function( elem, i, until ) {
  7571. return dir( elem, "nextSibling", until );
  7572. },
  7573. prevUntil: function( elem, i, until ) {
  7574. return dir( elem, "previousSibling", until );
  7575. },
  7576. siblings: function( elem ) {
  7577. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  7578. },
  7579. children: function( elem ) {
  7580. return siblings( elem.firstChild );
  7581. },
  7582. contents: function( elem ) {
  7583. if ( nodeName( elem, "iframe" ) ) {
  7584. return elem.contentDocument;
  7585. }
  7586. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  7587. // Treat the template element as a regular one in browsers that
  7588. // don't support it.
  7589. if ( nodeName( elem, "template" ) ) {
  7590. elem = elem.content || elem;
  7591. }
  7592. return jQuery.merge( [], elem.childNodes );
  7593. }
  7594. }, function( name, fn ) {
  7595. jQuery.fn[ name ] = function( until, selector ) {
  7596. var matched = jQuery.map( this, fn, until );
  7597. if ( name.slice( -5 ) !== "Until" ) {
  7598. selector = until;
  7599. }
  7600. if ( selector && typeof selector === "string" ) {
  7601. matched = jQuery.filter( selector, matched );
  7602. }
  7603. if ( this.length > 1 ) {
  7604. // Remove duplicates
  7605. if ( !guaranteedUnique[ name ] ) {
  7606. jQuery.uniqueSort( matched );
  7607. }
  7608. // Reverse order for parents* and prev-derivatives
  7609. if ( rparentsprev.test( name ) ) {
  7610. matched.reverse();
  7611. }
  7612. }
  7613. return this.pushStack( matched );
  7614. };
  7615. } );
  7616. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  7617. // Convert String-formatted options into Object-formatted ones
  7618. function createOptions( options ) {
  7619. var object = {};
  7620. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  7621. object[ flag ] = true;
  7622. } );
  7623. return object;
  7624. }
  7625. /*
  7626. * Create a callback list using the following parameters:
  7627. *
  7628. * options: an optional list of space-separated options that will change how
  7629. * the callback list behaves or a more traditional option object
  7630. *
  7631. * By default a callback list will act like an event callback list and can be
  7632. * "fired" multiple times.
  7633. *
  7634. * Possible options:
  7635. *
  7636. * once: will ensure the callback list can only be fired once (like a Deferred)
  7637. *
  7638. * memory: will keep track of previous values and will call any callback added
  7639. * after the list has been fired right away with the latest "memorized"
  7640. * values (like a Deferred)
  7641. *
  7642. * unique: will ensure a callback can only be added once (no duplicate in the list)
  7643. *
  7644. * stopOnFalse: interrupt callings when a callback returns false
  7645. *
  7646. */
  7647. jQuery.Callbacks = function( options ) {
  7648. // Convert options from String-formatted to Object-formatted if needed
  7649. // (we check in cache first)
  7650. options = typeof options === "string" ?
  7651. createOptions( options ) :
  7652. jQuery.extend( {}, options );
  7653. var // Flag to know if list is currently firing
  7654. firing,
  7655. // Last fire value for non-forgettable lists
  7656. memory,
  7657. // Flag to know if list was already fired
  7658. fired,
  7659. // Flag to prevent firing
  7660. locked,
  7661. // Actual callback list
  7662. list = [],
  7663. // Queue of execution data for repeatable lists
  7664. queue = [],
  7665. // Index of currently firing callback (modified by add/remove as needed)
  7666. firingIndex = -1,
  7667. // Fire callbacks
  7668. fire = function() {
  7669. // Enforce single-firing
  7670. locked = locked || options.once;
  7671. // Execute callbacks for all pending executions,
  7672. // respecting firingIndex overrides and runtime changes
  7673. fired = firing = true;
  7674. for ( ; queue.length; firingIndex = -1 ) {
  7675. memory = queue.shift();
  7676. while ( ++firingIndex < list.length ) {
  7677. // Run callback and check for early termination
  7678. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  7679. options.stopOnFalse ) {
  7680. // Jump to end and forget the data so .add doesn't re-fire
  7681. firingIndex = list.length;
  7682. memory = false;
  7683. }
  7684. }
  7685. }
  7686. // Forget the data if we're done with it
  7687. if ( !options.memory ) {
  7688. memory = false;
  7689. }
  7690. firing = false;
  7691. // Clean up if we're done firing for good
  7692. if ( locked ) {
  7693. // Keep an empty list if we have data for future add calls
  7694. if ( memory ) {
  7695. list = [];
  7696. // Otherwise, this object is spent
  7697. } else {
  7698. list = "";
  7699. }
  7700. }
  7701. },
  7702. // Actual Callbacks object
  7703. self = {
  7704. // Add a callback or a collection of callbacks to the list
  7705. add: function() {
  7706. if ( list ) {
  7707. // If we have memory from a past run, we should fire after adding
  7708. if ( memory && !firing ) {
  7709. firingIndex = list.length - 1;
  7710. queue.push( memory );
  7711. }
  7712. ( function add( args ) {
  7713. jQuery.each( args, function( _, arg ) {
  7714. if ( isFunction( arg ) ) {
  7715. if ( !options.unique || !self.has( arg ) ) {
  7716. list.push( arg );
  7717. }
  7718. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  7719. // Inspect recursively
  7720. add( arg );
  7721. }
  7722. } );
  7723. } )( arguments );
  7724. if ( memory && !firing ) {
  7725. fire();
  7726. }
  7727. }
  7728. return this;
  7729. },
  7730. // Remove a callback from the list
  7731. remove: function() {
  7732. jQuery.each( arguments, function( _, arg ) {
  7733. var index;
  7734. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  7735. list.splice( index, 1 );
  7736. // Handle firing indexes
  7737. if ( index <= firingIndex ) {
  7738. firingIndex--;
  7739. }
  7740. }
  7741. } );
  7742. return this;
  7743. },
  7744. // Check if a given callback is in the list.
  7745. // If no argument is given, return whether or not list has callbacks attached.
  7746. has: function( fn ) {
  7747. return fn ?
  7748. jQuery.inArray( fn, list ) > -1 :
  7749. list.length > 0;
  7750. },
  7751. // Remove all callbacks from the list
  7752. empty: function() {
  7753. if ( list ) {
  7754. list = [];
  7755. }
  7756. return this;
  7757. },
  7758. // Disable .fire and .add
  7759. // Abort any current/pending executions
  7760. // Clear all callbacks and values
  7761. disable: function() {
  7762. locked = queue = [];
  7763. list = memory = "";
  7764. return this;
  7765. },
  7766. disabled: function() {
  7767. return !list;
  7768. },
  7769. // Disable .fire
  7770. // Also disable .add unless we have memory (since it would have no effect)
  7771. // Abort any pending executions
  7772. lock: function() {
  7773. locked = queue = [];
  7774. if ( !memory && !firing ) {
  7775. list = memory = "";
  7776. }
  7777. return this;
  7778. },
  7779. locked: function() {
  7780. return !!locked;
  7781. },
  7782. // Call all callbacks with the given context and arguments
  7783. fireWith: function( context, args ) {
  7784. if ( !locked ) {
  7785. args = args || [];
  7786. args = [ context, args.slice ? args.slice() : args ];
  7787. queue.push( args );
  7788. if ( !firing ) {
  7789. fire();
  7790. }
  7791. }
  7792. return this;
  7793. },
  7794. // Call all the callbacks with the given arguments
  7795. fire: function() {
  7796. self.fireWith( this, arguments );
  7797. return this;
  7798. },
  7799. // To know if the callbacks have already been called at least once
  7800. fired: function() {
  7801. return !!fired;
  7802. }
  7803. };
  7804. return self;
  7805. };
  7806. function Identity( v ) {
  7807. return v;
  7808. }
  7809. function Thrower( ex ) {
  7810. throw ex;
  7811. }
  7812. function adoptValue( value, resolve, reject, noValue ) {
  7813. var method;
  7814. try {
  7815. // Check for promise aspect first to privilege synchronous behavior
  7816. if ( value && isFunction( ( method = value.promise ) ) ) {
  7817. method.call( value ).done( resolve ).fail( reject );
  7818. // Other thenables
  7819. } else if ( value && isFunction( ( method = value.then ) ) ) {
  7820. method.call( value, resolve, reject );
  7821. // Other non-thenables
  7822. } else {
  7823. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  7824. // * false: [ value ].slice( 0 ) => resolve( value )
  7825. // * true: [ value ].slice( 1 ) => resolve()
  7826. resolve.apply( undefined, [ value ].slice( noValue ) );
  7827. }
  7828. // For Promises/A+, convert exceptions into rejections
  7829. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  7830. // Deferred#then to conditionally suppress rejection.
  7831. } catch ( value ) {
  7832. // Support: Android 4.0 only
  7833. // Strict mode functions invoked without .call/.apply get global-object context
  7834. reject.apply( undefined, [ value ] );
  7835. }
  7836. }
  7837. jQuery.extend( {
  7838. Deferred: function( func ) {
  7839. var tuples = [
  7840. // action, add listener, callbacks,
  7841. // ... .then handlers, argument index, [final state]
  7842. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  7843. jQuery.Callbacks( "memory" ), 2 ],
  7844. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  7845. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  7846. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  7847. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  7848. ],
  7849. state = "pending",
  7850. promise = {
  7851. state: function() {
  7852. return state;
  7853. },
  7854. always: function() {
  7855. deferred.done( arguments ).fail( arguments );
  7856. return this;
  7857. },
  7858. "catch": function( fn ) {
  7859. return promise.then( null, fn );
  7860. },
  7861. // Keep pipe for back-compat
  7862. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  7863. var fns = arguments;
  7864. return jQuery.Deferred( function( newDefer ) {
  7865. jQuery.each( tuples, function( i, tuple ) {
  7866. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  7867. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  7868. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  7869. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  7870. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  7871. deferred[ tuple[ 1 ] ]( function() {
  7872. var returned = fn && fn.apply( this, arguments );
  7873. if ( returned && isFunction( returned.promise ) ) {
  7874. returned.promise()
  7875. .progress( newDefer.notify )
  7876. .done( newDefer.resolve )
  7877. .fail( newDefer.reject );
  7878. } else {
  7879. newDefer[ tuple[ 0 ] + "With" ](
  7880. this,
  7881. fn ? [ returned ] : arguments
  7882. );
  7883. }
  7884. } );
  7885. } );
  7886. fns = null;
  7887. } ).promise();
  7888. },
  7889. then: function( onFulfilled, onRejected, onProgress ) {
  7890. var maxDepth = 0;
  7891. function resolve( depth, deferred, handler, special ) {
  7892. return function() {
  7893. var that = this,
  7894. args = arguments,
  7895. mightThrow = function() {
  7896. var returned, then;
  7897. // Support: Promises/A+ section 2.3.3.3.3
  7898. // https://promisesaplus.com/#point-59
  7899. // Ignore double-resolution attempts
  7900. if ( depth < maxDepth ) {
  7901. return;
  7902. }
  7903. returned = handler.apply( that, args );
  7904. // Support: Promises/A+ section 2.3.1
  7905. // https://promisesaplus.com/#point-48
  7906. if ( returned === deferred.promise() ) {
  7907. throw new TypeError( "Thenable self-resolution" );
  7908. }
  7909. // Support: Promises/A+ sections 2.3.3.1, 3.5
  7910. // https://promisesaplus.com/#point-54
  7911. // https://promisesaplus.com/#point-75
  7912. // Retrieve `then` only once
  7913. then = returned &&
  7914. // Support: Promises/A+ section 2.3.4
  7915. // https://promisesaplus.com/#point-64
  7916. // Only check objects and functions for thenability
  7917. ( typeof returned === "object" ||
  7918. typeof returned === "function" ) &&
  7919. returned.then;
  7920. // Handle a returned thenable
  7921. if ( isFunction( then ) ) {
  7922. // Special processors (notify) just wait for resolution
  7923. if ( special ) {
  7924. then.call(
  7925. returned,
  7926. resolve( maxDepth, deferred, Identity, special ),
  7927. resolve( maxDepth, deferred, Thrower, special )
  7928. );
  7929. // Normal processors (resolve) also hook into progress
  7930. } else {
  7931. // ...and disregard older resolution values
  7932. maxDepth++;
  7933. then.call(
  7934. returned,
  7935. resolve( maxDepth, deferred, Identity, special ),
  7936. resolve( maxDepth, deferred, Thrower, special ),
  7937. resolve( maxDepth, deferred, Identity,
  7938. deferred.notifyWith )
  7939. );
  7940. }
  7941. // Handle all other returned values
  7942. } else {
  7943. // Only substitute handlers pass on context
  7944. // and multiple values (non-spec behavior)
  7945. if ( handler !== Identity ) {
  7946. that = undefined;
  7947. args = [ returned ];
  7948. }
  7949. // Process the value(s)
  7950. // Default process is resolve
  7951. ( special || deferred.resolveWith )( that, args );
  7952. }
  7953. },
  7954. // Only normal processors (resolve) catch and reject exceptions
  7955. process = special ?
  7956. mightThrow :
  7957. function() {
  7958. try {
  7959. mightThrow();
  7960. } catch ( e ) {
  7961. if ( jQuery.Deferred.exceptionHook ) {
  7962. jQuery.Deferred.exceptionHook( e,
  7963. process.stackTrace );
  7964. }
  7965. // Support: Promises/A+ section 2.3.3.3.4.1
  7966. // https://promisesaplus.com/#point-61
  7967. // Ignore post-resolution exceptions
  7968. if ( depth + 1 >= maxDepth ) {
  7969. // Only substitute handlers pass on context
  7970. // and multiple values (non-spec behavior)
  7971. if ( handler !== Thrower ) {
  7972. that = undefined;
  7973. args = [ e ];
  7974. }
  7975. deferred.rejectWith( that, args );
  7976. }
  7977. }
  7978. };
  7979. // Support: Promises/A+ section 2.3.3.3.1
  7980. // https://promisesaplus.com/#point-57
  7981. // Re-resolve promises immediately to dodge false rejection from
  7982. // subsequent errors
  7983. if ( depth ) {
  7984. process();
  7985. } else {
  7986. // Call an optional hook to record the stack, in case of exception
  7987. // since it's otherwise lost when execution goes async
  7988. if ( jQuery.Deferred.getStackHook ) {
  7989. process.stackTrace = jQuery.Deferred.getStackHook();
  7990. }
  7991. window.setTimeout( process );
  7992. }
  7993. };
  7994. }
  7995. return jQuery.Deferred( function( newDefer ) {
  7996. // progress_handlers.add( ... )
  7997. tuples[ 0 ][ 3 ].add(
  7998. resolve(
  7999. 0,
  8000. newDefer,
  8001. isFunction( onProgress ) ?
  8002. onProgress :
  8003. Identity,
  8004. newDefer.notifyWith
  8005. )
  8006. );
  8007. // fulfilled_handlers.add( ... )
  8008. tuples[ 1 ][ 3 ].add(
  8009. resolve(
  8010. 0,
  8011. newDefer,
  8012. isFunction( onFulfilled ) ?
  8013. onFulfilled :
  8014. Identity
  8015. )
  8016. );
  8017. // rejected_handlers.add( ... )
  8018. tuples[ 2 ][ 3 ].add(
  8019. resolve(
  8020. 0,
  8021. newDefer,
  8022. isFunction( onRejected ) ?
  8023. onRejected :
  8024. Thrower
  8025. )
  8026. );
  8027. } ).promise();
  8028. },
  8029. // Get a promise for this deferred
  8030. // If obj is provided, the promise aspect is added to the object
  8031. promise: function( obj ) {
  8032. return obj != null ? jQuery.extend( obj, promise ) : promise;
  8033. }
  8034. },
  8035. deferred = {};
  8036. // Add list-specific methods
  8037. jQuery.each( tuples, function( i, tuple ) {
  8038. var list = tuple[ 2 ],
  8039. stateString = tuple[ 5 ];
  8040. // promise.progress = list.add
  8041. // promise.done = list.add
  8042. // promise.fail = list.add
  8043. promise[ tuple[ 1 ] ] = list.add;
  8044. // Handle state
  8045. if ( stateString ) {
  8046. list.add(
  8047. function() {
  8048. // state = "resolved" (i.e., fulfilled)
  8049. // state = "rejected"
  8050. state = stateString;
  8051. },
  8052. // rejected_callbacks.disable
  8053. // fulfilled_callbacks.disable
  8054. tuples[ 3 - i ][ 2 ].disable,
  8055. // rejected_handlers.disable
  8056. // fulfilled_handlers.disable
  8057. tuples[ 3 - i ][ 3 ].disable,
  8058. // progress_callbacks.lock
  8059. tuples[ 0 ][ 2 ].lock,
  8060. // progress_handlers.lock
  8061. tuples[ 0 ][ 3 ].lock
  8062. );
  8063. }
  8064. // progress_handlers.fire
  8065. // fulfilled_handlers.fire
  8066. // rejected_handlers.fire
  8067. list.add( tuple[ 3 ].fire );
  8068. // deferred.notify = function() { deferred.notifyWith(...) }
  8069. // deferred.resolve = function() { deferred.resolveWith(...) }
  8070. // deferred.reject = function() { deferred.rejectWith(...) }
  8071. deferred[ tuple[ 0 ] ] = function() {
  8072. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  8073. return this;
  8074. };
  8075. // deferred.notifyWith = list.fireWith
  8076. // deferred.resolveWith = list.fireWith
  8077. // deferred.rejectWith = list.fireWith
  8078. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  8079. } );
  8080. // Make the deferred a promise
  8081. promise.promise( deferred );
  8082. // Call given func if any
  8083. if ( func ) {
  8084. func.call( deferred, deferred );
  8085. }
  8086. // All done!
  8087. return deferred;
  8088. },
  8089. // Deferred helper
  8090. when: function( singleValue ) {
  8091. var
  8092. // count of uncompleted subordinates
  8093. remaining = arguments.length,
  8094. // count of unprocessed arguments
  8095. i = remaining,
  8096. // subordinate fulfillment data
  8097. resolveContexts = Array( i ),
  8098. resolveValues = slice.call( arguments ),
  8099. // the master Deferred
  8100. master = jQuery.Deferred(),
  8101. // subordinate callback factory
  8102. updateFunc = function( i ) {
  8103. return function( value ) {
  8104. resolveContexts[ i ] = this;
  8105. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  8106. if ( !( --remaining ) ) {
  8107. master.resolveWith( resolveContexts, resolveValues );
  8108. }
  8109. };
  8110. };
  8111. // Single- and empty arguments are adopted like Promise.resolve
  8112. if ( remaining <= 1 ) {
  8113. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  8114. !remaining );
  8115. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  8116. if ( master.state() === "pending" ||
  8117. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  8118. return master.then();
  8119. }
  8120. }
  8121. // Multiple arguments are aggregated like Promise.all array elements
  8122. while ( i-- ) {
  8123. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  8124. }
  8125. return master.promise();
  8126. }
  8127. } );
  8128. // These usually indicate a programmer mistake during development,
  8129. // warn about them ASAP rather than swallowing them by default.
  8130. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  8131. jQuery.Deferred.exceptionHook = function( error, stack ) {
  8132. // Support: IE 8 - 9 only
  8133. // Console exists when dev tools are open, which can happen at any time
  8134. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  8135. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  8136. }
  8137. };
  8138. jQuery.readyException = function( error ) {
  8139. window.setTimeout( function() {
  8140. throw error;
  8141. } );
  8142. };
  8143. // The deferred used on DOM ready
  8144. var readyList = jQuery.Deferred();
  8145. jQuery.fn.ready = function( fn ) {
  8146. readyList
  8147. .then( fn )
  8148. // Wrap jQuery.readyException in a function so that the lookup
  8149. // happens at the time of error handling instead of callback
  8150. // registration.
  8151. .catch( function( error ) {
  8152. jQuery.readyException( error );
  8153. } );
  8154. return this;
  8155. };
  8156. jQuery.extend( {
  8157. // Is the DOM ready to be used? Set to true once it occurs.
  8158. isReady: false,
  8159. // A counter to track how many items to wait for before
  8160. // the ready event fires. See #6781
  8161. readyWait: 1,
  8162. // Handle when the DOM is ready
  8163. ready: function( wait ) {
  8164. // Abort if there are pending holds or we're already ready
  8165. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  8166. return;
  8167. }
  8168. // Remember that the DOM is ready
  8169. jQuery.isReady = true;
  8170. // If a normal DOM Ready event fired, decrement, and wait if need be
  8171. if ( wait !== true && --jQuery.readyWait > 0 ) {
  8172. return;
  8173. }
  8174. // If there are functions bound, to execute
  8175. readyList.resolveWith( document, [ jQuery ] );
  8176. }
  8177. } );
  8178. jQuery.ready.then = readyList.then;
  8179. // The ready event handler and self cleanup method
  8180. function completed() {
  8181. document.removeEventListener( "DOMContentLoaded", completed );
  8182. window.removeEventListener( "load", completed );
  8183. jQuery.ready();
  8184. }
  8185. // Catch cases where $(document).ready() is called
  8186. // after the browser event has already occurred.
  8187. // Support: IE <=9 - 10 only
  8188. // Older IE sometimes signals "interactive" too soon
  8189. if ( document.readyState === "complete" ||
  8190. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  8191. // Handle it asynchronously to allow scripts the opportunity to delay ready
  8192. window.setTimeout( jQuery.ready );
  8193. } else {
  8194. // Use the handy event callback
  8195. document.addEventListener( "DOMContentLoaded", completed );
  8196. // A fallback to window.onload, that will always work
  8197. window.addEventListener( "load", completed );
  8198. }
  8199. // Multifunctional method to get and set values of a collection
  8200. // The value/s can optionally be executed if it's a function
  8201. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  8202. var i = 0,
  8203. len = elems.length,
  8204. bulk = key == null;
  8205. // Sets many values
  8206. if ( toType( key ) === "object" ) {
  8207. chainable = true;
  8208. for ( i in key ) {
  8209. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  8210. }
  8211. // Sets one value
  8212. } else if ( value !== undefined ) {
  8213. chainable = true;
  8214. if ( !isFunction( value ) ) {
  8215. raw = true;
  8216. }
  8217. if ( bulk ) {
  8218. // Bulk operations run against the entire set
  8219. if ( raw ) {
  8220. fn.call( elems, value );
  8221. fn = null;
  8222. // ...except when executing function values
  8223. } else {
  8224. bulk = fn;
  8225. fn = function( elem, key, value ) {
  8226. return bulk.call( jQuery( elem ), value );
  8227. };
  8228. }
  8229. }
  8230. if ( fn ) {
  8231. for ( ; i < len; i++ ) {
  8232. fn(
  8233. elems[ i ], key, raw ?
  8234. value :
  8235. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  8236. );
  8237. }
  8238. }
  8239. }
  8240. if ( chainable ) {
  8241. return elems;
  8242. }
  8243. // Gets
  8244. if ( bulk ) {
  8245. return fn.call( elems );
  8246. }
  8247. return len ? fn( elems[ 0 ], key ) : emptyGet;
  8248. };
  8249. // Matches dashed string for camelizing
  8250. var rmsPrefix = /^-ms-/,
  8251. rdashAlpha = /-([a-z])/g;
  8252. // Used by camelCase as callback to replace()
  8253. function fcamelCase( all, letter ) {
  8254. return letter.toUpperCase();
  8255. }
  8256. // Convert dashed to camelCase; used by the css and data modules
  8257. // Support: IE <=9 - 11, Edge 12 - 15
  8258. // Microsoft forgot to hump their vendor prefix (#9572)
  8259. function camelCase( string ) {
  8260. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  8261. }
  8262. var acceptData = function( owner ) {
  8263. // Accepts only:
  8264. // - Node
  8265. // - Node.ELEMENT_NODE
  8266. // - Node.DOCUMENT_NODE
  8267. // - Object
  8268. // - Any
  8269. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  8270. };
  8271. function Data() {
  8272. this.expando = jQuery.expando + Data.uid++;
  8273. }
  8274. Data.uid = 1;
  8275. Data.prototype = {
  8276. cache: function( owner ) {
  8277. // Check if the owner object already has a cache
  8278. var value = owner[ this.expando ];
  8279. // If not, create one
  8280. if ( !value ) {
  8281. value = {};
  8282. // We can accept data for non-element nodes in modern browsers,
  8283. // but we should not, see #8335.
  8284. // Always return an empty object.
  8285. if ( acceptData( owner ) ) {
  8286. // If it is a node unlikely to be stringify-ed or looped over
  8287. // use plain assignment
  8288. if ( owner.nodeType ) {
  8289. owner[ this.expando ] = value;
  8290. // Otherwise secure it in a non-enumerable property
  8291. // configurable must be true to allow the property to be
  8292. // deleted when data is removed
  8293. } else {
  8294. Object.defineProperty( owner, this.expando, {
  8295. value: value,
  8296. configurable: true
  8297. } );
  8298. }
  8299. }
  8300. }
  8301. return value;
  8302. },
  8303. set: function( owner, data, value ) {
  8304. var prop,
  8305. cache = this.cache( owner );
  8306. // Handle: [ owner, key, value ] args
  8307. // Always use camelCase key (gh-2257)
  8308. if ( typeof data === "string" ) {
  8309. cache[ camelCase( data ) ] = value;
  8310. // Handle: [ owner, { properties } ] args
  8311. } else {
  8312. // Copy the properties one-by-one to the cache object
  8313. for ( prop in data ) {
  8314. cache[ camelCase( prop ) ] = data[ prop ];
  8315. }
  8316. }
  8317. return cache;
  8318. },
  8319. get: function( owner, key ) {
  8320. return key === undefined ?
  8321. this.cache( owner ) :
  8322. // Always use camelCase key (gh-2257)
  8323. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  8324. },
  8325. access: function( owner, key, value ) {
  8326. // In cases where either:
  8327. //
  8328. // 1. No key was specified
  8329. // 2. A string key was specified, but no value provided
  8330. //
  8331. // Take the "read" path and allow the get method to determine
  8332. // which value to return, respectively either:
  8333. //
  8334. // 1. The entire cache object
  8335. // 2. The data stored at the key
  8336. //
  8337. if ( key === undefined ||
  8338. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  8339. return this.get( owner, key );
  8340. }
  8341. // When the key is not a string, or both a key and value
  8342. // are specified, set or extend (existing objects) with either:
  8343. //
  8344. // 1. An object of properties
  8345. // 2. A key and value
  8346. //
  8347. this.set( owner, key, value );
  8348. // Since the "set" path can have two possible entry points
  8349. // return the expected data based on which path was taken[*]
  8350. return value !== undefined ? value : key;
  8351. },
  8352. remove: function( owner, key ) {
  8353. var i,
  8354. cache = owner[ this.expando ];
  8355. if ( cache === undefined ) {
  8356. return;
  8357. }
  8358. if ( key !== undefined ) {
  8359. // Support array or space separated string of keys
  8360. if ( Array.isArray( key ) ) {
  8361. // If key is an array of keys...
  8362. // We always set camelCase keys, so remove that.
  8363. key = key.map( camelCase );
  8364. } else {
  8365. key = camelCase( key );
  8366. // If a key with the spaces exists, use it.
  8367. // Otherwise, create an array by matching non-whitespace
  8368. key = key in cache ?
  8369. [ key ] :
  8370. ( key.match( rnothtmlwhite ) || [] );
  8371. }
  8372. i = key.length;
  8373. while ( i-- ) {
  8374. delete cache[ key[ i ] ];
  8375. }
  8376. }
  8377. // Remove the expando if there's no more data
  8378. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  8379. // Support: Chrome <=35 - 45
  8380. // Webkit & Blink performance suffers when deleting properties
  8381. // from DOM nodes, so set to undefined instead
  8382. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  8383. if ( owner.nodeType ) {
  8384. owner[ this.expando ] = undefined;
  8385. } else {
  8386. delete owner[ this.expando ];
  8387. }
  8388. }
  8389. },
  8390. hasData: function( owner ) {
  8391. var cache = owner[ this.expando ];
  8392. return cache !== undefined && !jQuery.isEmptyObject( cache );
  8393. }
  8394. };
  8395. var dataPriv = new Data();
  8396. var dataUser = new Data();
  8397. // Implementation Summary
  8398. //
  8399. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  8400. // 2. Improve the module's maintainability by reducing the storage
  8401. // paths to a single mechanism.
  8402. // 3. Use the same single mechanism to support "private" and "user" data.
  8403. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  8404. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  8405. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  8406. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  8407. rmultiDash = /[A-Z]/g;
  8408. function getData( data ) {
  8409. if ( data === "true" ) {
  8410. return true;
  8411. }
  8412. if ( data === "false" ) {
  8413. return false;
  8414. }
  8415. if ( data === "null" ) {
  8416. return null;
  8417. }
  8418. // Only convert to a number if it doesn't change the string
  8419. if ( data === +data + "" ) {
  8420. return +data;
  8421. }
  8422. if ( rbrace.test( data ) ) {
  8423. return JSON.parse( data );
  8424. }
  8425. return data;
  8426. }
  8427. function dataAttr( elem, key, data ) {
  8428. var name;
  8429. // If nothing was found internally, try to fetch any
  8430. // data from the HTML5 data-* attribute
  8431. if ( data === undefined && elem.nodeType === 1 ) {
  8432. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  8433. data = elem.getAttribute( name );
  8434. if ( typeof data === "string" ) {
  8435. try {
  8436. data = getData( data );
  8437. } catch ( e ) {}
  8438. // Make sure we set the data so it isn't changed later
  8439. dataUser.set( elem, key, data );
  8440. } else {
  8441. data = undefined;
  8442. }
  8443. }
  8444. return data;
  8445. }
  8446. jQuery.extend( {
  8447. hasData: function( elem ) {
  8448. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  8449. },
  8450. data: function( elem, name, data ) {
  8451. return dataUser.access( elem, name, data );
  8452. },
  8453. removeData: function( elem, name ) {
  8454. dataUser.remove( elem, name );
  8455. },
  8456. // TODO: Now that all calls to _data and _removeData have been replaced
  8457. // with direct calls to dataPriv methods, these can be deprecated.
  8458. _data: function( elem, name, data ) {
  8459. return dataPriv.access( elem, name, data );
  8460. },
  8461. _removeData: function( elem, name ) {
  8462. dataPriv.remove( elem, name );
  8463. }
  8464. } );
  8465. jQuery.fn.extend( {
  8466. data: function( key, value ) {
  8467. var i, name, data,
  8468. elem = this[ 0 ],
  8469. attrs = elem && elem.attributes;
  8470. // Gets all values
  8471. if ( key === undefined ) {
  8472. if ( this.length ) {
  8473. data = dataUser.get( elem );
  8474. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  8475. i = attrs.length;
  8476. while ( i-- ) {
  8477. // Support: IE 11 only
  8478. // The attrs elements can be null (#14894)
  8479. if ( attrs[ i ] ) {
  8480. name = attrs[ i ].name;
  8481. if ( name.indexOf( "data-" ) === 0 ) {
  8482. name = camelCase( name.slice( 5 ) );
  8483. dataAttr( elem, name, data[ name ] );
  8484. }
  8485. }
  8486. }
  8487. dataPriv.set( elem, "hasDataAttrs", true );
  8488. }
  8489. }
  8490. return data;
  8491. }
  8492. // Sets multiple values
  8493. if ( typeof key === "object" ) {
  8494. return this.each( function() {
  8495. dataUser.set( this, key );
  8496. } );
  8497. }
  8498. return access( this, function( value ) {
  8499. var data;
  8500. // The calling jQuery object (element matches) is not empty
  8501. // (and therefore has an element appears at this[ 0 ]) and the
  8502. // `value` parameter was not undefined. An empty jQuery object
  8503. // will result in `undefined` for elem = this[ 0 ] which will
  8504. // throw an exception if an attempt to read a data cache is made.
  8505. if ( elem && value === undefined ) {
  8506. // Attempt to get data from the cache
  8507. // The key will always be camelCased in Data
  8508. data = dataUser.get( elem, key );
  8509. if ( data !== undefined ) {
  8510. return data;
  8511. }
  8512. // Attempt to "discover" the data in
  8513. // HTML5 custom data-* attrs
  8514. data = dataAttr( elem, key );
  8515. if ( data !== undefined ) {
  8516. return data;
  8517. }
  8518. // We tried really hard, but the data doesn't exist.
  8519. return;
  8520. }
  8521. // Set the data...
  8522. this.each( function() {
  8523. // We always store the camelCased key
  8524. dataUser.set( this, key, value );
  8525. } );
  8526. }, null, value, arguments.length > 1, null, true );
  8527. },
  8528. removeData: function( key ) {
  8529. return this.each( function() {
  8530. dataUser.remove( this, key );
  8531. } );
  8532. }
  8533. } );
  8534. jQuery.extend( {
  8535. queue: function( elem, type, data ) {
  8536. var queue;
  8537. if ( elem ) {
  8538. type = ( type || "fx" ) + "queue";
  8539. queue = dataPriv.get( elem, type );
  8540. // Speed up dequeue by getting out quickly if this is just a lookup
  8541. if ( data ) {
  8542. if ( !queue || Array.isArray( data ) ) {
  8543. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  8544. } else {
  8545. queue.push( data );
  8546. }
  8547. }
  8548. return queue || [];
  8549. }
  8550. },
  8551. dequeue: function( elem, type ) {
  8552. type = type || "fx";
  8553. var queue = jQuery.queue( elem, type ),
  8554. startLength = queue.length,
  8555. fn = queue.shift(),
  8556. hooks = jQuery._queueHooks( elem, type ),
  8557. next = function() {
  8558. jQuery.dequeue( elem, type );
  8559. };
  8560. // If the fx queue is dequeued, always remove the progress sentinel
  8561. if ( fn === "inprogress" ) {
  8562. fn = queue.shift();
  8563. startLength--;
  8564. }
  8565. if ( fn ) {
  8566. // Add a progress sentinel to prevent the fx queue from being
  8567. // automatically dequeued
  8568. if ( type === "fx" ) {
  8569. queue.unshift( "inprogress" );
  8570. }
  8571. // Clear up the last queue stop function
  8572. delete hooks.stop;
  8573. fn.call( elem, next, hooks );
  8574. }
  8575. if ( !startLength && hooks ) {
  8576. hooks.empty.fire();
  8577. }
  8578. },
  8579. // Not public - generate a queueHooks object, or return the current one
  8580. _queueHooks: function( elem, type ) {
  8581. var key = type + "queueHooks";
  8582. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  8583. empty: jQuery.Callbacks( "once memory" ).add( function() {
  8584. dataPriv.remove( elem, [ type + "queue", key ] );
  8585. } )
  8586. } );
  8587. }
  8588. } );
  8589. jQuery.fn.extend( {
  8590. queue: function( type, data ) {
  8591. var setter = 2;
  8592. if ( typeof type !== "string" ) {
  8593. data = type;
  8594. type = "fx";
  8595. setter--;
  8596. }
  8597. if ( arguments.length < setter ) {
  8598. return jQuery.queue( this[ 0 ], type );
  8599. }
  8600. return data === undefined ?
  8601. this :
  8602. this.each( function() {
  8603. var queue = jQuery.queue( this, type, data );
  8604. // Ensure a hooks for this queue
  8605. jQuery._queueHooks( this, type );
  8606. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  8607. jQuery.dequeue( this, type );
  8608. }
  8609. } );
  8610. },
  8611. dequeue: function( type ) {
  8612. return this.each( function() {
  8613. jQuery.dequeue( this, type );
  8614. } );
  8615. },
  8616. clearQueue: function( type ) {
  8617. return this.queue( type || "fx", [] );
  8618. },
  8619. // Get a promise resolved when queues of a certain type
  8620. // are emptied (fx is the type by default)
  8621. promise: function( type, obj ) {
  8622. var tmp,
  8623. count = 1,
  8624. defer = jQuery.Deferred(),
  8625. elements = this,
  8626. i = this.length,
  8627. resolve = function() {
  8628. if ( !( --count ) ) {
  8629. defer.resolveWith( elements, [ elements ] );
  8630. }
  8631. };
  8632. if ( typeof type !== "string" ) {
  8633. obj = type;
  8634. type = undefined;
  8635. }
  8636. type = type || "fx";
  8637. while ( i-- ) {
  8638. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  8639. if ( tmp && tmp.empty ) {
  8640. count++;
  8641. tmp.empty.add( resolve );
  8642. }
  8643. }
  8644. resolve();
  8645. return defer.promise( obj );
  8646. }
  8647. } );
  8648. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  8649. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  8650. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  8651. var isHiddenWithinTree = function( elem, el ) {
  8652. // isHiddenWithinTree might be called from jQuery#filter function;
  8653. // in that case, element will be second argument
  8654. elem = el || elem;
  8655. // Inline style trumps all
  8656. return elem.style.display === "none" ||
  8657. elem.style.display === "" &&
  8658. // Otherwise, check computed style
  8659. // Support: Firefox <=43 - 45
  8660. // Disconnected elements can have computed display: none, so first confirm that elem is
  8661. // in the document.
  8662. jQuery.contains( elem.ownerDocument, elem ) &&
  8663. jQuery.css( elem, "display" ) === "none";
  8664. };
  8665. var swap = function( elem, options, callback, args ) {
  8666. var ret, name,
  8667. old = {};
  8668. // Remember the old values, and insert the new ones
  8669. for ( name in options ) {
  8670. old[ name ] = elem.style[ name ];
  8671. elem.style[ name ] = options[ name ];
  8672. }
  8673. ret = callback.apply( elem, args || [] );
  8674. // Revert the old values
  8675. for ( name in options ) {
  8676. elem.style[ name ] = old[ name ];
  8677. }
  8678. return ret;
  8679. };
  8680. function adjustCSS( elem, prop, valueParts, tween ) {
  8681. var adjusted, scale,
  8682. maxIterations = 20,
  8683. currentValue = tween ?
  8684. function() {
  8685. return tween.cur();
  8686. } :
  8687. function() {
  8688. return jQuery.css( elem, prop, "" );
  8689. },
  8690. initial = currentValue(),
  8691. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  8692. // Starting value computation is required for potential unit mismatches
  8693. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  8694. rcssNum.exec( jQuery.css( elem, prop ) );
  8695. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  8696. // Support: Firefox <=54
  8697. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  8698. initial = initial / 2;
  8699. // Trust units reported by jQuery.css
  8700. unit = unit || initialInUnit[ 3 ];
  8701. // Iteratively approximate from a nonzero starting point
  8702. initialInUnit = +initial || 1;
  8703. while ( maxIterations-- ) {
  8704. // Evaluate and update our best guess (doubling guesses that zero out).
  8705. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  8706. jQuery.style( elem, prop, initialInUnit + unit );
  8707. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  8708. maxIterations = 0;
  8709. }
  8710. initialInUnit = initialInUnit / scale;
  8711. }
  8712. initialInUnit = initialInUnit * 2;
  8713. jQuery.style( elem, prop, initialInUnit + unit );
  8714. // Make sure we update the tween properties later on
  8715. valueParts = valueParts || [];
  8716. }
  8717. if ( valueParts ) {
  8718. initialInUnit = +initialInUnit || +initial || 0;
  8719. // Apply relative offset (+=/-=) if specified
  8720. adjusted = valueParts[ 1 ] ?
  8721. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  8722. +valueParts[ 2 ];
  8723. if ( tween ) {
  8724. tween.unit = unit;
  8725. tween.start = initialInUnit;
  8726. tween.end = adjusted;
  8727. }
  8728. }
  8729. return adjusted;
  8730. }
  8731. var defaultDisplayMap = {};
  8732. function getDefaultDisplay( elem ) {
  8733. var temp,
  8734. doc = elem.ownerDocument,
  8735. nodeName = elem.nodeName,
  8736. display = defaultDisplayMap[ nodeName ];
  8737. if ( display ) {
  8738. return display;
  8739. }
  8740. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  8741. display = jQuery.css( temp, "display" );
  8742. temp.parentNode.removeChild( temp );
  8743. if ( display === "none" ) {
  8744. display = "block";
  8745. }
  8746. defaultDisplayMap[ nodeName ] = display;
  8747. return display;
  8748. }
  8749. function showHide( elements, show ) {
  8750. var display, elem,
  8751. values = [],
  8752. index = 0,
  8753. length = elements.length;
  8754. // Determine new display value for elements that need to change
  8755. for ( ; index < length; index++ ) {
  8756. elem = elements[ index ];
  8757. if ( !elem.style ) {
  8758. continue;
  8759. }
  8760. display = elem.style.display;
  8761. if ( show ) {
  8762. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  8763. // check is required in this first loop unless we have a nonempty display value (either
  8764. // inline or about-to-be-restored)
  8765. if ( display === "none" ) {
  8766. values[ index ] = dataPriv.get( elem, "display" ) || null;
  8767. if ( !values[ index ] ) {
  8768. elem.style.display = "";
  8769. }
  8770. }
  8771. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  8772. values[ index ] = getDefaultDisplay( elem );
  8773. }
  8774. } else {
  8775. if ( display !== "none" ) {
  8776. values[ index ] = "none";
  8777. // Remember what we're overwriting
  8778. dataPriv.set( elem, "display", display );
  8779. }
  8780. }
  8781. }
  8782. // Set the display of the elements in a second loop to avoid constant reflow
  8783. for ( index = 0; index < length; index++ ) {
  8784. if ( values[ index ] != null ) {
  8785. elements[ index ].style.display = values[ index ];
  8786. }
  8787. }
  8788. return elements;
  8789. }
  8790. jQuery.fn.extend( {
  8791. show: function() {
  8792. return showHide( this, true );
  8793. },
  8794. hide: function() {
  8795. return showHide( this );
  8796. },
  8797. toggle: function( state ) {
  8798. if ( typeof state === "boolean" ) {
  8799. return state ? this.show() : this.hide();
  8800. }
  8801. return this.each( function() {
  8802. if ( isHiddenWithinTree( this ) ) {
  8803. jQuery( this ).show();
  8804. } else {
  8805. jQuery( this ).hide();
  8806. }
  8807. } );
  8808. }
  8809. } );
  8810. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  8811. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  8812. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  8813. // We have to close these tags to support XHTML (#13200)
  8814. var wrapMap = {
  8815. // Support: IE <=9 only
  8816. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  8817. // XHTML parsers do not magically insert elements in the
  8818. // same way that tag soup parsers do. So we cannot shorten
  8819. // this by omitting <tbody> or other required elements.
  8820. thead: [ 1, "<table>", "</table>" ],
  8821. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  8822. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  8823. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  8824. _default: [ 0, "", "" ]
  8825. };
  8826. // Support: IE <=9 only
  8827. wrapMap.optgroup = wrapMap.option;
  8828. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  8829. wrapMap.th = wrapMap.td;
  8830. function getAll( context, tag ) {
  8831. // Support: IE <=9 - 11 only
  8832. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  8833. var ret;
  8834. if ( typeof context.getElementsByTagName !== "undefined" ) {
  8835. ret = context.getElementsByTagName( tag || "*" );
  8836. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  8837. ret = context.querySelectorAll( tag || "*" );
  8838. } else {
  8839. ret = [];
  8840. }
  8841. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  8842. return jQuery.merge( [ context ], ret );
  8843. }
  8844. return ret;
  8845. }
  8846. // Mark scripts as having already been evaluated
  8847. function setGlobalEval( elems, refElements ) {
  8848. var i = 0,
  8849. l = elems.length;
  8850. for ( ; i < l; i++ ) {
  8851. dataPriv.set(
  8852. elems[ i ],
  8853. "globalEval",
  8854. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  8855. );
  8856. }
  8857. }
  8858. var rhtml = /<|&#?\w+;/;
  8859. function buildFragment( elems, context, scripts, selection, ignored ) {
  8860. var elem, tmp, tag, wrap, contains, j,
  8861. fragment = context.createDocumentFragment(),
  8862. nodes = [],
  8863. i = 0,
  8864. l = elems.length;
  8865. for ( ; i < l; i++ ) {
  8866. elem = elems[ i ];
  8867. if ( elem || elem === 0 ) {
  8868. // Add nodes directly
  8869. if ( toType( elem ) === "object" ) {
  8870. // Support: Android <=4.0 only, PhantomJS 1 only
  8871. // push.apply(_, arraylike) throws on ancient WebKit
  8872. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  8873. // Convert non-html into a text node
  8874. } else if ( !rhtml.test( elem ) ) {
  8875. nodes.push( context.createTextNode( elem ) );
  8876. // Convert html into DOM nodes
  8877. } else {
  8878. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  8879. // Deserialize a standard representation
  8880. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  8881. wrap = wrapMap[ tag ] || wrapMap._default;
  8882. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  8883. // Descend through wrappers to the right content
  8884. j = wrap[ 0 ];
  8885. while ( j-- ) {
  8886. tmp = tmp.lastChild;
  8887. }
  8888. // Support: Android <=4.0 only, PhantomJS 1 only
  8889. // push.apply(_, arraylike) throws on ancient WebKit
  8890. jQuery.merge( nodes, tmp.childNodes );
  8891. // Remember the top-level container
  8892. tmp = fragment.firstChild;
  8893. // Ensure the created nodes are orphaned (#12392)
  8894. tmp.textContent = "";
  8895. }
  8896. }
  8897. }
  8898. // Remove wrapper from fragment
  8899. fragment.textContent = "";
  8900. i = 0;
  8901. while ( ( elem = nodes[ i++ ] ) ) {
  8902. // Skip elements already in the context collection (trac-4087)
  8903. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  8904. if ( ignored ) {
  8905. ignored.push( elem );
  8906. }
  8907. continue;
  8908. }
  8909. contains = jQuery.contains( elem.ownerDocument, elem );
  8910. // Append to fragment
  8911. tmp = getAll( fragment.appendChild( elem ), "script" );
  8912. // Preserve script evaluation history
  8913. if ( contains ) {
  8914. setGlobalEval( tmp );
  8915. }
  8916. // Capture executables
  8917. if ( scripts ) {
  8918. j = 0;
  8919. while ( ( elem = tmp[ j++ ] ) ) {
  8920. if ( rscriptType.test( elem.type || "" ) ) {
  8921. scripts.push( elem );
  8922. }
  8923. }
  8924. }
  8925. }
  8926. return fragment;
  8927. }
  8928. ( function() {
  8929. var fragment = document.createDocumentFragment(),
  8930. div = fragment.appendChild( document.createElement( "div" ) ),
  8931. input = document.createElement( "input" );
  8932. // Support: Android 4.0 - 4.3 only
  8933. // Check state lost if the name is set (#11217)
  8934. // Support: Windows Web Apps (WWA)
  8935. // `name` and `type` must use .setAttribute for WWA (#14901)
  8936. input.setAttribute( "type", "radio" );
  8937. input.setAttribute( "checked", "checked" );
  8938. input.setAttribute( "name", "t" );
  8939. div.appendChild( input );
  8940. // Support: Android <=4.1 only
  8941. // Older WebKit doesn't clone checked state correctly in fragments
  8942. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  8943. // Support: IE <=11 only
  8944. // Make sure textarea (and checkbox) defaultValue is properly cloned
  8945. div.innerHTML = "<textarea>x</textarea>";
  8946. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  8947. } )();
  8948. var documentElement = document.documentElement;
  8949. var
  8950. rkeyEvent = /^key/,
  8951. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  8952. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  8953. function returnTrue() {
  8954. return true;
  8955. }
  8956. function returnFalse() {
  8957. return false;
  8958. }
  8959. // Support: IE <=9 only
  8960. // See #13393 for more info
  8961. function safeActiveElement() {
  8962. try {
  8963. return document.activeElement;
  8964. } catch ( err ) { }
  8965. }
  8966. function on( elem, types, selector, data, fn, one ) {
  8967. var origFn, type;
  8968. // Types can be a map of types/handlers
  8969. if ( typeof types === "object" ) {
  8970. // ( types-Object, selector, data )
  8971. if ( typeof selector !== "string" ) {
  8972. // ( types-Object, data )
  8973. data = data || selector;
  8974. selector = undefined;
  8975. }
  8976. for ( type in types ) {
  8977. on( elem, type, selector, data, types[ type ], one );
  8978. }
  8979. return elem;
  8980. }
  8981. if ( data == null && fn == null ) {
  8982. // ( types, fn )
  8983. fn = selector;
  8984. data = selector = undefined;
  8985. } else if ( fn == null ) {
  8986. if ( typeof selector === "string" ) {
  8987. // ( types, selector, fn )
  8988. fn = data;
  8989. data = undefined;
  8990. } else {
  8991. // ( types, data, fn )
  8992. fn = data;
  8993. data = selector;
  8994. selector = undefined;
  8995. }
  8996. }
  8997. if ( fn === false ) {
  8998. fn = returnFalse;
  8999. } else if ( !fn ) {
  9000. return elem;
  9001. }
  9002. if ( one === 1 ) {
  9003. origFn = fn;
  9004. fn = function( event ) {
  9005. // Can use an empty set, since event contains the info
  9006. jQuery().off( event );
  9007. return origFn.apply( this, arguments );
  9008. };
  9009. // Use same guid so caller can remove using origFn
  9010. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  9011. }
  9012. return elem.each( function() {
  9013. jQuery.event.add( this, types, fn, data, selector );
  9014. } );
  9015. }
  9016. /*
  9017. * Helper functions for managing events -- not part of the public interface.
  9018. * Props to Dean Edwards' addEvent library for many of the ideas.
  9019. */
  9020. jQuery.event = {
  9021. global: {},
  9022. add: function( elem, types, handler, data, selector ) {
  9023. var handleObjIn, eventHandle, tmp,
  9024. events, t, handleObj,
  9025. special, handlers, type, namespaces, origType,
  9026. elemData = dataPriv.get( elem );
  9027. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  9028. if ( !elemData ) {
  9029. return;
  9030. }
  9031. // Caller can pass in an object of custom data in lieu of the handler
  9032. if ( handler.handler ) {
  9033. handleObjIn = handler;
  9034. handler = handleObjIn.handler;
  9035. selector = handleObjIn.selector;
  9036. }
  9037. // Ensure that invalid selectors throw exceptions at attach time
  9038. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  9039. if ( selector ) {
  9040. jQuery.find.matchesSelector( documentElement, selector );
  9041. }
  9042. // Make sure that the handler has a unique ID, used to find/remove it later
  9043. if ( !handler.guid ) {
  9044. handler.guid = jQuery.guid++;
  9045. }
  9046. // Init the element's event structure and main handler, if this is the first
  9047. if ( !( events = elemData.events ) ) {
  9048. events = elemData.events = {};
  9049. }
  9050. if ( !( eventHandle = elemData.handle ) ) {
  9051. eventHandle = elemData.handle = function( e ) {
  9052. // Discard the second event of a jQuery.event.trigger() and
  9053. // when an event is called after a page has unloaded
  9054. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  9055. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  9056. };
  9057. }
  9058. // Handle multiple events separated by a space
  9059. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  9060. t = types.length;
  9061. while ( t-- ) {
  9062. tmp = rtypenamespace.exec( types[ t ] ) || [];
  9063. type = origType = tmp[ 1 ];
  9064. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  9065. // There *must* be a type, no attaching namespace-only handlers
  9066. if ( !type ) {
  9067. continue;
  9068. }
  9069. // If event changes its type, use the special event handlers for the changed type
  9070. special = jQuery.event.special[ type ] || {};
  9071. // If selector defined, determine special event api type, otherwise given type
  9072. type = ( selector ? special.delegateType : special.bindType ) || type;
  9073. // Update special based on newly reset type
  9074. special = jQuery.event.special[ type ] || {};
  9075. // handleObj is passed to all event handlers
  9076. handleObj = jQuery.extend( {
  9077. type: type,
  9078. origType: origType,
  9079. data: data,
  9080. handler: handler,
  9081. guid: handler.guid,
  9082. selector: selector,
  9083. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  9084. namespace: namespaces.join( "." )
  9085. }, handleObjIn );
  9086. // Init the event handler queue if we're the first
  9087. if ( !( handlers = events[ type ] ) ) {
  9088. handlers = events[ type ] = [];
  9089. handlers.delegateCount = 0;
  9090. // Only use addEventListener if the special events handler returns false
  9091. if ( !special.setup ||
  9092. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  9093. if ( elem.addEventListener ) {
  9094. elem.addEventListener( type, eventHandle );
  9095. }
  9096. }
  9097. }
  9098. if ( special.add ) {
  9099. special.add.call( elem, handleObj );
  9100. if ( !handleObj.handler.guid ) {
  9101. handleObj.handler.guid = handler.guid;
  9102. }
  9103. }
  9104. // Add to the element's handler list, delegates in front
  9105. if ( selector ) {
  9106. handlers.splice( handlers.delegateCount++, 0, handleObj );
  9107. } else {
  9108. handlers.push( handleObj );
  9109. }
  9110. // Keep track of which events have ever been used, for event optimization
  9111. jQuery.event.global[ type ] = true;
  9112. }
  9113. },
  9114. // Detach an event or set of events from an element
  9115. remove: function( elem, types, handler, selector, mappedTypes ) {
  9116. var j, origCount, tmp,
  9117. events, t, handleObj,
  9118. special, handlers, type, namespaces, origType,
  9119. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  9120. if ( !elemData || !( events = elemData.events ) ) {
  9121. return;
  9122. }
  9123. // Once for each type.namespace in types; type may be omitted
  9124. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  9125. t = types.length;
  9126. while ( t-- ) {
  9127. tmp = rtypenamespace.exec( types[ t ] ) || [];
  9128. type = origType = tmp[ 1 ];
  9129. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  9130. // Unbind all events (on this namespace, if provided) for the element
  9131. if ( !type ) {
  9132. for ( type in events ) {
  9133. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  9134. }
  9135. continue;
  9136. }
  9137. special = jQuery.event.special[ type ] || {};
  9138. type = ( selector ? special.delegateType : special.bindType ) || type;
  9139. handlers = events[ type ] || [];
  9140. tmp = tmp[ 2 ] &&
  9141. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  9142. // Remove matching events
  9143. origCount = j = handlers.length;
  9144. while ( j-- ) {
  9145. handleObj = handlers[ j ];
  9146. if ( ( mappedTypes || origType === handleObj.origType ) &&
  9147. ( !handler || handler.guid === handleObj.guid ) &&
  9148. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  9149. ( !selector || selector === handleObj.selector ||
  9150. selector === "**" && handleObj.selector ) ) {
  9151. handlers.splice( j, 1 );
  9152. if ( handleObj.selector ) {
  9153. handlers.delegateCount--;
  9154. }
  9155. if ( special.remove ) {
  9156. special.remove.call( elem, handleObj );
  9157. }
  9158. }
  9159. }
  9160. // Remove generic event handler if we removed something and no more handlers exist
  9161. // (avoids potential for endless recursion during removal of special event handlers)
  9162. if ( origCount && !handlers.length ) {
  9163. if ( !special.teardown ||
  9164. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  9165. jQuery.removeEvent( elem, type, elemData.handle );
  9166. }
  9167. delete events[ type ];
  9168. }
  9169. }
  9170. // Remove data and the expando if it's no longer used
  9171. if ( jQuery.isEmptyObject( events ) ) {
  9172. dataPriv.remove( elem, "handle events" );
  9173. }
  9174. },
  9175. dispatch: function( nativeEvent ) {
  9176. // Make a writable jQuery.Event from the native event object
  9177. var event = jQuery.event.fix( nativeEvent );
  9178. var i, j, ret, matched, handleObj, handlerQueue,
  9179. args = new Array( arguments.length ),
  9180. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  9181. special = jQuery.event.special[ event.type ] || {};
  9182. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  9183. args[ 0 ] = event;
  9184. for ( i = 1; i < arguments.length; i++ ) {
  9185. args[ i ] = arguments[ i ];
  9186. }
  9187. event.delegateTarget = this;
  9188. // Call the preDispatch hook for the mapped type, and let it bail if desired
  9189. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  9190. return;
  9191. }
  9192. // Determine handlers
  9193. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  9194. // Run delegates first; they may want to stop propagation beneath us
  9195. i = 0;
  9196. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  9197. event.currentTarget = matched.elem;
  9198. j = 0;
  9199. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  9200. !event.isImmediatePropagationStopped() ) {
  9201. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  9202. // a subset or equal to those in the bound event (both can have no namespace).
  9203. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  9204. event.handleObj = handleObj;
  9205. event.data = handleObj.data;
  9206. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  9207. handleObj.handler ).apply( matched.elem, args );
  9208. if ( ret !== undefined ) {
  9209. if ( ( event.result = ret ) === false ) {
  9210. event.preventDefault();
  9211. event.stopPropagation();
  9212. }
  9213. }
  9214. }
  9215. }
  9216. }
  9217. // Call the postDispatch hook for the mapped type
  9218. if ( special.postDispatch ) {
  9219. special.postDispatch.call( this, event );
  9220. }
  9221. return event.result;
  9222. },
  9223. handlers: function( event, handlers ) {
  9224. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  9225. handlerQueue = [],
  9226. delegateCount = handlers.delegateCount,
  9227. cur = event.target;
  9228. // Find delegate handlers
  9229. if ( delegateCount &&
  9230. // Support: IE <=9
  9231. // Black-hole SVG <use> instance trees (trac-13180)
  9232. cur.nodeType &&
  9233. // Support: Firefox <=42
  9234. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  9235. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  9236. // Support: IE 11 only
  9237. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  9238. !( event.type === "click" && event.button >= 1 ) ) {
  9239. for ( ; cur !== this; cur = cur.parentNode || this ) {
  9240. // Don't check non-elements (#13208)
  9241. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  9242. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  9243. matchedHandlers = [];
  9244. matchedSelectors = {};
  9245. for ( i = 0; i < delegateCount; i++ ) {
  9246. handleObj = handlers[ i ];
  9247. // Don't conflict with Object.prototype properties (#13203)
  9248. sel = handleObj.selector + " ";
  9249. if ( matchedSelectors[ sel ] === undefined ) {
  9250. matchedSelectors[ sel ] = handleObj.needsContext ?
  9251. jQuery( sel, this ).index( cur ) > -1 :
  9252. jQuery.find( sel, this, null, [ cur ] ).length;
  9253. }
  9254. if ( matchedSelectors[ sel ] ) {
  9255. matchedHandlers.push( handleObj );
  9256. }
  9257. }
  9258. if ( matchedHandlers.length ) {
  9259. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  9260. }
  9261. }
  9262. }
  9263. }
  9264. // Add the remaining (directly-bound) handlers
  9265. cur = this;
  9266. if ( delegateCount < handlers.length ) {
  9267. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  9268. }
  9269. return handlerQueue;
  9270. },
  9271. addProp: function( name, hook ) {
  9272. Object.defineProperty( jQuery.Event.prototype, name, {
  9273. enumerable: true,
  9274. configurable: true,
  9275. get: isFunction( hook ) ?
  9276. function() {
  9277. if ( this.originalEvent ) {
  9278. return hook( this.originalEvent );
  9279. }
  9280. } :
  9281. function() {
  9282. if ( this.originalEvent ) {
  9283. return this.originalEvent[ name ];
  9284. }
  9285. },
  9286. set: function( value ) {
  9287. Object.defineProperty( this, name, {
  9288. enumerable: true,
  9289. configurable: true,
  9290. writable: true,
  9291. value: value
  9292. } );
  9293. }
  9294. } );
  9295. },
  9296. fix: function( originalEvent ) {
  9297. return originalEvent[ jQuery.expando ] ?
  9298. originalEvent :
  9299. new jQuery.Event( originalEvent );
  9300. },
  9301. special: {
  9302. load: {
  9303. // Prevent triggered image.load events from bubbling to window.load
  9304. noBubble: true
  9305. },
  9306. focus: {
  9307. // Fire native event if possible so blur/focus sequence is correct
  9308. trigger: function() {
  9309. if ( this !== safeActiveElement() && this.focus ) {
  9310. this.focus();
  9311. return false;
  9312. }
  9313. },
  9314. delegateType: "focusin"
  9315. },
  9316. blur: {
  9317. trigger: function() {
  9318. if ( this === safeActiveElement() && this.blur ) {
  9319. this.blur();
  9320. return false;
  9321. }
  9322. },
  9323. delegateType: "focusout"
  9324. },
  9325. click: {
  9326. // For checkbox, fire native event so checked state will be right
  9327. trigger: function() {
  9328. if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
  9329. this.click();
  9330. return false;
  9331. }
  9332. },
  9333. // For cross-browser consistency, don't fire native .click() on links
  9334. _default: function( event ) {
  9335. return nodeName( event.target, "a" );
  9336. }
  9337. },
  9338. beforeunload: {
  9339. postDispatch: function( event ) {
  9340. // Support: Firefox 20+
  9341. // Firefox doesn't alert if the returnValue field is not set.
  9342. if ( event.result !== undefined && event.originalEvent ) {
  9343. event.originalEvent.returnValue = event.result;
  9344. }
  9345. }
  9346. }
  9347. }
  9348. };
  9349. jQuery.removeEvent = function( elem, type, handle ) {
  9350. // This "if" is needed for plain objects
  9351. if ( elem.removeEventListener ) {
  9352. elem.removeEventListener( type, handle );
  9353. }
  9354. };
  9355. jQuery.Event = function( src, props ) {
  9356. // Allow instantiation without the 'new' keyword
  9357. if ( !( this instanceof jQuery.Event ) ) {
  9358. return new jQuery.Event( src, props );
  9359. }
  9360. // Event object
  9361. if ( src && src.type ) {
  9362. this.originalEvent = src;
  9363. this.type = src.type;
  9364. // Events bubbling up the document may have been marked as prevented
  9365. // by a handler lower down the tree; reflect the correct value.
  9366. this.isDefaultPrevented = src.defaultPrevented ||
  9367. src.defaultPrevented === undefined &&
  9368. // Support: Android <=2.3 only
  9369. src.returnValue === false ?
  9370. returnTrue :
  9371. returnFalse;
  9372. // Create target properties
  9373. // Support: Safari <=6 - 7 only
  9374. // Target should not be a text node (#504, #13143)
  9375. this.target = ( src.target && src.target.nodeType === 3 ) ?
  9376. src.target.parentNode :
  9377. src.target;
  9378. this.currentTarget = src.currentTarget;
  9379. this.relatedTarget = src.relatedTarget;
  9380. // Event type
  9381. } else {
  9382. this.type = src;
  9383. }
  9384. // Put explicitly provided properties onto the event object
  9385. if ( props ) {
  9386. jQuery.extend( this, props );
  9387. }
  9388. // Create a timestamp if incoming event doesn't have one
  9389. this.timeStamp = src && src.timeStamp || Date.now();
  9390. // Mark it as fixed
  9391. this[ jQuery.expando ] = true;
  9392. };
  9393. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  9394. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  9395. jQuery.Event.prototype = {
  9396. constructor: jQuery.Event,
  9397. isDefaultPrevented: returnFalse,
  9398. isPropagationStopped: returnFalse,
  9399. isImmediatePropagationStopped: returnFalse,
  9400. isSimulated: false,
  9401. preventDefault: function() {
  9402. var e = this.originalEvent;
  9403. this.isDefaultPrevented = returnTrue;
  9404. if ( e && !this.isSimulated ) {
  9405. e.preventDefault();
  9406. }
  9407. },
  9408. stopPropagation: function() {
  9409. var e = this.originalEvent;
  9410. this.isPropagationStopped = returnTrue;
  9411. if ( e && !this.isSimulated ) {
  9412. e.stopPropagation();
  9413. }
  9414. },
  9415. stopImmediatePropagation: function() {
  9416. var e = this.originalEvent;
  9417. this.isImmediatePropagationStopped = returnTrue;
  9418. if ( e && !this.isSimulated ) {
  9419. e.stopImmediatePropagation();
  9420. }
  9421. this.stopPropagation();
  9422. }
  9423. };
  9424. // Includes all common event props including KeyEvent and MouseEvent specific props
  9425. jQuery.each( {
  9426. altKey: true,
  9427. bubbles: true,
  9428. cancelable: true,
  9429. changedTouches: true,
  9430. ctrlKey: true,
  9431. detail: true,
  9432. eventPhase: true,
  9433. metaKey: true,
  9434. pageX: true,
  9435. pageY: true,
  9436. shiftKey: true,
  9437. view: true,
  9438. "char": true,
  9439. charCode: true,
  9440. key: true,
  9441. keyCode: true,
  9442. button: true,
  9443. buttons: true,
  9444. clientX: true,
  9445. clientY: true,
  9446. offsetX: true,
  9447. offsetY: true,
  9448. pointerId: true,
  9449. pointerType: true,
  9450. screenX: true,
  9451. screenY: true,
  9452. targetTouches: true,
  9453. toElement: true,
  9454. touches: true,
  9455. which: function( event ) {
  9456. var button = event.button;
  9457. // Add which for key events
  9458. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  9459. return event.charCode != null ? event.charCode : event.keyCode;
  9460. }
  9461. // Add which for click: 1 === left; 2 === middle; 3 === right
  9462. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  9463. if ( button & 1 ) {
  9464. return 1;
  9465. }
  9466. if ( button & 2 ) {
  9467. return 3;
  9468. }
  9469. if ( button & 4 ) {
  9470. return 2;
  9471. }
  9472. return 0;
  9473. }
  9474. return event.which;
  9475. }
  9476. }, jQuery.event.addProp );
  9477. // Create mouseenter/leave events using mouseover/out and event-time checks
  9478. // so that event delegation works in jQuery.
  9479. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  9480. //
  9481. // Support: Safari 7 only
  9482. // Safari sends mouseenter too often; see:
  9483. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  9484. // for the description of the bug (it existed in older Chrome versions as well).
  9485. jQuery.each( {
  9486. mouseenter: "mouseover",
  9487. mouseleave: "mouseout",
  9488. pointerenter: "pointerover",
  9489. pointerleave: "pointerout"
  9490. }, function( orig, fix ) {
  9491. jQuery.event.special[ orig ] = {
  9492. delegateType: fix,
  9493. bindType: fix,
  9494. handle: function( event ) {
  9495. var ret,
  9496. target = this,
  9497. related = event.relatedTarget,
  9498. handleObj = event.handleObj;
  9499. // For mouseenter/leave call the handler if related is outside the target.
  9500. // NB: No relatedTarget if the mouse left/entered the browser window
  9501. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  9502. event.type = handleObj.origType;
  9503. ret = handleObj.handler.apply( this, arguments );
  9504. event.type = fix;
  9505. }
  9506. return ret;
  9507. }
  9508. };
  9509. } );
  9510. jQuery.fn.extend( {
  9511. on: function( types, selector, data, fn ) {
  9512. return on( this, types, selector, data, fn );
  9513. },
  9514. one: function( types, selector, data, fn ) {
  9515. return on( this, types, selector, data, fn, 1 );
  9516. },
  9517. off: function( types, selector, fn ) {
  9518. var handleObj, type;
  9519. if ( types && types.preventDefault && types.handleObj ) {
  9520. // ( event ) dispatched jQuery.Event
  9521. handleObj = types.handleObj;
  9522. jQuery( types.delegateTarget ).off(
  9523. handleObj.namespace ?
  9524. handleObj.origType + "." + handleObj.namespace :
  9525. handleObj.origType,
  9526. handleObj.selector,
  9527. handleObj.handler
  9528. );
  9529. return this;
  9530. }
  9531. if ( typeof types === "object" ) {
  9532. // ( types-object [, selector] )
  9533. for ( type in types ) {
  9534. this.off( type, selector, types[ type ] );
  9535. }
  9536. return this;
  9537. }
  9538. if ( selector === false || typeof selector === "function" ) {
  9539. // ( types [, fn] )
  9540. fn = selector;
  9541. selector = undefined;
  9542. }
  9543. if ( fn === false ) {
  9544. fn = returnFalse;
  9545. }
  9546. return this.each( function() {
  9547. jQuery.event.remove( this, types, fn, selector );
  9548. } );
  9549. }
  9550. } );
  9551. var
  9552. /* eslint-disable max-len */
  9553. // See https://github.com/eslint/eslint/issues/3229
  9554. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  9555. /* eslint-enable */
  9556. // Support: IE <=10 - 11, Edge 12 - 13 only
  9557. // In IE/Edge using regex groups here causes severe slowdowns.
  9558. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  9559. rnoInnerhtml = /<script|<style|<link/i,
  9560. // checked="checked" or checked
  9561. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  9562. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  9563. // Prefer a tbody over its parent table for containing new rows
  9564. function manipulationTarget( elem, content ) {
  9565. if ( nodeName( elem, "table" ) &&
  9566. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  9567. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  9568. }
  9569. return elem;
  9570. }
  9571. // Replace/restore the type attribute of script elements for safe DOM manipulation
  9572. function disableScript( elem ) {
  9573. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  9574. return elem;
  9575. }
  9576. function restoreScript( elem ) {
  9577. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  9578. elem.type = elem.type.slice( 5 );
  9579. } else {
  9580. elem.removeAttribute( "type" );
  9581. }
  9582. return elem;
  9583. }
  9584. function cloneCopyEvent( src, dest ) {
  9585. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  9586. if ( dest.nodeType !== 1 ) {
  9587. return;
  9588. }
  9589. // 1. Copy private data: events, handlers, etc.
  9590. if ( dataPriv.hasData( src ) ) {
  9591. pdataOld = dataPriv.access( src );
  9592. pdataCur = dataPriv.set( dest, pdataOld );
  9593. events = pdataOld.events;
  9594. if ( events ) {
  9595. delete pdataCur.handle;
  9596. pdataCur.events = {};
  9597. for ( type in events ) {
  9598. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  9599. jQuery.event.add( dest, type, events[ type ][ i ] );
  9600. }
  9601. }
  9602. }
  9603. }
  9604. // 2. Copy user data
  9605. if ( dataUser.hasData( src ) ) {
  9606. udataOld = dataUser.access( src );
  9607. udataCur = jQuery.extend( {}, udataOld );
  9608. dataUser.set( dest, udataCur );
  9609. }
  9610. }
  9611. // Fix IE bugs, see support tests
  9612. function fixInput( src, dest ) {
  9613. var nodeName = dest.nodeName.toLowerCase();
  9614. // Fails to persist the checked state of a cloned checkbox or radio button.
  9615. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  9616. dest.checked = src.checked;
  9617. // Fails to return the selected option to the default selected state when cloning options
  9618. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  9619. dest.defaultValue = src.defaultValue;
  9620. }
  9621. }
  9622. function domManip( collection, args, callback, ignored ) {
  9623. // Flatten any nested arrays
  9624. args = concat.apply( [], args );
  9625. var fragment, first, scripts, hasScripts, node, doc,
  9626. i = 0,
  9627. l = collection.length,
  9628. iNoClone = l - 1,
  9629. value = args[ 0 ],
  9630. valueIsFunction = isFunction( value );
  9631. // We can't cloneNode fragments that contain checked, in WebKit
  9632. if ( valueIsFunction ||
  9633. ( l > 1 && typeof value === "string" &&
  9634. !support.checkClone && rchecked.test( value ) ) ) {
  9635. return collection.each( function( index ) {
  9636. var self = collection.eq( index );
  9637. if ( valueIsFunction ) {
  9638. args[ 0 ] = value.call( this, index, self.html() );
  9639. }
  9640. domManip( self, args, callback, ignored );
  9641. } );
  9642. }
  9643. if ( l ) {
  9644. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  9645. first = fragment.firstChild;
  9646. if ( fragment.childNodes.length === 1 ) {
  9647. fragment = first;
  9648. }
  9649. // Require either new content or an interest in ignored elements to invoke the callback
  9650. if ( first || ignored ) {
  9651. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  9652. hasScripts = scripts.length;
  9653. // Use the original fragment for the last item
  9654. // instead of the first because it can end up
  9655. // being emptied incorrectly in certain situations (#8070).
  9656. for ( ; i < l; i++ ) {
  9657. node = fragment;
  9658. if ( i !== iNoClone ) {
  9659. node = jQuery.clone( node, true, true );
  9660. // Keep references to cloned scripts for later restoration
  9661. if ( hasScripts ) {
  9662. // Support: Android <=4.0 only, PhantomJS 1 only
  9663. // push.apply(_, arraylike) throws on ancient WebKit
  9664. jQuery.merge( scripts, getAll( node, "script" ) );
  9665. }
  9666. }
  9667. callback.call( collection[ i ], node, i );
  9668. }
  9669. if ( hasScripts ) {
  9670. doc = scripts[ scripts.length - 1 ].ownerDocument;
  9671. // Reenable scripts
  9672. jQuery.map( scripts, restoreScript );
  9673. // Evaluate executable scripts on first document insertion
  9674. for ( i = 0; i < hasScripts; i++ ) {
  9675. node = scripts[ i ];
  9676. if ( rscriptType.test( node.type || "" ) &&
  9677. !dataPriv.access( node, "globalEval" ) &&
  9678. jQuery.contains( doc, node ) ) {
  9679. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  9680. // Optional AJAX dependency, but won't run scripts if not present
  9681. if ( jQuery._evalUrl ) {
  9682. jQuery._evalUrl( node.src );
  9683. }
  9684. } else {
  9685. DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
  9686. }
  9687. }
  9688. }
  9689. }
  9690. }
  9691. }
  9692. return collection;
  9693. }
  9694. function remove( elem, selector, keepData ) {
  9695. var node,
  9696. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  9697. i = 0;
  9698. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  9699. if ( !keepData && node.nodeType === 1 ) {
  9700. jQuery.cleanData( getAll( node ) );
  9701. }
  9702. if ( node.parentNode ) {
  9703. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  9704. setGlobalEval( getAll( node, "script" ) );
  9705. }
  9706. node.parentNode.removeChild( node );
  9707. }
  9708. }
  9709. return elem;
  9710. }
  9711. jQuery.extend( {
  9712. htmlPrefilter: function( html ) {
  9713. return html.replace( rxhtmlTag, "<$1></$2>" );
  9714. },
  9715. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  9716. var i, l, srcElements, destElements,
  9717. clone = elem.cloneNode( true ),
  9718. inPage = jQuery.contains( elem.ownerDocument, elem );
  9719. // Fix IE cloning issues
  9720. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  9721. !jQuery.isXMLDoc( elem ) ) {
  9722. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  9723. destElements = getAll( clone );
  9724. srcElements = getAll( elem );
  9725. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  9726. fixInput( srcElements[ i ], destElements[ i ] );
  9727. }
  9728. }
  9729. // Copy the events from the original to the clone
  9730. if ( dataAndEvents ) {
  9731. if ( deepDataAndEvents ) {
  9732. srcElements = srcElements || getAll( elem );
  9733. destElements = destElements || getAll( clone );
  9734. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  9735. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  9736. }
  9737. } else {
  9738. cloneCopyEvent( elem, clone );
  9739. }
  9740. }
  9741. // Preserve script evaluation history
  9742. destElements = getAll( clone, "script" );
  9743. if ( destElements.length > 0 ) {
  9744. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  9745. }
  9746. // Return the cloned set
  9747. return clone;
  9748. },
  9749. cleanData: function( elems ) {
  9750. var data, elem, type,
  9751. special = jQuery.event.special,
  9752. i = 0;
  9753. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  9754. if ( acceptData( elem ) ) {
  9755. if ( ( data = elem[ dataPriv.expando ] ) ) {
  9756. if ( data.events ) {
  9757. for ( type in data.events ) {
  9758. if ( special[ type ] ) {
  9759. jQuery.event.remove( elem, type );
  9760. // This is a shortcut to avoid jQuery.event.remove's overhead
  9761. } else {
  9762. jQuery.removeEvent( elem, type, data.handle );
  9763. }
  9764. }
  9765. }
  9766. // Support: Chrome <=35 - 45+
  9767. // Assign undefined instead of using delete, see Data#remove
  9768. elem[ dataPriv.expando ] = undefined;
  9769. }
  9770. if ( elem[ dataUser.expando ] ) {
  9771. // Support: Chrome <=35 - 45+
  9772. // Assign undefined instead of using delete, see Data#remove
  9773. elem[ dataUser.expando ] = undefined;
  9774. }
  9775. }
  9776. }
  9777. }
  9778. } );
  9779. jQuery.fn.extend( {
  9780. detach: function( selector ) {
  9781. return remove( this, selector, true );
  9782. },
  9783. remove: function( selector ) {
  9784. return remove( this, selector );
  9785. },
  9786. text: function( value ) {
  9787. return access( this, function( value ) {
  9788. return value === undefined ?
  9789. jQuery.text( this ) :
  9790. this.empty().each( function() {
  9791. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  9792. this.textContent = value;
  9793. }
  9794. } );
  9795. }, null, value, arguments.length );
  9796. },
  9797. append: function() {
  9798. return domManip( this, arguments, function( elem ) {
  9799. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  9800. var target = manipulationTarget( this, elem );
  9801. target.appendChild( elem );
  9802. }
  9803. } );
  9804. },
  9805. prepend: function() {
  9806. return domManip( this, arguments, function( elem ) {
  9807. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  9808. var target = manipulationTarget( this, elem );
  9809. target.insertBefore( elem, target.firstChild );
  9810. }
  9811. } );
  9812. },
  9813. before: function() {
  9814. return domManip( this, arguments, function( elem ) {
  9815. if ( this.parentNode ) {
  9816. this.parentNode.insertBefore( elem, this );
  9817. }
  9818. } );
  9819. },
  9820. after: function() {
  9821. return domManip( this, arguments, function( elem ) {
  9822. if ( this.parentNode ) {
  9823. this.parentNode.insertBefore( elem, this.nextSibling );
  9824. }
  9825. } );
  9826. },
  9827. empty: function() {
  9828. var elem,
  9829. i = 0;
  9830. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  9831. if ( elem.nodeType === 1 ) {
  9832. // Prevent memory leaks
  9833. jQuery.cleanData( getAll( elem, false ) );
  9834. // Remove any remaining nodes
  9835. elem.textContent = "";
  9836. }
  9837. }
  9838. return this;
  9839. },
  9840. clone: function( dataAndEvents, deepDataAndEvents ) {
  9841. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  9842. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  9843. return this.map( function() {
  9844. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  9845. } );
  9846. },
  9847. html: function( value ) {
  9848. return access( this, function( value ) {
  9849. var elem = this[ 0 ] || {},
  9850. i = 0,
  9851. l = this.length;
  9852. if ( value === undefined && elem.nodeType === 1 ) {
  9853. return elem.innerHTML;
  9854. }
  9855. // See if we can take a shortcut and just use innerHTML
  9856. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  9857. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  9858. value = jQuery.htmlPrefilter( value );
  9859. try {
  9860. for ( ; i < l; i++ ) {
  9861. elem = this[ i ] || {};
  9862. // Remove element nodes and prevent memory leaks
  9863. if ( elem.nodeType === 1 ) {
  9864. jQuery.cleanData( getAll( elem, false ) );
  9865. elem.innerHTML = value;
  9866. }
  9867. }
  9868. elem = 0;
  9869. // If using innerHTML throws an exception, use the fallback method
  9870. } catch ( e ) {}
  9871. }
  9872. if ( elem ) {
  9873. this.empty().append( value );
  9874. }
  9875. }, null, value, arguments.length );
  9876. },
  9877. replaceWith: function() {
  9878. var ignored = [];
  9879. // Make the changes, replacing each non-ignored context element with the new content
  9880. return domManip( this, arguments, function( elem ) {
  9881. var parent = this.parentNode;
  9882. if ( jQuery.inArray( this, ignored ) < 0 ) {
  9883. jQuery.cleanData( getAll( this ) );
  9884. if ( parent ) {
  9885. parent.replaceChild( elem, this );
  9886. }
  9887. }
  9888. // Force callback invocation
  9889. }, ignored );
  9890. }
  9891. } );
  9892. jQuery.each( {
  9893. appendTo: "append",
  9894. prependTo: "prepend",
  9895. insertBefore: "before",
  9896. insertAfter: "after",
  9897. replaceAll: "replaceWith"
  9898. }, function( name, original ) {
  9899. jQuery.fn[ name ] = function( selector ) {
  9900. var elems,
  9901. ret = [],
  9902. insert = jQuery( selector ),
  9903. last = insert.length - 1,
  9904. i = 0;
  9905. for ( ; i <= last; i++ ) {
  9906. elems = i === last ? this : this.clone( true );
  9907. jQuery( insert[ i ] )[ original ]( elems );
  9908. // Support: Android <=4.0 only, PhantomJS 1 only
  9909. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  9910. push.apply( ret, elems.get() );
  9911. }
  9912. return this.pushStack( ret );
  9913. };
  9914. } );
  9915. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  9916. var getStyles = function( elem ) {
  9917. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  9918. // IE throws on elements created in popups
  9919. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  9920. var view = elem.ownerDocument.defaultView;
  9921. if ( !view || !view.opener ) {
  9922. view = window;
  9923. }
  9924. return view.getComputedStyle( elem );
  9925. };
  9926. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  9927. ( function() {
  9928. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  9929. // so they're executed at the same time to save the second computation.
  9930. function computeStyleTests() {
  9931. // This is a singleton, we need to execute it only once
  9932. if ( !div ) {
  9933. return;
  9934. }
  9935. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  9936. "margin-top:1px;padding:0;border:0";
  9937. div.style.cssText =
  9938. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  9939. "margin:auto;border:1px;padding:1px;" +
  9940. "width:60%;top:1%";
  9941. documentElement.appendChild( container ).appendChild( div );
  9942. var divStyle = window.getComputedStyle( div );
  9943. pixelPositionVal = divStyle.top !== "1%";
  9944. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  9945. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  9946. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  9947. // Some styles come back with percentage values, even though they shouldn't
  9948. div.style.right = "60%";
  9949. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  9950. // Support: IE 9 - 11 only
  9951. // Detect misreporting of content dimensions for box-sizing:border-box elements
  9952. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  9953. // Support: IE 9 only
  9954. // Detect overflow:scroll screwiness (gh-3699)
  9955. div.style.position = "absolute";
  9956. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  9957. documentElement.removeChild( container );
  9958. // Nullify the div so it wouldn't be stored in the memory and
  9959. // it will also be a sign that checks already performed
  9960. div = null;
  9961. }
  9962. function roundPixelMeasures( measure ) {
  9963. return Math.round( parseFloat( measure ) );
  9964. }
  9965. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  9966. reliableMarginLeftVal,
  9967. container = document.createElement( "div" ),
  9968. div = document.createElement( "div" );
  9969. // Finish early in limited (non-browser) environments
  9970. if ( !div.style ) {
  9971. return;
  9972. }
  9973. // Support: IE <=9 - 11 only
  9974. // Style of cloned element affects source element cloned (#8908)
  9975. div.style.backgroundClip = "content-box";
  9976. div.cloneNode( true ).style.backgroundClip = "";
  9977. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  9978. jQuery.extend( support, {
  9979. boxSizingReliable: function() {
  9980. computeStyleTests();
  9981. return boxSizingReliableVal;
  9982. },
  9983. pixelBoxStyles: function() {
  9984. computeStyleTests();
  9985. return pixelBoxStylesVal;
  9986. },
  9987. pixelPosition: function() {
  9988. computeStyleTests();
  9989. return pixelPositionVal;
  9990. },
  9991. reliableMarginLeft: function() {
  9992. computeStyleTests();
  9993. return reliableMarginLeftVal;
  9994. },
  9995. scrollboxSize: function() {
  9996. computeStyleTests();
  9997. return scrollboxSizeVal;
  9998. }
  9999. } );
  10000. } )();
  10001. function curCSS( elem, name, computed ) {
  10002. var width, minWidth, maxWidth, ret,
  10003. // Support: Firefox 51+
  10004. // Retrieving style before computed somehow
  10005. // fixes an issue with getting wrong values
  10006. // on detached elements
  10007. style = elem.style;
  10008. computed = computed || getStyles( elem );
  10009. // getPropertyValue is needed for:
  10010. // .css('filter') (IE 9 only, #12537)
  10011. // .css('--customProperty) (#3144)
  10012. if ( computed ) {
  10013. ret = computed.getPropertyValue( name ) || computed[ name ];
  10014. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  10015. ret = jQuery.style( elem, name );
  10016. }
  10017. // A tribute to the "awesome hack by Dean Edwards"
  10018. // Android Browser returns percentage for some values,
  10019. // but width seems to be reliably pixels.
  10020. // This is against the CSSOM draft spec:
  10021. // https://drafts.csswg.org/cssom/#resolved-values
  10022. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  10023. // Remember the original values
  10024. width = style.width;
  10025. minWidth = style.minWidth;
  10026. maxWidth = style.maxWidth;
  10027. // Put in the new values to get a computed value out
  10028. style.minWidth = style.maxWidth = style.width = ret;
  10029. ret = computed.width;
  10030. // Revert the changed values
  10031. style.width = width;
  10032. style.minWidth = minWidth;
  10033. style.maxWidth = maxWidth;
  10034. }
  10035. }
  10036. return ret !== undefined ?
  10037. // Support: IE <=9 - 11 only
  10038. // IE returns zIndex value as an integer.
  10039. ret + "" :
  10040. ret;
  10041. }
  10042. function addGetHookIf( conditionFn, hookFn ) {
  10043. // Define the hook, we'll check on the first run if it's really needed.
  10044. return {
  10045. get: function() {
  10046. if ( conditionFn() ) {
  10047. // Hook not needed (or it's not possible to use it due
  10048. // to missing dependency), remove it.
  10049. delete this.get;
  10050. return;
  10051. }
  10052. // Hook needed; redefine it so that the support test is not executed again.
  10053. return ( this.get = hookFn ).apply( this, arguments );
  10054. }
  10055. };
  10056. }
  10057. var
  10058. // Swappable if display is none or starts with table
  10059. // except "table", "table-cell", or "table-caption"
  10060. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  10061. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  10062. rcustomProp = /^--/,
  10063. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  10064. cssNormalTransform = {
  10065. letterSpacing: "0",
  10066. fontWeight: "400"
  10067. },
  10068. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  10069. emptyStyle = document.createElement( "div" ).style;
  10070. // Return a css property mapped to a potentially vendor prefixed property
  10071. function vendorPropName( name ) {
  10072. // Shortcut for names that are not vendor prefixed
  10073. if ( name in emptyStyle ) {
  10074. return name;
  10075. }
  10076. // Check for vendor prefixed names
  10077. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  10078. i = cssPrefixes.length;
  10079. while ( i-- ) {
  10080. name = cssPrefixes[ i ] + capName;
  10081. if ( name in emptyStyle ) {
  10082. return name;
  10083. }
  10084. }
  10085. }
  10086. // Return a property mapped along what jQuery.cssProps suggests or to
  10087. // a vendor prefixed property.
  10088. function finalPropName( name ) {
  10089. var ret = jQuery.cssProps[ name ];
  10090. if ( !ret ) {
  10091. ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
  10092. }
  10093. return ret;
  10094. }
  10095. function setPositiveNumber( elem, value, subtract ) {
  10096. // Any relative (+/-) values have already been
  10097. // normalized at this point
  10098. var matches = rcssNum.exec( value );
  10099. return matches ?
  10100. // Guard against undefined "subtract", e.g., when used as in cssHooks
  10101. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  10102. value;
  10103. }
  10104. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  10105. var i = dimension === "width" ? 1 : 0,
  10106. extra = 0,
  10107. delta = 0;
  10108. // Adjustment may not be necessary
  10109. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  10110. return 0;
  10111. }
  10112. for ( ; i < 4; i += 2 ) {
  10113. // Both box models exclude margin
  10114. if ( box === "margin" ) {
  10115. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  10116. }
  10117. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  10118. if ( !isBorderBox ) {
  10119. // Add padding
  10120. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  10121. // For "border" or "margin", add border
  10122. if ( box !== "padding" ) {
  10123. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  10124. // But still keep track of it otherwise
  10125. } else {
  10126. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  10127. }
  10128. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  10129. // "padding" or "margin"
  10130. } else {
  10131. // For "content", subtract padding
  10132. if ( box === "content" ) {
  10133. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  10134. }
  10135. // For "content" or "padding", subtract border
  10136. if ( box !== "margin" ) {
  10137. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  10138. }
  10139. }
  10140. }
  10141. // Account for positive content-box scroll gutter when requested by providing computedVal
  10142. if ( !isBorderBox && computedVal >= 0 ) {
  10143. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  10144. // Assuming integer scroll gutter, subtract the rest and round down
  10145. delta += Math.max( 0, Math.ceil(
  10146. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  10147. computedVal -
  10148. delta -
  10149. extra -
  10150. 0.5
  10151. ) );
  10152. }
  10153. return delta;
  10154. }
  10155. function getWidthOrHeight( elem, dimension, extra ) {
  10156. // Start with computed style
  10157. var styles = getStyles( elem ),
  10158. val = curCSS( elem, dimension, styles ),
  10159. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  10160. valueIsBorderBox = isBorderBox;
  10161. // Support: Firefox <=54
  10162. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  10163. if ( rnumnonpx.test( val ) ) {
  10164. if ( !extra ) {
  10165. return val;
  10166. }
  10167. val = "auto";
  10168. }
  10169. // Check for style in case a browser which returns unreliable values
  10170. // for getComputedStyle silently falls back to the reliable elem.style
  10171. valueIsBorderBox = valueIsBorderBox &&
  10172. ( support.boxSizingReliable() || val === elem.style[ dimension ] );
  10173. // Fall back to offsetWidth/offsetHeight when value is "auto"
  10174. // This happens for inline elements with no explicit setting (gh-3571)
  10175. // Support: Android <=4.1 - 4.3 only
  10176. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  10177. if ( val === "auto" ||
  10178. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) {
  10179. val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];
  10180. // offsetWidth/offsetHeight provide border-box values
  10181. valueIsBorderBox = true;
  10182. }
  10183. // Normalize "" and auto
  10184. val = parseFloat( val ) || 0;
  10185. // Adjust for the element's box model
  10186. return ( val +
  10187. boxModelAdjustment(
  10188. elem,
  10189. dimension,
  10190. extra || ( isBorderBox ? "border" : "content" ),
  10191. valueIsBorderBox,
  10192. styles,
  10193. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  10194. val
  10195. )
  10196. ) + "px";
  10197. }
  10198. jQuery.extend( {
  10199. // Add in style property hooks for overriding the default
  10200. // behavior of getting and setting a style property
  10201. cssHooks: {
  10202. opacity: {
  10203. get: function( elem, computed ) {
  10204. if ( computed ) {
  10205. // We should always get a number back from opacity
  10206. var ret = curCSS( elem, "opacity" );
  10207. return ret === "" ? "1" : ret;
  10208. }
  10209. }
  10210. }
  10211. },
  10212. // Don't automatically add "px" to these possibly-unitless properties
  10213. cssNumber: {
  10214. "animationIterationCount": true,
  10215. "columnCount": true,
  10216. "fillOpacity": true,
  10217. "flexGrow": true,
  10218. "flexShrink": true,
  10219. "fontWeight": true,
  10220. "lineHeight": true,
  10221. "opacity": true,
  10222. "order": true,
  10223. "orphans": true,
  10224. "widows": true,
  10225. "zIndex": true,
  10226. "zoom": true
  10227. },
  10228. // Add in properties whose names you wish to fix before
  10229. // setting or getting the value
  10230. cssProps: {},
  10231. // Get and set the style property on a DOM Node
  10232. style: function( elem, name, value, extra ) {
  10233. // Don't set styles on text and comment nodes
  10234. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  10235. return;
  10236. }
  10237. // Make sure that we're working with the right name
  10238. var ret, type, hooks,
  10239. origName = camelCase( name ),
  10240. isCustomProp = rcustomProp.test( name ),
  10241. style = elem.style;
  10242. // Make sure that we're working with the right name. We don't
  10243. // want to query the value if it is a CSS custom property
  10244. // since they are user-defined.
  10245. if ( !isCustomProp ) {
  10246. name = finalPropName( origName );
  10247. }
  10248. // Gets hook for the prefixed version, then unprefixed version
  10249. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  10250. // Check if we're setting a value
  10251. if ( value !== undefined ) {
  10252. type = typeof value;
  10253. // Convert "+=" or "-=" to relative numbers (#7345)
  10254. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  10255. value = adjustCSS( elem, name, ret );
  10256. // Fixes bug #9237
  10257. type = "number";
  10258. }
  10259. // Make sure that null and NaN values aren't set (#7116)
  10260. if ( value == null || value !== value ) {
  10261. return;
  10262. }
  10263. // If a number was passed in, add the unit (except for certain CSS properties)
  10264. if ( type === "number" ) {
  10265. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  10266. }
  10267. // background-* props affect original clone's values
  10268. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  10269. style[ name ] = "inherit";
  10270. }
  10271. // If a hook was provided, use that value, otherwise just set the specified value
  10272. if ( !hooks || !( "set" in hooks ) ||
  10273. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  10274. if ( isCustomProp ) {
  10275. style.setProperty( name, value );
  10276. } else {
  10277. style[ name ] = value;
  10278. }
  10279. }
  10280. } else {
  10281. // If a hook was provided get the non-computed value from there
  10282. if ( hooks && "get" in hooks &&
  10283. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  10284. return ret;
  10285. }
  10286. // Otherwise just get the value from the style object
  10287. return style[ name ];
  10288. }
  10289. },
  10290. css: function( elem, name, extra, styles ) {
  10291. var val, num, hooks,
  10292. origName = camelCase( name ),
  10293. isCustomProp = rcustomProp.test( name );
  10294. // Make sure that we're working with the right name. We don't
  10295. // want to modify the value if it is a CSS custom property
  10296. // since they are user-defined.
  10297. if ( !isCustomProp ) {
  10298. name = finalPropName( origName );
  10299. }
  10300. // Try prefixed name followed by the unprefixed name
  10301. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  10302. // If a hook was provided get the computed value from there
  10303. if ( hooks && "get" in hooks ) {
  10304. val = hooks.get( elem, true, extra );
  10305. }
  10306. // Otherwise, if a way to get the computed value exists, use that
  10307. if ( val === undefined ) {
  10308. val = curCSS( elem, name, styles );
  10309. }
  10310. // Convert "normal" to computed value
  10311. if ( val === "normal" && name in cssNormalTransform ) {
  10312. val = cssNormalTransform[ name ];
  10313. }
  10314. // Make numeric if forced or a qualifier was provided and val looks numeric
  10315. if ( extra === "" || extra ) {
  10316. num = parseFloat( val );
  10317. return extra === true || isFinite( num ) ? num || 0 : val;
  10318. }
  10319. return val;
  10320. }
  10321. } );
  10322. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  10323. jQuery.cssHooks[ dimension ] = {
  10324. get: function( elem, computed, extra ) {
  10325. if ( computed ) {
  10326. // Certain elements can have dimension info if we invisibly show them
  10327. // but it must have a current display style that would benefit
  10328. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  10329. // Support: Safari 8+
  10330. // Table columns in Safari have non-zero offsetWidth & zero
  10331. // getBoundingClientRect().width unless display is changed.
  10332. // Support: IE <=11 only
  10333. // Running getBoundingClientRect on a disconnected node
  10334. // in IE throws an error.
  10335. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  10336. swap( elem, cssShow, function() {
  10337. return getWidthOrHeight( elem, dimension, extra );
  10338. } ) :
  10339. getWidthOrHeight( elem, dimension, extra );
  10340. }
  10341. },
  10342. set: function( elem, value, extra ) {
  10343. var matches,
  10344. styles = getStyles( elem ),
  10345. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  10346. subtract = extra && boxModelAdjustment(
  10347. elem,
  10348. dimension,
  10349. extra,
  10350. isBorderBox,
  10351. styles
  10352. );
  10353. // Account for unreliable border-box dimensions by comparing offset* to computed and
  10354. // faking a content-box to get border and padding (gh-3699)
  10355. if ( isBorderBox && support.scrollboxSize() === styles.position ) {
  10356. subtract -= Math.ceil(
  10357. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  10358. parseFloat( styles[ dimension ] ) -
  10359. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  10360. 0.5
  10361. );
  10362. }
  10363. // Convert to pixels if value adjustment is needed
  10364. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  10365. ( matches[ 3 ] || "px" ) !== "px" ) {
  10366. elem.style[ dimension ] = value;
  10367. value = jQuery.css( elem, dimension );
  10368. }
  10369. return setPositiveNumber( elem, value, subtract );
  10370. }
  10371. };
  10372. } );
  10373. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  10374. function( elem, computed ) {
  10375. if ( computed ) {
  10376. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  10377. elem.getBoundingClientRect().left -
  10378. swap( elem, { marginLeft: 0 }, function() {
  10379. return elem.getBoundingClientRect().left;
  10380. } )
  10381. ) + "px";
  10382. }
  10383. }
  10384. );
  10385. // These hooks are used by animate to expand properties
  10386. jQuery.each( {
  10387. margin: "",
  10388. padding: "",
  10389. border: "Width"
  10390. }, function( prefix, suffix ) {
  10391. jQuery.cssHooks[ prefix + suffix ] = {
  10392. expand: function( value ) {
  10393. var i = 0,
  10394. expanded = {},
  10395. // Assumes a single number if not a string
  10396. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  10397. for ( ; i < 4; i++ ) {
  10398. expanded[ prefix + cssExpand[ i ] + suffix ] =
  10399. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  10400. }
  10401. return expanded;
  10402. }
  10403. };
  10404. if ( prefix !== "margin" ) {
  10405. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  10406. }
  10407. } );
  10408. jQuery.fn.extend( {
  10409. css: function( name, value ) {
  10410. return access( this, function( elem, name, value ) {
  10411. var styles, len,
  10412. map = {},
  10413. i = 0;
  10414. if ( Array.isArray( name ) ) {
  10415. styles = getStyles( elem );
  10416. len = name.length;
  10417. for ( ; i < len; i++ ) {
  10418. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  10419. }
  10420. return map;
  10421. }
  10422. return value !== undefined ?
  10423. jQuery.style( elem, name, value ) :
  10424. jQuery.css( elem, name );
  10425. }, name, value, arguments.length > 1 );
  10426. }
  10427. } );
  10428. function Tween( elem, options, prop, end, easing ) {
  10429. return new Tween.prototype.init( elem, options, prop, end, easing );
  10430. }
  10431. jQuery.Tween = Tween;
  10432. Tween.prototype = {
  10433. constructor: Tween,
  10434. init: function( elem, options, prop, end, easing, unit ) {
  10435. this.elem = elem;
  10436. this.prop = prop;
  10437. this.easing = easing || jQuery.easing._default;
  10438. this.options = options;
  10439. this.start = this.now = this.cur();
  10440. this.end = end;
  10441. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  10442. },
  10443. cur: function() {
  10444. var hooks = Tween.propHooks[ this.prop ];
  10445. return hooks && hooks.get ?
  10446. hooks.get( this ) :
  10447. Tween.propHooks._default.get( this );
  10448. },
  10449. run: function( percent ) {
  10450. var eased,
  10451. hooks = Tween.propHooks[ this.prop ];
  10452. if ( this.options.duration ) {
  10453. this.pos = eased = jQuery.easing[ this.easing ](
  10454. percent, this.options.duration * percent, 0, 1, this.options.duration
  10455. );
  10456. } else {
  10457. this.pos = eased = percent;
  10458. }
  10459. this.now = ( this.end - this.start ) * eased + this.start;
  10460. if ( this.options.step ) {
  10461. this.options.step.call( this.elem, this.now, this );
  10462. }
  10463. if ( hooks && hooks.set ) {
  10464. hooks.set( this );
  10465. } else {
  10466. Tween.propHooks._default.set( this );
  10467. }
  10468. return this;
  10469. }
  10470. };
  10471. Tween.prototype.init.prototype = Tween.prototype;
  10472. Tween.propHooks = {
  10473. _default: {
  10474. get: function( tween ) {
  10475. var result;
  10476. // Use a property on the element directly when it is not a DOM element,
  10477. // or when there is no matching style property that exists.
  10478. if ( tween.elem.nodeType !== 1 ||
  10479. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  10480. return tween.elem[ tween.prop ];
  10481. }
  10482. // Passing an empty string as a 3rd parameter to .css will automatically
  10483. // attempt a parseFloat and fallback to a string if the parse fails.
  10484. // Simple values such as "10px" are parsed to Float;
  10485. // complex values such as "rotate(1rad)" are returned as-is.
  10486. result = jQuery.css( tween.elem, tween.prop, "" );
  10487. // Empty strings, null, undefined and "auto" are converted to 0.
  10488. return !result || result === "auto" ? 0 : result;
  10489. },
  10490. set: function( tween ) {
  10491. // Use step hook for back compat.
  10492. // Use cssHook if its there.
  10493. // Use .style if available and use plain properties where available.
  10494. if ( jQuery.fx.step[ tween.prop ] ) {
  10495. jQuery.fx.step[ tween.prop ]( tween );
  10496. } else if ( tween.elem.nodeType === 1 &&
  10497. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  10498. jQuery.cssHooks[ tween.prop ] ) ) {
  10499. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  10500. } else {
  10501. tween.elem[ tween.prop ] = tween.now;
  10502. }
  10503. }
  10504. }
  10505. };
  10506. // Support: IE <=9 only
  10507. // Panic based approach to setting things on disconnected nodes
  10508. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  10509. set: function( tween ) {
  10510. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  10511. tween.elem[ tween.prop ] = tween.now;
  10512. }
  10513. }
  10514. };
  10515. jQuery.easing = {
  10516. linear: function( p ) {
  10517. return p;
  10518. },
  10519. swing: function( p ) {
  10520. return 0.5 - Math.cos( p * Math.PI ) / 2;
  10521. },
  10522. _default: "swing"
  10523. };
  10524. jQuery.fx = Tween.prototype.init;
  10525. // Back compat <1.8 extension point
  10526. jQuery.fx.step = {};
  10527. var
  10528. fxNow, inProgress,
  10529. rfxtypes = /^(?:toggle|show|hide)$/,
  10530. rrun = /queueHooks$/;
  10531. function schedule() {
  10532. if ( inProgress ) {
  10533. if ( document.hidden === false && window.requestAnimationFrame ) {
  10534. window.requestAnimationFrame( schedule );
  10535. } else {
  10536. window.setTimeout( schedule, jQuery.fx.interval );
  10537. }
  10538. jQuery.fx.tick();
  10539. }
  10540. }
  10541. // Animations created synchronously will run synchronously
  10542. function createFxNow() {
  10543. window.setTimeout( function() {
  10544. fxNow = undefined;
  10545. } );
  10546. return ( fxNow = Date.now() );
  10547. }
  10548. // Generate parameters to create a standard animation
  10549. function genFx( type, includeWidth ) {
  10550. var which,
  10551. i = 0,
  10552. attrs = { height: type };
  10553. // If we include width, step value is 1 to do all cssExpand values,
  10554. // otherwise step value is 2 to skip over Left and Right
  10555. includeWidth = includeWidth ? 1 : 0;
  10556. for ( ; i < 4; i += 2 - includeWidth ) {
  10557. which = cssExpand[ i ];
  10558. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  10559. }
  10560. if ( includeWidth ) {
  10561. attrs.opacity = attrs.width = type;
  10562. }
  10563. return attrs;
  10564. }
  10565. function createTween( value, prop, animation ) {
  10566. var tween,
  10567. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  10568. index = 0,
  10569. length = collection.length;
  10570. for ( ; index < length; index++ ) {
  10571. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  10572. // We're done with this property
  10573. return tween;
  10574. }
  10575. }
  10576. }
  10577. function defaultPrefilter( elem, props, opts ) {
  10578. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  10579. isBox = "width" in props || "height" in props,
  10580. anim = this,
  10581. orig = {},
  10582. style = elem.style,
  10583. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  10584. dataShow = dataPriv.get( elem, "fxshow" );
  10585. // Queue-skipping animations hijack the fx hooks
  10586. if ( !opts.queue ) {
  10587. hooks = jQuery._queueHooks( elem, "fx" );
  10588. if ( hooks.unqueued == null ) {
  10589. hooks.unqueued = 0;
  10590. oldfire = hooks.empty.fire;
  10591. hooks.empty.fire = function() {
  10592. if ( !hooks.unqueued ) {
  10593. oldfire();
  10594. }
  10595. };
  10596. }
  10597. hooks.unqueued++;
  10598. anim.always( function() {
  10599. // Ensure the complete handler is called before this completes
  10600. anim.always( function() {
  10601. hooks.unqueued--;
  10602. if ( !jQuery.queue( elem, "fx" ).length ) {
  10603. hooks.empty.fire();
  10604. }
  10605. } );
  10606. } );
  10607. }
  10608. // Detect show/hide animations
  10609. for ( prop in props ) {
  10610. value = props[ prop ];
  10611. if ( rfxtypes.test( value ) ) {
  10612. delete props[ prop ];
  10613. toggle = toggle || value === "toggle";
  10614. if ( value === ( hidden ? "hide" : "show" ) ) {
  10615. // Pretend to be hidden if this is a "show" and
  10616. // there is still data from a stopped show/hide
  10617. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  10618. hidden = true;
  10619. // Ignore all other no-op show/hide data
  10620. } else {
  10621. continue;
  10622. }
  10623. }
  10624. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  10625. }
  10626. }
  10627. // Bail out if this is a no-op like .hide().hide()
  10628. propTween = !jQuery.isEmptyObject( props );
  10629. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  10630. return;
  10631. }
  10632. // Restrict "overflow" and "display" styles during box animations
  10633. if ( isBox && elem.nodeType === 1 ) {
  10634. // Support: IE <=9 - 11, Edge 12 - 15
  10635. // Record all 3 overflow attributes because IE does not infer the shorthand
  10636. // from identically-valued overflowX and overflowY and Edge just mirrors
  10637. // the overflowX value there.
  10638. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  10639. // Identify a display type, preferring old show/hide data over the CSS cascade
  10640. restoreDisplay = dataShow && dataShow.display;
  10641. if ( restoreDisplay == null ) {
  10642. restoreDisplay = dataPriv.get( elem, "display" );
  10643. }
  10644. display = jQuery.css( elem, "display" );
  10645. if ( display === "none" ) {
  10646. if ( restoreDisplay ) {
  10647. display = restoreDisplay;
  10648. } else {
  10649. // Get nonempty value(s) by temporarily forcing visibility
  10650. showHide( [ elem ], true );
  10651. restoreDisplay = elem.style.display || restoreDisplay;
  10652. display = jQuery.css( elem, "display" );
  10653. showHide( [ elem ] );
  10654. }
  10655. }
  10656. // Animate inline elements as inline-block
  10657. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  10658. if ( jQuery.css( elem, "float" ) === "none" ) {
  10659. // Restore the original display value at the end of pure show/hide animations
  10660. if ( !propTween ) {
  10661. anim.done( function() {
  10662. style.display = restoreDisplay;
  10663. } );
  10664. if ( restoreDisplay == null ) {
  10665. display = style.display;
  10666. restoreDisplay = display === "none" ? "" : display;
  10667. }
  10668. }
  10669. style.display = "inline-block";
  10670. }
  10671. }
  10672. }
  10673. if ( opts.overflow ) {
  10674. style.overflow = "hidden";
  10675. anim.always( function() {
  10676. style.overflow = opts.overflow[ 0 ];
  10677. style.overflowX = opts.overflow[ 1 ];
  10678. style.overflowY = opts.overflow[ 2 ];
  10679. } );
  10680. }
  10681. // Implement show/hide animations
  10682. propTween = false;
  10683. for ( prop in orig ) {
  10684. // General show/hide setup for this element animation
  10685. if ( !propTween ) {
  10686. if ( dataShow ) {
  10687. if ( "hidden" in dataShow ) {
  10688. hidden = dataShow.hidden;
  10689. }
  10690. } else {
  10691. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  10692. }
  10693. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  10694. if ( toggle ) {
  10695. dataShow.hidden = !hidden;
  10696. }
  10697. // Show elements before animating them
  10698. if ( hidden ) {
  10699. showHide( [ elem ], true );
  10700. }
  10701. /* eslint-disable no-loop-func */
  10702. anim.done( function() {
  10703. /* eslint-enable no-loop-func */
  10704. // The final step of a "hide" animation is actually hiding the element
  10705. if ( !hidden ) {
  10706. showHide( [ elem ] );
  10707. }
  10708. dataPriv.remove( elem, "fxshow" );
  10709. for ( prop in orig ) {
  10710. jQuery.style( elem, prop, orig[ prop ] );
  10711. }
  10712. } );
  10713. }
  10714. // Per-property setup
  10715. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  10716. if ( !( prop in dataShow ) ) {
  10717. dataShow[ prop ] = propTween.start;
  10718. if ( hidden ) {
  10719. propTween.end = propTween.start;
  10720. propTween.start = 0;
  10721. }
  10722. }
  10723. }
  10724. }
  10725. function propFilter( props, specialEasing ) {
  10726. var index, name, easing, value, hooks;
  10727. // camelCase, specialEasing and expand cssHook pass
  10728. for ( index in props ) {
  10729. name = camelCase( index );
  10730. easing = specialEasing[ name ];
  10731. value = props[ index ];
  10732. if ( Array.isArray( value ) ) {
  10733. easing = value[ 1 ];
  10734. value = props[ index ] = value[ 0 ];
  10735. }
  10736. if ( index !== name ) {
  10737. props[ name ] = value;
  10738. delete props[ index ];
  10739. }
  10740. hooks = jQuery.cssHooks[ name ];
  10741. if ( hooks && "expand" in hooks ) {
  10742. value = hooks.expand( value );
  10743. delete props[ name ];
  10744. // Not quite $.extend, this won't overwrite existing keys.
  10745. // Reusing 'index' because we have the correct "name"
  10746. for ( index in value ) {
  10747. if ( !( index in props ) ) {
  10748. props[ index ] = value[ index ];
  10749. specialEasing[ index ] = easing;
  10750. }
  10751. }
  10752. } else {
  10753. specialEasing[ name ] = easing;
  10754. }
  10755. }
  10756. }
  10757. function Animation( elem, properties, options ) {
  10758. var result,
  10759. stopped,
  10760. index = 0,
  10761. length = Animation.prefilters.length,
  10762. deferred = jQuery.Deferred().always( function() {
  10763. // Don't match elem in the :animated selector
  10764. delete tick.elem;
  10765. } ),
  10766. tick = function() {
  10767. if ( stopped ) {
  10768. return false;
  10769. }
  10770. var currentTime = fxNow || createFxNow(),
  10771. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  10772. // Support: Android 2.3 only
  10773. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  10774. temp = remaining / animation.duration || 0,
  10775. percent = 1 - temp,
  10776. index = 0,
  10777. length = animation.tweens.length;
  10778. for ( ; index < length; index++ ) {
  10779. animation.tweens[ index ].run( percent );
  10780. }
  10781. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  10782. // If there's more to do, yield
  10783. if ( percent < 1 && length ) {
  10784. return remaining;
  10785. }
  10786. // If this was an empty animation, synthesize a final progress notification
  10787. if ( !length ) {
  10788. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  10789. }
  10790. // Resolve the animation and report its conclusion
  10791. deferred.resolveWith( elem, [ animation ] );
  10792. return false;
  10793. },
  10794. animation = deferred.promise( {
  10795. elem: elem,
  10796. props: jQuery.extend( {}, properties ),
  10797. opts: jQuery.extend( true, {
  10798. specialEasing: {},
  10799. easing: jQuery.easing._default
  10800. }, options ),
  10801. originalProperties: properties,
  10802. originalOptions: options,
  10803. startTime: fxNow || createFxNow(),
  10804. duration: options.duration,
  10805. tweens: [],
  10806. createTween: function( prop, end ) {
  10807. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  10808. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  10809. animation.tweens.push( tween );
  10810. return tween;
  10811. },
  10812. stop: function( gotoEnd ) {
  10813. var index = 0,
  10814. // If we are going to the end, we want to run all the tweens
  10815. // otherwise we skip this part
  10816. length = gotoEnd ? animation.tweens.length : 0;
  10817. if ( stopped ) {
  10818. return this;
  10819. }
  10820. stopped = true;
  10821. for ( ; index < length; index++ ) {
  10822. animation.tweens[ index ].run( 1 );
  10823. }
  10824. // Resolve when we played the last frame; otherwise, reject
  10825. if ( gotoEnd ) {
  10826. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  10827. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  10828. } else {
  10829. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  10830. }
  10831. return this;
  10832. }
  10833. } ),
  10834. props = animation.props;
  10835. propFilter( props, animation.opts.specialEasing );
  10836. for ( ; index < length; index++ ) {
  10837. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  10838. if ( result ) {
  10839. if ( isFunction( result.stop ) ) {
  10840. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  10841. result.stop.bind( result );
  10842. }
  10843. return result;
  10844. }
  10845. }
  10846. jQuery.map( props, createTween, animation );
  10847. if ( isFunction( animation.opts.start ) ) {
  10848. animation.opts.start.call( elem, animation );
  10849. }
  10850. // Attach callbacks from options
  10851. animation
  10852. .progress( animation.opts.progress )
  10853. .done( animation.opts.done, animation.opts.complete )
  10854. .fail( animation.opts.fail )
  10855. .always( animation.opts.always );
  10856. jQuery.fx.timer(
  10857. jQuery.extend( tick, {
  10858. elem: elem,
  10859. anim: animation,
  10860. queue: animation.opts.queue
  10861. } )
  10862. );
  10863. return animation;
  10864. }
  10865. jQuery.Animation = jQuery.extend( Animation, {
  10866. tweeners: {
  10867. "*": [ function( prop, value ) {
  10868. var tween = this.createTween( prop, value );
  10869. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  10870. return tween;
  10871. } ]
  10872. },
  10873. tweener: function( props, callback ) {
  10874. if ( isFunction( props ) ) {
  10875. callback = props;
  10876. props = [ "*" ];
  10877. } else {
  10878. props = props.match( rnothtmlwhite );
  10879. }
  10880. var prop,
  10881. index = 0,
  10882. length = props.length;
  10883. for ( ; index < length; index++ ) {
  10884. prop = props[ index ];
  10885. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  10886. Animation.tweeners[ prop ].unshift( callback );
  10887. }
  10888. },
  10889. prefilters: [ defaultPrefilter ],
  10890. prefilter: function( callback, prepend ) {
  10891. if ( prepend ) {
  10892. Animation.prefilters.unshift( callback );
  10893. } else {
  10894. Animation.prefilters.push( callback );
  10895. }
  10896. }
  10897. } );
  10898. jQuery.speed = function( speed, easing, fn ) {
  10899. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  10900. complete: fn || !fn && easing ||
  10901. isFunction( speed ) && speed,
  10902. duration: speed,
  10903. easing: fn && easing || easing && !isFunction( easing ) && easing
  10904. };
  10905. // Go to the end state if fx are off
  10906. if ( jQuery.fx.off ) {
  10907. opt.duration = 0;
  10908. } else {
  10909. if ( typeof opt.duration !== "number" ) {
  10910. if ( opt.duration in jQuery.fx.speeds ) {
  10911. opt.duration = jQuery.fx.speeds[ opt.duration ];
  10912. } else {
  10913. opt.duration = jQuery.fx.speeds._default;
  10914. }
  10915. }
  10916. }
  10917. // Normalize opt.queue - true/undefined/null -> "fx"
  10918. if ( opt.queue == null || opt.queue === true ) {
  10919. opt.queue = "fx";
  10920. }
  10921. // Queueing
  10922. opt.old = opt.complete;
  10923. opt.complete = function() {
  10924. if ( isFunction( opt.old ) ) {
  10925. opt.old.call( this );
  10926. }
  10927. if ( opt.queue ) {
  10928. jQuery.dequeue( this, opt.queue );
  10929. }
  10930. };
  10931. return opt;
  10932. };
  10933. jQuery.fn.extend( {
  10934. fadeTo: function( speed, to, easing, callback ) {
  10935. // Show any hidden elements after setting opacity to 0
  10936. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  10937. // Animate to the value specified
  10938. .end().animate( { opacity: to }, speed, easing, callback );
  10939. },
  10940. animate: function( prop, speed, easing, callback ) {
  10941. var empty = jQuery.isEmptyObject( prop ),
  10942. optall = jQuery.speed( speed, easing, callback ),
  10943. doAnimation = function() {
  10944. // Operate on a copy of prop so per-property easing won't be lost
  10945. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  10946. // Empty animations, or finishing resolves immediately
  10947. if ( empty || dataPriv.get( this, "finish" ) ) {
  10948. anim.stop( true );
  10949. }
  10950. };
  10951. doAnimation.finish = doAnimation;
  10952. return empty || optall.queue === false ?
  10953. this.each( doAnimation ) :
  10954. this.queue( optall.queue, doAnimation );
  10955. },
  10956. stop: function( type, clearQueue, gotoEnd ) {
  10957. var stopQueue = function( hooks ) {
  10958. var stop = hooks.stop;
  10959. delete hooks.stop;
  10960. stop( gotoEnd );
  10961. };
  10962. if ( typeof type !== "string" ) {
  10963. gotoEnd = clearQueue;
  10964. clearQueue = type;
  10965. type = undefined;
  10966. }
  10967. if ( clearQueue && type !== false ) {
  10968. this.queue( type || "fx", [] );
  10969. }
  10970. return this.each( function() {
  10971. var dequeue = true,
  10972. index = type != null && type + "queueHooks",
  10973. timers = jQuery.timers,
  10974. data = dataPriv.get( this );
  10975. if ( index ) {
  10976. if ( data[ index ] && data[ index ].stop ) {
  10977. stopQueue( data[ index ] );
  10978. }
  10979. } else {
  10980. for ( index in data ) {
  10981. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  10982. stopQueue( data[ index ] );
  10983. }
  10984. }
  10985. }
  10986. for ( index = timers.length; index--; ) {
  10987. if ( timers[ index ].elem === this &&
  10988. ( type == null || timers[ index ].queue === type ) ) {
  10989. timers[ index ].anim.stop( gotoEnd );
  10990. dequeue = false;
  10991. timers.splice( index, 1 );
  10992. }
  10993. }
  10994. // Start the next in the queue if the last step wasn't forced.
  10995. // Timers currently will call their complete callbacks, which
  10996. // will dequeue but only if they were gotoEnd.
  10997. if ( dequeue || !gotoEnd ) {
  10998. jQuery.dequeue( this, type );
  10999. }
  11000. } );
  11001. },
  11002. finish: function( type ) {
  11003. if ( type !== false ) {
  11004. type = type || "fx";
  11005. }
  11006. return this.each( function() {
  11007. var index,
  11008. data = dataPriv.get( this ),
  11009. queue = data[ type + "queue" ],
  11010. hooks = data[ type + "queueHooks" ],
  11011. timers = jQuery.timers,
  11012. length = queue ? queue.length : 0;
  11013. // Enable finishing flag on private data
  11014. data.finish = true;
  11015. // Empty the queue first
  11016. jQuery.queue( this, type, [] );
  11017. if ( hooks && hooks.stop ) {
  11018. hooks.stop.call( this, true );
  11019. }
  11020. // Look for any active animations, and finish them
  11021. for ( index = timers.length; index--; ) {
  11022. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  11023. timers[ index ].anim.stop( true );
  11024. timers.splice( index, 1 );
  11025. }
  11026. }
  11027. // Look for any animations in the old queue and finish them
  11028. for ( index = 0; index < length; index++ ) {
  11029. if ( queue[ index ] && queue[ index ].finish ) {
  11030. queue[ index ].finish.call( this );
  11031. }
  11032. }
  11033. // Turn off finishing flag
  11034. delete data.finish;
  11035. } );
  11036. }
  11037. } );
  11038. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  11039. var cssFn = jQuery.fn[ name ];
  11040. jQuery.fn[ name ] = function( speed, easing, callback ) {
  11041. return speed == null || typeof speed === "boolean" ?
  11042. cssFn.apply( this, arguments ) :
  11043. this.animate( genFx( name, true ), speed, easing, callback );
  11044. };
  11045. } );
  11046. // Generate shortcuts for custom animations
  11047. jQuery.each( {
  11048. slideDown: genFx( "show" ),
  11049. slideUp: genFx( "hide" ),
  11050. slideToggle: genFx( "toggle" ),
  11051. fadeIn: { opacity: "show" },
  11052. fadeOut: { opacity: "hide" },
  11053. fadeToggle: { opacity: "toggle" }
  11054. }, function( name, props ) {
  11055. jQuery.fn[ name ] = function( speed, easing, callback ) {
  11056. return this.animate( props, speed, easing, callback );
  11057. };
  11058. } );
  11059. jQuery.timers = [];
  11060. jQuery.fx.tick = function() {
  11061. var timer,
  11062. i = 0,
  11063. timers = jQuery.timers;
  11064. fxNow = Date.now();
  11065. for ( ; i < timers.length; i++ ) {
  11066. timer = timers[ i ];
  11067. // Run the timer and safely remove it when done (allowing for external removal)
  11068. if ( !timer() && timers[ i ] === timer ) {
  11069. timers.splice( i--, 1 );
  11070. }
  11071. }
  11072. if ( !timers.length ) {
  11073. jQuery.fx.stop();
  11074. }
  11075. fxNow = undefined;
  11076. };
  11077. jQuery.fx.timer = function( timer ) {
  11078. jQuery.timers.push( timer );
  11079. jQuery.fx.start();
  11080. };
  11081. jQuery.fx.interval = 13;
  11082. jQuery.fx.start = function() {
  11083. if ( inProgress ) {
  11084. return;
  11085. }
  11086. inProgress = true;
  11087. schedule();
  11088. };
  11089. jQuery.fx.stop = function() {
  11090. inProgress = null;
  11091. };
  11092. jQuery.fx.speeds = {
  11093. slow: 600,
  11094. fast: 200,
  11095. // Default speed
  11096. _default: 400
  11097. };
  11098. // Based off of the plugin by Clint Helfers, with permission.
  11099. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  11100. jQuery.fn.delay = function( time, type ) {
  11101. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  11102. type = type || "fx";
  11103. return this.queue( type, function( next, hooks ) {
  11104. var timeout = window.setTimeout( next, time );
  11105. hooks.stop = function() {
  11106. window.clearTimeout( timeout );
  11107. };
  11108. } );
  11109. };
  11110. ( function() {
  11111. var input = document.createElement( "input" ),
  11112. select = document.createElement( "select" ),
  11113. opt = select.appendChild( document.createElement( "option" ) );
  11114. input.type = "checkbox";
  11115. // Support: Android <=4.3 only
  11116. // Default value for a checkbox should be "on"
  11117. support.checkOn = input.value !== "";
  11118. // Support: IE <=11 only
  11119. // Must access selectedIndex to make default options select
  11120. support.optSelected = opt.selected;
  11121. // Support: IE <=11 only
  11122. // An input loses its value after becoming a radio
  11123. input = document.createElement( "input" );
  11124. input.value = "t";
  11125. input.type = "radio";
  11126. support.radioValue = input.value === "t";
  11127. } )();
  11128. var boolHook,
  11129. attrHandle = jQuery.expr.attrHandle;
  11130. jQuery.fn.extend( {
  11131. attr: function( name, value ) {
  11132. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  11133. },
  11134. removeAttr: function( name ) {
  11135. return this.each( function() {
  11136. jQuery.removeAttr( this, name );
  11137. } );
  11138. }
  11139. } );
  11140. jQuery.extend( {
  11141. attr: function( elem, name, value ) {
  11142. var ret, hooks,
  11143. nType = elem.nodeType;
  11144. // Don't get/set attributes on text, comment and attribute nodes
  11145. if ( nType === 3 || nType === 8 || nType === 2 ) {
  11146. return;
  11147. }
  11148. // Fallback to prop when attributes are not supported
  11149. if ( typeof elem.getAttribute === "undefined" ) {
  11150. return jQuery.prop( elem, name, value );
  11151. }
  11152. // Attribute hooks are determined by the lowercase version
  11153. // Grab necessary hook if one is defined
  11154. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  11155. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  11156. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  11157. }
  11158. if ( value !== undefined ) {
  11159. if ( value === null ) {
  11160. jQuery.removeAttr( elem, name );
  11161. return;
  11162. }
  11163. if ( hooks && "set" in hooks &&
  11164. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  11165. return ret;
  11166. }
  11167. elem.setAttribute( name, value + "" );
  11168. return value;
  11169. }
  11170. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  11171. return ret;
  11172. }
  11173. ret = jQuery.find.attr( elem, name );
  11174. // Non-existent attributes return null, we normalize to undefined
  11175. return ret == null ? undefined : ret;
  11176. },
  11177. attrHooks: {
  11178. type: {
  11179. set: function( elem, value ) {
  11180. if ( !support.radioValue && value === "radio" &&
  11181. nodeName( elem, "input" ) ) {
  11182. var val = elem.value;
  11183. elem.setAttribute( "type", value );
  11184. if ( val ) {
  11185. elem.value = val;
  11186. }
  11187. return value;
  11188. }
  11189. }
  11190. }
  11191. },
  11192. removeAttr: function( elem, value ) {
  11193. var name,
  11194. i = 0,
  11195. // Attribute names can contain non-HTML whitespace characters
  11196. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  11197. attrNames = value && value.match( rnothtmlwhite );
  11198. if ( attrNames && elem.nodeType === 1 ) {
  11199. while ( ( name = attrNames[ i++ ] ) ) {
  11200. elem.removeAttribute( name );
  11201. }
  11202. }
  11203. }
  11204. } );
  11205. // Hooks for boolean attributes
  11206. boolHook = {
  11207. set: function( elem, value, name ) {
  11208. if ( value === false ) {
  11209. // Remove boolean attributes when set to false
  11210. jQuery.removeAttr( elem, name );
  11211. } else {
  11212. elem.setAttribute( name, name );
  11213. }
  11214. return name;
  11215. }
  11216. };
  11217. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  11218. var getter = attrHandle[ name ] || jQuery.find.attr;
  11219. attrHandle[ name ] = function( elem, name, isXML ) {
  11220. var ret, handle,
  11221. lowercaseName = name.toLowerCase();
  11222. if ( !isXML ) {
  11223. // Avoid an infinite loop by temporarily removing this function from the getter
  11224. handle = attrHandle[ lowercaseName ];
  11225. attrHandle[ lowercaseName ] = ret;
  11226. ret = getter( elem, name, isXML ) != null ?
  11227. lowercaseName :
  11228. null;
  11229. attrHandle[ lowercaseName ] = handle;
  11230. }
  11231. return ret;
  11232. };
  11233. } );
  11234. var rfocusable = /^(?:input|select|textarea|button)$/i,
  11235. rclickable = /^(?:a|area)$/i;
  11236. jQuery.fn.extend( {
  11237. prop: function( name, value ) {
  11238. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  11239. },
  11240. removeProp: function( name ) {
  11241. return this.each( function() {
  11242. delete this[ jQuery.propFix[ name ] || name ];
  11243. } );
  11244. }
  11245. } );
  11246. jQuery.extend( {
  11247. prop: function( elem, name, value ) {
  11248. var ret, hooks,
  11249. nType = elem.nodeType;
  11250. // Don't get/set properties on text, comment and attribute nodes
  11251. if ( nType === 3 || nType === 8 || nType === 2 ) {
  11252. return;
  11253. }
  11254. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  11255. // Fix name and attach hooks
  11256. name = jQuery.propFix[ name ] || name;
  11257. hooks = jQuery.propHooks[ name ];
  11258. }
  11259. if ( value !== undefined ) {
  11260. if ( hooks && "set" in hooks &&
  11261. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  11262. return ret;
  11263. }
  11264. return ( elem[ name ] = value );
  11265. }
  11266. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  11267. return ret;
  11268. }
  11269. return elem[ name ];
  11270. },
  11271. propHooks: {
  11272. tabIndex: {
  11273. get: function( elem ) {
  11274. // Support: IE <=9 - 11 only
  11275. // elem.tabIndex doesn't always return the
  11276. // correct value when it hasn't been explicitly set
  11277. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  11278. // Use proper attribute retrieval(#12072)
  11279. var tabindex = jQuery.find.attr( elem, "tabindex" );
  11280. if ( tabindex ) {
  11281. return parseInt( tabindex, 10 );
  11282. }
  11283. if (
  11284. rfocusable.test( elem.nodeName ) ||
  11285. rclickable.test( elem.nodeName ) &&
  11286. elem.href
  11287. ) {
  11288. return 0;
  11289. }
  11290. return -1;
  11291. }
  11292. }
  11293. },
  11294. propFix: {
  11295. "for": "htmlFor",
  11296. "class": "className"
  11297. }
  11298. } );
  11299. // Support: IE <=11 only
  11300. // Accessing the selectedIndex property
  11301. // forces the browser to respect setting selected
  11302. // on the option
  11303. // The getter ensures a default option is selected
  11304. // when in an optgroup
  11305. // eslint rule "no-unused-expressions" is disabled for this code
  11306. // since it considers such accessions noop
  11307. if ( !support.optSelected ) {
  11308. jQuery.propHooks.selected = {
  11309. get: function( elem ) {
  11310. /* eslint no-unused-expressions: "off" */
  11311. var parent = elem.parentNode;
  11312. if ( parent && parent.parentNode ) {
  11313. parent.parentNode.selectedIndex;
  11314. }
  11315. return null;
  11316. },
  11317. set: function( elem ) {
  11318. /* eslint no-unused-expressions: "off" */
  11319. var parent = elem.parentNode;
  11320. if ( parent ) {
  11321. parent.selectedIndex;
  11322. if ( parent.parentNode ) {
  11323. parent.parentNode.selectedIndex;
  11324. }
  11325. }
  11326. }
  11327. };
  11328. }
  11329. jQuery.each( [
  11330. "tabIndex",
  11331. "readOnly",
  11332. "maxLength",
  11333. "cellSpacing",
  11334. "cellPadding",
  11335. "rowSpan",
  11336. "colSpan",
  11337. "useMap",
  11338. "frameBorder",
  11339. "contentEditable"
  11340. ], function() {
  11341. jQuery.propFix[ this.toLowerCase() ] = this;
  11342. } );
  11343. // Strip and collapse whitespace according to HTML spec
  11344. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  11345. function stripAndCollapse( value ) {
  11346. var tokens = value.match( rnothtmlwhite ) || [];
  11347. return tokens.join( " " );
  11348. }
  11349. function getClass( elem ) {
  11350. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  11351. }
  11352. function classesToArray( value ) {
  11353. if ( Array.isArray( value ) ) {
  11354. return value;
  11355. }
  11356. if ( typeof value === "string" ) {
  11357. return value.match( rnothtmlwhite ) || [];
  11358. }
  11359. return [];
  11360. }
  11361. jQuery.fn.extend( {
  11362. addClass: function( value ) {
  11363. var classes, elem, cur, curValue, clazz, j, finalValue,
  11364. i = 0;
  11365. if ( isFunction( value ) ) {
  11366. return this.each( function( j ) {
  11367. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  11368. } );
  11369. }
  11370. classes = classesToArray( value );
  11371. if ( classes.length ) {
  11372. while ( ( elem = this[ i++ ] ) ) {
  11373. curValue = getClass( elem );
  11374. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  11375. if ( cur ) {
  11376. j = 0;
  11377. while ( ( clazz = classes[ j++ ] ) ) {
  11378. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  11379. cur += clazz + " ";
  11380. }
  11381. }
  11382. // Only assign if different to avoid unneeded rendering.
  11383. finalValue = stripAndCollapse( cur );
  11384. if ( curValue !== finalValue ) {
  11385. elem.setAttribute( "class", finalValue );
  11386. }
  11387. }
  11388. }
  11389. }
  11390. return this;
  11391. },
  11392. removeClass: function( value ) {
  11393. var classes, elem, cur, curValue, clazz, j, finalValue,
  11394. i = 0;
  11395. if ( isFunction( value ) ) {
  11396. return this.each( function( j ) {
  11397. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  11398. } );
  11399. }
  11400. if ( !arguments.length ) {
  11401. return this.attr( "class", "" );
  11402. }
  11403. classes = classesToArray( value );
  11404. if ( classes.length ) {
  11405. while ( ( elem = this[ i++ ] ) ) {
  11406. curValue = getClass( elem );
  11407. // This expression is here for better compressibility (see addClass)
  11408. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  11409. if ( cur ) {
  11410. j = 0;
  11411. while ( ( clazz = classes[ j++ ] ) ) {
  11412. // Remove *all* instances
  11413. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  11414. cur = cur.replace( " " + clazz + " ", " " );
  11415. }
  11416. }
  11417. // Only assign if different to avoid unneeded rendering.
  11418. finalValue = stripAndCollapse( cur );
  11419. if ( curValue !== finalValue ) {
  11420. elem.setAttribute( "class", finalValue );
  11421. }
  11422. }
  11423. }
  11424. }
  11425. return this;
  11426. },
  11427. toggleClass: function( value, stateVal ) {
  11428. var type = typeof value,
  11429. isValidValue = type === "string" || Array.isArray( value );
  11430. if ( typeof stateVal === "boolean" && isValidValue ) {
  11431. return stateVal ? this.addClass( value ) : this.removeClass( value );
  11432. }
  11433. if ( isFunction( value ) ) {
  11434. return this.each( function( i ) {
  11435. jQuery( this ).toggleClass(
  11436. value.call( this, i, getClass( this ), stateVal ),
  11437. stateVal
  11438. );
  11439. } );
  11440. }
  11441. return this.each( function() {
  11442. var className, i, self, classNames;
  11443. if ( isValidValue ) {
  11444. // Toggle individual class names
  11445. i = 0;
  11446. self = jQuery( this );
  11447. classNames = classesToArray( value );
  11448. while ( ( className = classNames[ i++ ] ) ) {
  11449. // Check each className given, space separated list
  11450. if ( self.hasClass( className ) ) {
  11451. self.removeClass( className );
  11452. } else {
  11453. self.addClass( className );
  11454. }
  11455. }
  11456. // Toggle whole class name
  11457. } else if ( value === undefined || type === "boolean" ) {
  11458. className = getClass( this );
  11459. if ( className ) {
  11460. // Store className if set
  11461. dataPriv.set( this, "__className__", className );
  11462. }
  11463. // If the element has a class name or if we're passed `false`,
  11464. // then remove the whole classname (if there was one, the above saved it).
  11465. // Otherwise bring back whatever was previously saved (if anything),
  11466. // falling back to the empty string if nothing was stored.
  11467. if ( this.setAttribute ) {
  11468. this.setAttribute( "class",
  11469. className || value === false ?
  11470. "" :
  11471. dataPriv.get( this, "__className__" ) || ""
  11472. );
  11473. }
  11474. }
  11475. } );
  11476. },
  11477. hasClass: function( selector ) {
  11478. var className, elem,
  11479. i = 0;
  11480. className = " " + selector + " ";
  11481. while ( ( elem = this[ i++ ] ) ) {
  11482. if ( elem.nodeType === 1 &&
  11483. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  11484. return true;
  11485. }
  11486. }
  11487. return false;
  11488. }
  11489. } );
  11490. var rreturn = /\r/g;
  11491. jQuery.fn.extend( {
  11492. val: function( value ) {
  11493. var hooks, ret, valueIsFunction,
  11494. elem = this[ 0 ];
  11495. if ( !arguments.length ) {
  11496. if ( elem ) {
  11497. hooks = jQuery.valHooks[ elem.type ] ||
  11498. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  11499. if ( hooks &&
  11500. "get" in hooks &&
  11501. ( ret = hooks.get( elem, "value" ) ) !== undefined
  11502. ) {
  11503. return ret;
  11504. }
  11505. ret = elem.value;
  11506. // Handle most common string cases
  11507. if ( typeof ret === "string" ) {
  11508. return ret.replace( rreturn, "" );
  11509. }
  11510. // Handle cases where value is null/undef or number
  11511. return ret == null ? "" : ret;
  11512. }
  11513. return;
  11514. }
  11515. valueIsFunction = isFunction( value );
  11516. return this.each( function( i ) {
  11517. var val;
  11518. if ( this.nodeType !== 1 ) {
  11519. return;
  11520. }
  11521. if ( valueIsFunction ) {
  11522. val = value.call( this, i, jQuery( this ).val() );
  11523. } else {
  11524. val = value;
  11525. }
  11526. // Treat null/undefined as ""; convert numbers to string
  11527. if ( val == null ) {
  11528. val = "";
  11529. } else if ( typeof val === "number" ) {
  11530. val += "";
  11531. } else if ( Array.isArray( val ) ) {
  11532. val = jQuery.map( val, function( value ) {
  11533. return value == null ? "" : value + "";
  11534. } );
  11535. }
  11536. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  11537. // If set returns undefined, fall back to normal setting
  11538. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  11539. this.value = val;
  11540. }
  11541. } );
  11542. }
  11543. } );
  11544. jQuery.extend( {
  11545. valHooks: {
  11546. option: {
  11547. get: function( elem ) {
  11548. var val = jQuery.find.attr( elem, "value" );
  11549. return val != null ?
  11550. val :
  11551. // Support: IE <=10 - 11 only
  11552. // option.text throws exceptions (#14686, #14858)
  11553. // Strip and collapse whitespace
  11554. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  11555. stripAndCollapse( jQuery.text( elem ) );
  11556. }
  11557. },
  11558. select: {
  11559. get: function( elem ) {
  11560. var value, option, i,
  11561. options = elem.options,
  11562. index = elem.selectedIndex,
  11563. one = elem.type === "select-one",
  11564. values = one ? null : [],
  11565. max = one ? index + 1 : options.length;
  11566. if ( index < 0 ) {
  11567. i = max;
  11568. } else {
  11569. i = one ? index : 0;
  11570. }
  11571. // Loop through all the selected options
  11572. for ( ; i < max; i++ ) {
  11573. option = options[ i ];
  11574. // Support: IE <=9 only
  11575. // IE8-9 doesn't update selected after form reset (#2551)
  11576. if ( ( option.selected || i === index ) &&
  11577. // Don't return options that are disabled or in a disabled optgroup
  11578. !option.disabled &&
  11579. ( !option.parentNode.disabled ||
  11580. !nodeName( option.parentNode, "optgroup" ) ) ) {
  11581. // Get the specific value for the option
  11582. value = jQuery( option ).val();
  11583. // We don't need an array for one selects
  11584. if ( one ) {
  11585. return value;
  11586. }
  11587. // Multi-Selects return an array
  11588. values.push( value );
  11589. }
  11590. }
  11591. return values;
  11592. },
  11593. set: function( elem, value ) {
  11594. var optionSet, option,
  11595. options = elem.options,
  11596. values = jQuery.makeArray( value ),
  11597. i = options.length;
  11598. while ( i-- ) {
  11599. option = options[ i ];
  11600. /* eslint-disable no-cond-assign */
  11601. if ( option.selected =
  11602. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  11603. ) {
  11604. optionSet = true;
  11605. }
  11606. /* eslint-enable no-cond-assign */
  11607. }
  11608. // Force browsers to behave consistently when non-matching value is set
  11609. if ( !optionSet ) {
  11610. elem.selectedIndex = -1;
  11611. }
  11612. return values;
  11613. }
  11614. }
  11615. }
  11616. } );
  11617. // Radios and checkboxes getter/setter
  11618. jQuery.each( [ "radio", "checkbox" ], function() {
  11619. jQuery.valHooks[ this ] = {
  11620. set: function( elem, value ) {
  11621. if ( Array.isArray( value ) ) {
  11622. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  11623. }
  11624. }
  11625. };
  11626. if ( !support.checkOn ) {
  11627. jQuery.valHooks[ this ].get = function( elem ) {
  11628. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  11629. };
  11630. }
  11631. } );
  11632. // Return jQuery for attributes-only inclusion
  11633. support.focusin = "onfocusin" in window;
  11634. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  11635. stopPropagationCallback = function( e ) {
  11636. e.stopPropagation();
  11637. };
  11638. jQuery.extend( jQuery.event, {
  11639. trigger: function( event, data, elem, onlyHandlers ) {
  11640. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  11641. eventPath = [ elem || document ],
  11642. type = hasOwn.call( event, "type" ) ? event.type : event,
  11643. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  11644. cur = lastElement = tmp = elem = elem || document;
  11645. // Don't do events on text and comment nodes
  11646. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  11647. return;
  11648. }
  11649. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  11650. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  11651. return;
  11652. }
  11653. if ( type.indexOf( "." ) > -1 ) {
  11654. // Namespaced trigger; create a regexp to match event type in handle()
  11655. namespaces = type.split( "." );
  11656. type = namespaces.shift();
  11657. namespaces.sort();
  11658. }
  11659. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  11660. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  11661. event = event[ jQuery.expando ] ?
  11662. event :
  11663. new jQuery.Event( type, typeof event === "object" && event );
  11664. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  11665. event.isTrigger = onlyHandlers ? 2 : 3;
  11666. event.namespace = namespaces.join( "." );
  11667. event.rnamespace = event.namespace ?
  11668. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  11669. null;
  11670. // Clean up the event in case it is being reused
  11671. event.result = undefined;
  11672. if ( !event.target ) {
  11673. event.target = elem;
  11674. }
  11675. // Clone any incoming data and prepend the event, creating the handler arg list
  11676. data = data == null ?
  11677. [ event ] :
  11678. jQuery.makeArray( data, [ event ] );
  11679. // Allow special events to draw outside the lines
  11680. special = jQuery.event.special[ type ] || {};
  11681. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  11682. return;
  11683. }
  11684. // Determine event propagation path in advance, per W3C events spec (#9951)
  11685. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  11686. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  11687. bubbleType = special.delegateType || type;
  11688. if ( !rfocusMorph.test( bubbleType + type ) ) {
  11689. cur = cur.parentNode;
  11690. }
  11691. for ( ; cur; cur = cur.parentNode ) {
  11692. eventPath.push( cur );
  11693. tmp = cur;
  11694. }
  11695. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  11696. if ( tmp === ( elem.ownerDocument || document ) ) {
  11697. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  11698. }
  11699. }
  11700. // Fire handlers on the event path
  11701. i = 0;
  11702. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  11703. lastElement = cur;
  11704. event.type = i > 1 ?
  11705. bubbleType :
  11706. special.bindType || type;
  11707. // jQuery handler
  11708. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  11709. dataPriv.get( cur, "handle" );
  11710. if ( handle ) {
  11711. handle.apply( cur, data );
  11712. }
  11713. // Native handler
  11714. handle = ontype && cur[ ontype ];
  11715. if ( handle && handle.apply && acceptData( cur ) ) {
  11716. event.result = handle.apply( cur, data );
  11717. if ( event.result === false ) {
  11718. event.preventDefault();
  11719. }
  11720. }
  11721. }
  11722. event.type = type;
  11723. // If nobody prevented the default action, do it now
  11724. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  11725. if ( ( !special._default ||
  11726. special._default.apply( eventPath.pop(), data ) === false ) &&
  11727. acceptData( elem ) ) {
  11728. // Call a native DOM method on the target with the same name as the event.
  11729. // Don't do default actions on window, that's where global variables be (#6170)
  11730. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  11731. // Don't re-trigger an onFOO event when we call its FOO() method
  11732. tmp = elem[ ontype ];
  11733. if ( tmp ) {
  11734. elem[ ontype ] = null;
  11735. }
  11736. // Prevent re-triggering of the same event, since we already bubbled it above
  11737. jQuery.event.triggered = type;
  11738. if ( event.isPropagationStopped() ) {
  11739. lastElement.addEventListener( type, stopPropagationCallback );
  11740. }
  11741. elem[ type ]();
  11742. if ( event.isPropagationStopped() ) {
  11743. lastElement.removeEventListener( type, stopPropagationCallback );
  11744. }
  11745. jQuery.event.triggered = undefined;
  11746. if ( tmp ) {
  11747. elem[ ontype ] = tmp;
  11748. }
  11749. }
  11750. }
  11751. }
  11752. return event.result;
  11753. },
  11754. // Piggyback on a donor event to simulate a different one
  11755. // Used only for `focus(in | out)` events
  11756. simulate: function( type, elem, event ) {
  11757. var e = jQuery.extend(
  11758. new jQuery.Event(),
  11759. event,
  11760. {
  11761. type: type,
  11762. isSimulated: true
  11763. }
  11764. );
  11765. jQuery.event.trigger( e, null, elem );
  11766. }
  11767. } );
  11768. jQuery.fn.extend( {
  11769. trigger: function( type, data ) {
  11770. return this.each( function() {
  11771. jQuery.event.trigger( type, data, this );
  11772. } );
  11773. },
  11774. triggerHandler: function( type, data ) {
  11775. var elem = this[ 0 ];
  11776. if ( elem ) {
  11777. return jQuery.event.trigger( type, data, elem, true );
  11778. }
  11779. }
  11780. } );
  11781. // Support: Firefox <=44
  11782. // Firefox doesn't have focus(in | out) events
  11783. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  11784. //
  11785. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  11786. // focus(in | out) events fire after focus & blur events,
  11787. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  11788. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  11789. if ( !support.focusin ) {
  11790. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  11791. // Attach a single capturing handler on the document while someone wants focusin/focusout
  11792. var handler = function( event ) {
  11793. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  11794. };
  11795. jQuery.event.special[ fix ] = {
  11796. setup: function() {
  11797. var doc = this.ownerDocument || this,
  11798. attaches = dataPriv.access( doc, fix );
  11799. if ( !attaches ) {
  11800. doc.addEventListener( orig, handler, true );
  11801. }
  11802. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  11803. },
  11804. teardown: function() {
  11805. var doc = this.ownerDocument || this,
  11806. attaches = dataPriv.access( doc, fix ) - 1;
  11807. if ( !attaches ) {
  11808. doc.removeEventListener( orig, handler, true );
  11809. dataPriv.remove( doc, fix );
  11810. } else {
  11811. dataPriv.access( doc, fix, attaches );
  11812. }
  11813. }
  11814. };
  11815. } );
  11816. }
  11817. var location = window.location;
  11818. var nonce = Date.now();
  11819. var rquery = ( /\?/ );
  11820. // Cross-browser xml parsing
  11821. jQuery.parseXML = function( data ) {
  11822. var xml;
  11823. if ( !data || typeof data !== "string" ) {
  11824. return null;
  11825. }
  11826. // Support: IE 9 - 11 only
  11827. // IE throws on parseFromString with invalid input.
  11828. try {
  11829. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  11830. } catch ( e ) {
  11831. xml = undefined;
  11832. }
  11833. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  11834. jQuery.error( "Invalid XML: " + data );
  11835. }
  11836. return xml;
  11837. };
  11838. var
  11839. rbracket = /\[\]$/,
  11840. rCRLF = /\r?\n/g,
  11841. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  11842. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  11843. function buildParams( prefix, obj, traditional, add ) {
  11844. var name;
  11845. if ( Array.isArray( obj ) ) {
  11846. // Serialize array item.
  11847. jQuery.each( obj, function( i, v ) {
  11848. if ( traditional || rbracket.test( prefix ) ) {
  11849. // Treat each array item as a scalar.
  11850. add( prefix, v );
  11851. } else {
  11852. // Item is non-scalar (array or object), encode its numeric index.
  11853. buildParams(
  11854. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  11855. v,
  11856. traditional,
  11857. add
  11858. );
  11859. }
  11860. } );
  11861. } else if ( !traditional && toType( obj ) === "object" ) {
  11862. // Serialize object item.
  11863. for ( name in obj ) {
  11864. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  11865. }
  11866. } else {
  11867. // Serialize scalar item.
  11868. add( prefix, obj );
  11869. }
  11870. }
  11871. // Serialize an array of form elements or a set of
  11872. // key/values into a query string
  11873. jQuery.param = function( a, traditional ) {
  11874. var prefix,
  11875. s = [],
  11876. add = function( key, valueOrFunction ) {
  11877. // If value is a function, invoke it and use its return value
  11878. var value = isFunction( valueOrFunction ) ?
  11879. valueOrFunction() :
  11880. valueOrFunction;
  11881. s[ s.length ] = encodeURIComponent( key ) + "=" +
  11882. encodeURIComponent( value == null ? "" : value );
  11883. };
  11884. // If an array was passed in, assume that it is an array of form elements.
  11885. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  11886. // Serialize the form elements
  11887. jQuery.each( a, function() {
  11888. add( this.name, this.value );
  11889. } );
  11890. } else {
  11891. // If traditional, encode the "old" way (the way 1.3.2 or older
  11892. // did it), otherwise encode params recursively.
  11893. for ( prefix in a ) {
  11894. buildParams( prefix, a[ prefix ], traditional, add );
  11895. }
  11896. }
  11897. // Return the resulting serialization
  11898. return s.join( "&" );
  11899. };
  11900. jQuery.fn.extend( {
  11901. serialize: function() {
  11902. return jQuery.param( this.serializeArray() );
  11903. },
  11904. serializeArray: function() {
  11905. return this.map( function() {
  11906. // Can add propHook for "elements" to filter or add form elements
  11907. var elements = jQuery.prop( this, "elements" );
  11908. return elements ? jQuery.makeArray( elements ) : this;
  11909. } )
  11910. .filter( function() {
  11911. var type = this.type;
  11912. // Use .is( ":disabled" ) so that fieldset[disabled] works
  11913. return this.name && !jQuery( this ).is( ":disabled" ) &&
  11914. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  11915. ( this.checked || !rcheckableType.test( type ) );
  11916. } )
  11917. .map( function( i, elem ) {
  11918. var val = jQuery( this ).val();
  11919. if ( val == null ) {
  11920. return null;
  11921. }
  11922. if ( Array.isArray( val ) ) {
  11923. return jQuery.map( val, function( val ) {
  11924. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  11925. } );
  11926. }
  11927. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  11928. } ).get();
  11929. }
  11930. } );
  11931. var
  11932. r20 = /%20/g,
  11933. rhash = /#.*$/,
  11934. rantiCache = /([?&])_=[^&]*/,
  11935. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  11936. // #7653, #8125, #8152: local protocol detection
  11937. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  11938. rnoContent = /^(?:GET|HEAD)$/,
  11939. rprotocol = /^\/\//,
  11940. /* Prefilters
  11941. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  11942. * 2) These are called:
  11943. * - BEFORE asking for a transport
  11944. * - AFTER param serialization (s.data is a string if s.processData is true)
  11945. * 3) key is the dataType
  11946. * 4) the catchall symbol "*" can be used
  11947. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  11948. */
  11949. prefilters = {},
  11950. /* Transports bindings
  11951. * 1) key is the dataType
  11952. * 2) the catchall symbol "*" can be used
  11953. * 3) selection will start with transport dataType and THEN go to "*" if needed
  11954. */
  11955. transports = {},
  11956. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  11957. allTypes = "*/".concat( "*" ),
  11958. // Anchor tag for parsing the document origin
  11959. originAnchor = document.createElement( "a" );
  11960. originAnchor.href = location.href;
  11961. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  11962. function addToPrefiltersOrTransports( structure ) {
  11963. // dataTypeExpression is optional and defaults to "*"
  11964. return function( dataTypeExpression, func ) {
  11965. if ( typeof dataTypeExpression !== "string" ) {
  11966. func = dataTypeExpression;
  11967. dataTypeExpression = "*";
  11968. }
  11969. var dataType,
  11970. i = 0,
  11971. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  11972. if ( isFunction( func ) ) {
  11973. // For each dataType in the dataTypeExpression
  11974. while ( ( dataType = dataTypes[ i++ ] ) ) {
  11975. // Prepend if requested
  11976. if ( dataType[ 0 ] === "+" ) {
  11977. dataType = dataType.slice( 1 ) || "*";
  11978. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  11979. // Otherwise append
  11980. } else {
  11981. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  11982. }
  11983. }
  11984. }
  11985. };
  11986. }
  11987. // Base inspection function for prefilters and transports
  11988. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  11989. var inspected = {},
  11990. seekingTransport = ( structure === transports );
  11991. function inspect( dataType ) {
  11992. var selected;
  11993. inspected[ dataType ] = true;
  11994. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  11995. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  11996. if ( typeof dataTypeOrTransport === "string" &&
  11997. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  11998. options.dataTypes.unshift( dataTypeOrTransport );
  11999. inspect( dataTypeOrTransport );
  12000. return false;
  12001. } else if ( seekingTransport ) {
  12002. return !( selected = dataTypeOrTransport );
  12003. }
  12004. } );
  12005. return selected;
  12006. }
  12007. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  12008. }
  12009. // A special extend for ajax options
  12010. // that takes "flat" options (not to be deep extended)
  12011. // Fixes #9887
  12012. function ajaxExtend( target, src ) {
  12013. var key, deep,
  12014. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  12015. for ( key in src ) {
  12016. if ( src[ key ] !== undefined ) {
  12017. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  12018. }
  12019. }
  12020. if ( deep ) {
  12021. jQuery.extend( true, target, deep );
  12022. }
  12023. return target;
  12024. }
  12025. /* Handles responses to an ajax request:
  12026. * - finds the right dataType (mediates between content-type and expected dataType)
  12027. * - returns the corresponding response
  12028. */
  12029. function ajaxHandleResponses( s, jqXHR, responses ) {
  12030. var ct, type, finalDataType, firstDataType,
  12031. contents = s.contents,
  12032. dataTypes = s.dataTypes;
  12033. // Remove auto dataType and get content-type in the process
  12034. while ( dataTypes[ 0 ] === "*" ) {
  12035. dataTypes.shift();
  12036. if ( ct === undefined ) {
  12037. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  12038. }
  12039. }
  12040. // Check if we're dealing with a known content-type
  12041. if ( ct ) {
  12042. for ( type in contents ) {
  12043. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  12044. dataTypes.unshift( type );
  12045. break;
  12046. }
  12047. }
  12048. }
  12049. // Check to see if we have a response for the expected dataType
  12050. if ( dataTypes[ 0 ] in responses ) {
  12051. finalDataType = dataTypes[ 0 ];
  12052. } else {
  12053. // Try convertible dataTypes
  12054. for ( type in responses ) {
  12055. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  12056. finalDataType = type;
  12057. break;
  12058. }
  12059. if ( !firstDataType ) {
  12060. firstDataType = type;
  12061. }
  12062. }
  12063. // Or just use first one
  12064. finalDataType = finalDataType || firstDataType;
  12065. }
  12066. // If we found a dataType
  12067. // We add the dataType to the list if needed
  12068. // and return the corresponding response
  12069. if ( finalDataType ) {
  12070. if ( finalDataType !== dataTypes[ 0 ] ) {
  12071. dataTypes.unshift( finalDataType );
  12072. }
  12073. return responses[ finalDataType ];
  12074. }
  12075. }
  12076. /* Chain conversions given the request and the original response
  12077. * Also sets the responseXXX fields on the jqXHR instance
  12078. */
  12079. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  12080. var conv2, current, conv, tmp, prev,
  12081. converters = {},
  12082. // Work with a copy of dataTypes in case we need to modify it for conversion
  12083. dataTypes = s.dataTypes.slice();
  12084. // Create converters map with lowercased keys
  12085. if ( dataTypes[ 1 ] ) {
  12086. for ( conv in s.converters ) {
  12087. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  12088. }
  12089. }
  12090. current = dataTypes.shift();
  12091. // Convert to each sequential dataType
  12092. while ( current ) {
  12093. if ( s.responseFields[ current ] ) {
  12094. jqXHR[ s.responseFields[ current ] ] = response;
  12095. }
  12096. // Apply the dataFilter if provided
  12097. if ( !prev && isSuccess && s.dataFilter ) {
  12098. response = s.dataFilter( response, s.dataType );
  12099. }
  12100. prev = current;
  12101. current = dataTypes.shift();
  12102. if ( current ) {
  12103. // There's only work to do if current dataType is non-auto
  12104. if ( current === "*" ) {
  12105. current = prev;
  12106. // Convert response if prev dataType is non-auto and differs from current
  12107. } else if ( prev !== "*" && prev !== current ) {
  12108. // Seek a direct converter
  12109. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  12110. // If none found, seek a pair
  12111. if ( !conv ) {
  12112. for ( conv2 in converters ) {
  12113. // If conv2 outputs current
  12114. tmp = conv2.split( " " );
  12115. if ( tmp[ 1 ] === current ) {
  12116. // If prev can be converted to accepted input
  12117. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  12118. converters[ "* " + tmp[ 0 ] ];
  12119. if ( conv ) {
  12120. // Condense equivalence converters
  12121. if ( conv === true ) {
  12122. conv = converters[ conv2 ];
  12123. // Otherwise, insert the intermediate dataType
  12124. } else if ( converters[ conv2 ] !== true ) {
  12125. current = tmp[ 0 ];
  12126. dataTypes.unshift( tmp[ 1 ] );
  12127. }
  12128. break;
  12129. }
  12130. }
  12131. }
  12132. }
  12133. // Apply converter (if not an equivalence)
  12134. if ( conv !== true ) {
  12135. // Unless errors are allowed to bubble, catch and return them
  12136. if ( conv && s.throws ) {
  12137. response = conv( response );
  12138. } else {
  12139. try {
  12140. response = conv( response );
  12141. } catch ( e ) {
  12142. return {
  12143. state: "parsererror",
  12144. error: conv ? e : "No conversion from " + prev + " to " + current
  12145. };
  12146. }
  12147. }
  12148. }
  12149. }
  12150. }
  12151. }
  12152. return { state: "success", data: response };
  12153. }
  12154. jQuery.extend( {
  12155. // Counter for holding the number of active queries
  12156. active: 0,
  12157. // Last-Modified header cache for next request
  12158. lastModified: {},
  12159. etag: {},
  12160. ajaxSettings: {
  12161. url: location.href,
  12162. type: "GET",
  12163. isLocal: rlocalProtocol.test( location.protocol ),
  12164. global: true,
  12165. processData: true,
  12166. async: true,
  12167. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  12168. /*
  12169. timeout: 0,
  12170. data: null,
  12171. dataType: null,
  12172. username: null,
  12173. password: null,
  12174. cache: null,
  12175. throws: false,
  12176. traditional: false,
  12177. headers: {},
  12178. */
  12179. accepts: {
  12180. "*": allTypes,
  12181. text: "text/plain",
  12182. html: "text/html",
  12183. xml: "application/xml, text/xml",
  12184. json: "application/json, text/javascript"
  12185. },
  12186. contents: {
  12187. xml: /\bxml\b/,
  12188. html: /\bhtml/,
  12189. json: /\bjson\b/
  12190. },
  12191. responseFields: {
  12192. xml: "responseXML",
  12193. text: "responseText",
  12194. json: "responseJSON"
  12195. },
  12196. // Data converters
  12197. // Keys separate source (or catchall "*") and destination types with a single space
  12198. converters: {
  12199. // Convert anything to text
  12200. "* text": String,
  12201. // Text to html (true = no transformation)
  12202. "text html": true,
  12203. // Evaluate text as a json expression
  12204. "text json": JSON.parse,
  12205. // Parse text as xml
  12206. "text xml": jQuery.parseXML
  12207. },
  12208. // For options that shouldn't be deep extended:
  12209. // you can add your own custom options here if
  12210. // and when you create one that shouldn't be
  12211. // deep extended (see ajaxExtend)
  12212. flatOptions: {
  12213. url: true,
  12214. context: true
  12215. }
  12216. },
  12217. // Creates a full fledged settings object into target
  12218. // with both ajaxSettings and settings fields.
  12219. // If target is omitted, writes into ajaxSettings.
  12220. ajaxSetup: function( target, settings ) {
  12221. return settings ?
  12222. // Building a settings object
  12223. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  12224. // Extending ajaxSettings
  12225. ajaxExtend( jQuery.ajaxSettings, target );
  12226. },
  12227. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  12228. ajaxTransport: addToPrefiltersOrTransports( transports ),
  12229. // Main method
  12230. ajax: function( url, options ) {
  12231. // If url is an object, simulate pre-1.5 signature
  12232. if ( typeof url === "object" ) {
  12233. options = url;
  12234. url = undefined;
  12235. }
  12236. // Force options to be an object
  12237. options = options || {};
  12238. var transport,
  12239. // URL without anti-cache param
  12240. cacheURL,
  12241. // Response headers
  12242. responseHeadersString,
  12243. responseHeaders,
  12244. // timeout handle
  12245. timeoutTimer,
  12246. // Url cleanup var
  12247. urlAnchor,
  12248. // Request state (becomes false upon send and true upon completion)
  12249. completed,
  12250. // To know if global events are to be dispatched
  12251. fireGlobals,
  12252. // Loop variable
  12253. i,
  12254. // uncached part of the url
  12255. uncached,
  12256. // Create the final options object
  12257. s = jQuery.ajaxSetup( {}, options ),
  12258. // Callbacks context
  12259. callbackContext = s.context || s,
  12260. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  12261. globalEventContext = s.context &&
  12262. ( callbackContext.nodeType || callbackContext.jquery ) ?
  12263. jQuery( callbackContext ) :
  12264. jQuery.event,
  12265. // Deferreds
  12266. deferred = jQuery.Deferred(),
  12267. completeDeferred = jQuery.Callbacks( "once memory" ),
  12268. // Status-dependent callbacks
  12269. statusCode = s.statusCode || {},
  12270. // Headers (they are sent all at once)
  12271. requestHeaders = {},
  12272. requestHeadersNames = {},
  12273. // Default abort message
  12274. strAbort = "canceled",
  12275. // Fake xhr
  12276. jqXHR = {
  12277. readyState: 0,
  12278. // Builds headers hashtable if needed
  12279. getResponseHeader: function( key ) {
  12280. var match;
  12281. if ( completed ) {
  12282. if ( !responseHeaders ) {
  12283. responseHeaders = {};
  12284. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  12285. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  12286. }
  12287. }
  12288. match = responseHeaders[ key.toLowerCase() ];
  12289. }
  12290. return match == null ? null : match;
  12291. },
  12292. // Raw string
  12293. getAllResponseHeaders: function() {
  12294. return completed ? responseHeadersString : null;
  12295. },
  12296. // Caches the header
  12297. setRequestHeader: function( name, value ) {
  12298. if ( completed == null ) {
  12299. name = requestHeadersNames[ name.toLowerCase() ] =
  12300. requestHeadersNames[ name.toLowerCase() ] || name;
  12301. requestHeaders[ name ] = value;
  12302. }
  12303. return this;
  12304. },
  12305. // Overrides response content-type header
  12306. overrideMimeType: function( type ) {
  12307. if ( completed == null ) {
  12308. s.mimeType = type;
  12309. }
  12310. return this;
  12311. },
  12312. // Status-dependent callbacks
  12313. statusCode: function( map ) {
  12314. var code;
  12315. if ( map ) {
  12316. if ( completed ) {
  12317. // Execute the appropriate callbacks
  12318. jqXHR.always( map[ jqXHR.status ] );
  12319. } else {
  12320. // Lazy-add the new callbacks in a way that preserves old ones
  12321. for ( code in map ) {
  12322. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  12323. }
  12324. }
  12325. }
  12326. return this;
  12327. },
  12328. // Cancel the request
  12329. abort: function( statusText ) {
  12330. var finalText = statusText || strAbort;
  12331. if ( transport ) {
  12332. transport.abort( finalText );
  12333. }
  12334. done( 0, finalText );
  12335. return this;
  12336. }
  12337. };
  12338. // Attach deferreds
  12339. deferred.promise( jqXHR );
  12340. // Add protocol if not provided (prefilters might expect it)
  12341. // Handle falsy url in the settings object (#10093: consistency with old signature)
  12342. // We also use the url parameter if available
  12343. s.url = ( ( url || s.url || location.href ) + "" )
  12344. .replace( rprotocol, location.protocol + "//" );
  12345. // Alias method option to type as per ticket #12004
  12346. s.type = options.method || options.type || s.method || s.type;
  12347. // Extract dataTypes list
  12348. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  12349. // A cross-domain request is in order when the origin doesn't match the current origin.
  12350. if ( s.crossDomain == null ) {
  12351. urlAnchor = document.createElement( "a" );
  12352. // Support: IE <=8 - 11, Edge 12 - 15
  12353. // IE throws exception on accessing the href property if url is malformed,
  12354. // e.g. http://example.com:80x/
  12355. try {
  12356. urlAnchor.href = s.url;
  12357. // Support: IE <=8 - 11 only
  12358. // Anchor's host property isn't correctly set when s.url is relative
  12359. urlAnchor.href = urlAnchor.href;
  12360. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  12361. urlAnchor.protocol + "//" + urlAnchor.host;
  12362. } catch ( e ) {
  12363. // If there is an error parsing the URL, assume it is crossDomain,
  12364. // it can be rejected by the transport if it is invalid
  12365. s.crossDomain = true;
  12366. }
  12367. }
  12368. // Convert data if not already a string
  12369. if ( s.data && s.processData && typeof s.data !== "string" ) {
  12370. s.data = jQuery.param( s.data, s.traditional );
  12371. }
  12372. // Apply prefilters
  12373. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  12374. // If request was aborted inside a prefilter, stop there
  12375. if ( completed ) {
  12376. return jqXHR;
  12377. }
  12378. // We can fire global events as of now if asked to
  12379. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  12380. fireGlobals = jQuery.event && s.global;
  12381. // Watch for a new set of requests
  12382. if ( fireGlobals && jQuery.active++ === 0 ) {
  12383. jQuery.event.trigger( "ajaxStart" );
  12384. }
  12385. // Uppercase the type
  12386. s.type = s.type.toUpperCase();
  12387. // Determine if request has content
  12388. s.hasContent = !rnoContent.test( s.type );
  12389. // Save the URL in case we're toying with the If-Modified-Since
  12390. // and/or If-None-Match header later on
  12391. // Remove hash to simplify url manipulation
  12392. cacheURL = s.url.replace( rhash, "" );
  12393. // More options handling for requests with no content
  12394. if ( !s.hasContent ) {
  12395. // Remember the hash so we can put it back
  12396. uncached = s.url.slice( cacheURL.length );
  12397. // If data is available and should be processed, append data to url
  12398. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  12399. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  12400. // #9682: remove data so that it's not used in an eventual retry
  12401. delete s.data;
  12402. }
  12403. // Add or update anti-cache param if needed
  12404. if ( s.cache === false ) {
  12405. cacheURL = cacheURL.replace( rantiCache, "$1" );
  12406. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  12407. }
  12408. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  12409. s.url = cacheURL + uncached;
  12410. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  12411. } else if ( s.data && s.processData &&
  12412. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  12413. s.data = s.data.replace( r20, "+" );
  12414. }
  12415. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  12416. if ( s.ifModified ) {
  12417. if ( jQuery.lastModified[ cacheURL ] ) {
  12418. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  12419. }
  12420. if ( jQuery.etag[ cacheURL ] ) {
  12421. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  12422. }
  12423. }
  12424. // Set the correct header, if data is being sent
  12425. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  12426. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  12427. }
  12428. // Set the Accepts header for the server, depending on the dataType
  12429. jqXHR.setRequestHeader(
  12430. "Accept",
  12431. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  12432. s.accepts[ s.dataTypes[ 0 ] ] +
  12433. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  12434. s.accepts[ "*" ]
  12435. );
  12436. // Check for headers option
  12437. for ( i in s.headers ) {
  12438. jqXHR.setRequestHeader( i, s.headers[ i ] );
  12439. }
  12440. // Allow custom headers/mimetypes and early abort
  12441. if ( s.beforeSend &&
  12442. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  12443. // Abort if not done already and return
  12444. return jqXHR.abort();
  12445. }
  12446. // Aborting is no longer a cancellation
  12447. strAbort = "abort";
  12448. // Install callbacks on deferreds
  12449. completeDeferred.add( s.complete );
  12450. jqXHR.done( s.success );
  12451. jqXHR.fail( s.error );
  12452. // Get transport
  12453. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  12454. // If no transport, we auto-abort
  12455. if ( !transport ) {
  12456. done( -1, "No Transport" );
  12457. } else {
  12458. jqXHR.readyState = 1;
  12459. // Send global event
  12460. if ( fireGlobals ) {
  12461. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  12462. }
  12463. // If request was aborted inside ajaxSend, stop there
  12464. if ( completed ) {
  12465. return jqXHR;
  12466. }
  12467. // Timeout
  12468. if ( s.async && s.timeout > 0 ) {
  12469. timeoutTimer = window.setTimeout( function() {
  12470. jqXHR.abort( "timeout" );
  12471. }, s.timeout );
  12472. }
  12473. try {
  12474. completed = false;
  12475. transport.send( requestHeaders, done );
  12476. } catch ( e ) {
  12477. // Rethrow post-completion exceptions
  12478. if ( completed ) {
  12479. throw e;
  12480. }
  12481. // Propagate others as results
  12482. done( -1, e );
  12483. }
  12484. }
  12485. // Callback for when everything is done
  12486. function done( status, nativeStatusText, responses, headers ) {
  12487. var isSuccess, success, error, response, modified,
  12488. statusText = nativeStatusText;
  12489. // Ignore repeat invocations
  12490. if ( completed ) {
  12491. return;
  12492. }
  12493. completed = true;
  12494. // Clear timeout if it exists
  12495. if ( timeoutTimer ) {
  12496. window.clearTimeout( timeoutTimer );
  12497. }
  12498. // Dereference transport for early garbage collection
  12499. // (no matter how long the jqXHR object will be used)
  12500. transport = undefined;
  12501. // Cache response headers
  12502. responseHeadersString = headers || "";
  12503. // Set readyState
  12504. jqXHR.readyState = status > 0 ? 4 : 0;
  12505. // Determine if successful
  12506. isSuccess = status >= 200 && status < 300 || status === 304;
  12507. // Get response data
  12508. if ( responses ) {
  12509. response = ajaxHandleResponses( s, jqXHR, responses );
  12510. }
  12511. // Convert no matter what (that way responseXXX fields are always set)
  12512. response = ajaxConvert( s, response, jqXHR, isSuccess );
  12513. // If successful, handle type chaining
  12514. if ( isSuccess ) {
  12515. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  12516. if ( s.ifModified ) {
  12517. modified = jqXHR.getResponseHeader( "Last-Modified" );
  12518. if ( modified ) {
  12519. jQuery.lastModified[ cacheURL ] = modified;
  12520. }
  12521. modified = jqXHR.getResponseHeader( "etag" );
  12522. if ( modified ) {
  12523. jQuery.etag[ cacheURL ] = modified;
  12524. }
  12525. }
  12526. // if no content
  12527. if ( status === 204 || s.type === "HEAD" ) {
  12528. statusText = "nocontent";
  12529. // if not modified
  12530. } else if ( status === 304 ) {
  12531. statusText = "notmodified";
  12532. // If we have data, let's convert it
  12533. } else {
  12534. statusText = response.state;
  12535. success = response.data;
  12536. error = response.error;
  12537. isSuccess = !error;
  12538. }
  12539. } else {
  12540. // Extract error from statusText and normalize for non-aborts
  12541. error = statusText;
  12542. if ( status || !statusText ) {
  12543. statusText = "error";
  12544. if ( status < 0 ) {
  12545. status = 0;
  12546. }
  12547. }
  12548. }
  12549. // Set data for the fake xhr object
  12550. jqXHR.status = status;
  12551. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  12552. // Success/Error
  12553. if ( isSuccess ) {
  12554. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  12555. } else {
  12556. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  12557. }
  12558. // Status-dependent callbacks
  12559. jqXHR.statusCode( statusCode );
  12560. statusCode = undefined;
  12561. if ( fireGlobals ) {
  12562. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  12563. [ jqXHR, s, isSuccess ? success : error ] );
  12564. }
  12565. // Complete
  12566. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  12567. if ( fireGlobals ) {
  12568. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  12569. // Handle the global AJAX counter
  12570. if ( !( --jQuery.active ) ) {
  12571. jQuery.event.trigger( "ajaxStop" );
  12572. }
  12573. }
  12574. }
  12575. return jqXHR;
  12576. },
  12577. getJSON: function( url, data, callback ) {
  12578. return jQuery.get( url, data, callback, "json" );
  12579. },
  12580. getScript: function( url, callback ) {
  12581. return jQuery.get( url, undefined, callback, "script" );
  12582. }
  12583. } );
  12584. jQuery.each( [ "get", "post" ], function( i, method ) {
  12585. jQuery[ method ] = function( url, data, callback, type ) {
  12586. // Shift arguments if data argument was omitted
  12587. if ( isFunction( data ) ) {
  12588. type = type || callback;
  12589. callback = data;
  12590. data = undefined;
  12591. }
  12592. // The url can be an options object (which then must have .url)
  12593. return jQuery.ajax( jQuery.extend( {
  12594. url: url,
  12595. type: method,
  12596. dataType: type,
  12597. data: data,
  12598. success: callback
  12599. }, jQuery.isPlainObject( url ) && url ) );
  12600. };
  12601. } );
  12602. jQuery._evalUrl = function( url ) {
  12603. return jQuery.ajax( {
  12604. url: url,
  12605. // Make this explicit, since user can override this through ajaxSetup (#11264)
  12606. type: "GET",
  12607. dataType: "script",
  12608. cache: true,
  12609. async: false,
  12610. global: false,
  12611. "throws": true
  12612. } );
  12613. };
  12614. jQuery.fn.extend( {
  12615. wrapAll: function( html ) {
  12616. var wrap;
  12617. if ( this[ 0 ] ) {
  12618. if ( isFunction( html ) ) {
  12619. html = html.call( this[ 0 ] );
  12620. }
  12621. // The elements to wrap the target around
  12622. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  12623. if ( this[ 0 ].parentNode ) {
  12624. wrap.insertBefore( this[ 0 ] );
  12625. }
  12626. wrap.map( function() {
  12627. var elem = this;
  12628. while ( elem.firstElementChild ) {
  12629. elem = elem.firstElementChild;
  12630. }
  12631. return elem;
  12632. } ).append( this );
  12633. }
  12634. return this;
  12635. },
  12636. wrapInner: function( html ) {
  12637. if ( isFunction( html ) ) {
  12638. return this.each( function( i ) {
  12639. jQuery( this ).wrapInner( html.call( this, i ) );
  12640. } );
  12641. }
  12642. return this.each( function() {
  12643. var self = jQuery( this ),
  12644. contents = self.contents();
  12645. if ( contents.length ) {
  12646. contents.wrapAll( html );
  12647. } else {
  12648. self.append( html );
  12649. }
  12650. } );
  12651. },
  12652. wrap: function( html ) {
  12653. var htmlIsFunction = isFunction( html );
  12654. return this.each( function( i ) {
  12655. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  12656. } );
  12657. },
  12658. unwrap: function( selector ) {
  12659. this.parent( selector ).not( "body" ).each( function() {
  12660. jQuery( this ).replaceWith( this.childNodes );
  12661. } );
  12662. return this;
  12663. }
  12664. } );
  12665. jQuery.expr.pseudos.hidden = function( elem ) {
  12666. return !jQuery.expr.pseudos.visible( elem );
  12667. };
  12668. jQuery.expr.pseudos.visible = function( elem ) {
  12669. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  12670. };
  12671. jQuery.ajaxSettings.xhr = function() {
  12672. try {
  12673. return new window.XMLHttpRequest();
  12674. } catch ( e ) {}
  12675. };
  12676. var xhrSuccessStatus = {
  12677. // File protocol always yields status code 0, assume 200
  12678. 0: 200,
  12679. // Support: IE <=9 only
  12680. // #1450: sometimes IE returns 1223 when it should be 204
  12681. 1223: 204
  12682. },
  12683. xhrSupported = jQuery.ajaxSettings.xhr();
  12684. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  12685. support.ajax = xhrSupported = !!xhrSupported;
  12686. jQuery.ajaxTransport( function( options ) {
  12687. var callback, errorCallback;
  12688. // Cross domain only allowed if supported through XMLHttpRequest
  12689. if ( support.cors || xhrSupported && !options.crossDomain ) {
  12690. return {
  12691. send: function( headers, complete ) {
  12692. var i,
  12693. xhr = options.xhr();
  12694. xhr.open(
  12695. options.type,
  12696. options.url,
  12697. options.async,
  12698. options.username,
  12699. options.password
  12700. );
  12701. // Apply custom fields if provided
  12702. if ( options.xhrFields ) {
  12703. for ( i in options.xhrFields ) {
  12704. xhr[ i ] = options.xhrFields[ i ];
  12705. }
  12706. }
  12707. // Override mime type if needed
  12708. if ( options.mimeType && xhr.overrideMimeType ) {
  12709. xhr.overrideMimeType( options.mimeType );
  12710. }
  12711. // X-Requested-With header
  12712. // For cross-domain requests, seeing as conditions for a preflight are
  12713. // akin to a jigsaw puzzle, we simply never set it to be sure.
  12714. // (it can always be set on a per-request basis or even using ajaxSetup)
  12715. // For same-domain requests, won't change header if already provided.
  12716. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  12717. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  12718. }
  12719. // Set headers
  12720. for ( i in headers ) {
  12721. xhr.setRequestHeader( i, headers[ i ] );
  12722. }
  12723. // Callback
  12724. callback = function( type ) {
  12725. return function() {
  12726. if ( callback ) {
  12727. callback = errorCallback = xhr.onload =
  12728. xhr.onerror = xhr.onabort = xhr.ontimeout =
  12729. xhr.onreadystatechange = null;
  12730. if ( type === "abort" ) {
  12731. xhr.abort();
  12732. } else if ( type === "error" ) {
  12733. // Support: IE <=9 only
  12734. // On a manual native abort, IE9 throws
  12735. // errors on any property access that is not readyState
  12736. if ( typeof xhr.status !== "number" ) {
  12737. complete( 0, "error" );
  12738. } else {
  12739. complete(
  12740. // File: protocol always yields status 0; see #8605, #14207
  12741. xhr.status,
  12742. xhr.statusText
  12743. );
  12744. }
  12745. } else {
  12746. complete(
  12747. xhrSuccessStatus[ xhr.status ] || xhr.status,
  12748. xhr.statusText,
  12749. // Support: IE <=9 only
  12750. // IE9 has no XHR2 but throws on binary (trac-11426)
  12751. // For XHR2 non-text, let the caller handle it (gh-2498)
  12752. ( xhr.responseType || "text" ) !== "text" ||
  12753. typeof xhr.responseText !== "string" ?
  12754. { binary: xhr.response } :
  12755. { text: xhr.responseText },
  12756. xhr.getAllResponseHeaders()
  12757. );
  12758. }
  12759. }
  12760. };
  12761. };
  12762. // Listen to events
  12763. xhr.onload = callback();
  12764. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  12765. // Support: IE 9 only
  12766. // Use onreadystatechange to replace onabort
  12767. // to handle uncaught aborts
  12768. if ( xhr.onabort !== undefined ) {
  12769. xhr.onabort = errorCallback;
  12770. } else {
  12771. xhr.onreadystatechange = function() {
  12772. // Check readyState before timeout as it changes
  12773. if ( xhr.readyState === 4 ) {
  12774. // Allow onerror to be called first,
  12775. // but that will not handle a native abort
  12776. // Also, save errorCallback to a variable
  12777. // as xhr.onerror cannot be accessed
  12778. window.setTimeout( function() {
  12779. if ( callback ) {
  12780. errorCallback();
  12781. }
  12782. } );
  12783. }
  12784. };
  12785. }
  12786. // Create the abort callback
  12787. callback = callback( "abort" );
  12788. try {
  12789. // Do send the request (this may raise an exception)
  12790. xhr.send( options.hasContent && options.data || null );
  12791. } catch ( e ) {
  12792. // #14683: Only rethrow if this hasn't been notified as an error yet
  12793. if ( callback ) {
  12794. throw e;
  12795. }
  12796. }
  12797. },
  12798. abort: function() {
  12799. if ( callback ) {
  12800. callback();
  12801. }
  12802. }
  12803. };
  12804. }
  12805. } );
  12806. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  12807. jQuery.ajaxPrefilter( function( s ) {
  12808. if ( s.crossDomain ) {
  12809. s.contents.script = false;
  12810. }
  12811. } );
  12812. // Install script dataType
  12813. jQuery.ajaxSetup( {
  12814. accepts: {
  12815. script: "text/javascript, application/javascript, " +
  12816. "application/ecmascript, application/x-ecmascript"
  12817. },
  12818. contents: {
  12819. script: /\b(?:java|ecma)script\b/
  12820. },
  12821. converters: {
  12822. "text script": function( text ) {
  12823. jQuery.globalEval( text );
  12824. return text;
  12825. }
  12826. }
  12827. } );
  12828. // Handle cache's special case and crossDomain
  12829. jQuery.ajaxPrefilter( "script", function( s ) {
  12830. if ( s.cache === undefined ) {
  12831. s.cache = false;
  12832. }
  12833. if ( s.crossDomain ) {
  12834. s.type = "GET";
  12835. }
  12836. } );
  12837. // Bind script tag hack transport
  12838. jQuery.ajaxTransport( "script", function( s ) {
  12839. // This transport only deals with cross domain requests
  12840. if ( s.crossDomain ) {
  12841. var script, callback;
  12842. return {
  12843. send: function( _, complete ) {
  12844. script = jQuery( "<script>" ).prop( {
  12845. charset: s.scriptCharset,
  12846. src: s.url
  12847. } ).on(
  12848. "load error",
  12849. callback = function( evt ) {
  12850. script.remove();
  12851. callback = null;
  12852. if ( evt ) {
  12853. complete( evt.type === "error" ? 404 : 200, evt.type );
  12854. }
  12855. }
  12856. );
  12857. // Use native DOM manipulation to avoid our domManip AJAX trickery
  12858. document.head.appendChild( script[ 0 ] );
  12859. },
  12860. abort: function() {
  12861. if ( callback ) {
  12862. callback();
  12863. }
  12864. }
  12865. };
  12866. }
  12867. } );
  12868. var oldCallbacks = [],
  12869. rjsonp = /(=)\?(?=&|$)|\?\?/;
  12870. // Default jsonp settings
  12871. jQuery.ajaxSetup( {
  12872. jsonp: "callback",
  12873. jsonpCallback: function() {
  12874. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  12875. this[ callback ] = true;
  12876. return callback;
  12877. }
  12878. } );
  12879. // Detect, normalize options and install callbacks for jsonp requests
  12880. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  12881. var callbackName, overwritten, responseContainer,
  12882. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  12883. "url" :
  12884. typeof s.data === "string" &&
  12885. ( s.contentType || "" )
  12886. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  12887. rjsonp.test( s.data ) && "data"
  12888. );
  12889. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  12890. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  12891. // Get callback name, remembering preexisting value associated with it
  12892. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  12893. s.jsonpCallback() :
  12894. s.jsonpCallback;
  12895. // Insert callback into url or form data
  12896. if ( jsonProp ) {
  12897. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  12898. } else if ( s.jsonp !== false ) {
  12899. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  12900. }
  12901. // Use data converter to retrieve json after script execution
  12902. s.converters[ "script json" ] = function() {
  12903. if ( !responseContainer ) {
  12904. jQuery.error( callbackName + " was not called" );
  12905. }
  12906. return responseContainer[ 0 ];
  12907. };
  12908. // Force json dataType
  12909. s.dataTypes[ 0 ] = "json";
  12910. // Install callback
  12911. overwritten = window[ callbackName ];
  12912. window[ callbackName ] = function() {
  12913. responseContainer = arguments;
  12914. };
  12915. // Clean-up function (fires after converters)
  12916. jqXHR.always( function() {
  12917. // If previous value didn't exist - remove it
  12918. if ( overwritten === undefined ) {
  12919. jQuery( window ).removeProp( callbackName );
  12920. // Otherwise restore preexisting value
  12921. } else {
  12922. window[ callbackName ] = overwritten;
  12923. }
  12924. // Save back as free
  12925. if ( s[ callbackName ] ) {
  12926. // Make sure that re-using the options doesn't screw things around
  12927. s.jsonpCallback = originalSettings.jsonpCallback;
  12928. // Save the callback name for future use
  12929. oldCallbacks.push( callbackName );
  12930. }
  12931. // Call if it was a function and we have a response
  12932. if ( responseContainer && isFunction( overwritten ) ) {
  12933. overwritten( responseContainer[ 0 ] );
  12934. }
  12935. responseContainer = overwritten = undefined;
  12936. } );
  12937. // Delegate to script
  12938. return "script";
  12939. }
  12940. } );
  12941. // Support: Safari 8 only
  12942. // In Safari 8 documents created via document.implementation.createHTMLDocument
  12943. // collapse sibling forms: the second one becomes a child of the first one.
  12944. // Because of that, this security measure has to be disabled in Safari 8.
  12945. // https://bugs.webkit.org/show_bug.cgi?id=137337
  12946. support.createHTMLDocument = ( function() {
  12947. var body = document.implementation.createHTMLDocument( "" ).body;
  12948. body.innerHTML = "<form></form><form></form>";
  12949. return body.childNodes.length === 2;
  12950. } )();
  12951. // Argument "data" should be string of html
  12952. // context (optional): If specified, the fragment will be created in this context,
  12953. // defaults to document
  12954. // keepScripts (optional): If true, will include scripts passed in the html string
  12955. jQuery.parseHTML = function( data, context, keepScripts ) {
  12956. if ( typeof data !== "string" ) {
  12957. return [];
  12958. }
  12959. if ( typeof context === "boolean" ) {
  12960. keepScripts = context;
  12961. context = false;
  12962. }
  12963. var base, parsed, scripts;
  12964. if ( !context ) {
  12965. // Stop scripts or inline event handlers from being executed immediately
  12966. // by using document.implementation
  12967. if ( support.createHTMLDocument ) {
  12968. context = document.implementation.createHTMLDocument( "" );
  12969. // Set the base href for the created document
  12970. // so any parsed elements with URLs
  12971. // are based on the document's URL (gh-2965)
  12972. base = context.createElement( "base" );
  12973. base.href = document.location.href;
  12974. context.head.appendChild( base );
  12975. } else {
  12976. context = document;
  12977. }
  12978. }
  12979. parsed = rsingleTag.exec( data );
  12980. scripts = !keepScripts && [];
  12981. // Single tag
  12982. if ( parsed ) {
  12983. return [ context.createElement( parsed[ 1 ] ) ];
  12984. }
  12985. parsed = buildFragment( [ data ], context, scripts );
  12986. if ( scripts && scripts.length ) {
  12987. jQuery( scripts ).remove();
  12988. }
  12989. return jQuery.merge( [], parsed.childNodes );
  12990. };
  12991. /**
  12992. * Load a url into a page
  12993. */
  12994. jQuery.fn.load = function( url, params, callback ) {
  12995. var selector, type, response,
  12996. self = this,
  12997. off = url.indexOf( " " );
  12998. if ( off > -1 ) {
  12999. selector = stripAndCollapse( url.slice( off ) );
  13000. url = url.slice( 0, off );
  13001. }
  13002. // If it's a function
  13003. if ( isFunction( params ) ) {
  13004. // We assume that it's the callback
  13005. callback = params;
  13006. params = undefined;
  13007. // Otherwise, build a param string
  13008. } else if ( params && typeof params === "object" ) {
  13009. type = "POST";
  13010. }
  13011. // If we have elements to modify, make the request
  13012. if ( self.length > 0 ) {
  13013. jQuery.ajax( {
  13014. url: url,
  13015. // If "type" variable is undefined, then "GET" method will be used.
  13016. // Make value of this field explicit since
  13017. // user can override it through ajaxSetup method
  13018. type: type || "GET",
  13019. dataType: "html",
  13020. data: params
  13021. } ).done( function( responseText ) {
  13022. // Save response for use in complete callback
  13023. response = arguments;
  13024. self.html( selector ?
  13025. // If a selector was specified, locate the right elements in a dummy div
  13026. // Exclude scripts to avoid IE 'Permission Denied' errors
  13027. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  13028. // Otherwise use the full result
  13029. responseText );
  13030. // If the request succeeds, this function gets "data", "status", "jqXHR"
  13031. // but they are ignored because response was set above.
  13032. // If it fails, this function gets "jqXHR", "status", "error"
  13033. } ).always( callback && function( jqXHR, status ) {
  13034. self.each( function() {
  13035. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  13036. } );
  13037. } );
  13038. }
  13039. return this;
  13040. };
  13041. // Attach a bunch of functions for handling common AJAX events
  13042. jQuery.each( [
  13043. "ajaxStart",
  13044. "ajaxStop",
  13045. "ajaxComplete",
  13046. "ajaxError",
  13047. "ajaxSuccess",
  13048. "ajaxSend"
  13049. ], function( i, type ) {
  13050. jQuery.fn[ type ] = function( fn ) {
  13051. return this.on( type, fn );
  13052. };
  13053. } );
  13054. jQuery.expr.pseudos.animated = function( elem ) {
  13055. return jQuery.grep( jQuery.timers, function( fn ) {
  13056. return elem === fn.elem;
  13057. } ).length;
  13058. };
  13059. jQuery.offset = {
  13060. setOffset: function( elem, options, i ) {
  13061. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  13062. position = jQuery.css( elem, "position" ),
  13063. curElem = jQuery( elem ),
  13064. props = {};
  13065. // Set position first, in-case top/left are set even on static elem
  13066. if ( position === "static" ) {
  13067. elem.style.position = "relative";
  13068. }
  13069. curOffset = curElem.offset();
  13070. curCSSTop = jQuery.css( elem, "top" );
  13071. curCSSLeft = jQuery.css( elem, "left" );
  13072. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  13073. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  13074. // Need to be able to calculate position if either
  13075. // top or left is auto and position is either absolute or fixed
  13076. if ( calculatePosition ) {
  13077. curPosition = curElem.position();
  13078. curTop = curPosition.top;
  13079. curLeft = curPosition.left;
  13080. } else {
  13081. curTop = parseFloat( curCSSTop ) || 0;
  13082. curLeft = parseFloat( curCSSLeft ) || 0;
  13083. }
  13084. if ( isFunction( options ) ) {
  13085. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  13086. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  13087. }
  13088. if ( options.top != null ) {
  13089. props.top = ( options.top - curOffset.top ) + curTop;
  13090. }
  13091. if ( options.left != null ) {
  13092. props.left = ( options.left - curOffset.left ) + curLeft;
  13093. }
  13094. if ( "using" in options ) {
  13095. options.using.call( elem, props );
  13096. } else {
  13097. curElem.css( props );
  13098. }
  13099. }
  13100. };
  13101. jQuery.fn.extend( {
  13102. // offset() relates an element's border box to the document origin
  13103. offset: function( options ) {
  13104. // Preserve chaining for setter
  13105. if ( arguments.length ) {
  13106. return options === undefined ?
  13107. this :
  13108. this.each( function( i ) {
  13109. jQuery.offset.setOffset( this, options, i );
  13110. } );
  13111. }
  13112. var rect, win,
  13113. elem = this[ 0 ];
  13114. if ( !elem ) {
  13115. return;
  13116. }
  13117. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  13118. // Support: IE <=11 only
  13119. // Running getBoundingClientRect on a
  13120. // disconnected node in IE throws an error
  13121. if ( !elem.getClientRects().length ) {
  13122. return { top: 0, left: 0 };
  13123. }
  13124. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  13125. rect = elem.getBoundingClientRect();
  13126. win = elem.ownerDocument.defaultView;
  13127. return {
  13128. top: rect.top + win.pageYOffset,
  13129. left: rect.left + win.pageXOffset
  13130. };
  13131. },
  13132. // position() relates an element's margin box to its offset parent's padding box
  13133. // This corresponds to the behavior of CSS absolute positioning
  13134. position: function() {
  13135. if ( !this[ 0 ] ) {
  13136. return;
  13137. }
  13138. var offsetParent, offset, doc,
  13139. elem = this[ 0 ],
  13140. parentOffset = { top: 0, left: 0 };
  13141. // position:fixed elements are offset from the viewport, which itself always has zero offset
  13142. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  13143. // Assume position:fixed implies availability of getBoundingClientRect
  13144. offset = elem.getBoundingClientRect();
  13145. } else {
  13146. offset = this.offset();
  13147. // Account for the *real* offset parent, which can be the document or its root element
  13148. // when a statically positioned element is identified
  13149. doc = elem.ownerDocument;
  13150. offsetParent = elem.offsetParent || doc.documentElement;
  13151. while ( offsetParent &&
  13152. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  13153. jQuery.css( offsetParent, "position" ) === "static" ) {
  13154. offsetParent = offsetParent.parentNode;
  13155. }
  13156. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  13157. // Incorporate borders into its offset, since they are outside its content origin
  13158. parentOffset = jQuery( offsetParent ).offset();
  13159. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  13160. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  13161. }
  13162. }
  13163. // Subtract parent offsets and element margins
  13164. return {
  13165. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  13166. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  13167. };
  13168. },
  13169. // This method will return documentElement in the following cases:
  13170. // 1) For the element inside the iframe without offsetParent, this method will return
  13171. // documentElement of the parent window
  13172. // 2) For the hidden or detached element
  13173. // 3) For body or html element, i.e. in case of the html node - it will return itself
  13174. //
  13175. // but those exceptions were never presented as a real life use-cases
  13176. // and might be considered as more preferable results.
  13177. //
  13178. // This logic, however, is not guaranteed and can change at any point in the future
  13179. offsetParent: function() {
  13180. return this.map( function() {
  13181. var offsetParent = this.offsetParent;
  13182. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  13183. offsetParent = offsetParent.offsetParent;
  13184. }
  13185. return offsetParent || documentElement;
  13186. } );
  13187. }
  13188. } );
  13189. // Create scrollLeft and scrollTop methods
  13190. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  13191. var top = "pageYOffset" === prop;
  13192. jQuery.fn[ method ] = function( val ) {
  13193. return access( this, function( elem, method, val ) {
  13194. // Coalesce documents and windows
  13195. var win;
  13196. if ( isWindow( elem ) ) {
  13197. win = elem;
  13198. } else if ( elem.nodeType === 9 ) {
  13199. win = elem.defaultView;
  13200. }
  13201. if ( val === undefined ) {
  13202. return win ? win[ prop ] : elem[ method ];
  13203. }
  13204. if ( win ) {
  13205. win.scrollTo(
  13206. !top ? val : win.pageXOffset,
  13207. top ? val : win.pageYOffset
  13208. );
  13209. } else {
  13210. elem[ method ] = val;
  13211. }
  13212. }, method, val, arguments.length );
  13213. };
  13214. } );
  13215. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  13216. // Add the top/left cssHooks using jQuery.fn.position
  13217. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  13218. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  13219. // getComputedStyle returns percent when specified for top/left/bottom/right;
  13220. // rather than make the css module depend on the offset module, just check for it here
  13221. jQuery.each( [ "top", "left" ], function( i, prop ) {
  13222. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  13223. function( elem, computed ) {
  13224. if ( computed ) {
  13225. computed = curCSS( elem, prop );
  13226. // If curCSS returns percentage, fallback to offset
  13227. return rnumnonpx.test( computed ) ?
  13228. jQuery( elem ).position()[ prop ] + "px" :
  13229. computed;
  13230. }
  13231. }
  13232. );
  13233. } );
  13234. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  13235. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  13236. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  13237. function( defaultExtra, funcName ) {
  13238. // Margin is only for outerHeight, outerWidth
  13239. jQuery.fn[ funcName ] = function( margin, value ) {
  13240. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  13241. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  13242. return access( this, function( elem, type, value ) {
  13243. var doc;
  13244. if ( isWindow( elem ) ) {
  13245. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  13246. return funcName.indexOf( "outer" ) === 0 ?
  13247. elem[ "inner" + name ] :
  13248. elem.document.documentElement[ "client" + name ];
  13249. }
  13250. // Get document width or height
  13251. if ( elem.nodeType === 9 ) {
  13252. doc = elem.documentElement;
  13253. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  13254. // whichever is greatest
  13255. return Math.max(
  13256. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  13257. elem.body[ "offset" + name ], doc[ "offset" + name ],
  13258. doc[ "client" + name ]
  13259. );
  13260. }
  13261. return value === undefined ?
  13262. // Get width or height on the element, requesting but not forcing parseFloat
  13263. jQuery.css( elem, type, extra ) :
  13264. // Set width or height on the element
  13265. jQuery.style( elem, type, value, extra );
  13266. }, type, chainable ? margin : undefined, chainable );
  13267. };
  13268. } );
  13269. } );
  13270. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  13271. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  13272. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  13273. function( i, name ) {
  13274. // Handle event binding
  13275. jQuery.fn[ name ] = function( data, fn ) {
  13276. return arguments.length > 0 ?
  13277. this.on( name, null, data, fn ) :
  13278. this.trigger( name );
  13279. };
  13280. } );
  13281. jQuery.fn.extend( {
  13282. hover: function( fnOver, fnOut ) {
  13283. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  13284. }
  13285. } );
  13286. jQuery.fn.extend( {
  13287. bind: function( types, data, fn ) {
  13288. return this.on( types, null, data, fn );
  13289. },
  13290. unbind: function( types, fn ) {
  13291. return this.off( types, null, fn );
  13292. },
  13293. delegate: function( selector, types, data, fn ) {
  13294. return this.on( types, selector, data, fn );
  13295. },
  13296. undelegate: function( selector, types, fn ) {
  13297. // ( namespace ) or ( selector, types [, fn] )
  13298. return arguments.length === 1 ?
  13299. this.off( selector, "**" ) :
  13300. this.off( types, selector || "**", fn );
  13301. }
  13302. } );
  13303. // Bind a function to a context, optionally partially applying any
  13304. // arguments.
  13305. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  13306. // However, it is not slated for removal any time soon
  13307. jQuery.proxy = function( fn, context ) {
  13308. var tmp, args, proxy;
  13309. if ( typeof context === "string" ) {
  13310. tmp = fn[ context ];
  13311. context = fn;
  13312. fn = tmp;
  13313. }
  13314. // Quick check to determine if target is callable, in the spec
  13315. // this throws a TypeError, but we will just return undefined.
  13316. if ( !isFunction( fn ) ) {
  13317. return undefined;
  13318. }
  13319. // Simulated bind
  13320. args = slice.call( arguments, 2 );
  13321. proxy = function() {
  13322. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  13323. };
  13324. // Set the guid of unique handler to the same of original handler, so it can be removed
  13325. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  13326. return proxy;
  13327. };
  13328. jQuery.holdReady = function( hold ) {
  13329. if ( hold ) {
  13330. jQuery.readyWait++;
  13331. } else {
  13332. jQuery.ready( true );
  13333. }
  13334. };
  13335. jQuery.isArray = Array.isArray;
  13336. jQuery.parseJSON = JSON.parse;
  13337. jQuery.nodeName = nodeName;
  13338. jQuery.isFunction = isFunction;
  13339. jQuery.isWindow = isWindow;
  13340. jQuery.camelCase = camelCase;
  13341. jQuery.type = toType;
  13342. jQuery.now = Date.now;
  13343. jQuery.isNumeric = function( obj ) {
  13344. // As of jQuery 3.0, isNumeric is limited to
  13345. // strings and numbers (primitives or objects)
  13346. // that can be coerced to finite numbers (gh-2662)
  13347. var type = jQuery.type( obj );
  13348. return ( type === "number" || type === "string" ) &&
  13349. // parseFloat NaNs numeric-cast false positives ("")
  13350. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  13351. // subtraction forces infinities to NaN
  13352. !isNaN( obj - parseFloat( obj ) );
  13353. };
  13354. // Register as a named AMD module, since jQuery can be concatenated with other
  13355. // files that may use define, but not via a proper concatenation script that
  13356. // understands anonymous AMD modules. A named AMD is safest and most robust
  13357. // way to register. Lowercase jquery is used because AMD module names are
  13358. // derived from file names, and jQuery is normally delivered in a lowercase
  13359. // file name. Do this after creating the global so that if an AMD module wants
  13360. // to call noConflict to hide this version of jQuery, it will work.
  13361. // Note that for maximum portability, libraries that are not jQuery should
  13362. // declare themselves as anonymous modules, and avoid setting a global if an
  13363. // AMD loader is present. jQuery is a special case. For more information, see
  13364. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  13365. if ( true ) {
  13366. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  13367. return jQuery;
  13368. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  13369. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  13370. }
  13371. var
  13372. // Map over jQuery in case of overwrite
  13373. _jQuery = window.jQuery,
  13374. // Map over the $ in case of overwrite
  13375. _$ = window.$;
  13376. jQuery.noConflict = function( deep ) {
  13377. if ( window.$ === jQuery ) {
  13378. window.$ = _$;
  13379. }
  13380. if ( deep && window.jQuery === jQuery ) {
  13381. window.jQuery = _jQuery;
  13382. }
  13383. return jQuery;
  13384. };
  13385. // Expose jQuery and $ identifiers, even in AMD
  13386. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  13387. // and CommonJS for browser emulators (#13566)
  13388. if ( !noGlobal ) {
  13389. window.jQuery = window.$ = jQuery;
  13390. }
  13391. return jQuery;
  13392. } );
  13393. /***/ }),
  13394. /***/ "./node_modules/lodash/lodash.js":
  13395. /***/ (function(module, exports, __webpack_require__) {
  13396. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  13397. * @license
  13398. * Lodash <https://lodash.com/>
  13399. * Copyright JS Foundation and other contributors <https://js.foundation/>
  13400. * Released under MIT license <https://lodash.com/license>
  13401. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  13402. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  13403. */
  13404. ;(function() {
  13405. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  13406. var undefined;
  13407. /** Used as the semantic version number. */
  13408. var VERSION = '4.17.11';
  13409. /** Used as the size to enable large array optimizations. */
  13410. var LARGE_ARRAY_SIZE = 200;
  13411. /** Error message constants. */
  13412. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  13413. FUNC_ERROR_TEXT = 'Expected a function';
  13414. /** Used to stand-in for `undefined` hash values. */
  13415. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  13416. /** Used as the maximum memoize cache size. */
  13417. var MAX_MEMOIZE_SIZE = 500;
  13418. /** Used as the internal argument placeholder. */
  13419. var PLACEHOLDER = '__lodash_placeholder__';
  13420. /** Used to compose bitmasks for cloning. */
  13421. var CLONE_DEEP_FLAG = 1,
  13422. CLONE_FLAT_FLAG = 2,
  13423. CLONE_SYMBOLS_FLAG = 4;
  13424. /** Used to compose bitmasks for value comparisons. */
  13425. var COMPARE_PARTIAL_FLAG = 1,
  13426. COMPARE_UNORDERED_FLAG = 2;
  13427. /** Used to compose bitmasks for function metadata. */
  13428. var WRAP_BIND_FLAG = 1,
  13429. WRAP_BIND_KEY_FLAG = 2,
  13430. WRAP_CURRY_BOUND_FLAG = 4,
  13431. WRAP_CURRY_FLAG = 8,
  13432. WRAP_CURRY_RIGHT_FLAG = 16,
  13433. WRAP_PARTIAL_FLAG = 32,
  13434. WRAP_PARTIAL_RIGHT_FLAG = 64,
  13435. WRAP_ARY_FLAG = 128,
  13436. WRAP_REARG_FLAG = 256,
  13437. WRAP_FLIP_FLAG = 512;
  13438. /** Used as default options for `_.truncate`. */
  13439. var DEFAULT_TRUNC_LENGTH = 30,
  13440. DEFAULT_TRUNC_OMISSION = '...';
  13441. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  13442. var HOT_COUNT = 800,
  13443. HOT_SPAN = 16;
  13444. /** Used to indicate the type of lazy iteratees. */
  13445. var LAZY_FILTER_FLAG = 1,
  13446. LAZY_MAP_FLAG = 2,
  13447. LAZY_WHILE_FLAG = 3;
  13448. /** Used as references for various `Number` constants. */
  13449. var INFINITY = 1 / 0,
  13450. MAX_SAFE_INTEGER = 9007199254740991,
  13451. MAX_INTEGER = 1.7976931348623157e+308,
  13452. NAN = 0 / 0;
  13453. /** Used as references for the maximum length and index of an array. */
  13454. var MAX_ARRAY_LENGTH = 4294967295,
  13455. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  13456. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  13457. /** Used to associate wrap methods with their bit flags. */
  13458. var wrapFlags = [
  13459. ['ary', WRAP_ARY_FLAG],
  13460. ['bind', WRAP_BIND_FLAG],
  13461. ['bindKey', WRAP_BIND_KEY_FLAG],
  13462. ['curry', WRAP_CURRY_FLAG],
  13463. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  13464. ['flip', WRAP_FLIP_FLAG],
  13465. ['partial', WRAP_PARTIAL_FLAG],
  13466. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  13467. ['rearg', WRAP_REARG_FLAG]
  13468. ];
  13469. /** `Object#toString` result references. */
  13470. var argsTag = '[object Arguments]',
  13471. arrayTag = '[object Array]',
  13472. asyncTag = '[object AsyncFunction]',
  13473. boolTag = '[object Boolean]',
  13474. dateTag = '[object Date]',
  13475. domExcTag = '[object DOMException]',
  13476. errorTag = '[object Error]',
  13477. funcTag = '[object Function]',
  13478. genTag = '[object GeneratorFunction]',
  13479. mapTag = '[object Map]',
  13480. numberTag = '[object Number]',
  13481. nullTag = '[object Null]',
  13482. objectTag = '[object Object]',
  13483. promiseTag = '[object Promise]',
  13484. proxyTag = '[object Proxy]',
  13485. regexpTag = '[object RegExp]',
  13486. setTag = '[object Set]',
  13487. stringTag = '[object String]',
  13488. symbolTag = '[object Symbol]',
  13489. undefinedTag = '[object Undefined]',
  13490. weakMapTag = '[object WeakMap]',
  13491. weakSetTag = '[object WeakSet]';
  13492. var arrayBufferTag = '[object ArrayBuffer]',
  13493. dataViewTag = '[object DataView]',
  13494. float32Tag = '[object Float32Array]',
  13495. float64Tag = '[object Float64Array]',
  13496. int8Tag = '[object Int8Array]',
  13497. int16Tag = '[object Int16Array]',
  13498. int32Tag = '[object Int32Array]',
  13499. uint8Tag = '[object Uint8Array]',
  13500. uint8ClampedTag = '[object Uint8ClampedArray]',
  13501. uint16Tag = '[object Uint16Array]',
  13502. uint32Tag = '[object Uint32Array]';
  13503. /** Used to match empty string literals in compiled template source. */
  13504. var reEmptyStringLeading = /\b__p \+= '';/g,
  13505. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  13506. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  13507. /** Used to match HTML entities and HTML characters. */
  13508. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  13509. reUnescapedHtml = /[&<>"']/g,
  13510. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  13511. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  13512. /** Used to match template delimiters. */
  13513. var reEscape = /<%-([\s\S]+?)%>/g,
  13514. reEvaluate = /<%([\s\S]+?)%>/g,
  13515. reInterpolate = /<%=([\s\S]+?)%>/g;
  13516. /** Used to match property names within property paths. */
  13517. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  13518. reIsPlainProp = /^\w*$/,
  13519. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  13520. /**
  13521. * Used to match `RegExp`
  13522. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  13523. */
  13524. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  13525. reHasRegExpChar = RegExp(reRegExpChar.source);
  13526. /** Used to match leading and trailing whitespace. */
  13527. var reTrim = /^\s+|\s+$/g,
  13528. reTrimStart = /^\s+/,
  13529. reTrimEnd = /\s+$/;
  13530. /** Used to match wrap detail comments. */
  13531. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  13532. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  13533. reSplitDetails = /,? & /;
  13534. /** Used to match words composed of alphanumeric characters. */
  13535. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  13536. /** Used to match backslashes in property paths. */
  13537. var reEscapeChar = /\\(\\)?/g;
  13538. /**
  13539. * Used to match
  13540. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  13541. */
  13542. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  13543. /** Used to match `RegExp` flags from their coerced string values. */
  13544. var reFlags = /\w*$/;
  13545. /** Used to detect bad signed hexadecimal string values. */
  13546. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  13547. /** Used to detect binary string values. */
  13548. var reIsBinary = /^0b[01]+$/i;
  13549. /** Used to detect host constructors (Safari). */
  13550. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  13551. /** Used to detect octal string values. */
  13552. var reIsOctal = /^0o[0-7]+$/i;
  13553. /** Used to detect unsigned integer values. */
  13554. var reIsUint = /^(?:0|[1-9]\d*)$/;
  13555. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  13556. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  13557. /** Used to ensure capturing order of template delimiters. */
  13558. var reNoMatch = /($^)/;
  13559. /** Used to match unescaped characters in compiled string literals. */
  13560. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  13561. /** Used to compose unicode character classes. */
  13562. var rsAstralRange = '\\ud800-\\udfff',
  13563. rsComboMarksRange = '\\u0300-\\u036f',
  13564. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  13565. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  13566. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  13567. rsDingbatRange = '\\u2700-\\u27bf',
  13568. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  13569. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  13570. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  13571. rsPunctuationRange = '\\u2000-\\u206f',
  13572. 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',
  13573. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  13574. rsVarRange = '\\ufe0e\\ufe0f',
  13575. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  13576. /** Used to compose unicode capture groups. */
  13577. var rsApos = "['\u2019]",
  13578. rsAstral = '[' + rsAstralRange + ']',
  13579. rsBreak = '[' + rsBreakRange + ']',
  13580. rsCombo = '[' + rsComboRange + ']',
  13581. rsDigits = '\\d+',
  13582. rsDingbat = '[' + rsDingbatRange + ']',
  13583. rsLower = '[' + rsLowerRange + ']',
  13584. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  13585. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  13586. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  13587. rsNonAstral = '[^' + rsAstralRange + ']',
  13588. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  13589. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  13590. rsUpper = '[' + rsUpperRange + ']',
  13591. rsZWJ = '\\u200d';
  13592. /** Used to compose unicode regexes. */
  13593. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  13594. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  13595. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  13596. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  13597. reOptMod = rsModifier + '?',
  13598. rsOptVar = '[' + rsVarRange + ']?',
  13599. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  13600. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  13601. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  13602. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  13603. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  13604. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  13605. /** Used to match apostrophes. */
  13606. var reApos = RegExp(rsApos, 'g');
  13607. /**
  13608. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  13609. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  13610. */
  13611. var reComboMark = RegExp(rsCombo, 'g');
  13612. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  13613. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  13614. /** Used to match complex or compound words. */
  13615. var reUnicodeWord = RegExp([
  13616. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  13617. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  13618. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  13619. rsUpper + '+' + rsOptContrUpper,
  13620. rsOrdUpper,
  13621. rsOrdLower,
  13622. rsDigits,
  13623. rsEmoji
  13624. ].join('|'), 'g');
  13625. /** 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/). */
  13626. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  13627. /** Used to detect strings that need a more robust regexp to match words. */
  13628. 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 ]/;
  13629. /** Used to assign default `context` object properties. */
  13630. var contextProps = [
  13631. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  13632. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  13633. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  13634. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  13635. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  13636. ];
  13637. /** Used to make template sourceURLs easier to identify. */
  13638. var templateCounter = -1;
  13639. /** Used to identify `toStringTag` values of typed arrays. */
  13640. var typedArrayTags = {};
  13641. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  13642. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  13643. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  13644. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  13645. typedArrayTags[uint32Tag] = true;
  13646. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  13647. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  13648. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  13649. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  13650. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  13651. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  13652. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  13653. typedArrayTags[weakMapTag] = false;
  13654. /** Used to identify `toStringTag` values supported by `_.clone`. */
  13655. var cloneableTags = {};
  13656. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  13657. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  13658. cloneableTags[boolTag] = cloneableTags[dateTag] =
  13659. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  13660. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  13661. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  13662. cloneableTags[numberTag] = cloneableTags[objectTag] =
  13663. cloneableTags[regexpTag] = cloneableTags[setTag] =
  13664. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  13665. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  13666. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  13667. cloneableTags[errorTag] = cloneableTags[funcTag] =
  13668. cloneableTags[weakMapTag] = false;
  13669. /** Used to map Latin Unicode letters to basic Latin letters. */
  13670. var deburredLetters = {
  13671. // Latin-1 Supplement block.
  13672. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  13673. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  13674. '\xc7': 'C', '\xe7': 'c',
  13675. '\xd0': 'D', '\xf0': 'd',
  13676. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  13677. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  13678. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  13679. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  13680. '\xd1': 'N', '\xf1': 'n',
  13681. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  13682. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  13683. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  13684. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  13685. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  13686. '\xc6': 'Ae', '\xe6': 'ae',
  13687. '\xde': 'Th', '\xfe': 'th',
  13688. '\xdf': 'ss',
  13689. // Latin Extended-A block.
  13690. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  13691. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  13692. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  13693. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  13694. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  13695. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  13696. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  13697. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  13698. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  13699. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  13700. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  13701. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  13702. '\u0134': 'J', '\u0135': 'j',
  13703. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  13704. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  13705. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  13706. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  13707. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  13708. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  13709. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  13710. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  13711. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  13712. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  13713. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  13714. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  13715. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  13716. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  13717. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  13718. '\u0174': 'W', '\u0175': 'w',
  13719. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  13720. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  13721. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  13722. '\u0132': 'IJ', '\u0133': 'ij',
  13723. '\u0152': 'Oe', '\u0153': 'oe',
  13724. '\u0149': "'n", '\u017f': 's'
  13725. };
  13726. /** Used to map characters to HTML entities. */
  13727. var htmlEscapes = {
  13728. '&': '&amp;',
  13729. '<': '&lt;',
  13730. '>': '&gt;',
  13731. '"': '&quot;',
  13732. "'": '&#39;'
  13733. };
  13734. /** Used to map HTML entities to characters. */
  13735. var htmlUnescapes = {
  13736. '&amp;': '&',
  13737. '&lt;': '<',
  13738. '&gt;': '>',
  13739. '&quot;': '"',
  13740. '&#39;': "'"
  13741. };
  13742. /** Used to escape characters for inclusion in compiled string literals. */
  13743. var stringEscapes = {
  13744. '\\': '\\',
  13745. "'": "'",
  13746. '\n': 'n',
  13747. '\r': 'r',
  13748. '\u2028': 'u2028',
  13749. '\u2029': 'u2029'
  13750. };
  13751. /** Built-in method references without a dependency on `root`. */
  13752. var freeParseFloat = parseFloat,
  13753. freeParseInt = parseInt;
  13754. /** Detect free variable `global` from Node.js. */
  13755. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  13756. /** Detect free variable `self`. */
  13757. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  13758. /** Used as a reference to the global object. */
  13759. var root = freeGlobal || freeSelf || Function('return this')();
  13760. /** Detect free variable `exports`. */
  13761. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  13762. /** Detect free variable `module`. */
  13763. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  13764. /** Detect the popular CommonJS extension `module.exports`. */
  13765. var moduleExports = freeModule && freeModule.exports === freeExports;
  13766. /** Detect free variable `process` from Node.js. */
  13767. var freeProcess = moduleExports && freeGlobal.process;
  13768. /** Used to access faster Node.js helpers. */
  13769. var nodeUtil = (function() {
  13770. try {
  13771. // Use `util.types` for Node.js 10+.
  13772. var types = freeModule && freeModule.require && freeModule.require('util').types;
  13773. if (types) {
  13774. return types;
  13775. }
  13776. // Legacy `process.binding('util')` for Node.js < 10.
  13777. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  13778. } catch (e) {}
  13779. }());
  13780. /* Node.js helper references. */
  13781. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  13782. nodeIsDate = nodeUtil && nodeUtil.isDate,
  13783. nodeIsMap = nodeUtil && nodeUtil.isMap,
  13784. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  13785. nodeIsSet = nodeUtil && nodeUtil.isSet,
  13786. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  13787. /*--------------------------------------------------------------------------*/
  13788. /**
  13789. * A faster alternative to `Function#apply`, this function invokes `func`
  13790. * with the `this` binding of `thisArg` and the arguments of `args`.
  13791. *
  13792. * @private
  13793. * @param {Function} func The function to invoke.
  13794. * @param {*} thisArg The `this` binding of `func`.
  13795. * @param {Array} args The arguments to invoke `func` with.
  13796. * @returns {*} Returns the result of `func`.
  13797. */
  13798. function apply(func, thisArg, args) {
  13799. switch (args.length) {
  13800. case 0: return func.call(thisArg);
  13801. case 1: return func.call(thisArg, args[0]);
  13802. case 2: return func.call(thisArg, args[0], args[1]);
  13803. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  13804. }
  13805. return func.apply(thisArg, args);
  13806. }
  13807. /**
  13808. * A specialized version of `baseAggregator` for arrays.
  13809. *
  13810. * @private
  13811. * @param {Array} [array] The array to iterate over.
  13812. * @param {Function} setter The function to set `accumulator` values.
  13813. * @param {Function} iteratee The iteratee to transform keys.
  13814. * @param {Object} accumulator The initial aggregated object.
  13815. * @returns {Function} Returns `accumulator`.
  13816. */
  13817. function arrayAggregator(array, setter, iteratee, accumulator) {
  13818. var index = -1,
  13819. length = array == null ? 0 : array.length;
  13820. while (++index < length) {
  13821. var value = array[index];
  13822. setter(accumulator, value, iteratee(value), array);
  13823. }
  13824. return accumulator;
  13825. }
  13826. /**
  13827. * A specialized version of `_.forEach` for arrays without support for
  13828. * iteratee shorthands.
  13829. *
  13830. * @private
  13831. * @param {Array} [array] The array to iterate over.
  13832. * @param {Function} iteratee The function invoked per iteration.
  13833. * @returns {Array} Returns `array`.
  13834. */
  13835. function arrayEach(array, iteratee) {
  13836. var index = -1,
  13837. length = array == null ? 0 : array.length;
  13838. while (++index < length) {
  13839. if (iteratee(array[index], index, array) === false) {
  13840. break;
  13841. }
  13842. }
  13843. return array;
  13844. }
  13845. /**
  13846. * A specialized version of `_.forEachRight` for arrays without support for
  13847. * iteratee shorthands.
  13848. *
  13849. * @private
  13850. * @param {Array} [array] The array to iterate over.
  13851. * @param {Function} iteratee The function invoked per iteration.
  13852. * @returns {Array} Returns `array`.
  13853. */
  13854. function arrayEachRight(array, iteratee) {
  13855. var length = array == null ? 0 : array.length;
  13856. while (length--) {
  13857. if (iteratee(array[length], length, array) === false) {
  13858. break;
  13859. }
  13860. }
  13861. return array;
  13862. }
  13863. /**
  13864. * A specialized version of `_.every` for arrays without support for
  13865. * iteratee shorthands.
  13866. *
  13867. * @private
  13868. * @param {Array} [array] The array to iterate over.
  13869. * @param {Function} predicate The function invoked per iteration.
  13870. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  13871. * else `false`.
  13872. */
  13873. function arrayEvery(array, predicate) {
  13874. var index = -1,
  13875. length = array == null ? 0 : array.length;
  13876. while (++index < length) {
  13877. if (!predicate(array[index], index, array)) {
  13878. return false;
  13879. }
  13880. }
  13881. return true;
  13882. }
  13883. /**
  13884. * A specialized version of `_.filter` for arrays without support for
  13885. * iteratee shorthands.
  13886. *
  13887. * @private
  13888. * @param {Array} [array] The array to iterate over.
  13889. * @param {Function} predicate The function invoked per iteration.
  13890. * @returns {Array} Returns the new filtered array.
  13891. */
  13892. function arrayFilter(array, predicate) {
  13893. var index = -1,
  13894. length = array == null ? 0 : array.length,
  13895. resIndex = 0,
  13896. result = [];
  13897. while (++index < length) {
  13898. var value = array[index];
  13899. if (predicate(value, index, array)) {
  13900. result[resIndex++] = value;
  13901. }
  13902. }
  13903. return result;
  13904. }
  13905. /**
  13906. * A specialized version of `_.includes` for arrays without support for
  13907. * specifying an index to search from.
  13908. *
  13909. * @private
  13910. * @param {Array} [array] The array to inspect.
  13911. * @param {*} target The value to search for.
  13912. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  13913. */
  13914. function arrayIncludes(array, value) {
  13915. var length = array == null ? 0 : array.length;
  13916. return !!length && baseIndexOf(array, value, 0) > -1;
  13917. }
  13918. /**
  13919. * This function is like `arrayIncludes` except that it accepts a comparator.
  13920. *
  13921. * @private
  13922. * @param {Array} [array] The array to inspect.
  13923. * @param {*} target The value to search for.
  13924. * @param {Function} comparator The comparator invoked per element.
  13925. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  13926. */
  13927. function arrayIncludesWith(array, value, comparator) {
  13928. var index = -1,
  13929. length = array == null ? 0 : array.length;
  13930. while (++index < length) {
  13931. if (comparator(value, array[index])) {
  13932. return true;
  13933. }
  13934. }
  13935. return false;
  13936. }
  13937. /**
  13938. * A specialized version of `_.map` for arrays without support for iteratee
  13939. * shorthands.
  13940. *
  13941. * @private
  13942. * @param {Array} [array] The array to iterate over.
  13943. * @param {Function} iteratee The function invoked per iteration.
  13944. * @returns {Array} Returns the new mapped array.
  13945. */
  13946. function arrayMap(array, iteratee) {
  13947. var index = -1,
  13948. length = array == null ? 0 : array.length,
  13949. result = Array(length);
  13950. while (++index < length) {
  13951. result[index] = iteratee(array[index], index, array);
  13952. }
  13953. return result;
  13954. }
  13955. /**
  13956. * Appends the elements of `values` to `array`.
  13957. *
  13958. * @private
  13959. * @param {Array} array The array to modify.
  13960. * @param {Array} values The values to append.
  13961. * @returns {Array} Returns `array`.
  13962. */
  13963. function arrayPush(array, values) {
  13964. var index = -1,
  13965. length = values.length,
  13966. offset = array.length;
  13967. while (++index < length) {
  13968. array[offset + index] = values[index];
  13969. }
  13970. return array;
  13971. }
  13972. /**
  13973. * A specialized version of `_.reduce` for arrays without support for
  13974. * iteratee shorthands.
  13975. *
  13976. * @private
  13977. * @param {Array} [array] The array to iterate over.
  13978. * @param {Function} iteratee The function invoked per iteration.
  13979. * @param {*} [accumulator] The initial value.
  13980. * @param {boolean} [initAccum] Specify using the first element of `array` as
  13981. * the initial value.
  13982. * @returns {*} Returns the accumulated value.
  13983. */
  13984. function arrayReduce(array, iteratee, accumulator, initAccum) {
  13985. var index = -1,
  13986. length = array == null ? 0 : array.length;
  13987. if (initAccum && length) {
  13988. accumulator = array[++index];
  13989. }
  13990. while (++index < length) {
  13991. accumulator = iteratee(accumulator, array[index], index, array);
  13992. }
  13993. return accumulator;
  13994. }
  13995. /**
  13996. * A specialized version of `_.reduceRight` for arrays without support for
  13997. * iteratee shorthands.
  13998. *
  13999. * @private
  14000. * @param {Array} [array] The array to iterate over.
  14001. * @param {Function} iteratee The function invoked per iteration.
  14002. * @param {*} [accumulator] The initial value.
  14003. * @param {boolean} [initAccum] Specify using the last element of `array` as
  14004. * the initial value.
  14005. * @returns {*} Returns the accumulated value.
  14006. */
  14007. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  14008. var length = array == null ? 0 : array.length;
  14009. if (initAccum && length) {
  14010. accumulator = array[--length];
  14011. }
  14012. while (length--) {
  14013. accumulator = iteratee(accumulator, array[length], length, array);
  14014. }
  14015. return accumulator;
  14016. }
  14017. /**
  14018. * A specialized version of `_.some` for arrays without support for iteratee
  14019. * shorthands.
  14020. *
  14021. * @private
  14022. * @param {Array} [array] The array to iterate over.
  14023. * @param {Function} predicate The function invoked per iteration.
  14024. * @returns {boolean} Returns `true` if any element passes the predicate check,
  14025. * else `false`.
  14026. */
  14027. function arraySome(array, predicate) {
  14028. var index = -1,
  14029. length = array == null ? 0 : array.length;
  14030. while (++index < length) {
  14031. if (predicate(array[index], index, array)) {
  14032. return true;
  14033. }
  14034. }
  14035. return false;
  14036. }
  14037. /**
  14038. * Gets the size of an ASCII `string`.
  14039. *
  14040. * @private
  14041. * @param {string} string The string inspect.
  14042. * @returns {number} Returns the string size.
  14043. */
  14044. var asciiSize = baseProperty('length');
  14045. /**
  14046. * Converts an ASCII `string` to an array.
  14047. *
  14048. * @private
  14049. * @param {string} string The string to convert.
  14050. * @returns {Array} Returns the converted array.
  14051. */
  14052. function asciiToArray(string) {
  14053. return string.split('');
  14054. }
  14055. /**
  14056. * Splits an ASCII `string` into an array of its words.
  14057. *
  14058. * @private
  14059. * @param {string} The string to inspect.
  14060. * @returns {Array} Returns the words of `string`.
  14061. */
  14062. function asciiWords(string) {
  14063. return string.match(reAsciiWord) || [];
  14064. }
  14065. /**
  14066. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  14067. * without support for iteratee shorthands, which iterates over `collection`
  14068. * using `eachFunc`.
  14069. *
  14070. * @private
  14071. * @param {Array|Object} collection The collection to inspect.
  14072. * @param {Function} predicate The function invoked per iteration.
  14073. * @param {Function} eachFunc The function to iterate over `collection`.
  14074. * @returns {*} Returns the found element or its key, else `undefined`.
  14075. */
  14076. function baseFindKey(collection, predicate, eachFunc) {
  14077. var result;
  14078. eachFunc(collection, function(value, key, collection) {
  14079. if (predicate(value, key, collection)) {
  14080. result = key;
  14081. return false;
  14082. }
  14083. });
  14084. return result;
  14085. }
  14086. /**
  14087. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  14088. * support for iteratee shorthands.
  14089. *
  14090. * @private
  14091. * @param {Array} array The array to inspect.
  14092. * @param {Function} predicate The function invoked per iteration.
  14093. * @param {number} fromIndex The index to search from.
  14094. * @param {boolean} [fromRight] Specify iterating from right to left.
  14095. * @returns {number} Returns the index of the matched value, else `-1`.
  14096. */
  14097. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  14098. var length = array.length,
  14099. index = fromIndex + (fromRight ? 1 : -1);
  14100. while ((fromRight ? index-- : ++index < length)) {
  14101. if (predicate(array[index], index, array)) {
  14102. return index;
  14103. }
  14104. }
  14105. return -1;
  14106. }
  14107. /**
  14108. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  14109. *
  14110. * @private
  14111. * @param {Array} array The array to inspect.
  14112. * @param {*} value The value to search for.
  14113. * @param {number} fromIndex The index to search from.
  14114. * @returns {number} Returns the index of the matched value, else `-1`.
  14115. */
  14116. function baseIndexOf(array, value, fromIndex) {
  14117. return value === value
  14118. ? strictIndexOf(array, value, fromIndex)
  14119. : baseFindIndex(array, baseIsNaN, fromIndex);
  14120. }
  14121. /**
  14122. * This function is like `baseIndexOf` except that it accepts a comparator.
  14123. *
  14124. * @private
  14125. * @param {Array} array The array to inspect.
  14126. * @param {*} value The value to search for.
  14127. * @param {number} fromIndex The index to search from.
  14128. * @param {Function} comparator The comparator invoked per element.
  14129. * @returns {number} Returns the index of the matched value, else `-1`.
  14130. */
  14131. function baseIndexOfWith(array, value, fromIndex, comparator) {
  14132. var index = fromIndex - 1,
  14133. length = array.length;
  14134. while (++index < length) {
  14135. if (comparator(array[index], value)) {
  14136. return index;
  14137. }
  14138. }
  14139. return -1;
  14140. }
  14141. /**
  14142. * The base implementation of `_.isNaN` without support for number objects.
  14143. *
  14144. * @private
  14145. * @param {*} value The value to check.
  14146. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  14147. */
  14148. function baseIsNaN(value) {
  14149. return value !== value;
  14150. }
  14151. /**
  14152. * The base implementation of `_.mean` and `_.meanBy` without support for
  14153. * iteratee shorthands.
  14154. *
  14155. * @private
  14156. * @param {Array} array The array to iterate over.
  14157. * @param {Function} iteratee The function invoked per iteration.
  14158. * @returns {number} Returns the mean.
  14159. */
  14160. function baseMean(array, iteratee) {
  14161. var length = array == null ? 0 : array.length;
  14162. return length ? (baseSum(array, iteratee) / length) : NAN;
  14163. }
  14164. /**
  14165. * The base implementation of `_.property` without support for deep paths.
  14166. *
  14167. * @private
  14168. * @param {string} key The key of the property to get.
  14169. * @returns {Function} Returns the new accessor function.
  14170. */
  14171. function baseProperty(key) {
  14172. return function(object) {
  14173. return object == null ? undefined : object[key];
  14174. };
  14175. }
  14176. /**
  14177. * The base implementation of `_.propertyOf` without support for deep paths.
  14178. *
  14179. * @private
  14180. * @param {Object} object The object to query.
  14181. * @returns {Function} Returns the new accessor function.
  14182. */
  14183. function basePropertyOf(object) {
  14184. return function(key) {
  14185. return object == null ? undefined : object[key];
  14186. };
  14187. }
  14188. /**
  14189. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  14190. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  14191. *
  14192. * @private
  14193. * @param {Array|Object} collection The collection to iterate over.
  14194. * @param {Function} iteratee The function invoked per iteration.
  14195. * @param {*} accumulator The initial value.
  14196. * @param {boolean} initAccum Specify using the first or last element of
  14197. * `collection` as the initial value.
  14198. * @param {Function} eachFunc The function to iterate over `collection`.
  14199. * @returns {*} Returns the accumulated value.
  14200. */
  14201. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  14202. eachFunc(collection, function(value, index, collection) {
  14203. accumulator = initAccum
  14204. ? (initAccum = false, value)
  14205. : iteratee(accumulator, value, index, collection);
  14206. });
  14207. return accumulator;
  14208. }
  14209. /**
  14210. * The base implementation of `_.sortBy` which uses `comparer` to define the
  14211. * sort order of `array` and replaces criteria objects with their corresponding
  14212. * values.
  14213. *
  14214. * @private
  14215. * @param {Array} array The array to sort.
  14216. * @param {Function} comparer The function to define sort order.
  14217. * @returns {Array} Returns `array`.
  14218. */
  14219. function baseSortBy(array, comparer) {
  14220. var length = array.length;
  14221. array.sort(comparer);
  14222. while (length--) {
  14223. array[length] = array[length].value;
  14224. }
  14225. return array;
  14226. }
  14227. /**
  14228. * The base implementation of `_.sum` and `_.sumBy` without support for
  14229. * iteratee shorthands.
  14230. *
  14231. * @private
  14232. * @param {Array} array The array to iterate over.
  14233. * @param {Function} iteratee The function invoked per iteration.
  14234. * @returns {number} Returns the sum.
  14235. */
  14236. function baseSum(array, iteratee) {
  14237. var result,
  14238. index = -1,
  14239. length = array.length;
  14240. while (++index < length) {
  14241. var current = iteratee(array[index]);
  14242. if (current !== undefined) {
  14243. result = result === undefined ? current : (result + current);
  14244. }
  14245. }
  14246. return result;
  14247. }
  14248. /**
  14249. * The base implementation of `_.times` without support for iteratee shorthands
  14250. * or max array length checks.
  14251. *
  14252. * @private
  14253. * @param {number} n The number of times to invoke `iteratee`.
  14254. * @param {Function} iteratee The function invoked per iteration.
  14255. * @returns {Array} Returns the array of results.
  14256. */
  14257. function baseTimes(n, iteratee) {
  14258. var index = -1,
  14259. result = Array(n);
  14260. while (++index < n) {
  14261. result[index] = iteratee(index);
  14262. }
  14263. return result;
  14264. }
  14265. /**
  14266. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  14267. * of key-value pairs for `object` corresponding to the property names of `props`.
  14268. *
  14269. * @private
  14270. * @param {Object} object The object to query.
  14271. * @param {Array} props The property names to get values for.
  14272. * @returns {Object} Returns the key-value pairs.
  14273. */
  14274. function baseToPairs(object, props) {
  14275. return arrayMap(props, function(key) {
  14276. return [key, object[key]];
  14277. });
  14278. }
  14279. /**
  14280. * The base implementation of `_.unary` without support for storing metadata.
  14281. *
  14282. * @private
  14283. * @param {Function} func The function to cap arguments for.
  14284. * @returns {Function} Returns the new capped function.
  14285. */
  14286. function baseUnary(func) {
  14287. return function(value) {
  14288. return func(value);
  14289. };
  14290. }
  14291. /**
  14292. * The base implementation of `_.values` and `_.valuesIn` which creates an
  14293. * array of `object` property values corresponding to the property names
  14294. * of `props`.
  14295. *
  14296. * @private
  14297. * @param {Object} object The object to query.
  14298. * @param {Array} props The property names to get values for.
  14299. * @returns {Object} Returns the array of property values.
  14300. */
  14301. function baseValues(object, props) {
  14302. return arrayMap(props, function(key) {
  14303. return object[key];
  14304. });
  14305. }
  14306. /**
  14307. * Checks if a `cache` value for `key` exists.
  14308. *
  14309. * @private
  14310. * @param {Object} cache The cache to query.
  14311. * @param {string} key The key of the entry to check.
  14312. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  14313. */
  14314. function cacheHas(cache, key) {
  14315. return cache.has(key);
  14316. }
  14317. /**
  14318. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  14319. * that is not found in the character symbols.
  14320. *
  14321. * @private
  14322. * @param {Array} strSymbols The string symbols to inspect.
  14323. * @param {Array} chrSymbols The character symbols to find.
  14324. * @returns {number} Returns the index of the first unmatched string symbol.
  14325. */
  14326. function charsStartIndex(strSymbols, chrSymbols) {
  14327. var index = -1,
  14328. length = strSymbols.length;
  14329. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  14330. return index;
  14331. }
  14332. /**
  14333. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  14334. * that is not found in the character symbols.
  14335. *
  14336. * @private
  14337. * @param {Array} strSymbols The string symbols to inspect.
  14338. * @param {Array} chrSymbols The character symbols to find.
  14339. * @returns {number} Returns the index of the last unmatched string symbol.
  14340. */
  14341. function charsEndIndex(strSymbols, chrSymbols) {
  14342. var index = strSymbols.length;
  14343. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  14344. return index;
  14345. }
  14346. /**
  14347. * Gets the number of `placeholder` occurrences in `array`.
  14348. *
  14349. * @private
  14350. * @param {Array} array The array to inspect.
  14351. * @param {*} placeholder The placeholder to search for.
  14352. * @returns {number} Returns the placeholder count.
  14353. */
  14354. function countHolders(array, placeholder) {
  14355. var length = array.length,
  14356. result = 0;
  14357. while (length--) {
  14358. if (array[length] === placeholder) {
  14359. ++result;
  14360. }
  14361. }
  14362. return result;
  14363. }
  14364. /**
  14365. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  14366. * letters to basic Latin letters.
  14367. *
  14368. * @private
  14369. * @param {string} letter The matched letter to deburr.
  14370. * @returns {string} Returns the deburred letter.
  14371. */
  14372. var deburrLetter = basePropertyOf(deburredLetters);
  14373. /**
  14374. * Used by `_.escape` to convert characters to HTML entities.
  14375. *
  14376. * @private
  14377. * @param {string} chr The matched character to escape.
  14378. * @returns {string} Returns the escaped character.
  14379. */
  14380. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  14381. /**
  14382. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  14383. *
  14384. * @private
  14385. * @param {string} chr The matched character to escape.
  14386. * @returns {string} Returns the escaped character.
  14387. */
  14388. function escapeStringChar(chr) {
  14389. return '\\' + stringEscapes[chr];
  14390. }
  14391. /**
  14392. * Gets the value at `key` of `object`.
  14393. *
  14394. * @private
  14395. * @param {Object} [object] The object to query.
  14396. * @param {string} key The key of the property to get.
  14397. * @returns {*} Returns the property value.
  14398. */
  14399. function getValue(object, key) {
  14400. return object == null ? undefined : object[key];
  14401. }
  14402. /**
  14403. * Checks if `string` contains Unicode symbols.
  14404. *
  14405. * @private
  14406. * @param {string} string The string to inspect.
  14407. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  14408. */
  14409. function hasUnicode(string) {
  14410. return reHasUnicode.test(string);
  14411. }
  14412. /**
  14413. * Checks if `string` contains a word composed of Unicode symbols.
  14414. *
  14415. * @private
  14416. * @param {string} string The string to inspect.
  14417. * @returns {boolean} Returns `true` if a word is found, else `false`.
  14418. */
  14419. function hasUnicodeWord(string) {
  14420. return reHasUnicodeWord.test(string);
  14421. }
  14422. /**
  14423. * Converts `iterator` to an array.
  14424. *
  14425. * @private
  14426. * @param {Object} iterator The iterator to convert.
  14427. * @returns {Array} Returns the converted array.
  14428. */
  14429. function iteratorToArray(iterator) {
  14430. var data,
  14431. result = [];
  14432. while (!(data = iterator.next()).done) {
  14433. result.push(data.value);
  14434. }
  14435. return result;
  14436. }
  14437. /**
  14438. * Converts `map` to its key-value pairs.
  14439. *
  14440. * @private
  14441. * @param {Object} map The map to convert.
  14442. * @returns {Array} Returns the key-value pairs.
  14443. */
  14444. function mapToArray(map) {
  14445. var index = -1,
  14446. result = Array(map.size);
  14447. map.forEach(function(value, key) {
  14448. result[++index] = [key, value];
  14449. });
  14450. return result;
  14451. }
  14452. /**
  14453. * Creates a unary function that invokes `func` with its argument transformed.
  14454. *
  14455. * @private
  14456. * @param {Function} func The function to wrap.
  14457. * @param {Function} transform The argument transform.
  14458. * @returns {Function} Returns the new function.
  14459. */
  14460. function overArg(func, transform) {
  14461. return function(arg) {
  14462. return func(transform(arg));
  14463. };
  14464. }
  14465. /**
  14466. * Replaces all `placeholder` elements in `array` with an internal placeholder
  14467. * and returns an array of their indexes.
  14468. *
  14469. * @private
  14470. * @param {Array} array The array to modify.
  14471. * @param {*} placeholder The placeholder to replace.
  14472. * @returns {Array} Returns the new array of placeholder indexes.
  14473. */
  14474. function replaceHolders(array, placeholder) {
  14475. var index = -1,
  14476. length = array.length,
  14477. resIndex = 0,
  14478. result = [];
  14479. while (++index < length) {
  14480. var value = array[index];
  14481. if (value === placeholder || value === PLACEHOLDER) {
  14482. array[index] = PLACEHOLDER;
  14483. result[resIndex++] = index;
  14484. }
  14485. }
  14486. return result;
  14487. }
  14488. /**
  14489. * Converts `set` to an array of its values.
  14490. *
  14491. * @private
  14492. * @param {Object} set The set to convert.
  14493. * @returns {Array} Returns the values.
  14494. */
  14495. function setToArray(set) {
  14496. var index = -1,
  14497. result = Array(set.size);
  14498. set.forEach(function(value) {
  14499. result[++index] = value;
  14500. });
  14501. return result;
  14502. }
  14503. /**
  14504. * Converts `set` to its value-value pairs.
  14505. *
  14506. * @private
  14507. * @param {Object} set The set to convert.
  14508. * @returns {Array} Returns the value-value pairs.
  14509. */
  14510. function setToPairs(set) {
  14511. var index = -1,
  14512. result = Array(set.size);
  14513. set.forEach(function(value) {
  14514. result[++index] = [value, value];
  14515. });
  14516. return result;
  14517. }
  14518. /**
  14519. * A specialized version of `_.indexOf` which performs strict equality
  14520. * comparisons of values, i.e. `===`.
  14521. *
  14522. * @private
  14523. * @param {Array} array The array to inspect.
  14524. * @param {*} value The value to search for.
  14525. * @param {number} fromIndex The index to search from.
  14526. * @returns {number} Returns the index of the matched value, else `-1`.
  14527. */
  14528. function strictIndexOf(array, value, fromIndex) {
  14529. var index = fromIndex - 1,
  14530. length = array.length;
  14531. while (++index < length) {
  14532. if (array[index] === value) {
  14533. return index;
  14534. }
  14535. }
  14536. return -1;
  14537. }
  14538. /**
  14539. * A specialized version of `_.lastIndexOf` which performs strict equality
  14540. * comparisons of values, i.e. `===`.
  14541. *
  14542. * @private
  14543. * @param {Array} array The array to inspect.
  14544. * @param {*} value The value to search for.
  14545. * @param {number} fromIndex The index to search from.
  14546. * @returns {number} Returns the index of the matched value, else `-1`.
  14547. */
  14548. function strictLastIndexOf(array, value, fromIndex) {
  14549. var index = fromIndex + 1;
  14550. while (index--) {
  14551. if (array[index] === value) {
  14552. return index;
  14553. }
  14554. }
  14555. return index;
  14556. }
  14557. /**
  14558. * Gets the number of symbols in `string`.
  14559. *
  14560. * @private
  14561. * @param {string} string The string to inspect.
  14562. * @returns {number} Returns the string size.
  14563. */
  14564. function stringSize(string) {
  14565. return hasUnicode(string)
  14566. ? unicodeSize(string)
  14567. : asciiSize(string);
  14568. }
  14569. /**
  14570. * Converts `string` to an array.
  14571. *
  14572. * @private
  14573. * @param {string} string The string to convert.
  14574. * @returns {Array} Returns the converted array.
  14575. */
  14576. function stringToArray(string) {
  14577. return hasUnicode(string)
  14578. ? unicodeToArray(string)
  14579. : asciiToArray(string);
  14580. }
  14581. /**
  14582. * Used by `_.unescape` to convert HTML entities to characters.
  14583. *
  14584. * @private
  14585. * @param {string} chr The matched character to unescape.
  14586. * @returns {string} Returns the unescaped character.
  14587. */
  14588. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  14589. /**
  14590. * Gets the size of a Unicode `string`.
  14591. *
  14592. * @private
  14593. * @param {string} string The string inspect.
  14594. * @returns {number} Returns the string size.
  14595. */
  14596. function unicodeSize(string) {
  14597. var result = reUnicode.lastIndex = 0;
  14598. while (reUnicode.test(string)) {
  14599. ++result;
  14600. }
  14601. return result;
  14602. }
  14603. /**
  14604. * Converts a Unicode `string` to an array.
  14605. *
  14606. * @private
  14607. * @param {string} string The string to convert.
  14608. * @returns {Array} Returns the converted array.
  14609. */
  14610. function unicodeToArray(string) {
  14611. return string.match(reUnicode) || [];
  14612. }
  14613. /**
  14614. * Splits a Unicode `string` into an array of its words.
  14615. *
  14616. * @private
  14617. * @param {string} The string to inspect.
  14618. * @returns {Array} Returns the words of `string`.
  14619. */
  14620. function unicodeWords(string) {
  14621. return string.match(reUnicodeWord) || [];
  14622. }
  14623. /*--------------------------------------------------------------------------*/
  14624. /**
  14625. * Create a new pristine `lodash` function using the `context` object.
  14626. *
  14627. * @static
  14628. * @memberOf _
  14629. * @since 1.1.0
  14630. * @category Util
  14631. * @param {Object} [context=root] The context object.
  14632. * @returns {Function} Returns a new `lodash` function.
  14633. * @example
  14634. *
  14635. * _.mixin({ 'foo': _.constant('foo') });
  14636. *
  14637. * var lodash = _.runInContext();
  14638. * lodash.mixin({ 'bar': lodash.constant('bar') });
  14639. *
  14640. * _.isFunction(_.foo);
  14641. * // => true
  14642. * _.isFunction(_.bar);
  14643. * // => false
  14644. *
  14645. * lodash.isFunction(lodash.foo);
  14646. * // => false
  14647. * lodash.isFunction(lodash.bar);
  14648. * // => true
  14649. *
  14650. * // Create a suped-up `defer` in Node.js.
  14651. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  14652. */
  14653. var runInContext = (function runInContext(context) {
  14654. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  14655. /** Built-in constructor references. */
  14656. var Array = context.Array,
  14657. Date = context.Date,
  14658. Error = context.Error,
  14659. Function = context.Function,
  14660. Math = context.Math,
  14661. Object = context.Object,
  14662. RegExp = context.RegExp,
  14663. String = context.String,
  14664. TypeError = context.TypeError;
  14665. /** Used for built-in method references. */
  14666. var arrayProto = Array.prototype,
  14667. funcProto = Function.prototype,
  14668. objectProto = Object.prototype;
  14669. /** Used to detect overreaching core-js shims. */
  14670. var coreJsData = context['__core-js_shared__'];
  14671. /** Used to resolve the decompiled source of functions. */
  14672. var funcToString = funcProto.toString;
  14673. /** Used to check objects for own properties. */
  14674. var hasOwnProperty = objectProto.hasOwnProperty;
  14675. /** Used to generate unique IDs. */
  14676. var idCounter = 0;
  14677. /** Used to detect methods masquerading as native. */
  14678. var maskSrcKey = (function() {
  14679. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  14680. return uid ? ('Symbol(src)_1.' + uid) : '';
  14681. }());
  14682. /**
  14683. * Used to resolve the
  14684. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  14685. * of values.
  14686. */
  14687. var nativeObjectToString = objectProto.toString;
  14688. /** Used to infer the `Object` constructor. */
  14689. var objectCtorString = funcToString.call(Object);
  14690. /** Used to restore the original `_` reference in `_.noConflict`. */
  14691. var oldDash = root._;
  14692. /** Used to detect if a method is native. */
  14693. var reIsNative = RegExp('^' +
  14694. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  14695. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  14696. );
  14697. /** Built-in value references. */
  14698. var Buffer = moduleExports ? context.Buffer : undefined,
  14699. Symbol = context.Symbol,
  14700. Uint8Array = context.Uint8Array,
  14701. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  14702. getPrototype = overArg(Object.getPrototypeOf, Object),
  14703. objectCreate = Object.create,
  14704. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  14705. splice = arrayProto.splice,
  14706. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  14707. symIterator = Symbol ? Symbol.iterator : undefined,
  14708. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  14709. var defineProperty = (function() {
  14710. try {
  14711. var func = getNative(Object, 'defineProperty');
  14712. func({}, '', {});
  14713. return func;
  14714. } catch (e) {}
  14715. }());
  14716. /** Mocked built-ins. */
  14717. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  14718. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  14719. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  14720. /* Built-in method references for those with the same name as other `lodash` methods. */
  14721. var nativeCeil = Math.ceil,
  14722. nativeFloor = Math.floor,
  14723. nativeGetSymbols = Object.getOwnPropertySymbols,
  14724. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  14725. nativeIsFinite = context.isFinite,
  14726. nativeJoin = arrayProto.join,
  14727. nativeKeys = overArg(Object.keys, Object),
  14728. nativeMax = Math.max,
  14729. nativeMin = Math.min,
  14730. nativeNow = Date.now,
  14731. nativeParseInt = context.parseInt,
  14732. nativeRandom = Math.random,
  14733. nativeReverse = arrayProto.reverse;
  14734. /* Built-in method references that are verified to be native. */
  14735. var DataView = getNative(context, 'DataView'),
  14736. Map = getNative(context, 'Map'),
  14737. Promise = getNative(context, 'Promise'),
  14738. Set = getNative(context, 'Set'),
  14739. WeakMap = getNative(context, 'WeakMap'),
  14740. nativeCreate = getNative(Object, 'create');
  14741. /** Used to store function metadata. */
  14742. var metaMap = WeakMap && new WeakMap;
  14743. /** Used to lookup unminified function names. */
  14744. var realNames = {};
  14745. /** Used to detect maps, sets, and weakmaps. */
  14746. var dataViewCtorString = toSource(DataView),
  14747. mapCtorString = toSource(Map),
  14748. promiseCtorString = toSource(Promise),
  14749. setCtorString = toSource(Set),
  14750. weakMapCtorString = toSource(WeakMap);
  14751. /** Used to convert symbols to primitives and strings. */
  14752. var symbolProto = Symbol ? Symbol.prototype : undefined,
  14753. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  14754. symbolToString = symbolProto ? symbolProto.toString : undefined;
  14755. /*------------------------------------------------------------------------*/
  14756. /**
  14757. * Creates a `lodash` object which wraps `value` to enable implicit method
  14758. * chain sequences. Methods that operate on and return arrays, collections,
  14759. * and functions can be chained together. Methods that retrieve a single value
  14760. * or may return a primitive value will automatically end the chain sequence
  14761. * and return the unwrapped value. Otherwise, the value must be unwrapped
  14762. * with `_#value`.
  14763. *
  14764. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  14765. * enabled using `_.chain`.
  14766. *
  14767. * The execution of chained methods is lazy, that is, it's deferred until
  14768. * `_#value` is implicitly or explicitly called.
  14769. *
  14770. * Lazy evaluation allows several methods to support shortcut fusion.
  14771. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  14772. * the creation of intermediate arrays and can greatly reduce the number of
  14773. * iteratee executions. Sections of a chain sequence qualify for shortcut
  14774. * fusion if the section is applied to an array and iteratees accept only
  14775. * one argument. The heuristic for whether a section qualifies for shortcut
  14776. * fusion is subject to change.
  14777. *
  14778. * Chaining is supported in custom builds as long as the `_#value` method is
  14779. * directly or indirectly included in the build.
  14780. *
  14781. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  14782. *
  14783. * The wrapper `Array` methods are:
  14784. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  14785. *
  14786. * The wrapper `String` methods are:
  14787. * `replace` and `split`
  14788. *
  14789. * The wrapper methods that support shortcut fusion are:
  14790. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  14791. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  14792. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  14793. *
  14794. * The chainable wrapper methods are:
  14795. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  14796. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  14797. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  14798. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  14799. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  14800. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  14801. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  14802. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  14803. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  14804. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  14805. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  14806. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  14807. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  14808. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  14809. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  14810. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  14811. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  14812. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  14813. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  14814. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  14815. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  14816. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  14817. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  14818. * `zipObject`, `zipObjectDeep`, and `zipWith`
  14819. *
  14820. * The wrapper methods that are **not** chainable by default are:
  14821. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  14822. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  14823. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  14824. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  14825. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  14826. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  14827. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  14828. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  14829. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  14830. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  14831. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  14832. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  14833. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  14834. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  14835. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  14836. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  14837. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  14838. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  14839. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  14840. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  14841. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  14842. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  14843. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  14844. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  14845. * `upperFirst`, `value`, and `words`
  14846. *
  14847. * @name _
  14848. * @constructor
  14849. * @category Seq
  14850. * @param {*} value The value to wrap in a `lodash` instance.
  14851. * @returns {Object} Returns the new `lodash` wrapper instance.
  14852. * @example
  14853. *
  14854. * function square(n) {
  14855. * return n * n;
  14856. * }
  14857. *
  14858. * var wrapped = _([1, 2, 3]);
  14859. *
  14860. * // Returns an unwrapped value.
  14861. * wrapped.reduce(_.add);
  14862. * // => 6
  14863. *
  14864. * // Returns a wrapped value.
  14865. * var squares = wrapped.map(square);
  14866. *
  14867. * _.isArray(squares);
  14868. * // => false
  14869. *
  14870. * _.isArray(squares.value());
  14871. * // => true
  14872. */
  14873. function lodash(value) {
  14874. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  14875. if (value instanceof LodashWrapper) {
  14876. return value;
  14877. }
  14878. if (hasOwnProperty.call(value, '__wrapped__')) {
  14879. return wrapperClone(value);
  14880. }
  14881. }
  14882. return new LodashWrapper(value);
  14883. }
  14884. /**
  14885. * The base implementation of `_.create` without support for assigning
  14886. * properties to the created object.
  14887. *
  14888. * @private
  14889. * @param {Object} proto The object to inherit from.
  14890. * @returns {Object} Returns the new object.
  14891. */
  14892. var baseCreate = (function() {
  14893. function object() {}
  14894. return function(proto) {
  14895. if (!isObject(proto)) {
  14896. return {};
  14897. }
  14898. if (objectCreate) {
  14899. return objectCreate(proto);
  14900. }
  14901. object.prototype = proto;
  14902. var result = new object;
  14903. object.prototype = undefined;
  14904. return result;
  14905. };
  14906. }());
  14907. /**
  14908. * The function whose prototype chain sequence wrappers inherit from.
  14909. *
  14910. * @private
  14911. */
  14912. function baseLodash() {
  14913. // No operation performed.
  14914. }
  14915. /**
  14916. * The base constructor for creating `lodash` wrapper objects.
  14917. *
  14918. * @private
  14919. * @param {*} value The value to wrap.
  14920. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  14921. */
  14922. function LodashWrapper(value, chainAll) {
  14923. this.__wrapped__ = value;
  14924. this.__actions__ = [];
  14925. this.__chain__ = !!chainAll;
  14926. this.__index__ = 0;
  14927. this.__values__ = undefined;
  14928. }
  14929. /**
  14930. * By default, the template delimiters used by lodash are like those in
  14931. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  14932. * following template settings to use alternative delimiters.
  14933. *
  14934. * @static
  14935. * @memberOf _
  14936. * @type {Object}
  14937. */
  14938. lodash.templateSettings = {
  14939. /**
  14940. * Used to detect `data` property values to be HTML-escaped.
  14941. *
  14942. * @memberOf _.templateSettings
  14943. * @type {RegExp}
  14944. */
  14945. 'escape': reEscape,
  14946. /**
  14947. * Used to detect code to be evaluated.
  14948. *
  14949. * @memberOf _.templateSettings
  14950. * @type {RegExp}
  14951. */
  14952. 'evaluate': reEvaluate,
  14953. /**
  14954. * Used to detect `data` property values to inject.
  14955. *
  14956. * @memberOf _.templateSettings
  14957. * @type {RegExp}
  14958. */
  14959. 'interpolate': reInterpolate,
  14960. /**
  14961. * Used to reference the data object in the template text.
  14962. *
  14963. * @memberOf _.templateSettings
  14964. * @type {string}
  14965. */
  14966. 'variable': '',
  14967. /**
  14968. * Used to import variables into the compiled template.
  14969. *
  14970. * @memberOf _.templateSettings
  14971. * @type {Object}
  14972. */
  14973. 'imports': {
  14974. /**
  14975. * A reference to the `lodash` function.
  14976. *
  14977. * @memberOf _.templateSettings.imports
  14978. * @type {Function}
  14979. */
  14980. '_': lodash
  14981. }
  14982. };
  14983. // Ensure wrappers are instances of `baseLodash`.
  14984. lodash.prototype = baseLodash.prototype;
  14985. lodash.prototype.constructor = lodash;
  14986. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  14987. LodashWrapper.prototype.constructor = LodashWrapper;
  14988. /*------------------------------------------------------------------------*/
  14989. /**
  14990. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  14991. *
  14992. * @private
  14993. * @constructor
  14994. * @param {*} value The value to wrap.
  14995. */
  14996. function LazyWrapper(value) {
  14997. this.__wrapped__ = value;
  14998. this.__actions__ = [];
  14999. this.__dir__ = 1;
  15000. this.__filtered__ = false;
  15001. this.__iteratees__ = [];
  15002. this.__takeCount__ = MAX_ARRAY_LENGTH;
  15003. this.__views__ = [];
  15004. }
  15005. /**
  15006. * Creates a clone of the lazy wrapper object.
  15007. *
  15008. * @private
  15009. * @name clone
  15010. * @memberOf LazyWrapper
  15011. * @returns {Object} Returns the cloned `LazyWrapper` object.
  15012. */
  15013. function lazyClone() {
  15014. var result = new LazyWrapper(this.__wrapped__);
  15015. result.__actions__ = copyArray(this.__actions__);
  15016. result.__dir__ = this.__dir__;
  15017. result.__filtered__ = this.__filtered__;
  15018. result.__iteratees__ = copyArray(this.__iteratees__);
  15019. result.__takeCount__ = this.__takeCount__;
  15020. result.__views__ = copyArray(this.__views__);
  15021. return result;
  15022. }
  15023. /**
  15024. * Reverses the direction of lazy iteration.
  15025. *
  15026. * @private
  15027. * @name reverse
  15028. * @memberOf LazyWrapper
  15029. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  15030. */
  15031. function lazyReverse() {
  15032. if (this.__filtered__) {
  15033. var result = new LazyWrapper(this);
  15034. result.__dir__ = -1;
  15035. result.__filtered__ = true;
  15036. } else {
  15037. result = this.clone();
  15038. result.__dir__ *= -1;
  15039. }
  15040. return result;
  15041. }
  15042. /**
  15043. * Extracts the unwrapped value from its lazy wrapper.
  15044. *
  15045. * @private
  15046. * @name value
  15047. * @memberOf LazyWrapper
  15048. * @returns {*} Returns the unwrapped value.
  15049. */
  15050. function lazyValue() {
  15051. var array = this.__wrapped__.value(),
  15052. dir = this.__dir__,
  15053. isArr = isArray(array),
  15054. isRight = dir < 0,
  15055. arrLength = isArr ? array.length : 0,
  15056. view = getView(0, arrLength, this.__views__),
  15057. start = view.start,
  15058. end = view.end,
  15059. length = end - start,
  15060. index = isRight ? end : (start - 1),
  15061. iteratees = this.__iteratees__,
  15062. iterLength = iteratees.length,
  15063. resIndex = 0,
  15064. takeCount = nativeMin(length, this.__takeCount__);
  15065. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  15066. return baseWrapperValue(array, this.__actions__);
  15067. }
  15068. var result = [];
  15069. outer:
  15070. while (length-- && resIndex < takeCount) {
  15071. index += dir;
  15072. var iterIndex = -1,
  15073. value = array[index];
  15074. while (++iterIndex < iterLength) {
  15075. var data = iteratees[iterIndex],
  15076. iteratee = data.iteratee,
  15077. type = data.type,
  15078. computed = iteratee(value);
  15079. if (type == LAZY_MAP_FLAG) {
  15080. value = computed;
  15081. } else if (!computed) {
  15082. if (type == LAZY_FILTER_FLAG) {
  15083. continue outer;
  15084. } else {
  15085. break outer;
  15086. }
  15087. }
  15088. }
  15089. result[resIndex++] = value;
  15090. }
  15091. return result;
  15092. }
  15093. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  15094. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  15095. LazyWrapper.prototype.constructor = LazyWrapper;
  15096. /*------------------------------------------------------------------------*/
  15097. /**
  15098. * Creates a hash object.
  15099. *
  15100. * @private
  15101. * @constructor
  15102. * @param {Array} [entries] The key-value pairs to cache.
  15103. */
  15104. function Hash(entries) {
  15105. var index = -1,
  15106. length = entries == null ? 0 : entries.length;
  15107. this.clear();
  15108. while (++index < length) {
  15109. var entry = entries[index];
  15110. this.set(entry[0], entry[1]);
  15111. }
  15112. }
  15113. /**
  15114. * Removes all key-value entries from the hash.
  15115. *
  15116. * @private
  15117. * @name clear
  15118. * @memberOf Hash
  15119. */
  15120. function hashClear() {
  15121. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  15122. this.size = 0;
  15123. }
  15124. /**
  15125. * Removes `key` and its value from the hash.
  15126. *
  15127. * @private
  15128. * @name delete
  15129. * @memberOf Hash
  15130. * @param {Object} hash The hash to modify.
  15131. * @param {string} key The key of the value to remove.
  15132. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15133. */
  15134. function hashDelete(key) {
  15135. var result = this.has(key) && delete this.__data__[key];
  15136. this.size -= result ? 1 : 0;
  15137. return result;
  15138. }
  15139. /**
  15140. * Gets the hash value for `key`.
  15141. *
  15142. * @private
  15143. * @name get
  15144. * @memberOf Hash
  15145. * @param {string} key The key of the value to get.
  15146. * @returns {*} Returns the entry value.
  15147. */
  15148. function hashGet(key) {
  15149. var data = this.__data__;
  15150. if (nativeCreate) {
  15151. var result = data[key];
  15152. return result === HASH_UNDEFINED ? undefined : result;
  15153. }
  15154. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  15155. }
  15156. /**
  15157. * Checks if a hash value for `key` exists.
  15158. *
  15159. * @private
  15160. * @name has
  15161. * @memberOf Hash
  15162. * @param {string} key The key of the entry to check.
  15163. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15164. */
  15165. function hashHas(key) {
  15166. var data = this.__data__;
  15167. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  15168. }
  15169. /**
  15170. * Sets the hash `key` to `value`.
  15171. *
  15172. * @private
  15173. * @name set
  15174. * @memberOf Hash
  15175. * @param {string} key The key of the value to set.
  15176. * @param {*} value The value to set.
  15177. * @returns {Object} Returns the hash instance.
  15178. */
  15179. function hashSet(key, value) {
  15180. var data = this.__data__;
  15181. this.size += this.has(key) ? 0 : 1;
  15182. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  15183. return this;
  15184. }
  15185. // Add methods to `Hash`.
  15186. Hash.prototype.clear = hashClear;
  15187. Hash.prototype['delete'] = hashDelete;
  15188. Hash.prototype.get = hashGet;
  15189. Hash.prototype.has = hashHas;
  15190. Hash.prototype.set = hashSet;
  15191. /*------------------------------------------------------------------------*/
  15192. /**
  15193. * Creates an list cache object.
  15194. *
  15195. * @private
  15196. * @constructor
  15197. * @param {Array} [entries] The key-value pairs to cache.
  15198. */
  15199. function ListCache(entries) {
  15200. var index = -1,
  15201. length = entries == null ? 0 : entries.length;
  15202. this.clear();
  15203. while (++index < length) {
  15204. var entry = entries[index];
  15205. this.set(entry[0], entry[1]);
  15206. }
  15207. }
  15208. /**
  15209. * Removes all key-value entries from the list cache.
  15210. *
  15211. * @private
  15212. * @name clear
  15213. * @memberOf ListCache
  15214. */
  15215. function listCacheClear() {
  15216. this.__data__ = [];
  15217. this.size = 0;
  15218. }
  15219. /**
  15220. * Removes `key` and its value from the list cache.
  15221. *
  15222. * @private
  15223. * @name delete
  15224. * @memberOf ListCache
  15225. * @param {string} key The key of the value to remove.
  15226. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15227. */
  15228. function listCacheDelete(key) {
  15229. var data = this.__data__,
  15230. index = assocIndexOf(data, key);
  15231. if (index < 0) {
  15232. return false;
  15233. }
  15234. var lastIndex = data.length - 1;
  15235. if (index == lastIndex) {
  15236. data.pop();
  15237. } else {
  15238. splice.call(data, index, 1);
  15239. }
  15240. --this.size;
  15241. return true;
  15242. }
  15243. /**
  15244. * Gets the list cache value for `key`.
  15245. *
  15246. * @private
  15247. * @name get
  15248. * @memberOf ListCache
  15249. * @param {string} key The key of the value to get.
  15250. * @returns {*} Returns the entry value.
  15251. */
  15252. function listCacheGet(key) {
  15253. var data = this.__data__,
  15254. index = assocIndexOf(data, key);
  15255. return index < 0 ? undefined : data[index][1];
  15256. }
  15257. /**
  15258. * Checks if a list cache value for `key` exists.
  15259. *
  15260. * @private
  15261. * @name has
  15262. * @memberOf ListCache
  15263. * @param {string} key The key of the entry to check.
  15264. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15265. */
  15266. function listCacheHas(key) {
  15267. return assocIndexOf(this.__data__, key) > -1;
  15268. }
  15269. /**
  15270. * Sets the list cache `key` to `value`.
  15271. *
  15272. * @private
  15273. * @name set
  15274. * @memberOf ListCache
  15275. * @param {string} key The key of the value to set.
  15276. * @param {*} value The value to set.
  15277. * @returns {Object} Returns the list cache instance.
  15278. */
  15279. function listCacheSet(key, value) {
  15280. var data = this.__data__,
  15281. index = assocIndexOf(data, key);
  15282. if (index < 0) {
  15283. ++this.size;
  15284. data.push([key, value]);
  15285. } else {
  15286. data[index][1] = value;
  15287. }
  15288. return this;
  15289. }
  15290. // Add methods to `ListCache`.
  15291. ListCache.prototype.clear = listCacheClear;
  15292. ListCache.prototype['delete'] = listCacheDelete;
  15293. ListCache.prototype.get = listCacheGet;
  15294. ListCache.prototype.has = listCacheHas;
  15295. ListCache.prototype.set = listCacheSet;
  15296. /*------------------------------------------------------------------------*/
  15297. /**
  15298. * Creates a map cache object to store key-value pairs.
  15299. *
  15300. * @private
  15301. * @constructor
  15302. * @param {Array} [entries] The key-value pairs to cache.
  15303. */
  15304. function MapCache(entries) {
  15305. var index = -1,
  15306. length = entries == null ? 0 : entries.length;
  15307. this.clear();
  15308. while (++index < length) {
  15309. var entry = entries[index];
  15310. this.set(entry[0], entry[1]);
  15311. }
  15312. }
  15313. /**
  15314. * Removes all key-value entries from the map.
  15315. *
  15316. * @private
  15317. * @name clear
  15318. * @memberOf MapCache
  15319. */
  15320. function mapCacheClear() {
  15321. this.size = 0;
  15322. this.__data__ = {
  15323. 'hash': new Hash,
  15324. 'map': new (Map || ListCache),
  15325. 'string': new Hash
  15326. };
  15327. }
  15328. /**
  15329. * Removes `key` and its value from the map.
  15330. *
  15331. * @private
  15332. * @name delete
  15333. * @memberOf MapCache
  15334. * @param {string} key The key of the value to remove.
  15335. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15336. */
  15337. function mapCacheDelete(key) {
  15338. var result = getMapData(this, key)['delete'](key);
  15339. this.size -= result ? 1 : 0;
  15340. return result;
  15341. }
  15342. /**
  15343. * Gets the map value for `key`.
  15344. *
  15345. * @private
  15346. * @name get
  15347. * @memberOf MapCache
  15348. * @param {string} key The key of the value to get.
  15349. * @returns {*} Returns the entry value.
  15350. */
  15351. function mapCacheGet(key) {
  15352. return getMapData(this, key).get(key);
  15353. }
  15354. /**
  15355. * Checks if a map value for `key` exists.
  15356. *
  15357. * @private
  15358. * @name has
  15359. * @memberOf MapCache
  15360. * @param {string} key The key of the entry to check.
  15361. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15362. */
  15363. function mapCacheHas(key) {
  15364. return getMapData(this, key).has(key);
  15365. }
  15366. /**
  15367. * Sets the map `key` to `value`.
  15368. *
  15369. * @private
  15370. * @name set
  15371. * @memberOf MapCache
  15372. * @param {string} key The key of the value to set.
  15373. * @param {*} value The value to set.
  15374. * @returns {Object} Returns the map cache instance.
  15375. */
  15376. function mapCacheSet(key, value) {
  15377. var data = getMapData(this, key),
  15378. size = data.size;
  15379. data.set(key, value);
  15380. this.size += data.size == size ? 0 : 1;
  15381. return this;
  15382. }
  15383. // Add methods to `MapCache`.
  15384. MapCache.prototype.clear = mapCacheClear;
  15385. MapCache.prototype['delete'] = mapCacheDelete;
  15386. MapCache.prototype.get = mapCacheGet;
  15387. MapCache.prototype.has = mapCacheHas;
  15388. MapCache.prototype.set = mapCacheSet;
  15389. /*------------------------------------------------------------------------*/
  15390. /**
  15391. *
  15392. * Creates an array cache object to store unique values.
  15393. *
  15394. * @private
  15395. * @constructor
  15396. * @param {Array} [values] The values to cache.
  15397. */
  15398. function SetCache(values) {
  15399. var index = -1,
  15400. length = values == null ? 0 : values.length;
  15401. this.__data__ = new MapCache;
  15402. while (++index < length) {
  15403. this.add(values[index]);
  15404. }
  15405. }
  15406. /**
  15407. * Adds `value` to the array cache.
  15408. *
  15409. * @private
  15410. * @name add
  15411. * @memberOf SetCache
  15412. * @alias push
  15413. * @param {*} value The value to cache.
  15414. * @returns {Object} Returns the cache instance.
  15415. */
  15416. function setCacheAdd(value) {
  15417. this.__data__.set(value, HASH_UNDEFINED);
  15418. return this;
  15419. }
  15420. /**
  15421. * Checks if `value` is in the array cache.
  15422. *
  15423. * @private
  15424. * @name has
  15425. * @memberOf SetCache
  15426. * @param {*} value The value to search for.
  15427. * @returns {number} Returns `true` if `value` is found, else `false`.
  15428. */
  15429. function setCacheHas(value) {
  15430. return this.__data__.has(value);
  15431. }
  15432. // Add methods to `SetCache`.
  15433. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  15434. SetCache.prototype.has = setCacheHas;
  15435. /*------------------------------------------------------------------------*/
  15436. /**
  15437. * Creates a stack cache object to store key-value pairs.
  15438. *
  15439. * @private
  15440. * @constructor
  15441. * @param {Array} [entries] The key-value pairs to cache.
  15442. */
  15443. function Stack(entries) {
  15444. var data = this.__data__ = new ListCache(entries);
  15445. this.size = data.size;
  15446. }
  15447. /**
  15448. * Removes all key-value entries from the stack.
  15449. *
  15450. * @private
  15451. * @name clear
  15452. * @memberOf Stack
  15453. */
  15454. function stackClear() {
  15455. this.__data__ = new ListCache;
  15456. this.size = 0;
  15457. }
  15458. /**
  15459. * Removes `key` and its value from the stack.
  15460. *
  15461. * @private
  15462. * @name delete
  15463. * @memberOf Stack
  15464. * @param {string} key The key of the value to remove.
  15465. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  15466. */
  15467. function stackDelete(key) {
  15468. var data = this.__data__,
  15469. result = data['delete'](key);
  15470. this.size = data.size;
  15471. return result;
  15472. }
  15473. /**
  15474. * Gets the stack value for `key`.
  15475. *
  15476. * @private
  15477. * @name get
  15478. * @memberOf Stack
  15479. * @param {string} key The key of the value to get.
  15480. * @returns {*} Returns the entry value.
  15481. */
  15482. function stackGet(key) {
  15483. return this.__data__.get(key);
  15484. }
  15485. /**
  15486. * Checks if a stack value for `key` exists.
  15487. *
  15488. * @private
  15489. * @name has
  15490. * @memberOf Stack
  15491. * @param {string} key The key of the entry to check.
  15492. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  15493. */
  15494. function stackHas(key) {
  15495. return this.__data__.has(key);
  15496. }
  15497. /**
  15498. * Sets the stack `key` to `value`.
  15499. *
  15500. * @private
  15501. * @name set
  15502. * @memberOf Stack
  15503. * @param {string} key The key of the value to set.
  15504. * @param {*} value The value to set.
  15505. * @returns {Object} Returns the stack cache instance.
  15506. */
  15507. function stackSet(key, value) {
  15508. var data = this.__data__;
  15509. if (data instanceof ListCache) {
  15510. var pairs = data.__data__;
  15511. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  15512. pairs.push([key, value]);
  15513. this.size = ++data.size;
  15514. return this;
  15515. }
  15516. data = this.__data__ = new MapCache(pairs);
  15517. }
  15518. data.set(key, value);
  15519. this.size = data.size;
  15520. return this;
  15521. }
  15522. // Add methods to `Stack`.
  15523. Stack.prototype.clear = stackClear;
  15524. Stack.prototype['delete'] = stackDelete;
  15525. Stack.prototype.get = stackGet;
  15526. Stack.prototype.has = stackHas;
  15527. Stack.prototype.set = stackSet;
  15528. /*------------------------------------------------------------------------*/
  15529. /**
  15530. * Creates an array of the enumerable property names of the array-like `value`.
  15531. *
  15532. * @private
  15533. * @param {*} value The value to query.
  15534. * @param {boolean} inherited Specify returning inherited property names.
  15535. * @returns {Array} Returns the array of property names.
  15536. */
  15537. function arrayLikeKeys(value, inherited) {
  15538. var isArr = isArray(value),
  15539. isArg = !isArr && isArguments(value),
  15540. isBuff = !isArr && !isArg && isBuffer(value),
  15541. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  15542. skipIndexes = isArr || isArg || isBuff || isType,
  15543. result = skipIndexes ? baseTimes(value.length, String) : [],
  15544. length = result.length;
  15545. for (var key in value) {
  15546. if ((inherited || hasOwnProperty.call(value, key)) &&
  15547. !(skipIndexes && (
  15548. // Safari 9 has enumerable `arguments.length` in strict mode.
  15549. key == 'length' ||
  15550. // Node.js 0.10 has enumerable non-index properties on buffers.
  15551. (isBuff && (key == 'offset' || key == 'parent')) ||
  15552. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  15553. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  15554. // Skip index properties.
  15555. isIndex(key, length)
  15556. ))) {
  15557. result.push(key);
  15558. }
  15559. }
  15560. return result;
  15561. }
  15562. /**
  15563. * A specialized version of `_.sample` for arrays.
  15564. *
  15565. * @private
  15566. * @param {Array} array The array to sample.
  15567. * @returns {*} Returns the random element.
  15568. */
  15569. function arraySample(array) {
  15570. var length = array.length;
  15571. return length ? array[baseRandom(0, length - 1)] : undefined;
  15572. }
  15573. /**
  15574. * A specialized version of `_.sampleSize` for arrays.
  15575. *
  15576. * @private
  15577. * @param {Array} array The array to sample.
  15578. * @param {number} n The number of elements to sample.
  15579. * @returns {Array} Returns the random elements.
  15580. */
  15581. function arraySampleSize(array, n) {
  15582. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  15583. }
  15584. /**
  15585. * A specialized version of `_.shuffle` for arrays.
  15586. *
  15587. * @private
  15588. * @param {Array} array The array to shuffle.
  15589. * @returns {Array} Returns the new shuffled array.
  15590. */
  15591. function arrayShuffle(array) {
  15592. return shuffleSelf(copyArray(array));
  15593. }
  15594. /**
  15595. * This function is like `assignValue` except that it doesn't assign
  15596. * `undefined` values.
  15597. *
  15598. * @private
  15599. * @param {Object} object The object to modify.
  15600. * @param {string} key The key of the property to assign.
  15601. * @param {*} value The value to assign.
  15602. */
  15603. function assignMergeValue(object, key, value) {
  15604. if ((value !== undefined && !eq(object[key], value)) ||
  15605. (value === undefined && !(key in object))) {
  15606. baseAssignValue(object, key, value);
  15607. }
  15608. }
  15609. /**
  15610. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  15611. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  15612. * for equality comparisons.
  15613. *
  15614. * @private
  15615. * @param {Object} object The object to modify.
  15616. * @param {string} key The key of the property to assign.
  15617. * @param {*} value The value to assign.
  15618. */
  15619. function assignValue(object, key, value) {
  15620. var objValue = object[key];
  15621. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  15622. (value === undefined && !(key in object))) {
  15623. baseAssignValue(object, key, value);
  15624. }
  15625. }
  15626. /**
  15627. * Gets the index at which the `key` is found in `array` of key-value pairs.
  15628. *
  15629. * @private
  15630. * @param {Array} array The array to inspect.
  15631. * @param {*} key The key to search for.
  15632. * @returns {number} Returns the index of the matched value, else `-1`.
  15633. */
  15634. function assocIndexOf(array, key) {
  15635. var length = array.length;
  15636. while (length--) {
  15637. if (eq(array[length][0], key)) {
  15638. return length;
  15639. }
  15640. }
  15641. return -1;
  15642. }
  15643. /**
  15644. * Aggregates elements of `collection` on `accumulator` with keys transformed
  15645. * by `iteratee` and values set by `setter`.
  15646. *
  15647. * @private
  15648. * @param {Array|Object} collection The collection to iterate over.
  15649. * @param {Function} setter The function to set `accumulator` values.
  15650. * @param {Function} iteratee The iteratee to transform keys.
  15651. * @param {Object} accumulator The initial aggregated object.
  15652. * @returns {Function} Returns `accumulator`.
  15653. */
  15654. function baseAggregator(collection, setter, iteratee, accumulator) {
  15655. baseEach(collection, function(value, key, collection) {
  15656. setter(accumulator, value, iteratee(value), collection);
  15657. });
  15658. return accumulator;
  15659. }
  15660. /**
  15661. * The base implementation of `_.assign` without support for multiple sources
  15662. * or `customizer` functions.
  15663. *
  15664. * @private
  15665. * @param {Object} object The destination object.
  15666. * @param {Object} source The source object.
  15667. * @returns {Object} Returns `object`.
  15668. */
  15669. function baseAssign(object, source) {
  15670. return object && copyObject(source, keys(source), object);
  15671. }
  15672. /**
  15673. * The base implementation of `_.assignIn` without support for multiple sources
  15674. * or `customizer` functions.
  15675. *
  15676. * @private
  15677. * @param {Object} object The destination object.
  15678. * @param {Object} source The source object.
  15679. * @returns {Object} Returns `object`.
  15680. */
  15681. function baseAssignIn(object, source) {
  15682. return object && copyObject(source, keysIn(source), object);
  15683. }
  15684. /**
  15685. * The base implementation of `assignValue` and `assignMergeValue` without
  15686. * value checks.
  15687. *
  15688. * @private
  15689. * @param {Object} object The object to modify.
  15690. * @param {string} key The key of the property to assign.
  15691. * @param {*} value The value to assign.
  15692. */
  15693. function baseAssignValue(object, key, value) {
  15694. if (key == '__proto__' && defineProperty) {
  15695. defineProperty(object, key, {
  15696. 'configurable': true,
  15697. 'enumerable': true,
  15698. 'value': value,
  15699. 'writable': true
  15700. });
  15701. } else {
  15702. object[key] = value;
  15703. }
  15704. }
  15705. /**
  15706. * The base implementation of `_.at` without support for individual paths.
  15707. *
  15708. * @private
  15709. * @param {Object} object The object to iterate over.
  15710. * @param {string[]} paths The property paths to pick.
  15711. * @returns {Array} Returns the picked elements.
  15712. */
  15713. function baseAt(object, paths) {
  15714. var index = -1,
  15715. length = paths.length,
  15716. result = Array(length),
  15717. skip = object == null;
  15718. while (++index < length) {
  15719. result[index] = skip ? undefined : get(object, paths[index]);
  15720. }
  15721. return result;
  15722. }
  15723. /**
  15724. * The base implementation of `_.clamp` which doesn't coerce arguments.
  15725. *
  15726. * @private
  15727. * @param {number} number The number to clamp.
  15728. * @param {number} [lower] The lower bound.
  15729. * @param {number} upper The upper bound.
  15730. * @returns {number} Returns the clamped number.
  15731. */
  15732. function baseClamp(number, lower, upper) {
  15733. if (number === number) {
  15734. if (upper !== undefined) {
  15735. number = number <= upper ? number : upper;
  15736. }
  15737. if (lower !== undefined) {
  15738. number = number >= lower ? number : lower;
  15739. }
  15740. }
  15741. return number;
  15742. }
  15743. /**
  15744. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  15745. * traversed objects.
  15746. *
  15747. * @private
  15748. * @param {*} value The value to clone.
  15749. * @param {boolean} bitmask The bitmask flags.
  15750. * 1 - Deep clone
  15751. * 2 - Flatten inherited properties
  15752. * 4 - Clone symbols
  15753. * @param {Function} [customizer] The function to customize cloning.
  15754. * @param {string} [key] The key of `value`.
  15755. * @param {Object} [object] The parent object of `value`.
  15756. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  15757. * @returns {*} Returns the cloned value.
  15758. */
  15759. function baseClone(value, bitmask, customizer, key, object, stack) {
  15760. var result,
  15761. isDeep = bitmask & CLONE_DEEP_FLAG,
  15762. isFlat = bitmask & CLONE_FLAT_FLAG,
  15763. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  15764. if (customizer) {
  15765. result = object ? customizer(value, key, object, stack) : customizer(value);
  15766. }
  15767. if (result !== undefined) {
  15768. return result;
  15769. }
  15770. if (!isObject(value)) {
  15771. return value;
  15772. }
  15773. var isArr = isArray(value);
  15774. if (isArr) {
  15775. result = initCloneArray(value);
  15776. if (!isDeep) {
  15777. return copyArray(value, result);
  15778. }
  15779. } else {
  15780. var tag = getTag(value),
  15781. isFunc = tag == funcTag || tag == genTag;
  15782. if (isBuffer(value)) {
  15783. return cloneBuffer(value, isDeep);
  15784. }
  15785. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  15786. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  15787. if (!isDeep) {
  15788. return isFlat
  15789. ? copySymbolsIn(value, baseAssignIn(result, value))
  15790. : copySymbols(value, baseAssign(result, value));
  15791. }
  15792. } else {
  15793. if (!cloneableTags[tag]) {
  15794. return object ? value : {};
  15795. }
  15796. result = initCloneByTag(value, tag, isDeep);
  15797. }
  15798. }
  15799. // Check for circular references and return its corresponding clone.
  15800. stack || (stack = new Stack);
  15801. var stacked = stack.get(value);
  15802. if (stacked) {
  15803. return stacked;
  15804. }
  15805. stack.set(value, result);
  15806. if (isSet(value)) {
  15807. value.forEach(function(subValue) {
  15808. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  15809. });
  15810. return result;
  15811. }
  15812. if (isMap(value)) {
  15813. value.forEach(function(subValue, key) {
  15814. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  15815. });
  15816. return result;
  15817. }
  15818. var keysFunc = isFull
  15819. ? (isFlat ? getAllKeysIn : getAllKeys)
  15820. : (isFlat ? keysIn : keys);
  15821. var props = isArr ? undefined : keysFunc(value);
  15822. arrayEach(props || value, function(subValue, key) {
  15823. if (props) {
  15824. key = subValue;
  15825. subValue = value[key];
  15826. }
  15827. // Recursively populate clone (susceptible to call stack limits).
  15828. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  15829. });
  15830. return result;
  15831. }
  15832. /**
  15833. * The base implementation of `_.conforms` which doesn't clone `source`.
  15834. *
  15835. * @private
  15836. * @param {Object} source The object of property predicates to conform to.
  15837. * @returns {Function} Returns the new spec function.
  15838. */
  15839. function baseConforms(source) {
  15840. var props = keys(source);
  15841. return function(object) {
  15842. return baseConformsTo(object, source, props);
  15843. };
  15844. }
  15845. /**
  15846. * The base implementation of `_.conformsTo` which accepts `props` to check.
  15847. *
  15848. * @private
  15849. * @param {Object} object The object to inspect.
  15850. * @param {Object} source The object of property predicates to conform to.
  15851. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  15852. */
  15853. function baseConformsTo(object, source, props) {
  15854. var length = props.length;
  15855. if (object == null) {
  15856. return !length;
  15857. }
  15858. object = Object(object);
  15859. while (length--) {
  15860. var key = props[length],
  15861. predicate = source[key],
  15862. value = object[key];
  15863. if ((value === undefined && !(key in object)) || !predicate(value)) {
  15864. return false;
  15865. }
  15866. }
  15867. return true;
  15868. }
  15869. /**
  15870. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  15871. * to provide to `func`.
  15872. *
  15873. * @private
  15874. * @param {Function} func The function to delay.
  15875. * @param {number} wait The number of milliseconds to delay invocation.
  15876. * @param {Array} args The arguments to provide to `func`.
  15877. * @returns {number|Object} Returns the timer id or timeout object.
  15878. */
  15879. function baseDelay(func, wait, args) {
  15880. if (typeof func != 'function') {
  15881. throw new TypeError(FUNC_ERROR_TEXT);
  15882. }
  15883. return setTimeout(function() { func.apply(undefined, args); }, wait);
  15884. }
  15885. /**
  15886. * The base implementation of methods like `_.difference` without support
  15887. * for excluding multiple arrays or iteratee shorthands.
  15888. *
  15889. * @private
  15890. * @param {Array} array The array to inspect.
  15891. * @param {Array} values The values to exclude.
  15892. * @param {Function} [iteratee] The iteratee invoked per element.
  15893. * @param {Function} [comparator] The comparator invoked per element.
  15894. * @returns {Array} Returns the new array of filtered values.
  15895. */
  15896. function baseDifference(array, values, iteratee, comparator) {
  15897. var index = -1,
  15898. includes = arrayIncludes,
  15899. isCommon = true,
  15900. length = array.length,
  15901. result = [],
  15902. valuesLength = values.length;
  15903. if (!length) {
  15904. return result;
  15905. }
  15906. if (iteratee) {
  15907. values = arrayMap(values, baseUnary(iteratee));
  15908. }
  15909. if (comparator) {
  15910. includes = arrayIncludesWith;
  15911. isCommon = false;
  15912. }
  15913. else if (values.length >= LARGE_ARRAY_SIZE) {
  15914. includes = cacheHas;
  15915. isCommon = false;
  15916. values = new SetCache(values);
  15917. }
  15918. outer:
  15919. while (++index < length) {
  15920. var value = array[index],
  15921. computed = iteratee == null ? value : iteratee(value);
  15922. value = (comparator || value !== 0) ? value : 0;
  15923. if (isCommon && computed === computed) {
  15924. var valuesIndex = valuesLength;
  15925. while (valuesIndex--) {
  15926. if (values[valuesIndex] === computed) {
  15927. continue outer;
  15928. }
  15929. }
  15930. result.push(value);
  15931. }
  15932. else if (!includes(values, computed, comparator)) {
  15933. result.push(value);
  15934. }
  15935. }
  15936. return result;
  15937. }
  15938. /**
  15939. * The base implementation of `_.forEach` without support for iteratee shorthands.
  15940. *
  15941. * @private
  15942. * @param {Array|Object} collection The collection to iterate over.
  15943. * @param {Function} iteratee The function invoked per iteration.
  15944. * @returns {Array|Object} Returns `collection`.
  15945. */
  15946. var baseEach = createBaseEach(baseForOwn);
  15947. /**
  15948. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  15949. *
  15950. * @private
  15951. * @param {Array|Object} collection The collection to iterate over.
  15952. * @param {Function} iteratee The function invoked per iteration.
  15953. * @returns {Array|Object} Returns `collection`.
  15954. */
  15955. var baseEachRight = createBaseEach(baseForOwnRight, true);
  15956. /**
  15957. * The base implementation of `_.every` without support for iteratee shorthands.
  15958. *
  15959. * @private
  15960. * @param {Array|Object} collection The collection to iterate over.
  15961. * @param {Function} predicate The function invoked per iteration.
  15962. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  15963. * else `false`
  15964. */
  15965. function baseEvery(collection, predicate) {
  15966. var result = true;
  15967. baseEach(collection, function(value, index, collection) {
  15968. result = !!predicate(value, index, collection);
  15969. return result;
  15970. });
  15971. return result;
  15972. }
  15973. /**
  15974. * The base implementation of methods like `_.max` and `_.min` which accepts a
  15975. * `comparator` to determine the extremum value.
  15976. *
  15977. * @private
  15978. * @param {Array} array The array to iterate over.
  15979. * @param {Function} iteratee The iteratee invoked per iteration.
  15980. * @param {Function} comparator The comparator used to compare values.
  15981. * @returns {*} Returns the extremum value.
  15982. */
  15983. function baseExtremum(array, iteratee, comparator) {
  15984. var index = -1,
  15985. length = array.length;
  15986. while (++index < length) {
  15987. var value = array[index],
  15988. current = iteratee(value);
  15989. if (current != null && (computed === undefined
  15990. ? (current === current && !isSymbol(current))
  15991. : comparator(current, computed)
  15992. )) {
  15993. var computed = current,
  15994. result = value;
  15995. }
  15996. }
  15997. return result;
  15998. }
  15999. /**
  16000. * The base implementation of `_.fill` without an iteratee call guard.
  16001. *
  16002. * @private
  16003. * @param {Array} array The array to fill.
  16004. * @param {*} value The value to fill `array` with.
  16005. * @param {number} [start=0] The start position.
  16006. * @param {number} [end=array.length] The end position.
  16007. * @returns {Array} Returns `array`.
  16008. */
  16009. function baseFill(array, value, start, end) {
  16010. var length = array.length;
  16011. start = toInteger(start);
  16012. if (start < 0) {
  16013. start = -start > length ? 0 : (length + start);
  16014. }
  16015. end = (end === undefined || end > length) ? length : toInteger(end);
  16016. if (end < 0) {
  16017. end += length;
  16018. }
  16019. end = start > end ? 0 : toLength(end);
  16020. while (start < end) {
  16021. array[start++] = value;
  16022. }
  16023. return array;
  16024. }
  16025. /**
  16026. * The base implementation of `_.filter` without support for iteratee shorthands.
  16027. *
  16028. * @private
  16029. * @param {Array|Object} collection The collection to iterate over.
  16030. * @param {Function} predicate The function invoked per iteration.
  16031. * @returns {Array} Returns the new filtered array.
  16032. */
  16033. function baseFilter(collection, predicate) {
  16034. var result = [];
  16035. baseEach(collection, function(value, index, collection) {
  16036. if (predicate(value, index, collection)) {
  16037. result.push(value);
  16038. }
  16039. });
  16040. return result;
  16041. }
  16042. /**
  16043. * The base implementation of `_.flatten` with support for restricting flattening.
  16044. *
  16045. * @private
  16046. * @param {Array} array The array to flatten.
  16047. * @param {number} depth The maximum recursion depth.
  16048. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  16049. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  16050. * @param {Array} [result=[]] The initial result value.
  16051. * @returns {Array} Returns the new flattened array.
  16052. */
  16053. function baseFlatten(array, depth, predicate, isStrict, result) {
  16054. var index = -1,
  16055. length = array.length;
  16056. predicate || (predicate = isFlattenable);
  16057. result || (result = []);
  16058. while (++index < length) {
  16059. var value = array[index];
  16060. if (depth > 0 && predicate(value)) {
  16061. if (depth > 1) {
  16062. // Recursively flatten arrays (susceptible to call stack limits).
  16063. baseFlatten(value, depth - 1, predicate, isStrict, result);
  16064. } else {
  16065. arrayPush(result, value);
  16066. }
  16067. } else if (!isStrict) {
  16068. result[result.length] = value;
  16069. }
  16070. }
  16071. return result;
  16072. }
  16073. /**
  16074. * The base implementation of `baseForOwn` which iterates over `object`
  16075. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  16076. * Iteratee functions may exit iteration early by explicitly returning `false`.
  16077. *
  16078. * @private
  16079. * @param {Object} object The object to iterate over.
  16080. * @param {Function} iteratee The function invoked per iteration.
  16081. * @param {Function} keysFunc The function to get the keys of `object`.
  16082. * @returns {Object} Returns `object`.
  16083. */
  16084. var baseFor = createBaseFor();
  16085. /**
  16086. * This function is like `baseFor` except that it iterates over properties
  16087. * in the opposite order.
  16088. *
  16089. * @private
  16090. * @param {Object} object The object to iterate over.
  16091. * @param {Function} iteratee The function invoked per iteration.
  16092. * @param {Function} keysFunc The function to get the keys of `object`.
  16093. * @returns {Object} Returns `object`.
  16094. */
  16095. var baseForRight = createBaseFor(true);
  16096. /**
  16097. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  16098. *
  16099. * @private
  16100. * @param {Object} object The object to iterate over.
  16101. * @param {Function} iteratee The function invoked per iteration.
  16102. * @returns {Object} Returns `object`.
  16103. */
  16104. function baseForOwn(object, iteratee) {
  16105. return object && baseFor(object, iteratee, keys);
  16106. }
  16107. /**
  16108. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  16109. *
  16110. * @private
  16111. * @param {Object} object The object to iterate over.
  16112. * @param {Function} iteratee The function invoked per iteration.
  16113. * @returns {Object} Returns `object`.
  16114. */
  16115. function baseForOwnRight(object, iteratee) {
  16116. return object && baseForRight(object, iteratee, keys);
  16117. }
  16118. /**
  16119. * The base implementation of `_.functions` which creates an array of
  16120. * `object` function property names filtered from `props`.
  16121. *
  16122. * @private
  16123. * @param {Object} object The object to inspect.
  16124. * @param {Array} props The property names to filter.
  16125. * @returns {Array} Returns the function names.
  16126. */
  16127. function baseFunctions(object, props) {
  16128. return arrayFilter(props, function(key) {
  16129. return isFunction(object[key]);
  16130. });
  16131. }
  16132. /**
  16133. * The base implementation of `_.get` without support for default values.
  16134. *
  16135. * @private
  16136. * @param {Object} object The object to query.
  16137. * @param {Array|string} path The path of the property to get.
  16138. * @returns {*} Returns the resolved value.
  16139. */
  16140. function baseGet(object, path) {
  16141. path = castPath(path, object);
  16142. var index = 0,
  16143. length = path.length;
  16144. while (object != null && index < length) {
  16145. object = object[toKey(path[index++])];
  16146. }
  16147. return (index && index == length) ? object : undefined;
  16148. }
  16149. /**
  16150. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  16151. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  16152. * symbols of `object`.
  16153. *
  16154. * @private
  16155. * @param {Object} object The object to query.
  16156. * @param {Function} keysFunc The function to get the keys of `object`.
  16157. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  16158. * @returns {Array} Returns the array of property names and symbols.
  16159. */
  16160. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  16161. var result = keysFunc(object);
  16162. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  16163. }
  16164. /**
  16165. * The base implementation of `getTag` without fallbacks for buggy environments.
  16166. *
  16167. * @private
  16168. * @param {*} value The value to query.
  16169. * @returns {string} Returns the `toStringTag`.
  16170. */
  16171. function baseGetTag(value) {
  16172. if (value == null) {
  16173. return value === undefined ? undefinedTag : nullTag;
  16174. }
  16175. return (symToStringTag && symToStringTag in Object(value))
  16176. ? getRawTag(value)
  16177. : objectToString(value);
  16178. }
  16179. /**
  16180. * The base implementation of `_.gt` which doesn't coerce arguments.
  16181. *
  16182. * @private
  16183. * @param {*} value The value to compare.
  16184. * @param {*} other The other value to compare.
  16185. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  16186. * else `false`.
  16187. */
  16188. function baseGt(value, other) {
  16189. return value > other;
  16190. }
  16191. /**
  16192. * The base implementation of `_.has` without support for deep paths.
  16193. *
  16194. * @private
  16195. * @param {Object} [object] The object to query.
  16196. * @param {Array|string} key The key to check.
  16197. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  16198. */
  16199. function baseHas(object, key) {
  16200. return object != null && hasOwnProperty.call(object, key);
  16201. }
  16202. /**
  16203. * The base implementation of `_.hasIn` without support for deep paths.
  16204. *
  16205. * @private
  16206. * @param {Object} [object] The object to query.
  16207. * @param {Array|string} key The key to check.
  16208. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  16209. */
  16210. function baseHasIn(object, key) {
  16211. return object != null && key in Object(object);
  16212. }
  16213. /**
  16214. * The base implementation of `_.inRange` which doesn't coerce arguments.
  16215. *
  16216. * @private
  16217. * @param {number} number The number to check.
  16218. * @param {number} start The start of the range.
  16219. * @param {number} end The end of the range.
  16220. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  16221. */
  16222. function baseInRange(number, start, end) {
  16223. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  16224. }
  16225. /**
  16226. * The base implementation of methods like `_.intersection`, without support
  16227. * for iteratee shorthands, that accepts an array of arrays to inspect.
  16228. *
  16229. * @private
  16230. * @param {Array} arrays The arrays to inspect.
  16231. * @param {Function} [iteratee] The iteratee invoked per element.
  16232. * @param {Function} [comparator] The comparator invoked per element.
  16233. * @returns {Array} Returns the new array of shared values.
  16234. */
  16235. function baseIntersection(arrays, iteratee, comparator) {
  16236. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  16237. length = arrays[0].length,
  16238. othLength = arrays.length,
  16239. othIndex = othLength,
  16240. caches = Array(othLength),
  16241. maxLength = Infinity,
  16242. result = [];
  16243. while (othIndex--) {
  16244. var array = arrays[othIndex];
  16245. if (othIndex && iteratee) {
  16246. array = arrayMap(array, baseUnary(iteratee));
  16247. }
  16248. maxLength = nativeMin(array.length, maxLength);
  16249. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  16250. ? new SetCache(othIndex && array)
  16251. : undefined;
  16252. }
  16253. array = arrays[0];
  16254. var index = -1,
  16255. seen = caches[0];
  16256. outer:
  16257. while (++index < length && result.length < maxLength) {
  16258. var value = array[index],
  16259. computed = iteratee ? iteratee(value) : value;
  16260. value = (comparator || value !== 0) ? value : 0;
  16261. if (!(seen
  16262. ? cacheHas(seen, computed)
  16263. : includes(result, computed, comparator)
  16264. )) {
  16265. othIndex = othLength;
  16266. while (--othIndex) {
  16267. var cache = caches[othIndex];
  16268. if (!(cache
  16269. ? cacheHas(cache, computed)
  16270. : includes(arrays[othIndex], computed, comparator))
  16271. ) {
  16272. continue outer;
  16273. }
  16274. }
  16275. if (seen) {
  16276. seen.push(computed);
  16277. }
  16278. result.push(value);
  16279. }
  16280. }
  16281. return result;
  16282. }
  16283. /**
  16284. * The base implementation of `_.invert` and `_.invertBy` which inverts
  16285. * `object` with values transformed by `iteratee` and set by `setter`.
  16286. *
  16287. * @private
  16288. * @param {Object} object The object to iterate over.
  16289. * @param {Function} setter The function to set `accumulator` values.
  16290. * @param {Function} iteratee The iteratee to transform values.
  16291. * @param {Object} accumulator The initial inverted object.
  16292. * @returns {Function} Returns `accumulator`.
  16293. */
  16294. function baseInverter(object, setter, iteratee, accumulator) {
  16295. baseForOwn(object, function(value, key, object) {
  16296. setter(accumulator, iteratee(value), key, object);
  16297. });
  16298. return accumulator;
  16299. }
  16300. /**
  16301. * The base implementation of `_.invoke` without support for individual
  16302. * method arguments.
  16303. *
  16304. * @private
  16305. * @param {Object} object The object to query.
  16306. * @param {Array|string} path The path of the method to invoke.
  16307. * @param {Array} args The arguments to invoke the method with.
  16308. * @returns {*} Returns the result of the invoked method.
  16309. */
  16310. function baseInvoke(object, path, args) {
  16311. path = castPath(path, object);
  16312. object = parent(object, path);
  16313. var func = object == null ? object : object[toKey(last(path))];
  16314. return func == null ? undefined : apply(func, object, args);
  16315. }
  16316. /**
  16317. * The base implementation of `_.isArguments`.
  16318. *
  16319. * @private
  16320. * @param {*} value The value to check.
  16321. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  16322. */
  16323. function baseIsArguments(value) {
  16324. return isObjectLike(value) && baseGetTag(value) == argsTag;
  16325. }
  16326. /**
  16327. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  16328. *
  16329. * @private
  16330. * @param {*} value The value to check.
  16331. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  16332. */
  16333. function baseIsArrayBuffer(value) {
  16334. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  16335. }
  16336. /**
  16337. * The base implementation of `_.isDate` without Node.js optimizations.
  16338. *
  16339. * @private
  16340. * @param {*} value The value to check.
  16341. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  16342. */
  16343. function baseIsDate(value) {
  16344. return isObjectLike(value) && baseGetTag(value) == dateTag;
  16345. }
  16346. /**
  16347. * The base implementation of `_.isEqual` which supports partial comparisons
  16348. * and tracks traversed objects.
  16349. *
  16350. * @private
  16351. * @param {*} value The value to compare.
  16352. * @param {*} other The other value to compare.
  16353. * @param {boolean} bitmask The bitmask flags.
  16354. * 1 - Unordered comparison
  16355. * 2 - Partial comparison
  16356. * @param {Function} [customizer] The function to customize comparisons.
  16357. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  16358. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  16359. */
  16360. function baseIsEqual(value, other, bitmask, customizer, stack) {
  16361. if (value === other) {
  16362. return true;
  16363. }
  16364. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  16365. return value !== value && other !== other;
  16366. }
  16367. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  16368. }
  16369. /**
  16370. * A specialized version of `baseIsEqual` for arrays and objects which performs
  16371. * deep comparisons and tracks traversed objects enabling objects with circular
  16372. * references to be compared.
  16373. *
  16374. * @private
  16375. * @param {Object} object The object to compare.
  16376. * @param {Object} other The other object to compare.
  16377. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  16378. * @param {Function} customizer The function to customize comparisons.
  16379. * @param {Function} equalFunc The function to determine equivalents of values.
  16380. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  16381. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  16382. */
  16383. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  16384. var objIsArr = isArray(object),
  16385. othIsArr = isArray(other),
  16386. objTag = objIsArr ? arrayTag : getTag(object),
  16387. othTag = othIsArr ? arrayTag : getTag(other);
  16388. objTag = objTag == argsTag ? objectTag : objTag;
  16389. othTag = othTag == argsTag ? objectTag : othTag;
  16390. var objIsObj = objTag == objectTag,
  16391. othIsObj = othTag == objectTag,
  16392. isSameTag = objTag == othTag;
  16393. if (isSameTag && isBuffer(object)) {
  16394. if (!isBuffer(other)) {
  16395. return false;
  16396. }
  16397. objIsArr = true;
  16398. objIsObj = false;
  16399. }
  16400. if (isSameTag && !objIsObj) {
  16401. stack || (stack = new Stack);
  16402. return (objIsArr || isTypedArray(object))
  16403. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  16404. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  16405. }
  16406. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  16407. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  16408. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  16409. if (objIsWrapped || othIsWrapped) {
  16410. var objUnwrapped = objIsWrapped ? object.value() : object,
  16411. othUnwrapped = othIsWrapped ? other.value() : other;
  16412. stack || (stack = new Stack);
  16413. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  16414. }
  16415. }
  16416. if (!isSameTag) {
  16417. return false;
  16418. }
  16419. stack || (stack = new Stack);
  16420. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  16421. }
  16422. /**
  16423. * The base implementation of `_.isMap` without Node.js optimizations.
  16424. *
  16425. * @private
  16426. * @param {*} value The value to check.
  16427. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  16428. */
  16429. function baseIsMap(value) {
  16430. return isObjectLike(value) && getTag(value) == mapTag;
  16431. }
  16432. /**
  16433. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  16434. *
  16435. * @private
  16436. * @param {Object} object The object to inspect.
  16437. * @param {Object} source The object of property values to match.
  16438. * @param {Array} matchData The property names, values, and compare flags to match.
  16439. * @param {Function} [customizer] The function to customize comparisons.
  16440. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  16441. */
  16442. function baseIsMatch(object, source, matchData, customizer) {
  16443. var index = matchData.length,
  16444. length = index,
  16445. noCustomizer = !customizer;
  16446. if (object == null) {
  16447. return !length;
  16448. }
  16449. object = Object(object);
  16450. while (index--) {
  16451. var data = matchData[index];
  16452. if ((noCustomizer && data[2])
  16453. ? data[1] !== object[data[0]]
  16454. : !(data[0] in object)
  16455. ) {
  16456. return false;
  16457. }
  16458. }
  16459. while (++index < length) {
  16460. data = matchData[index];
  16461. var key = data[0],
  16462. objValue = object[key],
  16463. srcValue = data[1];
  16464. if (noCustomizer && data[2]) {
  16465. if (objValue === undefined && !(key in object)) {
  16466. return false;
  16467. }
  16468. } else {
  16469. var stack = new Stack;
  16470. if (customizer) {
  16471. var result = customizer(objValue, srcValue, key, object, source, stack);
  16472. }
  16473. if (!(result === undefined
  16474. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  16475. : result
  16476. )) {
  16477. return false;
  16478. }
  16479. }
  16480. }
  16481. return true;
  16482. }
  16483. /**
  16484. * The base implementation of `_.isNative` without bad shim checks.
  16485. *
  16486. * @private
  16487. * @param {*} value The value to check.
  16488. * @returns {boolean} Returns `true` if `value` is a native function,
  16489. * else `false`.
  16490. */
  16491. function baseIsNative(value) {
  16492. if (!isObject(value) || isMasked(value)) {
  16493. return false;
  16494. }
  16495. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  16496. return pattern.test(toSource(value));
  16497. }
  16498. /**
  16499. * The base implementation of `_.isRegExp` without Node.js optimizations.
  16500. *
  16501. * @private
  16502. * @param {*} value The value to check.
  16503. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  16504. */
  16505. function baseIsRegExp(value) {
  16506. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  16507. }
  16508. /**
  16509. * The base implementation of `_.isSet` without Node.js optimizations.
  16510. *
  16511. * @private
  16512. * @param {*} value The value to check.
  16513. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  16514. */
  16515. function baseIsSet(value) {
  16516. return isObjectLike(value) && getTag(value) == setTag;
  16517. }
  16518. /**
  16519. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  16520. *
  16521. * @private
  16522. * @param {*} value The value to check.
  16523. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  16524. */
  16525. function baseIsTypedArray(value) {
  16526. return isObjectLike(value) &&
  16527. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  16528. }
  16529. /**
  16530. * The base implementation of `_.iteratee`.
  16531. *
  16532. * @private
  16533. * @param {*} [value=_.identity] The value to convert to an iteratee.
  16534. * @returns {Function} Returns the iteratee.
  16535. */
  16536. function baseIteratee(value) {
  16537. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  16538. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  16539. if (typeof value == 'function') {
  16540. return value;
  16541. }
  16542. if (value == null) {
  16543. return identity;
  16544. }
  16545. if (typeof value == 'object') {
  16546. return isArray(value)
  16547. ? baseMatchesProperty(value[0], value[1])
  16548. : baseMatches(value);
  16549. }
  16550. return property(value);
  16551. }
  16552. /**
  16553. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  16554. *
  16555. * @private
  16556. * @param {Object} object The object to query.
  16557. * @returns {Array} Returns the array of property names.
  16558. */
  16559. function baseKeys(object) {
  16560. if (!isPrototype(object)) {
  16561. return nativeKeys(object);
  16562. }
  16563. var result = [];
  16564. for (var key in Object(object)) {
  16565. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  16566. result.push(key);
  16567. }
  16568. }
  16569. return result;
  16570. }
  16571. /**
  16572. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  16573. *
  16574. * @private
  16575. * @param {Object} object The object to query.
  16576. * @returns {Array} Returns the array of property names.
  16577. */
  16578. function baseKeysIn(object) {
  16579. if (!isObject(object)) {
  16580. return nativeKeysIn(object);
  16581. }
  16582. var isProto = isPrototype(object),
  16583. result = [];
  16584. for (var key in object) {
  16585. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  16586. result.push(key);
  16587. }
  16588. }
  16589. return result;
  16590. }
  16591. /**
  16592. * The base implementation of `_.lt` which doesn't coerce arguments.
  16593. *
  16594. * @private
  16595. * @param {*} value The value to compare.
  16596. * @param {*} other The other value to compare.
  16597. * @returns {boolean} Returns `true` if `value` is less than `other`,
  16598. * else `false`.
  16599. */
  16600. function baseLt(value, other) {
  16601. return value < other;
  16602. }
  16603. /**
  16604. * The base implementation of `_.map` without support for iteratee shorthands.
  16605. *
  16606. * @private
  16607. * @param {Array|Object} collection The collection to iterate over.
  16608. * @param {Function} iteratee The function invoked per iteration.
  16609. * @returns {Array} Returns the new mapped array.
  16610. */
  16611. function baseMap(collection, iteratee) {
  16612. var index = -1,
  16613. result = isArrayLike(collection) ? Array(collection.length) : [];
  16614. baseEach(collection, function(value, key, collection) {
  16615. result[++index] = iteratee(value, key, collection);
  16616. });
  16617. return result;
  16618. }
  16619. /**
  16620. * The base implementation of `_.matches` which doesn't clone `source`.
  16621. *
  16622. * @private
  16623. * @param {Object} source The object of property values to match.
  16624. * @returns {Function} Returns the new spec function.
  16625. */
  16626. function baseMatches(source) {
  16627. var matchData = getMatchData(source);
  16628. if (matchData.length == 1 && matchData[0][2]) {
  16629. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  16630. }
  16631. return function(object) {
  16632. return object === source || baseIsMatch(object, source, matchData);
  16633. };
  16634. }
  16635. /**
  16636. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  16637. *
  16638. * @private
  16639. * @param {string} path The path of the property to get.
  16640. * @param {*} srcValue The value to match.
  16641. * @returns {Function} Returns the new spec function.
  16642. */
  16643. function baseMatchesProperty(path, srcValue) {
  16644. if (isKey(path) && isStrictComparable(srcValue)) {
  16645. return matchesStrictComparable(toKey(path), srcValue);
  16646. }
  16647. return function(object) {
  16648. var objValue = get(object, path);
  16649. return (objValue === undefined && objValue === srcValue)
  16650. ? hasIn(object, path)
  16651. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  16652. };
  16653. }
  16654. /**
  16655. * The base implementation of `_.merge` without support for multiple sources.
  16656. *
  16657. * @private
  16658. * @param {Object} object The destination object.
  16659. * @param {Object} source The source object.
  16660. * @param {number} srcIndex The index of `source`.
  16661. * @param {Function} [customizer] The function to customize merged values.
  16662. * @param {Object} [stack] Tracks traversed source values and their merged
  16663. * counterparts.
  16664. */
  16665. function baseMerge(object, source, srcIndex, customizer, stack) {
  16666. if (object === source) {
  16667. return;
  16668. }
  16669. baseFor(source, function(srcValue, key) {
  16670. if (isObject(srcValue)) {
  16671. stack || (stack = new Stack);
  16672. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  16673. }
  16674. else {
  16675. var newValue = customizer
  16676. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  16677. : undefined;
  16678. if (newValue === undefined) {
  16679. newValue = srcValue;
  16680. }
  16681. assignMergeValue(object, key, newValue);
  16682. }
  16683. }, keysIn);
  16684. }
  16685. /**
  16686. * A specialized version of `baseMerge` for arrays and objects which performs
  16687. * deep merges and tracks traversed objects enabling objects with circular
  16688. * references to be merged.
  16689. *
  16690. * @private
  16691. * @param {Object} object The destination object.
  16692. * @param {Object} source The source object.
  16693. * @param {string} key The key of the value to merge.
  16694. * @param {number} srcIndex The index of `source`.
  16695. * @param {Function} mergeFunc The function to merge values.
  16696. * @param {Function} [customizer] The function to customize assigned values.
  16697. * @param {Object} [stack] Tracks traversed source values and their merged
  16698. * counterparts.
  16699. */
  16700. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  16701. var objValue = safeGet(object, key),
  16702. srcValue = safeGet(source, key),
  16703. stacked = stack.get(srcValue);
  16704. if (stacked) {
  16705. assignMergeValue(object, key, stacked);
  16706. return;
  16707. }
  16708. var newValue = customizer
  16709. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  16710. : undefined;
  16711. var isCommon = newValue === undefined;
  16712. if (isCommon) {
  16713. var isArr = isArray(srcValue),
  16714. isBuff = !isArr && isBuffer(srcValue),
  16715. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  16716. newValue = srcValue;
  16717. if (isArr || isBuff || isTyped) {
  16718. if (isArray(objValue)) {
  16719. newValue = objValue;
  16720. }
  16721. else if (isArrayLikeObject(objValue)) {
  16722. newValue = copyArray(objValue);
  16723. }
  16724. else if (isBuff) {
  16725. isCommon = false;
  16726. newValue = cloneBuffer(srcValue, true);
  16727. }
  16728. else if (isTyped) {
  16729. isCommon = false;
  16730. newValue = cloneTypedArray(srcValue, true);
  16731. }
  16732. else {
  16733. newValue = [];
  16734. }
  16735. }
  16736. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  16737. newValue = objValue;
  16738. if (isArguments(objValue)) {
  16739. newValue = toPlainObject(objValue);
  16740. }
  16741. else if (!isObject(objValue) || isFunction(objValue)) {
  16742. newValue = initCloneObject(srcValue);
  16743. }
  16744. }
  16745. else {
  16746. isCommon = false;
  16747. }
  16748. }
  16749. if (isCommon) {
  16750. // Recursively merge objects and arrays (susceptible to call stack limits).
  16751. stack.set(srcValue, newValue);
  16752. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  16753. stack['delete'](srcValue);
  16754. }
  16755. assignMergeValue(object, key, newValue);
  16756. }
  16757. /**
  16758. * The base implementation of `_.nth` which doesn't coerce arguments.
  16759. *
  16760. * @private
  16761. * @param {Array} array The array to query.
  16762. * @param {number} n The index of the element to return.
  16763. * @returns {*} Returns the nth element of `array`.
  16764. */
  16765. function baseNth(array, n) {
  16766. var length = array.length;
  16767. if (!length) {
  16768. return;
  16769. }
  16770. n += n < 0 ? length : 0;
  16771. return isIndex(n, length) ? array[n] : undefined;
  16772. }
  16773. /**
  16774. * The base implementation of `_.orderBy` without param guards.
  16775. *
  16776. * @private
  16777. * @param {Array|Object} collection The collection to iterate over.
  16778. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  16779. * @param {string[]} orders The sort orders of `iteratees`.
  16780. * @returns {Array} Returns the new sorted array.
  16781. */
  16782. function baseOrderBy(collection, iteratees, orders) {
  16783. var index = -1;
  16784. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  16785. var result = baseMap(collection, function(value, key, collection) {
  16786. var criteria = arrayMap(iteratees, function(iteratee) {
  16787. return iteratee(value);
  16788. });
  16789. return { 'criteria': criteria, 'index': ++index, 'value': value };
  16790. });
  16791. return baseSortBy(result, function(object, other) {
  16792. return compareMultiple(object, other, orders);
  16793. });
  16794. }
  16795. /**
  16796. * The base implementation of `_.pick` without support for individual
  16797. * property identifiers.
  16798. *
  16799. * @private
  16800. * @param {Object} object The source object.
  16801. * @param {string[]} paths The property paths to pick.
  16802. * @returns {Object} Returns the new object.
  16803. */
  16804. function basePick(object, paths) {
  16805. return basePickBy(object, paths, function(value, path) {
  16806. return hasIn(object, path);
  16807. });
  16808. }
  16809. /**
  16810. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  16811. *
  16812. * @private
  16813. * @param {Object} object The source object.
  16814. * @param {string[]} paths The property paths to pick.
  16815. * @param {Function} predicate The function invoked per property.
  16816. * @returns {Object} Returns the new object.
  16817. */
  16818. function basePickBy(object, paths, predicate) {
  16819. var index = -1,
  16820. length = paths.length,
  16821. result = {};
  16822. while (++index < length) {
  16823. var path = paths[index],
  16824. value = baseGet(object, path);
  16825. if (predicate(value, path)) {
  16826. baseSet(result, castPath(path, object), value);
  16827. }
  16828. }
  16829. return result;
  16830. }
  16831. /**
  16832. * A specialized version of `baseProperty` which supports deep paths.
  16833. *
  16834. * @private
  16835. * @param {Array|string} path The path of the property to get.
  16836. * @returns {Function} Returns the new accessor function.
  16837. */
  16838. function basePropertyDeep(path) {
  16839. return function(object) {
  16840. return baseGet(object, path);
  16841. };
  16842. }
  16843. /**
  16844. * The base implementation of `_.pullAllBy` without support for iteratee
  16845. * shorthands.
  16846. *
  16847. * @private
  16848. * @param {Array} array The array to modify.
  16849. * @param {Array} values The values to remove.
  16850. * @param {Function} [iteratee] The iteratee invoked per element.
  16851. * @param {Function} [comparator] The comparator invoked per element.
  16852. * @returns {Array} Returns `array`.
  16853. */
  16854. function basePullAll(array, values, iteratee, comparator) {
  16855. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  16856. index = -1,
  16857. length = values.length,
  16858. seen = array;
  16859. if (array === values) {
  16860. values = copyArray(values);
  16861. }
  16862. if (iteratee) {
  16863. seen = arrayMap(array, baseUnary(iteratee));
  16864. }
  16865. while (++index < length) {
  16866. var fromIndex = 0,
  16867. value = values[index],
  16868. computed = iteratee ? iteratee(value) : value;
  16869. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  16870. if (seen !== array) {
  16871. splice.call(seen, fromIndex, 1);
  16872. }
  16873. splice.call(array, fromIndex, 1);
  16874. }
  16875. }
  16876. return array;
  16877. }
  16878. /**
  16879. * The base implementation of `_.pullAt` without support for individual
  16880. * indexes or capturing the removed elements.
  16881. *
  16882. * @private
  16883. * @param {Array} array The array to modify.
  16884. * @param {number[]} indexes The indexes of elements to remove.
  16885. * @returns {Array} Returns `array`.
  16886. */
  16887. function basePullAt(array, indexes) {
  16888. var length = array ? indexes.length : 0,
  16889. lastIndex = length - 1;
  16890. while (length--) {
  16891. var index = indexes[length];
  16892. if (length == lastIndex || index !== previous) {
  16893. var previous = index;
  16894. if (isIndex(index)) {
  16895. splice.call(array, index, 1);
  16896. } else {
  16897. baseUnset(array, index);
  16898. }
  16899. }
  16900. }
  16901. return array;
  16902. }
  16903. /**
  16904. * The base implementation of `_.random` without support for returning
  16905. * floating-point numbers.
  16906. *
  16907. * @private
  16908. * @param {number} lower The lower bound.
  16909. * @param {number} upper The upper bound.
  16910. * @returns {number} Returns the random number.
  16911. */
  16912. function baseRandom(lower, upper) {
  16913. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  16914. }
  16915. /**
  16916. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  16917. * coerce arguments.
  16918. *
  16919. * @private
  16920. * @param {number} start The start of the range.
  16921. * @param {number} end The end of the range.
  16922. * @param {number} step The value to increment or decrement by.
  16923. * @param {boolean} [fromRight] Specify iterating from right to left.
  16924. * @returns {Array} Returns the range of numbers.
  16925. */
  16926. function baseRange(start, end, step, fromRight) {
  16927. var index = -1,
  16928. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  16929. result = Array(length);
  16930. while (length--) {
  16931. result[fromRight ? length : ++index] = start;
  16932. start += step;
  16933. }
  16934. return result;
  16935. }
  16936. /**
  16937. * The base implementation of `_.repeat` which doesn't coerce arguments.
  16938. *
  16939. * @private
  16940. * @param {string} string The string to repeat.
  16941. * @param {number} n The number of times to repeat the string.
  16942. * @returns {string} Returns the repeated string.
  16943. */
  16944. function baseRepeat(string, n) {
  16945. var result = '';
  16946. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  16947. return result;
  16948. }
  16949. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  16950. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  16951. do {
  16952. if (n % 2) {
  16953. result += string;
  16954. }
  16955. n = nativeFloor(n / 2);
  16956. if (n) {
  16957. string += string;
  16958. }
  16959. } while (n);
  16960. return result;
  16961. }
  16962. /**
  16963. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  16964. *
  16965. * @private
  16966. * @param {Function} func The function to apply a rest parameter to.
  16967. * @param {number} [start=func.length-1] The start position of the rest parameter.
  16968. * @returns {Function} Returns the new function.
  16969. */
  16970. function baseRest(func, start) {
  16971. return setToString(overRest(func, start, identity), func + '');
  16972. }
  16973. /**
  16974. * The base implementation of `_.sample`.
  16975. *
  16976. * @private
  16977. * @param {Array|Object} collection The collection to sample.
  16978. * @returns {*} Returns the random element.
  16979. */
  16980. function baseSample(collection) {
  16981. return arraySample(values(collection));
  16982. }
  16983. /**
  16984. * The base implementation of `_.sampleSize` without param guards.
  16985. *
  16986. * @private
  16987. * @param {Array|Object} collection The collection to sample.
  16988. * @param {number} n The number of elements to sample.
  16989. * @returns {Array} Returns the random elements.
  16990. */
  16991. function baseSampleSize(collection, n) {
  16992. var array = values(collection);
  16993. return shuffleSelf(array, baseClamp(n, 0, array.length));
  16994. }
  16995. /**
  16996. * The base implementation of `_.set`.
  16997. *
  16998. * @private
  16999. * @param {Object} object The object to modify.
  17000. * @param {Array|string} path The path of the property to set.
  17001. * @param {*} value The value to set.
  17002. * @param {Function} [customizer] The function to customize path creation.
  17003. * @returns {Object} Returns `object`.
  17004. */
  17005. function baseSet(object, path, value, customizer) {
  17006. if (!isObject(object)) {
  17007. return object;
  17008. }
  17009. path = castPath(path, object);
  17010. var index = -1,
  17011. length = path.length,
  17012. lastIndex = length - 1,
  17013. nested = object;
  17014. while (nested != null && ++index < length) {
  17015. var key = toKey(path[index]),
  17016. newValue = value;
  17017. if (index != lastIndex) {
  17018. var objValue = nested[key];
  17019. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  17020. if (newValue === undefined) {
  17021. newValue = isObject(objValue)
  17022. ? objValue
  17023. : (isIndex(path[index + 1]) ? [] : {});
  17024. }
  17025. }
  17026. assignValue(nested, key, newValue);
  17027. nested = nested[key];
  17028. }
  17029. return object;
  17030. }
  17031. /**
  17032. * The base implementation of `setData` without support for hot loop shorting.
  17033. *
  17034. * @private
  17035. * @param {Function} func The function to associate metadata with.
  17036. * @param {*} data The metadata.
  17037. * @returns {Function} Returns `func`.
  17038. */
  17039. var baseSetData = !metaMap ? identity : function(func, data) {
  17040. metaMap.set(func, data);
  17041. return func;
  17042. };
  17043. /**
  17044. * The base implementation of `setToString` without support for hot loop shorting.
  17045. *
  17046. * @private
  17047. * @param {Function} func The function to modify.
  17048. * @param {Function} string The `toString` result.
  17049. * @returns {Function} Returns `func`.
  17050. */
  17051. var baseSetToString = !defineProperty ? identity : function(func, string) {
  17052. return defineProperty(func, 'toString', {
  17053. 'configurable': true,
  17054. 'enumerable': false,
  17055. 'value': constant(string),
  17056. 'writable': true
  17057. });
  17058. };
  17059. /**
  17060. * The base implementation of `_.shuffle`.
  17061. *
  17062. * @private
  17063. * @param {Array|Object} collection The collection to shuffle.
  17064. * @returns {Array} Returns the new shuffled array.
  17065. */
  17066. function baseShuffle(collection) {
  17067. return shuffleSelf(values(collection));
  17068. }
  17069. /**
  17070. * The base implementation of `_.slice` without an iteratee call guard.
  17071. *
  17072. * @private
  17073. * @param {Array} array The array to slice.
  17074. * @param {number} [start=0] The start position.
  17075. * @param {number} [end=array.length] The end position.
  17076. * @returns {Array} Returns the slice of `array`.
  17077. */
  17078. function baseSlice(array, start, end) {
  17079. var index = -1,
  17080. length = array.length;
  17081. if (start < 0) {
  17082. start = -start > length ? 0 : (length + start);
  17083. }
  17084. end = end > length ? length : end;
  17085. if (end < 0) {
  17086. end += length;
  17087. }
  17088. length = start > end ? 0 : ((end - start) >>> 0);
  17089. start >>>= 0;
  17090. var result = Array(length);
  17091. while (++index < length) {
  17092. result[index] = array[index + start];
  17093. }
  17094. return result;
  17095. }
  17096. /**
  17097. * The base implementation of `_.some` without support for iteratee shorthands.
  17098. *
  17099. * @private
  17100. * @param {Array|Object} collection The collection to iterate over.
  17101. * @param {Function} predicate The function invoked per iteration.
  17102. * @returns {boolean} Returns `true` if any element passes the predicate check,
  17103. * else `false`.
  17104. */
  17105. function baseSome(collection, predicate) {
  17106. var result;
  17107. baseEach(collection, function(value, index, collection) {
  17108. result = predicate(value, index, collection);
  17109. return !result;
  17110. });
  17111. return !!result;
  17112. }
  17113. /**
  17114. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  17115. * performs a binary search of `array` to determine the index at which `value`
  17116. * should be inserted into `array` in order to maintain its sort order.
  17117. *
  17118. * @private
  17119. * @param {Array} array The sorted array to inspect.
  17120. * @param {*} value The value to evaluate.
  17121. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  17122. * @returns {number} Returns the index at which `value` should be inserted
  17123. * into `array`.
  17124. */
  17125. function baseSortedIndex(array, value, retHighest) {
  17126. var low = 0,
  17127. high = array == null ? low : array.length;
  17128. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  17129. while (low < high) {
  17130. var mid = (low + high) >>> 1,
  17131. computed = array[mid];
  17132. if (computed !== null && !isSymbol(computed) &&
  17133. (retHighest ? (computed <= value) : (computed < value))) {
  17134. low = mid + 1;
  17135. } else {
  17136. high = mid;
  17137. }
  17138. }
  17139. return high;
  17140. }
  17141. return baseSortedIndexBy(array, value, identity, retHighest);
  17142. }
  17143. /**
  17144. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  17145. * which invokes `iteratee` for `value` and each element of `array` to compute
  17146. * their sort ranking. The iteratee is invoked with one argument; (value).
  17147. *
  17148. * @private
  17149. * @param {Array} array The sorted array to inspect.
  17150. * @param {*} value The value to evaluate.
  17151. * @param {Function} iteratee The iteratee invoked per element.
  17152. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  17153. * @returns {number} Returns the index at which `value` should be inserted
  17154. * into `array`.
  17155. */
  17156. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  17157. value = iteratee(value);
  17158. var low = 0,
  17159. high = array == null ? 0 : array.length,
  17160. valIsNaN = value !== value,
  17161. valIsNull = value === null,
  17162. valIsSymbol = isSymbol(value),
  17163. valIsUndefined = value === undefined;
  17164. while (low < high) {
  17165. var mid = nativeFloor((low + high) / 2),
  17166. computed = iteratee(array[mid]),
  17167. othIsDefined = computed !== undefined,
  17168. othIsNull = computed === null,
  17169. othIsReflexive = computed === computed,
  17170. othIsSymbol = isSymbol(computed);
  17171. if (valIsNaN) {
  17172. var setLow = retHighest || othIsReflexive;
  17173. } else if (valIsUndefined) {
  17174. setLow = othIsReflexive && (retHighest || othIsDefined);
  17175. } else if (valIsNull) {
  17176. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  17177. } else if (valIsSymbol) {
  17178. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  17179. } else if (othIsNull || othIsSymbol) {
  17180. setLow = false;
  17181. } else {
  17182. setLow = retHighest ? (computed <= value) : (computed < value);
  17183. }
  17184. if (setLow) {
  17185. low = mid + 1;
  17186. } else {
  17187. high = mid;
  17188. }
  17189. }
  17190. return nativeMin(high, MAX_ARRAY_INDEX);
  17191. }
  17192. /**
  17193. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  17194. * support for iteratee shorthands.
  17195. *
  17196. * @private
  17197. * @param {Array} array The array to inspect.
  17198. * @param {Function} [iteratee] The iteratee invoked per element.
  17199. * @returns {Array} Returns the new duplicate free array.
  17200. */
  17201. function baseSortedUniq(array, iteratee) {
  17202. var index = -1,
  17203. length = array.length,
  17204. resIndex = 0,
  17205. result = [];
  17206. while (++index < length) {
  17207. var value = array[index],
  17208. computed = iteratee ? iteratee(value) : value;
  17209. if (!index || !eq(computed, seen)) {
  17210. var seen = computed;
  17211. result[resIndex++] = value === 0 ? 0 : value;
  17212. }
  17213. }
  17214. return result;
  17215. }
  17216. /**
  17217. * The base implementation of `_.toNumber` which doesn't ensure correct
  17218. * conversions of binary, hexadecimal, or octal string values.
  17219. *
  17220. * @private
  17221. * @param {*} value The value to process.
  17222. * @returns {number} Returns the number.
  17223. */
  17224. function baseToNumber(value) {
  17225. if (typeof value == 'number') {
  17226. return value;
  17227. }
  17228. if (isSymbol(value)) {
  17229. return NAN;
  17230. }
  17231. return +value;
  17232. }
  17233. /**
  17234. * The base implementation of `_.toString` which doesn't convert nullish
  17235. * values to empty strings.
  17236. *
  17237. * @private
  17238. * @param {*} value The value to process.
  17239. * @returns {string} Returns the string.
  17240. */
  17241. function baseToString(value) {
  17242. // Exit early for strings to avoid a performance hit in some environments.
  17243. if (typeof value == 'string') {
  17244. return value;
  17245. }
  17246. if (isArray(value)) {
  17247. // Recursively convert values (susceptible to call stack limits).
  17248. return arrayMap(value, baseToString) + '';
  17249. }
  17250. if (isSymbol(value)) {
  17251. return symbolToString ? symbolToString.call(value) : '';
  17252. }
  17253. var result = (value + '');
  17254. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  17255. }
  17256. /**
  17257. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  17258. *
  17259. * @private
  17260. * @param {Array} array The array to inspect.
  17261. * @param {Function} [iteratee] The iteratee invoked per element.
  17262. * @param {Function} [comparator] The comparator invoked per element.
  17263. * @returns {Array} Returns the new duplicate free array.
  17264. */
  17265. function baseUniq(array, iteratee, comparator) {
  17266. var index = -1,
  17267. includes = arrayIncludes,
  17268. length = array.length,
  17269. isCommon = true,
  17270. result = [],
  17271. seen = result;
  17272. if (comparator) {
  17273. isCommon = false;
  17274. includes = arrayIncludesWith;
  17275. }
  17276. else if (length >= LARGE_ARRAY_SIZE) {
  17277. var set = iteratee ? null : createSet(array);
  17278. if (set) {
  17279. return setToArray(set);
  17280. }
  17281. isCommon = false;
  17282. includes = cacheHas;
  17283. seen = new SetCache;
  17284. }
  17285. else {
  17286. seen = iteratee ? [] : result;
  17287. }
  17288. outer:
  17289. while (++index < length) {
  17290. var value = array[index],
  17291. computed = iteratee ? iteratee(value) : value;
  17292. value = (comparator || value !== 0) ? value : 0;
  17293. if (isCommon && computed === computed) {
  17294. var seenIndex = seen.length;
  17295. while (seenIndex--) {
  17296. if (seen[seenIndex] === computed) {
  17297. continue outer;
  17298. }
  17299. }
  17300. if (iteratee) {
  17301. seen.push(computed);
  17302. }
  17303. result.push(value);
  17304. }
  17305. else if (!includes(seen, computed, comparator)) {
  17306. if (seen !== result) {
  17307. seen.push(computed);
  17308. }
  17309. result.push(value);
  17310. }
  17311. }
  17312. return result;
  17313. }
  17314. /**
  17315. * The base implementation of `_.unset`.
  17316. *
  17317. * @private
  17318. * @param {Object} object The object to modify.
  17319. * @param {Array|string} path The property path to unset.
  17320. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  17321. */
  17322. function baseUnset(object, path) {
  17323. path = castPath(path, object);
  17324. object = parent(object, path);
  17325. return object == null || delete object[toKey(last(path))];
  17326. }
  17327. /**
  17328. * The base implementation of `_.update`.
  17329. *
  17330. * @private
  17331. * @param {Object} object The object to modify.
  17332. * @param {Array|string} path The path of the property to update.
  17333. * @param {Function} updater The function to produce the updated value.
  17334. * @param {Function} [customizer] The function to customize path creation.
  17335. * @returns {Object} Returns `object`.
  17336. */
  17337. function baseUpdate(object, path, updater, customizer) {
  17338. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  17339. }
  17340. /**
  17341. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  17342. * without support for iteratee shorthands.
  17343. *
  17344. * @private
  17345. * @param {Array} array The array to query.
  17346. * @param {Function} predicate The function invoked per iteration.
  17347. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  17348. * @param {boolean} [fromRight] Specify iterating from right to left.
  17349. * @returns {Array} Returns the slice of `array`.
  17350. */
  17351. function baseWhile(array, predicate, isDrop, fromRight) {
  17352. var length = array.length,
  17353. index = fromRight ? length : -1;
  17354. while ((fromRight ? index-- : ++index < length) &&
  17355. predicate(array[index], index, array)) {}
  17356. return isDrop
  17357. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  17358. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  17359. }
  17360. /**
  17361. * The base implementation of `wrapperValue` which returns the result of
  17362. * performing a sequence of actions on the unwrapped `value`, where each
  17363. * successive action is supplied the return value of the previous.
  17364. *
  17365. * @private
  17366. * @param {*} value The unwrapped value.
  17367. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  17368. * @returns {*} Returns the resolved value.
  17369. */
  17370. function baseWrapperValue(value, actions) {
  17371. var result = value;
  17372. if (result instanceof LazyWrapper) {
  17373. result = result.value();
  17374. }
  17375. return arrayReduce(actions, function(result, action) {
  17376. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  17377. }, result);
  17378. }
  17379. /**
  17380. * The base implementation of methods like `_.xor`, without support for
  17381. * iteratee shorthands, that accepts an array of arrays to inspect.
  17382. *
  17383. * @private
  17384. * @param {Array} arrays The arrays to inspect.
  17385. * @param {Function} [iteratee] The iteratee invoked per element.
  17386. * @param {Function} [comparator] The comparator invoked per element.
  17387. * @returns {Array} Returns the new array of values.
  17388. */
  17389. function baseXor(arrays, iteratee, comparator) {
  17390. var length = arrays.length;
  17391. if (length < 2) {
  17392. return length ? baseUniq(arrays[0]) : [];
  17393. }
  17394. var index = -1,
  17395. result = Array(length);
  17396. while (++index < length) {
  17397. var array = arrays[index],
  17398. othIndex = -1;
  17399. while (++othIndex < length) {
  17400. if (othIndex != index) {
  17401. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  17402. }
  17403. }
  17404. }
  17405. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  17406. }
  17407. /**
  17408. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  17409. *
  17410. * @private
  17411. * @param {Array} props The property identifiers.
  17412. * @param {Array} values The property values.
  17413. * @param {Function} assignFunc The function to assign values.
  17414. * @returns {Object} Returns the new object.
  17415. */
  17416. function baseZipObject(props, values, assignFunc) {
  17417. var index = -1,
  17418. length = props.length,
  17419. valsLength = values.length,
  17420. result = {};
  17421. while (++index < length) {
  17422. var value = index < valsLength ? values[index] : undefined;
  17423. assignFunc(result, props[index], value);
  17424. }
  17425. return result;
  17426. }
  17427. /**
  17428. * Casts `value` to an empty array if it's not an array like object.
  17429. *
  17430. * @private
  17431. * @param {*} value The value to inspect.
  17432. * @returns {Array|Object} Returns the cast array-like object.
  17433. */
  17434. function castArrayLikeObject(value) {
  17435. return isArrayLikeObject(value) ? value : [];
  17436. }
  17437. /**
  17438. * Casts `value` to `identity` if it's not a function.
  17439. *
  17440. * @private
  17441. * @param {*} value The value to inspect.
  17442. * @returns {Function} Returns cast function.
  17443. */
  17444. function castFunction(value) {
  17445. return typeof value == 'function' ? value : identity;
  17446. }
  17447. /**
  17448. * Casts `value` to a path array if it's not one.
  17449. *
  17450. * @private
  17451. * @param {*} value The value to inspect.
  17452. * @param {Object} [object] The object to query keys on.
  17453. * @returns {Array} Returns the cast property path array.
  17454. */
  17455. function castPath(value, object) {
  17456. if (isArray(value)) {
  17457. return value;
  17458. }
  17459. return isKey(value, object) ? [value] : stringToPath(toString(value));
  17460. }
  17461. /**
  17462. * A `baseRest` alias which can be replaced with `identity` by module
  17463. * replacement plugins.
  17464. *
  17465. * @private
  17466. * @type {Function}
  17467. * @param {Function} func The function to apply a rest parameter to.
  17468. * @returns {Function} Returns the new function.
  17469. */
  17470. var castRest = baseRest;
  17471. /**
  17472. * Casts `array` to a slice if it's needed.
  17473. *
  17474. * @private
  17475. * @param {Array} array The array to inspect.
  17476. * @param {number} start The start position.
  17477. * @param {number} [end=array.length] The end position.
  17478. * @returns {Array} Returns the cast slice.
  17479. */
  17480. function castSlice(array, start, end) {
  17481. var length = array.length;
  17482. end = end === undefined ? length : end;
  17483. return (!start && end >= length) ? array : baseSlice(array, start, end);
  17484. }
  17485. /**
  17486. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  17487. *
  17488. * @private
  17489. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  17490. */
  17491. var clearTimeout = ctxClearTimeout || function(id) {
  17492. return root.clearTimeout(id);
  17493. };
  17494. /**
  17495. * Creates a clone of `buffer`.
  17496. *
  17497. * @private
  17498. * @param {Buffer} buffer The buffer to clone.
  17499. * @param {boolean} [isDeep] Specify a deep clone.
  17500. * @returns {Buffer} Returns the cloned buffer.
  17501. */
  17502. function cloneBuffer(buffer, isDeep) {
  17503. if (isDeep) {
  17504. return buffer.slice();
  17505. }
  17506. var length = buffer.length,
  17507. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  17508. buffer.copy(result);
  17509. return result;
  17510. }
  17511. /**
  17512. * Creates a clone of `arrayBuffer`.
  17513. *
  17514. * @private
  17515. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  17516. * @returns {ArrayBuffer} Returns the cloned array buffer.
  17517. */
  17518. function cloneArrayBuffer(arrayBuffer) {
  17519. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  17520. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  17521. return result;
  17522. }
  17523. /**
  17524. * Creates a clone of `dataView`.
  17525. *
  17526. * @private
  17527. * @param {Object} dataView The data view to clone.
  17528. * @param {boolean} [isDeep] Specify a deep clone.
  17529. * @returns {Object} Returns the cloned data view.
  17530. */
  17531. function cloneDataView(dataView, isDeep) {
  17532. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  17533. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  17534. }
  17535. /**
  17536. * Creates a clone of `regexp`.
  17537. *
  17538. * @private
  17539. * @param {Object} regexp The regexp to clone.
  17540. * @returns {Object} Returns the cloned regexp.
  17541. */
  17542. function cloneRegExp(regexp) {
  17543. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  17544. result.lastIndex = regexp.lastIndex;
  17545. return result;
  17546. }
  17547. /**
  17548. * Creates a clone of the `symbol` object.
  17549. *
  17550. * @private
  17551. * @param {Object} symbol The symbol object to clone.
  17552. * @returns {Object} Returns the cloned symbol object.
  17553. */
  17554. function cloneSymbol(symbol) {
  17555. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  17556. }
  17557. /**
  17558. * Creates a clone of `typedArray`.
  17559. *
  17560. * @private
  17561. * @param {Object} typedArray The typed array to clone.
  17562. * @param {boolean} [isDeep] Specify a deep clone.
  17563. * @returns {Object} Returns the cloned typed array.
  17564. */
  17565. function cloneTypedArray(typedArray, isDeep) {
  17566. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  17567. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  17568. }
  17569. /**
  17570. * Compares values to sort them in ascending order.
  17571. *
  17572. * @private
  17573. * @param {*} value The value to compare.
  17574. * @param {*} other The other value to compare.
  17575. * @returns {number} Returns the sort order indicator for `value`.
  17576. */
  17577. function compareAscending(value, other) {
  17578. if (value !== other) {
  17579. var valIsDefined = value !== undefined,
  17580. valIsNull = value === null,
  17581. valIsReflexive = value === value,
  17582. valIsSymbol = isSymbol(value);
  17583. var othIsDefined = other !== undefined,
  17584. othIsNull = other === null,
  17585. othIsReflexive = other === other,
  17586. othIsSymbol = isSymbol(other);
  17587. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  17588. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  17589. (valIsNull && othIsDefined && othIsReflexive) ||
  17590. (!valIsDefined && othIsReflexive) ||
  17591. !valIsReflexive) {
  17592. return 1;
  17593. }
  17594. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  17595. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  17596. (othIsNull && valIsDefined && valIsReflexive) ||
  17597. (!othIsDefined && valIsReflexive) ||
  17598. !othIsReflexive) {
  17599. return -1;
  17600. }
  17601. }
  17602. return 0;
  17603. }
  17604. /**
  17605. * Used by `_.orderBy` to compare multiple properties of a value to another
  17606. * and stable sort them.
  17607. *
  17608. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  17609. * specify an order of "desc" for descending or "asc" for ascending sort order
  17610. * of corresponding values.
  17611. *
  17612. * @private
  17613. * @param {Object} object The object to compare.
  17614. * @param {Object} other The other object to compare.
  17615. * @param {boolean[]|string[]} orders The order to sort by for each property.
  17616. * @returns {number} Returns the sort order indicator for `object`.
  17617. */
  17618. function compareMultiple(object, other, orders) {
  17619. var index = -1,
  17620. objCriteria = object.criteria,
  17621. othCriteria = other.criteria,
  17622. length = objCriteria.length,
  17623. ordersLength = orders.length;
  17624. while (++index < length) {
  17625. var result = compareAscending(objCriteria[index], othCriteria[index]);
  17626. if (result) {
  17627. if (index >= ordersLength) {
  17628. return result;
  17629. }
  17630. var order = orders[index];
  17631. return result * (order == 'desc' ? -1 : 1);
  17632. }
  17633. }
  17634. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  17635. // that causes it, under certain circumstances, to provide the same value for
  17636. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  17637. // for more details.
  17638. //
  17639. // This also ensures a stable sort in V8 and other engines.
  17640. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  17641. return object.index - other.index;
  17642. }
  17643. /**
  17644. * Creates an array that is the composition of partially applied arguments,
  17645. * placeholders, and provided arguments into a single array of arguments.
  17646. *
  17647. * @private
  17648. * @param {Array} args The provided arguments.
  17649. * @param {Array} partials The arguments to prepend to those provided.
  17650. * @param {Array} holders The `partials` placeholder indexes.
  17651. * @params {boolean} [isCurried] Specify composing for a curried function.
  17652. * @returns {Array} Returns the new array of composed arguments.
  17653. */
  17654. function composeArgs(args, partials, holders, isCurried) {
  17655. var argsIndex = -1,
  17656. argsLength = args.length,
  17657. holdersLength = holders.length,
  17658. leftIndex = -1,
  17659. leftLength = partials.length,
  17660. rangeLength = nativeMax(argsLength - holdersLength, 0),
  17661. result = Array(leftLength + rangeLength),
  17662. isUncurried = !isCurried;
  17663. while (++leftIndex < leftLength) {
  17664. result[leftIndex] = partials[leftIndex];
  17665. }
  17666. while (++argsIndex < holdersLength) {
  17667. if (isUncurried || argsIndex < argsLength) {
  17668. result[holders[argsIndex]] = args[argsIndex];
  17669. }
  17670. }
  17671. while (rangeLength--) {
  17672. result[leftIndex++] = args[argsIndex++];
  17673. }
  17674. return result;
  17675. }
  17676. /**
  17677. * This function is like `composeArgs` except that the arguments composition
  17678. * is tailored for `_.partialRight`.
  17679. *
  17680. * @private
  17681. * @param {Array} args The provided arguments.
  17682. * @param {Array} partials The arguments to append to those provided.
  17683. * @param {Array} holders The `partials` placeholder indexes.
  17684. * @params {boolean} [isCurried] Specify composing for a curried function.
  17685. * @returns {Array} Returns the new array of composed arguments.
  17686. */
  17687. function composeArgsRight(args, partials, holders, isCurried) {
  17688. var argsIndex = -1,
  17689. argsLength = args.length,
  17690. holdersIndex = -1,
  17691. holdersLength = holders.length,
  17692. rightIndex = -1,
  17693. rightLength = partials.length,
  17694. rangeLength = nativeMax(argsLength - holdersLength, 0),
  17695. result = Array(rangeLength + rightLength),
  17696. isUncurried = !isCurried;
  17697. while (++argsIndex < rangeLength) {
  17698. result[argsIndex] = args[argsIndex];
  17699. }
  17700. var offset = argsIndex;
  17701. while (++rightIndex < rightLength) {
  17702. result[offset + rightIndex] = partials[rightIndex];
  17703. }
  17704. while (++holdersIndex < holdersLength) {
  17705. if (isUncurried || argsIndex < argsLength) {
  17706. result[offset + holders[holdersIndex]] = args[argsIndex++];
  17707. }
  17708. }
  17709. return result;
  17710. }
  17711. /**
  17712. * Copies the values of `source` to `array`.
  17713. *
  17714. * @private
  17715. * @param {Array} source The array to copy values from.
  17716. * @param {Array} [array=[]] The array to copy values to.
  17717. * @returns {Array} Returns `array`.
  17718. */
  17719. function copyArray(source, array) {
  17720. var index = -1,
  17721. length = source.length;
  17722. array || (array = Array(length));
  17723. while (++index < length) {
  17724. array[index] = source[index];
  17725. }
  17726. return array;
  17727. }
  17728. /**
  17729. * Copies properties of `source` to `object`.
  17730. *
  17731. * @private
  17732. * @param {Object} source The object to copy properties from.
  17733. * @param {Array} props The property identifiers to copy.
  17734. * @param {Object} [object={}] The object to copy properties to.
  17735. * @param {Function} [customizer] The function to customize copied values.
  17736. * @returns {Object} Returns `object`.
  17737. */
  17738. function copyObject(source, props, object, customizer) {
  17739. var isNew = !object;
  17740. object || (object = {});
  17741. var index = -1,
  17742. length = props.length;
  17743. while (++index < length) {
  17744. var key = props[index];
  17745. var newValue = customizer
  17746. ? customizer(object[key], source[key], key, object, source)
  17747. : undefined;
  17748. if (newValue === undefined) {
  17749. newValue = source[key];
  17750. }
  17751. if (isNew) {
  17752. baseAssignValue(object, key, newValue);
  17753. } else {
  17754. assignValue(object, key, newValue);
  17755. }
  17756. }
  17757. return object;
  17758. }
  17759. /**
  17760. * Copies own symbols of `source` to `object`.
  17761. *
  17762. * @private
  17763. * @param {Object} source The object to copy symbols from.
  17764. * @param {Object} [object={}] The object to copy symbols to.
  17765. * @returns {Object} Returns `object`.
  17766. */
  17767. function copySymbols(source, object) {
  17768. return copyObject(source, getSymbols(source), object);
  17769. }
  17770. /**
  17771. * Copies own and inherited symbols of `source` to `object`.
  17772. *
  17773. * @private
  17774. * @param {Object} source The object to copy symbols from.
  17775. * @param {Object} [object={}] The object to copy symbols to.
  17776. * @returns {Object} Returns `object`.
  17777. */
  17778. function copySymbolsIn(source, object) {
  17779. return copyObject(source, getSymbolsIn(source), object);
  17780. }
  17781. /**
  17782. * Creates a function like `_.groupBy`.
  17783. *
  17784. * @private
  17785. * @param {Function} setter The function to set accumulator values.
  17786. * @param {Function} [initializer] The accumulator object initializer.
  17787. * @returns {Function} Returns the new aggregator function.
  17788. */
  17789. function createAggregator(setter, initializer) {
  17790. return function(collection, iteratee) {
  17791. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  17792. accumulator = initializer ? initializer() : {};
  17793. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  17794. };
  17795. }
  17796. /**
  17797. * Creates a function like `_.assign`.
  17798. *
  17799. * @private
  17800. * @param {Function} assigner The function to assign values.
  17801. * @returns {Function} Returns the new assigner function.
  17802. */
  17803. function createAssigner(assigner) {
  17804. return baseRest(function(object, sources) {
  17805. var index = -1,
  17806. length = sources.length,
  17807. customizer = length > 1 ? sources[length - 1] : undefined,
  17808. guard = length > 2 ? sources[2] : undefined;
  17809. customizer = (assigner.length > 3 && typeof customizer == 'function')
  17810. ? (length--, customizer)
  17811. : undefined;
  17812. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  17813. customizer = length < 3 ? undefined : customizer;
  17814. length = 1;
  17815. }
  17816. object = Object(object);
  17817. while (++index < length) {
  17818. var source = sources[index];
  17819. if (source) {
  17820. assigner(object, source, index, customizer);
  17821. }
  17822. }
  17823. return object;
  17824. });
  17825. }
  17826. /**
  17827. * Creates a `baseEach` or `baseEachRight` function.
  17828. *
  17829. * @private
  17830. * @param {Function} eachFunc The function to iterate over a collection.
  17831. * @param {boolean} [fromRight] Specify iterating from right to left.
  17832. * @returns {Function} Returns the new base function.
  17833. */
  17834. function createBaseEach(eachFunc, fromRight) {
  17835. return function(collection, iteratee) {
  17836. if (collection == null) {
  17837. return collection;
  17838. }
  17839. if (!isArrayLike(collection)) {
  17840. return eachFunc(collection, iteratee);
  17841. }
  17842. var length = collection.length,
  17843. index = fromRight ? length : -1,
  17844. iterable = Object(collection);
  17845. while ((fromRight ? index-- : ++index < length)) {
  17846. if (iteratee(iterable[index], index, iterable) === false) {
  17847. break;
  17848. }
  17849. }
  17850. return collection;
  17851. };
  17852. }
  17853. /**
  17854. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  17855. *
  17856. * @private
  17857. * @param {boolean} [fromRight] Specify iterating from right to left.
  17858. * @returns {Function} Returns the new base function.
  17859. */
  17860. function createBaseFor(fromRight) {
  17861. return function(object, iteratee, keysFunc) {
  17862. var index = -1,
  17863. iterable = Object(object),
  17864. props = keysFunc(object),
  17865. length = props.length;
  17866. while (length--) {
  17867. var key = props[fromRight ? length : ++index];
  17868. if (iteratee(iterable[key], key, iterable) === false) {
  17869. break;
  17870. }
  17871. }
  17872. return object;
  17873. };
  17874. }
  17875. /**
  17876. * Creates a function that wraps `func` to invoke it with the optional `this`
  17877. * binding of `thisArg`.
  17878. *
  17879. * @private
  17880. * @param {Function} func The function to wrap.
  17881. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  17882. * @param {*} [thisArg] The `this` binding of `func`.
  17883. * @returns {Function} Returns the new wrapped function.
  17884. */
  17885. function createBind(func, bitmask, thisArg) {
  17886. var isBind = bitmask & WRAP_BIND_FLAG,
  17887. Ctor = createCtor(func);
  17888. function wrapper() {
  17889. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  17890. return fn.apply(isBind ? thisArg : this, arguments);
  17891. }
  17892. return wrapper;
  17893. }
  17894. /**
  17895. * Creates a function like `_.lowerFirst`.
  17896. *
  17897. * @private
  17898. * @param {string} methodName The name of the `String` case method to use.
  17899. * @returns {Function} Returns the new case function.
  17900. */
  17901. function createCaseFirst(methodName) {
  17902. return function(string) {
  17903. string = toString(string);
  17904. var strSymbols = hasUnicode(string)
  17905. ? stringToArray(string)
  17906. : undefined;
  17907. var chr = strSymbols
  17908. ? strSymbols[0]
  17909. : string.charAt(0);
  17910. var trailing = strSymbols
  17911. ? castSlice(strSymbols, 1).join('')
  17912. : string.slice(1);
  17913. return chr[methodName]() + trailing;
  17914. };
  17915. }
  17916. /**
  17917. * Creates a function like `_.camelCase`.
  17918. *
  17919. * @private
  17920. * @param {Function} callback The function to combine each word.
  17921. * @returns {Function} Returns the new compounder function.
  17922. */
  17923. function createCompounder(callback) {
  17924. return function(string) {
  17925. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  17926. };
  17927. }
  17928. /**
  17929. * Creates a function that produces an instance of `Ctor` regardless of
  17930. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  17931. *
  17932. * @private
  17933. * @param {Function} Ctor The constructor to wrap.
  17934. * @returns {Function} Returns the new wrapped function.
  17935. */
  17936. function createCtor(Ctor) {
  17937. return function() {
  17938. // Use a `switch` statement to work with class constructors. See
  17939. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  17940. // for more details.
  17941. var args = arguments;
  17942. switch (args.length) {
  17943. case 0: return new Ctor;
  17944. case 1: return new Ctor(args[0]);
  17945. case 2: return new Ctor(args[0], args[1]);
  17946. case 3: return new Ctor(args[0], args[1], args[2]);
  17947. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  17948. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  17949. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  17950. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  17951. }
  17952. var thisBinding = baseCreate(Ctor.prototype),
  17953. result = Ctor.apply(thisBinding, args);
  17954. // Mimic the constructor's `return` behavior.
  17955. // See https://es5.github.io/#x13.2.2 for more details.
  17956. return isObject(result) ? result : thisBinding;
  17957. };
  17958. }
  17959. /**
  17960. * Creates a function that wraps `func` to enable currying.
  17961. *
  17962. * @private
  17963. * @param {Function} func The function to wrap.
  17964. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  17965. * @param {number} arity The arity of `func`.
  17966. * @returns {Function} Returns the new wrapped function.
  17967. */
  17968. function createCurry(func, bitmask, arity) {
  17969. var Ctor = createCtor(func);
  17970. function wrapper() {
  17971. var length = arguments.length,
  17972. args = Array(length),
  17973. index = length,
  17974. placeholder = getHolder(wrapper);
  17975. while (index--) {
  17976. args[index] = arguments[index];
  17977. }
  17978. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  17979. ? []
  17980. : replaceHolders(args, placeholder);
  17981. length -= holders.length;
  17982. if (length < arity) {
  17983. return createRecurry(
  17984. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  17985. args, holders, undefined, undefined, arity - length);
  17986. }
  17987. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  17988. return apply(fn, this, args);
  17989. }
  17990. return wrapper;
  17991. }
  17992. /**
  17993. * Creates a `_.find` or `_.findLast` function.
  17994. *
  17995. * @private
  17996. * @param {Function} findIndexFunc The function to find the collection index.
  17997. * @returns {Function} Returns the new find function.
  17998. */
  17999. function createFind(findIndexFunc) {
  18000. return function(collection, predicate, fromIndex) {
  18001. var iterable = Object(collection);
  18002. if (!isArrayLike(collection)) {
  18003. var iteratee = getIteratee(predicate, 3);
  18004. collection = keys(collection);
  18005. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  18006. }
  18007. var index = findIndexFunc(collection, predicate, fromIndex);
  18008. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  18009. };
  18010. }
  18011. /**
  18012. * Creates a `_.flow` or `_.flowRight` function.
  18013. *
  18014. * @private
  18015. * @param {boolean} [fromRight] Specify iterating from right to left.
  18016. * @returns {Function} Returns the new flow function.
  18017. */
  18018. function createFlow(fromRight) {
  18019. return flatRest(function(funcs) {
  18020. var length = funcs.length,
  18021. index = length,
  18022. prereq = LodashWrapper.prototype.thru;
  18023. if (fromRight) {
  18024. funcs.reverse();
  18025. }
  18026. while (index--) {
  18027. var func = funcs[index];
  18028. if (typeof func != 'function') {
  18029. throw new TypeError(FUNC_ERROR_TEXT);
  18030. }
  18031. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  18032. var wrapper = new LodashWrapper([], true);
  18033. }
  18034. }
  18035. index = wrapper ? index : length;
  18036. while (++index < length) {
  18037. func = funcs[index];
  18038. var funcName = getFuncName(func),
  18039. data = funcName == 'wrapper' ? getData(func) : undefined;
  18040. if (data && isLaziable(data[0]) &&
  18041. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  18042. !data[4].length && data[9] == 1
  18043. ) {
  18044. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  18045. } else {
  18046. wrapper = (func.length == 1 && isLaziable(func))
  18047. ? wrapper[funcName]()
  18048. : wrapper.thru(func);
  18049. }
  18050. }
  18051. return function() {
  18052. var args = arguments,
  18053. value = args[0];
  18054. if (wrapper && args.length == 1 && isArray(value)) {
  18055. return wrapper.plant(value).value();
  18056. }
  18057. var index = 0,
  18058. result = length ? funcs[index].apply(this, args) : value;
  18059. while (++index < length) {
  18060. result = funcs[index].call(this, result);
  18061. }
  18062. return result;
  18063. };
  18064. });
  18065. }
  18066. /**
  18067. * Creates a function that wraps `func` to invoke it with optional `this`
  18068. * binding of `thisArg`, partial application, and currying.
  18069. *
  18070. * @private
  18071. * @param {Function|string} func The function or method name to wrap.
  18072. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18073. * @param {*} [thisArg] The `this` binding of `func`.
  18074. * @param {Array} [partials] The arguments to prepend to those provided to
  18075. * the new function.
  18076. * @param {Array} [holders] The `partials` placeholder indexes.
  18077. * @param {Array} [partialsRight] The arguments to append to those provided
  18078. * to the new function.
  18079. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  18080. * @param {Array} [argPos] The argument positions of the new function.
  18081. * @param {number} [ary] The arity cap of `func`.
  18082. * @param {number} [arity] The arity of `func`.
  18083. * @returns {Function} Returns the new wrapped function.
  18084. */
  18085. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  18086. var isAry = bitmask & WRAP_ARY_FLAG,
  18087. isBind = bitmask & WRAP_BIND_FLAG,
  18088. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  18089. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  18090. isFlip = bitmask & WRAP_FLIP_FLAG,
  18091. Ctor = isBindKey ? undefined : createCtor(func);
  18092. function wrapper() {
  18093. var length = arguments.length,
  18094. args = Array(length),
  18095. index = length;
  18096. while (index--) {
  18097. args[index] = arguments[index];
  18098. }
  18099. if (isCurried) {
  18100. var placeholder = getHolder(wrapper),
  18101. holdersCount = countHolders(args, placeholder);
  18102. }
  18103. if (partials) {
  18104. args = composeArgs(args, partials, holders, isCurried);
  18105. }
  18106. if (partialsRight) {
  18107. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  18108. }
  18109. length -= holdersCount;
  18110. if (isCurried && length < arity) {
  18111. var newHolders = replaceHolders(args, placeholder);
  18112. return createRecurry(
  18113. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  18114. args, newHolders, argPos, ary, arity - length
  18115. );
  18116. }
  18117. var thisBinding = isBind ? thisArg : this,
  18118. fn = isBindKey ? thisBinding[func] : func;
  18119. length = args.length;
  18120. if (argPos) {
  18121. args = reorder(args, argPos);
  18122. } else if (isFlip && length > 1) {
  18123. args.reverse();
  18124. }
  18125. if (isAry && ary < length) {
  18126. args.length = ary;
  18127. }
  18128. if (this && this !== root && this instanceof wrapper) {
  18129. fn = Ctor || createCtor(fn);
  18130. }
  18131. return fn.apply(thisBinding, args);
  18132. }
  18133. return wrapper;
  18134. }
  18135. /**
  18136. * Creates a function like `_.invertBy`.
  18137. *
  18138. * @private
  18139. * @param {Function} setter The function to set accumulator values.
  18140. * @param {Function} toIteratee The function to resolve iteratees.
  18141. * @returns {Function} Returns the new inverter function.
  18142. */
  18143. function createInverter(setter, toIteratee) {
  18144. return function(object, iteratee) {
  18145. return baseInverter(object, setter, toIteratee(iteratee), {});
  18146. };
  18147. }
  18148. /**
  18149. * Creates a function that performs a mathematical operation on two values.
  18150. *
  18151. * @private
  18152. * @param {Function} operator The function to perform the operation.
  18153. * @param {number} [defaultValue] The value used for `undefined` arguments.
  18154. * @returns {Function} Returns the new mathematical operation function.
  18155. */
  18156. function createMathOperation(operator, defaultValue) {
  18157. return function(value, other) {
  18158. var result;
  18159. if (value === undefined && other === undefined) {
  18160. return defaultValue;
  18161. }
  18162. if (value !== undefined) {
  18163. result = value;
  18164. }
  18165. if (other !== undefined) {
  18166. if (result === undefined) {
  18167. return other;
  18168. }
  18169. if (typeof value == 'string' || typeof other == 'string') {
  18170. value = baseToString(value);
  18171. other = baseToString(other);
  18172. } else {
  18173. value = baseToNumber(value);
  18174. other = baseToNumber(other);
  18175. }
  18176. result = operator(value, other);
  18177. }
  18178. return result;
  18179. };
  18180. }
  18181. /**
  18182. * Creates a function like `_.over`.
  18183. *
  18184. * @private
  18185. * @param {Function} arrayFunc The function to iterate over iteratees.
  18186. * @returns {Function} Returns the new over function.
  18187. */
  18188. function createOver(arrayFunc) {
  18189. return flatRest(function(iteratees) {
  18190. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  18191. return baseRest(function(args) {
  18192. var thisArg = this;
  18193. return arrayFunc(iteratees, function(iteratee) {
  18194. return apply(iteratee, thisArg, args);
  18195. });
  18196. });
  18197. });
  18198. }
  18199. /**
  18200. * Creates the padding for `string` based on `length`. The `chars` string
  18201. * is truncated if the number of characters exceeds `length`.
  18202. *
  18203. * @private
  18204. * @param {number} length The padding length.
  18205. * @param {string} [chars=' '] The string used as padding.
  18206. * @returns {string} Returns the padding for `string`.
  18207. */
  18208. function createPadding(length, chars) {
  18209. chars = chars === undefined ? ' ' : baseToString(chars);
  18210. var charsLength = chars.length;
  18211. if (charsLength < 2) {
  18212. return charsLength ? baseRepeat(chars, length) : chars;
  18213. }
  18214. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  18215. return hasUnicode(chars)
  18216. ? castSlice(stringToArray(result), 0, length).join('')
  18217. : result.slice(0, length);
  18218. }
  18219. /**
  18220. * Creates a function that wraps `func` to invoke it with the `this` binding
  18221. * of `thisArg` and `partials` prepended to the arguments it receives.
  18222. *
  18223. * @private
  18224. * @param {Function} func The function to wrap.
  18225. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18226. * @param {*} thisArg The `this` binding of `func`.
  18227. * @param {Array} partials The arguments to prepend to those provided to
  18228. * the new function.
  18229. * @returns {Function} Returns the new wrapped function.
  18230. */
  18231. function createPartial(func, bitmask, thisArg, partials) {
  18232. var isBind = bitmask & WRAP_BIND_FLAG,
  18233. Ctor = createCtor(func);
  18234. function wrapper() {
  18235. var argsIndex = -1,
  18236. argsLength = arguments.length,
  18237. leftIndex = -1,
  18238. leftLength = partials.length,
  18239. args = Array(leftLength + argsLength),
  18240. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  18241. while (++leftIndex < leftLength) {
  18242. args[leftIndex] = partials[leftIndex];
  18243. }
  18244. while (argsLength--) {
  18245. args[leftIndex++] = arguments[++argsIndex];
  18246. }
  18247. return apply(fn, isBind ? thisArg : this, args);
  18248. }
  18249. return wrapper;
  18250. }
  18251. /**
  18252. * Creates a `_.range` or `_.rangeRight` function.
  18253. *
  18254. * @private
  18255. * @param {boolean} [fromRight] Specify iterating from right to left.
  18256. * @returns {Function} Returns the new range function.
  18257. */
  18258. function createRange(fromRight) {
  18259. return function(start, end, step) {
  18260. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  18261. end = step = undefined;
  18262. }
  18263. // Ensure the sign of `-0` is preserved.
  18264. start = toFinite(start);
  18265. if (end === undefined) {
  18266. end = start;
  18267. start = 0;
  18268. } else {
  18269. end = toFinite(end);
  18270. }
  18271. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  18272. return baseRange(start, end, step, fromRight);
  18273. };
  18274. }
  18275. /**
  18276. * Creates a function that performs a relational operation on two values.
  18277. *
  18278. * @private
  18279. * @param {Function} operator The function to perform the operation.
  18280. * @returns {Function} Returns the new relational operation function.
  18281. */
  18282. function createRelationalOperation(operator) {
  18283. return function(value, other) {
  18284. if (!(typeof value == 'string' && typeof other == 'string')) {
  18285. value = toNumber(value);
  18286. other = toNumber(other);
  18287. }
  18288. return operator(value, other);
  18289. };
  18290. }
  18291. /**
  18292. * Creates a function that wraps `func` to continue currying.
  18293. *
  18294. * @private
  18295. * @param {Function} func The function to wrap.
  18296. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  18297. * @param {Function} wrapFunc The function to create the `func` wrapper.
  18298. * @param {*} placeholder The placeholder value.
  18299. * @param {*} [thisArg] The `this` binding of `func`.
  18300. * @param {Array} [partials] The arguments to prepend to those provided to
  18301. * the new function.
  18302. * @param {Array} [holders] The `partials` placeholder indexes.
  18303. * @param {Array} [argPos] The argument positions of the new function.
  18304. * @param {number} [ary] The arity cap of `func`.
  18305. * @param {number} [arity] The arity of `func`.
  18306. * @returns {Function} Returns the new wrapped function.
  18307. */
  18308. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  18309. var isCurry = bitmask & WRAP_CURRY_FLAG,
  18310. newHolders = isCurry ? holders : undefined,
  18311. newHoldersRight = isCurry ? undefined : holders,
  18312. newPartials = isCurry ? partials : undefined,
  18313. newPartialsRight = isCurry ? undefined : partials;
  18314. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  18315. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  18316. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  18317. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  18318. }
  18319. var newData = [
  18320. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  18321. newHoldersRight, argPos, ary, arity
  18322. ];
  18323. var result = wrapFunc.apply(undefined, newData);
  18324. if (isLaziable(func)) {
  18325. setData(result, newData);
  18326. }
  18327. result.placeholder = placeholder;
  18328. return setWrapToString(result, func, bitmask);
  18329. }
  18330. /**
  18331. * Creates a function like `_.round`.
  18332. *
  18333. * @private
  18334. * @param {string} methodName The name of the `Math` method to use when rounding.
  18335. * @returns {Function} Returns the new round function.
  18336. */
  18337. function createRound(methodName) {
  18338. var func = Math[methodName];
  18339. return function(number, precision) {
  18340. number = toNumber(number);
  18341. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  18342. if (precision) {
  18343. // Shift with exponential notation to avoid floating-point issues.
  18344. // See [MDN](https://mdn.io/round#Examples) for more details.
  18345. var pair = (toString(number) + 'e').split('e'),
  18346. value = func(pair[0] + 'e' + (+pair[1] + precision));
  18347. pair = (toString(value) + 'e').split('e');
  18348. return +(pair[0] + 'e' + (+pair[1] - precision));
  18349. }
  18350. return func(number);
  18351. };
  18352. }
  18353. /**
  18354. * Creates a set object of `values`.
  18355. *
  18356. * @private
  18357. * @param {Array} values The values to add to the set.
  18358. * @returns {Object} Returns the new set.
  18359. */
  18360. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  18361. return new Set(values);
  18362. };
  18363. /**
  18364. * Creates a `_.toPairs` or `_.toPairsIn` function.
  18365. *
  18366. * @private
  18367. * @param {Function} keysFunc The function to get the keys of a given object.
  18368. * @returns {Function} Returns the new pairs function.
  18369. */
  18370. function createToPairs(keysFunc) {
  18371. return function(object) {
  18372. var tag = getTag(object);
  18373. if (tag == mapTag) {
  18374. return mapToArray(object);
  18375. }
  18376. if (tag == setTag) {
  18377. return setToPairs(object);
  18378. }
  18379. return baseToPairs(object, keysFunc(object));
  18380. };
  18381. }
  18382. /**
  18383. * Creates a function that either curries or invokes `func` with optional
  18384. * `this` binding and partially applied arguments.
  18385. *
  18386. * @private
  18387. * @param {Function|string} func The function or method name to wrap.
  18388. * @param {number} bitmask The bitmask flags.
  18389. * 1 - `_.bind`
  18390. * 2 - `_.bindKey`
  18391. * 4 - `_.curry` or `_.curryRight` of a bound function
  18392. * 8 - `_.curry`
  18393. * 16 - `_.curryRight`
  18394. * 32 - `_.partial`
  18395. * 64 - `_.partialRight`
  18396. * 128 - `_.rearg`
  18397. * 256 - `_.ary`
  18398. * 512 - `_.flip`
  18399. * @param {*} [thisArg] The `this` binding of `func`.
  18400. * @param {Array} [partials] The arguments to be partially applied.
  18401. * @param {Array} [holders] The `partials` placeholder indexes.
  18402. * @param {Array} [argPos] The argument positions of the new function.
  18403. * @param {number} [ary] The arity cap of `func`.
  18404. * @param {number} [arity] The arity of `func`.
  18405. * @returns {Function} Returns the new wrapped function.
  18406. */
  18407. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  18408. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  18409. if (!isBindKey && typeof func != 'function') {
  18410. throw new TypeError(FUNC_ERROR_TEXT);
  18411. }
  18412. var length = partials ? partials.length : 0;
  18413. if (!length) {
  18414. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  18415. partials = holders = undefined;
  18416. }
  18417. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  18418. arity = arity === undefined ? arity : toInteger(arity);
  18419. length -= holders ? holders.length : 0;
  18420. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  18421. var partialsRight = partials,
  18422. holdersRight = holders;
  18423. partials = holders = undefined;
  18424. }
  18425. var data = isBindKey ? undefined : getData(func);
  18426. var newData = [
  18427. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  18428. argPos, ary, arity
  18429. ];
  18430. if (data) {
  18431. mergeData(newData, data);
  18432. }
  18433. func = newData[0];
  18434. bitmask = newData[1];
  18435. thisArg = newData[2];
  18436. partials = newData[3];
  18437. holders = newData[4];
  18438. arity = newData[9] = newData[9] === undefined
  18439. ? (isBindKey ? 0 : func.length)
  18440. : nativeMax(newData[9] - length, 0);
  18441. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  18442. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  18443. }
  18444. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  18445. var result = createBind(func, bitmask, thisArg);
  18446. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  18447. result = createCurry(func, bitmask, arity);
  18448. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  18449. result = createPartial(func, bitmask, thisArg, partials);
  18450. } else {
  18451. result = createHybrid.apply(undefined, newData);
  18452. }
  18453. var setter = data ? baseSetData : setData;
  18454. return setWrapToString(setter(result, newData), func, bitmask);
  18455. }
  18456. /**
  18457. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  18458. * of source objects to the destination object for all destination properties
  18459. * that resolve to `undefined`.
  18460. *
  18461. * @private
  18462. * @param {*} objValue The destination value.
  18463. * @param {*} srcValue The source value.
  18464. * @param {string} key The key of the property to assign.
  18465. * @param {Object} object The parent object of `objValue`.
  18466. * @returns {*} Returns the value to assign.
  18467. */
  18468. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  18469. if (objValue === undefined ||
  18470. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  18471. return srcValue;
  18472. }
  18473. return objValue;
  18474. }
  18475. /**
  18476. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  18477. * objects into destination objects that are passed thru.
  18478. *
  18479. * @private
  18480. * @param {*} objValue The destination value.
  18481. * @param {*} srcValue The source value.
  18482. * @param {string} key The key of the property to merge.
  18483. * @param {Object} object The parent object of `objValue`.
  18484. * @param {Object} source The parent object of `srcValue`.
  18485. * @param {Object} [stack] Tracks traversed source values and their merged
  18486. * counterparts.
  18487. * @returns {*} Returns the value to assign.
  18488. */
  18489. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  18490. if (isObject(objValue) && isObject(srcValue)) {
  18491. // Recursively merge objects and arrays (susceptible to call stack limits).
  18492. stack.set(srcValue, objValue);
  18493. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  18494. stack['delete'](srcValue);
  18495. }
  18496. return objValue;
  18497. }
  18498. /**
  18499. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  18500. * objects.
  18501. *
  18502. * @private
  18503. * @param {*} value The value to inspect.
  18504. * @param {string} key The key of the property to inspect.
  18505. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  18506. */
  18507. function customOmitClone(value) {
  18508. return isPlainObject(value) ? undefined : value;
  18509. }
  18510. /**
  18511. * A specialized version of `baseIsEqualDeep` for arrays with support for
  18512. * partial deep comparisons.
  18513. *
  18514. * @private
  18515. * @param {Array} array The array to compare.
  18516. * @param {Array} other The other array to compare.
  18517. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  18518. * @param {Function} customizer The function to customize comparisons.
  18519. * @param {Function} equalFunc The function to determine equivalents of values.
  18520. * @param {Object} stack Tracks traversed `array` and `other` objects.
  18521. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  18522. */
  18523. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  18524. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  18525. arrLength = array.length,
  18526. othLength = other.length;
  18527. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  18528. return false;
  18529. }
  18530. // Assume cyclic values are equal.
  18531. var stacked = stack.get(array);
  18532. if (stacked && stack.get(other)) {
  18533. return stacked == other;
  18534. }
  18535. var index = -1,
  18536. result = true,
  18537. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  18538. stack.set(array, other);
  18539. stack.set(other, array);
  18540. // Ignore non-index properties.
  18541. while (++index < arrLength) {
  18542. var arrValue = array[index],
  18543. othValue = other[index];
  18544. if (customizer) {
  18545. var compared = isPartial
  18546. ? customizer(othValue, arrValue, index, other, array, stack)
  18547. : customizer(arrValue, othValue, index, array, other, stack);
  18548. }
  18549. if (compared !== undefined) {
  18550. if (compared) {
  18551. continue;
  18552. }
  18553. result = false;
  18554. break;
  18555. }
  18556. // Recursively compare arrays (susceptible to call stack limits).
  18557. if (seen) {
  18558. if (!arraySome(other, function(othValue, othIndex) {
  18559. if (!cacheHas(seen, othIndex) &&
  18560. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  18561. return seen.push(othIndex);
  18562. }
  18563. })) {
  18564. result = false;
  18565. break;
  18566. }
  18567. } else if (!(
  18568. arrValue === othValue ||
  18569. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  18570. )) {
  18571. result = false;
  18572. break;
  18573. }
  18574. }
  18575. stack['delete'](array);
  18576. stack['delete'](other);
  18577. return result;
  18578. }
  18579. /**
  18580. * A specialized version of `baseIsEqualDeep` for comparing objects of
  18581. * the same `toStringTag`.
  18582. *
  18583. * **Note:** This function only supports comparing values with tags of
  18584. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  18585. *
  18586. * @private
  18587. * @param {Object} object The object to compare.
  18588. * @param {Object} other The other object to compare.
  18589. * @param {string} tag The `toStringTag` of the objects to compare.
  18590. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  18591. * @param {Function} customizer The function to customize comparisons.
  18592. * @param {Function} equalFunc The function to determine equivalents of values.
  18593. * @param {Object} stack Tracks traversed `object` and `other` objects.
  18594. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  18595. */
  18596. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  18597. switch (tag) {
  18598. case dataViewTag:
  18599. if ((object.byteLength != other.byteLength) ||
  18600. (object.byteOffset != other.byteOffset)) {
  18601. return false;
  18602. }
  18603. object = object.buffer;
  18604. other = other.buffer;
  18605. case arrayBufferTag:
  18606. if ((object.byteLength != other.byteLength) ||
  18607. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  18608. return false;
  18609. }
  18610. return true;
  18611. case boolTag:
  18612. case dateTag:
  18613. case numberTag:
  18614. // Coerce booleans to `1` or `0` and dates to milliseconds.
  18615. // Invalid dates are coerced to `NaN`.
  18616. return eq(+object, +other);
  18617. case errorTag:
  18618. return object.name == other.name && object.message == other.message;
  18619. case regexpTag:
  18620. case stringTag:
  18621. // Coerce regexes to strings and treat strings, primitives and objects,
  18622. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  18623. // for more details.
  18624. return object == (other + '');
  18625. case mapTag:
  18626. var convert = mapToArray;
  18627. case setTag:
  18628. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  18629. convert || (convert = setToArray);
  18630. if (object.size != other.size && !isPartial) {
  18631. return false;
  18632. }
  18633. // Assume cyclic values are equal.
  18634. var stacked = stack.get(object);
  18635. if (stacked) {
  18636. return stacked == other;
  18637. }
  18638. bitmask |= COMPARE_UNORDERED_FLAG;
  18639. // Recursively compare objects (susceptible to call stack limits).
  18640. stack.set(object, other);
  18641. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  18642. stack['delete'](object);
  18643. return result;
  18644. case symbolTag:
  18645. if (symbolValueOf) {
  18646. return symbolValueOf.call(object) == symbolValueOf.call(other);
  18647. }
  18648. }
  18649. return false;
  18650. }
  18651. /**
  18652. * A specialized version of `baseIsEqualDeep` for objects with support for
  18653. * partial deep comparisons.
  18654. *
  18655. * @private
  18656. * @param {Object} object The object to compare.
  18657. * @param {Object} other The other object to compare.
  18658. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  18659. * @param {Function} customizer The function to customize comparisons.
  18660. * @param {Function} equalFunc The function to determine equivalents of values.
  18661. * @param {Object} stack Tracks traversed `object` and `other` objects.
  18662. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  18663. */
  18664. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  18665. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  18666. objProps = getAllKeys(object),
  18667. objLength = objProps.length,
  18668. othProps = getAllKeys(other),
  18669. othLength = othProps.length;
  18670. if (objLength != othLength && !isPartial) {
  18671. return false;
  18672. }
  18673. var index = objLength;
  18674. while (index--) {
  18675. var key = objProps[index];
  18676. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  18677. return false;
  18678. }
  18679. }
  18680. // Assume cyclic values are equal.
  18681. var stacked = stack.get(object);
  18682. if (stacked && stack.get(other)) {
  18683. return stacked == other;
  18684. }
  18685. var result = true;
  18686. stack.set(object, other);
  18687. stack.set(other, object);
  18688. var skipCtor = isPartial;
  18689. while (++index < objLength) {
  18690. key = objProps[index];
  18691. var objValue = object[key],
  18692. othValue = other[key];
  18693. if (customizer) {
  18694. var compared = isPartial
  18695. ? customizer(othValue, objValue, key, other, object, stack)
  18696. : customizer(objValue, othValue, key, object, other, stack);
  18697. }
  18698. // Recursively compare objects (susceptible to call stack limits).
  18699. if (!(compared === undefined
  18700. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  18701. : compared
  18702. )) {
  18703. result = false;
  18704. break;
  18705. }
  18706. skipCtor || (skipCtor = key == 'constructor');
  18707. }
  18708. if (result && !skipCtor) {
  18709. var objCtor = object.constructor,
  18710. othCtor = other.constructor;
  18711. // Non `Object` object instances with different constructors are not equal.
  18712. if (objCtor != othCtor &&
  18713. ('constructor' in object && 'constructor' in other) &&
  18714. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  18715. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  18716. result = false;
  18717. }
  18718. }
  18719. stack['delete'](object);
  18720. stack['delete'](other);
  18721. return result;
  18722. }
  18723. /**
  18724. * A specialized version of `baseRest` which flattens the rest array.
  18725. *
  18726. * @private
  18727. * @param {Function} func The function to apply a rest parameter to.
  18728. * @returns {Function} Returns the new function.
  18729. */
  18730. function flatRest(func) {
  18731. return setToString(overRest(func, undefined, flatten), func + '');
  18732. }
  18733. /**
  18734. * Creates an array of own enumerable property names and symbols of `object`.
  18735. *
  18736. * @private
  18737. * @param {Object} object The object to query.
  18738. * @returns {Array} Returns the array of property names and symbols.
  18739. */
  18740. function getAllKeys(object) {
  18741. return baseGetAllKeys(object, keys, getSymbols);
  18742. }
  18743. /**
  18744. * Creates an array of own and inherited enumerable property names and
  18745. * symbols of `object`.
  18746. *
  18747. * @private
  18748. * @param {Object} object The object to query.
  18749. * @returns {Array} Returns the array of property names and symbols.
  18750. */
  18751. function getAllKeysIn(object) {
  18752. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  18753. }
  18754. /**
  18755. * Gets metadata for `func`.
  18756. *
  18757. * @private
  18758. * @param {Function} func The function to query.
  18759. * @returns {*} Returns the metadata for `func`.
  18760. */
  18761. var getData = !metaMap ? noop : function(func) {
  18762. return metaMap.get(func);
  18763. };
  18764. /**
  18765. * Gets the name of `func`.
  18766. *
  18767. * @private
  18768. * @param {Function} func The function to query.
  18769. * @returns {string} Returns the function name.
  18770. */
  18771. function getFuncName(func) {
  18772. var result = (func.name + ''),
  18773. array = realNames[result],
  18774. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  18775. while (length--) {
  18776. var data = array[length],
  18777. otherFunc = data.func;
  18778. if (otherFunc == null || otherFunc == func) {
  18779. return data.name;
  18780. }
  18781. }
  18782. return result;
  18783. }
  18784. /**
  18785. * Gets the argument placeholder value for `func`.
  18786. *
  18787. * @private
  18788. * @param {Function} func The function to inspect.
  18789. * @returns {*} Returns the placeholder value.
  18790. */
  18791. function getHolder(func) {
  18792. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  18793. return object.placeholder;
  18794. }
  18795. /**
  18796. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  18797. * this function returns the custom method, otherwise it returns `baseIteratee`.
  18798. * If arguments are provided, the chosen function is invoked with them and
  18799. * its result is returned.
  18800. *
  18801. * @private
  18802. * @param {*} [value] The value to convert to an iteratee.
  18803. * @param {number} [arity] The arity of the created iteratee.
  18804. * @returns {Function} Returns the chosen function or its result.
  18805. */
  18806. function getIteratee() {
  18807. var result = lodash.iteratee || iteratee;
  18808. result = result === iteratee ? baseIteratee : result;
  18809. return arguments.length ? result(arguments[0], arguments[1]) : result;
  18810. }
  18811. /**
  18812. * Gets the data for `map`.
  18813. *
  18814. * @private
  18815. * @param {Object} map The map to query.
  18816. * @param {string} key The reference key.
  18817. * @returns {*} Returns the map data.
  18818. */
  18819. function getMapData(map, key) {
  18820. var data = map.__data__;
  18821. return isKeyable(key)
  18822. ? data[typeof key == 'string' ? 'string' : 'hash']
  18823. : data.map;
  18824. }
  18825. /**
  18826. * Gets the property names, values, and compare flags of `object`.
  18827. *
  18828. * @private
  18829. * @param {Object} object The object to query.
  18830. * @returns {Array} Returns the match data of `object`.
  18831. */
  18832. function getMatchData(object) {
  18833. var result = keys(object),
  18834. length = result.length;
  18835. while (length--) {
  18836. var key = result[length],
  18837. value = object[key];
  18838. result[length] = [key, value, isStrictComparable(value)];
  18839. }
  18840. return result;
  18841. }
  18842. /**
  18843. * Gets the native function at `key` of `object`.
  18844. *
  18845. * @private
  18846. * @param {Object} object The object to query.
  18847. * @param {string} key The key of the method to get.
  18848. * @returns {*} Returns the function if it's native, else `undefined`.
  18849. */
  18850. function getNative(object, key) {
  18851. var value = getValue(object, key);
  18852. return baseIsNative(value) ? value : undefined;
  18853. }
  18854. /**
  18855. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  18856. *
  18857. * @private
  18858. * @param {*} value The value to query.
  18859. * @returns {string} Returns the raw `toStringTag`.
  18860. */
  18861. function getRawTag(value) {
  18862. var isOwn = hasOwnProperty.call(value, symToStringTag),
  18863. tag = value[symToStringTag];
  18864. try {
  18865. value[symToStringTag] = undefined;
  18866. var unmasked = true;
  18867. } catch (e) {}
  18868. var result = nativeObjectToString.call(value);
  18869. if (unmasked) {
  18870. if (isOwn) {
  18871. value[symToStringTag] = tag;
  18872. } else {
  18873. delete value[symToStringTag];
  18874. }
  18875. }
  18876. return result;
  18877. }
  18878. /**
  18879. * Creates an array of the own enumerable symbols of `object`.
  18880. *
  18881. * @private
  18882. * @param {Object} object The object to query.
  18883. * @returns {Array} Returns the array of symbols.
  18884. */
  18885. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  18886. if (object == null) {
  18887. return [];
  18888. }
  18889. object = Object(object);
  18890. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  18891. return propertyIsEnumerable.call(object, symbol);
  18892. });
  18893. };
  18894. /**
  18895. * Creates an array of the own and inherited enumerable symbols of `object`.
  18896. *
  18897. * @private
  18898. * @param {Object} object The object to query.
  18899. * @returns {Array} Returns the array of symbols.
  18900. */
  18901. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  18902. var result = [];
  18903. while (object) {
  18904. arrayPush(result, getSymbols(object));
  18905. object = getPrototype(object);
  18906. }
  18907. return result;
  18908. };
  18909. /**
  18910. * Gets the `toStringTag` of `value`.
  18911. *
  18912. * @private
  18913. * @param {*} value The value to query.
  18914. * @returns {string} Returns the `toStringTag`.
  18915. */
  18916. var getTag = baseGetTag;
  18917. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  18918. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  18919. (Map && getTag(new Map) != mapTag) ||
  18920. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  18921. (Set && getTag(new Set) != setTag) ||
  18922. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  18923. getTag = function(value) {
  18924. var result = baseGetTag(value),
  18925. Ctor = result == objectTag ? value.constructor : undefined,
  18926. ctorString = Ctor ? toSource(Ctor) : '';
  18927. if (ctorString) {
  18928. switch (ctorString) {
  18929. case dataViewCtorString: return dataViewTag;
  18930. case mapCtorString: return mapTag;
  18931. case promiseCtorString: return promiseTag;
  18932. case setCtorString: return setTag;
  18933. case weakMapCtorString: return weakMapTag;
  18934. }
  18935. }
  18936. return result;
  18937. };
  18938. }
  18939. /**
  18940. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  18941. *
  18942. * @private
  18943. * @param {number} start The start of the view.
  18944. * @param {number} end The end of the view.
  18945. * @param {Array} transforms The transformations to apply to the view.
  18946. * @returns {Object} Returns an object containing the `start` and `end`
  18947. * positions of the view.
  18948. */
  18949. function getView(start, end, transforms) {
  18950. var index = -1,
  18951. length = transforms.length;
  18952. while (++index < length) {
  18953. var data = transforms[index],
  18954. size = data.size;
  18955. switch (data.type) {
  18956. case 'drop': start += size; break;
  18957. case 'dropRight': end -= size; break;
  18958. case 'take': end = nativeMin(end, start + size); break;
  18959. case 'takeRight': start = nativeMax(start, end - size); break;
  18960. }
  18961. }
  18962. return { 'start': start, 'end': end };
  18963. }
  18964. /**
  18965. * Extracts wrapper details from the `source` body comment.
  18966. *
  18967. * @private
  18968. * @param {string} source The source to inspect.
  18969. * @returns {Array} Returns the wrapper details.
  18970. */
  18971. function getWrapDetails(source) {
  18972. var match = source.match(reWrapDetails);
  18973. return match ? match[1].split(reSplitDetails) : [];
  18974. }
  18975. /**
  18976. * Checks if `path` exists on `object`.
  18977. *
  18978. * @private
  18979. * @param {Object} object The object to query.
  18980. * @param {Array|string} path The path to check.
  18981. * @param {Function} hasFunc The function to check properties.
  18982. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  18983. */
  18984. function hasPath(object, path, hasFunc) {
  18985. path = castPath(path, object);
  18986. var index = -1,
  18987. length = path.length,
  18988. result = false;
  18989. while (++index < length) {
  18990. var key = toKey(path[index]);
  18991. if (!(result = object != null && hasFunc(object, key))) {
  18992. break;
  18993. }
  18994. object = object[key];
  18995. }
  18996. if (result || ++index != length) {
  18997. return result;
  18998. }
  18999. length = object == null ? 0 : object.length;
  19000. return !!length && isLength(length) && isIndex(key, length) &&
  19001. (isArray(object) || isArguments(object));
  19002. }
  19003. /**
  19004. * Initializes an array clone.
  19005. *
  19006. * @private
  19007. * @param {Array} array The array to clone.
  19008. * @returns {Array} Returns the initialized clone.
  19009. */
  19010. function initCloneArray(array) {
  19011. var length = array.length,
  19012. result = new array.constructor(length);
  19013. // Add properties assigned by `RegExp#exec`.
  19014. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  19015. result.index = array.index;
  19016. result.input = array.input;
  19017. }
  19018. return result;
  19019. }
  19020. /**
  19021. * Initializes an object clone.
  19022. *
  19023. * @private
  19024. * @param {Object} object The object to clone.
  19025. * @returns {Object} Returns the initialized clone.
  19026. */
  19027. function initCloneObject(object) {
  19028. return (typeof object.constructor == 'function' && !isPrototype(object))
  19029. ? baseCreate(getPrototype(object))
  19030. : {};
  19031. }
  19032. /**
  19033. * Initializes an object clone based on its `toStringTag`.
  19034. *
  19035. * **Note:** This function only supports cloning values with tags of
  19036. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  19037. *
  19038. * @private
  19039. * @param {Object} object The object to clone.
  19040. * @param {string} tag The `toStringTag` of the object to clone.
  19041. * @param {boolean} [isDeep] Specify a deep clone.
  19042. * @returns {Object} Returns the initialized clone.
  19043. */
  19044. function initCloneByTag(object, tag, isDeep) {
  19045. var Ctor = object.constructor;
  19046. switch (tag) {
  19047. case arrayBufferTag:
  19048. return cloneArrayBuffer(object);
  19049. case boolTag:
  19050. case dateTag:
  19051. return new Ctor(+object);
  19052. case dataViewTag:
  19053. return cloneDataView(object, isDeep);
  19054. case float32Tag: case float64Tag:
  19055. case int8Tag: case int16Tag: case int32Tag:
  19056. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  19057. return cloneTypedArray(object, isDeep);
  19058. case mapTag:
  19059. return new Ctor;
  19060. case numberTag:
  19061. case stringTag:
  19062. return new Ctor(object);
  19063. case regexpTag:
  19064. return cloneRegExp(object);
  19065. case setTag:
  19066. return new Ctor;
  19067. case symbolTag:
  19068. return cloneSymbol(object);
  19069. }
  19070. }
  19071. /**
  19072. * Inserts wrapper `details` in a comment at the top of the `source` body.
  19073. *
  19074. * @private
  19075. * @param {string} source The source to modify.
  19076. * @returns {Array} details The details to insert.
  19077. * @returns {string} Returns the modified source.
  19078. */
  19079. function insertWrapDetails(source, details) {
  19080. var length = details.length;
  19081. if (!length) {
  19082. return source;
  19083. }
  19084. var lastIndex = length - 1;
  19085. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  19086. details = details.join(length > 2 ? ', ' : ' ');
  19087. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  19088. }
  19089. /**
  19090. * Checks if `value` is a flattenable `arguments` object or array.
  19091. *
  19092. * @private
  19093. * @param {*} value The value to check.
  19094. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  19095. */
  19096. function isFlattenable(value) {
  19097. return isArray(value) || isArguments(value) ||
  19098. !!(spreadableSymbol && value && value[spreadableSymbol]);
  19099. }
  19100. /**
  19101. * Checks if `value` is a valid array-like index.
  19102. *
  19103. * @private
  19104. * @param {*} value The value to check.
  19105. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  19106. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  19107. */
  19108. function isIndex(value, length) {
  19109. var type = typeof value;
  19110. length = length == null ? MAX_SAFE_INTEGER : length;
  19111. return !!length &&
  19112. (type == 'number' ||
  19113. (type != 'symbol' && reIsUint.test(value))) &&
  19114. (value > -1 && value % 1 == 0 && value < length);
  19115. }
  19116. /**
  19117. * Checks if the given arguments are from an iteratee call.
  19118. *
  19119. * @private
  19120. * @param {*} value The potential iteratee value argument.
  19121. * @param {*} index The potential iteratee index or key argument.
  19122. * @param {*} object The potential iteratee object argument.
  19123. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  19124. * else `false`.
  19125. */
  19126. function isIterateeCall(value, index, object) {
  19127. if (!isObject(object)) {
  19128. return false;
  19129. }
  19130. var type = typeof index;
  19131. if (type == 'number'
  19132. ? (isArrayLike(object) && isIndex(index, object.length))
  19133. : (type == 'string' && index in object)
  19134. ) {
  19135. return eq(object[index], value);
  19136. }
  19137. return false;
  19138. }
  19139. /**
  19140. * Checks if `value` is a property name and not a property path.
  19141. *
  19142. * @private
  19143. * @param {*} value The value to check.
  19144. * @param {Object} [object] The object to query keys on.
  19145. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  19146. */
  19147. function isKey(value, object) {
  19148. if (isArray(value)) {
  19149. return false;
  19150. }
  19151. var type = typeof value;
  19152. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  19153. value == null || isSymbol(value)) {
  19154. return true;
  19155. }
  19156. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  19157. (object != null && value in Object(object));
  19158. }
  19159. /**
  19160. * Checks if `value` is suitable for use as unique object key.
  19161. *
  19162. * @private
  19163. * @param {*} value The value to check.
  19164. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  19165. */
  19166. function isKeyable(value) {
  19167. var type = typeof value;
  19168. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  19169. ? (value !== '__proto__')
  19170. : (value === null);
  19171. }
  19172. /**
  19173. * Checks if `func` has a lazy counterpart.
  19174. *
  19175. * @private
  19176. * @param {Function} func The function to check.
  19177. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  19178. * else `false`.
  19179. */
  19180. function isLaziable(func) {
  19181. var funcName = getFuncName(func),
  19182. other = lodash[funcName];
  19183. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  19184. return false;
  19185. }
  19186. if (func === other) {
  19187. return true;
  19188. }
  19189. var data = getData(other);
  19190. return !!data && func === data[0];
  19191. }
  19192. /**
  19193. * Checks if `func` has its source masked.
  19194. *
  19195. * @private
  19196. * @param {Function} func The function to check.
  19197. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  19198. */
  19199. function isMasked(func) {
  19200. return !!maskSrcKey && (maskSrcKey in func);
  19201. }
  19202. /**
  19203. * Checks if `func` is capable of being masked.
  19204. *
  19205. * @private
  19206. * @param {*} value The value to check.
  19207. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  19208. */
  19209. var isMaskable = coreJsData ? isFunction : stubFalse;
  19210. /**
  19211. * Checks if `value` is likely a prototype object.
  19212. *
  19213. * @private
  19214. * @param {*} value The value to check.
  19215. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  19216. */
  19217. function isPrototype(value) {
  19218. var Ctor = value && value.constructor,
  19219. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  19220. return value === proto;
  19221. }
  19222. /**
  19223. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  19224. *
  19225. * @private
  19226. * @param {*} value The value to check.
  19227. * @returns {boolean} Returns `true` if `value` if suitable for strict
  19228. * equality comparisons, else `false`.
  19229. */
  19230. function isStrictComparable(value) {
  19231. return value === value && !isObject(value);
  19232. }
  19233. /**
  19234. * A specialized version of `matchesProperty` for source values suitable
  19235. * for strict equality comparisons, i.e. `===`.
  19236. *
  19237. * @private
  19238. * @param {string} key The key of the property to get.
  19239. * @param {*} srcValue The value to match.
  19240. * @returns {Function} Returns the new spec function.
  19241. */
  19242. function matchesStrictComparable(key, srcValue) {
  19243. return function(object) {
  19244. if (object == null) {
  19245. return false;
  19246. }
  19247. return object[key] === srcValue &&
  19248. (srcValue !== undefined || (key in Object(object)));
  19249. };
  19250. }
  19251. /**
  19252. * A specialized version of `_.memoize` which clears the memoized function's
  19253. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  19254. *
  19255. * @private
  19256. * @param {Function} func The function to have its output memoized.
  19257. * @returns {Function} Returns the new memoized function.
  19258. */
  19259. function memoizeCapped(func) {
  19260. var result = memoize(func, function(key) {
  19261. if (cache.size === MAX_MEMOIZE_SIZE) {
  19262. cache.clear();
  19263. }
  19264. return key;
  19265. });
  19266. var cache = result.cache;
  19267. return result;
  19268. }
  19269. /**
  19270. * Merges the function metadata of `source` into `data`.
  19271. *
  19272. * Merging metadata reduces the number of wrappers used to invoke a function.
  19273. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  19274. * may be applied regardless of execution order. Methods like `_.ary` and
  19275. * `_.rearg` modify function arguments, making the order in which they are
  19276. * executed important, preventing the merging of metadata. However, we make
  19277. * an exception for a safe combined case where curried functions have `_.ary`
  19278. * and or `_.rearg` applied.
  19279. *
  19280. * @private
  19281. * @param {Array} data The destination metadata.
  19282. * @param {Array} source The source metadata.
  19283. * @returns {Array} Returns `data`.
  19284. */
  19285. function mergeData(data, source) {
  19286. var bitmask = data[1],
  19287. srcBitmask = source[1],
  19288. newBitmask = bitmask | srcBitmask,
  19289. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  19290. var isCombo =
  19291. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  19292. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  19293. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  19294. // Exit early if metadata can't be merged.
  19295. if (!(isCommon || isCombo)) {
  19296. return data;
  19297. }
  19298. // Use source `thisArg` if available.
  19299. if (srcBitmask & WRAP_BIND_FLAG) {
  19300. data[2] = source[2];
  19301. // Set when currying a bound function.
  19302. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  19303. }
  19304. // Compose partial arguments.
  19305. var value = source[3];
  19306. if (value) {
  19307. var partials = data[3];
  19308. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  19309. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  19310. }
  19311. // Compose partial right arguments.
  19312. value = source[5];
  19313. if (value) {
  19314. partials = data[5];
  19315. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  19316. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  19317. }
  19318. // Use source `argPos` if available.
  19319. value = source[7];
  19320. if (value) {
  19321. data[7] = value;
  19322. }
  19323. // Use source `ary` if it's smaller.
  19324. if (srcBitmask & WRAP_ARY_FLAG) {
  19325. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  19326. }
  19327. // Use source `arity` if one is not provided.
  19328. if (data[9] == null) {
  19329. data[9] = source[9];
  19330. }
  19331. // Use source `func` and merge bitmasks.
  19332. data[0] = source[0];
  19333. data[1] = newBitmask;
  19334. return data;
  19335. }
  19336. /**
  19337. * This function is like
  19338. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  19339. * except that it includes inherited enumerable properties.
  19340. *
  19341. * @private
  19342. * @param {Object} object The object to query.
  19343. * @returns {Array} Returns the array of property names.
  19344. */
  19345. function nativeKeysIn(object) {
  19346. var result = [];
  19347. if (object != null) {
  19348. for (var key in Object(object)) {
  19349. result.push(key);
  19350. }
  19351. }
  19352. return result;
  19353. }
  19354. /**
  19355. * Converts `value` to a string using `Object.prototype.toString`.
  19356. *
  19357. * @private
  19358. * @param {*} value The value to convert.
  19359. * @returns {string} Returns the converted string.
  19360. */
  19361. function objectToString(value) {
  19362. return nativeObjectToString.call(value);
  19363. }
  19364. /**
  19365. * A specialized version of `baseRest` which transforms the rest array.
  19366. *
  19367. * @private
  19368. * @param {Function} func The function to apply a rest parameter to.
  19369. * @param {number} [start=func.length-1] The start position of the rest parameter.
  19370. * @param {Function} transform The rest array transform.
  19371. * @returns {Function} Returns the new function.
  19372. */
  19373. function overRest(func, start, transform) {
  19374. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  19375. return function() {
  19376. var args = arguments,
  19377. index = -1,
  19378. length = nativeMax(args.length - start, 0),
  19379. array = Array(length);
  19380. while (++index < length) {
  19381. array[index] = args[start + index];
  19382. }
  19383. index = -1;
  19384. var otherArgs = Array(start + 1);
  19385. while (++index < start) {
  19386. otherArgs[index] = args[index];
  19387. }
  19388. otherArgs[start] = transform(array);
  19389. return apply(func, this, otherArgs);
  19390. };
  19391. }
  19392. /**
  19393. * Gets the parent value at `path` of `object`.
  19394. *
  19395. * @private
  19396. * @param {Object} object The object to query.
  19397. * @param {Array} path The path to get the parent value of.
  19398. * @returns {*} Returns the parent value.
  19399. */
  19400. function parent(object, path) {
  19401. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  19402. }
  19403. /**
  19404. * Reorder `array` according to the specified indexes where the element at
  19405. * the first index is assigned as the first element, the element at
  19406. * the second index is assigned as the second element, and so on.
  19407. *
  19408. * @private
  19409. * @param {Array} array The array to reorder.
  19410. * @param {Array} indexes The arranged array indexes.
  19411. * @returns {Array} Returns `array`.
  19412. */
  19413. function reorder(array, indexes) {
  19414. var arrLength = array.length,
  19415. length = nativeMin(indexes.length, arrLength),
  19416. oldArray = copyArray(array);
  19417. while (length--) {
  19418. var index = indexes[length];
  19419. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  19420. }
  19421. return array;
  19422. }
  19423. /**
  19424. * Gets the value at `key`, unless `key` is "__proto__".
  19425. *
  19426. * @private
  19427. * @param {Object} object The object to query.
  19428. * @param {string} key The key of the property to get.
  19429. * @returns {*} Returns the property value.
  19430. */
  19431. function safeGet(object, key) {
  19432. if (key == '__proto__') {
  19433. return;
  19434. }
  19435. return object[key];
  19436. }
  19437. /**
  19438. * Sets metadata for `func`.
  19439. *
  19440. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  19441. * period of time, it will trip its breaker and transition to an identity
  19442. * function to avoid garbage collection pauses in V8. See
  19443. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  19444. * for more details.
  19445. *
  19446. * @private
  19447. * @param {Function} func The function to associate metadata with.
  19448. * @param {*} data The metadata.
  19449. * @returns {Function} Returns `func`.
  19450. */
  19451. var setData = shortOut(baseSetData);
  19452. /**
  19453. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  19454. *
  19455. * @private
  19456. * @param {Function} func The function to delay.
  19457. * @param {number} wait The number of milliseconds to delay invocation.
  19458. * @returns {number|Object} Returns the timer id or timeout object.
  19459. */
  19460. var setTimeout = ctxSetTimeout || function(func, wait) {
  19461. return root.setTimeout(func, wait);
  19462. };
  19463. /**
  19464. * Sets the `toString` method of `func` to return `string`.
  19465. *
  19466. * @private
  19467. * @param {Function} func The function to modify.
  19468. * @param {Function} string The `toString` result.
  19469. * @returns {Function} Returns `func`.
  19470. */
  19471. var setToString = shortOut(baseSetToString);
  19472. /**
  19473. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  19474. * with wrapper details in a comment at the top of the source body.
  19475. *
  19476. * @private
  19477. * @param {Function} wrapper The function to modify.
  19478. * @param {Function} reference The reference function.
  19479. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  19480. * @returns {Function} Returns `wrapper`.
  19481. */
  19482. function setWrapToString(wrapper, reference, bitmask) {
  19483. var source = (reference + '');
  19484. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  19485. }
  19486. /**
  19487. * Creates a function that'll short out and invoke `identity` instead
  19488. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  19489. * milliseconds.
  19490. *
  19491. * @private
  19492. * @param {Function} func The function to restrict.
  19493. * @returns {Function} Returns the new shortable function.
  19494. */
  19495. function shortOut(func) {
  19496. var count = 0,
  19497. lastCalled = 0;
  19498. return function() {
  19499. var stamp = nativeNow(),
  19500. remaining = HOT_SPAN - (stamp - lastCalled);
  19501. lastCalled = stamp;
  19502. if (remaining > 0) {
  19503. if (++count >= HOT_COUNT) {
  19504. return arguments[0];
  19505. }
  19506. } else {
  19507. count = 0;
  19508. }
  19509. return func.apply(undefined, arguments);
  19510. };
  19511. }
  19512. /**
  19513. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  19514. *
  19515. * @private
  19516. * @param {Array} array The array to shuffle.
  19517. * @param {number} [size=array.length] The size of `array`.
  19518. * @returns {Array} Returns `array`.
  19519. */
  19520. function shuffleSelf(array, size) {
  19521. var index = -1,
  19522. length = array.length,
  19523. lastIndex = length - 1;
  19524. size = size === undefined ? length : size;
  19525. while (++index < size) {
  19526. var rand = baseRandom(index, lastIndex),
  19527. value = array[rand];
  19528. array[rand] = array[index];
  19529. array[index] = value;
  19530. }
  19531. array.length = size;
  19532. return array;
  19533. }
  19534. /**
  19535. * Converts `string` to a property path array.
  19536. *
  19537. * @private
  19538. * @param {string} string The string to convert.
  19539. * @returns {Array} Returns the property path array.
  19540. */
  19541. var stringToPath = memoizeCapped(function(string) {
  19542. var result = [];
  19543. if (string.charCodeAt(0) === 46 /* . */) {
  19544. result.push('');
  19545. }
  19546. string.replace(rePropName, function(match, number, quote, subString) {
  19547. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  19548. });
  19549. return result;
  19550. });
  19551. /**
  19552. * Converts `value` to a string key if it's not a string or symbol.
  19553. *
  19554. * @private
  19555. * @param {*} value The value to inspect.
  19556. * @returns {string|symbol} Returns the key.
  19557. */
  19558. function toKey(value) {
  19559. if (typeof value == 'string' || isSymbol(value)) {
  19560. return value;
  19561. }
  19562. var result = (value + '');
  19563. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  19564. }
  19565. /**
  19566. * Converts `func` to its source code.
  19567. *
  19568. * @private
  19569. * @param {Function} func The function to convert.
  19570. * @returns {string} Returns the source code.
  19571. */
  19572. function toSource(func) {
  19573. if (func != null) {
  19574. try {
  19575. return funcToString.call(func);
  19576. } catch (e) {}
  19577. try {
  19578. return (func + '');
  19579. } catch (e) {}
  19580. }
  19581. return '';
  19582. }
  19583. /**
  19584. * Updates wrapper `details` based on `bitmask` flags.
  19585. *
  19586. * @private
  19587. * @returns {Array} details The details to modify.
  19588. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  19589. * @returns {Array} Returns `details`.
  19590. */
  19591. function updateWrapDetails(details, bitmask) {
  19592. arrayEach(wrapFlags, function(pair) {
  19593. var value = '_.' + pair[0];
  19594. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  19595. details.push(value);
  19596. }
  19597. });
  19598. return details.sort();
  19599. }
  19600. /**
  19601. * Creates a clone of `wrapper`.
  19602. *
  19603. * @private
  19604. * @param {Object} wrapper The wrapper to clone.
  19605. * @returns {Object} Returns the cloned wrapper.
  19606. */
  19607. function wrapperClone(wrapper) {
  19608. if (wrapper instanceof LazyWrapper) {
  19609. return wrapper.clone();
  19610. }
  19611. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  19612. result.__actions__ = copyArray(wrapper.__actions__);
  19613. result.__index__ = wrapper.__index__;
  19614. result.__values__ = wrapper.__values__;
  19615. return result;
  19616. }
  19617. /*------------------------------------------------------------------------*/
  19618. /**
  19619. * Creates an array of elements split into groups the length of `size`.
  19620. * If `array` can't be split evenly, the final chunk will be the remaining
  19621. * elements.
  19622. *
  19623. * @static
  19624. * @memberOf _
  19625. * @since 3.0.0
  19626. * @category Array
  19627. * @param {Array} array The array to process.
  19628. * @param {number} [size=1] The length of each chunk
  19629. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  19630. * @returns {Array} Returns the new array of chunks.
  19631. * @example
  19632. *
  19633. * _.chunk(['a', 'b', 'c', 'd'], 2);
  19634. * // => [['a', 'b'], ['c', 'd']]
  19635. *
  19636. * _.chunk(['a', 'b', 'c', 'd'], 3);
  19637. * // => [['a', 'b', 'c'], ['d']]
  19638. */
  19639. function chunk(array, size, guard) {
  19640. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  19641. size = 1;
  19642. } else {
  19643. size = nativeMax(toInteger(size), 0);
  19644. }
  19645. var length = array == null ? 0 : array.length;
  19646. if (!length || size < 1) {
  19647. return [];
  19648. }
  19649. var index = 0,
  19650. resIndex = 0,
  19651. result = Array(nativeCeil(length / size));
  19652. while (index < length) {
  19653. result[resIndex++] = baseSlice(array, index, (index += size));
  19654. }
  19655. return result;
  19656. }
  19657. /**
  19658. * Creates an array with all falsey values removed. The values `false`, `null`,
  19659. * `0`, `""`, `undefined`, and `NaN` are falsey.
  19660. *
  19661. * @static
  19662. * @memberOf _
  19663. * @since 0.1.0
  19664. * @category Array
  19665. * @param {Array} array The array to compact.
  19666. * @returns {Array} Returns the new array of filtered values.
  19667. * @example
  19668. *
  19669. * _.compact([0, 1, false, 2, '', 3]);
  19670. * // => [1, 2, 3]
  19671. */
  19672. function compact(array) {
  19673. var index = -1,
  19674. length = array == null ? 0 : array.length,
  19675. resIndex = 0,
  19676. result = [];
  19677. while (++index < length) {
  19678. var value = array[index];
  19679. if (value) {
  19680. result[resIndex++] = value;
  19681. }
  19682. }
  19683. return result;
  19684. }
  19685. /**
  19686. * Creates a new array concatenating `array` with any additional arrays
  19687. * and/or values.
  19688. *
  19689. * @static
  19690. * @memberOf _
  19691. * @since 4.0.0
  19692. * @category Array
  19693. * @param {Array} array The array to concatenate.
  19694. * @param {...*} [values] The values to concatenate.
  19695. * @returns {Array} Returns the new concatenated array.
  19696. * @example
  19697. *
  19698. * var array = [1];
  19699. * var other = _.concat(array, 2, [3], [[4]]);
  19700. *
  19701. * console.log(other);
  19702. * // => [1, 2, 3, [4]]
  19703. *
  19704. * console.log(array);
  19705. * // => [1]
  19706. */
  19707. function concat() {
  19708. var length = arguments.length;
  19709. if (!length) {
  19710. return [];
  19711. }
  19712. var args = Array(length - 1),
  19713. array = arguments[0],
  19714. index = length;
  19715. while (index--) {
  19716. args[index - 1] = arguments[index];
  19717. }
  19718. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  19719. }
  19720. /**
  19721. * Creates an array of `array` values not included in the other given arrays
  19722. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  19723. * for equality comparisons. The order and references of result values are
  19724. * determined by the first array.
  19725. *
  19726. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  19727. *
  19728. * @static
  19729. * @memberOf _
  19730. * @since 0.1.0
  19731. * @category Array
  19732. * @param {Array} array The array to inspect.
  19733. * @param {...Array} [values] The values to exclude.
  19734. * @returns {Array} Returns the new array of filtered values.
  19735. * @see _.without, _.xor
  19736. * @example
  19737. *
  19738. * _.difference([2, 1], [2, 3]);
  19739. * // => [1]
  19740. */
  19741. var difference = baseRest(function(array, values) {
  19742. return isArrayLikeObject(array)
  19743. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  19744. : [];
  19745. });
  19746. /**
  19747. * This method is like `_.difference` except that it accepts `iteratee` which
  19748. * is invoked for each element of `array` and `values` to generate the criterion
  19749. * by which they're compared. The order and references of result values are
  19750. * determined by the first array. The iteratee is invoked with one argument:
  19751. * (value).
  19752. *
  19753. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  19754. *
  19755. * @static
  19756. * @memberOf _
  19757. * @since 4.0.0
  19758. * @category Array
  19759. * @param {Array} array The array to inspect.
  19760. * @param {...Array} [values] The values to exclude.
  19761. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  19762. * @returns {Array} Returns the new array of filtered values.
  19763. * @example
  19764. *
  19765. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  19766. * // => [1.2]
  19767. *
  19768. * // The `_.property` iteratee shorthand.
  19769. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  19770. * // => [{ 'x': 2 }]
  19771. */
  19772. var differenceBy = baseRest(function(array, values) {
  19773. var iteratee = last(values);
  19774. if (isArrayLikeObject(iteratee)) {
  19775. iteratee = undefined;
  19776. }
  19777. return isArrayLikeObject(array)
  19778. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  19779. : [];
  19780. });
  19781. /**
  19782. * This method is like `_.difference` except that it accepts `comparator`
  19783. * which is invoked to compare elements of `array` to `values`. The order and
  19784. * references of result values are determined by the first array. The comparator
  19785. * is invoked with two arguments: (arrVal, othVal).
  19786. *
  19787. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  19788. *
  19789. * @static
  19790. * @memberOf _
  19791. * @since 4.0.0
  19792. * @category Array
  19793. * @param {Array} array The array to inspect.
  19794. * @param {...Array} [values] The values to exclude.
  19795. * @param {Function} [comparator] The comparator invoked per element.
  19796. * @returns {Array} Returns the new array of filtered values.
  19797. * @example
  19798. *
  19799. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  19800. *
  19801. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  19802. * // => [{ 'x': 2, 'y': 1 }]
  19803. */
  19804. var differenceWith = baseRest(function(array, values) {
  19805. var comparator = last(values);
  19806. if (isArrayLikeObject(comparator)) {
  19807. comparator = undefined;
  19808. }
  19809. return isArrayLikeObject(array)
  19810. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  19811. : [];
  19812. });
  19813. /**
  19814. * Creates a slice of `array` with `n` elements dropped from the beginning.
  19815. *
  19816. * @static
  19817. * @memberOf _
  19818. * @since 0.5.0
  19819. * @category Array
  19820. * @param {Array} array The array to query.
  19821. * @param {number} [n=1] The number of elements to drop.
  19822. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  19823. * @returns {Array} Returns the slice of `array`.
  19824. * @example
  19825. *
  19826. * _.drop([1, 2, 3]);
  19827. * // => [2, 3]
  19828. *
  19829. * _.drop([1, 2, 3], 2);
  19830. * // => [3]
  19831. *
  19832. * _.drop([1, 2, 3], 5);
  19833. * // => []
  19834. *
  19835. * _.drop([1, 2, 3], 0);
  19836. * // => [1, 2, 3]
  19837. */
  19838. function drop(array, n, guard) {
  19839. var length = array == null ? 0 : array.length;
  19840. if (!length) {
  19841. return [];
  19842. }
  19843. n = (guard || n === undefined) ? 1 : toInteger(n);
  19844. return baseSlice(array, n < 0 ? 0 : n, length);
  19845. }
  19846. /**
  19847. * Creates a slice of `array` with `n` elements dropped from the end.
  19848. *
  19849. * @static
  19850. * @memberOf _
  19851. * @since 3.0.0
  19852. * @category Array
  19853. * @param {Array} array The array to query.
  19854. * @param {number} [n=1] The number of elements to drop.
  19855. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  19856. * @returns {Array} Returns the slice of `array`.
  19857. * @example
  19858. *
  19859. * _.dropRight([1, 2, 3]);
  19860. * // => [1, 2]
  19861. *
  19862. * _.dropRight([1, 2, 3], 2);
  19863. * // => [1]
  19864. *
  19865. * _.dropRight([1, 2, 3], 5);
  19866. * // => []
  19867. *
  19868. * _.dropRight([1, 2, 3], 0);
  19869. * // => [1, 2, 3]
  19870. */
  19871. function dropRight(array, n, guard) {
  19872. var length = array == null ? 0 : array.length;
  19873. if (!length) {
  19874. return [];
  19875. }
  19876. n = (guard || n === undefined) ? 1 : toInteger(n);
  19877. n = length - n;
  19878. return baseSlice(array, 0, n < 0 ? 0 : n);
  19879. }
  19880. /**
  19881. * Creates a slice of `array` excluding elements dropped from the end.
  19882. * Elements are dropped until `predicate` returns falsey. The predicate is
  19883. * invoked with three arguments: (value, index, array).
  19884. *
  19885. * @static
  19886. * @memberOf _
  19887. * @since 3.0.0
  19888. * @category Array
  19889. * @param {Array} array The array to query.
  19890. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  19891. * @returns {Array} Returns the slice of `array`.
  19892. * @example
  19893. *
  19894. * var users = [
  19895. * { 'user': 'barney', 'active': true },
  19896. * { 'user': 'fred', 'active': false },
  19897. * { 'user': 'pebbles', 'active': false }
  19898. * ];
  19899. *
  19900. * _.dropRightWhile(users, function(o) { return !o.active; });
  19901. * // => objects for ['barney']
  19902. *
  19903. * // The `_.matches` iteratee shorthand.
  19904. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  19905. * // => objects for ['barney', 'fred']
  19906. *
  19907. * // The `_.matchesProperty` iteratee shorthand.
  19908. * _.dropRightWhile(users, ['active', false]);
  19909. * // => objects for ['barney']
  19910. *
  19911. * // The `_.property` iteratee shorthand.
  19912. * _.dropRightWhile(users, 'active');
  19913. * // => objects for ['barney', 'fred', 'pebbles']
  19914. */
  19915. function dropRightWhile(array, predicate) {
  19916. return (array && array.length)
  19917. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  19918. : [];
  19919. }
  19920. /**
  19921. * Creates a slice of `array` excluding elements dropped from the beginning.
  19922. * Elements are dropped until `predicate` returns falsey. The predicate is
  19923. * invoked with three arguments: (value, index, array).
  19924. *
  19925. * @static
  19926. * @memberOf _
  19927. * @since 3.0.0
  19928. * @category Array
  19929. * @param {Array} array The array to query.
  19930. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  19931. * @returns {Array} Returns the slice of `array`.
  19932. * @example
  19933. *
  19934. * var users = [
  19935. * { 'user': 'barney', 'active': false },
  19936. * { 'user': 'fred', 'active': false },
  19937. * { 'user': 'pebbles', 'active': true }
  19938. * ];
  19939. *
  19940. * _.dropWhile(users, function(o) { return !o.active; });
  19941. * // => objects for ['pebbles']
  19942. *
  19943. * // The `_.matches` iteratee shorthand.
  19944. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  19945. * // => objects for ['fred', 'pebbles']
  19946. *
  19947. * // The `_.matchesProperty` iteratee shorthand.
  19948. * _.dropWhile(users, ['active', false]);
  19949. * // => objects for ['pebbles']
  19950. *
  19951. * // The `_.property` iteratee shorthand.
  19952. * _.dropWhile(users, 'active');
  19953. * // => objects for ['barney', 'fred', 'pebbles']
  19954. */
  19955. function dropWhile(array, predicate) {
  19956. return (array && array.length)
  19957. ? baseWhile(array, getIteratee(predicate, 3), true)
  19958. : [];
  19959. }
  19960. /**
  19961. * Fills elements of `array` with `value` from `start` up to, but not
  19962. * including, `end`.
  19963. *
  19964. * **Note:** This method mutates `array`.
  19965. *
  19966. * @static
  19967. * @memberOf _
  19968. * @since 3.2.0
  19969. * @category Array
  19970. * @param {Array} array The array to fill.
  19971. * @param {*} value The value to fill `array` with.
  19972. * @param {number} [start=0] The start position.
  19973. * @param {number} [end=array.length] The end position.
  19974. * @returns {Array} Returns `array`.
  19975. * @example
  19976. *
  19977. * var array = [1, 2, 3];
  19978. *
  19979. * _.fill(array, 'a');
  19980. * console.log(array);
  19981. * // => ['a', 'a', 'a']
  19982. *
  19983. * _.fill(Array(3), 2);
  19984. * // => [2, 2, 2]
  19985. *
  19986. * _.fill([4, 6, 8, 10], '*', 1, 3);
  19987. * // => [4, '*', '*', 10]
  19988. */
  19989. function fill(array, value, start, end) {
  19990. var length = array == null ? 0 : array.length;
  19991. if (!length) {
  19992. return [];
  19993. }
  19994. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  19995. start = 0;
  19996. end = length;
  19997. }
  19998. return baseFill(array, value, start, end);
  19999. }
  20000. /**
  20001. * This method is like `_.find` except that it returns the index of the first
  20002. * element `predicate` returns truthy for instead of the element itself.
  20003. *
  20004. * @static
  20005. * @memberOf _
  20006. * @since 1.1.0
  20007. * @category Array
  20008. * @param {Array} array The array to inspect.
  20009. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20010. * @param {number} [fromIndex=0] The index to search from.
  20011. * @returns {number} Returns the index of the found element, else `-1`.
  20012. * @example
  20013. *
  20014. * var users = [
  20015. * { 'user': 'barney', 'active': false },
  20016. * { 'user': 'fred', 'active': false },
  20017. * { 'user': 'pebbles', 'active': true }
  20018. * ];
  20019. *
  20020. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  20021. * // => 0
  20022. *
  20023. * // The `_.matches` iteratee shorthand.
  20024. * _.findIndex(users, { 'user': 'fred', 'active': false });
  20025. * // => 1
  20026. *
  20027. * // The `_.matchesProperty` iteratee shorthand.
  20028. * _.findIndex(users, ['active', false]);
  20029. * // => 0
  20030. *
  20031. * // The `_.property` iteratee shorthand.
  20032. * _.findIndex(users, 'active');
  20033. * // => 2
  20034. */
  20035. function findIndex(array, predicate, fromIndex) {
  20036. var length = array == null ? 0 : array.length;
  20037. if (!length) {
  20038. return -1;
  20039. }
  20040. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  20041. if (index < 0) {
  20042. index = nativeMax(length + index, 0);
  20043. }
  20044. return baseFindIndex(array, getIteratee(predicate, 3), index);
  20045. }
  20046. /**
  20047. * This method is like `_.findIndex` except that it iterates over elements
  20048. * of `collection` from right to left.
  20049. *
  20050. * @static
  20051. * @memberOf _
  20052. * @since 2.0.0
  20053. * @category Array
  20054. * @param {Array} array The array to inspect.
  20055. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20056. * @param {number} [fromIndex=array.length-1] The index to search from.
  20057. * @returns {number} Returns the index of the found element, else `-1`.
  20058. * @example
  20059. *
  20060. * var users = [
  20061. * { 'user': 'barney', 'active': true },
  20062. * { 'user': 'fred', 'active': false },
  20063. * { 'user': 'pebbles', 'active': false }
  20064. * ];
  20065. *
  20066. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  20067. * // => 2
  20068. *
  20069. * // The `_.matches` iteratee shorthand.
  20070. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  20071. * // => 0
  20072. *
  20073. * // The `_.matchesProperty` iteratee shorthand.
  20074. * _.findLastIndex(users, ['active', false]);
  20075. * // => 2
  20076. *
  20077. * // The `_.property` iteratee shorthand.
  20078. * _.findLastIndex(users, 'active');
  20079. * // => 0
  20080. */
  20081. function findLastIndex(array, predicate, fromIndex) {
  20082. var length = array == null ? 0 : array.length;
  20083. if (!length) {
  20084. return -1;
  20085. }
  20086. var index = length - 1;
  20087. if (fromIndex !== undefined) {
  20088. index = toInteger(fromIndex);
  20089. index = fromIndex < 0
  20090. ? nativeMax(length + index, 0)
  20091. : nativeMin(index, length - 1);
  20092. }
  20093. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  20094. }
  20095. /**
  20096. * Flattens `array` a single level deep.
  20097. *
  20098. * @static
  20099. * @memberOf _
  20100. * @since 0.1.0
  20101. * @category Array
  20102. * @param {Array} array The array to flatten.
  20103. * @returns {Array} Returns the new flattened array.
  20104. * @example
  20105. *
  20106. * _.flatten([1, [2, [3, [4]], 5]]);
  20107. * // => [1, 2, [3, [4]], 5]
  20108. */
  20109. function flatten(array) {
  20110. var length = array == null ? 0 : array.length;
  20111. return length ? baseFlatten(array, 1) : [];
  20112. }
  20113. /**
  20114. * Recursively flattens `array`.
  20115. *
  20116. * @static
  20117. * @memberOf _
  20118. * @since 3.0.0
  20119. * @category Array
  20120. * @param {Array} array The array to flatten.
  20121. * @returns {Array} Returns the new flattened array.
  20122. * @example
  20123. *
  20124. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  20125. * // => [1, 2, 3, 4, 5]
  20126. */
  20127. function flattenDeep(array) {
  20128. var length = array == null ? 0 : array.length;
  20129. return length ? baseFlatten(array, INFINITY) : [];
  20130. }
  20131. /**
  20132. * Recursively flatten `array` up to `depth` times.
  20133. *
  20134. * @static
  20135. * @memberOf _
  20136. * @since 4.4.0
  20137. * @category Array
  20138. * @param {Array} array The array to flatten.
  20139. * @param {number} [depth=1] The maximum recursion depth.
  20140. * @returns {Array} Returns the new flattened array.
  20141. * @example
  20142. *
  20143. * var array = [1, [2, [3, [4]], 5]];
  20144. *
  20145. * _.flattenDepth(array, 1);
  20146. * // => [1, 2, [3, [4]], 5]
  20147. *
  20148. * _.flattenDepth(array, 2);
  20149. * // => [1, 2, 3, [4], 5]
  20150. */
  20151. function flattenDepth(array, depth) {
  20152. var length = array == null ? 0 : array.length;
  20153. if (!length) {
  20154. return [];
  20155. }
  20156. depth = depth === undefined ? 1 : toInteger(depth);
  20157. return baseFlatten(array, depth);
  20158. }
  20159. /**
  20160. * The inverse of `_.toPairs`; this method returns an object composed
  20161. * from key-value `pairs`.
  20162. *
  20163. * @static
  20164. * @memberOf _
  20165. * @since 4.0.0
  20166. * @category Array
  20167. * @param {Array} pairs The key-value pairs.
  20168. * @returns {Object} Returns the new object.
  20169. * @example
  20170. *
  20171. * _.fromPairs([['a', 1], ['b', 2]]);
  20172. * // => { 'a': 1, 'b': 2 }
  20173. */
  20174. function fromPairs(pairs) {
  20175. var index = -1,
  20176. length = pairs == null ? 0 : pairs.length,
  20177. result = {};
  20178. while (++index < length) {
  20179. var pair = pairs[index];
  20180. result[pair[0]] = pair[1];
  20181. }
  20182. return result;
  20183. }
  20184. /**
  20185. * Gets the first element of `array`.
  20186. *
  20187. * @static
  20188. * @memberOf _
  20189. * @since 0.1.0
  20190. * @alias first
  20191. * @category Array
  20192. * @param {Array} array The array to query.
  20193. * @returns {*} Returns the first element of `array`.
  20194. * @example
  20195. *
  20196. * _.head([1, 2, 3]);
  20197. * // => 1
  20198. *
  20199. * _.head([]);
  20200. * // => undefined
  20201. */
  20202. function head(array) {
  20203. return (array && array.length) ? array[0] : undefined;
  20204. }
  20205. /**
  20206. * Gets the index at which the first occurrence of `value` is found in `array`
  20207. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20208. * for equality comparisons. If `fromIndex` is negative, it's used as the
  20209. * offset from the end of `array`.
  20210. *
  20211. * @static
  20212. * @memberOf _
  20213. * @since 0.1.0
  20214. * @category Array
  20215. * @param {Array} array The array to inspect.
  20216. * @param {*} value The value to search for.
  20217. * @param {number} [fromIndex=0] The index to search from.
  20218. * @returns {number} Returns the index of the matched value, else `-1`.
  20219. * @example
  20220. *
  20221. * _.indexOf([1, 2, 1, 2], 2);
  20222. * // => 1
  20223. *
  20224. * // Search from the `fromIndex`.
  20225. * _.indexOf([1, 2, 1, 2], 2, 2);
  20226. * // => 3
  20227. */
  20228. function indexOf(array, value, fromIndex) {
  20229. var length = array == null ? 0 : array.length;
  20230. if (!length) {
  20231. return -1;
  20232. }
  20233. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  20234. if (index < 0) {
  20235. index = nativeMax(length + index, 0);
  20236. }
  20237. return baseIndexOf(array, value, index);
  20238. }
  20239. /**
  20240. * Gets all but the last element of `array`.
  20241. *
  20242. * @static
  20243. * @memberOf _
  20244. * @since 0.1.0
  20245. * @category Array
  20246. * @param {Array} array The array to query.
  20247. * @returns {Array} Returns the slice of `array`.
  20248. * @example
  20249. *
  20250. * _.initial([1, 2, 3]);
  20251. * // => [1, 2]
  20252. */
  20253. function initial(array) {
  20254. var length = array == null ? 0 : array.length;
  20255. return length ? baseSlice(array, 0, -1) : [];
  20256. }
  20257. /**
  20258. * Creates an array of unique values that are included in all given arrays
  20259. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20260. * for equality comparisons. The order and references of result values are
  20261. * determined by the first array.
  20262. *
  20263. * @static
  20264. * @memberOf _
  20265. * @since 0.1.0
  20266. * @category Array
  20267. * @param {...Array} [arrays] The arrays to inspect.
  20268. * @returns {Array} Returns the new array of intersecting values.
  20269. * @example
  20270. *
  20271. * _.intersection([2, 1], [2, 3]);
  20272. * // => [2]
  20273. */
  20274. var intersection = baseRest(function(arrays) {
  20275. var mapped = arrayMap(arrays, castArrayLikeObject);
  20276. return (mapped.length && mapped[0] === arrays[0])
  20277. ? baseIntersection(mapped)
  20278. : [];
  20279. });
  20280. /**
  20281. * This method is like `_.intersection` except that it accepts `iteratee`
  20282. * which is invoked for each element of each `arrays` to generate the criterion
  20283. * by which they're compared. The order and references of result values are
  20284. * determined by the first array. The iteratee is invoked with one argument:
  20285. * (value).
  20286. *
  20287. * @static
  20288. * @memberOf _
  20289. * @since 4.0.0
  20290. * @category Array
  20291. * @param {...Array} [arrays] The arrays to inspect.
  20292. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  20293. * @returns {Array} Returns the new array of intersecting values.
  20294. * @example
  20295. *
  20296. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  20297. * // => [2.1]
  20298. *
  20299. * // The `_.property` iteratee shorthand.
  20300. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  20301. * // => [{ 'x': 1 }]
  20302. */
  20303. var intersectionBy = baseRest(function(arrays) {
  20304. var iteratee = last(arrays),
  20305. mapped = arrayMap(arrays, castArrayLikeObject);
  20306. if (iteratee === last(mapped)) {
  20307. iteratee = undefined;
  20308. } else {
  20309. mapped.pop();
  20310. }
  20311. return (mapped.length && mapped[0] === arrays[0])
  20312. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  20313. : [];
  20314. });
  20315. /**
  20316. * This method is like `_.intersection` except that it accepts `comparator`
  20317. * which is invoked to compare elements of `arrays`. The order and references
  20318. * of result values are determined by the first array. The comparator is
  20319. * invoked with two arguments: (arrVal, othVal).
  20320. *
  20321. * @static
  20322. * @memberOf _
  20323. * @since 4.0.0
  20324. * @category Array
  20325. * @param {...Array} [arrays] The arrays to inspect.
  20326. * @param {Function} [comparator] The comparator invoked per element.
  20327. * @returns {Array} Returns the new array of intersecting values.
  20328. * @example
  20329. *
  20330. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  20331. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  20332. *
  20333. * _.intersectionWith(objects, others, _.isEqual);
  20334. * // => [{ 'x': 1, 'y': 2 }]
  20335. */
  20336. var intersectionWith = baseRest(function(arrays) {
  20337. var comparator = last(arrays),
  20338. mapped = arrayMap(arrays, castArrayLikeObject);
  20339. comparator = typeof comparator == 'function' ? comparator : undefined;
  20340. if (comparator) {
  20341. mapped.pop();
  20342. }
  20343. return (mapped.length && mapped[0] === arrays[0])
  20344. ? baseIntersection(mapped, undefined, comparator)
  20345. : [];
  20346. });
  20347. /**
  20348. * Converts all elements in `array` into a string separated by `separator`.
  20349. *
  20350. * @static
  20351. * @memberOf _
  20352. * @since 4.0.0
  20353. * @category Array
  20354. * @param {Array} array The array to convert.
  20355. * @param {string} [separator=','] The element separator.
  20356. * @returns {string} Returns the joined string.
  20357. * @example
  20358. *
  20359. * _.join(['a', 'b', 'c'], '~');
  20360. * // => 'a~b~c'
  20361. */
  20362. function join(array, separator) {
  20363. return array == null ? '' : nativeJoin.call(array, separator);
  20364. }
  20365. /**
  20366. * Gets the last element of `array`.
  20367. *
  20368. * @static
  20369. * @memberOf _
  20370. * @since 0.1.0
  20371. * @category Array
  20372. * @param {Array} array The array to query.
  20373. * @returns {*} Returns the last element of `array`.
  20374. * @example
  20375. *
  20376. * _.last([1, 2, 3]);
  20377. * // => 3
  20378. */
  20379. function last(array) {
  20380. var length = array == null ? 0 : array.length;
  20381. return length ? array[length - 1] : undefined;
  20382. }
  20383. /**
  20384. * This method is like `_.indexOf` except that it iterates over elements of
  20385. * `array` from right to left.
  20386. *
  20387. * @static
  20388. * @memberOf _
  20389. * @since 0.1.0
  20390. * @category Array
  20391. * @param {Array} array The array to inspect.
  20392. * @param {*} value The value to search for.
  20393. * @param {number} [fromIndex=array.length-1] The index to search from.
  20394. * @returns {number} Returns the index of the matched value, else `-1`.
  20395. * @example
  20396. *
  20397. * _.lastIndexOf([1, 2, 1, 2], 2);
  20398. * // => 3
  20399. *
  20400. * // Search from the `fromIndex`.
  20401. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  20402. * // => 1
  20403. */
  20404. function lastIndexOf(array, value, fromIndex) {
  20405. var length = array == null ? 0 : array.length;
  20406. if (!length) {
  20407. return -1;
  20408. }
  20409. var index = length;
  20410. if (fromIndex !== undefined) {
  20411. index = toInteger(fromIndex);
  20412. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  20413. }
  20414. return value === value
  20415. ? strictLastIndexOf(array, value, index)
  20416. : baseFindIndex(array, baseIsNaN, index, true);
  20417. }
  20418. /**
  20419. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  20420. * element from the end is returned.
  20421. *
  20422. * @static
  20423. * @memberOf _
  20424. * @since 4.11.0
  20425. * @category Array
  20426. * @param {Array} array The array to query.
  20427. * @param {number} [n=0] The index of the element to return.
  20428. * @returns {*} Returns the nth element of `array`.
  20429. * @example
  20430. *
  20431. * var array = ['a', 'b', 'c', 'd'];
  20432. *
  20433. * _.nth(array, 1);
  20434. * // => 'b'
  20435. *
  20436. * _.nth(array, -2);
  20437. * // => 'c';
  20438. */
  20439. function nth(array, n) {
  20440. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  20441. }
  20442. /**
  20443. * Removes all given values from `array` using
  20444. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20445. * for equality comparisons.
  20446. *
  20447. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  20448. * to remove elements from an array by predicate.
  20449. *
  20450. * @static
  20451. * @memberOf _
  20452. * @since 2.0.0
  20453. * @category Array
  20454. * @param {Array} array The array to modify.
  20455. * @param {...*} [values] The values to remove.
  20456. * @returns {Array} Returns `array`.
  20457. * @example
  20458. *
  20459. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  20460. *
  20461. * _.pull(array, 'a', 'c');
  20462. * console.log(array);
  20463. * // => ['b', 'b']
  20464. */
  20465. var pull = baseRest(pullAll);
  20466. /**
  20467. * This method is like `_.pull` except that it accepts an array of values to remove.
  20468. *
  20469. * **Note:** Unlike `_.difference`, this method mutates `array`.
  20470. *
  20471. * @static
  20472. * @memberOf _
  20473. * @since 4.0.0
  20474. * @category Array
  20475. * @param {Array} array The array to modify.
  20476. * @param {Array} values The values to remove.
  20477. * @returns {Array} Returns `array`.
  20478. * @example
  20479. *
  20480. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  20481. *
  20482. * _.pullAll(array, ['a', 'c']);
  20483. * console.log(array);
  20484. * // => ['b', 'b']
  20485. */
  20486. function pullAll(array, values) {
  20487. return (array && array.length && values && values.length)
  20488. ? basePullAll(array, values)
  20489. : array;
  20490. }
  20491. /**
  20492. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  20493. * invoked for each element of `array` and `values` to generate the criterion
  20494. * by which they're compared. The iteratee is invoked with one argument: (value).
  20495. *
  20496. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  20497. *
  20498. * @static
  20499. * @memberOf _
  20500. * @since 4.0.0
  20501. * @category Array
  20502. * @param {Array} array The array to modify.
  20503. * @param {Array} values The values to remove.
  20504. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  20505. * @returns {Array} Returns `array`.
  20506. * @example
  20507. *
  20508. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  20509. *
  20510. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  20511. * console.log(array);
  20512. * // => [{ 'x': 2 }]
  20513. */
  20514. function pullAllBy(array, values, iteratee) {
  20515. return (array && array.length && values && values.length)
  20516. ? basePullAll(array, values, getIteratee(iteratee, 2))
  20517. : array;
  20518. }
  20519. /**
  20520. * This method is like `_.pullAll` except that it accepts `comparator` which
  20521. * is invoked to compare elements of `array` to `values`. The comparator is
  20522. * invoked with two arguments: (arrVal, othVal).
  20523. *
  20524. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  20525. *
  20526. * @static
  20527. * @memberOf _
  20528. * @since 4.6.0
  20529. * @category Array
  20530. * @param {Array} array The array to modify.
  20531. * @param {Array} values The values to remove.
  20532. * @param {Function} [comparator] The comparator invoked per element.
  20533. * @returns {Array} Returns `array`.
  20534. * @example
  20535. *
  20536. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  20537. *
  20538. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  20539. * console.log(array);
  20540. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  20541. */
  20542. function pullAllWith(array, values, comparator) {
  20543. return (array && array.length && values && values.length)
  20544. ? basePullAll(array, values, undefined, comparator)
  20545. : array;
  20546. }
  20547. /**
  20548. * Removes elements from `array` corresponding to `indexes` and returns an
  20549. * array of removed elements.
  20550. *
  20551. * **Note:** Unlike `_.at`, this method mutates `array`.
  20552. *
  20553. * @static
  20554. * @memberOf _
  20555. * @since 3.0.0
  20556. * @category Array
  20557. * @param {Array} array The array to modify.
  20558. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  20559. * @returns {Array} Returns the new array of removed elements.
  20560. * @example
  20561. *
  20562. * var array = ['a', 'b', 'c', 'd'];
  20563. * var pulled = _.pullAt(array, [1, 3]);
  20564. *
  20565. * console.log(array);
  20566. * // => ['a', 'c']
  20567. *
  20568. * console.log(pulled);
  20569. * // => ['b', 'd']
  20570. */
  20571. var pullAt = flatRest(function(array, indexes) {
  20572. var length = array == null ? 0 : array.length,
  20573. result = baseAt(array, indexes);
  20574. basePullAt(array, arrayMap(indexes, function(index) {
  20575. return isIndex(index, length) ? +index : index;
  20576. }).sort(compareAscending));
  20577. return result;
  20578. });
  20579. /**
  20580. * Removes all elements from `array` that `predicate` returns truthy for
  20581. * and returns an array of the removed elements. The predicate is invoked
  20582. * with three arguments: (value, index, array).
  20583. *
  20584. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  20585. * to pull elements from an array by value.
  20586. *
  20587. * @static
  20588. * @memberOf _
  20589. * @since 2.0.0
  20590. * @category Array
  20591. * @param {Array} array The array to modify.
  20592. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20593. * @returns {Array} Returns the new array of removed elements.
  20594. * @example
  20595. *
  20596. * var array = [1, 2, 3, 4];
  20597. * var evens = _.remove(array, function(n) {
  20598. * return n % 2 == 0;
  20599. * });
  20600. *
  20601. * console.log(array);
  20602. * // => [1, 3]
  20603. *
  20604. * console.log(evens);
  20605. * // => [2, 4]
  20606. */
  20607. function remove(array, predicate) {
  20608. var result = [];
  20609. if (!(array && array.length)) {
  20610. return result;
  20611. }
  20612. var index = -1,
  20613. indexes = [],
  20614. length = array.length;
  20615. predicate = getIteratee(predicate, 3);
  20616. while (++index < length) {
  20617. var value = array[index];
  20618. if (predicate(value, index, array)) {
  20619. result.push(value);
  20620. indexes.push(index);
  20621. }
  20622. }
  20623. basePullAt(array, indexes);
  20624. return result;
  20625. }
  20626. /**
  20627. * Reverses `array` so that the first element becomes the last, the second
  20628. * element becomes the second to last, and so on.
  20629. *
  20630. * **Note:** This method mutates `array` and is based on
  20631. * [`Array#reverse`](https://mdn.io/Array/reverse).
  20632. *
  20633. * @static
  20634. * @memberOf _
  20635. * @since 4.0.0
  20636. * @category Array
  20637. * @param {Array} array The array to modify.
  20638. * @returns {Array} Returns `array`.
  20639. * @example
  20640. *
  20641. * var array = [1, 2, 3];
  20642. *
  20643. * _.reverse(array);
  20644. * // => [3, 2, 1]
  20645. *
  20646. * console.log(array);
  20647. * // => [3, 2, 1]
  20648. */
  20649. function reverse(array) {
  20650. return array == null ? array : nativeReverse.call(array);
  20651. }
  20652. /**
  20653. * Creates a slice of `array` from `start` up to, but not including, `end`.
  20654. *
  20655. * **Note:** This method is used instead of
  20656. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  20657. * returned.
  20658. *
  20659. * @static
  20660. * @memberOf _
  20661. * @since 3.0.0
  20662. * @category Array
  20663. * @param {Array} array The array to slice.
  20664. * @param {number} [start=0] The start position.
  20665. * @param {number} [end=array.length] The end position.
  20666. * @returns {Array} Returns the slice of `array`.
  20667. */
  20668. function slice(array, start, end) {
  20669. var length = array == null ? 0 : array.length;
  20670. if (!length) {
  20671. return [];
  20672. }
  20673. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  20674. start = 0;
  20675. end = length;
  20676. }
  20677. else {
  20678. start = start == null ? 0 : toInteger(start);
  20679. end = end === undefined ? length : toInteger(end);
  20680. }
  20681. return baseSlice(array, start, end);
  20682. }
  20683. /**
  20684. * Uses a binary search to determine the lowest index at which `value`
  20685. * should be inserted into `array` in order to maintain its sort order.
  20686. *
  20687. * @static
  20688. * @memberOf _
  20689. * @since 0.1.0
  20690. * @category Array
  20691. * @param {Array} array The sorted array to inspect.
  20692. * @param {*} value The value to evaluate.
  20693. * @returns {number} Returns the index at which `value` should be inserted
  20694. * into `array`.
  20695. * @example
  20696. *
  20697. * _.sortedIndex([30, 50], 40);
  20698. * // => 1
  20699. */
  20700. function sortedIndex(array, value) {
  20701. return baseSortedIndex(array, value);
  20702. }
  20703. /**
  20704. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  20705. * which is invoked for `value` and each element of `array` to compute their
  20706. * sort ranking. The iteratee is invoked with one argument: (value).
  20707. *
  20708. * @static
  20709. * @memberOf _
  20710. * @since 4.0.0
  20711. * @category Array
  20712. * @param {Array} array The sorted array to inspect.
  20713. * @param {*} value The value to evaluate.
  20714. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  20715. * @returns {number} Returns the index at which `value` should be inserted
  20716. * into `array`.
  20717. * @example
  20718. *
  20719. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  20720. *
  20721. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  20722. * // => 0
  20723. *
  20724. * // The `_.property` iteratee shorthand.
  20725. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  20726. * // => 0
  20727. */
  20728. function sortedIndexBy(array, value, iteratee) {
  20729. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  20730. }
  20731. /**
  20732. * This method is like `_.indexOf` except that it performs a binary
  20733. * search on a sorted `array`.
  20734. *
  20735. * @static
  20736. * @memberOf _
  20737. * @since 4.0.0
  20738. * @category Array
  20739. * @param {Array} array The array to inspect.
  20740. * @param {*} value The value to search for.
  20741. * @returns {number} Returns the index of the matched value, else `-1`.
  20742. * @example
  20743. *
  20744. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  20745. * // => 1
  20746. */
  20747. function sortedIndexOf(array, value) {
  20748. var length = array == null ? 0 : array.length;
  20749. if (length) {
  20750. var index = baseSortedIndex(array, value);
  20751. if (index < length && eq(array[index], value)) {
  20752. return index;
  20753. }
  20754. }
  20755. return -1;
  20756. }
  20757. /**
  20758. * This method is like `_.sortedIndex` except that it returns the highest
  20759. * index at which `value` should be inserted into `array` in order to
  20760. * maintain its sort order.
  20761. *
  20762. * @static
  20763. * @memberOf _
  20764. * @since 3.0.0
  20765. * @category Array
  20766. * @param {Array} array The sorted array to inspect.
  20767. * @param {*} value The value to evaluate.
  20768. * @returns {number} Returns the index at which `value` should be inserted
  20769. * into `array`.
  20770. * @example
  20771. *
  20772. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  20773. * // => 4
  20774. */
  20775. function sortedLastIndex(array, value) {
  20776. return baseSortedIndex(array, value, true);
  20777. }
  20778. /**
  20779. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  20780. * which is invoked for `value` and each element of `array` to compute their
  20781. * sort ranking. The iteratee is invoked with one argument: (value).
  20782. *
  20783. * @static
  20784. * @memberOf _
  20785. * @since 4.0.0
  20786. * @category Array
  20787. * @param {Array} array The sorted array to inspect.
  20788. * @param {*} value The value to evaluate.
  20789. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  20790. * @returns {number} Returns the index at which `value` should be inserted
  20791. * into `array`.
  20792. * @example
  20793. *
  20794. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  20795. *
  20796. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  20797. * // => 1
  20798. *
  20799. * // The `_.property` iteratee shorthand.
  20800. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  20801. * // => 1
  20802. */
  20803. function sortedLastIndexBy(array, value, iteratee) {
  20804. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  20805. }
  20806. /**
  20807. * This method is like `_.lastIndexOf` except that it performs a binary
  20808. * search on a sorted `array`.
  20809. *
  20810. * @static
  20811. * @memberOf _
  20812. * @since 4.0.0
  20813. * @category Array
  20814. * @param {Array} array The array to inspect.
  20815. * @param {*} value The value to search for.
  20816. * @returns {number} Returns the index of the matched value, else `-1`.
  20817. * @example
  20818. *
  20819. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  20820. * // => 3
  20821. */
  20822. function sortedLastIndexOf(array, value) {
  20823. var length = array == null ? 0 : array.length;
  20824. if (length) {
  20825. var index = baseSortedIndex(array, value, true) - 1;
  20826. if (eq(array[index], value)) {
  20827. return index;
  20828. }
  20829. }
  20830. return -1;
  20831. }
  20832. /**
  20833. * This method is like `_.uniq` except that it's designed and optimized
  20834. * for sorted arrays.
  20835. *
  20836. * @static
  20837. * @memberOf _
  20838. * @since 4.0.0
  20839. * @category Array
  20840. * @param {Array} array The array to inspect.
  20841. * @returns {Array} Returns the new duplicate free array.
  20842. * @example
  20843. *
  20844. * _.sortedUniq([1, 1, 2]);
  20845. * // => [1, 2]
  20846. */
  20847. function sortedUniq(array) {
  20848. return (array && array.length)
  20849. ? baseSortedUniq(array)
  20850. : [];
  20851. }
  20852. /**
  20853. * This method is like `_.uniqBy` except that it's designed and optimized
  20854. * for sorted arrays.
  20855. *
  20856. * @static
  20857. * @memberOf _
  20858. * @since 4.0.0
  20859. * @category Array
  20860. * @param {Array} array The array to inspect.
  20861. * @param {Function} [iteratee] The iteratee invoked per element.
  20862. * @returns {Array} Returns the new duplicate free array.
  20863. * @example
  20864. *
  20865. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  20866. * // => [1.1, 2.3]
  20867. */
  20868. function sortedUniqBy(array, iteratee) {
  20869. return (array && array.length)
  20870. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  20871. : [];
  20872. }
  20873. /**
  20874. * Gets all but the first element of `array`.
  20875. *
  20876. * @static
  20877. * @memberOf _
  20878. * @since 4.0.0
  20879. * @category Array
  20880. * @param {Array} array The array to query.
  20881. * @returns {Array} Returns the slice of `array`.
  20882. * @example
  20883. *
  20884. * _.tail([1, 2, 3]);
  20885. * // => [2, 3]
  20886. */
  20887. function tail(array) {
  20888. var length = array == null ? 0 : array.length;
  20889. return length ? baseSlice(array, 1, length) : [];
  20890. }
  20891. /**
  20892. * Creates a slice of `array` with `n` elements taken from the beginning.
  20893. *
  20894. * @static
  20895. * @memberOf _
  20896. * @since 0.1.0
  20897. * @category Array
  20898. * @param {Array} array The array to query.
  20899. * @param {number} [n=1] The number of elements to take.
  20900. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20901. * @returns {Array} Returns the slice of `array`.
  20902. * @example
  20903. *
  20904. * _.take([1, 2, 3]);
  20905. * // => [1]
  20906. *
  20907. * _.take([1, 2, 3], 2);
  20908. * // => [1, 2]
  20909. *
  20910. * _.take([1, 2, 3], 5);
  20911. * // => [1, 2, 3]
  20912. *
  20913. * _.take([1, 2, 3], 0);
  20914. * // => []
  20915. */
  20916. function take(array, n, guard) {
  20917. if (!(array && array.length)) {
  20918. return [];
  20919. }
  20920. n = (guard || n === undefined) ? 1 : toInteger(n);
  20921. return baseSlice(array, 0, n < 0 ? 0 : n);
  20922. }
  20923. /**
  20924. * Creates a slice of `array` with `n` elements taken from the end.
  20925. *
  20926. * @static
  20927. * @memberOf _
  20928. * @since 3.0.0
  20929. * @category Array
  20930. * @param {Array} array The array to query.
  20931. * @param {number} [n=1] The number of elements to take.
  20932. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  20933. * @returns {Array} Returns the slice of `array`.
  20934. * @example
  20935. *
  20936. * _.takeRight([1, 2, 3]);
  20937. * // => [3]
  20938. *
  20939. * _.takeRight([1, 2, 3], 2);
  20940. * // => [2, 3]
  20941. *
  20942. * _.takeRight([1, 2, 3], 5);
  20943. * // => [1, 2, 3]
  20944. *
  20945. * _.takeRight([1, 2, 3], 0);
  20946. * // => []
  20947. */
  20948. function takeRight(array, n, guard) {
  20949. var length = array == null ? 0 : array.length;
  20950. if (!length) {
  20951. return [];
  20952. }
  20953. n = (guard || n === undefined) ? 1 : toInteger(n);
  20954. n = length - n;
  20955. return baseSlice(array, n < 0 ? 0 : n, length);
  20956. }
  20957. /**
  20958. * Creates a slice of `array` with elements taken from the end. Elements are
  20959. * taken until `predicate` returns falsey. The predicate is invoked with
  20960. * three arguments: (value, index, array).
  20961. *
  20962. * @static
  20963. * @memberOf _
  20964. * @since 3.0.0
  20965. * @category Array
  20966. * @param {Array} array The array to query.
  20967. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  20968. * @returns {Array} Returns the slice of `array`.
  20969. * @example
  20970. *
  20971. * var users = [
  20972. * { 'user': 'barney', 'active': true },
  20973. * { 'user': 'fred', 'active': false },
  20974. * { 'user': 'pebbles', 'active': false }
  20975. * ];
  20976. *
  20977. * _.takeRightWhile(users, function(o) { return !o.active; });
  20978. * // => objects for ['fred', 'pebbles']
  20979. *
  20980. * // The `_.matches` iteratee shorthand.
  20981. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  20982. * // => objects for ['pebbles']
  20983. *
  20984. * // The `_.matchesProperty` iteratee shorthand.
  20985. * _.takeRightWhile(users, ['active', false]);
  20986. * // => objects for ['fred', 'pebbles']
  20987. *
  20988. * // The `_.property` iteratee shorthand.
  20989. * _.takeRightWhile(users, 'active');
  20990. * // => []
  20991. */
  20992. function takeRightWhile(array, predicate) {
  20993. return (array && array.length)
  20994. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  20995. : [];
  20996. }
  20997. /**
  20998. * Creates a slice of `array` with elements taken from the beginning. Elements
  20999. * are taken until `predicate` returns falsey. The predicate is invoked with
  21000. * three arguments: (value, index, array).
  21001. *
  21002. * @static
  21003. * @memberOf _
  21004. * @since 3.0.0
  21005. * @category Array
  21006. * @param {Array} array The array to query.
  21007. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21008. * @returns {Array} Returns the slice of `array`.
  21009. * @example
  21010. *
  21011. * var users = [
  21012. * { 'user': 'barney', 'active': false },
  21013. * { 'user': 'fred', 'active': false },
  21014. * { 'user': 'pebbles', 'active': true }
  21015. * ];
  21016. *
  21017. * _.takeWhile(users, function(o) { return !o.active; });
  21018. * // => objects for ['barney', 'fred']
  21019. *
  21020. * // The `_.matches` iteratee shorthand.
  21021. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  21022. * // => objects for ['barney']
  21023. *
  21024. * // The `_.matchesProperty` iteratee shorthand.
  21025. * _.takeWhile(users, ['active', false]);
  21026. * // => objects for ['barney', 'fred']
  21027. *
  21028. * // The `_.property` iteratee shorthand.
  21029. * _.takeWhile(users, 'active');
  21030. * // => []
  21031. */
  21032. function takeWhile(array, predicate) {
  21033. return (array && array.length)
  21034. ? baseWhile(array, getIteratee(predicate, 3))
  21035. : [];
  21036. }
  21037. /**
  21038. * Creates an array of unique values, in order, from all given arrays using
  21039. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21040. * for equality comparisons.
  21041. *
  21042. * @static
  21043. * @memberOf _
  21044. * @since 0.1.0
  21045. * @category Array
  21046. * @param {...Array} [arrays] The arrays to inspect.
  21047. * @returns {Array} Returns the new array of combined values.
  21048. * @example
  21049. *
  21050. * _.union([2], [1, 2]);
  21051. * // => [2, 1]
  21052. */
  21053. var union = baseRest(function(arrays) {
  21054. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  21055. });
  21056. /**
  21057. * This method is like `_.union` except that it accepts `iteratee` which is
  21058. * invoked for each element of each `arrays` to generate the criterion by
  21059. * which uniqueness is computed. Result values are chosen from the first
  21060. * array in which the value occurs. The iteratee is invoked with one argument:
  21061. * (value).
  21062. *
  21063. * @static
  21064. * @memberOf _
  21065. * @since 4.0.0
  21066. * @category Array
  21067. * @param {...Array} [arrays] The arrays to inspect.
  21068. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21069. * @returns {Array} Returns the new array of combined values.
  21070. * @example
  21071. *
  21072. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  21073. * // => [2.1, 1.2]
  21074. *
  21075. * // The `_.property` iteratee shorthand.
  21076. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  21077. * // => [{ 'x': 1 }, { 'x': 2 }]
  21078. */
  21079. var unionBy = baseRest(function(arrays) {
  21080. var iteratee = last(arrays);
  21081. if (isArrayLikeObject(iteratee)) {
  21082. iteratee = undefined;
  21083. }
  21084. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  21085. });
  21086. /**
  21087. * This method is like `_.union` except that it accepts `comparator` which
  21088. * is invoked to compare elements of `arrays`. Result values are chosen from
  21089. * the first array in which the value occurs. The comparator is invoked
  21090. * with two arguments: (arrVal, othVal).
  21091. *
  21092. * @static
  21093. * @memberOf _
  21094. * @since 4.0.0
  21095. * @category Array
  21096. * @param {...Array} [arrays] The arrays to inspect.
  21097. * @param {Function} [comparator] The comparator invoked per element.
  21098. * @returns {Array} Returns the new array of combined values.
  21099. * @example
  21100. *
  21101. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  21102. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  21103. *
  21104. * _.unionWith(objects, others, _.isEqual);
  21105. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  21106. */
  21107. var unionWith = baseRest(function(arrays) {
  21108. var comparator = last(arrays);
  21109. comparator = typeof comparator == 'function' ? comparator : undefined;
  21110. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  21111. });
  21112. /**
  21113. * Creates a duplicate-free version of an array, using
  21114. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21115. * for equality comparisons, in which only the first occurrence of each element
  21116. * is kept. The order of result values is determined by the order they occur
  21117. * in the array.
  21118. *
  21119. * @static
  21120. * @memberOf _
  21121. * @since 0.1.0
  21122. * @category Array
  21123. * @param {Array} array The array to inspect.
  21124. * @returns {Array} Returns the new duplicate free array.
  21125. * @example
  21126. *
  21127. * _.uniq([2, 1, 2]);
  21128. * // => [2, 1]
  21129. */
  21130. function uniq(array) {
  21131. return (array && array.length) ? baseUniq(array) : [];
  21132. }
  21133. /**
  21134. * This method is like `_.uniq` except that it accepts `iteratee` which is
  21135. * invoked for each element in `array` to generate the criterion by which
  21136. * uniqueness is computed. The order of result values is determined by the
  21137. * order they occur in the array. The iteratee is invoked with one argument:
  21138. * (value).
  21139. *
  21140. * @static
  21141. * @memberOf _
  21142. * @since 4.0.0
  21143. * @category Array
  21144. * @param {Array} array The array to inspect.
  21145. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21146. * @returns {Array} Returns the new duplicate free array.
  21147. * @example
  21148. *
  21149. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  21150. * // => [2.1, 1.2]
  21151. *
  21152. * // The `_.property` iteratee shorthand.
  21153. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  21154. * // => [{ 'x': 1 }, { 'x': 2 }]
  21155. */
  21156. function uniqBy(array, iteratee) {
  21157. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  21158. }
  21159. /**
  21160. * This method is like `_.uniq` except that it accepts `comparator` which
  21161. * is invoked to compare elements of `array`. The order of result values is
  21162. * determined by the order they occur in the array.The comparator is invoked
  21163. * with two arguments: (arrVal, othVal).
  21164. *
  21165. * @static
  21166. * @memberOf _
  21167. * @since 4.0.0
  21168. * @category Array
  21169. * @param {Array} array The array to inspect.
  21170. * @param {Function} [comparator] The comparator invoked per element.
  21171. * @returns {Array} Returns the new duplicate free array.
  21172. * @example
  21173. *
  21174. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  21175. *
  21176. * _.uniqWith(objects, _.isEqual);
  21177. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  21178. */
  21179. function uniqWith(array, comparator) {
  21180. comparator = typeof comparator == 'function' ? comparator : undefined;
  21181. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  21182. }
  21183. /**
  21184. * This method is like `_.zip` except that it accepts an array of grouped
  21185. * elements and creates an array regrouping the elements to their pre-zip
  21186. * configuration.
  21187. *
  21188. * @static
  21189. * @memberOf _
  21190. * @since 1.2.0
  21191. * @category Array
  21192. * @param {Array} array The array of grouped elements to process.
  21193. * @returns {Array} Returns the new array of regrouped elements.
  21194. * @example
  21195. *
  21196. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  21197. * // => [['a', 1, true], ['b', 2, false]]
  21198. *
  21199. * _.unzip(zipped);
  21200. * // => [['a', 'b'], [1, 2], [true, false]]
  21201. */
  21202. function unzip(array) {
  21203. if (!(array && array.length)) {
  21204. return [];
  21205. }
  21206. var length = 0;
  21207. array = arrayFilter(array, function(group) {
  21208. if (isArrayLikeObject(group)) {
  21209. length = nativeMax(group.length, length);
  21210. return true;
  21211. }
  21212. });
  21213. return baseTimes(length, function(index) {
  21214. return arrayMap(array, baseProperty(index));
  21215. });
  21216. }
  21217. /**
  21218. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  21219. * how regrouped values should be combined. The iteratee is invoked with the
  21220. * elements of each group: (...group).
  21221. *
  21222. * @static
  21223. * @memberOf _
  21224. * @since 3.8.0
  21225. * @category Array
  21226. * @param {Array} array The array of grouped elements to process.
  21227. * @param {Function} [iteratee=_.identity] The function to combine
  21228. * regrouped values.
  21229. * @returns {Array} Returns the new array of regrouped elements.
  21230. * @example
  21231. *
  21232. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  21233. * // => [[1, 10, 100], [2, 20, 200]]
  21234. *
  21235. * _.unzipWith(zipped, _.add);
  21236. * // => [3, 30, 300]
  21237. */
  21238. function unzipWith(array, iteratee) {
  21239. if (!(array && array.length)) {
  21240. return [];
  21241. }
  21242. var result = unzip(array);
  21243. if (iteratee == null) {
  21244. return result;
  21245. }
  21246. return arrayMap(result, function(group) {
  21247. return apply(iteratee, undefined, group);
  21248. });
  21249. }
  21250. /**
  21251. * Creates an array excluding all given values using
  21252. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21253. * for equality comparisons.
  21254. *
  21255. * **Note:** Unlike `_.pull`, this method returns a new array.
  21256. *
  21257. * @static
  21258. * @memberOf _
  21259. * @since 0.1.0
  21260. * @category Array
  21261. * @param {Array} array The array to inspect.
  21262. * @param {...*} [values] The values to exclude.
  21263. * @returns {Array} Returns the new array of filtered values.
  21264. * @see _.difference, _.xor
  21265. * @example
  21266. *
  21267. * _.without([2, 1, 2, 3], 1, 2);
  21268. * // => [3]
  21269. */
  21270. var without = baseRest(function(array, values) {
  21271. return isArrayLikeObject(array)
  21272. ? baseDifference(array, values)
  21273. : [];
  21274. });
  21275. /**
  21276. * Creates an array of unique values that is the
  21277. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  21278. * of the given arrays. The order of result values is determined by the order
  21279. * they occur in the arrays.
  21280. *
  21281. * @static
  21282. * @memberOf _
  21283. * @since 2.4.0
  21284. * @category Array
  21285. * @param {...Array} [arrays] The arrays to inspect.
  21286. * @returns {Array} Returns the new array of filtered values.
  21287. * @see _.difference, _.without
  21288. * @example
  21289. *
  21290. * _.xor([2, 1], [2, 3]);
  21291. * // => [1, 3]
  21292. */
  21293. var xor = baseRest(function(arrays) {
  21294. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  21295. });
  21296. /**
  21297. * This method is like `_.xor` except that it accepts `iteratee` which is
  21298. * invoked for each element of each `arrays` to generate the criterion by
  21299. * which by which they're compared. The order of result values is determined
  21300. * by the order they occur in the arrays. The iteratee is invoked with one
  21301. * argument: (value).
  21302. *
  21303. * @static
  21304. * @memberOf _
  21305. * @since 4.0.0
  21306. * @category Array
  21307. * @param {...Array} [arrays] The arrays to inspect.
  21308. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  21309. * @returns {Array} Returns the new array of filtered values.
  21310. * @example
  21311. *
  21312. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  21313. * // => [1.2, 3.4]
  21314. *
  21315. * // The `_.property` iteratee shorthand.
  21316. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  21317. * // => [{ 'x': 2 }]
  21318. */
  21319. var xorBy = baseRest(function(arrays) {
  21320. var iteratee = last(arrays);
  21321. if (isArrayLikeObject(iteratee)) {
  21322. iteratee = undefined;
  21323. }
  21324. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  21325. });
  21326. /**
  21327. * This method is like `_.xor` except that it accepts `comparator` which is
  21328. * invoked to compare elements of `arrays`. The order of result values is
  21329. * determined by the order they occur in the arrays. The comparator is invoked
  21330. * with two arguments: (arrVal, othVal).
  21331. *
  21332. * @static
  21333. * @memberOf _
  21334. * @since 4.0.0
  21335. * @category Array
  21336. * @param {...Array} [arrays] The arrays to inspect.
  21337. * @param {Function} [comparator] The comparator invoked per element.
  21338. * @returns {Array} Returns the new array of filtered values.
  21339. * @example
  21340. *
  21341. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  21342. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  21343. *
  21344. * _.xorWith(objects, others, _.isEqual);
  21345. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  21346. */
  21347. var xorWith = baseRest(function(arrays) {
  21348. var comparator = last(arrays);
  21349. comparator = typeof comparator == 'function' ? comparator : undefined;
  21350. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  21351. });
  21352. /**
  21353. * Creates an array of grouped elements, the first of which contains the
  21354. * first elements of the given arrays, the second of which contains the
  21355. * second elements of the given arrays, and so on.
  21356. *
  21357. * @static
  21358. * @memberOf _
  21359. * @since 0.1.0
  21360. * @category Array
  21361. * @param {...Array} [arrays] The arrays to process.
  21362. * @returns {Array} Returns the new array of grouped elements.
  21363. * @example
  21364. *
  21365. * _.zip(['a', 'b'], [1, 2], [true, false]);
  21366. * // => [['a', 1, true], ['b', 2, false]]
  21367. */
  21368. var zip = baseRest(unzip);
  21369. /**
  21370. * This method is like `_.fromPairs` except that it accepts two arrays,
  21371. * one of property identifiers and one of corresponding values.
  21372. *
  21373. * @static
  21374. * @memberOf _
  21375. * @since 0.4.0
  21376. * @category Array
  21377. * @param {Array} [props=[]] The property identifiers.
  21378. * @param {Array} [values=[]] The property values.
  21379. * @returns {Object} Returns the new object.
  21380. * @example
  21381. *
  21382. * _.zipObject(['a', 'b'], [1, 2]);
  21383. * // => { 'a': 1, 'b': 2 }
  21384. */
  21385. function zipObject(props, values) {
  21386. return baseZipObject(props || [], values || [], assignValue);
  21387. }
  21388. /**
  21389. * This method is like `_.zipObject` except that it supports property paths.
  21390. *
  21391. * @static
  21392. * @memberOf _
  21393. * @since 4.1.0
  21394. * @category Array
  21395. * @param {Array} [props=[]] The property identifiers.
  21396. * @param {Array} [values=[]] The property values.
  21397. * @returns {Object} Returns the new object.
  21398. * @example
  21399. *
  21400. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  21401. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  21402. */
  21403. function zipObjectDeep(props, values) {
  21404. return baseZipObject(props || [], values || [], baseSet);
  21405. }
  21406. /**
  21407. * This method is like `_.zip` except that it accepts `iteratee` to specify
  21408. * how grouped values should be combined. The iteratee is invoked with the
  21409. * elements of each group: (...group).
  21410. *
  21411. * @static
  21412. * @memberOf _
  21413. * @since 3.8.0
  21414. * @category Array
  21415. * @param {...Array} [arrays] The arrays to process.
  21416. * @param {Function} [iteratee=_.identity] The function to combine
  21417. * grouped values.
  21418. * @returns {Array} Returns the new array of grouped elements.
  21419. * @example
  21420. *
  21421. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  21422. * return a + b + c;
  21423. * });
  21424. * // => [111, 222]
  21425. */
  21426. var zipWith = baseRest(function(arrays) {
  21427. var length = arrays.length,
  21428. iteratee = length > 1 ? arrays[length - 1] : undefined;
  21429. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  21430. return unzipWith(arrays, iteratee);
  21431. });
  21432. /*------------------------------------------------------------------------*/
  21433. /**
  21434. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  21435. * chain sequences enabled. The result of such sequences must be unwrapped
  21436. * with `_#value`.
  21437. *
  21438. * @static
  21439. * @memberOf _
  21440. * @since 1.3.0
  21441. * @category Seq
  21442. * @param {*} value The value to wrap.
  21443. * @returns {Object} Returns the new `lodash` wrapper instance.
  21444. * @example
  21445. *
  21446. * var users = [
  21447. * { 'user': 'barney', 'age': 36 },
  21448. * { 'user': 'fred', 'age': 40 },
  21449. * { 'user': 'pebbles', 'age': 1 }
  21450. * ];
  21451. *
  21452. * var youngest = _
  21453. * .chain(users)
  21454. * .sortBy('age')
  21455. * .map(function(o) {
  21456. * return o.user + ' is ' + o.age;
  21457. * })
  21458. * .head()
  21459. * .value();
  21460. * // => 'pebbles is 1'
  21461. */
  21462. function chain(value) {
  21463. var result = lodash(value);
  21464. result.__chain__ = true;
  21465. return result;
  21466. }
  21467. /**
  21468. * This method invokes `interceptor` and returns `value`. The interceptor
  21469. * is invoked with one argument; (value). The purpose of this method is to
  21470. * "tap into" a method chain sequence in order to modify intermediate results.
  21471. *
  21472. * @static
  21473. * @memberOf _
  21474. * @since 0.1.0
  21475. * @category Seq
  21476. * @param {*} value The value to provide to `interceptor`.
  21477. * @param {Function} interceptor The function to invoke.
  21478. * @returns {*} Returns `value`.
  21479. * @example
  21480. *
  21481. * _([1, 2, 3])
  21482. * .tap(function(array) {
  21483. * // Mutate input array.
  21484. * array.pop();
  21485. * })
  21486. * .reverse()
  21487. * .value();
  21488. * // => [2, 1]
  21489. */
  21490. function tap(value, interceptor) {
  21491. interceptor(value);
  21492. return value;
  21493. }
  21494. /**
  21495. * This method is like `_.tap` except that it returns the result of `interceptor`.
  21496. * The purpose of this method is to "pass thru" values replacing intermediate
  21497. * results in a method chain sequence.
  21498. *
  21499. * @static
  21500. * @memberOf _
  21501. * @since 3.0.0
  21502. * @category Seq
  21503. * @param {*} value The value to provide to `interceptor`.
  21504. * @param {Function} interceptor The function to invoke.
  21505. * @returns {*} Returns the result of `interceptor`.
  21506. * @example
  21507. *
  21508. * _(' abc ')
  21509. * .chain()
  21510. * .trim()
  21511. * .thru(function(value) {
  21512. * return [value];
  21513. * })
  21514. * .value();
  21515. * // => ['abc']
  21516. */
  21517. function thru(value, interceptor) {
  21518. return interceptor(value);
  21519. }
  21520. /**
  21521. * This method is the wrapper version of `_.at`.
  21522. *
  21523. * @name at
  21524. * @memberOf _
  21525. * @since 1.0.0
  21526. * @category Seq
  21527. * @param {...(string|string[])} [paths] The property paths to pick.
  21528. * @returns {Object} Returns the new `lodash` wrapper instance.
  21529. * @example
  21530. *
  21531. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  21532. *
  21533. * _(object).at(['a[0].b.c', 'a[1]']).value();
  21534. * // => [3, 4]
  21535. */
  21536. var wrapperAt = flatRest(function(paths) {
  21537. var length = paths.length,
  21538. start = length ? paths[0] : 0,
  21539. value = this.__wrapped__,
  21540. interceptor = function(object) { return baseAt(object, paths); };
  21541. if (length > 1 || this.__actions__.length ||
  21542. !(value instanceof LazyWrapper) || !isIndex(start)) {
  21543. return this.thru(interceptor);
  21544. }
  21545. value = value.slice(start, +start + (length ? 1 : 0));
  21546. value.__actions__.push({
  21547. 'func': thru,
  21548. 'args': [interceptor],
  21549. 'thisArg': undefined
  21550. });
  21551. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  21552. if (length && !array.length) {
  21553. array.push(undefined);
  21554. }
  21555. return array;
  21556. });
  21557. });
  21558. /**
  21559. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  21560. *
  21561. * @name chain
  21562. * @memberOf _
  21563. * @since 0.1.0
  21564. * @category Seq
  21565. * @returns {Object} Returns the new `lodash` wrapper instance.
  21566. * @example
  21567. *
  21568. * var users = [
  21569. * { 'user': 'barney', 'age': 36 },
  21570. * { 'user': 'fred', 'age': 40 }
  21571. * ];
  21572. *
  21573. * // A sequence without explicit chaining.
  21574. * _(users).head();
  21575. * // => { 'user': 'barney', 'age': 36 }
  21576. *
  21577. * // A sequence with explicit chaining.
  21578. * _(users)
  21579. * .chain()
  21580. * .head()
  21581. * .pick('user')
  21582. * .value();
  21583. * // => { 'user': 'barney' }
  21584. */
  21585. function wrapperChain() {
  21586. return chain(this);
  21587. }
  21588. /**
  21589. * Executes the chain sequence and returns the wrapped result.
  21590. *
  21591. * @name commit
  21592. * @memberOf _
  21593. * @since 3.2.0
  21594. * @category Seq
  21595. * @returns {Object} Returns the new `lodash` wrapper instance.
  21596. * @example
  21597. *
  21598. * var array = [1, 2];
  21599. * var wrapped = _(array).push(3);
  21600. *
  21601. * console.log(array);
  21602. * // => [1, 2]
  21603. *
  21604. * wrapped = wrapped.commit();
  21605. * console.log(array);
  21606. * // => [1, 2, 3]
  21607. *
  21608. * wrapped.last();
  21609. * // => 3
  21610. *
  21611. * console.log(array);
  21612. * // => [1, 2, 3]
  21613. */
  21614. function wrapperCommit() {
  21615. return new LodashWrapper(this.value(), this.__chain__);
  21616. }
  21617. /**
  21618. * Gets the next value on a wrapped object following the
  21619. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  21620. *
  21621. * @name next
  21622. * @memberOf _
  21623. * @since 4.0.0
  21624. * @category Seq
  21625. * @returns {Object} Returns the next iterator value.
  21626. * @example
  21627. *
  21628. * var wrapped = _([1, 2]);
  21629. *
  21630. * wrapped.next();
  21631. * // => { 'done': false, 'value': 1 }
  21632. *
  21633. * wrapped.next();
  21634. * // => { 'done': false, 'value': 2 }
  21635. *
  21636. * wrapped.next();
  21637. * // => { 'done': true, 'value': undefined }
  21638. */
  21639. function wrapperNext() {
  21640. if (this.__values__ === undefined) {
  21641. this.__values__ = toArray(this.value());
  21642. }
  21643. var done = this.__index__ >= this.__values__.length,
  21644. value = done ? undefined : this.__values__[this.__index__++];
  21645. return { 'done': done, 'value': value };
  21646. }
  21647. /**
  21648. * Enables the wrapper to be iterable.
  21649. *
  21650. * @name Symbol.iterator
  21651. * @memberOf _
  21652. * @since 4.0.0
  21653. * @category Seq
  21654. * @returns {Object} Returns the wrapper object.
  21655. * @example
  21656. *
  21657. * var wrapped = _([1, 2]);
  21658. *
  21659. * wrapped[Symbol.iterator]() === wrapped;
  21660. * // => true
  21661. *
  21662. * Array.from(wrapped);
  21663. * // => [1, 2]
  21664. */
  21665. function wrapperToIterator() {
  21666. return this;
  21667. }
  21668. /**
  21669. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  21670. *
  21671. * @name plant
  21672. * @memberOf _
  21673. * @since 3.2.0
  21674. * @category Seq
  21675. * @param {*} value The value to plant.
  21676. * @returns {Object} Returns the new `lodash` wrapper instance.
  21677. * @example
  21678. *
  21679. * function square(n) {
  21680. * return n * n;
  21681. * }
  21682. *
  21683. * var wrapped = _([1, 2]).map(square);
  21684. * var other = wrapped.plant([3, 4]);
  21685. *
  21686. * other.value();
  21687. * // => [9, 16]
  21688. *
  21689. * wrapped.value();
  21690. * // => [1, 4]
  21691. */
  21692. function wrapperPlant(value) {
  21693. var result,
  21694. parent = this;
  21695. while (parent instanceof baseLodash) {
  21696. var clone = wrapperClone(parent);
  21697. clone.__index__ = 0;
  21698. clone.__values__ = undefined;
  21699. if (result) {
  21700. previous.__wrapped__ = clone;
  21701. } else {
  21702. result = clone;
  21703. }
  21704. var previous = clone;
  21705. parent = parent.__wrapped__;
  21706. }
  21707. previous.__wrapped__ = value;
  21708. return result;
  21709. }
  21710. /**
  21711. * This method is the wrapper version of `_.reverse`.
  21712. *
  21713. * **Note:** This method mutates the wrapped array.
  21714. *
  21715. * @name reverse
  21716. * @memberOf _
  21717. * @since 0.1.0
  21718. * @category Seq
  21719. * @returns {Object} Returns the new `lodash` wrapper instance.
  21720. * @example
  21721. *
  21722. * var array = [1, 2, 3];
  21723. *
  21724. * _(array).reverse().value()
  21725. * // => [3, 2, 1]
  21726. *
  21727. * console.log(array);
  21728. * // => [3, 2, 1]
  21729. */
  21730. function wrapperReverse() {
  21731. var value = this.__wrapped__;
  21732. if (value instanceof LazyWrapper) {
  21733. var wrapped = value;
  21734. if (this.__actions__.length) {
  21735. wrapped = new LazyWrapper(this);
  21736. }
  21737. wrapped = wrapped.reverse();
  21738. wrapped.__actions__.push({
  21739. 'func': thru,
  21740. 'args': [reverse],
  21741. 'thisArg': undefined
  21742. });
  21743. return new LodashWrapper(wrapped, this.__chain__);
  21744. }
  21745. return this.thru(reverse);
  21746. }
  21747. /**
  21748. * Executes the chain sequence to resolve the unwrapped value.
  21749. *
  21750. * @name value
  21751. * @memberOf _
  21752. * @since 0.1.0
  21753. * @alias toJSON, valueOf
  21754. * @category Seq
  21755. * @returns {*} Returns the resolved unwrapped value.
  21756. * @example
  21757. *
  21758. * _([1, 2, 3]).value();
  21759. * // => [1, 2, 3]
  21760. */
  21761. function wrapperValue() {
  21762. return baseWrapperValue(this.__wrapped__, this.__actions__);
  21763. }
  21764. /*------------------------------------------------------------------------*/
  21765. /**
  21766. * Creates an object composed of keys generated from the results of running
  21767. * each element of `collection` thru `iteratee`. The corresponding value of
  21768. * each key is the number of times the key was returned by `iteratee`. The
  21769. * iteratee is invoked with one argument: (value).
  21770. *
  21771. * @static
  21772. * @memberOf _
  21773. * @since 0.5.0
  21774. * @category Collection
  21775. * @param {Array|Object} collection The collection to iterate over.
  21776. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  21777. * @returns {Object} Returns the composed aggregate object.
  21778. * @example
  21779. *
  21780. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  21781. * // => { '4': 1, '6': 2 }
  21782. *
  21783. * // The `_.property` iteratee shorthand.
  21784. * _.countBy(['one', 'two', 'three'], 'length');
  21785. * // => { '3': 2, '5': 1 }
  21786. */
  21787. var countBy = createAggregator(function(result, value, key) {
  21788. if (hasOwnProperty.call(result, key)) {
  21789. ++result[key];
  21790. } else {
  21791. baseAssignValue(result, key, 1);
  21792. }
  21793. });
  21794. /**
  21795. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  21796. * Iteration is stopped once `predicate` returns falsey. The predicate is
  21797. * invoked with three arguments: (value, index|key, collection).
  21798. *
  21799. * **Note:** This method returns `true` for
  21800. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  21801. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  21802. * elements of empty collections.
  21803. *
  21804. * @static
  21805. * @memberOf _
  21806. * @since 0.1.0
  21807. * @category Collection
  21808. * @param {Array|Object} collection The collection to iterate over.
  21809. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21810. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  21811. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  21812. * else `false`.
  21813. * @example
  21814. *
  21815. * _.every([true, 1, null, 'yes'], Boolean);
  21816. * // => false
  21817. *
  21818. * var users = [
  21819. * { 'user': 'barney', 'age': 36, 'active': false },
  21820. * { 'user': 'fred', 'age': 40, 'active': false }
  21821. * ];
  21822. *
  21823. * // The `_.matches` iteratee shorthand.
  21824. * _.every(users, { 'user': 'barney', 'active': false });
  21825. * // => false
  21826. *
  21827. * // The `_.matchesProperty` iteratee shorthand.
  21828. * _.every(users, ['active', false]);
  21829. * // => true
  21830. *
  21831. * // The `_.property` iteratee shorthand.
  21832. * _.every(users, 'active');
  21833. * // => false
  21834. */
  21835. function every(collection, predicate, guard) {
  21836. var func = isArray(collection) ? arrayEvery : baseEvery;
  21837. if (guard && isIterateeCall(collection, predicate, guard)) {
  21838. predicate = undefined;
  21839. }
  21840. return func(collection, getIteratee(predicate, 3));
  21841. }
  21842. /**
  21843. * Iterates over elements of `collection`, returning an array of all elements
  21844. * `predicate` returns truthy for. The predicate is invoked with three
  21845. * arguments: (value, index|key, collection).
  21846. *
  21847. * **Note:** Unlike `_.remove`, this method returns a new array.
  21848. *
  21849. * @static
  21850. * @memberOf _
  21851. * @since 0.1.0
  21852. * @category Collection
  21853. * @param {Array|Object} collection The collection to iterate over.
  21854. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21855. * @returns {Array} Returns the new filtered array.
  21856. * @see _.reject
  21857. * @example
  21858. *
  21859. * var users = [
  21860. * { 'user': 'barney', 'age': 36, 'active': true },
  21861. * { 'user': 'fred', 'age': 40, 'active': false }
  21862. * ];
  21863. *
  21864. * _.filter(users, function(o) { return !o.active; });
  21865. * // => objects for ['fred']
  21866. *
  21867. * // The `_.matches` iteratee shorthand.
  21868. * _.filter(users, { 'age': 36, 'active': true });
  21869. * // => objects for ['barney']
  21870. *
  21871. * // The `_.matchesProperty` iteratee shorthand.
  21872. * _.filter(users, ['active', false]);
  21873. * // => objects for ['fred']
  21874. *
  21875. * // The `_.property` iteratee shorthand.
  21876. * _.filter(users, 'active');
  21877. * // => objects for ['barney']
  21878. */
  21879. function filter(collection, predicate) {
  21880. var func = isArray(collection) ? arrayFilter : baseFilter;
  21881. return func(collection, getIteratee(predicate, 3));
  21882. }
  21883. /**
  21884. * Iterates over elements of `collection`, returning the first element
  21885. * `predicate` returns truthy for. The predicate is invoked with three
  21886. * arguments: (value, index|key, collection).
  21887. *
  21888. * @static
  21889. * @memberOf _
  21890. * @since 0.1.0
  21891. * @category Collection
  21892. * @param {Array|Object} collection The collection to inspect.
  21893. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21894. * @param {number} [fromIndex=0] The index to search from.
  21895. * @returns {*} Returns the matched element, else `undefined`.
  21896. * @example
  21897. *
  21898. * var users = [
  21899. * { 'user': 'barney', 'age': 36, 'active': true },
  21900. * { 'user': 'fred', 'age': 40, 'active': false },
  21901. * { 'user': 'pebbles', 'age': 1, 'active': true }
  21902. * ];
  21903. *
  21904. * _.find(users, function(o) { return o.age < 40; });
  21905. * // => object for 'barney'
  21906. *
  21907. * // The `_.matches` iteratee shorthand.
  21908. * _.find(users, { 'age': 1, 'active': true });
  21909. * // => object for 'pebbles'
  21910. *
  21911. * // The `_.matchesProperty` iteratee shorthand.
  21912. * _.find(users, ['active', false]);
  21913. * // => object for 'fred'
  21914. *
  21915. * // The `_.property` iteratee shorthand.
  21916. * _.find(users, 'active');
  21917. * // => object for 'barney'
  21918. */
  21919. var find = createFind(findIndex);
  21920. /**
  21921. * This method is like `_.find` except that it iterates over elements of
  21922. * `collection` from right to left.
  21923. *
  21924. * @static
  21925. * @memberOf _
  21926. * @since 2.0.0
  21927. * @category Collection
  21928. * @param {Array|Object} collection The collection to inspect.
  21929. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  21930. * @param {number} [fromIndex=collection.length-1] The index to search from.
  21931. * @returns {*} Returns the matched element, else `undefined`.
  21932. * @example
  21933. *
  21934. * _.findLast([1, 2, 3, 4], function(n) {
  21935. * return n % 2 == 1;
  21936. * });
  21937. * // => 3
  21938. */
  21939. var findLast = createFind(findLastIndex);
  21940. /**
  21941. * Creates a flattened array of values by running each element in `collection`
  21942. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  21943. * with three arguments: (value, index|key, collection).
  21944. *
  21945. * @static
  21946. * @memberOf _
  21947. * @since 4.0.0
  21948. * @category Collection
  21949. * @param {Array|Object} collection The collection to iterate over.
  21950. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  21951. * @returns {Array} Returns the new flattened array.
  21952. * @example
  21953. *
  21954. * function duplicate(n) {
  21955. * return [n, n];
  21956. * }
  21957. *
  21958. * _.flatMap([1, 2], duplicate);
  21959. * // => [1, 1, 2, 2]
  21960. */
  21961. function flatMap(collection, iteratee) {
  21962. return baseFlatten(map(collection, iteratee), 1);
  21963. }
  21964. /**
  21965. * This method is like `_.flatMap` except that it recursively flattens the
  21966. * mapped results.
  21967. *
  21968. * @static
  21969. * @memberOf _
  21970. * @since 4.7.0
  21971. * @category Collection
  21972. * @param {Array|Object} collection The collection to iterate over.
  21973. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  21974. * @returns {Array} Returns the new flattened array.
  21975. * @example
  21976. *
  21977. * function duplicate(n) {
  21978. * return [[[n, n]]];
  21979. * }
  21980. *
  21981. * _.flatMapDeep([1, 2], duplicate);
  21982. * // => [1, 1, 2, 2]
  21983. */
  21984. function flatMapDeep(collection, iteratee) {
  21985. return baseFlatten(map(collection, iteratee), INFINITY);
  21986. }
  21987. /**
  21988. * This method is like `_.flatMap` except that it recursively flattens the
  21989. * mapped results up to `depth` times.
  21990. *
  21991. * @static
  21992. * @memberOf _
  21993. * @since 4.7.0
  21994. * @category Collection
  21995. * @param {Array|Object} collection The collection to iterate over.
  21996. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  21997. * @param {number} [depth=1] The maximum recursion depth.
  21998. * @returns {Array} Returns the new flattened array.
  21999. * @example
  22000. *
  22001. * function duplicate(n) {
  22002. * return [[[n, n]]];
  22003. * }
  22004. *
  22005. * _.flatMapDepth([1, 2], duplicate, 2);
  22006. * // => [[1, 1], [2, 2]]
  22007. */
  22008. function flatMapDepth(collection, iteratee, depth) {
  22009. depth = depth === undefined ? 1 : toInteger(depth);
  22010. return baseFlatten(map(collection, iteratee), depth);
  22011. }
  22012. /**
  22013. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  22014. * The iteratee is invoked with three arguments: (value, index|key, collection).
  22015. * Iteratee functions may exit iteration early by explicitly returning `false`.
  22016. *
  22017. * **Note:** As with other "Collections" methods, objects with a "length"
  22018. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  22019. * or `_.forOwn` for object iteration.
  22020. *
  22021. * @static
  22022. * @memberOf _
  22023. * @since 0.1.0
  22024. * @alias each
  22025. * @category Collection
  22026. * @param {Array|Object} collection The collection to iterate over.
  22027. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22028. * @returns {Array|Object} Returns `collection`.
  22029. * @see _.forEachRight
  22030. * @example
  22031. *
  22032. * _.forEach([1, 2], function(value) {
  22033. * console.log(value);
  22034. * });
  22035. * // => Logs `1` then `2`.
  22036. *
  22037. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  22038. * console.log(key);
  22039. * });
  22040. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  22041. */
  22042. function forEach(collection, iteratee) {
  22043. var func = isArray(collection) ? arrayEach : baseEach;
  22044. return func(collection, getIteratee(iteratee, 3));
  22045. }
  22046. /**
  22047. * This method is like `_.forEach` except that it iterates over elements of
  22048. * `collection` from right to left.
  22049. *
  22050. * @static
  22051. * @memberOf _
  22052. * @since 2.0.0
  22053. * @alias eachRight
  22054. * @category Collection
  22055. * @param {Array|Object} collection The collection to iterate over.
  22056. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22057. * @returns {Array|Object} Returns `collection`.
  22058. * @see _.forEach
  22059. * @example
  22060. *
  22061. * _.forEachRight([1, 2], function(value) {
  22062. * console.log(value);
  22063. * });
  22064. * // => Logs `2` then `1`.
  22065. */
  22066. function forEachRight(collection, iteratee) {
  22067. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  22068. return func(collection, getIteratee(iteratee, 3));
  22069. }
  22070. /**
  22071. * Creates an object composed of keys generated from the results of running
  22072. * each element of `collection` thru `iteratee`. The order of grouped values
  22073. * is determined by the order they occur in `collection`. The corresponding
  22074. * value of each key is an array of elements responsible for generating the
  22075. * key. The iteratee is invoked with one argument: (value).
  22076. *
  22077. * @static
  22078. * @memberOf _
  22079. * @since 0.1.0
  22080. * @category Collection
  22081. * @param {Array|Object} collection The collection to iterate over.
  22082. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  22083. * @returns {Object} Returns the composed aggregate object.
  22084. * @example
  22085. *
  22086. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  22087. * // => { '4': [4.2], '6': [6.1, 6.3] }
  22088. *
  22089. * // The `_.property` iteratee shorthand.
  22090. * _.groupBy(['one', 'two', 'three'], 'length');
  22091. * // => { '3': ['one', 'two'], '5': ['three'] }
  22092. */
  22093. var groupBy = createAggregator(function(result, value, key) {
  22094. if (hasOwnProperty.call(result, key)) {
  22095. result[key].push(value);
  22096. } else {
  22097. baseAssignValue(result, key, [value]);
  22098. }
  22099. });
  22100. /**
  22101. * Checks if `value` is in `collection`. If `collection` is a string, it's
  22102. * checked for a substring of `value`, otherwise
  22103. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  22104. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  22105. * the offset from the end of `collection`.
  22106. *
  22107. * @static
  22108. * @memberOf _
  22109. * @since 0.1.0
  22110. * @category Collection
  22111. * @param {Array|Object|string} collection The collection to inspect.
  22112. * @param {*} value The value to search for.
  22113. * @param {number} [fromIndex=0] The index to search from.
  22114. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  22115. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  22116. * @example
  22117. *
  22118. * _.includes([1, 2, 3], 1);
  22119. * // => true
  22120. *
  22121. * _.includes([1, 2, 3], 1, 2);
  22122. * // => false
  22123. *
  22124. * _.includes({ 'a': 1, 'b': 2 }, 1);
  22125. * // => true
  22126. *
  22127. * _.includes('abcd', 'bc');
  22128. * // => true
  22129. */
  22130. function includes(collection, value, fromIndex, guard) {
  22131. collection = isArrayLike(collection) ? collection : values(collection);
  22132. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  22133. var length = collection.length;
  22134. if (fromIndex < 0) {
  22135. fromIndex = nativeMax(length + fromIndex, 0);
  22136. }
  22137. return isString(collection)
  22138. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  22139. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  22140. }
  22141. /**
  22142. * Invokes the method at `path` of each element in `collection`, returning
  22143. * an array of the results of each invoked method. Any additional arguments
  22144. * are provided to each invoked method. If `path` is a function, it's invoked
  22145. * for, and `this` bound to, each element in `collection`.
  22146. *
  22147. * @static
  22148. * @memberOf _
  22149. * @since 4.0.0
  22150. * @category Collection
  22151. * @param {Array|Object} collection The collection to iterate over.
  22152. * @param {Array|Function|string} path The path of the method to invoke or
  22153. * the function invoked per iteration.
  22154. * @param {...*} [args] The arguments to invoke each method with.
  22155. * @returns {Array} Returns the array of results.
  22156. * @example
  22157. *
  22158. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  22159. * // => [[1, 5, 7], [1, 2, 3]]
  22160. *
  22161. * _.invokeMap([123, 456], String.prototype.split, '');
  22162. * // => [['1', '2', '3'], ['4', '5', '6']]
  22163. */
  22164. var invokeMap = baseRest(function(collection, path, args) {
  22165. var index = -1,
  22166. isFunc = typeof path == 'function',
  22167. result = isArrayLike(collection) ? Array(collection.length) : [];
  22168. baseEach(collection, function(value) {
  22169. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  22170. });
  22171. return result;
  22172. });
  22173. /**
  22174. * Creates an object composed of keys generated from the results of running
  22175. * each element of `collection` thru `iteratee`. The corresponding value of
  22176. * each key is the last element responsible for generating the key. The
  22177. * iteratee is invoked with one argument: (value).
  22178. *
  22179. * @static
  22180. * @memberOf _
  22181. * @since 4.0.0
  22182. * @category Collection
  22183. * @param {Array|Object} collection The collection to iterate over.
  22184. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  22185. * @returns {Object} Returns the composed aggregate object.
  22186. * @example
  22187. *
  22188. * var array = [
  22189. * { 'dir': 'left', 'code': 97 },
  22190. * { 'dir': 'right', 'code': 100 }
  22191. * ];
  22192. *
  22193. * _.keyBy(array, function(o) {
  22194. * return String.fromCharCode(o.code);
  22195. * });
  22196. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  22197. *
  22198. * _.keyBy(array, 'dir');
  22199. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  22200. */
  22201. var keyBy = createAggregator(function(result, value, key) {
  22202. baseAssignValue(result, key, value);
  22203. });
  22204. /**
  22205. * Creates an array of values by running each element in `collection` thru
  22206. * `iteratee`. The iteratee is invoked with three arguments:
  22207. * (value, index|key, collection).
  22208. *
  22209. * Many lodash methods are guarded to work as iteratees for methods like
  22210. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  22211. *
  22212. * The guarded methods are:
  22213. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  22214. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  22215. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  22216. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  22217. *
  22218. * @static
  22219. * @memberOf _
  22220. * @since 0.1.0
  22221. * @category Collection
  22222. * @param {Array|Object} collection The collection to iterate over.
  22223. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22224. * @returns {Array} Returns the new mapped array.
  22225. * @example
  22226. *
  22227. * function square(n) {
  22228. * return n * n;
  22229. * }
  22230. *
  22231. * _.map([4, 8], square);
  22232. * // => [16, 64]
  22233. *
  22234. * _.map({ 'a': 4, 'b': 8 }, square);
  22235. * // => [16, 64] (iteration order is not guaranteed)
  22236. *
  22237. * var users = [
  22238. * { 'user': 'barney' },
  22239. * { 'user': 'fred' }
  22240. * ];
  22241. *
  22242. * // The `_.property` iteratee shorthand.
  22243. * _.map(users, 'user');
  22244. * // => ['barney', 'fred']
  22245. */
  22246. function map(collection, iteratee) {
  22247. var func = isArray(collection) ? arrayMap : baseMap;
  22248. return func(collection, getIteratee(iteratee, 3));
  22249. }
  22250. /**
  22251. * This method is like `_.sortBy` except that it allows specifying the sort
  22252. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  22253. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  22254. * descending or "asc" for ascending sort order of corresponding values.
  22255. *
  22256. * @static
  22257. * @memberOf _
  22258. * @since 4.0.0
  22259. * @category Collection
  22260. * @param {Array|Object} collection The collection to iterate over.
  22261. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  22262. * The iteratees to sort by.
  22263. * @param {string[]} [orders] The sort orders of `iteratees`.
  22264. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  22265. * @returns {Array} Returns the new sorted array.
  22266. * @example
  22267. *
  22268. * var users = [
  22269. * { 'user': 'fred', 'age': 48 },
  22270. * { 'user': 'barney', 'age': 34 },
  22271. * { 'user': 'fred', 'age': 40 },
  22272. * { 'user': 'barney', 'age': 36 }
  22273. * ];
  22274. *
  22275. * // Sort by `user` in ascending order and by `age` in descending order.
  22276. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  22277. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  22278. */
  22279. function orderBy(collection, iteratees, orders, guard) {
  22280. if (collection == null) {
  22281. return [];
  22282. }
  22283. if (!isArray(iteratees)) {
  22284. iteratees = iteratees == null ? [] : [iteratees];
  22285. }
  22286. orders = guard ? undefined : orders;
  22287. if (!isArray(orders)) {
  22288. orders = orders == null ? [] : [orders];
  22289. }
  22290. return baseOrderBy(collection, iteratees, orders);
  22291. }
  22292. /**
  22293. * Creates an array of elements split into two groups, the first of which
  22294. * contains elements `predicate` returns truthy for, the second of which
  22295. * contains elements `predicate` returns falsey for. The predicate is
  22296. * invoked with one argument: (value).
  22297. *
  22298. * @static
  22299. * @memberOf _
  22300. * @since 3.0.0
  22301. * @category Collection
  22302. * @param {Array|Object} collection The collection to iterate over.
  22303. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22304. * @returns {Array} Returns the array of grouped elements.
  22305. * @example
  22306. *
  22307. * var users = [
  22308. * { 'user': 'barney', 'age': 36, 'active': false },
  22309. * { 'user': 'fred', 'age': 40, 'active': true },
  22310. * { 'user': 'pebbles', 'age': 1, 'active': false }
  22311. * ];
  22312. *
  22313. * _.partition(users, function(o) { return o.active; });
  22314. * // => objects for [['fred'], ['barney', 'pebbles']]
  22315. *
  22316. * // The `_.matches` iteratee shorthand.
  22317. * _.partition(users, { 'age': 1, 'active': false });
  22318. * // => objects for [['pebbles'], ['barney', 'fred']]
  22319. *
  22320. * // The `_.matchesProperty` iteratee shorthand.
  22321. * _.partition(users, ['active', false]);
  22322. * // => objects for [['barney', 'pebbles'], ['fred']]
  22323. *
  22324. * // The `_.property` iteratee shorthand.
  22325. * _.partition(users, 'active');
  22326. * // => objects for [['fred'], ['barney', 'pebbles']]
  22327. */
  22328. var partition = createAggregator(function(result, value, key) {
  22329. result[key ? 0 : 1].push(value);
  22330. }, function() { return [[], []]; });
  22331. /**
  22332. * Reduces `collection` to a value which is the accumulated result of running
  22333. * each element in `collection` thru `iteratee`, where each successive
  22334. * invocation is supplied the return value of the previous. If `accumulator`
  22335. * is not given, the first element of `collection` is used as the initial
  22336. * value. The iteratee is invoked with four arguments:
  22337. * (accumulator, value, index|key, collection).
  22338. *
  22339. * Many lodash methods are guarded to work as iteratees for methods like
  22340. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  22341. *
  22342. * The guarded methods are:
  22343. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  22344. * and `sortBy`
  22345. *
  22346. * @static
  22347. * @memberOf _
  22348. * @since 0.1.0
  22349. * @category Collection
  22350. * @param {Array|Object} collection The collection to iterate over.
  22351. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22352. * @param {*} [accumulator] The initial value.
  22353. * @returns {*} Returns the accumulated value.
  22354. * @see _.reduceRight
  22355. * @example
  22356. *
  22357. * _.reduce([1, 2], function(sum, n) {
  22358. * return sum + n;
  22359. * }, 0);
  22360. * // => 3
  22361. *
  22362. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  22363. * (result[value] || (result[value] = [])).push(key);
  22364. * return result;
  22365. * }, {});
  22366. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  22367. */
  22368. function reduce(collection, iteratee, accumulator) {
  22369. var func = isArray(collection) ? arrayReduce : baseReduce,
  22370. initAccum = arguments.length < 3;
  22371. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  22372. }
  22373. /**
  22374. * This method is like `_.reduce` except that it iterates over elements of
  22375. * `collection` from right to left.
  22376. *
  22377. * @static
  22378. * @memberOf _
  22379. * @since 0.1.0
  22380. * @category Collection
  22381. * @param {Array|Object} collection The collection to iterate over.
  22382. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  22383. * @param {*} [accumulator] The initial value.
  22384. * @returns {*} Returns the accumulated value.
  22385. * @see _.reduce
  22386. * @example
  22387. *
  22388. * var array = [[0, 1], [2, 3], [4, 5]];
  22389. *
  22390. * _.reduceRight(array, function(flattened, other) {
  22391. * return flattened.concat(other);
  22392. * }, []);
  22393. * // => [4, 5, 2, 3, 0, 1]
  22394. */
  22395. function reduceRight(collection, iteratee, accumulator) {
  22396. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  22397. initAccum = arguments.length < 3;
  22398. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  22399. }
  22400. /**
  22401. * The opposite of `_.filter`; this method returns the elements of `collection`
  22402. * that `predicate` does **not** return truthy for.
  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. * @returns {Array} Returns the new filtered array.
  22411. * @see _.filter
  22412. * @example
  22413. *
  22414. * var users = [
  22415. * { 'user': 'barney', 'age': 36, 'active': false },
  22416. * { 'user': 'fred', 'age': 40, 'active': true }
  22417. * ];
  22418. *
  22419. * _.reject(users, function(o) { return !o.active; });
  22420. * // => objects for ['fred']
  22421. *
  22422. * // The `_.matches` iteratee shorthand.
  22423. * _.reject(users, { 'age': 40, 'active': true });
  22424. * // => objects for ['barney']
  22425. *
  22426. * // The `_.matchesProperty` iteratee shorthand.
  22427. * _.reject(users, ['active', false]);
  22428. * // => objects for ['fred']
  22429. *
  22430. * // The `_.property` iteratee shorthand.
  22431. * _.reject(users, 'active');
  22432. * // => objects for ['barney']
  22433. */
  22434. function reject(collection, predicate) {
  22435. var func = isArray(collection) ? arrayFilter : baseFilter;
  22436. return func(collection, negate(getIteratee(predicate, 3)));
  22437. }
  22438. /**
  22439. * Gets a random element from `collection`.
  22440. *
  22441. * @static
  22442. * @memberOf _
  22443. * @since 2.0.0
  22444. * @category Collection
  22445. * @param {Array|Object} collection The collection to sample.
  22446. * @returns {*} Returns the random element.
  22447. * @example
  22448. *
  22449. * _.sample([1, 2, 3, 4]);
  22450. * // => 2
  22451. */
  22452. function sample(collection) {
  22453. var func = isArray(collection) ? arraySample : baseSample;
  22454. return func(collection);
  22455. }
  22456. /**
  22457. * Gets `n` random elements at unique keys from `collection` up to the
  22458. * size of `collection`.
  22459. *
  22460. * @static
  22461. * @memberOf _
  22462. * @since 4.0.0
  22463. * @category Collection
  22464. * @param {Array|Object} collection The collection to sample.
  22465. * @param {number} [n=1] The number of elements to sample.
  22466. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22467. * @returns {Array} Returns the random elements.
  22468. * @example
  22469. *
  22470. * _.sampleSize([1, 2, 3], 2);
  22471. * // => [3, 1]
  22472. *
  22473. * _.sampleSize([1, 2, 3], 4);
  22474. * // => [2, 3, 1]
  22475. */
  22476. function sampleSize(collection, n, guard) {
  22477. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  22478. n = 1;
  22479. } else {
  22480. n = toInteger(n);
  22481. }
  22482. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  22483. return func(collection, n);
  22484. }
  22485. /**
  22486. * Creates an array of shuffled values, using a version of the
  22487. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  22488. *
  22489. * @static
  22490. * @memberOf _
  22491. * @since 0.1.0
  22492. * @category Collection
  22493. * @param {Array|Object} collection The collection to shuffle.
  22494. * @returns {Array} Returns the new shuffled array.
  22495. * @example
  22496. *
  22497. * _.shuffle([1, 2, 3, 4]);
  22498. * // => [4, 1, 3, 2]
  22499. */
  22500. function shuffle(collection) {
  22501. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  22502. return func(collection);
  22503. }
  22504. /**
  22505. * Gets the size of `collection` by returning its length for array-like
  22506. * values or the number of own enumerable string keyed properties for objects.
  22507. *
  22508. * @static
  22509. * @memberOf _
  22510. * @since 0.1.0
  22511. * @category Collection
  22512. * @param {Array|Object|string} collection The collection to inspect.
  22513. * @returns {number} Returns the collection size.
  22514. * @example
  22515. *
  22516. * _.size([1, 2, 3]);
  22517. * // => 3
  22518. *
  22519. * _.size({ 'a': 1, 'b': 2 });
  22520. * // => 2
  22521. *
  22522. * _.size('pebbles');
  22523. * // => 7
  22524. */
  22525. function size(collection) {
  22526. if (collection == null) {
  22527. return 0;
  22528. }
  22529. if (isArrayLike(collection)) {
  22530. return isString(collection) ? stringSize(collection) : collection.length;
  22531. }
  22532. var tag = getTag(collection);
  22533. if (tag == mapTag || tag == setTag) {
  22534. return collection.size;
  22535. }
  22536. return baseKeys(collection).length;
  22537. }
  22538. /**
  22539. * Checks if `predicate` returns truthy for **any** element of `collection`.
  22540. * Iteration is stopped once `predicate` returns truthy. The predicate is
  22541. * invoked with three arguments: (value, index|key, collection).
  22542. *
  22543. * @static
  22544. * @memberOf _
  22545. * @since 0.1.0
  22546. * @category Collection
  22547. * @param {Array|Object} collection The collection to iterate over.
  22548. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  22549. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22550. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22551. * else `false`.
  22552. * @example
  22553. *
  22554. * _.some([null, 0, 'yes', false], Boolean);
  22555. * // => true
  22556. *
  22557. * var users = [
  22558. * { 'user': 'barney', 'active': true },
  22559. * { 'user': 'fred', 'active': false }
  22560. * ];
  22561. *
  22562. * // The `_.matches` iteratee shorthand.
  22563. * _.some(users, { 'user': 'barney', 'active': false });
  22564. * // => false
  22565. *
  22566. * // The `_.matchesProperty` iteratee shorthand.
  22567. * _.some(users, ['active', false]);
  22568. * // => true
  22569. *
  22570. * // The `_.property` iteratee shorthand.
  22571. * _.some(users, 'active');
  22572. * // => true
  22573. */
  22574. function some(collection, predicate, guard) {
  22575. var func = isArray(collection) ? arraySome : baseSome;
  22576. if (guard && isIterateeCall(collection, predicate, guard)) {
  22577. predicate = undefined;
  22578. }
  22579. return func(collection, getIteratee(predicate, 3));
  22580. }
  22581. /**
  22582. * Creates an array of elements, sorted in ascending order by the results of
  22583. * running each element in a collection thru each iteratee. This method
  22584. * performs a stable sort, that is, it preserves the original sort order of
  22585. * equal elements. The iteratees are invoked with one argument: (value).
  22586. *
  22587. * @static
  22588. * @memberOf _
  22589. * @since 0.1.0
  22590. * @category Collection
  22591. * @param {Array|Object} collection The collection to iterate over.
  22592. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  22593. * The iteratees to sort by.
  22594. * @returns {Array} Returns the new sorted array.
  22595. * @example
  22596. *
  22597. * var users = [
  22598. * { 'user': 'fred', 'age': 48 },
  22599. * { 'user': 'barney', 'age': 36 },
  22600. * { 'user': 'fred', 'age': 40 },
  22601. * { 'user': 'barney', 'age': 34 }
  22602. * ];
  22603. *
  22604. * _.sortBy(users, [function(o) { return o.user; }]);
  22605. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  22606. *
  22607. * _.sortBy(users, ['user', 'age']);
  22608. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  22609. */
  22610. var sortBy = baseRest(function(collection, iteratees) {
  22611. if (collection == null) {
  22612. return [];
  22613. }
  22614. var length = iteratees.length;
  22615. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  22616. iteratees = [];
  22617. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  22618. iteratees = [iteratees[0]];
  22619. }
  22620. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  22621. });
  22622. /*------------------------------------------------------------------------*/
  22623. /**
  22624. * Gets the timestamp of the number of milliseconds that have elapsed since
  22625. * the Unix epoch (1 January 1970 00:00:00 UTC).
  22626. *
  22627. * @static
  22628. * @memberOf _
  22629. * @since 2.4.0
  22630. * @category Date
  22631. * @returns {number} Returns the timestamp.
  22632. * @example
  22633. *
  22634. * _.defer(function(stamp) {
  22635. * console.log(_.now() - stamp);
  22636. * }, _.now());
  22637. * // => Logs the number of milliseconds it took for the deferred invocation.
  22638. */
  22639. var now = ctxNow || function() {
  22640. return root.Date.now();
  22641. };
  22642. /*------------------------------------------------------------------------*/
  22643. /**
  22644. * The opposite of `_.before`; this method creates a function that invokes
  22645. * `func` once it's called `n` or more times.
  22646. *
  22647. * @static
  22648. * @memberOf _
  22649. * @since 0.1.0
  22650. * @category Function
  22651. * @param {number} n The number of calls before `func` is invoked.
  22652. * @param {Function} func The function to restrict.
  22653. * @returns {Function} Returns the new restricted function.
  22654. * @example
  22655. *
  22656. * var saves = ['profile', 'settings'];
  22657. *
  22658. * var done = _.after(saves.length, function() {
  22659. * console.log('done saving!');
  22660. * });
  22661. *
  22662. * _.forEach(saves, function(type) {
  22663. * asyncSave({ 'type': type, 'complete': done });
  22664. * });
  22665. * // => Logs 'done saving!' after the two async saves have completed.
  22666. */
  22667. function after(n, func) {
  22668. if (typeof func != 'function') {
  22669. throw new TypeError(FUNC_ERROR_TEXT);
  22670. }
  22671. n = toInteger(n);
  22672. return function() {
  22673. if (--n < 1) {
  22674. return func.apply(this, arguments);
  22675. }
  22676. };
  22677. }
  22678. /**
  22679. * Creates a function that invokes `func`, with up to `n` arguments,
  22680. * ignoring any additional arguments.
  22681. *
  22682. * @static
  22683. * @memberOf _
  22684. * @since 3.0.0
  22685. * @category Function
  22686. * @param {Function} func The function to cap arguments for.
  22687. * @param {number} [n=func.length] The arity cap.
  22688. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22689. * @returns {Function} Returns the new capped function.
  22690. * @example
  22691. *
  22692. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  22693. * // => [6, 8, 10]
  22694. */
  22695. function ary(func, n, guard) {
  22696. n = guard ? undefined : n;
  22697. n = (func && n == null) ? func.length : n;
  22698. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  22699. }
  22700. /**
  22701. * Creates a function that invokes `func`, with the `this` binding and arguments
  22702. * of the created function, while it's called less than `n` times. Subsequent
  22703. * calls to the created function return the result of the last `func` invocation.
  22704. *
  22705. * @static
  22706. * @memberOf _
  22707. * @since 3.0.0
  22708. * @category Function
  22709. * @param {number} n The number of calls at which `func` is no longer invoked.
  22710. * @param {Function} func The function to restrict.
  22711. * @returns {Function} Returns the new restricted function.
  22712. * @example
  22713. *
  22714. * jQuery(element).on('click', _.before(5, addContactToList));
  22715. * // => Allows adding up to 4 contacts to the list.
  22716. */
  22717. function before(n, func) {
  22718. var result;
  22719. if (typeof func != 'function') {
  22720. throw new TypeError(FUNC_ERROR_TEXT);
  22721. }
  22722. n = toInteger(n);
  22723. return function() {
  22724. if (--n > 0) {
  22725. result = func.apply(this, arguments);
  22726. }
  22727. if (n <= 1) {
  22728. func = undefined;
  22729. }
  22730. return result;
  22731. };
  22732. }
  22733. /**
  22734. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  22735. * and `partials` prepended to the arguments it receives.
  22736. *
  22737. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  22738. * may be used as a placeholder for partially applied arguments.
  22739. *
  22740. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  22741. * property of bound functions.
  22742. *
  22743. * @static
  22744. * @memberOf _
  22745. * @since 0.1.0
  22746. * @category Function
  22747. * @param {Function} func The function to bind.
  22748. * @param {*} thisArg The `this` binding of `func`.
  22749. * @param {...*} [partials] The arguments to be partially applied.
  22750. * @returns {Function} Returns the new bound function.
  22751. * @example
  22752. *
  22753. * function greet(greeting, punctuation) {
  22754. * return greeting + ' ' + this.user + punctuation;
  22755. * }
  22756. *
  22757. * var object = { 'user': 'fred' };
  22758. *
  22759. * var bound = _.bind(greet, object, 'hi');
  22760. * bound('!');
  22761. * // => 'hi fred!'
  22762. *
  22763. * // Bound with placeholders.
  22764. * var bound = _.bind(greet, object, _, '!');
  22765. * bound('hi');
  22766. * // => 'hi fred!'
  22767. */
  22768. var bind = baseRest(function(func, thisArg, partials) {
  22769. var bitmask = WRAP_BIND_FLAG;
  22770. if (partials.length) {
  22771. var holders = replaceHolders(partials, getHolder(bind));
  22772. bitmask |= WRAP_PARTIAL_FLAG;
  22773. }
  22774. return createWrap(func, bitmask, thisArg, partials, holders);
  22775. });
  22776. /**
  22777. * Creates a function that invokes the method at `object[key]` with `partials`
  22778. * prepended to the arguments it receives.
  22779. *
  22780. * This method differs from `_.bind` by allowing bound functions to reference
  22781. * methods that may be redefined or don't yet exist. See
  22782. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  22783. * for more details.
  22784. *
  22785. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  22786. * builds, may be used as a placeholder for partially applied arguments.
  22787. *
  22788. * @static
  22789. * @memberOf _
  22790. * @since 0.10.0
  22791. * @category Function
  22792. * @param {Object} object The object to invoke the method on.
  22793. * @param {string} key The key of the method.
  22794. * @param {...*} [partials] The arguments to be partially applied.
  22795. * @returns {Function} Returns the new bound function.
  22796. * @example
  22797. *
  22798. * var object = {
  22799. * 'user': 'fred',
  22800. * 'greet': function(greeting, punctuation) {
  22801. * return greeting + ' ' + this.user + punctuation;
  22802. * }
  22803. * };
  22804. *
  22805. * var bound = _.bindKey(object, 'greet', 'hi');
  22806. * bound('!');
  22807. * // => 'hi fred!'
  22808. *
  22809. * object.greet = function(greeting, punctuation) {
  22810. * return greeting + 'ya ' + this.user + punctuation;
  22811. * };
  22812. *
  22813. * bound('!');
  22814. * // => 'hiya fred!'
  22815. *
  22816. * // Bound with placeholders.
  22817. * var bound = _.bindKey(object, 'greet', _, '!');
  22818. * bound('hi');
  22819. * // => 'hiya fred!'
  22820. */
  22821. var bindKey = baseRest(function(object, key, partials) {
  22822. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  22823. if (partials.length) {
  22824. var holders = replaceHolders(partials, getHolder(bindKey));
  22825. bitmask |= WRAP_PARTIAL_FLAG;
  22826. }
  22827. return createWrap(key, bitmask, object, partials, holders);
  22828. });
  22829. /**
  22830. * Creates a function that accepts arguments of `func` and either invokes
  22831. * `func` returning its result, if at least `arity` number of arguments have
  22832. * been provided, or returns a function that accepts the remaining `func`
  22833. * arguments, and so on. The arity of `func` may be specified if `func.length`
  22834. * is not sufficient.
  22835. *
  22836. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  22837. * may be used as a placeholder for provided arguments.
  22838. *
  22839. * **Note:** This method doesn't set the "length" property of curried functions.
  22840. *
  22841. * @static
  22842. * @memberOf _
  22843. * @since 2.0.0
  22844. * @category Function
  22845. * @param {Function} func The function to curry.
  22846. * @param {number} [arity=func.length] The arity of `func`.
  22847. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22848. * @returns {Function} Returns the new curried function.
  22849. * @example
  22850. *
  22851. * var abc = function(a, b, c) {
  22852. * return [a, b, c];
  22853. * };
  22854. *
  22855. * var curried = _.curry(abc);
  22856. *
  22857. * curried(1)(2)(3);
  22858. * // => [1, 2, 3]
  22859. *
  22860. * curried(1, 2)(3);
  22861. * // => [1, 2, 3]
  22862. *
  22863. * curried(1, 2, 3);
  22864. * // => [1, 2, 3]
  22865. *
  22866. * // Curried with placeholders.
  22867. * curried(1)(_, 3)(2);
  22868. * // => [1, 2, 3]
  22869. */
  22870. function curry(func, arity, guard) {
  22871. arity = guard ? undefined : arity;
  22872. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  22873. result.placeholder = curry.placeholder;
  22874. return result;
  22875. }
  22876. /**
  22877. * This method is like `_.curry` except that arguments are applied to `func`
  22878. * in the manner of `_.partialRight` instead of `_.partial`.
  22879. *
  22880. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  22881. * builds, may be used as a placeholder for provided arguments.
  22882. *
  22883. * **Note:** This method doesn't set the "length" property of curried functions.
  22884. *
  22885. * @static
  22886. * @memberOf _
  22887. * @since 3.0.0
  22888. * @category Function
  22889. * @param {Function} func The function to curry.
  22890. * @param {number} [arity=func.length] The arity of `func`.
  22891. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  22892. * @returns {Function} Returns the new curried function.
  22893. * @example
  22894. *
  22895. * var abc = function(a, b, c) {
  22896. * return [a, b, c];
  22897. * };
  22898. *
  22899. * var curried = _.curryRight(abc);
  22900. *
  22901. * curried(3)(2)(1);
  22902. * // => [1, 2, 3]
  22903. *
  22904. * curried(2, 3)(1);
  22905. * // => [1, 2, 3]
  22906. *
  22907. * curried(1, 2, 3);
  22908. * // => [1, 2, 3]
  22909. *
  22910. * // Curried with placeholders.
  22911. * curried(3)(1, _)(2);
  22912. * // => [1, 2, 3]
  22913. */
  22914. function curryRight(func, arity, guard) {
  22915. arity = guard ? undefined : arity;
  22916. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  22917. result.placeholder = curryRight.placeholder;
  22918. return result;
  22919. }
  22920. /**
  22921. * Creates a debounced function that delays invoking `func` until after `wait`
  22922. * milliseconds have elapsed since the last time the debounced function was
  22923. * invoked. The debounced function comes with a `cancel` method to cancel
  22924. * delayed `func` invocations and a `flush` method to immediately invoke them.
  22925. * Provide `options` to indicate whether `func` should be invoked on the
  22926. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  22927. * with the last arguments provided to the debounced function. Subsequent
  22928. * calls to the debounced function return the result of the last `func`
  22929. * invocation.
  22930. *
  22931. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  22932. * invoked on the trailing edge of the timeout only if the debounced function
  22933. * is invoked more than once during the `wait` timeout.
  22934. *
  22935. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  22936. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  22937. *
  22938. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  22939. * for details over the differences between `_.debounce` and `_.throttle`.
  22940. *
  22941. * @static
  22942. * @memberOf _
  22943. * @since 0.1.0
  22944. * @category Function
  22945. * @param {Function} func The function to debounce.
  22946. * @param {number} [wait=0] The number of milliseconds to delay.
  22947. * @param {Object} [options={}] The options object.
  22948. * @param {boolean} [options.leading=false]
  22949. * Specify invoking on the leading edge of the timeout.
  22950. * @param {number} [options.maxWait]
  22951. * The maximum time `func` is allowed to be delayed before it's invoked.
  22952. * @param {boolean} [options.trailing=true]
  22953. * Specify invoking on the trailing edge of the timeout.
  22954. * @returns {Function} Returns the new debounced function.
  22955. * @example
  22956. *
  22957. * // Avoid costly calculations while the window size is in flux.
  22958. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  22959. *
  22960. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  22961. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  22962. * 'leading': true,
  22963. * 'trailing': false
  22964. * }));
  22965. *
  22966. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  22967. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  22968. * var source = new EventSource('/stream');
  22969. * jQuery(source).on('message', debounced);
  22970. *
  22971. * // Cancel the trailing debounced invocation.
  22972. * jQuery(window).on('popstate', debounced.cancel);
  22973. */
  22974. function debounce(func, wait, options) {
  22975. var lastArgs,
  22976. lastThis,
  22977. maxWait,
  22978. result,
  22979. timerId,
  22980. lastCallTime,
  22981. lastInvokeTime = 0,
  22982. leading = false,
  22983. maxing = false,
  22984. trailing = true;
  22985. if (typeof func != 'function') {
  22986. throw new TypeError(FUNC_ERROR_TEXT);
  22987. }
  22988. wait = toNumber(wait) || 0;
  22989. if (isObject(options)) {
  22990. leading = !!options.leading;
  22991. maxing = 'maxWait' in options;
  22992. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  22993. trailing = 'trailing' in options ? !!options.trailing : trailing;
  22994. }
  22995. function invokeFunc(time) {
  22996. var args = lastArgs,
  22997. thisArg = lastThis;
  22998. lastArgs = lastThis = undefined;
  22999. lastInvokeTime = time;
  23000. result = func.apply(thisArg, args);
  23001. return result;
  23002. }
  23003. function leadingEdge(time) {
  23004. // Reset any `maxWait` timer.
  23005. lastInvokeTime = time;
  23006. // Start the timer for the trailing edge.
  23007. timerId = setTimeout(timerExpired, wait);
  23008. // Invoke the leading edge.
  23009. return leading ? invokeFunc(time) : result;
  23010. }
  23011. function remainingWait(time) {
  23012. var timeSinceLastCall = time - lastCallTime,
  23013. timeSinceLastInvoke = time - lastInvokeTime,
  23014. timeWaiting = wait - timeSinceLastCall;
  23015. return maxing
  23016. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  23017. : timeWaiting;
  23018. }
  23019. function shouldInvoke(time) {
  23020. var timeSinceLastCall = time - lastCallTime,
  23021. timeSinceLastInvoke = time - lastInvokeTime;
  23022. // Either this is the first call, activity has stopped and we're at the
  23023. // trailing edge, the system time has gone backwards and we're treating
  23024. // it as the trailing edge, or we've hit the `maxWait` limit.
  23025. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  23026. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  23027. }
  23028. function timerExpired() {
  23029. var time = now();
  23030. if (shouldInvoke(time)) {
  23031. return trailingEdge(time);
  23032. }
  23033. // Restart the timer.
  23034. timerId = setTimeout(timerExpired, remainingWait(time));
  23035. }
  23036. function trailingEdge(time) {
  23037. timerId = undefined;
  23038. // Only invoke if we have `lastArgs` which means `func` has been
  23039. // debounced at least once.
  23040. if (trailing && lastArgs) {
  23041. return invokeFunc(time);
  23042. }
  23043. lastArgs = lastThis = undefined;
  23044. return result;
  23045. }
  23046. function cancel() {
  23047. if (timerId !== undefined) {
  23048. clearTimeout(timerId);
  23049. }
  23050. lastInvokeTime = 0;
  23051. lastArgs = lastCallTime = lastThis = timerId = undefined;
  23052. }
  23053. function flush() {
  23054. return timerId === undefined ? result : trailingEdge(now());
  23055. }
  23056. function debounced() {
  23057. var time = now(),
  23058. isInvoking = shouldInvoke(time);
  23059. lastArgs = arguments;
  23060. lastThis = this;
  23061. lastCallTime = time;
  23062. if (isInvoking) {
  23063. if (timerId === undefined) {
  23064. return leadingEdge(lastCallTime);
  23065. }
  23066. if (maxing) {
  23067. // Handle invocations in a tight loop.
  23068. timerId = setTimeout(timerExpired, wait);
  23069. return invokeFunc(lastCallTime);
  23070. }
  23071. }
  23072. if (timerId === undefined) {
  23073. timerId = setTimeout(timerExpired, wait);
  23074. }
  23075. return result;
  23076. }
  23077. debounced.cancel = cancel;
  23078. debounced.flush = flush;
  23079. return debounced;
  23080. }
  23081. /**
  23082. * Defers invoking the `func` until the current call stack has cleared. Any
  23083. * additional arguments are provided to `func` when it's invoked.
  23084. *
  23085. * @static
  23086. * @memberOf _
  23087. * @since 0.1.0
  23088. * @category Function
  23089. * @param {Function} func The function to defer.
  23090. * @param {...*} [args] The arguments to invoke `func` with.
  23091. * @returns {number} Returns the timer id.
  23092. * @example
  23093. *
  23094. * _.defer(function(text) {
  23095. * console.log(text);
  23096. * }, 'deferred');
  23097. * // => Logs 'deferred' after one millisecond.
  23098. */
  23099. var defer = baseRest(function(func, args) {
  23100. return baseDelay(func, 1, args);
  23101. });
  23102. /**
  23103. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  23104. * provided to `func` when it's invoked.
  23105. *
  23106. * @static
  23107. * @memberOf _
  23108. * @since 0.1.0
  23109. * @category Function
  23110. * @param {Function} func The function to delay.
  23111. * @param {number} wait The number of milliseconds to delay invocation.
  23112. * @param {...*} [args] The arguments to invoke `func` with.
  23113. * @returns {number} Returns the timer id.
  23114. * @example
  23115. *
  23116. * _.delay(function(text) {
  23117. * console.log(text);
  23118. * }, 1000, 'later');
  23119. * // => Logs 'later' after one second.
  23120. */
  23121. var delay = baseRest(function(func, wait, args) {
  23122. return baseDelay(func, toNumber(wait) || 0, args);
  23123. });
  23124. /**
  23125. * Creates a function that invokes `func` with arguments reversed.
  23126. *
  23127. * @static
  23128. * @memberOf _
  23129. * @since 4.0.0
  23130. * @category Function
  23131. * @param {Function} func The function to flip arguments for.
  23132. * @returns {Function} Returns the new flipped function.
  23133. * @example
  23134. *
  23135. * var flipped = _.flip(function() {
  23136. * return _.toArray(arguments);
  23137. * });
  23138. *
  23139. * flipped('a', 'b', 'c', 'd');
  23140. * // => ['d', 'c', 'b', 'a']
  23141. */
  23142. function flip(func) {
  23143. return createWrap(func, WRAP_FLIP_FLAG);
  23144. }
  23145. /**
  23146. * Creates a function that memoizes the result of `func`. If `resolver` is
  23147. * provided, it determines the cache key for storing the result based on the
  23148. * arguments provided to the memoized function. By default, the first argument
  23149. * provided to the memoized function is used as the map cache key. The `func`
  23150. * is invoked with the `this` binding of the memoized function.
  23151. *
  23152. * **Note:** The cache is exposed as the `cache` property on the memoized
  23153. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  23154. * constructor with one whose instances implement the
  23155. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  23156. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  23157. *
  23158. * @static
  23159. * @memberOf _
  23160. * @since 0.1.0
  23161. * @category Function
  23162. * @param {Function} func The function to have its output memoized.
  23163. * @param {Function} [resolver] The function to resolve the cache key.
  23164. * @returns {Function} Returns the new memoized function.
  23165. * @example
  23166. *
  23167. * var object = { 'a': 1, 'b': 2 };
  23168. * var other = { 'c': 3, 'd': 4 };
  23169. *
  23170. * var values = _.memoize(_.values);
  23171. * values(object);
  23172. * // => [1, 2]
  23173. *
  23174. * values(other);
  23175. * // => [3, 4]
  23176. *
  23177. * object.a = 2;
  23178. * values(object);
  23179. * // => [1, 2]
  23180. *
  23181. * // Modify the result cache.
  23182. * values.cache.set(object, ['a', 'b']);
  23183. * values(object);
  23184. * // => ['a', 'b']
  23185. *
  23186. * // Replace `_.memoize.Cache`.
  23187. * _.memoize.Cache = WeakMap;
  23188. */
  23189. function memoize(func, resolver) {
  23190. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  23191. throw new TypeError(FUNC_ERROR_TEXT);
  23192. }
  23193. var memoized = function() {
  23194. var args = arguments,
  23195. key = resolver ? resolver.apply(this, args) : args[0],
  23196. cache = memoized.cache;
  23197. if (cache.has(key)) {
  23198. return cache.get(key);
  23199. }
  23200. var result = func.apply(this, args);
  23201. memoized.cache = cache.set(key, result) || cache;
  23202. return result;
  23203. };
  23204. memoized.cache = new (memoize.Cache || MapCache);
  23205. return memoized;
  23206. }
  23207. // Expose `MapCache`.
  23208. memoize.Cache = MapCache;
  23209. /**
  23210. * Creates a function that negates the result of the predicate `func`. The
  23211. * `func` predicate is invoked with the `this` binding and arguments of the
  23212. * created function.
  23213. *
  23214. * @static
  23215. * @memberOf _
  23216. * @since 3.0.0
  23217. * @category Function
  23218. * @param {Function} predicate The predicate to negate.
  23219. * @returns {Function} Returns the new negated function.
  23220. * @example
  23221. *
  23222. * function isEven(n) {
  23223. * return n % 2 == 0;
  23224. * }
  23225. *
  23226. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  23227. * // => [1, 3, 5]
  23228. */
  23229. function negate(predicate) {
  23230. if (typeof predicate != 'function') {
  23231. throw new TypeError(FUNC_ERROR_TEXT);
  23232. }
  23233. return function() {
  23234. var args = arguments;
  23235. switch (args.length) {
  23236. case 0: return !predicate.call(this);
  23237. case 1: return !predicate.call(this, args[0]);
  23238. case 2: return !predicate.call(this, args[0], args[1]);
  23239. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  23240. }
  23241. return !predicate.apply(this, args);
  23242. };
  23243. }
  23244. /**
  23245. * Creates a function that is restricted to invoking `func` once. Repeat calls
  23246. * to the function return the value of the first invocation. The `func` is
  23247. * invoked with the `this` binding and arguments of the created function.
  23248. *
  23249. * @static
  23250. * @memberOf _
  23251. * @since 0.1.0
  23252. * @category Function
  23253. * @param {Function} func The function to restrict.
  23254. * @returns {Function} Returns the new restricted function.
  23255. * @example
  23256. *
  23257. * var initialize = _.once(createApplication);
  23258. * initialize();
  23259. * initialize();
  23260. * // => `createApplication` is invoked once
  23261. */
  23262. function once(func) {
  23263. return before(2, func);
  23264. }
  23265. /**
  23266. * Creates a function that invokes `func` with its arguments transformed.
  23267. *
  23268. * @static
  23269. * @since 4.0.0
  23270. * @memberOf _
  23271. * @category Function
  23272. * @param {Function} func The function to wrap.
  23273. * @param {...(Function|Function[])} [transforms=[_.identity]]
  23274. * The argument transforms.
  23275. * @returns {Function} Returns the new function.
  23276. * @example
  23277. *
  23278. * function doubled(n) {
  23279. * return n * 2;
  23280. * }
  23281. *
  23282. * function square(n) {
  23283. * return n * n;
  23284. * }
  23285. *
  23286. * var func = _.overArgs(function(x, y) {
  23287. * return [x, y];
  23288. * }, [square, doubled]);
  23289. *
  23290. * func(9, 3);
  23291. * // => [81, 6]
  23292. *
  23293. * func(10, 5);
  23294. * // => [100, 10]
  23295. */
  23296. var overArgs = castRest(function(func, transforms) {
  23297. transforms = (transforms.length == 1 && isArray(transforms[0]))
  23298. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  23299. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  23300. var funcsLength = transforms.length;
  23301. return baseRest(function(args) {
  23302. var index = -1,
  23303. length = nativeMin(args.length, funcsLength);
  23304. while (++index < length) {
  23305. args[index] = transforms[index].call(this, args[index]);
  23306. }
  23307. return apply(func, this, args);
  23308. });
  23309. });
  23310. /**
  23311. * Creates a function that invokes `func` with `partials` prepended to the
  23312. * arguments it receives. This method is like `_.bind` except it does **not**
  23313. * alter the `this` binding.
  23314. *
  23315. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  23316. * builds, may be used as a placeholder for partially applied arguments.
  23317. *
  23318. * **Note:** This method doesn't set the "length" property of partially
  23319. * applied functions.
  23320. *
  23321. * @static
  23322. * @memberOf _
  23323. * @since 0.2.0
  23324. * @category Function
  23325. * @param {Function} func The function to partially apply arguments to.
  23326. * @param {...*} [partials] The arguments to be partially applied.
  23327. * @returns {Function} Returns the new partially applied function.
  23328. * @example
  23329. *
  23330. * function greet(greeting, name) {
  23331. * return greeting + ' ' + name;
  23332. * }
  23333. *
  23334. * var sayHelloTo = _.partial(greet, 'hello');
  23335. * sayHelloTo('fred');
  23336. * // => 'hello fred'
  23337. *
  23338. * // Partially applied with placeholders.
  23339. * var greetFred = _.partial(greet, _, 'fred');
  23340. * greetFred('hi');
  23341. * // => 'hi fred'
  23342. */
  23343. var partial = baseRest(function(func, partials) {
  23344. var holders = replaceHolders(partials, getHolder(partial));
  23345. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  23346. });
  23347. /**
  23348. * This method is like `_.partial` except that partially applied arguments
  23349. * are appended to the arguments it receives.
  23350. *
  23351. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  23352. * builds, may be used as a placeholder for partially applied arguments.
  23353. *
  23354. * **Note:** This method doesn't set the "length" property of partially
  23355. * applied functions.
  23356. *
  23357. * @static
  23358. * @memberOf _
  23359. * @since 1.0.0
  23360. * @category Function
  23361. * @param {Function} func The function to partially apply arguments to.
  23362. * @param {...*} [partials] The arguments to be partially applied.
  23363. * @returns {Function} Returns the new partially applied function.
  23364. * @example
  23365. *
  23366. * function greet(greeting, name) {
  23367. * return greeting + ' ' + name;
  23368. * }
  23369. *
  23370. * var greetFred = _.partialRight(greet, 'fred');
  23371. * greetFred('hi');
  23372. * // => 'hi fred'
  23373. *
  23374. * // Partially applied with placeholders.
  23375. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  23376. * sayHelloTo('fred');
  23377. * // => 'hello fred'
  23378. */
  23379. var partialRight = baseRest(function(func, partials) {
  23380. var holders = replaceHolders(partials, getHolder(partialRight));
  23381. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  23382. });
  23383. /**
  23384. * Creates a function that invokes `func` with arguments arranged according
  23385. * to the specified `indexes` where the argument value at the first index is
  23386. * provided as the first argument, the argument value at the second index is
  23387. * provided as the second argument, and so on.
  23388. *
  23389. * @static
  23390. * @memberOf _
  23391. * @since 3.0.0
  23392. * @category Function
  23393. * @param {Function} func The function to rearrange arguments for.
  23394. * @param {...(number|number[])} indexes The arranged argument indexes.
  23395. * @returns {Function} Returns the new function.
  23396. * @example
  23397. *
  23398. * var rearged = _.rearg(function(a, b, c) {
  23399. * return [a, b, c];
  23400. * }, [2, 0, 1]);
  23401. *
  23402. * rearged('b', 'c', 'a')
  23403. * // => ['a', 'b', 'c']
  23404. */
  23405. var rearg = flatRest(function(func, indexes) {
  23406. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  23407. });
  23408. /**
  23409. * Creates a function that invokes `func` with the `this` binding of the
  23410. * created function and arguments from `start` and beyond provided as
  23411. * an array.
  23412. *
  23413. * **Note:** This method is based on the
  23414. * [rest parameter](https://mdn.io/rest_parameters).
  23415. *
  23416. * @static
  23417. * @memberOf _
  23418. * @since 4.0.0
  23419. * @category Function
  23420. * @param {Function} func The function to apply a rest parameter to.
  23421. * @param {number} [start=func.length-1] The start position of the rest parameter.
  23422. * @returns {Function} Returns the new function.
  23423. * @example
  23424. *
  23425. * var say = _.rest(function(what, names) {
  23426. * return what + ' ' + _.initial(names).join(', ') +
  23427. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  23428. * });
  23429. *
  23430. * say('hello', 'fred', 'barney', 'pebbles');
  23431. * // => 'hello fred, barney, & pebbles'
  23432. */
  23433. function rest(func, start) {
  23434. if (typeof func != 'function') {
  23435. throw new TypeError(FUNC_ERROR_TEXT);
  23436. }
  23437. start = start === undefined ? start : toInteger(start);
  23438. return baseRest(func, start);
  23439. }
  23440. /**
  23441. * Creates a function that invokes `func` with the `this` binding of the
  23442. * create function and an array of arguments much like
  23443. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  23444. *
  23445. * **Note:** This method is based on the
  23446. * [spread operator](https://mdn.io/spread_operator).
  23447. *
  23448. * @static
  23449. * @memberOf _
  23450. * @since 3.2.0
  23451. * @category Function
  23452. * @param {Function} func The function to spread arguments over.
  23453. * @param {number} [start=0] The start position of the spread.
  23454. * @returns {Function} Returns the new function.
  23455. * @example
  23456. *
  23457. * var say = _.spread(function(who, what) {
  23458. * return who + ' says ' + what;
  23459. * });
  23460. *
  23461. * say(['fred', 'hello']);
  23462. * // => 'fred says hello'
  23463. *
  23464. * var numbers = Promise.all([
  23465. * Promise.resolve(40),
  23466. * Promise.resolve(36)
  23467. * ]);
  23468. *
  23469. * numbers.then(_.spread(function(x, y) {
  23470. * return x + y;
  23471. * }));
  23472. * // => a Promise of 76
  23473. */
  23474. function spread(func, start) {
  23475. if (typeof func != 'function') {
  23476. throw new TypeError(FUNC_ERROR_TEXT);
  23477. }
  23478. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  23479. return baseRest(function(args) {
  23480. var array = args[start],
  23481. otherArgs = castSlice(args, 0, start);
  23482. if (array) {
  23483. arrayPush(otherArgs, array);
  23484. }
  23485. return apply(func, this, otherArgs);
  23486. });
  23487. }
  23488. /**
  23489. * Creates a throttled function that only invokes `func` at most once per
  23490. * every `wait` milliseconds. The throttled function comes with a `cancel`
  23491. * method to cancel delayed `func` invocations and a `flush` method to
  23492. * immediately invoke them. Provide `options` to indicate whether `func`
  23493. * should be invoked on the leading and/or trailing edge of the `wait`
  23494. * timeout. The `func` is invoked with the last arguments provided to the
  23495. * throttled function. Subsequent calls to the throttled function return the
  23496. * result of the last `func` invocation.
  23497. *
  23498. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  23499. * invoked on the trailing edge of the timeout only if the throttled function
  23500. * is invoked more than once during the `wait` timeout.
  23501. *
  23502. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  23503. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  23504. *
  23505. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  23506. * for details over the differences between `_.throttle` and `_.debounce`.
  23507. *
  23508. * @static
  23509. * @memberOf _
  23510. * @since 0.1.0
  23511. * @category Function
  23512. * @param {Function} func The function to throttle.
  23513. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  23514. * @param {Object} [options={}] The options object.
  23515. * @param {boolean} [options.leading=true]
  23516. * Specify invoking on the leading edge of the timeout.
  23517. * @param {boolean} [options.trailing=true]
  23518. * Specify invoking on the trailing edge of the timeout.
  23519. * @returns {Function} Returns the new throttled function.
  23520. * @example
  23521. *
  23522. * // Avoid excessively updating the position while scrolling.
  23523. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  23524. *
  23525. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  23526. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  23527. * jQuery(element).on('click', throttled);
  23528. *
  23529. * // Cancel the trailing throttled invocation.
  23530. * jQuery(window).on('popstate', throttled.cancel);
  23531. */
  23532. function throttle(func, wait, options) {
  23533. var leading = true,
  23534. trailing = true;
  23535. if (typeof func != 'function') {
  23536. throw new TypeError(FUNC_ERROR_TEXT);
  23537. }
  23538. if (isObject(options)) {
  23539. leading = 'leading' in options ? !!options.leading : leading;
  23540. trailing = 'trailing' in options ? !!options.trailing : trailing;
  23541. }
  23542. return debounce(func, wait, {
  23543. 'leading': leading,
  23544. 'maxWait': wait,
  23545. 'trailing': trailing
  23546. });
  23547. }
  23548. /**
  23549. * Creates a function that accepts up to one argument, ignoring any
  23550. * additional arguments.
  23551. *
  23552. * @static
  23553. * @memberOf _
  23554. * @since 4.0.0
  23555. * @category Function
  23556. * @param {Function} func The function to cap arguments for.
  23557. * @returns {Function} Returns the new capped function.
  23558. * @example
  23559. *
  23560. * _.map(['6', '8', '10'], _.unary(parseInt));
  23561. * // => [6, 8, 10]
  23562. */
  23563. function unary(func) {
  23564. return ary(func, 1);
  23565. }
  23566. /**
  23567. * Creates a function that provides `value` to `wrapper` as its first
  23568. * argument. Any additional arguments provided to the function are appended
  23569. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  23570. * binding of the created function.
  23571. *
  23572. * @static
  23573. * @memberOf _
  23574. * @since 0.1.0
  23575. * @category Function
  23576. * @param {*} value The value to wrap.
  23577. * @param {Function} [wrapper=identity] The wrapper function.
  23578. * @returns {Function} Returns the new function.
  23579. * @example
  23580. *
  23581. * var p = _.wrap(_.escape, function(func, text) {
  23582. * return '<p>' + func(text) + '</p>';
  23583. * });
  23584. *
  23585. * p('fred, barney, & pebbles');
  23586. * // => '<p>fred, barney, &amp; pebbles</p>'
  23587. */
  23588. function wrap(value, wrapper) {
  23589. return partial(castFunction(wrapper), value);
  23590. }
  23591. /*------------------------------------------------------------------------*/
  23592. /**
  23593. * Casts `value` as an array if it's not one.
  23594. *
  23595. * @static
  23596. * @memberOf _
  23597. * @since 4.4.0
  23598. * @category Lang
  23599. * @param {*} value The value to inspect.
  23600. * @returns {Array} Returns the cast array.
  23601. * @example
  23602. *
  23603. * _.castArray(1);
  23604. * // => [1]
  23605. *
  23606. * _.castArray({ 'a': 1 });
  23607. * // => [{ 'a': 1 }]
  23608. *
  23609. * _.castArray('abc');
  23610. * // => ['abc']
  23611. *
  23612. * _.castArray(null);
  23613. * // => [null]
  23614. *
  23615. * _.castArray(undefined);
  23616. * // => [undefined]
  23617. *
  23618. * _.castArray();
  23619. * // => []
  23620. *
  23621. * var array = [1, 2, 3];
  23622. * console.log(_.castArray(array) === array);
  23623. * // => true
  23624. */
  23625. function castArray() {
  23626. if (!arguments.length) {
  23627. return [];
  23628. }
  23629. var value = arguments[0];
  23630. return isArray(value) ? value : [value];
  23631. }
  23632. /**
  23633. * Creates a shallow clone of `value`.
  23634. *
  23635. * **Note:** This method is loosely based on the
  23636. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  23637. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  23638. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  23639. * arrays. The own enumerable properties of `arguments` objects are cloned
  23640. * as plain objects. An empty object is returned for uncloneable values such
  23641. * as error objects, functions, DOM nodes, and WeakMaps.
  23642. *
  23643. * @static
  23644. * @memberOf _
  23645. * @since 0.1.0
  23646. * @category Lang
  23647. * @param {*} value The value to clone.
  23648. * @returns {*} Returns the cloned value.
  23649. * @see _.cloneDeep
  23650. * @example
  23651. *
  23652. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  23653. *
  23654. * var shallow = _.clone(objects);
  23655. * console.log(shallow[0] === objects[0]);
  23656. * // => true
  23657. */
  23658. function clone(value) {
  23659. return baseClone(value, CLONE_SYMBOLS_FLAG);
  23660. }
  23661. /**
  23662. * This method is like `_.clone` except that it accepts `customizer` which
  23663. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  23664. * cloning is handled by the method instead. The `customizer` is invoked with
  23665. * up to four arguments; (value [, index|key, object, stack]).
  23666. *
  23667. * @static
  23668. * @memberOf _
  23669. * @since 4.0.0
  23670. * @category Lang
  23671. * @param {*} value The value to clone.
  23672. * @param {Function} [customizer] The function to customize cloning.
  23673. * @returns {*} Returns the cloned value.
  23674. * @see _.cloneDeepWith
  23675. * @example
  23676. *
  23677. * function customizer(value) {
  23678. * if (_.isElement(value)) {
  23679. * return value.cloneNode(false);
  23680. * }
  23681. * }
  23682. *
  23683. * var el = _.cloneWith(document.body, customizer);
  23684. *
  23685. * console.log(el === document.body);
  23686. * // => false
  23687. * console.log(el.nodeName);
  23688. * // => 'BODY'
  23689. * console.log(el.childNodes.length);
  23690. * // => 0
  23691. */
  23692. function cloneWith(value, customizer) {
  23693. customizer = typeof customizer == 'function' ? customizer : undefined;
  23694. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  23695. }
  23696. /**
  23697. * This method is like `_.clone` except that it recursively clones `value`.
  23698. *
  23699. * @static
  23700. * @memberOf _
  23701. * @since 1.0.0
  23702. * @category Lang
  23703. * @param {*} value The value to recursively clone.
  23704. * @returns {*} Returns the deep cloned value.
  23705. * @see _.clone
  23706. * @example
  23707. *
  23708. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  23709. *
  23710. * var deep = _.cloneDeep(objects);
  23711. * console.log(deep[0] === objects[0]);
  23712. * // => false
  23713. */
  23714. function cloneDeep(value) {
  23715. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  23716. }
  23717. /**
  23718. * This method is like `_.cloneWith` except that it recursively clones `value`.
  23719. *
  23720. * @static
  23721. * @memberOf _
  23722. * @since 4.0.0
  23723. * @category Lang
  23724. * @param {*} value The value to recursively clone.
  23725. * @param {Function} [customizer] The function to customize cloning.
  23726. * @returns {*} Returns the deep cloned value.
  23727. * @see _.cloneWith
  23728. * @example
  23729. *
  23730. * function customizer(value) {
  23731. * if (_.isElement(value)) {
  23732. * return value.cloneNode(true);
  23733. * }
  23734. * }
  23735. *
  23736. * var el = _.cloneDeepWith(document.body, customizer);
  23737. *
  23738. * console.log(el === document.body);
  23739. * // => false
  23740. * console.log(el.nodeName);
  23741. * // => 'BODY'
  23742. * console.log(el.childNodes.length);
  23743. * // => 20
  23744. */
  23745. function cloneDeepWith(value, customizer) {
  23746. customizer = typeof customizer == 'function' ? customizer : undefined;
  23747. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  23748. }
  23749. /**
  23750. * Checks if `object` conforms to `source` by invoking the predicate
  23751. * properties of `source` with the corresponding property values of `object`.
  23752. *
  23753. * **Note:** This method is equivalent to `_.conforms` when `source` is
  23754. * partially applied.
  23755. *
  23756. * @static
  23757. * @memberOf _
  23758. * @since 4.14.0
  23759. * @category Lang
  23760. * @param {Object} object The object to inspect.
  23761. * @param {Object} source The object of property predicates to conform to.
  23762. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  23763. * @example
  23764. *
  23765. * var object = { 'a': 1, 'b': 2 };
  23766. *
  23767. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  23768. * // => true
  23769. *
  23770. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  23771. * // => false
  23772. */
  23773. function conformsTo(object, source) {
  23774. return source == null || baseConformsTo(object, source, keys(source));
  23775. }
  23776. /**
  23777. * Performs a
  23778. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  23779. * comparison between two values to determine if they are equivalent.
  23780. *
  23781. * @static
  23782. * @memberOf _
  23783. * @since 4.0.0
  23784. * @category Lang
  23785. * @param {*} value The value to compare.
  23786. * @param {*} other The other value to compare.
  23787. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  23788. * @example
  23789. *
  23790. * var object = { 'a': 1 };
  23791. * var other = { 'a': 1 };
  23792. *
  23793. * _.eq(object, object);
  23794. * // => true
  23795. *
  23796. * _.eq(object, other);
  23797. * // => false
  23798. *
  23799. * _.eq('a', 'a');
  23800. * // => true
  23801. *
  23802. * _.eq('a', Object('a'));
  23803. * // => false
  23804. *
  23805. * _.eq(NaN, NaN);
  23806. * // => true
  23807. */
  23808. function eq(value, other) {
  23809. return value === other || (value !== value && other !== other);
  23810. }
  23811. /**
  23812. * Checks if `value` is greater than `other`.
  23813. *
  23814. * @static
  23815. * @memberOf _
  23816. * @since 3.9.0
  23817. * @category Lang
  23818. * @param {*} value The value to compare.
  23819. * @param {*} other The other value to compare.
  23820. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  23821. * else `false`.
  23822. * @see _.lt
  23823. * @example
  23824. *
  23825. * _.gt(3, 1);
  23826. * // => true
  23827. *
  23828. * _.gt(3, 3);
  23829. * // => false
  23830. *
  23831. * _.gt(1, 3);
  23832. * // => false
  23833. */
  23834. var gt = createRelationalOperation(baseGt);
  23835. /**
  23836. * Checks if `value` is greater than or equal to `other`.
  23837. *
  23838. * @static
  23839. * @memberOf _
  23840. * @since 3.9.0
  23841. * @category Lang
  23842. * @param {*} value The value to compare.
  23843. * @param {*} other The other value to compare.
  23844. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  23845. * `other`, else `false`.
  23846. * @see _.lte
  23847. * @example
  23848. *
  23849. * _.gte(3, 1);
  23850. * // => true
  23851. *
  23852. * _.gte(3, 3);
  23853. * // => true
  23854. *
  23855. * _.gte(1, 3);
  23856. * // => false
  23857. */
  23858. var gte = createRelationalOperation(function(value, other) {
  23859. return value >= other;
  23860. });
  23861. /**
  23862. * Checks if `value` is likely an `arguments` object.
  23863. *
  23864. * @static
  23865. * @memberOf _
  23866. * @since 0.1.0
  23867. * @category Lang
  23868. * @param {*} value The value to check.
  23869. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  23870. * else `false`.
  23871. * @example
  23872. *
  23873. * _.isArguments(function() { return arguments; }());
  23874. * // => true
  23875. *
  23876. * _.isArguments([1, 2, 3]);
  23877. * // => false
  23878. */
  23879. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  23880. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  23881. !propertyIsEnumerable.call(value, 'callee');
  23882. };
  23883. /**
  23884. * Checks if `value` is classified as an `Array` object.
  23885. *
  23886. * @static
  23887. * @memberOf _
  23888. * @since 0.1.0
  23889. * @category Lang
  23890. * @param {*} value The value to check.
  23891. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  23892. * @example
  23893. *
  23894. * _.isArray([1, 2, 3]);
  23895. * // => true
  23896. *
  23897. * _.isArray(document.body.children);
  23898. * // => false
  23899. *
  23900. * _.isArray('abc');
  23901. * // => false
  23902. *
  23903. * _.isArray(_.noop);
  23904. * // => false
  23905. */
  23906. var isArray = Array.isArray;
  23907. /**
  23908. * Checks if `value` is classified as an `ArrayBuffer` object.
  23909. *
  23910. * @static
  23911. * @memberOf _
  23912. * @since 4.3.0
  23913. * @category Lang
  23914. * @param {*} value The value to check.
  23915. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  23916. * @example
  23917. *
  23918. * _.isArrayBuffer(new ArrayBuffer(2));
  23919. * // => true
  23920. *
  23921. * _.isArrayBuffer(new Array(2));
  23922. * // => false
  23923. */
  23924. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  23925. /**
  23926. * Checks if `value` is array-like. A value is considered array-like if it's
  23927. * not a function and has a `value.length` that's an integer greater than or
  23928. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  23929. *
  23930. * @static
  23931. * @memberOf _
  23932. * @since 4.0.0
  23933. * @category Lang
  23934. * @param {*} value The value to check.
  23935. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  23936. * @example
  23937. *
  23938. * _.isArrayLike([1, 2, 3]);
  23939. * // => true
  23940. *
  23941. * _.isArrayLike(document.body.children);
  23942. * // => true
  23943. *
  23944. * _.isArrayLike('abc');
  23945. * // => true
  23946. *
  23947. * _.isArrayLike(_.noop);
  23948. * // => false
  23949. */
  23950. function isArrayLike(value) {
  23951. return value != null && isLength(value.length) && !isFunction(value);
  23952. }
  23953. /**
  23954. * This method is like `_.isArrayLike` except that it also checks if `value`
  23955. * is an object.
  23956. *
  23957. * @static
  23958. * @memberOf _
  23959. * @since 4.0.0
  23960. * @category Lang
  23961. * @param {*} value The value to check.
  23962. * @returns {boolean} Returns `true` if `value` is an array-like object,
  23963. * else `false`.
  23964. * @example
  23965. *
  23966. * _.isArrayLikeObject([1, 2, 3]);
  23967. * // => true
  23968. *
  23969. * _.isArrayLikeObject(document.body.children);
  23970. * // => true
  23971. *
  23972. * _.isArrayLikeObject('abc');
  23973. * // => false
  23974. *
  23975. * _.isArrayLikeObject(_.noop);
  23976. * // => false
  23977. */
  23978. function isArrayLikeObject(value) {
  23979. return isObjectLike(value) && isArrayLike(value);
  23980. }
  23981. /**
  23982. * Checks if `value` is classified as a boolean primitive or object.
  23983. *
  23984. * @static
  23985. * @memberOf _
  23986. * @since 0.1.0
  23987. * @category Lang
  23988. * @param {*} value The value to check.
  23989. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  23990. * @example
  23991. *
  23992. * _.isBoolean(false);
  23993. * // => true
  23994. *
  23995. * _.isBoolean(null);
  23996. * // => false
  23997. */
  23998. function isBoolean(value) {
  23999. return value === true || value === false ||
  24000. (isObjectLike(value) && baseGetTag(value) == boolTag);
  24001. }
  24002. /**
  24003. * Checks if `value` is a buffer.
  24004. *
  24005. * @static
  24006. * @memberOf _
  24007. * @since 4.3.0
  24008. * @category Lang
  24009. * @param {*} value The value to check.
  24010. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  24011. * @example
  24012. *
  24013. * _.isBuffer(new Buffer(2));
  24014. * // => true
  24015. *
  24016. * _.isBuffer(new Uint8Array(2));
  24017. * // => false
  24018. */
  24019. var isBuffer = nativeIsBuffer || stubFalse;
  24020. /**
  24021. * Checks if `value` is classified as a `Date` object.
  24022. *
  24023. * @static
  24024. * @memberOf _
  24025. * @since 0.1.0
  24026. * @category Lang
  24027. * @param {*} value The value to check.
  24028. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  24029. * @example
  24030. *
  24031. * _.isDate(new Date);
  24032. * // => true
  24033. *
  24034. * _.isDate('Mon April 23 2012');
  24035. * // => false
  24036. */
  24037. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  24038. /**
  24039. * Checks if `value` is likely a DOM element.
  24040. *
  24041. * @static
  24042. * @memberOf _
  24043. * @since 0.1.0
  24044. * @category Lang
  24045. * @param {*} value The value to check.
  24046. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  24047. * @example
  24048. *
  24049. * _.isElement(document.body);
  24050. * // => true
  24051. *
  24052. * _.isElement('<body>');
  24053. * // => false
  24054. */
  24055. function isElement(value) {
  24056. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  24057. }
  24058. /**
  24059. * Checks if `value` is an empty object, collection, map, or set.
  24060. *
  24061. * Objects are considered empty if they have no own enumerable string keyed
  24062. * properties.
  24063. *
  24064. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  24065. * jQuery-like collections are considered empty if they have a `length` of `0`.
  24066. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  24067. *
  24068. * @static
  24069. * @memberOf _
  24070. * @since 0.1.0
  24071. * @category Lang
  24072. * @param {*} value The value to check.
  24073. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  24074. * @example
  24075. *
  24076. * _.isEmpty(null);
  24077. * // => true
  24078. *
  24079. * _.isEmpty(true);
  24080. * // => true
  24081. *
  24082. * _.isEmpty(1);
  24083. * // => true
  24084. *
  24085. * _.isEmpty([1, 2, 3]);
  24086. * // => false
  24087. *
  24088. * _.isEmpty({ 'a': 1 });
  24089. * // => false
  24090. */
  24091. function isEmpty(value) {
  24092. if (value == null) {
  24093. return true;
  24094. }
  24095. if (isArrayLike(value) &&
  24096. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  24097. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  24098. return !value.length;
  24099. }
  24100. var tag = getTag(value);
  24101. if (tag == mapTag || tag == setTag) {
  24102. return !value.size;
  24103. }
  24104. if (isPrototype(value)) {
  24105. return !baseKeys(value).length;
  24106. }
  24107. for (var key in value) {
  24108. if (hasOwnProperty.call(value, key)) {
  24109. return false;
  24110. }
  24111. }
  24112. return true;
  24113. }
  24114. /**
  24115. * Performs a deep comparison between two values to determine if they are
  24116. * equivalent.
  24117. *
  24118. * **Note:** This method supports comparing arrays, array buffers, booleans,
  24119. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  24120. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  24121. * by their own, not inherited, enumerable properties. Functions and DOM
  24122. * nodes are compared by strict equality, i.e. `===`.
  24123. *
  24124. * @static
  24125. * @memberOf _
  24126. * @since 0.1.0
  24127. * @category Lang
  24128. * @param {*} value The value to compare.
  24129. * @param {*} other The other value to compare.
  24130. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  24131. * @example
  24132. *
  24133. * var object = { 'a': 1 };
  24134. * var other = { 'a': 1 };
  24135. *
  24136. * _.isEqual(object, other);
  24137. * // => true
  24138. *
  24139. * object === other;
  24140. * // => false
  24141. */
  24142. function isEqual(value, other) {
  24143. return baseIsEqual(value, other);
  24144. }
  24145. /**
  24146. * This method is like `_.isEqual` except that it accepts `customizer` which
  24147. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  24148. * are handled by the method instead. The `customizer` is invoked with up to
  24149. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  24150. *
  24151. * @static
  24152. * @memberOf _
  24153. * @since 4.0.0
  24154. * @category Lang
  24155. * @param {*} value The value to compare.
  24156. * @param {*} other The other value to compare.
  24157. * @param {Function} [customizer] The function to customize comparisons.
  24158. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  24159. * @example
  24160. *
  24161. * function isGreeting(value) {
  24162. * return /^h(?:i|ello)$/.test(value);
  24163. * }
  24164. *
  24165. * function customizer(objValue, othValue) {
  24166. * if (isGreeting(objValue) && isGreeting(othValue)) {
  24167. * return true;
  24168. * }
  24169. * }
  24170. *
  24171. * var array = ['hello', 'goodbye'];
  24172. * var other = ['hi', 'goodbye'];
  24173. *
  24174. * _.isEqualWith(array, other, customizer);
  24175. * // => true
  24176. */
  24177. function isEqualWith(value, other, customizer) {
  24178. customizer = typeof customizer == 'function' ? customizer : undefined;
  24179. var result = customizer ? customizer(value, other) : undefined;
  24180. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  24181. }
  24182. /**
  24183. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  24184. * `SyntaxError`, `TypeError`, or `URIError` object.
  24185. *
  24186. * @static
  24187. * @memberOf _
  24188. * @since 3.0.0
  24189. * @category Lang
  24190. * @param {*} value The value to check.
  24191. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  24192. * @example
  24193. *
  24194. * _.isError(new Error);
  24195. * // => true
  24196. *
  24197. * _.isError(Error);
  24198. * // => false
  24199. */
  24200. function isError(value) {
  24201. if (!isObjectLike(value)) {
  24202. return false;
  24203. }
  24204. var tag = baseGetTag(value);
  24205. return tag == errorTag || tag == domExcTag ||
  24206. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  24207. }
  24208. /**
  24209. * Checks if `value` is a finite primitive number.
  24210. *
  24211. * **Note:** This method is based on
  24212. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  24213. *
  24214. * @static
  24215. * @memberOf _
  24216. * @since 0.1.0
  24217. * @category Lang
  24218. * @param {*} value The value to check.
  24219. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  24220. * @example
  24221. *
  24222. * _.isFinite(3);
  24223. * // => true
  24224. *
  24225. * _.isFinite(Number.MIN_VALUE);
  24226. * // => true
  24227. *
  24228. * _.isFinite(Infinity);
  24229. * // => false
  24230. *
  24231. * _.isFinite('3');
  24232. * // => false
  24233. */
  24234. function isFinite(value) {
  24235. return typeof value == 'number' && nativeIsFinite(value);
  24236. }
  24237. /**
  24238. * Checks if `value` is classified as a `Function` object.
  24239. *
  24240. * @static
  24241. * @memberOf _
  24242. * @since 0.1.0
  24243. * @category Lang
  24244. * @param {*} value The value to check.
  24245. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  24246. * @example
  24247. *
  24248. * _.isFunction(_);
  24249. * // => true
  24250. *
  24251. * _.isFunction(/abc/);
  24252. * // => false
  24253. */
  24254. function isFunction(value) {
  24255. if (!isObject(value)) {
  24256. return false;
  24257. }
  24258. // The use of `Object#toString` avoids issues with the `typeof` operator
  24259. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  24260. var tag = baseGetTag(value);
  24261. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  24262. }
  24263. /**
  24264. * Checks if `value` is an integer.
  24265. *
  24266. * **Note:** This method is based on
  24267. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  24268. *
  24269. * @static
  24270. * @memberOf _
  24271. * @since 4.0.0
  24272. * @category Lang
  24273. * @param {*} value The value to check.
  24274. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  24275. * @example
  24276. *
  24277. * _.isInteger(3);
  24278. * // => true
  24279. *
  24280. * _.isInteger(Number.MIN_VALUE);
  24281. * // => false
  24282. *
  24283. * _.isInteger(Infinity);
  24284. * // => false
  24285. *
  24286. * _.isInteger('3');
  24287. * // => false
  24288. */
  24289. function isInteger(value) {
  24290. return typeof value == 'number' && value == toInteger(value);
  24291. }
  24292. /**
  24293. * Checks if `value` is a valid array-like length.
  24294. *
  24295. * **Note:** This method is loosely based on
  24296. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  24297. *
  24298. * @static
  24299. * @memberOf _
  24300. * @since 4.0.0
  24301. * @category Lang
  24302. * @param {*} value The value to check.
  24303. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  24304. * @example
  24305. *
  24306. * _.isLength(3);
  24307. * // => true
  24308. *
  24309. * _.isLength(Number.MIN_VALUE);
  24310. * // => false
  24311. *
  24312. * _.isLength(Infinity);
  24313. * // => false
  24314. *
  24315. * _.isLength('3');
  24316. * // => false
  24317. */
  24318. function isLength(value) {
  24319. return typeof value == 'number' &&
  24320. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  24321. }
  24322. /**
  24323. * Checks if `value` is the
  24324. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  24325. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  24326. *
  24327. * @static
  24328. * @memberOf _
  24329. * @since 0.1.0
  24330. * @category Lang
  24331. * @param {*} value The value to check.
  24332. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  24333. * @example
  24334. *
  24335. * _.isObject({});
  24336. * // => true
  24337. *
  24338. * _.isObject([1, 2, 3]);
  24339. * // => true
  24340. *
  24341. * _.isObject(_.noop);
  24342. * // => true
  24343. *
  24344. * _.isObject(null);
  24345. * // => false
  24346. */
  24347. function isObject(value) {
  24348. var type = typeof value;
  24349. return value != null && (type == 'object' || type == 'function');
  24350. }
  24351. /**
  24352. * Checks if `value` is object-like. A value is object-like if it's not `null`
  24353. * and has a `typeof` result of "object".
  24354. *
  24355. * @static
  24356. * @memberOf _
  24357. * @since 4.0.0
  24358. * @category Lang
  24359. * @param {*} value The value to check.
  24360. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  24361. * @example
  24362. *
  24363. * _.isObjectLike({});
  24364. * // => true
  24365. *
  24366. * _.isObjectLike([1, 2, 3]);
  24367. * // => true
  24368. *
  24369. * _.isObjectLike(_.noop);
  24370. * // => false
  24371. *
  24372. * _.isObjectLike(null);
  24373. * // => false
  24374. */
  24375. function isObjectLike(value) {
  24376. return value != null && typeof value == 'object';
  24377. }
  24378. /**
  24379. * Checks if `value` is classified as a `Map` object.
  24380. *
  24381. * @static
  24382. * @memberOf _
  24383. * @since 4.3.0
  24384. * @category Lang
  24385. * @param {*} value The value to check.
  24386. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  24387. * @example
  24388. *
  24389. * _.isMap(new Map);
  24390. * // => true
  24391. *
  24392. * _.isMap(new WeakMap);
  24393. * // => false
  24394. */
  24395. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  24396. /**
  24397. * Performs a partial deep comparison between `object` and `source` to
  24398. * determine if `object` contains equivalent property values.
  24399. *
  24400. * **Note:** This method is equivalent to `_.matches` when `source` is
  24401. * partially applied.
  24402. *
  24403. * Partial comparisons will match empty array and empty object `source`
  24404. * values against any array or object value, respectively. See `_.isEqual`
  24405. * for a list of supported value comparisons.
  24406. *
  24407. * @static
  24408. * @memberOf _
  24409. * @since 3.0.0
  24410. * @category Lang
  24411. * @param {Object} object The object to inspect.
  24412. * @param {Object} source The object of property values to match.
  24413. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  24414. * @example
  24415. *
  24416. * var object = { 'a': 1, 'b': 2 };
  24417. *
  24418. * _.isMatch(object, { 'b': 2 });
  24419. * // => true
  24420. *
  24421. * _.isMatch(object, { 'b': 1 });
  24422. * // => false
  24423. */
  24424. function isMatch(object, source) {
  24425. return object === source || baseIsMatch(object, source, getMatchData(source));
  24426. }
  24427. /**
  24428. * This method is like `_.isMatch` except that it accepts `customizer` which
  24429. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  24430. * are handled by the method instead. The `customizer` is invoked with five
  24431. * arguments: (objValue, srcValue, index|key, object, source).
  24432. *
  24433. * @static
  24434. * @memberOf _
  24435. * @since 4.0.0
  24436. * @category Lang
  24437. * @param {Object} object The object to inspect.
  24438. * @param {Object} source The object of property values to match.
  24439. * @param {Function} [customizer] The function to customize comparisons.
  24440. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  24441. * @example
  24442. *
  24443. * function isGreeting(value) {
  24444. * return /^h(?:i|ello)$/.test(value);
  24445. * }
  24446. *
  24447. * function customizer(objValue, srcValue) {
  24448. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  24449. * return true;
  24450. * }
  24451. * }
  24452. *
  24453. * var object = { 'greeting': 'hello' };
  24454. * var source = { 'greeting': 'hi' };
  24455. *
  24456. * _.isMatchWith(object, source, customizer);
  24457. * // => true
  24458. */
  24459. function isMatchWith(object, source, customizer) {
  24460. customizer = typeof customizer == 'function' ? customizer : undefined;
  24461. return baseIsMatch(object, source, getMatchData(source), customizer);
  24462. }
  24463. /**
  24464. * Checks if `value` is `NaN`.
  24465. *
  24466. * **Note:** This method is based on
  24467. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  24468. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  24469. * `undefined` and other non-number values.
  24470. *
  24471. * @static
  24472. * @memberOf _
  24473. * @since 0.1.0
  24474. * @category Lang
  24475. * @param {*} value The value to check.
  24476. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  24477. * @example
  24478. *
  24479. * _.isNaN(NaN);
  24480. * // => true
  24481. *
  24482. * _.isNaN(new Number(NaN));
  24483. * // => true
  24484. *
  24485. * isNaN(undefined);
  24486. * // => true
  24487. *
  24488. * _.isNaN(undefined);
  24489. * // => false
  24490. */
  24491. function isNaN(value) {
  24492. // An `NaN` primitive is the only value that is not equal to itself.
  24493. // Perform the `toStringTag` check first to avoid errors with some
  24494. // ActiveX objects in IE.
  24495. return isNumber(value) && value != +value;
  24496. }
  24497. /**
  24498. * Checks if `value` is a pristine native function.
  24499. *
  24500. * **Note:** This method can't reliably detect native functions in the presence
  24501. * of the core-js package because core-js circumvents this kind of detection.
  24502. * Despite multiple requests, the core-js maintainer has made it clear: any
  24503. * attempt to fix the detection will be obstructed. As a result, we're left
  24504. * with little choice but to throw an error. Unfortunately, this also affects
  24505. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  24506. * which rely on core-js.
  24507. *
  24508. * @static
  24509. * @memberOf _
  24510. * @since 3.0.0
  24511. * @category Lang
  24512. * @param {*} value The value to check.
  24513. * @returns {boolean} Returns `true` if `value` is a native function,
  24514. * else `false`.
  24515. * @example
  24516. *
  24517. * _.isNative(Array.prototype.push);
  24518. * // => true
  24519. *
  24520. * _.isNative(_);
  24521. * // => false
  24522. */
  24523. function isNative(value) {
  24524. if (isMaskable(value)) {
  24525. throw new Error(CORE_ERROR_TEXT);
  24526. }
  24527. return baseIsNative(value);
  24528. }
  24529. /**
  24530. * Checks if `value` is `null`.
  24531. *
  24532. * @static
  24533. * @memberOf _
  24534. * @since 0.1.0
  24535. * @category Lang
  24536. * @param {*} value The value to check.
  24537. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  24538. * @example
  24539. *
  24540. * _.isNull(null);
  24541. * // => true
  24542. *
  24543. * _.isNull(void 0);
  24544. * // => false
  24545. */
  24546. function isNull(value) {
  24547. return value === null;
  24548. }
  24549. /**
  24550. * Checks if `value` is `null` or `undefined`.
  24551. *
  24552. * @static
  24553. * @memberOf _
  24554. * @since 4.0.0
  24555. * @category Lang
  24556. * @param {*} value The value to check.
  24557. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  24558. * @example
  24559. *
  24560. * _.isNil(null);
  24561. * // => true
  24562. *
  24563. * _.isNil(void 0);
  24564. * // => true
  24565. *
  24566. * _.isNil(NaN);
  24567. * // => false
  24568. */
  24569. function isNil(value) {
  24570. return value == null;
  24571. }
  24572. /**
  24573. * Checks if `value` is classified as a `Number` primitive or object.
  24574. *
  24575. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  24576. * classified as numbers, use the `_.isFinite` method.
  24577. *
  24578. * @static
  24579. * @memberOf _
  24580. * @since 0.1.0
  24581. * @category Lang
  24582. * @param {*} value The value to check.
  24583. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  24584. * @example
  24585. *
  24586. * _.isNumber(3);
  24587. * // => true
  24588. *
  24589. * _.isNumber(Number.MIN_VALUE);
  24590. * // => true
  24591. *
  24592. * _.isNumber(Infinity);
  24593. * // => true
  24594. *
  24595. * _.isNumber('3');
  24596. * // => false
  24597. */
  24598. function isNumber(value) {
  24599. return typeof value == 'number' ||
  24600. (isObjectLike(value) && baseGetTag(value) == numberTag);
  24601. }
  24602. /**
  24603. * Checks if `value` is a plain object, that is, an object created by the
  24604. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  24605. *
  24606. * @static
  24607. * @memberOf _
  24608. * @since 0.8.0
  24609. * @category Lang
  24610. * @param {*} value The value to check.
  24611. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  24612. * @example
  24613. *
  24614. * function Foo() {
  24615. * this.a = 1;
  24616. * }
  24617. *
  24618. * _.isPlainObject(new Foo);
  24619. * // => false
  24620. *
  24621. * _.isPlainObject([1, 2, 3]);
  24622. * // => false
  24623. *
  24624. * _.isPlainObject({ 'x': 0, 'y': 0 });
  24625. * // => true
  24626. *
  24627. * _.isPlainObject(Object.create(null));
  24628. * // => true
  24629. */
  24630. function isPlainObject(value) {
  24631. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  24632. return false;
  24633. }
  24634. var proto = getPrototype(value);
  24635. if (proto === null) {
  24636. return true;
  24637. }
  24638. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  24639. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  24640. funcToString.call(Ctor) == objectCtorString;
  24641. }
  24642. /**
  24643. * Checks if `value` is classified as a `RegExp` object.
  24644. *
  24645. * @static
  24646. * @memberOf _
  24647. * @since 0.1.0
  24648. * @category Lang
  24649. * @param {*} value The value to check.
  24650. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  24651. * @example
  24652. *
  24653. * _.isRegExp(/abc/);
  24654. * // => true
  24655. *
  24656. * _.isRegExp('/abc/');
  24657. * // => false
  24658. */
  24659. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  24660. /**
  24661. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  24662. * double precision number which isn't the result of a rounded unsafe integer.
  24663. *
  24664. * **Note:** This method is based on
  24665. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  24666. *
  24667. * @static
  24668. * @memberOf _
  24669. * @since 4.0.0
  24670. * @category Lang
  24671. * @param {*} value The value to check.
  24672. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  24673. * @example
  24674. *
  24675. * _.isSafeInteger(3);
  24676. * // => true
  24677. *
  24678. * _.isSafeInteger(Number.MIN_VALUE);
  24679. * // => false
  24680. *
  24681. * _.isSafeInteger(Infinity);
  24682. * // => false
  24683. *
  24684. * _.isSafeInteger('3');
  24685. * // => false
  24686. */
  24687. function isSafeInteger(value) {
  24688. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  24689. }
  24690. /**
  24691. * Checks if `value` is classified as a `Set` object.
  24692. *
  24693. * @static
  24694. * @memberOf _
  24695. * @since 4.3.0
  24696. * @category Lang
  24697. * @param {*} value The value to check.
  24698. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  24699. * @example
  24700. *
  24701. * _.isSet(new Set);
  24702. * // => true
  24703. *
  24704. * _.isSet(new WeakSet);
  24705. * // => false
  24706. */
  24707. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  24708. /**
  24709. * Checks if `value` is classified as a `String` primitive or object.
  24710. *
  24711. * @static
  24712. * @since 0.1.0
  24713. * @memberOf _
  24714. * @category Lang
  24715. * @param {*} value The value to check.
  24716. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  24717. * @example
  24718. *
  24719. * _.isString('abc');
  24720. * // => true
  24721. *
  24722. * _.isString(1);
  24723. * // => false
  24724. */
  24725. function isString(value) {
  24726. return typeof value == 'string' ||
  24727. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  24728. }
  24729. /**
  24730. * Checks if `value` is classified as a `Symbol` primitive or object.
  24731. *
  24732. * @static
  24733. * @memberOf _
  24734. * @since 4.0.0
  24735. * @category Lang
  24736. * @param {*} value The value to check.
  24737. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  24738. * @example
  24739. *
  24740. * _.isSymbol(Symbol.iterator);
  24741. * // => true
  24742. *
  24743. * _.isSymbol('abc');
  24744. * // => false
  24745. */
  24746. function isSymbol(value) {
  24747. return typeof value == 'symbol' ||
  24748. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  24749. }
  24750. /**
  24751. * Checks if `value` is classified as a typed array.
  24752. *
  24753. * @static
  24754. * @memberOf _
  24755. * @since 3.0.0
  24756. * @category Lang
  24757. * @param {*} value The value to check.
  24758. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  24759. * @example
  24760. *
  24761. * _.isTypedArray(new Uint8Array);
  24762. * // => true
  24763. *
  24764. * _.isTypedArray([]);
  24765. * // => false
  24766. */
  24767. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  24768. /**
  24769. * Checks if `value` is `undefined`.
  24770. *
  24771. * @static
  24772. * @since 0.1.0
  24773. * @memberOf _
  24774. * @category Lang
  24775. * @param {*} value The value to check.
  24776. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  24777. * @example
  24778. *
  24779. * _.isUndefined(void 0);
  24780. * // => true
  24781. *
  24782. * _.isUndefined(null);
  24783. * // => false
  24784. */
  24785. function isUndefined(value) {
  24786. return value === undefined;
  24787. }
  24788. /**
  24789. * Checks if `value` is classified as a `WeakMap` object.
  24790. *
  24791. * @static
  24792. * @memberOf _
  24793. * @since 4.3.0
  24794. * @category Lang
  24795. * @param {*} value The value to check.
  24796. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  24797. * @example
  24798. *
  24799. * _.isWeakMap(new WeakMap);
  24800. * // => true
  24801. *
  24802. * _.isWeakMap(new Map);
  24803. * // => false
  24804. */
  24805. function isWeakMap(value) {
  24806. return isObjectLike(value) && getTag(value) == weakMapTag;
  24807. }
  24808. /**
  24809. * Checks if `value` is classified as a `WeakSet` object.
  24810. *
  24811. * @static
  24812. * @memberOf _
  24813. * @since 4.3.0
  24814. * @category Lang
  24815. * @param {*} value The value to check.
  24816. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  24817. * @example
  24818. *
  24819. * _.isWeakSet(new WeakSet);
  24820. * // => true
  24821. *
  24822. * _.isWeakSet(new Set);
  24823. * // => false
  24824. */
  24825. function isWeakSet(value) {
  24826. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  24827. }
  24828. /**
  24829. * Checks if `value` is less than `other`.
  24830. *
  24831. * @static
  24832. * @memberOf _
  24833. * @since 3.9.0
  24834. * @category Lang
  24835. * @param {*} value The value to compare.
  24836. * @param {*} other The other value to compare.
  24837. * @returns {boolean} Returns `true` if `value` is less than `other`,
  24838. * else `false`.
  24839. * @see _.gt
  24840. * @example
  24841. *
  24842. * _.lt(1, 3);
  24843. * // => true
  24844. *
  24845. * _.lt(3, 3);
  24846. * // => false
  24847. *
  24848. * _.lt(3, 1);
  24849. * // => false
  24850. */
  24851. var lt = createRelationalOperation(baseLt);
  24852. /**
  24853. * Checks if `value` is less than or equal to `other`.
  24854. *
  24855. * @static
  24856. * @memberOf _
  24857. * @since 3.9.0
  24858. * @category Lang
  24859. * @param {*} value The value to compare.
  24860. * @param {*} other The other value to compare.
  24861. * @returns {boolean} Returns `true` if `value` is less than or equal to
  24862. * `other`, else `false`.
  24863. * @see _.gte
  24864. * @example
  24865. *
  24866. * _.lte(1, 3);
  24867. * // => true
  24868. *
  24869. * _.lte(3, 3);
  24870. * // => true
  24871. *
  24872. * _.lte(3, 1);
  24873. * // => false
  24874. */
  24875. var lte = createRelationalOperation(function(value, other) {
  24876. return value <= other;
  24877. });
  24878. /**
  24879. * Converts `value` to an array.
  24880. *
  24881. * @static
  24882. * @since 0.1.0
  24883. * @memberOf _
  24884. * @category Lang
  24885. * @param {*} value The value to convert.
  24886. * @returns {Array} Returns the converted array.
  24887. * @example
  24888. *
  24889. * _.toArray({ 'a': 1, 'b': 2 });
  24890. * // => [1, 2]
  24891. *
  24892. * _.toArray('abc');
  24893. * // => ['a', 'b', 'c']
  24894. *
  24895. * _.toArray(1);
  24896. * // => []
  24897. *
  24898. * _.toArray(null);
  24899. * // => []
  24900. */
  24901. function toArray(value) {
  24902. if (!value) {
  24903. return [];
  24904. }
  24905. if (isArrayLike(value)) {
  24906. return isString(value) ? stringToArray(value) : copyArray(value);
  24907. }
  24908. if (symIterator && value[symIterator]) {
  24909. return iteratorToArray(value[symIterator]());
  24910. }
  24911. var tag = getTag(value),
  24912. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  24913. return func(value);
  24914. }
  24915. /**
  24916. * Converts `value` to a finite number.
  24917. *
  24918. * @static
  24919. * @memberOf _
  24920. * @since 4.12.0
  24921. * @category Lang
  24922. * @param {*} value The value to convert.
  24923. * @returns {number} Returns the converted number.
  24924. * @example
  24925. *
  24926. * _.toFinite(3.2);
  24927. * // => 3.2
  24928. *
  24929. * _.toFinite(Number.MIN_VALUE);
  24930. * // => 5e-324
  24931. *
  24932. * _.toFinite(Infinity);
  24933. * // => 1.7976931348623157e+308
  24934. *
  24935. * _.toFinite('3.2');
  24936. * // => 3.2
  24937. */
  24938. function toFinite(value) {
  24939. if (!value) {
  24940. return value === 0 ? value : 0;
  24941. }
  24942. value = toNumber(value);
  24943. if (value === INFINITY || value === -INFINITY) {
  24944. var sign = (value < 0 ? -1 : 1);
  24945. return sign * MAX_INTEGER;
  24946. }
  24947. return value === value ? value : 0;
  24948. }
  24949. /**
  24950. * Converts `value` to an integer.
  24951. *
  24952. * **Note:** This method is loosely based on
  24953. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  24954. *
  24955. * @static
  24956. * @memberOf _
  24957. * @since 4.0.0
  24958. * @category Lang
  24959. * @param {*} value The value to convert.
  24960. * @returns {number} Returns the converted integer.
  24961. * @example
  24962. *
  24963. * _.toInteger(3.2);
  24964. * // => 3
  24965. *
  24966. * _.toInteger(Number.MIN_VALUE);
  24967. * // => 0
  24968. *
  24969. * _.toInteger(Infinity);
  24970. * // => 1.7976931348623157e+308
  24971. *
  24972. * _.toInteger('3.2');
  24973. * // => 3
  24974. */
  24975. function toInteger(value) {
  24976. var result = toFinite(value),
  24977. remainder = result % 1;
  24978. return result === result ? (remainder ? result - remainder : result) : 0;
  24979. }
  24980. /**
  24981. * Converts `value` to an integer suitable for use as the length of an
  24982. * array-like object.
  24983. *
  24984. * **Note:** This method is based on
  24985. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  24986. *
  24987. * @static
  24988. * @memberOf _
  24989. * @since 4.0.0
  24990. * @category Lang
  24991. * @param {*} value The value to convert.
  24992. * @returns {number} Returns the converted integer.
  24993. * @example
  24994. *
  24995. * _.toLength(3.2);
  24996. * // => 3
  24997. *
  24998. * _.toLength(Number.MIN_VALUE);
  24999. * // => 0
  25000. *
  25001. * _.toLength(Infinity);
  25002. * // => 4294967295
  25003. *
  25004. * _.toLength('3.2');
  25005. * // => 3
  25006. */
  25007. function toLength(value) {
  25008. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  25009. }
  25010. /**
  25011. * Converts `value` to a number.
  25012. *
  25013. * @static
  25014. * @memberOf _
  25015. * @since 4.0.0
  25016. * @category Lang
  25017. * @param {*} value The value to process.
  25018. * @returns {number} Returns the number.
  25019. * @example
  25020. *
  25021. * _.toNumber(3.2);
  25022. * // => 3.2
  25023. *
  25024. * _.toNumber(Number.MIN_VALUE);
  25025. * // => 5e-324
  25026. *
  25027. * _.toNumber(Infinity);
  25028. * // => Infinity
  25029. *
  25030. * _.toNumber('3.2');
  25031. * // => 3.2
  25032. */
  25033. function toNumber(value) {
  25034. if (typeof value == 'number') {
  25035. return value;
  25036. }
  25037. if (isSymbol(value)) {
  25038. return NAN;
  25039. }
  25040. if (isObject(value)) {
  25041. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  25042. value = isObject(other) ? (other + '') : other;
  25043. }
  25044. if (typeof value != 'string') {
  25045. return value === 0 ? value : +value;
  25046. }
  25047. value = value.replace(reTrim, '');
  25048. var isBinary = reIsBinary.test(value);
  25049. return (isBinary || reIsOctal.test(value))
  25050. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  25051. : (reIsBadHex.test(value) ? NAN : +value);
  25052. }
  25053. /**
  25054. * Converts `value` to a plain object flattening inherited enumerable string
  25055. * keyed properties of `value` to own properties of the plain object.
  25056. *
  25057. * @static
  25058. * @memberOf _
  25059. * @since 3.0.0
  25060. * @category Lang
  25061. * @param {*} value The value to convert.
  25062. * @returns {Object} Returns the converted plain object.
  25063. * @example
  25064. *
  25065. * function Foo() {
  25066. * this.b = 2;
  25067. * }
  25068. *
  25069. * Foo.prototype.c = 3;
  25070. *
  25071. * _.assign({ 'a': 1 }, new Foo);
  25072. * // => { 'a': 1, 'b': 2 }
  25073. *
  25074. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  25075. * // => { 'a': 1, 'b': 2, 'c': 3 }
  25076. */
  25077. function toPlainObject(value) {
  25078. return copyObject(value, keysIn(value));
  25079. }
  25080. /**
  25081. * Converts `value` to a safe integer. A safe integer can be compared and
  25082. * represented correctly.
  25083. *
  25084. * @static
  25085. * @memberOf _
  25086. * @since 4.0.0
  25087. * @category Lang
  25088. * @param {*} value The value to convert.
  25089. * @returns {number} Returns the converted integer.
  25090. * @example
  25091. *
  25092. * _.toSafeInteger(3.2);
  25093. * // => 3
  25094. *
  25095. * _.toSafeInteger(Number.MIN_VALUE);
  25096. * // => 0
  25097. *
  25098. * _.toSafeInteger(Infinity);
  25099. * // => 9007199254740991
  25100. *
  25101. * _.toSafeInteger('3.2');
  25102. * // => 3
  25103. */
  25104. function toSafeInteger(value) {
  25105. return value
  25106. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  25107. : (value === 0 ? value : 0);
  25108. }
  25109. /**
  25110. * Converts `value` to a string. An empty string is returned for `null`
  25111. * and `undefined` values. The sign of `-0` is preserved.
  25112. *
  25113. * @static
  25114. * @memberOf _
  25115. * @since 4.0.0
  25116. * @category Lang
  25117. * @param {*} value The value to convert.
  25118. * @returns {string} Returns the converted string.
  25119. * @example
  25120. *
  25121. * _.toString(null);
  25122. * // => ''
  25123. *
  25124. * _.toString(-0);
  25125. * // => '-0'
  25126. *
  25127. * _.toString([1, 2, 3]);
  25128. * // => '1,2,3'
  25129. */
  25130. function toString(value) {
  25131. return value == null ? '' : baseToString(value);
  25132. }
  25133. /*------------------------------------------------------------------------*/
  25134. /**
  25135. * Assigns own enumerable string keyed properties of source objects to the
  25136. * destination object. Source objects are applied from left to right.
  25137. * Subsequent sources overwrite property assignments of previous sources.
  25138. *
  25139. * **Note:** This method mutates `object` and is loosely based on
  25140. * [`Object.assign`](https://mdn.io/Object/assign).
  25141. *
  25142. * @static
  25143. * @memberOf _
  25144. * @since 0.10.0
  25145. * @category Object
  25146. * @param {Object} object The destination object.
  25147. * @param {...Object} [sources] The source objects.
  25148. * @returns {Object} Returns `object`.
  25149. * @see _.assignIn
  25150. * @example
  25151. *
  25152. * function Foo() {
  25153. * this.a = 1;
  25154. * }
  25155. *
  25156. * function Bar() {
  25157. * this.c = 3;
  25158. * }
  25159. *
  25160. * Foo.prototype.b = 2;
  25161. * Bar.prototype.d = 4;
  25162. *
  25163. * _.assign({ 'a': 0 }, new Foo, new Bar);
  25164. * // => { 'a': 1, 'c': 3 }
  25165. */
  25166. var assign = createAssigner(function(object, source) {
  25167. if (isPrototype(source) || isArrayLike(source)) {
  25168. copyObject(source, keys(source), object);
  25169. return;
  25170. }
  25171. for (var key in source) {
  25172. if (hasOwnProperty.call(source, key)) {
  25173. assignValue(object, key, source[key]);
  25174. }
  25175. }
  25176. });
  25177. /**
  25178. * This method is like `_.assign` except that it iterates over own and
  25179. * inherited source properties.
  25180. *
  25181. * **Note:** This method mutates `object`.
  25182. *
  25183. * @static
  25184. * @memberOf _
  25185. * @since 4.0.0
  25186. * @alias extend
  25187. * @category Object
  25188. * @param {Object} object The destination object.
  25189. * @param {...Object} [sources] The source objects.
  25190. * @returns {Object} Returns `object`.
  25191. * @see _.assign
  25192. * @example
  25193. *
  25194. * function Foo() {
  25195. * this.a = 1;
  25196. * }
  25197. *
  25198. * function Bar() {
  25199. * this.c = 3;
  25200. * }
  25201. *
  25202. * Foo.prototype.b = 2;
  25203. * Bar.prototype.d = 4;
  25204. *
  25205. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  25206. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  25207. */
  25208. var assignIn = createAssigner(function(object, source) {
  25209. copyObject(source, keysIn(source), object);
  25210. });
  25211. /**
  25212. * This method is like `_.assignIn` except that it accepts `customizer`
  25213. * which is invoked to produce the assigned values. If `customizer` returns
  25214. * `undefined`, assignment is handled by the method instead. The `customizer`
  25215. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  25216. *
  25217. * **Note:** This method mutates `object`.
  25218. *
  25219. * @static
  25220. * @memberOf _
  25221. * @since 4.0.0
  25222. * @alias extendWith
  25223. * @category Object
  25224. * @param {Object} object The destination object.
  25225. * @param {...Object} sources The source objects.
  25226. * @param {Function} [customizer] The function to customize assigned values.
  25227. * @returns {Object} Returns `object`.
  25228. * @see _.assignWith
  25229. * @example
  25230. *
  25231. * function customizer(objValue, srcValue) {
  25232. * return _.isUndefined(objValue) ? srcValue : objValue;
  25233. * }
  25234. *
  25235. * var defaults = _.partialRight(_.assignInWith, customizer);
  25236. *
  25237. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  25238. * // => { 'a': 1, 'b': 2 }
  25239. */
  25240. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  25241. copyObject(source, keysIn(source), object, customizer);
  25242. });
  25243. /**
  25244. * This method is like `_.assign` except that it accepts `customizer`
  25245. * which is invoked to produce the assigned values. If `customizer` returns
  25246. * `undefined`, assignment is handled by the method instead. The `customizer`
  25247. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  25248. *
  25249. * **Note:** This method mutates `object`.
  25250. *
  25251. * @static
  25252. * @memberOf _
  25253. * @since 4.0.0
  25254. * @category Object
  25255. * @param {Object} object The destination object.
  25256. * @param {...Object} sources The source objects.
  25257. * @param {Function} [customizer] The function to customize assigned values.
  25258. * @returns {Object} Returns `object`.
  25259. * @see _.assignInWith
  25260. * @example
  25261. *
  25262. * function customizer(objValue, srcValue) {
  25263. * return _.isUndefined(objValue) ? srcValue : objValue;
  25264. * }
  25265. *
  25266. * var defaults = _.partialRight(_.assignWith, customizer);
  25267. *
  25268. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  25269. * // => { 'a': 1, 'b': 2 }
  25270. */
  25271. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  25272. copyObject(source, keys(source), object, customizer);
  25273. });
  25274. /**
  25275. * Creates an array of values corresponding to `paths` of `object`.
  25276. *
  25277. * @static
  25278. * @memberOf _
  25279. * @since 1.0.0
  25280. * @category Object
  25281. * @param {Object} object The object to iterate over.
  25282. * @param {...(string|string[])} [paths] The property paths to pick.
  25283. * @returns {Array} Returns the picked values.
  25284. * @example
  25285. *
  25286. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  25287. *
  25288. * _.at(object, ['a[0].b.c', 'a[1]']);
  25289. * // => [3, 4]
  25290. */
  25291. var at = flatRest(baseAt);
  25292. /**
  25293. * Creates an object that inherits from the `prototype` object. If a
  25294. * `properties` object is given, its own enumerable string keyed properties
  25295. * are assigned to the created object.
  25296. *
  25297. * @static
  25298. * @memberOf _
  25299. * @since 2.3.0
  25300. * @category Object
  25301. * @param {Object} prototype The object to inherit from.
  25302. * @param {Object} [properties] The properties to assign to the object.
  25303. * @returns {Object} Returns the new object.
  25304. * @example
  25305. *
  25306. * function Shape() {
  25307. * this.x = 0;
  25308. * this.y = 0;
  25309. * }
  25310. *
  25311. * function Circle() {
  25312. * Shape.call(this);
  25313. * }
  25314. *
  25315. * Circle.prototype = _.create(Shape.prototype, {
  25316. * 'constructor': Circle
  25317. * });
  25318. *
  25319. * var circle = new Circle;
  25320. * circle instanceof Circle;
  25321. * // => true
  25322. *
  25323. * circle instanceof Shape;
  25324. * // => true
  25325. */
  25326. function create(prototype, properties) {
  25327. var result = baseCreate(prototype);
  25328. return properties == null ? result : baseAssign(result, properties);
  25329. }
  25330. /**
  25331. * Assigns own and inherited enumerable string keyed properties of source
  25332. * objects to the destination object for all destination properties that
  25333. * resolve to `undefined`. Source objects are applied from left to right.
  25334. * Once a property is set, additional values of the same property are ignored.
  25335. *
  25336. * **Note:** This method mutates `object`.
  25337. *
  25338. * @static
  25339. * @since 0.1.0
  25340. * @memberOf _
  25341. * @category Object
  25342. * @param {Object} object The destination object.
  25343. * @param {...Object} [sources] The source objects.
  25344. * @returns {Object} Returns `object`.
  25345. * @see _.defaultsDeep
  25346. * @example
  25347. *
  25348. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  25349. * // => { 'a': 1, 'b': 2 }
  25350. */
  25351. var defaults = baseRest(function(object, sources) {
  25352. object = Object(object);
  25353. var index = -1;
  25354. var length = sources.length;
  25355. var guard = length > 2 ? sources[2] : undefined;
  25356. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  25357. length = 1;
  25358. }
  25359. while (++index < length) {
  25360. var source = sources[index];
  25361. var props = keysIn(source);
  25362. var propsIndex = -1;
  25363. var propsLength = props.length;
  25364. while (++propsIndex < propsLength) {
  25365. var key = props[propsIndex];
  25366. var value = object[key];
  25367. if (value === undefined ||
  25368. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  25369. object[key] = source[key];
  25370. }
  25371. }
  25372. }
  25373. return object;
  25374. });
  25375. /**
  25376. * This method is like `_.defaults` except that it recursively assigns
  25377. * default properties.
  25378. *
  25379. * **Note:** This method mutates `object`.
  25380. *
  25381. * @static
  25382. * @memberOf _
  25383. * @since 3.10.0
  25384. * @category Object
  25385. * @param {Object} object The destination object.
  25386. * @param {...Object} [sources] The source objects.
  25387. * @returns {Object} Returns `object`.
  25388. * @see _.defaults
  25389. * @example
  25390. *
  25391. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  25392. * // => { 'a': { 'b': 2, 'c': 3 } }
  25393. */
  25394. var defaultsDeep = baseRest(function(args) {
  25395. args.push(undefined, customDefaultsMerge);
  25396. return apply(mergeWith, undefined, args);
  25397. });
  25398. /**
  25399. * This method is like `_.find` except that it returns the key of the first
  25400. * element `predicate` returns truthy for instead of the element itself.
  25401. *
  25402. * @static
  25403. * @memberOf _
  25404. * @since 1.1.0
  25405. * @category Object
  25406. * @param {Object} object The object to inspect.
  25407. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25408. * @returns {string|undefined} Returns the key of the matched element,
  25409. * else `undefined`.
  25410. * @example
  25411. *
  25412. * var users = {
  25413. * 'barney': { 'age': 36, 'active': true },
  25414. * 'fred': { 'age': 40, 'active': false },
  25415. * 'pebbles': { 'age': 1, 'active': true }
  25416. * };
  25417. *
  25418. * _.findKey(users, function(o) { return o.age < 40; });
  25419. * // => 'barney' (iteration order is not guaranteed)
  25420. *
  25421. * // The `_.matches` iteratee shorthand.
  25422. * _.findKey(users, { 'age': 1, 'active': true });
  25423. * // => 'pebbles'
  25424. *
  25425. * // The `_.matchesProperty` iteratee shorthand.
  25426. * _.findKey(users, ['active', false]);
  25427. * // => 'fred'
  25428. *
  25429. * // The `_.property` iteratee shorthand.
  25430. * _.findKey(users, 'active');
  25431. * // => 'barney'
  25432. */
  25433. function findKey(object, predicate) {
  25434. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  25435. }
  25436. /**
  25437. * This method is like `_.findKey` except that it iterates over elements of
  25438. * a collection in the opposite order.
  25439. *
  25440. * @static
  25441. * @memberOf _
  25442. * @since 2.0.0
  25443. * @category Object
  25444. * @param {Object} object The object to inspect.
  25445. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25446. * @returns {string|undefined} Returns the key of the matched element,
  25447. * else `undefined`.
  25448. * @example
  25449. *
  25450. * var users = {
  25451. * 'barney': { 'age': 36, 'active': true },
  25452. * 'fred': { 'age': 40, 'active': false },
  25453. * 'pebbles': { 'age': 1, 'active': true }
  25454. * };
  25455. *
  25456. * _.findLastKey(users, function(o) { return o.age < 40; });
  25457. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  25458. *
  25459. * // The `_.matches` iteratee shorthand.
  25460. * _.findLastKey(users, { 'age': 36, 'active': true });
  25461. * // => 'barney'
  25462. *
  25463. * // The `_.matchesProperty` iteratee shorthand.
  25464. * _.findLastKey(users, ['active', false]);
  25465. * // => 'fred'
  25466. *
  25467. * // The `_.property` iteratee shorthand.
  25468. * _.findLastKey(users, 'active');
  25469. * // => 'pebbles'
  25470. */
  25471. function findLastKey(object, predicate) {
  25472. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  25473. }
  25474. /**
  25475. * Iterates over own and inherited enumerable string keyed properties of an
  25476. * object and invokes `iteratee` for each property. The iteratee is invoked
  25477. * with three arguments: (value, key, object). Iteratee functions may exit
  25478. * iteration early by explicitly returning `false`.
  25479. *
  25480. * @static
  25481. * @memberOf _
  25482. * @since 0.3.0
  25483. * @category Object
  25484. * @param {Object} object The object to iterate over.
  25485. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  25486. * @returns {Object} Returns `object`.
  25487. * @see _.forInRight
  25488. * @example
  25489. *
  25490. * function Foo() {
  25491. * this.a = 1;
  25492. * this.b = 2;
  25493. * }
  25494. *
  25495. * Foo.prototype.c = 3;
  25496. *
  25497. * _.forIn(new Foo, function(value, key) {
  25498. * console.log(key);
  25499. * });
  25500. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  25501. */
  25502. function forIn(object, iteratee) {
  25503. return object == null
  25504. ? object
  25505. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  25506. }
  25507. /**
  25508. * This method is like `_.forIn` except that it iterates over properties of
  25509. * `object` in the opposite order.
  25510. *
  25511. * @static
  25512. * @memberOf _
  25513. * @since 2.0.0
  25514. * @category Object
  25515. * @param {Object} object The object to iterate over.
  25516. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  25517. * @returns {Object} Returns `object`.
  25518. * @see _.forIn
  25519. * @example
  25520. *
  25521. * function Foo() {
  25522. * this.a = 1;
  25523. * this.b = 2;
  25524. * }
  25525. *
  25526. * Foo.prototype.c = 3;
  25527. *
  25528. * _.forInRight(new Foo, function(value, key) {
  25529. * console.log(key);
  25530. * });
  25531. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  25532. */
  25533. function forInRight(object, iteratee) {
  25534. return object == null
  25535. ? object
  25536. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  25537. }
  25538. /**
  25539. * Iterates over own enumerable string keyed properties of an object and
  25540. * invokes `iteratee` for each property. The iteratee is invoked with three
  25541. * arguments: (value, key, object). Iteratee functions may exit iteration
  25542. * early by explicitly returning `false`.
  25543. *
  25544. * @static
  25545. * @memberOf _
  25546. * @since 0.3.0
  25547. * @category Object
  25548. * @param {Object} object The object to iterate over.
  25549. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  25550. * @returns {Object} Returns `object`.
  25551. * @see _.forOwnRight
  25552. * @example
  25553. *
  25554. * function Foo() {
  25555. * this.a = 1;
  25556. * this.b = 2;
  25557. * }
  25558. *
  25559. * Foo.prototype.c = 3;
  25560. *
  25561. * _.forOwn(new Foo, function(value, key) {
  25562. * console.log(key);
  25563. * });
  25564. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  25565. */
  25566. function forOwn(object, iteratee) {
  25567. return object && baseForOwn(object, getIteratee(iteratee, 3));
  25568. }
  25569. /**
  25570. * This method is like `_.forOwn` except that it iterates over properties of
  25571. * `object` in the opposite order.
  25572. *
  25573. * @static
  25574. * @memberOf _
  25575. * @since 2.0.0
  25576. * @category Object
  25577. * @param {Object} object The object to iterate over.
  25578. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  25579. * @returns {Object} Returns `object`.
  25580. * @see _.forOwn
  25581. * @example
  25582. *
  25583. * function Foo() {
  25584. * this.a = 1;
  25585. * this.b = 2;
  25586. * }
  25587. *
  25588. * Foo.prototype.c = 3;
  25589. *
  25590. * _.forOwnRight(new Foo, function(value, key) {
  25591. * console.log(key);
  25592. * });
  25593. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  25594. */
  25595. function forOwnRight(object, iteratee) {
  25596. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  25597. }
  25598. /**
  25599. * Creates an array of function property names from own enumerable properties
  25600. * of `object`.
  25601. *
  25602. * @static
  25603. * @since 0.1.0
  25604. * @memberOf _
  25605. * @category Object
  25606. * @param {Object} object The object to inspect.
  25607. * @returns {Array} Returns the function names.
  25608. * @see _.functionsIn
  25609. * @example
  25610. *
  25611. * function Foo() {
  25612. * this.a = _.constant('a');
  25613. * this.b = _.constant('b');
  25614. * }
  25615. *
  25616. * Foo.prototype.c = _.constant('c');
  25617. *
  25618. * _.functions(new Foo);
  25619. * // => ['a', 'b']
  25620. */
  25621. function functions(object) {
  25622. return object == null ? [] : baseFunctions(object, keys(object));
  25623. }
  25624. /**
  25625. * Creates an array of function property names from own and inherited
  25626. * enumerable properties of `object`.
  25627. *
  25628. * @static
  25629. * @memberOf _
  25630. * @since 4.0.0
  25631. * @category Object
  25632. * @param {Object} object The object to inspect.
  25633. * @returns {Array} Returns the function names.
  25634. * @see _.functions
  25635. * @example
  25636. *
  25637. * function Foo() {
  25638. * this.a = _.constant('a');
  25639. * this.b = _.constant('b');
  25640. * }
  25641. *
  25642. * Foo.prototype.c = _.constant('c');
  25643. *
  25644. * _.functionsIn(new Foo);
  25645. * // => ['a', 'b', 'c']
  25646. */
  25647. function functionsIn(object) {
  25648. return object == null ? [] : baseFunctions(object, keysIn(object));
  25649. }
  25650. /**
  25651. * Gets the value at `path` of `object`. If the resolved value is
  25652. * `undefined`, the `defaultValue` is returned in its place.
  25653. *
  25654. * @static
  25655. * @memberOf _
  25656. * @since 3.7.0
  25657. * @category Object
  25658. * @param {Object} object The object to query.
  25659. * @param {Array|string} path The path of the property to get.
  25660. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  25661. * @returns {*} Returns the resolved value.
  25662. * @example
  25663. *
  25664. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  25665. *
  25666. * _.get(object, 'a[0].b.c');
  25667. * // => 3
  25668. *
  25669. * _.get(object, ['a', '0', 'b', 'c']);
  25670. * // => 3
  25671. *
  25672. * _.get(object, 'a.b.c', 'default');
  25673. * // => 'default'
  25674. */
  25675. function get(object, path, defaultValue) {
  25676. var result = object == null ? undefined : baseGet(object, path);
  25677. return result === undefined ? defaultValue : result;
  25678. }
  25679. /**
  25680. * Checks if `path` is a direct property of `object`.
  25681. *
  25682. * @static
  25683. * @since 0.1.0
  25684. * @memberOf _
  25685. * @category Object
  25686. * @param {Object} object The object to query.
  25687. * @param {Array|string} path The path to check.
  25688. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  25689. * @example
  25690. *
  25691. * var object = { 'a': { 'b': 2 } };
  25692. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  25693. *
  25694. * _.has(object, 'a');
  25695. * // => true
  25696. *
  25697. * _.has(object, 'a.b');
  25698. * // => true
  25699. *
  25700. * _.has(object, ['a', 'b']);
  25701. * // => true
  25702. *
  25703. * _.has(other, 'a');
  25704. * // => false
  25705. */
  25706. function has(object, path) {
  25707. return object != null && hasPath(object, path, baseHas);
  25708. }
  25709. /**
  25710. * Checks if `path` is a direct or inherited property of `object`.
  25711. *
  25712. * @static
  25713. * @memberOf _
  25714. * @since 4.0.0
  25715. * @category Object
  25716. * @param {Object} object The object to query.
  25717. * @param {Array|string} path The path to check.
  25718. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  25719. * @example
  25720. *
  25721. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  25722. *
  25723. * _.hasIn(object, 'a');
  25724. * // => true
  25725. *
  25726. * _.hasIn(object, 'a.b');
  25727. * // => true
  25728. *
  25729. * _.hasIn(object, ['a', 'b']);
  25730. * // => true
  25731. *
  25732. * _.hasIn(object, 'b');
  25733. * // => false
  25734. */
  25735. function hasIn(object, path) {
  25736. return object != null && hasPath(object, path, baseHasIn);
  25737. }
  25738. /**
  25739. * Creates an object composed of the inverted keys and values of `object`.
  25740. * If `object` contains duplicate values, subsequent values overwrite
  25741. * property assignments of previous values.
  25742. *
  25743. * @static
  25744. * @memberOf _
  25745. * @since 0.7.0
  25746. * @category Object
  25747. * @param {Object} object The object to invert.
  25748. * @returns {Object} Returns the new inverted object.
  25749. * @example
  25750. *
  25751. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  25752. *
  25753. * _.invert(object);
  25754. * // => { '1': 'c', '2': 'b' }
  25755. */
  25756. var invert = createInverter(function(result, value, key) {
  25757. if (value != null &&
  25758. typeof value.toString != 'function') {
  25759. value = nativeObjectToString.call(value);
  25760. }
  25761. result[value] = key;
  25762. }, constant(identity));
  25763. /**
  25764. * This method is like `_.invert` except that the inverted object is generated
  25765. * from the results of running each element of `object` thru `iteratee`. The
  25766. * corresponding inverted value of each inverted key is an array of keys
  25767. * responsible for generating the inverted value. The iteratee is invoked
  25768. * with one argument: (value).
  25769. *
  25770. * @static
  25771. * @memberOf _
  25772. * @since 4.1.0
  25773. * @category Object
  25774. * @param {Object} object The object to invert.
  25775. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25776. * @returns {Object} Returns the new inverted object.
  25777. * @example
  25778. *
  25779. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  25780. *
  25781. * _.invertBy(object);
  25782. * // => { '1': ['a', 'c'], '2': ['b'] }
  25783. *
  25784. * _.invertBy(object, function(value) {
  25785. * return 'group' + value;
  25786. * });
  25787. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  25788. */
  25789. var invertBy = createInverter(function(result, value, key) {
  25790. if (value != null &&
  25791. typeof value.toString != 'function') {
  25792. value = nativeObjectToString.call(value);
  25793. }
  25794. if (hasOwnProperty.call(result, value)) {
  25795. result[value].push(key);
  25796. } else {
  25797. result[value] = [key];
  25798. }
  25799. }, getIteratee);
  25800. /**
  25801. * Invokes the method at `path` of `object`.
  25802. *
  25803. * @static
  25804. * @memberOf _
  25805. * @since 4.0.0
  25806. * @category Object
  25807. * @param {Object} object The object to query.
  25808. * @param {Array|string} path The path of the method to invoke.
  25809. * @param {...*} [args] The arguments to invoke the method with.
  25810. * @returns {*} Returns the result of the invoked method.
  25811. * @example
  25812. *
  25813. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  25814. *
  25815. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  25816. * // => [2, 3]
  25817. */
  25818. var invoke = baseRest(baseInvoke);
  25819. /**
  25820. * Creates an array of the own enumerable property names of `object`.
  25821. *
  25822. * **Note:** Non-object values are coerced to objects. See the
  25823. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  25824. * for more details.
  25825. *
  25826. * @static
  25827. * @since 0.1.0
  25828. * @memberOf _
  25829. * @category Object
  25830. * @param {Object} object The object to query.
  25831. * @returns {Array} Returns the array of property names.
  25832. * @example
  25833. *
  25834. * function Foo() {
  25835. * this.a = 1;
  25836. * this.b = 2;
  25837. * }
  25838. *
  25839. * Foo.prototype.c = 3;
  25840. *
  25841. * _.keys(new Foo);
  25842. * // => ['a', 'b'] (iteration order is not guaranteed)
  25843. *
  25844. * _.keys('hi');
  25845. * // => ['0', '1']
  25846. */
  25847. function keys(object) {
  25848. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  25849. }
  25850. /**
  25851. * Creates an array of the own and inherited enumerable property names of `object`.
  25852. *
  25853. * **Note:** Non-object values are coerced to objects.
  25854. *
  25855. * @static
  25856. * @memberOf _
  25857. * @since 3.0.0
  25858. * @category Object
  25859. * @param {Object} object The object to query.
  25860. * @returns {Array} Returns the array of property names.
  25861. * @example
  25862. *
  25863. * function Foo() {
  25864. * this.a = 1;
  25865. * this.b = 2;
  25866. * }
  25867. *
  25868. * Foo.prototype.c = 3;
  25869. *
  25870. * _.keysIn(new Foo);
  25871. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  25872. */
  25873. function keysIn(object) {
  25874. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  25875. }
  25876. /**
  25877. * The opposite of `_.mapValues`; this method creates an object with the
  25878. * same values as `object` and keys generated by running each own enumerable
  25879. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  25880. * with three arguments: (value, key, object).
  25881. *
  25882. * @static
  25883. * @memberOf _
  25884. * @since 3.8.0
  25885. * @category Object
  25886. * @param {Object} object The object to iterate over.
  25887. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  25888. * @returns {Object} Returns the new mapped object.
  25889. * @see _.mapValues
  25890. * @example
  25891. *
  25892. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  25893. * return key + value;
  25894. * });
  25895. * // => { 'a1': 1, 'b2': 2 }
  25896. */
  25897. function mapKeys(object, iteratee) {
  25898. var result = {};
  25899. iteratee = getIteratee(iteratee, 3);
  25900. baseForOwn(object, function(value, key, object) {
  25901. baseAssignValue(result, iteratee(value, key, object), value);
  25902. });
  25903. return result;
  25904. }
  25905. /**
  25906. * Creates an object with the same keys as `object` and values generated
  25907. * by running each own enumerable string keyed property of `object` thru
  25908. * `iteratee`. The iteratee is invoked with three arguments:
  25909. * (value, key, object).
  25910. *
  25911. * @static
  25912. * @memberOf _
  25913. * @since 2.4.0
  25914. * @category Object
  25915. * @param {Object} object The object to iterate over.
  25916. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  25917. * @returns {Object} Returns the new mapped object.
  25918. * @see _.mapKeys
  25919. * @example
  25920. *
  25921. * var users = {
  25922. * 'fred': { 'user': 'fred', 'age': 40 },
  25923. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  25924. * };
  25925. *
  25926. * _.mapValues(users, function(o) { return o.age; });
  25927. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  25928. *
  25929. * // The `_.property` iteratee shorthand.
  25930. * _.mapValues(users, 'age');
  25931. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  25932. */
  25933. function mapValues(object, iteratee) {
  25934. var result = {};
  25935. iteratee = getIteratee(iteratee, 3);
  25936. baseForOwn(object, function(value, key, object) {
  25937. baseAssignValue(result, key, iteratee(value, key, object));
  25938. });
  25939. return result;
  25940. }
  25941. /**
  25942. * This method is like `_.assign` except that it recursively merges own and
  25943. * inherited enumerable string keyed properties of source objects into the
  25944. * destination object. Source properties that resolve to `undefined` are
  25945. * skipped if a destination value exists. Array and plain object properties
  25946. * are merged recursively. Other objects and value types are overridden by
  25947. * assignment. Source objects are applied from left to right. Subsequent
  25948. * sources overwrite property assignments of previous sources.
  25949. *
  25950. * **Note:** This method mutates `object`.
  25951. *
  25952. * @static
  25953. * @memberOf _
  25954. * @since 0.5.0
  25955. * @category Object
  25956. * @param {Object} object The destination object.
  25957. * @param {...Object} [sources] The source objects.
  25958. * @returns {Object} Returns `object`.
  25959. * @example
  25960. *
  25961. * var object = {
  25962. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  25963. * };
  25964. *
  25965. * var other = {
  25966. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  25967. * };
  25968. *
  25969. * _.merge(object, other);
  25970. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  25971. */
  25972. var merge = createAssigner(function(object, source, srcIndex) {
  25973. baseMerge(object, source, srcIndex);
  25974. });
  25975. /**
  25976. * This method is like `_.merge` except that it accepts `customizer` which
  25977. * is invoked to produce the merged values of the destination and source
  25978. * properties. If `customizer` returns `undefined`, merging is handled by the
  25979. * method instead. The `customizer` is invoked with six arguments:
  25980. * (objValue, srcValue, key, object, source, stack).
  25981. *
  25982. * **Note:** This method mutates `object`.
  25983. *
  25984. * @static
  25985. * @memberOf _
  25986. * @since 4.0.0
  25987. * @category Object
  25988. * @param {Object} object The destination object.
  25989. * @param {...Object} sources The source objects.
  25990. * @param {Function} customizer The function to customize assigned values.
  25991. * @returns {Object} Returns `object`.
  25992. * @example
  25993. *
  25994. * function customizer(objValue, srcValue) {
  25995. * if (_.isArray(objValue)) {
  25996. * return objValue.concat(srcValue);
  25997. * }
  25998. * }
  25999. *
  26000. * var object = { 'a': [1], 'b': [2] };
  26001. * var other = { 'a': [3], 'b': [4] };
  26002. *
  26003. * _.mergeWith(object, other, customizer);
  26004. * // => { 'a': [1, 3], 'b': [2, 4] }
  26005. */
  26006. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  26007. baseMerge(object, source, srcIndex, customizer);
  26008. });
  26009. /**
  26010. * The opposite of `_.pick`; this method creates an object composed of the
  26011. * own and inherited enumerable property paths of `object` that are not omitted.
  26012. *
  26013. * **Note:** This method is considerably slower than `_.pick`.
  26014. *
  26015. * @static
  26016. * @since 0.1.0
  26017. * @memberOf _
  26018. * @category Object
  26019. * @param {Object} object The source object.
  26020. * @param {...(string|string[])} [paths] The property paths to omit.
  26021. * @returns {Object} Returns the new object.
  26022. * @example
  26023. *
  26024. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26025. *
  26026. * _.omit(object, ['a', 'c']);
  26027. * // => { 'b': '2' }
  26028. */
  26029. var omit = flatRest(function(object, paths) {
  26030. var result = {};
  26031. if (object == null) {
  26032. return result;
  26033. }
  26034. var isDeep = false;
  26035. paths = arrayMap(paths, function(path) {
  26036. path = castPath(path, object);
  26037. isDeep || (isDeep = path.length > 1);
  26038. return path;
  26039. });
  26040. copyObject(object, getAllKeysIn(object), result);
  26041. if (isDeep) {
  26042. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  26043. }
  26044. var length = paths.length;
  26045. while (length--) {
  26046. baseUnset(result, paths[length]);
  26047. }
  26048. return result;
  26049. });
  26050. /**
  26051. * The opposite of `_.pickBy`; this method creates an object composed of
  26052. * the own and inherited enumerable string keyed properties of `object` that
  26053. * `predicate` doesn't return truthy for. The predicate is invoked with two
  26054. * arguments: (value, key).
  26055. *
  26056. * @static
  26057. * @memberOf _
  26058. * @since 4.0.0
  26059. * @category Object
  26060. * @param {Object} object The source object.
  26061. * @param {Function} [predicate=_.identity] The function invoked per property.
  26062. * @returns {Object} Returns the new object.
  26063. * @example
  26064. *
  26065. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26066. *
  26067. * _.omitBy(object, _.isNumber);
  26068. * // => { 'b': '2' }
  26069. */
  26070. function omitBy(object, predicate) {
  26071. return pickBy(object, negate(getIteratee(predicate)));
  26072. }
  26073. /**
  26074. * Creates an object composed of the picked `object` properties.
  26075. *
  26076. * @static
  26077. * @since 0.1.0
  26078. * @memberOf _
  26079. * @category Object
  26080. * @param {Object} object The source object.
  26081. * @param {...(string|string[])} [paths] The property paths to pick.
  26082. * @returns {Object} Returns the new object.
  26083. * @example
  26084. *
  26085. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26086. *
  26087. * _.pick(object, ['a', 'c']);
  26088. * // => { 'a': 1, 'c': 3 }
  26089. */
  26090. var pick = flatRest(function(object, paths) {
  26091. return object == null ? {} : basePick(object, paths);
  26092. });
  26093. /**
  26094. * Creates an object composed of the `object` properties `predicate` returns
  26095. * truthy for. The predicate is invoked with two arguments: (value, key).
  26096. *
  26097. * @static
  26098. * @memberOf _
  26099. * @since 4.0.0
  26100. * @category Object
  26101. * @param {Object} object The source object.
  26102. * @param {Function} [predicate=_.identity] The function invoked per property.
  26103. * @returns {Object} Returns the new object.
  26104. * @example
  26105. *
  26106. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  26107. *
  26108. * _.pickBy(object, _.isNumber);
  26109. * // => { 'a': 1, 'c': 3 }
  26110. */
  26111. function pickBy(object, predicate) {
  26112. if (object == null) {
  26113. return {};
  26114. }
  26115. var props = arrayMap(getAllKeysIn(object), function(prop) {
  26116. return [prop];
  26117. });
  26118. predicate = getIteratee(predicate);
  26119. return basePickBy(object, props, function(value, path) {
  26120. return predicate(value, path[0]);
  26121. });
  26122. }
  26123. /**
  26124. * This method is like `_.get` except that if the resolved value is a
  26125. * function it's invoked with the `this` binding of its parent object and
  26126. * its result is returned.
  26127. *
  26128. * @static
  26129. * @since 0.1.0
  26130. * @memberOf _
  26131. * @category Object
  26132. * @param {Object} object The object to query.
  26133. * @param {Array|string} path The path of the property to resolve.
  26134. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  26135. * @returns {*} Returns the resolved value.
  26136. * @example
  26137. *
  26138. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  26139. *
  26140. * _.result(object, 'a[0].b.c1');
  26141. * // => 3
  26142. *
  26143. * _.result(object, 'a[0].b.c2');
  26144. * // => 4
  26145. *
  26146. * _.result(object, 'a[0].b.c3', 'default');
  26147. * // => 'default'
  26148. *
  26149. * _.result(object, 'a[0].b.c3', _.constant('default'));
  26150. * // => 'default'
  26151. */
  26152. function result(object, path, defaultValue) {
  26153. path = castPath(path, object);
  26154. var index = -1,
  26155. length = path.length;
  26156. // Ensure the loop is entered when path is empty.
  26157. if (!length) {
  26158. length = 1;
  26159. object = undefined;
  26160. }
  26161. while (++index < length) {
  26162. var value = object == null ? undefined : object[toKey(path[index])];
  26163. if (value === undefined) {
  26164. index = length;
  26165. value = defaultValue;
  26166. }
  26167. object = isFunction(value) ? value.call(object) : value;
  26168. }
  26169. return object;
  26170. }
  26171. /**
  26172. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  26173. * it's created. Arrays are created for missing index properties while objects
  26174. * are created for all other missing properties. Use `_.setWith` to customize
  26175. * `path` creation.
  26176. *
  26177. * **Note:** This method mutates `object`.
  26178. *
  26179. * @static
  26180. * @memberOf _
  26181. * @since 3.7.0
  26182. * @category Object
  26183. * @param {Object} object The object to modify.
  26184. * @param {Array|string} path The path of the property to set.
  26185. * @param {*} value The value to set.
  26186. * @returns {Object} Returns `object`.
  26187. * @example
  26188. *
  26189. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  26190. *
  26191. * _.set(object, 'a[0].b.c', 4);
  26192. * console.log(object.a[0].b.c);
  26193. * // => 4
  26194. *
  26195. * _.set(object, ['x', '0', 'y', 'z'], 5);
  26196. * console.log(object.x[0].y.z);
  26197. * // => 5
  26198. */
  26199. function set(object, path, value) {
  26200. return object == null ? object : baseSet(object, path, value);
  26201. }
  26202. /**
  26203. * This method is like `_.set` except that it accepts `customizer` which is
  26204. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  26205. * path creation is handled by the method instead. The `customizer` is invoked
  26206. * with three arguments: (nsValue, key, nsObject).
  26207. *
  26208. * **Note:** This method mutates `object`.
  26209. *
  26210. * @static
  26211. * @memberOf _
  26212. * @since 4.0.0
  26213. * @category Object
  26214. * @param {Object} object The object to modify.
  26215. * @param {Array|string} path The path of the property to set.
  26216. * @param {*} value The value to set.
  26217. * @param {Function} [customizer] The function to customize assigned values.
  26218. * @returns {Object} Returns `object`.
  26219. * @example
  26220. *
  26221. * var object = {};
  26222. *
  26223. * _.setWith(object, '[0][1]', 'a', Object);
  26224. * // => { '0': { '1': 'a' } }
  26225. */
  26226. function setWith(object, path, value, customizer) {
  26227. customizer = typeof customizer == 'function' ? customizer : undefined;
  26228. return object == null ? object : baseSet(object, path, value, customizer);
  26229. }
  26230. /**
  26231. * Creates an array of own enumerable string keyed-value pairs for `object`
  26232. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  26233. * entries are returned.
  26234. *
  26235. * @static
  26236. * @memberOf _
  26237. * @since 4.0.0
  26238. * @alias entries
  26239. * @category Object
  26240. * @param {Object} object The object to query.
  26241. * @returns {Array} Returns the key-value pairs.
  26242. * @example
  26243. *
  26244. * function Foo() {
  26245. * this.a = 1;
  26246. * this.b = 2;
  26247. * }
  26248. *
  26249. * Foo.prototype.c = 3;
  26250. *
  26251. * _.toPairs(new Foo);
  26252. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  26253. */
  26254. var toPairs = createToPairs(keys);
  26255. /**
  26256. * Creates an array of own and inherited enumerable string keyed-value pairs
  26257. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  26258. * or set, its entries are returned.
  26259. *
  26260. * @static
  26261. * @memberOf _
  26262. * @since 4.0.0
  26263. * @alias entriesIn
  26264. * @category Object
  26265. * @param {Object} object The object to query.
  26266. * @returns {Array} Returns the key-value pairs.
  26267. * @example
  26268. *
  26269. * function Foo() {
  26270. * this.a = 1;
  26271. * this.b = 2;
  26272. * }
  26273. *
  26274. * Foo.prototype.c = 3;
  26275. *
  26276. * _.toPairsIn(new Foo);
  26277. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  26278. */
  26279. var toPairsIn = createToPairs(keysIn);
  26280. /**
  26281. * An alternative to `_.reduce`; this method transforms `object` to a new
  26282. * `accumulator` object which is the result of running each of its own
  26283. * enumerable string keyed properties thru `iteratee`, with each invocation
  26284. * potentially mutating the `accumulator` object. If `accumulator` is not
  26285. * provided, a new object with the same `[[Prototype]]` will be used. The
  26286. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  26287. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26288. *
  26289. * @static
  26290. * @memberOf _
  26291. * @since 1.3.0
  26292. * @category Object
  26293. * @param {Object} object The object to iterate over.
  26294. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26295. * @param {*} [accumulator] The custom accumulator value.
  26296. * @returns {*} Returns the accumulated value.
  26297. * @example
  26298. *
  26299. * _.transform([2, 3, 4], function(result, n) {
  26300. * result.push(n *= n);
  26301. * return n % 2 == 0;
  26302. * }, []);
  26303. * // => [4, 9]
  26304. *
  26305. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  26306. * (result[value] || (result[value] = [])).push(key);
  26307. * }, {});
  26308. * // => { '1': ['a', 'c'], '2': ['b'] }
  26309. */
  26310. function transform(object, iteratee, accumulator) {
  26311. var isArr = isArray(object),
  26312. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  26313. iteratee = getIteratee(iteratee, 4);
  26314. if (accumulator == null) {
  26315. var Ctor = object && object.constructor;
  26316. if (isArrLike) {
  26317. accumulator = isArr ? new Ctor : [];
  26318. }
  26319. else if (isObject(object)) {
  26320. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  26321. }
  26322. else {
  26323. accumulator = {};
  26324. }
  26325. }
  26326. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  26327. return iteratee(accumulator, value, index, object);
  26328. });
  26329. return accumulator;
  26330. }
  26331. /**
  26332. * Removes the property at `path` of `object`.
  26333. *
  26334. * **Note:** This method mutates `object`.
  26335. *
  26336. * @static
  26337. * @memberOf _
  26338. * @since 4.0.0
  26339. * @category Object
  26340. * @param {Object} object The object to modify.
  26341. * @param {Array|string} path The path of the property to unset.
  26342. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  26343. * @example
  26344. *
  26345. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  26346. * _.unset(object, 'a[0].b.c');
  26347. * // => true
  26348. *
  26349. * console.log(object);
  26350. * // => { 'a': [{ 'b': {} }] };
  26351. *
  26352. * _.unset(object, ['a', '0', 'b', 'c']);
  26353. * // => true
  26354. *
  26355. * console.log(object);
  26356. * // => { 'a': [{ 'b': {} }] };
  26357. */
  26358. function unset(object, path) {
  26359. return object == null ? true : baseUnset(object, path);
  26360. }
  26361. /**
  26362. * This method is like `_.set` except that accepts `updater` to produce the
  26363. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  26364. * is invoked with one argument: (value).
  26365. *
  26366. * **Note:** This method mutates `object`.
  26367. *
  26368. * @static
  26369. * @memberOf _
  26370. * @since 4.6.0
  26371. * @category Object
  26372. * @param {Object} object The object to modify.
  26373. * @param {Array|string} path The path of the property to set.
  26374. * @param {Function} updater The function to produce the updated value.
  26375. * @returns {Object} Returns `object`.
  26376. * @example
  26377. *
  26378. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  26379. *
  26380. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  26381. * console.log(object.a[0].b.c);
  26382. * // => 9
  26383. *
  26384. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  26385. * console.log(object.x[0].y.z);
  26386. * // => 0
  26387. */
  26388. function update(object, path, updater) {
  26389. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  26390. }
  26391. /**
  26392. * This method is like `_.update` except that it accepts `customizer` which is
  26393. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  26394. * path creation is handled by the method instead. The `customizer` is invoked
  26395. * with three arguments: (nsValue, key, nsObject).
  26396. *
  26397. * **Note:** This method mutates `object`.
  26398. *
  26399. * @static
  26400. * @memberOf _
  26401. * @since 4.6.0
  26402. * @category Object
  26403. * @param {Object} object The object to modify.
  26404. * @param {Array|string} path The path of the property to set.
  26405. * @param {Function} updater The function to produce the updated value.
  26406. * @param {Function} [customizer] The function to customize assigned values.
  26407. * @returns {Object} Returns `object`.
  26408. * @example
  26409. *
  26410. * var object = {};
  26411. *
  26412. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  26413. * // => { '0': { '1': 'a' } }
  26414. */
  26415. function updateWith(object, path, updater, customizer) {
  26416. customizer = typeof customizer == 'function' ? customizer : undefined;
  26417. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  26418. }
  26419. /**
  26420. * Creates an array of the own enumerable string keyed property values of `object`.
  26421. *
  26422. * **Note:** Non-object values are coerced to objects.
  26423. *
  26424. * @static
  26425. * @since 0.1.0
  26426. * @memberOf _
  26427. * @category Object
  26428. * @param {Object} object The object to query.
  26429. * @returns {Array} Returns the array of property values.
  26430. * @example
  26431. *
  26432. * function Foo() {
  26433. * this.a = 1;
  26434. * this.b = 2;
  26435. * }
  26436. *
  26437. * Foo.prototype.c = 3;
  26438. *
  26439. * _.values(new Foo);
  26440. * // => [1, 2] (iteration order is not guaranteed)
  26441. *
  26442. * _.values('hi');
  26443. * // => ['h', 'i']
  26444. */
  26445. function values(object) {
  26446. return object == null ? [] : baseValues(object, keys(object));
  26447. }
  26448. /**
  26449. * Creates an array of the own and inherited enumerable string keyed property
  26450. * values of `object`.
  26451. *
  26452. * **Note:** Non-object values are coerced to objects.
  26453. *
  26454. * @static
  26455. * @memberOf _
  26456. * @since 3.0.0
  26457. * @category Object
  26458. * @param {Object} object The object to query.
  26459. * @returns {Array} Returns the array of property values.
  26460. * @example
  26461. *
  26462. * function Foo() {
  26463. * this.a = 1;
  26464. * this.b = 2;
  26465. * }
  26466. *
  26467. * Foo.prototype.c = 3;
  26468. *
  26469. * _.valuesIn(new Foo);
  26470. * // => [1, 2, 3] (iteration order is not guaranteed)
  26471. */
  26472. function valuesIn(object) {
  26473. return object == null ? [] : baseValues(object, keysIn(object));
  26474. }
  26475. /*------------------------------------------------------------------------*/
  26476. /**
  26477. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  26478. *
  26479. * @static
  26480. * @memberOf _
  26481. * @since 4.0.0
  26482. * @category Number
  26483. * @param {number} number The number to clamp.
  26484. * @param {number} [lower] The lower bound.
  26485. * @param {number} upper The upper bound.
  26486. * @returns {number} Returns the clamped number.
  26487. * @example
  26488. *
  26489. * _.clamp(-10, -5, 5);
  26490. * // => -5
  26491. *
  26492. * _.clamp(10, -5, 5);
  26493. * // => 5
  26494. */
  26495. function clamp(number, lower, upper) {
  26496. if (upper === undefined) {
  26497. upper = lower;
  26498. lower = undefined;
  26499. }
  26500. if (upper !== undefined) {
  26501. upper = toNumber(upper);
  26502. upper = upper === upper ? upper : 0;
  26503. }
  26504. if (lower !== undefined) {
  26505. lower = toNumber(lower);
  26506. lower = lower === lower ? lower : 0;
  26507. }
  26508. return baseClamp(toNumber(number), lower, upper);
  26509. }
  26510. /**
  26511. * Checks if `n` is between `start` and up to, but not including, `end`. If
  26512. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  26513. * If `start` is greater than `end` the params are swapped to support
  26514. * negative ranges.
  26515. *
  26516. * @static
  26517. * @memberOf _
  26518. * @since 3.3.0
  26519. * @category Number
  26520. * @param {number} number The number to check.
  26521. * @param {number} [start=0] The start of the range.
  26522. * @param {number} end The end of the range.
  26523. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  26524. * @see _.range, _.rangeRight
  26525. * @example
  26526. *
  26527. * _.inRange(3, 2, 4);
  26528. * // => true
  26529. *
  26530. * _.inRange(4, 8);
  26531. * // => true
  26532. *
  26533. * _.inRange(4, 2);
  26534. * // => false
  26535. *
  26536. * _.inRange(2, 2);
  26537. * // => false
  26538. *
  26539. * _.inRange(1.2, 2);
  26540. * // => true
  26541. *
  26542. * _.inRange(5.2, 4);
  26543. * // => false
  26544. *
  26545. * _.inRange(-3, -2, -6);
  26546. * // => true
  26547. */
  26548. function inRange(number, start, end) {
  26549. start = toFinite(start);
  26550. if (end === undefined) {
  26551. end = start;
  26552. start = 0;
  26553. } else {
  26554. end = toFinite(end);
  26555. }
  26556. number = toNumber(number);
  26557. return baseInRange(number, start, end);
  26558. }
  26559. /**
  26560. * Produces a random number between the inclusive `lower` and `upper` bounds.
  26561. * If only one argument is provided a number between `0` and the given number
  26562. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  26563. * floats, a floating-point number is returned instead of an integer.
  26564. *
  26565. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  26566. * floating-point values which can produce unexpected results.
  26567. *
  26568. * @static
  26569. * @memberOf _
  26570. * @since 0.7.0
  26571. * @category Number
  26572. * @param {number} [lower=0] The lower bound.
  26573. * @param {number} [upper=1] The upper bound.
  26574. * @param {boolean} [floating] Specify returning a floating-point number.
  26575. * @returns {number} Returns the random number.
  26576. * @example
  26577. *
  26578. * _.random(0, 5);
  26579. * // => an integer between 0 and 5
  26580. *
  26581. * _.random(5);
  26582. * // => also an integer between 0 and 5
  26583. *
  26584. * _.random(5, true);
  26585. * // => a floating-point number between 0 and 5
  26586. *
  26587. * _.random(1.2, 5.2);
  26588. * // => a floating-point number between 1.2 and 5.2
  26589. */
  26590. function random(lower, upper, floating) {
  26591. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  26592. upper = floating = undefined;
  26593. }
  26594. if (floating === undefined) {
  26595. if (typeof upper == 'boolean') {
  26596. floating = upper;
  26597. upper = undefined;
  26598. }
  26599. else if (typeof lower == 'boolean') {
  26600. floating = lower;
  26601. lower = undefined;
  26602. }
  26603. }
  26604. if (lower === undefined && upper === undefined) {
  26605. lower = 0;
  26606. upper = 1;
  26607. }
  26608. else {
  26609. lower = toFinite(lower);
  26610. if (upper === undefined) {
  26611. upper = lower;
  26612. lower = 0;
  26613. } else {
  26614. upper = toFinite(upper);
  26615. }
  26616. }
  26617. if (lower > upper) {
  26618. var temp = lower;
  26619. lower = upper;
  26620. upper = temp;
  26621. }
  26622. if (floating || lower % 1 || upper % 1) {
  26623. var rand = nativeRandom();
  26624. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  26625. }
  26626. return baseRandom(lower, upper);
  26627. }
  26628. /*------------------------------------------------------------------------*/
  26629. /**
  26630. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  26631. *
  26632. * @static
  26633. * @memberOf _
  26634. * @since 3.0.0
  26635. * @category String
  26636. * @param {string} [string=''] The string to convert.
  26637. * @returns {string} Returns the camel cased string.
  26638. * @example
  26639. *
  26640. * _.camelCase('Foo Bar');
  26641. * // => 'fooBar'
  26642. *
  26643. * _.camelCase('--foo-bar--');
  26644. * // => 'fooBar'
  26645. *
  26646. * _.camelCase('__FOO_BAR__');
  26647. * // => 'fooBar'
  26648. */
  26649. var camelCase = createCompounder(function(result, word, index) {
  26650. word = word.toLowerCase();
  26651. return result + (index ? capitalize(word) : word);
  26652. });
  26653. /**
  26654. * Converts the first character of `string` to upper case and the remaining
  26655. * to lower case.
  26656. *
  26657. * @static
  26658. * @memberOf _
  26659. * @since 3.0.0
  26660. * @category String
  26661. * @param {string} [string=''] The string to capitalize.
  26662. * @returns {string} Returns the capitalized string.
  26663. * @example
  26664. *
  26665. * _.capitalize('FRED');
  26666. * // => 'Fred'
  26667. */
  26668. function capitalize(string) {
  26669. return upperFirst(toString(string).toLowerCase());
  26670. }
  26671. /**
  26672. * Deburrs `string` by converting
  26673. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  26674. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  26675. * letters to basic Latin letters and removing
  26676. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  26677. *
  26678. * @static
  26679. * @memberOf _
  26680. * @since 3.0.0
  26681. * @category String
  26682. * @param {string} [string=''] The string to deburr.
  26683. * @returns {string} Returns the deburred string.
  26684. * @example
  26685. *
  26686. * _.deburr('déjà vu');
  26687. * // => 'deja vu'
  26688. */
  26689. function deburr(string) {
  26690. string = toString(string);
  26691. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  26692. }
  26693. /**
  26694. * Checks if `string` ends with the given target string.
  26695. *
  26696. * @static
  26697. * @memberOf _
  26698. * @since 3.0.0
  26699. * @category String
  26700. * @param {string} [string=''] The string to inspect.
  26701. * @param {string} [target] The string to search for.
  26702. * @param {number} [position=string.length] The position to search up to.
  26703. * @returns {boolean} Returns `true` if `string` ends with `target`,
  26704. * else `false`.
  26705. * @example
  26706. *
  26707. * _.endsWith('abc', 'c');
  26708. * // => true
  26709. *
  26710. * _.endsWith('abc', 'b');
  26711. * // => false
  26712. *
  26713. * _.endsWith('abc', 'b', 2);
  26714. * // => true
  26715. */
  26716. function endsWith(string, target, position) {
  26717. string = toString(string);
  26718. target = baseToString(target);
  26719. var length = string.length;
  26720. position = position === undefined
  26721. ? length
  26722. : baseClamp(toInteger(position), 0, length);
  26723. var end = position;
  26724. position -= target.length;
  26725. return position >= 0 && string.slice(position, end) == target;
  26726. }
  26727. /**
  26728. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  26729. * corresponding HTML entities.
  26730. *
  26731. * **Note:** No other characters are escaped. To escape additional
  26732. * characters use a third-party library like [_he_](https://mths.be/he).
  26733. *
  26734. * Though the ">" character is escaped for symmetry, characters like
  26735. * ">" and "/" don't need escaping in HTML and have no special meaning
  26736. * unless they're part of a tag or unquoted attribute value. See
  26737. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  26738. * (under "semi-related fun fact") for more details.
  26739. *
  26740. * When working with HTML you should always
  26741. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  26742. * XSS vectors.
  26743. *
  26744. * @static
  26745. * @since 0.1.0
  26746. * @memberOf _
  26747. * @category String
  26748. * @param {string} [string=''] The string to escape.
  26749. * @returns {string} Returns the escaped string.
  26750. * @example
  26751. *
  26752. * _.escape('fred, barney, & pebbles');
  26753. * // => 'fred, barney, &amp; pebbles'
  26754. */
  26755. function escape(string) {
  26756. string = toString(string);
  26757. return (string && reHasUnescapedHtml.test(string))
  26758. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  26759. : string;
  26760. }
  26761. /**
  26762. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  26763. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  26764. *
  26765. * @static
  26766. * @memberOf _
  26767. * @since 3.0.0
  26768. * @category String
  26769. * @param {string} [string=''] The string to escape.
  26770. * @returns {string} Returns the escaped string.
  26771. * @example
  26772. *
  26773. * _.escapeRegExp('[lodash](https://lodash.com/)');
  26774. * // => '\[lodash\]\(https://lodash\.com/\)'
  26775. */
  26776. function escapeRegExp(string) {
  26777. string = toString(string);
  26778. return (string && reHasRegExpChar.test(string))
  26779. ? string.replace(reRegExpChar, '\\$&')
  26780. : string;
  26781. }
  26782. /**
  26783. * Converts `string` to
  26784. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  26785. *
  26786. * @static
  26787. * @memberOf _
  26788. * @since 3.0.0
  26789. * @category String
  26790. * @param {string} [string=''] The string to convert.
  26791. * @returns {string} Returns the kebab cased string.
  26792. * @example
  26793. *
  26794. * _.kebabCase('Foo Bar');
  26795. * // => 'foo-bar'
  26796. *
  26797. * _.kebabCase('fooBar');
  26798. * // => 'foo-bar'
  26799. *
  26800. * _.kebabCase('__FOO_BAR__');
  26801. * // => 'foo-bar'
  26802. */
  26803. var kebabCase = createCompounder(function(result, word, index) {
  26804. return result + (index ? '-' : '') + word.toLowerCase();
  26805. });
  26806. /**
  26807. * Converts `string`, as space separated words, to lower case.
  26808. *
  26809. * @static
  26810. * @memberOf _
  26811. * @since 4.0.0
  26812. * @category String
  26813. * @param {string} [string=''] The string to convert.
  26814. * @returns {string} Returns the lower cased string.
  26815. * @example
  26816. *
  26817. * _.lowerCase('--Foo-Bar--');
  26818. * // => 'foo bar'
  26819. *
  26820. * _.lowerCase('fooBar');
  26821. * // => 'foo bar'
  26822. *
  26823. * _.lowerCase('__FOO_BAR__');
  26824. * // => 'foo bar'
  26825. */
  26826. var lowerCase = createCompounder(function(result, word, index) {
  26827. return result + (index ? ' ' : '') + word.toLowerCase();
  26828. });
  26829. /**
  26830. * Converts the first character of `string` to lower case.
  26831. *
  26832. * @static
  26833. * @memberOf _
  26834. * @since 4.0.0
  26835. * @category String
  26836. * @param {string} [string=''] The string to convert.
  26837. * @returns {string} Returns the converted string.
  26838. * @example
  26839. *
  26840. * _.lowerFirst('Fred');
  26841. * // => 'fred'
  26842. *
  26843. * _.lowerFirst('FRED');
  26844. * // => 'fRED'
  26845. */
  26846. var lowerFirst = createCaseFirst('toLowerCase');
  26847. /**
  26848. * Pads `string` on the left and right sides if it's shorter than `length`.
  26849. * Padding characters are truncated if they can't be evenly divided by `length`.
  26850. *
  26851. * @static
  26852. * @memberOf _
  26853. * @since 3.0.0
  26854. * @category String
  26855. * @param {string} [string=''] The string to pad.
  26856. * @param {number} [length=0] The padding length.
  26857. * @param {string} [chars=' '] The string used as padding.
  26858. * @returns {string} Returns the padded string.
  26859. * @example
  26860. *
  26861. * _.pad('abc', 8);
  26862. * // => ' abc '
  26863. *
  26864. * _.pad('abc', 8, '_-');
  26865. * // => '_-abc_-_'
  26866. *
  26867. * _.pad('abc', 3);
  26868. * // => 'abc'
  26869. */
  26870. function pad(string, length, chars) {
  26871. string = toString(string);
  26872. length = toInteger(length);
  26873. var strLength = length ? stringSize(string) : 0;
  26874. if (!length || strLength >= length) {
  26875. return string;
  26876. }
  26877. var mid = (length - strLength) / 2;
  26878. return (
  26879. createPadding(nativeFloor(mid), chars) +
  26880. string +
  26881. createPadding(nativeCeil(mid), chars)
  26882. );
  26883. }
  26884. /**
  26885. * Pads `string` on the right side if it's shorter than `length`. Padding
  26886. * characters are truncated if they exceed `length`.
  26887. *
  26888. * @static
  26889. * @memberOf _
  26890. * @since 4.0.0
  26891. * @category String
  26892. * @param {string} [string=''] The string to pad.
  26893. * @param {number} [length=0] The padding length.
  26894. * @param {string} [chars=' '] The string used as padding.
  26895. * @returns {string} Returns the padded string.
  26896. * @example
  26897. *
  26898. * _.padEnd('abc', 6);
  26899. * // => 'abc '
  26900. *
  26901. * _.padEnd('abc', 6, '_-');
  26902. * // => 'abc_-_'
  26903. *
  26904. * _.padEnd('abc', 3);
  26905. * // => 'abc'
  26906. */
  26907. function padEnd(string, length, chars) {
  26908. string = toString(string);
  26909. length = toInteger(length);
  26910. var strLength = length ? stringSize(string) : 0;
  26911. return (length && strLength < length)
  26912. ? (string + createPadding(length - strLength, chars))
  26913. : string;
  26914. }
  26915. /**
  26916. * Pads `string` on the left side if it's shorter than `length`. Padding
  26917. * characters are truncated if they exceed `length`.
  26918. *
  26919. * @static
  26920. * @memberOf _
  26921. * @since 4.0.0
  26922. * @category String
  26923. * @param {string} [string=''] The string to pad.
  26924. * @param {number} [length=0] The padding length.
  26925. * @param {string} [chars=' '] The string used as padding.
  26926. * @returns {string} Returns the padded string.
  26927. * @example
  26928. *
  26929. * _.padStart('abc', 6);
  26930. * // => ' abc'
  26931. *
  26932. * _.padStart('abc', 6, '_-');
  26933. * // => '_-_abc'
  26934. *
  26935. * _.padStart('abc', 3);
  26936. * // => 'abc'
  26937. */
  26938. function padStart(string, length, chars) {
  26939. string = toString(string);
  26940. length = toInteger(length);
  26941. var strLength = length ? stringSize(string) : 0;
  26942. return (length && strLength < length)
  26943. ? (createPadding(length - strLength, chars) + string)
  26944. : string;
  26945. }
  26946. /**
  26947. * Converts `string` to an integer of the specified radix. If `radix` is
  26948. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  26949. * hexadecimal, in which case a `radix` of `16` is used.
  26950. *
  26951. * **Note:** This method aligns with the
  26952. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  26953. *
  26954. * @static
  26955. * @memberOf _
  26956. * @since 1.1.0
  26957. * @category String
  26958. * @param {string} string The string to convert.
  26959. * @param {number} [radix=10] The radix to interpret `value` by.
  26960. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26961. * @returns {number} Returns the converted integer.
  26962. * @example
  26963. *
  26964. * _.parseInt('08');
  26965. * // => 8
  26966. *
  26967. * _.map(['6', '08', '10'], _.parseInt);
  26968. * // => [6, 8, 10]
  26969. */
  26970. function parseInt(string, radix, guard) {
  26971. if (guard || radix == null) {
  26972. radix = 0;
  26973. } else if (radix) {
  26974. radix = +radix;
  26975. }
  26976. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  26977. }
  26978. /**
  26979. * Repeats the given string `n` times.
  26980. *
  26981. * @static
  26982. * @memberOf _
  26983. * @since 3.0.0
  26984. * @category String
  26985. * @param {string} [string=''] The string to repeat.
  26986. * @param {number} [n=1] The number of times to repeat the string.
  26987. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26988. * @returns {string} Returns the repeated string.
  26989. * @example
  26990. *
  26991. * _.repeat('*', 3);
  26992. * // => '***'
  26993. *
  26994. * _.repeat('abc', 2);
  26995. * // => 'abcabc'
  26996. *
  26997. * _.repeat('abc', 0);
  26998. * // => ''
  26999. */
  27000. function repeat(string, n, guard) {
  27001. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  27002. n = 1;
  27003. } else {
  27004. n = toInteger(n);
  27005. }
  27006. return baseRepeat(toString(string), n);
  27007. }
  27008. /**
  27009. * Replaces matches for `pattern` in `string` with `replacement`.
  27010. *
  27011. * **Note:** This method is based on
  27012. * [`String#replace`](https://mdn.io/String/replace).
  27013. *
  27014. * @static
  27015. * @memberOf _
  27016. * @since 4.0.0
  27017. * @category String
  27018. * @param {string} [string=''] The string to modify.
  27019. * @param {RegExp|string} pattern The pattern to replace.
  27020. * @param {Function|string} replacement The match replacement.
  27021. * @returns {string} Returns the modified string.
  27022. * @example
  27023. *
  27024. * _.replace('Hi Fred', 'Fred', 'Barney');
  27025. * // => 'Hi Barney'
  27026. */
  27027. function replace() {
  27028. var args = arguments,
  27029. string = toString(args[0]);
  27030. return args.length < 3 ? string : string.replace(args[1], args[2]);
  27031. }
  27032. /**
  27033. * Converts `string` to
  27034. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  27035. *
  27036. * @static
  27037. * @memberOf _
  27038. * @since 3.0.0
  27039. * @category String
  27040. * @param {string} [string=''] The string to convert.
  27041. * @returns {string} Returns the snake cased string.
  27042. * @example
  27043. *
  27044. * _.snakeCase('Foo Bar');
  27045. * // => 'foo_bar'
  27046. *
  27047. * _.snakeCase('fooBar');
  27048. * // => 'foo_bar'
  27049. *
  27050. * _.snakeCase('--FOO-BAR--');
  27051. * // => 'foo_bar'
  27052. */
  27053. var snakeCase = createCompounder(function(result, word, index) {
  27054. return result + (index ? '_' : '') + word.toLowerCase();
  27055. });
  27056. /**
  27057. * Splits `string` by `separator`.
  27058. *
  27059. * **Note:** This method is based on
  27060. * [`String#split`](https://mdn.io/String/split).
  27061. *
  27062. * @static
  27063. * @memberOf _
  27064. * @since 4.0.0
  27065. * @category String
  27066. * @param {string} [string=''] The string to split.
  27067. * @param {RegExp|string} separator The separator pattern to split by.
  27068. * @param {number} [limit] The length to truncate results to.
  27069. * @returns {Array} Returns the string segments.
  27070. * @example
  27071. *
  27072. * _.split('a-b-c', '-', 2);
  27073. * // => ['a', 'b']
  27074. */
  27075. function split(string, separator, limit) {
  27076. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  27077. separator = limit = undefined;
  27078. }
  27079. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  27080. if (!limit) {
  27081. return [];
  27082. }
  27083. string = toString(string);
  27084. if (string && (
  27085. typeof separator == 'string' ||
  27086. (separator != null && !isRegExp(separator))
  27087. )) {
  27088. separator = baseToString(separator);
  27089. if (!separator && hasUnicode(string)) {
  27090. return castSlice(stringToArray(string), 0, limit);
  27091. }
  27092. }
  27093. return string.split(separator, limit);
  27094. }
  27095. /**
  27096. * Converts `string` to
  27097. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  27098. *
  27099. * @static
  27100. * @memberOf _
  27101. * @since 3.1.0
  27102. * @category String
  27103. * @param {string} [string=''] The string to convert.
  27104. * @returns {string} Returns the start cased string.
  27105. * @example
  27106. *
  27107. * _.startCase('--foo-bar--');
  27108. * // => 'Foo Bar'
  27109. *
  27110. * _.startCase('fooBar');
  27111. * // => 'Foo Bar'
  27112. *
  27113. * _.startCase('__FOO_BAR__');
  27114. * // => 'FOO BAR'
  27115. */
  27116. var startCase = createCompounder(function(result, word, index) {
  27117. return result + (index ? ' ' : '') + upperFirst(word);
  27118. });
  27119. /**
  27120. * Checks if `string` starts with the given target string.
  27121. *
  27122. * @static
  27123. * @memberOf _
  27124. * @since 3.0.0
  27125. * @category String
  27126. * @param {string} [string=''] The string to inspect.
  27127. * @param {string} [target] The string to search for.
  27128. * @param {number} [position=0] The position to search from.
  27129. * @returns {boolean} Returns `true` if `string` starts with `target`,
  27130. * else `false`.
  27131. * @example
  27132. *
  27133. * _.startsWith('abc', 'a');
  27134. * // => true
  27135. *
  27136. * _.startsWith('abc', 'b');
  27137. * // => false
  27138. *
  27139. * _.startsWith('abc', 'b', 1);
  27140. * // => true
  27141. */
  27142. function startsWith(string, target, position) {
  27143. string = toString(string);
  27144. position = position == null
  27145. ? 0
  27146. : baseClamp(toInteger(position), 0, string.length);
  27147. target = baseToString(target);
  27148. return string.slice(position, position + target.length) == target;
  27149. }
  27150. /**
  27151. * Creates a compiled template function that can interpolate data properties
  27152. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  27153. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  27154. * properties may be accessed as free variables in the template. If a setting
  27155. * object is given, it takes precedence over `_.templateSettings` values.
  27156. *
  27157. * **Note:** In the development build `_.template` utilizes
  27158. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  27159. * for easier debugging.
  27160. *
  27161. * For more information on precompiling templates see
  27162. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  27163. *
  27164. * For more information on Chrome extension sandboxes see
  27165. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  27166. *
  27167. * @static
  27168. * @since 0.1.0
  27169. * @memberOf _
  27170. * @category String
  27171. * @param {string} [string=''] The template string.
  27172. * @param {Object} [options={}] The options object.
  27173. * @param {RegExp} [options.escape=_.templateSettings.escape]
  27174. * The HTML "escape" delimiter.
  27175. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  27176. * The "evaluate" delimiter.
  27177. * @param {Object} [options.imports=_.templateSettings.imports]
  27178. * An object to import into the template as free variables.
  27179. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  27180. * The "interpolate" delimiter.
  27181. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  27182. * The sourceURL of the compiled template.
  27183. * @param {string} [options.variable='obj']
  27184. * The data object variable name.
  27185. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27186. * @returns {Function} Returns the compiled template function.
  27187. * @example
  27188. *
  27189. * // Use the "interpolate" delimiter to create a compiled template.
  27190. * var compiled = _.template('hello <%= user %>!');
  27191. * compiled({ 'user': 'fred' });
  27192. * // => 'hello fred!'
  27193. *
  27194. * // Use the HTML "escape" delimiter to escape data property values.
  27195. * var compiled = _.template('<b><%- value %></b>');
  27196. * compiled({ 'value': '<script>' });
  27197. * // => '<b>&lt;script&gt;</b>'
  27198. *
  27199. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  27200. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  27201. * compiled({ 'users': ['fred', 'barney'] });
  27202. * // => '<li>fred</li><li>barney</li>'
  27203. *
  27204. * // Use the internal `print` function in "evaluate" delimiters.
  27205. * var compiled = _.template('<% print("hello " + user); %>!');
  27206. * compiled({ 'user': 'barney' });
  27207. * // => 'hello barney!'
  27208. *
  27209. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  27210. * // Disable support by replacing the "interpolate" delimiter.
  27211. * var compiled = _.template('hello ${ user }!');
  27212. * compiled({ 'user': 'pebbles' });
  27213. * // => 'hello pebbles!'
  27214. *
  27215. * // Use backslashes to treat delimiters as plain text.
  27216. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  27217. * compiled({ 'value': 'ignored' });
  27218. * // => '<%- value %>'
  27219. *
  27220. * // Use the `imports` option to import `jQuery` as `jq`.
  27221. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  27222. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  27223. * compiled({ 'users': ['fred', 'barney'] });
  27224. * // => '<li>fred</li><li>barney</li>'
  27225. *
  27226. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  27227. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  27228. * compiled(data);
  27229. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  27230. *
  27231. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  27232. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  27233. * compiled.source;
  27234. * // => function(data) {
  27235. * // var __t, __p = '';
  27236. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  27237. * // return __p;
  27238. * // }
  27239. *
  27240. * // Use custom template delimiters.
  27241. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  27242. * var compiled = _.template('hello {{ user }}!');
  27243. * compiled({ 'user': 'mustache' });
  27244. * // => 'hello mustache!'
  27245. *
  27246. * // Use the `source` property to inline compiled templates for meaningful
  27247. * // line numbers in error messages and stack traces.
  27248. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  27249. * var JST = {\
  27250. * "main": ' + _.template(mainText).source + '\
  27251. * };\
  27252. * ');
  27253. */
  27254. function template(string, options, guard) {
  27255. // Based on John Resig's `tmpl` implementation
  27256. // (http://ejohn.org/blog/javascript-micro-templating/)
  27257. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  27258. var settings = lodash.templateSettings;
  27259. if (guard && isIterateeCall(string, options, guard)) {
  27260. options = undefined;
  27261. }
  27262. string = toString(string);
  27263. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  27264. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  27265. importsKeys = keys(imports),
  27266. importsValues = baseValues(imports, importsKeys);
  27267. var isEscaping,
  27268. isEvaluating,
  27269. index = 0,
  27270. interpolate = options.interpolate || reNoMatch,
  27271. source = "__p += '";
  27272. // Compile the regexp to match each delimiter.
  27273. var reDelimiters = RegExp(
  27274. (options.escape || reNoMatch).source + '|' +
  27275. interpolate.source + '|' +
  27276. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  27277. (options.evaluate || reNoMatch).source + '|$'
  27278. , 'g');
  27279. // Use a sourceURL for easier debugging.
  27280. var sourceURL = '//# sourceURL=' +
  27281. ('sourceURL' in options
  27282. ? options.sourceURL
  27283. : ('lodash.templateSources[' + (++templateCounter) + ']')
  27284. ) + '\n';
  27285. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  27286. interpolateValue || (interpolateValue = esTemplateValue);
  27287. // Escape characters that can't be included in string literals.
  27288. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  27289. // Replace delimiters with snippets.
  27290. if (escapeValue) {
  27291. isEscaping = true;
  27292. source += "' +\n__e(" + escapeValue + ") +\n'";
  27293. }
  27294. if (evaluateValue) {
  27295. isEvaluating = true;
  27296. source += "';\n" + evaluateValue + ";\n__p += '";
  27297. }
  27298. if (interpolateValue) {
  27299. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  27300. }
  27301. index = offset + match.length;
  27302. // The JS engine embedded in Adobe products needs `match` returned in
  27303. // order to produce the correct `offset` value.
  27304. return match;
  27305. });
  27306. source += "';\n";
  27307. // If `variable` is not specified wrap a with-statement around the generated
  27308. // code to add the data object to the top of the scope chain.
  27309. var variable = options.variable;
  27310. if (!variable) {
  27311. source = 'with (obj) {\n' + source + '\n}\n';
  27312. }
  27313. // Cleanup code by stripping empty strings.
  27314. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  27315. .replace(reEmptyStringMiddle, '$1')
  27316. .replace(reEmptyStringTrailing, '$1;');
  27317. // Frame code as the function body.
  27318. source = 'function(' + (variable || 'obj') + ') {\n' +
  27319. (variable
  27320. ? ''
  27321. : 'obj || (obj = {});\n'
  27322. ) +
  27323. "var __t, __p = ''" +
  27324. (isEscaping
  27325. ? ', __e = _.escape'
  27326. : ''
  27327. ) +
  27328. (isEvaluating
  27329. ? ', __j = Array.prototype.join;\n' +
  27330. "function print() { __p += __j.call(arguments, '') }\n"
  27331. : ';\n'
  27332. ) +
  27333. source +
  27334. 'return __p\n}';
  27335. var result = attempt(function() {
  27336. return Function(importsKeys, sourceURL + 'return ' + source)
  27337. .apply(undefined, importsValues);
  27338. });
  27339. // Provide the compiled function's source by its `toString` method or
  27340. // the `source` property as a convenience for inlining compiled templates.
  27341. result.source = source;
  27342. if (isError(result)) {
  27343. throw result;
  27344. }
  27345. return result;
  27346. }
  27347. /**
  27348. * Converts `string`, as a whole, to lower case just like
  27349. * [String#toLowerCase](https://mdn.io/toLowerCase).
  27350. *
  27351. * @static
  27352. * @memberOf _
  27353. * @since 4.0.0
  27354. * @category String
  27355. * @param {string} [string=''] The string to convert.
  27356. * @returns {string} Returns the lower cased string.
  27357. * @example
  27358. *
  27359. * _.toLower('--Foo-Bar--');
  27360. * // => '--foo-bar--'
  27361. *
  27362. * _.toLower('fooBar');
  27363. * // => 'foobar'
  27364. *
  27365. * _.toLower('__FOO_BAR__');
  27366. * // => '__foo_bar__'
  27367. */
  27368. function toLower(value) {
  27369. return toString(value).toLowerCase();
  27370. }
  27371. /**
  27372. * Converts `string`, as a whole, to upper case just like
  27373. * [String#toUpperCase](https://mdn.io/toUpperCase).
  27374. *
  27375. * @static
  27376. * @memberOf _
  27377. * @since 4.0.0
  27378. * @category String
  27379. * @param {string} [string=''] The string to convert.
  27380. * @returns {string} Returns the upper cased string.
  27381. * @example
  27382. *
  27383. * _.toUpper('--foo-bar--');
  27384. * // => '--FOO-BAR--'
  27385. *
  27386. * _.toUpper('fooBar');
  27387. * // => 'FOOBAR'
  27388. *
  27389. * _.toUpper('__foo_bar__');
  27390. * // => '__FOO_BAR__'
  27391. */
  27392. function toUpper(value) {
  27393. return toString(value).toUpperCase();
  27394. }
  27395. /**
  27396. * Removes leading and trailing whitespace or specified characters from `string`.
  27397. *
  27398. * @static
  27399. * @memberOf _
  27400. * @since 3.0.0
  27401. * @category String
  27402. * @param {string} [string=''] The string to trim.
  27403. * @param {string} [chars=whitespace] The characters to trim.
  27404. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27405. * @returns {string} Returns the trimmed string.
  27406. * @example
  27407. *
  27408. * _.trim(' abc ');
  27409. * // => 'abc'
  27410. *
  27411. * _.trim('-_-abc-_-', '_-');
  27412. * // => 'abc'
  27413. *
  27414. * _.map([' foo ', ' bar '], _.trim);
  27415. * // => ['foo', 'bar']
  27416. */
  27417. function trim(string, chars, guard) {
  27418. string = toString(string);
  27419. if (string && (guard || chars === undefined)) {
  27420. return string.replace(reTrim, '');
  27421. }
  27422. if (!string || !(chars = baseToString(chars))) {
  27423. return string;
  27424. }
  27425. var strSymbols = stringToArray(string),
  27426. chrSymbols = stringToArray(chars),
  27427. start = charsStartIndex(strSymbols, chrSymbols),
  27428. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  27429. return castSlice(strSymbols, start, end).join('');
  27430. }
  27431. /**
  27432. * Removes trailing whitespace or specified characters from `string`.
  27433. *
  27434. * @static
  27435. * @memberOf _
  27436. * @since 4.0.0
  27437. * @category String
  27438. * @param {string} [string=''] The string to trim.
  27439. * @param {string} [chars=whitespace] The characters to trim.
  27440. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27441. * @returns {string} Returns the trimmed string.
  27442. * @example
  27443. *
  27444. * _.trimEnd(' abc ');
  27445. * // => ' abc'
  27446. *
  27447. * _.trimEnd('-_-abc-_-', '_-');
  27448. * // => '-_-abc'
  27449. */
  27450. function trimEnd(string, chars, guard) {
  27451. string = toString(string);
  27452. if (string && (guard || chars === undefined)) {
  27453. return string.replace(reTrimEnd, '');
  27454. }
  27455. if (!string || !(chars = baseToString(chars))) {
  27456. return string;
  27457. }
  27458. var strSymbols = stringToArray(string),
  27459. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  27460. return castSlice(strSymbols, 0, end).join('');
  27461. }
  27462. /**
  27463. * Removes leading whitespace or specified characters from `string`.
  27464. *
  27465. * @static
  27466. * @memberOf _
  27467. * @since 4.0.0
  27468. * @category String
  27469. * @param {string} [string=''] The string to trim.
  27470. * @param {string} [chars=whitespace] The characters to trim.
  27471. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27472. * @returns {string} Returns the trimmed string.
  27473. * @example
  27474. *
  27475. * _.trimStart(' abc ');
  27476. * // => 'abc '
  27477. *
  27478. * _.trimStart('-_-abc-_-', '_-');
  27479. * // => 'abc-_-'
  27480. */
  27481. function trimStart(string, chars, guard) {
  27482. string = toString(string);
  27483. if (string && (guard || chars === undefined)) {
  27484. return string.replace(reTrimStart, '');
  27485. }
  27486. if (!string || !(chars = baseToString(chars))) {
  27487. return string;
  27488. }
  27489. var strSymbols = stringToArray(string),
  27490. start = charsStartIndex(strSymbols, stringToArray(chars));
  27491. return castSlice(strSymbols, start).join('');
  27492. }
  27493. /**
  27494. * Truncates `string` if it's longer than the given maximum string length.
  27495. * The last characters of the truncated string are replaced with the omission
  27496. * string which defaults to "...".
  27497. *
  27498. * @static
  27499. * @memberOf _
  27500. * @since 4.0.0
  27501. * @category String
  27502. * @param {string} [string=''] The string to truncate.
  27503. * @param {Object} [options={}] The options object.
  27504. * @param {number} [options.length=30] The maximum string length.
  27505. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  27506. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  27507. * @returns {string} Returns the truncated string.
  27508. * @example
  27509. *
  27510. * _.truncate('hi-diddly-ho there, neighborino');
  27511. * // => 'hi-diddly-ho there, neighbo...'
  27512. *
  27513. * _.truncate('hi-diddly-ho there, neighborino', {
  27514. * 'length': 24,
  27515. * 'separator': ' '
  27516. * });
  27517. * // => 'hi-diddly-ho there,...'
  27518. *
  27519. * _.truncate('hi-diddly-ho there, neighborino', {
  27520. * 'length': 24,
  27521. * 'separator': /,? +/
  27522. * });
  27523. * // => 'hi-diddly-ho there...'
  27524. *
  27525. * _.truncate('hi-diddly-ho there, neighborino', {
  27526. * 'omission': ' [...]'
  27527. * });
  27528. * // => 'hi-diddly-ho there, neig [...]'
  27529. */
  27530. function truncate(string, options) {
  27531. var length = DEFAULT_TRUNC_LENGTH,
  27532. omission = DEFAULT_TRUNC_OMISSION;
  27533. if (isObject(options)) {
  27534. var separator = 'separator' in options ? options.separator : separator;
  27535. length = 'length' in options ? toInteger(options.length) : length;
  27536. omission = 'omission' in options ? baseToString(options.omission) : omission;
  27537. }
  27538. string = toString(string);
  27539. var strLength = string.length;
  27540. if (hasUnicode(string)) {
  27541. var strSymbols = stringToArray(string);
  27542. strLength = strSymbols.length;
  27543. }
  27544. if (length >= strLength) {
  27545. return string;
  27546. }
  27547. var end = length - stringSize(omission);
  27548. if (end < 1) {
  27549. return omission;
  27550. }
  27551. var result = strSymbols
  27552. ? castSlice(strSymbols, 0, end).join('')
  27553. : string.slice(0, end);
  27554. if (separator === undefined) {
  27555. return result + omission;
  27556. }
  27557. if (strSymbols) {
  27558. end += (result.length - end);
  27559. }
  27560. if (isRegExp(separator)) {
  27561. if (string.slice(end).search(separator)) {
  27562. var match,
  27563. substring = result;
  27564. if (!separator.global) {
  27565. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  27566. }
  27567. separator.lastIndex = 0;
  27568. while ((match = separator.exec(substring))) {
  27569. var newEnd = match.index;
  27570. }
  27571. result = result.slice(0, newEnd === undefined ? end : newEnd);
  27572. }
  27573. } else if (string.indexOf(baseToString(separator), end) != end) {
  27574. var index = result.lastIndexOf(separator);
  27575. if (index > -1) {
  27576. result = result.slice(0, index);
  27577. }
  27578. }
  27579. return result + omission;
  27580. }
  27581. /**
  27582. * The inverse of `_.escape`; this method converts the HTML entities
  27583. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  27584. * their corresponding characters.
  27585. *
  27586. * **Note:** No other HTML entities are unescaped. To unescape additional
  27587. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  27588. *
  27589. * @static
  27590. * @memberOf _
  27591. * @since 0.6.0
  27592. * @category String
  27593. * @param {string} [string=''] The string to unescape.
  27594. * @returns {string} Returns the unescaped string.
  27595. * @example
  27596. *
  27597. * _.unescape('fred, barney, &amp; pebbles');
  27598. * // => 'fred, barney, & pebbles'
  27599. */
  27600. function unescape(string) {
  27601. string = toString(string);
  27602. return (string && reHasEscapedHtml.test(string))
  27603. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  27604. : string;
  27605. }
  27606. /**
  27607. * Converts `string`, as space separated words, to upper case.
  27608. *
  27609. * @static
  27610. * @memberOf _
  27611. * @since 4.0.0
  27612. * @category String
  27613. * @param {string} [string=''] The string to convert.
  27614. * @returns {string} Returns the upper cased string.
  27615. * @example
  27616. *
  27617. * _.upperCase('--foo-bar');
  27618. * // => 'FOO BAR'
  27619. *
  27620. * _.upperCase('fooBar');
  27621. * // => 'FOO BAR'
  27622. *
  27623. * _.upperCase('__foo_bar__');
  27624. * // => 'FOO BAR'
  27625. */
  27626. var upperCase = createCompounder(function(result, word, index) {
  27627. return result + (index ? ' ' : '') + word.toUpperCase();
  27628. });
  27629. /**
  27630. * Converts the first character of `string` to upper case.
  27631. *
  27632. * @static
  27633. * @memberOf _
  27634. * @since 4.0.0
  27635. * @category String
  27636. * @param {string} [string=''] The string to convert.
  27637. * @returns {string} Returns the converted string.
  27638. * @example
  27639. *
  27640. * _.upperFirst('fred');
  27641. * // => 'Fred'
  27642. *
  27643. * _.upperFirst('FRED');
  27644. * // => 'FRED'
  27645. */
  27646. var upperFirst = createCaseFirst('toUpperCase');
  27647. /**
  27648. * Splits `string` into an array of its words.
  27649. *
  27650. * @static
  27651. * @memberOf _
  27652. * @since 3.0.0
  27653. * @category String
  27654. * @param {string} [string=''] The string to inspect.
  27655. * @param {RegExp|string} [pattern] The pattern to match words.
  27656. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27657. * @returns {Array} Returns the words of `string`.
  27658. * @example
  27659. *
  27660. * _.words('fred, barney, & pebbles');
  27661. * // => ['fred', 'barney', 'pebbles']
  27662. *
  27663. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  27664. * // => ['fred', 'barney', '&', 'pebbles']
  27665. */
  27666. function words(string, pattern, guard) {
  27667. string = toString(string);
  27668. pattern = guard ? undefined : pattern;
  27669. if (pattern === undefined) {
  27670. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  27671. }
  27672. return string.match(pattern) || [];
  27673. }
  27674. /*------------------------------------------------------------------------*/
  27675. /**
  27676. * Attempts to invoke `func`, returning either the result or the caught error
  27677. * object. Any additional arguments are provided to `func` when it's invoked.
  27678. *
  27679. * @static
  27680. * @memberOf _
  27681. * @since 3.0.0
  27682. * @category Util
  27683. * @param {Function} func The function to attempt.
  27684. * @param {...*} [args] The arguments to invoke `func` with.
  27685. * @returns {*} Returns the `func` result or error object.
  27686. * @example
  27687. *
  27688. * // Avoid throwing errors for invalid selectors.
  27689. * var elements = _.attempt(function(selector) {
  27690. * return document.querySelectorAll(selector);
  27691. * }, '>_>');
  27692. *
  27693. * if (_.isError(elements)) {
  27694. * elements = [];
  27695. * }
  27696. */
  27697. var attempt = baseRest(function(func, args) {
  27698. try {
  27699. return apply(func, undefined, args);
  27700. } catch (e) {
  27701. return isError(e) ? e : new Error(e);
  27702. }
  27703. });
  27704. /**
  27705. * Binds methods of an object to the object itself, overwriting the existing
  27706. * method.
  27707. *
  27708. * **Note:** This method doesn't set the "length" property of bound functions.
  27709. *
  27710. * @static
  27711. * @since 0.1.0
  27712. * @memberOf _
  27713. * @category Util
  27714. * @param {Object} object The object to bind and assign the bound methods to.
  27715. * @param {...(string|string[])} methodNames The object method names to bind.
  27716. * @returns {Object} Returns `object`.
  27717. * @example
  27718. *
  27719. * var view = {
  27720. * 'label': 'docs',
  27721. * 'click': function() {
  27722. * console.log('clicked ' + this.label);
  27723. * }
  27724. * };
  27725. *
  27726. * _.bindAll(view, ['click']);
  27727. * jQuery(element).on('click', view.click);
  27728. * // => Logs 'clicked docs' when clicked.
  27729. */
  27730. var bindAll = flatRest(function(object, methodNames) {
  27731. arrayEach(methodNames, function(key) {
  27732. key = toKey(key);
  27733. baseAssignValue(object, key, bind(object[key], object));
  27734. });
  27735. return object;
  27736. });
  27737. /**
  27738. * Creates a function that iterates over `pairs` and invokes the corresponding
  27739. * function of the first predicate to return truthy. The predicate-function
  27740. * pairs are invoked with the `this` binding and arguments of the created
  27741. * function.
  27742. *
  27743. * @static
  27744. * @memberOf _
  27745. * @since 4.0.0
  27746. * @category Util
  27747. * @param {Array} pairs The predicate-function pairs.
  27748. * @returns {Function} Returns the new composite function.
  27749. * @example
  27750. *
  27751. * var func = _.cond([
  27752. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  27753. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  27754. * [_.stubTrue, _.constant('no match')]
  27755. * ]);
  27756. *
  27757. * func({ 'a': 1, 'b': 2 });
  27758. * // => 'matches A'
  27759. *
  27760. * func({ 'a': 0, 'b': 1 });
  27761. * // => 'matches B'
  27762. *
  27763. * func({ 'a': '1', 'b': '2' });
  27764. * // => 'no match'
  27765. */
  27766. function cond(pairs) {
  27767. var length = pairs == null ? 0 : pairs.length,
  27768. toIteratee = getIteratee();
  27769. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  27770. if (typeof pair[1] != 'function') {
  27771. throw new TypeError(FUNC_ERROR_TEXT);
  27772. }
  27773. return [toIteratee(pair[0]), pair[1]];
  27774. });
  27775. return baseRest(function(args) {
  27776. var index = -1;
  27777. while (++index < length) {
  27778. var pair = pairs[index];
  27779. if (apply(pair[0], this, args)) {
  27780. return apply(pair[1], this, args);
  27781. }
  27782. }
  27783. });
  27784. }
  27785. /**
  27786. * Creates a function that invokes the predicate properties of `source` with
  27787. * the corresponding property values of a given object, returning `true` if
  27788. * all predicates return truthy, else `false`.
  27789. *
  27790. * **Note:** The created function is equivalent to `_.conformsTo` with
  27791. * `source` partially applied.
  27792. *
  27793. * @static
  27794. * @memberOf _
  27795. * @since 4.0.0
  27796. * @category Util
  27797. * @param {Object} source The object of property predicates to conform to.
  27798. * @returns {Function} Returns the new spec function.
  27799. * @example
  27800. *
  27801. * var objects = [
  27802. * { 'a': 2, 'b': 1 },
  27803. * { 'a': 1, 'b': 2 }
  27804. * ];
  27805. *
  27806. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  27807. * // => [{ 'a': 1, 'b': 2 }]
  27808. */
  27809. function conforms(source) {
  27810. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  27811. }
  27812. /**
  27813. * Creates a function that returns `value`.
  27814. *
  27815. * @static
  27816. * @memberOf _
  27817. * @since 2.4.0
  27818. * @category Util
  27819. * @param {*} value The value to return from the new function.
  27820. * @returns {Function} Returns the new constant function.
  27821. * @example
  27822. *
  27823. * var objects = _.times(2, _.constant({ 'a': 1 }));
  27824. *
  27825. * console.log(objects);
  27826. * // => [{ 'a': 1 }, { 'a': 1 }]
  27827. *
  27828. * console.log(objects[0] === objects[1]);
  27829. * // => true
  27830. */
  27831. function constant(value) {
  27832. return function() {
  27833. return value;
  27834. };
  27835. }
  27836. /**
  27837. * Checks `value` to determine whether a default value should be returned in
  27838. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  27839. * or `undefined`.
  27840. *
  27841. * @static
  27842. * @memberOf _
  27843. * @since 4.14.0
  27844. * @category Util
  27845. * @param {*} value The value to check.
  27846. * @param {*} defaultValue The default value.
  27847. * @returns {*} Returns the resolved value.
  27848. * @example
  27849. *
  27850. * _.defaultTo(1, 10);
  27851. * // => 1
  27852. *
  27853. * _.defaultTo(undefined, 10);
  27854. * // => 10
  27855. */
  27856. function defaultTo(value, defaultValue) {
  27857. return (value == null || value !== value) ? defaultValue : value;
  27858. }
  27859. /**
  27860. * Creates a function that returns the result of invoking the given functions
  27861. * with the `this` binding of the created function, where each successive
  27862. * invocation is supplied the return value of the previous.
  27863. *
  27864. * @static
  27865. * @memberOf _
  27866. * @since 3.0.0
  27867. * @category Util
  27868. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  27869. * @returns {Function} Returns the new composite function.
  27870. * @see _.flowRight
  27871. * @example
  27872. *
  27873. * function square(n) {
  27874. * return n * n;
  27875. * }
  27876. *
  27877. * var addSquare = _.flow([_.add, square]);
  27878. * addSquare(1, 2);
  27879. * // => 9
  27880. */
  27881. var flow = createFlow();
  27882. /**
  27883. * This method is like `_.flow` except that it creates a function that
  27884. * invokes the given functions from right to left.
  27885. *
  27886. * @static
  27887. * @since 3.0.0
  27888. * @memberOf _
  27889. * @category Util
  27890. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  27891. * @returns {Function} Returns the new composite function.
  27892. * @see _.flow
  27893. * @example
  27894. *
  27895. * function square(n) {
  27896. * return n * n;
  27897. * }
  27898. *
  27899. * var addSquare = _.flowRight([square, _.add]);
  27900. * addSquare(1, 2);
  27901. * // => 9
  27902. */
  27903. var flowRight = createFlow(true);
  27904. /**
  27905. * This method returns the first argument it receives.
  27906. *
  27907. * @static
  27908. * @since 0.1.0
  27909. * @memberOf _
  27910. * @category Util
  27911. * @param {*} value Any value.
  27912. * @returns {*} Returns `value`.
  27913. * @example
  27914. *
  27915. * var object = { 'a': 1 };
  27916. *
  27917. * console.log(_.identity(object) === object);
  27918. * // => true
  27919. */
  27920. function identity(value) {
  27921. return value;
  27922. }
  27923. /**
  27924. * Creates a function that invokes `func` with the arguments of the created
  27925. * function. If `func` is a property name, the created function returns the
  27926. * property value for a given element. If `func` is an array or object, the
  27927. * created function returns `true` for elements that contain the equivalent
  27928. * source properties, otherwise it returns `false`.
  27929. *
  27930. * @static
  27931. * @since 4.0.0
  27932. * @memberOf _
  27933. * @category Util
  27934. * @param {*} [func=_.identity] The value to convert to a callback.
  27935. * @returns {Function} Returns the callback.
  27936. * @example
  27937. *
  27938. * var users = [
  27939. * { 'user': 'barney', 'age': 36, 'active': true },
  27940. * { 'user': 'fred', 'age': 40, 'active': false }
  27941. * ];
  27942. *
  27943. * // The `_.matches` iteratee shorthand.
  27944. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  27945. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  27946. *
  27947. * // The `_.matchesProperty` iteratee shorthand.
  27948. * _.filter(users, _.iteratee(['user', 'fred']));
  27949. * // => [{ 'user': 'fred', 'age': 40 }]
  27950. *
  27951. * // The `_.property` iteratee shorthand.
  27952. * _.map(users, _.iteratee('user'));
  27953. * // => ['barney', 'fred']
  27954. *
  27955. * // Create custom iteratee shorthands.
  27956. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  27957. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  27958. * return func.test(string);
  27959. * };
  27960. * });
  27961. *
  27962. * _.filter(['abc', 'def'], /ef/);
  27963. * // => ['def']
  27964. */
  27965. function iteratee(func) {
  27966. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  27967. }
  27968. /**
  27969. * Creates a function that performs a partial deep comparison between a given
  27970. * object and `source`, returning `true` if the given object has equivalent
  27971. * property values, else `false`.
  27972. *
  27973. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  27974. * partially applied.
  27975. *
  27976. * Partial comparisons will match empty array and empty object `source`
  27977. * values against any array or object value, respectively. See `_.isEqual`
  27978. * for a list of supported value comparisons.
  27979. *
  27980. * @static
  27981. * @memberOf _
  27982. * @since 3.0.0
  27983. * @category Util
  27984. * @param {Object} source The object of property values to match.
  27985. * @returns {Function} Returns the new spec function.
  27986. * @example
  27987. *
  27988. * var objects = [
  27989. * { 'a': 1, 'b': 2, 'c': 3 },
  27990. * { 'a': 4, 'b': 5, 'c': 6 }
  27991. * ];
  27992. *
  27993. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  27994. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  27995. */
  27996. function matches(source) {
  27997. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  27998. }
  27999. /**
  28000. * Creates a function that performs a partial deep comparison between the
  28001. * value at `path` of a given object to `srcValue`, returning `true` if the
  28002. * object value is equivalent, else `false`.
  28003. *
  28004. * **Note:** Partial comparisons will match empty array and empty object
  28005. * `srcValue` values against any array or object value, respectively. See
  28006. * `_.isEqual` for a list of supported value comparisons.
  28007. *
  28008. * @static
  28009. * @memberOf _
  28010. * @since 3.2.0
  28011. * @category Util
  28012. * @param {Array|string} path The path of the property to get.
  28013. * @param {*} srcValue The value to match.
  28014. * @returns {Function} Returns the new spec function.
  28015. * @example
  28016. *
  28017. * var objects = [
  28018. * { 'a': 1, 'b': 2, 'c': 3 },
  28019. * { 'a': 4, 'b': 5, 'c': 6 }
  28020. * ];
  28021. *
  28022. * _.find(objects, _.matchesProperty('a', 4));
  28023. * // => { 'a': 4, 'b': 5, 'c': 6 }
  28024. */
  28025. function matchesProperty(path, srcValue) {
  28026. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  28027. }
  28028. /**
  28029. * Creates a function that invokes the method at `path` of a given object.
  28030. * Any additional arguments are provided to the invoked method.
  28031. *
  28032. * @static
  28033. * @memberOf _
  28034. * @since 3.7.0
  28035. * @category Util
  28036. * @param {Array|string} path The path of the method to invoke.
  28037. * @param {...*} [args] The arguments to invoke the method with.
  28038. * @returns {Function} Returns the new invoker function.
  28039. * @example
  28040. *
  28041. * var objects = [
  28042. * { 'a': { 'b': _.constant(2) } },
  28043. * { 'a': { 'b': _.constant(1) } }
  28044. * ];
  28045. *
  28046. * _.map(objects, _.method('a.b'));
  28047. * // => [2, 1]
  28048. *
  28049. * _.map(objects, _.method(['a', 'b']));
  28050. * // => [2, 1]
  28051. */
  28052. var method = baseRest(function(path, args) {
  28053. return function(object) {
  28054. return baseInvoke(object, path, args);
  28055. };
  28056. });
  28057. /**
  28058. * The opposite of `_.method`; this method creates a function that invokes
  28059. * the method at a given path of `object`. Any additional arguments are
  28060. * provided to the invoked method.
  28061. *
  28062. * @static
  28063. * @memberOf _
  28064. * @since 3.7.0
  28065. * @category Util
  28066. * @param {Object} object The object to query.
  28067. * @param {...*} [args] The arguments to invoke the method with.
  28068. * @returns {Function} Returns the new invoker function.
  28069. * @example
  28070. *
  28071. * var array = _.times(3, _.constant),
  28072. * object = { 'a': array, 'b': array, 'c': array };
  28073. *
  28074. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  28075. * // => [2, 0]
  28076. *
  28077. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  28078. * // => [2, 0]
  28079. */
  28080. var methodOf = baseRest(function(object, args) {
  28081. return function(path) {
  28082. return baseInvoke(object, path, args);
  28083. };
  28084. });
  28085. /**
  28086. * Adds all own enumerable string keyed function properties of a source
  28087. * object to the destination object. If `object` is a function, then methods
  28088. * are added to its prototype as well.
  28089. *
  28090. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  28091. * avoid conflicts caused by modifying the original.
  28092. *
  28093. * @static
  28094. * @since 0.1.0
  28095. * @memberOf _
  28096. * @category Util
  28097. * @param {Function|Object} [object=lodash] The destination object.
  28098. * @param {Object} source The object of functions to add.
  28099. * @param {Object} [options={}] The options object.
  28100. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  28101. * @returns {Function|Object} Returns `object`.
  28102. * @example
  28103. *
  28104. * function vowels(string) {
  28105. * return _.filter(string, function(v) {
  28106. * return /[aeiou]/i.test(v);
  28107. * });
  28108. * }
  28109. *
  28110. * _.mixin({ 'vowels': vowels });
  28111. * _.vowels('fred');
  28112. * // => ['e']
  28113. *
  28114. * _('fred').vowels().value();
  28115. * // => ['e']
  28116. *
  28117. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  28118. * _('fred').vowels();
  28119. * // => ['e']
  28120. */
  28121. function mixin(object, source, options) {
  28122. var props = keys(source),
  28123. methodNames = baseFunctions(source, props);
  28124. if (options == null &&
  28125. !(isObject(source) && (methodNames.length || !props.length))) {
  28126. options = source;
  28127. source = object;
  28128. object = this;
  28129. methodNames = baseFunctions(source, keys(source));
  28130. }
  28131. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  28132. isFunc = isFunction(object);
  28133. arrayEach(methodNames, function(methodName) {
  28134. var func = source[methodName];
  28135. object[methodName] = func;
  28136. if (isFunc) {
  28137. object.prototype[methodName] = function() {
  28138. var chainAll = this.__chain__;
  28139. if (chain || chainAll) {
  28140. var result = object(this.__wrapped__),
  28141. actions = result.__actions__ = copyArray(this.__actions__);
  28142. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  28143. result.__chain__ = chainAll;
  28144. return result;
  28145. }
  28146. return func.apply(object, arrayPush([this.value()], arguments));
  28147. };
  28148. }
  28149. });
  28150. return object;
  28151. }
  28152. /**
  28153. * Reverts the `_` variable to its previous value and returns a reference to
  28154. * the `lodash` function.
  28155. *
  28156. * @static
  28157. * @since 0.1.0
  28158. * @memberOf _
  28159. * @category Util
  28160. * @returns {Function} Returns the `lodash` function.
  28161. * @example
  28162. *
  28163. * var lodash = _.noConflict();
  28164. */
  28165. function noConflict() {
  28166. if (root._ === this) {
  28167. root._ = oldDash;
  28168. }
  28169. return this;
  28170. }
  28171. /**
  28172. * This method returns `undefined`.
  28173. *
  28174. * @static
  28175. * @memberOf _
  28176. * @since 2.3.0
  28177. * @category Util
  28178. * @example
  28179. *
  28180. * _.times(2, _.noop);
  28181. * // => [undefined, undefined]
  28182. */
  28183. function noop() {
  28184. // No operation performed.
  28185. }
  28186. /**
  28187. * Creates a function that gets the argument at index `n`. If `n` is negative,
  28188. * the nth argument from the end is returned.
  28189. *
  28190. * @static
  28191. * @memberOf _
  28192. * @since 4.0.0
  28193. * @category Util
  28194. * @param {number} [n=0] The index of the argument to return.
  28195. * @returns {Function} Returns the new pass-thru function.
  28196. * @example
  28197. *
  28198. * var func = _.nthArg(1);
  28199. * func('a', 'b', 'c', 'd');
  28200. * // => 'b'
  28201. *
  28202. * var func = _.nthArg(-2);
  28203. * func('a', 'b', 'c', 'd');
  28204. * // => 'c'
  28205. */
  28206. function nthArg(n) {
  28207. n = toInteger(n);
  28208. return baseRest(function(args) {
  28209. return baseNth(args, n);
  28210. });
  28211. }
  28212. /**
  28213. * Creates a function that invokes `iteratees` with the arguments it receives
  28214. * and returns their results.
  28215. *
  28216. * @static
  28217. * @memberOf _
  28218. * @since 4.0.0
  28219. * @category Util
  28220. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  28221. * The iteratees to invoke.
  28222. * @returns {Function} Returns the new function.
  28223. * @example
  28224. *
  28225. * var func = _.over([Math.max, Math.min]);
  28226. *
  28227. * func(1, 2, 3, 4);
  28228. * // => [4, 1]
  28229. */
  28230. var over = createOver(arrayMap);
  28231. /**
  28232. * Creates a function that checks if **all** of the `predicates` return
  28233. * truthy when invoked with the arguments it receives.
  28234. *
  28235. * @static
  28236. * @memberOf _
  28237. * @since 4.0.0
  28238. * @category Util
  28239. * @param {...(Function|Function[])} [predicates=[_.identity]]
  28240. * The predicates to check.
  28241. * @returns {Function} Returns the new function.
  28242. * @example
  28243. *
  28244. * var func = _.overEvery([Boolean, isFinite]);
  28245. *
  28246. * func('1');
  28247. * // => true
  28248. *
  28249. * func(null);
  28250. * // => false
  28251. *
  28252. * func(NaN);
  28253. * // => false
  28254. */
  28255. var overEvery = createOver(arrayEvery);
  28256. /**
  28257. * Creates a function that checks if **any** of the `predicates` return
  28258. * truthy when invoked with the arguments it receives.
  28259. *
  28260. * @static
  28261. * @memberOf _
  28262. * @since 4.0.0
  28263. * @category Util
  28264. * @param {...(Function|Function[])} [predicates=[_.identity]]
  28265. * The predicates to check.
  28266. * @returns {Function} Returns the new function.
  28267. * @example
  28268. *
  28269. * var func = _.overSome([Boolean, isFinite]);
  28270. *
  28271. * func('1');
  28272. * // => true
  28273. *
  28274. * func(null);
  28275. * // => true
  28276. *
  28277. * func(NaN);
  28278. * // => false
  28279. */
  28280. var overSome = createOver(arraySome);
  28281. /**
  28282. * Creates a function that returns the value at `path` of a given object.
  28283. *
  28284. * @static
  28285. * @memberOf _
  28286. * @since 2.4.0
  28287. * @category Util
  28288. * @param {Array|string} path The path of the property to get.
  28289. * @returns {Function} Returns the new accessor function.
  28290. * @example
  28291. *
  28292. * var objects = [
  28293. * { 'a': { 'b': 2 } },
  28294. * { 'a': { 'b': 1 } }
  28295. * ];
  28296. *
  28297. * _.map(objects, _.property('a.b'));
  28298. * // => [2, 1]
  28299. *
  28300. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  28301. * // => [1, 2]
  28302. */
  28303. function property(path) {
  28304. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  28305. }
  28306. /**
  28307. * The opposite of `_.property`; this method creates a function that returns
  28308. * the value at a given path of `object`.
  28309. *
  28310. * @static
  28311. * @memberOf _
  28312. * @since 3.0.0
  28313. * @category Util
  28314. * @param {Object} object The object to query.
  28315. * @returns {Function} Returns the new accessor function.
  28316. * @example
  28317. *
  28318. * var array = [0, 1, 2],
  28319. * object = { 'a': array, 'b': array, 'c': array };
  28320. *
  28321. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  28322. * // => [2, 0]
  28323. *
  28324. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  28325. * // => [2, 0]
  28326. */
  28327. function propertyOf(object) {
  28328. return function(path) {
  28329. return object == null ? undefined : baseGet(object, path);
  28330. };
  28331. }
  28332. /**
  28333. * Creates an array of numbers (positive and/or negative) progressing from
  28334. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  28335. * `start` is specified without an `end` or `step`. If `end` is not specified,
  28336. * it's set to `start` with `start` then set to `0`.
  28337. *
  28338. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  28339. * floating-point values which can produce unexpected results.
  28340. *
  28341. * @static
  28342. * @since 0.1.0
  28343. * @memberOf _
  28344. * @category Util
  28345. * @param {number} [start=0] The start of the range.
  28346. * @param {number} end The end of the range.
  28347. * @param {number} [step=1] The value to increment or decrement by.
  28348. * @returns {Array} Returns the range of numbers.
  28349. * @see _.inRange, _.rangeRight
  28350. * @example
  28351. *
  28352. * _.range(4);
  28353. * // => [0, 1, 2, 3]
  28354. *
  28355. * _.range(-4);
  28356. * // => [0, -1, -2, -3]
  28357. *
  28358. * _.range(1, 5);
  28359. * // => [1, 2, 3, 4]
  28360. *
  28361. * _.range(0, 20, 5);
  28362. * // => [0, 5, 10, 15]
  28363. *
  28364. * _.range(0, -4, -1);
  28365. * // => [0, -1, -2, -3]
  28366. *
  28367. * _.range(1, 4, 0);
  28368. * // => [1, 1, 1]
  28369. *
  28370. * _.range(0);
  28371. * // => []
  28372. */
  28373. var range = createRange();
  28374. /**
  28375. * This method is like `_.range` except that it populates values in
  28376. * descending order.
  28377. *
  28378. * @static
  28379. * @memberOf _
  28380. * @since 4.0.0
  28381. * @category Util
  28382. * @param {number} [start=0] The start of the range.
  28383. * @param {number} end The end of the range.
  28384. * @param {number} [step=1] The value to increment or decrement by.
  28385. * @returns {Array} Returns the range of numbers.
  28386. * @see _.inRange, _.range
  28387. * @example
  28388. *
  28389. * _.rangeRight(4);
  28390. * // => [3, 2, 1, 0]
  28391. *
  28392. * _.rangeRight(-4);
  28393. * // => [-3, -2, -1, 0]
  28394. *
  28395. * _.rangeRight(1, 5);
  28396. * // => [4, 3, 2, 1]
  28397. *
  28398. * _.rangeRight(0, 20, 5);
  28399. * // => [15, 10, 5, 0]
  28400. *
  28401. * _.rangeRight(0, -4, -1);
  28402. * // => [-3, -2, -1, 0]
  28403. *
  28404. * _.rangeRight(1, 4, 0);
  28405. * // => [1, 1, 1]
  28406. *
  28407. * _.rangeRight(0);
  28408. * // => []
  28409. */
  28410. var rangeRight = createRange(true);
  28411. /**
  28412. * This method returns a new empty array.
  28413. *
  28414. * @static
  28415. * @memberOf _
  28416. * @since 4.13.0
  28417. * @category Util
  28418. * @returns {Array} Returns the new empty array.
  28419. * @example
  28420. *
  28421. * var arrays = _.times(2, _.stubArray);
  28422. *
  28423. * console.log(arrays);
  28424. * // => [[], []]
  28425. *
  28426. * console.log(arrays[0] === arrays[1]);
  28427. * // => false
  28428. */
  28429. function stubArray() {
  28430. return [];
  28431. }
  28432. /**
  28433. * This method returns `false`.
  28434. *
  28435. * @static
  28436. * @memberOf _
  28437. * @since 4.13.0
  28438. * @category Util
  28439. * @returns {boolean} Returns `false`.
  28440. * @example
  28441. *
  28442. * _.times(2, _.stubFalse);
  28443. * // => [false, false]
  28444. */
  28445. function stubFalse() {
  28446. return false;
  28447. }
  28448. /**
  28449. * This method returns a new empty object.
  28450. *
  28451. * @static
  28452. * @memberOf _
  28453. * @since 4.13.0
  28454. * @category Util
  28455. * @returns {Object} Returns the new empty object.
  28456. * @example
  28457. *
  28458. * var objects = _.times(2, _.stubObject);
  28459. *
  28460. * console.log(objects);
  28461. * // => [{}, {}]
  28462. *
  28463. * console.log(objects[0] === objects[1]);
  28464. * // => false
  28465. */
  28466. function stubObject() {
  28467. return {};
  28468. }
  28469. /**
  28470. * This method returns an empty string.
  28471. *
  28472. * @static
  28473. * @memberOf _
  28474. * @since 4.13.0
  28475. * @category Util
  28476. * @returns {string} Returns the empty string.
  28477. * @example
  28478. *
  28479. * _.times(2, _.stubString);
  28480. * // => ['', '']
  28481. */
  28482. function stubString() {
  28483. return '';
  28484. }
  28485. /**
  28486. * This method returns `true`.
  28487. *
  28488. * @static
  28489. * @memberOf _
  28490. * @since 4.13.0
  28491. * @category Util
  28492. * @returns {boolean} Returns `true`.
  28493. * @example
  28494. *
  28495. * _.times(2, _.stubTrue);
  28496. * // => [true, true]
  28497. */
  28498. function stubTrue() {
  28499. return true;
  28500. }
  28501. /**
  28502. * Invokes the iteratee `n` times, returning an array of the results of
  28503. * each invocation. The iteratee is invoked with one argument; (index).
  28504. *
  28505. * @static
  28506. * @since 0.1.0
  28507. * @memberOf _
  28508. * @category Util
  28509. * @param {number} n The number of times to invoke `iteratee`.
  28510. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28511. * @returns {Array} Returns the array of results.
  28512. * @example
  28513. *
  28514. * _.times(3, String);
  28515. * // => ['0', '1', '2']
  28516. *
  28517. * _.times(4, _.constant(0));
  28518. * // => [0, 0, 0, 0]
  28519. */
  28520. function times(n, iteratee) {
  28521. n = toInteger(n);
  28522. if (n < 1 || n > MAX_SAFE_INTEGER) {
  28523. return [];
  28524. }
  28525. var index = MAX_ARRAY_LENGTH,
  28526. length = nativeMin(n, MAX_ARRAY_LENGTH);
  28527. iteratee = getIteratee(iteratee);
  28528. n -= MAX_ARRAY_LENGTH;
  28529. var result = baseTimes(length, iteratee);
  28530. while (++index < n) {
  28531. iteratee(index);
  28532. }
  28533. return result;
  28534. }
  28535. /**
  28536. * Converts `value` to a property path array.
  28537. *
  28538. * @static
  28539. * @memberOf _
  28540. * @since 4.0.0
  28541. * @category Util
  28542. * @param {*} value The value to convert.
  28543. * @returns {Array} Returns the new property path array.
  28544. * @example
  28545. *
  28546. * _.toPath('a.b.c');
  28547. * // => ['a', 'b', 'c']
  28548. *
  28549. * _.toPath('a[0].b.c');
  28550. * // => ['a', '0', 'b', 'c']
  28551. */
  28552. function toPath(value) {
  28553. if (isArray(value)) {
  28554. return arrayMap(value, toKey);
  28555. }
  28556. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  28557. }
  28558. /**
  28559. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  28560. *
  28561. * @static
  28562. * @since 0.1.0
  28563. * @memberOf _
  28564. * @category Util
  28565. * @param {string} [prefix=''] The value to prefix the ID with.
  28566. * @returns {string} Returns the unique ID.
  28567. * @example
  28568. *
  28569. * _.uniqueId('contact_');
  28570. * // => 'contact_104'
  28571. *
  28572. * _.uniqueId();
  28573. * // => '105'
  28574. */
  28575. function uniqueId(prefix) {
  28576. var id = ++idCounter;
  28577. return toString(prefix) + id;
  28578. }
  28579. /*------------------------------------------------------------------------*/
  28580. /**
  28581. * Adds two numbers.
  28582. *
  28583. * @static
  28584. * @memberOf _
  28585. * @since 3.4.0
  28586. * @category Math
  28587. * @param {number} augend The first number in an addition.
  28588. * @param {number} addend The second number in an addition.
  28589. * @returns {number} Returns the total.
  28590. * @example
  28591. *
  28592. * _.add(6, 4);
  28593. * // => 10
  28594. */
  28595. var add = createMathOperation(function(augend, addend) {
  28596. return augend + addend;
  28597. }, 0);
  28598. /**
  28599. * Computes `number` rounded up to `precision`.
  28600. *
  28601. * @static
  28602. * @memberOf _
  28603. * @since 3.10.0
  28604. * @category Math
  28605. * @param {number} number The number to round up.
  28606. * @param {number} [precision=0] The precision to round up to.
  28607. * @returns {number} Returns the rounded up number.
  28608. * @example
  28609. *
  28610. * _.ceil(4.006);
  28611. * // => 5
  28612. *
  28613. * _.ceil(6.004, 2);
  28614. * // => 6.01
  28615. *
  28616. * _.ceil(6040, -2);
  28617. * // => 6100
  28618. */
  28619. var ceil = createRound('ceil');
  28620. /**
  28621. * Divide two numbers.
  28622. *
  28623. * @static
  28624. * @memberOf _
  28625. * @since 4.7.0
  28626. * @category Math
  28627. * @param {number} dividend The first number in a division.
  28628. * @param {number} divisor The second number in a division.
  28629. * @returns {number} Returns the quotient.
  28630. * @example
  28631. *
  28632. * _.divide(6, 4);
  28633. * // => 1.5
  28634. */
  28635. var divide = createMathOperation(function(dividend, divisor) {
  28636. return dividend / divisor;
  28637. }, 1);
  28638. /**
  28639. * Computes `number` rounded down to `precision`.
  28640. *
  28641. * @static
  28642. * @memberOf _
  28643. * @since 3.10.0
  28644. * @category Math
  28645. * @param {number} number The number to round down.
  28646. * @param {number} [precision=0] The precision to round down to.
  28647. * @returns {number} Returns the rounded down number.
  28648. * @example
  28649. *
  28650. * _.floor(4.006);
  28651. * // => 4
  28652. *
  28653. * _.floor(0.046, 2);
  28654. * // => 0.04
  28655. *
  28656. * _.floor(4060, -2);
  28657. * // => 4000
  28658. */
  28659. var floor = createRound('floor');
  28660. /**
  28661. * Computes the maximum value of `array`. If `array` is empty or falsey,
  28662. * `undefined` is returned.
  28663. *
  28664. * @static
  28665. * @since 0.1.0
  28666. * @memberOf _
  28667. * @category Math
  28668. * @param {Array} array The array to iterate over.
  28669. * @returns {*} Returns the maximum value.
  28670. * @example
  28671. *
  28672. * _.max([4, 2, 8, 6]);
  28673. * // => 8
  28674. *
  28675. * _.max([]);
  28676. * // => undefined
  28677. */
  28678. function max(array) {
  28679. return (array && array.length)
  28680. ? baseExtremum(array, identity, baseGt)
  28681. : undefined;
  28682. }
  28683. /**
  28684. * This method is like `_.max` except that it accepts `iteratee` which is
  28685. * invoked for each element in `array` to generate the criterion by which
  28686. * the value is ranked. The iteratee is invoked with one argument: (value).
  28687. *
  28688. * @static
  28689. * @memberOf _
  28690. * @since 4.0.0
  28691. * @category Math
  28692. * @param {Array} array The array to iterate over.
  28693. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  28694. * @returns {*} Returns the maximum value.
  28695. * @example
  28696. *
  28697. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  28698. *
  28699. * _.maxBy(objects, function(o) { return o.n; });
  28700. * // => { 'n': 2 }
  28701. *
  28702. * // The `_.property` iteratee shorthand.
  28703. * _.maxBy(objects, 'n');
  28704. * // => { 'n': 2 }
  28705. */
  28706. function maxBy(array, iteratee) {
  28707. return (array && array.length)
  28708. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  28709. : undefined;
  28710. }
  28711. /**
  28712. * Computes the mean of the values in `array`.
  28713. *
  28714. * @static
  28715. * @memberOf _
  28716. * @since 4.0.0
  28717. * @category Math
  28718. * @param {Array} array The array to iterate over.
  28719. * @returns {number} Returns the mean.
  28720. * @example
  28721. *
  28722. * _.mean([4, 2, 8, 6]);
  28723. * // => 5
  28724. */
  28725. function mean(array) {
  28726. return baseMean(array, identity);
  28727. }
  28728. /**
  28729. * This method is like `_.mean` except that it accepts `iteratee` which is
  28730. * invoked for each element in `array` to generate the value to be averaged.
  28731. * The iteratee is invoked with one argument: (value).
  28732. *
  28733. * @static
  28734. * @memberOf _
  28735. * @since 4.7.0
  28736. * @category Math
  28737. * @param {Array} array The array to iterate over.
  28738. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  28739. * @returns {number} Returns the mean.
  28740. * @example
  28741. *
  28742. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  28743. *
  28744. * _.meanBy(objects, function(o) { return o.n; });
  28745. * // => 5
  28746. *
  28747. * // The `_.property` iteratee shorthand.
  28748. * _.meanBy(objects, 'n');
  28749. * // => 5
  28750. */
  28751. function meanBy(array, iteratee) {
  28752. return baseMean(array, getIteratee(iteratee, 2));
  28753. }
  28754. /**
  28755. * Computes the minimum value of `array`. If `array` is empty or falsey,
  28756. * `undefined` is returned.
  28757. *
  28758. * @static
  28759. * @since 0.1.0
  28760. * @memberOf _
  28761. * @category Math
  28762. * @param {Array} array The array to iterate over.
  28763. * @returns {*} Returns the minimum value.
  28764. * @example
  28765. *
  28766. * _.min([4, 2, 8, 6]);
  28767. * // => 2
  28768. *
  28769. * _.min([]);
  28770. * // => undefined
  28771. */
  28772. function min(array) {
  28773. return (array && array.length)
  28774. ? baseExtremum(array, identity, baseLt)
  28775. : undefined;
  28776. }
  28777. /**
  28778. * This method is like `_.min` except that it accepts `iteratee` which is
  28779. * invoked for each element in `array` to generate the criterion by which
  28780. * the value is ranked. The iteratee is invoked with one argument: (value).
  28781. *
  28782. * @static
  28783. * @memberOf _
  28784. * @since 4.0.0
  28785. * @category Math
  28786. * @param {Array} array The array to iterate over.
  28787. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  28788. * @returns {*} Returns the minimum value.
  28789. * @example
  28790. *
  28791. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  28792. *
  28793. * _.minBy(objects, function(o) { return o.n; });
  28794. * // => { 'n': 1 }
  28795. *
  28796. * // The `_.property` iteratee shorthand.
  28797. * _.minBy(objects, 'n');
  28798. * // => { 'n': 1 }
  28799. */
  28800. function minBy(array, iteratee) {
  28801. return (array && array.length)
  28802. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  28803. : undefined;
  28804. }
  28805. /**
  28806. * Multiply two numbers.
  28807. *
  28808. * @static
  28809. * @memberOf _
  28810. * @since 4.7.0
  28811. * @category Math
  28812. * @param {number} multiplier The first number in a multiplication.
  28813. * @param {number} multiplicand The second number in a multiplication.
  28814. * @returns {number} Returns the product.
  28815. * @example
  28816. *
  28817. * _.multiply(6, 4);
  28818. * // => 24
  28819. */
  28820. var multiply = createMathOperation(function(multiplier, multiplicand) {
  28821. return multiplier * multiplicand;
  28822. }, 1);
  28823. /**
  28824. * Computes `number` rounded to `precision`.
  28825. *
  28826. * @static
  28827. * @memberOf _
  28828. * @since 3.10.0
  28829. * @category Math
  28830. * @param {number} number The number to round.
  28831. * @param {number} [precision=0] The precision to round to.
  28832. * @returns {number} Returns the rounded number.
  28833. * @example
  28834. *
  28835. * _.round(4.006);
  28836. * // => 4
  28837. *
  28838. * _.round(4.006, 2);
  28839. * // => 4.01
  28840. *
  28841. * _.round(4060, -2);
  28842. * // => 4100
  28843. */
  28844. var round = createRound('round');
  28845. /**
  28846. * Subtract two numbers.
  28847. *
  28848. * @static
  28849. * @memberOf _
  28850. * @since 4.0.0
  28851. * @category Math
  28852. * @param {number} minuend The first number in a subtraction.
  28853. * @param {number} subtrahend The second number in a subtraction.
  28854. * @returns {number} Returns the difference.
  28855. * @example
  28856. *
  28857. * _.subtract(6, 4);
  28858. * // => 2
  28859. */
  28860. var subtract = createMathOperation(function(minuend, subtrahend) {
  28861. return minuend - subtrahend;
  28862. }, 0);
  28863. /**
  28864. * Computes the sum of the values in `array`.
  28865. *
  28866. * @static
  28867. * @memberOf _
  28868. * @since 3.4.0
  28869. * @category Math
  28870. * @param {Array} array The array to iterate over.
  28871. * @returns {number} Returns the sum.
  28872. * @example
  28873. *
  28874. * _.sum([4, 2, 8, 6]);
  28875. * // => 20
  28876. */
  28877. function sum(array) {
  28878. return (array && array.length)
  28879. ? baseSum(array, identity)
  28880. : 0;
  28881. }
  28882. /**
  28883. * This method is like `_.sum` except that it accepts `iteratee` which is
  28884. * invoked for each element in `array` to generate the value to be summed.
  28885. * The iteratee is invoked with one argument: (value).
  28886. *
  28887. * @static
  28888. * @memberOf _
  28889. * @since 4.0.0
  28890. * @category Math
  28891. * @param {Array} array The array to iterate over.
  28892. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  28893. * @returns {number} Returns the sum.
  28894. * @example
  28895. *
  28896. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  28897. *
  28898. * _.sumBy(objects, function(o) { return o.n; });
  28899. * // => 20
  28900. *
  28901. * // The `_.property` iteratee shorthand.
  28902. * _.sumBy(objects, 'n');
  28903. * // => 20
  28904. */
  28905. function sumBy(array, iteratee) {
  28906. return (array && array.length)
  28907. ? baseSum(array, getIteratee(iteratee, 2))
  28908. : 0;
  28909. }
  28910. /*------------------------------------------------------------------------*/
  28911. // Add methods that return wrapped values in chain sequences.
  28912. lodash.after = after;
  28913. lodash.ary = ary;
  28914. lodash.assign = assign;
  28915. lodash.assignIn = assignIn;
  28916. lodash.assignInWith = assignInWith;
  28917. lodash.assignWith = assignWith;
  28918. lodash.at = at;
  28919. lodash.before = before;
  28920. lodash.bind = bind;
  28921. lodash.bindAll = bindAll;
  28922. lodash.bindKey = bindKey;
  28923. lodash.castArray = castArray;
  28924. lodash.chain = chain;
  28925. lodash.chunk = chunk;
  28926. lodash.compact = compact;
  28927. lodash.concat = concat;
  28928. lodash.cond = cond;
  28929. lodash.conforms = conforms;
  28930. lodash.constant = constant;
  28931. lodash.countBy = countBy;
  28932. lodash.create = create;
  28933. lodash.curry = curry;
  28934. lodash.curryRight = curryRight;
  28935. lodash.debounce = debounce;
  28936. lodash.defaults = defaults;
  28937. lodash.defaultsDeep = defaultsDeep;
  28938. lodash.defer = defer;
  28939. lodash.delay = delay;
  28940. lodash.difference = difference;
  28941. lodash.differenceBy = differenceBy;
  28942. lodash.differenceWith = differenceWith;
  28943. lodash.drop = drop;
  28944. lodash.dropRight = dropRight;
  28945. lodash.dropRightWhile = dropRightWhile;
  28946. lodash.dropWhile = dropWhile;
  28947. lodash.fill = fill;
  28948. lodash.filter = filter;
  28949. lodash.flatMap = flatMap;
  28950. lodash.flatMapDeep = flatMapDeep;
  28951. lodash.flatMapDepth = flatMapDepth;
  28952. lodash.flatten = flatten;
  28953. lodash.flattenDeep = flattenDeep;
  28954. lodash.flattenDepth = flattenDepth;
  28955. lodash.flip = flip;
  28956. lodash.flow = flow;
  28957. lodash.flowRight = flowRight;
  28958. lodash.fromPairs = fromPairs;
  28959. lodash.functions = functions;
  28960. lodash.functionsIn = functionsIn;
  28961. lodash.groupBy = groupBy;
  28962. lodash.initial = initial;
  28963. lodash.intersection = intersection;
  28964. lodash.intersectionBy = intersectionBy;
  28965. lodash.intersectionWith = intersectionWith;
  28966. lodash.invert = invert;
  28967. lodash.invertBy = invertBy;
  28968. lodash.invokeMap = invokeMap;
  28969. lodash.iteratee = iteratee;
  28970. lodash.keyBy = keyBy;
  28971. lodash.keys = keys;
  28972. lodash.keysIn = keysIn;
  28973. lodash.map = map;
  28974. lodash.mapKeys = mapKeys;
  28975. lodash.mapValues = mapValues;
  28976. lodash.matches = matches;
  28977. lodash.matchesProperty = matchesProperty;
  28978. lodash.memoize = memoize;
  28979. lodash.merge = merge;
  28980. lodash.mergeWith = mergeWith;
  28981. lodash.method = method;
  28982. lodash.methodOf = methodOf;
  28983. lodash.mixin = mixin;
  28984. lodash.negate = negate;
  28985. lodash.nthArg = nthArg;
  28986. lodash.omit = omit;
  28987. lodash.omitBy = omitBy;
  28988. lodash.once = once;
  28989. lodash.orderBy = orderBy;
  28990. lodash.over = over;
  28991. lodash.overArgs = overArgs;
  28992. lodash.overEvery = overEvery;
  28993. lodash.overSome = overSome;
  28994. lodash.partial = partial;
  28995. lodash.partialRight = partialRight;
  28996. lodash.partition = partition;
  28997. lodash.pick = pick;
  28998. lodash.pickBy = pickBy;
  28999. lodash.property = property;
  29000. lodash.propertyOf = propertyOf;
  29001. lodash.pull = pull;
  29002. lodash.pullAll = pullAll;
  29003. lodash.pullAllBy = pullAllBy;
  29004. lodash.pullAllWith = pullAllWith;
  29005. lodash.pullAt = pullAt;
  29006. lodash.range = range;
  29007. lodash.rangeRight = rangeRight;
  29008. lodash.rearg = rearg;
  29009. lodash.reject = reject;
  29010. lodash.remove = remove;
  29011. lodash.rest = rest;
  29012. lodash.reverse = reverse;
  29013. lodash.sampleSize = sampleSize;
  29014. lodash.set = set;
  29015. lodash.setWith = setWith;
  29016. lodash.shuffle = shuffle;
  29017. lodash.slice = slice;
  29018. lodash.sortBy = sortBy;
  29019. lodash.sortedUniq = sortedUniq;
  29020. lodash.sortedUniqBy = sortedUniqBy;
  29021. lodash.split = split;
  29022. lodash.spread = spread;
  29023. lodash.tail = tail;
  29024. lodash.take = take;
  29025. lodash.takeRight = takeRight;
  29026. lodash.takeRightWhile = takeRightWhile;
  29027. lodash.takeWhile = takeWhile;
  29028. lodash.tap = tap;
  29029. lodash.throttle = throttle;
  29030. lodash.thru = thru;
  29031. lodash.toArray = toArray;
  29032. lodash.toPairs = toPairs;
  29033. lodash.toPairsIn = toPairsIn;
  29034. lodash.toPath = toPath;
  29035. lodash.toPlainObject = toPlainObject;
  29036. lodash.transform = transform;
  29037. lodash.unary = unary;
  29038. lodash.union = union;
  29039. lodash.unionBy = unionBy;
  29040. lodash.unionWith = unionWith;
  29041. lodash.uniq = uniq;
  29042. lodash.uniqBy = uniqBy;
  29043. lodash.uniqWith = uniqWith;
  29044. lodash.unset = unset;
  29045. lodash.unzip = unzip;
  29046. lodash.unzipWith = unzipWith;
  29047. lodash.update = update;
  29048. lodash.updateWith = updateWith;
  29049. lodash.values = values;
  29050. lodash.valuesIn = valuesIn;
  29051. lodash.without = without;
  29052. lodash.words = words;
  29053. lodash.wrap = wrap;
  29054. lodash.xor = xor;
  29055. lodash.xorBy = xorBy;
  29056. lodash.xorWith = xorWith;
  29057. lodash.zip = zip;
  29058. lodash.zipObject = zipObject;
  29059. lodash.zipObjectDeep = zipObjectDeep;
  29060. lodash.zipWith = zipWith;
  29061. // Add aliases.
  29062. lodash.entries = toPairs;
  29063. lodash.entriesIn = toPairsIn;
  29064. lodash.extend = assignIn;
  29065. lodash.extendWith = assignInWith;
  29066. // Add methods to `lodash.prototype`.
  29067. mixin(lodash, lodash);
  29068. /*------------------------------------------------------------------------*/
  29069. // Add methods that return unwrapped values in chain sequences.
  29070. lodash.add = add;
  29071. lodash.attempt = attempt;
  29072. lodash.camelCase = camelCase;
  29073. lodash.capitalize = capitalize;
  29074. lodash.ceil = ceil;
  29075. lodash.clamp = clamp;
  29076. lodash.clone = clone;
  29077. lodash.cloneDeep = cloneDeep;
  29078. lodash.cloneDeepWith = cloneDeepWith;
  29079. lodash.cloneWith = cloneWith;
  29080. lodash.conformsTo = conformsTo;
  29081. lodash.deburr = deburr;
  29082. lodash.defaultTo = defaultTo;
  29083. lodash.divide = divide;
  29084. lodash.endsWith = endsWith;
  29085. lodash.eq = eq;
  29086. lodash.escape = escape;
  29087. lodash.escapeRegExp = escapeRegExp;
  29088. lodash.every = every;
  29089. lodash.find = find;
  29090. lodash.findIndex = findIndex;
  29091. lodash.findKey = findKey;
  29092. lodash.findLast = findLast;
  29093. lodash.findLastIndex = findLastIndex;
  29094. lodash.findLastKey = findLastKey;
  29095. lodash.floor = floor;
  29096. lodash.forEach = forEach;
  29097. lodash.forEachRight = forEachRight;
  29098. lodash.forIn = forIn;
  29099. lodash.forInRight = forInRight;
  29100. lodash.forOwn = forOwn;
  29101. lodash.forOwnRight = forOwnRight;
  29102. lodash.get = get;
  29103. lodash.gt = gt;
  29104. lodash.gte = gte;
  29105. lodash.has = has;
  29106. lodash.hasIn = hasIn;
  29107. lodash.head = head;
  29108. lodash.identity = identity;
  29109. lodash.includes = includes;
  29110. lodash.indexOf = indexOf;
  29111. lodash.inRange = inRange;
  29112. lodash.invoke = invoke;
  29113. lodash.isArguments = isArguments;
  29114. lodash.isArray = isArray;
  29115. lodash.isArrayBuffer = isArrayBuffer;
  29116. lodash.isArrayLike = isArrayLike;
  29117. lodash.isArrayLikeObject = isArrayLikeObject;
  29118. lodash.isBoolean = isBoolean;
  29119. lodash.isBuffer = isBuffer;
  29120. lodash.isDate = isDate;
  29121. lodash.isElement = isElement;
  29122. lodash.isEmpty = isEmpty;
  29123. lodash.isEqual = isEqual;
  29124. lodash.isEqualWith = isEqualWith;
  29125. lodash.isError = isError;
  29126. lodash.isFinite = isFinite;
  29127. lodash.isFunction = isFunction;
  29128. lodash.isInteger = isInteger;
  29129. lodash.isLength = isLength;
  29130. lodash.isMap = isMap;
  29131. lodash.isMatch = isMatch;
  29132. lodash.isMatchWith = isMatchWith;
  29133. lodash.isNaN = isNaN;
  29134. lodash.isNative = isNative;
  29135. lodash.isNil = isNil;
  29136. lodash.isNull = isNull;
  29137. lodash.isNumber = isNumber;
  29138. lodash.isObject = isObject;
  29139. lodash.isObjectLike = isObjectLike;
  29140. lodash.isPlainObject = isPlainObject;
  29141. lodash.isRegExp = isRegExp;
  29142. lodash.isSafeInteger = isSafeInteger;
  29143. lodash.isSet = isSet;
  29144. lodash.isString = isString;
  29145. lodash.isSymbol = isSymbol;
  29146. lodash.isTypedArray = isTypedArray;
  29147. lodash.isUndefined = isUndefined;
  29148. lodash.isWeakMap = isWeakMap;
  29149. lodash.isWeakSet = isWeakSet;
  29150. lodash.join = join;
  29151. lodash.kebabCase = kebabCase;
  29152. lodash.last = last;
  29153. lodash.lastIndexOf = lastIndexOf;
  29154. lodash.lowerCase = lowerCase;
  29155. lodash.lowerFirst = lowerFirst;
  29156. lodash.lt = lt;
  29157. lodash.lte = lte;
  29158. lodash.max = max;
  29159. lodash.maxBy = maxBy;
  29160. lodash.mean = mean;
  29161. lodash.meanBy = meanBy;
  29162. lodash.min = min;
  29163. lodash.minBy = minBy;
  29164. lodash.stubArray = stubArray;
  29165. lodash.stubFalse = stubFalse;
  29166. lodash.stubObject = stubObject;
  29167. lodash.stubString = stubString;
  29168. lodash.stubTrue = stubTrue;
  29169. lodash.multiply = multiply;
  29170. lodash.nth = nth;
  29171. lodash.noConflict = noConflict;
  29172. lodash.noop = noop;
  29173. lodash.now = now;
  29174. lodash.pad = pad;
  29175. lodash.padEnd = padEnd;
  29176. lodash.padStart = padStart;
  29177. lodash.parseInt = parseInt;
  29178. lodash.random = random;
  29179. lodash.reduce = reduce;
  29180. lodash.reduceRight = reduceRight;
  29181. lodash.repeat = repeat;
  29182. lodash.replace = replace;
  29183. lodash.result = result;
  29184. lodash.round = round;
  29185. lodash.runInContext = runInContext;
  29186. lodash.sample = sample;
  29187. lodash.size = size;
  29188. lodash.snakeCase = snakeCase;
  29189. lodash.some = some;
  29190. lodash.sortedIndex = sortedIndex;
  29191. lodash.sortedIndexBy = sortedIndexBy;
  29192. lodash.sortedIndexOf = sortedIndexOf;
  29193. lodash.sortedLastIndex = sortedLastIndex;
  29194. lodash.sortedLastIndexBy = sortedLastIndexBy;
  29195. lodash.sortedLastIndexOf = sortedLastIndexOf;
  29196. lodash.startCase = startCase;
  29197. lodash.startsWith = startsWith;
  29198. lodash.subtract = subtract;
  29199. lodash.sum = sum;
  29200. lodash.sumBy = sumBy;
  29201. lodash.template = template;
  29202. lodash.times = times;
  29203. lodash.toFinite = toFinite;
  29204. lodash.toInteger = toInteger;
  29205. lodash.toLength = toLength;
  29206. lodash.toLower = toLower;
  29207. lodash.toNumber = toNumber;
  29208. lodash.toSafeInteger = toSafeInteger;
  29209. lodash.toString = toString;
  29210. lodash.toUpper = toUpper;
  29211. lodash.trim = trim;
  29212. lodash.trimEnd = trimEnd;
  29213. lodash.trimStart = trimStart;
  29214. lodash.truncate = truncate;
  29215. lodash.unescape = unescape;
  29216. lodash.uniqueId = uniqueId;
  29217. lodash.upperCase = upperCase;
  29218. lodash.upperFirst = upperFirst;
  29219. // Add aliases.
  29220. lodash.each = forEach;
  29221. lodash.eachRight = forEachRight;
  29222. lodash.first = head;
  29223. mixin(lodash, (function() {
  29224. var source = {};
  29225. baseForOwn(lodash, function(func, methodName) {
  29226. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  29227. source[methodName] = func;
  29228. }
  29229. });
  29230. return source;
  29231. }()), { 'chain': false });
  29232. /*------------------------------------------------------------------------*/
  29233. /**
  29234. * The semantic version number.
  29235. *
  29236. * @static
  29237. * @memberOf _
  29238. * @type {string}
  29239. */
  29240. lodash.VERSION = VERSION;
  29241. // Assign default placeholders.
  29242. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  29243. lodash[methodName].placeholder = lodash;
  29244. });
  29245. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  29246. arrayEach(['drop', 'take'], function(methodName, index) {
  29247. LazyWrapper.prototype[methodName] = function(n) {
  29248. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  29249. var result = (this.__filtered__ && !index)
  29250. ? new LazyWrapper(this)
  29251. : this.clone();
  29252. if (result.__filtered__) {
  29253. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  29254. } else {
  29255. result.__views__.push({
  29256. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  29257. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  29258. });
  29259. }
  29260. return result;
  29261. };
  29262. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  29263. return this.reverse()[methodName](n).reverse();
  29264. };
  29265. });
  29266. // Add `LazyWrapper` methods that accept an `iteratee` value.
  29267. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  29268. var type = index + 1,
  29269. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  29270. LazyWrapper.prototype[methodName] = function(iteratee) {
  29271. var result = this.clone();
  29272. result.__iteratees__.push({
  29273. 'iteratee': getIteratee(iteratee, 3),
  29274. 'type': type
  29275. });
  29276. result.__filtered__ = result.__filtered__ || isFilter;
  29277. return result;
  29278. };
  29279. });
  29280. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  29281. arrayEach(['head', 'last'], function(methodName, index) {
  29282. var takeName = 'take' + (index ? 'Right' : '');
  29283. LazyWrapper.prototype[methodName] = function() {
  29284. return this[takeName](1).value()[0];
  29285. };
  29286. });
  29287. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  29288. arrayEach(['initial', 'tail'], function(methodName, index) {
  29289. var dropName = 'drop' + (index ? '' : 'Right');
  29290. LazyWrapper.prototype[methodName] = function() {
  29291. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  29292. };
  29293. });
  29294. LazyWrapper.prototype.compact = function() {
  29295. return this.filter(identity);
  29296. };
  29297. LazyWrapper.prototype.find = function(predicate) {
  29298. return this.filter(predicate).head();
  29299. };
  29300. LazyWrapper.prototype.findLast = function(predicate) {
  29301. return this.reverse().find(predicate);
  29302. };
  29303. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  29304. if (typeof path == 'function') {
  29305. return new LazyWrapper(this);
  29306. }
  29307. return this.map(function(value) {
  29308. return baseInvoke(value, path, args);
  29309. });
  29310. });
  29311. LazyWrapper.prototype.reject = function(predicate) {
  29312. return this.filter(negate(getIteratee(predicate)));
  29313. };
  29314. LazyWrapper.prototype.slice = function(start, end) {
  29315. start = toInteger(start);
  29316. var result = this;
  29317. if (result.__filtered__ && (start > 0 || end < 0)) {
  29318. return new LazyWrapper(result);
  29319. }
  29320. if (start < 0) {
  29321. result = result.takeRight(-start);
  29322. } else if (start) {
  29323. result = result.drop(start);
  29324. }
  29325. if (end !== undefined) {
  29326. end = toInteger(end);
  29327. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  29328. }
  29329. return result;
  29330. };
  29331. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  29332. return this.reverse().takeWhile(predicate).reverse();
  29333. };
  29334. LazyWrapper.prototype.toArray = function() {
  29335. return this.take(MAX_ARRAY_LENGTH);
  29336. };
  29337. // Add `LazyWrapper` methods to `lodash.prototype`.
  29338. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  29339. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  29340. isTaker = /^(?:head|last)$/.test(methodName),
  29341. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  29342. retUnwrapped = isTaker || /^find/.test(methodName);
  29343. if (!lodashFunc) {
  29344. return;
  29345. }
  29346. lodash.prototype[methodName] = function() {
  29347. var value = this.__wrapped__,
  29348. args = isTaker ? [1] : arguments,
  29349. isLazy = value instanceof LazyWrapper,
  29350. iteratee = args[0],
  29351. useLazy = isLazy || isArray(value);
  29352. var interceptor = function(value) {
  29353. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  29354. return (isTaker && chainAll) ? result[0] : result;
  29355. };
  29356. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  29357. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  29358. isLazy = useLazy = false;
  29359. }
  29360. var chainAll = this.__chain__,
  29361. isHybrid = !!this.__actions__.length,
  29362. isUnwrapped = retUnwrapped && !chainAll,
  29363. onlyLazy = isLazy && !isHybrid;
  29364. if (!retUnwrapped && useLazy) {
  29365. value = onlyLazy ? value : new LazyWrapper(this);
  29366. var result = func.apply(value, args);
  29367. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  29368. return new LodashWrapper(result, chainAll);
  29369. }
  29370. if (isUnwrapped && onlyLazy) {
  29371. return func.apply(this, args);
  29372. }
  29373. result = this.thru(interceptor);
  29374. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  29375. };
  29376. });
  29377. // Add `Array` methods to `lodash.prototype`.
  29378. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  29379. var func = arrayProto[methodName],
  29380. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  29381. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  29382. lodash.prototype[methodName] = function() {
  29383. var args = arguments;
  29384. if (retUnwrapped && !this.__chain__) {
  29385. var value = this.value();
  29386. return func.apply(isArray(value) ? value : [], args);
  29387. }
  29388. return this[chainName](function(value) {
  29389. return func.apply(isArray(value) ? value : [], args);
  29390. });
  29391. };
  29392. });
  29393. // Map minified method names to their real names.
  29394. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  29395. var lodashFunc = lodash[methodName];
  29396. if (lodashFunc) {
  29397. var key = (lodashFunc.name + ''),
  29398. names = realNames[key] || (realNames[key] = []);
  29399. names.push({ 'name': methodName, 'func': lodashFunc });
  29400. }
  29401. });
  29402. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  29403. 'name': 'wrapper',
  29404. 'func': undefined
  29405. }];
  29406. // Add methods to `LazyWrapper`.
  29407. LazyWrapper.prototype.clone = lazyClone;
  29408. LazyWrapper.prototype.reverse = lazyReverse;
  29409. LazyWrapper.prototype.value = lazyValue;
  29410. // Add chain sequence methods to the `lodash` wrapper.
  29411. lodash.prototype.at = wrapperAt;
  29412. lodash.prototype.chain = wrapperChain;
  29413. lodash.prototype.commit = wrapperCommit;
  29414. lodash.prototype.next = wrapperNext;
  29415. lodash.prototype.plant = wrapperPlant;
  29416. lodash.prototype.reverse = wrapperReverse;
  29417. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  29418. // Add lazy aliases.
  29419. lodash.prototype.first = lodash.prototype.head;
  29420. if (symIterator) {
  29421. lodash.prototype[symIterator] = wrapperToIterator;
  29422. }
  29423. return lodash;
  29424. });
  29425. /*--------------------------------------------------------------------------*/
  29426. // Export lodash.
  29427. var _ = runInContext();
  29428. // Some AMD build optimizers, like r.js, check for condition patterns like:
  29429. if (true) {
  29430. // Expose Lodash on the global object to prevent errors when Lodash is
  29431. // loaded by a script tag in the presence of an AMD loader.
  29432. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  29433. // Use `_.noConflict` to remove Lodash from the global object.
  29434. root._ = _;
  29435. // Define as an anonymous module so, through path mapping, it can be
  29436. // referenced as the "underscore" module.
  29437. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  29438. return _;
  29439. }).call(exports, __webpack_require__, exports, module),
  29440. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  29441. }
  29442. // Check for `exports` after `define` in case a build optimizer adds it.
  29443. else if (freeModule) {
  29444. // Export for Node.js.
  29445. (freeModule.exports = _)._ = _;
  29446. // Export for CommonJS support.
  29447. freeExports._ = _;
  29448. }
  29449. else {
  29450. // Export to the global object.
  29451. root._ = _;
  29452. }
  29453. }.call(this));
  29454. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/webpack/buildin/global.js"), __webpack_require__("./node_modules/webpack/buildin/module.js")(module)))
  29455. /***/ }),
  29456. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  29457. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  29458. "use strict";
  29459. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  29460. /* WEBPACK VAR INJECTION */(function(global) {/**!
  29461. * @fileOverview Kickass library to create and place poppers near their reference elements.
  29462. * @version 1.14.7
  29463. * @license
  29464. * Copyright (c) 2016 Federico Zivolo and contributors
  29465. *
  29466. * Permission is hereby granted, free of charge, to any person obtaining a copy
  29467. * of this software and associated documentation files (the "Software"), to deal
  29468. * in the Software without restriction, including without limitation the rights
  29469. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  29470. * copies of the Software, and to permit persons to whom the Software is
  29471. * furnished to do so, subject to the following conditions:
  29472. *
  29473. * The above copyright notice and this permission notice shall be included in all
  29474. * copies or substantial portions of the Software.
  29475. *
  29476. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  29477. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  29478. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  29479. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  29480. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  29481. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  29482. * SOFTWARE.
  29483. */
  29484. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
  29485. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  29486. var timeoutDuration = 0;
  29487. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  29488. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  29489. timeoutDuration = 1;
  29490. break;
  29491. }
  29492. }
  29493. function microtaskDebounce(fn) {
  29494. var called = false;
  29495. return function () {
  29496. if (called) {
  29497. return;
  29498. }
  29499. called = true;
  29500. window.Promise.resolve().then(function () {
  29501. called = false;
  29502. fn();
  29503. });
  29504. };
  29505. }
  29506. function taskDebounce(fn) {
  29507. var scheduled = false;
  29508. return function () {
  29509. if (!scheduled) {
  29510. scheduled = true;
  29511. setTimeout(function () {
  29512. scheduled = false;
  29513. fn();
  29514. }, timeoutDuration);
  29515. }
  29516. };
  29517. }
  29518. var supportsMicroTasks = isBrowser && window.Promise;
  29519. /**
  29520. * Create a debounced version of a method, that's asynchronously deferred
  29521. * but called in the minimum time possible.
  29522. *
  29523. * @method
  29524. * @memberof Popper.Utils
  29525. * @argument {Function} fn
  29526. * @returns {Function}
  29527. */
  29528. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  29529. /**
  29530. * Check if the given variable is a function
  29531. * @method
  29532. * @memberof Popper.Utils
  29533. * @argument {Any} functionToCheck - variable to check
  29534. * @returns {Boolean} answer to: is a function?
  29535. */
  29536. function isFunction(functionToCheck) {
  29537. var getType = {};
  29538. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  29539. }
  29540. /**
  29541. * Get CSS computed property of the given element
  29542. * @method
  29543. * @memberof Popper.Utils
  29544. * @argument {Eement} element
  29545. * @argument {String} property
  29546. */
  29547. function getStyleComputedProperty(element, property) {
  29548. if (element.nodeType !== 1) {
  29549. return [];
  29550. }
  29551. // NOTE: 1 DOM access here
  29552. var window = element.ownerDocument.defaultView;
  29553. var css = window.getComputedStyle(element, null);
  29554. return property ? css[property] : css;
  29555. }
  29556. /**
  29557. * Returns the parentNode or the host of the element
  29558. * @method
  29559. * @memberof Popper.Utils
  29560. * @argument {Element} element
  29561. * @returns {Element} parent
  29562. */
  29563. function getParentNode(element) {
  29564. if (element.nodeName === 'HTML') {
  29565. return element;
  29566. }
  29567. return element.parentNode || element.host;
  29568. }
  29569. /**
  29570. * Returns the scrolling parent of the given element
  29571. * @method
  29572. * @memberof Popper.Utils
  29573. * @argument {Element} element
  29574. * @returns {Element} scroll parent
  29575. */
  29576. function getScrollParent(element) {
  29577. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  29578. if (!element) {
  29579. return document.body;
  29580. }
  29581. switch (element.nodeName) {
  29582. case 'HTML':
  29583. case 'BODY':
  29584. return element.ownerDocument.body;
  29585. case '#document':
  29586. return element.body;
  29587. }
  29588. // Firefox want us to check `-x` and `-y` variations as well
  29589. var _getStyleComputedProp = getStyleComputedProperty(element),
  29590. overflow = _getStyleComputedProp.overflow,
  29591. overflowX = _getStyleComputedProp.overflowX,
  29592. overflowY = _getStyleComputedProp.overflowY;
  29593. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  29594. return element;
  29595. }
  29596. return getScrollParent(getParentNode(element));
  29597. }
  29598. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  29599. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  29600. /**
  29601. * Determines if the browser is Internet Explorer
  29602. * @method
  29603. * @memberof Popper.Utils
  29604. * @param {Number} version to check
  29605. * @returns {Boolean} isIE
  29606. */
  29607. function isIE(version) {
  29608. if (version === 11) {
  29609. return isIE11;
  29610. }
  29611. if (version === 10) {
  29612. return isIE10;
  29613. }
  29614. return isIE11 || isIE10;
  29615. }
  29616. /**
  29617. * Returns the offset parent of the given element
  29618. * @method
  29619. * @memberof Popper.Utils
  29620. * @argument {Element} element
  29621. * @returns {Element} offset parent
  29622. */
  29623. function getOffsetParent(element) {
  29624. if (!element) {
  29625. return document.documentElement;
  29626. }
  29627. var noOffsetParent = isIE(10) ? document.body : null;
  29628. // NOTE: 1 DOM access here
  29629. var offsetParent = element.offsetParent || null;
  29630. // Skip hidden elements which don't have an offsetParent
  29631. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  29632. offsetParent = (element = element.nextElementSibling).offsetParent;
  29633. }
  29634. var nodeName = offsetParent && offsetParent.nodeName;
  29635. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  29636. return element ? element.ownerDocument.documentElement : document.documentElement;
  29637. }
  29638. // .offsetParent will return the closest TH, TD or TABLE in case
  29639. // no offsetParent is present, I hate this job...
  29640. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  29641. return getOffsetParent(offsetParent);
  29642. }
  29643. return offsetParent;
  29644. }
  29645. function isOffsetContainer(element) {
  29646. var nodeName = element.nodeName;
  29647. if (nodeName === 'BODY') {
  29648. return false;
  29649. }
  29650. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  29651. }
  29652. /**
  29653. * Finds the root node (document, shadowDOM root) of the given element
  29654. * @method
  29655. * @memberof Popper.Utils
  29656. * @argument {Element} node
  29657. * @returns {Element} root node
  29658. */
  29659. function getRoot(node) {
  29660. if (node.parentNode !== null) {
  29661. return getRoot(node.parentNode);
  29662. }
  29663. return node;
  29664. }
  29665. /**
  29666. * Finds the offset parent common to the two provided nodes
  29667. * @method
  29668. * @memberof Popper.Utils
  29669. * @argument {Element} element1
  29670. * @argument {Element} element2
  29671. * @returns {Element} common offset parent
  29672. */
  29673. function findCommonOffsetParent(element1, element2) {
  29674. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  29675. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  29676. return document.documentElement;
  29677. }
  29678. // Here we make sure to give as "start" the element that comes first in the DOM
  29679. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  29680. var start = order ? element1 : element2;
  29681. var end = order ? element2 : element1;
  29682. // Get common ancestor container
  29683. var range = document.createRange();
  29684. range.setStart(start, 0);
  29685. range.setEnd(end, 0);
  29686. var commonAncestorContainer = range.commonAncestorContainer;
  29687. // Both nodes are inside #document
  29688. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  29689. if (isOffsetContainer(commonAncestorContainer)) {
  29690. return commonAncestorContainer;
  29691. }
  29692. return getOffsetParent(commonAncestorContainer);
  29693. }
  29694. // one of the nodes is inside shadowDOM, find which one
  29695. var element1root = getRoot(element1);
  29696. if (element1root.host) {
  29697. return findCommonOffsetParent(element1root.host, element2);
  29698. } else {
  29699. return findCommonOffsetParent(element1, getRoot(element2).host);
  29700. }
  29701. }
  29702. /**
  29703. * Gets the scroll value of the given element in the given side (top and left)
  29704. * @method
  29705. * @memberof Popper.Utils
  29706. * @argument {Element} element
  29707. * @argument {String} side `top` or `left`
  29708. * @returns {number} amount of scrolled pixels
  29709. */
  29710. function getScroll(element) {
  29711. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  29712. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  29713. var nodeName = element.nodeName;
  29714. if (nodeName === 'BODY' || nodeName === 'HTML') {
  29715. var html = element.ownerDocument.documentElement;
  29716. var scrollingElement = element.ownerDocument.scrollingElement || html;
  29717. return scrollingElement[upperSide];
  29718. }
  29719. return element[upperSide];
  29720. }
  29721. /*
  29722. * Sum or subtract the element scroll values (left and top) from a given rect object
  29723. * @method
  29724. * @memberof Popper.Utils
  29725. * @param {Object} rect - Rect object you want to change
  29726. * @param {HTMLElement} element - The element from the function reads the scroll values
  29727. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  29728. * @return {Object} rect - The modifier rect object
  29729. */
  29730. function includeScroll(rect, element) {
  29731. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  29732. var scrollTop = getScroll(element, 'top');
  29733. var scrollLeft = getScroll(element, 'left');
  29734. var modifier = subtract ? -1 : 1;
  29735. rect.top += scrollTop * modifier;
  29736. rect.bottom += scrollTop * modifier;
  29737. rect.left += scrollLeft * modifier;
  29738. rect.right += scrollLeft * modifier;
  29739. return rect;
  29740. }
  29741. /*
  29742. * Helper to detect borders of a given element
  29743. * @method
  29744. * @memberof Popper.Utils
  29745. * @param {CSSStyleDeclaration} styles
  29746. * Result of `getStyleComputedProperty` on the given element
  29747. * @param {String} axis - `x` or `y`
  29748. * @return {number} borders - The borders size of the given axis
  29749. */
  29750. function getBordersSize(styles, axis) {
  29751. var sideA = axis === 'x' ? 'Left' : 'Top';
  29752. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  29753. return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10);
  29754. }
  29755. function getSize(axis, body, html, computedStyle) {
  29756. 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);
  29757. }
  29758. function getWindowSizes(document) {
  29759. var body = document.body;
  29760. var html = document.documentElement;
  29761. var computedStyle = isIE(10) && getComputedStyle(html);
  29762. return {
  29763. height: getSize('Height', body, html, computedStyle),
  29764. width: getSize('Width', body, html, computedStyle)
  29765. };
  29766. }
  29767. var classCallCheck = function (instance, Constructor) {
  29768. if (!(instance instanceof Constructor)) {
  29769. throw new TypeError("Cannot call a class as a function");
  29770. }
  29771. };
  29772. var createClass = function () {
  29773. function defineProperties(target, props) {
  29774. for (var i = 0; i < props.length; i++) {
  29775. var descriptor = props[i];
  29776. descriptor.enumerable = descriptor.enumerable || false;
  29777. descriptor.configurable = true;
  29778. if ("value" in descriptor) descriptor.writable = true;
  29779. Object.defineProperty(target, descriptor.key, descriptor);
  29780. }
  29781. }
  29782. return function (Constructor, protoProps, staticProps) {
  29783. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  29784. if (staticProps) defineProperties(Constructor, staticProps);
  29785. return Constructor;
  29786. };
  29787. }();
  29788. var defineProperty = function (obj, key, value) {
  29789. if (key in obj) {
  29790. Object.defineProperty(obj, key, {
  29791. value: value,
  29792. enumerable: true,
  29793. configurable: true,
  29794. writable: true
  29795. });
  29796. } else {
  29797. obj[key] = value;
  29798. }
  29799. return obj;
  29800. };
  29801. var _extends = Object.assign || function (target) {
  29802. for (var i = 1; i < arguments.length; i++) {
  29803. var source = arguments[i];
  29804. for (var key in source) {
  29805. if (Object.prototype.hasOwnProperty.call(source, key)) {
  29806. target[key] = source[key];
  29807. }
  29808. }
  29809. }
  29810. return target;
  29811. };
  29812. /**
  29813. * Given element offsets, generate an output similar to getBoundingClientRect
  29814. * @method
  29815. * @memberof Popper.Utils
  29816. * @argument {Object} offsets
  29817. * @returns {Object} ClientRect like output
  29818. */
  29819. function getClientRect(offsets) {
  29820. return _extends({}, offsets, {
  29821. right: offsets.left + offsets.width,
  29822. bottom: offsets.top + offsets.height
  29823. });
  29824. }
  29825. /**
  29826. * Get bounding client rect of given element
  29827. * @method
  29828. * @memberof Popper.Utils
  29829. * @param {HTMLElement} element
  29830. * @return {Object} client rect
  29831. */
  29832. function getBoundingClientRect(element) {
  29833. var rect = {};
  29834. // IE10 10 FIX: Please, don't ask, the element isn't
  29835. // considered in DOM in some circumstances...
  29836. // This isn't reproducible in IE10 compatibility mode of IE11
  29837. try {
  29838. if (isIE(10)) {
  29839. rect = element.getBoundingClientRect();
  29840. var scrollTop = getScroll(element, 'top');
  29841. var scrollLeft = getScroll(element, 'left');
  29842. rect.top += scrollTop;
  29843. rect.left += scrollLeft;
  29844. rect.bottom += scrollTop;
  29845. rect.right += scrollLeft;
  29846. } else {
  29847. rect = element.getBoundingClientRect();
  29848. }
  29849. } catch (e) {}
  29850. var result = {
  29851. left: rect.left,
  29852. top: rect.top,
  29853. width: rect.right - rect.left,
  29854. height: rect.bottom - rect.top
  29855. };
  29856. // subtract scrollbar size from sizes
  29857. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  29858. var width = sizes.width || element.clientWidth || result.right - result.left;
  29859. var height = sizes.height || element.clientHeight || result.bottom - result.top;
  29860. var horizScrollbar = element.offsetWidth - width;
  29861. var vertScrollbar = element.offsetHeight - height;
  29862. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  29863. // we make this check conditional for performance reasons
  29864. if (horizScrollbar || vertScrollbar) {
  29865. var styles = getStyleComputedProperty(element);
  29866. horizScrollbar -= getBordersSize(styles, 'x');
  29867. vertScrollbar -= getBordersSize(styles, 'y');
  29868. result.width -= horizScrollbar;
  29869. result.height -= vertScrollbar;
  29870. }
  29871. return getClientRect(result);
  29872. }
  29873. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  29874. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  29875. var isIE10 = isIE(10);
  29876. var isHTML = parent.nodeName === 'HTML';
  29877. var childrenRect = getBoundingClientRect(children);
  29878. var parentRect = getBoundingClientRect(parent);
  29879. var scrollParent = getScrollParent(children);
  29880. var styles = getStyleComputedProperty(parent);
  29881. var borderTopWidth = parseFloat(styles.borderTopWidth, 10);
  29882. var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10);
  29883. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  29884. if (fixedPosition && isHTML) {
  29885. parentRect.top = Math.max(parentRect.top, 0);
  29886. parentRect.left = Math.max(parentRect.left, 0);
  29887. }
  29888. var offsets = getClientRect({
  29889. top: childrenRect.top - parentRect.top - borderTopWidth,
  29890. left: childrenRect.left - parentRect.left - borderLeftWidth,
  29891. width: childrenRect.width,
  29892. height: childrenRect.height
  29893. });
  29894. offsets.marginTop = 0;
  29895. offsets.marginLeft = 0;
  29896. // Subtract margins of documentElement in case it's being used as parent
  29897. // we do this only on HTML because it's the only element that behaves
  29898. // differently when margins are applied to it. The margins are included in
  29899. // the box of the documentElement, in the other cases not.
  29900. if (!isIE10 && isHTML) {
  29901. var marginTop = parseFloat(styles.marginTop, 10);
  29902. var marginLeft = parseFloat(styles.marginLeft, 10);
  29903. offsets.top -= borderTopWidth - marginTop;
  29904. offsets.bottom -= borderTopWidth - marginTop;
  29905. offsets.left -= borderLeftWidth - marginLeft;
  29906. offsets.right -= borderLeftWidth - marginLeft;
  29907. // Attach marginTop and marginLeft because in some circumstances we may need them
  29908. offsets.marginTop = marginTop;
  29909. offsets.marginLeft = marginLeft;
  29910. }
  29911. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  29912. offsets = includeScroll(offsets, parent);
  29913. }
  29914. return offsets;
  29915. }
  29916. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  29917. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  29918. var html = element.ownerDocument.documentElement;
  29919. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  29920. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  29921. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  29922. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  29923. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  29924. var offset = {
  29925. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  29926. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  29927. width: width,
  29928. height: height
  29929. };
  29930. return getClientRect(offset);
  29931. }
  29932. /**
  29933. * Check if the given element is fixed or is inside a fixed parent
  29934. * @method
  29935. * @memberof Popper.Utils
  29936. * @argument {Element} element
  29937. * @argument {Element} customContainer
  29938. * @returns {Boolean} answer to "isFixed?"
  29939. */
  29940. function isFixed(element) {
  29941. var nodeName = element.nodeName;
  29942. if (nodeName === 'BODY' || nodeName === 'HTML') {
  29943. return false;
  29944. }
  29945. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  29946. return true;
  29947. }
  29948. var parentNode = getParentNode(element);
  29949. if (!parentNode) {
  29950. return false;
  29951. }
  29952. return isFixed(parentNode);
  29953. }
  29954. /**
  29955. * Finds the first parent of an element that has a transformed property defined
  29956. * @method
  29957. * @memberof Popper.Utils
  29958. * @argument {Element} element
  29959. * @returns {Element} first transformed parent or documentElement
  29960. */
  29961. function getFixedPositionOffsetParent(element) {
  29962. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  29963. if (!element || !element.parentElement || isIE()) {
  29964. return document.documentElement;
  29965. }
  29966. var el = element.parentElement;
  29967. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  29968. el = el.parentElement;
  29969. }
  29970. return el || document.documentElement;
  29971. }
  29972. /**
  29973. * Computed the boundaries limits and return them
  29974. * @method
  29975. * @memberof Popper.Utils
  29976. * @param {HTMLElement} popper
  29977. * @param {HTMLElement} reference
  29978. * @param {number} padding
  29979. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  29980. * @param {Boolean} fixedPosition - Is in fixed position mode
  29981. * @returns {Object} Coordinates of the boundaries
  29982. */
  29983. function getBoundaries(popper, reference, padding, boundariesElement) {
  29984. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  29985. // NOTE: 1 DOM access here
  29986. var boundaries = { top: 0, left: 0 };
  29987. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
  29988. // Handle viewport case
  29989. if (boundariesElement === 'viewport') {
  29990. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  29991. } else {
  29992. // Handle other cases based on DOM element used as boundaries
  29993. var boundariesNode = void 0;
  29994. if (boundariesElement === 'scrollParent') {
  29995. boundariesNode = getScrollParent(getParentNode(reference));
  29996. if (boundariesNode.nodeName === 'BODY') {
  29997. boundariesNode = popper.ownerDocument.documentElement;
  29998. }
  29999. } else if (boundariesElement === 'window') {
  30000. boundariesNode = popper.ownerDocument.documentElement;
  30001. } else {
  30002. boundariesNode = boundariesElement;
  30003. }
  30004. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  30005. // In case of HTML, we need a different computation
  30006. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  30007. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  30008. height = _getWindowSizes.height,
  30009. width = _getWindowSizes.width;
  30010. boundaries.top += offsets.top - offsets.marginTop;
  30011. boundaries.bottom = height + offsets.top;
  30012. boundaries.left += offsets.left - offsets.marginLeft;
  30013. boundaries.right = width + offsets.left;
  30014. } else {
  30015. // for all the other DOM elements, this one is good
  30016. boundaries = offsets;
  30017. }
  30018. }
  30019. // Add paddings
  30020. padding = padding || 0;
  30021. var isPaddingNumber = typeof padding === 'number';
  30022. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  30023. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  30024. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  30025. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  30026. return boundaries;
  30027. }
  30028. function getArea(_ref) {
  30029. var width = _ref.width,
  30030. height = _ref.height;
  30031. return width * height;
  30032. }
  30033. /**
  30034. * Utility used to transform the `auto` placement to the placement with more
  30035. * available space.
  30036. * @method
  30037. * @memberof Popper.Utils
  30038. * @argument {Object} data - The data object generated by update method
  30039. * @argument {Object} options - Modifiers configuration and options
  30040. * @returns {Object} The data object, properly modified
  30041. */
  30042. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  30043. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  30044. if (placement.indexOf('auto') === -1) {
  30045. return placement;
  30046. }
  30047. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  30048. var rects = {
  30049. top: {
  30050. width: boundaries.width,
  30051. height: refRect.top - boundaries.top
  30052. },
  30053. right: {
  30054. width: boundaries.right - refRect.right,
  30055. height: boundaries.height
  30056. },
  30057. bottom: {
  30058. width: boundaries.width,
  30059. height: boundaries.bottom - refRect.bottom
  30060. },
  30061. left: {
  30062. width: refRect.left - boundaries.left,
  30063. height: boundaries.height
  30064. }
  30065. };
  30066. var sortedAreas = Object.keys(rects).map(function (key) {
  30067. return _extends({
  30068. key: key
  30069. }, rects[key], {
  30070. area: getArea(rects[key])
  30071. });
  30072. }).sort(function (a, b) {
  30073. return b.area - a.area;
  30074. });
  30075. var filteredAreas = sortedAreas.filter(function (_ref2) {
  30076. var width = _ref2.width,
  30077. height = _ref2.height;
  30078. return width >= popper.clientWidth && height >= popper.clientHeight;
  30079. });
  30080. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  30081. var variation = placement.split('-')[1];
  30082. return computedPlacement + (variation ? '-' + variation : '');
  30083. }
  30084. /**
  30085. * Get offsets to the reference element
  30086. * @method
  30087. * @memberof Popper.Utils
  30088. * @param {Object} state
  30089. * @param {Element} popper - the popper element
  30090. * @param {Element} reference - the reference element (the popper will be relative to this)
  30091. * @param {Element} fixedPosition - is in fixed position mode
  30092. * @returns {Object} An object containing the offsets which will be applied to the popper
  30093. */
  30094. function getReferenceOffsets(state, popper, reference) {
  30095. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  30096. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
  30097. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  30098. }
  30099. /**
  30100. * Get the outer sizes of the given element (offset size + margins)
  30101. * @method
  30102. * @memberof Popper.Utils
  30103. * @argument {Element} element
  30104. * @returns {Object} object containing width and height properties
  30105. */
  30106. function getOuterSizes(element) {
  30107. var window = element.ownerDocument.defaultView;
  30108. var styles = window.getComputedStyle(element);
  30109. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  30110. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  30111. var result = {
  30112. width: element.offsetWidth + y,
  30113. height: element.offsetHeight + x
  30114. };
  30115. return result;
  30116. }
  30117. /**
  30118. * Get the opposite placement of the given one
  30119. * @method
  30120. * @memberof Popper.Utils
  30121. * @argument {String} placement
  30122. * @returns {String} flipped placement
  30123. */
  30124. function getOppositePlacement(placement) {
  30125. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  30126. return placement.replace(/left|right|bottom|top/g, function (matched) {
  30127. return hash[matched];
  30128. });
  30129. }
  30130. /**
  30131. * Get offsets to the popper
  30132. * @method
  30133. * @memberof Popper.Utils
  30134. * @param {Object} position - CSS position the Popper will get applied
  30135. * @param {HTMLElement} popper - the popper element
  30136. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  30137. * @param {String} placement - one of the valid placement options
  30138. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  30139. */
  30140. function getPopperOffsets(popper, referenceOffsets, placement) {
  30141. placement = placement.split('-')[0];
  30142. // Get popper node sizes
  30143. var popperRect = getOuterSizes(popper);
  30144. // Add position, width and height to our offsets object
  30145. var popperOffsets = {
  30146. width: popperRect.width,
  30147. height: popperRect.height
  30148. };
  30149. // depending by the popper placement we have to compute its offsets slightly differently
  30150. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  30151. var mainSide = isHoriz ? 'top' : 'left';
  30152. var secondarySide = isHoriz ? 'left' : 'top';
  30153. var measurement = isHoriz ? 'height' : 'width';
  30154. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  30155. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  30156. if (placement === secondarySide) {
  30157. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  30158. } else {
  30159. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  30160. }
  30161. return popperOffsets;
  30162. }
  30163. /**
  30164. * Mimics the `find` method of Array
  30165. * @method
  30166. * @memberof Popper.Utils
  30167. * @argument {Array} arr
  30168. * @argument prop
  30169. * @argument value
  30170. * @returns index or -1
  30171. */
  30172. function find(arr, check) {
  30173. // use native find if supported
  30174. if (Array.prototype.find) {
  30175. return arr.find(check);
  30176. }
  30177. // use `filter` to obtain the same behavior of `find`
  30178. return arr.filter(check)[0];
  30179. }
  30180. /**
  30181. * Return the index of the matching object
  30182. * @method
  30183. * @memberof Popper.Utils
  30184. * @argument {Array} arr
  30185. * @argument prop
  30186. * @argument value
  30187. * @returns index or -1
  30188. */
  30189. function findIndex(arr, prop, value) {
  30190. // use native findIndex if supported
  30191. if (Array.prototype.findIndex) {
  30192. return arr.findIndex(function (cur) {
  30193. return cur[prop] === value;
  30194. });
  30195. }
  30196. // use `find` + `indexOf` if `findIndex` isn't supported
  30197. var match = find(arr, function (obj) {
  30198. return obj[prop] === value;
  30199. });
  30200. return arr.indexOf(match);
  30201. }
  30202. /**
  30203. * Loop trough the list of modifiers and run them in order,
  30204. * each of them will then edit the data object.
  30205. * @method
  30206. * @memberof Popper.Utils
  30207. * @param {dataObject} data
  30208. * @param {Array} modifiers
  30209. * @param {String} ends - Optional modifier name used as stopper
  30210. * @returns {dataObject}
  30211. */
  30212. function runModifiers(modifiers, data, ends) {
  30213. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  30214. modifiersToRun.forEach(function (modifier) {
  30215. if (modifier['function']) {
  30216. // eslint-disable-line dot-notation
  30217. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  30218. }
  30219. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  30220. if (modifier.enabled && isFunction(fn)) {
  30221. // Add properties to offsets to make them a complete clientRect object
  30222. // we do this before each modifier to make sure the previous one doesn't
  30223. // mess with these values
  30224. data.offsets.popper = getClientRect(data.offsets.popper);
  30225. data.offsets.reference = getClientRect(data.offsets.reference);
  30226. data = fn(data, modifier);
  30227. }
  30228. });
  30229. return data;
  30230. }
  30231. /**
  30232. * Updates the position of the popper, computing the new offsets and applying
  30233. * the new style.<br />
  30234. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  30235. * @method
  30236. * @memberof Popper
  30237. */
  30238. function update() {
  30239. // if popper is destroyed, don't perform any further update
  30240. if (this.state.isDestroyed) {
  30241. return;
  30242. }
  30243. var data = {
  30244. instance: this,
  30245. styles: {},
  30246. arrowStyles: {},
  30247. attributes: {},
  30248. flipped: false,
  30249. offsets: {}
  30250. };
  30251. // compute reference element offsets
  30252. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  30253. // compute auto placement, store placement inside the data object,
  30254. // modifiers will be able to edit `placement` if needed
  30255. // and refer to originalPlacement to know the original value
  30256. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  30257. // store the computed placement inside `originalPlacement`
  30258. data.originalPlacement = data.placement;
  30259. data.positionFixed = this.options.positionFixed;
  30260. // compute the popper offsets
  30261. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  30262. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  30263. // run the modifiers
  30264. data = runModifiers(this.modifiers, data);
  30265. // the first `update` will call `onCreate` callback
  30266. // the other ones will call `onUpdate` callback
  30267. if (!this.state.isCreated) {
  30268. this.state.isCreated = true;
  30269. this.options.onCreate(data);
  30270. } else {
  30271. this.options.onUpdate(data);
  30272. }
  30273. }
  30274. /**
  30275. * Helper used to know if the given modifier is enabled.
  30276. * @method
  30277. * @memberof Popper.Utils
  30278. * @returns {Boolean}
  30279. */
  30280. function isModifierEnabled(modifiers, modifierName) {
  30281. return modifiers.some(function (_ref) {
  30282. var name = _ref.name,
  30283. enabled = _ref.enabled;
  30284. return enabled && name === modifierName;
  30285. });
  30286. }
  30287. /**
  30288. * Get the prefixed supported property name
  30289. * @method
  30290. * @memberof Popper.Utils
  30291. * @argument {String} property (camelCase)
  30292. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  30293. */
  30294. function getSupportedPropertyName(property) {
  30295. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  30296. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  30297. for (var i = 0; i < prefixes.length; i++) {
  30298. var prefix = prefixes[i];
  30299. var toCheck = prefix ? '' + prefix + upperProp : property;
  30300. if (typeof document.body.style[toCheck] !== 'undefined') {
  30301. return toCheck;
  30302. }
  30303. }
  30304. return null;
  30305. }
  30306. /**
  30307. * Destroys the popper.
  30308. * @method
  30309. * @memberof Popper
  30310. */
  30311. function destroy() {
  30312. this.state.isDestroyed = true;
  30313. // touch DOM only if `applyStyle` modifier is enabled
  30314. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  30315. this.popper.removeAttribute('x-placement');
  30316. this.popper.style.position = '';
  30317. this.popper.style.top = '';
  30318. this.popper.style.left = '';
  30319. this.popper.style.right = '';
  30320. this.popper.style.bottom = '';
  30321. this.popper.style.willChange = '';
  30322. this.popper.style[getSupportedPropertyName('transform')] = '';
  30323. }
  30324. this.disableEventListeners();
  30325. // remove the popper if user explicity asked for the deletion on destroy
  30326. // do not use `remove` because IE11 doesn't support it
  30327. if (this.options.removeOnDestroy) {
  30328. this.popper.parentNode.removeChild(this.popper);
  30329. }
  30330. return this;
  30331. }
  30332. /**
  30333. * Get the window associated with the element
  30334. * @argument {Element} element
  30335. * @returns {Window}
  30336. */
  30337. function getWindow(element) {
  30338. var ownerDocument = element.ownerDocument;
  30339. return ownerDocument ? ownerDocument.defaultView : window;
  30340. }
  30341. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  30342. var isBody = scrollParent.nodeName === 'BODY';
  30343. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  30344. target.addEventListener(event, callback, { passive: true });
  30345. if (!isBody) {
  30346. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  30347. }
  30348. scrollParents.push(target);
  30349. }
  30350. /**
  30351. * Setup needed event listeners used to update the popper position
  30352. * @method
  30353. * @memberof Popper.Utils
  30354. * @private
  30355. */
  30356. function setupEventListeners(reference, options, state, updateBound) {
  30357. // Resize event listener on window
  30358. state.updateBound = updateBound;
  30359. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  30360. // Scroll event listener on scroll parents
  30361. var scrollElement = getScrollParent(reference);
  30362. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  30363. state.scrollElement = scrollElement;
  30364. state.eventsEnabled = true;
  30365. return state;
  30366. }
  30367. /**
  30368. * It will add resize/scroll events and start recalculating
  30369. * position of the popper element when they are triggered.
  30370. * @method
  30371. * @memberof Popper
  30372. */
  30373. function enableEventListeners() {
  30374. if (!this.state.eventsEnabled) {
  30375. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  30376. }
  30377. }
  30378. /**
  30379. * Remove event listeners used to update the popper position
  30380. * @method
  30381. * @memberof Popper.Utils
  30382. * @private
  30383. */
  30384. function removeEventListeners(reference, state) {
  30385. // Remove resize event listener on window
  30386. getWindow(reference).removeEventListener('resize', state.updateBound);
  30387. // Remove scroll event listener on scroll parents
  30388. state.scrollParents.forEach(function (target) {
  30389. target.removeEventListener('scroll', state.updateBound);
  30390. });
  30391. // Reset state
  30392. state.updateBound = null;
  30393. state.scrollParents = [];
  30394. state.scrollElement = null;
  30395. state.eventsEnabled = false;
  30396. return state;
  30397. }
  30398. /**
  30399. * It will remove resize/scroll events and won't recalculate popper position
  30400. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  30401. * unless you call `update` method manually.
  30402. * @method
  30403. * @memberof Popper
  30404. */
  30405. function disableEventListeners() {
  30406. if (this.state.eventsEnabled) {
  30407. cancelAnimationFrame(this.scheduleUpdate);
  30408. this.state = removeEventListeners(this.reference, this.state);
  30409. }
  30410. }
  30411. /**
  30412. * Tells if a given input is a number
  30413. * @method
  30414. * @memberof Popper.Utils
  30415. * @param {*} input to check
  30416. * @return {Boolean}
  30417. */
  30418. function isNumeric(n) {
  30419. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  30420. }
  30421. /**
  30422. * Set the style to the given popper
  30423. * @method
  30424. * @memberof Popper.Utils
  30425. * @argument {Element} element - Element to apply the style to
  30426. * @argument {Object} styles
  30427. * Object with a list of properties and values which will be applied to the element
  30428. */
  30429. function setStyles(element, styles) {
  30430. Object.keys(styles).forEach(function (prop) {
  30431. var unit = '';
  30432. // add unit if the value is numeric and is one of the following
  30433. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  30434. unit = 'px';
  30435. }
  30436. element.style[prop] = styles[prop] + unit;
  30437. });
  30438. }
  30439. /**
  30440. * Set the attributes to the given popper
  30441. * @method
  30442. * @memberof Popper.Utils
  30443. * @argument {Element} element - Element to apply the attributes to
  30444. * @argument {Object} styles
  30445. * Object with a list of properties and values which will be applied to the element
  30446. */
  30447. function setAttributes(element, attributes) {
  30448. Object.keys(attributes).forEach(function (prop) {
  30449. var value = attributes[prop];
  30450. if (value !== false) {
  30451. element.setAttribute(prop, attributes[prop]);
  30452. } else {
  30453. element.removeAttribute(prop);
  30454. }
  30455. });
  30456. }
  30457. /**
  30458. * @function
  30459. * @memberof Modifiers
  30460. * @argument {Object} data - The data object generated by `update` method
  30461. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  30462. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  30463. * @argument {Object} options - Modifiers configuration and options
  30464. * @returns {Object} The same data object
  30465. */
  30466. function applyStyle(data) {
  30467. // any property present in `data.styles` will be applied to the popper,
  30468. // in this way we can make the 3rd party modifiers add custom styles to it
  30469. // Be aware, modifiers could override the properties defined in the previous
  30470. // lines of this modifier!
  30471. setStyles(data.instance.popper, data.styles);
  30472. // any property present in `data.attributes` will be applied to the popper,
  30473. // they will be set as HTML attributes of the element
  30474. setAttributes(data.instance.popper, data.attributes);
  30475. // if arrowElement is defined and arrowStyles has some properties
  30476. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  30477. setStyles(data.arrowElement, data.arrowStyles);
  30478. }
  30479. return data;
  30480. }
  30481. /**
  30482. * Set the x-placement attribute before everything else because it could be used
  30483. * to add margins to the popper margins needs to be calculated to get the
  30484. * correct popper offsets.
  30485. * @method
  30486. * @memberof Popper.modifiers
  30487. * @param {HTMLElement} reference - The reference element used to position the popper
  30488. * @param {HTMLElement} popper - The HTML element used as popper
  30489. * @param {Object} options - Popper.js options
  30490. */
  30491. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  30492. // compute reference element offsets
  30493. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  30494. // compute auto placement, store placement inside the data object,
  30495. // modifiers will be able to edit `placement` if needed
  30496. // and refer to originalPlacement to know the original value
  30497. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  30498. popper.setAttribute('x-placement', placement);
  30499. // Apply `position` to popper before anything else because
  30500. // without the position applied we can't guarantee correct computations
  30501. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  30502. return options;
  30503. }
  30504. /**
  30505. * @function
  30506. * @memberof Popper.Utils
  30507. * @argument {Object} data - The data object generated by `update` method
  30508. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  30509. * @returns {Object} The popper's position offsets rounded
  30510. *
  30511. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  30512. * good as it can be within reason.
  30513. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  30514. *
  30515. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  30516. * as well on High DPI screens).
  30517. *
  30518. * Firefox prefers no rounding for positioning and does not have blurriness on
  30519. * high DPI screens.
  30520. *
  30521. * Only horizontal placement and left/right values need to be considered.
  30522. */
  30523. function getRoundedOffsets(data, shouldRound) {
  30524. var _data$offsets = data.offsets,
  30525. popper = _data$offsets.popper,
  30526. reference = _data$offsets.reference;
  30527. var round = Math.round,
  30528. floor = Math.floor;
  30529. var noRound = function noRound(v) {
  30530. return v;
  30531. };
  30532. var referenceWidth = round(reference.width);
  30533. var popperWidth = round(popper.width);
  30534. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  30535. var isVariation = data.placement.indexOf('-') !== -1;
  30536. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  30537. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  30538. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  30539. var verticalToInteger = !shouldRound ? noRound : round;
  30540. return {
  30541. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  30542. top: verticalToInteger(popper.top),
  30543. bottom: verticalToInteger(popper.bottom),
  30544. right: horizontalToInteger(popper.right)
  30545. };
  30546. }
  30547. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  30548. /**
  30549. * @function
  30550. * @memberof Modifiers
  30551. * @argument {Object} data - The data object generated by `update` method
  30552. * @argument {Object} options - Modifiers configuration and options
  30553. * @returns {Object} The data object, properly modified
  30554. */
  30555. function computeStyle(data, options) {
  30556. var x = options.x,
  30557. y = options.y;
  30558. var popper = data.offsets.popper;
  30559. // Remove this legacy support in Popper.js v2
  30560. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  30561. return modifier.name === 'applyStyle';
  30562. }).gpuAcceleration;
  30563. if (legacyGpuAccelerationOption !== undefined) {
  30564. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  30565. }
  30566. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  30567. var offsetParent = getOffsetParent(data.instance.popper);
  30568. var offsetParentRect = getBoundingClientRect(offsetParent);
  30569. // Styles
  30570. var styles = {
  30571. position: popper.position
  30572. };
  30573. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  30574. var sideA = x === 'bottom' ? 'top' : 'bottom';
  30575. var sideB = y === 'right' ? 'left' : 'right';
  30576. // if gpuAcceleration is set to `true` and transform is supported,
  30577. // we use `translate3d` to apply the position to the popper we
  30578. // automatically use the supported prefixed version if needed
  30579. var prefixedProperty = getSupportedPropertyName('transform');
  30580. // now, let's make a step back and look at this code closely (wtf?)
  30581. // If the content of the popper grows once it's been positioned, it
  30582. // may happen that the popper gets misplaced because of the new content
  30583. // overflowing its reference element
  30584. // To avoid this problem, we provide two options (x and y), which allow
  30585. // the consumer to define the offset origin.
  30586. // If we position a popper on top of a reference element, we can set
  30587. // `x` to `top` to make the popper grow towards its top instead of
  30588. // its bottom.
  30589. var left = void 0,
  30590. top = void 0;
  30591. if (sideA === 'bottom') {
  30592. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  30593. // and not the bottom of the html element
  30594. if (offsetParent.nodeName === 'HTML') {
  30595. top = -offsetParent.clientHeight + offsets.bottom;
  30596. } else {
  30597. top = -offsetParentRect.height + offsets.bottom;
  30598. }
  30599. } else {
  30600. top = offsets.top;
  30601. }
  30602. if (sideB === 'right') {
  30603. if (offsetParent.nodeName === 'HTML') {
  30604. left = -offsetParent.clientWidth + offsets.right;
  30605. } else {
  30606. left = -offsetParentRect.width + offsets.right;
  30607. }
  30608. } else {
  30609. left = offsets.left;
  30610. }
  30611. if (gpuAcceleration && prefixedProperty) {
  30612. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  30613. styles[sideA] = 0;
  30614. styles[sideB] = 0;
  30615. styles.willChange = 'transform';
  30616. } else {
  30617. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  30618. var invertTop = sideA === 'bottom' ? -1 : 1;
  30619. var invertLeft = sideB === 'right' ? -1 : 1;
  30620. styles[sideA] = top * invertTop;
  30621. styles[sideB] = left * invertLeft;
  30622. styles.willChange = sideA + ', ' + sideB;
  30623. }
  30624. // Attributes
  30625. var attributes = {
  30626. 'x-placement': data.placement
  30627. };
  30628. // Update `data` attributes, styles and arrowStyles
  30629. data.attributes = _extends({}, attributes, data.attributes);
  30630. data.styles = _extends({}, styles, data.styles);
  30631. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  30632. return data;
  30633. }
  30634. /**
  30635. * Helper used to know if the given modifier depends from another one.<br />
  30636. * It checks if the needed modifier is listed and enabled.
  30637. * @method
  30638. * @memberof Popper.Utils
  30639. * @param {Array} modifiers - list of modifiers
  30640. * @param {String} requestingName - name of requesting modifier
  30641. * @param {String} requestedName - name of requested modifier
  30642. * @returns {Boolean}
  30643. */
  30644. function isModifierRequired(modifiers, requestingName, requestedName) {
  30645. var requesting = find(modifiers, function (_ref) {
  30646. var name = _ref.name;
  30647. return name === requestingName;
  30648. });
  30649. var isRequired = !!requesting && modifiers.some(function (modifier) {
  30650. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  30651. });
  30652. if (!isRequired) {
  30653. var _requesting = '`' + requestingName + '`';
  30654. var requested = '`' + requestedName + '`';
  30655. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  30656. }
  30657. return isRequired;
  30658. }
  30659. /**
  30660. * @function
  30661. * @memberof Modifiers
  30662. * @argument {Object} data - The data object generated by update method
  30663. * @argument {Object} options - Modifiers configuration and options
  30664. * @returns {Object} The data object, properly modified
  30665. */
  30666. function arrow(data, options) {
  30667. var _data$offsets$arrow;
  30668. // arrow depends on keepTogether in order to work
  30669. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  30670. return data;
  30671. }
  30672. var arrowElement = options.element;
  30673. // if arrowElement is a string, suppose it's a CSS selector
  30674. if (typeof arrowElement === 'string') {
  30675. arrowElement = data.instance.popper.querySelector(arrowElement);
  30676. // if arrowElement is not found, don't run the modifier
  30677. if (!arrowElement) {
  30678. return data;
  30679. }
  30680. } else {
  30681. // if the arrowElement isn't a query selector we must check that the
  30682. // provided DOM node is child of its popper node
  30683. if (!data.instance.popper.contains(arrowElement)) {
  30684. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  30685. return data;
  30686. }
  30687. }
  30688. var placement = data.placement.split('-')[0];
  30689. var _data$offsets = data.offsets,
  30690. popper = _data$offsets.popper,
  30691. reference = _data$offsets.reference;
  30692. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  30693. var len = isVertical ? 'height' : 'width';
  30694. var sideCapitalized = isVertical ? 'Top' : 'Left';
  30695. var side = sideCapitalized.toLowerCase();
  30696. var altSide = isVertical ? 'left' : 'top';
  30697. var opSide = isVertical ? 'bottom' : 'right';
  30698. var arrowElementSize = getOuterSizes(arrowElement)[len];
  30699. //
  30700. // extends keepTogether behavior making sure the popper and its
  30701. // reference have enough pixels in conjunction
  30702. //
  30703. // top/left side
  30704. if (reference[opSide] - arrowElementSize < popper[side]) {
  30705. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  30706. }
  30707. // bottom/right side
  30708. if (reference[side] + arrowElementSize > popper[opSide]) {
  30709. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  30710. }
  30711. data.offsets.popper = getClientRect(data.offsets.popper);
  30712. // compute center of the popper
  30713. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  30714. // Compute the sideValue using the updated popper offsets
  30715. // take popper margin in account because we don't have this info available
  30716. var css = getStyleComputedProperty(data.instance.popper);
  30717. var popperMarginSide = parseFloat(css['margin' + sideCapitalized], 10);
  30718. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10);
  30719. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  30720. // prevent arrowElement from being placed not contiguously to its popper
  30721. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  30722. data.arrowElement = arrowElement;
  30723. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  30724. return data;
  30725. }
  30726. /**
  30727. * Get the opposite placement variation of the given one
  30728. * @method
  30729. * @memberof Popper.Utils
  30730. * @argument {String} placement variation
  30731. * @returns {String} flipped placement variation
  30732. */
  30733. function getOppositeVariation(variation) {
  30734. if (variation === 'end') {
  30735. return 'start';
  30736. } else if (variation === 'start') {
  30737. return 'end';
  30738. }
  30739. return variation;
  30740. }
  30741. /**
  30742. * List of accepted placements to use as values of the `placement` option.<br />
  30743. * Valid placements are:
  30744. * - `auto`
  30745. * - `top`
  30746. * - `right`
  30747. * - `bottom`
  30748. * - `left`
  30749. *
  30750. * Each placement can have a variation from this list:
  30751. * - `-start`
  30752. * - `-end`
  30753. *
  30754. * Variations are interpreted easily if you think of them as the left to right
  30755. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  30756. * is right.<br />
  30757. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  30758. *
  30759. * Some valid examples are:
  30760. * - `top-end` (on top of reference, right aligned)
  30761. * - `right-start` (on right of reference, top aligned)
  30762. * - `bottom` (on bottom, centered)
  30763. * - `auto-end` (on the side with more space available, alignment depends by placement)
  30764. *
  30765. * @static
  30766. * @type {Array}
  30767. * @enum {String}
  30768. * @readonly
  30769. * @method placements
  30770. * @memberof Popper
  30771. */
  30772. 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'];
  30773. // Get rid of `auto` `auto-start` and `auto-end`
  30774. var validPlacements = placements.slice(3);
  30775. /**
  30776. * Given an initial placement, returns all the subsequent placements
  30777. * clockwise (or counter-clockwise).
  30778. *
  30779. * @method
  30780. * @memberof Popper.Utils
  30781. * @argument {String} placement - A valid placement (it accepts variations)
  30782. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  30783. * @returns {Array} placements including their variations
  30784. */
  30785. function clockwise(placement) {
  30786. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  30787. var index = validPlacements.indexOf(placement);
  30788. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  30789. return counter ? arr.reverse() : arr;
  30790. }
  30791. var BEHAVIORS = {
  30792. FLIP: 'flip',
  30793. CLOCKWISE: 'clockwise',
  30794. COUNTERCLOCKWISE: 'counterclockwise'
  30795. };
  30796. /**
  30797. * @function
  30798. * @memberof Modifiers
  30799. * @argument {Object} data - The data object generated by update method
  30800. * @argument {Object} options - Modifiers configuration and options
  30801. * @returns {Object} The data object, properly modified
  30802. */
  30803. function flip(data, options) {
  30804. // if `inner` modifier is enabled, we can't use the `flip` modifier
  30805. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  30806. return data;
  30807. }
  30808. if (data.flipped && data.placement === data.originalPlacement) {
  30809. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  30810. return data;
  30811. }
  30812. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  30813. var placement = data.placement.split('-')[0];
  30814. var placementOpposite = getOppositePlacement(placement);
  30815. var variation = data.placement.split('-')[1] || '';
  30816. var flipOrder = [];
  30817. switch (options.behavior) {
  30818. case BEHAVIORS.FLIP:
  30819. flipOrder = [placement, placementOpposite];
  30820. break;
  30821. case BEHAVIORS.CLOCKWISE:
  30822. flipOrder = clockwise(placement);
  30823. break;
  30824. case BEHAVIORS.COUNTERCLOCKWISE:
  30825. flipOrder = clockwise(placement, true);
  30826. break;
  30827. default:
  30828. flipOrder = options.behavior;
  30829. }
  30830. flipOrder.forEach(function (step, index) {
  30831. if (placement !== step || flipOrder.length === index + 1) {
  30832. return data;
  30833. }
  30834. placement = data.placement.split('-')[0];
  30835. placementOpposite = getOppositePlacement(placement);
  30836. var popperOffsets = data.offsets.popper;
  30837. var refOffsets = data.offsets.reference;
  30838. // using floor because the reference offsets may contain decimals we are not going to consider here
  30839. var floor = Math.floor;
  30840. 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);
  30841. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  30842. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  30843. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  30844. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  30845. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  30846. // flip the variation if required
  30847. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  30848. var flippedVariation = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  30849. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  30850. // this boolean to detect any flip loop
  30851. data.flipped = true;
  30852. if (overlapsRef || overflowsBoundaries) {
  30853. placement = flipOrder[index + 1];
  30854. }
  30855. if (flippedVariation) {
  30856. variation = getOppositeVariation(variation);
  30857. }
  30858. data.placement = placement + (variation ? '-' + variation : '');
  30859. // this object contains `position`, we want to preserve it along with
  30860. // any additional property we may add in the future
  30861. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  30862. data = runModifiers(data.instance.modifiers, data, 'flip');
  30863. }
  30864. });
  30865. return data;
  30866. }
  30867. /**
  30868. * @function
  30869. * @memberof Modifiers
  30870. * @argument {Object} data - The data object generated by update method
  30871. * @argument {Object} options - Modifiers configuration and options
  30872. * @returns {Object} The data object, properly modified
  30873. */
  30874. function keepTogether(data) {
  30875. var _data$offsets = data.offsets,
  30876. popper = _data$offsets.popper,
  30877. reference = _data$offsets.reference;
  30878. var placement = data.placement.split('-')[0];
  30879. var floor = Math.floor;
  30880. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  30881. var side = isVertical ? 'right' : 'bottom';
  30882. var opSide = isVertical ? 'left' : 'top';
  30883. var measurement = isVertical ? 'width' : 'height';
  30884. if (popper[side] < floor(reference[opSide])) {
  30885. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  30886. }
  30887. if (popper[opSide] > floor(reference[side])) {
  30888. data.offsets.popper[opSide] = floor(reference[side]);
  30889. }
  30890. return data;
  30891. }
  30892. /**
  30893. * Converts a string containing value + unit into a px value number
  30894. * @function
  30895. * @memberof {modifiers~offset}
  30896. * @private
  30897. * @argument {String} str - Value + unit string
  30898. * @argument {String} measurement - `height` or `width`
  30899. * @argument {Object} popperOffsets
  30900. * @argument {Object} referenceOffsets
  30901. * @returns {Number|String}
  30902. * Value in pixels, or original string if no values were extracted
  30903. */
  30904. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  30905. // separate value from unit
  30906. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  30907. var value = +split[1];
  30908. var unit = split[2];
  30909. // If it's not a number it's an operator, I guess
  30910. if (!value) {
  30911. return str;
  30912. }
  30913. if (unit.indexOf('%') === 0) {
  30914. var element = void 0;
  30915. switch (unit) {
  30916. case '%p':
  30917. element = popperOffsets;
  30918. break;
  30919. case '%':
  30920. case '%r':
  30921. default:
  30922. element = referenceOffsets;
  30923. }
  30924. var rect = getClientRect(element);
  30925. return rect[measurement] / 100 * value;
  30926. } else if (unit === 'vh' || unit === 'vw') {
  30927. // if is a vh or vw, we calculate the size based on the viewport
  30928. var size = void 0;
  30929. if (unit === 'vh') {
  30930. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  30931. } else {
  30932. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  30933. }
  30934. return size / 100 * value;
  30935. } else {
  30936. // if is an explicit pixel unit, we get rid of the unit and keep the value
  30937. // if is an implicit unit, it's px, and we return just the value
  30938. return value;
  30939. }
  30940. }
  30941. /**
  30942. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  30943. * @function
  30944. * @memberof {modifiers~offset}
  30945. * @private
  30946. * @argument {String} offset
  30947. * @argument {Object} popperOffsets
  30948. * @argument {Object} referenceOffsets
  30949. * @argument {String} basePlacement
  30950. * @returns {Array} a two cells array with x and y offsets in numbers
  30951. */
  30952. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  30953. var offsets = [0, 0];
  30954. // Use height if placement is left or right and index is 0 otherwise use width
  30955. // in this way the first offset will use an axis and the second one
  30956. // will use the other one
  30957. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  30958. // Split the offset string to obtain a list of values and operands
  30959. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  30960. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  30961. return frag.trim();
  30962. });
  30963. // Detect if the offset string contains a pair of values or a single one
  30964. // they could be separated by comma or space
  30965. var divider = fragments.indexOf(find(fragments, function (frag) {
  30966. return frag.search(/,|\s/) !== -1;
  30967. }));
  30968. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  30969. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  30970. }
  30971. // If divider is found, we divide the list of values and operands to divide
  30972. // them by ofset X and Y.
  30973. var splitRegex = /\s*,\s*|\s+/;
  30974. 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];
  30975. // Convert the values with units to absolute pixels to allow our computations
  30976. ops = ops.map(function (op, index) {
  30977. // Most of the units rely on the orientation of the popper
  30978. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  30979. var mergeWithPrevious = false;
  30980. return op
  30981. // This aggregates any `+` or `-` sign that aren't considered operators
  30982. // e.g.: 10 + +5 => [10, +, +5]
  30983. .reduce(function (a, b) {
  30984. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  30985. a[a.length - 1] = b;
  30986. mergeWithPrevious = true;
  30987. return a;
  30988. } else if (mergeWithPrevious) {
  30989. a[a.length - 1] += b;
  30990. mergeWithPrevious = false;
  30991. return a;
  30992. } else {
  30993. return a.concat(b);
  30994. }
  30995. }, [])
  30996. // Here we convert the string values into number values (in px)
  30997. .map(function (str) {
  30998. return toValue(str, measurement, popperOffsets, referenceOffsets);
  30999. });
  31000. });
  31001. // Loop trough the offsets arrays and execute the operations
  31002. ops.forEach(function (op, index) {
  31003. op.forEach(function (frag, index2) {
  31004. if (isNumeric(frag)) {
  31005. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  31006. }
  31007. });
  31008. });
  31009. return offsets;
  31010. }
  31011. /**
  31012. * @function
  31013. * @memberof Modifiers
  31014. * @argument {Object} data - The data object generated by update method
  31015. * @argument {Object} options - Modifiers configuration and options
  31016. * @argument {Number|String} options.offset=0
  31017. * The offset value as described in the modifier description
  31018. * @returns {Object} The data object, properly modified
  31019. */
  31020. function offset(data, _ref) {
  31021. var offset = _ref.offset;
  31022. var placement = data.placement,
  31023. _data$offsets = data.offsets,
  31024. popper = _data$offsets.popper,
  31025. reference = _data$offsets.reference;
  31026. var basePlacement = placement.split('-')[0];
  31027. var offsets = void 0;
  31028. if (isNumeric(+offset)) {
  31029. offsets = [+offset, 0];
  31030. } else {
  31031. offsets = parseOffset(offset, popper, reference, basePlacement);
  31032. }
  31033. if (basePlacement === 'left') {
  31034. popper.top += offsets[0];
  31035. popper.left -= offsets[1];
  31036. } else if (basePlacement === 'right') {
  31037. popper.top += offsets[0];
  31038. popper.left += offsets[1];
  31039. } else if (basePlacement === 'top') {
  31040. popper.left += offsets[0];
  31041. popper.top -= offsets[1];
  31042. } else if (basePlacement === 'bottom') {
  31043. popper.left += offsets[0];
  31044. popper.top += offsets[1];
  31045. }
  31046. data.popper = popper;
  31047. return data;
  31048. }
  31049. /**
  31050. * @function
  31051. * @memberof Modifiers
  31052. * @argument {Object} data - The data object generated by `update` method
  31053. * @argument {Object} options - Modifiers configuration and options
  31054. * @returns {Object} The data object, properly modified
  31055. */
  31056. function preventOverflow(data, options) {
  31057. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  31058. // If offsetParent is the reference element, we really want to
  31059. // go one step up and use the next offsetParent as reference to
  31060. // avoid to make this modifier completely useless and look like broken
  31061. if (data.instance.reference === boundariesElement) {
  31062. boundariesElement = getOffsetParent(boundariesElement);
  31063. }
  31064. // NOTE: DOM access here
  31065. // resets the popper's position so that the document size can be calculated excluding
  31066. // the size of the popper element itself
  31067. var transformProp = getSupportedPropertyName('transform');
  31068. var popperStyles = data.instance.popper.style; // assignment to help minification
  31069. var top = popperStyles.top,
  31070. left = popperStyles.left,
  31071. transform = popperStyles[transformProp];
  31072. popperStyles.top = '';
  31073. popperStyles.left = '';
  31074. popperStyles[transformProp] = '';
  31075. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  31076. // NOTE: DOM access here
  31077. // restores the original style properties after the offsets have been computed
  31078. popperStyles.top = top;
  31079. popperStyles.left = left;
  31080. popperStyles[transformProp] = transform;
  31081. options.boundaries = boundaries;
  31082. var order = options.priority;
  31083. var popper = data.offsets.popper;
  31084. var check = {
  31085. primary: function primary(placement) {
  31086. var value = popper[placement];
  31087. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  31088. value = Math.max(popper[placement], boundaries[placement]);
  31089. }
  31090. return defineProperty({}, placement, value);
  31091. },
  31092. secondary: function secondary(placement) {
  31093. var mainSide = placement === 'right' ? 'left' : 'top';
  31094. var value = popper[mainSide];
  31095. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  31096. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  31097. }
  31098. return defineProperty({}, mainSide, value);
  31099. }
  31100. };
  31101. order.forEach(function (placement) {
  31102. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  31103. popper = _extends({}, popper, check[side](placement));
  31104. });
  31105. data.offsets.popper = popper;
  31106. return data;
  31107. }
  31108. /**
  31109. * @function
  31110. * @memberof Modifiers
  31111. * @argument {Object} data - The data object generated by `update` method
  31112. * @argument {Object} options - Modifiers configuration and options
  31113. * @returns {Object} The data object, properly modified
  31114. */
  31115. function shift(data) {
  31116. var placement = data.placement;
  31117. var basePlacement = placement.split('-')[0];
  31118. var shiftvariation = placement.split('-')[1];
  31119. // if shift shiftvariation is specified, run the modifier
  31120. if (shiftvariation) {
  31121. var _data$offsets = data.offsets,
  31122. reference = _data$offsets.reference,
  31123. popper = _data$offsets.popper;
  31124. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  31125. var side = isVertical ? 'left' : 'top';
  31126. var measurement = isVertical ? 'width' : 'height';
  31127. var shiftOffsets = {
  31128. start: defineProperty({}, side, reference[side]),
  31129. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  31130. };
  31131. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  31132. }
  31133. return data;
  31134. }
  31135. /**
  31136. * @function
  31137. * @memberof Modifiers
  31138. * @argument {Object} data - The data object generated by update method
  31139. * @argument {Object} options - Modifiers configuration and options
  31140. * @returns {Object} The data object, properly modified
  31141. */
  31142. function hide(data) {
  31143. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  31144. return data;
  31145. }
  31146. var refRect = data.offsets.reference;
  31147. var bound = find(data.instance.modifiers, function (modifier) {
  31148. return modifier.name === 'preventOverflow';
  31149. }).boundaries;
  31150. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  31151. // Avoid unnecessary DOM access if visibility hasn't changed
  31152. if (data.hide === true) {
  31153. return data;
  31154. }
  31155. data.hide = true;
  31156. data.attributes['x-out-of-boundaries'] = '';
  31157. } else {
  31158. // Avoid unnecessary DOM access if visibility hasn't changed
  31159. if (data.hide === false) {
  31160. return data;
  31161. }
  31162. data.hide = false;
  31163. data.attributes['x-out-of-boundaries'] = false;
  31164. }
  31165. return data;
  31166. }
  31167. /**
  31168. * @function
  31169. * @memberof Modifiers
  31170. * @argument {Object} data - The data object generated by `update` method
  31171. * @argument {Object} options - Modifiers configuration and options
  31172. * @returns {Object} The data object, properly modified
  31173. */
  31174. function inner(data) {
  31175. var placement = data.placement;
  31176. var basePlacement = placement.split('-')[0];
  31177. var _data$offsets = data.offsets,
  31178. popper = _data$offsets.popper,
  31179. reference = _data$offsets.reference;
  31180. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  31181. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  31182. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  31183. data.placement = getOppositePlacement(placement);
  31184. data.offsets.popper = getClientRect(popper);
  31185. return data;
  31186. }
  31187. /**
  31188. * Modifier function, each modifier can have a function of this type assigned
  31189. * to its `fn` property.<br />
  31190. * These functions will be called on each update, this means that you must
  31191. * make sure they are performant enough to avoid performance bottlenecks.
  31192. *
  31193. * @function ModifierFn
  31194. * @argument {dataObject} data - The data object generated by `update` method
  31195. * @argument {Object} options - Modifiers configuration and options
  31196. * @returns {dataObject} The data object, properly modified
  31197. */
  31198. /**
  31199. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  31200. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  31201. * needed by the library.
  31202. *
  31203. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  31204. * All the other properties are configurations that could be tweaked.
  31205. * @namespace modifiers
  31206. */
  31207. var modifiers = {
  31208. /**
  31209. * Modifier used to shift the popper on the start or end of its reference
  31210. * element.<br />
  31211. * It will read the variation of the `placement` property.<br />
  31212. * It can be one either `-end` or `-start`.
  31213. * @memberof modifiers
  31214. * @inner
  31215. */
  31216. shift: {
  31217. /** @prop {number} order=100 - Index used to define the order of execution */
  31218. order: 100,
  31219. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31220. enabled: true,
  31221. /** @prop {ModifierFn} */
  31222. fn: shift
  31223. },
  31224. /**
  31225. * The `offset` modifier can shift your popper on both its axis.
  31226. *
  31227. * It accepts the following units:
  31228. * - `px` or unit-less, interpreted as pixels
  31229. * - `%` or `%r`, percentage relative to the length of the reference element
  31230. * - `%p`, percentage relative to the length of the popper element
  31231. * - `vw`, CSS viewport width unit
  31232. * - `vh`, CSS viewport height unit
  31233. *
  31234. * For length is intended the main axis relative to the placement of the popper.<br />
  31235. * This means that if the placement is `top` or `bottom`, the length will be the
  31236. * `width`. In case of `left` or `right`, it will be the `height`.
  31237. *
  31238. * You can provide a single value (as `Number` or `String`), or a pair of values
  31239. * as `String` divided by a comma or one (or more) white spaces.<br />
  31240. * The latter is a deprecated method because it leads to confusion and will be
  31241. * removed in v2.<br />
  31242. * Additionally, it accepts additions and subtractions between different units.
  31243. * Note that multiplications and divisions aren't supported.
  31244. *
  31245. * Valid examples are:
  31246. * ```
  31247. * 10
  31248. * '10%'
  31249. * '10, 10'
  31250. * '10%, 10'
  31251. * '10 + 10%'
  31252. * '10 - 5vh + 3%'
  31253. * '-10px + 5vh, 5px - 6%'
  31254. * ```
  31255. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  31256. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  31257. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  31258. *
  31259. * @memberof modifiers
  31260. * @inner
  31261. */
  31262. offset: {
  31263. /** @prop {number} order=200 - Index used to define the order of execution */
  31264. order: 200,
  31265. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31266. enabled: true,
  31267. /** @prop {ModifierFn} */
  31268. fn: offset,
  31269. /** @prop {Number|String} offset=0
  31270. * The offset value as described in the modifier description
  31271. */
  31272. offset: 0
  31273. },
  31274. /**
  31275. * Modifier used to prevent the popper from being positioned outside the boundary.
  31276. *
  31277. * A scenario exists where the reference itself is not within the boundaries.<br />
  31278. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  31279. * In this case we need to decide whether the popper should either:
  31280. *
  31281. * - detach from the reference and remain "trapped" in the boundaries, or
  31282. * - if it should ignore the boundary and "escape with its reference"
  31283. *
  31284. * When `escapeWithReference` is set to`true` and reference is completely
  31285. * outside its boundaries, the popper will overflow (or completely leave)
  31286. * the boundaries in order to remain attached to the edge of the reference.
  31287. *
  31288. * @memberof modifiers
  31289. * @inner
  31290. */
  31291. preventOverflow: {
  31292. /** @prop {number} order=300 - Index used to define the order of execution */
  31293. order: 300,
  31294. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31295. enabled: true,
  31296. /** @prop {ModifierFn} */
  31297. fn: preventOverflow,
  31298. /**
  31299. * @prop {Array} [priority=['left','right','top','bottom']]
  31300. * Popper will try to prevent overflow following these priorities by default,
  31301. * then, it could overflow on the left and on top of the `boundariesElement`
  31302. */
  31303. priority: ['left', 'right', 'top', 'bottom'],
  31304. /**
  31305. * @prop {number} padding=5
  31306. * Amount of pixel used to define a minimum distance between the boundaries
  31307. * and the popper. This makes sure the popper always has a little padding
  31308. * between the edges of its container
  31309. */
  31310. padding: 5,
  31311. /**
  31312. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  31313. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  31314. * `viewport` or any DOM element.
  31315. */
  31316. boundariesElement: 'scrollParent'
  31317. },
  31318. /**
  31319. * Modifier used to make sure the reference and its popper stay near each other
  31320. * without leaving any gap between the two. Especially useful when the arrow is
  31321. * enabled and you want to ensure that it points to its reference element.
  31322. * It cares only about the first axis. You can still have poppers with margin
  31323. * between the popper and its reference element.
  31324. * @memberof modifiers
  31325. * @inner
  31326. */
  31327. keepTogether: {
  31328. /** @prop {number} order=400 - Index used to define the order of execution */
  31329. order: 400,
  31330. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31331. enabled: true,
  31332. /** @prop {ModifierFn} */
  31333. fn: keepTogether
  31334. },
  31335. /**
  31336. * This modifier is used to move the `arrowElement` of the popper to make
  31337. * sure it is positioned between the reference element and its popper element.
  31338. * It will read the outer size of the `arrowElement` node to detect how many
  31339. * pixels of conjunction are needed.
  31340. *
  31341. * It has no effect if no `arrowElement` is provided.
  31342. * @memberof modifiers
  31343. * @inner
  31344. */
  31345. arrow: {
  31346. /** @prop {number} order=500 - Index used to define the order of execution */
  31347. order: 500,
  31348. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31349. enabled: true,
  31350. /** @prop {ModifierFn} */
  31351. fn: arrow,
  31352. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  31353. element: '[x-arrow]'
  31354. },
  31355. /**
  31356. * Modifier used to flip the popper's placement when it starts to overlap its
  31357. * reference element.
  31358. *
  31359. * Requires the `preventOverflow` modifier before it in order to work.
  31360. *
  31361. * **NOTE:** this modifier will interrupt the current update cycle and will
  31362. * restart it if it detects the need to flip the placement.
  31363. * @memberof modifiers
  31364. * @inner
  31365. */
  31366. flip: {
  31367. /** @prop {number} order=600 - Index used to define the order of execution */
  31368. order: 600,
  31369. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31370. enabled: true,
  31371. /** @prop {ModifierFn} */
  31372. fn: flip,
  31373. /**
  31374. * @prop {String|Array} behavior='flip'
  31375. * The behavior used to change the popper's placement. It can be one of
  31376. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  31377. * placements (with optional variations)
  31378. */
  31379. behavior: 'flip',
  31380. /**
  31381. * @prop {number} padding=5
  31382. * The popper will flip if it hits the edges of the `boundariesElement`
  31383. */
  31384. padding: 5,
  31385. /**
  31386. * @prop {String|HTMLElement} boundariesElement='viewport'
  31387. * The element which will define the boundaries of the popper position.
  31388. * The popper will never be placed outside of the defined boundaries
  31389. * (except if `keepTogether` is enabled)
  31390. */
  31391. boundariesElement: 'viewport'
  31392. },
  31393. /**
  31394. * Modifier used to make the popper flow toward the inner of the reference element.
  31395. * By default, when this modifier is disabled, the popper will be placed outside
  31396. * the reference element.
  31397. * @memberof modifiers
  31398. * @inner
  31399. */
  31400. inner: {
  31401. /** @prop {number} order=700 - Index used to define the order of execution */
  31402. order: 700,
  31403. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  31404. enabled: false,
  31405. /** @prop {ModifierFn} */
  31406. fn: inner
  31407. },
  31408. /**
  31409. * Modifier used to hide the popper when its reference element is outside of the
  31410. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  31411. * be used to hide with a CSS selector the popper when its reference is
  31412. * out of boundaries.
  31413. *
  31414. * Requires the `preventOverflow` modifier before it in order to work.
  31415. * @memberof modifiers
  31416. * @inner
  31417. */
  31418. hide: {
  31419. /** @prop {number} order=800 - Index used to define the order of execution */
  31420. order: 800,
  31421. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31422. enabled: true,
  31423. /** @prop {ModifierFn} */
  31424. fn: hide
  31425. },
  31426. /**
  31427. * Computes the style that will be applied to the popper element to gets
  31428. * properly positioned.
  31429. *
  31430. * Note that this modifier will not touch the DOM, it just prepares the styles
  31431. * so that `applyStyle` modifier can apply it. This separation is useful
  31432. * in case you need to replace `applyStyle` with a custom implementation.
  31433. *
  31434. * This modifier has `850` as `order` value to maintain backward compatibility
  31435. * with previous versions of Popper.js. Expect the modifiers ordering method
  31436. * to change in future major versions of the library.
  31437. *
  31438. * @memberof modifiers
  31439. * @inner
  31440. */
  31441. computeStyle: {
  31442. /** @prop {number} order=850 - Index used to define the order of execution */
  31443. order: 850,
  31444. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31445. enabled: true,
  31446. /** @prop {ModifierFn} */
  31447. fn: computeStyle,
  31448. /**
  31449. * @prop {Boolean} gpuAcceleration=true
  31450. * If true, it uses the CSS 3D transformation to position the popper.
  31451. * Otherwise, it will use the `top` and `left` properties
  31452. */
  31453. gpuAcceleration: true,
  31454. /**
  31455. * @prop {string} [x='bottom']
  31456. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  31457. * Change this if your popper should grow in a direction different from `bottom`
  31458. */
  31459. x: 'bottom',
  31460. /**
  31461. * @prop {string} [x='left']
  31462. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  31463. * Change this if your popper should grow in a direction different from `right`
  31464. */
  31465. y: 'right'
  31466. },
  31467. /**
  31468. * Applies the computed styles to the popper element.
  31469. *
  31470. * All the DOM manipulations are limited to this modifier. This is useful in case
  31471. * you want to integrate Popper.js inside a framework or view library and you
  31472. * want to delegate all the DOM manipulations to it.
  31473. *
  31474. * Note that if you disable this modifier, you must make sure the popper element
  31475. * has its position set to `absolute` before Popper.js can do its work!
  31476. *
  31477. * Just disable this modifier and define your own to achieve the desired effect.
  31478. *
  31479. * @memberof modifiers
  31480. * @inner
  31481. */
  31482. applyStyle: {
  31483. /** @prop {number} order=900 - Index used to define the order of execution */
  31484. order: 900,
  31485. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  31486. enabled: true,
  31487. /** @prop {ModifierFn} */
  31488. fn: applyStyle,
  31489. /** @prop {Function} */
  31490. onLoad: applyStyleOnLoad,
  31491. /**
  31492. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  31493. * @prop {Boolean} gpuAcceleration=true
  31494. * If true, it uses the CSS 3D transformation to position the popper.
  31495. * Otherwise, it will use the `top` and `left` properties
  31496. */
  31497. gpuAcceleration: undefined
  31498. }
  31499. };
  31500. /**
  31501. * The `dataObject` is an object containing all the information used by Popper.js.
  31502. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  31503. * @name dataObject
  31504. * @property {Object} data.instance The Popper.js instance
  31505. * @property {String} data.placement Placement applied to popper
  31506. * @property {String} data.originalPlacement Placement originally defined on init
  31507. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  31508. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  31509. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  31510. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  31511. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  31512. * @property {Object} data.boundaries Offsets of the popper boundaries
  31513. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  31514. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  31515. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  31516. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  31517. */
  31518. /**
  31519. * Default options provided to Popper.js constructor.<br />
  31520. * These can be overridden using the `options` argument of Popper.js.<br />
  31521. * To override an option, simply pass an object with the same
  31522. * structure of the `options` object, as the 3rd argument. For example:
  31523. * ```
  31524. * new Popper(ref, pop, {
  31525. * modifiers: {
  31526. * preventOverflow: { enabled: false }
  31527. * }
  31528. * })
  31529. * ```
  31530. * @type {Object}
  31531. * @static
  31532. * @memberof Popper
  31533. */
  31534. var Defaults = {
  31535. /**
  31536. * Popper's placement.
  31537. * @prop {Popper.placements} placement='bottom'
  31538. */
  31539. placement: 'bottom',
  31540. /**
  31541. * Set this to true if you want popper to position it self in 'fixed' mode
  31542. * @prop {Boolean} positionFixed=false
  31543. */
  31544. positionFixed: false,
  31545. /**
  31546. * Whether events (resize, scroll) are initially enabled.
  31547. * @prop {Boolean} eventsEnabled=true
  31548. */
  31549. eventsEnabled: true,
  31550. /**
  31551. * Set to true if you want to automatically remove the popper when
  31552. * you call the `destroy` method.
  31553. * @prop {Boolean} removeOnDestroy=false
  31554. */
  31555. removeOnDestroy: false,
  31556. /**
  31557. * Callback called when the popper is created.<br />
  31558. * By default, it is set to no-op.<br />
  31559. * Access Popper.js instance with `data.instance`.
  31560. * @prop {onCreate}
  31561. */
  31562. onCreate: function onCreate() {},
  31563. /**
  31564. * Callback called when the popper is updated. This callback is not called
  31565. * on the initialization/creation of the popper, but only on subsequent
  31566. * updates.<br />
  31567. * By default, it is set to no-op.<br />
  31568. * Access Popper.js instance with `data.instance`.
  31569. * @prop {onUpdate}
  31570. */
  31571. onUpdate: function onUpdate() {},
  31572. /**
  31573. * List of modifiers used to modify the offsets before they are applied to the popper.
  31574. * They provide most of the functionalities of Popper.js.
  31575. * @prop {modifiers}
  31576. */
  31577. modifiers: modifiers
  31578. };
  31579. /**
  31580. * @callback onCreate
  31581. * @param {dataObject} data
  31582. */
  31583. /**
  31584. * @callback onUpdate
  31585. * @param {dataObject} data
  31586. */
  31587. // Utils
  31588. // Methods
  31589. var Popper = function () {
  31590. /**
  31591. * Creates a new Popper.js instance.
  31592. * @class Popper
  31593. * @param {HTMLElement|referenceObject} reference - The reference element used to position the popper
  31594. * @param {HTMLElement} popper - The HTML element used as the popper
  31595. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  31596. * @return {Object} instance - The generated Popper.js instance
  31597. */
  31598. function Popper(reference, popper) {
  31599. var _this = this;
  31600. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  31601. classCallCheck(this, Popper);
  31602. this.scheduleUpdate = function () {
  31603. return requestAnimationFrame(_this.update);
  31604. };
  31605. // make update() debounced, so that it only runs at most once-per-tick
  31606. this.update = debounce(this.update.bind(this));
  31607. // with {} we create a new object with the options inside it
  31608. this.options = _extends({}, Popper.Defaults, options);
  31609. // init state
  31610. this.state = {
  31611. isDestroyed: false,
  31612. isCreated: false,
  31613. scrollParents: []
  31614. };
  31615. // get reference and popper elements (allow jQuery wrappers)
  31616. this.reference = reference && reference.jquery ? reference[0] : reference;
  31617. this.popper = popper && popper.jquery ? popper[0] : popper;
  31618. // Deep merge modifiers options
  31619. this.options.modifiers = {};
  31620. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  31621. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  31622. });
  31623. // Refactoring modifiers' list (Object => Array)
  31624. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  31625. return _extends({
  31626. name: name
  31627. }, _this.options.modifiers[name]);
  31628. })
  31629. // sort the modifiers by order
  31630. .sort(function (a, b) {
  31631. return a.order - b.order;
  31632. });
  31633. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  31634. // such code is executed in the same order of its modifier
  31635. // they could add new properties to their options configuration
  31636. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  31637. this.modifiers.forEach(function (modifierOptions) {
  31638. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  31639. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  31640. }
  31641. });
  31642. // fire the first update to position the popper in the right place
  31643. this.update();
  31644. var eventsEnabled = this.options.eventsEnabled;
  31645. if (eventsEnabled) {
  31646. // setup event listeners, they will take care of update the position in specific situations
  31647. this.enableEventListeners();
  31648. }
  31649. this.state.eventsEnabled = eventsEnabled;
  31650. }
  31651. // We can't use class properties because they don't get listed in the
  31652. // class prototype and break stuff like Sinon stubs
  31653. createClass(Popper, [{
  31654. key: 'update',
  31655. value: function update$$1() {
  31656. return update.call(this);
  31657. }
  31658. }, {
  31659. key: 'destroy',
  31660. value: function destroy$$1() {
  31661. return destroy.call(this);
  31662. }
  31663. }, {
  31664. key: 'enableEventListeners',
  31665. value: function enableEventListeners$$1() {
  31666. return enableEventListeners.call(this);
  31667. }
  31668. }, {
  31669. key: 'disableEventListeners',
  31670. value: function disableEventListeners$$1() {
  31671. return disableEventListeners.call(this);
  31672. }
  31673. /**
  31674. * Schedules an update. It will run on the next UI update available.
  31675. * @method scheduleUpdate
  31676. * @memberof Popper
  31677. */
  31678. /**
  31679. * Collection of utilities useful when writing custom modifiers.
  31680. * Starting from version 1.7, this method is available only if you
  31681. * include `popper-utils.js` before `popper.js`.
  31682. *
  31683. * **DEPRECATION**: This way to access PopperUtils is deprecated
  31684. * and will be removed in v2! Use the PopperUtils module directly instead.
  31685. * Due to the high instability of the methods contained in Utils, we can't
  31686. * guarantee them to follow semver. Use them at your own risk!
  31687. * @static
  31688. * @private
  31689. * @type {Object}
  31690. * @deprecated since version 1.8
  31691. * @member Utils
  31692. * @memberof Popper
  31693. */
  31694. }]);
  31695. return Popper;
  31696. }();
  31697. /**
  31698. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  31699. * and lets you use it as replacement of a real DOM node.<br />
  31700. * You can use this method to position a popper relatively to a set of coordinates
  31701. * in case you don't have a DOM node to use as reference.
  31702. *
  31703. * ```
  31704. * new Popper(referenceObject, popperNode);
  31705. * ```
  31706. *
  31707. * NB: This feature isn't supported in Internet Explorer 10.
  31708. * @name referenceObject
  31709. * @property {Function} data.getBoundingClientRect
  31710. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  31711. * @property {number} data.clientWidth
  31712. * An ES6 getter that will return the width of the virtual reference element.
  31713. * @property {number} data.clientHeight
  31714. * An ES6 getter that will return the height of the virtual reference element.
  31715. */
  31716. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  31717. Popper.placements = placements;
  31718. Popper.Defaults = Defaults;
  31719. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  31720. //# sourceMappingURL=popper.js.map
  31721. /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("./node_modules/webpack/buildin/global.js")))
  31722. /***/ }),
  31723. /***/ "./node_modules/process/browser.js":
  31724. /***/ (function(module, exports) {
  31725. // shim for using process in browser
  31726. var process = module.exports = {};
  31727. // cached from whatever global is present so that test runners that stub it
  31728. // don't break things. But we need to wrap it in a try catch in case it is
  31729. // wrapped in strict mode code which doesn't define any globals. It's inside a
  31730. // function because try/catches deoptimize in certain engines.
  31731. var cachedSetTimeout;
  31732. var cachedClearTimeout;
  31733. function defaultSetTimout() {
  31734. throw new Error('setTimeout has not been defined');
  31735. }
  31736. function defaultClearTimeout () {
  31737. throw new Error('clearTimeout has not been defined');
  31738. }
  31739. (function () {
  31740. try {
  31741. if (typeof setTimeout === 'function') {
  31742. cachedSetTimeout = setTimeout;
  31743. } else {
  31744. cachedSetTimeout = defaultSetTimout;
  31745. }
  31746. } catch (e) {
  31747. cachedSetTimeout = defaultSetTimout;
  31748. }
  31749. try {
  31750. if (typeof clearTimeout === 'function') {
  31751. cachedClearTimeout = clearTimeout;
  31752. } else {
  31753. cachedClearTimeout = defaultClearTimeout;
  31754. }
  31755. } catch (e) {
  31756. cachedClearTimeout = defaultClearTimeout;
  31757. }
  31758. } ())
  31759. function runTimeout(fun) {
  31760. if (cachedSetTimeout === setTimeout) {
  31761. //normal enviroments in sane situations
  31762. return setTimeout(fun, 0);
  31763. }
  31764. // if setTimeout wasn't available but was latter defined
  31765. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  31766. cachedSetTimeout = setTimeout;
  31767. return setTimeout(fun, 0);
  31768. }
  31769. try {
  31770. // when when somebody has screwed with setTimeout but no I.E. maddness
  31771. return cachedSetTimeout(fun, 0);
  31772. } catch(e){
  31773. try {
  31774. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  31775. return cachedSetTimeout.call(null, fun, 0);
  31776. } catch(e){
  31777. // 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
  31778. return cachedSetTimeout.call(this, fun, 0);
  31779. }
  31780. }
  31781. }
  31782. function runClearTimeout(marker) {
  31783. if (cachedClearTimeout === clearTimeout) {
  31784. //normal enviroments in sane situations
  31785. return clearTimeout(marker);
  31786. }
  31787. // if clearTimeout wasn't available but was latter defined
  31788. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  31789. cachedClearTimeout = clearTimeout;
  31790. return clearTimeout(marker);
  31791. }
  31792. try {
  31793. // when when somebody has screwed with setTimeout but no I.E. maddness
  31794. return cachedClearTimeout(marker);
  31795. } catch (e){
  31796. try {
  31797. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  31798. return cachedClearTimeout.call(null, marker);
  31799. } catch (e){
  31800. // 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.
  31801. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  31802. return cachedClearTimeout.call(this, marker);
  31803. }
  31804. }
  31805. }
  31806. var queue = [];
  31807. var draining = false;
  31808. var currentQueue;
  31809. var queueIndex = -1;
  31810. function cleanUpNextTick() {
  31811. if (!draining || !currentQueue) {
  31812. return;
  31813. }
  31814. draining = false;
  31815. if (currentQueue.length) {
  31816. queue = currentQueue.concat(queue);
  31817. } else {
  31818. queueIndex = -1;
  31819. }
  31820. if (queue.length) {
  31821. drainQueue();
  31822. }
  31823. }
  31824. function drainQueue() {
  31825. if (draining) {
  31826. return;
  31827. }
  31828. var timeout = runTimeout(cleanUpNextTick);
  31829. draining = true;
  31830. var len = queue.length;
  31831. while(len) {
  31832. currentQueue = queue;
  31833. queue = [];
  31834. while (++queueIndex < len) {
  31835. if (currentQueue) {
  31836. currentQueue[queueIndex].run();
  31837. }
  31838. }
  31839. queueIndex = -1;
  31840. len = queue.length;
  31841. }
  31842. currentQueue = null;
  31843. draining = false;
  31844. runClearTimeout(timeout);
  31845. }
  31846. process.nextTick = function (fun) {
  31847. var args = new Array(arguments.length - 1);
  31848. if (arguments.length > 1) {
  31849. for (var i = 1; i < arguments.length; i++) {
  31850. args[i - 1] = arguments[i];
  31851. }
  31852. }
  31853. queue.push(new Item(fun, args));
  31854. if (queue.length === 1 && !draining) {
  31855. runTimeout(drainQueue);
  31856. }
  31857. };
  31858. // v8 likes predictible objects
  31859. function Item(fun, array) {
  31860. this.fun = fun;
  31861. this.array = array;
  31862. }
  31863. Item.prototype.run = function () {
  31864. this.fun.apply(null, this.array);
  31865. };
  31866. process.title = 'browser';
  31867. process.browser = true;
  31868. process.env = {};
  31869. process.argv = [];
  31870. process.version = ''; // empty string to avoid regexp issues
  31871. process.versions = {};
  31872. function noop() {}
  31873. process.on = noop;
  31874. process.addListener = noop;
  31875. process.once = noop;
  31876. process.off = noop;
  31877. process.removeListener = noop;
  31878. process.removeAllListeners = noop;
  31879. process.emit = noop;
  31880. process.prependListener = noop;
  31881. process.prependOnceListener = noop;
  31882. process.listeners = function (name) { return [] }
  31883. process.binding = function (name) {
  31884. throw new Error('process.binding is not supported');
  31885. };
  31886. process.cwd = function () { return '/' };
  31887. process.chdir = function (dir) {
  31888. throw new Error('process.chdir is not supported');
  31889. };
  31890. process.umask = function() { return 0; };
  31891. /***/ }),
  31892. /***/ "./node_modules/setimmediate/setImmediate.js":
  31893. /***/ (function(module, exports, __webpack_require__) {
  31894. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  31895. "use strict";
  31896. if (global.setImmediate) {
  31897. return;
  31898. }
  31899. var nextHandle = 1; // Spec says greater than zero
  31900. var tasksByHandle = {};
  31901. var currentlyRunningATask = false;
  31902. var doc = global.document;
  31903. var registerImmediate;
  31904. function setImmediate(callback) {
  31905. // Callback can either be a function or a string
  31906. if (typeof callback !== "function") {
  31907. callback = new Function("" + callback);
  31908. }
  31909. // Copy function arguments
  31910. var args = new Array(arguments.length - 1);
  31911. for (var i = 0; i < args.length; i++) {
  31912. args[i] = arguments[i + 1];
  31913. }
  31914. // Store and register the task
  31915. var task = { callback: callback, args: args };
  31916. tasksByHandle[nextHandle] = task;
  31917. registerImmediate(nextHandle);
  31918. return nextHandle++;
  31919. }
  31920. function clearImmediate(handle) {
  31921. delete tasksByHandle[handle];
  31922. }
  31923. function run(task) {
  31924. var callback = task.callback;
  31925. var args = task.args;
  31926. switch (args.length) {
  31927. case 0:
  31928. callback();
  31929. break;
  31930. case 1:
  31931. callback(args[0]);
  31932. break;
  31933. case 2:
  31934. callback(args[0], args[1]);
  31935. break;
  31936. case 3:
  31937. callback(args[0], args[1], args[2]);
  31938. break;
  31939. default:
  31940. callback.apply(undefined, args);
  31941. break;
  31942. }
  31943. }
  31944. function runIfPresent(handle) {
  31945. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  31946. // So if we're currently running a task, we'll need to delay this invocation.
  31947. if (currentlyRunningATask) {
  31948. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  31949. // "too much recursion" error.
  31950. setTimeout(runIfPresent, 0, handle);
  31951. } else {
  31952. var task = tasksByHandle[handle];
  31953. if (task) {
  31954. currentlyRunningATask = true;
  31955. try {
  31956. run(task);
  31957. } finally {
  31958. clearImmediate(handle);
  31959. currentlyRunningATask = false;
  31960. }
  31961. }
  31962. }
  31963. }
  31964. function installNextTickImplementation() {
  31965. registerImmediate = function(handle) {
  31966. process.nextTick(function () { runIfPresent(handle); });
  31967. };
  31968. }
  31969. function canUsePostMessage() {
  31970. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  31971. // where `global.postMessage` means something completely different and can't be used for this purpose.
  31972. if (global.postMessage && !global.importScripts) {
  31973. var postMessageIsAsynchronous = true;
  31974. var oldOnMessage = global.onmessage;
  31975. global.onmessage = function() {
  31976. postMessageIsAsynchronous = false;
  31977. };
  31978. global.postMessage("", "*");
  31979. global.onmessage = oldOnMessage;
  31980. return postMessageIsAsynchronous;
  31981. }
  31982. }
  31983. function installPostMessageImplementation() {
  31984. // Installs an event handler on `global` for the `message` event: see
  31985. // * https://developer.mozilla.org/en/DOM/window.postMessage
  31986. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  31987. var messagePrefix = "setImmediate$" + Math.random() + "$";
  31988. var onGlobalMessage = function(event) {
  31989. if (event.source === global &&
  31990. typeof event.data === "string" &&
  31991. event.data.indexOf(messagePrefix) === 0) {
  31992. runIfPresent(+event.data.slice(messagePrefix.length));
  31993. }
  31994. };
  31995. if (global.addEventListener) {
  31996. global.addEventListener("message", onGlobalMessage, false);
  31997. } else {
  31998. global.attachEvent("onmessage", onGlobalMessage);
  31999. }
  32000. registerImmediate = function(handle) {
  32001. global.postMessage(messagePrefix + handle, "*");
  32002. };
  32003. }
  32004. function installMessageChannelImplementation() {
  32005. var channel = new MessageChannel();
  32006. channel.port1.onmessage = function(event) {
  32007. var handle = event.data;
  32008. runIfPresent(handle);
  32009. };
  32010. registerImmediate = function(handle) {
  32011. channel.port2.postMessage(handle);
  32012. };
  32013. }
  32014. function installReadyStateChangeImplementation() {
  32015. var html = doc.documentElement;
  32016. registerImmediate = function(handle) {
  32017. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  32018. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  32019. var script = doc.createElement("script");
  32020. script.onreadystatechange = function () {
  32021. runIfPresent(handle);
  32022. script.onreadystatechange = null;
  32023. html.removeChild(script);
  32024. script = null;
  32025. };
  32026. html.appendChild(script);
  32027. };
  32028. }
  32029. function installSetTimeoutImplementation() {
  32030. registerImmediate = function(handle) {
  32031. setTimeout(runIfPresent, 0, handle);
  32032. };
  32033. }
  32034. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  32035. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  32036. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  32037. // Don't get fooled by e.g. browserify environments.
  32038. if ({}.toString.call(global.process) === "[object process]") {
  32039. // For Node.js before 0.9
  32040. installNextTickImplementation();
  32041. } else if (canUsePostMessage()) {
  32042. // For non-IE10 modern browsers
  32043. installPostMessageImplementation();
  32044. } else if (global.MessageChannel) {
  32045. // For web workers, where supported
  32046. installMessageChannelImplementation();
  32047. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  32048. // For IE 6–8
  32049. installReadyStateChangeImplementation();
  32050. } else {
  32051. // For older browsers
  32052. installSetTimeoutImplementation();
  32053. }
  32054. attachTo.setImmediate = setImmediate;
  32055. attachTo.clearImmediate = clearImmediate;
  32056. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  32057. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/webpack/buildin/global.js"), __webpack_require__("./node_modules/process/browser.js")))
  32058. /***/ }),
  32059. /***/ "./node_modules/timers-browserify/main.js":
  32060. /***/ (function(module, exports, __webpack_require__) {
  32061. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  32062. (typeof self !== "undefined" && self) ||
  32063. window;
  32064. var apply = Function.prototype.apply;
  32065. // DOM APIs, for completeness
  32066. exports.setTimeout = function() {
  32067. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  32068. };
  32069. exports.setInterval = function() {
  32070. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  32071. };
  32072. exports.clearTimeout =
  32073. exports.clearInterval = function(timeout) {
  32074. if (timeout) {
  32075. timeout.close();
  32076. }
  32077. };
  32078. function Timeout(id, clearFn) {
  32079. this._id = id;
  32080. this._clearFn = clearFn;
  32081. }
  32082. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  32083. Timeout.prototype.close = function() {
  32084. this._clearFn.call(scope, this._id);
  32085. };
  32086. // Does not start the time, just sets up the members needed.
  32087. exports.enroll = function(item, msecs) {
  32088. clearTimeout(item._idleTimeoutId);
  32089. item._idleTimeout = msecs;
  32090. };
  32091. exports.unenroll = function(item) {
  32092. clearTimeout(item._idleTimeoutId);
  32093. item._idleTimeout = -1;
  32094. };
  32095. exports._unrefActive = exports.active = function(item) {
  32096. clearTimeout(item._idleTimeoutId);
  32097. var msecs = item._idleTimeout;
  32098. if (msecs >= 0) {
  32099. item._idleTimeoutId = setTimeout(function onTimeout() {
  32100. if (item._onTimeout)
  32101. item._onTimeout();
  32102. }, msecs);
  32103. }
  32104. };
  32105. // setimmediate attaches itself to the global object
  32106. __webpack_require__("./node_modules/setimmediate/setImmediate.js");
  32107. // On some exotic environments, it's not clear which object `setimmediate` was
  32108. // able to install onto. Search each possibility in the same order as the
  32109. // `setimmediate` library.
  32110. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  32111. (typeof global !== "undefined" && global.setImmediate) ||
  32112. (this && this.setImmediate);
  32113. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  32114. (typeof global !== "undefined" && global.clearImmediate) ||
  32115. (this && this.clearImmediate);
  32116. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/webpack/buildin/global.js")))
  32117. /***/ }),
  32118. /***/ "./node_modules/vue-loader/lib/component-normalizer.js":
  32119. /***/ (function(module, exports) {
  32120. /* globals __VUE_SSR_CONTEXT__ */
  32121. // IMPORTANT: Do NOT use ES2015 features in this file.
  32122. // This module is a runtime utility for cleaner component module output and will
  32123. // be included in the final webpack user bundle.
  32124. module.exports = function normalizeComponent (
  32125. rawScriptExports,
  32126. compiledTemplate,
  32127. functionalTemplate,
  32128. injectStyles,
  32129. scopeId,
  32130. moduleIdentifier /* server only */
  32131. ) {
  32132. var esModule
  32133. var scriptExports = rawScriptExports = rawScriptExports || {}
  32134. // ES6 modules interop
  32135. var type = typeof rawScriptExports.default
  32136. if (type === 'object' || type === 'function') {
  32137. esModule = rawScriptExports
  32138. scriptExports = rawScriptExports.default
  32139. }
  32140. // Vue.extend constructor export interop
  32141. var options = typeof scriptExports === 'function'
  32142. ? scriptExports.options
  32143. : scriptExports
  32144. // render functions
  32145. if (compiledTemplate) {
  32146. options.render = compiledTemplate.render
  32147. options.staticRenderFns = compiledTemplate.staticRenderFns
  32148. options._compiled = true
  32149. }
  32150. // functional template
  32151. if (functionalTemplate) {
  32152. options.functional = true
  32153. }
  32154. // scopedId
  32155. if (scopeId) {
  32156. options._scopeId = scopeId
  32157. }
  32158. var hook
  32159. if (moduleIdentifier) { // server build
  32160. hook = function (context) {
  32161. // 2.3 injection
  32162. context =
  32163. context || // cached call
  32164. (this.$vnode && this.$vnode.ssrContext) || // stateful
  32165. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  32166. // 2.2 with runInNewContext: true
  32167. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  32168. context = __VUE_SSR_CONTEXT__
  32169. }
  32170. // inject component styles
  32171. if (injectStyles) {
  32172. injectStyles.call(this, context)
  32173. }
  32174. // register component module identifier for async chunk inferrence
  32175. if (context && context._registeredComponents) {
  32176. context._registeredComponents.add(moduleIdentifier)
  32177. }
  32178. }
  32179. // used by ssr in case component is cached and beforeCreate
  32180. // never gets called
  32181. options._ssrRegister = hook
  32182. } else if (injectStyles) {
  32183. hook = injectStyles
  32184. }
  32185. if (hook) {
  32186. var functional = options.functional
  32187. var existing = functional
  32188. ? options.render
  32189. : options.beforeCreate
  32190. if (!functional) {
  32191. // inject component registration as beforeCreate hook
  32192. options.beforeCreate = existing
  32193. ? [].concat(existing, hook)
  32194. : [hook]
  32195. } else {
  32196. // for template-only hot-reload because in that case the render fn doesn't
  32197. // go through the normalizer
  32198. options._injectStyles = hook
  32199. // register for functioal component in vue file
  32200. options.render = function renderWithStyleInjection (h, context) {
  32201. hook.call(context)
  32202. return existing(h, context)
  32203. }
  32204. }
  32205. }
  32206. return {
  32207. esModule: esModule,
  32208. exports: scriptExports,
  32209. options: options
  32210. }
  32211. }
  32212. /***/ }),
  32213. /***/ "./node_modules/vue-loader/lib/template-compiler/index.js?{\"id\":\"data-v-7168fb6a\",\"hasScoped\":false,\"buble\":{\"transforms\":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./resources/assets/js/components/ExampleComponent.vue":
  32214. /***/ (function(module, exports, __webpack_require__) {
  32215. var render = function() {
  32216. var _vm = this
  32217. var _h = _vm.$createElement
  32218. var _c = _vm._self._c || _h
  32219. return _vm._m(0)
  32220. }
  32221. var staticRenderFns = [
  32222. function() {
  32223. var _vm = this
  32224. var _h = _vm.$createElement
  32225. var _c = _vm._self._c || _h
  32226. return _c("div", { staticClass: "container" }, [
  32227. _c("div", { staticClass: "row justify-content-center" }, [
  32228. _c("div", { staticClass: "col-md-8" }, [
  32229. _c("div", { staticClass: "card card-default" }, [
  32230. _c("div", { staticClass: "card-header" }, [
  32231. _vm._v("Example Component")
  32232. ]),
  32233. _vm._v(" "),
  32234. _c("div", { staticClass: "card-body" }, [
  32235. _vm._v(
  32236. "\n I'm an example component.\n "
  32237. )
  32238. ])
  32239. ])
  32240. ])
  32241. ])
  32242. ])
  32243. }
  32244. ]
  32245. render._withStripped = true
  32246. module.exports = { render: render, staticRenderFns: staticRenderFns }
  32247. if (false) {
  32248. module.hot.accept()
  32249. if (module.hot.data) {
  32250. require("vue-hot-reload-api") .rerender("data-v-7168fb6a", module.exports)
  32251. }
  32252. }
  32253. /***/ }),
  32254. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  32255. /***/ (function(module, exports, __webpack_require__) {
  32256. "use strict";
  32257. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  32258. * Vue.js v2.6.7
  32259. * (c) 2014-2019 Evan You
  32260. * Released under the MIT License.
  32261. */
  32262. /* */
  32263. var emptyObject = Object.freeze({});
  32264. // These helpers produce better VM code in JS engines due to their
  32265. // explicitness and function inlining.
  32266. function isUndef (v) {
  32267. return v === undefined || v === null
  32268. }
  32269. function isDef (v) {
  32270. return v !== undefined && v !== null
  32271. }
  32272. function isTrue (v) {
  32273. return v === true
  32274. }
  32275. function isFalse (v) {
  32276. return v === false
  32277. }
  32278. /**
  32279. * Check if value is primitive.
  32280. */
  32281. function isPrimitive (value) {
  32282. return (
  32283. typeof value === 'string' ||
  32284. typeof value === 'number' ||
  32285. // $flow-disable-line
  32286. typeof value === 'symbol' ||
  32287. typeof value === 'boolean'
  32288. )
  32289. }
  32290. /**
  32291. * Quick object check - this is primarily used to tell
  32292. * Objects from primitive values when we know the value
  32293. * is a JSON-compliant type.
  32294. */
  32295. function isObject (obj) {
  32296. return obj !== null && typeof obj === 'object'
  32297. }
  32298. /**
  32299. * Get the raw type string of a value, e.g., [object Object].
  32300. */
  32301. var _toString = Object.prototype.toString;
  32302. function toRawType (value) {
  32303. return _toString.call(value).slice(8, -1)
  32304. }
  32305. /**
  32306. * Strict object type check. Only returns true
  32307. * for plain JavaScript objects.
  32308. */
  32309. function isPlainObject (obj) {
  32310. return _toString.call(obj) === '[object Object]'
  32311. }
  32312. function isRegExp (v) {
  32313. return _toString.call(v) === '[object RegExp]'
  32314. }
  32315. /**
  32316. * Check if val is a valid array index.
  32317. */
  32318. function isValidArrayIndex (val) {
  32319. var n = parseFloat(String(val));
  32320. return n >= 0 && Math.floor(n) === n && isFinite(val)
  32321. }
  32322. function isPromise (val) {
  32323. return (
  32324. isDef(val) &&
  32325. typeof val.then === 'function' &&
  32326. typeof val.catch === 'function'
  32327. )
  32328. }
  32329. /**
  32330. * Convert a value to a string that is actually rendered.
  32331. */
  32332. function toString (val) {
  32333. return val == null
  32334. ? ''
  32335. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  32336. ? JSON.stringify(val, null, 2)
  32337. : String(val)
  32338. }
  32339. /**
  32340. * Convert an input value to a number for persistence.
  32341. * If the conversion fails, return original string.
  32342. */
  32343. function toNumber (val) {
  32344. var n = parseFloat(val);
  32345. return isNaN(n) ? val : n
  32346. }
  32347. /**
  32348. * Make a map and return a function for checking if a key
  32349. * is in that map.
  32350. */
  32351. function makeMap (
  32352. str,
  32353. expectsLowerCase
  32354. ) {
  32355. var map = Object.create(null);
  32356. var list = str.split(',');
  32357. for (var i = 0; i < list.length; i++) {
  32358. map[list[i]] = true;
  32359. }
  32360. return expectsLowerCase
  32361. ? function (val) { return map[val.toLowerCase()]; }
  32362. : function (val) { return map[val]; }
  32363. }
  32364. /**
  32365. * Check if a tag is a built-in tag.
  32366. */
  32367. var isBuiltInTag = makeMap('slot,component', true);
  32368. /**
  32369. * Check if an attribute is a reserved attribute.
  32370. */
  32371. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  32372. /**
  32373. * Remove an item from an array.
  32374. */
  32375. function remove (arr, item) {
  32376. if (arr.length) {
  32377. var index = arr.indexOf(item);
  32378. if (index > -1) {
  32379. return arr.splice(index, 1)
  32380. }
  32381. }
  32382. }
  32383. /**
  32384. * Check whether an object has the property.
  32385. */
  32386. var hasOwnProperty = Object.prototype.hasOwnProperty;
  32387. function hasOwn (obj, key) {
  32388. return hasOwnProperty.call(obj, key)
  32389. }
  32390. /**
  32391. * Create a cached version of a pure function.
  32392. */
  32393. function cached (fn) {
  32394. var cache = Object.create(null);
  32395. return (function cachedFn (str) {
  32396. var hit = cache[str];
  32397. return hit || (cache[str] = fn(str))
  32398. })
  32399. }
  32400. /**
  32401. * Camelize a hyphen-delimited string.
  32402. */
  32403. var camelizeRE = /-(\w)/g;
  32404. var camelize = cached(function (str) {
  32405. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  32406. });
  32407. /**
  32408. * Capitalize a string.
  32409. */
  32410. var capitalize = cached(function (str) {
  32411. return str.charAt(0).toUpperCase() + str.slice(1)
  32412. });
  32413. /**
  32414. * Hyphenate a camelCase string.
  32415. */
  32416. var hyphenateRE = /\B([A-Z])/g;
  32417. var hyphenate = cached(function (str) {
  32418. return str.replace(hyphenateRE, '-$1').toLowerCase()
  32419. });
  32420. /**
  32421. * Simple bind polyfill for environments that do not support it,
  32422. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  32423. * since native bind is now performant enough in most browsers.
  32424. * But removing it would mean breaking code that was able to run in
  32425. * PhantomJS 1.x, so this must be kept for backward compatibility.
  32426. */
  32427. /* istanbul ignore next */
  32428. function polyfillBind (fn, ctx) {
  32429. function boundFn (a) {
  32430. var l = arguments.length;
  32431. return l
  32432. ? l > 1
  32433. ? fn.apply(ctx, arguments)
  32434. : fn.call(ctx, a)
  32435. : fn.call(ctx)
  32436. }
  32437. boundFn._length = fn.length;
  32438. return boundFn
  32439. }
  32440. function nativeBind (fn, ctx) {
  32441. return fn.bind(ctx)
  32442. }
  32443. var bind = Function.prototype.bind
  32444. ? nativeBind
  32445. : polyfillBind;
  32446. /**
  32447. * Convert an Array-like object to a real Array.
  32448. */
  32449. function toArray (list, start) {
  32450. start = start || 0;
  32451. var i = list.length - start;
  32452. var ret = new Array(i);
  32453. while (i--) {
  32454. ret[i] = list[i + start];
  32455. }
  32456. return ret
  32457. }
  32458. /**
  32459. * Mix properties into target object.
  32460. */
  32461. function extend (to, _from) {
  32462. for (var key in _from) {
  32463. to[key] = _from[key];
  32464. }
  32465. return to
  32466. }
  32467. /**
  32468. * Merge an Array of Objects into a single Object.
  32469. */
  32470. function toObject (arr) {
  32471. var res = {};
  32472. for (var i = 0; i < arr.length; i++) {
  32473. if (arr[i]) {
  32474. extend(res, arr[i]);
  32475. }
  32476. }
  32477. return res
  32478. }
  32479. /* eslint-disable no-unused-vars */
  32480. /**
  32481. * Perform no operation.
  32482. * Stubbing args to make Flow happy without leaving useless transpiled code
  32483. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  32484. */
  32485. function noop (a, b, c) {}
  32486. /**
  32487. * Always return false.
  32488. */
  32489. var no = function (a, b, c) { return false; };
  32490. /* eslint-enable no-unused-vars */
  32491. /**
  32492. * Return the same value.
  32493. */
  32494. var identity = function (_) { return _; };
  32495. /**
  32496. * Generate a string containing static keys from compiler modules.
  32497. */
  32498. function genStaticKeys (modules) {
  32499. return modules.reduce(function (keys, m) {
  32500. return keys.concat(m.staticKeys || [])
  32501. }, []).join(',')
  32502. }
  32503. /**
  32504. * Check if two values are loosely equal - that is,
  32505. * if they are plain objects, do they have the same shape?
  32506. */
  32507. function looseEqual (a, b) {
  32508. if (a === b) { return true }
  32509. var isObjectA = isObject(a);
  32510. var isObjectB = isObject(b);
  32511. if (isObjectA && isObjectB) {
  32512. try {
  32513. var isArrayA = Array.isArray(a);
  32514. var isArrayB = Array.isArray(b);
  32515. if (isArrayA && isArrayB) {
  32516. return a.length === b.length && a.every(function (e, i) {
  32517. return looseEqual(e, b[i])
  32518. })
  32519. } else if (a instanceof Date && b instanceof Date) {
  32520. return a.getTime() === b.getTime()
  32521. } else if (!isArrayA && !isArrayB) {
  32522. var keysA = Object.keys(a);
  32523. var keysB = Object.keys(b);
  32524. return keysA.length === keysB.length && keysA.every(function (key) {
  32525. return looseEqual(a[key], b[key])
  32526. })
  32527. } else {
  32528. /* istanbul ignore next */
  32529. return false
  32530. }
  32531. } catch (e) {
  32532. /* istanbul ignore next */
  32533. return false
  32534. }
  32535. } else if (!isObjectA && !isObjectB) {
  32536. return String(a) === String(b)
  32537. } else {
  32538. return false
  32539. }
  32540. }
  32541. /**
  32542. * Return the first index at which a loosely equal value can be
  32543. * found in the array (if value is a plain object, the array must
  32544. * contain an object of the same shape), or -1 if it is not present.
  32545. */
  32546. function looseIndexOf (arr, val) {
  32547. for (var i = 0; i < arr.length; i++) {
  32548. if (looseEqual(arr[i], val)) { return i }
  32549. }
  32550. return -1
  32551. }
  32552. /**
  32553. * Ensure a function is called only once.
  32554. */
  32555. function once (fn) {
  32556. var called = false;
  32557. return function () {
  32558. if (!called) {
  32559. called = true;
  32560. fn.apply(this, arguments);
  32561. }
  32562. }
  32563. }
  32564. var SSR_ATTR = 'data-server-rendered';
  32565. var ASSET_TYPES = [
  32566. 'component',
  32567. 'directive',
  32568. 'filter'
  32569. ];
  32570. var LIFECYCLE_HOOKS = [
  32571. 'beforeCreate',
  32572. 'created',
  32573. 'beforeMount',
  32574. 'mounted',
  32575. 'beforeUpdate',
  32576. 'updated',
  32577. 'beforeDestroy',
  32578. 'destroyed',
  32579. 'activated',
  32580. 'deactivated',
  32581. 'errorCaptured',
  32582. 'serverPrefetch'
  32583. ];
  32584. /* */
  32585. var config = ({
  32586. /**
  32587. * Option merge strategies (used in core/util/options)
  32588. */
  32589. // $flow-disable-line
  32590. optionMergeStrategies: Object.create(null),
  32591. /**
  32592. * Whether to suppress warnings.
  32593. */
  32594. silent: false,
  32595. /**
  32596. * Show production mode tip message on boot?
  32597. */
  32598. productionTip: "development" !== 'production',
  32599. /**
  32600. * Whether to enable devtools
  32601. */
  32602. devtools: "development" !== 'production',
  32603. /**
  32604. * Whether to record perf
  32605. */
  32606. performance: false,
  32607. /**
  32608. * Error handler for watcher errors
  32609. */
  32610. errorHandler: null,
  32611. /**
  32612. * Warn handler for watcher warns
  32613. */
  32614. warnHandler: null,
  32615. /**
  32616. * Ignore certain custom elements
  32617. */
  32618. ignoredElements: [],
  32619. /**
  32620. * Custom user key aliases for v-on
  32621. */
  32622. // $flow-disable-line
  32623. keyCodes: Object.create(null),
  32624. /**
  32625. * Check if a tag is reserved so that it cannot be registered as a
  32626. * component. This is platform-dependent and may be overwritten.
  32627. */
  32628. isReservedTag: no,
  32629. /**
  32630. * Check if an attribute is reserved so that it cannot be used as a component
  32631. * prop. This is platform-dependent and may be overwritten.
  32632. */
  32633. isReservedAttr: no,
  32634. /**
  32635. * Check if a tag is an unknown element.
  32636. * Platform-dependent.
  32637. */
  32638. isUnknownElement: no,
  32639. /**
  32640. * Get the namespace of an element
  32641. */
  32642. getTagNamespace: noop,
  32643. /**
  32644. * Parse the real tag name for the specific platform.
  32645. */
  32646. parsePlatformTagName: identity,
  32647. /**
  32648. * Check if an attribute must be bound using property, e.g. value
  32649. * Platform-dependent.
  32650. */
  32651. mustUseProp: no,
  32652. /**
  32653. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  32654. * This will significantly reduce performance if set to false.
  32655. */
  32656. async: true,
  32657. /**
  32658. * Exposed for legacy reasons
  32659. */
  32660. _lifecycleHooks: LIFECYCLE_HOOKS
  32661. });
  32662. /* */
  32663. /**
  32664. * unicode letters used for parsing html tags, component names and property paths.
  32665. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  32666. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  32667. */
  32668. var unicodeLetters = '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';
  32669. /**
  32670. * Check if a string starts with $ or _
  32671. */
  32672. function isReserved (str) {
  32673. var c = (str + '').charCodeAt(0);
  32674. return c === 0x24 || c === 0x5F
  32675. }
  32676. /**
  32677. * Define a property.
  32678. */
  32679. function def (obj, key, val, enumerable) {
  32680. Object.defineProperty(obj, key, {
  32681. value: val,
  32682. enumerable: !!enumerable,
  32683. writable: true,
  32684. configurable: true
  32685. });
  32686. }
  32687. /**
  32688. * Parse simple path.
  32689. */
  32690. var bailRE = new RegExp(("[^" + unicodeLetters + ".$_\\d]"));
  32691. function parsePath (path) {
  32692. if (bailRE.test(path)) {
  32693. return
  32694. }
  32695. var segments = path.split('.');
  32696. return function (obj) {
  32697. for (var i = 0; i < segments.length; i++) {
  32698. if (!obj) { return }
  32699. obj = obj[segments[i]];
  32700. }
  32701. return obj
  32702. }
  32703. }
  32704. /* */
  32705. // can we use __proto__?
  32706. var hasProto = '__proto__' in {};
  32707. // Browser environment sniffing
  32708. var inBrowser = typeof window !== 'undefined';
  32709. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  32710. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  32711. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  32712. var isIE = UA && /msie|trident/.test(UA);
  32713. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  32714. var isEdge = UA && UA.indexOf('edge/') > 0;
  32715. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  32716. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  32717. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  32718. var isPhantomJS = UA && /phantomjs/.test(UA);
  32719. var isFF = UA && UA.match(/firefox\/(\d+)/);
  32720. // Firefox has a "watch" function on Object.prototype...
  32721. var nativeWatch = ({}).watch;
  32722. var supportsPassive = false;
  32723. if (inBrowser) {
  32724. try {
  32725. var opts = {};
  32726. Object.defineProperty(opts, 'passive', ({
  32727. get: function get () {
  32728. /* istanbul ignore next */
  32729. supportsPassive = true;
  32730. }
  32731. })); // https://github.com/facebook/flow/issues/285
  32732. window.addEventListener('test-passive', null, opts);
  32733. } catch (e) {}
  32734. }
  32735. // this needs to be lazy-evaled because vue may be required before
  32736. // vue-server-renderer can set VUE_ENV
  32737. var _isServer;
  32738. var isServerRendering = function () {
  32739. if (_isServer === undefined) {
  32740. /* istanbul ignore if */
  32741. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  32742. // detect presence of vue-server-renderer and avoid
  32743. // Webpack shimming the process
  32744. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  32745. } else {
  32746. _isServer = false;
  32747. }
  32748. }
  32749. return _isServer
  32750. };
  32751. // detect devtools
  32752. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  32753. /* istanbul ignore next */
  32754. function isNative (Ctor) {
  32755. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  32756. }
  32757. var hasSymbol =
  32758. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  32759. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  32760. var _Set;
  32761. /* istanbul ignore if */ // $flow-disable-line
  32762. if (typeof Set !== 'undefined' && isNative(Set)) {
  32763. // use native Set when available.
  32764. _Set = Set;
  32765. } else {
  32766. // a non-standard Set polyfill that only works with primitive keys.
  32767. _Set = /*@__PURE__*/(function () {
  32768. function Set () {
  32769. this.set = Object.create(null);
  32770. }
  32771. Set.prototype.has = function has (key) {
  32772. return this.set[key] === true
  32773. };
  32774. Set.prototype.add = function add (key) {
  32775. this.set[key] = true;
  32776. };
  32777. Set.prototype.clear = function clear () {
  32778. this.set = Object.create(null);
  32779. };
  32780. return Set;
  32781. }());
  32782. }
  32783. /* */
  32784. var warn = noop;
  32785. var tip = noop;
  32786. var generateComponentTrace = (noop); // work around flow check
  32787. var formatComponentName = (noop);
  32788. {
  32789. var hasConsole = typeof console !== 'undefined';
  32790. var classifyRE = /(?:^|[-_])(\w)/g;
  32791. var classify = function (str) { return str
  32792. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  32793. .replace(/[-_]/g, ''); };
  32794. warn = function (msg, vm) {
  32795. var trace = vm ? generateComponentTrace(vm) : '';
  32796. if (config.warnHandler) {
  32797. config.warnHandler.call(null, msg, vm, trace);
  32798. } else if (hasConsole && (!config.silent)) {
  32799. console.error(("[Vue warn]: " + msg + trace));
  32800. }
  32801. };
  32802. tip = function (msg, vm) {
  32803. if (hasConsole && (!config.silent)) {
  32804. console.warn("[Vue tip]: " + msg + (
  32805. vm ? generateComponentTrace(vm) : ''
  32806. ));
  32807. }
  32808. };
  32809. formatComponentName = function (vm, includeFile) {
  32810. if (vm.$root === vm) {
  32811. return '<Root>'
  32812. }
  32813. var options = typeof vm === 'function' && vm.cid != null
  32814. ? vm.options
  32815. : vm._isVue
  32816. ? vm.$options || vm.constructor.options
  32817. : vm;
  32818. var name = options.name || options._componentTag;
  32819. var file = options.__file;
  32820. if (!name && file) {
  32821. var match = file.match(/([^/\\]+)\.vue$/);
  32822. name = match && match[1];
  32823. }
  32824. return (
  32825. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  32826. (file && includeFile !== false ? (" at " + file) : '')
  32827. )
  32828. };
  32829. var repeat = function (str, n) {
  32830. var res = '';
  32831. while (n) {
  32832. if (n % 2 === 1) { res += str; }
  32833. if (n > 1) { str += str; }
  32834. n >>= 1;
  32835. }
  32836. return res
  32837. };
  32838. generateComponentTrace = function (vm) {
  32839. if (vm._isVue && vm.$parent) {
  32840. var tree = [];
  32841. var currentRecursiveSequence = 0;
  32842. while (vm) {
  32843. if (tree.length > 0) {
  32844. var last = tree[tree.length - 1];
  32845. if (last.constructor === vm.constructor) {
  32846. currentRecursiveSequence++;
  32847. vm = vm.$parent;
  32848. continue
  32849. } else if (currentRecursiveSequence > 0) {
  32850. tree[tree.length - 1] = [last, currentRecursiveSequence];
  32851. currentRecursiveSequence = 0;
  32852. }
  32853. }
  32854. tree.push(vm);
  32855. vm = vm.$parent;
  32856. }
  32857. return '\n\nfound in\n\n' + tree
  32858. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  32859. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  32860. : formatComponentName(vm))); })
  32861. .join('\n')
  32862. } else {
  32863. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  32864. }
  32865. };
  32866. }
  32867. /* */
  32868. var uid = 0;
  32869. /**
  32870. * A dep is an observable that can have multiple
  32871. * directives subscribing to it.
  32872. */
  32873. var Dep = function Dep () {
  32874. this.id = uid++;
  32875. this.subs = [];
  32876. };
  32877. Dep.prototype.addSub = function addSub (sub) {
  32878. this.subs.push(sub);
  32879. };
  32880. Dep.prototype.removeSub = function removeSub (sub) {
  32881. remove(this.subs, sub);
  32882. };
  32883. Dep.prototype.depend = function depend () {
  32884. if (Dep.target) {
  32885. Dep.target.addDep(this);
  32886. }
  32887. };
  32888. Dep.prototype.notify = function notify () {
  32889. // stabilize the subscriber list first
  32890. var subs = this.subs.slice();
  32891. if (!config.async) {
  32892. // subs aren't sorted in scheduler if not running async
  32893. // we need to sort them now to make sure they fire in correct
  32894. // order
  32895. subs.sort(function (a, b) { return a.id - b.id; });
  32896. }
  32897. for (var i = 0, l = subs.length; i < l; i++) {
  32898. subs[i].update();
  32899. }
  32900. };
  32901. // The current target watcher being evaluated.
  32902. // This is globally unique because only one watcher
  32903. // can be evaluated at a time.
  32904. Dep.target = null;
  32905. var targetStack = [];
  32906. function pushTarget (target) {
  32907. targetStack.push(target);
  32908. Dep.target = target;
  32909. }
  32910. function popTarget () {
  32911. targetStack.pop();
  32912. Dep.target = targetStack[targetStack.length - 1];
  32913. }
  32914. /* */
  32915. var VNode = function VNode (
  32916. tag,
  32917. data,
  32918. children,
  32919. text,
  32920. elm,
  32921. context,
  32922. componentOptions,
  32923. asyncFactory
  32924. ) {
  32925. this.tag = tag;
  32926. this.data = data;
  32927. this.children = children;
  32928. this.text = text;
  32929. this.elm = elm;
  32930. this.ns = undefined;
  32931. this.context = context;
  32932. this.fnContext = undefined;
  32933. this.fnOptions = undefined;
  32934. this.fnScopeId = undefined;
  32935. this.key = data && data.key;
  32936. this.componentOptions = componentOptions;
  32937. this.componentInstance = undefined;
  32938. this.parent = undefined;
  32939. this.raw = false;
  32940. this.isStatic = false;
  32941. this.isRootInsert = true;
  32942. this.isComment = false;
  32943. this.isCloned = false;
  32944. this.isOnce = false;
  32945. this.asyncFactory = asyncFactory;
  32946. this.asyncMeta = undefined;
  32947. this.isAsyncPlaceholder = false;
  32948. };
  32949. var prototypeAccessors = { child: { configurable: true } };
  32950. // DEPRECATED: alias for componentInstance for backwards compat.
  32951. /* istanbul ignore next */
  32952. prototypeAccessors.child.get = function () {
  32953. return this.componentInstance
  32954. };
  32955. Object.defineProperties( VNode.prototype, prototypeAccessors );
  32956. var createEmptyVNode = function (text) {
  32957. if ( text === void 0 ) text = '';
  32958. var node = new VNode();
  32959. node.text = text;
  32960. node.isComment = true;
  32961. return node
  32962. };
  32963. function createTextVNode (val) {
  32964. return new VNode(undefined, undefined, undefined, String(val))
  32965. }
  32966. // optimized shallow clone
  32967. // used for static nodes and slot nodes because they may be reused across
  32968. // multiple renders, cloning them avoids errors when DOM manipulations rely
  32969. // on their elm reference.
  32970. function cloneVNode (vnode) {
  32971. var cloned = new VNode(
  32972. vnode.tag,
  32973. vnode.data,
  32974. // #7975
  32975. // clone children array to avoid mutating original in case of cloning
  32976. // a child.
  32977. vnode.children && vnode.children.slice(),
  32978. vnode.text,
  32979. vnode.elm,
  32980. vnode.context,
  32981. vnode.componentOptions,
  32982. vnode.asyncFactory
  32983. );
  32984. cloned.ns = vnode.ns;
  32985. cloned.isStatic = vnode.isStatic;
  32986. cloned.key = vnode.key;
  32987. cloned.isComment = vnode.isComment;
  32988. cloned.fnContext = vnode.fnContext;
  32989. cloned.fnOptions = vnode.fnOptions;
  32990. cloned.fnScopeId = vnode.fnScopeId;
  32991. cloned.asyncMeta = vnode.asyncMeta;
  32992. cloned.isCloned = true;
  32993. return cloned
  32994. }
  32995. /*
  32996. * not type checking this file because flow doesn't play well with
  32997. * dynamically accessing methods on Array prototype
  32998. */
  32999. var arrayProto = Array.prototype;
  33000. var arrayMethods = Object.create(arrayProto);
  33001. var methodsToPatch = [
  33002. 'push',
  33003. 'pop',
  33004. 'shift',
  33005. 'unshift',
  33006. 'splice',
  33007. 'sort',
  33008. 'reverse'
  33009. ];
  33010. /**
  33011. * Intercept mutating methods and emit events
  33012. */
  33013. methodsToPatch.forEach(function (method) {
  33014. // cache original method
  33015. var original = arrayProto[method];
  33016. def(arrayMethods, method, function mutator () {
  33017. var args = [], len = arguments.length;
  33018. while ( len-- ) args[ len ] = arguments[ len ];
  33019. var result = original.apply(this, args);
  33020. var ob = this.__ob__;
  33021. var inserted;
  33022. switch (method) {
  33023. case 'push':
  33024. case 'unshift':
  33025. inserted = args;
  33026. break
  33027. case 'splice':
  33028. inserted = args.slice(2);
  33029. break
  33030. }
  33031. if (inserted) { ob.observeArray(inserted); }
  33032. // notify change
  33033. ob.dep.notify();
  33034. return result
  33035. });
  33036. });
  33037. /* */
  33038. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  33039. /**
  33040. * In some cases we may want to disable observation inside a component's
  33041. * update computation.
  33042. */
  33043. var shouldObserve = true;
  33044. function toggleObserving (value) {
  33045. shouldObserve = value;
  33046. }
  33047. /**
  33048. * Observer class that is attached to each observed
  33049. * object. Once attached, the observer converts the target
  33050. * object's property keys into getter/setters that
  33051. * collect dependencies and dispatch updates.
  33052. */
  33053. var Observer = function Observer (value) {
  33054. this.value = value;
  33055. this.dep = new Dep();
  33056. this.vmCount = 0;
  33057. def(value, '__ob__', this);
  33058. if (Array.isArray(value)) {
  33059. if (hasProto) {
  33060. protoAugment(value, arrayMethods);
  33061. } else {
  33062. copyAugment(value, arrayMethods, arrayKeys);
  33063. }
  33064. this.observeArray(value);
  33065. } else {
  33066. this.walk(value);
  33067. }
  33068. };
  33069. /**
  33070. * Walk through all properties and convert them into
  33071. * getter/setters. This method should only be called when
  33072. * value type is Object.
  33073. */
  33074. Observer.prototype.walk = function walk (obj) {
  33075. var keys = Object.keys(obj);
  33076. for (var i = 0; i < keys.length; i++) {
  33077. defineReactive$$1(obj, keys[i]);
  33078. }
  33079. };
  33080. /**
  33081. * Observe a list of Array items.
  33082. */
  33083. Observer.prototype.observeArray = function observeArray (items) {
  33084. for (var i = 0, l = items.length; i < l; i++) {
  33085. observe(items[i]);
  33086. }
  33087. };
  33088. // helpers
  33089. /**
  33090. * Augment a target Object or Array by intercepting
  33091. * the prototype chain using __proto__
  33092. */
  33093. function protoAugment (target, src) {
  33094. /* eslint-disable no-proto */
  33095. target.__proto__ = src;
  33096. /* eslint-enable no-proto */
  33097. }
  33098. /**
  33099. * Augment a target Object or Array by defining
  33100. * hidden properties.
  33101. */
  33102. /* istanbul ignore next */
  33103. function copyAugment (target, src, keys) {
  33104. for (var i = 0, l = keys.length; i < l; i++) {
  33105. var key = keys[i];
  33106. def(target, key, src[key]);
  33107. }
  33108. }
  33109. /**
  33110. * Attempt to create an observer instance for a value,
  33111. * returns the new observer if successfully observed,
  33112. * or the existing observer if the value already has one.
  33113. */
  33114. function observe (value, asRootData) {
  33115. if (!isObject(value) || value instanceof VNode) {
  33116. return
  33117. }
  33118. var ob;
  33119. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  33120. ob = value.__ob__;
  33121. } else if (
  33122. shouldObserve &&
  33123. !isServerRendering() &&
  33124. (Array.isArray(value) || isPlainObject(value)) &&
  33125. Object.isExtensible(value) &&
  33126. !value._isVue
  33127. ) {
  33128. ob = new Observer(value);
  33129. }
  33130. if (asRootData && ob) {
  33131. ob.vmCount++;
  33132. }
  33133. return ob
  33134. }
  33135. /**
  33136. * Define a reactive property on an Object.
  33137. */
  33138. function defineReactive$$1 (
  33139. obj,
  33140. key,
  33141. val,
  33142. customSetter,
  33143. shallow
  33144. ) {
  33145. var dep = new Dep();
  33146. var property = Object.getOwnPropertyDescriptor(obj, key);
  33147. if (property && property.configurable === false) {
  33148. return
  33149. }
  33150. // cater for pre-defined getter/setters
  33151. var getter = property && property.get;
  33152. var setter = property && property.set;
  33153. if ((!getter || setter) && arguments.length === 2) {
  33154. val = obj[key];
  33155. }
  33156. var childOb = !shallow && observe(val);
  33157. Object.defineProperty(obj, key, {
  33158. enumerable: true,
  33159. configurable: true,
  33160. get: function reactiveGetter () {
  33161. var value = getter ? getter.call(obj) : val;
  33162. if (Dep.target) {
  33163. dep.depend();
  33164. if (childOb) {
  33165. childOb.dep.depend();
  33166. if (Array.isArray(value)) {
  33167. dependArray(value);
  33168. }
  33169. }
  33170. }
  33171. return value
  33172. },
  33173. set: function reactiveSetter (newVal) {
  33174. var value = getter ? getter.call(obj) : val;
  33175. /* eslint-disable no-self-compare */
  33176. if (newVal === value || (newVal !== newVal && value !== value)) {
  33177. return
  33178. }
  33179. /* eslint-enable no-self-compare */
  33180. if (customSetter) {
  33181. customSetter();
  33182. }
  33183. // #7981: for accessor properties without setter
  33184. if (getter && !setter) { return }
  33185. if (setter) {
  33186. setter.call(obj, newVal);
  33187. } else {
  33188. val = newVal;
  33189. }
  33190. childOb = !shallow && observe(newVal);
  33191. dep.notify();
  33192. }
  33193. });
  33194. }
  33195. /**
  33196. * Set a property on an object. Adds the new property and
  33197. * triggers change notification if the property doesn't
  33198. * already exist.
  33199. */
  33200. function set (target, key, val) {
  33201. if (isUndef(target) || isPrimitive(target)
  33202. ) {
  33203. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  33204. }
  33205. if (Array.isArray(target) && isValidArrayIndex(key)) {
  33206. target.length = Math.max(target.length, key);
  33207. target.splice(key, 1, val);
  33208. return val
  33209. }
  33210. if (key in target && !(key in Object.prototype)) {
  33211. target[key] = val;
  33212. return val
  33213. }
  33214. var ob = (target).__ob__;
  33215. if (target._isVue || (ob && ob.vmCount)) {
  33216. warn(
  33217. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  33218. 'at runtime - declare it upfront in the data option.'
  33219. );
  33220. return val
  33221. }
  33222. if (!ob) {
  33223. target[key] = val;
  33224. return val
  33225. }
  33226. defineReactive$$1(ob.value, key, val);
  33227. ob.dep.notify();
  33228. return val
  33229. }
  33230. /**
  33231. * Delete a property and trigger change if necessary.
  33232. */
  33233. function del (target, key) {
  33234. if (isUndef(target) || isPrimitive(target)
  33235. ) {
  33236. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  33237. }
  33238. if (Array.isArray(target) && isValidArrayIndex(key)) {
  33239. target.splice(key, 1);
  33240. return
  33241. }
  33242. var ob = (target).__ob__;
  33243. if (target._isVue || (ob && ob.vmCount)) {
  33244. warn(
  33245. 'Avoid deleting properties on a Vue instance or its root $data ' +
  33246. '- just set it to null.'
  33247. );
  33248. return
  33249. }
  33250. if (!hasOwn(target, key)) {
  33251. return
  33252. }
  33253. delete target[key];
  33254. if (!ob) {
  33255. return
  33256. }
  33257. ob.dep.notify();
  33258. }
  33259. /**
  33260. * Collect dependencies on array elements when the array is touched, since
  33261. * we cannot intercept array element access like property getters.
  33262. */
  33263. function dependArray (value) {
  33264. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  33265. e = value[i];
  33266. e && e.__ob__ && e.__ob__.dep.depend();
  33267. if (Array.isArray(e)) {
  33268. dependArray(e);
  33269. }
  33270. }
  33271. }
  33272. /* */
  33273. /**
  33274. * Option overwriting strategies are functions that handle
  33275. * how to merge a parent option value and a child option
  33276. * value into the final value.
  33277. */
  33278. var strats = config.optionMergeStrategies;
  33279. /**
  33280. * Options with restrictions
  33281. */
  33282. {
  33283. strats.el = strats.propsData = function (parent, child, vm, key) {
  33284. if (!vm) {
  33285. warn(
  33286. "option \"" + key + "\" can only be used during instance " +
  33287. 'creation with the `new` keyword.'
  33288. );
  33289. }
  33290. return defaultStrat(parent, child)
  33291. };
  33292. }
  33293. /**
  33294. * Helper that recursively merges two data objects together.
  33295. */
  33296. function mergeData (to, from) {
  33297. if (!from) { return to }
  33298. var key, toVal, fromVal;
  33299. var keys = hasSymbol
  33300. ? Reflect.ownKeys(from)
  33301. : Object.keys(from);
  33302. for (var i = 0; i < keys.length; i++) {
  33303. key = keys[i];
  33304. // in case the object is already observed...
  33305. if (key === '__ob__') { continue }
  33306. toVal = to[key];
  33307. fromVal = from[key];
  33308. if (!hasOwn(to, key)) {
  33309. set(to, key, fromVal);
  33310. } else if (
  33311. toVal !== fromVal &&
  33312. isPlainObject(toVal) &&
  33313. isPlainObject(fromVal)
  33314. ) {
  33315. mergeData(toVal, fromVal);
  33316. }
  33317. }
  33318. return to
  33319. }
  33320. /**
  33321. * Data
  33322. */
  33323. function mergeDataOrFn (
  33324. parentVal,
  33325. childVal,
  33326. vm
  33327. ) {
  33328. if (!vm) {
  33329. // in a Vue.extend merge, both should be functions
  33330. if (!childVal) {
  33331. return parentVal
  33332. }
  33333. if (!parentVal) {
  33334. return childVal
  33335. }
  33336. // when parentVal & childVal are both present,
  33337. // we need to return a function that returns the
  33338. // merged result of both functions... no need to
  33339. // check if parentVal is a function here because
  33340. // it has to be a function to pass previous merges.
  33341. return function mergedDataFn () {
  33342. return mergeData(
  33343. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  33344. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  33345. )
  33346. }
  33347. } else {
  33348. return function mergedInstanceDataFn () {
  33349. // instance merge
  33350. var instanceData = typeof childVal === 'function'
  33351. ? childVal.call(vm, vm)
  33352. : childVal;
  33353. var defaultData = typeof parentVal === 'function'
  33354. ? parentVal.call(vm, vm)
  33355. : parentVal;
  33356. if (instanceData) {
  33357. return mergeData(instanceData, defaultData)
  33358. } else {
  33359. return defaultData
  33360. }
  33361. }
  33362. }
  33363. }
  33364. strats.data = function (
  33365. parentVal,
  33366. childVal,
  33367. vm
  33368. ) {
  33369. if (!vm) {
  33370. if (childVal && typeof childVal !== 'function') {
  33371. warn(
  33372. 'The "data" option should be a function ' +
  33373. 'that returns a per-instance value in component ' +
  33374. 'definitions.',
  33375. vm
  33376. );
  33377. return parentVal
  33378. }
  33379. return mergeDataOrFn(parentVal, childVal)
  33380. }
  33381. return mergeDataOrFn(parentVal, childVal, vm)
  33382. };
  33383. /**
  33384. * Hooks and props are merged as arrays.
  33385. */
  33386. function mergeHook (
  33387. parentVal,
  33388. childVal
  33389. ) {
  33390. var res = childVal
  33391. ? parentVal
  33392. ? parentVal.concat(childVal)
  33393. : Array.isArray(childVal)
  33394. ? childVal
  33395. : [childVal]
  33396. : parentVal;
  33397. return res
  33398. ? dedupeHooks(res)
  33399. : res
  33400. }
  33401. function dedupeHooks (hooks) {
  33402. var res = [];
  33403. for (var i = 0; i < hooks.length; i++) {
  33404. if (res.indexOf(hooks[i]) === -1) {
  33405. res.push(hooks[i]);
  33406. }
  33407. }
  33408. return res
  33409. }
  33410. LIFECYCLE_HOOKS.forEach(function (hook) {
  33411. strats[hook] = mergeHook;
  33412. });
  33413. /**
  33414. * Assets
  33415. *
  33416. * When a vm is present (instance creation), we need to do
  33417. * a three-way merge between constructor options, instance
  33418. * options and parent options.
  33419. */
  33420. function mergeAssets (
  33421. parentVal,
  33422. childVal,
  33423. vm,
  33424. key
  33425. ) {
  33426. var res = Object.create(parentVal || null);
  33427. if (childVal) {
  33428. assertObjectType(key, childVal, vm);
  33429. return extend(res, childVal)
  33430. } else {
  33431. return res
  33432. }
  33433. }
  33434. ASSET_TYPES.forEach(function (type) {
  33435. strats[type + 's'] = mergeAssets;
  33436. });
  33437. /**
  33438. * Watchers.
  33439. *
  33440. * Watchers hashes should not overwrite one
  33441. * another, so we merge them as arrays.
  33442. */
  33443. strats.watch = function (
  33444. parentVal,
  33445. childVal,
  33446. vm,
  33447. key
  33448. ) {
  33449. // work around Firefox's Object.prototype.watch...
  33450. if (parentVal === nativeWatch) { parentVal = undefined; }
  33451. if (childVal === nativeWatch) { childVal = undefined; }
  33452. /* istanbul ignore if */
  33453. if (!childVal) { return Object.create(parentVal || null) }
  33454. {
  33455. assertObjectType(key, childVal, vm);
  33456. }
  33457. if (!parentVal) { return childVal }
  33458. var ret = {};
  33459. extend(ret, parentVal);
  33460. for (var key$1 in childVal) {
  33461. var parent = ret[key$1];
  33462. var child = childVal[key$1];
  33463. if (parent && !Array.isArray(parent)) {
  33464. parent = [parent];
  33465. }
  33466. ret[key$1] = parent
  33467. ? parent.concat(child)
  33468. : Array.isArray(child) ? child : [child];
  33469. }
  33470. return ret
  33471. };
  33472. /**
  33473. * Other object hashes.
  33474. */
  33475. strats.props =
  33476. strats.methods =
  33477. strats.inject =
  33478. strats.computed = function (
  33479. parentVal,
  33480. childVal,
  33481. vm,
  33482. key
  33483. ) {
  33484. if (childVal && "development" !== 'production') {
  33485. assertObjectType(key, childVal, vm);
  33486. }
  33487. if (!parentVal) { return childVal }
  33488. var ret = Object.create(null);
  33489. extend(ret, parentVal);
  33490. if (childVal) { extend(ret, childVal); }
  33491. return ret
  33492. };
  33493. strats.provide = mergeDataOrFn;
  33494. /**
  33495. * Default strategy.
  33496. */
  33497. var defaultStrat = function (parentVal, childVal) {
  33498. return childVal === undefined
  33499. ? parentVal
  33500. : childVal
  33501. };
  33502. /**
  33503. * Validate component names
  33504. */
  33505. function checkComponents (options) {
  33506. for (var key in options.components) {
  33507. validateComponentName(key);
  33508. }
  33509. }
  33510. function validateComponentName (name) {
  33511. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + unicodeLetters + "]*$")).test(name)) {
  33512. warn(
  33513. 'Invalid component name: "' + name + '". Component names ' +
  33514. 'should conform to valid custom element name in html5 specification.'
  33515. );
  33516. }
  33517. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  33518. warn(
  33519. 'Do not use built-in or reserved HTML elements as component ' +
  33520. 'id: ' + name
  33521. );
  33522. }
  33523. }
  33524. /**
  33525. * Ensure all props option syntax are normalized into the
  33526. * Object-based format.
  33527. */
  33528. function normalizeProps (options, vm) {
  33529. var props = options.props;
  33530. if (!props) { return }
  33531. var res = {};
  33532. var i, val, name;
  33533. if (Array.isArray(props)) {
  33534. i = props.length;
  33535. while (i--) {
  33536. val = props[i];
  33537. if (typeof val === 'string') {
  33538. name = camelize(val);
  33539. res[name] = { type: null };
  33540. } else {
  33541. warn('props must be strings when using array syntax.');
  33542. }
  33543. }
  33544. } else if (isPlainObject(props)) {
  33545. for (var key in props) {
  33546. val = props[key];
  33547. name = camelize(key);
  33548. res[name] = isPlainObject(val)
  33549. ? val
  33550. : { type: val };
  33551. }
  33552. } else {
  33553. warn(
  33554. "Invalid value for option \"props\": expected an Array or an Object, " +
  33555. "but got " + (toRawType(props)) + ".",
  33556. vm
  33557. );
  33558. }
  33559. options.props = res;
  33560. }
  33561. /**
  33562. * Normalize all injections into Object-based format
  33563. */
  33564. function normalizeInject (options, vm) {
  33565. var inject = options.inject;
  33566. if (!inject) { return }
  33567. var normalized = options.inject = {};
  33568. if (Array.isArray(inject)) {
  33569. for (var i = 0; i < inject.length; i++) {
  33570. normalized[inject[i]] = { from: inject[i] };
  33571. }
  33572. } else if (isPlainObject(inject)) {
  33573. for (var key in inject) {
  33574. var val = inject[key];
  33575. normalized[key] = isPlainObject(val)
  33576. ? extend({ from: key }, val)
  33577. : { from: val };
  33578. }
  33579. } else {
  33580. warn(
  33581. "Invalid value for option \"inject\": expected an Array or an Object, " +
  33582. "but got " + (toRawType(inject)) + ".",
  33583. vm
  33584. );
  33585. }
  33586. }
  33587. /**
  33588. * Normalize raw function directives into object format.
  33589. */
  33590. function normalizeDirectives (options) {
  33591. var dirs = options.directives;
  33592. if (dirs) {
  33593. for (var key in dirs) {
  33594. var def$$1 = dirs[key];
  33595. if (typeof def$$1 === 'function') {
  33596. dirs[key] = { bind: def$$1, update: def$$1 };
  33597. }
  33598. }
  33599. }
  33600. }
  33601. function assertObjectType (name, value, vm) {
  33602. if (!isPlainObject(value)) {
  33603. warn(
  33604. "Invalid value for option \"" + name + "\": expected an Object, " +
  33605. "but got " + (toRawType(value)) + ".",
  33606. vm
  33607. );
  33608. }
  33609. }
  33610. /**
  33611. * Merge two option objects into a new one.
  33612. * Core utility used in both instantiation and inheritance.
  33613. */
  33614. function mergeOptions (
  33615. parent,
  33616. child,
  33617. vm
  33618. ) {
  33619. {
  33620. checkComponents(child);
  33621. }
  33622. if (typeof child === 'function') {
  33623. child = child.options;
  33624. }
  33625. normalizeProps(child, vm);
  33626. normalizeInject(child, vm);
  33627. normalizeDirectives(child);
  33628. // Apply extends and mixins on the child options,
  33629. // but only if it is a raw options object that isn't
  33630. // the result of another mergeOptions call.
  33631. // Only merged options has the _base property.
  33632. if (!child._base) {
  33633. if (child.extends) {
  33634. parent = mergeOptions(parent, child.extends, vm);
  33635. }
  33636. if (child.mixins) {
  33637. for (var i = 0, l = child.mixins.length; i < l; i++) {
  33638. parent = mergeOptions(parent, child.mixins[i], vm);
  33639. }
  33640. }
  33641. }
  33642. var options = {};
  33643. var key;
  33644. for (key in parent) {
  33645. mergeField(key);
  33646. }
  33647. for (key in child) {
  33648. if (!hasOwn(parent, key)) {
  33649. mergeField(key);
  33650. }
  33651. }
  33652. function mergeField (key) {
  33653. var strat = strats[key] || defaultStrat;
  33654. options[key] = strat(parent[key], child[key], vm, key);
  33655. }
  33656. return options
  33657. }
  33658. /**
  33659. * Resolve an asset.
  33660. * This function is used because child instances need access
  33661. * to assets defined in its ancestor chain.
  33662. */
  33663. function resolveAsset (
  33664. options,
  33665. type,
  33666. id,
  33667. warnMissing
  33668. ) {
  33669. /* istanbul ignore if */
  33670. if (typeof id !== 'string') {
  33671. return
  33672. }
  33673. var assets = options[type];
  33674. // check local registration variations first
  33675. if (hasOwn(assets, id)) { return assets[id] }
  33676. var camelizedId = camelize(id);
  33677. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  33678. var PascalCaseId = capitalize(camelizedId);
  33679. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  33680. // fallback to prototype chain
  33681. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  33682. if (warnMissing && !res) {
  33683. warn(
  33684. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  33685. options
  33686. );
  33687. }
  33688. return res
  33689. }
  33690. /* */
  33691. function validateProp (
  33692. key,
  33693. propOptions,
  33694. propsData,
  33695. vm
  33696. ) {
  33697. var prop = propOptions[key];
  33698. var absent = !hasOwn(propsData, key);
  33699. var value = propsData[key];
  33700. // boolean casting
  33701. var booleanIndex = getTypeIndex(Boolean, prop.type);
  33702. if (booleanIndex > -1) {
  33703. if (absent && !hasOwn(prop, 'default')) {
  33704. value = false;
  33705. } else if (value === '' || value === hyphenate(key)) {
  33706. // only cast empty string / same name to boolean if
  33707. // boolean has higher priority
  33708. var stringIndex = getTypeIndex(String, prop.type);
  33709. if (stringIndex < 0 || booleanIndex < stringIndex) {
  33710. value = true;
  33711. }
  33712. }
  33713. }
  33714. // check default value
  33715. if (value === undefined) {
  33716. value = getPropDefaultValue(vm, prop, key);
  33717. // since the default value is a fresh copy,
  33718. // make sure to observe it.
  33719. var prevShouldObserve = shouldObserve;
  33720. toggleObserving(true);
  33721. observe(value);
  33722. toggleObserving(prevShouldObserve);
  33723. }
  33724. {
  33725. assertProp(prop, key, value, vm, absent);
  33726. }
  33727. return value
  33728. }
  33729. /**
  33730. * Get the default value of a prop.
  33731. */
  33732. function getPropDefaultValue (vm, prop, key) {
  33733. // no default, return undefined
  33734. if (!hasOwn(prop, 'default')) {
  33735. return undefined
  33736. }
  33737. var def = prop.default;
  33738. // warn against non-factory defaults for Object & Array
  33739. if (isObject(def)) {
  33740. warn(
  33741. 'Invalid default value for prop "' + key + '": ' +
  33742. 'Props with type Object/Array must use a factory function ' +
  33743. 'to return the default value.',
  33744. vm
  33745. );
  33746. }
  33747. // the raw prop value was also undefined from previous render,
  33748. // return previous default value to avoid unnecessary watcher trigger
  33749. if (vm && vm.$options.propsData &&
  33750. vm.$options.propsData[key] === undefined &&
  33751. vm._props[key] !== undefined
  33752. ) {
  33753. return vm._props[key]
  33754. }
  33755. // call factory function for non-Function types
  33756. // a value is Function if its prototype is function even across different execution context
  33757. return typeof def === 'function' && getType(prop.type) !== 'Function'
  33758. ? def.call(vm)
  33759. : def
  33760. }
  33761. /**
  33762. * Assert whether a prop is valid.
  33763. */
  33764. function assertProp (
  33765. prop,
  33766. name,
  33767. value,
  33768. vm,
  33769. absent
  33770. ) {
  33771. if (prop.required && absent) {
  33772. warn(
  33773. 'Missing required prop: "' + name + '"',
  33774. vm
  33775. );
  33776. return
  33777. }
  33778. if (value == null && !prop.required) {
  33779. return
  33780. }
  33781. var type = prop.type;
  33782. var valid = !type || type === true;
  33783. var expectedTypes = [];
  33784. if (type) {
  33785. if (!Array.isArray(type)) {
  33786. type = [type];
  33787. }
  33788. for (var i = 0; i < type.length && !valid; i++) {
  33789. var assertedType = assertType(value, type[i]);
  33790. expectedTypes.push(assertedType.expectedType || '');
  33791. valid = assertedType.valid;
  33792. }
  33793. }
  33794. if (!valid) {
  33795. warn(
  33796. getInvalidTypeMessage(name, value, expectedTypes),
  33797. vm
  33798. );
  33799. return
  33800. }
  33801. var validator = prop.validator;
  33802. if (validator) {
  33803. if (!validator(value)) {
  33804. warn(
  33805. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  33806. vm
  33807. );
  33808. }
  33809. }
  33810. }
  33811. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  33812. function assertType (value, type) {
  33813. var valid;
  33814. var expectedType = getType(type);
  33815. if (simpleCheckRE.test(expectedType)) {
  33816. var t = typeof value;
  33817. valid = t === expectedType.toLowerCase();
  33818. // for primitive wrapper objects
  33819. if (!valid && t === 'object') {
  33820. valid = value instanceof type;
  33821. }
  33822. } else if (expectedType === 'Object') {
  33823. valid = isPlainObject(value);
  33824. } else if (expectedType === 'Array') {
  33825. valid = Array.isArray(value);
  33826. } else {
  33827. valid = value instanceof type;
  33828. }
  33829. return {
  33830. valid: valid,
  33831. expectedType: expectedType
  33832. }
  33833. }
  33834. /**
  33835. * Use function string name to check built-in types,
  33836. * because a simple equality check will fail when running
  33837. * across different vms / iframes.
  33838. */
  33839. function getType (fn) {
  33840. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  33841. return match ? match[1] : ''
  33842. }
  33843. function isSameType (a, b) {
  33844. return getType(a) === getType(b)
  33845. }
  33846. function getTypeIndex (type, expectedTypes) {
  33847. if (!Array.isArray(expectedTypes)) {
  33848. return isSameType(expectedTypes, type) ? 0 : -1
  33849. }
  33850. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  33851. if (isSameType(expectedTypes[i], type)) {
  33852. return i
  33853. }
  33854. }
  33855. return -1
  33856. }
  33857. function getInvalidTypeMessage (name, value, expectedTypes) {
  33858. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  33859. " Expected " + (expectedTypes.map(capitalize).join(', '));
  33860. var expectedType = expectedTypes[0];
  33861. var receivedType = toRawType(value);
  33862. var expectedValue = styleValue(value, expectedType);
  33863. var receivedValue = styleValue(value, receivedType);
  33864. // check if we need to specify expected value
  33865. if (expectedTypes.length === 1 &&
  33866. isExplicable(expectedType) &&
  33867. !isBoolean(expectedType, receivedType)) {
  33868. message += " with value " + expectedValue;
  33869. }
  33870. message += ", got " + receivedType + " ";
  33871. // check if we need to specify received value
  33872. if (isExplicable(receivedType)) {
  33873. message += "with value " + receivedValue + ".";
  33874. }
  33875. return message
  33876. }
  33877. function styleValue (value, type) {
  33878. if (type === 'String') {
  33879. return ("\"" + value + "\"")
  33880. } else if (type === 'Number') {
  33881. return ("" + (Number(value)))
  33882. } else {
  33883. return ("" + value)
  33884. }
  33885. }
  33886. function isExplicable (value) {
  33887. var explicitTypes = ['string', 'number', 'boolean'];
  33888. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  33889. }
  33890. function isBoolean () {
  33891. var args = [], len = arguments.length;
  33892. while ( len-- ) args[ len ] = arguments[ len ];
  33893. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  33894. }
  33895. /* */
  33896. function handleError (err, vm, info) {
  33897. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  33898. // See: https://github.com/vuejs/vuex/issues/1505
  33899. pushTarget();
  33900. try {
  33901. if (vm) {
  33902. var cur = vm;
  33903. while ((cur = cur.$parent)) {
  33904. var hooks = cur.$options.errorCaptured;
  33905. if (hooks) {
  33906. for (var i = 0; i < hooks.length; i++) {
  33907. try {
  33908. var capture = hooks[i].call(cur, err, vm, info) === false;
  33909. if (capture) { return }
  33910. } catch (e) {
  33911. globalHandleError(e, cur, 'errorCaptured hook');
  33912. }
  33913. }
  33914. }
  33915. }
  33916. }
  33917. globalHandleError(err, vm, info);
  33918. } finally {
  33919. popTarget();
  33920. }
  33921. }
  33922. function invokeWithErrorHandling (
  33923. handler,
  33924. context,
  33925. args,
  33926. vm,
  33927. info
  33928. ) {
  33929. var res;
  33930. try {
  33931. res = args ? handler.apply(context, args) : handler.call(context);
  33932. if (res && !res._isVue && isPromise(res)) {
  33933. // issue #9511
  33934. // reassign to res to avoid catch triggering multiple times when nested calls
  33935. res = res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  33936. }
  33937. } catch (e) {
  33938. handleError(e, vm, info);
  33939. }
  33940. return res
  33941. }
  33942. function globalHandleError (err, vm, info) {
  33943. if (config.errorHandler) {
  33944. try {
  33945. return config.errorHandler.call(null, err, vm, info)
  33946. } catch (e) {
  33947. // if the user intentionally throws the original error in the handler,
  33948. // do not log it twice
  33949. if (e !== err) {
  33950. logError(e, null, 'config.errorHandler');
  33951. }
  33952. }
  33953. }
  33954. logError(err, vm, info);
  33955. }
  33956. function logError (err, vm, info) {
  33957. {
  33958. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  33959. }
  33960. /* istanbul ignore else */
  33961. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  33962. console.error(err);
  33963. } else {
  33964. throw err
  33965. }
  33966. }
  33967. /* */
  33968. var isUsingMicroTask = false;
  33969. var callbacks = [];
  33970. var pending = false;
  33971. function flushCallbacks () {
  33972. pending = false;
  33973. var copies = callbacks.slice(0);
  33974. callbacks.length = 0;
  33975. for (var i = 0; i < copies.length; i++) {
  33976. copies[i]();
  33977. }
  33978. }
  33979. // Here we have async deferring wrappers using microtasks.
  33980. // In 2.5 we used (macro) tasks (in combination with microtasks).
  33981. // However, it has subtle problems when state is changed right before repaint
  33982. // (e.g. #6813, out-in transitions).
  33983. // Also, using (macro) tasks in event handler would cause some weird behaviors
  33984. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  33985. // So we now use microtasks everywhere, again.
  33986. // A major drawback of this tradeoff is that there are some scenarios
  33987. // where microtasks have too high a priority and fire in between supposedly
  33988. // sequential events (e.g. #4521, #6690, which have workarounds)
  33989. // or even between bubbling of the same event (#6566).
  33990. var timerFunc;
  33991. // The nextTick behavior leverages the microtask queue, which can be accessed
  33992. // via either native Promise.then or MutationObserver.
  33993. // MutationObserver has wider support, however it is seriously bugged in
  33994. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  33995. // completely stops working after triggering a few times... so, if native
  33996. // Promise is available, we will use it:
  33997. /* istanbul ignore next, $flow-disable-line */
  33998. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  33999. var p = Promise.resolve();
  34000. timerFunc = function () {
  34001. p.then(flushCallbacks);
  34002. // In problematic UIWebViews, Promise.then doesn't completely break, but
  34003. // it can get stuck in a weird state where callbacks are pushed into the
  34004. // microtask queue but the queue isn't being flushed, until the browser
  34005. // needs to do some other work, e.g. handle a timer. Therefore we can
  34006. // "force" the microtask queue to be flushed by adding an empty timer.
  34007. if (isIOS) { setTimeout(noop); }
  34008. };
  34009. isUsingMicroTask = true;
  34010. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  34011. isNative(MutationObserver) ||
  34012. // PhantomJS and iOS 7.x
  34013. MutationObserver.toString() === '[object MutationObserverConstructor]'
  34014. )) {
  34015. // Use MutationObserver where native Promise is not available,
  34016. // e.g. PhantomJS, iOS7, Android 4.4
  34017. // (#6466 MutationObserver is unreliable in IE11)
  34018. var counter = 1;
  34019. var observer = new MutationObserver(flushCallbacks);
  34020. var textNode = document.createTextNode(String(counter));
  34021. observer.observe(textNode, {
  34022. characterData: true
  34023. });
  34024. timerFunc = function () {
  34025. counter = (counter + 1) % 2;
  34026. textNode.data = String(counter);
  34027. };
  34028. isUsingMicroTask = true;
  34029. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  34030. // Fallback to setImmediate.
  34031. // Techinically it leverages the (macro) task queue,
  34032. // but it is still a better choice than setTimeout.
  34033. timerFunc = function () {
  34034. setImmediate(flushCallbacks);
  34035. };
  34036. } else {
  34037. // Fallback to setTimeout.
  34038. timerFunc = function () {
  34039. setTimeout(flushCallbacks, 0);
  34040. };
  34041. }
  34042. function nextTick (cb, ctx) {
  34043. var _resolve;
  34044. callbacks.push(function () {
  34045. if (cb) {
  34046. try {
  34047. cb.call(ctx);
  34048. } catch (e) {
  34049. handleError(e, ctx, 'nextTick');
  34050. }
  34051. } else if (_resolve) {
  34052. _resolve(ctx);
  34053. }
  34054. });
  34055. if (!pending) {
  34056. pending = true;
  34057. timerFunc();
  34058. }
  34059. // $flow-disable-line
  34060. if (!cb && typeof Promise !== 'undefined') {
  34061. return new Promise(function (resolve) {
  34062. _resolve = resolve;
  34063. })
  34064. }
  34065. }
  34066. /* */
  34067. var mark;
  34068. var measure;
  34069. {
  34070. var perf = inBrowser && window.performance;
  34071. /* istanbul ignore if */
  34072. if (
  34073. perf &&
  34074. perf.mark &&
  34075. perf.measure &&
  34076. perf.clearMarks &&
  34077. perf.clearMeasures
  34078. ) {
  34079. mark = function (tag) { return perf.mark(tag); };
  34080. measure = function (name, startTag, endTag) {
  34081. perf.measure(name, startTag, endTag);
  34082. perf.clearMarks(startTag);
  34083. perf.clearMarks(endTag);
  34084. // perf.clearMeasures(name)
  34085. };
  34086. }
  34087. }
  34088. /* not type checking this file because flow doesn't play well with Proxy */
  34089. var initProxy;
  34090. {
  34091. var allowedGlobals = makeMap(
  34092. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  34093. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  34094. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  34095. 'require' // for Webpack/Browserify
  34096. );
  34097. var warnNonPresent = function (target, key) {
  34098. warn(
  34099. "Property or method \"" + key + "\" is not defined on the instance but " +
  34100. 'referenced during render. Make sure that this property is reactive, ' +
  34101. 'either in the data option, or for class-based components, by ' +
  34102. 'initializing the property. ' +
  34103. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  34104. target
  34105. );
  34106. };
  34107. var warnReservedPrefix = function (target, key) {
  34108. warn(
  34109. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  34110. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  34111. 'prevent conflicts with Vue internals' +
  34112. 'See: https://vuejs.org/v2/api/#data',
  34113. target
  34114. );
  34115. };
  34116. var hasProxy =
  34117. typeof Proxy !== 'undefined' && isNative(Proxy);
  34118. if (hasProxy) {
  34119. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  34120. config.keyCodes = new Proxy(config.keyCodes, {
  34121. set: function set (target, key, value) {
  34122. if (isBuiltInModifier(key)) {
  34123. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  34124. return false
  34125. } else {
  34126. target[key] = value;
  34127. return true
  34128. }
  34129. }
  34130. });
  34131. }
  34132. var hasHandler = {
  34133. has: function has (target, key) {
  34134. var has = key in target;
  34135. var isAllowed = allowedGlobals(key) ||
  34136. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  34137. if (!has && !isAllowed) {
  34138. if (key in target.$data) { warnReservedPrefix(target, key); }
  34139. else { warnNonPresent(target, key); }
  34140. }
  34141. return has || !isAllowed
  34142. }
  34143. };
  34144. var getHandler = {
  34145. get: function get (target, key) {
  34146. if (typeof key === 'string' && !(key in target)) {
  34147. if (key in target.$data) { warnReservedPrefix(target, key); }
  34148. else { warnNonPresent(target, key); }
  34149. }
  34150. return target[key]
  34151. }
  34152. };
  34153. initProxy = function initProxy (vm) {
  34154. if (hasProxy) {
  34155. // determine which proxy handler to use
  34156. var options = vm.$options;
  34157. var handlers = options.render && options.render._withStripped
  34158. ? getHandler
  34159. : hasHandler;
  34160. vm._renderProxy = new Proxy(vm, handlers);
  34161. } else {
  34162. vm._renderProxy = vm;
  34163. }
  34164. };
  34165. }
  34166. /* */
  34167. var seenObjects = new _Set();
  34168. /**
  34169. * Recursively traverse an object to evoke all converted
  34170. * getters, so that every nested property inside the object
  34171. * is collected as a "deep" dependency.
  34172. */
  34173. function traverse (val) {
  34174. _traverse(val, seenObjects);
  34175. seenObjects.clear();
  34176. }
  34177. function _traverse (val, seen) {
  34178. var i, keys;
  34179. var isA = Array.isArray(val);
  34180. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  34181. return
  34182. }
  34183. if (val.__ob__) {
  34184. var depId = val.__ob__.dep.id;
  34185. if (seen.has(depId)) {
  34186. return
  34187. }
  34188. seen.add(depId);
  34189. }
  34190. if (isA) {
  34191. i = val.length;
  34192. while (i--) { _traverse(val[i], seen); }
  34193. } else {
  34194. keys = Object.keys(val);
  34195. i = keys.length;
  34196. while (i--) { _traverse(val[keys[i]], seen); }
  34197. }
  34198. }
  34199. /* */
  34200. var normalizeEvent = cached(function (name) {
  34201. var passive = name.charAt(0) === '&';
  34202. name = passive ? name.slice(1) : name;
  34203. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  34204. name = once$$1 ? name.slice(1) : name;
  34205. var capture = name.charAt(0) === '!';
  34206. name = capture ? name.slice(1) : name;
  34207. return {
  34208. name: name,
  34209. once: once$$1,
  34210. capture: capture,
  34211. passive: passive
  34212. }
  34213. });
  34214. function createFnInvoker (fns, vm) {
  34215. function invoker () {
  34216. var arguments$1 = arguments;
  34217. var fns = invoker.fns;
  34218. if (Array.isArray(fns)) {
  34219. var cloned = fns.slice();
  34220. for (var i = 0; i < cloned.length; i++) {
  34221. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  34222. }
  34223. } else {
  34224. // return handler return value for single handlers
  34225. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  34226. }
  34227. }
  34228. invoker.fns = fns;
  34229. return invoker
  34230. }
  34231. function updateListeners (
  34232. on,
  34233. oldOn,
  34234. add,
  34235. remove$$1,
  34236. createOnceHandler,
  34237. vm
  34238. ) {
  34239. var name, def$$1, cur, old, event;
  34240. for (name in on) {
  34241. def$$1 = cur = on[name];
  34242. old = oldOn[name];
  34243. event = normalizeEvent(name);
  34244. if (isUndef(cur)) {
  34245. warn(
  34246. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  34247. vm
  34248. );
  34249. } else if (isUndef(old)) {
  34250. if (isUndef(cur.fns)) {
  34251. cur = on[name] = createFnInvoker(cur, vm);
  34252. }
  34253. if (isTrue(event.once)) {
  34254. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  34255. }
  34256. add(event.name, cur, event.capture, event.passive, event.params);
  34257. } else if (cur !== old) {
  34258. old.fns = cur;
  34259. on[name] = old;
  34260. }
  34261. }
  34262. for (name in oldOn) {
  34263. if (isUndef(on[name])) {
  34264. event = normalizeEvent(name);
  34265. remove$$1(event.name, oldOn[name], event.capture);
  34266. }
  34267. }
  34268. }
  34269. /* */
  34270. function mergeVNodeHook (def, hookKey, hook) {
  34271. if (def instanceof VNode) {
  34272. def = def.data.hook || (def.data.hook = {});
  34273. }
  34274. var invoker;
  34275. var oldHook = def[hookKey];
  34276. function wrappedHook () {
  34277. hook.apply(this, arguments);
  34278. // important: remove merged hook to ensure it's called only once
  34279. // and prevent memory leak
  34280. remove(invoker.fns, wrappedHook);
  34281. }
  34282. if (isUndef(oldHook)) {
  34283. // no existing hook
  34284. invoker = createFnInvoker([wrappedHook]);
  34285. } else {
  34286. /* istanbul ignore if */
  34287. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  34288. // already a merged invoker
  34289. invoker = oldHook;
  34290. invoker.fns.push(wrappedHook);
  34291. } else {
  34292. // existing plain hook
  34293. invoker = createFnInvoker([oldHook, wrappedHook]);
  34294. }
  34295. }
  34296. invoker.merged = true;
  34297. def[hookKey] = invoker;
  34298. }
  34299. /* */
  34300. function extractPropsFromVNodeData (
  34301. data,
  34302. Ctor,
  34303. tag
  34304. ) {
  34305. // we are only extracting raw values here.
  34306. // validation and default values are handled in the child
  34307. // component itself.
  34308. var propOptions = Ctor.options.props;
  34309. if (isUndef(propOptions)) {
  34310. return
  34311. }
  34312. var res = {};
  34313. var attrs = data.attrs;
  34314. var props = data.props;
  34315. if (isDef(attrs) || isDef(props)) {
  34316. for (var key in propOptions) {
  34317. var altKey = hyphenate(key);
  34318. {
  34319. var keyInLowerCase = key.toLowerCase();
  34320. if (
  34321. key !== keyInLowerCase &&
  34322. attrs && hasOwn(attrs, keyInLowerCase)
  34323. ) {
  34324. tip(
  34325. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  34326. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  34327. " \"" + key + "\". " +
  34328. "Note that HTML attributes are case-insensitive and camelCased " +
  34329. "props need to use their kebab-case equivalents when using in-DOM " +
  34330. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  34331. );
  34332. }
  34333. }
  34334. checkProp(res, props, key, altKey, true) ||
  34335. checkProp(res, attrs, key, altKey, false);
  34336. }
  34337. }
  34338. return res
  34339. }
  34340. function checkProp (
  34341. res,
  34342. hash,
  34343. key,
  34344. altKey,
  34345. preserve
  34346. ) {
  34347. if (isDef(hash)) {
  34348. if (hasOwn(hash, key)) {
  34349. res[key] = hash[key];
  34350. if (!preserve) {
  34351. delete hash[key];
  34352. }
  34353. return true
  34354. } else if (hasOwn(hash, altKey)) {
  34355. res[key] = hash[altKey];
  34356. if (!preserve) {
  34357. delete hash[altKey];
  34358. }
  34359. return true
  34360. }
  34361. }
  34362. return false
  34363. }
  34364. /* */
  34365. // The template compiler attempts to minimize the need for normalization by
  34366. // statically analyzing the template at compile time.
  34367. //
  34368. // For plain HTML markup, normalization can be completely skipped because the
  34369. // generated render function is guaranteed to return Array<VNode>. There are
  34370. // two cases where extra normalization is needed:
  34371. // 1. When the children contains components - because a functional component
  34372. // may return an Array instead of a single root. In this case, just a simple
  34373. // normalization is needed - if any child is an Array, we flatten the whole
  34374. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  34375. // because functional components already normalize their own children.
  34376. function simpleNormalizeChildren (children) {
  34377. for (var i = 0; i < children.length; i++) {
  34378. if (Array.isArray(children[i])) {
  34379. return Array.prototype.concat.apply([], children)
  34380. }
  34381. }
  34382. return children
  34383. }
  34384. // 2. When the children contains constructs that always generated nested Arrays,
  34385. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  34386. // with hand-written render functions / JSX. In such cases a full normalization
  34387. // is needed to cater to all possible types of children values.
  34388. function normalizeChildren (children) {
  34389. return isPrimitive(children)
  34390. ? [createTextVNode(children)]
  34391. : Array.isArray(children)
  34392. ? normalizeArrayChildren(children)
  34393. : undefined
  34394. }
  34395. function isTextNode (node) {
  34396. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  34397. }
  34398. function normalizeArrayChildren (children, nestedIndex) {
  34399. var res = [];
  34400. var i, c, lastIndex, last;
  34401. for (i = 0; i < children.length; i++) {
  34402. c = children[i];
  34403. if (isUndef(c) || typeof c === 'boolean') { continue }
  34404. lastIndex = res.length - 1;
  34405. last = res[lastIndex];
  34406. // nested
  34407. if (Array.isArray(c)) {
  34408. if (c.length > 0) {
  34409. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  34410. // merge adjacent text nodes
  34411. if (isTextNode(c[0]) && isTextNode(last)) {
  34412. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  34413. c.shift();
  34414. }
  34415. res.push.apply(res, c);
  34416. }
  34417. } else if (isPrimitive(c)) {
  34418. if (isTextNode(last)) {
  34419. // merge adjacent text nodes
  34420. // this is necessary for SSR hydration because text nodes are
  34421. // essentially merged when rendered to HTML strings
  34422. res[lastIndex] = createTextVNode(last.text + c);
  34423. } else if (c !== '') {
  34424. // convert primitive to vnode
  34425. res.push(createTextVNode(c));
  34426. }
  34427. } else {
  34428. if (isTextNode(c) && isTextNode(last)) {
  34429. // merge adjacent text nodes
  34430. res[lastIndex] = createTextVNode(last.text + c.text);
  34431. } else {
  34432. // default key for nested array children (likely generated by v-for)
  34433. if (isTrue(children._isVList) &&
  34434. isDef(c.tag) &&
  34435. isUndef(c.key) &&
  34436. isDef(nestedIndex)) {
  34437. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  34438. }
  34439. res.push(c);
  34440. }
  34441. }
  34442. }
  34443. return res
  34444. }
  34445. /* */
  34446. function initProvide (vm) {
  34447. var provide = vm.$options.provide;
  34448. if (provide) {
  34449. vm._provided = typeof provide === 'function'
  34450. ? provide.call(vm)
  34451. : provide;
  34452. }
  34453. }
  34454. function initInjections (vm) {
  34455. var result = resolveInject(vm.$options.inject, vm);
  34456. if (result) {
  34457. toggleObserving(false);
  34458. Object.keys(result).forEach(function (key) {
  34459. /* istanbul ignore else */
  34460. {
  34461. defineReactive$$1(vm, key, result[key], function () {
  34462. warn(
  34463. "Avoid mutating an injected value directly since the changes will be " +
  34464. "overwritten whenever the provided component re-renders. " +
  34465. "injection being mutated: \"" + key + "\"",
  34466. vm
  34467. );
  34468. });
  34469. }
  34470. });
  34471. toggleObserving(true);
  34472. }
  34473. }
  34474. function resolveInject (inject, vm) {
  34475. if (inject) {
  34476. // inject is :any because flow is not smart enough to figure out cached
  34477. var result = Object.create(null);
  34478. var keys = hasSymbol
  34479. ? Reflect.ownKeys(inject)
  34480. : Object.keys(inject);
  34481. for (var i = 0; i < keys.length; i++) {
  34482. var key = keys[i];
  34483. // #6574 in case the inject object is observed...
  34484. if (key === '__ob__') { continue }
  34485. var provideKey = inject[key].from;
  34486. var source = vm;
  34487. while (source) {
  34488. if (source._provided && hasOwn(source._provided, provideKey)) {
  34489. result[key] = source._provided[provideKey];
  34490. break
  34491. }
  34492. source = source.$parent;
  34493. }
  34494. if (!source) {
  34495. if ('default' in inject[key]) {
  34496. var provideDefault = inject[key].default;
  34497. result[key] = typeof provideDefault === 'function'
  34498. ? provideDefault.call(vm)
  34499. : provideDefault;
  34500. } else {
  34501. warn(("Injection \"" + key + "\" not found"), vm);
  34502. }
  34503. }
  34504. }
  34505. return result
  34506. }
  34507. }
  34508. /* */
  34509. /**
  34510. * Runtime helper for resolving raw children VNodes into a slot object.
  34511. */
  34512. function resolveSlots (
  34513. children,
  34514. context
  34515. ) {
  34516. if (!children || !children.length) {
  34517. return {}
  34518. }
  34519. var slots = {};
  34520. for (var i = 0, l = children.length; i < l; i++) {
  34521. var child = children[i];
  34522. var data = child.data;
  34523. // remove slot attribute if the node is resolved as a Vue slot node
  34524. if (data && data.attrs && data.attrs.slot) {
  34525. delete data.attrs.slot;
  34526. }
  34527. // named slots should only be respected if the vnode was rendered in the
  34528. // same context.
  34529. if ((child.context === context || child.fnContext === context) &&
  34530. data && data.slot != null
  34531. ) {
  34532. var name = data.slot;
  34533. var slot = (slots[name] || (slots[name] = []));
  34534. if (child.tag === 'template') {
  34535. slot.push.apply(slot, child.children || []);
  34536. } else {
  34537. slot.push(child);
  34538. }
  34539. } else {
  34540. (slots.default || (slots.default = [])).push(child);
  34541. }
  34542. }
  34543. // ignore slots that contains only whitespace
  34544. for (var name$1 in slots) {
  34545. if (slots[name$1].every(isWhitespace)) {
  34546. delete slots[name$1];
  34547. }
  34548. }
  34549. return slots
  34550. }
  34551. function isWhitespace (node) {
  34552. return (node.isComment && !node.asyncFactory) || node.text === ' '
  34553. }
  34554. /* */
  34555. function normalizeScopedSlots (
  34556. slots,
  34557. normalSlots,
  34558. prevSlots
  34559. ) {
  34560. var res;
  34561. var isStable = slots ? !!slots.$stable : true;
  34562. var key = slots && slots.$key;
  34563. if (!slots) {
  34564. res = {};
  34565. } else if (slots._normalized) {
  34566. // fast path 1: child component re-render only, parent did not change
  34567. return slots._normalized
  34568. } else if (
  34569. isStable &&
  34570. prevSlots &&
  34571. prevSlots !== emptyObject &&
  34572. key === prevSlots.$key &&
  34573. Object.keys(normalSlots).length === 0
  34574. ) {
  34575. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  34576. // only need to normalize once
  34577. return prevSlots
  34578. } else {
  34579. res = {};
  34580. for (var key$1 in slots) {
  34581. if (slots[key$1] && key$1[0] !== '$') {
  34582. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  34583. }
  34584. }
  34585. }
  34586. // expose normal slots on scopedSlots
  34587. for (var key$2 in normalSlots) {
  34588. if (!(key$2 in res)) {
  34589. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  34590. }
  34591. }
  34592. // avoriaz seems to mock a non-extensible $scopedSlots object
  34593. // and when that is passed down this would cause an error
  34594. if (slots && Object.isExtensible(slots)) {
  34595. (slots)._normalized = res;
  34596. }
  34597. def(res, '$stable', isStable);
  34598. def(res, '$key', key);
  34599. return res
  34600. }
  34601. function normalizeScopedSlot(normalSlots, key, fn) {
  34602. var normalized = function () {
  34603. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  34604. res = res && typeof res === 'object' && !Array.isArray(res)
  34605. ? [res] // single vnode
  34606. : normalizeChildren(res);
  34607. return res && res.length === 0
  34608. ? undefined
  34609. : res
  34610. };
  34611. // this is a slot using the new v-slot syntax without scope. although it is
  34612. // compiled as a scoped slot, render fn users would expect it to be present
  34613. // on this.$slots because the usage is semantically a normal slot.
  34614. if (fn.proxy) {
  34615. Object.defineProperty(normalSlots, key, {
  34616. get: normalized,
  34617. enumerable: true,
  34618. configurable: true
  34619. });
  34620. }
  34621. return normalized
  34622. }
  34623. function proxyNormalSlot(slots, key) {
  34624. return function () { return slots[key]; }
  34625. }
  34626. /* */
  34627. /**
  34628. * Runtime helper for rendering v-for lists.
  34629. */
  34630. function renderList (
  34631. val,
  34632. render
  34633. ) {
  34634. var ret, i, l, keys, key;
  34635. if (Array.isArray(val) || typeof val === 'string') {
  34636. ret = new Array(val.length);
  34637. for (i = 0, l = val.length; i < l; i++) {
  34638. ret[i] = render(val[i], i);
  34639. }
  34640. } else if (typeof val === 'number') {
  34641. ret = new Array(val);
  34642. for (i = 0; i < val; i++) {
  34643. ret[i] = render(i + 1, i);
  34644. }
  34645. } else if (isObject(val)) {
  34646. if (hasSymbol && val[Symbol.iterator]) {
  34647. ret = [];
  34648. var iterator = val[Symbol.iterator]();
  34649. var result = iterator.next();
  34650. while (!result.done) {
  34651. ret.push(render(result.value, ret.length));
  34652. result = iterator.next();
  34653. }
  34654. } else {
  34655. keys = Object.keys(val);
  34656. ret = new Array(keys.length);
  34657. for (i = 0, l = keys.length; i < l; i++) {
  34658. key = keys[i];
  34659. ret[i] = render(val[key], key, i);
  34660. }
  34661. }
  34662. }
  34663. if (!isDef(ret)) {
  34664. ret = [];
  34665. }
  34666. (ret)._isVList = true;
  34667. return ret
  34668. }
  34669. /* */
  34670. /**
  34671. * Runtime helper for rendering <slot>
  34672. */
  34673. function renderSlot (
  34674. name,
  34675. fallback,
  34676. props,
  34677. bindObject
  34678. ) {
  34679. var scopedSlotFn = this.$scopedSlots[name];
  34680. var nodes;
  34681. if (scopedSlotFn) { // scoped slot
  34682. props = props || {};
  34683. if (bindObject) {
  34684. if (!isObject(bindObject)) {
  34685. warn(
  34686. 'slot v-bind without argument expects an Object',
  34687. this
  34688. );
  34689. }
  34690. props = extend(extend({}, bindObject), props);
  34691. }
  34692. nodes = scopedSlotFn(props) || fallback;
  34693. } else {
  34694. nodes = this.$slots[name] || fallback;
  34695. }
  34696. var target = props && props.slot;
  34697. if (target) {
  34698. return this.$createElement('template', { slot: target }, nodes)
  34699. } else {
  34700. return nodes
  34701. }
  34702. }
  34703. /* */
  34704. /**
  34705. * Runtime helper for resolving filters
  34706. */
  34707. function resolveFilter (id) {
  34708. return resolveAsset(this.$options, 'filters', id, true) || identity
  34709. }
  34710. /* */
  34711. function isKeyNotMatch (expect, actual) {
  34712. if (Array.isArray(expect)) {
  34713. return expect.indexOf(actual) === -1
  34714. } else {
  34715. return expect !== actual
  34716. }
  34717. }
  34718. /**
  34719. * Runtime helper for checking keyCodes from config.
  34720. * exposed as Vue.prototype._k
  34721. * passing in eventKeyName as last argument separately for backwards compat
  34722. */
  34723. function checkKeyCodes (
  34724. eventKeyCode,
  34725. key,
  34726. builtInKeyCode,
  34727. eventKeyName,
  34728. builtInKeyName
  34729. ) {
  34730. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  34731. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  34732. return isKeyNotMatch(builtInKeyName, eventKeyName)
  34733. } else if (mappedKeyCode) {
  34734. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  34735. } else if (eventKeyName) {
  34736. return hyphenate(eventKeyName) !== key
  34737. }
  34738. }
  34739. /* */
  34740. /**
  34741. * Runtime helper for merging v-bind="object" into a VNode's data.
  34742. */
  34743. function bindObjectProps (
  34744. data,
  34745. tag,
  34746. value,
  34747. asProp,
  34748. isSync
  34749. ) {
  34750. if (value) {
  34751. if (!isObject(value)) {
  34752. warn(
  34753. 'v-bind without argument expects an Object or Array value',
  34754. this
  34755. );
  34756. } else {
  34757. if (Array.isArray(value)) {
  34758. value = toObject(value);
  34759. }
  34760. var hash;
  34761. var loop = function ( key ) {
  34762. if (
  34763. key === 'class' ||
  34764. key === 'style' ||
  34765. isReservedAttribute(key)
  34766. ) {
  34767. hash = data;
  34768. } else {
  34769. var type = data.attrs && data.attrs.type;
  34770. hash = asProp || config.mustUseProp(tag, type, key)
  34771. ? data.domProps || (data.domProps = {})
  34772. : data.attrs || (data.attrs = {});
  34773. }
  34774. var camelizedKey = camelize(key);
  34775. if (!(key in hash) && !(camelizedKey in hash)) {
  34776. hash[key] = value[key];
  34777. if (isSync) {
  34778. var on = data.on || (data.on = {});
  34779. on[("update:" + camelizedKey)] = function ($event) {
  34780. value[key] = $event;
  34781. };
  34782. }
  34783. }
  34784. };
  34785. for (var key in value) loop( key );
  34786. }
  34787. }
  34788. return data
  34789. }
  34790. /* */
  34791. /**
  34792. * Runtime helper for rendering static trees.
  34793. */
  34794. function renderStatic (
  34795. index,
  34796. isInFor
  34797. ) {
  34798. var cached = this._staticTrees || (this._staticTrees = []);
  34799. var tree = cached[index];
  34800. // if has already-rendered static tree and not inside v-for,
  34801. // we can reuse the same tree.
  34802. if (tree && !isInFor) {
  34803. return tree
  34804. }
  34805. // otherwise, render a fresh tree.
  34806. tree = cached[index] = this.$options.staticRenderFns[index].call(
  34807. this._renderProxy,
  34808. null,
  34809. this // for render fns generated for functional component templates
  34810. );
  34811. markStatic(tree, ("__static__" + index), false);
  34812. return tree
  34813. }
  34814. /**
  34815. * Runtime helper for v-once.
  34816. * Effectively it means marking the node as static with a unique key.
  34817. */
  34818. function markOnce (
  34819. tree,
  34820. index,
  34821. key
  34822. ) {
  34823. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  34824. return tree
  34825. }
  34826. function markStatic (
  34827. tree,
  34828. key,
  34829. isOnce
  34830. ) {
  34831. if (Array.isArray(tree)) {
  34832. for (var i = 0; i < tree.length; i++) {
  34833. if (tree[i] && typeof tree[i] !== 'string') {
  34834. markStaticNode(tree[i], (key + "_" + i), isOnce);
  34835. }
  34836. }
  34837. } else {
  34838. markStaticNode(tree, key, isOnce);
  34839. }
  34840. }
  34841. function markStaticNode (node, key, isOnce) {
  34842. node.isStatic = true;
  34843. node.key = key;
  34844. node.isOnce = isOnce;
  34845. }
  34846. /* */
  34847. function bindObjectListeners (data, value) {
  34848. if (value) {
  34849. if (!isPlainObject(value)) {
  34850. warn(
  34851. 'v-on without argument expects an Object value',
  34852. this
  34853. );
  34854. } else {
  34855. var on = data.on = data.on ? extend({}, data.on) : {};
  34856. for (var key in value) {
  34857. var existing = on[key];
  34858. var ours = value[key];
  34859. on[key] = existing ? [].concat(existing, ours) : ours;
  34860. }
  34861. }
  34862. }
  34863. return data
  34864. }
  34865. /* */
  34866. function resolveScopedSlots (
  34867. fns, // see flow/vnode
  34868. res,
  34869. // the following are added in 2.6
  34870. hasDynamicKeys,
  34871. contentHashKey
  34872. ) {
  34873. res = res || { $stable: !hasDynamicKeys };
  34874. for (var i = 0; i < fns.length; i++) {
  34875. var slot = fns[i];
  34876. if (Array.isArray(slot)) {
  34877. resolveScopedSlots(slot, res, hasDynamicKeys);
  34878. } else if (slot) {
  34879. // marker for reverse proxying v-slot without scope on this.$slots
  34880. if (slot.proxy) {
  34881. slot.fn.proxy = true;
  34882. }
  34883. res[slot.key] = slot.fn;
  34884. }
  34885. }
  34886. if (contentHashKey) {
  34887. (res).$key = contentHashKey;
  34888. }
  34889. return res
  34890. }
  34891. /* */
  34892. function bindDynamicKeys (baseObj, values) {
  34893. for (var i = 0; i < values.length; i += 2) {
  34894. var key = values[i];
  34895. if (typeof key === 'string' && key) {
  34896. baseObj[values[i]] = values[i + 1];
  34897. } else if (key !== '' && key !== null) {
  34898. // null is a speical value for explicitly removing a binding
  34899. warn(
  34900. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  34901. this
  34902. );
  34903. }
  34904. }
  34905. return baseObj
  34906. }
  34907. // helper to dynamically append modifier runtime markers to event names.
  34908. // ensure only append when value is already string, otherwise it will be cast
  34909. // to string and cause the type check to miss.
  34910. function prependModifier (value, symbol) {
  34911. return typeof value === 'string' ? symbol + value : value
  34912. }
  34913. /* */
  34914. function installRenderHelpers (target) {
  34915. target._o = markOnce;
  34916. target._n = toNumber;
  34917. target._s = toString;
  34918. target._l = renderList;
  34919. target._t = renderSlot;
  34920. target._q = looseEqual;
  34921. target._i = looseIndexOf;
  34922. target._m = renderStatic;
  34923. target._f = resolveFilter;
  34924. target._k = checkKeyCodes;
  34925. target._b = bindObjectProps;
  34926. target._v = createTextVNode;
  34927. target._e = createEmptyVNode;
  34928. target._u = resolveScopedSlots;
  34929. target._g = bindObjectListeners;
  34930. target._d = bindDynamicKeys;
  34931. target._p = prependModifier;
  34932. }
  34933. /* */
  34934. function FunctionalRenderContext (
  34935. data,
  34936. props,
  34937. children,
  34938. parent,
  34939. Ctor
  34940. ) {
  34941. var this$1 = this;
  34942. var options = Ctor.options;
  34943. // ensure the createElement function in functional components
  34944. // gets a unique context - this is necessary for correct named slot check
  34945. var contextVm;
  34946. if (hasOwn(parent, '_uid')) {
  34947. contextVm = Object.create(parent);
  34948. // $flow-disable-line
  34949. contextVm._original = parent;
  34950. } else {
  34951. // the context vm passed in is a functional context as well.
  34952. // in this case we want to make sure we are able to get a hold to the
  34953. // real context instance.
  34954. contextVm = parent;
  34955. // $flow-disable-line
  34956. parent = parent._original;
  34957. }
  34958. var isCompiled = isTrue(options._compiled);
  34959. var needNormalization = !isCompiled;
  34960. this.data = data;
  34961. this.props = props;
  34962. this.children = children;
  34963. this.parent = parent;
  34964. this.listeners = data.on || emptyObject;
  34965. this.injections = resolveInject(options.inject, parent);
  34966. this.slots = function () {
  34967. if (!this$1.$slots) {
  34968. normalizeScopedSlots(
  34969. data.scopedSlots,
  34970. this$1.$slots = resolveSlots(children, parent)
  34971. );
  34972. }
  34973. return this$1.$slots
  34974. };
  34975. Object.defineProperty(this, 'scopedSlots', ({
  34976. enumerable: true,
  34977. get: function get () {
  34978. return normalizeScopedSlots(data.scopedSlots, this.slots())
  34979. }
  34980. }));
  34981. // support for compiled functional template
  34982. if (isCompiled) {
  34983. // exposing $options for renderStatic()
  34984. this.$options = options;
  34985. // pre-resolve slots for renderSlot()
  34986. this.$slots = this.slots();
  34987. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  34988. }
  34989. if (options._scopeId) {
  34990. this._c = function (a, b, c, d) {
  34991. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  34992. if (vnode && !Array.isArray(vnode)) {
  34993. vnode.fnScopeId = options._scopeId;
  34994. vnode.fnContext = parent;
  34995. }
  34996. return vnode
  34997. };
  34998. } else {
  34999. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  35000. }
  35001. }
  35002. installRenderHelpers(FunctionalRenderContext.prototype);
  35003. function createFunctionalComponent (
  35004. Ctor,
  35005. propsData,
  35006. data,
  35007. contextVm,
  35008. children
  35009. ) {
  35010. var options = Ctor.options;
  35011. var props = {};
  35012. var propOptions = options.props;
  35013. if (isDef(propOptions)) {
  35014. for (var key in propOptions) {
  35015. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  35016. }
  35017. } else {
  35018. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  35019. if (isDef(data.props)) { mergeProps(props, data.props); }
  35020. }
  35021. var renderContext = new FunctionalRenderContext(
  35022. data,
  35023. props,
  35024. children,
  35025. contextVm,
  35026. Ctor
  35027. );
  35028. var vnode = options.render.call(null, renderContext._c, renderContext);
  35029. if (vnode instanceof VNode) {
  35030. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  35031. } else if (Array.isArray(vnode)) {
  35032. var vnodes = normalizeChildren(vnode) || [];
  35033. var res = new Array(vnodes.length);
  35034. for (var i = 0; i < vnodes.length; i++) {
  35035. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  35036. }
  35037. return res
  35038. }
  35039. }
  35040. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  35041. // #7817 clone node before setting fnContext, otherwise if the node is reused
  35042. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  35043. // that should not be matched to match.
  35044. var clone = cloneVNode(vnode);
  35045. clone.fnContext = contextVm;
  35046. clone.fnOptions = options;
  35047. {
  35048. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  35049. }
  35050. if (data.slot) {
  35051. (clone.data || (clone.data = {})).slot = data.slot;
  35052. }
  35053. return clone
  35054. }
  35055. function mergeProps (to, from) {
  35056. for (var key in from) {
  35057. to[camelize(key)] = from[key];
  35058. }
  35059. }
  35060. /* */
  35061. /* */
  35062. /* */
  35063. /* */
  35064. // inline hooks to be invoked on component VNodes during patch
  35065. var componentVNodeHooks = {
  35066. init: function init (vnode, hydrating) {
  35067. if (
  35068. vnode.componentInstance &&
  35069. !vnode.componentInstance._isDestroyed &&
  35070. vnode.data.keepAlive
  35071. ) {
  35072. // kept-alive components, treat as a patch
  35073. var mountedNode = vnode; // work around flow
  35074. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  35075. } else {
  35076. var child = vnode.componentInstance = createComponentInstanceForVnode(
  35077. vnode,
  35078. activeInstance
  35079. );
  35080. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  35081. }
  35082. },
  35083. prepatch: function prepatch (oldVnode, vnode) {
  35084. var options = vnode.componentOptions;
  35085. var child = vnode.componentInstance = oldVnode.componentInstance;
  35086. updateChildComponent(
  35087. child,
  35088. options.propsData, // updated props
  35089. options.listeners, // updated listeners
  35090. vnode, // new parent vnode
  35091. options.children // new children
  35092. );
  35093. },
  35094. insert: function insert (vnode) {
  35095. var context = vnode.context;
  35096. var componentInstance = vnode.componentInstance;
  35097. if (!componentInstance._isMounted) {
  35098. componentInstance._isMounted = true;
  35099. callHook(componentInstance, 'mounted');
  35100. }
  35101. if (vnode.data.keepAlive) {
  35102. if (context._isMounted) {
  35103. // vue-router#1212
  35104. // During updates, a kept-alive component's child components may
  35105. // change, so directly walking the tree here may call activated hooks
  35106. // on incorrect children. Instead we push them into a queue which will
  35107. // be processed after the whole patch process ended.
  35108. queueActivatedComponent(componentInstance);
  35109. } else {
  35110. activateChildComponent(componentInstance, true /* direct */);
  35111. }
  35112. }
  35113. },
  35114. destroy: function destroy (vnode) {
  35115. var componentInstance = vnode.componentInstance;
  35116. if (!componentInstance._isDestroyed) {
  35117. if (!vnode.data.keepAlive) {
  35118. componentInstance.$destroy();
  35119. } else {
  35120. deactivateChildComponent(componentInstance, true /* direct */);
  35121. }
  35122. }
  35123. }
  35124. };
  35125. var hooksToMerge = Object.keys(componentVNodeHooks);
  35126. function createComponent (
  35127. Ctor,
  35128. data,
  35129. context,
  35130. children,
  35131. tag
  35132. ) {
  35133. if (isUndef(Ctor)) {
  35134. return
  35135. }
  35136. var baseCtor = context.$options._base;
  35137. // plain options object: turn it into a constructor
  35138. if (isObject(Ctor)) {
  35139. Ctor = baseCtor.extend(Ctor);
  35140. }
  35141. // if at this stage it's not a constructor or an async component factory,
  35142. // reject.
  35143. if (typeof Ctor !== 'function') {
  35144. {
  35145. warn(("Invalid Component definition: " + (String(Ctor))), context);
  35146. }
  35147. return
  35148. }
  35149. // async component
  35150. var asyncFactory;
  35151. if (isUndef(Ctor.cid)) {
  35152. asyncFactory = Ctor;
  35153. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  35154. if (Ctor === undefined) {
  35155. // return a placeholder node for async component, which is rendered
  35156. // as a comment node but preserves all the raw information for the node.
  35157. // the information will be used for async server-rendering and hydration.
  35158. return createAsyncPlaceholder(
  35159. asyncFactory,
  35160. data,
  35161. context,
  35162. children,
  35163. tag
  35164. )
  35165. }
  35166. }
  35167. data = data || {};
  35168. // resolve constructor options in case global mixins are applied after
  35169. // component constructor creation
  35170. resolveConstructorOptions(Ctor);
  35171. // transform component v-model data into props & events
  35172. if (isDef(data.model)) {
  35173. transformModel(Ctor.options, data);
  35174. }
  35175. // extract props
  35176. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  35177. // functional component
  35178. if (isTrue(Ctor.options.functional)) {
  35179. return createFunctionalComponent(Ctor, propsData, data, context, children)
  35180. }
  35181. // extract listeners, since these needs to be treated as
  35182. // child component listeners instead of DOM listeners
  35183. var listeners = data.on;
  35184. // replace with listeners with .native modifier
  35185. // so it gets processed during parent component patch.
  35186. data.on = data.nativeOn;
  35187. if (isTrue(Ctor.options.abstract)) {
  35188. // abstract components do not keep anything
  35189. // other than props & listeners & slot
  35190. // work around flow
  35191. var slot = data.slot;
  35192. data = {};
  35193. if (slot) {
  35194. data.slot = slot;
  35195. }
  35196. }
  35197. // install component management hooks onto the placeholder node
  35198. installComponentHooks(data);
  35199. // return a placeholder vnode
  35200. var name = Ctor.options.name || tag;
  35201. var vnode = new VNode(
  35202. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  35203. data, undefined, undefined, undefined, context,
  35204. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  35205. asyncFactory
  35206. );
  35207. return vnode
  35208. }
  35209. function createComponentInstanceForVnode (
  35210. vnode, // we know it's MountedComponentVNode but flow doesn't
  35211. parent // activeInstance in lifecycle state
  35212. ) {
  35213. var options = {
  35214. _isComponent: true,
  35215. _parentVnode: vnode,
  35216. parent: parent
  35217. };
  35218. // check inline-template render functions
  35219. var inlineTemplate = vnode.data.inlineTemplate;
  35220. if (isDef(inlineTemplate)) {
  35221. options.render = inlineTemplate.render;
  35222. options.staticRenderFns = inlineTemplate.staticRenderFns;
  35223. }
  35224. return new vnode.componentOptions.Ctor(options)
  35225. }
  35226. function installComponentHooks (data) {
  35227. var hooks = data.hook || (data.hook = {});
  35228. for (var i = 0; i < hooksToMerge.length; i++) {
  35229. var key = hooksToMerge[i];
  35230. var existing = hooks[key];
  35231. var toMerge = componentVNodeHooks[key];
  35232. if (existing !== toMerge && !(existing && existing._merged)) {
  35233. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  35234. }
  35235. }
  35236. }
  35237. function mergeHook$1 (f1, f2) {
  35238. var merged = function (a, b) {
  35239. // flow complains about extra args which is why we use any
  35240. f1(a, b);
  35241. f2(a, b);
  35242. };
  35243. merged._merged = true;
  35244. return merged
  35245. }
  35246. // transform component v-model info (value and callback) into
  35247. // prop and event handler respectively.
  35248. function transformModel (options, data) {
  35249. var prop = (options.model && options.model.prop) || 'value';
  35250. var event = (options.model && options.model.event) || 'input'
  35251. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  35252. var on = data.on || (data.on = {});
  35253. var existing = on[event];
  35254. var callback = data.model.callback;
  35255. if (isDef(existing)) {
  35256. if (
  35257. Array.isArray(existing)
  35258. ? existing.indexOf(callback) === -1
  35259. : existing !== callback
  35260. ) {
  35261. on[event] = [callback].concat(existing);
  35262. }
  35263. } else {
  35264. on[event] = callback;
  35265. }
  35266. }
  35267. /* */
  35268. var SIMPLE_NORMALIZE = 1;
  35269. var ALWAYS_NORMALIZE = 2;
  35270. // wrapper function for providing a more flexible interface
  35271. // without getting yelled at by flow
  35272. function createElement (
  35273. context,
  35274. tag,
  35275. data,
  35276. children,
  35277. normalizationType,
  35278. alwaysNormalize
  35279. ) {
  35280. if (Array.isArray(data) || isPrimitive(data)) {
  35281. normalizationType = children;
  35282. children = data;
  35283. data = undefined;
  35284. }
  35285. if (isTrue(alwaysNormalize)) {
  35286. normalizationType = ALWAYS_NORMALIZE;
  35287. }
  35288. return _createElement(context, tag, data, children, normalizationType)
  35289. }
  35290. function _createElement (
  35291. context,
  35292. tag,
  35293. data,
  35294. children,
  35295. normalizationType
  35296. ) {
  35297. if (isDef(data) && isDef((data).__ob__)) {
  35298. warn(
  35299. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  35300. 'Always create fresh vnode data objects in each render!',
  35301. context
  35302. );
  35303. return createEmptyVNode()
  35304. }
  35305. // object syntax in v-bind
  35306. if (isDef(data) && isDef(data.is)) {
  35307. tag = data.is;
  35308. }
  35309. if (!tag) {
  35310. // in case of component :is set to falsy value
  35311. return createEmptyVNode()
  35312. }
  35313. // warn against non-primitive key
  35314. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  35315. ) {
  35316. {
  35317. warn(
  35318. 'Avoid using non-primitive value as key, ' +
  35319. 'use string/number value instead.',
  35320. context
  35321. );
  35322. }
  35323. }
  35324. // support single function children as default scoped slot
  35325. if (Array.isArray(children) &&
  35326. typeof children[0] === 'function'
  35327. ) {
  35328. data = data || {};
  35329. data.scopedSlots = { default: children[0] };
  35330. children.length = 0;
  35331. }
  35332. if (normalizationType === ALWAYS_NORMALIZE) {
  35333. children = normalizeChildren(children);
  35334. } else if (normalizationType === SIMPLE_NORMALIZE) {
  35335. children = simpleNormalizeChildren(children);
  35336. }
  35337. var vnode, ns;
  35338. if (typeof tag === 'string') {
  35339. var Ctor;
  35340. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  35341. if (config.isReservedTag(tag)) {
  35342. // platform built-in elements
  35343. vnode = new VNode(
  35344. config.parsePlatformTagName(tag), data, children,
  35345. undefined, undefined, context
  35346. );
  35347. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  35348. // component
  35349. vnode = createComponent(Ctor, data, context, children, tag);
  35350. } else {
  35351. // unknown or unlisted namespaced elements
  35352. // check at runtime because it may get assigned a namespace when its
  35353. // parent normalizes children
  35354. vnode = new VNode(
  35355. tag, data, children,
  35356. undefined, undefined, context
  35357. );
  35358. }
  35359. } else {
  35360. // direct component options / constructor
  35361. vnode = createComponent(tag, data, context, children);
  35362. }
  35363. if (Array.isArray(vnode)) {
  35364. return vnode
  35365. } else if (isDef(vnode)) {
  35366. if (isDef(ns)) { applyNS(vnode, ns); }
  35367. if (isDef(data)) { registerDeepBindings(data); }
  35368. return vnode
  35369. } else {
  35370. return createEmptyVNode()
  35371. }
  35372. }
  35373. function applyNS (vnode, ns, force) {
  35374. vnode.ns = ns;
  35375. if (vnode.tag === 'foreignObject') {
  35376. // use default namespace inside foreignObject
  35377. ns = undefined;
  35378. force = true;
  35379. }
  35380. if (isDef(vnode.children)) {
  35381. for (var i = 0, l = vnode.children.length; i < l; i++) {
  35382. var child = vnode.children[i];
  35383. if (isDef(child.tag) && (
  35384. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  35385. applyNS(child, ns, force);
  35386. }
  35387. }
  35388. }
  35389. }
  35390. // ref #5318
  35391. // necessary to ensure parent re-render when deep bindings like :style and
  35392. // :class are used on slot nodes
  35393. function registerDeepBindings (data) {
  35394. if (isObject(data.style)) {
  35395. traverse(data.style);
  35396. }
  35397. if (isObject(data.class)) {
  35398. traverse(data.class);
  35399. }
  35400. }
  35401. /* */
  35402. function initRender (vm) {
  35403. vm._vnode = null; // the root of the child tree
  35404. vm._staticTrees = null; // v-once cached trees
  35405. var options = vm.$options;
  35406. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  35407. var renderContext = parentVnode && parentVnode.context;
  35408. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  35409. vm.$scopedSlots = emptyObject;
  35410. // bind the createElement fn to this instance
  35411. // so that we get proper render context inside it.
  35412. // args order: tag, data, children, normalizationType, alwaysNormalize
  35413. // internal version is used by render functions compiled from templates
  35414. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  35415. // normalization is always applied for the public version, used in
  35416. // user-written render functions.
  35417. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  35418. // $attrs & $listeners are exposed for easier HOC creation.
  35419. // they need to be reactive so that HOCs using them are always updated
  35420. var parentData = parentVnode && parentVnode.data;
  35421. /* istanbul ignore else */
  35422. {
  35423. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  35424. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  35425. }, true);
  35426. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  35427. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  35428. }, true);
  35429. }
  35430. }
  35431. var currentRenderingInstance = null;
  35432. function renderMixin (Vue) {
  35433. // install runtime convenience helpers
  35434. installRenderHelpers(Vue.prototype);
  35435. Vue.prototype.$nextTick = function (fn) {
  35436. return nextTick(fn, this)
  35437. };
  35438. Vue.prototype._render = function () {
  35439. var vm = this;
  35440. var ref = vm.$options;
  35441. var render = ref.render;
  35442. var _parentVnode = ref._parentVnode;
  35443. if (_parentVnode) {
  35444. vm.$scopedSlots = normalizeScopedSlots(
  35445. _parentVnode.data.scopedSlots,
  35446. vm.$slots,
  35447. vm.$scopedSlots
  35448. );
  35449. }
  35450. // set parent vnode. this allows render functions to have access
  35451. // to the data on the placeholder node.
  35452. vm.$vnode = _parentVnode;
  35453. // render self
  35454. var vnode;
  35455. try {
  35456. // There's no need to maintain a stack becaues all render fns are called
  35457. // separately from one another. Nested component's render fns are called
  35458. // when parent component is patched.
  35459. currentRenderingInstance = vm;
  35460. vnode = render.call(vm._renderProxy, vm.$createElement);
  35461. } catch (e) {
  35462. handleError(e, vm, "render");
  35463. // return error render result,
  35464. // or previous vnode to prevent render error causing blank component
  35465. /* istanbul ignore else */
  35466. if (vm.$options.renderError) {
  35467. try {
  35468. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  35469. } catch (e) {
  35470. handleError(e, vm, "renderError");
  35471. vnode = vm._vnode;
  35472. }
  35473. } else {
  35474. vnode = vm._vnode;
  35475. }
  35476. } finally {
  35477. currentRenderingInstance = null;
  35478. }
  35479. // if the returned array contains only a single node, allow it
  35480. if (Array.isArray(vnode) && vnode.length === 1) {
  35481. vnode = vnode[0];
  35482. }
  35483. // return empty vnode in case the render function errored out
  35484. if (!(vnode instanceof VNode)) {
  35485. if (Array.isArray(vnode)) {
  35486. warn(
  35487. 'Multiple root nodes returned from render function. Render function ' +
  35488. 'should return a single root node.',
  35489. vm
  35490. );
  35491. }
  35492. vnode = createEmptyVNode();
  35493. }
  35494. // set parent
  35495. vnode.parent = _parentVnode;
  35496. return vnode
  35497. };
  35498. }
  35499. /* */
  35500. function ensureCtor (comp, base) {
  35501. if (
  35502. comp.__esModule ||
  35503. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  35504. ) {
  35505. comp = comp.default;
  35506. }
  35507. return isObject(comp)
  35508. ? base.extend(comp)
  35509. : comp
  35510. }
  35511. function createAsyncPlaceholder (
  35512. factory,
  35513. data,
  35514. context,
  35515. children,
  35516. tag
  35517. ) {
  35518. var node = createEmptyVNode();
  35519. node.asyncFactory = factory;
  35520. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  35521. return node
  35522. }
  35523. function resolveAsyncComponent (
  35524. factory,
  35525. baseCtor
  35526. ) {
  35527. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  35528. return factory.errorComp
  35529. }
  35530. if (isDef(factory.resolved)) {
  35531. return factory.resolved
  35532. }
  35533. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  35534. return factory.loadingComp
  35535. }
  35536. var owner = currentRenderingInstance;
  35537. if (isDef(factory.owners)) {
  35538. // already pending
  35539. factory.owners.push(owner);
  35540. } else {
  35541. var owners = factory.owners = [owner];
  35542. var sync = true;
  35543. var forceRender = function (renderCompleted) {
  35544. for (var i = 0, l = owners.length; i < l; i++) {
  35545. (owners[i]).$forceUpdate();
  35546. }
  35547. if (renderCompleted) {
  35548. owners.length = 0;
  35549. }
  35550. };
  35551. var resolve = once(function (res) {
  35552. // cache resolved
  35553. factory.resolved = ensureCtor(res, baseCtor);
  35554. // invoke callbacks only if this is not a synchronous resolve
  35555. // (async resolves are shimmed as synchronous during SSR)
  35556. if (!sync) {
  35557. forceRender(true);
  35558. } else {
  35559. owners.length = 0;
  35560. }
  35561. });
  35562. var reject = once(function (reason) {
  35563. warn(
  35564. "Failed to resolve async component: " + (String(factory)) +
  35565. (reason ? ("\nReason: " + reason) : '')
  35566. );
  35567. if (isDef(factory.errorComp)) {
  35568. factory.error = true;
  35569. forceRender(true);
  35570. }
  35571. });
  35572. var res = factory(resolve, reject);
  35573. if (isObject(res)) {
  35574. if (isPromise(res)) {
  35575. // () => Promise
  35576. if (isUndef(factory.resolved)) {
  35577. res.then(resolve, reject);
  35578. }
  35579. } else if (isPromise(res.component)) {
  35580. res.component.then(resolve, reject);
  35581. if (isDef(res.error)) {
  35582. factory.errorComp = ensureCtor(res.error, baseCtor);
  35583. }
  35584. if (isDef(res.loading)) {
  35585. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  35586. if (res.delay === 0) {
  35587. factory.loading = true;
  35588. } else {
  35589. setTimeout(function () {
  35590. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  35591. factory.loading = true;
  35592. forceRender(false);
  35593. }
  35594. }, res.delay || 200);
  35595. }
  35596. }
  35597. if (isDef(res.timeout)) {
  35598. setTimeout(function () {
  35599. if (isUndef(factory.resolved)) {
  35600. reject(
  35601. "timeout (" + (res.timeout) + "ms)"
  35602. );
  35603. }
  35604. }, res.timeout);
  35605. }
  35606. }
  35607. }
  35608. sync = false;
  35609. // return in case resolved synchronously
  35610. return factory.loading
  35611. ? factory.loadingComp
  35612. : factory.resolved
  35613. }
  35614. }
  35615. /* */
  35616. function isAsyncPlaceholder (node) {
  35617. return node.isComment && node.asyncFactory
  35618. }
  35619. /* */
  35620. function getFirstComponentChild (children) {
  35621. if (Array.isArray(children)) {
  35622. for (var i = 0; i < children.length; i++) {
  35623. var c = children[i];
  35624. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  35625. return c
  35626. }
  35627. }
  35628. }
  35629. }
  35630. /* */
  35631. /* */
  35632. function initEvents (vm) {
  35633. vm._events = Object.create(null);
  35634. vm._hasHookEvent = false;
  35635. // init parent attached events
  35636. var listeners = vm.$options._parentListeners;
  35637. if (listeners) {
  35638. updateComponentListeners(vm, listeners);
  35639. }
  35640. }
  35641. var target;
  35642. function add (event, fn) {
  35643. target.$on(event, fn);
  35644. }
  35645. function remove$1 (event, fn) {
  35646. target.$off(event, fn);
  35647. }
  35648. function createOnceHandler (event, fn) {
  35649. var _target = target;
  35650. return function onceHandler () {
  35651. var res = fn.apply(null, arguments);
  35652. if (res !== null) {
  35653. _target.$off(event, onceHandler);
  35654. }
  35655. }
  35656. }
  35657. function updateComponentListeners (
  35658. vm,
  35659. listeners,
  35660. oldListeners
  35661. ) {
  35662. target = vm;
  35663. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  35664. target = undefined;
  35665. }
  35666. function eventsMixin (Vue) {
  35667. var hookRE = /^hook:/;
  35668. Vue.prototype.$on = function (event, fn) {
  35669. var vm = this;
  35670. if (Array.isArray(event)) {
  35671. for (var i = 0, l = event.length; i < l; i++) {
  35672. vm.$on(event[i], fn);
  35673. }
  35674. } else {
  35675. (vm._events[event] || (vm._events[event] = [])).push(fn);
  35676. // optimize hook:event cost by using a boolean flag marked at registration
  35677. // instead of a hash lookup
  35678. if (hookRE.test(event)) {
  35679. vm._hasHookEvent = true;
  35680. }
  35681. }
  35682. return vm
  35683. };
  35684. Vue.prototype.$once = function (event, fn) {
  35685. var vm = this;
  35686. function on () {
  35687. vm.$off(event, on);
  35688. fn.apply(vm, arguments);
  35689. }
  35690. on.fn = fn;
  35691. vm.$on(event, on);
  35692. return vm
  35693. };
  35694. Vue.prototype.$off = function (event, fn) {
  35695. var vm = this;
  35696. // all
  35697. if (!arguments.length) {
  35698. vm._events = Object.create(null);
  35699. return vm
  35700. }
  35701. // array of events
  35702. if (Array.isArray(event)) {
  35703. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  35704. vm.$off(event[i$1], fn);
  35705. }
  35706. return vm
  35707. }
  35708. // specific event
  35709. var cbs = vm._events[event];
  35710. if (!cbs) {
  35711. return vm
  35712. }
  35713. if (!fn) {
  35714. vm._events[event] = null;
  35715. return vm
  35716. }
  35717. // specific handler
  35718. var cb;
  35719. var i = cbs.length;
  35720. while (i--) {
  35721. cb = cbs[i];
  35722. if (cb === fn || cb.fn === fn) {
  35723. cbs.splice(i, 1);
  35724. break
  35725. }
  35726. }
  35727. return vm
  35728. };
  35729. Vue.prototype.$emit = function (event) {
  35730. var vm = this;
  35731. {
  35732. var lowerCaseEvent = event.toLowerCase();
  35733. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  35734. tip(
  35735. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  35736. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  35737. "Note that HTML attributes are case-insensitive and you cannot use " +
  35738. "v-on to listen to camelCase events when using in-DOM templates. " +
  35739. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  35740. );
  35741. }
  35742. }
  35743. var cbs = vm._events[event];
  35744. if (cbs) {
  35745. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  35746. var args = toArray(arguments, 1);
  35747. var info = "event handler for \"" + event + "\"";
  35748. for (var i = 0, l = cbs.length; i < l; i++) {
  35749. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  35750. }
  35751. }
  35752. return vm
  35753. };
  35754. }
  35755. /* */
  35756. var activeInstance = null;
  35757. var isUpdatingChildComponent = false;
  35758. function setActiveInstance(vm) {
  35759. var prevActiveInstance = activeInstance;
  35760. activeInstance = vm;
  35761. return function () {
  35762. activeInstance = prevActiveInstance;
  35763. }
  35764. }
  35765. function initLifecycle (vm) {
  35766. var options = vm.$options;
  35767. // locate first non-abstract parent
  35768. var parent = options.parent;
  35769. if (parent && !options.abstract) {
  35770. while (parent.$options.abstract && parent.$parent) {
  35771. parent = parent.$parent;
  35772. }
  35773. parent.$children.push(vm);
  35774. }
  35775. vm.$parent = parent;
  35776. vm.$root = parent ? parent.$root : vm;
  35777. vm.$children = [];
  35778. vm.$refs = {};
  35779. vm._watcher = null;
  35780. vm._inactive = null;
  35781. vm._directInactive = false;
  35782. vm._isMounted = false;
  35783. vm._isDestroyed = false;
  35784. vm._isBeingDestroyed = false;
  35785. }
  35786. function lifecycleMixin (Vue) {
  35787. Vue.prototype._update = function (vnode, hydrating) {
  35788. var vm = this;
  35789. var prevEl = vm.$el;
  35790. var prevVnode = vm._vnode;
  35791. var restoreActiveInstance = setActiveInstance(vm);
  35792. vm._vnode = vnode;
  35793. // Vue.prototype.__patch__ is injected in entry points
  35794. // based on the rendering backend used.
  35795. if (!prevVnode) {
  35796. // initial render
  35797. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  35798. } else {
  35799. // updates
  35800. vm.$el = vm.__patch__(prevVnode, vnode);
  35801. }
  35802. restoreActiveInstance();
  35803. // update __vue__ reference
  35804. if (prevEl) {
  35805. prevEl.__vue__ = null;
  35806. }
  35807. if (vm.$el) {
  35808. vm.$el.__vue__ = vm;
  35809. }
  35810. // if parent is an HOC, update its $el as well
  35811. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  35812. vm.$parent.$el = vm.$el;
  35813. }
  35814. // updated hook is called by the scheduler to ensure that children are
  35815. // updated in a parent's updated hook.
  35816. };
  35817. Vue.prototype.$forceUpdate = function () {
  35818. var vm = this;
  35819. if (vm._watcher) {
  35820. vm._watcher.update();
  35821. }
  35822. };
  35823. Vue.prototype.$destroy = function () {
  35824. var vm = this;
  35825. if (vm._isBeingDestroyed) {
  35826. return
  35827. }
  35828. callHook(vm, 'beforeDestroy');
  35829. vm._isBeingDestroyed = true;
  35830. // remove self from parent
  35831. var parent = vm.$parent;
  35832. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  35833. remove(parent.$children, vm);
  35834. }
  35835. // teardown watchers
  35836. if (vm._watcher) {
  35837. vm._watcher.teardown();
  35838. }
  35839. var i = vm._watchers.length;
  35840. while (i--) {
  35841. vm._watchers[i].teardown();
  35842. }
  35843. // remove reference from data ob
  35844. // frozen object may not have observer.
  35845. if (vm._data.__ob__) {
  35846. vm._data.__ob__.vmCount--;
  35847. }
  35848. // call the last hook...
  35849. vm._isDestroyed = true;
  35850. // invoke destroy hooks on current rendered tree
  35851. vm.__patch__(vm._vnode, null);
  35852. // fire destroyed hook
  35853. callHook(vm, 'destroyed');
  35854. // turn off all instance listeners.
  35855. vm.$off();
  35856. // remove __vue__ reference
  35857. if (vm.$el) {
  35858. vm.$el.__vue__ = null;
  35859. }
  35860. // release circular reference (#6759)
  35861. if (vm.$vnode) {
  35862. vm.$vnode.parent = null;
  35863. }
  35864. };
  35865. }
  35866. function mountComponent (
  35867. vm,
  35868. el,
  35869. hydrating
  35870. ) {
  35871. vm.$el = el;
  35872. if (!vm.$options.render) {
  35873. vm.$options.render = createEmptyVNode;
  35874. {
  35875. /* istanbul ignore if */
  35876. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  35877. vm.$options.el || el) {
  35878. warn(
  35879. 'You are using the runtime-only build of Vue where the template ' +
  35880. 'compiler is not available. Either pre-compile the templates into ' +
  35881. 'render functions, or use the compiler-included build.',
  35882. vm
  35883. );
  35884. } else {
  35885. warn(
  35886. 'Failed to mount component: template or render function not defined.',
  35887. vm
  35888. );
  35889. }
  35890. }
  35891. }
  35892. callHook(vm, 'beforeMount');
  35893. var updateComponent;
  35894. /* istanbul ignore if */
  35895. if (config.performance && mark) {
  35896. updateComponent = function () {
  35897. var name = vm._name;
  35898. var id = vm._uid;
  35899. var startTag = "vue-perf-start:" + id;
  35900. var endTag = "vue-perf-end:" + id;
  35901. mark(startTag);
  35902. var vnode = vm._render();
  35903. mark(endTag);
  35904. measure(("vue " + name + " render"), startTag, endTag);
  35905. mark(startTag);
  35906. vm._update(vnode, hydrating);
  35907. mark(endTag);
  35908. measure(("vue " + name + " patch"), startTag, endTag);
  35909. };
  35910. } else {
  35911. updateComponent = function () {
  35912. vm._update(vm._render(), hydrating);
  35913. };
  35914. }
  35915. // we set this to vm._watcher inside the watcher's constructor
  35916. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  35917. // component's mounted hook), which relies on vm._watcher being already defined
  35918. new Watcher(vm, updateComponent, noop, {
  35919. before: function before () {
  35920. if (vm._isMounted && !vm._isDestroyed) {
  35921. callHook(vm, 'beforeUpdate');
  35922. }
  35923. }
  35924. }, true /* isRenderWatcher */);
  35925. hydrating = false;
  35926. // manually mounted instance, call mounted on self
  35927. // mounted is called for render-created child components in its inserted hook
  35928. if (vm.$vnode == null) {
  35929. vm._isMounted = true;
  35930. callHook(vm, 'mounted');
  35931. }
  35932. return vm
  35933. }
  35934. function updateChildComponent (
  35935. vm,
  35936. propsData,
  35937. listeners,
  35938. parentVnode,
  35939. renderChildren
  35940. ) {
  35941. {
  35942. isUpdatingChildComponent = true;
  35943. }
  35944. // determine whether component has slot children
  35945. // we need to do this before overwriting $options._renderChildren.
  35946. // check if there are dynamic scopedSlots (hand-written or compiled but with
  35947. // dynamic slot names). Static scoped slots compiled from template has the
  35948. // "$stable" marker.
  35949. var newScopedSlots = parentVnode.data.scopedSlots;
  35950. var oldScopedSlots = vm.$scopedSlots;
  35951. var hasDynamicScopedSlot = !!(
  35952. (newScopedSlots && !newScopedSlots.$stable) ||
  35953. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  35954. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  35955. );
  35956. // Any static slot children from the parent may have changed during parent's
  35957. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  35958. // update is necessary to ensure correctness.
  35959. var needsForceUpdate = !!(
  35960. renderChildren || // has new static slots
  35961. vm.$options._renderChildren || // has old static slots
  35962. hasDynamicScopedSlot
  35963. );
  35964. vm.$options._parentVnode = parentVnode;
  35965. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  35966. if (vm._vnode) { // update child tree's parent
  35967. vm._vnode.parent = parentVnode;
  35968. }
  35969. vm.$options._renderChildren = renderChildren;
  35970. // update $attrs and $listeners hash
  35971. // these are also reactive so they may trigger child update if the child
  35972. // used them during render
  35973. vm.$attrs = parentVnode.data.attrs || emptyObject;
  35974. vm.$listeners = listeners || emptyObject;
  35975. // update props
  35976. if (propsData && vm.$options.props) {
  35977. toggleObserving(false);
  35978. var props = vm._props;
  35979. var propKeys = vm.$options._propKeys || [];
  35980. for (var i = 0; i < propKeys.length; i++) {
  35981. var key = propKeys[i];
  35982. var propOptions = vm.$options.props; // wtf flow?
  35983. props[key] = validateProp(key, propOptions, propsData, vm);
  35984. }
  35985. toggleObserving(true);
  35986. // keep a copy of raw propsData
  35987. vm.$options.propsData = propsData;
  35988. }
  35989. // update listeners
  35990. listeners = listeners || emptyObject;
  35991. var oldListeners = vm.$options._parentListeners;
  35992. vm.$options._parentListeners = listeners;
  35993. updateComponentListeners(vm, listeners, oldListeners);
  35994. // resolve slots + force update if has children
  35995. if (needsForceUpdate) {
  35996. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  35997. vm.$forceUpdate();
  35998. }
  35999. {
  36000. isUpdatingChildComponent = false;
  36001. }
  36002. }
  36003. function isInInactiveTree (vm) {
  36004. while (vm && (vm = vm.$parent)) {
  36005. if (vm._inactive) { return true }
  36006. }
  36007. return false
  36008. }
  36009. function activateChildComponent (vm, direct) {
  36010. if (direct) {
  36011. vm._directInactive = false;
  36012. if (isInInactiveTree(vm)) {
  36013. return
  36014. }
  36015. } else if (vm._directInactive) {
  36016. return
  36017. }
  36018. if (vm._inactive || vm._inactive === null) {
  36019. vm._inactive = false;
  36020. for (var i = 0; i < vm.$children.length; i++) {
  36021. activateChildComponent(vm.$children[i]);
  36022. }
  36023. callHook(vm, 'activated');
  36024. }
  36025. }
  36026. function deactivateChildComponent (vm, direct) {
  36027. if (direct) {
  36028. vm._directInactive = true;
  36029. if (isInInactiveTree(vm)) {
  36030. return
  36031. }
  36032. }
  36033. if (!vm._inactive) {
  36034. vm._inactive = true;
  36035. for (var i = 0; i < vm.$children.length; i++) {
  36036. deactivateChildComponent(vm.$children[i]);
  36037. }
  36038. callHook(vm, 'deactivated');
  36039. }
  36040. }
  36041. function callHook (vm, hook) {
  36042. // #7573 disable dep collection when invoking lifecycle hooks
  36043. pushTarget();
  36044. var handlers = vm.$options[hook];
  36045. var info = hook + " hook";
  36046. if (handlers) {
  36047. for (var i = 0, j = handlers.length; i < j; i++) {
  36048. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  36049. }
  36050. }
  36051. if (vm._hasHookEvent) {
  36052. vm.$emit('hook:' + hook);
  36053. }
  36054. popTarget();
  36055. }
  36056. /* */
  36057. var MAX_UPDATE_COUNT = 100;
  36058. var queue = [];
  36059. var activatedChildren = [];
  36060. var has = {};
  36061. var circular = {};
  36062. var waiting = false;
  36063. var flushing = false;
  36064. var index = 0;
  36065. /**
  36066. * Reset the scheduler's state.
  36067. */
  36068. function resetSchedulerState () {
  36069. index = queue.length = activatedChildren.length = 0;
  36070. has = {};
  36071. {
  36072. circular = {};
  36073. }
  36074. waiting = flushing = false;
  36075. }
  36076. // Async edge case #6566 requires saving the timestamp when event listeners are
  36077. // attached. However, calling performance.now() has a perf overhead especially
  36078. // if the page has thousands of event listeners. Instead, we take a timestamp
  36079. // every time the scheduler flushes and use that for all event listeners
  36080. // attached during that flush.
  36081. var currentFlushTimestamp = 0;
  36082. // Async edge case fix requires storing an event listener's attach timestamp.
  36083. var getNow = Date.now;
  36084. // Determine what event timestamp the browser is using. Annoyingly, the
  36085. // timestamp can either be hi-res (relative to page load) or low-res
  36086. // (relative to UNIX epoch), so in order to compare time we have to use the
  36087. // same timestamp type when saving the flush timestamp.
  36088. if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
  36089. // if the low-res timestamp which is bigger than the event timestamp
  36090. // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
  36091. // and we need to use the hi-res version for event listeners as well.
  36092. getNow = function () { return performance.now(); };
  36093. }
  36094. /**
  36095. * Flush both queues and run the watchers.
  36096. */
  36097. function flushSchedulerQueue () {
  36098. currentFlushTimestamp = getNow();
  36099. flushing = true;
  36100. var watcher, id;
  36101. // Sort queue before flush.
  36102. // This ensures that:
  36103. // 1. Components are updated from parent to child. (because parent is always
  36104. // created before the child)
  36105. // 2. A component's user watchers are run before its render watcher (because
  36106. // user watchers are created before the render watcher)
  36107. // 3. If a component is destroyed during a parent component's watcher run,
  36108. // its watchers can be skipped.
  36109. queue.sort(function (a, b) { return a.id - b.id; });
  36110. // do not cache length because more watchers might be pushed
  36111. // as we run existing watchers
  36112. for (index = 0; index < queue.length; index++) {
  36113. watcher = queue[index];
  36114. if (watcher.before) {
  36115. watcher.before();
  36116. }
  36117. id = watcher.id;
  36118. has[id] = null;
  36119. watcher.run();
  36120. // in dev build, check and stop circular updates.
  36121. if (has[id] != null) {
  36122. circular[id] = (circular[id] || 0) + 1;
  36123. if (circular[id] > MAX_UPDATE_COUNT) {
  36124. warn(
  36125. 'You may have an infinite update loop ' + (
  36126. watcher.user
  36127. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  36128. : "in a component render function."
  36129. ),
  36130. watcher.vm
  36131. );
  36132. break
  36133. }
  36134. }
  36135. }
  36136. // keep copies of post queues before resetting state
  36137. var activatedQueue = activatedChildren.slice();
  36138. var updatedQueue = queue.slice();
  36139. resetSchedulerState();
  36140. // call component updated and activated hooks
  36141. callActivatedHooks(activatedQueue);
  36142. callUpdatedHooks(updatedQueue);
  36143. // devtool hook
  36144. /* istanbul ignore if */
  36145. if (devtools && config.devtools) {
  36146. devtools.emit('flush');
  36147. }
  36148. }
  36149. function callUpdatedHooks (queue) {
  36150. var i = queue.length;
  36151. while (i--) {
  36152. var watcher = queue[i];
  36153. var vm = watcher.vm;
  36154. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  36155. callHook(vm, 'updated');
  36156. }
  36157. }
  36158. }
  36159. /**
  36160. * Queue a kept-alive component that was activated during patch.
  36161. * The queue will be processed after the entire tree has been patched.
  36162. */
  36163. function queueActivatedComponent (vm) {
  36164. // setting _inactive to false here so that a render function can
  36165. // rely on checking whether it's in an inactive tree (e.g. router-view)
  36166. vm._inactive = false;
  36167. activatedChildren.push(vm);
  36168. }
  36169. function callActivatedHooks (queue) {
  36170. for (var i = 0; i < queue.length; i++) {
  36171. queue[i]._inactive = true;
  36172. activateChildComponent(queue[i], true /* true */);
  36173. }
  36174. }
  36175. /**
  36176. * Push a watcher into the watcher queue.
  36177. * Jobs with duplicate IDs will be skipped unless it's
  36178. * pushed when the queue is being flushed.
  36179. */
  36180. function queueWatcher (watcher) {
  36181. var id = watcher.id;
  36182. if (has[id] == null) {
  36183. has[id] = true;
  36184. if (!flushing) {
  36185. queue.push(watcher);
  36186. } else {
  36187. // if already flushing, splice the watcher based on its id
  36188. // if already past its id, it will be run next immediately.
  36189. var i = queue.length - 1;
  36190. while (i > index && queue[i].id > watcher.id) {
  36191. i--;
  36192. }
  36193. queue.splice(i + 1, 0, watcher);
  36194. }
  36195. // queue the flush
  36196. if (!waiting) {
  36197. waiting = true;
  36198. if (!config.async) {
  36199. flushSchedulerQueue();
  36200. return
  36201. }
  36202. nextTick(flushSchedulerQueue);
  36203. }
  36204. }
  36205. }
  36206. /* */
  36207. var uid$2 = 0;
  36208. /**
  36209. * A watcher parses an expression, collects dependencies,
  36210. * and fires callback when the expression value changes.
  36211. * This is used for both the $watch() api and directives.
  36212. */
  36213. var Watcher = function Watcher (
  36214. vm,
  36215. expOrFn,
  36216. cb,
  36217. options,
  36218. isRenderWatcher
  36219. ) {
  36220. this.vm = vm;
  36221. if (isRenderWatcher) {
  36222. vm._watcher = this;
  36223. }
  36224. vm._watchers.push(this);
  36225. // options
  36226. if (options) {
  36227. this.deep = !!options.deep;
  36228. this.user = !!options.user;
  36229. this.lazy = !!options.lazy;
  36230. this.sync = !!options.sync;
  36231. this.before = options.before;
  36232. } else {
  36233. this.deep = this.user = this.lazy = this.sync = false;
  36234. }
  36235. this.cb = cb;
  36236. this.id = ++uid$2; // uid for batching
  36237. this.active = true;
  36238. this.dirty = this.lazy; // for lazy watchers
  36239. this.deps = [];
  36240. this.newDeps = [];
  36241. this.depIds = new _Set();
  36242. this.newDepIds = new _Set();
  36243. this.expression = expOrFn.toString();
  36244. // parse expression for getter
  36245. if (typeof expOrFn === 'function') {
  36246. this.getter = expOrFn;
  36247. } else {
  36248. this.getter = parsePath(expOrFn);
  36249. if (!this.getter) {
  36250. this.getter = noop;
  36251. warn(
  36252. "Failed watching path: \"" + expOrFn + "\" " +
  36253. 'Watcher only accepts simple dot-delimited paths. ' +
  36254. 'For full control, use a function instead.',
  36255. vm
  36256. );
  36257. }
  36258. }
  36259. this.value = this.lazy
  36260. ? undefined
  36261. : this.get();
  36262. };
  36263. /**
  36264. * Evaluate the getter, and re-collect dependencies.
  36265. */
  36266. Watcher.prototype.get = function get () {
  36267. pushTarget(this);
  36268. var value;
  36269. var vm = this.vm;
  36270. try {
  36271. value = this.getter.call(vm, vm);
  36272. } catch (e) {
  36273. if (this.user) {
  36274. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  36275. } else {
  36276. throw e
  36277. }
  36278. } finally {
  36279. // "touch" every property so they are all tracked as
  36280. // dependencies for deep watching
  36281. if (this.deep) {
  36282. traverse(value);
  36283. }
  36284. popTarget();
  36285. this.cleanupDeps();
  36286. }
  36287. return value
  36288. };
  36289. /**
  36290. * Add a dependency to this directive.
  36291. */
  36292. Watcher.prototype.addDep = function addDep (dep) {
  36293. var id = dep.id;
  36294. if (!this.newDepIds.has(id)) {
  36295. this.newDepIds.add(id);
  36296. this.newDeps.push(dep);
  36297. if (!this.depIds.has(id)) {
  36298. dep.addSub(this);
  36299. }
  36300. }
  36301. };
  36302. /**
  36303. * Clean up for dependency collection.
  36304. */
  36305. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  36306. var i = this.deps.length;
  36307. while (i--) {
  36308. var dep = this.deps[i];
  36309. if (!this.newDepIds.has(dep.id)) {
  36310. dep.removeSub(this);
  36311. }
  36312. }
  36313. var tmp = this.depIds;
  36314. this.depIds = this.newDepIds;
  36315. this.newDepIds = tmp;
  36316. this.newDepIds.clear();
  36317. tmp = this.deps;
  36318. this.deps = this.newDeps;
  36319. this.newDeps = tmp;
  36320. this.newDeps.length = 0;
  36321. };
  36322. /**
  36323. * Subscriber interface.
  36324. * Will be called when a dependency changes.
  36325. */
  36326. Watcher.prototype.update = function update () {
  36327. /* istanbul ignore else */
  36328. if (this.lazy) {
  36329. this.dirty = true;
  36330. } else if (this.sync) {
  36331. this.run();
  36332. } else {
  36333. queueWatcher(this);
  36334. }
  36335. };
  36336. /**
  36337. * Scheduler job interface.
  36338. * Will be called by the scheduler.
  36339. */
  36340. Watcher.prototype.run = function run () {
  36341. if (this.active) {
  36342. var value = this.get();
  36343. if (
  36344. value !== this.value ||
  36345. // Deep watchers and watchers on Object/Arrays should fire even
  36346. // when the value is the same, because the value may
  36347. // have mutated.
  36348. isObject(value) ||
  36349. this.deep
  36350. ) {
  36351. // set new value
  36352. var oldValue = this.value;
  36353. this.value = value;
  36354. if (this.user) {
  36355. try {
  36356. this.cb.call(this.vm, value, oldValue);
  36357. } catch (e) {
  36358. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  36359. }
  36360. } else {
  36361. this.cb.call(this.vm, value, oldValue);
  36362. }
  36363. }
  36364. }
  36365. };
  36366. /**
  36367. * Evaluate the value of the watcher.
  36368. * This only gets called for lazy watchers.
  36369. */
  36370. Watcher.prototype.evaluate = function evaluate () {
  36371. this.value = this.get();
  36372. this.dirty = false;
  36373. };
  36374. /**
  36375. * Depend on all deps collected by this watcher.
  36376. */
  36377. Watcher.prototype.depend = function depend () {
  36378. var i = this.deps.length;
  36379. while (i--) {
  36380. this.deps[i].depend();
  36381. }
  36382. };
  36383. /**
  36384. * Remove self from all dependencies' subscriber list.
  36385. */
  36386. Watcher.prototype.teardown = function teardown () {
  36387. if (this.active) {
  36388. // remove self from vm's watcher list
  36389. // this is a somewhat expensive operation so we skip it
  36390. // if the vm is being destroyed.
  36391. if (!this.vm._isBeingDestroyed) {
  36392. remove(this.vm._watchers, this);
  36393. }
  36394. var i = this.deps.length;
  36395. while (i--) {
  36396. this.deps[i].removeSub(this);
  36397. }
  36398. this.active = false;
  36399. }
  36400. };
  36401. /* */
  36402. var sharedPropertyDefinition = {
  36403. enumerable: true,
  36404. configurable: true,
  36405. get: noop,
  36406. set: noop
  36407. };
  36408. function proxy (target, sourceKey, key) {
  36409. sharedPropertyDefinition.get = function proxyGetter () {
  36410. return this[sourceKey][key]
  36411. };
  36412. sharedPropertyDefinition.set = function proxySetter (val) {
  36413. this[sourceKey][key] = val;
  36414. };
  36415. Object.defineProperty(target, key, sharedPropertyDefinition);
  36416. }
  36417. function initState (vm) {
  36418. vm._watchers = [];
  36419. var opts = vm.$options;
  36420. if (opts.props) { initProps(vm, opts.props); }
  36421. if (opts.methods) { initMethods(vm, opts.methods); }
  36422. if (opts.data) {
  36423. initData(vm);
  36424. } else {
  36425. observe(vm._data = {}, true /* asRootData */);
  36426. }
  36427. if (opts.computed) { initComputed(vm, opts.computed); }
  36428. if (opts.watch && opts.watch !== nativeWatch) {
  36429. initWatch(vm, opts.watch);
  36430. }
  36431. }
  36432. function initProps (vm, propsOptions) {
  36433. var propsData = vm.$options.propsData || {};
  36434. var props = vm._props = {};
  36435. // cache prop keys so that future props updates can iterate using Array
  36436. // instead of dynamic object key enumeration.
  36437. var keys = vm.$options._propKeys = [];
  36438. var isRoot = !vm.$parent;
  36439. // root instance props should be converted
  36440. if (!isRoot) {
  36441. toggleObserving(false);
  36442. }
  36443. var loop = function ( key ) {
  36444. keys.push(key);
  36445. var value = validateProp(key, propsOptions, propsData, vm);
  36446. /* istanbul ignore else */
  36447. {
  36448. var hyphenatedKey = hyphenate(key);
  36449. if (isReservedAttribute(hyphenatedKey) ||
  36450. config.isReservedAttr(hyphenatedKey)) {
  36451. warn(
  36452. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  36453. vm
  36454. );
  36455. }
  36456. defineReactive$$1(props, key, value, function () {
  36457. if (!isRoot && !isUpdatingChildComponent) {
  36458. warn(
  36459. "Avoid mutating a prop directly since the value will be " +
  36460. "overwritten whenever the parent component re-renders. " +
  36461. "Instead, use a data or computed property based on the prop's " +
  36462. "value. Prop being mutated: \"" + key + "\"",
  36463. vm
  36464. );
  36465. }
  36466. });
  36467. }
  36468. // static props are already proxied on the component's prototype
  36469. // during Vue.extend(). We only need to proxy props defined at
  36470. // instantiation here.
  36471. if (!(key in vm)) {
  36472. proxy(vm, "_props", key);
  36473. }
  36474. };
  36475. for (var key in propsOptions) loop( key );
  36476. toggleObserving(true);
  36477. }
  36478. function initData (vm) {
  36479. var data = vm.$options.data;
  36480. data = vm._data = typeof data === 'function'
  36481. ? getData(data, vm)
  36482. : data || {};
  36483. if (!isPlainObject(data)) {
  36484. data = {};
  36485. warn(
  36486. 'data functions should return an object:\n' +
  36487. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  36488. vm
  36489. );
  36490. }
  36491. // proxy data on instance
  36492. var keys = Object.keys(data);
  36493. var props = vm.$options.props;
  36494. var methods = vm.$options.methods;
  36495. var i = keys.length;
  36496. while (i--) {
  36497. var key = keys[i];
  36498. {
  36499. if (methods && hasOwn(methods, key)) {
  36500. warn(
  36501. ("Method \"" + key + "\" has already been defined as a data property."),
  36502. vm
  36503. );
  36504. }
  36505. }
  36506. if (props && hasOwn(props, key)) {
  36507. warn(
  36508. "The data property \"" + key + "\" is already declared as a prop. " +
  36509. "Use prop default value instead.",
  36510. vm
  36511. );
  36512. } else if (!isReserved(key)) {
  36513. proxy(vm, "_data", key);
  36514. }
  36515. }
  36516. // observe data
  36517. observe(data, true /* asRootData */);
  36518. }
  36519. function getData (data, vm) {
  36520. // #7573 disable dep collection when invoking data getters
  36521. pushTarget();
  36522. try {
  36523. return data.call(vm, vm)
  36524. } catch (e) {
  36525. handleError(e, vm, "data()");
  36526. return {}
  36527. } finally {
  36528. popTarget();
  36529. }
  36530. }
  36531. var computedWatcherOptions = { lazy: true };
  36532. function initComputed (vm, computed) {
  36533. // $flow-disable-line
  36534. var watchers = vm._computedWatchers = Object.create(null);
  36535. // computed properties are just getters during SSR
  36536. var isSSR = isServerRendering();
  36537. for (var key in computed) {
  36538. var userDef = computed[key];
  36539. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  36540. if (getter == null) {
  36541. warn(
  36542. ("Getter is missing for computed property \"" + key + "\"."),
  36543. vm
  36544. );
  36545. }
  36546. if (!isSSR) {
  36547. // create internal watcher for the computed property.
  36548. watchers[key] = new Watcher(
  36549. vm,
  36550. getter || noop,
  36551. noop,
  36552. computedWatcherOptions
  36553. );
  36554. }
  36555. // component-defined computed properties are already defined on the
  36556. // component prototype. We only need to define computed properties defined
  36557. // at instantiation here.
  36558. if (!(key in vm)) {
  36559. defineComputed(vm, key, userDef);
  36560. } else {
  36561. if (key in vm.$data) {
  36562. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  36563. } else if (vm.$options.props && key in vm.$options.props) {
  36564. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  36565. }
  36566. }
  36567. }
  36568. }
  36569. function defineComputed (
  36570. target,
  36571. key,
  36572. userDef
  36573. ) {
  36574. var shouldCache = !isServerRendering();
  36575. if (typeof userDef === 'function') {
  36576. sharedPropertyDefinition.get = shouldCache
  36577. ? createComputedGetter(key)
  36578. : createGetterInvoker(userDef);
  36579. sharedPropertyDefinition.set = noop;
  36580. } else {
  36581. sharedPropertyDefinition.get = userDef.get
  36582. ? shouldCache && userDef.cache !== false
  36583. ? createComputedGetter(key)
  36584. : createGetterInvoker(userDef.get)
  36585. : noop;
  36586. sharedPropertyDefinition.set = userDef.set || noop;
  36587. }
  36588. if (sharedPropertyDefinition.set === noop) {
  36589. sharedPropertyDefinition.set = function () {
  36590. warn(
  36591. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  36592. this
  36593. );
  36594. };
  36595. }
  36596. Object.defineProperty(target, key, sharedPropertyDefinition);
  36597. }
  36598. function createComputedGetter (key) {
  36599. return function computedGetter () {
  36600. var watcher = this._computedWatchers && this._computedWatchers[key];
  36601. if (watcher) {
  36602. if (watcher.dirty) {
  36603. watcher.evaluate();
  36604. }
  36605. if (Dep.target) {
  36606. watcher.depend();
  36607. }
  36608. return watcher.value
  36609. }
  36610. }
  36611. }
  36612. function createGetterInvoker(fn) {
  36613. return function computedGetter () {
  36614. return fn.call(this, this)
  36615. }
  36616. }
  36617. function initMethods (vm, methods) {
  36618. var props = vm.$options.props;
  36619. for (var key in methods) {
  36620. {
  36621. if (typeof methods[key] !== 'function') {
  36622. warn(
  36623. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  36624. "Did you reference the function correctly?",
  36625. vm
  36626. );
  36627. }
  36628. if (props && hasOwn(props, key)) {
  36629. warn(
  36630. ("Method \"" + key + "\" has already been defined as a prop."),
  36631. vm
  36632. );
  36633. }
  36634. if ((key in vm) && isReserved(key)) {
  36635. warn(
  36636. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  36637. "Avoid defining component methods that start with _ or $."
  36638. );
  36639. }
  36640. }
  36641. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  36642. }
  36643. }
  36644. function initWatch (vm, watch) {
  36645. for (var key in watch) {
  36646. var handler = watch[key];
  36647. if (Array.isArray(handler)) {
  36648. for (var i = 0; i < handler.length; i++) {
  36649. createWatcher(vm, key, handler[i]);
  36650. }
  36651. } else {
  36652. createWatcher(vm, key, handler);
  36653. }
  36654. }
  36655. }
  36656. function createWatcher (
  36657. vm,
  36658. expOrFn,
  36659. handler,
  36660. options
  36661. ) {
  36662. if (isPlainObject(handler)) {
  36663. options = handler;
  36664. handler = handler.handler;
  36665. }
  36666. if (typeof handler === 'string') {
  36667. handler = vm[handler];
  36668. }
  36669. return vm.$watch(expOrFn, handler, options)
  36670. }
  36671. function stateMixin (Vue) {
  36672. // flow somehow has problems with directly declared definition object
  36673. // when using Object.defineProperty, so we have to procedurally build up
  36674. // the object here.
  36675. var dataDef = {};
  36676. dataDef.get = function () { return this._data };
  36677. var propsDef = {};
  36678. propsDef.get = function () { return this._props };
  36679. {
  36680. dataDef.set = function () {
  36681. warn(
  36682. 'Avoid replacing instance root $data. ' +
  36683. 'Use nested data properties instead.',
  36684. this
  36685. );
  36686. };
  36687. propsDef.set = function () {
  36688. warn("$props is readonly.", this);
  36689. };
  36690. }
  36691. Object.defineProperty(Vue.prototype, '$data', dataDef);
  36692. Object.defineProperty(Vue.prototype, '$props', propsDef);
  36693. Vue.prototype.$set = set;
  36694. Vue.prototype.$delete = del;
  36695. Vue.prototype.$watch = function (
  36696. expOrFn,
  36697. cb,
  36698. options
  36699. ) {
  36700. var vm = this;
  36701. if (isPlainObject(cb)) {
  36702. return createWatcher(vm, expOrFn, cb, options)
  36703. }
  36704. options = options || {};
  36705. options.user = true;
  36706. var watcher = new Watcher(vm, expOrFn, cb, options);
  36707. if (options.immediate) {
  36708. try {
  36709. cb.call(vm, watcher.value);
  36710. } catch (error) {
  36711. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  36712. }
  36713. }
  36714. return function unwatchFn () {
  36715. watcher.teardown();
  36716. }
  36717. };
  36718. }
  36719. /* */
  36720. var uid$3 = 0;
  36721. function initMixin (Vue) {
  36722. Vue.prototype._init = function (options) {
  36723. var vm = this;
  36724. // a uid
  36725. vm._uid = uid$3++;
  36726. var startTag, endTag;
  36727. /* istanbul ignore if */
  36728. if (config.performance && mark) {
  36729. startTag = "vue-perf-start:" + (vm._uid);
  36730. endTag = "vue-perf-end:" + (vm._uid);
  36731. mark(startTag);
  36732. }
  36733. // a flag to avoid this being observed
  36734. vm._isVue = true;
  36735. // merge options
  36736. if (options && options._isComponent) {
  36737. // optimize internal component instantiation
  36738. // since dynamic options merging is pretty slow, and none of the
  36739. // internal component options needs special treatment.
  36740. initInternalComponent(vm, options);
  36741. } else {
  36742. vm.$options = mergeOptions(
  36743. resolveConstructorOptions(vm.constructor),
  36744. options || {},
  36745. vm
  36746. );
  36747. }
  36748. /* istanbul ignore else */
  36749. {
  36750. initProxy(vm);
  36751. }
  36752. // expose real self
  36753. vm._self = vm;
  36754. initLifecycle(vm);
  36755. initEvents(vm);
  36756. initRender(vm);
  36757. callHook(vm, 'beforeCreate');
  36758. initInjections(vm); // resolve injections before data/props
  36759. initState(vm);
  36760. initProvide(vm); // resolve provide after data/props
  36761. callHook(vm, 'created');
  36762. /* istanbul ignore if */
  36763. if (config.performance && mark) {
  36764. vm._name = formatComponentName(vm, false);
  36765. mark(endTag);
  36766. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  36767. }
  36768. if (vm.$options.el) {
  36769. vm.$mount(vm.$options.el);
  36770. }
  36771. };
  36772. }
  36773. function initInternalComponent (vm, options) {
  36774. var opts = vm.$options = Object.create(vm.constructor.options);
  36775. // doing this because it's faster than dynamic enumeration.
  36776. var parentVnode = options._parentVnode;
  36777. opts.parent = options.parent;
  36778. opts._parentVnode = parentVnode;
  36779. var vnodeComponentOptions = parentVnode.componentOptions;
  36780. opts.propsData = vnodeComponentOptions.propsData;
  36781. opts._parentListeners = vnodeComponentOptions.listeners;
  36782. opts._renderChildren = vnodeComponentOptions.children;
  36783. opts._componentTag = vnodeComponentOptions.tag;
  36784. if (options.render) {
  36785. opts.render = options.render;
  36786. opts.staticRenderFns = options.staticRenderFns;
  36787. }
  36788. }
  36789. function resolveConstructorOptions (Ctor) {
  36790. var options = Ctor.options;
  36791. if (Ctor.super) {
  36792. var superOptions = resolveConstructorOptions(Ctor.super);
  36793. var cachedSuperOptions = Ctor.superOptions;
  36794. if (superOptions !== cachedSuperOptions) {
  36795. // super option changed,
  36796. // need to resolve new options.
  36797. Ctor.superOptions = superOptions;
  36798. // check if there are any late-modified/attached options (#4976)
  36799. var modifiedOptions = resolveModifiedOptions(Ctor);
  36800. // update base extend options
  36801. if (modifiedOptions) {
  36802. extend(Ctor.extendOptions, modifiedOptions);
  36803. }
  36804. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  36805. if (options.name) {
  36806. options.components[options.name] = Ctor;
  36807. }
  36808. }
  36809. }
  36810. return options
  36811. }
  36812. function resolveModifiedOptions (Ctor) {
  36813. var modified;
  36814. var latest = Ctor.options;
  36815. var sealed = Ctor.sealedOptions;
  36816. for (var key in latest) {
  36817. if (latest[key] !== sealed[key]) {
  36818. if (!modified) { modified = {}; }
  36819. modified[key] = latest[key];
  36820. }
  36821. }
  36822. return modified
  36823. }
  36824. function Vue (options) {
  36825. if (!(this instanceof Vue)
  36826. ) {
  36827. warn('Vue is a constructor and should be called with the `new` keyword');
  36828. }
  36829. this._init(options);
  36830. }
  36831. initMixin(Vue);
  36832. stateMixin(Vue);
  36833. eventsMixin(Vue);
  36834. lifecycleMixin(Vue);
  36835. renderMixin(Vue);
  36836. /* */
  36837. function initUse (Vue) {
  36838. Vue.use = function (plugin) {
  36839. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  36840. if (installedPlugins.indexOf(plugin) > -1) {
  36841. return this
  36842. }
  36843. // additional parameters
  36844. var args = toArray(arguments, 1);
  36845. args.unshift(this);
  36846. if (typeof plugin.install === 'function') {
  36847. plugin.install.apply(plugin, args);
  36848. } else if (typeof plugin === 'function') {
  36849. plugin.apply(null, args);
  36850. }
  36851. installedPlugins.push(plugin);
  36852. return this
  36853. };
  36854. }
  36855. /* */
  36856. function initMixin$1 (Vue) {
  36857. Vue.mixin = function (mixin) {
  36858. this.options = mergeOptions(this.options, mixin);
  36859. return this
  36860. };
  36861. }
  36862. /* */
  36863. function initExtend (Vue) {
  36864. /**
  36865. * Each instance constructor, including Vue, has a unique
  36866. * cid. This enables us to create wrapped "child
  36867. * constructors" for prototypal inheritance and cache them.
  36868. */
  36869. Vue.cid = 0;
  36870. var cid = 1;
  36871. /**
  36872. * Class inheritance
  36873. */
  36874. Vue.extend = function (extendOptions) {
  36875. extendOptions = extendOptions || {};
  36876. var Super = this;
  36877. var SuperId = Super.cid;
  36878. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  36879. if (cachedCtors[SuperId]) {
  36880. return cachedCtors[SuperId]
  36881. }
  36882. var name = extendOptions.name || Super.options.name;
  36883. if (name) {
  36884. validateComponentName(name);
  36885. }
  36886. var Sub = function VueComponent (options) {
  36887. this._init(options);
  36888. };
  36889. Sub.prototype = Object.create(Super.prototype);
  36890. Sub.prototype.constructor = Sub;
  36891. Sub.cid = cid++;
  36892. Sub.options = mergeOptions(
  36893. Super.options,
  36894. extendOptions
  36895. );
  36896. Sub['super'] = Super;
  36897. // For props and computed properties, we define the proxy getters on
  36898. // the Vue instances at extension time, on the extended prototype. This
  36899. // avoids Object.defineProperty calls for each instance created.
  36900. if (Sub.options.props) {
  36901. initProps$1(Sub);
  36902. }
  36903. if (Sub.options.computed) {
  36904. initComputed$1(Sub);
  36905. }
  36906. // allow further extension/mixin/plugin usage
  36907. Sub.extend = Super.extend;
  36908. Sub.mixin = Super.mixin;
  36909. Sub.use = Super.use;
  36910. // create asset registers, so extended classes
  36911. // can have their private assets too.
  36912. ASSET_TYPES.forEach(function (type) {
  36913. Sub[type] = Super[type];
  36914. });
  36915. // enable recursive self-lookup
  36916. if (name) {
  36917. Sub.options.components[name] = Sub;
  36918. }
  36919. // keep a reference to the super options at extension time.
  36920. // later at instantiation we can check if Super's options have
  36921. // been updated.
  36922. Sub.superOptions = Super.options;
  36923. Sub.extendOptions = extendOptions;
  36924. Sub.sealedOptions = extend({}, Sub.options);
  36925. // cache constructor
  36926. cachedCtors[SuperId] = Sub;
  36927. return Sub
  36928. };
  36929. }
  36930. function initProps$1 (Comp) {
  36931. var props = Comp.options.props;
  36932. for (var key in props) {
  36933. proxy(Comp.prototype, "_props", key);
  36934. }
  36935. }
  36936. function initComputed$1 (Comp) {
  36937. var computed = Comp.options.computed;
  36938. for (var key in computed) {
  36939. defineComputed(Comp.prototype, key, computed[key]);
  36940. }
  36941. }
  36942. /* */
  36943. function initAssetRegisters (Vue) {
  36944. /**
  36945. * Create asset registration methods.
  36946. */
  36947. ASSET_TYPES.forEach(function (type) {
  36948. Vue[type] = function (
  36949. id,
  36950. definition
  36951. ) {
  36952. if (!definition) {
  36953. return this.options[type + 's'][id]
  36954. } else {
  36955. /* istanbul ignore if */
  36956. if (type === 'component') {
  36957. validateComponentName(id);
  36958. }
  36959. if (type === 'component' && isPlainObject(definition)) {
  36960. definition.name = definition.name || id;
  36961. definition = this.options._base.extend(definition);
  36962. }
  36963. if (type === 'directive' && typeof definition === 'function') {
  36964. definition = { bind: definition, update: definition };
  36965. }
  36966. this.options[type + 's'][id] = definition;
  36967. return definition
  36968. }
  36969. };
  36970. });
  36971. }
  36972. /* */
  36973. function getComponentName (opts) {
  36974. return opts && (opts.Ctor.options.name || opts.tag)
  36975. }
  36976. function matches (pattern, name) {
  36977. if (Array.isArray(pattern)) {
  36978. return pattern.indexOf(name) > -1
  36979. } else if (typeof pattern === 'string') {
  36980. return pattern.split(',').indexOf(name) > -1
  36981. } else if (isRegExp(pattern)) {
  36982. return pattern.test(name)
  36983. }
  36984. /* istanbul ignore next */
  36985. return false
  36986. }
  36987. function pruneCache (keepAliveInstance, filter) {
  36988. var cache = keepAliveInstance.cache;
  36989. var keys = keepAliveInstance.keys;
  36990. var _vnode = keepAliveInstance._vnode;
  36991. for (var key in cache) {
  36992. var cachedNode = cache[key];
  36993. if (cachedNode) {
  36994. var name = getComponentName(cachedNode.componentOptions);
  36995. if (name && !filter(name)) {
  36996. pruneCacheEntry(cache, key, keys, _vnode);
  36997. }
  36998. }
  36999. }
  37000. }
  37001. function pruneCacheEntry (
  37002. cache,
  37003. key,
  37004. keys,
  37005. current
  37006. ) {
  37007. var cached$$1 = cache[key];
  37008. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  37009. cached$$1.componentInstance.$destroy();
  37010. }
  37011. cache[key] = null;
  37012. remove(keys, key);
  37013. }
  37014. var patternTypes = [String, RegExp, Array];
  37015. var KeepAlive = {
  37016. name: 'keep-alive',
  37017. abstract: true,
  37018. props: {
  37019. include: patternTypes,
  37020. exclude: patternTypes,
  37021. max: [String, Number]
  37022. },
  37023. created: function created () {
  37024. this.cache = Object.create(null);
  37025. this.keys = [];
  37026. },
  37027. destroyed: function destroyed () {
  37028. for (var key in this.cache) {
  37029. pruneCacheEntry(this.cache, key, this.keys);
  37030. }
  37031. },
  37032. mounted: function mounted () {
  37033. var this$1 = this;
  37034. this.$watch('include', function (val) {
  37035. pruneCache(this$1, function (name) { return matches(val, name); });
  37036. });
  37037. this.$watch('exclude', function (val) {
  37038. pruneCache(this$1, function (name) { return !matches(val, name); });
  37039. });
  37040. },
  37041. render: function render () {
  37042. var slot = this.$slots.default;
  37043. var vnode = getFirstComponentChild(slot);
  37044. var componentOptions = vnode && vnode.componentOptions;
  37045. if (componentOptions) {
  37046. // check pattern
  37047. var name = getComponentName(componentOptions);
  37048. var ref = this;
  37049. var include = ref.include;
  37050. var exclude = ref.exclude;
  37051. if (
  37052. // not included
  37053. (include && (!name || !matches(include, name))) ||
  37054. // excluded
  37055. (exclude && name && matches(exclude, name))
  37056. ) {
  37057. return vnode
  37058. }
  37059. var ref$1 = this;
  37060. var cache = ref$1.cache;
  37061. var keys = ref$1.keys;
  37062. var key = vnode.key == null
  37063. // same constructor may get registered as different local components
  37064. // so cid alone is not enough (#3269)
  37065. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  37066. : vnode.key;
  37067. if (cache[key]) {
  37068. vnode.componentInstance = cache[key].componentInstance;
  37069. // make current key freshest
  37070. remove(keys, key);
  37071. keys.push(key);
  37072. } else {
  37073. cache[key] = vnode;
  37074. keys.push(key);
  37075. // prune oldest entry
  37076. if (this.max && keys.length > parseInt(this.max)) {
  37077. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  37078. }
  37079. }
  37080. vnode.data.keepAlive = true;
  37081. }
  37082. return vnode || (slot && slot[0])
  37083. }
  37084. };
  37085. var builtInComponents = {
  37086. KeepAlive: KeepAlive
  37087. };
  37088. /* */
  37089. function initGlobalAPI (Vue) {
  37090. // config
  37091. var configDef = {};
  37092. configDef.get = function () { return config; };
  37093. {
  37094. configDef.set = function () {
  37095. warn(
  37096. 'Do not replace the Vue.config object, set individual fields instead.'
  37097. );
  37098. };
  37099. }
  37100. Object.defineProperty(Vue, 'config', configDef);
  37101. // exposed util methods.
  37102. // NOTE: these are not considered part of the public API - avoid relying on
  37103. // them unless you are aware of the risk.
  37104. Vue.util = {
  37105. warn: warn,
  37106. extend: extend,
  37107. mergeOptions: mergeOptions,
  37108. defineReactive: defineReactive$$1
  37109. };
  37110. Vue.set = set;
  37111. Vue.delete = del;
  37112. Vue.nextTick = nextTick;
  37113. // 2.6 explicit observable API
  37114. Vue.observable = function (obj) {
  37115. observe(obj);
  37116. return obj
  37117. };
  37118. Vue.options = Object.create(null);
  37119. ASSET_TYPES.forEach(function (type) {
  37120. Vue.options[type + 's'] = Object.create(null);
  37121. });
  37122. // this is used to identify the "base" constructor to extend all plain-object
  37123. // components with in Weex's multi-instance scenarios.
  37124. Vue.options._base = Vue;
  37125. extend(Vue.options.components, builtInComponents);
  37126. initUse(Vue);
  37127. initMixin$1(Vue);
  37128. initExtend(Vue);
  37129. initAssetRegisters(Vue);
  37130. }
  37131. initGlobalAPI(Vue);
  37132. Object.defineProperty(Vue.prototype, '$isServer', {
  37133. get: isServerRendering
  37134. });
  37135. Object.defineProperty(Vue.prototype, '$ssrContext', {
  37136. get: function get () {
  37137. /* istanbul ignore next */
  37138. return this.$vnode && this.$vnode.ssrContext
  37139. }
  37140. });
  37141. // expose FunctionalRenderContext for ssr runtime helper installation
  37142. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  37143. value: FunctionalRenderContext
  37144. });
  37145. Vue.version = '2.6.7';
  37146. /* */
  37147. // these are reserved for web because they are directly compiled away
  37148. // during template compilation
  37149. var isReservedAttr = makeMap('style,class');
  37150. // attributes that should be using props for binding
  37151. var acceptValue = makeMap('input,textarea,option,select,progress');
  37152. var mustUseProp = function (tag, type, attr) {
  37153. return (
  37154. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  37155. (attr === 'selected' && tag === 'option') ||
  37156. (attr === 'checked' && tag === 'input') ||
  37157. (attr === 'muted' && tag === 'video')
  37158. )
  37159. };
  37160. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  37161. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  37162. var convertEnumeratedValue = function (key, value) {
  37163. return isFalsyAttrValue(value) || value === 'false'
  37164. ? 'false'
  37165. // allow arbitrary string value for contenteditable
  37166. : key === 'contenteditable' && isValidContentEditableValue(value)
  37167. ? value
  37168. : 'true'
  37169. };
  37170. var isBooleanAttr = makeMap(
  37171. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  37172. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  37173. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  37174. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  37175. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  37176. 'truespeed,typemustmatch,visible'
  37177. );
  37178. var xlinkNS = 'http://www.w3.org/1999/xlink';
  37179. var isXlink = function (name) {
  37180. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  37181. };
  37182. var getXlinkProp = function (name) {
  37183. return isXlink(name) ? name.slice(6, name.length) : ''
  37184. };
  37185. var isFalsyAttrValue = function (val) {
  37186. return val == null || val === false
  37187. };
  37188. /* */
  37189. function genClassForVnode (vnode) {
  37190. var data = vnode.data;
  37191. var parentNode = vnode;
  37192. var childNode = vnode;
  37193. while (isDef(childNode.componentInstance)) {
  37194. childNode = childNode.componentInstance._vnode;
  37195. if (childNode && childNode.data) {
  37196. data = mergeClassData(childNode.data, data);
  37197. }
  37198. }
  37199. while (isDef(parentNode = parentNode.parent)) {
  37200. if (parentNode && parentNode.data) {
  37201. data = mergeClassData(data, parentNode.data);
  37202. }
  37203. }
  37204. return renderClass(data.staticClass, data.class)
  37205. }
  37206. function mergeClassData (child, parent) {
  37207. return {
  37208. staticClass: concat(child.staticClass, parent.staticClass),
  37209. class: isDef(child.class)
  37210. ? [child.class, parent.class]
  37211. : parent.class
  37212. }
  37213. }
  37214. function renderClass (
  37215. staticClass,
  37216. dynamicClass
  37217. ) {
  37218. if (isDef(staticClass) || isDef(dynamicClass)) {
  37219. return concat(staticClass, stringifyClass(dynamicClass))
  37220. }
  37221. /* istanbul ignore next */
  37222. return ''
  37223. }
  37224. function concat (a, b) {
  37225. return a ? b ? (a + ' ' + b) : a : (b || '')
  37226. }
  37227. function stringifyClass (value) {
  37228. if (Array.isArray(value)) {
  37229. return stringifyArray(value)
  37230. }
  37231. if (isObject(value)) {
  37232. return stringifyObject(value)
  37233. }
  37234. if (typeof value === 'string') {
  37235. return value
  37236. }
  37237. /* istanbul ignore next */
  37238. return ''
  37239. }
  37240. function stringifyArray (value) {
  37241. var res = '';
  37242. var stringified;
  37243. for (var i = 0, l = value.length; i < l; i++) {
  37244. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  37245. if (res) { res += ' '; }
  37246. res += stringified;
  37247. }
  37248. }
  37249. return res
  37250. }
  37251. function stringifyObject (value) {
  37252. var res = '';
  37253. for (var key in value) {
  37254. if (value[key]) {
  37255. if (res) { res += ' '; }
  37256. res += key;
  37257. }
  37258. }
  37259. return res
  37260. }
  37261. /* */
  37262. var namespaceMap = {
  37263. svg: 'http://www.w3.org/2000/svg',
  37264. math: 'http://www.w3.org/1998/Math/MathML'
  37265. };
  37266. var isHTMLTag = makeMap(
  37267. 'html,body,base,head,link,meta,style,title,' +
  37268. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  37269. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  37270. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  37271. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  37272. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  37273. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  37274. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  37275. 'output,progress,select,textarea,' +
  37276. 'details,dialog,menu,menuitem,summary,' +
  37277. 'content,element,shadow,template,blockquote,iframe,tfoot'
  37278. );
  37279. // this map is intentionally selective, only covering SVG elements that may
  37280. // contain child elements.
  37281. var isSVG = makeMap(
  37282. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  37283. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  37284. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  37285. true
  37286. );
  37287. var isPreTag = function (tag) { return tag === 'pre'; };
  37288. var isReservedTag = function (tag) {
  37289. return isHTMLTag(tag) || isSVG(tag)
  37290. };
  37291. function getTagNamespace (tag) {
  37292. if (isSVG(tag)) {
  37293. return 'svg'
  37294. }
  37295. // basic support for MathML
  37296. // note it doesn't support other MathML elements being component roots
  37297. if (tag === 'math') {
  37298. return 'math'
  37299. }
  37300. }
  37301. var unknownElementCache = Object.create(null);
  37302. function isUnknownElement (tag) {
  37303. /* istanbul ignore if */
  37304. if (!inBrowser) {
  37305. return true
  37306. }
  37307. if (isReservedTag(tag)) {
  37308. return false
  37309. }
  37310. tag = tag.toLowerCase();
  37311. /* istanbul ignore if */
  37312. if (unknownElementCache[tag] != null) {
  37313. return unknownElementCache[tag]
  37314. }
  37315. var el = document.createElement(tag);
  37316. if (tag.indexOf('-') > -1) {
  37317. // http://stackoverflow.com/a/28210364/1070244
  37318. return (unknownElementCache[tag] = (
  37319. el.constructor === window.HTMLUnknownElement ||
  37320. el.constructor === window.HTMLElement
  37321. ))
  37322. } else {
  37323. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  37324. }
  37325. }
  37326. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  37327. /* */
  37328. /**
  37329. * Query an element selector if it's not an element already.
  37330. */
  37331. function query (el) {
  37332. if (typeof el === 'string') {
  37333. var selected = document.querySelector(el);
  37334. if (!selected) {
  37335. warn(
  37336. 'Cannot find element: ' + el
  37337. );
  37338. return document.createElement('div')
  37339. }
  37340. return selected
  37341. } else {
  37342. return el
  37343. }
  37344. }
  37345. /* */
  37346. function createElement$1 (tagName, vnode) {
  37347. var elm = document.createElement(tagName);
  37348. if (tagName !== 'select') {
  37349. return elm
  37350. }
  37351. // false or null will remove the attribute but undefined will not
  37352. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  37353. elm.setAttribute('multiple', 'multiple');
  37354. }
  37355. return elm
  37356. }
  37357. function createElementNS (namespace, tagName) {
  37358. return document.createElementNS(namespaceMap[namespace], tagName)
  37359. }
  37360. function createTextNode (text) {
  37361. return document.createTextNode(text)
  37362. }
  37363. function createComment (text) {
  37364. return document.createComment(text)
  37365. }
  37366. function insertBefore (parentNode, newNode, referenceNode) {
  37367. parentNode.insertBefore(newNode, referenceNode);
  37368. }
  37369. function removeChild (node, child) {
  37370. node.removeChild(child);
  37371. }
  37372. function appendChild (node, child) {
  37373. node.appendChild(child);
  37374. }
  37375. function parentNode (node) {
  37376. return node.parentNode
  37377. }
  37378. function nextSibling (node) {
  37379. return node.nextSibling
  37380. }
  37381. function tagName (node) {
  37382. return node.tagName
  37383. }
  37384. function setTextContent (node, text) {
  37385. node.textContent = text;
  37386. }
  37387. function setStyleScope (node, scopeId) {
  37388. node.setAttribute(scopeId, '');
  37389. }
  37390. var nodeOps = /*#__PURE__*/Object.freeze({
  37391. createElement: createElement$1,
  37392. createElementNS: createElementNS,
  37393. createTextNode: createTextNode,
  37394. createComment: createComment,
  37395. insertBefore: insertBefore,
  37396. removeChild: removeChild,
  37397. appendChild: appendChild,
  37398. parentNode: parentNode,
  37399. nextSibling: nextSibling,
  37400. tagName: tagName,
  37401. setTextContent: setTextContent,
  37402. setStyleScope: setStyleScope
  37403. });
  37404. /* */
  37405. var ref = {
  37406. create: function create (_, vnode) {
  37407. registerRef(vnode);
  37408. },
  37409. update: function update (oldVnode, vnode) {
  37410. if (oldVnode.data.ref !== vnode.data.ref) {
  37411. registerRef(oldVnode, true);
  37412. registerRef(vnode);
  37413. }
  37414. },
  37415. destroy: function destroy (vnode) {
  37416. registerRef(vnode, true);
  37417. }
  37418. };
  37419. function registerRef (vnode, isRemoval) {
  37420. var key = vnode.data.ref;
  37421. if (!isDef(key)) { return }
  37422. var vm = vnode.context;
  37423. var ref = vnode.componentInstance || vnode.elm;
  37424. var refs = vm.$refs;
  37425. if (isRemoval) {
  37426. if (Array.isArray(refs[key])) {
  37427. remove(refs[key], ref);
  37428. } else if (refs[key] === ref) {
  37429. refs[key] = undefined;
  37430. }
  37431. } else {
  37432. if (vnode.data.refInFor) {
  37433. if (!Array.isArray(refs[key])) {
  37434. refs[key] = [ref];
  37435. } else if (refs[key].indexOf(ref) < 0) {
  37436. // $flow-disable-line
  37437. refs[key].push(ref);
  37438. }
  37439. } else {
  37440. refs[key] = ref;
  37441. }
  37442. }
  37443. }
  37444. /**
  37445. * Virtual DOM patching algorithm based on Snabbdom by
  37446. * Simon Friis Vindum (@paldepind)
  37447. * Licensed under the MIT License
  37448. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  37449. *
  37450. * modified by Evan You (@yyx990803)
  37451. *
  37452. * Not type-checking this because this file is perf-critical and the cost
  37453. * of making flow understand it is not worth it.
  37454. */
  37455. var emptyNode = new VNode('', {}, []);
  37456. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  37457. function sameVnode (a, b) {
  37458. return (
  37459. a.key === b.key && (
  37460. (
  37461. a.tag === b.tag &&
  37462. a.isComment === b.isComment &&
  37463. isDef(a.data) === isDef(b.data) &&
  37464. sameInputType(a, b)
  37465. ) || (
  37466. isTrue(a.isAsyncPlaceholder) &&
  37467. a.asyncFactory === b.asyncFactory &&
  37468. isUndef(b.asyncFactory.error)
  37469. )
  37470. )
  37471. )
  37472. }
  37473. function sameInputType (a, b) {
  37474. if (a.tag !== 'input') { return true }
  37475. var i;
  37476. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  37477. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  37478. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  37479. }
  37480. function createKeyToOldIdx (children, beginIdx, endIdx) {
  37481. var i, key;
  37482. var map = {};
  37483. for (i = beginIdx; i <= endIdx; ++i) {
  37484. key = children[i].key;
  37485. if (isDef(key)) { map[key] = i; }
  37486. }
  37487. return map
  37488. }
  37489. function createPatchFunction (backend) {
  37490. var i, j;
  37491. var cbs = {};
  37492. var modules = backend.modules;
  37493. var nodeOps = backend.nodeOps;
  37494. for (i = 0; i < hooks.length; ++i) {
  37495. cbs[hooks[i]] = [];
  37496. for (j = 0; j < modules.length; ++j) {
  37497. if (isDef(modules[j][hooks[i]])) {
  37498. cbs[hooks[i]].push(modules[j][hooks[i]]);
  37499. }
  37500. }
  37501. }
  37502. function emptyNodeAt (elm) {
  37503. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  37504. }
  37505. function createRmCb (childElm, listeners) {
  37506. function remove$$1 () {
  37507. if (--remove$$1.listeners === 0) {
  37508. removeNode(childElm);
  37509. }
  37510. }
  37511. remove$$1.listeners = listeners;
  37512. return remove$$1
  37513. }
  37514. function removeNode (el) {
  37515. var parent = nodeOps.parentNode(el);
  37516. // element may have already been removed due to v-html / v-text
  37517. if (isDef(parent)) {
  37518. nodeOps.removeChild(parent, el);
  37519. }
  37520. }
  37521. function isUnknownElement$$1 (vnode, inVPre) {
  37522. return (
  37523. !inVPre &&
  37524. !vnode.ns &&
  37525. !(
  37526. config.ignoredElements.length &&
  37527. config.ignoredElements.some(function (ignore) {
  37528. return isRegExp(ignore)
  37529. ? ignore.test(vnode.tag)
  37530. : ignore === vnode.tag
  37531. })
  37532. ) &&
  37533. config.isUnknownElement(vnode.tag)
  37534. )
  37535. }
  37536. var creatingElmInVPre = 0;
  37537. function createElm (
  37538. vnode,
  37539. insertedVnodeQueue,
  37540. parentElm,
  37541. refElm,
  37542. nested,
  37543. ownerArray,
  37544. index
  37545. ) {
  37546. if (isDef(vnode.elm) && isDef(ownerArray)) {
  37547. // This vnode was used in a previous render!
  37548. // now it's used as a new node, overwriting its elm would cause
  37549. // potential patch errors down the road when it's used as an insertion
  37550. // reference node. Instead, we clone the node on-demand before creating
  37551. // associated DOM element for it.
  37552. vnode = ownerArray[index] = cloneVNode(vnode);
  37553. }
  37554. vnode.isRootInsert = !nested; // for transition enter check
  37555. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  37556. return
  37557. }
  37558. var data = vnode.data;
  37559. var children = vnode.children;
  37560. var tag = vnode.tag;
  37561. if (isDef(tag)) {
  37562. {
  37563. if (data && data.pre) {
  37564. creatingElmInVPre++;
  37565. }
  37566. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  37567. warn(
  37568. 'Unknown custom element: <' + tag + '> - did you ' +
  37569. 'register the component correctly? For recursive components, ' +
  37570. 'make sure to provide the "name" option.',
  37571. vnode.context
  37572. );
  37573. }
  37574. }
  37575. vnode.elm = vnode.ns
  37576. ? nodeOps.createElementNS(vnode.ns, tag)
  37577. : nodeOps.createElement(tag, vnode);
  37578. setScope(vnode);
  37579. /* istanbul ignore if */
  37580. {
  37581. createChildren(vnode, children, insertedVnodeQueue);
  37582. if (isDef(data)) {
  37583. invokeCreateHooks(vnode, insertedVnodeQueue);
  37584. }
  37585. insert(parentElm, vnode.elm, refElm);
  37586. }
  37587. if (data && data.pre) {
  37588. creatingElmInVPre--;
  37589. }
  37590. } else if (isTrue(vnode.isComment)) {
  37591. vnode.elm = nodeOps.createComment(vnode.text);
  37592. insert(parentElm, vnode.elm, refElm);
  37593. } else {
  37594. vnode.elm = nodeOps.createTextNode(vnode.text);
  37595. insert(parentElm, vnode.elm, refElm);
  37596. }
  37597. }
  37598. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  37599. var i = vnode.data;
  37600. if (isDef(i)) {
  37601. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  37602. if (isDef(i = i.hook) && isDef(i = i.init)) {
  37603. i(vnode, false /* hydrating */);
  37604. }
  37605. // after calling the init hook, if the vnode is a child component
  37606. // it should've created a child instance and mounted it. the child
  37607. // component also has set the placeholder vnode's elm.
  37608. // in that case we can just return the element and be done.
  37609. if (isDef(vnode.componentInstance)) {
  37610. initComponent(vnode, insertedVnodeQueue);
  37611. insert(parentElm, vnode.elm, refElm);
  37612. if (isTrue(isReactivated)) {
  37613. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  37614. }
  37615. return true
  37616. }
  37617. }
  37618. }
  37619. function initComponent (vnode, insertedVnodeQueue) {
  37620. if (isDef(vnode.data.pendingInsert)) {
  37621. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  37622. vnode.data.pendingInsert = null;
  37623. }
  37624. vnode.elm = vnode.componentInstance.$el;
  37625. if (isPatchable(vnode)) {
  37626. invokeCreateHooks(vnode, insertedVnodeQueue);
  37627. setScope(vnode);
  37628. } else {
  37629. // empty component root.
  37630. // skip all element-related modules except for ref (#3455)
  37631. registerRef(vnode);
  37632. // make sure to invoke the insert hook
  37633. insertedVnodeQueue.push(vnode);
  37634. }
  37635. }
  37636. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  37637. var i;
  37638. // hack for #4339: a reactivated component with inner transition
  37639. // does not trigger because the inner node's created hooks are not called
  37640. // again. It's not ideal to involve module-specific logic in here but
  37641. // there doesn't seem to be a better way to do it.
  37642. var innerNode = vnode;
  37643. while (innerNode.componentInstance) {
  37644. innerNode = innerNode.componentInstance._vnode;
  37645. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  37646. for (i = 0; i < cbs.activate.length; ++i) {
  37647. cbs.activate[i](emptyNode, innerNode);
  37648. }
  37649. insertedVnodeQueue.push(innerNode);
  37650. break
  37651. }
  37652. }
  37653. // unlike a newly created component,
  37654. // a reactivated keep-alive component doesn't insert itself
  37655. insert(parentElm, vnode.elm, refElm);
  37656. }
  37657. function insert (parent, elm, ref$$1) {
  37658. if (isDef(parent)) {
  37659. if (isDef(ref$$1)) {
  37660. if (nodeOps.parentNode(ref$$1) === parent) {
  37661. nodeOps.insertBefore(parent, elm, ref$$1);
  37662. }
  37663. } else {
  37664. nodeOps.appendChild(parent, elm);
  37665. }
  37666. }
  37667. }
  37668. function createChildren (vnode, children, insertedVnodeQueue) {
  37669. if (Array.isArray(children)) {
  37670. {
  37671. checkDuplicateKeys(children);
  37672. }
  37673. for (var i = 0; i < children.length; ++i) {
  37674. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  37675. }
  37676. } else if (isPrimitive(vnode.text)) {
  37677. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  37678. }
  37679. }
  37680. function isPatchable (vnode) {
  37681. while (vnode.componentInstance) {
  37682. vnode = vnode.componentInstance._vnode;
  37683. }
  37684. return isDef(vnode.tag)
  37685. }
  37686. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  37687. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  37688. cbs.create[i$1](emptyNode, vnode);
  37689. }
  37690. i = vnode.data.hook; // Reuse variable
  37691. if (isDef(i)) {
  37692. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  37693. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  37694. }
  37695. }
  37696. // set scope id attribute for scoped CSS.
  37697. // this is implemented as a special case to avoid the overhead
  37698. // of going through the normal attribute patching process.
  37699. function setScope (vnode) {
  37700. var i;
  37701. if (isDef(i = vnode.fnScopeId)) {
  37702. nodeOps.setStyleScope(vnode.elm, i);
  37703. } else {
  37704. var ancestor = vnode;
  37705. while (ancestor) {
  37706. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  37707. nodeOps.setStyleScope(vnode.elm, i);
  37708. }
  37709. ancestor = ancestor.parent;
  37710. }
  37711. }
  37712. // for slot content they should also get the scopeId from the host instance.
  37713. if (isDef(i = activeInstance) &&
  37714. i !== vnode.context &&
  37715. i !== vnode.fnContext &&
  37716. isDef(i = i.$options._scopeId)
  37717. ) {
  37718. nodeOps.setStyleScope(vnode.elm, i);
  37719. }
  37720. }
  37721. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  37722. for (; startIdx <= endIdx; ++startIdx) {
  37723. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  37724. }
  37725. }
  37726. function invokeDestroyHook (vnode) {
  37727. var i, j;
  37728. var data = vnode.data;
  37729. if (isDef(data)) {
  37730. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  37731. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  37732. }
  37733. if (isDef(i = vnode.children)) {
  37734. for (j = 0; j < vnode.children.length; ++j) {
  37735. invokeDestroyHook(vnode.children[j]);
  37736. }
  37737. }
  37738. }
  37739. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  37740. for (; startIdx <= endIdx; ++startIdx) {
  37741. var ch = vnodes[startIdx];
  37742. if (isDef(ch)) {
  37743. if (isDef(ch.tag)) {
  37744. removeAndInvokeRemoveHook(ch);
  37745. invokeDestroyHook(ch);
  37746. } else { // Text node
  37747. removeNode(ch.elm);
  37748. }
  37749. }
  37750. }
  37751. }
  37752. function removeAndInvokeRemoveHook (vnode, rm) {
  37753. if (isDef(rm) || isDef(vnode.data)) {
  37754. var i;
  37755. var listeners = cbs.remove.length + 1;
  37756. if (isDef(rm)) {
  37757. // we have a recursively passed down rm callback
  37758. // increase the listeners count
  37759. rm.listeners += listeners;
  37760. } else {
  37761. // directly removing
  37762. rm = createRmCb(vnode.elm, listeners);
  37763. }
  37764. // recursively invoke hooks on child component root node
  37765. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  37766. removeAndInvokeRemoveHook(i, rm);
  37767. }
  37768. for (i = 0; i < cbs.remove.length; ++i) {
  37769. cbs.remove[i](vnode, rm);
  37770. }
  37771. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  37772. i(vnode, rm);
  37773. } else {
  37774. rm();
  37775. }
  37776. } else {
  37777. removeNode(vnode.elm);
  37778. }
  37779. }
  37780. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  37781. var oldStartIdx = 0;
  37782. var newStartIdx = 0;
  37783. var oldEndIdx = oldCh.length - 1;
  37784. var oldStartVnode = oldCh[0];
  37785. var oldEndVnode = oldCh[oldEndIdx];
  37786. var newEndIdx = newCh.length - 1;
  37787. var newStartVnode = newCh[0];
  37788. var newEndVnode = newCh[newEndIdx];
  37789. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  37790. // removeOnly is a special flag used only by <transition-group>
  37791. // to ensure removed elements stay in correct relative positions
  37792. // during leaving transitions
  37793. var canMove = !removeOnly;
  37794. {
  37795. checkDuplicateKeys(newCh);
  37796. }
  37797. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  37798. if (isUndef(oldStartVnode)) {
  37799. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  37800. } else if (isUndef(oldEndVnode)) {
  37801. oldEndVnode = oldCh[--oldEndIdx];
  37802. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  37803. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  37804. oldStartVnode = oldCh[++oldStartIdx];
  37805. newStartVnode = newCh[++newStartIdx];
  37806. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  37807. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  37808. oldEndVnode = oldCh[--oldEndIdx];
  37809. newEndVnode = newCh[--newEndIdx];
  37810. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  37811. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  37812. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  37813. oldStartVnode = oldCh[++oldStartIdx];
  37814. newEndVnode = newCh[--newEndIdx];
  37815. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  37816. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  37817. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  37818. oldEndVnode = oldCh[--oldEndIdx];
  37819. newStartVnode = newCh[++newStartIdx];
  37820. } else {
  37821. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  37822. idxInOld = isDef(newStartVnode.key)
  37823. ? oldKeyToIdx[newStartVnode.key]
  37824. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  37825. if (isUndef(idxInOld)) { // New element
  37826. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  37827. } else {
  37828. vnodeToMove = oldCh[idxInOld];
  37829. if (sameVnode(vnodeToMove, newStartVnode)) {
  37830. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  37831. oldCh[idxInOld] = undefined;
  37832. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  37833. } else {
  37834. // same key but different element. treat as new element
  37835. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  37836. }
  37837. }
  37838. newStartVnode = newCh[++newStartIdx];
  37839. }
  37840. }
  37841. if (oldStartIdx > oldEndIdx) {
  37842. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  37843. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  37844. } else if (newStartIdx > newEndIdx) {
  37845. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  37846. }
  37847. }
  37848. function checkDuplicateKeys (children) {
  37849. var seenKeys = {};
  37850. for (var i = 0; i < children.length; i++) {
  37851. var vnode = children[i];
  37852. var key = vnode.key;
  37853. if (isDef(key)) {
  37854. if (seenKeys[key]) {
  37855. warn(
  37856. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  37857. vnode.context
  37858. );
  37859. } else {
  37860. seenKeys[key] = true;
  37861. }
  37862. }
  37863. }
  37864. }
  37865. function findIdxInOld (node, oldCh, start, end) {
  37866. for (var i = start; i < end; i++) {
  37867. var c = oldCh[i];
  37868. if (isDef(c) && sameVnode(node, c)) { return i }
  37869. }
  37870. }
  37871. function patchVnode (
  37872. oldVnode,
  37873. vnode,
  37874. insertedVnodeQueue,
  37875. ownerArray,
  37876. index,
  37877. removeOnly
  37878. ) {
  37879. if (oldVnode === vnode) {
  37880. return
  37881. }
  37882. if (isDef(vnode.elm) && isDef(ownerArray)) {
  37883. // clone reused vnode
  37884. vnode = ownerArray[index] = cloneVNode(vnode);
  37885. }
  37886. var elm = vnode.elm = oldVnode.elm;
  37887. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  37888. if (isDef(vnode.asyncFactory.resolved)) {
  37889. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  37890. } else {
  37891. vnode.isAsyncPlaceholder = true;
  37892. }
  37893. return
  37894. }
  37895. // reuse element for static trees.
  37896. // note we only do this if the vnode is cloned -
  37897. // if the new node is not cloned it means the render functions have been
  37898. // reset by the hot-reload-api and we need to do a proper re-render.
  37899. if (isTrue(vnode.isStatic) &&
  37900. isTrue(oldVnode.isStatic) &&
  37901. vnode.key === oldVnode.key &&
  37902. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  37903. ) {
  37904. vnode.componentInstance = oldVnode.componentInstance;
  37905. return
  37906. }
  37907. var i;
  37908. var data = vnode.data;
  37909. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  37910. i(oldVnode, vnode);
  37911. }
  37912. var oldCh = oldVnode.children;
  37913. var ch = vnode.children;
  37914. if (isDef(data) && isPatchable(vnode)) {
  37915. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  37916. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  37917. }
  37918. if (isUndef(vnode.text)) {
  37919. if (isDef(oldCh) && isDef(ch)) {
  37920. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  37921. } else if (isDef(ch)) {
  37922. {
  37923. checkDuplicateKeys(ch);
  37924. }
  37925. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  37926. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  37927. } else if (isDef(oldCh)) {
  37928. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  37929. } else if (isDef(oldVnode.text)) {
  37930. nodeOps.setTextContent(elm, '');
  37931. }
  37932. } else if (oldVnode.text !== vnode.text) {
  37933. nodeOps.setTextContent(elm, vnode.text);
  37934. }
  37935. if (isDef(data)) {
  37936. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  37937. }
  37938. }
  37939. function invokeInsertHook (vnode, queue, initial) {
  37940. // delay insert hooks for component root nodes, invoke them after the
  37941. // element is really inserted
  37942. if (isTrue(initial) && isDef(vnode.parent)) {
  37943. vnode.parent.data.pendingInsert = queue;
  37944. } else {
  37945. for (var i = 0; i < queue.length; ++i) {
  37946. queue[i].data.hook.insert(queue[i]);
  37947. }
  37948. }
  37949. }
  37950. var hydrationBailed = false;
  37951. // list of modules that can skip create hook during hydration because they
  37952. // are already rendered on the client or has no need for initialization
  37953. // Note: style is excluded because it relies on initial clone for future
  37954. // deep updates (#7063).
  37955. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  37956. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  37957. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  37958. var i;
  37959. var tag = vnode.tag;
  37960. var data = vnode.data;
  37961. var children = vnode.children;
  37962. inVPre = inVPre || (data && data.pre);
  37963. vnode.elm = elm;
  37964. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  37965. vnode.isAsyncPlaceholder = true;
  37966. return true
  37967. }
  37968. // assert node match
  37969. {
  37970. if (!assertNodeMatch(elm, vnode, inVPre)) {
  37971. return false
  37972. }
  37973. }
  37974. if (isDef(data)) {
  37975. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  37976. if (isDef(i = vnode.componentInstance)) {
  37977. // child component. it should have hydrated its own tree.
  37978. initComponent(vnode, insertedVnodeQueue);
  37979. return true
  37980. }
  37981. }
  37982. if (isDef(tag)) {
  37983. if (isDef(children)) {
  37984. // empty element, allow client to pick up and populate children
  37985. if (!elm.hasChildNodes()) {
  37986. createChildren(vnode, children, insertedVnodeQueue);
  37987. } else {
  37988. // v-html and domProps: innerHTML
  37989. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  37990. if (i !== elm.innerHTML) {
  37991. /* istanbul ignore if */
  37992. if (typeof console !== 'undefined' &&
  37993. !hydrationBailed
  37994. ) {
  37995. hydrationBailed = true;
  37996. console.warn('Parent: ', elm);
  37997. console.warn('server innerHTML: ', i);
  37998. console.warn('client innerHTML: ', elm.innerHTML);
  37999. }
  38000. return false
  38001. }
  38002. } else {
  38003. // iterate and compare children lists
  38004. var childrenMatch = true;
  38005. var childNode = elm.firstChild;
  38006. for (var i$1 = 0; i$1 < children.length; i$1++) {
  38007. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  38008. childrenMatch = false;
  38009. break
  38010. }
  38011. childNode = childNode.nextSibling;
  38012. }
  38013. // if childNode is not null, it means the actual childNodes list is
  38014. // longer than the virtual children list.
  38015. if (!childrenMatch || childNode) {
  38016. /* istanbul ignore if */
  38017. if (typeof console !== 'undefined' &&
  38018. !hydrationBailed
  38019. ) {
  38020. hydrationBailed = true;
  38021. console.warn('Parent: ', elm);
  38022. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  38023. }
  38024. return false
  38025. }
  38026. }
  38027. }
  38028. }
  38029. if (isDef(data)) {
  38030. var fullInvoke = false;
  38031. for (var key in data) {
  38032. if (!isRenderedModule(key)) {
  38033. fullInvoke = true;
  38034. invokeCreateHooks(vnode, insertedVnodeQueue);
  38035. break
  38036. }
  38037. }
  38038. if (!fullInvoke && data['class']) {
  38039. // ensure collecting deps for deep class bindings for future updates
  38040. traverse(data['class']);
  38041. }
  38042. }
  38043. } else if (elm.data !== vnode.text) {
  38044. elm.data = vnode.text;
  38045. }
  38046. return true
  38047. }
  38048. function assertNodeMatch (node, vnode, inVPre) {
  38049. if (isDef(vnode.tag)) {
  38050. return vnode.tag.indexOf('vue-component') === 0 || (
  38051. !isUnknownElement$$1(vnode, inVPre) &&
  38052. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  38053. )
  38054. } else {
  38055. return node.nodeType === (vnode.isComment ? 8 : 3)
  38056. }
  38057. }
  38058. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  38059. if (isUndef(vnode)) {
  38060. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  38061. return
  38062. }
  38063. var isInitialPatch = false;
  38064. var insertedVnodeQueue = [];
  38065. if (isUndef(oldVnode)) {
  38066. // empty mount (likely as component), create new root element
  38067. isInitialPatch = true;
  38068. createElm(vnode, insertedVnodeQueue);
  38069. } else {
  38070. var isRealElement = isDef(oldVnode.nodeType);
  38071. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  38072. // patch existing root node
  38073. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  38074. } else {
  38075. if (isRealElement) {
  38076. // mounting to a real element
  38077. // check if this is server-rendered content and if we can perform
  38078. // a successful hydration.
  38079. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  38080. oldVnode.removeAttribute(SSR_ATTR);
  38081. hydrating = true;
  38082. }
  38083. if (isTrue(hydrating)) {
  38084. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  38085. invokeInsertHook(vnode, insertedVnodeQueue, true);
  38086. return oldVnode
  38087. } else {
  38088. warn(
  38089. 'The client-side rendered virtual DOM tree is not matching ' +
  38090. 'server-rendered content. This is likely caused by incorrect ' +
  38091. 'HTML markup, for example nesting block-level elements inside ' +
  38092. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  38093. 'full client-side render.'
  38094. );
  38095. }
  38096. }
  38097. // either not server-rendered, or hydration failed.
  38098. // create an empty node and replace it
  38099. oldVnode = emptyNodeAt(oldVnode);
  38100. }
  38101. // replacing existing element
  38102. var oldElm = oldVnode.elm;
  38103. var parentElm = nodeOps.parentNode(oldElm);
  38104. // create new node
  38105. createElm(
  38106. vnode,
  38107. insertedVnodeQueue,
  38108. // extremely rare edge case: do not insert if old element is in a
  38109. // leaving transition. Only happens when combining transition +
  38110. // keep-alive + HOCs. (#4590)
  38111. oldElm._leaveCb ? null : parentElm,
  38112. nodeOps.nextSibling(oldElm)
  38113. );
  38114. // update parent placeholder node element, recursively
  38115. if (isDef(vnode.parent)) {
  38116. var ancestor = vnode.parent;
  38117. var patchable = isPatchable(vnode);
  38118. while (ancestor) {
  38119. for (var i = 0; i < cbs.destroy.length; ++i) {
  38120. cbs.destroy[i](ancestor);
  38121. }
  38122. ancestor.elm = vnode.elm;
  38123. if (patchable) {
  38124. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  38125. cbs.create[i$1](emptyNode, ancestor);
  38126. }
  38127. // #6513
  38128. // invoke insert hooks that may have been merged by create hooks.
  38129. // e.g. for directives that uses the "inserted" hook.
  38130. var insert = ancestor.data.hook.insert;
  38131. if (insert.merged) {
  38132. // start at index 1 to avoid re-invoking component mounted hook
  38133. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  38134. insert.fns[i$2]();
  38135. }
  38136. }
  38137. } else {
  38138. registerRef(ancestor);
  38139. }
  38140. ancestor = ancestor.parent;
  38141. }
  38142. }
  38143. // destroy old node
  38144. if (isDef(parentElm)) {
  38145. removeVnodes(parentElm, [oldVnode], 0, 0);
  38146. } else if (isDef(oldVnode.tag)) {
  38147. invokeDestroyHook(oldVnode);
  38148. }
  38149. }
  38150. }
  38151. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  38152. return vnode.elm
  38153. }
  38154. }
  38155. /* */
  38156. var directives = {
  38157. create: updateDirectives,
  38158. update: updateDirectives,
  38159. destroy: function unbindDirectives (vnode) {
  38160. updateDirectives(vnode, emptyNode);
  38161. }
  38162. };
  38163. function updateDirectives (oldVnode, vnode) {
  38164. if (oldVnode.data.directives || vnode.data.directives) {
  38165. _update(oldVnode, vnode);
  38166. }
  38167. }
  38168. function _update (oldVnode, vnode) {
  38169. var isCreate = oldVnode === emptyNode;
  38170. var isDestroy = vnode === emptyNode;
  38171. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  38172. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  38173. var dirsWithInsert = [];
  38174. var dirsWithPostpatch = [];
  38175. var key, oldDir, dir;
  38176. for (key in newDirs) {
  38177. oldDir = oldDirs[key];
  38178. dir = newDirs[key];
  38179. if (!oldDir) {
  38180. // new directive, bind
  38181. callHook$1(dir, 'bind', vnode, oldVnode);
  38182. if (dir.def && dir.def.inserted) {
  38183. dirsWithInsert.push(dir);
  38184. }
  38185. } else {
  38186. // existing directive, update
  38187. dir.oldValue = oldDir.value;
  38188. dir.oldArg = oldDir.arg;
  38189. callHook$1(dir, 'update', vnode, oldVnode);
  38190. if (dir.def && dir.def.componentUpdated) {
  38191. dirsWithPostpatch.push(dir);
  38192. }
  38193. }
  38194. }
  38195. if (dirsWithInsert.length) {
  38196. var callInsert = function () {
  38197. for (var i = 0; i < dirsWithInsert.length; i++) {
  38198. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  38199. }
  38200. };
  38201. if (isCreate) {
  38202. mergeVNodeHook(vnode, 'insert', callInsert);
  38203. } else {
  38204. callInsert();
  38205. }
  38206. }
  38207. if (dirsWithPostpatch.length) {
  38208. mergeVNodeHook(vnode, 'postpatch', function () {
  38209. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  38210. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  38211. }
  38212. });
  38213. }
  38214. if (!isCreate) {
  38215. for (key in oldDirs) {
  38216. if (!newDirs[key]) {
  38217. // no longer present, unbind
  38218. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  38219. }
  38220. }
  38221. }
  38222. }
  38223. var emptyModifiers = Object.create(null);
  38224. function normalizeDirectives$1 (
  38225. dirs,
  38226. vm
  38227. ) {
  38228. var res = Object.create(null);
  38229. if (!dirs) {
  38230. // $flow-disable-line
  38231. return res
  38232. }
  38233. var i, dir;
  38234. for (i = 0; i < dirs.length; i++) {
  38235. dir = dirs[i];
  38236. if (!dir.modifiers) {
  38237. // $flow-disable-line
  38238. dir.modifiers = emptyModifiers;
  38239. }
  38240. res[getRawDirName(dir)] = dir;
  38241. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  38242. }
  38243. // $flow-disable-line
  38244. return res
  38245. }
  38246. function getRawDirName (dir) {
  38247. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  38248. }
  38249. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  38250. var fn = dir.def && dir.def[hook];
  38251. if (fn) {
  38252. try {
  38253. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  38254. } catch (e) {
  38255. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  38256. }
  38257. }
  38258. }
  38259. var baseModules = [
  38260. ref,
  38261. directives
  38262. ];
  38263. /* */
  38264. function updateAttrs (oldVnode, vnode) {
  38265. var opts = vnode.componentOptions;
  38266. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  38267. return
  38268. }
  38269. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  38270. return
  38271. }
  38272. var key, cur, old;
  38273. var elm = vnode.elm;
  38274. var oldAttrs = oldVnode.data.attrs || {};
  38275. var attrs = vnode.data.attrs || {};
  38276. // clone observed objects, as the user probably wants to mutate it
  38277. if (isDef(attrs.__ob__)) {
  38278. attrs = vnode.data.attrs = extend({}, attrs);
  38279. }
  38280. for (key in attrs) {
  38281. cur = attrs[key];
  38282. old = oldAttrs[key];
  38283. if (old !== cur) {
  38284. setAttr(elm, key, cur);
  38285. }
  38286. }
  38287. // #4391: in IE9, setting type can reset value for input[type=radio]
  38288. // #6666: IE/Edge forces progress value down to 1 before setting a max
  38289. /* istanbul ignore if */
  38290. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  38291. setAttr(elm, 'value', attrs.value);
  38292. }
  38293. for (key in oldAttrs) {
  38294. if (isUndef(attrs[key])) {
  38295. if (isXlink(key)) {
  38296. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  38297. } else if (!isEnumeratedAttr(key)) {
  38298. elm.removeAttribute(key);
  38299. }
  38300. }
  38301. }
  38302. }
  38303. function setAttr (el, key, value) {
  38304. if (el.tagName.indexOf('-') > -1) {
  38305. baseSetAttr(el, key, value);
  38306. } else if (isBooleanAttr(key)) {
  38307. // set attribute for blank value
  38308. // e.g. <option disabled>Select one</option>
  38309. if (isFalsyAttrValue(value)) {
  38310. el.removeAttribute(key);
  38311. } else {
  38312. // technically allowfullscreen is a boolean attribute for <iframe>,
  38313. // but Flash expects a value of "true" when used on <embed> tag
  38314. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  38315. ? 'true'
  38316. : key;
  38317. el.setAttribute(key, value);
  38318. }
  38319. } else if (isEnumeratedAttr(key)) {
  38320. el.setAttribute(key, convertEnumeratedValue(key, value));
  38321. } else if (isXlink(key)) {
  38322. if (isFalsyAttrValue(value)) {
  38323. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  38324. } else {
  38325. el.setAttributeNS(xlinkNS, key, value);
  38326. }
  38327. } else {
  38328. baseSetAttr(el, key, value);
  38329. }
  38330. }
  38331. function baseSetAttr (el, key, value) {
  38332. if (isFalsyAttrValue(value)) {
  38333. el.removeAttribute(key);
  38334. } else {
  38335. // #7138: IE10 & 11 fires input event when setting placeholder on
  38336. // <textarea>... block the first input event and remove the blocker
  38337. // immediately.
  38338. /* istanbul ignore if */
  38339. if (
  38340. isIE && !isIE9 &&
  38341. el.tagName === 'TEXTAREA' &&
  38342. key === 'placeholder' && value !== '' && !el.__ieph
  38343. ) {
  38344. var blocker = function (e) {
  38345. e.stopImmediatePropagation();
  38346. el.removeEventListener('input', blocker);
  38347. };
  38348. el.addEventListener('input', blocker);
  38349. // $flow-disable-line
  38350. el.__ieph = true; /* IE placeholder patched */
  38351. }
  38352. el.setAttribute(key, value);
  38353. }
  38354. }
  38355. var attrs = {
  38356. create: updateAttrs,
  38357. update: updateAttrs
  38358. };
  38359. /* */
  38360. function updateClass (oldVnode, vnode) {
  38361. var el = vnode.elm;
  38362. var data = vnode.data;
  38363. var oldData = oldVnode.data;
  38364. if (
  38365. isUndef(data.staticClass) &&
  38366. isUndef(data.class) && (
  38367. isUndef(oldData) || (
  38368. isUndef(oldData.staticClass) &&
  38369. isUndef(oldData.class)
  38370. )
  38371. )
  38372. ) {
  38373. return
  38374. }
  38375. var cls = genClassForVnode(vnode);
  38376. // handle transition classes
  38377. var transitionClass = el._transitionClasses;
  38378. if (isDef(transitionClass)) {
  38379. cls = concat(cls, stringifyClass(transitionClass));
  38380. }
  38381. // set the class
  38382. if (cls !== el._prevClass) {
  38383. el.setAttribute('class', cls);
  38384. el._prevClass = cls;
  38385. }
  38386. }
  38387. var klass = {
  38388. create: updateClass,
  38389. update: updateClass
  38390. };
  38391. /* */
  38392. var validDivisionCharRE = /[\w).+\-_$\]]/;
  38393. function parseFilters (exp) {
  38394. var inSingle = false;
  38395. var inDouble = false;
  38396. var inTemplateString = false;
  38397. var inRegex = false;
  38398. var curly = 0;
  38399. var square = 0;
  38400. var paren = 0;
  38401. var lastFilterIndex = 0;
  38402. var c, prev, i, expression, filters;
  38403. for (i = 0; i < exp.length; i++) {
  38404. prev = c;
  38405. c = exp.charCodeAt(i);
  38406. if (inSingle) {
  38407. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  38408. } else if (inDouble) {
  38409. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  38410. } else if (inTemplateString) {
  38411. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  38412. } else if (inRegex) {
  38413. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  38414. } else if (
  38415. c === 0x7C && // pipe
  38416. exp.charCodeAt(i + 1) !== 0x7C &&
  38417. exp.charCodeAt(i - 1) !== 0x7C &&
  38418. !curly && !square && !paren
  38419. ) {
  38420. if (expression === undefined) {
  38421. // first filter, end of expression
  38422. lastFilterIndex = i + 1;
  38423. expression = exp.slice(0, i).trim();
  38424. } else {
  38425. pushFilter();
  38426. }
  38427. } else {
  38428. switch (c) {
  38429. case 0x22: inDouble = true; break // "
  38430. case 0x27: inSingle = true; break // '
  38431. case 0x60: inTemplateString = true; break // `
  38432. case 0x28: paren++; break // (
  38433. case 0x29: paren--; break // )
  38434. case 0x5B: square++; break // [
  38435. case 0x5D: square--; break // ]
  38436. case 0x7B: curly++; break // {
  38437. case 0x7D: curly--; break // }
  38438. }
  38439. if (c === 0x2f) { // /
  38440. var j = i - 1;
  38441. var p = (void 0);
  38442. // find first non-whitespace prev char
  38443. for (; j >= 0; j--) {
  38444. p = exp.charAt(j);
  38445. if (p !== ' ') { break }
  38446. }
  38447. if (!p || !validDivisionCharRE.test(p)) {
  38448. inRegex = true;
  38449. }
  38450. }
  38451. }
  38452. }
  38453. if (expression === undefined) {
  38454. expression = exp.slice(0, i).trim();
  38455. } else if (lastFilterIndex !== 0) {
  38456. pushFilter();
  38457. }
  38458. function pushFilter () {
  38459. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  38460. lastFilterIndex = i + 1;
  38461. }
  38462. if (filters) {
  38463. for (i = 0; i < filters.length; i++) {
  38464. expression = wrapFilter(expression, filters[i]);
  38465. }
  38466. }
  38467. return expression
  38468. }
  38469. function wrapFilter (exp, filter) {
  38470. var i = filter.indexOf('(');
  38471. if (i < 0) {
  38472. // _f: resolveFilter
  38473. return ("_f(\"" + filter + "\")(" + exp + ")")
  38474. } else {
  38475. var name = filter.slice(0, i);
  38476. var args = filter.slice(i + 1);
  38477. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  38478. }
  38479. }
  38480. /* */
  38481. /* eslint-disable no-unused-vars */
  38482. function baseWarn (msg, range) {
  38483. console.error(("[Vue compiler]: " + msg));
  38484. }
  38485. /* eslint-enable no-unused-vars */
  38486. function pluckModuleFunction (
  38487. modules,
  38488. key
  38489. ) {
  38490. return modules
  38491. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  38492. : []
  38493. }
  38494. function addProp (el, name, value, range, dynamic) {
  38495. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  38496. el.plain = false;
  38497. }
  38498. function addAttr (el, name, value, range, dynamic) {
  38499. var attrs = dynamic
  38500. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  38501. : (el.attrs || (el.attrs = []));
  38502. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  38503. el.plain = false;
  38504. }
  38505. // add a raw attr (use this in preTransforms)
  38506. function addRawAttr (el, name, value, range) {
  38507. el.attrsMap[name] = value;
  38508. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  38509. }
  38510. function addDirective (
  38511. el,
  38512. name,
  38513. rawName,
  38514. value,
  38515. arg,
  38516. isDynamicArg,
  38517. modifiers,
  38518. range
  38519. ) {
  38520. (el.directives || (el.directives = [])).push(rangeSetItem({
  38521. name: name,
  38522. rawName: rawName,
  38523. value: value,
  38524. arg: arg,
  38525. isDynamicArg: isDynamicArg,
  38526. modifiers: modifiers
  38527. }, range));
  38528. el.plain = false;
  38529. }
  38530. function prependModifierMarker (symbol, name, dynamic) {
  38531. return dynamic
  38532. ? ("_p(" + name + ",\"" + symbol + "\")")
  38533. : symbol + name // mark the event as captured
  38534. }
  38535. function addHandler (
  38536. el,
  38537. name,
  38538. value,
  38539. modifiers,
  38540. important,
  38541. warn,
  38542. range,
  38543. dynamic
  38544. ) {
  38545. modifiers = modifiers || emptyObject;
  38546. // warn prevent and passive modifier
  38547. /* istanbul ignore if */
  38548. if (
  38549. warn &&
  38550. modifiers.prevent && modifiers.passive
  38551. ) {
  38552. warn(
  38553. 'passive and prevent can\'t be used together. ' +
  38554. 'Passive handler can\'t prevent default event.',
  38555. range
  38556. );
  38557. }
  38558. // normalize click.right and click.middle since they don't actually fire
  38559. // this is technically browser-specific, but at least for now browsers are
  38560. // the only target envs that have right/middle clicks.
  38561. if (modifiers.right) {
  38562. if (dynamic) {
  38563. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  38564. } else if (name === 'click') {
  38565. name = 'contextmenu';
  38566. delete modifiers.right;
  38567. }
  38568. } else if (modifiers.middle) {
  38569. if (dynamic) {
  38570. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  38571. } else if (name === 'click') {
  38572. name = 'mouseup';
  38573. }
  38574. }
  38575. // check capture modifier
  38576. if (modifiers.capture) {
  38577. delete modifiers.capture;
  38578. name = prependModifierMarker('!', name, dynamic);
  38579. }
  38580. if (modifiers.once) {
  38581. delete modifiers.once;
  38582. name = prependModifierMarker('~', name, dynamic);
  38583. }
  38584. /* istanbul ignore if */
  38585. if (modifiers.passive) {
  38586. delete modifiers.passive;
  38587. name = prependModifierMarker('&', name, dynamic);
  38588. }
  38589. var events;
  38590. if (modifiers.native) {
  38591. delete modifiers.native;
  38592. events = el.nativeEvents || (el.nativeEvents = {});
  38593. } else {
  38594. events = el.events || (el.events = {});
  38595. }
  38596. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  38597. if (modifiers !== emptyObject) {
  38598. newHandler.modifiers = modifiers;
  38599. }
  38600. var handlers = events[name];
  38601. /* istanbul ignore if */
  38602. if (Array.isArray(handlers)) {
  38603. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  38604. } else if (handlers) {
  38605. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  38606. } else {
  38607. events[name] = newHandler;
  38608. }
  38609. el.plain = false;
  38610. }
  38611. function getRawBindingAttr (
  38612. el,
  38613. name
  38614. ) {
  38615. return el.rawAttrsMap[':' + name] ||
  38616. el.rawAttrsMap['v-bind:' + name] ||
  38617. el.rawAttrsMap[name]
  38618. }
  38619. function getBindingAttr (
  38620. el,
  38621. name,
  38622. getStatic
  38623. ) {
  38624. var dynamicValue =
  38625. getAndRemoveAttr(el, ':' + name) ||
  38626. getAndRemoveAttr(el, 'v-bind:' + name);
  38627. if (dynamicValue != null) {
  38628. return parseFilters(dynamicValue)
  38629. } else if (getStatic !== false) {
  38630. var staticValue = getAndRemoveAttr(el, name);
  38631. if (staticValue != null) {
  38632. return JSON.stringify(staticValue)
  38633. }
  38634. }
  38635. }
  38636. // note: this only removes the attr from the Array (attrsList) so that it
  38637. // doesn't get processed by processAttrs.
  38638. // By default it does NOT remove it from the map (attrsMap) because the map is
  38639. // needed during codegen.
  38640. function getAndRemoveAttr (
  38641. el,
  38642. name,
  38643. removeFromMap
  38644. ) {
  38645. var val;
  38646. if ((val = el.attrsMap[name]) != null) {
  38647. var list = el.attrsList;
  38648. for (var i = 0, l = list.length; i < l; i++) {
  38649. if (list[i].name === name) {
  38650. list.splice(i, 1);
  38651. break
  38652. }
  38653. }
  38654. }
  38655. if (removeFromMap) {
  38656. delete el.attrsMap[name];
  38657. }
  38658. return val
  38659. }
  38660. function getAndRemoveAttrByRegex (
  38661. el,
  38662. name
  38663. ) {
  38664. var list = el.attrsList;
  38665. for (var i = 0, l = list.length; i < l; i++) {
  38666. var attr = list[i];
  38667. if (name.test(attr.name)) {
  38668. list.splice(i, 1);
  38669. return attr
  38670. }
  38671. }
  38672. }
  38673. function rangeSetItem (
  38674. item,
  38675. range
  38676. ) {
  38677. if (range) {
  38678. if (range.start != null) {
  38679. item.start = range.start;
  38680. }
  38681. if (range.end != null) {
  38682. item.end = range.end;
  38683. }
  38684. }
  38685. return item
  38686. }
  38687. /* */
  38688. /**
  38689. * Cross-platform code generation for component v-model
  38690. */
  38691. function genComponentModel (
  38692. el,
  38693. value,
  38694. modifiers
  38695. ) {
  38696. var ref = modifiers || {};
  38697. var number = ref.number;
  38698. var trim = ref.trim;
  38699. var baseValueExpression = '$$v';
  38700. var valueExpression = baseValueExpression;
  38701. if (trim) {
  38702. valueExpression =
  38703. "(typeof " + baseValueExpression + " === 'string'" +
  38704. "? " + baseValueExpression + ".trim()" +
  38705. ": " + baseValueExpression + ")";
  38706. }
  38707. if (number) {
  38708. valueExpression = "_n(" + valueExpression + ")";
  38709. }
  38710. var assignment = genAssignmentCode(value, valueExpression);
  38711. el.model = {
  38712. value: ("(" + value + ")"),
  38713. expression: JSON.stringify(value),
  38714. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  38715. };
  38716. }
  38717. /**
  38718. * Cross-platform codegen helper for generating v-model value assignment code.
  38719. */
  38720. function genAssignmentCode (
  38721. value,
  38722. assignment
  38723. ) {
  38724. var res = parseModel(value);
  38725. if (res.key === null) {
  38726. return (value + "=" + assignment)
  38727. } else {
  38728. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  38729. }
  38730. }
  38731. /**
  38732. * Parse a v-model expression into a base path and a final key segment.
  38733. * Handles both dot-path and possible square brackets.
  38734. *
  38735. * Possible cases:
  38736. *
  38737. * - test
  38738. * - test[key]
  38739. * - test[test1[key]]
  38740. * - test["a"][key]
  38741. * - xxx.test[a[a].test1[key]]
  38742. * - test.xxx.a["asa"][test1[key]]
  38743. *
  38744. */
  38745. var len, str, chr, index$1, expressionPos, expressionEndPos;
  38746. function parseModel (val) {
  38747. // Fix https://github.com/vuejs/vue/pull/7730
  38748. // allow v-model="obj.val " (trailing whitespace)
  38749. val = val.trim();
  38750. len = val.length;
  38751. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  38752. index$1 = val.lastIndexOf('.');
  38753. if (index$1 > -1) {
  38754. return {
  38755. exp: val.slice(0, index$1),
  38756. key: '"' + val.slice(index$1 + 1) + '"'
  38757. }
  38758. } else {
  38759. return {
  38760. exp: val,
  38761. key: null
  38762. }
  38763. }
  38764. }
  38765. str = val;
  38766. index$1 = expressionPos = expressionEndPos = 0;
  38767. while (!eof()) {
  38768. chr = next();
  38769. /* istanbul ignore if */
  38770. if (isStringStart(chr)) {
  38771. parseString(chr);
  38772. } else if (chr === 0x5B) {
  38773. parseBracket(chr);
  38774. }
  38775. }
  38776. return {
  38777. exp: val.slice(0, expressionPos),
  38778. key: val.slice(expressionPos + 1, expressionEndPos)
  38779. }
  38780. }
  38781. function next () {
  38782. return str.charCodeAt(++index$1)
  38783. }
  38784. function eof () {
  38785. return index$1 >= len
  38786. }
  38787. function isStringStart (chr) {
  38788. return chr === 0x22 || chr === 0x27
  38789. }
  38790. function parseBracket (chr) {
  38791. var inBracket = 1;
  38792. expressionPos = index$1;
  38793. while (!eof()) {
  38794. chr = next();
  38795. if (isStringStart(chr)) {
  38796. parseString(chr);
  38797. continue
  38798. }
  38799. if (chr === 0x5B) { inBracket++; }
  38800. if (chr === 0x5D) { inBracket--; }
  38801. if (inBracket === 0) {
  38802. expressionEndPos = index$1;
  38803. break
  38804. }
  38805. }
  38806. }
  38807. function parseString (chr) {
  38808. var stringQuote = chr;
  38809. while (!eof()) {
  38810. chr = next();
  38811. if (chr === stringQuote) {
  38812. break
  38813. }
  38814. }
  38815. }
  38816. /* */
  38817. var warn$1;
  38818. // in some cases, the event used has to be determined at runtime
  38819. // so we used some reserved tokens during compile.
  38820. var RANGE_TOKEN = '__r';
  38821. var CHECKBOX_RADIO_TOKEN = '__c';
  38822. function model (
  38823. el,
  38824. dir,
  38825. _warn
  38826. ) {
  38827. warn$1 = _warn;
  38828. var value = dir.value;
  38829. var modifiers = dir.modifiers;
  38830. var tag = el.tag;
  38831. var type = el.attrsMap.type;
  38832. {
  38833. // inputs with type="file" are read only and setting the input's
  38834. // value will throw an error.
  38835. if (tag === 'input' && type === 'file') {
  38836. warn$1(
  38837. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  38838. "File inputs are read only. Use a v-on:change listener instead.",
  38839. el.rawAttrsMap['v-model']
  38840. );
  38841. }
  38842. }
  38843. if (el.component) {
  38844. genComponentModel(el, value, modifiers);
  38845. // component v-model doesn't need extra runtime
  38846. return false
  38847. } else if (tag === 'select') {
  38848. genSelect(el, value, modifiers);
  38849. } else if (tag === 'input' && type === 'checkbox') {
  38850. genCheckboxModel(el, value, modifiers);
  38851. } else if (tag === 'input' && type === 'radio') {
  38852. genRadioModel(el, value, modifiers);
  38853. } else if (tag === 'input' || tag === 'textarea') {
  38854. genDefaultModel(el, value, modifiers);
  38855. } else if (!config.isReservedTag(tag)) {
  38856. genComponentModel(el, value, modifiers);
  38857. // component v-model doesn't need extra runtime
  38858. return false
  38859. } else {
  38860. warn$1(
  38861. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  38862. "v-model is not supported on this element type. " +
  38863. 'If you are working with contenteditable, it\'s recommended to ' +
  38864. 'wrap a library dedicated for that purpose inside a custom component.',
  38865. el.rawAttrsMap['v-model']
  38866. );
  38867. }
  38868. // ensure runtime directive metadata
  38869. return true
  38870. }
  38871. function genCheckboxModel (
  38872. el,
  38873. value,
  38874. modifiers
  38875. ) {
  38876. var number = modifiers && modifiers.number;
  38877. var valueBinding = getBindingAttr(el, 'value') || 'null';
  38878. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  38879. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  38880. addProp(el, 'checked',
  38881. "Array.isArray(" + value + ")" +
  38882. "?_i(" + value + "," + valueBinding + ")>-1" + (
  38883. trueValueBinding === 'true'
  38884. ? (":(" + value + ")")
  38885. : (":_q(" + value + "," + trueValueBinding + ")")
  38886. )
  38887. );
  38888. addHandler(el, 'change',
  38889. "var $$a=" + value + "," +
  38890. '$$el=$event.target,' +
  38891. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  38892. 'if(Array.isArray($$a)){' +
  38893. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  38894. '$$i=_i($$a,$$v);' +
  38895. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  38896. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  38897. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  38898. null, true
  38899. );
  38900. }
  38901. function genRadioModel (
  38902. el,
  38903. value,
  38904. modifiers
  38905. ) {
  38906. var number = modifiers && modifiers.number;
  38907. var valueBinding = getBindingAttr(el, 'value') || 'null';
  38908. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  38909. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  38910. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  38911. }
  38912. function genSelect (
  38913. el,
  38914. value,
  38915. modifiers
  38916. ) {
  38917. var number = modifiers && modifiers.number;
  38918. var selectedVal = "Array.prototype.filter" +
  38919. ".call($event.target.options,function(o){return o.selected})" +
  38920. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  38921. "return " + (number ? '_n(val)' : 'val') + "})";
  38922. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  38923. var code = "var $$selectedVal = " + selectedVal + ";";
  38924. code = code + " " + (genAssignmentCode(value, assignment));
  38925. addHandler(el, 'change', code, null, true);
  38926. }
  38927. function genDefaultModel (
  38928. el,
  38929. value,
  38930. modifiers
  38931. ) {
  38932. var type = el.attrsMap.type;
  38933. // warn if v-bind:value conflicts with v-model
  38934. // except for inputs with v-bind:type
  38935. {
  38936. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  38937. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  38938. if (value$1 && !typeBinding) {
  38939. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  38940. warn$1(
  38941. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  38942. 'because the latter already expands to a value binding internally',
  38943. el.rawAttrsMap[binding]
  38944. );
  38945. }
  38946. }
  38947. var ref = modifiers || {};
  38948. var lazy = ref.lazy;
  38949. var number = ref.number;
  38950. var trim = ref.trim;
  38951. var needCompositionGuard = !lazy && type !== 'range';
  38952. var event = lazy
  38953. ? 'change'
  38954. : type === 'range'
  38955. ? RANGE_TOKEN
  38956. : 'input';
  38957. var valueExpression = '$event.target.value';
  38958. if (trim) {
  38959. valueExpression = "$event.target.value.trim()";
  38960. }
  38961. if (number) {
  38962. valueExpression = "_n(" + valueExpression + ")";
  38963. }
  38964. var code = genAssignmentCode(value, valueExpression);
  38965. if (needCompositionGuard) {
  38966. code = "if($event.target.composing)return;" + code;
  38967. }
  38968. addProp(el, 'value', ("(" + value + ")"));
  38969. addHandler(el, event, code, null, true);
  38970. if (trim || number) {
  38971. addHandler(el, 'blur', '$forceUpdate()');
  38972. }
  38973. }
  38974. /* */
  38975. // normalize v-model event tokens that can only be determined at runtime.
  38976. // it's important to place the event as the first in the array because
  38977. // the whole point is ensuring the v-model callback gets called before
  38978. // user-attached handlers.
  38979. function normalizeEvents (on) {
  38980. /* istanbul ignore if */
  38981. if (isDef(on[RANGE_TOKEN])) {
  38982. // IE input[type=range] only supports `change` event
  38983. var event = isIE ? 'change' : 'input';
  38984. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  38985. delete on[RANGE_TOKEN];
  38986. }
  38987. // This was originally intended to fix #4521 but no longer necessary
  38988. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  38989. /* istanbul ignore if */
  38990. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  38991. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  38992. delete on[CHECKBOX_RADIO_TOKEN];
  38993. }
  38994. }
  38995. var target$1;
  38996. function createOnceHandler$1 (event, handler, capture) {
  38997. var _target = target$1; // save current target element in closure
  38998. return function onceHandler () {
  38999. var res = handler.apply(null, arguments);
  39000. if (res !== null) {
  39001. remove$2(event, onceHandler, capture, _target);
  39002. }
  39003. }
  39004. }
  39005. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  39006. // implementation and does not fire microtasks in between event propagation, so
  39007. // safe to exclude.
  39008. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  39009. function add$1 (
  39010. name,
  39011. handler,
  39012. capture,
  39013. passive
  39014. ) {
  39015. // async edge case #6566: inner click event triggers patch, event handler
  39016. // attached to outer element during patch, and triggered again. This
  39017. // happens because browsers fire microtask ticks between event propagation.
  39018. // the solution is simple: we save the timestamp when a handler is attached,
  39019. // and the handler would only fire if the event passed to it was fired
  39020. // AFTER it was attached.
  39021. if (useMicrotaskFix) {
  39022. var attachedTimestamp = currentFlushTimestamp;
  39023. var original = handler;
  39024. handler = original._wrapper = function (e) {
  39025. if (
  39026. // no bubbling, should always fire.
  39027. // this is just a safety net in case event.timeStamp is unreliable in
  39028. // certain weird environments...
  39029. e.target === e.currentTarget ||
  39030. // event is fired after handler attachment
  39031. e.timeStamp >= attachedTimestamp ||
  39032. // #9462 bail for iOS 9 bug: event.timeStamp is 0 after history.pushState
  39033. e.timeStamp === 0 ||
  39034. // #9448 bail if event is fired in another document in a multi-page
  39035. // electron/nw.js app, since event.timeStamp will be using a different
  39036. // starting reference
  39037. e.target.ownerDocument !== document
  39038. ) {
  39039. return original.apply(this, arguments)
  39040. }
  39041. };
  39042. }
  39043. target$1.addEventListener(
  39044. name,
  39045. handler,
  39046. supportsPassive
  39047. ? { capture: capture, passive: passive }
  39048. : capture
  39049. );
  39050. }
  39051. function remove$2 (
  39052. name,
  39053. handler,
  39054. capture,
  39055. _target
  39056. ) {
  39057. (_target || target$1).removeEventListener(
  39058. name,
  39059. handler._wrapper || handler,
  39060. capture
  39061. );
  39062. }
  39063. function updateDOMListeners (oldVnode, vnode) {
  39064. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  39065. return
  39066. }
  39067. var on = vnode.data.on || {};
  39068. var oldOn = oldVnode.data.on || {};
  39069. target$1 = vnode.elm;
  39070. normalizeEvents(on);
  39071. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  39072. target$1 = undefined;
  39073. }
  39074. var events = {
  39075. create: updateDOMListeners,
  39076. update: updateDOMListeners
  39077. };
  39078. /* */
  39079. var svgContainer;
  39080. function updateDOMProps (oldVnode, vnode) {
  39081. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  39082. return
  39083. }
  39084. var key, cur;
  39085. var elm = vnode.elm;
  39086. var oldProps = oldVnode.data.domProps || {};
  39087. var props = vnode.data.domProps || {};
  39088. // clone observed objects, as the user probably wants to mutate it
  39089. if (isDef(props.__ob__)) {
  39090. props = vnode.data.domProps = extend({}, props);
  39091. }
  39092. for (key in oldProps) {
  39093. if (isUndef(props[key])) {
  39094. elm[key] = '';
  39095. }
  39096. }
  39097. for (key in props) {
  39098. cur = props[key];
  39099. // ignore children if the node has textContent or innerHTML,
  39100. // as these will throw away existing DOM nodes and cause removal errors
  39101. // on subsequent patches (#3360)
  39102. if (key === 'textContent' || key === 'innerHTML') {
  39103. if (vnode.children) { vnode.children.length = 0; }
  39104. if (cur === oldProps[key]) { continue }
  39105. // #6601 work around Chrome version <= 55 bug where single textNode
  39106. // replaced by innerHTML/textContent retains its parentNode property
  39107. if (elm.childNodes.length === 1) {
  39108. elm.removeChild(elm.childNodes[0]);
  39109. }
  39110. }
  39111. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  39112. // store value as _value as well since
  39113. // non-string values will be stringified
  39114. elm._value = cur;
  39115. // avoid resetting cursor position when value is the same
  39116. var strCur = isUndef(cur) ? '' : String(cur);
  39117. if (shouldUpdateValue(elm, strCur)) {
  39118. elm.value = strCur;
  39119. }
  39120. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  39121. // IE doesn't support innerHTML for SVG elements
  39122. svgContainer = svgContainer || document.createElement('div');
  39123. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  39124. var svg = svgContainer.firstChild;
  39125. while (elm.firstChild) {
  39126. elm.removeChild(elm.firstChild);
  39127. }
  39128. while (svg.firstChild) {
  39129. elm.appendChild(svg.firstChild);
  39130. }
  39131. } else if (
  39132. // skip the update if old and new VDOM state is the same.
  39133. // `value` is handled separately because the DOM value may be temporarily
  39134. // out of sync with VDOM state due to focus, composition and modifiers.
  39135. // This #4521 by skipping the unnecesarry `checked` update.
  39136. cur !== oldProps[key]
  39137. ) {
  39138. // some property updates can throw
  39139. // e.g. `value` on <progress> w/ non-finite value
  39140. try {
  39141. elm[key] = cur;
  39142. } catch (e) {}
  39143. }
  39144. }
  39145. }
  39146. // check platforms/web/util/attrs.js acceptValue
  39147. function shouldUpdateValue (elm, checkVal) {
  39148. return (!elm.composing && (
  39149. elm.tagName === 'OPTION' ||
  39150. isNotInFocusAndDirty(elm, checkVal) ||
  39151. isDirtyWithModifiers(elm, checkVal)
  39152. ))
  39153. }
  39154. function isNotInFocusAndDirty (elm, checkVal) {
  39155. // return true when textbox (.number and .trim) loses focus and its value is
  39156. // not equal to the updated value
  39157. var notInFocus = true;
  39158. // #6157
  39159. // work around IE bug when accessing document.activeElement in an iframe
  39160. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  39161. return notInFocus && elm.value !== checkVal
  39162. }
  39163. function isDirtyWithModifiers (elm, newVal) {
  39164. var value = elm.value;
  39165. var modifiers = elm._vModifiers; // injected by v-model runtime
  39166. if (isDef(modifiers)) {
  39167. if (modifiers.number) {
  39168. return toNumber(value) !== toNumber(newVal)
  39169. }
  39170. if (modifiers.trim) {
  39171. return value.trim() !== newVal.trim()
  39172. }
  39173. }
  39174. return value !== newVal
  39175. }
  39176. var domProps = {
  39177. create: updateDOMProps,
  39178. update: updateDOMProps
  39179. };
  39180. /* */
  39181. var parseStyleText = cached(function (cssText) {
  39182. var res = {};
  39183. var listDelimiter = /;(?![^(]*\))/g;
  39184. var propertyDelimiter = /:(.+)/;
  39185. cssText.split(listDelimiter).forEach(function (item) {
  39186. if (item) {
  39187. var tmp = item.split(propertyDelimiter);
  39188. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  39189. }
  39190. });
  39191. return res
  39192. });
  39193. // merge static and dynamic style data on the same vnode
  39194. function normalizeStyleData (data) {
  39195. var style = normalizeStyleBinding(data.style);
  39196. // static style is pre-processed into an object during compilation
  39197. // and is always a fresh object, so it's safe to merge into it
  39198. return data.staticStyle
  39199. ? extend(data.staticStyle, style)
  39200. : style
  39201. }
  39202. // normalize possible array / string values into Object
  39203. function normalizeStyleBinding (bindingStyle) {
  39204. if (Array.isArray(bindingStyle)) {
  39205. return toObject(bindingStyle)
  39206. }
  39207. if (typeof bindingStyle === 'string') {
  39208. return parseStyleText(bindingStyle)
  39209. }
  39210. return bindingStyle
  39211. }
  39212. /**
  39213. * parent component style should be after child's
  39214. * so that parent component's style could override it
  39215. */
  39216. function getStyle (vnode, checkChild) {
  39217. var res = {};
  39218. var styleData;
  39219. if (checkChild) {
  39220. var childNode = vnode;
  39221. while (childNode.componentInstance) {
  39222. childNode = childNode.componentInstance._vnode;
  39223. if (
  39224. childNode && childNode.data &&
  39225. (styleData = normalizeStyleData(childNode.data))
  39226. ) {
  39227. extend(res, styleData);
  39228. }
  39229. }
  39230. }
  39231. if ((styleData = normalizeStyleData(vnode.data))) {
  39232. extend(res, styleData);
  39233. }
  39234. var parentNode = vnode;
  39235. while ((parentNode = parentNode.parent)) {
  39236. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  39237. extend(res, styleData);
  39238. }
  39239. }
  39240. return res
  39241. }
  39242. /* */
  39243. var cssVarRE = /^--/;
  39244. var importantRE = /\s*!important$/;
  39245. var setProp = function (el, name, val) {
  39246. /* istanbul ignore if */
  39247. if (cssVarRE.test(name)) {
  39248. el.style.setProperty(name, val);
  39249. } else if (importantRE.test(val)) {
  39250. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  39251. } else {
  39252. var normalizedName = normalize(name);
  39253. if (Array.isArray(val)) {
  39254. // Support values array created by autoprefixer, e.g.
  39255. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  39256. // Set them one by one, and the browser will only set those it can recognize
  39257. for (var i = 0, len = val.length; i < len; i++) {
  39258. el.style[normalizedName] = val[i];
  39259. }
  39260. } else {
  39261. el.style[normalizedName] = val;
  39262. }
  39263. }
  39264. };
  39265. var vendorNames = ['Webkit', 'Moz', 'ms'];
  39266. var emptyStyle;
  39267. var normalize = cached(function (prop) {
  39268. emptyStyle = emptyStyle || document.createElement('div').style;
  39269. prop = camelize(prop);
  39270. if (prop !== 'filter' && (prop in emptyStyle)) {
  39271. return prop
  39272. }
  39273. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  39274. for (var i = 0; i < vendorNames.length; i++) {
  39275. var name = vendorNames[i] + capName;
  39276. if (name in emptyStyle) {
  39277. return name
  39278. }
  39279. }
  39280. });
  39281. function updateStyle (oldVnode, vnode) {
  39282. var data = vnode.data;
  39283. var oldData = oldVnode.data;
  39284. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  39285. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  39286. ) {
  39287. return
  39288. }
  39289. var cur, name;
  39290. var el = vnode.elm;
  39291. var oldStaticStyle = oldData.staticStyle;
  39292. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  39293. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  39294. var oldStyle = oldStaticStyle || oldStyleBinding;
  39295. var style = normalizeStyleBinding(vnode.data.style) || {};
  39296. // store normalized style under a different key for next diff
  39297. // make sure to clone it if it's reactive, since the user likely wants
  39298. // to mutate it.
  39299. vnode.data.normalizedStyle = isDef(style.__ob__)
  39300. ? extend({}, style)
  39301. : style;
  39302. var newStyle = getStyle(vnode, true);
  39303. for (name in oldStyle) {
  39304. if (isUndef(newStyle[name])) {
  39305. setProp(el, name, '');
  39306. }
  39307. }
  39308. for (name in newStyle) {
  39309. cur = newStyle[name];
  39310. if (cur !== oldStyle[name]) {
  39311. // ie9 setting to null has no effect, must use empty string
  39312. setProp(el, name, cur == null ? '' : cur);
  39313. }
  39314. }
  39315. }
  39316. var style = {
  39317. create: updateStyle,
  39318. update: updateStyle
  39319. };
  39320. /* */
  39321. var whitespaceRE = /\s+/;
  39322. /**
  39323. * Add class with compatibility for SVG since classList is not supported on
  39324. * SVG elements in IE
  39325. */
  39326. function addClass (el, cls) {
  39327. /* istanbul ignore if */
  39328. if (!cls || !(cls = cls.trim())) {
  39329. return
  39330. }
  39331. /* istanbul ignore else */
  39332. if (el.classList) {
  39333. if (cls.indexOf(' ') > -1) {
  39334. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  39335. } else {
  39336. el.classList.add(cls);
  39337. }
  39338. } else {
  39339. var cur = " " + (el.getAttribute('class') || '') + " ";
  39340. if (cur.indexOf(' ' + cls + ' ') < 0) {
  39341. el.setAttribute('class', (cur + cls).trim());
  39342. }
  39343. }
  39344. }
  39345. /**
  39346. * Remove class with compatibility for SVG since classList is not supported on
  39347. * SVG elements in IE
  39348. */
  39349. function removeClass (el, cls) {
  39350. /* istanbul ignore if */
  39351. if (!cls || !(cls = cls.trim())) {
  39352. return
  39353. }
  39354. /* istanbul ignore else */
  39355. if (el.classList) {
  39356. if (cls.indexOf(' ') > -1) {
  39357. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  39358. } else {
  39359. el.classList.remove(cls);
  39360. }
  39361. if (!el.classList.length) {
  39362. el.removeAttribute('class');
  39363. }
  39364. } else {
  39365. var cur = " " + (el.getAttribute('class') || '') + " ";
  39366. var tar = ' ' + cls + ' ';
  39367. while (cur.indexOf(tar) >= 0) {
  39368. cur = cur.replace(tar, ' ');
  39369. }
  39370. cur = cur.trim();
  39371. if (cur) {
  39372. el.setAttribute('class', cur);
  39373. } else {
  39374. el.removeAttribute('class');
  39375. }
  39376. }
  39377. }
  39378. /* */
  39379. function resolveTransition (def$$1) {
  39380. if (!def$$1) {
  39381. return
  39382. }
  39383. /* istanbul ignore else */
  39384. if (typeof def$$1 === 'object') {
  39385. var res = {};
  39386. if (def$$1.css !== false) {
  39387. extend(res, autoCssTransition(def$$1.name || 'v'));
  39388. }
  39389. extend(res, def$$1);
  39390. return res
  39391. } else if (typeof def$$1 === 'string') {
  39392. return autoCssTransition(def$$1)
  39393. }
  39394. }
  39395. var autoCssTransition = cached(function (name) {
  39396. return {
  39397. enterClass: (name + "-enter"),
  39398. enterToClass: (name + "-enter-to"),
  39399. enterActiveClass: (name + "-enter-active"),
  39400. leaveClass: (name + "-leave"),
  39401. leaveToClass: (name + "-leave-to"),
  39402. leaveActiveClass: (name + "-leave-active")
  39403. }
  39404. });
  39405. var hasTransition = inBrowser && !isIE9;
  39406. var TRANSITION = 'transition';
  39407. var ANIMATION = 'animation';
  39408. // Transition property/event sniffing
  39409. var transitionProp = 'transition';
  39410. var transitionEndEvent = 'transitionend';
  39411. var animationProp = 'animation';
  39412. var animationEndEvent = 'animationend';
  39413. if (hasTransition) {
  39414. /* istanbul ignore if */
  39415. if (window.ontransitionend === undefined &&
  39416. window.onwebkittransitionend !== undefined
  39417. ) {
  39418. transitionProp = 'WebkitTransition';
  39419. transitionEndEvent = 'webkitTransitionEnd';
  39420. }
  39421. if (window.onanimationend === undefined &&
  39422. window.onwebkitanimationend !== undefined
  39423. ) {
  39424. animationProp = 'WebkitAnimation';
  39425. animationEndEvent = 'webkitAnimationEnd';
  39426. }
  39427. }
  39428. // binding to window is necessary to make hot reload work in IE in strict mode
  39429. var raf = inBrowser
  39430. ? window.requestAnimationFrame
  39431. ? window.requestAnimationFrame.bind(window)
  39432. : setTimeout
  39433. : /* istanbul ignore next */ function (fn) { return fn(); };
  39434. function nextFrame (fn) {
  39435. raf(function () {
  39436. raf(fn);
  39437. });
  39438. }
  39439. function addTransitionClass (el, cls) {
  39440. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  39441. if (transitionClasses.indexOf(cls) < 0) {
  39442. transitionClasses.push(cls);
  39443. addClass(el, cls);
  39444. }
  39445. }
  39446. function removeTransitionClass (el, cls) {
  39447. if (el._transitionClasses) {
  39448. remove(el._transitionClasses, cls);
  39449. }
  39450. removeClass(el, cls);
  39451. }
  39452. function whenTransitionEnds (
  39453. el,
  39454. expectedType,
  39455. cb
  39456. ) {
  39457. var ref = getTransitionInfo(el, expectedType);
  39458. var type = ref.type;
  39459. var timeout = ref.timeout;
  39460. var propCount = ref.propCount;
  39461. if (!type) { return cb() }
  39462. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  39463. var ended = 0;
  39464. var end = function () {
  39465. el.removeEventListener(event, onEnd);
  39466. cb();
  39467. };
  39468. var onEnd = function (e) {
  39469. if (e.target === el) {
  39470. if (++ended >= propCount) {
  39471. end();
  39472. }
  39473. }
  39474. };
  39475. setTimeout(function () {
  39476. if (ended < propCount) {
  39477. end();
  39478. }
  39479. }, timeout + 1);
  39480. el.addEventListener(event, onEnd);
  39481. }
  39482. var transformRE = /\b(transform|all)(,|$)/;
  39483. function getTransitionInfo (el, expectedType) {
  39484. var styles = window.getComputedStyle(el);
  39485. // JSDOM may return undefined for transition properties
  39486. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  39487. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  39488. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  39489. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  39490. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  39491. var animationTimeout = getTimeout(animationDelays, animationDurations);
  39492. var type;
  39493. var timeout = 0;
  39494. var propCount = 0;
  39495. /* istanbul ignore if */
  39496. if (expectedType === TRANSITION) {
  39497. if (transitionTimeout > 0) {
  39498. type = TRANSITION;
  39499. timeout = transitionTimeout;
  39500. propCount = transitionDurations.length;
  39501. }
  39502. } else if (expectedType === ANIMATION) {
  39503. if (animationTimeout > 0) {
  39504. type = ANIMATION;
  39505. timeout = animationTimeout;
  39506. propCount = animationDurations.length;
  39507. }
  39508. } else {
  39509. timeout = Math.max(transitionTimeout, animationTimeout);
  39510. type = timeout > 0
  39511. ? transitionTimeout > animationTimeout
  39512. ? TRANSITION
  39513. : ANIMATION
  39514. : null;
  39515. propCount = type
  39516. ? type === TRANSITION
  39517. ? transitionDurations.length
  39518. : animationDurations.length
  39519. : 0;
  39520. }
  39521. var hasTransform =
  39522. type === TRANSITION &&
  39523. transformRE.test(styles[transitionProp + 'Property']);
  39524. return {
  39525. type: type,
  39526. timeout: timeout,
  39527. propCount: propCount,
  39528. hasTransform: hasTransform
  39529. }
  39530. }
  39531. function getTimeout (delays, durations) {
  39532. /* istanbul ignore next */
  39533. while (delays.length < durations.length) {
  39534. delays = delays.concat(delays);
  39535. }
  39536. return Math.max.apply(null, durations.map(function (d, i) {
  39537. return toMs(d) + toMs(delays[i])
  39538. }))
  39539. }
  39540. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  39541. // in a locale-dependent way, using a comma instead of a dot.
  39542. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  39543. // as a floor function) causing unexpected behaviors
  39544. function toMs (s) {
  39545. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  39546. }
  39547. /* */
  39548. function enter (vnode, toggleDisplay) {
  39549. var el = vnode.elm;
  39550. // call leave callback now
  39551. if (isDef(el._leaveCb)) {
  39552. el._leaveCb.cancelled = true;
  39553. el._leaveCb();
  39554. }
  39555. var data = resolveTransition(vnode.data.transition);
  39556. if (isUndef(data)) {
  39557. return
  39558. }
  39559. /* istanbul ignore if */
  39560. if (isDef(el._enterCb) || el.nodeType !== 1) {
  39561. return
  39562. }
  39563. var css = data.css;
  39564. var type = data.type;
  39565. var enterClass = data.enterClass;
  39566. var enterToClass = data.enterToClass;
  39567. var enterActiveClass = data.enterActiveClass;
  39568. var appearClass = data.appearClass;
  39569. var appearToClass = data.appearToClass;
  39570. var appearActiveClass = data.appearActiveClass;
  39571. var beforeEnter = data.beforeEnter;
  39572. var enter = data.enter;
  39573. var afterEnter = data.afterEnter;
  39574. var enterCancelled = data.enterCancelled;
  39575. var beforeAppear = data.beforeAppear;
  39576. var appear = data.appear;
  39577. var afterAppear = data.afterAppear;
  39578. var appearCancelled = data.appearCancelled;
  39579. var duration = data.duration;
  39580. // activeInstance will always be the <transition> component managing this
  39581. // transition. One edge case to check is when the <transition> is placed
  39582. // as the root node of a child component. In that case we need to check
  39583. // <transition>'s parent for appear check.
  39584. var context = activeInstance;
  39585. var transitionNode = activeInstance.$vnode;
  39586. while (transitionNode && transitionNode.parent) {
  39587. transitionNode = transitionNode.parent;
  39588. context = transitionNode.context;
  39589. }
  39590. var isAppear = !context._isMounted || !vnode.isRootInsert;
  39591. if (isAppear && !appear && appear !== '') {
  39592. return
  39593. }
  39594. var startClass = isAppear && appearClass
  39595. ? appearClass
  39596. : enterClass;
  39597. var activeClass = isAppear && appearActiveClass
  39598. ? appearActiveClass
  39599. : enterActiveClass;
  39600. var toClass = isAppear && appearToClass
  39601. ? appearToClass
  39602. : enterToClass;
  39603. var beforeEnterHook = isAppear
  39604. ? (beforeAppear || beforeEnter)
  39605. : beforeEnter;
  39606. var enterHook = isAppear
  39607. ? (typeof appear === 'function' ? appear : enter)
  39608. : enter;
  39609. var afterEnterHook = isAppear
  39610. ? (afterAppear || afterEnter)
  39611. : afterEnter;
  39612. var enterCancelledHook = isAppear
  39613. ? (appearCancelled || enterCancelled)
  39614. : enterCancelled;
  39615. var explicitEnterDuration = toNumber(
  39616. isObject(duration)
  39617. ? duration.enter
  39618. : duration
  39619. );
  39620. if (explicitEnterDuration != null) {
  39621. checkDuration(explicitEnterDuration, 'enter', vnode);
  39622. }
  39623. var expectsCSS = css !== false && !isIE9;
  39624. var userWantsControl = getHookArgumentsLength(enterHook);
  39625. var cb = el._enterCb = once(function () {
  39626. if (expectsCSS) {
  39627. removeTransitionClass(el, toClass);
  39628. removeTransitionClass(el, activeClass);
  39629. }
  39630. if (cb.cancelled) {
  39631. if (expectsCSS) {
  39632. removeTransitionClass(el, startClass);
  39633. }
  39634. enterCancelledHook && enterCancelledHook(el);
  39635. } else {
  39636. afterEnterHook && afterEnterHook(el);
  39637. }
  39638. el._enterCb = null;
  39639. });
  39640. if (!vnode.data.show) {
  39641. // remove pending leave element on enter by injecting an insert hook
  39642. mergeVNodeHook(vnode, 'insert', function () {
  39643. var parent = el.parentNode;
  39644. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  39645. if (pendingNode &&
  39646. pendingNode.tag === vnode.tag &&
  39647. pendingNode.elm._leaveCb
  39648. ) {
  39649. pendingNode.elm._leaveCb();
  39650. }
  39651. enterHook && enterHook(el, cb);
  39652. });
  39653. }
  39654. // start enter transition
  39655. beforeEnterHook && beforeEnterHook(el);
  39656. if (expectsCSS) {
  39657. addTransitionClass(el, startClass);
  39658. addTransitionClass(el, activeClass);
  39659. nextFrame(function () {
  39660. removeTransitionClass(el, startClass);
  39661. if (!cb.cancelled) {
  39662. addTransitionClass(el, toClass);
  39663. if (!userWantsControl) {
  39664. if (isValidDuration(explicitEnterDuration)) {
  39665. setTimeout(cb, explicitEnterDuration);
  39666. } else {
  39667. whenTransitionEnds(el, type, cb);
  39668. }
  39669. }
  39670. }
  39671. });
  39672. }
  39673. if (vnode.data.show) {
  39674. toggleDisplay && toggleDisplay();
  39675. enterHook && enterHook(el, cb);
  39676. }
  39677. if (!expectsCSS && !userWantsControl) {
  39678. cb();
  39679. }
  39680. }
  39681. function leave (vnode, rm) {
  39682. var el = vnode.elm;
  39683. // call enter callback now
  39684. if (isDef(el._enterCb)) {
  39685. el._enterCb.cancelled = true;
  39686. el._enterCb();
  39687. }
  39688. var data = resolveTransition(vnode.data.transition);
  39689. if (isUndef(data) || el.nodeType !== 1) {
  39690. return rm()
  39691. }
  39692. /* istanbul ignore if */
  39693. if (isDef(el._leaveCb)) {
  39694. return
  39695. }
  39696. var css = data.css;
  39697. var type = data.type;
  39698. var leaveClass = data.leaveClass;
  39699. var leaveToClass = data.leaveToClass;
  39700. var leaveActiveClass = data.leaveActiveClass;
  39701. var beforeLeave = data.beforeLeave;
  39702. var leave = data.leave;
  39703. var afterLeave = data.afterLeave;
  39704. var leaveCancelled = data.leaveCancelled;
  39705. var delayLeave = data.delayLeave;
  39706. var duration = data.duration;
  39707. var expectsCSS = css !== false && !isIE9;
  39708. var userWantsControl = getHookArgumentsLength(leave);
  39709. var explicitLeaveDuration = toNumber(
  39710. isObject(duration)
  39711. ? duration.leave
  39712. : duration
  39713. );
  39714. if (isDef(explicitLeaveDuration)) {
  39715. checkDuration(explicitLeaveDuration, 'leave', vnode);
  39716. }
  39717. var cb = el._leaveCb = once(function () {
  39718. if (el.parentNode && el.parentNode._pending) {
  39719. el.parentNode._pending[vnode.key] = null;
  39720. }
  39721. if (expectsCSS) {
  39722. removeTransitionClass(el, leaveToClass);
  39723. removeTransitionClass(el, leaveActiveClass);
  39724. }
  39725. if (cb.cancelled) {
  39726. if (expectsCSS) {
  39727. removeTransitionClass(el, leaveClass);
  39728. }
  39729. leaveCancelled && leaveCancelled(el);
  39730. } else {
  39731. rm();
  39732. afterLeave && afterLeave(el);
  39733. }
  39734. el._leaveCb = null;
  39735. });
  39736. if (delayLeave) {
  39737. delayLeave(performLeave);
  39738. } else {
  39739. performLeave();
  39740. }
  39741. function performLeave () {
  39742. // the delayed leave may have already been cancelled
  39743. if (cb.cancelled) {
  39744. return
  39745. }
  39746. // record leaving element
  39747. if (!vnode.data.show && el.parentNode) {
  39748. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  39749. }
  39750. beforeLeave && beforeLeave(el);
  39751. if (expectsCSS) {
  39752. addTransitionClass(el, leaveClass);
  39753. addTransitionClass(el, leaveActiveClass);
  39754. nextFrame(function () {
  39755. removeTransitionClass(el, leaveClass);
  39756. if (!cb.cancelled) {
  39757. addTransitionClass(el, leaveToClass);
  39758. if (!userWantsControl) {
  39759. if (isValidDuration(explicitLeaveDuration)) {
  39760. setTimeout(cb, explicitLeaveDuration);
  39761. } else {
  39762. whenTransitionEnds(el, type, cb);
  39763. }
  39764. }
  39765. }
  39766. });
  39767. }
  39768. leave && leave(el, cb);
  39769. if (!expectsCSS && !userWantsControl) {
  39770. cb();
  39771. }
  39772. }
  39773. }
  39774. // only used in dev mode
  39775. function checkDuration (val, name, vnode) {
  39776. if (typeof val !== 'number') {
  39777. warn(
  39778. "<transition> explicit " + name + " duration is not a valid number - " +
  39779. "got " + (JSON.stringify(val)) + ".",
  39780. vnode.context
  39781. );
  39782. } else if (isNaN(val)) {
  39783. warn(
  39784. "<transition> explicit " + name + " duration is NaN - " +
  39785. 'the duration expression might be incorrect.',
  39786. vnode.context
  39787. );
  39788. }
  39789. }
  39790. function isValidDuration (val) {
  39791. return typeof val === 'number' && !isNaN(val)
  39792. }
  39793. /**
  39794. * Normalize a transition hook's argument length. The hook may be:
  39795. * - a merged hook (invoker) with the original in .fns
  39796. * - a wrapped component method (check ._length)
  39797. * - a plain function (.length)
  39798. */
  39799. function getHookArgumentsLength (fn) {
  39800. if (isUndef(fn)) {
  39801. return false
  39802. }
  39803. var invokerFns = fn.fns;
  39804. if (isDef(invokerFns)) {
  39805. // invoker
  39806. return getHookArgumentsLength(
  39807. Array.isArray(invokerFns)
  39808. ? invokerFns[0]
  39809. : invokerFns
  39810. )
  39811. } else {
  39812. return (fn._length || fn.length) > 1
  39813. }
  39814. }
  39815. function _enter (_, vnode) {
  39816. if (vnode.data.show !== true) {
  39817. enter(vnode);
  39818. }
  39819. }
  39820. var transition = inBrowser ? {
  39821. create: _enter,
  39822. activate: _enter,
  39823. remove: function remove$$1 (vnode, rm) {
  39824. /* istanbul ignore else */
  39825. if (vnode.data.show !== true) {
  39826. leave(vnode, rm);
  39827. } else {
  39828. rm();
  39829. }
  39830. }
  39831. } : {};
  39832. var platformModules = [
  39833. attrs,
  39834. klass,
  39835. events,
  39836. domProps,
  39837. style,
  39838. transition
  39839. ];
  39840. /* */
  39841. // the directive module should be applied last, after all
  39842. // built-in modules have been applied.
  39843. var modules = platformModules.concat(baseModules);
  39844. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  39845. /**
  39846. * Not type checking this file because flow doesn't like attaching
  39847. * properties to Elements.
  39848. */
  39849. /* istanbul ignore if */
  39850. if (isIE9) {
  39851. // http://www.matts411.com/post/internet-explorer-9-oninput/
  39852. document.addEventListener('selectionchange', function () {
  39853. var el = document.activeElement;
  39854. if (el && el.vmodel) {
  39855. trigger(el, 'input');
  39856. }
  39857. });
  39858. }
  39859. var directive = {
  39860. inserted: function inserted (el, binding, vnode, oldVnode) {
  39861. if (vnode.tag === 'select') {
  39862. // #6903
  39863. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  39864. mergeVNodeHook(vnode, 'postpatch', function () {
  39865. directive.componentUpdated(el, binding, vnode);
  39866. });
  39867. } else {
  39868. setSelected(el, binding, vnode.context);
  39869. }
  39870. el._vOptions = [].map.call(el.options, getValue);
  39871. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  39872. el._vModifiers = binding.modifiers;
  39873. if (!binding.modifiers.lazy) {
  39874. el.addEventListener('compositionstart', onCompositionStart);
  39875. el.addEventListener('compositionend', onCompositionEnd);
  39876. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  39877. // switching focus before confirming composition choice
  39878. // this also fixes the issue where some browsers e.g. iOS Chrome
  39879. // fires "change" instead of "input" on autocomplete.
  39880. el.addEventListener('change', onCompositionEnd);
  39881. /* istanbul ignore if */
  39882. if (isIE9) {
  39883. el.vmodel = true;
  39884. }
  39885. }
  39886. }
  39887. },
  39888. componentUpdated: function componentUpdated (el, binding, vnode) {
  39889. if (vnode.tag === 'select') {
  39890. setSelected(el, binding, vnode.context);
  39891. // in case the options rendered by v-for have changed,
  39892. // it's possible that the value is out-of-sync with the rendered options.
  39893. // detect such cases and filter out values that no longer has a matching
  39894. // option in the DOM.
  39895. var prevOptions = el._vOptions;
  39896. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  39897. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  39898. // trigger change event if
  39899. // no matching option found for at least one value
  39900. var needReset = el.multiple
  39901. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  39902. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  39903. if (needReset) {
  39904. trigger(el, 'change');
  39905. }
  39906. }
  39907. }
  39908. }
  39909. };
  39910. function setSelected (el, binding, vm) {
  39911. actuallySetSelected(el, binding, vm);
  39912. /* istanbul ignore if */
  39913. if (isIE || isEdge) {
  39914. setTimeout(function () {
  39915. actuallySetSelected(el, binding, vm);
  39916. }, 0);
  39917. }
  39918. }
  39919. function actuallySetSelected (el, binding, vm) {
  39920. var value = binding.value;
  39921. var isMultiple = el.multiple;
  39922. if (isMultiple && !Array.isArray(value)) {
  39923. warn(
  39924. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  39925. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  39926. vm
  39927. );
  39928. return
  39929. }
  39930. var selected, option;
  39931. for (var i = 0, l = el.options.length; i < l; i++) {
  39932. option = el.options[i];
  39933. if (isMultiple) {
  39934. selected = looseIndexOf(value, getValue(option)) > -1;
  39935. if (option.selected !== selected) {
  39936. option.selected = selected;
  39937. }
  39938. } else {
  39939. if (looseEqual(getValue(option), value)) {
  39940. if (el.selectedIndex !== i) {
  39941. el.selectedIndex = i;
  39942. }
  39943. return
  39944. }
  39945. }
  39946. }
  39947. if (!isMultiple) {
  39948. el.selectedIndex = -1;
  39949. }
  39950. }
  39951. function hasNoMatchingOption (value, options) {
  39952. return options.every(function (o) { return !looseEqual(o, value); })
  39953. }
  39954. function getValue (option) {
  39955. return '_value' in option
  39956. ? option._value
  39957. : option.value
  39958. }
  39959. function onCompositionStart (e) {
  39960. e.target.composing = true;
  39961. }
  39962. function onCompositionEnd (e) {
  39963. // prevent triggering an input event for no reason
  39964. if (!e.target.composing) { return }
  39965. e.target.composing = false;
  39966. trigger(e.target, 'input');
  39967. }
  39968. function trigger (el, type) {
  39969. var e = document.createEvent('HTMLEvents');
  39970. e.initEvent(type, true, true);
  39971. el.dispatchEvent(e);
  39972. }
  39973. /* */
  39974. // recursively search for possible transition defined inside the component root
  39975. function locateNode (vnode) {
  39976. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  39977. ? locateNode(vnode.componentInstance._vnode)
  39978. : vnode
  39979. }
  39980. var show = {
  39981. bind: function bind (el, ref, vnode) {
  39982. var value = ref.value;
  39983. vnode = locateNode(vnode);
  39984. var transition$$1 = vnode.data && vnode.data.transition;
  39985. var originalDisplay = el.__vOriginalDisplay =
  39986. el.style.display === 'none' ? '' : el.style.display;
  39987. if (value && transition$$1) {
  39988. vnode.data.show = true;
  39989. enter(vnode, function () {
  39990. el.style.display = originalDisplay;
  39991. });
  39992. } else {
  39993. el.style.display = value ? originalDisplay : 'none';
  39994. }
  39995. },
  39996. update: function update (el, ref, vnode) {
  39997. var value = ref.value;
  39998. var oldValue = ref.oldValue;
  39999. /* istanbul ignore if */
  40000. if (!value === !oldValue) { return }
  40001. vnode = locateNode(vnode);
  40002. var transition$$1 = vnode.data && vnode.data.transition;
  40003. if (transition$$1) {
  40004. vnode.data.show = true;
  40005. if (value) {
  40006. enter(vnode, function () {
  40007. el.style.display = el.__vOriginalDisplay;
  40008. });
  40009. } else {
  40010. leave(vnode, function () {
  40011. el.style.display = 'none';
  40012. });
  40013. }
  40014. } else {
  40015. el.style.display = value ? el.__vOriginalDisplay : 'none';
  40016. }
  40017. },
  40018. unbind: function unbind (
  40019. el,
  40020. binding,
  40021. vnode,
  40022. oldVnode,
  40023. isDestroy
  40024. ) {
  40025. if (!isDestroy) {
  40026. el.style.display = el.__vOriginalDisplay;
  40027. }
  40028. }
  40029. };
  40030. var platformDirectives = {
  40031. model: directive,
  40032. show: show
  40033. };
  40034. /* */
  40035. var transitionProps = {
  40036. name: String,
  40037. appear: Boolean,
  40038. css: Boolean,
  40039. mode: String,
  40040. type: String,
  40041. enterClass: String,
  40042. leaveClass: String,
  40043. enterToClass: String,
  40044. leaveToClass: String,
  40045. enterActiveClass: String,
  40046. leaveActiveClass: String,
  40047. appearClass: String,
  40048. appearActiveClass: String,
  40049. appearToClass: String,
  40050. duration: [Number, String, Object]
  40051. };
  40052. // in case the child is also an abstract component, e.g. <keep-alive>
  40053. // we want to recursively retrieve the real component to be rendered
  40054. function getRealChild (vnode) {
  40055. var compOptions = vnode && vnode.componentOptions;
  40056. if (compOptions && compOptions.Ctor.options.abstract) {
  40057. return getRealChild(getFirstComponentChild(compOptions.children))
  40058. } else {
  40059. return vnode
  40060. }
  40061. }
  40062. function extractTransitionData (comp) {
  40063. var data = {};
  40064. var options = comp.$options;
  40065. // props
  40066. for (var key in options.propsData) {
  40067. data[key] = comp[key];
  40068. }
  40069. // events.
  40070. // extract listeners and pass them directly to the transition methods
  40071. var listeners = options._parentListeners;
  40072. for (var key$1 in listeners) {
  40073. data[camelize(key$1)] = listeners[key$1];
  40074. }
  40075. return data
  40076. }
  40077. function placeholder (h, rawChild) {
  40078. if (/\d-keep-alive$/.test(rawChild.tag)) {
  40079. return h('keep-alive', {
  40080. props: rawChild.componentOptions.propsData
  40081. })
  40082. }
  40083. }
  40084. function hasParentTransition (vnode) {
  40085. while ((vnode = vnode.parent)) {
  40086. if (vnode.data.transition) {
  40087. return true
  40088. }
  40089. }
  40090. }
  40091. function isSameChild (child, oldChild) {
  40092. return oldChild.key === child.key && oldChild.tag === child.tag
  40093. }
  40094. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  40095. var isVShowDirective = function (d) { return d.name === 'show'; };
  40096. var Transition = {
  40097. name: 'transition',
  40098. props: transitionProps,
  40099. abstract: true,
  40100. render: function render (h) {
  40101. var this$1 = this;
  40102. var children = this.$slots.default;
  40103. if (!children) {
  40104. return
  40105. }
  40106. // filter out text nodes (possible whitespaces)
  40107. children = children.filter(isNotTextNode);
  40108. /* istanbul ignore if */
  40109. if (!children.length) {
  40110. return
  40111. }
  40112. // warn multiple elements
  40113. if (children.length > 1) {
  40114. warn(
  40115. '<transition> can only be used on a single element. Use ' +
  40116. '<transition-group> for lists.',
  40117. this.$parent
  40118. );
  40119. }
  40120. var mode = this.mode;
  40121. // warn invalid mode
  40122. if (mode && mode !== 'in-out' && mode !== 'out-in'
  40123. ) {
  40124. warn(
  40125. 'invalid <transition> mode: ' + mode,
  40126. this.$parent
  40127. );
  40128. }
  40129. var rawChild = children[0];
  40130. // if this is a component root node and the component's
  40131. // parent container node also has transition, skip.
  40132. if (hasParentTransition(this.$vnode)) {
  40133. return rawChild
  40134. }
  40135. // apply transition data to child
  40136. // use getRealChild() to ignore abstract components e.g. keep-alive
  40137. var child = getRealChild(rawChild);
  40138. /* istanbul ignore if */
  40139. if (!child) {
  40140. return rawChild
  40141. }
  40142. if (this._leaving) {
  40143. return placeholder(h, rawChild)
  40144. }
  40145. // ensure a key that is unique to the vnode type and to this transition
  40146. // component instance. This key will be used to remove pending leaving nodes
  40147. // during entering.
  40148. var id = "__transition-" + (this._uid) + "-";
  40149. child.key = child.key == null
  40150. ? child.isComment
  40151. ? id + 'comment'
  40152. : id + child.tag
  40153. : isPrimitive(child.key)
  40154. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  40155. : child.key;
  40156. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  40157. var oldRawChild = this._vnode;
  40158. var oldChild = getRealChild(oldRawChild);
  40159. // mark v-show
  40160. // so that the transition module can hand over the control to the directive
  40161. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  40162. child.data.show = true;
  40163. }
  40164. if (
  40165. oldChild &&
  40166. oldChild.data &&
  40167. !isSameChild(child, oldChild) &&
  40168. !isAsyncPlaceholder(oldChild) &&
  40169. // #6687 component root is a comment node
  40170. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  40171. ) {
  40172. // replace old child transition data with fresh one
  40173. // important for dynamic transitions!
  40174. var oldData = oldChild.data.transition = extend({}, data);
  40175. // handle transition mode
  40176. if (mode === 'out-in') {
  40177. // return placeholder node and queue update when leave finishes
  40178. this._leaving = true;
  40179. mergeVNodeHook(oldData, 'afterLeave', function () {
  40180. this$1._leaving = false;
  40181. this$1.$forceUpdate();
  40182. });
  40183. return placeholder(h, rawChild)
  40184. } else if (mode === 'in-out') {
  40185. if (isAsyncPlaceholder(child)) {
  40186. return oldRawChild
  40187. }
  40188. var delayedLeave;
  40189. var performLeave = function () { delayedLeave(); };
  40190. mergeVNodeHook(data, 'afterEnter', performLeave);
  40191. mergeVNodeHook(data, 'enterCancelled', performLeave);
  40192. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  40193. }
  40194. }
  40195. return rawChild
  40196. }
  40197. };
  40198. /* */
  40199. var props = extend({
  40200. tag: String,
  40201. moveClass: String
  40202. }, transitionProps);
  40203. delete props.mode;
  40204. var TransitionGroup = {
  40205. props: props,
  40206. beforeMount: function beforeMount () {
  40207. var this$1 = this;
  40208. var update = this._update;
  40209. this._update = function (vnode, hydrating) {
  40210. var restoreActiveInstance = setActiveInstance(this$1);
  40211. // force removing pass
  40212. this$1.__patch__(
  40213. this$1._vnode,
  40214. this$1.kept,
  40215. false, // hydrating
  40216. true // removeOnly (!important, avoids unnecessary moves)
  40217. );
  40218. this$1._vnode = this$1.kept;
  40219. restoreActiveInstance();
  40220. update.call(this$1, vnode, hydrating);
  40221. };
  40222. },
  40223. render: function render (h) {
  40224. var tag = this.tag || this.$vnode.data.tag || 'span';
  40225. var map = Object.create(null);
  40226. var prevChildren = this.prevChildren = this.children;
  40227. var rawChildren = this.$slots.default || [];
  40228. var children = this.children = [];
  40229. var transitionData = extractTransitionData(this);
  40230. for (var i = 0; i < rawChildren.length; i++) {
  40231. var c = rawChildren[i];
  40232. if (c.tag) {
  40233. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  40234. children.push(c);
  40235. map[c.key] = c
  40236. ;(c.data || (c.data = {})).transition = transitionData;
  40237. } else {
  40238. var opts = c.componentOptions;
  40239. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  40240. warn(("<transition-group> children must be keyed: <" + name + ">"));
  40241. }
  40242. }
  40243. }
  40244. if (prevChildren) {
  40245. var kept = [];
  40246. var removed = [];
  40247. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  40248. var c$1 = prevChildren[i$1];
  40249. c$1.data.transition = transitionData;
  40250. c$1.data.pos = c$1.elm.getBoundingClientRect();
  40251. if (map[c$1.key]) {
  40252. kept.push(c$1);
  40253. } else {
  40254. removed.push(c$1);
  40255. }
  40256. }
  40257. this.kept = h(tag, null, kept);
  40258. this.removed = removed;
  40259. }
  40260. return h(tag, null, children)
  40261. },
  40262. updated: function updated () {
  40263. var children = this.prevChildren;
  40264. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  40265. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  40266. return
  40267. }
  40268. // we divide the work into three loops to avoid mixing DOM reads and writes
  40269. // in each iteration - which helps prevent layout thrashing.
  40270. children.forEach(callPendingCbs);
  40271. children.forEach(recordPosition);
  40272. children.forEach(applyTranslation);
  40273. // force reflow to put everything in position
  40274. // assign to this to avoid being removed in tree-shaking
  40275. // $flow-disable-line
  40276. this._reflow = document.body.offsetHeight;
  40277. children.forEach(function (c) {
  40278. if (c.data.moved) {
  40279. var el = c.elm;
  40280. var s = el.style;
  40281. addTransitionClass(el, moveClass);
  40282. s.transform = s.WebkitTransform = s.transitionDuration = '';
  40283. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  40284. if (e && e.target !== el) {
  40285. return
  40286. }
  40287. if (!e || /transform$/.test(e.propertyName)) {
  40288. el.removeEventListener(transitionEndEvent, cb);
  40289. el._moveCb = null;
  40290. removeTransitionClass(el, moveClass);
  40291. }
  40292. });
  40293. }
  40294. });
  40295. },
  40296. methods: {
  40297. hasMove: function hasMove (el, moveClass) {
  40298. /* istanbul ignore if */
  40299. if (!hasTransition) {
  40300. return false
  40301. }
  40302. /* istanbul ignore if */
  40303. if (this._hasMove) {
  40304. return this._hasMove
  40305. }
  40306. // Detect whether an element with the move class applied has
  40307. // CSS transitions. Since the element may be inside an entering
  40308. // transition at this very moment, we make a clone of it and remove
  40309. // all other transition classes applied to ensure only the move class
  40310. // is applied.
  40311. var clone = el.cloneNode();
  40312. if (el._transitionClasses) {
  40313. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  40314. }
  40315. addClass(clone, moveClass);
  40316. clone.style.display = 'none';
  40317. this.$el.appendChild(clone);
  40318. var info = getTransitionInfo(clone);
  40319. this.$el.removeChild(clone);
  40320. return (this._hasMove = info.hasTransform)
  40321. }
  40322. }
  40323. };
  40324. function callPendingCbs (c) {
  40325. /* istanbul ignore if */
  40326. if (c.elm._moveCb) {
  40327. c.elm._moveCb();
  40328. }
  40329. /* istanbul ignore if */
  40330. if (c.elm._enterCb) {
  40331. c.elm._enterCb();
  40332. }
  40333. }
  40334. function recordPosition (c) {
  40335. c.data.newPos = c.elm.getBoundingClientRect();
  40336. }
  40337. function applyTranslation (c) {
  40338. var oldPos = c.data.pos;
  40339. var newPos = c.data.newPos;
  40340. var dx = oldPos.left - newPos.left;
  40341. var dy = oldPos.top - newPos.top;
  40342. if (dx || dy) {
  40343. c.data.moved = true;
  40344. var s = c.elm.style;
  40345. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  40346. s.transitionDuration = '0s';
  40347. }
  40348. }
  40349. var platformComponents = {
  40350. Transition: Transition,
  40351. TransitionGroup: TransitionGroup
  40352. };
  40353. /* */
  40354. // install platform specific utils
  40355. Vue.config.mustUseProp = mustUseProp;
  40356. Vue.config.isReservedTag = isReservedTag;
  40357. Vue.config.isReservedAttr = isReservedAttr;
  40358. Vue.config.getTagNamespace = getTagNamespace;
  40359. Vue.config.isUnknownElement = isUnknownElement;
  40360. // install platform runtime directives & components
  40361. extend(Vue.options.directives, platformDirectives);
  40362. extend(Vue.options.components, platformComponents);
  40363. // install platform patch function
  40364. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  40365. // public mount method
  40366. Vue.prototype.$mount = function (
  40367. el,
  40368. hydrating
  40369. ) {
  40370. el = el && inBrowser ? query(el) : undefined;
  40371. return mountComponent(this, el, hydrating)
  40372. };
  40373. // devtools global hook
  40374. /* istanbul ignore next */
  40375. if (inBrowser) {
  40376. setTimeout(function () {
  40377. if (config.devtools) {
  40378. if (devtools) {
  40379. devtools.emit('init', Vue);
  40380. } else {
  40381. console[console.info ? 'info' : 'log'](
  40382. 'Download the Vue Devtools extension for a better development experience:\n' +
  40383. 'https://github.com/vuejs/vue-devtools'
  40384. );
  40385. }
  40386. }
  40387. if (config.productionTip !== false &&
  40388. typeof console !== 'undefined'
  40389. ) {
  40390. console[console.info ? 'info' : 'log'](
  40391. "You are running Vue in development mode.\n" +
  40392. "Make sure to turn on production mode when deploying for production.\n" +
  40393. "See more tips at https://vuejs.org/guide/deployment.html"
  40394. );
  40395. }
  40396. }, 0);
  40397. }
  40398. /* */
  40399. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  40400. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  40401. var buildRegex = cached(function (delimiters) {
  40402. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  40403. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  40404. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  40405. });
  40406. function parseText (
  40407. text,
  40408. delimiters
  40409. ) {
  40410. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  40411. if (!tagRE.test(text)) {
  40412. return
  40413. }
  40414. var tokens = [];
  40415. var rawTokens = [];
  40416. var lastIndex = tagRE.lastIndex = 0;
  40417. var match, index, tokenValue;
  40418. while ((match = tagRE.exec(text))) {
  40419. index = match.index;
  40420. // push text token
  40421. if (index > lastIndex) {
  40422. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  40423. tokens.push(JSON.stringify(tokenValue));
  40424. }
  40425. // tag token
  40426. var exp = parseFilters(match[1].trim());
  40427. tokens.push(("_s(" + exp + ")"));
  40428. rawTokens.push({ '@binding': exp });
  40429. lastIndex = index + match[0].length;
  40430. }
  40431. if (lastIndex < text.length) {
  40432. rawTokens.push(tokenValue = text.slice(lastIndex));
  40433. tokens.push(JSON.stringify(tokenValue));
  40434. }
  40435. return {
  40436. expression: tokens.join('+'),
  40437. tokens: rawTokens
  40438. }
  40439. }
  40440. /* */
  40441. function transformNode (el, options) {
  40442. var warn = options.warn || baseWarn;
  40443. var staticClass = getAndRemoveAttr(el, 'class');
  40444. if (staticClass) {
  40445. var res = parseText(staticClass, options.delimiters);
  40446. if (res) {
  40447. warn(
  40448. "class=\"" + staticClass + "\": " +
  40449. 'Interpolation inside attributes has been removed. ' +
  40450. 'Use v-bind or the colon shorthand instead. For example, ' +
  40451. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  40452. el.rawAttrsMap['class']
  40453. );
  40454. }
  40455. }
  40456. if (staticClass) {
  40457. el.staticClass = JSON.stringify(staticClass);
  40458. }
  40459. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  40460. if (classBinding) {
  40461. el.classBinding = classBinding;
  40462. }
  40463. }
  40464. function genData (el) {
  40465. var data = '';
  40466. if (el.staticClass) {
  40467. data += "staticClass:" + (el.staticClass) + ",";
  40468. }
  40469. if (el.classBinding) {
  40470. data += "class:" + (el.classBinding) + ",";
  40471. }
  40472. return data
  40473. }
  40474. var klass$1 = {
  40475. staticKeys: ['staticClass'],
  40476. transformNode: transformNode,
  40477. genData: genData
  40478. };
  40479. /* */
  40480. function transformNode$1 (el, options) {
  40481. var warn = options.warn || baseWarn;
  40482. var staticStyle = getAndRemoveAttr(el, 'style');
  40483. if (staticStyle) {
  40484. /* istanbul ignore if */
  40485. {
  40486. var res = parseText(staticStyle, options.delimiters);
  40487. if (res) {
  40488. warn(
  40489. "style=\"" + staticStyle + "\": " +
  40490. 'Interpolation inside attributes has been removed. ' +
  40491. 'Use v-bind or the colon shorthand instead. For example, ' +
  40492. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  40493. el.rawAttrsMap['style']
  40494. );
  40495. }
  40496. }
  40497. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  40498. }
  40499. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  40500. if (styleBinding) {
  40501. el.styleBinding = styleBinding;
  40502. }
  40503. }
  40504. function genData$1 (el) {
  40505. var data = '';
  40506. if (el.staticStyle) {
  40507. data += "staticStyle:" + (el.staticStyle) + ",";
  40508. }
  40509. if (el.styleBinding) {
  40510. data += "style:(" + (el.styleBinding) + "),";
  40511. }
  40512. return data
  40513. }
  40514. var style$1 = {
  40515. staticKeys: ['staticStyle'],
  40516. transformNode: transformNode$1,
  40517. genData: genData$1
  40518. };
  40519. /* */
  40520. var decoder;
  40521. var he = {
  40522. decode: function decode (html) {
  40523. decoder = decoder || document.createElement('div');
  40524. decoder.innerHTML = html;
  40525. return decoder.textContent
  40526. }
  40527. };
  40528. /* */
  40529. var isUnaryTag = makeMap(
  40530. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  40531. 'link,meta,param,source,track,wbr'
  40532. );
  40533. // Elements that you can, intentionally, leave open
  40534. // (and which close themselves)
  40535. var canBeLeftOpenTag = makeMap(
  40536. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  40537. );
  40538. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  40539. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  40540. var isNonPhrasingTag = makeMap(
  40541. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  40542. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  40543. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  40544. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  40545. 'title,tr,track'
  40546. );
  40547. /**
  40548. * Not type-checking this file because it's mostly vendor code.
  40549. */
  40550. // Regular Expressions for parsing tags and attributes
  40551. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  40552. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  40553. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + unicodeLetters + "]*";
  40554. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  40555. var startTagOpen = new RegExp(("^<" + qnameCapture));
  40556. var startTagClose = /^\s*(\/?)>/;
  40557. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  40558. var doctype = /^<!DOCTYPE [^>]+>/i;
  40559. // #7298: escape - to avoid being pased as HTML comment when inlined in page
  40560. var comment = /^<!\--/;
  40561. var conditionalComment = /^<!\[/;
  40562. // Special Elements (can contain anything)
  40563. var isPlainTextElement = makeMap('script,style,textarea', true);
  40564. var reCache = {};
  40565. var decodingMap = {
  40566. '&lt;': '<',
  40567. '&gt;': '>',
  40568. '&quot;': '"',
  40569. '&amp;': '&',
  40570. '&#10;': '\n',
  40571. '&#9;': '\t',
  40572. '&#39;': "'"
  40573. };
  40574. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  40575. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  40576. // #5992
  40577. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  40578. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  40579. function decodeAttr (value, shouldDecodeNewlines) {
  40580. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  40581. return value.replace(re, function (match) { return decodingMap[match]; })
  40582. }
  40583. function parseHTML (html, options) {
  40584. var stack = [];
  40585. var expectHTML = options.expectHTML;
  40586. var isUnaryTag$$1 = options.isUnaryTag || no;
  40587. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  40588. var index = 0;
  40589. var last, lastTag;
  40590. while (html) {
  40591. last = html;
  40592. // Make sure we're not in a plaintext content element like script/style
  40593. if (!lastTag || !isPlainTextElement(lastTag)) {
  40594. var textEnd = html.indexOf('<');
  40595. if (textEnd === 0) {
  40596. // Comment:
  40597. if (comment.test(html)) {
  40598. var commentEnd = html.indexOf('-->');
  40599. if (commentEnd >= 0) {
  40600. if (options.shouldKeepComment) {
  40601. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  40602. }
  40603. advance(commentEnd + 3);
  40604. continue
  40605. }
  40606. }
  40607. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  40608. if (conditionalComment.test(html)) {
  40609. var conditionalEnd = html.indexOf(']>');
  40610. if (conditionalEnd >= 0) {
  40611. advance(conditionalEnd + 2);
  40612. continue
  40613. }
  40614. }
  40615. // Doctype:
  40616. var doctypeMatch = html.match(doctype);
  40617. if (doctypeMatch) {
  40618. advance(doctypeMatch[0].length);
  40619. continue
  40620. }
  40621. // End tag:
  40622. var endTagMatch = html.match(endTag);
  40623. if (endTagMatch) {
  40624. var curIndex = index;
  40625. advance(endTagMatch[0].length);
  40626. parseEndTag(endTagMatch[1], curIndex, index);
  40627. continue
  40628. }
  40629. // Start tag:
  40630. var startTagMatch = parseStartTag();
  40631. if (startTagMatch) {
  40632. handleStartTag(startTagMatch);
  40633. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  40634. advance(1);
  40635. }
  40636. continue
  40637. }
  40638. }
  40639. var text = (void 0), rest = (void 0), next = (void 0);
  40640. if (textEnd >= 0) {
  40641. rest = html.slice(textEnd);
  40642. while (
  40643. !endTag.test(rest) &&
  40644. !startTagOpen.test(rest) &&
  40645. !comment.test(rest) &&
  40646. !conditionalComment.test(rest)
  40647. ) {
  40648. // < in plain text, be forgiving and treat it as text
  40649. next = rest.indexOf('<', 1);
  40650. if (next < 0) { break }
  40651. textEnd += next;
  40652. rest = html.slice(textEnd);
  40653. }
  40654. text = html.substring(0, textEnd);
  40655. }
  40656. if (textEnd < 0) {
  40657. text = html;
  40658. }
  40659. if (text) {
  40660. advance(text.length);
  40661. }
  40662. if (options.chars && text) {
  40663. options.chars(text, index - text.length, index);
  40664. }
  40665. } else {
  40666. var endTagLength = 0;
  40667. var stackedTag = lastTag.toLowerCase();
  40668. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  40669. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  40670. endTagLength = endTag.length;
  40671. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  40672. text = text
  40673. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  40674. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  40675. }
  40676. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  40677. text = text.slice(1);
  40678. }
  40679. if (options.chars) {
  40680. options.chars(text);
  40681. }
  40682. return ''
  40683. });
  40684. index += html.length - rest$1.length;
  40685. html = rest$1;
  40686. parseEndTag(stackedTag, index - endTagLength, index);
  40687. }
  40688. if (html === last) {
  40689. options.chars && options.chars(html);
  40690. if (!stack.length && options.warn) {
  40691. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  40692. }
  40693. break
  40694. }
  40695. }
  40696. // Clean up any remaining tags
  40697. parseEndTag();
  40698. function advance (n) {
  40699. index += n;
  40700. html = html.substring(n);
  40701. }
  40702. function parseStartTag () {
  40703. var start = html.match(startTagOpen);
  40704. if (start) {
  40705. var match = {
  40706. tagName: start[1],
  40707. attrs: [],
  40708. start: index
  40709. };
  40710. advance(start[0].length);
  40711. var end, attr;
  40712. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  40713. attr.start = index;
  40714. advance(attr[0].length);
  40715. attr.end = index;
  40716. match.attrs.push(attr);
  40717. }
  40718. if (end) {
  40719. match.unarySlash = end[1];
  40720. advance(end[0].length);
  40721. match.end = index;
  40722. return match
  40723. }
  40724. }
  40725. }
  40726. function handleStartTag (match) {
  40727. var tagName = match.tagName;
  40728. var unarySlash = match.unarySlash;
  40729. if (expectHTML) {
  40730. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  40731. parseEndTag(lastTag);
  40732. }
  40733. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  40734. parseEndTag(tagName);
  40735. }
  40736. }
  40737. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  40738. var l = match.attrs.length;
  40739. var attrs = new Array(l);
  40740. for (var i = 0; i < l; i++) {
  40741. var args = match.attrs[i];
  40742. var value = args[3] || args[4] || args[5] || '';
  40743. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  40744. ? options.shouldDecodeNewlinesForHref
  40745. : options.shouldDecodeNewlines;
  40746. attrs[i] = {
  40747. name: args[1],
  40748. value: decodeAttr(value, shouldDecodeNewlines)
  40749. };
  40750. if (options.outputSourceRange) {
  40751. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  40752. attrs[i].end = args.end;
  40753. }
  40754. }
  40755. if (!unary) {
  40756. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  40757. lastTag = tagName;
  40758. }
  40759. if (options.start) {
  40760. options.start(tagName, attrs, unary, match.start, match.end);
  40761. }
  40762. }
  40763. function parseEndTag (tagName, start, end) {
  40764. var pos, lowerCasedTagName;
  40765. if (start == null) { start = index; }
  40766. if (end == null) { end = index; }
  40767. // Find the closest opened tag of the same type
  40768. if (tagName) {
  40769. lowerCasedTagName = tagName.toLowerCase();
  40770. for (pos = stack.length - 1; pos >= 0; pos--) {
  40771. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  40772. break
  40773. }
  40774. }
  40775. } else {
  40776. // If no tag name is provided, clean shop
  40777. pos = 0;
  40778. }
  40779. if (pos >= 0) {
  40780. // Close all the open elements, up the stack
  40781. for (var i = stack.length - 1; i >= pos; i--) {
  40782. if (i > pos || !tagName &&
  40783. options.warn
  40784. ) {
  40785. options.warn(
  40786. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  40787. { start: stack[i].start }
  40788. );
  40789. }
  40790. if (options.end) {
  40791. options.end(stack[i].tag, start, end);
  40792. }
  40793. }
  40794. // Remove the open elements from the stack
  40795. stack.length = pos;
  40796. lastTag = pos && stack[pos - 1].tag;
  40797. } else if (lowerCasedTagName === 'br') {
  40798. if (options.start) {
  40799. options.start(tagName, [], true, start, end);
  40800. }
  40801. } else if (lowerCasedTagName === 'p') {
  40802. if (options.start) {
  40803. options.start(tagName, [], false, start, end);
  40804. }
  40805. if (options.end) {
  40806. options.end(tagName, start, end);
  40807. }
  40808. }
  40809. }
  40810. }
  40811. /* */
  40812. var onRE = /^@|^v-on:/;
  40813. var dirRE = /^v-|^@|^:/;
  40814. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  40815. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  40816. var stripParensRE = /^\(|\)$/g;
  40817. var dynamicArgRE = /^\[.*\]$/;
  40818. var argRE = /:(.*)$/;
  40819. var bindRE = /^:|^\.|^v-bind:/;
  40820. var modifierRE = /\.[^.]+/g;
  40821. var slotRE = /^v-slot(:|$)|^#/;
  40822. var lineBreakRE = /[\r\n]/;
  40823. var whitespaceRE$1 = /\s+/g;
  40824. var invalidAttributeRE = /[\s"'<>\/=]/;
  40825. var decodeHTMLCached = cached(he.decode);
  40826. var emptySlotScopeToken = "_empty_";
  40827. // configurable state
  40828. var warn$2;
  40829. var delimiters;
  40830. var transforms;
  40831. var preTransforms;
  40832. var postTransforms;
  40833. var platformIsPreTag;
  40834. var platformMustUseProp;
  40835. var platformGetTagNamespace;
  40836. var maybeComponent;
  40837. function createASTElement (
  40838. tag,
  40839. attrs,
  40840. parent
  40841. ) {
  40842. return {
  40843. type: 1,
  40844. tag: tag,
  40845. attrsList: attrs,
  40846. attrsMap: makeAttrsMap(attrs),
  40847. rawAttrsMap: {},
  40848. parent: parent,
  40849. children: []
  40850. }
  40851. }
  40852. /**
  40853. * Convert HTML string to AST.
  40854. */
  40855. function parse (
  40856. template,
  40857. options
  40858. ) {
  40859. warn$2 = options.warn || baseWarn;
  40860. platformIsPreTag = options.isPreTag || no;
  40861. platformMustUseProp = options.mustUseProp || no;
  40862. platformGetTagNamespace = options.getTagNamespace || no;
  40863. var isReservedTag = options.isReservedTag || no;
  40864. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  40865. transforms = pluckModuleFunction(options.modules, 'transformNode');
  40866. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  40867. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  40868. delimiters = options.delimiters;
  40869. var stack = [];
  40870. var preserveWhitespace = options.preserveWhitespace !== false;
  40871. var whitespaceOption = options.whitespace;
  40872. var root;
  40873. var currentParent;
  40874. var inVPre = false;
  40875. var inPre = false;
  40876. var warned = false;
  40877. function warnOnce (msg, range) {
  40878. if (!warned) {
  40879. warned = true;
  40880. warn$2(msg, range);
  40881. }
  40882. }
  40883. function closeElement (element) {
  40884. trimEndingWhitespace(element);
  40885. if (!inVPre && !element.processed) {
  40886. element = processElement(element, options);
  40887. }
  40888. // tree management
  40889. if (!stack.length && element !== root) {
  40890. // allow root elements with v-if, v-else-if and v-else
  40891. if (root.if && (element.elseif || element.else)) {
  40892. {
  40893. checkRootConstraints(element);
  40894. }
  40895. addIfCondition(root, {
  40896. exp: element.elseif,
  40897. block: element
  40898. });
  40899. } else {
  40900. warnOnce(
  40901. "Component template should contain exactly one root element. " +
  40902. "If you are using v-if on multiple elements, " +
  40903. "use v-else-if to chain them instead.",
  40904. { start: element.start }
  40905. );
  40906. }
  40907. }
  40908. if (currentParent && !element.forbidden) {
  40909. if (element.elseif || element.else) {
  40910. processIfConditions(element, currentParent);
  40911. } else {
  40912. if (element.slotScope) {
  40913. // scoped slot
  40914. // keep it in the children list so that v-else(-if) conditions can
  40915. // find it as the prev node.
  40916. var name = element.slotTarget || '"default"'
  40917. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  40918. }
  40919. currentParent.children.push(element);
  40920. element.parent = currentParent;
  40921. }
  40922. }
  40923. // final children cleanup
  40924. // filter out scoped slots
  40925. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  40926. // remove trailing whitespace node again
  40927. trimEndingWhitespace(element);
  40928. // check pre state
  40929. if (element.pre) {
  40930. inVPre = false;
  40931. }
  40932. if (platformIsPreTag(element.tag)) {
  40933. inPre = false;
  40934. }
  40935. // apply post-transforms
  40936. for (var i = 0; i < postTransforms.length; i++) {
  40937. postTransforms[i](element, options);
  40938. }
  40939. }
  40940. function trimEndingWhitespace (el) {
  40941. // remove trailing whitespace node
  40942. if (!inPre) {
  40943. var lastNode;
  40944. while (
  40945. (lastNode = el.children[el.children.length - 1]) &&
  40946. lastNode.type === 3 &&
  40947. lastNode.text === ' '
  40948. ) {
  40949. el.children.pop();
  40950. }
  40951. }
  40952. }
  40953. function checkRootConstraints (el) {
  40954. if (el.tag === 'slot' || el.tag === 'template') {
  40955. warnOnce(
  40956. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  40957. 'contain multiple nodes.',
  40958. { start: el.start }
  40959. );
  40960. }
  40961. if (el.attrsMap.hasOwnProperty('v-for')) {
  40962. warnOnce(
  40963. 'Cannot use v-for on stateful component root element because ' +
  40964. 'it renders multiple elements.',
  40965. el.rawAttrsMap['v-for']
  40966. );
  40967. }
  40968. }
  40969. parseHTML(template, {
  40970. warn: warn$2,
  40971. expectHTML: options.expectHTML,
  40972. isUnaryTag: options.isUnaryTag,
  40973. canBeLeftOpenTag: options.canBeLeftOpenTag,
  40974. shouldDecodeNewlines: options.shouldDecodeNewlines,
  40975. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  40976. shouldKeepComment: options.comments,
  40977. outputSourceRange: options.outputSourceRange,
  40978. start: function start (tag, attrs, unary, start$1) {
  40979. // check namespace.
  40980. // inherit parent ns if there is one
  40981. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  40982. // handle IE svg bug
  40983. /* istanbul ignore if */
  40984. if (isIE && ns === 'svg') {
  40985. attrs = guardIESVGBug(attrs);
  40986. }
  40987. var element = createASTElement(tag, attrs, currentParent);
  40988. if (ns) {
  40989. element.ns = ns;
  40990. }
  40991. {
  40992. if (options.outputSourceRange) {
  40993. element.start = start$1;
  40994. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  40995. cumulated[attr.name] = attr;
  40996. return cumulated
  40997. }, {});
  40998. }
  40999. attrs.forEach(function (attr) {
  41000. if (invalidAttributeRE.test(attr.name)) {
  41001. warn$2(
  41002. "Invalid dynamic argument expression: attribute names cannot contain " +
  41003. "spaces, quotes, <, >, / or =.",
  41004. {
  41005. start: attr.start + attr.name.indexOf("["),
  41006. end: attr.start + attr.name.length
  41007. }
  41008. );
  41009. }
  41010. });
  41011. }
  41012. if (isForbiddenTag(element) && !isServerRendering()) {
  41013. element.forbidden = true;
  41014. warn$2(
  41015. 'Templates should only be responsible for mapping the state to the ' +
  41016. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  41017. "<" + tag + ">" + ', as they will not be parsed.',
  41018. { start: element.start }
  41019. );
  41020. }
  41021. // apply pre-transforms
  41022. for (var i = 0; i < preTransforms.length; i++) {
  41023. element = preTransforms[i](element, options) || element;
  41024. }
  41025. if (!inVPre) {
  41026. processPre(element);
  41027. if (element.pre) {
  41028. inVPre = true;
  41029. }
  41030. }
  41031. if (platformIsPreTag(element.tag)) {
  41032. inPre = true;
  41033. }
  41034. if (inVPre) {
  41035. processRawAttrs(element);
  41036. } else if (!element.processed) {
  41037. // structural directives
  41038. processFor(element);
  41039. processIf(element);
  41040. processOnce(element);
  41041. }
  41042. if (!root) {
  41043. root = element;
  41044. {
  41045. checkRootConstraints(root);
  41046. }
  41047. }
  41048. if (!unary) {
  41049. currentParent = element;
  41050. stack.push(element);
  41051. } else {
  41052. closeElement(element);
  41053. }
  41054. },
  41055. end: function end (tag, start, end$1) {
  41056. var element = stack[stack.length - 1];
  41057. // pop stack
  41058. stack.length -= 1;
  41059. currentParent = stack[stack.length - 1];
  41060. if (options.outputSourceRange) {
  41061. element.end = end$1;
  41062. }
  41063. closeElement(element);
  41064. },
  41065. chars: function chars (text, start, end) {
  41066. if (!currentParent) {
  41067. {
  41068. if (text === template) {
  41069. warnOnce(
  41070. 'Component template requires a root element, rather than just text.',
  41071. { start: start }
  41072. );
  41073. } else if ((text = text.trim())) {
  41074. warnOnce(
  41075. ("text \"" + text + "\" outside root element will be ignored."),
  41076. { start: start }
  41077. );
  41078. }
  41079. }
  41080. return
  41081. }
  41082. // IE textarea placeholder bug
  41083. /* istanbul ignore if */
  41084. if (isIE &&
  41085. currentParent.tag === 'textarea' &&
  41086. currentParent.attrsMap.placeholder === text
  41087. ) {
  41088. return
  41089. }
  41090. var children = currentParent.children;
  41091. if (inPre || text.trim()) {
  41092. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  41093. } else if (!children.length) {
  41094. // remove the whitespace-only node right after an opening tag
  41095. text = '';
  41096. } else if (whitespaceOption) {
  41097. if (whitespaceOption === 'condense') {
  41098. // in condense mode, remove the whitespace node if it contains
  41099. // line break, otherwise condense to a single space
  41100. text = lineBreakRE.test(text) ? '' : ' ';
  41101. } else {
  41102. text = ' ';
  41103. }
  41104. } else {
  41105. text = preserveWhitespace ? ' ' : '';
  41106. }
  41107. if (text) {
  41108. if (whitespaceOption === 'condense') {
  41109. // condense consecutive whitespaces into single space
  41110. text = text.replace(whitespaceRE$1, ' ');
  41111. }
  41112. var res;
  41113. var child;
  41114. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  41115. child = {
  41116. type: 2,
  41117. expression: res.expression,
  41118. tokens: res.tokens,
  41119. text: text
  41120. };
  41121. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  41122. child = {
  41123. type: 3,
  41124. text: text
  41125. };
  41126. }
  41127. if (child) {
  41128. if (options.outputSourceRange) {
  41129. child.start = start;
  41130. child.end = end;
  41131. }
  41132. children.push(child);
  41133. }
  41134. }
  41135. },
  41136. comment: function comment (text, start, end) {
  41137. // adding anyting as a sibling to the root node is forbidden
  41138. // comments should still be allowed, but ignored
  41139. if (currentParent) {
  41140. var child = {
  41141. type: 3,
  41142. text: text,
  41143. isComment: true
  41144. };
  41145. if (options.outputSourceRange) {
  41146. child.start = start;
  41147. child.end = end;
  41148. }
  41149. currentParent.children.push(child);
  41150. }
  41151. }
  41152. });
  41153. return root
  41154. }
  41155. function processPre (el) {
  41156. if (getAndRemoveAttr(el, 'v-pre') != null) {
  41157. el.pre = true;
  41158. }
  41159. }
  41160. function processRawAttrs (el) {
  41161. var list = el.attrsList;
  41162. var len = list.length;
  41163. if (len) {
  41164. var attrs = el.attrs = new Array(len);
  41165. for (var i = 0; i < len; i++) {
  41166. attrs[i] = {
  41167. name: list[i].name,
  41168. value: JSON.stringify(list[i].value)
  41169. };
  41170. if (list[i].start != null) {
  41171. attrs[i].start = list[i].start;
  41172. attrs[i].end = list[i].end;
  41173. }
  41174. }
  41175. } else if (!el.pre) {
  41176. // non root node in pre blocks with no attributes
  41177. el.plain = true;
  41178. }
  41179. }
  41180. function processElement (
  41181. element,
  41182. options
  41183. ) {
  41184. processKey(element);
  41185. // determine whether this is a plain element after
  41186. // removing structural attributes
  41187. element.plain = (
  41188. !element.key &&
  41189. !element.scopedSlots &&
  41190. !element.attrsList.length
  41191. );
  41192. processRef(element);
  41193. processSlotContent(element);
  41194. processSlotOutlet(element);
  41195. processComponent(element);
  41196. for (var i = 0; i < transforms.length; i++) {
  41197. element = transforms[i](element, options) || element;
  41198. }
  41199. processAttrs(element);
  41200. return element
  41201. }
  41202. function processKey (el) {
  41203. var exp = getBindingAttr(el, 'key');
  41204. if (exp) {
  41205. {
  41206. if (el.tag === 'template') {
  41207. warn$2(
  41208. "<template> cannot be keyed. Place the key on real elements instead.",
  41209. getRawBindingAttr(el, 'key')
  41210. );
  41211. }
  41212. if (el.for) {
  41213. var iterator = el.iterator2 || el.iterator1;
  41214. var parent = el.parent;
  41215. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  41216. warn$2(
  41217. "Do not use v-for index as key on <transition-group> children, " +
  41218. "this is the same as not using keys.",
  41219. getRawBindingAttr(el, 'key'),
  41220. true /* tip */
  41221. );
  41222. }
  41223. }
  41224. }
  41225. el.key = exp;
  41226. }
  41227. }
  41228. function processRef (el) {
  41229. var ref = getBindingAttr(el, 'ref');
  41230. if (ref) {
  41231. el.ref = ref;
  41232. el.refInFor = checkInFor(el);
  41233. }
  41234. }
  41235. function processFor (el) {
  41236. var exp;
  41237. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  41238. var res = parseFor(exp);
  41239. if (res) {
  41240. extend(el, res);
  41241. } else {
  41242. warn$2(
  41243. ("Invalid v-for expression: " + exp),
  41244. el.rawAttrsMap['v-for']
  41245. );
  41246. }
  41247. }
  41248. }
  41249. function parseFor (exp) {
  41250. var inMatch = exp.match(forAliasRE);
  41251. if (!inMatch) { return }
  41252. var res = {};
  41253. res.for = inMatch[2].trim();
  41254. var alias = inMatch[1].trim().replace(stripParensRE, '');
  41255. var iteratorMatch = alias.match(forIteratorRE);
  41256. if (iteratorMatch) {
  41257. res.alias = alias.replace(forIteratorRE, '').trim();
  41258. res.iterator1 = iteratorMatch[1].trim();
  41259. if (iteratorMatch[2]) {
  41260. res.iterator2 = iteratorMatch[2].trim();
  41261. }
  41262. } else {
  41263. res.alias = alias;
  41264. }
  41265. return res
  41266. }
  41267. function processIf (el) {
  41268. var exp = getAndRemoveAttr(el, 'v-if');
  41269. if (exp) {
  41270. el.if = exp;
  41271. addIfCondition(el, {
  41272. exp: exp,
  41273. block: el
  41274. });
  41275. } else {
  41276. if (getAndRemoveAttr(el, 'v-else') != null) {
  41277. el.else = true;
  41278. }
  41279. var elseif = getAndRemoveAttr(el, 'v-else-if');
  41280. if (elseif) {
  41281. el.elseif = elseif;
  41282. }
  41283. }
  41284. }
  41285. function processIfConditions (el, parent) {
  41286. var prev = findPrevElement(parent.children);
  41287. if (prev && prev.if) {
  41288. addIfCondition(prev, {
  41289. exp: el.elseif,
  41290. block: el
  41291. });
  41292. } else {
  41293. warn$2(
  41294. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  41295. "used on element <" + (el.tag) + "> without corresponding v-if.",
  41296. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  41297. );
  41298. }
  41299. }
  41300. function findPrevElement (children) {
  41301. var i = children.length;
  41302. while (i--) {
  41303. if (children[i].type === 1) {
  41304. return children[i]
  41305. } else {
  41306. if (children[i].text !== ' ') {
  41307. warn$2(
  41308. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  41309. "will be ignored.",
  41310. children[i]
  41311. );
  41312. }
  41313. children.pop();
  41314. }
  41315. }
  41316. }
  41317. function addIfCondition (el, condition) {
  41318. if (!el.ifConditions) {
  41319. el.ifConditions = [];
  41320. }
  41321. el.ifConditions.push(condition);
  41322. }
  41323. function processOnce (el) {
  41324. var once$$1 = getAndRemoveAttr(el, 'v-once');
  41325. if (once$$1 != null) {
  41326. el.once = true;
  41327. }
  41328. }
  41329. // handle content being passed to a component as slot,
  41330. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  41331. function processSlotContent (el) {
  41332. var slotScope;
  41333. if (el.tag === 'template') {
  41334. slotScope = getAndRemoveAttr(el, 'scope');
  41335. /* istanbul ignore if */
  41336. if (slotScope) {
  41337. warn$2(
  41338. "the \"scope\" attribute for scoped slots have been deprecated and " +
  41339. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  41340. "can also be used on plain elements in addition to <template> to " +
  41341. "denote scoped slots.",
  41342. el.rawAttrsMap['scope'],
  41343. true
  41344. );
  41345. }
  41346. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  41347. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  41348. /* istanbul ignore if */
  41349. if (el.attrsMap['v-for']) {
  41350. warn$2(
  41351. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  41352. "(v-for takes higher priority). Use a wrapper <template> for the " +
  41353. "scoped slot to make it clearer.",
  41354. el.rawAttrsMap['slot-scope'],
  41355. true
  41356. );
  41357. }
  41358. el.slotScope = slotScope;
  41359. }
  41360. // slot="xxx"
  41361. var slotTarget = getBindingAttr(el, 'slot');
  41362. if (slotTarget) {
  41363. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  41364. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  41365. // preserve slot as an attribute for native shadow DOM compat
  41366. // only for non-scoped slots.
  41367. if (el.tag !== 'template' && !el.slotScope) {
  41368. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  41369. }
  41370. }
  41371. // 2.6 v-slot syntax
  41372. {
  41373. if (el.tag === 'template') {
  41374. // v-slot on <template>
  41375. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  41376. if (slotBinding) {
  41377. {
  41378. if (el.slotTarget || el.slotScope) {
  41379. warn$2(
  41380. "Unexpected mixed usage of different slot syntaxes.",
  41381. el
  41382. );
  41383. }
  41384. if (el.parent && !maybeComponent(el.parent)) {
  41385. warn$2(
  41386. "<template v-slot> can only appear at the root level inside " +
  41387. "the receiving the component",
  41388. el
  41389. );
  41390. }
  41391. }
  41392. var ref = getSlotName(slotBinding);
  41393. var name = ref.name;
  41394. var dynamic = ref.dynamic;
  41395. el.slotTarget = name;
  41396. el.slotTargetDynamic = dynamic;
  41397. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  41398. }
  41399. } else {
  41400. // v-slot on component, denotes default slot
  41401. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  41402. if (slotBinding$1) {
  41403. {
  41404. if (!maybeComponent(el)) {
  41405. warn$2(
  41406. "v-slot can only be used on components or <template>.",
  41407. slotBinding$1
  41408. );
  41409. }
  41410. if (el.slotScope || el.slotTarget) {
  41411. warn$2(
  41412. "Unexpected mixed usage of different slot syntaxes.",
  41413. el
  41414. );
  41415. }
  41416. if (el.scopedSlots) {
  41417. warn$2(
  41418. "To avoid scope ambiguity, the default slot should also use " +
  41419. "<template> syntax when there are other named slots.",
  41420. slotBinding$1
  41421. );
  41422. }
  41423. }
  41424. // add the component's children to its default slot
  41425. var slots = el.scopedSlots || (el.scopedSlots = {});
  41426. var ref$1 = getSlotName(slotBinding$1);
  41427. var name$1 = ref$1.name;
  41428. var dynamic$1 = ref$1.dynamic;
  41429. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  41430. slotContainer.slotTarget = name$1;
  41431. slotContainer.slotTargetDynamic = dynamic$1;
  41432. slotContainer.children = el.children.filter(function (c) {
  41433. if (!c.slotScope) {
  41434. c.parent = slotContainer;
  41435. return true
  41436. }
  41437. });
  41438. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  41439. // remove children as they are returned from scopedSlots now
  41440. el.children = [];
  41441. // mark el non-plain so data gets generated
  41442. el.plain = false;
  41443. }
  41444. }
  41445. }
  41446. }
  41447. function getSlotName (binding) {
  41448. var name = binding.name.replace(slotRE, '');
  41449. if (!name) {
  41450. if (binding.name[0] !== '#') {
  41451. name = 'default';
  41452. } else {
  41453. warn$2(
  41454. "v-slot shorthand syntax requires a slot name.",
  41455. binding
  41456. );
  41457. }
  41458. }
  41459. return dynamicArgRE.test(name)
  41460. // dynamic [name]
  41461. ? { name: name.slice(1, -1), dynamic: true }
  41462. // static name
  41463. : { name: ("\"" + name + "\""), dynamic: false }
  41464. }
  41465. // handle <slot/> outlets
  41466. function processSlotOutlet (el) {
  41467. if (el.tag === 'slot') {
  41468. el.slotName = getBindingAttr(el, 'name');
  41469. if (el.key) {
  41470. warn$2(
  41471. "`key` does not work on <slot> because slots are abstract outlets " +
  41472. "and can possibly expand into multiple elements. " +
  41473. "Use the key on a wrapping element instead.",
  41474. getRawBindingAttr(el, 'key')
  41475. );
  41476. }
  41477. }
  41478. }
  41479. function processComponent (el) {
  41480. var binding;
  41481. if ((binding = getBindingAttr(el, 'is'))) {
  41482. el.component = binding;
  41483. }
  41484. if (getAndRemoveAttr(el, 'inline-template') != null) {
  41485. el.inlineTemplate = true;
  41486. }
  41487. }
  41488. function processAttrs (el) {
  41489. var list = el.attrsList;
  41490. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  41491. for (i = 0, l = list.length; i < l; i++) {
  41492. name = rawName = list[i].name;
  41493. value = list[i].value;
  41494. if (dirRE.test(name)) {
  41495. // mark element as dynamic
  41496. el.hasBindings = true;
  41497. // modifiers
  41498. modifiers = parseModifiers(name.replace(dirRE, ''));
  41499. // support .foo shorthand syntax for the .prop modifier
  41500. if (modifiers) {
  41501. name = name.replace(modifierRE, '');
  41502. }
  41503. if (bindRE.test(name)) { // v-bind
  41504. name = name.replace(bindRE, '');
  41505. value = parseFilters(value);
  41506. isDynamic = dynamicArgRE.test(name);
  41507. if (isDynamic) {
  41508. name = name.slice(1, -1);
  41509. }
  41510. if (
  41511. value.trim().length === 0
  41512. ) {
  41513. warn$2(
  41514. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  41515. );
  41516. }
  41517. if (modifiers) {
  41518. if (modifiers.prop && !isDynamic) {
  41519. name = camelize(name);
  41520. if (name === 'innerHtml') { name = 'innerHTML'; }
  41521. }
  41522. if (modifiers.camel && !isDynamic) {
  41523. name = camelize(name);
  41524. }
  41525. if (modifiers.sync) {
  41526. syncGen = genAssignmentCode(value, "$event");
  41527. if (!isDynamic) {
  41528. addHandler(
  41529. el,
  41530. ("update:" + (camelize(name))),
  41531. syncGen,
  41532. null,
  41533. false,
  41534. warn$2,
  41535. list[i]
  41536. );
  41537. if (hyphenate(name) !== camelize(name)) {
  41538. addHandler(
  41539. el,
  41540. ("update:" + (hyphenate(name))),
  41541. syncGen,
  41542. null,
  41543. false,
  41544. warn$2,
  41545. list[i]
  41546. );
  41547. }
  41548. } else {
  41549. // handler w/ dynamic event name
  41550. addHandler(
  41551. el,
  41552. ("\"update:\"+(" + name + ")"),
  41553. syncGen,
  41554. null,
  41555. false,
  41556. warn$2,
  41557. list[i],
  41558. true // dynamic
  41559. );
  41560. }
  41561. }
  41562. }
  41563. if ((modifiers && modifiers.prop) || (
  41564. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  41565. )) {
  41566. addProp(el, name, value, list[i], isDynamic);
  41567. } else {
  41568. addAttr(el, name, value, list[i], isDynamic);
  41569. }
  41570. } else if (onRE.test(name)) { // v-on
  41571. name = name.replace(onRE, '');
  41572. isDynamic = dynamicArgRE.test(name);
  41573. if (isDynamic) {
  41574. name = name.slice(1, -1);
  41575. }
  41576. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  41577. } else { // normal directives
  41578. name = name.replace(dirRE, '');
  41579. // parse arg
  41580. var argMatch = name.match(argRE);
  41581. var arg = argMatch && argMatch[1];
  41582. isDynamic = false;
  41583. if (arg) {
  41584. name = name.slice(0, -(arg.length + 1));
  41585. if (dynamicArgRE.test(arg)) {
  41586. arg = arg.slice(1, -1);
  41587. isDynamic = true;
  41588. }
  41589. }
  41590. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  41591. if (name === 'model') {
  41592. checkForAliasModel(el, value);
  41593. }
  41594. }
  41595. } else {
  41596. // literal attribute
  41597. {
  41598. var res = parseText(value, delimiters);
  41599. if (res) {
  41600. warn$2(
  41601. name + "=\"" + value + "\": " +
  41602. 'Interpolation inside attributes has been removed. ' +
  41603. 'Use v-bind or the colon shorthand instead. For example, ' +
  41604. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  41605. list[i]
  41606. );
  41607. }
  41608. }
  41609. addAttr(el, name, JSON.stringify(value), list[i]);
  41610. // #6887 firefox doesn't update muted state if set via attribute
  41611. // even immediately after element creation
  41612. if (!el.component &&
  41613. name === 'muted' &&
  41614. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  41615. addProp(el, name, 'true', list[i]);
  41616. }
  41617. }
  41618. }
  41619. }
  41620. function checkInFor (el) {
  41621. var parent = el;
  41622. while (parent) {
  41623. if (parent.for !== undefined) {
  41624. return true
  41625. }
  41626. parent = parent.parent;
  41627. }
  41628. return false
  41629. }
  41630. function parseModifiers (name) {
  41631. var match = name.match(modifierRE);
  41632. if (match) {
  41633. var ret = {};
  41634. match.forEach(function (m) { ret[m.slice(1)] = true; });
  41635. return ret
  41636. }
  41637. }
  41638. function makeAttrsMap (attrs) {
  41639. var map = {};
  41640. for (var i = 0, l = attrs.length; i < l; i++) {
  41641. if (
  41642. map[attrs[i].name] && !isIE && !isEdge
  41643. ) {
  41644. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  41645. }
  41646. map[attrs[i].name] = attrs[i].value;
  41647. }
  41648. return map
  41649. }
  41650. // for script (e.g. type="x/template") or style, do not decode content
  41651. function isTextTag (el) {
  41652. return el.tag === 'script' || el.tag === 'style'
  41653. }
  41654. function isForbiddenTag (el) {
  41655. return (
  41656. el.tag === 'style' ||
  41657. (el.tag === 'script' && (
  41658. !el.attrsMap.type ||
  41659. el.attrsMap.type === 'text/javascript'
  41660. ))
  41661. )
  41662. }
  41663. var ieNSBug = /^xmlns:NS\d+/;
  41664. var ieNSPrefix = /^NS\d+:/;
  41665. /* istanbul ignore next */
  41666. function guardIESVGBug (attrs) {
  41667. var res = [];
  41668. for (var i = 0; i < attrs.length; i++) {
  41669. var attr = attrs[i];
  41670. if (!ieNSBug.test(attr.name)) {
  41671. attr.name = attr.name.replace(ieNSPrefix, '');
  41672. res.push(attr);
  41673. }
  41674. }
  41675. return res
  41676. }
  41677. function checkForAliasModel (el, value) {
  41678. var _el = el;
  41679. while (_el) {
  41680. if (_el.for && _el.alias === value) {
  41681. warn$2(
  41682. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  41683. "You are binding v-model directly to a v-for iteration alias. " +
  41684. "This will not be able to modify the v-for source array because " +
  41685. "writing to the alias is like modifying a function local variable. " +
  41686. "Consider using an array of objects and use v-model on an object property instead.",
  41687. el.rawAttrsMap['v-model']
  41688. );
  41689. }
  41690. _el = _el.parent;
  41691. }
  41692. }
  41693. /* */
  41694. function preTransformNode (el, options) {
  41695. if (el.tag === 'input') {
  41696. var map = el.attrsMap;
  41697. if (!map['v-model']) {
  41698. return
  41699. }
  41700. var typeBinding;
  41701. if (map[':type'] || map['v-bind:type']) {
  41702. typeBinding = getBindingAttr(el, 'type');
  41703. }
  41704. if (!map.type && !typeBinding && map['v-bind']) {
  41705. typeBinding = "(" + (map['v-bind']) + ").type";
  41706. }
  41707. if (typeBinding) {
  41708. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  41709. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  41710. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  41711. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  41712. // 1. checkbox
  41713. var branch0 = cloneASTElement(el);
  41714. // process for on the main node
  41715. processFor(branch0);
  41716. addRawAttr(branch0, 'type', 'checkbox');
  41717. processElement(branch0, options);
  41718. branch0.processed = true; // prevent it from double-processed
  41719. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  41720. addIfCondition(branch0, {
  41721. exp: branch0.if,
  41722. block: branch0
  41723. });
  41724. // 2. add radio else-if condition
  41725. var branch1 = cloneASTElement(el);
  41726. getAndRemoveAttr(branch1, 'v-for', true);
  41727. addRawAttr(branch1, 'type', 'radio');
  41728. processElement(branch1, options);
  41729. addIfCondition(branch0, {
  41730. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  41731. block: branch1
  41732. });
  41733. // 3. other
  41734. var branch2 = cloneASTElement(el);
  41735. getAndRemoveAttr(branch2, 'v-for', true);
  41736. addRawAttr(branch2, ':type', typeBinding);
  41737. processElement(branch2, options);
  41738. addIfCondition(branch0, {
  41739. exp: ifCondition,
  41740. block: branch2
  41741. });
  41742. if (hasElse) {
  41743. branch0.else = true;
  41744. } else if (elseIfCondition) {
  41745. branch0.elseif = elseIfCondition;
  41746. }
  41747. return branch0
  41748. }
  41749. }
  41750. }
  41751. function cloneASTElement (el) {
  41752. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  41753. }
  41754. var model$1 = {
  41755. preTransformNode: preTransformNode
  41756. };
  41757. var modules$1 = [
  41758. klass$1,
  41759. style$1,
  41760. model$1
  41761. ];
  41762. /* */
  41763. function text (el, dir) {
  41764. if (dir.value) {
  41765. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  41766. }
  41767. }
  41768. /* */
  41769. function html (el, dir) {
  41770. if (dir.value) {
  41771. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  41772. }
  41773. }
  41774. var directives$1 = {
  41775. model: model,
  41776. text: text,
  41777. html: html
  41778. };
  41779. /* */
  41780. var baseOptions = {
  41781. expectHTML: true,
  41782. modules: modules$1,
  41783. directives: directives$1,
  41784. isPreTag: isPreTag,
  41785. isUnaryTag: isUnaryTag,
  41786. mustUseProp: mustUseProp,
  41787. canBeLeftOpenTag: canBeLeftOpenTag,
  41788. isReservedTag: isReservedTag,
  41789. getTagNamespace: getTagNamespace,
  41790. staticKeys: genStaticKeys(modules$1)
  41791. };
  41792. /* */
  41793. var isStaticKey;
  41794. var isPlatformReservedTag;
  41795. var genStaticKeysCached = cached(genStaticKeys$1);
  41796. /**
  41797. * Goal of the optimizer: walk the generated template AST tree
  41798. * and detect sub-trees that are purely static, i.e. parts of
  41799. * the DOM that never needs to change.
  41800. *
  41801. * Once we detect these sub-trees, we can:
  41802. *
  41803. * 1. Hoist them into constants, so that we no longer need to
  41804. * create fresh nodes for them on each re-render;
  41805. * 2. Completely skip them in the patching process.
  41806. */
  41807. function optimize (root, options) {
  41808. if (!root) { return }
  41809. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  41810. isPlatformReservedTag = options.isReservedTag || no;
  41811. // first pass: mark all non-static nodes.
  41812. markStatic$1(root);
  41813. // second pass: mark static roots.
  41814. markStaticRoots(root, false);
  41815. }
  41816. function genStaticKeys$1 (keys) {
  41817. return makeMap(
  41818. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  41819. (keys ? ',' + keys : '')
  41820. )
  41821. }
  41822. function markStatic$1 (node) {
  41823. node.static = isStatic(node);
  41824. if (node.type === 1) {
  41825. // do not make component slot content static. this avoids
  41826. // 1. components not able to mutate slot nodes
  41827. // 2. static slot content fails for hot-reloading
  41828. if (
  41829. !isPlatformReservedTag(node.tag) &&
  41830. node.tag !== 'slot' &&
  41831. node.attrsMap['inline-template'] == null
  41832. ) {
  41833. return
  41834. }
  41835. for (var i = 0, l = node.children.length; i < l; i++) {
  41836. var child = node.children[i];
  41837. markStatic$1(child);
  41838. if (!child.static) {
  41839. node.static = false;
  41840. }
  41841. }
  41842. if (node.ifConditions) {
  41843. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  41844. var block = node.ifConditions[i$1].block;
  41845. markStatic$1(block);
  41846. if (!block.static) {
  41847. node.static = false;
  41848. }
  41849. }
  41850. }
  41851. }
  41852. }
  41853. function markStaticRoots (node, isInFor) {
  41854. if (node.type === 1) {
  41855. if (node.static || node.once) {
  41856. node.staticInFor = isInFor;
  41857. }
  41858. // For a node to qualify as a static root, it should have children that
  41859. // are not just static text. Otherwise the cost of hoisting out will
  41860. // outweigh the benefits and it's better off to just always render it fresh.
  41861. if (node.static && node.children.length && !(
  41862. node.children.length === 1 &&
  41863. node.children[0].type === 3
  41864. )) {
  41865. node.staticRoot = true;
  41866. return
  41867. } else {
  41868. node.staticRoot = false;
  41869. }
  41870. if (node.children) {
  41871. for (var i = 0, l = node.children.length; i < l; i++) {
  41872. markStaticRoots(node.children[i], isInFor || !!node.for);
  41873. }
  41874. }
  41875. if (node.ifConditions) {
  41876. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  41877. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  41878. }
  41879. }
  41880. }
  41881. }
  41882. function isStatic (node) {
  41883. if (node.type === 2) { // expression
  41884. return false
  41885. }
  41886. if (node.type === 3) { // text
  41887. return true
  41888. }
  41889. return !!(node.pre || (
  41890. !node.hasBindings && // no dynamic bindings
  41891. !node.if && !node.for && // not v-if or v-for or v-else
  41892. !isBuiltInTag(node.tag) && // not a built-in
  41893. isPlatformReservedTag(node.tag) && // not a component
  41894. !isDirectChildOfTemplateFor(node) &&
  41895. Object.keys(node).every(isStaticKey)
  41896. ))
  41897. }
  41898. function isDirectChildOfTemplateFor (node) {
  41899. while (node.parent) {
  41900. node = node.parent;
  41901. if (node.tag !== 'template') {
  41902. return false
  41903. }
  41904. if (node.for) {
  41905. return true
  41906. }
  41907. }
  41908. return false
  41909. }
  41910. /* */
  41911. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
  41912. var fnInvokeRE = /\([^)]*?\);*$/;
  41913. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  41914. // KeyboardEvent.keyCode aliases
  41915. var keyCodes = {
  41916. esc: 27,
  41917. tab: 9,
  41918. enter: 13,
  41919. space: 32,
  41920. up: 38,
  41921. left: 37,
  41922. right: 39,
  41923. down: 40,
  41924. 'delete': [8, 46]
  41925. };
  41926. // KeyboardEvent.key aliases
  41927. var keyNames = {
  41928. // #7880: IE11 and Edge use `Esc` for Escape key name.
  41929. esc: ['Esc', 'Escape'],
  41930. tab: 'Tab',
  41931. enter: 'Enter',
  41932. // #9112: IE11 uses `Spacebar` for Space key name.
  41933. space: [' ', 'Spacebar'],
  41934. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  41935. up: ['Up', 'ArrowUp'],
  41936. left: ['Left', 'ArrowLeft'],
  41937. right: ['Right', 'ArrowRight'],
  41938. down: ['Down', 'ArrowDown'],
  41939. // #9112: IE11 uses `Del` for Delete key name.
  41940. 'delete': ['Backspace', 'Delete', 'Del']
  41941. };
  41942. // #4868: modifiers that prevent the execution of the listener
  41943. // need to explicitly return null so that we can determine whether to remove
  41944. // the listener for .once
  41945. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  41946. var modifierCode = {
  41947. stop: '$event.stopPropagation();',
  41948. prevent: '$event.preventDefault();',
  41949. self: genGuard("$event.target !== $event.currentTarget"),
  41950. ctrl: genGuard("!$event.ctrlKey"),
  41951. shift: genGuard("!$event.shiftKey"),
  41952. alt: genGuard("!$event.altKey"),
  41953. meta: genGuard("!$event.metaKey"),
  41954. left: genGuard("'button' in $event && $event.button !== 0"),
  41955. middle: genGuard("'button' in $event && $event.button !== 1"),
  41956. right: genGuard("'button' in $event && $event.button !== 2")
  41957. };
  41958. function genHandlers (
  41959. events,
  41960. isNative
  41961. ) {
  41962. var prefix = isNative ? 'nativeOn:' : 'on:';
  41963. var staticHandlers = "";
  41964. var dynamicHandlers = "";
  41965. for (var name in events) {
  41966. var handlerCode = genHandler(events[name]);
  41967. if (events[name] && events[name].dynamic) {
  41968. dynamicHandlers += name + "," + handlerCode + ",";
  41969. } else {
  41970. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  41971. }
  41972. }
  41973. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  41974. if (dynamicHandlers) {
  41975. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  41976. } else {
  41977. return prefix + staticHandlers
  41978. }
  41979. }
  41980. function genHandler (handler) {
  41981. if (!handler) {
  41982. return 'function(){}'
  41983. }
  41984. if (Array.isArray(handler)) {
  41985. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  41986. }
  41987. var isMethodPath = simplePathRE.test(handler.value);
  41988. var isFunctionExpression = fnExpRE.test(handler.value);
  41989. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  41990. if (!handler.modifiers) {
  41991. if (isMethodPath || isFunctionExpression) {
  41992. return handler.value
  41993. }
  41994. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  41995. } else {
  41996. var code = '';
  41997. var genModifierCode = '';
  41998. var keys = [];
  41999. for (var key in handler.modifiers) {
  42000. if (modifierCode[key]) {
  42001. genModifierCode += modifierCode[key];
  42002. // left/right
  42003. if (keyCodes[key]) {
  42004. keys.push(key);
  42005. }
  42006. } else if (key === 'exact') {
  42007. var modifiers = (handler.modifiers);
  42008. genModifierCode += genGuard(
  42009. ['ctrl', 'shift', 'alt', 'meta']
  42010. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  42011. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  42012. .join('||')
  42013. );
  42014. } else {
  42015. keys.push(key);
  42016. }
  42017. }
  42018. if (keys.length) {
  42019. code += genKeyFilter(keys);
  42020. }
  42021. // Make sure modifiers like prevent and stop get executed after key filtering
  42022. if (genModifierCode) {
  42023. code += genModifierCode;
  42024. }
  42025. var handlerCode = isMethodPath
  42026. ? ("return " + (handler.value) + "($event)")
  42027. : isFunctionExpression
  42028. ? ("return (" + (handler.value) + ")($event)")
  42029. : isFunctionInvocation
  42030. ? ("return " + (handler.value))
  42031. : handler.value;
  42032. return ("function($event){" + code + handlerCode + "}")
  42033. }
  42034. }
  42035. function genKeyFilter (keys) {
  42036. return (
  42037. // make sure the key filters only apply to KeyboardEvents
  42038. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  42039. // key events that do not have keyCode property...
  42040. "if(!$event.type.indexOf('key')&&" +
  42041. (keys.map(genFilterCode).join('&&')) + ")return null;"
  42042. )
  42043. }
  42044. function genFilterCode (key) {
  42045. var keyVal = parseInt(key, 10);
  42046. if (keyVal) {
  42047. return ("$event.keyCode!==" + keyVal)
  42048. }
  42049. var keyCode = keyCodes[key];
  42050. var keyName = keyNames[key];
  42051. return (
  42052. "_k($event.keyCode," +
  42053. (JSON.stringify(key)) + "," +
  42054. (JSON.stringify(keyCode)) + "," +
  42055. "$event.key," +
  42056. "" + (JSON.stringify(keyName)) +
  42057. ")"
  42058. )
  42059. }
  42060. /* */
  42061. function on (el, dir) {
  42062. if (dir.modifiers) {
  42063. warn("v-on without argument does not support modifiers.");
  42064. }
  42065. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  42066. }
  42067. /* */
  42068. function bind$1 (el, dir) {
  42069. el.wrapData = function (code) {
  42070. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  42071. };
  42072. }
  42073. /* */
  42074. var baseDirectives = {
  42075. on: on,
  42076. bind: bind$1,
  42077. cloak: noop
  42078. };
  42079. /* */
  42080. var CodegenState = function CodegenState (options) {
  42081. this.options = options;
  42082. this.warn = options.warn || baseWarn;
  42083. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  42084. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  42085. this.directives = extend(extend({}, baseDirectives), options.directives);
  42086. var isReservedTag = options.isReservedTag || no;
  42087. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  42088. this.onceId = 0;
  42089. this.staticRenderFns = [];
  42090. this.pre = false;
  42091. };
  42092. function generate (
  42093. ast,
  42094. options
  42095. ) {
  42096. var state = new CodegenState(options);
  42097. var code = ast ? genElement(ast, state) : '_c("div")';
  42098. return {
  42099. render: ("with(this){return " + code + "}"),
  42100. staticRenderFns: state.staticRenderFns
  42101. }
  42102. }
  42103. function genElement (el, state) {
  42104. if (el.parent) {
  42105. el.pre = el.pre || el.parent.pre;
  42106. }
  42107. if (el.staticRoot && !el.staticProcessed) {
  42108. return genStatic(el, state)
  42109. } else if (el.once && !el.onceProcessed) {
  42110. return genOnce(el, state)
  42111. } else if (el.for && !el.forProcessed) {
  42112. return genFor(el, state)
  42113. } else if (el.if && !el.ifProcessed) {
  42114. return genIf(el, state)
  42115. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  42116. return genChildren(el, state) || 'void 0'
  42117. } else if (el.tag === 'slot') {
  42118. return genSlot(el, state)
  42119. } else {
  42120. // component or element
  42121. var code;
  42122. if (el.component) {
  42123. code = genComponent(el.component, el, state);
  42124. } else {
  42125. var data;
  42126. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  42127. data = genData$2(el, state);
  42128. }
  42129. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  42130. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  42131. }
  42132. // module transforms
  42133. for (var i = 0; i < state.transforms.length; i++) {
  42134. code = state.transforms[i](el, code);
  42135. }
  42136. return code
  42137. }
  42138. }
  42139. // hoist static sub-trees out
  42140. function genStatic (el, state) {
  42141. el.staticProcessed = true;
  42142. // Some elements (templates) need to behave differently inside of a v-pre
  42143. // node. All pre nodes are static roots, so we can use this as a location to
  42144. // wrap a state change and reset it upon exiting the pre node.
  42145. var originalPreState = state.pre;
  42146. if (el.pre) {
  42147. state.pre = el.pre;
  42148. }
  42149. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  42150. state.pre = originalPreState;
  42151. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  42152. }
  42153. // v-once
  42154. function genOnce (el, state) {
  42155. el.onceProcessed = true;
  42156. if (el.if && !el.ifProcessed) {
  42157. return genIf(el, state)
  42158. } else if (el.staticInFor) {
  42159. var key = '';
  42160. var parent = el.parent;
  42161. while (parent) {
  42162. if (parent.for) {
  42163. key = parent.key;
  42164. break
  42165. }
  42166. parent = parent.parent;
  42167. }
  42168. if (!key) {
  42169. state.warn(
  42170. "v-once can only be used inside v-for that is keyed. ",
  42171. el.rawAttrsMap['v-once']
  42172. );
  42173. return genElement(el, state)
  42174. }
  42175. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  42176. } else {
  42177. return genStatic(el, state)
  42178. }
  42179. }
  42180. function genIf (
  42181. el,
  42182. state,
  42183. altGen,
  42184. altEmpty
  42185. ) {
  42186. el.ifProcessed = true; // avoid recursion
  42187. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  42188. }
  42189. function genIfConditions (
  42190. conditions,
  42191. state,
  42192. altGen,
  42193. altEmpty
  42194. ) {
  42195. if (!conditions.length) {
  42196. return altEmpty || '_e()'
  42197. }
  42198. var condition = conditions.shift();
  42199. if (condition.exp) {
  42200. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  42201. } else {
  42202. return ("" + (genTernaryExp(condition.block)))
  42203. }
  42204. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  42205. function genTernaryExp (el) {
  42206. return altGen
  42207. ? altGen(el, state)
  42208. : el.once
  42209. ? genOnce(el, state)
  42210. : genElement(el, state)
  42211. }
  42212. }
  42213. function genFor (
  42214. el,
  42215. state,
  42216. altGen,
  42217. altHelper
  42218. ) {
  42219. var exp = el.for;
  42220. var alias = el.alias;
  42221. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  42222. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  42223. if (state.maybeComponent(el) &&
  42224. el.tag !== 'slot' &&
  42225. el.tag !== 'template' &&
  42226. !el.key
  42227. ) {
  42228. state.warn(
  42229. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  42230. "v-for should have explicit keys. " +
  42231. "See https://vuejs.org/guide/list.html#key for more info.",
  42232. el.rawAttrsMap['v-for'],
  42233. true /* tip */
  42234. );
  42235. }
  42236. el.forProcessed = true; // avoid recursion
  42237. return (altHelper || '_l') + "((" + exp + ")," +
  42238. "function(" + alias + iterator1 + iterator2 + "){" +
  42239. "return " + ((altGen || genElement)(el, state)) +
  42240. '})'
  42241. }
  42242. function genData$2 (el, state) {
  42243. var data = '{';
  42244. // directives first.
  42245. // directives may mutate the el's other properties before they are generated.
  42246. var dirs = genDirectives(el, state);
  42247. if (dirs) { data += dirs + ','; }
  42248. // key
  42249. if (el.key) {
  42250. data += "key:" + (el.key) + ",";
  42251. }
  42252. // ref
  42253. if (el.ref) {
  42254. data += "ref:" + (el.ref) + ",";
  42255. }
  42256. if (el.refInFor) {
  42257. data += "refInFor:true,";
  42258. }
  42259. // pre
  42260. if (el.pre) {
  42261. data += "pre:true,";
  42262. }
  42263. // record original tag name for components using "is" attribute
  42264. if (el.component) {
  42265. data += "tag:\"" + (el.tag) + "\",";
  42266. }
  42267. // module data generation functions
  42268. for (var i = 0; i < state.dataGenFns.length; i++) {
  42269. data += state.dataGenFns[i](el);
  42270. }
  42271. // attributes
  42272. if (el.attrs) {
  42273. data += "attrs:" + (genProps(el.attrs)) + ",";
  42274. }
  42275. // DOM props
  42276. if (el.props) {
  42277. data += "domProps:" + (genProps(el.props)) + ",";
  42278. }
  42279. // event handlers
  42280. if (el.events) {
  42281. data += (genHandlers(el.events, false)) + ",";
  42282. }
  42283. if (el.nativeEvents) {
  42284. data += (genHandlers(el.nativeEvents, true)) + ",";
  42285. }
  42286. // slot target
  42287. // only for non-scoped slots
  42288. if (el.slotTarget && !el.slotScope) {
  42289. data += "slot:" + (el.slotTarget) + ",";
  42290. }
  42291. // scoped slots
  42292. if (el.scopedSlots) {
  42293. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  42294. }
  42295. // component v-model
  42296. if (el.model) {
  42297. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  42298. }
  42299. // inline-template
  42300. if (el.inlineTemplate) {
  42301. var inlineTemplate = genInlineTemplate(el, state);
  42302. if (inlineTemplate) {
  42303. data += inlineTemplate + ",";
  42304. }
  42305. }
  42306. data = data.replace(/,$/, '') + '}';
  42307. // v-bind dynamic argument wrap
  42308. // v-bind with dynamic arguments must be applied using the same v-bind object
  42309. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  42310. if (el.dynamicAttrs) {
  42311. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  42312. }
  42313. // v-bind data wrap
  42314. if (el.wrapData) {
  42315. data = el.wrapData(data);
  42316. }
  42317. // v-on data wrap
  42318. if (el.wrapListeners) {
  42319. data = el.wrapListeners(data);
  42320. }
  42321. return data
  42322. }
  42323. function genDirectives (el, state) {
  42324. var dirs = el.directives;
  42325. if (!dirs) { return }
  42326. var res = 'directives:[';
  42327. var hasRuntime = false;
  42328. var i, l, dir, needRuntime;
  42329. for (i = 0, l = dirs.length; i < l; i++) {
  42330. dir = dirs[i];
  42331. needRuntime = true;
  42332. var gen = state.directives[dir.name];
  42333. if (gen) {
  42334. // compile-time directive that manipulates AST.
  42335. // returns true if it also needs a runtime counterpart.
  42336. needRuntime = !!gen(el, dir, state.warn);
  42337. }
  42338. if (needRuntime) {
  42339. hasRuntime = true;
  42340. 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))) : '') + "},";
  42341. }
  42342. }
  42343. if (hasRuntime) {
  42344. return res.slice(0, -1) + ']'
  42345. }
  42346. }
  42347. function genInlineTemplate (el, state) {
  42348. var ast = el.children[0];
  42349. if (el.children.length !== 1 || ast.type !== 1) {
  42350. state.warn(
  42351. 'Inline-template components must have exactly one child element.',
  42352. { start: el.start }
  42353. );
  42354. }
  42355. if (ast && ast.type === 1) {
  42356. var inlineRenderFns = generate(ast, state.options);
  42357. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  42358. }
  42359. }
  42360. function genScopedSlots (
  42361. el,
  42362. slots,
  42363. state
  42364. ) {
  42365. // by default scoped slots are considered "stable", this allows child
  42366. // components with only scoped slots to skip forced updates from parent.
  42367. // but in some cases we have to bail-out of this optimization
  42368. // for example if the slot contains dynamic names, has v-if or v-for on them...
  42369. var needsForceUpdate = Object.keys(slots).some(function (key) {
  42370. var slot = slots[key];
  42371. return (
  42372. slot.slotTargetDynamic ||
  42373. slot.if ||
  42374. slot.for ||
  42375. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  42376. )
  42377. });
  42378. // #9534: if a component with scoped slots is inside a conditional branch,
  42379. // it's possible for the same component to be reused but with different
  42380. // compiled slot content. To avoid that, we generate a unique key based on
  42381. // the generated code of all the slot contents.
  42382. var needsKey = !!el.if;
  42383. // OR when it is inside another scoped slot or v-for (the reactivity may be
  42384. // disconnected due to the intermediate scope variable)
  42385. // #9438, #9506
  42386. // TODO: this can be further optimized by properly analyzing in-scope bindings
  42387. // and skip force updating ones that do not actually use scope variables.
  42388. if (!needsForceUpdate) {
  42389. var parent = el.parent;
  42390. while (parent) {
  42391. if (
  42392. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  42393. parent.for
  42394. ) {
  42395. needsForceUpdate = true;
  42396. break
  42397. }
  42398. if (parent.if) {
  42399. needsKey = true;
  42400. }
  42401. parent = parent.parent;
  42402. }
  42403. }
  42404. var generatedSlots = Object.keys(slots)
  42405. .map(function (key) { return genScopedSlot(slots[key], state); })
  42406. .join(',');
  42407. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  42408. }
  42409. function hash(str) {
  42410. var hash = 5381;
  42411. var i = str.length;
  42412. while(i) {
  42413. hash = (hash * 33) ^ str.charCodeAt(--i);
  42414. }
  42415. return hash >>> 0
  42416. }
  42417. function containsSlotChild (el) {
  42418. if (el.type === 1) {
  42419. if (el.tag === 'slot') {
  42420. return true
  42421. }
  42422. return el.children.some(containsSlotChild)
  42423. }
  42424. return false
  42425. }
  42426. function genScopedSlot (
  42427. el,
  42428. state
  42429. ) {
  42430. var isLegacySyntax = el.attrsMap['slot-scope'];
  42431. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  42432. return genIf(el, state, genScopedSlot, "null")
  42433. }
  42434. if (el.for && !el.forProcessed) {
  42435. return genFor(el, state, genScopedSlot)
  42436. }
  42437. var slotScope = el.slotScope === emptySlotScopeToken
  42438. ? ""
  42439. : String(el.slotScope);
  42440. var fn = "function(" + slotScope + "){" +
  42441. "return " + (el.tag === 'template'
  42442. ? el.if && isLegacySyntax
  42443. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  42444. : genChildren(el, state) || 'undefined'
  42445. : genElement(el, state)) + "}";
  42446. // reverse proxy v-slot without scope on this.$slots
  42447. var reverseProxy = slotScope ? "" : ",proxy:true";
  42448. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  42449. }
  42450. function genChildren (
  42451. el,
  42452. state,
  42453. checkSkip,
  42454. altGenElement,
  42455. altGenNode
  42456. ) {
  42457. var children = el.children;
  42458. if (children.length) {
  42459. var el$1 = children[0];
  42460. // optimize single v-for
  42461. if (children.length === 1 &&
  42462. el$1.for &&
  42463. el$1.tag !== 'template' &&
  42464. el$1.tag !== 'slot'
  42465. ) {
  42466. var normalizationType = checkSkip
  42467. ? state.maybeComponent(el$1) ? ",1" : ",0"
  42468. : "";
  42469. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  42470. }
  42471. var normalizationType$1 = checkSkip
  42472. ? getNormalizationType(children, state.maybeComponent)
  42473. : 0;
  42474. var gen = altGenNode || genNode;
  42475. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  42476. }
  42477. }
  42478. // determine the normalization needed for the children array.
  42479. // 0: no normalization needed
  42480. // 1: simple normalization needed (possible 1-level deep nested array)
  42481. // 2: full normalization needed
  42482. function getNormalizationType (
  42483. children,
  42484. maybeComponent
  42485. ) {
  42486. var res = 0;
  42487. for (var i = 0; i < children.length; i++) {
  42488. var el = children[i];
  42489. if (el.type !== 1) {
  42490. continue
  42491. }
  42492. if (needsNormalization(el) ||
  42493. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  42494. res = 2;
  42495. break
  42496. }
  42497. if (maybeComponent(el) ||
  42498. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  42499. res = 1;
  42500. }
  42501. }
  42502. return res
  42503. }
  42504. function needsNormalization (el) {
  42505. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  42506. }
  42507. function genNode (node, state) {
  42508. if (node.type === 1) {
  42509. return genElement(node, state)
  42510. } else if (node.type === 3 && node.isComment) {
  42511. return genComment(node)
  42512. } else {
  42513. return genText(node)
  42514. }
  42515. }
  42516. function genText (text) {
  42517. return ("_v(" + (text.type === 2
  42518. ? text.expression // no need for () because already wrapped in _s()
  42519. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  42520. }
  42521. function genComment (comment) {
  42522. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  42523. }
  42524. function genSlot (el, state) {
  42525. var slotName = el.slotName || '"default"';
  42526. var children = genChildren(el, state);
  42527. var res = "_t(" + slotName + (children ? ("," + children) : '');
  42528. var attrs = el.attrs || el.dynamicAttrs
  42529. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  42530. // slot props are camelized
  42531. name: camelize(attr.name),
  42532. value: attr.value,
  42533. dynamic: attr.dynamic
  42534. }); }))
  42535. : null;
  42536. var bind$$1 = el.attrsMap['v-bind'];
  42537. if ((attrs || bind$$1) && !children) {
  42538. res += ",null";
  42539. }
  42540. if (attrs) {
  42541. res += "," + attrs;
  42542. }
  42543. if (bind$$1) {
  42544. res += (attrs ? '' : ',null') + "," + bind$$1;
  42545. }
  42546. return res + ')'
  42547. }
  42548. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  42549. function genComponent (
  42550. componentName,
  42551. el,
  42552. state
  42553. ) {
  42554. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  42555. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  42556. }
  42557. function genProps (props) {
  42558. var staticProps = "";
  42559. var dynamicProps = "";
  42560. for (var i = 0; i < props.length; i++) {
  42561. var prop = props[i];
  42562. var value = transformSpecialNewlines(prop.value);
  42563. if (prop.dynamic) {
  42564. dynamicProps += (prop.name) + "," + value + ",";
  42565. } else {
  42566. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  42567. }
  42568. }
  42569. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  42570. if (dynamicProps) {
  42571. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  42572. } else {
  42573. return staticProps
  42574. }
  42575. }
  42576. // #3895, #4268
  42577. function transformSpecialNewlines (text) {
  42578. return text
  42579. .replace(/\u2028/g, '\\u2028')
  42580. .replace(/\u2029/g, '\\u2029')
  42581. }
  42582. /* */
  42583. // these keywords should not appear inside expressions, but operators like
  42584. // typeof, instanceof and in are allowed
  42585. var prohibitedKeywordRE = new RegExp('\\b' + (
  42586. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  42587. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  42588. 'extends,finally,continue,debugger,function,arguments'
  42589. ).split(',').join('\\b|\\b') + '\\b');
  42590. // these unary operators should not be used as property/method names
  42591. var unaryOperatorsRE = new RegExp('\\b' + (
  42592. 'delete,typeof,void'
  42593. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  42594. // strip strings in expressions
  42595. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  42596. // detect problematic expressions in a template
  42597. function detectErrors (ast, warn) {
  42598. if (ast) {
  42599. checkNode(ast, warn);
  42600. }
  42601. }
  42602. function checkNode (node, warn) {
  42603. if (node.type === 1) {
  42604. for (var name in node.attrsMap) {
  42605. if (dirRE.test(name)) {
  42606. var value = node.attrsMap[name];
  42607. if (value) {
  42608. var range = node.rawAttrsMap[name];
  42609. if (name === 'v-for') {
  42610. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  42611. } else if (onRE.test(name)) {
  42612. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  42613. } else {
  42614. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  42615. }
  42616. }
  42617. }
  42618. }
  42619. if (node.children) {
  42620. for (var i = 0; i < node.children.length; i++) {
  42621. checkNode(node.children[i], warn);
  42622. }
  42623. }
  42624. } else if (node.type === 2) {
  42625. checkExpression(node.expression, node.text, warn, node);
  42626. }
  42627. }
  42628. function checkEvent (exp, text, warn, range) {
  42629. var stipped = exp.replace(stripStringRE, '');
  42630. var keywordMatch = stipped.match(unaryOperatorsRE);
  42631. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  42632. warn(
  42633. "avoid using JavaScript unary operator as property name: " +
  42634. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  42635. range
  42636. );
  42637. }
  42638. checkExpression(exp, text, warn, range);
  42639. }
  42640. function checkFor (node, text, warn, range) {
  42641. checkExpression(node.for || '', text, warn, range);
  42642. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  42643. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  42644. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  42645. }
  42646. function checkIdentifier (
  42647. ident,
  42648. type,
  42649. text,
  42650. warn,
  42651. range
  42652. ) {
  42653. if (typeof ident === 'string') {
  42654. try {
  42655. new Function(("var " + ident + "=_"));
  42656. } catch (e) {
  42657. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  42658. }
  42659. }
  42660. }
  42661. function checkExpression (exp, text, warn, range) {
  42662. try {
  42663. new Function(("return " + exp));
  42664. } catch (e) {
  42665. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  42666. if (keywordMatch) {
  42667. warn(
  42668. "avoid using JavaScript keyword as property name: " +
  42669. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  42670. range
  42671. );
  42672. } else {
  42673. warn(
  42674. "invalid expression: " + (e.message) + " in\n\n" +
  42675. " " + exp + "\n\n" +
  42676. " Raw expression: " + (text.trim()) + "\n",
  42677. range
  42678. );
  42679. }
  42680. }
  42681. }
  42682. /* */
  42683. var range = 2;
  42684. function generateCodeFrame (
  42685. source,
  42686. start,
  42687. end
  42688. ) {
  42689. if ( start === void 0 ) start = 0;
  42690. if ( end === void 0 ) end = source.length;
  42691. var lines = source.split(/\r?\n/);
  42692. var count = 0;
  42693. var res = [];
  42694. for (var i = 0; i < lines.length; i++) {
  42695. count += lines[i].length + 1;
  42696. if (count >= start) {
  42697. for (var j = i - range; j <= i + range || end > count; j++) {
  42698. if (j < 0 || j >= lines.length) { continue }
  42699. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  42700. var lineLength = lines[j].length;
  42701. if (j === i) {
  42702. // push underline
  42703. var pad = start - (count - lineLength) + 1;
  42704. var length = end > count ? lineLength - pad : end - start;
  42705. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  42706. } else if (j > i) {
  42707. if (end > count) {
  42708. var length$1 = Math.min(end - count, lineLength);
  42709. res.push(" | " + repeat$1("^", length$1));
  42710. }
  42711. count += lineLength + 1;
  42712. }
  42713. }
  42714. break
  42715. }
  42716. }
  42717. return res.join('\n')
  42718. }
  42719. function repeat$1 (str, n) {
  42720. var result = '';
  42721. if (n > 0) {
  42722. while (true) { // eslint-disable-line
  42723. if (n & 1) { result += str; }
  42724. n >>>= 1;
  42725. if (n <= 0) { break }
  42726. str += str;
  42727. }
  42728. }
  42729. return result
  42730. }
  42731. /* */
  42732. function createFunction (code, errors) {
  42733. try {
  42734. return new Function(code)
  42735. } catch (err) {
  42736. errors.push({ err: err, code: code });
  42737. return noop
  42738. }
  42739. }
  42740. function createCompileToFunctionFn (compile) {
  42741. var cache = Object.create(null);
  42742. return function compileToFunctions (
  42743. template,
  42744. options,
  42745. vm
  42746. ) {
  42747. options = extend({}, options);
  42748. var warn$$1 = options.warn || warn;
  42749. delete options.warn;
  42750. /* istanbul ignore if */
  42751. {
  42752. // detect possible CSP restriction
  42753. try {
  42754. new Function('return 1');
  42755. } catch (e) {
  42756. if (e.toString().match(/unsafe-eval|CSP/)) {
  42757. warn$$1(
  42758. 'It seems you are using the standalone build of Vue.js in an ' +
  42759. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  42760. 'The template compiler cannot work in this environment. Consider ' +
  42761. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  42762. 'templates into render functions.'
  42763. );
  42764. }
  42765. }
  42766. }
  42767. // check cache
  42768. var key = options.delimiters
  42769. ? String(options.delimiters) + template
  42770. : template;
  42771. if (cache[key]) {
  42772. return cache[key]
  42773. }
  42774. // compile
  42775. var compiled = compile(template, options);
  42776. // check compilation errors/tips
  42777. {
  42778. if (compiled.errors && compiled.errors.length) {
  42779. if (options.outputSourceRange) {
  42780. compiled.errors.forEach(function (e) {
  42781. warn$$1(
  42782. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  42783. generateCodeFrame(template, e.start, e.end),
  42784. vm
  42785. );
  42786. });
  42787. } else {
  42788. warn$$1(
  42789. "Error compiling template:\n\n" + template + "\n\n" +
  42790. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  42791. vm
  42792. );
  42793. }
  42794. }
  42795. if (compiled.tips && compiled.tips.length) {
  42796. if (options.outputSourceRange) {
  42797. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  42798. } else {
  42799. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  42800. }
  42801. }
  42802. }
  42803. // turn code into functions
  42804. var res = {};
  42805. var fnGenErrors = [];
  42806. res.render = createFunction(compiled.render, fnGenErrors);
  42807. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  42808. return createFunction(code, fnGenErrors)
  42809. });
  42810. // check function generation errors.
  42811. // this should only happen if there is a bug in the compiler itself.
  42812. // mostly for codegen development use
  42813. /* istanbul ignore if */
  42814. {
  42815. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  42816. warn$$1(
  42817. "Failed to generate render function:\n\n" +
  42818. fnGenErrors.map(function (ref) {
  42819. var err = ref.err;
  42820. var code = ref.code;
  42821. return ((err.toString()) + " in\n\n" + code + "\n");
  42822. }).join('\n'),
  42823. vm
  42824. );
  42825. }
  42826. }
  42827. return (cache[key] = res)
  42828. }
  42829. }
  42830. /* */
  42831. function createCompilerCreator (baseCompile) {
  42832. return function createCompiler (baseOptions) {
  42833. function compile (
  42834. template,
  42835. options
  42836. ) {
  42837. var finalOptions = Object.create(baseOptions);
  42838. var errors = [];
  42839. var tips = [];
  42840. var warn = function (msg, range, tip) {
  42841. (tip ? tips : errors).push(msg);
  42842. };
  42843. if (options) {
  42844. if (options.outputSourceRange) {
  42845. // $flow-disable-line
  42846. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  42847. warn = function (msg, range, tip) {
  42848. var data = { msg: msg };
  42849. if (range) {
  42850. if (range.start != null) {
  42851. data.start = range.start + leadingSpaceLength;
  42852. }
  42853. if (range.end != null) {
  42854. data.end = range.end + leadingSpaceLength;
  42855. }
  42856. }
  42857. (tip ? tips : errors).push(data);
  42858. };
  42859. }
  42860. // merge custom modules
  42861. if (options.modules) {
  42862. finalOptions.modules =
  42863. (baseOptions.modules || []).concat(options.modules);
  42864. }
  42865. // merge custom directives
  42866. if (options.directives) {
  42867. finalOptions.directives = extend(
  42868. Object.create(baseOptions.directives || null),
  42869. options.directives
  42870. );
  42871. }
  42872. // copy other options
  42873. for (var key in options) {
  42874. if (key !== 'modules' && key !== 'directives') {
  42875. finalOptions[key] = options[key];
  42876. }
  42877. }
  42878. }
  42879. finalOptions.warn = warn;
  42880. var compiled = baseCompile(template.trim(), finalOptions);
  42881. {
  42882. detectErrors(compiled.ast, warn);
  42883. }
  42884. compiled.errors = errors;
  42885. compiled.tips = tips;
  42886. return compiled
  42887. }
  42888. return {
  42889. compile: compile,
  42890. compileToFunctions: createCompileToFunctionFn(compile)
  42891. }
  42892. }
  42893. }
  42894. /* */
  42895. // `createCompilerCreator` allows creating compilers that use alternative
  42896. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  42897. // Here we just export a default compiler using the default parts.
  42898. var createCompiler = createCompilerCreator(function baseCompile (
  42899. template,
  42900. options
  42901. ) {
  42902. var ast = parse(template.trim(), options);
  42903. if (options.optimize !== false) {
  42904. optimize(ast, options);
  42905. }
  42906. var code = generate(ast, options);
  42907. return {
  42908. ast: ast,
  42909. render: code.render,
  42910. staticRenderFns: code.staticRenderFns
  42911. }
  42912. });
  42913. /* */
  42914. var ref$1 = createCompiler(baseOptions);
  42915. var compile = ref$1.compile;
  42916. var compileToFunctions = ref$1.compileToFunctions;
  42917. /* */
  42918. // check whether current browser encodes a char inside attribute values
  42919. var div;
  42920. function getShouldDecode (href) {
  42921. div = div || document.createElement('div');
  42922. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  42923. return div.innerHTML.indexOf('&#10;') > 0
  42924. }
  42925. // #3663: IE encodes newlines inside attribute values while other browsers don't
  42926. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  42927. // #6828: chrome encodes content in a[href]
  42928. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  42929. /* */
  42930. var idToTemplate = cached(function (id) {
  42931. var el = query(id);
  42932. return el && el.innerHTML
  42933. });
  42934. var mount = Vue.prototype.$mount;
  42935. Vue.prototype.$mount = function (
  42936. el,
  42937. hydrating
  42938. ) {
  42939. el = el && query(el);
  42940. /* istanbul ignore if */
  42941. if (el === document.body || el === document.documentElement) {
  42942. warn(
  42943. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  42944. );
  42945. return this
  42946. }
  42947. var options = this.$options;
  42948. // resolve template/el and convert to render function
  42949. if (!options.render) {
  42950. var template = options.template;
  42951. if (template) {
  42952. if (typeof template === 'string') {
  42953. if (template.charAt(0) === '#') {
  42954. template = idToTemplate(template);
  42955. /* istanbul ignore if */
  42956. if (!template) {
  42957. warn(
  42958. ("Template element not found or is empty: " + (options.template)),
  42959. this
  42960. );
  42961. }
  42962. }
  42963. } else if (template.nodeType) {
  42964. template = template.innerHTML;
  42965. } else {
  42966. {
  42967. warn('invalid template option:' + template, this);
  42968. }
  42969. return this
  42970. }
  42971. } else if (el) {
  42972. template = getOuterHTML(el);
  42973. }
  42974. if (template) {
  42975. /* istanbul ignore if */
  42976. if (config.performance && mark) {
  42977. mark('compile');
  42978. }
  42979. var ref = compileToFunctions(template, {
  42980. outputSourceRange: "development" !== 'production',
  42981. shouldDecodeNewlines: shouldDecodeNewlines,
  42982. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  42983. delimiters: options.delimiters,
  42984. comments: options.comments
  42985. }, this);
  42986. var render = ref.render;
  42987. var staticRenderFns = ref.staticRenderFns;
  42988. options.render = render;
  42989. options.staticRenderFns = staticRenderFns;
  42990. /* istanbul ignore if */
  42991. if (config.performance && mark) {
  42992. mark('compile end');
  42993. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  42994. }
  42995. }
  42996. }
  42997. return mount.call(this, el, hydrating)
  42998. };
  42999. /**
  43000. * Get outerHTML of elements, taking care
  43001. * of SVG elements in IE as well.
  43002. */
  43003. function getOuterHTML (el) {
  43004. if (el.outerHTML) {
  43005. return el.outerHTML
  43006. } else {
  43007. var container = document.createElement('div');
  43008. container.appendChild(el.cloneNode(true));
  43009. return container.innerHTML
  43010. }
  43011. }
  43012. Vue.compile = compileToFunctions;
  43013. module.exports = Vue;
  43014. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/webpack/buildin/global.js"), __webpack_require__("./node_modules/timers-browserify/main.js").setImmediate))
  43015. /***/ }),
  43016. /***/ "./node_modules/vue/dist/vue.common.js":
  43017. /***/ (function(module, exports, __webpack_require__) {
  43018. if (false) {
  43019. module.exports = require('./vue.common.prod.js')
  43020. } else {
  43021. module.exports = __webpack_require__("./node_modules/vue/dist/vue.common.dev.js")
  43022. }
  43023. /***/ }),
  43024. /***/ "./node_modules/webpack/buildin/global.js":
  43025. /***/ (function(module, exports) {
  43026. var g;
  43027. // This works in non-strict mode
  43028. g = (function() {
  43029. return this;
  43030. })();
  43031. try {
  43032. // This works if eval is allowed (see CSP)
  43033. g = g || Function("return this")() || (1,eval)("this");
  43034. } catch(e) {
  43035. // This works if the window reference is available
  43036. if(typeof window === "object")
  43037. g = window;
  43038. }
  43039. // g can still be undefined, but nothing to do about it...
  43040. // We return undefined, instead of nothing here, so it's
  43041. // easier to handle this case. if(!global) { ...}
  43042. module.exports = g;
  43043. /***/ }),
  43044. /***/ "./node_modules/webpack/buildin/module.js":
  43045. /***/ (function(module, exports) {
  43046. module.exports = function(module) {
  43047. if(!module.webpackPolyfill) {
  43048. module.deprecate = function() {};
  43049. module.paths = [];
  43050. // module.parent = undefined by default
  43051. if(!module.children) module.children = [];
  43052. Object.defineProperty(module, "loaded", {
  43053. enumerable: true,
  43054. get: function() {
  43055. return module.l;
  43056. }
  43057. });
  43058. Object.defineProperty(module, "id", {
  43059. enumerable: true,
  43060. get: function() {
  43061. return module.i;
  43062. }
  43063. });
  43064. module.webpackPolyfill = 1;
  43065. }
  43066. return module;
  43067. };
  43068. /***/ }),
  43069. /***/ "./resources/assets/js/app.js":
  43070. /***/ (function(module, exports, __webpack_require__) {
  43071. /**
  43072. * First we will load all of this project's JavaScript dependencies which
  43073. * includes Vue and other libraries. It is a great starting point when
  43074. * building robust, powerful web applications using Vue and Laravel.
  43075. */
  43076. __webpack_require__("./resources/assets/js/bootstrap.js");
  43077. // global.jQuery = require('jquery');
  43078. // var $ = global.jQuery;
  43079. // window.$ = $;
  43080. window.Vue = __webpack_require__("./node_modules/vue/dist/vue.common.js");
  43081. /**
  43082. * Next, we will create a fresh Vue application instance and attach it to
  43083. * the page. Then, you may begin adding components to this application
  43084. * or customize the JavaScript scaffolding to fit your unique needs.
  43085. */
  43086. Vue.component('example-component', __webpack_require__("./resources/assets/js/components/ExampleComponent.vue"));
  43087. $.ajaxSetup({
  43088. headers: {
  43089. 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  43090. },
  43091. data: {
  43092. '_token': $('meta[name="csrf-token"]').attr('content')
  43093. }
  43094. });
  43095. /***/ }),
  43096. /***/ "./resources/assets/js/bootstrap.js":
  43097. /***/ (function(module, exports, __webpack_require__) {
  43098. window._ = __webpack_require__("./node_modules/lodash/lodash.js");
  43099. window.Popper = __webpack_require__("./node_modules/popper.js/dist/esm/popper.js").default;
  43100. /**
  43101. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  43102. * for JavaScript based Bootstrap features such as modals and tabs. This
  43103. * code may be modified to fit the specific needs of your application.
  43104. */
  43105. try {
  43106. window.$ = window.jQuery = __webpack_require__("./node_modules/jquery/dist/jquery.js");
  43107. __webpack_require__("./node_modules/bootstrap/dist/js/bootstrap.js");
  43108. } catch (e) {}
  43109. /**
  43110. * We'll load the axios HTTP library which allows us to easily issue requests
  43111. * to our Laravel back-end. This library automatically handles sending the
  43112. * CSRF token as a header based on the value of the "XSRF" token cookie.
  43113. */
  43114. window.axios = __webpack_require__("./node_modules/axios/index.js");
  43115. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  43116. /**
  43117. * Next we will register the CSRF Token as a common header with Axios so that
  43118. * all outgoing HTTP requests automatically have it attached. This is just
  43119. * a simple convenience so we don't have to attach every token manually.
  43120. */
  43121. var token = document.head.querySelector('meta[name="csrf-token"]');
  43122. if (token) {
  43123. window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
  43124. } else {
  43125. console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
  43126. }
  43127. /**
  43128. * Echo exposes an expressive API for subscribing to channels and listening
  43129. * for events that are broadcast by Laravel. Echo and event broadcasting
  43130. * allows your team to easily build robust real-time web applications.
  43131. */
  43132. // import Echo from 'laravel-echo'
  43133. // window.Pusher = require('pusher-js');
  43134. // window.Echo = new Echo({
  43135. // broadcaster: 'pusher',
  43136. // key: process.env.MIX_PUSHER_APP_KEY,
  43137. // cluster: process.env.MIX_PUSHER_APP_CLUSTER,
  43138. // encrypted: true
  43139. // });
  43140. /***/ }),
  43141. /***/ "./resources/assets/js/components/ExampleComponent.vue":
  43142. /***/ (function(module, exports, __webpack_require__) {
  43143. var disposed = false
  43144. var normalizeComponent = __webpack_require__("./node_modules/vue-loader/lib/component-normalizer.js")
  43145. /* script */
  43146. var __vue_script__ = __webpack_require__("./node_modules/babel-loader/lib/index.js?{\"cacheDirectory\":true,\"presets\":[[\"env\",{\"modules\":false,\"targets\":{\"browsers\":[\"> 2%\"],\"uglify\":true}}]],\"plugins\":[\"transform-object-rest-spread\",[\"transform-runtime\",{\"polyfill\":false,\"helpers\":false}]]}!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./resources/assets/js/components/ExampleComponent.vue")
  43147. /* template */
  43148. var __vue_template__ = __webpack_require__("./node_modules/vue-loader/lib/template-compiler/index.js?{\"id\":\"data-v-7168fb6a\",\"hasScoped\":false,\"buble\":{\"transforms\":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./resources/assets/js/components/ExampleComponent.vue")
  43149. /* template functional */
  43150. var __vue_template_functional__ = false
  43151. /* styles */
  43152. var __vue_styles__ = null
  43153. /* scopeId */
  43154. var __vue_scopeId__ = null
  43155. /* moduleIdentifier (server only) */
  43156. var __vue_module_identifier__ = null
  43157. var Component = normalizeComponent(
  43158. __vue_script__,
  43159. __vue_template__,
  43160. __vue_template_functional__,
  43161. __vue_styles__,
  43162. __vue_scopeId__,
  43163. __vue_module_identifier__
  43164. )
  43165. Component.options.__file = "resources/assets/js/components/ExampleComponent.vue"
  43166. /* hot reload */
  43167. if (false) {(function () {
  43168. var hotAPI = require("vue-hot-reload-api")
  43169. hotAPI.install(require("vue"), false)
  43170. if (!hotAPI.compatible) return
  43171. module.hot.accept()
  43172. if (!module.hot.data) {
  43173. hotAPI.createRecord("data-v-7168fb6a", Component.options)
  43174. } else {
  43175. hotAPI.reload("data-v-7168fb6a", Component.options)
  43176. }
  43177. module.hot.dispose(function (data) {
  43178. disposed = true
  43179. })
  43180. })()}
  43181. module.exports = Component.exports
  43182. /***/ }),
  43183. /***/ "./resources/assets/sass/app.scss":
  43184. /***/ (function(module, exports) {
  43185. // removed by extract-text-webpack-plugin
  43186. /***/ }),
  43187. /***/ 0:
  43188. /***/ (function(module, exports, __webpack_require__) {
  43189. __webpack_require__("./resources/assets/js/app.js");
  43190. __webpack_require__("./resources/assets/sass/app.scss");
  43191. module.exports = __webpack_require__("./node_modules/bootstrap4c-chosen/src/scss/build.scss");
  43192. /***/ })
  43193. /******/ });