vue-test-utils.iife.js 236 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734
  1. var VueTestUtils = (function (Vue,vueTemplateCompiler) {
  2. 'use strict';
  3. Vue = Vue && Vue.hasOwnProperty('default') ? Vue['default'] : Vue;
  4. var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  5. function createCommonjsModule(fn, module) {
  6. return module = { exports: {} }, fn(module, module.exports), module.exports;
  7. }
  8. var semver = createCommonjsModule(function (module, exports) {
  9. exports = module.exports = SemVer;
  10. // The debug function is excluded entirely from the minified version.
  11. /* nomin */ var debug;
  12. /* nomin */ if (typeof process === 'object' &&
  13. /* nomin */ process.env &&
  14. /* nomin */ process.env.NODE_DEBUG &&
  15. /* nomin */ /\bsemver\b/i.test(process.env.NODE_DEBUG))
  16. /* nomin */ { debug = function() {
  17. /* nomin */ var args = Array.prototype.slice.call(arguments, 0);
  18. /* nomin */ args.unshift('SEMVER');
  19. /* nomin */ console.log.apply(console, args);
  20. /* nomin */ }; }
  21. /* nomin */ else
  22. /* nomin */ { debug = function() {}; }
  23. // Note: this is the semver.org version of the spec that it implements
  24. // Not necessarily the package version of this code.
  25. exports.SEMVER_SPEC_VERSION = '2.0.0';
  26. var MAX_LENGTH = 256;
  27. var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
  28. // Max safe segment length for coercion.
  29. var MAX_SAFE_COMPONENT_LENGTH = 16;
  30. // The actual regexps go on exports.re
  31. var re = exports.re = [];
  32. var src = exports.src = [];
  33. var R = 0;
  34. // The following Regular Expressions can be used for tokenizing,
  35. // validating, and parsing SemVer version strings.
  36. // ## Numeric Identifier
  37. // A single `0`, or a non-zero digit followed by zero or more digits.
  38. var NUMERICIDENTIFIER = R++;
  39. src[NUMERICIDENTIFIER] = '0|[1-9]\\d*';
  40. var NUMERICIDENTIFIERLOOSE = R++;
  41. src[NUMERICIDENTIFIERLOOSE] = '[0-9]+';
  42. // ## Non-numeric Identifier
  43. // Zero or more digits, followed by a letter or hyphen, and then zero or
  44. // more letters, digits, or hyphens.
  45. var NONNUMERICIDENTIFIER = R++;
  46. src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*';
  47. // ## Main Version
  48. // Three dot-separated numeric identifiers.
  49. var MAINVERSION = R++;
  50. src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' +
  51. '(' + src[NUMERICIDENTIFIER] + ')\\.' +
  52. '(' + src[NUMERICIDENTIFIER] + ')';
  53. var MAINVERSIONLOOSE = R++;
  54. src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
  55. '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
  56. '(' + src[NUMERICIDENTIFIERLOOSE] + ')';
  57. // ## Pre-release Version Identifier
  58. // A numeric identifier, or a non-numeric identifier.
  59. var PRERELEASEIDENTIFIER = R++;
  60. src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] +
  61. '|' + src[NONNUMERICIDENTIFIER] + ')';
  62. var PRERELEASEIDENTIFIERLOOSE = R++;
  63. src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] +
  64. '|' + src[NONNUMERICIDENTIFIER] + ')';
  65. // ## Pre-release Version
  66. // Hyphen, followed by one or more dot-separated pre-release version
  67. // identifiers.
  68. var PRERELEASE = R++;
  69. src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] +
  70. '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))';
  71. var PRERELEASELOOSE = R++;
  72. src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] +
  73. '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))';
  74. // ## Build Metadata Identifier
  75. // Any combination of digits, letters, or hyphens.
  76. var BUILDIDENTIFIER = R++;
  77. src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+';
  78. // ## Build Metadata
  79. // Plus sign, followed by one or more period-separated build metadata
  80. // identifiers.
  81. var BUILD = R++;
  82. src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] +
  83. '(?:\\.' + src[BUILDIDENTIFIER] + ')*))';
  84. // ## Full Version String
  85. // A main version, followed optionally by a pre-release version and
  86. // build metadata.
  87. // Note that the only major, minor, patch, and pre-release sections of
  88. // the version string are capturing groups. The build metadata is not a
  89. // capturing group, because it should not ever be used in version
  90. // comparison.
  91. var FULL = R++;
  92. var FULLPLAIN = 'v?' + src[MAINVERSION] +
  93. src[PRERELEASE] + '?' +
  94. src[BUILD] + '?';
  95. src[FULL] = '^' + FULLPLAIN + '$';
  96. // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
  97. // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
  98. // common in the npm registry.
  99. var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] +
  100. src[PRERELEASELOOSE] + '?' +
  101. src[BUILD] + '?';
  102. var LOOSE = R++;
  103. src[LOOSE] = '^' + LOOSEPLAIN + '$';
  104. var GTLT = R++;
  105. src[GTLT] = '((?:<|>)?=?)';
  106. // Something like "2.*" or "1.2.x".
  107. // Note that "x.x" is a valid xRange identifer, meaning "any version"
  108. // Only the first item is strictly required.
  109. var XRANGEIDENTIFIERLOOSE = R++;
  110. src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
  111. var XRANGEIDENTIFIER = R++;
  112. src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*';
  113. var XRANGEPLAIN = R++;
  114. src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' +
  115. '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
  116. '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
  117. '(?:' + src[PRERELEASE] + ')?' +
  118. src[BUILD] + '?' +
  119. ')?)?';
  120. var XRANGEPLAINLOOSE = R++;
  121. src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
  122. '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
  123. '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
  124. '(?:' + src[PRERELEASELOOSE] + ')?' +
  125. src[BUILD] + '?' +
  126. ')?)?';
  127. var XRANGE = R++;
  128. src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$';
  129. var XRANGELOOSE = R++;
  130. src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$';
  131. // Coercion.
  132. // Extract anything that could conceivably be a part of a valid semver
  133. var COERCE = R++;
  134. src[COERCE] = '(?:^|[^\\d])' +
  135. '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +
  136. '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
  137. '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
  138. '(?:$|[^\\d])';
  139. // Tilde ranges.
  140. // Meaning is "reasonably at or greater than"
  141. var LONETILDE = R++;
  142. src[LONETILDE] = '(?:~>?)';
  143. var TILDETRIM = R++;
  144. src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+';
  145. re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g');
  146. var tildeTrimReplace = '$1~';
  147. var TILDE = R++;
  148. src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$';
  149. var TILDELOOSE = R++;
  150. src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$';
  151. // Caret ranges.
  152. // Meaning is "at least and backwards compatible with"
  153. var LONECARET = R++;
  154. src[LONECARET] = '(?:\\^)';
  155. var CARETTRIM = R++;
  156. src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+';
  157. re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g');
  158. var caretTrimReplace = '$1^';
  159. var CARET = R++;
  160. src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$';
  161. var CARETLOOSE = R++;
  162. src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$';
  163. // A simple gt/lt/eq thing, or just "" to indicate "any version"
  164. var COMPARATORLOOSE = R++;
  165. src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$';
  166. var COMPARATOR = R++;
  167. src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$';
  168. // An expression to strip any whitespace between the gtlt and the thing
  169. // it modifies, so that `> 1.2.3` ==> `>1.2.3`
  170. var COMPARATORTRIM = R++;
  171. src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] +
  172. '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')';
  173. // this one has to use the /g flag
  174. re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g');
  175. var comparatorTrimReplace = '$1$2$3';
  176. // Something like `1.2.3 - 1.2.4`
  177. // Note that these all use the loose form, because they'll be
  178. // checked against either the strict or loose comparator form
  179. // later.
  180. var HYPHENRANGE = R++;
  181. src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' +
  182. '\\s+-\\s+' +
  183. '(' + src[XRANGEPLAIN] + ')' +
  184. '\\s*$';
  185. var HYPHENRANGELOOSE = R++;
  186. src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' +
  187. '\\s+-\\s+' +
  188. '(' + src[XRANGEPLAINLOOSE] + ')' +
  189. '\\s*$';
  190. // Star ranges basically just allow anything at all.
  191. var STAR = R++;
  192. src[STAR] = '(<|>)?=?\\s*\\*';
  193. // Compile to actual regexp objects.
  194. // All are flag-free, unless they were created above with a flag.
  195. for (var i = 0; i < R; i++) {
  196. debug(i, src[i]);
  197. if (!re[i])
  198. { re[i] = new RegExp(src[i]); }
  199. }
  200. exports.parse = parse;
  201. function parse(version, options) {
  202. if (!options || typeof options !== 'object')
  203. { options = { loose: !!options, includePrerelease: false }; }
  204. if (version instanceof SemVer)
  205. { return version; }
  206. if (typeof version !== 'string')
  207. { return null; }
  208. if (version.length > MAX_LENGTH)
  209. { return null; }
  210. var r = options.loose ? re[LOOSE] : re[FULL];
  211. if (!r.test(version))
  212. { return null; }
  213. try {
  214. return new SemVer(version, options);
  215. } catch (er) {
  216. return null;
  217. }
  218. }
  219. exports.valid = valid;
  220. function valid(version, options) {
  221. var v = parse(version, options);
  222. return v ? v.version : null;
  223. }
  224. exports.clean = clean;
  225. function clean(version, options) {
  226. var s = parse(version.trim().replace(/^[=v]+/, ''), options);
  227. return s ? s.version : null;
  228. }
  229. exports.SemVer = SemVer;
  230. function SemVer(version, options) {
  231. if (!options || typeof options !== 'object')
  232. { options = { loose: !!options, includePrerelease: false }; }
  233. if (version instanceof SemVer) {
  234. if (version.loose === options.loose)
  235. { return version; }
  236. else
  237. { version = version.version; }
  238. } else if (typeof version !== 'string') {
  239. throw new TypeError('Invalid Version: ' + version);
  240. }
  241. if (version.length > MAX_LENGTH)
  242. { throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') }
  243. if (!(this instanceof SemVer))
  244. { return new SemVer(version, options); }
  245. debug('SemVer', version, options);
  246. this.options = options;
  247. this.loose = !!options.loose;
  248. var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]);
  249. if (!m)
  250. { throw new TypeError('Invalid Version: ' + version); }
  251. this.raw = version;
  252. // these are actually numbers
  253. this.major = +m[1];
  254. this.minor = +m[2];
  255. this.patch = +m[3];
  256. if (this.major > MAX_SAFE_INTEGER || this.major < 0)
  257. { throw new TypeError('Invalid major version') }
  258. if (this.minor > MAX_SAFE_INTEGER || this.minor < 0)
  259. { throw new TypeError('Invalid minor version') }
  260. if (this.patch > MAX_SAFE_INTEGER || this.patch < 0)
  261. { throw new TypeError('Invalid patch version') }
  262. // numberify any prerelease numeric ids
  263. if (!m[4])
  264. { this.prerelease = []; }
  265. else
  266. { this.prerelease = m[4].split('.').map(function(id) {
  267. if (/^[0-9]+$/.test(id)) {
  268. var num = +id;
  269. if (num >= 0 && num < MAX_SAFE_INTEGER)
  270. { return num; }
  271. }
  272. return id;
  273. }); }
  274. this.build = m[5] ? m[5].split('.') : [];
  275. this.format();
  276. }
  277. SemVer.prototype.format = function() {
  278. this.version = this.major + '.' + this.minor + '.' + this.patch;
  279. if (this.prerelease.length)
  280. { this.version += '-' + this.prerelease.join('.'); }
  281. return this.version;
  282. };
  283. SemVer.prototype.toString = function() {
  284. return this.version;
  285. };
  286. SemVer.prototype.compare = function(other) {
  287. debug('SemVer.compare', this.version, this.options, other);
  288. if (!(other instanceof SemVer))
  289. { other = new SemVer(other, this.options); }
  290. return this.compareMain(other) || this.comparePre(other);
  291. };
  292. SemVer.prototype.compareMain = function(other) {
  293. if (!(other instanceof SemVer))
  294. { other = new SemVer(other, this.options); }
  295. return compareIdentifiers(this.major, other.major) ||
  296. compareIdentifiers(this.minor, other.minor) ||
  297. compareIdentifiers(this.patch, other.patch);
  298. };
  299. SemVer.prototype.comparePre = function(other) {
  300. var this$1 = this;
  301. if (!(other instanceof SemVer))
  302. { other = new SemVer(other, this.options); }
  303. // NOT having a prerelease is > having one
  304. if (this.prerelease.length && !other.prerelease.length)
  305. { return -1; }
  306. else if (!this.prerelease.length && other.prerelease.length)
  307. { return 1; }
  308. else if (!this.prerelease.length && !other.prerelease.length)
  309. { return 0; }
  310. var i = 0;
  311. do {
  312. var a = this$1.prerelease[i];
  313. var b = other.prerelease[i];
  314. debug('prerelease compare', i, a, b);
  315. if (a === undefined && b === undefined)
  316. { return 0; }
  317. else if (b === undefined)
  318. { return 1; }
  319. else if (a === undefined)
  320. { return -1; }
  321. else if (a === b)
  322. { continue; }
  323. else
  324. { return compareIdentifiers(a, b); }
  325. } while (++i);
  326. };
  327. // preminor will bump the version up to the next minor release, and immediately
  328. // down to pre-release. premajor and prepatch work the same way.
  329. SemVer.prototype.inc = function(release, identifier) {
  330. var this$1 = this;
  331. switch (release) {
  332. case 'premajor':
  333. this.prerelease.length = 0;
  334. this.patch = 0;
  335. this.minor = 0;
  336. this.major++;
  337. this.inc('pre', identifier);
  338. break;
  339. case 'preminor':
  340. this.prerelease.length = 0;
  341. this.patch = 0;
  342. this.minor++;
  343. this.inc('pre', identifier);
  344. break;
  345. case 'prepatch':
  346. // If this is already a prerelease, it will bump to the next version
  347. // drop any prereleases that might already exist, since they are not
  348. // relevant at this point.
  349. this.prerelease.length = 0;
  350. this.inc('patch', identifier);
  351. this.inc('pre', identifier);
  352. break;
  353. // If the input is a non-prerelease version, this acts the same as
  354. // prepatch.
  355. case 'prerelease':
  356. if (this.prerelease.length === 0)
  357. { this.inc('patch', identifier); }
  358. this.inc('pre', identifier);
  359. break;
  360. case 'major':
  361. // If this is a pre-major version, bump up to the same major version.
  362. // Otherwise increment major.
  363. // 1.0.0-5 bumps to 1.0.0
  364. // 1.1.0 bumps to 2.0.0
  365. if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0)
  366. { this.major++; }
  367. this.minor = 0;
  368. this.patch = 0;
  369. this.prerelease = [];
  370. break;
  371. case 'minor':
  372. // If this is a pre-minor version, bump up to the same minor version.
  373. // Otherwise increment minor.
  374. // 1.2.0-5 bumps to 1.2.0
  375. // 1.2.1 bumps to 1.3.0
  376. if (this.patch !== 0 || this.prerelease.length === 0)
  377. { this.minor++; }
  378. this.patch = 0;
  379. this.prerelease = [];
  380. break;
  381. case 'patch':
  382. // If this is not a pre-release version, it will increment the patch.
  383. // If it is a pre-release it will bump up to the same patch version.
  384. // 1.2.0-5 patches to 1.2.0
  385. // 1.2.0 patches to 1.2.1
  386. if (this.prerelease.length === 0)
  387. { this.patch++; }
  388. this.prerelease = [];
  389. break;
  390. // This probably shouldn't be used publicly.
  391. // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
  392. case 'pre':
  393. if (this.prerelease.length === 0)
  394. { this.prerelease = [0]; }
  395. else {
  396. var i = this.prerelease.length;
  397. while (--i >= 0) {
  398. if (typeof this$1.prerelease[i] === 'number') {
  399. this$1.prerelease[i]++;
  400. i = -2;
  401. }
  402. }
  403. if (i === -1) // didn't increment anything
  404. { this.prerelease.push(0); }
  405. }
  406. if (identifier) {
  407. // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
  408. // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
  409. if (this.prerelease[0] === identifier) {
  410. if (isNaN(this.prerelease[1]))
  411. { this.prerelease = [identifier, 0]; }
  412. } else
  413. { this.prerelease = [identifier, 0]; }
  414. }
  415. break;
  416. default:
  417. throw new Error('invalid increment argument: ' + release);
  418. }
  419. this.format();
  420. this.raw = this.version;
  421. return this;
  422. };
  423. exports.inc = inc;
  424. function inc(version, release, loose, identifier) {
  425. if (typeof(loose) === 'string') {
  426. identifier = loose;
  427. loose = undefined;
  428. }
  429. try {
  430. return new SemVer(version, loose).inc(release, identifier).version;
  431. } catch (er) {
  432. return null;
  433. }
  434. }
  435. exports.diff = diff;
  436. function diff(version1, version2) {
  437. if (eq(version1, version2)) {
  438. return null;
  439. } else {
  440. var v1 = parse(version1);
  441. var v2 = parse(version2);
  442. if (v1.prerelease.length || v2.prerelease.length) {
  443. for (var key in v1) {
  444. if (key === 'major' || key === 'minor' || key === 'patch') {
  445. if (v1[key] !== v2[key]) {
  446. return 'pre'+key;
  447. }
  448. }
  449. }
  450. return 'prerelease';
  451. }
  452. for (var key in v1) {
  453. if (key === 'major' || key === 'minor' || key === 'patch') {
  454. if (v1[key] !== v2[key]) {
  455. return key;
  456. }
  457. }
  458. }
  459. }
  460. }
  461. exports.compareIdentifiers = compareIdentifiers;
  462. var numeric = /^[0-9]+$/;
  463. function compareIdentifiers(a, b) {
  464. var anum = numeric.test(a);
  465. var bnum = numeric.test(b);
  466. if (anum && bnum) {
  467. a = +a;
  468. b = +b;
  469. }
  470. return (anum && !bnum) ? -1 :
  471. (bnum && !anum) ? 1 :
  472. a < b ? -1 :
  473. a > b ? 1 :
  474. 0;
  475. }
  476. exports.rcompareIdentifiers = rcompareIdentifiers;
  477. function rcompareIdentifiers(a, b) {
  478. return compareIdentifiers(b, a);
  479. }
  480. exports.major = major;
  481. function major(a, loose) {
  482. return new SemVer(a, loose).major;
  483. }
  484. exports.minor = minor;
  485. function minor(a, loose) {
  486. return new SemVer(a, loose).minor;
  487. }
  488. exports.patch = patch;
  489. function patch(a, loose) {
  490. return new SemVer(a, loose).patch;
  491. }
  492. exports.compare = compare;
  493. function compare(a, b, loose) {
  494. return new SemVer(a, loose).compare(new SemVer(b, loose));
  495. }
  496. exports.compareLoose = compareLoose;
  497. function compareLoose(a, b) {
  498. return compare(a, b, true);
  499. }
  500. exports.rcompare = rcompare;
  501. function rcompare(a, b, loose) {
  502. return compare(b, a, loose);
  503. }
  504. exports.sort = sort;
  505. function sort(list, loose) {
  506. return list.sort(function(a, b) {
  507. return exports.compare(a, b, loose);
  508. });
  509. }
  510. exports.rsort = rsort;
  511. function rsort(list, loose) {
  512. return list.sort(function(a, b) {
  513. return exports.rcompare(a, b, loose);
  514. });
  515. }
  516. exports.gt = gt;
  517. function gt(a, b, loose) {
  518. return compare(a, b, loose) > 0;
  519. }
  520. exports.lt = lt;
  521. function lt(a, b, loose) {
  522. return compare(a, b, loose) < 0;
  523. }
  524. exports.eq = eq;
  525. function eq(a, b, loose) {
  526. return compare(a, b, loose) === 0;
  527. }
  528. exports.neq = neq;
  529. function neq(a, b, loose) {
  530. return compare(a, b, loose) !== 0;
  531. }
  532. exports.gte = gte;
  533. function gte(a, b, loose) {
  534. return compare(a, b, loose) >= 0;
  535. }
  536. exports.lte = lte;
  537. function lte(a, b, loose) {
  538. return compare(a, b, loose) <= 0;
  539. }
  540. exports.cmp = cmp;
  541. function cmp(a, op, b, loose) {
  542. var ret;
  543. switch (op) {
  544. case '===':
  545. if (typeof a === 'object') { a = a.version; }
  546. if (typeof b === 'object') { b = b.version; }
  547. ret = a === b;
  548. break;
  549. case '!==':
  550. if (typeof a === 'object') { a = a.version; }
  551. if (typeof b === 'object') { b = b.version; }
  552. ret = a !== b;
  553. break;
  554. case '': case '=': case '==': ret = eq(a, b, loose); break;
  555. case '!=': ret = neq(a, b, loose); break;
  556. case '>': ret = gt(a, b, loose); break;
  557. case '>=': ret = gte(a, b, loose); break;
  558. case '<': ret = lt(a, b, loose); break;
  559. case '<=': ret = lte(a, b, loose); break;
  560. default: throw new TypeError('Invalid operator: ' + op);
  561. }
  562. return ret;
  563. }
  564. exports.Comparator = Comparator;
  565. function Comparator(comp, options) {
  566. if (!options || typeof options !== 'object')
  567. { options = { loose: !!options, includePrerelease: false }; }
  568. if (comp instanceof Comparator) {
  569. if (comp.loose === !!options.loose)
  570. { return comp; }
  571. else
  572. { comp = comp.value; }
  573. }
  574. if (!(this instanceof Comparator))
  575. { return new Comparator(comp, options); }
  576. debug('comparator', comp, options);
  577. this.options = options;
  578. this.loose = !!options.loose;
  579. this.parse(comp);
  580. if (this.semver === ANY)
  581. { this.value = ''; }
  582. else
  583. { this.value = this.operator + this.semver.version; }
  584. debug('comp', this);
  585. }
  586. var ANY = {};
  587. Comparator.prototype.parse = function(comp) {
  588. var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
  589. var m = comp.match(r);
  590. if (!m)
  591. { throw new TypeError('Invalid comparator: ' + comp); }
  592. this.operator = m[1];
  593. if (this.operator === '=')
  594. { this.operator = ''; }
  595. // if it literally is just '>' or '' then allow anything.
  596. if (!m[2])
  597. { this.semver = ANY; }
  598. else
  599. { this.semver = new SemVer(m[2], this.options.loose); }
  600. };
  601. Comparator.prototype.toString = function() {
  602. return this.value;
  603. };
  604. Comparator.prototype.test = function(version) {
  605. debug('Comparator.test', version, this.options.loose);
  606. if (this.semver === ANY)
  607. { return true; }
  608. if (typeof version === 'string')
  609. { version = new SemVer(version, this.options); }
  610. return cmp(version, this.operator, this.semver, this.options);
  611. };
  612. Comparator.prototype.intersects = function(comp, options) {
  613. if (!(comp instanceof Comparator)) {
  614. throw new TypeError('a Comparator is required');
  615. }
  616. if (!options || typeof options !== 'object')
  617. { options = { loose: !!options, includePrerelease: false }; }
  618. var rangeTmp;
  619. if (this.operator === '') {
  620. rangeTmp = new Range(comp.value, options);
  621. return satisfies(this.value, rangeTmp, options);
  622. } else if (comp.operator === '') {
  623. rangeTmp = new Range(this.value, options);
  624. return satisfies(comp.semver, rangeTmp, options);
  625. }
  626. var sameDirectionIncreasing =
  627. (this.operator === '>=' || this.operator === '>') &&
  628. (comp.operator === '>=' || comp.operator === '>');
  629. var sameDirectionDecreasing =
  630. (this.operator === '<=' || this.operator === '<') &&
  631. (comp.operator === '<=' || comp.operator === '<');
  632. var sameSemVer = this.semver.version === comp.semver.version;
  633. var differentDirectionsInclusive =
  634. (this.operator === '>=' || this.operator === '<=') &&
  635. (comp.operator === '>=' || comp.operator === '<=');
  636. var oppositeDirectionsLessThan =
  637. cmp(this.semver, '<', comp.semver, options) &&
  638. ((this.operator === '>=' || this.operator === '>') &&
  639. (comp.operator === '<=' || comp.operator === '<'));
  640. var oppositeDirectionsGreaterThan =
  641. cmp(this.semver, '>', comp.semver, options) &&
  642. ((this.operator === '<=' || this.operator === '<') &&
  643. (comp.operator === '>=' || comp.operator === '>'));
  644. return sameDirectionIncreasing || sameDirectionDecreasing ||
  645. (sameSemVer && differentDirectionsInclusive) ||
  646. oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
  647. };
  648. exports.Range = Range;
  649. function Range(range, options) {
  650. if (!options || typeof options !== 'object')
  651. { options = { loose: !!options, includePrerelease: false }; }
  652. if (range instanceof Range) {
  653. if (range.loose === !!options.loose &&
  654. range.includePrerelease === !!options.includePrerelease) {
  655. return range;
  656. } else {
  657. return new Range(range.raw, options);
  658. }
  659. }
  660. if (range instanceof Comparator) {
  661. return new Range(range.value, options);
  662. }
  663. if (!(this instanceof Range))
  664. { return new Range(range, options); }
  665. this.options = options;
  666. this.loose = !!options.loose;
  667. this.includePrerelease = !!options.includePrerelease;
  668. // First, split based on boolean or ||
  669. this.raw = range;
  670. this.set = range.split(/\s*\|\|\s*/).map(function(range) {
  671. return this.parseRange(range.trim());
  672. }, this).filter(function(c) {
  673. // throw out any that are not relevant for whatever reason
  674. return c.length;
  675. });
  676. if (!this.set.length) {
  677. throw new TypeError('Invalid SemVer Range: ' + range);
  678. }
  679. this.format();
  680. }
  681. Range.prototype.format = function() {
  682. this.range = this.set.map(function(comps) {
  683. return comps.join(' ').trim();
  684. }).join('||').trim();
  685. return this.range;
  686. };
  687. Range.prototype.toString = function() {
  688. return this.range;
  689. };
  690. Range.prototype.parseRange = function(range) {
  691. var loose = this.options.loose;
  692. range = range.trim();
  693. // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
  694. var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE];
  695. range = range.replace(hr, hyphenReplace);
  696. debug('hyphen replace', range);
  697. // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
  698. range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace);
  699. debug('comparator trim', range, re[COMPARATORTRIM]);
  700. // `~ 1.2.3` => `~1.2.3`
  701. range = range.replace(re[TILDETRIM], tildeTrimReplace);
  702. // `^ 1.2.3` => `^1.2.3`
  703. range = range.replace(re[CARETTRIM], caretTrimReplace);
  704. // normalize spaces
  705. range = range.split(/\s+/).join(' ');
  706. // At this point, the range is completely trimmed and
  707. // ready to be split into comparators.
  708. var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
  709. var set = range.split(' ').map(function(comp) {
  710. return parseComparator(comp, this.options);
  711. }, this).join(' ').split(/\s+/);
  712. if (this.options.loose) {
  713. // in loose mode, throw out any that are not valid comparators
  714. set = set.filter(function(comp) {
  715. return !!comp.match(compRe);
  716. });
  717. }
  718. set = set.map(function(comp) {
  719. return new Comparator(comp, this.options);
  720. }, this);
  721. return set;
  722. };
  723. Range.prototype.intersects = function(range, options) {
  724. if (!(range instanceof Range)) {
  725. throw new TypeError('a Range is required');
  726. }
  727. return this.set.some(function(thisComparators) {
  728. return thisComparators.every(function(thisComparator) {
  729. return range.set.some(function(rangeComparators) {
  730. return rangeComparators.every(function(rangeComparator) {
  731. return thisComparator.intersects(rangeComparator, options);
  732. });
  733. });
  734. });
  735. });
  736. };
  737. // Mostly just for testing and legacy API reasons
  738. exports.toComparators = toComparators;
  739. function toComparators(range, options) {
  740. return new Range(range, options).set.map(function(comp) {
  741. return comp.map(function(c) {
  742. return c.value;
  743. }).join(' ').trim().split(' ');
  744. });
  745. }
  746. // comprised of xranges, tildes, stars, and gtlt's at this point.
  747. // already replaced the hyphen ranges
  748. // turn into a set of JUST comparators.
  749. function parseComparator(comp, options) {
  750. debug('comp', comp, options);
  751. comp = replaceCarets(comp, options);
  752. debug('caret', comp);
  753. comp = replaceTildes(comp, options);
  754. debug('tildes', comp);
  755. comp = replaceXRanges(comp, options);
  756. debug('xrange', comp);
  757. comp = replaceStars(comp, options);
  758. debug('stars', comp);
  759. return comp;
  760. }
  761. function isX(id) {
  762. return !id || id.toLowerCase() === 'x' || id === '*';
  763. }
  764. // ~, ~> --> * (any, kinda silly)
  765. // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
  766. // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
  767. // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
  768. // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
  769. // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
  770. function replaceTildes(comp, options) {
  771. return comp.trim().split(/\s+/).map(function(comp) {
  772. return replaceTilde(comp, options);
  773. }).join(' ');
  774. }
  775. function replaceTilde(comp, options) {
  776. if (!options || typeof options !== 'object')
  777. { options = { loose: !!options, includePrerelease: false }; }
  778. var r = options.loose ? re[TILDELOOSE] : re[TILDE];
  779. return comp.replace(r, function(_, M, m, p, pr) {
  780. debug('tilde', comp, _, M, m, p, pr);
  781. var ret;
  782. if (isX(M))
  783. { ret = ''; }
  784. else if (isX(m))
  785. { ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; }
  786. else if (isX(p))
  787. // ~1.2 == >=1.2.0 <1.3.0
  788. { ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; }
  789. else if (pr) {
  790. debug('replaceTilde pr', pr);
  791. if (pr.charAt(0) !== '-')
  792. { pr = '-' + pr; }
  793. ret = '>=' + M + '.' + m + '.' + p + pr +
  794. ' <' + M + '.' + (+m + 1) + '.0';
  795. } else
  796. // ~1.2.3 == >=1.2.3 <1.3.0
  797. { ret = '>=' + M + '.' + m + '.' + p +
  798. ' <' + M + '.' + (+m + 1) + '.0'; }
  799. debug('tilde return', ret);
  800. return ret;
  801. });
  802. }
  803. // ^ --> * (any, kinda silly)
  804. // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
  805. // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
  806. // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
  807. // ^1.2.3 --> >=1.2.3 <2.0.0
  808. // ^1.2.0 --> >=1.2.0 <2.0.0
  809. function replaceCarets(comp, options) {
  810. return comp.trim().split(/\s+/).map(function(comp) {
  811. return replaceCaret(comp, options);
  812. }).join(' ');
  813. }
  814. function replaceCaret(comp, options) {
  815. debug('caret', comp, options);
  816. if (!options || typeof options !== 'object')
  817. { options = { loose: !!options, includePrerelease: false }; }
  818. var r = options.loose ? re[CARETLOOSE] : re[CARET];
  819. return comp.replace(r, function(_, M, m, p, pr) {
  820. debug('caret', comp, _, M, m, p, pr);
  821. var ret;
  822. if (isX(M))
  823. { ret = ''; }
  824. else if (isX(m))
  825. { ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; }
  826. else if (isX(p)) {
  827. if (M === '0')
  828. { ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; }
  829. else
  830. { ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; }
  831. } else if (pr) {
  832. debug('replaceCaret pr', pr);
  833. if (pr.charAt(0) !== '-')
  834. { pr = '-' + pr; }
  835. if (M === '0') {
  836. if (m === '0')
  837. { ret = '>=' + M + '.' + m + '.' + p + pr +
  838. ' <' + M + '.' + m + '.' + (+p + 1); }
  839. else
  840. { ret = '>=' + M + '.' + m + '.' + p + pr +
  841. ' <' + M + '.' + (+m + 1) + '.0'; }
  842. } else
  843. { ret = '>=' + M + '.' + m + '.' + p + pr +
  844. ' <' + (+M + 1) + '.0.0'; }
  845. } else {
  846. debug('no pr');
  847. if (M === '0') {
  848. if (m === '0')
  849. { ret = '>=' + M + '.' + m + '.' + p +
  850. ' <' + M + '.' + m + '.' + (+p + 1); }
  851. else
  852. { ret = '>=' + M + '.' + m + '.' + p +
  853. ' <' + M + '.' + (+m + 1) + '.0'; }
  854. } else
  855. { ret = '>=' + M + '.' + m + '.' + p +
  856. ' <' + (+M + 1) + '.0.0'; }
  857. }
  858. debug('caret return', ret);
  859. return ret;
  860. });
  861. }
  862. function replaceXRanges(comp, options) {
  863. debug('replaceXRanges', comp, options);
  864. return comp.split(/\s+/).map(function(comp) {
  865. return replaceXRange(comp, options);
  866. }).join(' ');
  867. }
  868. function replaceXRange(comp, options) {
  869. comp = comp.trim();
  870. if (!options || typeof options !== 'object')
  871. { options = { loose: !!options, includePrerelease: false }; }
  872. var r = options.loose ? re[XRANGELOOSE] : re[XRANGE];
  873. return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
  874. debug('xRange', comp, ret, gtlt, M, m, p, pr);
  875. var xM = isX(M);
  876. var xm = xM || isX(m);
  877. var xp = xm || isX(p);
  878. var anyX = xp;
  879. if (gtlt === '=' && anyX)
  880. { gtlt = ''; }
  881. if (xM) {
  882. if (gtlt === '>' || gtlt === '<') {
  883. // nothing is allowed
  884. ret = '<0.0.0';
  885. } else {
  886. // nothing is forbidden
  887. ret = '*';
  888. }
  889. } else if (gtlt && anyX) {
  890. // replace X with 0
  891. if (xm)
  892. { m = 0; }
  893. if (xp)
  894. { p = 0; }
  895. if (gtlt === '>') {
  896. // >1 => >=2.0.0
  897. // >1.2 => >=1.3.0
  898. // >1.2.3 => >= 1.2.4
  899. gtlt = '>=';
  900. if (xm) {
  901. M = +M + 1;
  902. m = 0;
  903. p = 0;
  904. } else if (xp) {
  905. m = +m + 1;
  906. p = 0;
  907. }
  908. } else if (gtlt === '<=') {
  909. // <=0.7.x is actually <0.8.0, since any 0.7.x should
  910. // pass. Similarly, <=7.x is actually <8.0.0, etc.
  911. gtlt = '<';
  912. if (xm)
  913. { M = +M + 1; }
  914. else
  915. { m = +m + 1; }
  916. }
  917. ret = gtlt + M + '.' + m + '.' + p;
  918. } else if (xm) {
  919. ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
  920. } else if (xp) {
  921. ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
  922. }
  923. debug('xRange return', ret);
  924. return ret;
  925. });
  926. }
  927. // Because * is AND-ed with everything else in the comparator,
  928. // and '' means "any version", just remove the *s entirely.
  929. function replaceStars(comp, options) {
  930. debug('replaceStars', comp, options);
  931. // Looseness is ignored here. star is always as loose as it gets!
  932. return comp.trim().replace(re[STAR], '');
  933. }
  934. // This function is passed to string.replace(re[HYPHENRANGE])
  935. // M, m, patch, prerelease, build
  936. // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
  937. // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
  938. // 1.2 - 3.4 => >=1.2.0 <3.5.0
  939. function hyphenReplace($0,
  940. from, fM, fm, fp, fpr, fb,
  941. to, tM, tm, tp, tpr, tb) {
  942. if (isX(fM))
  943. { from = ''; }
  944. else if (isX(fm))
  945. { from = '>=' + fM + '.0.0'; }
  946. else if (isX(fp))
  947. { from = '>=' + fM + '.' + fm + '.0'; }
  948. else
  949. { from = '>=' + from; }
  950. if (isX(tM))
  951. { to = ''; }
  952. else if (isX(tm))
  953. { to = '<' + (+tM + 1) + '.0.0'; }
  954. else if (isX(tp))
  955. { to = '<' + tM + '.' + (+tm + 1) + '.0'; }
  956. else if (tpr)
  957. { to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; }
  958. else
  959. { to = '<=' + to; }
  960. return (from + ' ' + to).trim();
  961. }
  962. // if ANY of the sets match ALL of its comparators, then pass
  963. Range.prototype.test = function(version) {
  964. var this$1 = this;
  965. if (!version)
  966. { return false; }
  967. if (typeof version === 'string')
  968. { version = new SemVer(version, this.options); }
  969. for (var i = 0; i < this.set.length; i++) {
  970. if (testSet(this$1.set[i], version, this$1.options))
  971. { return true; }
  972. }
  973. return false;
  974. };
  975. function testSet(set, version, options) {
  976. for (var i = 0; i < set.length; i++) {
  977. if (!set[i].test(version))
  978. { return false; }
  979. }
  980. if (!options)
  981. { options = {}; }
  982. if (version.prerelease.length && !options.includePrerelease) {
  983. // Find the set of versions that are allowed to have prereleases
  984. // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
  985. // That should allow `1.2.3-pr.2` to pass.
  986. // However, `1.2.4-alpha.notready` should NOT be allowed,
  987. // even though it's within the range set by the comparators.
  988. for (var i = 0; i < set.length; i++) {
  989. debug(set[i].semver);
  990. if (set[i].semver === ANY)
  991. { continue; }
  992. if (set[i].semver.prerelease.length > 0) {
  993. var allowed = set[i].semver;
  994. if (allowed.major === version.major &&
  995. allowed.minor === version.minor &&
  996. allowed.patch === version.patch)
  997. { return true; }
  998. }
  999. }
  1000. // Version has a -pre, but it's not one of the ones we like.
  1001. return false;
  1002. }
  1003. return true;
  1004. }
  1005. exports.satisfies = satisfies;
  1006. function satisfies(version, range, options) {
  1007. try {
  1008. range = new Range(range, options);
  1009. } catch (er) {
  1010. return false;
  1011. }
  1012. return range.test(version);
  1013. }
  1014. exports.maxSatisfying = maxSatisfying;
  1015. function maxSatisfying(versions, range, options) {
  1016. var max = null;
  1017. var maxSV = null;
  1018. try {
  1019. var rangeObj = new Range(range, options);
  1020. } catch (er) {
  1021. return null;
  1022. }
  1023. versions.forEach(function (v) {
  1024. if (rangeObj.test(v)) { // satisfies(v, range, options)
  1025. if (!max || maxSV.compare(v) === -1) { // compare(max, v, true)
  1026. max = v;
  1027. maxSV = new SemVer(max, options);
  1028. }
  1029. }
  1030. });
  1031. return max;
  1032. }
  1033. exports.minSatisfying = minSatisfying;
  1034. function minSatisfying(versions, range, options) {
  1035. var min = null;
  1036. var minSV = null;
  1037. try {
  1038. var rangeObj = new Range(range, options);
  1039. } catch (er) {
  1040. return null;
  1041. }
  1042. versions.forEach(function (v) {
  1043. if (rangeObj.test(v)) { // satisfies(v, range, options)
  1044. if (!min || minSV.compare(v) === 1) { // compare(min, v, true)
  1045. min = v;
  1046. minSV = new SemVer(min, options);
  1047. }
  1048. }
  1049. });
  1050. return min;
  1051. }
  1052. exports.validRange = validRange;
  1053. function validRange(range, options) {
  1054. try {
  1055. // Return '*' instead of '' so that truthiness works.
  1056. // This will throw if it's invalid anyway
  1057. return new Range(range, options).range || '*';
  1058. } catch (er) {
  1059. return null;
  1060. }
  1061. }
  1062. // Determine if version is less than all the versions possible in the range
  1063. exports.ltr = ltr;
  1064. function ltr(version, range, options) {
  1065. return outside(version, range, '<', options);
  1066. }
  1067. // Determine if version is greater than all the versions possible in the range.
  1068. exports.gtr = gtr;
  1069. function gtr(version, range, options) {
  1070. return outside(version, range, '>', options);
  1071. }
  1072. exports.outside = outside;
  1073. function outside(version, range, hilo, options) {
  1074. version = new SemVer(version, options);
  1075. range = new Range(range, options);
  1076. var gtfn, ltefn, ltfn, comp, ecomp;
  1077. switch (hilo) {
  1078. case '>':
  1079. gtfn = gt;
  1080. ltefn = lte;
  1081. ltfn = lt;
  1082. comp = '>';
  1083. ecomp = '>=';
  1084. break;
  1085. case '<':
  1086. gtfn = lt;
  1087. ltefn = gte;
  1088. ltfn = gt;
  1089. comp = '<';
  1090. ecomp = '<=';
  1091. break;
  1092. default:
  1093. throw new TypeError('Must provide a hilo val of "<" or ">"');
  1094. }
  1095. // If it satisifes the range it is not outside
  1096. if (satisfies(version, range, options)) {
  1097. return false;
  1098. }
  1099. // From now on, variable terms are as if we're in "gtr" mode.
  1100. // but note that everything is flipped for the "ltr" function.
  1101. for (var i = 0; i < range.set.length; ++i) {
  1102. var comparators = range.set[i];
  1103. var high = null;
  1104. var low = null;
  1105. comparators.forEach(function(comparator) {
  1106. if (comparator.semver === ANY) {
  1107. comparator = new Comparator('>=0.0.0');
  1108. }
  1109. high = high || comparator;
  1110. low = low || comparator;
  1111. if (gtfn(comparator.semver, high.semver, options)) {
  1112. high = comparator;
  1113. } else if (ltfn(comparator.semver, low.semver, options)) {
  1114. low = comparator;
  1115. }
  1116. });
  1117. // If the edge version comparator has a operator then our version
  1118. // isn't outside it
  1119. if (high.operator === comp || high.operator === ecomp) {
  1120. return false;
  1121. }
  1122. // If the lowest version comparator has an operator and our version
  1123. // is less than it then it isn't higher than the range
  1124. if ((!low.operator || low.operator === comp) &&
  1125. ltefn(version, low.semver)) {
  1126. return false;
  1127. } else if (low.operator === ecomp && ltfn(version, low.semver)) {
  1128. return false;
  1129. }
  1130. }
  1131. return true;
  1132. }
  1133. exports.prerelease = prerelease;
  1134. function prerelease(version, options) {
  1135. var parsed = parse(version, options);
  1136. return (parsed && parsed.prerelease.length) ? parsed.prerelease : null;
  1137. }
  1138. exports.intersects = intersects;
  1139. function intersects(r1, r2, options) {
  1140. r1 = new Range(r1, options);
  1141. r2 = new Range(r2, options);
  1142. return r1.intersects(r2)
  1143. }
  1144. exports.coerce = coerce;
  1145. function coerce(version) {
  1146. if (version instanceof SemVer)
  1147. { return version; }
  1148. if (typeof version !== 'string')
  1149. { return null; }
  1150. var match = version.match(re[COERCE]);
  1151. if (match == null)
  1152. { return null; }
  1153. return parse((match[1] || '0') + '.' + (match[2] || '0') + '.' + (match[3] || '0'));
  1154. }
  1155. });
  1156. var semver_1 = semver.SEMVER_SPEC_VERSION;
  1157. var semver_2 = semver.re;
  1158. var semver_3 = semver.src;
  1159. var semver_4 = semver.parse;
  1160. var semver_5 = semver.valid;
  1161. var semver_6 = semver.clean;
  1162. var semver_7 = semver.SemVer;
  1163. var semver_8 = semver.inc;
  1164. var semver_9 = semver.diff;
  1165. var semver_10 = semver.compareIdentifiers;
  1166. var semver_11 = semver.rcompareIdentifiers;
  1167. var semver_12 = semver.major;
  1168. var semver_13 = semver.minor;
  1169. var semver_14 = semver.patch;
  1170. var semver_15 = semver.compare;
  1171. var semver_16 = semver.compareLoose;
  1172. var semver_17 = semver.rcompare;
  1173. var semver_18 = semver.sort;
  1174. var semver_19 = semver.rsort;
  1175. var semver_20 = semver.gt;
  1176. var semver_21 = semver.lt;
  1177. var semver_22 = semver.eq;
  1178. var semver_23 = semver.neq;
  1179. var semver_24 = semver.gte;
  1180. var semver_25 = semver.lte;
  1181. var semver_26 = semver.cmp;
  1182. var semver_27 = semver.Comparator;
  1183. var semver_28 = semver.Range;
  1184. var semver_29 = semver.toComparators;
  1185. var semver_30 = semver.satisfies;
  1186. var semver_31 = semver.maxSatisfying;
  1187. var semver_32 = semver.minSatisfying;
  1188. var semver_33 = semver.validRange;
  1189. var semver_34 = semver.ltr;
  1190. var semver_35 = semver.gtr;
  1191. var semver_36 = semver.outside;
  1192. var semver_37 = semver.prerelease;
  1193. var semver_38 = semver.intersects;
  1194. var semver_39 = semver.coerce;
  1195. //
  1196. function throwError(msg) {
  1197. throw new Error(("[vue-test-utils]: " + msg))
  1198. }
  1199. function warn(msg) {
  1200. console.error(("[vue-test-utils]: " + msg));
  1201. }
  1202. var camelizeRE = /-(\w)/g;
  1203. var camelize = function (str) {
  1204. var camelizedStr = str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; }
  1205. );
  1206. return camelizedStr.charAt(0).toLowerCase() + camelizedStr.slice(1)
  1207. };
  1208. /**
  1209. * Capitalize a string.
  1210. */
  1211. var capitalize = function (str) { return str.charAt(0).toUpperCase() + str.slice(1); };
  1212. /**
  1213. * Hyphenate a camelCase string.
  1214. */
  1215. var hyphenateRE = /\B([A-Z])/g;
  1216. var hyphenate = function (str) { return str.replace(hyphenateRE, '-$1').toLowerCase(); };
  1217. function hasOwnProperty(obj, prop) {
  1218. return Object.prototype.hasOwnProperty.call(obj, prop)
  1219. }
  1220. function resolveComponent(id, components) {
  1221. if (typeof id !== 'string') {
  1222. return
  1223. }
  1224. // check local registration variations first
  1225. if (hasOwnProperty(components, id)) {
  1226. return components[id]
  1227. }
  1228. var camelizedId = camelize(id);
  1229. if (hasOwnProperty(components, camelizedId)) {
  1230. return components[camelizedId]
  1231. }
  1232. var PascalCaseId = capitalize(camelizedId);
  1233. if (hasOwnProperty(components, PascalCaseId)) {
  1234. return components[PascalCaseId]
  1235. }
  1236. // fallback to prototype chain
  1237. return components[id] || components[camelizedId] || components[PascalCaseId]
  1238. }
  1239. var UA =
  1240. typeof window !== 'undefined' &&
  1241. 'navigator' in window &&
  1242. navigator.userAgent.toLowerCase();
  1243. var isPhantomJS = UA && UA.includes && UA.match(/phantomjs/i);
  1244. var isEdge = UA && UA.indexOf('edge/') > 0;
  1245. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  1246. // get the event used to trigger v-model handler that updates bound data
  1247. function getCheckedEvent() {
  1248. var version = Vue.version;
  1249. if (semver.satisfies(version, '2.1.9 - 2.1.10')) {
  1250. return 'click'
  1251. }
  1252. if (semver.satisfies(version, '2.2 - 2.4')) {
  1253. return isChrome ? 'click' : 'change'
  1254. }
  1255. // change is handler for version 2.0 - 2.1.8, and 2.5+
  1256. return 'change'
  1257. }
  1258. //
  1259. function isDomSelector(selector) {
  1260. if (typeof selector !== 'string') {
  1261. return false
  1262. }
  1263. try {
  1264. if (typeof document === 'undefined') {
  1265. throwError(
  1266. "mount must be run in a browser environment like " +
  1267. "PhantomJS, jsdom or chrome"
  1268. );
  1269. }
  1270. } catch (error) {
  1271. throwError(
  1272. "mount must be run in a browser environment like " +
  1273. "PhantomJS, jsdom or chrome"
  1274. );
  1275. }
  1276. try {
  1277. document.querySelector(selector);
  1278. return true
  1279. } catch (error) {
  1280. return false
  1281. }
  1282. }
  1283. function isVueComponent(c) {
  1284. if (isConstructor(c)) {
  1285. return true
  1286. }
  1287. if (c === null || typeof c !== 'object') {
  1288. return false
  1289. }
  1290. if (c.extends || c._Ctor) {
  1291. return true
  1292. }
  1293. if (typeof c.template === 'string') {
  1294. return true
  1295. }
  1296. return typeof c.render === 'function'
  1297. }
  1298. function componentNeedsCompiling(component) {
  1299. return (
  1300. component &&
  1301. !component.render &&
  1302. (component.template || component.extends || component.extendOptions) &&
  1303. !component.functional
  1304. )
  1305. }
  1306. function isRefSelector(refOptionsObject) {
  1307. if (
  1308. typeof refOptionsObject !== 'object' ||
  1309. Object.keys(refOptionsObject || {}).length !== 1
  1310. ) {
  1311. return false
  1312. }
  1313. return typeof refOptionsObject.ref === 'string'
  1314. }
  1315. function isNameSelector(nameOptionsObject) {
  1316. if (typeof nameOptionsObject !== 'object' || nameOptionsObject === null) {
  1317. return false
  1318. }
  1319. return !!nameOptionsObject.name
  1320. }
  1321. function isConstructor(c) {
  1322. return typeof c === 'function' && c.cid
  1323. }
  1324. function isDynamicComponent(c) {
  1325. return typeof c === 'function' && !c.cid
  1326. }
  1327. function isComponentOptions(c) {
  1328. return typeof c === 'object' && (c.template || c.render)
  1329. }
  1330. function isFunctionalComponent(c) {
  1331. if (!isVueComponent(c)) {
  1332. return false
  1333. }
  1334. if (isConstructor(c)) {
  1335. return c.options.functional
  1336. }
  1337. return c.functional
  1338. }
  1339. function templateContainsComponent(
  1340. template,
  1341. name
  1342. ) {
  1343. return [capitalize, camelize, hyphenate].some(function (format) {
  1344. var re = new RegExp(("<" + (format(name)) + "\\s*(\\s|>|(/>))"), 'g');
  1345. return re.test(template)
  1346. })
  1347. }
  1348. function isPlainObject(c) {
  1349. return Object.prototype.toString.call(c) === '[object Object]'
  1350. }
  1351. function makeMap(str, expectsLowerCase) {
  1352. var map = Object.create(null);
  1353. var list = str.split(',');
  1354. for (var i = 0; i < list.length; i++) {
  1355. map[list[i]] = true;
  1356. }
  1357. return expectsLowerCase
  1358. ? function(val) {
  1359. return map[val.toLowerCase()]
  1360. }
  1361. : function(val) {
  1362. return map[val]
  1363. }
  1364. }
  1365. var isHTMLTag = makeMap(
  1366. 'html,body,base,head,link,meta,style,title,' +
  1367. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  1368. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  1369. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  1370. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,' +
  1371. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  1372. 'caption,col,colgroup,table,thead,tbody,td,th,tr,video,' +
  1373. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  1374. 'output,progress,select,textarea,' +
  1375. 'details,dialog,menu,menuitem,summary,' +
  1376. 'content,element,shadow,template,blockquote,iframe,tfoot'
  1377. );
  1378. // this map is intentionally selective, only covering SVG elements that may
  1379. // contain child elements.
  1380. var isSVG = makeMap(
  1381. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  1382. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  1383. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  1384. true
  1385. );
  1386. var isReservedTag = function (tag) { return isHTMLTag(tag) || isSVG(tag); };
  1387. var NAME_SELECTOR = 'NAME_SELECTOR';
  1388. var COMPONENT_SELECTOR = 'COMPONENT_SELECTOR';
  1389. var REF_SELECTOR = 'REF_SELECTOR';
  1390. var DOM_SELECTOR = 'DOM_SELECTOR';
  1391. var INVALID_SELECTOR = 'INVALID_SELECTOR';
  1392. var COMPAT_SYNC_MODE = 'COMPAT_SYNC_MODE';
  1393. var VUE_VERSION = Number(
  1394. ((Vue.version.split('.')[0]) + "." + (Vue.version.split('.')[1]))
  1395. );
  1396. var FUNCTIONAL_OPTIONS =
  1397. VUE_VERSION >= 2.5 ? 'fnOptions' : 'functionalOptions';
  1398. var BEFORE_RENDER_LIFECYCLE_HOOK = semver.gt(Vue.version, '2.1.8')
  1399. ? 'beforeCreate'
  1400. : 'beforeMount';
  1401. var CREATE_ELEMENT_ALIAS = semver.gt(Vue.version, '2.1.5')
  1402. ? '_c'
  1403. : '_h';
  1404. //
  1405. function getSelectorType(selector) {
  1406. if (isDomSelector(selector)) { return DOM_SELECTOR }
  1407. if (isVueComponent(selector)) { return COMPONENT_SELECTOR }
  1408. if (isNameSelector(selector)) { return NAME_SELECTOR }
  1409. if (isRefSelector(selector)) { return REF_SELECTOR }
  1410. return INVALID_SELECTOR
  1411. }
  1412. function getSelector(
  1413. selector,
  1414. methodName
  1415. ) {
  1416. var type = getSelectorType(selector);
  1417. if (type === INVALID_SELECTOR) {
  1418. throwError(
  1419. "wrapper." + methodName + "() must be passed a valid CSS selector, Vue " +
  1420. "constructor, or valid find option object"
  1421. );
  1422. }
  1423. return {
  1424. type: type,
  1425. value: selector
  1426. }
  1427. }
  1428. //
  1429. function getRealChild(vnode) {
  1430. var compOptions = vnode && vnode.componentOptions;
  1431. if (compOptions && compOptions.Ctor.options.abstract) {
  1432. return getRealChild(getFirstComponentChild(compOptions.children))
  1433. } else {
  1434. return vnode
  1435. }
  1436. }
  1437. function isSameChild(child, oldChild) {
  1438. return oldChild.key === child.key && oldChild.tag === child.tag
  1439. }
  1440. function getFirstComponentChild(children) {
  1441. if (Array.isArray(children)) {
  1442. for (var i = 0; i < children.length; i++) {
  1443. var c = children[i];
  1444. if (c && (c.componentOptions || isAsyncPlaceholder(c))) {
  1445. return c
  1446. }
  1447. }
  1448. }
  1449. }
  1450. function isPrimitive(value) {
  1451. return (
  1452. typeof value === 'string' ||
  1453. typeof value === 'number' ||
  1454. // $FlowIgnore
  1455. typeof value === 'symbol' ||
  1456. typeof value === 'boolean'
  1457. )
  1458. }
  1459. function isAsyncPlaceholder(node) {
  1460. return node.isComment && node.asyncFactory
  1461. }
  1462. function hasParentTransition(vnode) {
  1463. while ((vnode = vnode.parent)) {
  1464. if (vnode.data.transition) {
  1465. return true
  1466. }
  1467. }
  1468. }
  1469. var TransitionStub = {
  1470. render: function render(h) {
  1471. var children = this.$options._renderChildren;
  1472. if (!children) {
  1473. return
  1474. }
  1475. // filter out text nodes (possible whitespaces)
  1476. children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); });
  1477. /* istanbul ignore if */
  1478. if (!children.length) {
  1479. return
  1480. }
  1481. // warn multiple elements
  1482. if (children.length > 1) {
  1483. warn(
  1484. "<transition> can only be used on a single element. " +
  1485. "Use " +
  1486. '<transition-group> for lists.'
  1487. );
  1488. }
  1489. var mode = this.mode;
  1490. // warn invalid mode
  1491. if (mode && mode !== 'in-out' && mode !== 'out-in') {
  1492. warn('invalid <transition> mode: ' + mode);
  1493. }
  1494. var rawChild = children[0];
  1495. // if this is a component root node and the component's
  1496. // parent container node also has transition, skip.
  1497. if (hasParentTransition(this.$vnode)) {
  1498. return rawChild
  1499. }
  1500. // apply transition data to child
  1501. // use getRealChild() to ignore abstract components e.g. keep-alive
  1502. var child = getRealChild(rawChild);
  1503. if (!child) {
  1504. return rawChild
  1505. }
  1506. var id = "__transition-" + (this._uid) + "-";
  1507. child.key =
  1508. child.key == null
  1509. ? child.isComment
  1510. ? id + 'comment'
  1511. : id + child.tag
  1512. : isPrimitive(child.key)
  1513. ? String(child.key).indexOf(id) === 0
  1514. ? child.key
  1515. : id + child.key
  1516. : child.key;
  1517. var data = child.data || (child.data = {});
  1518. var oldRawChild = this._vnode;
  1519. var oldChild = getRealChild(oldRawChild);
  1520. if (
  1521. child.data.directives &&
  1522. child.data.directives.some(function (d) { return d.name === 'show'; })
  1523. ) {
  1524. child.data.show = true;
  1525. }
  1526. // mark v-show
  1527. // so that the transition module can hand over the control
  1528. // to the directive
  1529. if (
  1530. child.data.directives &&
  1531. child.data.directives.some(function (d) { return d.name === 'show'; })
  1532. ) {
  1533. child.data.show = true;
  1534. }
  1535. if (
  1536. oldChild &&
  1537. oldChild.data &&
  1538. !isSameChild(child, oldChild) &&
  1539. !isAsyncPlaceholder(oldChild) &&
  1540. // #6687 component root is a comment node
  1541. !(
  1542. oldChild.componentInstance &&
  1543. oldChild.componentInstance._vnode.isComment
  1544. )
  1545. ) {
  1546. oldChild.data = Object.assign({}, data);
  1547. }
  1548. return rawChild
  1549. }
  1550. }
  1551. //
  1552. var TransitionGroupStub = {
  1553. render: function render(h) {
  1554. var tag = this.tag || this.$vnode.data.tag || 'span';
  1555. var children = this.$slots.default || [];
  1556. return h(tag, null, children)
  1557. }
  1558. }
  1559. var config = {
  1560. stubs: {
  1561. transition: TransitionStub,
  1562. 'transition-group': TransitionGroupStub
  1563. },
  1564. mocks: {},
  1565. methods: {},
  1566. provide: {},
  1567. logModifiedComponents: true,
  1568. silent: true
  1569. }
  1570. //
  1571. var WrapperArray = function WrapperArray(wrappers) {
  1572. var length = wrappers.length;
  1573. // $FlowIgnore
  1574. Object.defineProperty(this, 'wrappers', {
  1575. get: function () { return wrappers; },
  1576. set: function () { return throwError('wrapperArray.wrappers is read-only'); }
  1577. });
  1578. // $FlowIgnore
  1579. Object.defineProperty(this, 'length', {
  1580. get: function () { return length; },
  1581. set: function () { return throwError('wrapperArray.length is read-only'); }
  1582. });
  1583. };
  1584. WrapperArray.prototype.at = function at (index) {
  1585. if (index > this.length - 1) {
  1586. throwError(("no item exists at " + index));
  1587. }
  1588. return this.wrappers[index]
  1589. };
  1590. WrapperArray.prototype.attributes = function attributes () {
  1591. this.throwErrorIfWrappersIsEmpty('attributes');
  1592. throwError(
  1593. "attributes must be called on a single wrapper, use " +
  1594. "at(i) to access a wrapper"
  1595. );
  1596. };
  1597. WrapperArray.prototype.classes = function classes () {
  1598. this.throwErrorIfWrappersIsEmpty('classes');
  1599. throwError(
  1600. "classes must be called on a single wrapper, use " +
  1601. "at(i) to access a wrapper"
  1602. );
  1603. };
  1604. WrapperArray.prototype.contains = function contains (selector) {
  1605. this.throwErrorIfWrappersIsEmpty('contains');
  1606. return this.wrappers.every(function (wrapper) { return wrapper.contains(selector); })
  1607. };
  1608. WrapperArray.prototype.exists = function exists () {
  1609. return this.length > 0 && this.wrappers.every(function (wrapper) { return wrapper.exists(); })
  1610. };
  1611. WrapperArray.prototype.filter = function filter (predicate) {
  1612. return new WrapperArray(this.wrappers.filter(predicate))
  1613. };
  1614. WrapperArray.prototype.emitted = function emitted () {
  1615. this.throwErrorIfWrappersIsEmpty('emitted');
  1616. throwError(
  1617. "emitted must be called on a single wrapper, use " +
  1618. "at(i) to access a wrapper"
  1619. );
  1620. };
  1621. WrapperArray.prototype.emittedByOrder = function emittedByOrder () {
  1622. this.throwErrorIfWrappersIsEmpty('emittedByOrder');
  1623. throwError(
  1624. "emittedByOrder must be called on a single wrapper, " +
  1625. "use at(i) to access a wrapper"
  1626. );
  1627. };
  1628. WrapperArray.prototype.findAll = function findAll () {
  1629. this.throwErrorIfWrappersIsEmpty('findAll');
  1630. throwError(
  1631. "findAll must be called on a single wrapper, use " +
  1632. "at(i) to access a wrapper"
  1633. );
  1634. };
  1635. WrapperArray.prototype.find = function find () {
  1636. this.throwErrorIfWrappersIsEmpty('find');
  1637. throwError(
  1638. "find must be called on a single wrapper, use at(i) " +
  1639. "to access a wrapper"
  1640. );
  1641. };
  1642. WrapperArray.prototype.html = function html () {
  1643. this.throwErrorIfWrappersIsEmpty('html');
  1644. throwError(
  1645. "html must be called on a single wrapper, use at(i) " +
  1646. "to access a wrapper"
  1647. );
  1648. };
  1649. WrapperArray.prototype.is = function is (selector) {
  1650. this.throwErrorIfWrappersIsEmpty('is');
  1651. return this.wrappers.every(function (wrapper) { return wrapper.is(selector); })
  1652. };
  1653. WrapperArray.prototype.isEmpty = function isEmpty () {
  1654. this.throwErrorIfWrappersIsEmpty('isEmpty');
  1655. return this.wrappers.every(function (wrapper) { return wrapper.isEmpty(); })
  1656. };
  1657. WrapperArray.prototype.isVisible = function isVisible () {
  1658. this.throwErrorIfWrappersIsEmpty('isVisible');
  1659. return this.wrappers.every(function (wrapper) { return wrapper.isVisible(); })
  1660. };
  1661. WrapperArray.prototype.isVueInstance = function isVueInstance () {
  1662. this.throwErrorIfWrappersIsEmpty('isVueInstance');
  1663. return this.wrappers.every(function (wrapper) { return wrapper.isVueInstance(); })
  1664. };
  1665. WrapperArray.prototype.name = function name () {
  1666. this.throwErrorIfWrappersIsEmpty('name');
  1667. throwError(
  1668. "name must be called on a single wrapper, use at(i) " +
  1669. "to access a wrapper"
  1670. );
  1671. };
  1672. WrapperArray.prototype.props = function props () {
  1673. this.throwErrorIfWrappersIsEmpty('props');
  1674. throwError(
  1675. "props must be called on a single wrapper, use " +
  1676. "at(i) to access a wrapper"
  1677. );
  1678. };
  1679. WrapperArray.prototype.text = function text () {
  1680. this.throwErrorIfWrappersIsEmpty('text');
  1681. throwError(
  1682. "text must be called on a single wrapper, use at(i) " +
  1683. "to access a wrapper"
  1684. );
  1685. };
  1686. WrapperArray.prototype.throwErrorIfWrappersIsEmpty = function throwErrorIfWrappersIsEmpty (method) {
  1687. if (this.wrappers.length === 0) {
  1688. throwError((method + " cannot be called on 0 items"));
  1689. }
  1690. };
  1691. WrapperArray.prototype.setData = function setData (data) {
  1692. this.throwErrorIfWrappersIsEmpty('setData');
  1693. this.wrappers.forEach(function (wrapper) { return wrapper.setData(data); });
  1694. };
  1695. WrapperArray.prototype.setMethods = function setMethods (props) {
  1696. this.throwErrorIfWrappersIsEmpty('setMethods');
  1697. this.wrappers.forEach(function (wrapper) { return wrapper.setMethods(props); });
  1698. };
  1699. WrapperArray.prototype.setProps = function setProps (props) {
  1700. this.throwErrorIfWrappersIsEmpty('setProps');
  1701. this.wrappers.forEach(function (wrapper) { return wrapper.setProps(props); });
  1702. };
  1703. WrapperArray.prototype.setValue = function setValue (value) {
  1704. this.throwErrorIfWrappersIsEmpty('setValue');
  1705. this.wrappers.forEach(function (wrapper) { return wrapper.setValue(value); });
  1706. };
  1707. WrapperArray.prototype.setChecked = function setChecked (checked) {
  1708. if ( checked === void 0 ) checked = true;
  1709. this.throwErrorIfWrappersIsEmpty('setChecked');
  1710. this.wrappers.forEach(function (wrapper) { return wrapper.setChecked(checked); });
  1711. };
  1712. WrapperArray.prototype.setSelected = function setSelected () {
  1713. this.throwErrorIfWrappersIsEmpty('setSelected');
  1714. throwError(
  1715. "setSelected must be called on a single wrapper, " +
  1716. "use at(i) to access a wrapper"
  1717. );
  1718. };
  1719. WrapperArray.prototype.trigger = function trigger (event, options) {
  1720. this.throwErrorIfWrappersIsEmpty('trigger');
  1721. this.wrappers.forEach(function (wrapper) { return wrapper.trigger(event, options); });
  1722. };
  1723. WrapperArray.prototype.update = function update () {
  1724. this.throwErrorIfWrappersIsEmpty('update');
  1725. warn(
  1726. "update has been removed. All changes are now " +
  1727. "synchrnous without calling update"
  1728. );
  1729. };
  1730. WrapperArray.prototype.destroy = function destroy () {
  1731. this.throwErrorIfWrappersIsEmpty('destroy');
  1732. this.wrappers.forEach(function (wrapper) { return wrapper.destroy(); });
  1733. };
  1734. //
  1735. var ErrorWrapper = function ErrorWrapper(selector) {
  1736. this.selector = selector;
  1737. };
  1738. ErrorWrapper.prototype.at = function at () {
  1739. throwError(
  1740. ("find did not return " + (this.selector) + ", cannot call at() on empty Wrapper")
  1741. );
  1742. };
  1743. ErrorWrapper.prototype.attributes = function attributes () {
  1744. throwError(
  1745. ("find did not return " + (this.selector) + ", cannot call attributes() on empty Wrapper")
  1746. );
  1747. };
  1748. ErrorWrapper.prototype.classes = function classes () {
  1749. throwError(
  1750. ("find did not return " + (this.selector) + ", cannot call classes() on empty Wrapper")
  1751. );
  1752. };
  1753. ErrorWrapper.prototype.contains = function contains () {
  1754. throwError(
  1755. ("find did not return " + (this.selector) + ", cannot call contains() on empty Wrapper")
  1756. );
  1757. };
  1758. ErrorWrapper.prototype.emitted = function emitted () {
  1759. throwError(
  1760. ("find did not return " + (this.selector) + ", cannot call emitted() on empty Wrapper")
  1761. );
  1762. };
  1763. ErrorWrapper.prototype.emittedByOrder = function emittedByOrder () {
  1764. throwError(
  1765. ("find did not return " + (this.selector) + ", cannot call emittedByOrder() on empty Wrapper")
  1766. );
  1767. };
  1768. ErrorWrapper.prototype.exists = function exists () {
  1769. return false
  1770. };
  1771. ErrorWrapper.prototype.filter = function filter () {
  1772. throwError(
  1773. ("find did not return " + (this.selector) + ", cannot call filter() on empty Wrapper")
  1774. );
  1775. };
  1776. ErrorWrapper.prototype.visible = function visible () {
  1777. throwError(
  1778. ("find did not return " + (this.selector) + ", cannot call visible() on empty Wrapper")
  1779. );
  1780. };
  1781. ErrorWrapper.prototype.hasAttribute = function hasAttribute () {
  1782. throwError(
  1783. ("find did not return " + (this.selector) + ", cannot call hasAttribute() on empty Wrapper")
  1784. );
  1785. };
  1786. ErrorWrapper.prototype.hasClass = function hasClass () {
  1787. throwError(
  1788. ("find did not return " + (this.selector) + ", cannot call hasClass() on empty Wrapper")
  1789. );
  1790. };
  1791. ErrorWrapper.prototype.hasProp = function hasProp () {
  1792. throwError(
  1793. ("find did not return " + (this.selector) + ", cannot call hasProp() on empty Wrapper")
  1794. );
  1795. };
  1796. ErrorWrapper.prototype.hasStyle = function hasStyle () {
  1797. throwError(
  1798. ("find did not return " + (this.selector) + ", cannot call hasStyle() on empty Wrapper")
  1799. );
  1800. };
  1801. ErrorWrapper.prototype.findAll = function findAll () {
  1802. throwError(
  1803. ("find did not return " + (this.selector) + ", cannot call findAll() on empty Wrapper")
  1804. );
  1805. };
  1806. ErrorWrapper.prototype.find = function find () {
  1807. throwError(
  1808. ("find did not return " + (this.selector) + ", cannot call find() on empty Wrapper")
  1809. );
  1810. };
  1811. ErrorWrapper.prototype.html = function html () {
  1812. throwError(
  1813. ("find did not return " + (this.selector) + ", cannot call html() on empty Wrapper")
  1814. );
  1815. };
  1816. ErrorWrapper.prototype.is = function is () {
  1817. throwError(
  1818. ("find did not return " + (this.selector) + ", cannot call is() on empty Wrapper")
  1819. );
  1820. };
  1821. ErrorWrapper.prototype.isEmpty = function isEmpty () {
  1822. throwError(
  1823. ("find did not return " + (this.selector) + ", cannot call isEmpty() on empty Wrapper")
  1824. );
  1825. };
  1826. ErrorWrapper.prototype.isVisible = function isVisible () {
  1827. throwError(
  1828. ("find did not return " + (this.selector) + ", cannot call isVisible() on empty Wrapper")
  1829. );
  1830. };
  1831. ErrorWrapper.prototype.isVueInstance = function isVueInstance () {
  1832. throwError(
  1833. ("find did not return " + (this.selector) + ", cannot call isVueInstance() on empty Wrapper")
  1834. );
  1835. };
  1836. ErrorWrapper.prototype.name = function name () {
  1837. throwError(
  1838. ("find did not return " + (this.selector) + ", cannot call name() on empty Wrapper")
  1839. );
  1840. };
  1841. ErrorWrapper.prototype.props = function props () {
  1842. throwError(
  1843. ("find did not return " + (this.selector) + ", cannot call props() on empty Wrapper")
  1844. );
  1845. };
  1846. ErrorWrapper.prototype.text = function text () {
  1847. throwError(
  1848. ("find did not return " + (this.selector) + ", cannot call text() on empty Wrapper")
  1849. );
  1850. };
  1851. ErrorWrapper.prototype.setComputed = function setComputed () {
  1852. throwError(
  1853. ("find did not return " + (this.selector) + ", cannot call setComputed() on empty Wrapper")
  1854. );
  1855. };
  1856. ErrorWrapper.prototype.setData = function setData () {
  1857. throwError(
  1858. ("find did not return " + (this.selector) + ", cannot call setData() on empty Wrapper")
  1859. );
  1860. };
  1861. ErrorWrapper.prototype.setMethods = function setMethods () {
  1862. throwError(
  1863. ("find did not return " + (this.selector) + ", cannot call setMethods() on empty Wrapper")
  1864. );
  1865. };
  1866. ErrorWrapper.prototype.setProps = function setProps () {
  1867. throwError(
  1868. ("find did not return " + (this.selector) + ", cannot call setProps() on empty Wrapper")
  1869. );
  1870. };
  1871. ErrorWrapper.prototype.setValue = function setValue () {
  1872. throwError(
  1873. ("find did not return " + (this.selector) + ", cannot call setValue() on empty Wrapper")
  1874. );
  1875. };
  1876. ErrorWrapper.prototype.setChecked = function setChecked () {
  1877. throwError(
  1878. ("find did not return " + (this.selector) + ", cannot call setChecked() on empty Wrapper")
  1879. );
  1880. };
  1881. ErrorWrapper.prototype.setSelected = function setSelected () {
  1882. throwError(
  1883. ("find did not return " + (this.selector) + ", cannot call setSelected() on empty Wrapper")
  1884. );
  1885. };
  1886. ErrorWrapper.prototype.trigger = function trigger () {
  1887. throwError(
  1888. ("find did not return " + (this.selector) + ", cannot call trigger() on empty Wrapper")
  1889. );
  1890. };
  1891. ErrorWrapper.prototype.update = function update () {
  1892. throwError(
  1893. "update has been removed from vue-test-utils." +
  1894. "All updates are now synchronous by default"
  1895. );
  1896. };
  1897. ErrorWrapper.prototype.destroy = function destroy () {
  1898. throwError(
  1899. ("find did not return " + (this.selector) + ", cannot call destroy() on empty Wrapper")
  1900. );
  1901. };
  1902. //
  1903. function findDOMNodes(
  1904. element,
  1905. selector
  1906. ) {
  1907. var nodes = [];
  1908. if (!element || !element.querySelectorAll || !element.matches) {
  1909. return nodes
  1910. }
  1911. if (element.matches(selector)) {
  1912. nodes.push(element);
  1913. }
  1914. // $FlowIgnore
  1915. return nodes.concat([].slice.call(element.querySelectorAll(selector)))
  1916. }
  1917. function vmMatchesName(vm, name) {
  1918. return (
  1919. !!name && (vm.name === name || (vm.$options && vm.$options.name === name))
  1920. )
  1921. }
  1922. function vmCtorMatches(vm, component) {
  1923. if (
  1924. (vm.$options && vm.$options.$_vueTestUtils_original === component) ||
  1925. vm.$_vueTestUtils_original === component
  1926. ) {
  1927. return true
  1928. }
  1929. var Ctor = isConstructor(component)
  1930. ? component.options._Ctor
  1931. : component._Ctor;
  1932. if (!Ctor) {
  1933. return false
  1934. }
  1935. if (vm.constructor.extendOptions === component) {
  1936. return true
  1937. }
  1938. if (component.functional) {
  1939. return Object.keys(vm._Ctor || {}).some(function (c) {
  1940. return component === vm._Ctor[c].extendOptions
  1941. })
  1942. }
  1943. }
  1944. function matches(node, selector) {
  1945. if (selector.type === DOM_SELECTOR) {
  1946. var element = node instanceof Element ? node : node.elm;
  1947. return element && element.matches && element.matches(selector.value)
  1948. }
  1949. var isFunctionalSelector = isConstructor(selector.value)
  1950. ? selector.value.options.functional
  1951. : selector.value.functional;
  1952. var componentInstance = isFunctionalSelector
  1953. ? node[FUNCTIONAL_OPTIONS]
  1954. : node.child;
  1955. if (!componentInstance) {
  1956. return false
  1957. }
  1958. if (selector.type === COMPONENT_SELECTOR) {
  1959. if (vmCtorMatches(componentInstance, selector.value)) {
  1960. return true
  1961. }
  1962. }
  1963. // Fallback to name selector for COMPONENT_SELECTOR for Vue < 2.1
  1964. var nameSelector = isConstructor(selector.value)
  1965. ? selector.value.extendOptions.name
  1966. : selector.value.name;
  1967. return vmMatchesName(componentInstance, nameSelector)
  1968. }
  1969. //
  1970. function findAllInstances(rootVm) {
  1971. var instances = [rootVm];
  1972. var i = 0;
  1973. while (i < instances.length) {
  1974. var vm = instances[i]
  1975. ;(vm.$children || []).forEach(function (child) {
  1976. instances.push(child);
  1977. });
  1978. i++;
  1979. }
  1980. return instances
  1981. }
  1982. function findAllVNodes(vnode, selector) {
  1983. var matchingNodes = [];
  1984. var nodes = [vnode];
  1985. while (nodes.length) {
  1986. var node = nodes.shift();
  1987. if (node.children) {
  1988. var children = [].concat( node.children ).reverse();
  1989. children.forEach(function (n) {
  1990. nodes.unshift(n);
  1991. });
  1992. }
  1993. if (node.child) {
  1994. nodes.unshift(node.child._vnode);
  1995. }
  1996. if (matches(node, selector)) {
  1997. matchingNodes.push(node);
  1998. }
  1999. }
  2000. return matchingNodes
  2001. }
  2002. function removeDuplicateNodes(vNodes) {
  2003. var vNodeElms = vNodes.map(function (vNode) { return vNode.elm; });
  2004. return vNodes.filter(function (vNode, index) { return index === vNodeElms.indexOf(vNode.elm); })
  2005. }
  2006. function find(
  2007. root,
  2008. vm,
  2009. selector
  2010. ) {
  2011. if (root instanceof Element && selector.type !== DOM_SELECTOR) {
  2012. throwError(
  2013. "cannot find a Vue instance on a DOM node. The node " +
  2014. "you are calling find on does not exist in the " +
  2015. "VDom. Are you adding the node as innerHTML?"
  2016. );
  2017. }
  2018. if (
  2019. selector.type === COMPONENT_SELECTOR &&
  2020. (selector.value.functional ||
  2021. (selector.value.options && selector.value.options.functional)) &&
  2022. VUE_VERSION < 2.3
  2023. ) {
  2024. throwError(
  2025. "find for functional components is not supported " + "in Vue < 2.3"
  2026. );
  2027. }
  2028. if (root instanceof Element) {
  2029. return findDOMNodes(root, selector.value)
  2030. }
  2031. if (!root && selector.type !== DOM_SELECTOR) {
  2032. throwError(
  2033. "cannot find a Vue instance on a DOM node. The node " +
  2034. "you are calling find on does not exist in the " +
  2035. "VDom. Are you adding the node as innerHTML?"
  2036. );
  2037. }
  2038. if (!vm && selector.type === REF_SELECTOR) {
  2039. throwError("$ref selectors can only be used on Vue component " + "wrappers");
  2040. }
  2041. if (vm && vm.$refs && selector.value.ref in vm.$refs) {
  2042. var refs = vm.$refs[selector.value.ref];
  2043. return Array.isArray(refs) ? refs : [refs]
  2044. }
  2045. var nodes = findAllVNodes(root, selector);
  2046. var dedupedNodes = removeDuplicateNodes(nodes);
  2047. if (nodes.length > 0 || selector.type !== DOM_SELECTOR) {
  2048. return dedupedNodes
  2049. }
  2050. // Fallback in case element exists in HTML, but not in vnode tree
  2051. // (e.g. if innerHTML is set as a domProp)
  2052. return findDOMNodes(root.elm, selector.value)
  2053. }
  2054. //
  2055. function createWrapper(
  2056. node,
  2057. options
  2058. ) {
  2059. if ( options === void 0 ) options = {};
  2060. var componentInstance = node.child;
  2061. if (componentInstance) {
  2062. return new VueWrapper(componentInstance, options)
  2063. }
  2064. return node instanceof Vue
  2065. ? new VueWrapper(node, options)
  2066. : new Wrapper(node, options)
  2067. }
  2068. //
  2069. var i = 0;
  2070. function orderDeps(watcher) {
  2071. watcher.deps.forEach(function (dep) {
  2072. if (dep._sortedId === i) {
  2073. return
  2074. }
  2075. dep._sortedId = i;
  2076. dep.subs.forEach(orderDeps);
  2077. dep.subs = dep.subs.sort(function (a, b) { return a.id - b.id; });
  2078. });
  2079. }
  2080. function orderVmWatchers(vm) {
  2081. if (vm._watchers) {
  2082. vm._watchers.forEach(orderDeps);
  2083. }
  2084. if (vm._computedWatchers) {
  2085. Object.keys(vm._computedWatchers).forEach(function (computedWatcher) {
  2086. orderDeps(vm._computedWatchers[computedWatcher]);
  2087. });
  2088. }
  2089. vm._watcher && orderDeps(vm._watcher);
  2090. vm.$children.forEach(orderVmWatchers);
  2091. }
  2092. function orderWatchers(vm) {
  2093. orderVmWatchers(vm);
  2094. i++;
  2095. }
  2096. function recursivelySetData(vm, target, data) {
  2097. Object.keys(data).forEach(function (key) {
  2098. var val = data[key];
  2099. var targetVal = target[key];
  2100. if (isPlainObject(val) && isPlainObject(targetVal)) {
  2101. recursivelySetData(vm, targetVal, val);
  2102. } else {
  2103. vm.$set(target, key, val);
  2104. }
  2105. });
  2106. }
  2107. var abort = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2108. var afterprint = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2109. var animationend = {"eventInterface":"AnimationEvent","bubbles":true,"cancelable":false};
  2110. var animationiteration = {"eventInterface":"AnimationEvent","bubbles":true,"cancelable":false};
  2111. var animationstart = {"eventInterface":"AnimationEvent","bubbles":true,"cancelable":false};
  2112. var appinstalled = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2113. var audioprocess = {"eventInterface":"AudioProcessingEvent"};
  2114. var audioend = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2115. var audiostart = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2116. var beforeprint = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2117. var beforeunload = {"eventInterface":"BeforeUnloadEvent","bubbles":false,"cancelable":true};
  2118. var beginEvent = {"eventInterface":"TimeEvent","bubbles":false,"cancelable":false};
  2119. var blur = {"eventInterface":"FocusEvent","bubbles":false,"cancelable":false};
  2120. var boundary = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false};
  2121. var cached = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2122. var canplay = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2123. var canplaythrough = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2124. var change = {"eventInterface":"Event","bubbles":true,"cancelable":false};
  2125. var chargingchange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2126. var chargingtimechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2127. var checking = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2128. var click = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
  2129. var close = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2130. var complete = {"eventInterface":"OfflineAudioCompletionEvent"};
  2131. var compositionend = {"eventInterface":"CompositionEvent","bubbles":true,"cancelable":true};
  2132. var compositionstart = {"eventInterface":"CompositionEvent","bubbles":true,"cancelable":true};
  2133. var compositionupdate = {"eventInterface":"CompositionEvent","bubbles":true,"cancelable":false};
  2134. var contextmenu = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
  2135. var copy = {"eventInterface":"ClipboardEvent"};
  2136. var cut = {"eventInterface":"ClipboardEvent","bubbles":true,"cancelable":true};
  2137. var dblclick = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
  2138. var devicechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2139. var devicelight = {"eventInterface":"DeviceLightEvent","bubbles":false,"cancelable":false};
  2140. var devicemotion = {"eventInterface":"DeviceMotionEvent","bubbles":false,"cancelable":false};
  2141. var deviceorientation = {"eventInterface":"DeviceOrientationEvent","bubbles":false,"cancelable":false};
  2142. var deviceproximity = {"eventInterface":"DeviceProximityEvent","bubbles":false,"cancelable":false};
  2143. var dischargingtimechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2144. var DOMActivate = {"eventInterface":"UIEvent","bubbles":true,"cancelable":true};
  2145. var DOMAttributeNameChanged = {"eventInterface":"MutationNameEvent","bubbles":true,"cancelable":true};
  2146. var DOMAttrModified = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true};
  2147. var DOMCharacterDataModified = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true};
  2148. var DOMContentLoaded = {"eventInterface":"Event","bubbles":true,"cancelable":true};
  2149. var DOMElementNameChanged = {"eventInterface":"MutationNameEvent","bubbles":true,"cancelable":true};
  2150. var DOMFocusIn = {"eventInterface":"FocusEvent","bubbles":true,"cancelable":true};
  2151. var DOMFocusOut = {"eventInterface":"FocusEvent","bubbles":true,"cancelable":true};
  2152. var DOMNodeInserted = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true};
  2153. var DOMNodeInsertedIntoDocument = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true};
  2154. var DOMNodeRemoved = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true};
  2155. var DOMNodeRemovedFromDocument = {"eventInterface":"MutationEvent","bubbles":true,"cancelable":true};
  2156. var DOMSubtreeModified = {"eventInterface":"MutationEvent"};
  2157. var downloading = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2158. var drag = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true};
  2159. var dragend = {"eventInterface":"DragEvent","bubbles":true,"cancelable":false};
  2160. var dragenter = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true};
  2161. var dragleave = {"eventInterface":"DragEvent","bubbles":true,"cancelable":false};
  2162. var dragover = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true};
  2163. var dragstart = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true};
  2164. var drop = {"eventInterface":"DragEvent","bubbles":true,"cancelable":true};
  2165. var durationchange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2166. var emptied = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2167. var end = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2168. var ended = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2169. var endEvent = {"eventInterface":"TimeEvent","bubbles":false,"cancelable":false};
  2170. var error = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2171. var focus = {"eventInterface":"FocusEvent","bubbles":false,"cancelable":false};
  2172. var focusin = {"eventInterface":"FocusEvent","bubbles":true,"cancelable":false};
  2173. var focusout = {"eventInterface":"FocusEvent","bubbles":true,"cancelable":false};
  2174. var fullscreenchange = {"eventInterface":"Event","bubbles":true,"cancelable":false};
  2175. var fullscreenerror = {"eventInterface":"Event","bubbles":true,"cancelable":false};
  2176. var gamepadconnected = {"eventInterface":"GamepadEvent","bubbles":false,"cancelable":false};
  2177. var gamepaddisconnected = {"eventInterface":"GamepadEvent","bubbles":false,"cancelable":false};
  2178. var gotpointercapture = {"eventInterface":"PointerEvent","bubbles":false,"cancelable":false};
  2179. var hashchange = {"eventInterface":"HashChangeEvent","bubbles":true,"cancelable":false};
  2180. var lostpointercapture = {"eventInterface":"PointerEvent","bubbles":false,"cancelable":false};
  2181. var input = {"eventInterface":"Event","bubbles":true,"cancelable":false};
  2182. var invalid = {"eventInterface":"Event","cancelable":true,"bubbles":false};
  2183. var keydown = {"eventInterface":"KeyboardEvent","bubbles":true,"cancelable":true};
  2184. var keypress = {"eventInterface":"KeyboardEvent","bubbles":true,"cancelable":true};
  2185. var keyup = {"eventInterface":"KeyboardEvent","bubbles":true,"cancelable":true};
  2186. var languagechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2187. var levelchange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2188. var load = {"eventInterface":"UIEvent","bubbles":false,"cancelable":false};
  2189. var loadeddata = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2190. var loadedmetadata = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2191. var loadend = {"eventInterface":"ProgressEvent","bubbles":false,"cancelable":false};
  2192. var loadstart = {"eventInterface":"ProgressEvent","bubbles":false,"cancelable":false};
  2193. var mark = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false};
  2194. var message = {"eventInterface":"MessageEvent","bubbles":false,"cancelable":false};
  2195. var messageerror = {"eventInterface":"MessageEvent","bubbles":false,"cancelable":false};
  2196. var mousedown = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
  2197. var mouseenter = {"eventInterface":"MouseEvent","bubbles":false,"cancelable":false};
  2198. var mouseleave = {"eventInterface":"MouseEvent","bubbles":false,"cancelable":false};
  2199. var mousemove = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
  2200. var mouseout = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
  2201. var mouseover = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
  2202. var mouseup = {"eventInterface":"MouseEvent","bubbles":true,"cancelable":true};
  2203. var nomatch = {"eventInterface":"SpeechRecognitionEvent","bubbles":false,"cancelable":false};
  2204. var notificationclick = {"eventInterface":"NotificationEvent","bubbles":false,"cancelable":false};
  2205. var noupdate = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2206. var obsolete = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2207. var offline = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2208. var online = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2209. var open = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2210. var orientationchange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2211. var pagehide = {"eventInterface":"PageTransitionEvent","bubbles":false,"cancelable":false};
  2212. var pageshow = {"eventInterface":"PageTransitionEvent","bubbles":false,"cancelable":false};
  2213. var paste = {"eventInterface":"ClipboardEvent","bubbles":true,"cancelable":true};
  2214. var pause = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false};
  2215. var pointercancel = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":false};
  2216. var pointerdown = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true};
  2217. var pointerenter = {"eventInterface":"PointerEvent","bubbles":false,"cancelable":false};
  2218. var pointerleave = {"eventInterface":"PointerEvent","bubbles":false,"cancelable":false};
  2219. var pointerlockchange = {"eventInterface":"Event","bubbles":true,"cancelable":false};
  2220. var pointerlockerror = {"eventInterface":"Event","bubbles":true,"cancelable":false};
  2221. var pointermove = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true};
  2222. var pointerout = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true};
  2223. var pointerover = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true};
  2224. var pointerup = {"eventInterface":"PointerEvent","bubbles":true,"cancelable":true};
  2225. var play = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2226. var playing = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2227. var popstate = {"eventInterface":"PopStateEvent","bubbles":true,"cancelable":false};
  2228. var progress = {"eventInterface":"ProgressEvent","bubbles":false,"cancelable":false};
  2229. var push = {"eventInterface":"PushEvent","bubbles":false,"cancelable":false};
  2230. var pushsubscriptionchange = {"eventInterface":"PushEvent","bubbles":false,"cancelable":false};
  2231. var ratechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2232. var readystatechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2233. var repeatEvent = {"eventInterface":"TimeEvent","bubbles":false,"cancelable":false};
  2234. var reset = {"eventInterface":"Event","bubbles":true,"cancelable":true};
  2235. var resize = {"eventInterface":"UIEvent","bubbles":false,"cancelable":false};
  2236. var resourcetimingbufferfull = {"eventInterface":"Performance","bubbles":true,"cancelable":true};
  2237. var result = {"eventInterface":"SpeechRecognitionEvent","bubbles":false,"cancelable":false};
  2238. var resume = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false};
  2239. var scroll = {"eventInterface":"UIEvent","bubbles":false,"cancelable":false};
  2240. var seeked = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2241. var seeking = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2242. var select = {"eventInterface":"UIEvent","bubbles":true,"cancelable":false};
  2243. var selectstart = {"eventInterface":"Event","bubbles":true,"cancelable":true};
  2244. var selectionchange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2245. var show = {"eventInterface":"MouseEvent","bubbles":false,"cancelable":false};
  2246. var slotchange = {"eventInterface":"Event","bubbles":true,"cancelable":false};
  2247. var soundend = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2248. var soundstart = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2249. var speechend = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2250. var speechstart = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2251. var stalled = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2252. var start = {"eventInterface":"SpeechSynthesisEvent","bubbles":false,"cancelable":false};
  2253. var storage = {"eventInterface":"StorageEvent","bubbles":false,"cancelable":false};
  2254. var submit = {"eventInterface":"Event","bubbles":true,"cancelable":true};
  2255. var success = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2256. var suspend = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2257. var SVGAbort = {"eventInterface":"SVGEvent","bubbles":true,"cancelable":false};
  2258. var SVGError = {"eventInterface":"SVGEvent","bubbles":true,"cancelable":false};
  2259. var SVGLoad = {"eventInterface":"SVGEvent","bubbles":false,"cancelable":false};
  2260. var SVGResize = {"eventInterface":"SVGEvent","bubbles":true,"cancelable":false};
  2261. var SVGScroll = {"eventInterface":"SVGEvent","bubbles":true,"cancelable":false};
  2262. var SVGUnload = {"eventInterface":"SVGEvent","bubbles":false,"cancelable":false};
  2263. var SVGZoom = {"eventInterface":"SVGZoomEvent","bubbles":true,"cancelable":false};
  2264. var timeout = {"eventInterface":"ProgressEvent","bubbles":false,"cancelable":false};
  2265. var timeupdate = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2266. var touchcancel = {"eventInterface":"TouchEvent","bubbles":true,"cancelable":false};
  2267. var touchend = {"eventInterface":"TouchEvent","bubbles":true,"cancelable":true};
  2268. var touchmove = {"eventInterface":"TouchEvent","bubbles":true,"cancelable":true};
  2269. var touchstart = {"eventInterface":"TouchEvent","bubbles":true,"cancelable":true};
  2270. var transitionend = {"eventInterface":"TransitionEvent","bubbles":true,"cancelable":true};
  2271. var unload = {"eventInterface":"UIEvent","bubbles":false};
  2272. var updateready = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2273. var userproximity = {"eventInterface":"UserProximityEvent","bubbles":false,"cancelable":false};
  2274. var voiceschanged = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2275. var visibilitychange = {"eventInterface":"Event","bubbles":true,"cancelable":false};
  2276. var volumechange = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2277. var waiting = {"eventInterface":"Event","bubbles":false,"cancelable":false};
  2278. var wheel = {"eventInterface":"WheelEvent","bubbles":true,"cancelable":true};
  2279. var domEventTypes = {
  2280. abort: abort,
  2281. afterprint: afterprint,
  2282. animationend: animationend,
  2283. animationiteration: animationiteration,
  2284. animationstart: animationstart,
  2285. appinstalled: appinstalled,
  2286. audioprocess: audioprocess,
  2287. audioend: audioend,
  2288. audiostart: audiostart,
  2289. beforeprint: beforeprint,
  2290. beforeunload: beforeunload,
  2291. beginEvent: beginEvent,
  2292. blur: blur,
  2293. boundary: boundary,
  2294. cached: cached,
  2295. canplay: canplay,
  2296. canplaythrough: canplaythrough,
  2297. change: change,
  2298. chargingchange: chargingchange,
  2299. chargingtimechange: chargingtimechange,
  2300. checking: checking,
  2301. click: click,
  2302. close: close,
  2303. complete: complete,
  2304. compositionend: compositionend,
  2305. compositionstart: compositionstart,
  2306. compositionupdate: compositionupdate,
  2307. contextmenu: contextmenu,
  2308. copy: copy,
  2309. cut: cut,
  2310. dblclick: dblclick,
  2311. devicechange: devicechange,
  2312. devicelight: devicelight,
  2313. devicemotion: devicemotion,
  2314. deviceorientation: deviceorientation,
  2315. deviceproximity: deviceproximity,
  2316. dischargingtimechange: dischargingtimechange,
  2317. DOMActivate: DOMActivate,
  2318. DOMAttributeNameChanged: DOMAttributeNameChanged,
  2319. DOMAttrModified: DOMAttrModified,
  2320. DOMCharacterDataModified: DOMCharacterDataModified,
  2321. DOMContentLoaded: DOMContentLoaded,
  2322. DOMElementNameChanged: DOMElementNameChanged,
  2323. DOMFocusIn: DOMFocusIn,
  2324. DOMFocusOut: DOMFocusOut,
  2325. DOMNodeInserted: DOMNodeInserted,
  2326. DOMNodeInsertedIntoDocument: DOMNodeInsertedIntoDocument,
  2327. DOMNodeRemoved: DOMNodeRemoved,
  2328. DOMNodeRemovedFromDocument: DOMNodeRemovedFromDocument,
  2329. DOMSubtreeModified: DOMSubtreeModified,
  2330. downloading: downloading,
  2331. drag: drag,
  2332. dragend: dragend,
  2333. dragenter: dragenter,
  2334. dragleave: dragleave,
  2335. dragover: dragover,
  2336. dragstart: dragstart,
  2337. drop: drop,
  2338. durationchange: durationchange,
  2339. emptied: emptied,
  2340. end: end,
  2341. ended: ended,
  2342. endEvent: endEvent,
  2343. error: error,
  2344. focus: focus,
  2345. focusin: focusin,
  2346. focusout: focusout,
  2347. fullscreenchange: fullscreenchange,
  2348. fullscreenerror: fullscreenerror,
  2349. gamepadconnected: gamepadconnected,
  2350. gamepaddisconnected: gamepaddisconnected,
  2351. gotpointercapture: gotpointercapture,
  2352. hashchange: hashchange,
  2353. lostpointercapture: lostpointercapture,
  2354. input: input,
  2355. invalid: invalid,
  2356. keydown: keydown,
  2357. keypress: keypress,
  2358. keyup: keyup,
  2359. languagechange: languagechange,
  2360. levelchange: levelchange,
  2361. load: load,
  2362. loadeddata: loadeddata,
  2363. loadedmetadata: loadedmetadata,
  2364. loadend: loadend,
  2365. loadstart: loadstart,
  2366. mark: mark,
  2367. message: message,
  2368. messageerror: messageerror,
  2369. mousedown: mousedown,
  2370. mouseenter: mouseenter,
  2371. mouseleave: mouseleave,
  2372. mousemove: mousemove,
  2373. mouseout: mouseout,
  2374. mouseover: mouseover,
  2375. mouseup: mouseup,
  2376. nomatch: nomatch,
  2377. notificationclick: notificationclick,
  2378. noupdate: noupdate,
  2379. obsolete: obsolete,
  2380. offline: offline,
  2381. online: online,
  2382. open: open,
  2383. orientationchange: orientationchange,
  2384. pagehide: pagehide,
  2385. pageshow: pageshow,
  2386. paste: paste,
  2387. pause: pause,
  2388. pointercancel: pointercancel,
  2389. pointerdown: pointerdown,
  2390. pointerenter: pointerenter,
  2391. pointerleave: pointerleave,
  2392. pointerlockchange: pointerlockchange,
  2393. pointerlockerror: pointerlockerror,
  2394. pointermove: pointermove,
  2395. pointerout: pointerout,
  2396. pointerover: pointerover,
  2397. pointerup: pointerup,
  2398. play: play,
  2399. playing: playing,
  2400. popstate: popstate,
  2401. progress: progress,
  2402. push: push,
  2403. pushsubscriptionchange: pushsubscriptionchange,
  2404. ratechange: ratechange,
  2405. readystatechange: readystatechange,
  2406. repeatEvent: repeatEvent,
  2407. reset: reset,
  2408. resize: resize,
  2409. resourcetimingbufferfull: resourcetimingbufferfull,
  2410. result: result,
  2411. resume: resume,
  2412. scroll: scroll,
  2413. seeked: seeked,
  2414. seeking: seeking,
  2415. select: select,
  2416. selectstart: selectstart,
  2417. selectionchange: selectionchange,
  2418. show: show,
  2419. slotchange: slotchange,
  2420. soundend: soundend,
  2421. soundstart: soundstart,
  2422. speechend: speechend,
  2423. speechstart: speechstart,
  2424. stalled: stalled,
  2425. start: start,
  2426. storage: storage,
  2427. submit: submit,
  2428. success: success,
  2429. suspend: suspend,
  2430. SVGAbort: SVGAbort,
  2431. SVGError: SVGError,
  2432. SVGLoad: SVGLoad,
  2433. SVGResize: SVGResize,
  2434. SVGScroll: SVGScroll,
  2435. SVGUnload: SVGUnload,
  2436. SVGZoom: SVGZoom,
  2437. timeout: timeout,
  2438. timeupdate: timeupdate,
  2439. touchcancel: touchcancel,
  2440. touchend: touchend,
  2441. touchmove: touchmove,
  2442. touchstart: touchstart,
  2443. transitionend: transitionend,
  2444. unload: unload,
  2445. updateready: updateready,
  2446. userproximity: userproximity,
  2447. voiceschanged: voiceschanged,
  2448. visibilitychange: visibilitychange,
  2449. volumechange: volumechange,
  2450. waiting: waiting,
  2451. wheel: wheel
  2452. };
  2453. var domEventTypes$1 = Object.freeze({
  2454. abort: abort,
  2455. afterprint: afterprint,
  2456. animationend: animationend,
  2457. animationiteration: animationiteration,
  2458. animationstart: animationstart,
  2459. appinstalled: appinstalled,
  2460. audioprocess: audioprocess,
  2461. audioend: audioend,
  2462. audiostart: audiostart,
  2463. beforeprint: beforeprint,
  2464. beforeunload: beforeunload,
  2465. beginEvent: beginEvent,
  2466. blur: blur,
  2467. boundary: boundary,
  2468. cached: cached,
  2469. canplay: canplay,
  2470. canplaythrough: canplaythrough,
  2471. change: change,
  2472. chargingchange: chargingchange,
  2473. chargingtimechange: chargingtimechange,
  2474. checking: checking,
  2475. click: click,
  2476. close: close,
  2477. complete: complete,
  2478. compositionend: compositionend,
  2479. compositionstart: compositionstart,
  2480. compositionupdate: compositionupdate,
  2481. contextmenu: contextmenu,
  2482. copy: copy,
  2483. cut: cut,
  2484. dblclick: dblclick,
  2485. devicechange: devicechange,
  2486. devicelight: devicelight,
  2487. devicemotion: devicemotion,
  2488. deviceorientation: deviceorientation,
  2489. deviceproximity: deviceproximity,
  2490. dischargingtimechange: dischargingtimechange,
  2491. DOMActivate: DOMActivate,
  2492. DOMAttributeNameChanged: DOMAttributeNameChanged,
  2493. DOMAttrModified: DOMAttrModified,
  2494. DOMCharacterDataModified: DOMCharacterDataModified,
  2495. DOMContentLoaded: DOMContentLoaded,
  2496. DOMElementNameChanged: DOMElementNameChanged,
  2497. DOMFocusIn: DOMFocusIn,
  2498. DOMFocusOut: DOMFocusOut,
  2499. DOMNodeInserted: DOMNodeInserted,
  2500. DOMNodeInsertedIntoDocument: DOMNodeInsertedIntoDocument,
  2501. DOMNodeRemoved: DOMNodeRemoved,
  2502. DOMNodeRemovedFromDocument: DOMNodeRemovedFromDocument,
  2503. DOMSubtreeModified: DOMSubtreeModified,
  2504. downloading: downloading,
  2505. drag: drag,
  2506. dragend: dragend,
  2507. dragenter: dragenter,
  2508. dragleave: dragleave,
  2509. dragover: dragover,
  2510. dragstart: dragstart,
  2511. drop: drop,
  2512. durationchange: durationchange,
  2513. emptied: emptied,
  2514. end: end,
  2515. ended: ended,
  2516. endEvent: endEvent,
  2517. error: error,
  2518. focus: focus,
  2519. focusin: focusin,
  2520. focusout: focusout,
  2521. fullscreenchange: fullscreenchange,
  2522. fullscreenerror: fullscreenerror,
  2523. gamepadconnected: gamepadconnected,
  2524. gamepaddisconnected: gamepaddisconnected,
  2525. gotpointercapture: gotpointercapture,
  2526. hashchange: hashchange,
  2527. lostpointercapture: lostpointercapture,
  2528. input: input,
  2529. invalid: invalid,
  2530. keydown: keydown,
  2531. keypress: keypress,
  2532. keyup: keyup,
  2533. languagechange: languagechange,
  2534. levelchange: levelchange,
  2535. load: load,
  2536. loadeddata: loadeddata,
  2537. loadedmetadata: loadedmetadata,
  2538. loadend: loadend,
  2539. loadstart: loadstart,
  2540. mark: mark,
  2541. message: message,
  2542. messageerror: messageerror,
  2543. mousedown: mousedown,
  2544. mouseenter: mouseenter,
  2545. mouseleave: mouseleave,
  2546. mousemove: mousemove,
  2547. mouseout: mouseout,
  2548. mouseover: mouseover,
  2549. mouseup: mouseup,
  2550. nomatch: nomatch,
  2551. notificationclick: notificationclick,
  2552. noupdate: noupdate,
  2553. obsolete: obsolete,
  2554. offline: offline,
  2555. online: online,
  2556. open: open,
  2557. orientationchange: orientationchange,
  2558. pagehide: pagehide,
  2559. pageshow: pageshow,
  2560. paste: paste,
  2561. pause: pause,
  2562. pointercancel: pointercancel,
  2563. pointerdown: pointerdown,
  2564. pointerenter: pointerenter,
  2565. pointerleave: pointerleave,
  2566. pointerlockchange: pointerlockchange,
  2567. pointerlockerror: pointerlockerror,
  2568. pointermove: pointermove,
  2569. pointerout: pointerout,
  2570. pointerover: pointerover,
  2571. pointerup: pointerup,
  2572. play: play,
  2573. playing: playing,
  2574. popstate: popstate,
  2575. progress: progress,
  2576. push: push,
  2577. pushsubscriptionchange: pushsubscriptionchange,
  2578. ratechange: ratechange,
  2579. readystatechange: readystatechange,
  2580. repeatEvent: repeatEvent,
  2581. reset: reset,
  2582. resize: resize,
  2583. resourcetimingbufferfull: resourcetimingbufferfull,
  2584. result: result,
  2585. resume: resume,
  2586. scroll: scroll,
  2587. seeked: seeked,
  2588. seeking: seeking,
  2589. select: select,
  2590. selectstart: selectstart,
  2591. selectionchange: selectionchange,
  2592. show: show,
  2593. slotchange: slotchange,
  2594. soundend: soundend,
  2595. soundstart: soundstart,
  2596. speechend: speechend,
  2597. speechstart: speechstart,
  2598. stalled: stalled,
  2599. start: start,
  2600. storage: storage,
  2601. submit: submit,
  2602. success: success,
  2603. suspend: suspend,
  2604. SVGAbort: SVGAbort,
  2605. SVGError: SVGError,
  2606. SVGLoad: SVGLoad,
  2607. SVGResize: SVGResize,
  2608. SVGScroll: SVGScroll,
  2609. SVGUnload: SVGUnload,
  2610. SVGZoom: SVGZoom,
  2611. timeout: timeout,
  2612. timeupdate: timeupdate,
  2613. touchcancel: touchcancel,
  2614. touchend: touchend,
  2615. touchmove: touchmove,
  2616. touchstart: touchstart,
  2617. transitionend: transitionend,
  2618. unload: unload,
  2619. updateready: updateready,
  2620. userproximity: userproximity,
  2621. voiceschanged: voiceschanged,
  2622. visibilitychange: visibilitychange,
  2623. volumechange: volumechange,
  2624. waiting: waiting,
  2625. wheel: wheel,
  2626. default: domEventTypes
  2627. });
  2628. var require$$0 = ( domEventTypes$1 && domEventTypes ) || domEventTypes$1;
  2629. var domEventTypes$2 = require$$0;
  2630. var defaultEventType = {
  2631. eventInterface: 'Event',
  2632. cancelable: true,
  2633. bubbles: true
  2634. };
  2635. var modifiers = {
  2636. enter: 13,
  2637. tab: 9,
  2638. delete: 46,
  2639. esc: 27,
  2640. space: 32,
  2641. up: 38,
  2642. down: 40,
  2643. left: 37,
  2644. right: 39,
  2645. end: 35,
  2646. home: 36,
  2647. backspace: 8,
  2648. insert: 45,
  2649. pageup: 33,
  2650. pagedown: 34
  2651. };
  2652. function createEvent(
  2653. type,
  2654. modifier,
  2655. ref,
  2656. options
  2657. ) {
  2658. var eventInterface = ref.eventInterface;
  2659. var bubbles = ref.bubbles;
  2660. var cancelable = ref.cancelable;
  2661. var SupportedEventInterface =
  2662. typeof window[eventInterface] === 'function'
  2663. ? window[eventInterface]
  2664. : window.Event;
  2665. var event = new SupportedEventInterface(type, Object.assign({}, options,
  2666. {bubbles: bubbles,
  2667. cancelable: cancelable,
  2668. keyCode: modifiers[modifier]}));
  2669. return event
  2670. }
  2671. function createOldEvent(
  2672. type,
  2673. modifier,
  2674. ref
  2675. ) {
  2676. var eventInterface = ref.eventInterface;
  2677. var bubbles = ref.bubbles;
  2678. var cancelable = ref.cancelable;
  2679. var event = document.createEvent('Event');
  2680. event.initEvent(type, bubbles, cancelable);
  2681. event.keyCode = modifiers[modifier];
  2682. return event
  2683. }
  2684. function createDOMEvent(type, options) {
  2685. var ref = type.split('.');
  2686. var eventType = ref[0];
  2687. var modifier = ref[1];
  2688. var meta = domEventTypes$2[eventType] || defaultEventType;
  2689. // Fallback for IE10,11 - https://stackoverflow.com/questions/26596123
  2690. var event =
  2691. typeof window.Event === 'function'
  2692. ? createEvent(eventType, modifier, meta, options)
  2693. : createOldEvent(eventType, modifier, meta);
  2694. var eventPrototype = Object.getPrototypeOf(event);
  2695. Object.keys(options || {}).forEach(function (key) {
  2696. var propertyDescriptor = Object.getOwnPropertyDescriptor(
  2697. eventPrototype,
  2698. key
  2699. );
  2700. var canSetProperty = !(
  2701. propertyDescriptor && propertyDescriptor.setter === undefined
  2702. );
  2703. if (canSetProperty) {
  2704. event[key] = options[key];
  2705. }
  2706. });
  2707. return event
  2708. }
  2709. function errorHandler(errorOrString, vm) {
  2710. var error =
  2711. typeof errorOrString === 'object' ? errorOrString : new Error(errorOrString);
  2712. vm._error = error;
  2713. throw error
  2714. }
  2715. function throwIfInstancesThrew(vm) {
  2716. var instancesWithError = findAllInstances(vm).filter(function (_vm) { return _vm._error; });
  2717. if (instancesWithError.length > 0) {
  2718. throw instancesWithError[0]._error
  2719. }
  2720. }
  2721. var hasWarned = false;
  2722. // Vue swallows errors thrown by instances, even if the global error handler
  2723. // throws. In order to throw in the test, we add an _error property to an
  2724. // instance when it throws. Then we loop through the instances with
  2725. // throwIfInstancesThrew and throw an error in the test context if any
  2726. // instances threw.
  2727. function addGlobalErrorHandler(_Vue) {
  2728. var existingErrorHandler = _Vue.config.errorHandler;
  2729. if (existingErrorHandler === errorHandler) {
  2730. return
  2731. }
  2732. if (_Vue.config.errorHandler && !hasWarned) {
  2733. warn(
  2734. "Global error handler detected (Vue.config.errorHandler). \n" +
  2735. "Vue Test Utils sets a custom error handler to throw errors " +
  2736. "thrown by instances. If you want this behavior in " +
  2737. "your tests, you must remove the global error handler."
  2738. );
  2739. hasWarned = true;
  2740. } else {
  2741. _Vue.config.errorHandler = errorHandler;
  2742. }
  2743. }
  2744. //
  2745. var Wrapper = function Wrapper(
  2746. node,
  2747. options,
  2748. isVueWrapper
  2749. ) {
  2750. var vnode = node instanceof Element ? null : node;
  2751. var element = node instanceof Element ? node : node.elm;
  2752. // Prevent redefine by VueWrapper
  2753. if (!isVueWrapper) {
  2754. // $FlowIgnore : issue with defineProperty
  2755. Object.defineProperty(this, 'rootNode', {
  2756. get: function () { return vnode || element; },
  2757. set: function () { return throwError('wrapper.rootNode is read-only'); }
  2758. });
  2759. // $FlowIgnore
  2760. Object.defineProperty(this, 'vnode', {
  2761. get: function () { return vnode; },
  2762. set: function () { return throwError('wrapper.vnode is read-only'); }
  2763. });
  2764. // $FlowIgnore
  2765. Object.defineProperty(this, 'element', {
  2766. get: function () { return element; },
  2767. set: function () { return throwError('wrapper.element is read-only'); }
  2768. });
  2769. // $FlowIgnore
  2770. Object.defineProperty(this, 'vm', {
  2771. get: function () { return undefined; },
  2772. set: function () { return throwError('wrapper.vm is read-only'); }
  2773. });
  2774. }
  2775. var frozenOptions = Object.freeze(options);
  2776. // $FlowIgnore
  2777. Object.defineProperty(this, 'options', {
  2778. get: function () { return frozenOptions; },
  2779. set: function () { return throwError('wrapper.options is read-only'); }
  2780. });
  2781. if (
  2782. this.vnode &&
  2783. (this.vnode[FUNCTIONAL_OPTIONS] || this.vnode.functionalContext)
  2784. ) {
  2785. this.isFunctionalComponent = true;
  2786. }
  2787. };
  2788. Wrapper.prototype.at = function at () {
  2789. throwError('at() must be called on a WrapperArray');
  2790. };
  2791. /**
  2792. * Returns an Object containing all the attribute/value pairs on the element.
  2793. */
  2794. Wrapper.prototype.attributes = function attributes (key) {
  2795. var attributes = this.element.attributes;
  2796. var attributeMap = {};
  2797. for (var i = 0; i < attributes.length; i++) {
  2798. var att = attributes.item(i);
  2799. attributeMap[att.localName] = att.value;
  2800. }
  2801. return key ? attributeMap[key] : attributeMap
  2802. };
  2803. /**
  2804. * Returns an Array containing all the classes on the element
  2805. */
  2806. Wrapper.prototype.classes = function classes (className) {
  2807. var this$1 = this;
  2808. var classAttribute = this.element.getAttribute('class');
  2809. var classes = classAttribute ? classAttribute.split(' ') : [];
  2810. // Handle converting cssmodules identifiers back to the original class name
  2811. if (this.vm && this.vm.$style) {
  2812. var cssModuleIdentifiers = Object.keys(this.vm.$style).reduce(
  2813. function (acc, key) {
  2814. // $FlowIgnore
  2815. var moduleIdent = this$1.vm.$style[key];
  2816. if (moduleIdent) {
  2817. acc[moduleIdent.split(' ')[0]] = key;
  2818. }
  2819. return acc
  2820. },
  2821. {}
  2822. );
  2823. classes = classes.map(function (name) { return cssModuleIdentifiers[name] || name; });
  2824. }
  2825. return className ? !!(classes.indexOf(className) > -1) : classes
  2826. };
  2827. /**
  2828. * Checks if wrapper contains provided selector.
  2829. */
  2830. Wrapper.prototype.contains = function contains (rawSelector) {
  2831. var selector = getSelector(rawSelector, 'contains');
  2832. var nodes = find(this.rootNode, this.vm, selector);
  2833. return nodes.length > 0
  2834. };
  2835. /**
  2836. * Calls destroy on vm
  2837. */
  2838. Wrapper.prototype.destroy = function destroy () {
  2839. if (!this.isVueInstance()) {
  2840. throwError("wrapper.destroy() can only be called on a Vue instance");
  2841. }
  2842. if (this.element.parentNode) {
  2843. this.element.parentNode.removeChild(this.element);
  2844. }
  2845. // $FlowIgnore
  2846. this.vm.$destroy();
  2847. throwIfInstancesThrew(this.vm);
  2848. };
  2849. /**
  2850. * Returns an object containing custom events emitted by the Wrapper vm
  2851. */
  2852. Wrapper.prototype.emitted = function emitted (
  2853. event
  2854. ) {
  2855. if (!this._emitted && !this.vm) {
  2856. throwError("wrapper.emitted() can only be called on a Vue instance");
  2857. }
  2858. if (event) {
  2859. return this._emitted[event]
  2860. }
  2861. return this._emitted
  2862. };
  2863. /**
  2864. * Returns an Array containing custom events emitted by the Wrapper vm
  2865. */
  2866. Wrapper.prototype.emittedByOrder = function emittedByOrder () {
  2867. if (!this._emittedByOrder && !this.vm) {
  2868. throwError(
  2869. "wrapper.emittedByOrder() can only be called on a Vue instance"
  2870. );
  2871. }
  2872. return this._emittedByOrder
  2873. };
  2874. /**
  2875. * Utility to check wrapper exists. Returns true as Wrapper always exists
  2876. */
  2877. Wrapper.prototype.exists = function exists () {
  2878. if (this.vm) {
  2879. return !!this.vm && !this.vm._isDestroyed
  2880. }
  2881. return true
  2882. };
  2883. Wrapper.prototype.filter = function filter () {
  2884. throwError('filter() must be called on a WrapperArray');
  2885. };
  2886. /**
  2887. * Finds first node in tree of the current wrapper that
  2888. * matches the provided selector.
  2889. */
  2890. Wrapper.prototype.find = function find$1 (rawSelector) {
  2891. var selector = getSelector(rawSelector, 'find');
  2892. var node = find(this.rootNode, this.vm, selector)[0];
  2893. if (!node) {
  2894. if (selector.type === REF_SELECTOR) {
  2895. return new ErrorWrapper(("ref=\"" + (selector.value.ref) + "\""))
  2896. }
  2897. return new ErrorWrapper(
  2898. typeof selector.value === 'string' ? selector.value : 'Component'
  2899. )
  2900. }
  2901. return createWrapper(node, this.options)
  2902. };
  2903. /**
  2904. * Finds node in tree of the current wrapper that matches
  2905. * the provided selector.
  2906. */
  2907. Wrapper.prototype.findAll = function findAll (rawSelector) {
  2908. var this$1 = this;
  2909. var selector = getSelector(rawSelector, 'findAll');
  2910. var nodes = find(this.rootNode, this.vm, selector);
  2911. var wrappers = nodes.map(function (node) {
  2912. // Using CSS Selector, returns a VueWrapper instance if the root element
  2913. // binds a Vue instance.
  2914. return createWrapper(node, this$1.options)
  2915. });
  2916. return new WrapperArray(wrappers)
  2917. };
  2918. /**
  2919. * Returns HTML of element as a string
  2920. */
  2921. Wrapper.prototype.html = function html () {
  2922. return this.element.outerHTML
  2923. };
  2924. /**
  2925. * Checks if node matches selector
  2926. */
  2927. Wrapper.prototype.is = function is (rawSelector) {
  2928. var selector = getSelector(rawSelector, 'is');
  2929. if (selector.type === REF_SELECTOR) {
  2930. throwError('$ref selectors can not be used with wrapper.is()');
  2931. }
  2932. return matches(this.rootNode, selector)
  2933. };
  2934. /**
  2935. * Checks if node is empty
  2936. */
  2937. Wrapper.prototype.isEmpty = function isEmpty () {
  2938. if (!this.vnode) {
  2939. return this.element.innerHTML === ''
  2940. }
  2941. var nodes = [];
  2942. var node = this.vnode;
  2943. var i = 0;
  2944. while (node) {
  2945. if (node.child) {
  2946. nodes.push(node.child._vnode);
  2947. }
  2948. node.children &&
  2949. node.children.forEach(function (n) {
  2950. nodes.push(n);
  2951. });
  2952. node = nodes[i++];
  2953. }
  2954. return nodes.every(function (n) { return n.isComment || n.child; })
  2955. };
  2956. /**
  2957. * Checks if node is visible
  2958. */
  2959. Wrapper.prototype.isVisible = function isVisible () {
  2960. var element = this.element;
  2961. while (element) {
  2962. if (
  2963. element.style &&
  2964. (element.style.visibility === 'hidden' ||
  2965. element.style.display === 'none')
  2966. ) {
  2967. return false
  2968. }
  2969. element = element.parentElement;
  2970. }
  2971. return true
  2972. };
  2973. /**
  2974. * Checks if wrapper is a vue instance
  2975. */
  2976. Wrapper.prototype.isVueInstance = function isVueInstance () {
  2977. return !!this.vm
  2978. };
  2979. /**
  2980. * Returns name of component, or tag name if node is not a Vue component
  2981. */
  2982. Wrapper.prototype.name = function name () {
  2983. if (this.vm) {
  2984. return (
  2985. this.vm.$options.name ||
  2986. // compat for Vue < 2.3
  2987. (this.vm.$options.extendOptions && this.vm.$options.extendOptions.name)
  2988. )
  2989. }
  2990. if (!this.vnode) {
  2991. return this.element.tagName
  2992. }
  2993. return this.vnode.tag
  2994. };
  2995. /**
  2996. * Returns an Object containing the prop name/value pairs on the element
  2997. */
  2998. Wrapper.prototype.props = function props (key) {
  2999. var this$1 = this;
  3000. if (this.isFunctionalComponent) {
  3001. throwError(
  3002. "wrapper.props() cannot be called on a mounted functional component."
  3003. );
  3004. }
  3005. if (!this.vm) {
  3006. throwError('wrapper.props() must be called on a Vue instance');
  3007. }
  3008. var props = {};
  3009. var keys = this.vm && this.vm.$options._propKeys;
  3010. if (keys) {
  3011. (keys || {}).forEach(function (key) {
  3012. if (this$1.vm) {
  3013. props[key] = this$1.vm[key];
  3014. }
  3015. });
  3016. }
  3017. if (key) {
  3018. return props[key]
  3019. }
  3020. return props
  3021. };
  3022. /**
  3023. * Checks radio button or checkbox element
  3024. */
  3025. Wrapper.prototype.setChecked = function setChecked (checked) {
  3026. if ( checked === void 0 ) checked = true;
  3027. if (typeof checked !== 'boolean') {
  3028. throwError('wrapper.setChecked() must be passed a boolean');
  3029. }
  3030. var tagName = this.element.tagName;
  3031. // $FlowIgnore
  3032. var type = this.attributes().type;
  3033. var event = getCheckedEvent();
  3034. if (tagName === 'INPUT' && type === 'checkbox') {
  3035. if (this.element.checked === checked) {
  3036. return
  3037. }
  3038. if (event !== 'click' || isPhantomJS) {
  3039. // $FlowIgnore
  3040. this.element.checked = checked;
  3041. }
  3042. this.trigger(event);
  3043. return
  3044. }
  3045. if (tagName === 'INPUT' && type === 'radio') {
  3046. if (!checked) {
  3047. throwError(
  3048. "wrapper.setChecked() cannot be called with parameter false on a " +
  3049. "<input type=\"radio\" /> element."
  3050. );
  3051. }
  3052. if (event !== 'click' || isPhantomJS) {
  3053. // $FlowIgnore
  3054. this.element.selected = true;
  3055. }
  3056. this.trigger(event);
  3057. return
  3058. }
  3059. throwError("wrapper.setChecked() cannot be called on this element");
  3060. };
  3061. /**
  3062. * Selects <option></option> element
  3063. */
  3064. Wrapper.prototype.setSelected = function setSelected () {
  3065. var tagName = this.element.tagName;
  3066. if (tagName === 'SELECT') {
  3067. throwError(
  3068. "wrapper.setSelected() cannot be called on select. Call it on one of " +
  3069. "its options"
  3070. );
  3071. }
  3072. if (tagName === 'OPTION') {
  3073. // $FlowIgnore
  3074. this.element.selected = true;
  3075. // $FlowIgnore
  3076. var parentElement = this.element.parentElement;
  3077. // $FlowIgnore
  3078. if (parentElement.tagName === 'OPTGROUP') {
  3079. // $FlowIgnore
  3080. parentElement = parentElement.parentElement;
  3081. }
  3082. // $FlowIgnore
  3083. createWrapper(parentElement, this.options).trigger('change');
  3084. return
  3085. }
  3086. throwError("wrapper.setSelected() cannot be called on this element");
  3087. };
  3088. /**
  3089. * Sets vm data
  3090. */
  3091. Wrapper.prototype.setData = function setData (data) {
  3092. if (this.isFunctionalComponent) {
  3093. throwError("wrapper.setData() cannot be called on a functional component");
  3094. }
  3095. if (!this.vm) {
  3096. throwError("wrapper.setData() can only be called on a Vue instance");
  3097. }
  3098. recursivelySetData(this.vm, this.vm, data);
  3099. };
  3100. /**
  3101. * Sets vm methods
  3102. */
  3103. Wrapper.prototype.setMethods = function setMethods (methods) {
  3104. var this$1 = this;
  3105. if (!this.isVueInstance()) {
  3106. throwError("wrapper.setMethods() can only be called on a Vue instance");
  3107. }
  3108. Object.keys(methods).forEach(function (key) {
  3109. // $FlowIgnore : Problem with possibly null this.vm
  3110. this$1.vm[key] = methods[key];
  3111. // $FlowIgnore : Problem with possibly null this.vm
  3112. this$1.vm.$options.methods[key] = methods[key];
  3113. });
  3114. if (this.vnode) {
  3115. var context = this.vnode.context;
  3116. if (context.$options.render) { context._update(context._render()); }
  3117. }
  3118. };
  3119. /**
  3120. * Sets vm props
  3121. */
  3122. Wrapper.prototype.setProps = function setProps (data) {
  3123. var this$1 = this;
  3124. var originalConfig = Vue.config.silent;
  3125. Vue.config.silent = config.silent;
  3126. if (this.isFunctionalComponent) {
  3127. throwError(
  3128. "wrapper.setProps() cannot be called on a functional component"
  3129. );
  3130. }
  3131. if (!this.vm) {
  3132. throwError("wrapper.setProps() can only be called on a Vue instance");
  3133. }
  3134. Object.keys(data).forEach(function (key) {
  3135. if (
  3136. typeof data[key] === 'object' &&
  3137. data[key] !== null &&
  3138. // $FlowIgnore : Problem with possibly null this.vm
  3139. data[key] === this$1.vm[key]
  3140. ) {
  3141. throwError(
  3142. "wrapper.setProps() called with the same object of the existing " +
  3143. key + " property. You must call wrapper.setProps() with a new " +
  3144. "object to trigger reactivity"
  3145. );
  3146. }
  3147. if (
  3148. !this$1.vm ||
  3149. !this$1.vm.$options._propKeys ||
  3150. !this$1.vm.$options._propKeys.some(function (prop) { return prop === key; })
  3151. ) {
  3152. if (VUE_VERSION > 2.3) {
  3153. // $FlowIgnore : Problem with possibly null this.vm
  3154. this$1.vm.$attrs[key] = data[key];
  3155. return
  3156. }
  3157. throwError(
  3158. "wrapper.setProps() called with " + key + " property which " +
  3159. "is not defined on the component"
  3160. );
  3161. }
  3162. if (this$1.vm && this$1.vm._props) {
  3163. // Set actual props value
  3164. this$1.vm._props[key] = data[key];
  3165. // $FlowIgnore : Problem with possibly null this.vm
  3166. this$1.vm[key] = data[key];
  3167. } else {
  3168. // $FlowIgnore : Problem with possibly null this.vm.$options
  3169. this$1.vm.$options.propsData[key] = data[key];
  3170. // $FlowIgnore : Problem with possibly null this.vm
  3171. this$1.vm[key] = data[key];
  3172. // $FlowIgnore : Need to call this twice to fix watcher bug in 2.0.x
  3173. this$1.vm[key] = data[key];
  3174. }
  3175. });
  3176. // $FlowIgnore : Problem with possibly null this.vm
  3177. this.vm.$forceUpdate();
  3178. if (this.options.sync === COMPAT_SYNC_MODE) {
  3179. // $FlowIgnore : Problem with possibly null this.vm
  3180. orderWatchers(this.vm || this.vnode.context.$root);
  3181. }
  3182. Vue.config.silent = originalConfig;
  3183. };
  3184. /**
  3185. * Sets element value and triggers input event
  3186. */
  3187. Wrapper.prototype.setValue = function setValue (value) {
  3188. var tagName = this.element.tagName;
  3189. // $FlowIgnore
  3190. var type = this.attributes().type;
  3191. if (tagName === 'OPTION') {
  3192. throwError(
  3193. "wrapper.setValue() cannot be called on an <option> element. Use " +
  3194. "wrapper.setSelected() instead"
  3195. );
  3196. } else if (tagName === 'INPUT' && type === 'checkbox') {
  3197. throwError(
  3198. "wrapper.setValue() cannot be called on a <input type=\"checkbox\" /> " +
  3199. "element. Use wrapper.setChecked() instead"
  3200. );
  3201. } else if (tagName === 'INPUT' && type === 'radio') {
  3202. throwError(
  3203. "wrapper.setValue() cannot be called on a <input type=\"radio\" /> " +
  3204. "element. Use wrapper.setChecked() instead"
  3205. );
  3206. } else if (
  3207. tagName === 'INPUT' ||
  3208. tagName === 'TEXTAREA' ||
  3209. tagName === 'SELECT'
  3210. ) {
  3211. var event = tagName === 'SELECT' ? 'change' : 'input';
  3212. // $FlowIgnore
  3213. this.element.value = value;
  3214. this.trigger(event);
  3215. } else {
  3216. throwError("wrapper.setValue() cannot be called on this element");
  3217. }
  3218. };
  3219. /**
  3220. * Return text of wrapper element
  3221. */
  3222. Wrapper.prototype.text = function text () {
  3223. return this.element.textContent.trim()
  3224. };
  3225. /**
  3226. * Dispatches a DOM event on wrapper
  3227. */
  3228. Wrapper.prototype.trigger = function trigger (type, options) {
  3229. if ( options === void 0 ) options = {};
  3230. if (typeof type !== 'string') {
  3231. throwError('wrapper.trigger() must be passed a string');
  3232. }
  3233. if (options.target) {
  3234. throwError(
  3235. "you cannot set the target value of an event. See the notes section " +
  3236. "of the docs for more details—" +
  3237. "https://vue-test-utils.vuejs.org/api/wrapper/trigger.html"
  3238. );
  3239. }
  3240. // Don't fire event on a disabled element
  3241. if (this.attributes().disabled) {
  3242. return
  3243. }
  3244. var event = createDOMEvent(type, options);
  3245. this.element.dispatchEvent(event);
  3246. if (this.vnode && this.options.sync === COMPAT_SYNC_MODE) {
  3247. orderWatchers(this.vm || this.vnode.context.$root);
  3248. }
  3249. };
  3250. Wrapper.prototype.update = function update () {
  3251. warn(
  3252. "update has been removed from vue-test-utils. All updates are now " +
  3253. "synchronous by default"
  3254. );
  3255. };
  3256. //
  3257. function setDepsSync(dep) {
  3258. dep.subs.forEach(setWatcherSync);
  3259. }
  3260. function setWatcherSync(watcher) {
  3261. if (watcher.sync === true) {
  3262. return
  3263. }
  3264. watcher.sync = true;
  3265. watcher.deps.forEach(setDepsSync);
  3266. }
  3267. function setWatchersToSync(vm) {
  3268. if (vm._watchers) {
  3269. vm._watchers.forEach(setWatcherSync);
  3270. }
  3271. if (vm._computedWatchers) {
  3272. Object.keys(vm._computedWatchers).forEach(function (computedWatcher) {
  3273. setWatcherSync(vm._computedWatchers[computedWatcher]);
  3274. });
  3275. }
  3276. setWatcherSync(vm._watcher);
  3277. vm.$children.forEach(setWatchersToSync);
  3278. // preventing double registration
  3279. if (!vm.$_vueTestUtils_updateInSetWatcherSync) {
  3280. vm.$_vueTestUtils_updateInSetWatcherSync = vm._update;
  3281. vm._update = function(vnode, hydrating) {
  3282. var this$1 = this;
  3283. this.$_vueTestUtils_updateInSetWatcherSync(vnode, hydrating);
  3284. if (VUE_VERSION >= 2.1 && this._isMounted && this.$options.updated) {
  3285. this.$options.updated.forEach(function (handler) {
  3286. handler.call(this$1);
  3287. });
  3288. }
  3289. };
  3290. }
  3291. }
  3292. //
  3293. var VueWrapper = (function (Wrapper$$1) {
  3294. function VueWrapper(vm, options) {
  3295. var this$1 = this;
  3296. Wrapper$$1.call(this, vm._vnode, options, true);
  3297. // $FlowIgnore : issue with defineProperty
  3298. Object.defineProperty(this, 'rootNode', {
  3299. get: function () { return vm.$vnode || { child: this$1.vm }; },
  3300. set: function () { return throwError('wrapper.vnode is read-only'); }
  3301. });
  3302. // $FlowIgnore : issue with defineProperty
  3303. Object.defineProperty(this, 'vnode', {
  3304. get: function () { return vm._vnode; },
  3305. set: function () { return throwError('wrapper.vnode is read-only'); }
  3306. });
  3307. // $FlowIgnore
  3308. Object.defineProperty(this, 'element', {
  3309. get: function () { return vm.$el; },
  3310. set: function () { return throwError('wrapper.element is read-only'); }
  3311. });
  3312. // $FlowIgnore
  3313. Object.defineProperty(this, 'vm', {
  3314. get: function () { return vm; },
  3315. set: function () { return throwError('wrapper.vm is read-only'); }
  3316. });
  3317. if (options.sync === COMPAT_SYNC_MODE) {
  3318. setWatchersToSync(vm);
  3319. orderWatchers(vm);
  3320. }
  3321. this.isFunctionalComponent = vm.$options._isFunctionalContainer;
  3322. this._emitted = vm.__emitted;
  3323. this._emittedByOrder = vm.__emittedByOrder;
  3324. }
  3325. if ( Wrapper$$1 ) VueWrapper.__proto__ = Wrapper$$1;
  3326. VueWrapper.prototype = Object.create( Wrapper$$1 && Wrapper$$1.prototype );
  3327. VueWrapper.prototype.constructor = VueWrapper;
  3328. return VueWrapper;
  3329. }(Wrapper));
  3330. //
  3331. function createVNodes(vm, slotValue, name) {
  3332. var el = vueTemplateCompiler.compileToFunctions(
  3333. ("<div><template slot=" + name + ">" + slotValue + "</template></div>")
  3334. );
  3335. var _staticRenderFns = vm._renderProxy.$options.staticRenderFns;
  3336. var _staticTrees = vm._renderProxy._staticTrees;
  3337. vm._renderProxy._staticTrees = [];
  3338. vm._renderProxy.$options.staticRenderFns = el.staticRenderFns;
  3339. var vnode = el.render.call(vm._renderProxy, vm.$createElement);
  3340. vm._renderProxy.$options.staticRenderFns = _staticRenderFns;
  3341. vm._renderProxy._staticTrees = _staticTrees;
  3342. return vnode.children[0]
  3343. }
  3344. function createVNodesForSlot(
  3345. vm,
  3346. slotValue,
  3347. name
  3348. ) {
  3349. if (typeof slotValue === 'string') {
  3350. return createVNodes(vm, slotValue, name)
  3351. }
  3352. var vnode = vm.$createElement(slotValue)
  3353. ;(vnode.data || (vnode.data = {})).slot = name;
  3354. return vnode
  3355. }
  3356. function createSlotVNodes(
  3357. vm,
  3358. slots
  3359. ) {
  3360. return Object.keys(slots).reduce(function (acc, key) {
  3361. var content = slots[key];
  3362. if (Array.isArray(content)) {
  3363. var nodes = content.map(function (slotDef) { return createVNodesForSlot(vm, slotDef, key); }
  3364. );
  3365. return acc.concat(nodes)
  3366. }
  3367. return acc.concat(createVNodesForSlot(vm, content, key))
  3368. }, [])
  3369. }
  3370. //
  3371. function addMocks(
  3372. _Vue,
  3373. mockedProperties
  3374. ) {
  3375. if ( mockedProperties === void 0 ) mockedProperties = {};
  3376. if (mockedProperties === false) {
  3377. return
  3378. }
  3379. Object.keys(mockedProperties).forEach(function (key) {
  3380. try {
  3381. // $FlowIgnore
  3382. _Vue.prototype[key] = mockedProperties[key];
  3383. } catch (e) {
  3384. warn(
  3385. "could not overwrite property " + key + ", this is " +
  3386. "usually caused by a plugin that has added " +
  3387. "the property as a read-only value"
  3388. );
  3389. }
  3390. // $FlowIgnore
  3391. Vue.util.defineReactive(_Vue, key, mockedProperties[key]);
  3392. });
  3393. }
  3394. //
  3395. function logEvents(
  3396. vm,
  3397. emitted,
  3398. emittedByOrder
  3399. ) {
  3400. var emit = vm.$emit;
  3401. vm.$emit = function (name) {
  3402. var args = [], len = arguments.length - 1;
  3403. while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
  3404. (emitted[name] || (emitted[name] = [])).push(args);
  3405. emittedByOrder.push({ name: name, args: args });
  3406. return emit.call.apply(emit, [ vm, name ].concat( args ))
  3407. };
  3408. }
  3409. function addEventLogger(_Vue) {
  3410. _Vue.mixin({
  3411. beforeCreate: function() {
  3412. this.__emitted = Object.create(null);
  3413. this.__emittedByOrder = [];
  3414. logEvents(this, this.__emitted, this.__emittedByOrder);
  3415. }
  3416. });
  3417. }
  3418. function addStubs(_Vue, stubComponents) {
  3419. var obj;
  3420. function addStubComponentsMixin() {
  3421. Object.assign(this.$options.components, stubComponents);
  3422. }
  3423. _Vue.mixin(( obj = {}, obj[BEFORE_RENDER_LIFECYCLE_HOOK] = addStubComponentsMixin, obj));
  3424. }
  3425. //
  3426. function compileFromString(str) {
  3427. if (!vueTemplateCompiler.compileToFunctions) {
  3428. throwError(
  3429. "vueTemplateCompiler is undefined, you must pass " +
  3430. "precompiled components if vue-template-compiler is " +
  3431. "undefined"
  3432. );
  3433. }
  3434. return vueTemplateCompiler.compileToFunctions(str)
  3435. }
  3436. function compileTemplate(component) {
  3437. if (component.template) {
  3438. Object.assign(component, vueTemplateCompiler.compileToFunctions(component.template));
  3439. }
  3440. if (component.components) {
  3441. Object.keys(component.components).forEach(function (c) {
  3442. var cmp = component.components[c];
  3443. if (!cmp.render) {
  3444. compileTemplate(cmp);
  3445. }
  3446. });
  3447. }
  3448. if (component.extends) {
  3449. compileTemplate(component.extends);
  3450. }
  3451. if (component.extendOptions && !component.options.render) {
  3452. compileTemplate(component.options);
  3453. }
  3454. }
  3455. function compileTemplateForSlots(slots) {
  3456. Object.keys(slots).forEach(function (key) {
  3457. var slot = Array.isArray(slots[key]) ? slots[key] : [slots[key]];
  3458. slot.forEach(function (slotValue) {
  3459. if (componentNeedsCompiling(slotValue)) {
  3460. compileTemplate(slotValue);
  3461. }
  3462. });
  3463. });
  3464. }
  3465. //
  3466. var MOUNTING_OPTIONS = [
  3467. 'attachToDocument',
  3468. 'mocks',
  3469. 'slots',
  3470. 'localVue',
  3471. 'stubs',
  3472. 'context',
  3473. 'clone',
  3474. 'attrs',
  3475. 'listeners',
  3476. 'propsData',
  3477. 'sync',
  3478. 'shouldProxy'
  3479. ];
  3480. function extractInstanceOptions(options) {
  3481. var instanceOptions = Object.assign({}, options);
  3482. MOUNTING_OPTIONS.forEach(function (mountingOption) {
  3483. delete instanceOptions[mountingOption];
  3484. });
  3485. return instanceOptions
  3486. }
  3487. //
  3488. function isDestructuringSlotScope(slotScope) {
  3489. return slotScope[0] === '{' && slotScope[slotScope.length - 1] === '}'
  3490. }
  3491. function getVueTemplateCompilerHelpers(
  3492. _Vue
  3493. ) {
  3494. // $FlowIgnore
  3495. var vue = new _Vue();
  3496. var helpers = {};
  3497. var names = [
  3498. '_c',
  3499. '_o',
  3500. '_n',
  3501. '_s',
  3502. '_l',
  3503. '_t',
  3504. '_q',
  3505. '_i',
  3506. '_m',
  3507. '_f',
  3508. '_k',
  3509. '_b',
  3510. '_v',
  3511. '_e',
  3512. '_u',
  3513. '_g'
  3514. ];
  3515. names.forEach(function (name) {
  3516. helpers[name] = vue._renderProxy[name];
  3517. });
  3518. helpers.$createElement = vue._renderProxy.$createElement;
  3519. return helpers
  3520. }
  3521. function validateEnvironment() {
  3522. if (VUE_VERSION < 2.1) {
  3523. throwError("the scopedSlots option is only supported in vue@2.1+.");
  3524. }
  3525. }
  3526. var slotScopeRe = /<[^>]+ slot-scope=\"(.+)\"/;
  3527. // Hide warning about <template> disallowed as root element
  3528. function customWarn(msg) {
  3529. if (msg.indexOf('Cannot use <template> as component root element') === -1) {
  3530. console.error(msg);
  3531. }
  3532. }
  3533. function createScopedSlots(
  3534. scopedSlotsOption,
  3535. _Vue
  3536. ) {
  3537. var scopedSlots = {};
  3538. if (!scopedSlotsOption) {
  3539. return scopedSlots
  3540. }
  3541. validateEnvironment();
  3542. var helpers = getVueTemplateCompilerHelpers(_Vue);
  3543. var loop = function ( scopedSlotName ) {
  3544. var slot = scopedSlotsOption[scopedSlotName];
  3545. var isFn = typeof slot === 'function';
  3546. // Type check to silence flow (can't use isFn)
  3547. var renderFn =
  3548. typeof slot === 'function'
  3549. ? slot
  3550. : vueTemplateCompiler.compileToFunctions(slot, { warn: customWarn }).render;
  3551. var hasSlotScopeAttr = !isFn && slot.match(slotScopeRe);
  3552. var slotScope = hasSlotScopeAttr && hasSlotScopeAttr[1];
  3553. scopedSlots[scopedSlotName] = function(props) {
  3554. var obj;
  3555. var res;
  3556. if (isFn) {
  3557. res = renderFn.call(Object.assign({}, helpers), props);
  3558. } else if (slotScope && !isDestructuringSlotScope(slotScope)) {
  3559. res = renderFn.call(Object.assign({}, helpers, ( obj = {}, obj[slotScope] = props, obj)));
  3560. } else if (slotScope && isDestructuringSlotScope(slotScope)) {
  3561. res = renderFn.call(Object.assign({}, helpers, props));
  3562. } else {
  3563. res = renderFn.call(Object.assign({}, helpers, {props: props}));
  3564. }
  3565. // res is Array if <template> is a root element
  3566. return Array.isArray(res) ? res[0] : res
  3567. };
  3568. };
  3569. for (var scopedSlotName in scopedSlotsOption) loop( scopedSlotName );
  3570. return scopedSlots
  3571. }
  3572. //
  3573. function isVueComponentStub(comp) {
  3574. return (comp && comp.template) || isVueComponent(comp)
  3575. }
  3576. function isValidStub(stub) {
  3577. return (
  3578. typeof stub === 'boolean' ||
  3579. (!!stub && typeof stub === 'string') ||
  3580. isVueComponentStub(stub)
  3581. )
  3582. }
  3583. function resolveComponent$1(obj, component) {
  3584. return (
  3585. obj[component] ||
  3586. obj[hyphenate(component)] ||
  3587. obj[camelize(component)] ||
  3588. obj[capitalize(camelize(component))] ||
  3589. obj[capitalize(component)] ||
  3590. {}
  3591. )
  3592. }
  3593. function getCoreProperties(componentOptions) {
  3594. return {
  3595. attrs: componentOptions.attrs,
  3596. name: componentOptions.name,
  3597. props: componentOptions.props,
  3598. on: componentOptions.on,
  3599. key: componentOptions.key,
  3600. ref: componentOptions.ref,
  3601. domProps: componentOptions.domProps,
  3602. class: componentOptions.class,
  3603. staticClass: componentOptions.staticClass,
  3604. staticStyle: componentOptions.staticStyle,
  3605. style: componentOptions.style,
  3606. normalizedStyle: componentOptions.normalizedStyle,
  3607. nativeOn: componentOptions.nativeOn,
  3608. functional: componentOptions.functional
  3609. }
  3610. }
  3611. function createClassString(staticClass, dynamicClass) {
  3612. if (staticClass && dynamicClass) {
  3613. return staticClass + ' ' + dynamicClass
  3614. }
  3615. return staticClass || dynamicClass
  3616. }
  3617. function resolveOptions(component, _Vue) {
  3618. if (isDynamicComponent(component)) {
  3619. return {}
  3620. }
  3621. return isConstructor(component)
  3622. ? component.options
  3623. : _Vue.extend(component).options
  3624. }
  3625. function createStubFromComponent(
  3626. originalComponent,
  3627. name,
  3628. _Vue
  3629. ) {
  3630. var componentOptions = resolveOptions(originalComponent, _Vue);
  3631. var tagName = (name || 'anonymous') + "-stub";
  3632. // ignoreElements does not exist in Vue 2.0.x
  3633. if (Vue.config.ignoredElements) {
  3634. Vue.config.ignoredElements.push(tagName);
  3635. }
  3636. return Object.assign({}, getCoreProperties(componentOptions),
  3637. {$_vueTestUtils_original: originalComponent,
  3638. $_doNotStubChildren: true,
  3639. render: function render(h, context) {
  3640. return h(
  3641. tagName,
  3642. {
  3643. attrs: componentOptions.functional
  3644. ? Object.assign({}, context.props,
  3645. context.data.attrs,
  3646. {class: createClassString(
  3647. context.data.staticClass,
  3648. context.data.class
  3649. )})
  3650. : Object.assign({}, this.$props)
  3651. },
  3652. context ? context.children : this.$options._renderChildren
  3653. )
  3654. }})
  3655. }
  3656. function createStubFromString(
  3657. templateString,
  3658. originalComponent,
  3659. name,
  3660. _Vue
  3661. ) {
  3662. if ( originalComponent === void 0 ) originalComponent = {};
  3663. if (templateContainsComponent(templateString, name)) {
  3664. throwError('options.stub cannot contain a circular reference');
  3665. }
  3666. var componentOptions = resolveOptions(originalComponent, _Vue);
  3667. return Object.assign({}, getCoreProperties(componentOptions),
  3668. {$_doNotStubChildren: true},
  3669. compileFromString(templateString))
  3670. }
  3671. function validateStub(stub) {
  3672. if (!isValidStub(stub)) {
  3673. throwError("options.stub values must be passed a string or " + "component");
  3674. }
  3675. }
  3676. function createStubsFromStubsObject(
  3677. originalComponents,
  3678. stubs,
  3679. _Vue
  3680. ) {
  3681. if ( originalComponents === void 0 ) originalComponents = {};
  3682. return Object.keys(stubs || {}).reduce(function (acc, stubName) {
  3683. var stub = stubs[stubName];
  3684. validateStub(stub);
  3685. if (stub === false) {
  3686. return acc
  3687. }
  3688. if (stub === true) {
  3689. var component = resolveComponent$1(originalComponents, stubName);
  3690. acc[stubName] = createStubFromComponent(component, stubName, _Vue);
  3691. return acc
  3692. }
  3693. if (typeof stub === 'string') {
  3694. var component$1 = resolveComponent$1(originalComponents, stubName);
  3695. acc[stubName] = createStubFromString(stub, component$1, stubName, _Vue);
  3696. return acc
  3697. }
  3698. if (componentNeedsCompiling(stub)) {
  3699. compileTemplate(stub);
  3700. }
  3701. acc[stubName] = stub;
  3702. return acc
  3703. }, {})
  3704. }
  3705. var isWhitelisted = function (el, whitelist) { return resolveComponent(el, whitelist); };
  3706. var isAlreadyStubbed = function (el, stubs) { return stubs.has(el); };
  3707. function shouldExtend(component, _Vue) {
  3708. return isConstructor(component) || (component && component.extends)
  3709. }
  3710. function extend(component, _Vue) {
  3711. var componentOptions = component.options ? component.options : component;
  3712. var stub = _Vue.extend(componentOptions);
  3713. stub.options.$_vueTestUtils_original = component;
  3714. stub.options._base = _Vue;
  3715. return stub
  3716. }
  3717. function createStubIfNeeded(shouldStub, component, _Vue, el) {
  3718. if (shouldStub) {
  3719. return createStubFromComponent(component || {}, el, _Vue)
  3720. }
  3721. if (shouldExtend(component, _Vue)) {
  3722. return extend(component, _Vue)
  3723. }
  3724. }
  3725. function shouldNotBeStubbed(el, whitelist, modifiedComponents) {
  3726. return (
  3727. (typeof el === 'string' && isReservedTag(el)) ||
  3728. isWhitelisted(el, whitelist) ||
  3729. isAlreadyStubbed(el, modifiedComponents)
  3730. )
  3731. }
  3732. function patchCreateElement(_Vue, stubs, stubAllComponents) {
  3733. var obj;
  3734. // This mixin patches vm.$createElement so that we can stub all components
  3735. // before they are rendered in shallow mode. We also need to ensure that
  3736. // component constructors were created from the _Vue constructor. If not,
  3737. // we must replace them with components created from the _Vue constructor
  3738. // before calling the original $createElement. This ensures that components
  3739. // have the correct instance properties and stubs when they are rendered.
  3740. function patchCreateElementMixin() {
  3741. var vm = this;
  3742. if (vm.$options.$_doNotStubChildren || vm.$options._isFunctionalContainer) {
  3743. return
  3744. }
  3745. var modifiedComponents = new Set();
  3746. var originalCreateElement = vm.$createElement;
  3747. var originalComponents = vm.$options.components;
  3748. var createElement = function (el) {
  3749. var obj;
  3750. var args = [], len = arguments.length - 1;
  3751. while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
  3752. if (shouldNotBeStubbed(el, stubs, modifiedComponents)) {
  3753. return originalCreateElement.apply(void 0, [ el ].concat( args ))
  3754. }
  3755. if (isConstructor(el) || isComponentOptions(el)) {
  3756. if (stubAllComponents) {
  3757. var stub = createStubFromComponent(el, el.name || 'anonymous', _Vue);
  3758. return originalCreateElement.apply(void 0, [ stub ].concat( args ))
  3759. }
  3760. var Constructor = shouldExtend(el, _Vue) ? extend(el, _Vue) : el;
  3761. return originalCreateElement.apply(void 0, [ Constructor ].concat( args ))
  3762. }
  3763. if (typeof el === 'string') {
  3764. var original = resolveComponent(el, originalComponents);
  3765. if (!original) {
  3766. return originalCreateElement.apply(void 0, [ el ].concat( args ))
  3767. }
  3768. if (isDynamicComponent(original)) {
  3769. return originalCreateElement.apply(void 0, [ el ].concat( args ))
  3770. }
  3771. var stub$1 = createStubIfNeeded(stubAllComponents, original, _Vue, el);
  3772. if (stub$1) {
  3773. Object.assign(vm.$options.components, ( obj = {}, obj[el] = stub$1, obj));
  3774. modifiedComponents.add(el);
  3775. }
  3776. }
  3777. return originalCreateElement.apply(void 0, [ el ].concat( args ))
  3778. };
  3779. vm[CREATE_ELEMENT_ALIAS] = createElement;
  3780. vm.$createElement = createElement;
  3781. }
  3782. _Vue.mixin(( obj = {}, obj[BEFORE_RENDER_LIFECYCLE_HOOK] = patchCreateElementMixin, obj));
  3783. }
  3784. //
  3785. function createContext(options, scopedSlots) {
  3786. var on = Object.assign({}, (options.context && options.context.on),
  3787. options.listeners);
  3788. return Object.assign({}, {attrs: Object.assign({}, options.attrs,
  3789. // pass as attrs so that inheritAttrs works correctly
  3790. // propsData should take precedence over attrs
  3791. options.propsData)},
  3792. (options.context || {}),
  3793. {on: on,
  3794. scopedSlots: scopedSlots})
  3795. }
  3796. function createChildren(vm, h, ref) {
  3797. var slots = ref.slots;
  3798. var context = ref.context;
  3799. var slotVNodes = slots ? createSlotVNodes(vm, slots) : undefined;
  3800. return (
  3801. (context &&
  3802. context.children &&
  3803. context.children.map(function (x) { return (typeof x === 'function' ? x(h) : x); })) ||
  3804. slotVNodes
  3805. )
  3806. }
  3807. function createInstance(
  3808. component,
  3809. options,
  3810. _Vue
  3811. ) {
  3812. var componentOptions = isConstructor(component)
  3813. ? component.options
  3814. : component;
  3815. // instance options are options that are passed to the
  3816. // root instance when it's instantiated
  3817. var instanceOptions = extractInstanceOptions(options);
  3818. var stubComponentsObject = createStubsFromStubsObject(
  3819. componentOptions.components,
  3820. // $FlowIgnore
  3821. options.stubs,
  3822. _Vue
  3823. );
  3824. addEventLogger(_Vue);
  3825. addMocks(_Vue, options.mocks);
  3826. addStubs(_Vue, stubComponentsObject);
  3827. patchCreateElement(_Vue, stubComponentsObject, options.shouldProxy);
  3828. if (componentNeedsCompiling(componentOptions)) {
  3829. compileTemplate(componentOptions);
  3830. }
  3831. // used to identify extended component using constructor
  3832. componentOptions.$_vueTestUtils_original = component;
  3833. // make sure all extends are based on this instance
  3834. var Constructor = _Vue.extend(componentOptions).extend(instanceOptions);
  3835. Constructor.options._base = _Vue;
  3836. var scopedSlots = createScopedSlots(options.scopedSlots, _Vue);
  3837. var parentComponentOptions = options.parentComponent || {};
  3838. parentComponentOptions.provide = options.provide;
  3839. parentComponentOptions.$_doNotStubChildren = true;
  3840. parentComponentOptions._isFunctionalContainer = componentOptions.functional;
  3841. parentComponentOptions.render = function(h) {
  3842. return h(
  3843. Constructor,
  3844. createContext(options, scopedSlots),
  3845. createChildren(this, h, options)
  3846. )
  3847. };
  3848. var Parent = _Vue.extend(parentComponentOptions);
  3849. return new Parent()
  3850. }
  3851. //
  3852. function createElement() {
  3853. if (document) {
  3854. var elem = document.createElement('div');
  3855. if (document.body) {
  3856. document.body.appendChild(elem);
  3857. }
  3858. return elem
  3859. }
  3860. }
  3861. function normalizeStubs(stubs) {
  3862. if ( stubs === void 0 ) stubs = {};
  3863. if (stubs === false) {
  3864. return false
  3865. }
  3866. if (isPlainObject(stubs)) {
  3867. return stubs
  3868. }
  3869. if (Array.isArray(stubs)) {
  3870. return stubs.reduce(function (acc, stub) {
  3871. if (typeof stub !== 'string') {
  3872. throwError('each item in an options.stubs array must be a string');
  3873. }
  3874. acc[stub] = true;
  3875. return acc
  3876. }, {})
  3877. }
  3878. throwError('options.stubs must be an object or an Array');
  3879. }
  3880. function normalizeProvide(provide) {
  3881. // Objects are not resolved in extended components in Vue < 2.5
  3882. // https://github.com/vuejs/vue/issues/6436
  3883. if (typeof provide === 'object' && VUE_VERSION < 2.5) {
  3884. var obj = Object.assign({}, provide);
  3885. return function () { return obj; }
  3886. }
  3887. return provide
  3888. }
  3889. //
  3890. function getOption(option, config) {
  3891. if (option === false) {
  3892. return false
  3893. }
  3894. if (option || (config && Object.keys(config).length > 0)) {
  3895. if (option instanceof Function) {
  3896. return option
  3897. }
  3898. if (config instanceof Function) {
  3899. throw new Error("Config can't be a Function.")
  3900. }
  3901. return Object.assign({}, config,
  3902. option)
  3903. }
  3904. }
  3905. function mergeOptions(options, config) {
  3906. var mocks = (getOption(options.mocks, config.mocks));
  3907. var methods = (getOption(options.methods, config.methods));
  3908. var provide = (getOption(options.provide, config.provide));
  3909. return Object.assign({}, options,
  3910. {provide: normalizeProvide(provide),
  3911. stubs: getOption(normalizeStubs(options.stubs), config.stubs),
  3912. mocks: mocks,
  3913. methods: methods,
  3914. sync: !!(options.sync || options.sync === undefined)})
  3915. }
  3916. //
  3917. function warnIfNoWindow() {
  3918. if (typeof window === 'undefined') {
  3919. throwError(
  3920. "window is undefined, vue-test-utils needs to be " +
  3921. "run in a browser environment. \n" +
  3922. "You can run the tests in node using jsdom \n" +
  3923. "See https://vue-test-utils.vuejs.org/guides/#browser-environment " +
  3924. "for more details."
  3925. );
  3926. }
  3927. }
  3928. /**
  3929. * Removes all key-value entries from the list cache.
  3930. *
  3931. * @private
  3932. * @name clear
  3933. * @memberOf ListCache
  3934. */
  3935. function listCacheClear() {
  3936. this.__data__ = [];
  3937. this.size = 0;
  3938. }
  3939. var _listCacheClear = listCacheClear;
  3940. /**
  3941. * Performs a
  3942. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3943. * comparison between two values to determine if they are equivalent.
  3944. *
  3945. * @static
  3946. * @memberOf _
  3947. * @since 4.0.0
  3948. * @category Lang
  3949. * @param {*} value The value to compare.
  3950. * @param {*} other The other value to compare.
  3951. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  3952. * @example
  3953. *
  3954. * var object = { 'a': 1 };
  3955. * var other = { 'a': 1 };
  3956. *
  3957. * _.eq(object, object);
  3958. * // => true
  3959. *
  3960. * _.eq(object, other);
  3961. * // => false
  3962. *
  3963. * _.eq('a', 'a');
  3964. * // => true
  3965. *
  3966. * _.eq('a', Object('a'));
  3967. * // => false
  3968. *
  3969. * _.eq(NaN, NaN);
  3970. * // => true
  3971. */
  3972. function eq(value, other) {
  3973. return value === other || (value !== value && other !== other);
  3974. }
  3975. var eq_1 = eq;
  3976. /**
  3977. * Gets the index at which the `key` is found in `array` of key-value pairs.
  3978. *
  3979. * @private
  3980. * @param {Array} array The array to inspect.
  3981. * @param {*} key The key to search for.
  3982. * @returns {number} Returns the index of the matched value, else `-1`.
  3983. */
  3984. function assocIndexOf(array, key) {
  3985. var length = array.length;
  3986. while (length--) {
  3987. if (eq_1(array[length][0], key)) {
  3988. return length;
  3989. }
  3990. }
  3991. return -1;
  3992. }
  3993. var _assocIndexOf = assocIndexOf;
  3994. /** Used for built-in method references. */
  3995. var arrayProto = Array.prototype;
  3996. /** Built-in value references. */
  3997. var splice = arrayProto.splice;
  3998. /**
  3999. * Removes `key` and its value from the list cache.
  4000. *
  4001. * @private
  4002. * @name delete
  4003. * @memberOf ListCache
  4004. * @param {string} key The key of the value to remove.
  4005. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4006. */
  4007. function listCacheDelete(key) {
  4008. var data = this.__data__,
  4009. index = _assocIndexOf(data, key);
  4010. if (index < 0) {
  4011. return false;
  4012. }
  4013. var lastIndex = data.length - 1;
  4014. if (index == lastIndex) {
  4015. data.pop();
  4016. } else {
  4017. splice.call(data, index, 1);
  4018. }
  4019. --this.size;
  4020. return true;
  4021. }
  4022. var _listCacheDelete = listCacheDelete;
  4023. /**
  4024. * Gets the list cache value for `key`.
  4025. *
  4026. * @private
  4027. * @name get
  4028. * @memberOf ListCache
  4029. * @param {string} key The key of the value to get.
  4030. * @returns {*} Returns the entry value.
  4031. */
  4032. function listCacheGet(key) {
  4033. var data = this.__data__,
  4034. index = _assocIndexOf(data, key);
  4035. return index < 0 ? undefined : data[index][1];
  4036. }
  4037. var _listCacheGet = listCacheGet;
  4038. /**
  4039. * Checks if a list cache value for `key` exists.
  4040. *
  4041. * @private
  4042. * @name has
  4043. * @memberOf ListCache
  4044. * @param {string} key The key of the entry to check.
  4045. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4046. */
  4047. function listCacheHas(key) {
  4048. return _assocIndexOf(this.__data__, key) > -1;
  4049. }
  4050. var _listCacheHas = listCacheHas;
  4051. /**
  4052. * Sets the list cache `key` to `value`.
  4053. *
  4054. * @private
  4055. * @name set
  4056. * @memberOf ListCache
  4057. * @param {string} key The key of the value to set.
  4058. * @param {*} value The value to set.
  4059. * @returns {Object} Returns the list cache instance.
  4060. */
  4061. function listCacheSet(key, value) {
  4062. var data = this.__data__,
  4063. index = _assocIndexOf(data, key);
  4064. if (index < 0) {
  4065. ++this.size;
  4066. data.push([key, value]);
  4067. } else {
  4068. data[index][1] = value;
  4069. }
  4070. return this;
  4071. }
  4072. var _listCacheSet = listCacheSet;
  4073. /**
  4074. * Creates an list cache object.
  4075. *
  4076. * @private
  4077. * @constructor
  4078. * @param {Array} [entries] The key-value pairs to cache.
  4079. */
  4080. function ListCache(entries) {
  4081. var this$1 = this;
  4082. var index = -1,
  4083. length = entries == null ? 0 : entries.length;
  4084. this.clear();
  4085. while (++index < length) {
  4086. var entry = entries[index];
  4087. this$1.set(entry[0], entry[1]);
  4088. }
  4089. }
  4090. // Add methods to `ListCache`.
  4091. ListCache.prototype.clear = _listCacheClear;
  4092. ListCache.prototype['delete'] = _listCacheDelete;
  4093. ListCache.prototype.get = _listCacheGet;
  4094. ListCache.prototype.has = _listCacheHas;
  4095. ListCache.prototype.set = _listCacheSet;
  4096. var _ListCache = ListCache;
  4097. /**
  4098. * Removes all key-value entries from the stack.
  4099. *
  4100. * @private
  4101. * @name clear
  4102. * @memberOf Stack
  4103. */
  4104. function stackClear() {
  4105. this.__data__ = new _ListCache;
  4106. this.size = 0;
  4107. }
  4108. var _stackClear = stackClear;
  4109. /**
  4110. * Removes `key` and its value from the stack.
  4111. *
  4112. * @private
  4113. * @name delete
  4114. * @memberOf Stack
  4115. * @param {string} key The key of the value to remove.
  4116. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4117. */
  4118. function stackDelete(key) {
  4119. var data = this.__data__,
  4120. result = data['delete'](key);
  4121. this.size = data.size;
  4122. return result;
  4123. }
  4124. var _stackDelete = stackDelete;
  4125. /**
  4126. * Gets the stack value for `key`.
  4127. *
  4128. * @private
  4129. * @name get
  4130. * @memberOf Stack
  4131. * @param {string} key The key of the value to get.
  4132. * @returns {*} Returns the entry value.
  4133. */
  4134. function stackGet(key) {
  4135. return this.__data__.get(key);
  4136. }
  4137. var _stackGet = stackGet;
  4138. /**
  4139. * Checks if a stack value for `key` exists.
  4140. *
  4141. * @private
  4142. * @name has
  4143. * @memberOf Stack
  4144. * @param {string} key The key of the entry to check.
  4145. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4146. */
  4147. function stackHas(key) {
  4148. return this.__data__.has(key);
  4149. }
  4150. var _stackHas = stackHas;
  4151. /** Detect free variable `global` from Node.js. */
  4152. var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
  4153. var _freeGlobal = freeGlobal;
  4154. /** Detect free variable `self`. */
  4155. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  4156. /** Used as a reference to the global object. */
  4157. var root = _freeGlobal || freeSelf || Function('return this')();
  4158. var _root = root;
  4159. /** Built-in value references. */
  4160. var Symbol = _root.Symbol;
  4161. var _Symbol = Symbol;
  4162. /** Used for built-in method references. */
  4163. var objectProto = Object.prototype;
  4164. /** Used to check objects for own properties. */
  4165. var hasOwnProperty$1 = objectProto.hasOwnProperty;
  4166. /**
  4167. * Used to resolve the
  4168. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  4169. * of values.
  4170. */
  4171. var nativeObjectToString = objectProto.toString;
  4172. /** Built-in value references. */
  4173. var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
  4174. /**
  4175. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  4176. *
  4177. * @private
  4178. * @param {*} value The value to query.
  4179. * @returns {string} Returns the raw `toStringTag`.
  4180. */
  4181. function getRawTag(value) {
  4182. var isOwn = hasOwnProperty$1.call(value, symToStringTag),
  4183. tag = value[symToStringTag];
  4184. try {
  4185. value[symToStringTag] = undefined;
  4186. var unmasked = true;
  4187. } catch (e) {}
  4188. var result = nativeObjectToString.call(value);
  4189. if (unmasked) {
  4190. if (isOwn) {
  4191. value[symToStringTag] = tag;
  4192. } else {
  4193. delete value[symToStringTag];
  4194. }
  4195. }
  4196. return result;
  4197. }
  4198. var _getRawTag = getRawTag;
  4199. /** Used for built-in method references. */
  4200. var objectProto$1 = Object.prototype;
  4201. /**
  4202. * Used to resolve the
  4203. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  4204. * of values.
  4205. */
  4206. var nativeObjectToString$1 = objectProto$1.toString;
  4207. /**
  4208. * Converts `value` to a string using `Object.prototype.toString`.
  4209. *
  4210. * @private
  4211. * @param {*} value The value to convert.
  4212. * @returns {string} Returns the converted string.
  4213. */
  4214. function objectToString(value) {
  4215. return nativeObjectToString$1.call(value);
  4216. }
  4217. var _objectToString = objectToString;
  4218. /** `Object#toString` result references. */
  4219. var nullTag = '[object Null]',
  4220. undefinedTag = '[object Undefined]';
  4221. /** Built-in value references. */
  4222. var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
  4223. /**
  4224. * The base implementation of `getTag` without fallbacks for buggy environments.
  4225. *
  4226. * @private
  4227. * @param {*} value The value to query.
  4228. * @returns {string} Returns the `toStringTag`.
  4229. */
  4230. function baseGetTag(value) {
  4231. if (value == null) {
  4232. return value === undefined ? undefinedTag : nullTag;
  4233. }
  4234. return (symToStringTag$1 && symToStringTag$1 in Object(value))
  4235. ? _getRawTag(value)
  4236. : _objectToString(value);
  4237. }
  4238. var _baseGetTag = baseGetTag;
  4239. /**
  4240. * Checks if `value` is the
  4241. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  4242. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  4243. *
  4244. * @static
  4245. * @memberOf _
  4246. * @since 0.1.0
  4247. * @category Lang
  4248. * @param {*} value The value to check.
  4249. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  4250. * @example
  4251. *
  4252. * _.isObject({});
  4253. * // => true
  4254. *
  4255. * _.isObject([1, 2, 3]);
  4256. * // => true
  4257. *
  4258. * _.isObject(_.noop);
  4259. * // => true
  4260. *
  4261. * _.isObject(null);
  4262. * // => false
  4263. */
  4264. function isObject(value) {
  4265. var type = typeof value;
  4266. return value != null && (type == 'object' || type == 'function');
  4267. }
  4268. var isObject_1 = isObject;
  4269. /** `Object#toString` result references. */
  4270. var asyncTag = '[object AsyncFunction]',
  4271. funcTag = '[object Function]',
  4272. genTag = '[object GeneratorFunction]',
  4273. proxyTag = '[object Proxy]';
  4274. /**
  4275. * Checks if `value` is classified as a `Function` object.
  4276. *
  4277. * @static
  4278. * @memberOf _
  4279. * @since 0.1.0
  4280. * @category Lang
  4281. * @param {*} value The value to check.
  4282. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  4283. * @example
  4284. *
  4285. * _.isFunction(_);
  4286. * // => true
  4287. *
  4288. * _.isFunction(/abc/);
  4289. * // => false
  4290. */
  4291. function isFunction(value) {
  4292. if (!isObject_1(value)) {
  4293. return false;
  4294. }
  4295. // The use of `Object#toString` avoids issues with the `typeof` operator
  4296. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  4297. var tag = _baseGetTag(value);
  4298. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  4299. }
  4300. var isFunction_1 = isFunction;
  4301. /** Used to detect overreaching core-js shims. */
  4302. var coreJsData = _root['__core-js_shared__'];
  4303. var _coreJsData = coreJsData;
  4304. /** Used to detect methods masquerading as native. */
  4305. var maskSrcKey = (function() {
  4306. var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
  4307. return uid ? ('Symbol(src)_1.' + uid) : '';
  4308. }());
  4309. /**
  4310. * Checks if `func` has its source masked.
  4311. *
  4312. * @private
  4313. * @param {Function} func The function to check.
  4314. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  4315. */
  4316. function isMasked(func) {
  4317. return !!maskSrcKey && (maskSrcKey in func);
  4318. }
  4319. var _isMasked = isMasked;
  4320. /** Used for built-in method references. */
  4321. var funcProto = Function.prototype;
  4322. /** Used to resolve the decompiled source of functions. */
  4323. var funcToString = funcProto.toString;
  4324. /**
  4325. * Converts `func` to its source code.
  4326. *
  4327. * @private
  4328. * @param {Function} func The function to convert.
  4329. * @returns {string} Returns the source code.
  4330. */
  4331. function toSource(func) {
  4332. if (func != null) {
  4333. try {
  4334. return funcToString.call(func);
  4335. } catch (e) {}
  4336. try {
  4337. return (func + '');
  4338. } catch (e) {}
  4339. }
  4340. return '';
  4341. }
  4342. var _toSource = toSource;
  4343. /**
  4344. * Used to match `RegExp`
  4345. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  4346. */
  4347. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  4348. /** Used to detect host constructors (Safari). */
  4349. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  4350. /** Used for built-in method references. */
  4351. var funcProto$1 = Function.prototype,
  4352. objectProto$2 = Object.prototype;
  4353. /** Used to resolve the decompiled source of functions. */
  4354. var funcToString$1 = funcProto$1.toString;
  4355. /** Used to check objects for own properties. */
  4356. var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
  4357. /** Used to detect if a method is native. */
  4358. var reIsNative = RegExp('^' +
  4359. funcToString$1.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
  4360. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  4361. );
  4362. /**
  4363. * The base implementation of `_.isNative` without bad shim checks.
  4364. *
  4365. * @private
  4366. * @param {*} value The value to check.
  4367. * @returns {boolean} Returns `true` if `value` is a native function,
  4368. * else `false`.
  4369. */
  4370. function baseIsNative(value) {
  4371. if (!isObject_1(value) || _isMasked(value)) {
  4372. return false;
  4373. }
  4374. var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
  4375. return pattern.test(_toSource(value));
  4376. }
  4377. var _baseIsNative = baseIsNative;
  4378. /**
  4379. * Gets the value at `key` of `object`.
  4380. *
  4381. * @private
  4382. * @param {Object} [object] The object to query.
  4383. * @param {string} key The key of the property to get.
  4384. * @returns {*} Returns the property value.
  4385. */
  4386. function getValue(object, key) {
  4387. return object == null ? undefined : object[key];
  4388. }
  4389. var _getValue = getValue;
  4390. /**
  4391. * Gets the native function at `key` of `object`.
  4392. *
  4393. * @private
  4394. * @param {Object} object The object to query.
  4395. * @param {string} key The key of the method to get.
  4396. * @returns {*} Returns the function if it's native, else `undefined`.
  4397. */
  4398. function getNative(object, key) {
  4399. var value = _getValue(object, key);
  4400. return _baseIsNative(value) ? value : undefined;
  4401. }
  4402. var _getNative = getNative;
  4403. /* Built-in method references that are verified to be native. */
  4404. var Map = _getNative(_root, 'Map');
  4405. var _Map = Map;
  4406. /* Built-in method references that are verified to be native. */
  4407. var nativeCreate = _getNative(Object, 'create');
  4408. var _nativeCreate = nativeCreate;
  4409. /**
  4410. * Removes all key-value entries from the hash.
  4411. *
  4412. * @private
  4413. * @name clear
  4414. * @memberOf Hash
  4415. */
  4416. function hashClear() {
  4417. this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
  4418. this.size = 0;
  4419. }
  4420. var _hashClear = hashClear;
  4421. /**
  4422. * Removes `key` and its value from the hash.
  4423. *
  4424. * @private
  4425. * @name delete
  4426. * @memberOf Hash
  4427. * @param {Object} hash The hash to modify.
  4428. * @param {string} key The key of the value to remove.
  4429. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4430. */
  4431. function hashDelete(key) {
  4432. var result = this.has(key) && delete this.__data__[key];
  4433. this.size -= result ? 1 : 0;
  4434. return result;
  4435. }
  4436. var _hashDelete = hashDelete;
  4437. /** Used to stand-in for `undefined` hash values. */
  4438. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  4439. /** Used for built-in method references. */
  4440. var objectProto$3 = Object.prototype;
  4441. /** Used to check objects for own properties. */
  4442. var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
  4443. /**
  4444. * Gets the hash value for `key`.
  4445. *
  4446. * @private
  4447. * @name get
  4448. * @memberOf Hash
  4449. * @param {string} key The key of the value to get.
  4450. * @returns {*} Returns the entry value.
  4451. */
  4452. function hashGet(key) {
  4453. var data = this.__data__;
  4454. if (_nativeCreate) {
  4455. var result = data[key];
  4456. return result === HASH_UNDEFINED ? undefined : result;
  4457. }
  4458. return hasOwnProperty$3.call(data, key) ? data[key] : undefined;
  4459. }
  4460. var _hashGet = hashGet;
  4461. /** Used for built-in method references. */
  4462. var objectProto$4 = Object.prototype;
  4463. /** Used to check objects for own properties. */
  4464. var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
  4465. /**
  4466. * Checks if a hash value for `key` exists.
  4467. *
  4468. * @private
  4469. * @name has
  4470. * @memberOf Hash
  4471. * @param {string} key The key of the entry to check.
  4472. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4473. */
  4474. function hashHas(key) {
  4475. var data = this.__data__;
  4476. return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$4.call(data, key);
  4477. }
  4478. var _hashHas = hashHas;
  4479. /** Used to stand-in for `undefined` hash values. */
  4480. var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
  4481. /**
  4482. * Sets the hash `key` to `value`.
  4483. *
  4484. * @private
  4485. * @name set
  4486. * @memberOf Hash
  4487. * @param {string} key The key of the value to set.
  4488. * @param {*} value The value to set.
  4489. * @returns {Object} Returns the hash instance.
  4490. */
  4491. function hashSet(key, value) {
  4492. var data = this.__data__;
  4493. this.size += this.has(key) ? 0 : 1;
  4494. data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
  4495. return this;
  4496. }
  4497. var _hashSet = hashSet;
  4498. /**
  4499. * Creates a hash object.
  4500. *
  4501. * @private
  4502. * @constructor
  4503. * @param {Array} [entries] The key-value pairs to cache.
  4504. */
  4505. function Hash(entries) {
  4506. var this$1 = this;
  4507. var index = -1,
  4508. length = entries == null ? 0 : entries.length;
  4509. this.clear();
  4510. while (++index < length) {
  4511. var entry = entries[index];
  4512. this$1.set(entry[0], entry[1]);
  4513. }
  4514. }
  4515. // Add methods to `Hash`.
  4516. Hash.prototype.clear = _hashClear;
  4517. Hash.prototype['delete'] = _hashDelete;
  4518. Hash.prototype.get = _hashGet;
  4519. Hash.prototype.has = _hashHas;
  4520. Hash.prototype.set = _hashSet;
  4521. var _Hash = Hash;
  4522. /**
  4523. * Removes all key-value entries from the map.
  4524. *
  4525. * @private
  4526. * @name clear
  4527. * @memberOf MapCache
  4528. */
  4529. function mapCacheClear() {
  4530. this.size = 0;
  4531. this.__data__ = {
  4532. 'hash': new _Hash,
  4533. 'map': new (_Map || _ListCache),
  4534. 'string': new _Hash
  4535. };
  4536. }
  4537. var _mapCacheClear = mapCacheClear;
  4538. /**
  4539. * Checks if `value` is suitable for use as unique object key.
  4540. *
  4541. * @private
  4542. * @param {*} value The value to check.
  4543. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  4544. */
  4545. function isKeyable(value) {
  4546. var type = typeof value;
  4547. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  4548. ? (value !== '__proto__')
  4549. : (value === null);
  4550. }
  4551. var _isKeyable = isKeyable;
  4552. /**
  4553. * Gets the data for `map`.
  4554. *
  4555. * @private
  4556. * @param {Object} map The map to query.
  4557. * @param {string} key The reference key.
  4558. * @returns {*} Returns the map data.
  4559. */
  4560. function getMapData(map, key) {
  4561. var data = map.__data__;
  4562. return _isKeyable(key)
  4563. ? data[typeof key == 'string' ? 'string' : 'hash']
  4564. : data.map;
  4565. }
  4566. var _getMapData = getMapData;
  4567. /**
  4568. * Removes `key` and its value from the map.
  4569. *
  4570. * @private
  4571. * @name delete
  4572. * @memberOf MapCache
  4573. * @param {string} key The key of the value to remove.
  4574. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4575. */
  4576. function mapCacheDelete(key) {
  4577. var result = _getMapData(this, key)['delete'](key);
  4578. this.size -= result ? 1 : 0;
  4579. return result;
  4580. }
  4581. var _mapCacheDelete = mapCacheDelete;
  4582. /**
  4583. * Gets the map value for `key`.
  4584. *
  4585. * @private
  4586. * @name get
  4587. * @memberOf MapCache
  4588. * @param {string} key The key of the value to get.
  4589. * @returns {*} Returns the entry value.
  4590. */
  4591. function mapCacheGet(key) {
  4592. return _getMapData(this, key).get(key);
  4593. }
  4594. var _mapCacheGet = mapCacheGet;
  4595. /**
  4596. * Checks if a map value for `key` exists.
  4597. *
  4598. * @private
  4599. * @name has
  4600. * @memberOf MapCache
  4601. * @param {string} key The key of the entry to check.
  4602. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4603. */
  4604. function mapCacheHas(key) {
  4605. return _getMapData(this, key).has(key);
  4606. }
  4607. var _mapCacheHas = mapCacheHas;
  4608. /**
  4609. * Sets the map `key` to `value`.
  4610. *
  4611. * @private
  4612. * @name set
  4613. * @memberOf MapCache
  4614. * @param {string} key The key of the value to set.
  4615. * @param {*} value The value to set.
  4616. * @returns {Object} Returns the map cache instance.
  4617. */
  4618. function mapCacheSet(key, value) {
  4619. var data = _getMapData(this, key),
  4620. size = data.size;
  4621. data.set(key, value);
  4622. this.size += data.size == size ? 0 : 1;
  4623. return this;
  4624. }
  4625. var _mapCacheSet = mapCacheSet;
  4626. /**
  4627. * Creates a map cache object to store key-value pairs.
  4628. *
  4629. * @private
  4630. * @constructor
  4631. * @param {Array} [entries] The key-value pairs to cache.
  4632. */
  4633. function MapCache(entries) {
  4634. var this$1 = this;
  4635. var index = -1,
  4636. length = entries == null ? 0 : entries.length;
  4637. this.clear();
  4638. while (++index < length) {
  4639. var entry = entries[index];
  4640. this$1.set(entry[0], entry[1]);
  4641. }
  4642. }
  4643. // Add methods to `MapCache`.
  4644. MapCache.prototype.clear = _mapCacheClear;
  4645. MapCache.prototype['delete'] = _mapCacheDelete;
  4646. MapCache.prototype.get = _mapCacheGet;
  4647. MapCache.prototype.has = _mapCacheHas;
  4648. MapCache.prototype.set = _mapCacheSet;
  4649. var _MapCache = MapCache;
  4650. /** Used as the size to enable large array optimizations. */
  4651. var LARGE_ARRAY_SIZE = 200;
  4652. /**
  4653. * Sets the stack `key` to `value`.
  4654. *
  4655. * @private
  4656. * @name set
  4657. * @memberOf Stack
  4658. * @param {string} key The key of the value to set.
  4659. * @param {*} value The value to set.
  4660. * @returns {Object} Returns the stack cache instance.
  4661. */
  4662. function stackSet(key, value) {
  4663. var data = this.__data__;
  4664. if (data instanceof _ListCache) {
  4665. var pairs = data.__data__;
  4666. if (!_Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  4667. pairs.push([key, value]);
  4668. this.size = ++data.size;
  4669. return this;
  4670. }
  4671. data = this.__data__ = new _MapCache(pairs);
  4672. }
  4673. data.set(key, value);
  4674. this.size = data.size;
  4675. return this;
  4676. }
  4677. var _stackSet = stackSet;
  4678. /**
  4679. * Creates a stack cache object to store key-value pairs.
  4680. *
  4681. * @private
  4682. * @constructor
  4683. * @param {Array} [entries] The key-value pairs to cache.
  4684. */
  4685. function Stack(entries) {
  4686. var data = this.__data__ = new _ListCache(entries);
  4687. this.size = data.size;
  4688. }
  4689. // Add methods to `Stack`.
  4690. Stack.prototype.clear = _stackClear;
  4691. Stack.prototype['delete'] = _stackDelete;
  4692. Stack.prototype.get = _stackGet;
  4693. Stack.prototype.has = _stackHas;
  4694. Stack.prototype.set = _stackSet;
  4695. var _Stack = Stack;
  4696. /**
  4697. * A specialized version of `_.forEach` for arrays without support for
  4698. * iteratee shorthands.
  4699. *
  4700. * @private
  4701. * @param {Array} [array] The array to iterate over.
  4702. * @param {Function} iteratee The function invoked per iteration.
  4703. * @returns {Array} Returns `array`.
  4704. */
  4705. function arrayEach(array, iteratee) {
  4706. var index = -1,
  4707. length = array == null ? 0 : array.length;
  4708. while (++index < length) {
  4709. if (iteratee(array[index], index, array) === false) {
  4710. break;
  4711. }
  4712. }
  4713. return array;
  4714. }
  4715. var _arrayEach = arrayEach;
  4716. var defineProperty = (function() {
  4717. try {
  4718. var func = _getNative(Object, 'defineProperty');
  4719. func({}, '', {});
  4720. return func;
  4721. } catch (e) {}
  4722. }());
  4723. var _defineProperty = defineProperty;
  4724. /**
  4725. * The base implementation of `assignValue` and `assignMergeValue` without
  4726. * value checks.
  4727. *
  4728. * @private
  4729. * @param {Object} object The object to modify.
  4730. * @param {string} key The key of the property to assign.
  4731. * @param {*} value The value to assign.
  4732. */
  4733. function baseAssignValue(object, key, value) {
  4734. if (key == '__proto__' && _defineProperty) {
  4735. _defineProperty(object, key, {
  4736. 'configurable': true,
  4737. 'enumerable': true,
  4738. 'value': value,
  4739. 'writable': true
  4740. });
  4741. } else {
  4742. object[key] = value;
  4743. }
  4744. }
  4745. var _baseAssignValue = baseAssignValue;
  4746. /** Used for built-in method references. */
  4747. var objectProto$5 = Object.prototype;
  4748. /** Used to check objects for own properties. */
  4749. var hasOwnProperty$5 = objectProto$5.hasOwnProperty;
  4750. /**
  4751. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  4752. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  4753. * for equality comparisons.
  4754. *
  4755. * @private
  4756. * @param {Object} object The object to modify.
  4757. * @param {string} key The key of the property to assign.
  4758. * @param {*} value The value to assign.
  4759. */
  4760. function assignValue(object, key, value) {
  4761. var objValue = object[key];
  4762. if (!(hasOwnProperty$5.call(object, key) && eq_1(objValue, value)) ||
  4763. (value === undefined && !(key in object))) {
  4764. _baseAssignValue(object, key, value);
  4765. }
  4766. }
  4767. var _assignValue = assignValue;
  4768. /**
  4769. * Copies properties of `source` to `object`.
  4770. *
  4771. * @private
  4772. * @param {Object} source The object to copy properties from.
  4773. * @param {Array} props The property identifiers to copy.
  4774. * @param {Object} [object={}] The object to copy properties to.
  4775. * @param {Function} [customizer] The function to customize copied values.
  4776. * @returns {Object} Returns `object`.
  4777. */
  4778. function copyObject(source, props, object, customizer) {
  4779. var isNew = !object;
  4780. object || (object = {});
  4781. var index = -1,
  4782. length = props.length;
  4783. while (++index < length) {
  4784. var key = props[index];
  4785. var newValue = customizer
  4786. ? customizer(object[key], source[key], key, object, source)
  4787. : undefined;
  4788. if (newValue === undefined) {
  4789. newValue = source[key];
  4790. }
  4791. if (isNew) {
  4792. _baseAssignValue(object, key, newValue);
  4793. } else {
  4794. _assignValue(object, key, newValue);
  4795. }
  4796. }
  4797. return object;
  4798. }
  4799. var _copyObject = copyObject;
  4800. /**
  4801. * The base implementation of `_.times` without support for iteratee shorthands
  4802. * or max array length checks.
  4803. *
  4804. * @private
  4805. * @param {number} n The number of times to invoke `iteratee`.
  4806. * @param {Function} iteratee The function invoked per iteration.
  4807. * @returns {Array} Returns the array of results.
  4808. */
  4809. function baseTimes(n, iteratee) {
  4810. var index = -1,
  4811. result = Array(n);
  4812. while (++index < n) {
  4813. result[index] = iteratee(index);
  4814. }
  4815. return result;
  4816. }
  4817. var _baseTimes = baseTimes;
  4818. /**
  4819. * Checks if `value` is object-like. A value is object-like if it's not `null`
  4820. * and has a `typeof` result of "object".
  4821. *
  4822. * @static
  4823. * @memberOf _
  4824. * @since 4.0.0
  4825. * @category Lang
  4826. * @param {*} value The value to check.
  4827. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  4828. * @example
  4829. *
  4830. * _.isObjectLike({});
  4831. * // => true
  4832. *
  4833. * _.isObjectLike([1, 2, 3]);
  4834. * // => true
  4835. *
  4836. * _.isObjectLike(_.noop);
  4837. * // => false
  4838. *
  4839. * _.isObjectLike(null);
  4840. * // => false
  4841. */
  4842. function isObjectLike(value) {
  4843. return value != null && typeof value == 'object';
  4844. }
  4845. var isObjectLike_1 = isObjectLike;
  4846. /** `Object#toString` result references. */
  4847. var argsTag = '[object Arguments]';
  4848. /**
  4849. * The base implementation of `_.isArguments`.
  4850. *
  4851. * @private
  4852. * @param {*} value The value to check.
  4853. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  4854. */
  4855. function baseIsArguments(value) {
  4856. return isObjectLike_1(value) && _baseGetTag(value) == argsTag;
  4857. }
  4858. var _baseIsArguments = baseIsArguments;
  4859. /** Used for built-in method references. */
  4860. var objectProto$6 = Object.prototype;
  4861. /** Used to check objects for own properties. */
  4862. var hasOwnProperty$6 = objectProto$6.hasOwnProperty;
  4863. /** Built-in value references. */
  4864. var propertyIsEnumerable = objectProto$6.propertyIsEnumerable;
  4865. /**
  4866. * Checks if `value` is likely an `arguments` object.
  4867. *
  4868. * @static
  4869. * @memberOf _
  4870. * @since 0.1.0
  4871. * @category Lang
  4872. * @param {*} value The value to check.
  4873. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  4874. * else `false`.
  4875. * @example
  4876. *
  4877. * _.isArguments(function() { return arguments; }());
  4878. * // => true
  4879. *
  4880. * _.isArguments([1, 2, 3]);
  4881. * // => false
  4882. */
  4883. var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
  4884. return isObjectLike_1(value) && hasOwnProperty$6.call(value, 'callee') &&
  4885. !propertyIsEnumerable.call(value, 'callee');
  4886. };
  4887. var isArguments_1 = isArguments;
  4888. /**
  4889. * Checks if `value` is classified as an `Array` object.
  4890. *
  4891. * @static
  4892. * @memberOf _
  4893. * @since 0.1.0
  4894. * @category Lang
  4895. * @param {*} value The value to check.
  4896. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  4897. * @example
  4898. *
  4899. * _.isArray([1, 2, 3]);
  4900. * // => true
  4901. *
  4902. * _.isArray(document.body.children);
  4903. * // => false
  4904. *
  4905. * _.isArray('abc');
  4906. * // => false
  4907. *
  4908. * _.isArray(_.noop);
  4909. * // => false
  4910. */
  4911. var isArray = Array.isArray;
  4912. var isArray_1 = isArray;
  4913. /**
  4914. * This method returns `false`.
  4915. *
  4916. * @static
  4917. * @memberOf _
  4918. * @since 4.13.0
  4919. * @category Util
  4920. * @returns {boolean} Returns `false`.
  4921. * @example
  4922. *
  4923. * _.times(2, _.stubFalse);
  4924. * // => [false, false]
  4925. */
  4926. function stubFalse() {
  4927. return false;
  4928. }
  4929. var stubFalse_1 = stubFalse;
  4930. var isBuffer_1 = createCommonjsModule(function (module, exports) {
  4931. /** Detect free variable `exports`. */
  4932. var freeExports = 'object' == 'object' && exports && !exports.nodeType && exports;
  4933. /** Detect free variable `module`. */
  4934. var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
  4935. /** Detect the popular CommonJS extension `module.exports`. */
  4936. var moduleExports = freeModule && freeModule.exports === freeExports;
  4937. /** Built-in value references. */
  4938. var Buffer = moduleExports ? _root.Buffer : undefined;
  4939. /* Built-in method references for those with the same name as other `lodash` methods. */
  4940. var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
  4941. /**
  4942. * Checks if `value` is a buffer.
  4943. *
  4944. * @static
  4945. * @memberOf _
  4946. * @since 4.3.0
  4947. * @category Lang
  4948. * @param {*} value The value to check.
  4949. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  4950. * @example
  4951. *
  4952. * _.isBuffer(new Buffer(2));
  4953. * // => true
  4954. *
  4955. * _.isBuffer(new Uint8Array(2));
  4956. * // => false
  4957. */
  4958. var isBuffer = nativeIsBuffer || stubFalse_1;
  4959. module.exports = isBuffer;
  4960. });
  4961. /** Used as references for various `Number` constants. */
  4962. var MAX_SAFE_INTEGER = 9007199254740991;
  4963. /** Used to detect unsigned integer values. */
  4964. var reIsUint = /^(?:0|[1-9]\d*)$/;
  4965. /**
  4966. * Checks if `value` is a valid array-like index.
  4967. *
  4968. * @private
  4969. * @param {*} value The value to check.
  4970. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  4971. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  4972. */
  4973. function isIndex(value, length) {
  4974. length = length == null ? MAX_SAFE_INTEGER : length;
  4975. return !!length &&
  4976. (typeof value == 'number' || reIsUint.test(value)) &&
  4977. (value > -1 && value % 1 == 0 && value < length);
  4978. }
  4979. var _isIndex = isIndex;
  4980. /** Used as references for various `Number` constants. */
  4981. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  4982. /**
  4983. * Checks if `value` is a valid array-like length.
  4984. *
  4985. * **Note:** This method is loosely based on
  4986. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  4987. *
  4988. * @static
  4989. * @memberOf _
  4990. * @since 4.0.0
  4991. * @category Lang
  4992. * @param {*} value The value to check.
  4993. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  4994. * @example
  4995. *
  4996. * _.isLength(3);
  4997. * // => true
  4998. *
  4999. * _.isLength(Number.MIN_VALUE);
  5000. * // => false
  5001. *
  5002. * _.isLength(Infinity);
  5003. * // => false
  5004. *
  5005. * _.isLength('3');
  5006. * // => false
  5007. */
  5008. function isLength(value) {
  5009. return typeof value == 'number' &&
  5010. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
  5011. }
  5012. var isLength_1 = isLength;
  5013. /** `Object#toString` result references. */
  5014. var argsTag$1 = '[object Arguments]',
  5015. arrayTag = '[object Array]',
  5016. boolTag = '[object Boolean]',
  5017. dateTag = '[object Date]',
  5018. errorTag = '[object Error]',
  5019. funcTag$1 = '[object Function]',
  5020. mapTag = '[object Map]',
  5021. numberTag = '[object Number]',
  5022. objectTag = '[object Object]',
  5023. regexpTag = '[object RegExp]',
  5024. setTag = '[object Set]',
  5025. stringTag = '[object String]',
  5026. weakMapTag = '[object WeakMap]';
  5027. var arrayBufferTag = '[object ArrayBuffer]',
  5028. dataViewTag = '[object DataView]',
  5029. float32Tag = '[object Float32Array]',
  5030. float64Tag = '[object Float64Array]',
  5031. int8Tag = '[object Int8Array]',
  5032. int16Tag = '[object Int16Array]',
  5033. int32Tag = '[object Int32Array]',
  5034. uint8Tag = '[object Uint8Array]',
  5035. uint8ClampedTag = '[object Uint8ClampedArray]',
  5036. uint16Tag = '[object Uint16Array]',
  5037. uint32Tag = '[object Uint32Array]';
  5038. /** Used to identify `toStringTag` values of typed arrays. */
  5039. var typedArrayTags = {};
  5040. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  5041. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  5042. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  5043. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  5044. typedArrayTags[uint32Tag] = true;
  5045. typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] =
  5046. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  5047. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  5048. typedArrayTags[errorTag] = typedArrayTags[funcTag$1] =
  5049. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  5050. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  5051. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  5052. typedArrayTags[weakMapTag] = false;
  5053. /**
  5054. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  5055. *
  5056. * @private
  5057. * @param {*} value The value to check.
  5058. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  5059. */
  5060. function baseIsTypedArray(value) {
  5061. return isObjectLike_1(value) &&
  5062. isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
  5063. }
  5064. var _baseIsTypedArray = baseIsTypedArray;
  5065. /**
  5066. * The base implementation of `_.unary` without support for storing metadata.
  5067. *
  5068. * @private
  5069. * @param {Function} func The function to cap arguments for.
  5070. * @returns {Function} Returns the new capped function.
  5071. */
  5072. function baseUnary(func) {
  5073. return function(value) {
  5074. return func(value);
  5075. };
  5076. }
  5077. var _baseUnary = baseUnary;
  5078. var _nodeUtil = createCommonjsModule(function (module, exports) {
  5079. /** Detect free variable `exports`. */
  5080. var freeExports = 'object' == 'object' && exports && !exports.nodeType && exports;
  5081. /** Detect free variable `module`. */
  5082. var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
  5083. /** Detect the popular CommonJS extension `module.exports`. */
  5084. var moduleExports = freeModule && freeModule.exports === freeExports;
  5085. /** Detect free variable `process` from Node.js. */
  5086. var freeProcess = moduleExports && _freeGlobal.process;
  5087. /** Used to access faster Node.js helpers. */
  5088. var nodeUtil = (function() {
  5089. try {
  5090. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  5091. } catch (e) {}
  5092. }());
  5093. module.exports = nodeUtil;
  5094. });
  5095. /* Node.js helper references. */
  5096. var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
  5097. /**
  5098. * Checks if `value` is classified as a typed array.
  5099. *
  5100. * @static
  5101. * @memberOf _
  5102. * @since 3.0.0
  5103. * @category Lang
  5104. * @param {*} value The value to check.
  5105. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  5106. * @example
  5107. *
  5108. * _.isTypedArray(new Uint8Array);
  5109. * // => true
  5110. *
  5111. * _.isTypedArray([]);
  5112. * // => false
  5113. */
  5114. var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
  5115. var isTypedArray_1 = isTypedArray;
  5116. /** Used for built-in method references. */
  5117. var objectProto$7 = Object.prototype;
  5118. /** Used to check objects for own properties. */
  5119. var hasOwnProperty$7 = objectProto$7.hasOwnProperty;
  5120. /**
  5121. * Creates an array of the enumerable property names of the array-like `value`.
  5122. *
  5123. * @private
  5124. * @param {*} value The value to query.
  5125. * @param {boolean} inherited Specify returning inherited property names.
  5126. * @returns {Array} Returns the array of property names.
  5127. */
  5128. function arrayLikeKeys(value, inherited) {
  5129. var isArr = isArray_1(value),
  5130. isArg = !isArr && isArguments_1(value),
  5131. isBuff = !isArr && !isArg && isBuffer_1(value),
  5132. isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),
  5133. skipIndexes = isArr || isArg || isBuff || isType,
  5134. result = skipIndexes ? _baseTimes(value.length, String) : [],
  5135. length = result.length;
  5136. for (var key in value) {
  5137. if ((inherited || hasOwnProperty$7.call(value, key)) &&
  5138. !(skipIndexes && (
  5139. // Safari 9 has enumerable `arguments.length` in strict mode.
  5140. key == 'length' ||
  5141. // Node.js 0.10 has enumerable non-index properties on buffers.
  5142. (isBuff && (key == 'offset' || key == 'parent')) ||
  5143. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  5144. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  5145. // Skip index properties.
  5146. _isIndex(key, length)
  5147. ))) {
  5148. result.push(key);
  5149. }
  5150. }
  5151. return result;
  5152. }
  5153. var _arrayLikeKeys = arrayLikeKeys;
  5154. /** Used for built-in method references. */
  5155. var objectProto$8 = Object.prototype;
  5156. /**
  5157. * Checks if `value` is likely a prototype object.
  5158. *
  5159. * @private
  5160. * @param {*} value The value to check.
  5161. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  5162. */
  5163. function isPrototype(value) {
  5164. var Ctor = value && value.constructor,
  5165. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$8;
  5166. return value === proto;
  5167. }
  5168. var _isPrototype = isPrototype;
  5169. /**
  5170. * Creates a unary function that invokes `func` with its argument transformed.
  5171. *
  5172. * @private
  5173. * @param {Function} func The function to wrap.
  5174. * @param {Function} transform The argument transform.
  5175. * @returns {Function} Returns the new function.
  5176. */
  5177. function overArg(func, transform) {
  5178. return function(arg) {
  5179. return func(transform(arg));
  5180. };
  5181. }
  5182. var _overArg = overArg;
  5183. /* Built-in method references for those with the same name as other `lodash` methods. */
  5184. var nativeKeys = _overArg(Object.keys, Object);
  5185. var _nativeKeys = nativeKeys;
  5186. /** Used for built-in method references. */
  5187. var objectProto$9 = Object.prototype;
  5188. /** Used to check objects for own properties. */
  5189. var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
  5190. /**
  5191. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  5192. *
  5193. * @private
  5194. * @param {Object} object The object to query.
  5195. * @returns {Array} Returns the array of property names.
  5196. */
  5197. function baseKeys(object) {
  5198. if (!_isPrototype(object)) {
  5199. return _nativeKeys(object);
  5200. }
  5201. var result = [];
  5202. for (var key in Object(object)) {
  5203. if (hasOwnProperty$8.call(object, key) && key != 'constructor') {
  5204. result.push(key);
  5205. }
  5206. }
  5207. return result;
  5208. }
  5209. var _baseKeys = baseKeys;
  5210. /**
  5211. * Checks if `value` is array-like. A value is considered array-like if it's
  5212. * not a function and has a `value.length` that's an integer greater than or
  5213. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  5214. *
  5215. * @static
  5216. * @memberOf _
  5217. * @since 4.0.0
  5218. * @category Lang
  5219. * @param {*} value The value to check.
  5220. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  5221. * @example
  5222. *
  5223. * _.isArrayLike([1, 2, 3]);
  5224. * // => true
  5225. *
  5226. * _.isArrayLike(document.body.children);
  5227. * // => true
  5228. *
  5229. * _.isArrayLike('abc');
  5230. * // => true
  5231. *
  5232. * _.isArrayLike(_.noop);
  5233. * // => false
  5234. */
  5235. function isArrayLike(value) {
  5236. return value != null && isLength_1(value.length) && !isFunction_1(value);
  5237. }
  5238. var isArrayLike_1 = isArrayLike;
  5239. /**
  5240. * Creates an array of the own enumerable property names of `object`.
  5241. *
  5242. * **Note:** Non-object values are coerced to objects. See the
  5243. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  5244. * for more details.
  5245. *
  5246. * @static
  5247. * @since 0.1.0
  5248. * @memberOf _
  5249. * @category Object
  5250. * @param {Object} object The object to query.
  5251. * @returns {Array} Returns the array of property names.
  5252. * @example
  5253. *
  5254. * function Foo() {
  5255. * this.a = 1;
  5256. * this.b = 2;
  5257. * }
  5258. *
  5259. * Foo.prototype.c = 3;
  5260. *
  5261. * _.keys(new Foo);
  5262. * // => ['a', 'b'] (iteration order is not guaranteed)
  5263. *
  5264. * _.keys('hi');
  5265. * // => ['0', '1']
  5266. */
  5267. function keys(object) {
  5268. return isArrayLike_1(object) ? _arrayLikeKeys(object) : _baseKeys(object);
  5269. }
  5270. var keys_1 = keys;
  5271. /**
  5272. * The base implementation of `_.assign` without support for multiple sources
  5273. * or `customizer` functions.
  5274. *
  5275. * @private
  5276. * @param {Object} object The destination object.
  5277. * @param {Object} source The source object.
  5278. * @returns {Object} Returns `object`.
  5279. */
  5280. function baseAssign(object, source) {
  5281. return object && _copyObject(source, keys_1(source), object);
  5282. }
  5283. var _baseAssign = baseAssign;
  5284. /**
  5285. * This function is like
  5286. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  5287. * except that it includes inherited enumerable properties.
  5288. *
  5289. * @private
  5290. * @param {Object} object The object to query.
  5291. * @returns {Array} Returns the array of property names.
  5292. */
  5293. function nativeKeysIn(object) {
  5294. var result = [];
  5295. if (object != null) {
  5296. for (var key in Object(object)) {
  5297. result.push(key);
  5298. }
  5299. }
  5300. return result;
  5301. }
  5302. var _nativeKeysIn = nativeKeysIn;
  5303. /** Used for built-in method references. */
  5304. var objectProto$10 = Object.prototype;
  5305. /** Used to check objects for own properties. */
  5306. var hasOwnProperty$9 = objectProto$10.hasOwnProperty;
  5307. /**
  5308. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  5309. *
  5310. * @private
  5311. * @param {Object} object The object to query.
  5312. * @returns {Array} Returns the array of property names.
  5313. */
  5314. function baseKeysIn(object) {
  5315. if (!isObject_1(object)) {
  5316. return _nativeKeysIn(object);
  5317. }
  5318. var isProto = _isPrototype(object),
  5319. result = [];
  5320. for (var key in object) {
  5321. if (!(key == 'constructor' && (isProto || !hasOwnProperty$9.call(object, key)))) {
  5322. result.push(key);
  5323. }
  5324. }
  5325. return result;
  5326. }
  5327. var _baseKeysIn = baseKeysIn;
  5328. /**
  5329. * Creates an array of the own and inherited enumerable property names of `object`.
  5330. *
  5331. * **Note:** Non-object values are coerced to objects.
  5332. *
  5333. * @static
  5334. * @memberOf _
  5335. * @since 3.0.0
  5336. * @category Object
  5337. * @param {Object} object The object to query.
  5338. * @returns {Array} Returns the array of property names.
  5339. * @example
  5340. *
  5341. * function Foo() {
  5342. * this.a = 1;
  5343. * this.b = 2;
  5344. * }
  5345. *
  5346. * Foo.prototype.c = 3;
  5347. *
  5348. * _.keysIn(new Foo);
  5349. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  5350. */
  5351. function keysIn$1(object) {
  5352. return isArrayLike_1(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object);
  5353. }
  5354. var keysIn_1 = keysIn$1;
  5355. /**
  5356. * The base implementation of `_.assignIn` without support for multiple sources
  5357. * or `customizer` functions.
  5358. *
  5359. * @private
  5360. * @param {Object} object The destination object.
  5361. * @param {Object} source The source object.
  5362. * @returns {Object} Returns `object`.
  5363. */
  5364. function baseAssignIn(object, source) {
  5365. return object && _copyObject(source, keysIn_1(source), object);
  5366. }
  5367. var _baseAssignIn = baseAssignIn;
  5368. var _cloneBuffer = createCommonjsModule(function (module, exports) {
  5369. /** Detect free variable `exports`. */
  5370. var freeExports = 'object' == 'object' && exports && !exports.nodeType && exports;
  5371. /** Detect free variable `module`. */
  5372. var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
  5373. /** Detect the popular CommonJS extension `module.exports`. */
  5374. var moduleExports = freeModule && freeModule.exports === freeExports;
  5375. /** Built-in value references. */
  5376. var Buffer = moduleExports ? _root.Buffer : undefined,
  5377. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
  5378. /**
  5379. * Creates a clone of `buffer`.
  5380. *
  5381. * @private
  5382. * @param {Buffer} buffer The buffer to clone.
  5383. * @param {boolean} [isDeep] Specify a deep clone.
  5384. * @returns {Buffer} Returns the cloned buffer.
  5385. */
  5386. function cloneBuffer(buffer, isDeep) {
  5387. if (isDeep) {
  5388. return buffer.slice();
  5389. }
  5390. var length = buffer.length,
  5391. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  5392. buffer.copy(result);
  5393. return result;
  5394. }
  5395. module.exports = cloneBuffer;
  5396. });
  5397. /**
  5398. * Copies the values of `source` to `array`.
  5399. *
  5400. * @private
  5401. * @param {Array} source The array to copy values from.
  5402. * @param {Array} [array=[]] The array to copy values to.
  5403. * @returns {Array} Returns `array`.
  5404. */
  5405. function copyArray(source, array) {
  5406. var index = -1,
  5407. length = source.length;
  5408. array || (array = Array(length));
  5409. while (++index < length) {
  5410. array[index] = source[index];
  5411. }
  5412. return array;
  5413. }
  5414. var _copyArray = copyArray;
  5415. /**
  5416. * A specialized version of `_.filter` for arrays without support for
  5417. * iteratee shorthands.
  5418. *
  5419. * @private
  5420. * @param {Array} [array] The array to iterate over.
  5421. * @param {Function} predicate The function invoked per iteration.
  5422. * @returns {Array} Returns the new filtered array.
  5423. */
  5424. function arrayFilter(array, predicate) {
  5425. var index = -1,
  5426. length = array == null ? 0 : array.length,
  5427. resIndex = 0,
  5428. result = [];
  5429. while (++index < length) {
  5430. var value = array[index];
  5431. if (predicate(value, index, array)) {
  5432. result[resIndex++] = value;
  5433. }
  5434. }
  5435. return result;
  5436. }
  5437. var _arrayFilter = arrayFilter;
  5438. /**
  5439. * This method returns a new empty array.
  5440. *
  5441. * @static
  5442. * @memberOf _
  5443. * @since 4.13.0
  5444. * @category Util
  5445. * @returns {Array} Returns the new empty array.
  5446. * @example
  5447. *
  5448. * var arrays = _.times(2, _.stubArray);
  5449. *
  5450. * console.log(arrays);
  5451. * // => [[], []]
  5452. *
  5453. * console.log(arrays[0] === arrays[1]);
  5454. * // => false
  5455. */
  5456. function stubArray() {
  5457. return [];
  5458. }
  5459. var stubArray_1 = stubArray;
  5460. /** Used for built-in method references. */
  5461. var objectProto$11 = Object.prototype;
  5462. /** Built-in value references. */
  5463. var propertyIsEnumerable$1 = objectProto$11.propertyIsEnumerable;
  5464. /* Built-in method references for those with the same name as other `lodash` methods. */
  5465. var nativeGetSymbols = Object.getOwnPropertySymbols;
  5466. /**
  5467. * Creates an array of the own enumerable symbols of `object`.
  5468. *
  5469. * @private
  5470. * @param {Object} object The object to query.
  5471. * @returns {Array} Returns the array of symbols.
  5472. */
  5473. var getSymbols = !nativeGetSymbols ? stubArray_1 : function(object) {
  5474. if (object == null) {
  5475. return [];
  5476. }
  5477. object = Object(object);
  5478. return _arrayFilter(nativeGetSymbols(object), function(symbol) {
  5479. return propertyIsEnumerable$1.call(object, symbol);
  5480. });
  5481. };
  5482. var _getSymbols = getSymbols;
  5483. /**
  5484. * Copies own symbols of `source` to `object`.
  5485. *
  5486. * @private
  5487. * @param {Object} source The object to copy symbols from.
  5488. * @param {Object} [object={}] The object to copy symbols to.
  5489. * @returns {Object} Returns `object`.
  5490. */
  5491. function copySymbols(source, object) {
  5492. return _copyObject(source, _getSymbols(source), object);
  5493. }
  5494. var _copySymbols = copySymbols;
  5495. /**
  5496. * Appends the elements of `values` to `array`.
  5497. *
  5498. * @private
  5499. * @param {Array} array The array to modify.
  5500. * @param {Array} values The values to append.
  5501. * @returns {Array} Returns `array`.
  5502. */
  5503. function arrayPush(array, values) {
  5504. var index = -1,
  5505. length = values.length,
  5506. offset = array.length;
  5507. while (++index < length) {
  5508. array[offset + index] = values[index];
  5509. }
  5510. return array;
  5511. }
  5512. var _arrayPush = arrayPush;
  5513. /** Built-in value references. */
  5514. var getPrototype = _overArg(Object.getPrototypeOf, Object);
  5515. var _getPrototype = getPrototype;
  5516. /* Built-in method references for those with the same name as other `lodash` methods. */
  5517. var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
  5518. /**
  5519. * Creates an array of the own and inherited enumerable symbols of `object`.
  5520. *
  5521. * @private
  5522. * @param {Object} object The object to query.
  5523. * @returns {Array} Returns the array of symbols.
  5524. */
  5525. var getSymbolsIn = !nativeGetSymbols$1 ? stubArray_1 : function(object) {
  5526. var result = [];
  5527. while (object) {
  5528. _arrayPush(result, _getSymbols(object));
  5529. object = _getPrototype(object);
  5530. }
  5531. return result;
  5532. };
  5533. var _getSymbolsIn = getSymbolsIn;
  5534. /**
  5535. * Copies own and inherited symbols of `source` to `object`.
  5536. *
  5537. * @private
  5538. * @param {Object} source The object to copy symbols from.
  5539. * @param {Object} [object={}] The object to copy symbols to.
  5540. * @returns {Object} Returns `object`.
  5541. */
  5542. function copySymbolsIn(source, object) {
  5543. return _copyObject(source, _getSymbolsIn(source), object);
  5544. }
  5545. var _copySymbolsIn = copySymbolsIn;
  5546. /**
  5547. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  5548. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  5549. * symbols of `object`.
  5550. *
  5551. * @private
  5552. * @param {Object} object The object to query.
  5553. * @param {Function} keysFunc The function to get the keys of `object`.
  5554. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  5555. * @returns {Array} Returns the array of property names and symbols.
  5556. */
  5557. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  5558. var result = keysFunc(object);
  5559. return isArray_1(object) ? result : _arrayPush(result, symbolsFunc(object));
  5560. }
  5561. var _baseGetAllKeys = baseGetAllKeys;
  5562. /**
  5563. * Creates an array of own enumerable property names and symbols of `object`.
  5564. *
  5565. * @private
  5566. * @param {Object} object The object to query.
  5567. * @returns {Array} Returns the array of property names and symbols.
  5568. */
  5569. function getAllKeys(object) {
  5570. return _baseGetAllKeys(object, keys_1, _getSymbols);
  5571. }
  5572. var _getAllKeys = getAllKeys;
  5573. /**
  5574. * Creates an array of own and inherited enumerable property names and
  5575. * symbols of `object`.
  5576. *
  5577. * @private
  5578. * @param {Object} object The object to query.
  5579. * @returns {Array} Returns the array of property names and symbols.
  5580. */
  5581. function getAllKeysIn(object) {
  5582. return _baseGetAllKeys(object, keysIn_1, _getSymbolsIn);
  5583. }
  5584. var _getAllKeysIn = getAllKeysIn;
  5585. /* Built-in method references that are verified to be native. */
  5586. var DataView = _getNative(_root, 'DataView');
  5587. var _DataView = DataView;
  5588. /* Built-in method references that are verified to be native. */
  5589. var Promise = _getNative(_root, 'Promise');
  5590. var _Promise = Promise;
  5591. /* Built-in method references that are verified to be native. */
  5592. var Set$1 = _getNative(_root, 'Set');
  5593. var _Set = Set$1;
  5594. /* Built-in method references that are verified to be native. */
  5595. var WeakMap = _getNative(_root, 'WeakMap');
  5596. var _WeakMap = WeakMap;
  5597. /** `Object#toString` result references. */
  5598. var mapTag$1 = '[object Map]',
  5599. objectTag$1 = '[object Object]',
  5600. promiseTag = '[object Promise]',
  5601. setTag$1 = '[object Set]',
  5602. weakMapTag$1 = '[object WeakMap]';
  5603. var dataViewTag$1 = '[object DataView]';
  5604. /** Used to detect maps, sets, and weakmaps. */
  5605. var dataViewCtorString = _toSource(_DataView),
  5606. mapCtorString = _toSource(_Map),
  5607. promiseCtorString = _toSource(_Promise),
  5608. setCtorString = _toSource(_Set),
  5609. weakMapCtorString = _toSource(_WeakMap);
  5610. /**
  5611. * Gets the `toStringTag` of `value`.
  5612. *
  5613. * @private
  5614. * @param {*} value The value to query.
  5615. * @returns {string} Returns the `toStringTag`.
  5616. */
  5617. var getTag = _baseGetTag;
  5618. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  5619. if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag$1) ||
  5620. (_Map && getTag(new _Map) != mapTag$1) ||
  5621. (_Promise && getTag(_Promise.resolve()) != promiseTag) ||
  5622. (_Set && getTag(new _Set) != setTag$1) ||
  5623. (_WeakMap && getTag(new _WeakMap) != weakMapTag$1)) {
  5624. getTag = function(value) {
  5625. var result = _baseGetTag(value),
  5626. Ctor = result == objectTag$1 ? value.constructor : undefined,
  5627. ctorString = Ctor ? _toSource(Ctor) : '';
  5628. if (ctorString) {
  5629. switch (ctorString) {
  5630. case dataViewCtorString: return dataViewTag$1;
  5631. case mapCtorString: return mapTag$1;
  5632. case promiseCtorString: return promiseTag;
  5633. case setCtorString: return setTag$1;
  5634. case weakMapCtorString: return weakMapTag$1;
  5635. }
  5636. }
  5637. return result;
  5638. };
  5639. }
  5640. var _getTag = getTag;
  5641. /** Used for built-in method references. */
  5642. var objectProto$12 = Object.prototype;
  5643. /** Used to check objects for own properties. */
  5644. var hasOwnProperty$10 = objectProto$12.hasOwnProperty;
  5645. /**
  5646. * Initializes an array clone.
  5647. *
  5648. * @private
  5649. * @param {Array} array The array to clone.
  5650. * @returns {Array} Returns the initialized clone.
  5651. */
  5652. function initCloneArray(array) {
  5653. var length = array.length,
  5654. result = array.constructor(length);
  5655. // Add properties assigned by `RegExp#exec`.
  5656. if (length && typeof array[0] == 'string' && hasOwnProperty$10.call(array, 'index')) {
  5657. result.index = array.index;
  5658. result.input = array.input;
  5659. }
  5660. return result;
  5661. }
  5662. var _initCloneArray = initCloneArray;
  5663. /** Built-in value references. */
  5664. var Uint8Array = _root.Uint8Array;
  5665. var _Uint8Array = Uint8Array;
  5666. /**
  5667. * Creates a clone of `arrayBuffer`.
  5668. *
  5669. * @private
  5670. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  5671. * @returns {ArrayBuffer} Returns the cloned array buffer.
  5672. */
  5673. function cloneArrayBuffer(arrayBuffer) {
  5674. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  5675. new _Uint8Array(result).set(new _Uint8Array(arrayBuffer));
  5676. return result;
  5677. }
  5678. var _cloneArrayBuffer = cloneArrayBuffer;
  5679. /**
  5680. * Creates a clone of `dataView`.
  5681. *
  5682. * @private
  5683. * @param {Object} dataView The data view to clone.
  5684. * @param {boolean} [isDeep] Specify a deep clone.
  5685. * @returns {Object} Returns the cloned data view.
  5686. */
  5687. function cloneDataView(dataView, isDeep) {
  5688. var buffer = isDeep ? _cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  5689. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  5690. }
  5691. var _cloneDataView = cloneDataView;
  5692. /**
  5693. * Adds the key-value `pair` to `map`.
  5694. *
  5695. * @private
  5696. * @param {Object} map The map to modify.
  5697. * @param {Array} pair The key-value pair to add.
  5698. * @returns {Object} Returns `map`.
  5699. */
  5700. function addMapEntry(map, pair) {
  5701. // Don't return `map.set` because it's not chainable in IE 11.
  5702. map.set(pair[0], pair[1]);
  5703. return map;
  5704. }
  5705. var _addMapEntry = addMapEntry;
  5706. /**
  5707. * A specialized version of `_.reduce` for arrays without support for
  5708. * iteratee shorthands.
  5709. *
  5710. * @private
  5711. * @param {Array} [array] The array to iterate over.
  5712. * @param {Function} iteratee The function invoked per iteration.
  5713. * @param {*} [accumulator] The initial value.
  5714. * @param {boolean} [initAccum] Specify using the first element of `array` as
  5715. * the initial value.
  5716. * @returns {*} Returns the accumulated value.
  5717. */
  5718. function arrayReduce(array, iteratee, accumulator, initAccum) {
  5719. var index = -1,
  5720. length = array == null ? 0 : array.length;
  5721. if (initAccum && length) {
  5722. accumulator = array[++index];
  5723. }
  5724. while (++index < length) {
  5725. accumulator = iteratee(accumulator, array[index], index, array);
  5726. }
  5727. return accumulator;
  5728. }
  5729. var _arrayReduce = arrayReduce;
  5730. /**
  5731. * Converts `map` to its key-value pairs.
  5732. *
  5733. * @private
  5734. * @param {Object} map The map to convert.
  5735. * @returns {Array} Returns the key-value pairs.
  5736. */
  5737. function mapToArray(map) {
  5738. var index = -1,
  5739. result = Array(map.size);
  5740. map.forEach(function(value, key) {
  5741. result[++index] = [key, value];
  5742. });
  5743. return result;
  5744. }
  5745. var _mapToArray = mapToArray;
  5746. /** Used to compose bitmasks for cloning. */
  5747. var CLONE_DEEP_FLAG = 1;
  5748. /**
  5749. * Creates a clone of `map`.
  5750. *
  5751. * @private
  5752. * @param {Object} map The map to clone.
  5753. * @param {Function} cloneFunc The function to clone values.
  5754. * @param {boolean} [isDeep] Specify a deep clone.
  5755. * @returns {Object} Returns the cloned map.
  5756. */
  5757. function cloneMap(map, isDeep, cloneFunc) {
  5758. var array = isDeep ? cloneFunc(_mapToArray(map), CLONE_DEEP_FLAG) : _mapToArray(map);
  5759. return _arrayReduce(array, _addMapEntry, new map.constructor);
  5760. }
  5761. var _cloneMap = cloneMap;
  5762. /** Used to match `RegExp` flags from their coerced string values. */
  5763. var reFlags = /\w*$/;
  5764. /**
  5765. * Creates a clone of `regexp`.
  5766. *
  5767. * @private
  5768. * @param {Object} regexp The regexp to clone.
  5769. * @returns {Object} Returns the cloned regexp.
  5770. */
  5771. function cloneRegExp(regexp) {
  5772. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  5773. result.lastIndex = regexp.lastIndex;
  5774. return result;
  5775. }
  5776. var _cloneRegExp = cloneRegExp;
  5777. /**
  5778. * Adds `value` to `set`.
  5779. *
  5780. * @private
  5781. * @param {Object} set The set to modify.
  5782. * @param {*} value The value to add.
  5783. * @returns {Object} Returns `set`.
  5784. */
  5785. function addSetEntry(set, value) {
  5786. // Don't return `set.add` because it's not chainable in IE 11.
  5787. set.add(value);
  5788. return set;
  5789. }
  5790. var _addSetEntry = addSetEntry;
  5791. /**
  5792. * Converts `set` to an array of its values.
  5793. *
  5794. * @private
  5795. * @param {Object} set The set to convert.
  5796. * @returns {Array} Returns the values.
  5797. */
  5798. function setToArray(set) {
  5799. var index = -1,
  5800. result = Array(set.size);
  5801. set.forEach(function(value) {
  5802. result[++index] = value;
  5803. });
  5804. return result;
  5805. }
  5806. var _setToArray = setToArray;
  5807. /** Used to compose bitmasks for cloning. */
  5808. var CLONE_DEEP_FLAG$1 = 1;
  5809. /**
  5810. * Creates a clone of `set`.
  5811. *
  5812. * @private
  5813. * @param {Object} set The set to clone.
  5814. * @param {Function} cloneFunc The function to clone values.
  5815. * @param {boolean} [isDeep] Specify a deep clone.
  5816. * @returns {Object} Returns the cloned set.
  5817. */
  5818. function cloneSet(set, isDeep, cloneFunc) {
  5819. var array = isDeep ? cloneFunc(_setToArray(set), CLONE_DEEP_FLAG$1) : _setToArray(set);
  5820. return _arrayReduce(array, _addSetEntry, new set.constructor);
  5821. }
  5822. var _cloneSet = cloneSet;
  5823. /** Used to convert symbols to primitives and strings. */
  5824. var symbolProto = _Symbol ? _Symbol.prototype : undefined,
  5825. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
  5826. /**
  5827. * Creates a clone of the `symbol` object.
  5828. *
  5829. * @private
  5830. * @param {Object} symbol The symbol object to clone.
  5831. * @returns {Object} Returns the cloned symbol object.
  5832. */
  5833. function cloneSymbol(symbol) {
  5834. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  5835. }
  5836. var _cloneSymbol = cloneSymbol;
  5837. /**
  5838. * Creates a clone of `typedArray`.
  5839. *
  5840. * @private
  5841. * @param {Object} typedArray The typed array to clone.
  5842. * @param {boolean} [isDeep] Specify a deep clone.
  5843. * @returns {Object} Returns the cloned typed array.
  5844. */
  5845. function cloneTypedArray(typedArray, isDeep) {
  5846. var buffer = isDeep ? _cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  5847. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  5848. }
  5849. var _cloneTypedArray = cloneTypedArray;
  5850. /** `Object#toString` result references. */
  5851. var boolTag$1 = '[object Boolean]',
  5852. dateTag$1 = '[object Date]',
  5853. mapTag$2 = '[object Map]',
  5854. numberTag$1 = '[object Number]',
  5855. regexpTag$1 = '[object RegExp]',
  5856. setTag$2 = '[object Set]',
  5857. stringTag$1 = '[object String]',
  5858. symbolTag = '[object Symbol]';
  5859. var arrayBufferTag$1 = '[object ArrayBuffer]',
  5860. dataViewTag$2 = '[object DataView]',
  5861. float32Tag$1 = '[object Float32Array]',
  5862. float64Tag$1 = '[object Float64Array]',
  5863. int8Tag$1 = '[object Int8Array]',
  5864. int16Tag$1 = '[object Int16Array]',
  5865. int32Tag$1 = '[object Int32Array]',
  5866. uint8Tag$1 = '[object Uint8Array]',
  5867. uint8ClampedTag$1 = '[object Uint8ClampedArray]',
  5868. uint16Tag$1 = '[object Uint16Array]',
  5869. uint32Tag$1 = '[object Uint32Array]';
  5870. /**
  5871. * Initializes an object clone based on its `toStringTag`.
  5872. *
  5873. * **Note:** This function only supports cloning values with tags of
  5874. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  5875. *
  5876. * @private
  5877. * @param {Object} object The object to clone.
  5878. * @param {string} tag The `toStringTag` of the object to clone.
  5879. * @param {Function} cloneFunc The function to clone values.
  5880. * @param {boolean} [isDeep] Specify a deep clone.
  5881. * @returns {Object} Returns the initialized clone.
  5882. */
  5883. function initCloneByTag(object, tag, cloneFunc, isDeep) {
  5884. var Ctor = object.constructor;
  5885. switch (tag) {
  5886. case arrayBufferTag$1:
  5887. return _cloneArrayBuffer(object);
  5888. case boolTag$1:
  5889. case dateTag$1:
  5890. return new Ctor(+object);
  5891. case dataViewTag$2:
  5892. return _cloneDataView(object, isDeep);
  5893. case float32Tag$1: case float64Tag$1:
  5894. case int8Tag$1: case int16Tag$1: case int32Tag$1:
  5895. case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
  5896. return _cloneTypedArray(object, isDeep);
  5897. case mapTag$2:
  5898. return _cloneMap(object, isDeep, cloneFunc);
  5899. case numberTag$1:
  5900. case stringTag$1:
  5901. return new Ctor(object);
  5902. case regexpTag$1:
  5903. return _cloneRegExp(object);
  5904. case setTag$2:
  5905. return _cloneSet(object, isDeep, cloneFunc);
  5906. case symbolTag:
  5907. return _cloneSymbol(object);
  5908. }
  5909. }
  5910. var _initCloneByTag = initCloneByTag;
  5911. /** Built-in value references. */
  5912. var objectCreate = Object.create;
  5913. /**
  5914. * The base implementation of `_.create` without support for assigning
  5915. * properties to the created object.
  5916. *
  5917. * @private
  5918. * @param {Object} proto The object to inherit from.
  5919. * @returns {Object} Returns the new object.
  5920. */
  5921. var baseCreate = (function() {
  5922. function object() {}
  5923. return function(proto) {
  5924. if (!isObject_1(proto)) {
  5925. return {};
  5926. }
  5927. if (objectCreate) {
  5928. return objectCreate(proto);
  5929. }
  5930. object.prototype = proto;
  5931. var result = new object;
  5932. object.prototype = undefined;
  5933. return result;
  5934. };
  5935. }());
  5936. var _baseCreate = baseCreate;
  5937. /**
  5938. * Initializes an object clone.
  5939. *
  5940. * @private
  5941. * @param {Object} object The object to clone.
  5942. * @returns {Object} Returns the initialized clone.
  5943. */
  5944. function initCloneObject(object) {
  5945. return (typeof object.constructor == 'function' && !_isPrototype(object))
  5946. ? _baseCreate(_getPrototype(object))
  5947. : {};
  5948. }
  5949. var _initCloneObject = initCloneObject;
  5950. /** Used to compose bitmasks for cloning. */
  5951. var CLONE_DEEP_FLAG$2 = 1,
  5952. CLONE_FLAT_FLAG = 2,
  5953. CLONE_SYMBOLS_FLAG = 4;
  5954. /** `Object#toString` result references. */
  5955. var argsTag$2 = '[object Arguments]',
  5956. arrayTag$1 = '[object Array]',
  5957. boolTag$2 = '[object Boolean]',
  5958. dateTag$2 = '[object Date]',
  5959. errorTag$1 = '[object Error]',
  5960. funcTag$2 = '[object Function]',
  5961. genTag$1 = '[object GeneratorFunction]',
  5962. mapTag$3 = '[object Map]',
  5963. numberTag$2 = '[object Number]',
  5964. objectTag$2 = '[object Object]',
  5965. regexpTag$2 = '[object RegExp]',
  5966. setTag$3 = '[object Set]',
  5967. stringTag$2 = '[object String]',
  5968. symbolTag$1 = '[object Symbol]',
  5969. weakMapTag$2 = '[object WeakMap]';
  5970. var arrayBufferTag$2 = '[object ArrayBuffer]',
  5971. dataViewTag$3 = '[object DataView]',
  5972. float32Tag$2 = '[object Float32Array]',
  5973. float64Tag$2 = '[object Float64Array]',
  5974. int8Tag$2 = '[object Int8Array]',
  5975. int16Tag$2 = '[object Int16Array]',
  5976. int32Tag$2 = '[object Int32Array]',
  5977. uint8Tag$2 = '[object Uint8Array]',
  5978. uint8ClampedTag$2 = '[object Uint8ClampedArray]',
  5979. uint16Tag$2 = '[object Uint16Array]',
  5980. uint32Tag$2 = '[object Uint32Array]';
  5981. /** Used to identify `toStringTag` values supported by `_.clone`. */
  5982. var cloneableTags = {};
  5983. cloneableTags[argsTag$2] = cloneableTags[arrayTag$1] =
  5984. cloneableTags[arrayBufferTag$2] = cloneableTags[dataViewTag$3] =
  5985. cloneableTags[boolTag$2] = cloneableTags[dateTag$2] =
  5986. cloneableTags[float32Tag$2] = cloneableTags[float64Tag$2] =
  5987. cloneableTags[int8Tag$2] = cloneableTags[int16Tag$2] =
  5988. cloneableTags[int32Tag$2] = cloneableTags[mapTag$3] =
  5989. cloneableTags[numberTag$2] = cloneableTags[objectTag$2] =
  5990. cloneableTags[regexpTag$2] = cloneableTags[setTag$3] =
  5991. cloneableTags[stringTag$2] = cloneableTags[symbolTag$1] =
  5992. cloneableTags[uint8Tag$2] = cloneableTags[uint8ClampedTag$2] =
  5993. cloneableTags[uint16Tag$2] = cloneableTags[uint32Tag$2] = true;
  5994. cloneableTags[errorTag$1] = cloneableTags[funcTag$2] =
  5995. cloneableTags[weakMapTag$2] = false;
  5996. /**
  5997. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  5998. * traversed objects.
  5999. *
  6000. * @private
  6001. * @param {*} value The value to clone.
  6002. * @param {boolean} bitmask The bitmask flags.
  6003. * 1 - Deep clone
  6004. * 2 - Flatten inherited properties
  6005. * 4 - Clone symbols
  6006. * @param {Function} [customizer] The function to customize cloning.
  6007. * @param {string} [key] The key of `value`.
  6008. * @param {Object} [object] The parent object of `value`.
  6009. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  6010. * @returns {*} Returns the cloned value.
  6011. */
  6012. function baseClone(value, bitmask, customizer, key, object, stack) {
  6013. var result,
  6014. isDeep = bitmask & CLONE_DEEP_FLAG$2,
  6015. isFlat = bitmask & CLONE_FLAT_FLAG,
  6016. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  6017. if (customizer) {
  6018. result = object ? customizer(value, key, object, stack) : customizer(value);
  6019. }
  6020. if (result !== undefined) {
  6021. return result;
  6022. }
  6023. if (!isObject_1(value)) {
  6024. return value;
  6025. }
  6026. var isArr = isArray_1(value);
  6027. if (isArr) {
  6028. result = _initCloneArray(value);
  6029. if (!isDeep) {
  6030. return _copyArray(value, result);
  6031. }
  6032. } else {
  6033. var tag = _getTag(value),
  6034. isFunc = tag == funcTag$2 || tag == genTag$1;
  6035. if (isBuffer_1(value)) {
  6036. return _cloneBuffer(value, isDeep);
  6037. }
  6038. if (tag == objectTag$2 || tag == argsTag$2 || (isFunc && !object)) {
  6039. result = (isFlat || isFunc) ? {} : _initCloneObject(value);
  6040. if (!isDeep) {
  6041. return isFlat
  6042. ? _copySymbolsIn(value, _baseAssignIn(result, value))
  6043. : _copySymbols(value, _baseAssign(result, value));
  6044. }
  6045. } else {
  6046. if (!cloneableTags[tag]) {
  6047. return object ? value : {};
  6048. }
  6049. result = _initCloneByTag(value, tag, baseClone, isDeep);
  6050. }
  6051. }
  6052. // Check for circular references and return its corresponding clone.
  6053. stack || (stack = new _Stack);
  6054. var stacked = stack.get(value);
  6055. if (stacked) {
  6056. return stacked;
  6057. }
  6058. stack.set(value, result);
  6059. var keysFunc = isFull
  6060. ? (isFlat ? _getAllKeysIn : _getAllKeys)
  6061. : (isFlat ? keysIn : keys_1);
  6062. var props = isArr ? undefined : keysFunc(value);
  6063. _arrayEach(props || value, function(subValue, key) {
  6064. if (props) {
  6065. key = subValue;
  6066. subValue = value[key];
  6067. }
  6068. // Recursively populate clone (susceptible to call stack limits).
  6069. _assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  6070. });
  6071. return result;
  6072. }
  6073. var _baseClone = baseClone;
  6074. /** Used to compose bitmasks for cloning. */
  6075. var CLONE_DEEP_FLAG$3 = 1,
  6076. CLONE_SYMBOLS_FLAG$1 = 4;
  6077. /**
  6078. * This method is like `_.clone` except that it recursively clones `value`.
  6079. *
  6080. * @static
  6081. * @memberOf _
  6082. * @since 1.0.0
  6083. * @category Lang
  6084. * @param {*} value The value to recursively clone.
  6085. * @returns {*} Returns the deep cloned value.
  6086. * @see _.clone
  6087. * @example
  6088. *
  6089. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  6090. *
  6091. * var deep = _.cloneDeep(objects);
  6092. * console.log(deep[0] === objects[0]);
  6093. * // => false
  6094. */
  6095. function cloneDeep(value) {
  6096. return _baseClone(value, CLONE_DEEP_FLAG$3 | CLONE_SYMBOLS_FLAG$1);
  6097. }
  6098. var cloneDeep_1 = cloneDeep;
  6099. //
  6100. function createLocalVue(_Vue) {
  6101. if ( _Vue === void 0 ) _Vue = Vue;
  6102. var instance = _Vue.extend();
  6103. // clone global APIs
  6104. Object.keys(_Vue).forEach(function (key) {
  6105. if (!instance.hasOwnProperty(key)) {
  6106. var original = _Vue[key];
  6107. // cloneDeep can fail when cloning Vue instances
  6108. // cloneDeep checks that the instance has a Symbol
  6109. // which errors in Vue < 2.17 (https://github.com/vuejs/vue/pull/7878)
  6110. try {
  6111. instance[key] =
  6112. typeof original === 'object' ? cloneDeep_1(original) : original;
  6113. } catch (e) {
  6114. instance[key] = original;
  6115. }
  6116. }
  6117. });
  6118. // config is not enumerable
  6119. instance.config = cloneDeep_1(Vue.config);
  6120. instance.config.errorHandler = Vue.config.errorHandler;
  6121. // option merge strategies need to be exposed by reference
  6122. // so that merge strats registered by plugins can work properly
  6123. instance.config.optionMergeStrategies = Vue.config.optionMergeStrategies;
  6124. // make sure all extends are based on this instance.
  6125. // this is important so that global components registered by plugins,
  6126. // e.g. router-link are created using the correct base constructor
  6127. instance.options._base = instance;
  6128. // compat for vue-router < 2.7.1 where it does not allow multiple installs
  6129. if (instance._installedPlugins && instance._installedPlugins.length) {
  6130. instance._installedPlugins.length = 0;
  6131. }
  6132. var use = instance.use;
  6133. instance.use = function (plugin) {
  6134. var rest = [], len = arguments.length - 1;
  6135. while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];
  6136. if (plugin.installed === true) {
  6137. plugin.installed = false;
  6138. }
  6139. if (plugin.install && plugin.install.installed === true) {
  6140. plugin.install.installed = false;
  6141. }
  6142. use.call.apply(use, [ instance, plugin ].concat( rest ));
  6143. };
  6144. return instance
  6145. }
  6146. var semver$1 = createCommonjsModule(function (module, exports) {
  6147. exports = module.exports = SemVer;
  6148. // The debug function is excluded entirely from the minified version.
  6149. /* nomin */ var debug;
  6150. /* nomin */ if (typeof process === 'object' &&
  6151. /* nomin */ process.env &&
  6152. /* nomin */ process.env.NODE_DEBUG &&
  6153. /* nomin */ /\bsemver\b/i.test(process.env.NODE_DEBUG))
  6154. /* nomin */ { debug = function() {
  6155. /* nomin */ var args = Array.prototype.slice.call(arguments, 0);
  6156. /* nomin */ args.unshift('SEMVER');
  6157. /* nomin */ console.log.apply(console, args);
  6158. /* nomin */ }; }
  6159. /* nomin */ else
  6160. /* nomin */ { debug = function() {}; }
  6161. // Note: this is the semver.org version of the spec that it implements
  6162. // Not necessarily the package version of this code.
  6163. exports.SEMVER_SPEC_VERSION = '2.0.0';
  6164. var MAX_LENGTH = 256;
  6165. var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
  6166. // Max safe segment length for coercion.
  6167. var MAX_SAFE_COMPONENT_LENGTH = 16;
  6168. // The actual regexps go on exports.re
  6169. var re = exports.re = [];
  6170. var src = exports.src = [];
  6171. var R = 0;
  6172. // The following Regular Expressions can be used for tokenizing,
  6173. // validating, and parsing SemVer version strings.
  6174. // ## Numeric Identifier
  6175. // A single `0`, or a non-zero digit followed by zero or more digits.
  6176. var NUMERICIDENTIFIER = R++;
  6177. src[NUMERICIDENTIFIER] = '0|[1-9]\\d*';
  6178. var NUMERICIDENTIFIERLOOSE = R++;
  6179. src[NUMERICIDENTIFIERLOOSE] = '[0-9]+';
  6180. // ## Non-numeric Identifier
  6181. // Zero or more digits, followed by a letter or hyphen, and then zero or
  6182. // more letters, digits, or hyphens.
  6183. var NONNUMERICIDENTIFIER = R++;
  6184. src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*';
  6185. // ## Main Version
  6186. // Three dot-separated numeric identifiers.
  6187. var MAINVERSION = R++;
  6188. src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' +
  6189. '(' + src[NUMERICIDENTIFIER] + ')\\.' +
  6190. '(' + src[NUMERICIDENTIFIER] + ')';
  6191. var MAINVERSIONLOOSE = R++;
  6192. src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
  6193. '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
  6194. '(' + src[NUMERICIDENTIFIERLOOSE] + ')';
  6195. // ## Pre-release Version Identifier
  6196. // A numeric identifier, or a non-numeric identifier.
  6197. var PRERELEASEIDENTIFIER = R++;
  6198. src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] +
  6199. '|' + src[NONNUMERICIDENTIFIER] + ')';
  6200. var PRERELEASEIDENTIFIERLOOSE = R++;
  6201. src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] +
  6202. '|' + src[NONNUMERICIDENTIFIER] + ')';
  6203. // ## Pre-release Version
  6204. // Hyphen, followed by one or more dot-separated pre-release version
  6205. // identifiers.
  6206. var PRERELEASE = R++;
  6207. src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] +
  6208. '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))';
  6209. var PRERELEASELOOSE = R++;
  6210. src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] +
  6211. '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))';
  6212. // ## Build Metadata Identifier
  6213. // Any combination of digits, letters, or hyphens.
  6214. var BUILDIDENTIFIER = R++;
  6215. src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+';
  6216. // ## Build Metadata
  6217. // Plus sign, followed by one or more period-separated build metadata
  6218. // identifiers.
  6219. var BUILD = R++;
  6220. src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] +
  6221. '(?:\\.' + src[BUILDIDENTIFIER] + ')*))';
  6222. // ## Full Version String
  6223. // A main version, followed optionally by a pre-release version and
  6224. // build metadata.
  6225. // Note that the only major, minor, patch, and pre-release sections of
  6226. // the version string are capturing groups. The build metadata is not a
  6227. // capturing group, because it should not ever be used in version
  6228. // comparison.
  6229. var FULL = R++;
  6230. var FULLPLAIN = 'v?' + src[MAINVERSION] +
  6231. src[PRERELEASE] + '?' +
  6232. src[BUILD] + '?';
  6233. src[FULL] = '^' + FULLPLAIN + '$';
  6234. // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
  6235. // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
  6236. // common in the npm registry.
  6237. var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] +
  6238. src[PRERELEASELOOSE] + '?' +
  6239. src[BUILD] + '?';
  6240. var LOOSE = R++;
  6241. src[LOOSE] = '^' + LOOSEPLAIN + '$';
  6242. var GTLT = R++;
  6243. src[GTLT] = '((?:<|>)?=?)';
  6244. // Something like "2.*" or "1.2.x".
  6245. // Note that "x.x" is a valid xRange identifer, meaning "any version"
  6246. // Only the first item is strictly required.
  6247. var XRANGEIDENTIFIERLOOSE = R++;
  6248. src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
  6249. var XRANGEIDENTIFIER = R++;
  6250. src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*';
  6251. var XRANGEPLAIN = R++;
  6252. src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' +
  6253. '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
  6254. '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
  6255. '(?:' + src[PRERELEASE] + ')?' +
  6256. src[BUILD] + '?' +
  6257. ')?)?';
  6258. var XRANGEPLAINLOOSE = R++;
  6259. src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
  6260. '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
  6261. '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
  6262. '(?:' + src[PRERELEASELOOSE] + ')?' +
  6263. src[BUILD] + '?' +
  6264. ')?)?';
  6265. var XRANGE = R++;
  6266. src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$';
  6267. var XRANGELOOSE = R++;
  6268. src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$';
  6269. // Coercion.
  6270. // Extract anything that could conceivably be a part of a valid semver
  6271. var COERCE = R++;
  6272. src[COERCE] = '(?:^|[^\\d])' +
  6273. '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +
  6274. '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
  6275. '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
  6276. '(?:$|[^\\d])';
  6277. // Tilde ranges.
  6278. // Meaning is "reasonably at or greater than"
  6279. var LONETILDE = R++;
  6280. src[LONETILDE] = '(?:~>?)';
  6281. var TILDETRIM = R++;
  6282. src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+';
  6283. re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g');
  6284. var tildeTrimReplace = '$1~';
  6285. var TILDE = R++;
  6286. src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$';
  6287. var TILDELOOSE = R++;
  6288. src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$';
  6289. // Caret ranges.
  6290. // Meaning is "at least and backwards compatible with"
  6291. var LONECARET = R++;
  6292. src[LONECARET] = '(?:\\^)';
  6293. var CARETTRIM = R++;
  6294. src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+';
  6295. re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g');
  6296. var caretTrimReplace = '$1^';
  6297. var CARET = R++;
  6298. src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$';
  6299. var CARETLOOSE = R++;
  6300. src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$';
  6301. // A simple gt/lt/eq thing, or just "" to indicate "any version"
  6302. var COMPARATORLOOSE = R++;
  6303. src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$';
  6304. var COMPARATOR = R++;
  6305. src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$';
  6306. // An expression to strip any whitespace between the gtlt and the thing
  6307. // it modifies, so that `> 1.2.3` ==> `>1.2.3`
  6308. var COMPARATORTRIM = R++;
  6309. src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] +
  6310. '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')';
  6311. // this one has to use the /g flag
  6312. re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g');
  6313. var comparatorTrimReplace = '$1$2$3';
  6314. // Something like `1.2.3 - 1.2.4`
  6315. // Note that these all use the loose form, because they'll be
  6316. // checked against either the strict or loose comparator form
  6317. // later.
  6318. var HYPHENRANGE = R++;
  6319. src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' +
  6320. '\\s+-\\s+' +
  6321. '(' + src[XRANGEPLAIN] + ')' +
  6322. '\\s*$';
  6323. var HYPHENRANGELOOSE = R++;
  6324. src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' +
  6325. '\\s+-\\s+' +
  6326. '(' + src[XRANGEPLAINLOOSE] + ')' +
  6327. '\\s*$';
  6328. // Star ranges basically just allow anything at all.
  6329. var STAR = R++;
  6330. src[STAR] = '(<|>)?=?\\s*\\*';
  6331. // Compile to actual regexp objects.
  6332. // All are flag-free, unless they were created above with a flag.
  6333. for (var i = 0; i < R; i++) {
  6334. debug(i, src[i]);
  6335. if (!re[i])
  6336. { re[i] = new RegExp(src[i]); }
  6337. }
  6338. exports.parse = parse;
  6339. function parse(version, loose) {
  6340. if (version instanceof SemVer)
  6341. { return version; }
  6342. if (typeof version !== 'string')
  6343. { return null; }
  6344. if (version.length > MAX_LENGTH)
  6345. { return null; }
  6346. var r = loose ? re[LOOSE] : re[FULL];
  6347. if (!r.test(version))
  6348. { return null; }
  6349. try {
  6350. return new SemVer(version, loose);
  6351. } catch (er) {
  6352. return null;
  6353. }
  6354. }
  6355. exports.valid = valid;
  6356. function valid(version, loose) {
  6357. var v = parse(version, loose);
  6358. return v ? v.version : null;
  6359. }
  6360. exports.clean = clean;
  6361. function clean(version, loose) {
  6362. var s = parse(version.trim().replace(/^[=v]+/, ''), loose);
  6363. return s ? s.version : null;
  6364. }
  6365. exports.SemVer = SemVer;
  6366. function SemVer(version, loose) {
  6367. if (version instanceof SemVer) {
  6368. if (version.loose === loose)
  6369. { return version; }
  6370. else
  6371. { version = version.version; }
  6372. } else if (typeof version !== 'string') {
  6373. throw new TypeError('Invalid Version: ' + version);
  6374. }
  6375. if (version.length > MAX_LENGTH)
  6376. { throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') }
  6377. if (!(this instanceof SemVer))
  6378. { return new SemVer(version, loose); }
  6379. debug('SemVer', version, loose);
  6380. this.loose = loose;
  6381. var m = version.trim().match(loose ? re[LOOSE] : re[FULL]);
  6382. if (!m)
  6383. { throw new TypeError('Invalid Version: ' + version); }
  6384. this.raw = version;
  6385. // these are actually numbers
  6386. this.major = +m[1];
  6387. this.minor = +m[2];
  6388. this.patch = +m[3];
  6389. if (this.major > MAX_SAFE_INTEGER || this.major < 0)
  6390. { throw new TypeError('Invalid major version') }
  6391. if (this.minor > MAX_SAFE_INTEGER || this.minor < 0)
  6392. { throw new TypeError('Invalid minor version') }
  6393. if (this.patch > MAX_SAFE_INTEGER || this.patch < 0)
  6394. { throw new TypeError('Invalid patch version') }
  6395. // numberify any prerelease numeric ids
  6396. if (!m[4])
  6397. { this.prerelease = []; }
  6398. else
  6399. { this.prerelease = m[4].split('.').map(function(id) {
  6400. if (/^[0-9]+$/.test(id)) {
  6401. var num = +id;
  6402. if (num >= 0 && num < MAX_SAFE_INTEGER)
  6403. { return num; }
  6404. }
  6405. return id;
  6406. }); }
  6407. this.build = m[5] ? m[5].split('.') : [];
  6408. this.format();
  6409. }
  6410. SemVer.prototype.format = function() {
  6411. this.version = this.major + '.' + this.minor + '.' + this.patch;
  6412. if (this.prerelease.length)
  6413. { this.version += '-' + this.prerelease.join('.'); }
  6414. return this.version;
  6415. };
  6416. SemVer.prototype.toString = function() {
  6417. return this.version;
  6418. };
  6419. SemVer.prototype.compare = function(other) {
  6420. debug('SemVer.compare', this.version, this.loose, other);
  6421. if (!(other instanceof SemVer))
  6422. { other = new SemVer(other, this.loose); }
  6423. return this.compareMain(other) || this.comparePre(other);
  6424. };
  6425. SemVer.prototype.compareMain = function(other) {
  6426. if (!(other instanceof SemVer))
  6427. { other = new SemVer(other, this.loose); }
  6428. return compareIdentifiers(this.major, other.major) ||
  6429. compareIdentifiers(this.minor, other.minor) ||
  6430. compareIdentifiers(this.patch, other.patch);
  6431. };
  6432. SemVer.prototype.comparePre = function(other) {
  6433. var this$1 = this;
  6434. if (!(other instanceof SemVer))
  6435. { other = new SemVer(other, this.loose); }
  6436. // NOT having a prerelease is > having one
  6437. if (this.prerelease.length && !other.prerelease.length)
  6438. { return -1; }
  6439. else if (!this.prerelease.length && other.prerelease.length)
  6440. { return 1; }
  6441. else if (!this.prerelease.length && !other.prerelease.length)
  6442. { return 0; }
  6443. var i = 0;
  6444. do {
  6445. var a = this$1.prerelease[i];
  6446. var b = other.prerelease[i];
  6447. debug('prerelease compare', i, a, b);
  6448. if (a === undefined && b === undefined)
  6449. { return 0; }
  6450. else if (b === undefined)
  6451. { return 1; }
  6452. else if (a === undefined)
  6453. { return -1; }
  6454. else if (a === b)
  6455. { continue; }
  6456. else
  6457. { return compareIdentifiers(a, b); }
  6458. } while (++i);
  6459. };
  6460. // preminor will bump the version up to the next minor release, and immediately
  6461. // down to pre-release. premajor and prepatch work the same way.
  6462. SemVer.prototype.inc = function(release, identifier) {
  6463. var this$1 = this;
  6464. switch (release) {
  6465. case 'premajor':
  6466. this.prerelease.length = 0;
  6467. this.patch = 0;
  6468. this.minor = 0;
  6469. this.major++;
  6470. this.inc('pre', identifier);
  6471. break;
  6472. case 'preminor':
  6473. this.prerelease.length = 0;
  6474. this.patch = 0;
  6475. this.minor++;
  6476. this.inc('pre', identifier);
  6477. break;
  6478. case 'prepatch':
  6479. // If this is already a prerelease, it will bump to the next version
  6480. // drop any prereleases that might already exist, since they are not
  6481. // relevant at this point.
  6482. this.prerelease.length = 0;
  6483. this.inc('patch', identifier);
  6484. this.inc('pre', identifier);
  6485. break;
  6486. // If the input is a non-prerelease version, this acts the same as
  6487. // prepatch.
  6488. case 'prerelease':
  6489. if (this.prerelease.length === 0)
  6490. { this.inc('patch', identifier); }
  6491. this.inc('pre', identifier);
  6492. break;
  6493. case 'major':
  6494. // If this is a pre-major version, bump up to the same major version.
  6495. // Otherwise increment major.
  6496. // 1.0.0-5 bumps to 1.0.0
  6497. // 1.1.0 bumps to 2.0.0
  6498. if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0)
  6499. { this.major++; }
  6500. this.minor = 0;
  6501. this.patch = 0;
  6502. this.prerelease = [];
  6503. break;
  6504. case 'minor':
  6505. // If this is a pre-minor version, bump up to the same minor version.
  6506. // Otherwise increment minor.
  6507. // 1.2.0-5 bumps to 1.2.0
  6508. // 1.2.1 bumps to 1.3.0
  6509. if (this.patch !== 0 || this.prerelease.length === 0)
  6510. { this.minor++; }
  6511. this.patch = 0;
  6512. this.prerelease = [];
  6513. break;
  6514. case 'patch':
  6515. // If this is not a pre-release version, it will increment the patch.
  6516. // If it is a pre-release it will bump up to the same patch version.
  6517. // 1.2.0-5 patches to 1.2.0
  6518. // 1.2.0 patches to 1.2.1
  6519. if (this.prerelease.length === 0)
  6520. { this.patch++; }
  6521. this.prerelease = [];
  6522. break;
  6523. // This probably shouldn't be used publicly.
  6524. // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
  6525. case 'pre':
  6526. if (this.prerelease.length === 0)
  6527. { this.prerelease = [0]; }
  6528. else {
  6529. var i = this.prerelease.length;
  6530. while (--i >= 0) {
  6531. if (typeof this$1.prerelease[i] === 'number') {
  6532. this$1.prerelease[i]++;
  6533. i = -2;
  6534. }
  6535. }
  6536. if (i === -1) // didn't increment anything
  6537. { this.prerelease.push(0); }
  6538. }
  6539. if (identifier) {
  6540. // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
  6541. // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
  6542. if (this.prerelease[0] === identifier) {
  6543. if (isNaN(this.prerelease[1]))
  6544. { this.prerelease = [identifier, 0]; }
  6545. } else
  6546. { this.prerelease = [identifier, 0]; }
  6547. }
  6548. break;
  6549. default:
  6550. throw new Error('invalid increment argument: ' + release);
  6551. }
  6552. this.format();
  6553. this.raw = this.version;
  6554. return this;
  6555. };
  6556. exports.inc = inc;
  6557. function inc(version, release, loose, identifier) {
  6558. if (typeof(loose) === 'string') {
  6559. identifier = loose;
  6560. loose = undefined;
  6561. }
  6562. try {
  6563. return new SemVer(version, loose).inc(release, identifier).version;
  6564. } catch (er) {
  6565. return null;
  6566. }
  6567. }
  6568. exports.diff = diff;
  6569. function diff(version1, version2) {
  6570. if (eq(version1, version2)) {
  6571. return null;
  6572. } else {
  6573. var v1 = parse(version1);
  6574. var v2 = parse(version2);
  6575. if (v1.prerelease.length || v2.prerelease.length) {
  6576. for (var key in v1) {
  6577. if (key === 'major' || key === 'minor' || key === 'patch') {
  6578. if (v1[key] !== v2[key]) {
  6579. return 'pre'+key;
  6580. }
  6581. }
  6582. }
  6583. return 'prerelease';
  6584. }
  6585. for (var key in v1) {
  6586. if (key === 'major' || key === 'minor' || key === 'patch') {
  6587. if (v1[key] !== v2[key]) {
  6588. return key;
  6589. }
  6590. }
  6591. }
  6592. }
  6593. }
  6594. exports.compareIdentifiers = compareIdentifiers;
  6595. var numeric = /^[0-9]+$/;
  6596. function compareIdentifiers(a, b) {
  6597. var anum = numeric.test(a);
  6598. var bnum = numeric.test(b);
  6599. if (anum && bnum) {
  6600. a = +a;
  6601. b = +b;
  6602. }
  6603. return (anum && !bnum) ? -1 :
  6604. (bnum && !anum) ? 1 :
  6605. a < b ? -1 :
  6606. a > b ? 1 :
  6607. 0;
  6608. }
  6609. exports.rcompareIdentifiers = rcompareIdentifiers;
  6610. function rcompareIdentifiers(a, b) {
  6611. return compareIdentifiers(b, a);
  6612. }
  6613. exports.major = major;
  6614. function major(a, loose) {
  6615. return new SemVer(a, loose).major;
  6616. }
  6617. exports.minor = minor;
  6618. function minor(a, loose) {
  6619. return new SemVer(a, loose).minor;
  6620. }
  6621. exports.patch = patch;
  6622. function patch(a, loose) {
  6623. return new SemVer(a, loose).patch;
  6624. }
  6625. exports.compare = compare;
  6626. function compare(a, b, loose) {
  6627. return new SemVer(a, loose).compare(new SemVer(b, loose));
  6628. }
  6629. exports.compareLoose = compareLoose;
  6630. function compareLoose(a, b) {
  6631. return compare(a, b, true);
  6632. }
  6633. exports.rcompare = rcompare;
  6634. function rcompare(a, b, loose) {
  6635. return compare(b, a, loose);
  6636. }
  6637. exports.sort = sort;
  6638. function sort(list, loose) {
  6639. return list.sort(function(a, b) {
  6640. return exports.compare(a, b, loose);
  6641. });
  6642. }
  6643. exports.rsort = rsort;
  6644. function rsort(list, loose) {
  6645. return list.sort(function(a, b) {
  6646. return exports.rcompare(a, b, loose);
  6647. });
  6648. }
  6649. exports.gt = gt;
  6650. function gt(a, b, loose) {
  6651. return compare(a, b, loose) > 0;
  6652. }
  6653. exports.lt = lt;
  6654. function lt(a, b, loose) {
  6655. return compare(a, b, loose) < 0;
  6656. }
  6657. exports.eq = eq;
  6658. function eq(a, b, loose) {
  6659. return compare(a, b, loose) === 0;
  6660. }
  6661. exports.neq = neq;
  6662. function neq(a, b, loose) {
  6663. return compare(a, b, loose) !== 0;
  6664. }
  6665. exports.gte = gte;
  6666. function gte(a, b, loose) {
  6667. return compare(a, b, loose) >= 0;
  6668. }
  6669. exports.lte = lte;
  6670. function lte(a, b, loose) {
  6671. return compare(a, b, loose) <= 0;
  6672. }
  6673. exports.cmp = cmp;
  6674. function cmp(a, op, b, loose) {
  6675. var ret;
  6676. switch (op) {
  6677. case '===':
  6678. if (typeof a === 'object') { a = a.version; }
  6679. if (typeof b === 'object') { b = b.version; }
  6680. ret = a === b;
  6681. break;
  6682. case '!==':
  6683. if (typeof a === 'object') { a = a.version; }
  6684. if (typeof b === 'object') { b = b.version; }
  6685. ret = a !== b;
  6686. break;
  6687. case '': case '=': case '==': ret = eq(a, b, loose); break;
  6688. case '!=': ret = neq(a, b, loose); break;
  6689. case '>': ret = gt(a, b, loose); break;
  6690. case '>=': ret = gte(a, b, loose); break;
  6691. case '<': ret = lt(a, b, loose); break;
  6692. case '<=': ret = lte(a, b, loose); break;
  6693. default: throw new TypeError('Invalid operator: ' + op);
  6694. }
  6695. return ret;
  6696. }
  6697. exports.Comparator = Comparator;
  6698. function Comparator(comp, loose) {
  6699. if (comp instanceof Comparator) {
  6700. if (comp.loose === loose)
  6701. { return comp; }
  6702. else
  6703. { comp = comp.value; }
  6704. }
  6705. if (!(this instanceof Comparator))
  6706. { return new Comparator(comp, loose); }
  6707. debug('comparator', comp, loose);
  6708. this.loose = loose;
  6709. this.parse(comp);
  6710. if (this.semver === ANY)
  6711. { this.value = ''; }
  6712. else
  6713. { this.value = this.operator + this.semver.version; }
  6714. debug('comp', this);
  6715. }
  6716. var ANY = {};
  6717. Comparator.prototype.parse = function(comp) {
  6718. var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
  6719. var m = comp.match(r);
  6720. if (!m)
  6721. { throw new TypeError('Invalid comparator: ' + comp); }
  6722. this.operator = m[1];
  6723. if (this.operator === '=')
  6724. { this.operator = ''; }
  6725. // if it literally is just '>' or '' then allow anything.
  6726. if (!m[2])
  6727. { this.semver = ANY; }
  6728. else
  6729. { this.semver = new SemVer(m[2], this.loose); }
  6730. };
  6731. Comparator.prototype.toString = function() {
  6732. return this.value;
  6733. };
  6734. Comparator.prototype.test = function(version) {
  6735. debug('Comparator.test', version, this.loose);
  6736. if (this.semver === ANY)
  6737. { return true; }
  6738. if (typeof version === 'string')
  6739. { version = new SemVer(version, this.loose); }
  6740. return cmp(version, this.operator, this.semver, this.loose);
  6741. };
  6742. Comparator.prototype.intersects = function(comp, loose) {
  6743. if (!(comp instanceof Comparator)) {
  6744. throw new TypeError('a Comparator is required');
  6745. }
  6746. var rangeTmp;
  6747. if (this.operator === '') {
  6748. rangeTmp = new Range(comp.value, loose);
  6749. return satisfies(this.value, rangeTmp, loose);
  6750. } else if (comp.operator === '') {
  6751. rangeTmp = new Range(this.value, loose);
  6752. return satisfies(comp.semver, rangeTmp, loose);
  6753. }
  6754. var sameDirectionIncreasing =
  6755. (this.operator === '>=' || this.operator === '>') &&
  6756. (comp.operator === '>=' || comp.operator === '>');
  6757. var sameDirectionDecreasing =
  6758. (this.operator === '<=' || this.operator === '<') &&
  6759. (comp.operator === '<=' || comp.operator === '<');
  6760. var sameSemVer = this.semver.version === comp.semver.version;
  6761. var differentDirectionsInclusive =
  6762. (this.operator === '>=' || this.operator === '<=') &&
  6763. (comp.operator === '>=' || comp.operator === '<=');
  6764. var oppositeDirectionsLessThan =
  6765. cmp(this.semver, '<', comp.semver, loose) &&
  6766. ((this.operator === '>=' || this.operator === '>') &&
  6767. (comp.operator === '<=' || comp.operator === '<'));
  6768. var oppositeDirectionsGreaterThan =
  6769. cmp(this.semver, '>', comp.semver, loose) &&
  6770. ((this.operator === '<=' || this.operator === '<') &&
  6771. (comp.operator === '>=' || comp.operator === '>'));
  6772. return sameDirectionIncreasing || sameDirectionDecreasing ||
  6773. (sameSemVer && differentDirectionsInclusive) ||
  6774. oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
  6775. };
  6776. exports.Range = Range;
  6777. function Range(range, loose) {
  6778. if (range instanceof Range) {
  6779. if (range.loose === loose) {
  6780. return range;
  6781. } else {
  6782. return new Range(range.raw, loose);
  6783. }
  6784. }
  6785. if (range instanceof Comparator) {
  6786. return new Range(range.value, loose);
  6787. }
  6788. if (!(this instanceof Range))
  6789. { return new Range(range, loose); }
  6790. this.loose = loose;
  6791. // First, split based on boolean or ||
  6792. this.raw = range;
  6793. this.set = range.split(/\s*\|\|\s*/).map(function(range) {
  6794. return this.parseRange(range.trim());
  6795. }, this).filter(function(c) {
  6796. // throw out any that are not relevant for whatever reason
  6797. return c.length;
  6798. });
  6799. if (!this.set.length) {
  6800. throw new TypeError('Invalid SemVer Range: ' + range);
  6801. }
  6802. this.format();
  6803. }
  6804. Range.prototype.format = function() {
  6805. this.range = this.set.map(function(comps) {
  6806. return comps.join(' ').trim();
  6807. }).join('||').trim();
  6808. return this.range;
  6809. };
  6810. Range.prototype.toString = function() {
  6811. return this.range;
  6812. };
  6813. Range.prototype.parseRange = function(range) {
  6814. var loose = this.loose;
  6815. range = range.trim();
  6816. debug('range', range, loose);
  6817. // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
  6818. var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE];
  6819. range = range.replace(hr, hyphenReplace);
  6820. debug('hyphen replace', range);
  6821. // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
  6822. range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace);
  6823. debug('comparator trim', range, re[COMPARATORTRIM]);
  6824. // `~ 1.2.3` => `~1.2.3`
  6825. range = range.replace(re[TILDETRIM], tildeTrimReplace);
  6826. // `^ 1.2.3` => `^1.2.3`
  6827. range = range.replace(re[CARETTRIM], caretTrimReplace);
  6828. // normalize spaces
  6829. range = range.split(/\s+/).join(' ');
  6830. // At this point, the range is completely trimmed and
  6831. // ready to be split into comparators.
  6832. var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
  6833. var set = range.split(' ').map(function(comp) {
  6834. return parseComparator(comp, loose);
  6835. }).join(' ').split(/\s+/);
  6836. if (this.loose) {
  6837. // in loose mode, throw out any that are not valid comparators
  6838. set = set.filter(function(comp) {
  6839. return !!comp.match(compRe);
  6840. });
  6841. }
  6842. set = set.map(function(comp) {
  6843. return new Comparator(comp, loose);
  6844. });
  6845. return set;
  6846. };
  6847. Range.prototype.intersects = function(range, loose) {
  6848. if (!(range instanceof Range)) {
  6849. throw new TypeError('a Range is required');
  6850. }
  6851. return this.set.some(function(thisComparators) {
  6852. return thisComparators.every(function(thisComparator) {
  6853. return range.set.some(function(rangeComparators) {
  6854. return rangeComparators.every(function(rangeComparator) {
  6855. return thisComparator.intersects(rangeComparator, loose);
  6856. });
  6857. });
  6858. });
  6859. });
  6860. };
  6861. // Mostly just for testing and legacy API reasons
  6862. exports.toComparators = toComparators;
  6863. function toComparators(range, loose) {
  6864. return new Range(range, loose).set.map(function(comp) {
  6865. return comp.map(function(c) {
  6866. return c.value;
  6867. }).join(' ').trim().split(' ');
  6868. });
  6869. }
  6870. // comprised of xranges, tildes, stars, and gtlt's at this point.
  6871. // already replaced the hyphen ranges
  6872. // turn into a set of JUST comparators.
  6873. function parseComparator(comp, loose) {
  6874. debug('comp', comp);
  6875. comp = replaceCarets(comp, loose);
  6876. debug('caret', comp);
  6877. comp = replaceTildes(comp, loose);
  6878. debug('tildes', comp);
  6879. comp = replaceXRanges(comp, loose);
  6880. debug('xrange', comp);
  6881. comp = replaceStars(comp, loose);
  6882. debug('stars', comp);
  6883. return comp;
  6884. }
  6885. function isX(id) {
  6886. return !id || id.toLowerCase() === 'x' || id === '*';
  6887. }
  6888. // ~, ~> --> * (any, kinda silly)
  6889. // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
  6890. // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
  6891. // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
  6892. // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
  6893. // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
  6894. function replaceTildes(comp, loose) {
  6895. return comp.trim().split(/\s+/).map(function(comp) {
  6896. return replaceTilde(comp, loose);
  6897. }).join(' ');
  6898. }
  6899. function replaceTilde(comp, loose) {
  6900. var r = loose ? re[TILDELOOSE] : re[TILDE];
  6901. return comp.replace(r, function(_, M, m, p, pr) {
  6902. debug('tilde', comp, _, M, m, p, pr);
  6903. var ret;
  6904. if (isX(M))
  6905. { ret = ''; }
  6906. else if (isX(m))
  6907. { ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; }
  6908. else if (isX(p))
  6909. // ~1.2 == >=1.2.0 <1.3.0
  6910. { ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; }
  6911. else if (pr) {
  6912. debug('replaceTilde pr', pr);
  6913. if (pr.charAt(0) !== '-')
  6914. { pr = '-' + pr; }
  6915. ret = '>=' + M + '.' + m + '.' + p + pr +
  6916. ' <' + M + '.' + (+m + 1) + '.0';
  6917. } else
  6918. // ~1.2.3 == >=1.2.3 <1.3.0
  6919. { ret = '>=' + M + '.' + m + '.' + p +
  6920. ' <' + M + '.' + (+m + 1) + '.0'; }
  6921. debug('tilde return', ret);
  6922. return ret;
  6923. });
  6924. }
  6925. // ^ --> * (any, kinda silly)
  6926. // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
  6927. // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
  6928. // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
  6929. // ^1.2.3 --> >=1.2.3 <2.0.0
  6930. // ^1.2.0 --> >=1.2.0 <2.0.0
  6931. function replaceCarets(comp, loose) {
  6932. return comp.trim().split(/\s+/).map(function(comp) {
  6933. return replaceCaret(comp, loose);
  6934. }).join(' ');
  6935. }
  6936. function replaceCaret(comp, loose) {
  6937. debug('caret', comp, loose);
  6938. var r = loose ? re[CARETLOOSE] : re[CARET];
  6939. return comp.replace(r, function(_, M, m, p, pr) {
  6940. debug('caret', comp, _, M, m, p, pr);
  6941. var ret;
  6942. if (isX(M))
  6943. { ret = ''; }
  6944. else if (isX(m))
  6945. { ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; }
  6946. else if (isX(p)) {
  6947. if (M === '0')
  6948. { ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; }
  6949. else
  6950. { ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; }
  6951. } else if (pr) {
  6952. debug('replaceCaret pr', pr);
  6953. if (pr.charAt(0) !== '-')
  6954. { pr = '-' + pr; }
  6955. if (M === '0') {
  6956. if (m === '0')
  6957. { ret = '>=' + M + '.' + m + '.' + p + pr +
  6958. ' <' + M + '.' + m + '.' + (+p + 1); }
  6959. else
  6960. { ret = '>=' + M + '.' + m + '.' + p + pr +
  6961. ' <' + M + '.' + (+m + 1) + '.0'; }
  6962. } else
  6963. { ret = '>=' + M + '.' + m + '.' + p + pr +
  6964. ' <' + (+M + 1) + '.0.0'; }
  6965. } else {
  6966. debug('no pr');
  6967. if (M === '0') {
  6968. if (m === '0')
  6969. { ret = '>=' + M + '.' + m + '.' + p +
  6970. ' <' + M + '.' + m + '.' + (+p + 1); }
  6971. else
  6972. { ret = '>=' + M + '.' + m + '.' + p +
  6973. ' <' + M + '.' + (+m + 1) + '.0'; }
  6974. } else
  6975. { ret = '>=' + M + '.' + m + '.' + p +
  6976. ' <' + (+M + 1) + '.0.0'; }
  6977. }
  6978. debug('caret return', ret);
  6979. return ret;
  6980. });
  6981. }
  6982. function replaceXRanges(comp, loose) {
  6983. debug('replaceXRanges', comp, loose);
  6984. return comp.split(/\s+/).map(function(comp) {
  6985. return replaceXRange(comp, loose);
  6986. }).join(' ');
  6987. }
  6988. function replaceXRange(comp, loose) {
  6989. comp = comp.trim();
  6990. var r = loose ? re[XRANGELOOSE] : re[XRANGE];
  6991. return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
  6992. debug('xRange', comp, ret, gtlt, M, m, p, pr);
  6993. var xM = isX(M);
  6994. var xm = xM || isX(m);
  6995. var xp = xm || isX(p);
  6996. var anyX = xp;
  6997. if (gtlt === '=' && anyX)
  6998. { gtlt = ''; }
  6999. if (xM) {
  7000. if (gtlt === '>' || gtlt === '<') {
  7001. // nothing is allowed
  7002. ret = '<0.0.0';
  7003. } else {
  7004. // nothing is forbidden
  7005. ret = '*';
  7006. }
  7007. } else if (gtlt && anyX) {
  7008. // replace X with 0
  7009. if (xm)
  7010. { m = 0; }
  7011. if (xp)
  7012. { p = 0; }
  7013. if (gtlt === '>') {
  7014. // >1 => >=2.0.0
  7015. // >1.2 => >=1.3.0
  7016. // >1.2.3 => >= 1.2.4
  7017. gtlt = '>=';
  7018. if (xm) {
  7019. M = +M + 1;
  7020. m = 0;
  7021. p = 0;
  7022. } else if (xp) {
  7023. m = +m + 1;
  7024. p = 0;
  7025. }
  7026. } else if (gtlt === '<=') {
  7027. // <=0.7.x is actually <0.8.0, since any 0.7.x should
  7028. // pass. Similarly, <=7.x is actually <8.0.0, etc.
  7029. gtlt = '<';
  7030. if (xm)
  7031. { M = +M + 1; }
  7032. else
  7033. { m = +m + 1; }
  7034. }
  7035. ret = gtlt + M + '.' + m + '.' + p;
  7036. } else if (xm) {
  7037. ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
  7038. } else if (xp) {
  7039. ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
  7040. }
  7041. debug('xRange return', ret);
  7042. return ret;
  7043. });
  7044. }
  7045. // Because * is AND-ed with everything else in the comparator,
  7046. // and '' means "any version", just remove the *s entirely.
  7047. function replaceStars(comp, loose) {
  7048. debug('replaceStars', comp, loose);
  7049. // Looseness is ignored here. star is always as loose as it gets!
  7050. return comp.trim().replace(re[STAR], '');
  7051. }
  7052. // This function is passed to string.replace(re[HYPHENRANGE])
  7053. // M, m, patch, prerelease, build
  7054. // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
  7055. // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
  7056. // 1.2 - 3.4 => >=1.2.0 <3.5.0
  7057. function hyphenReplace($0,
  7058. from, fM, fm, fp, fpr, fb,
  7059. to, tM, tm, tp, tpr, tb) {
  7060. if (isX(fM))
  7061. { from = ''; }
  7062. else if (isX(fm))
  7063. { from = '>=' + fM + '.0.0'; }
  7064. else if (isX(fp))
  7065. { from = '>=' + fM + '.' + fm + '.0'; }
  7066. else
  7067. { from = '>=' + from; }
  7068. if (isX(tM))
  7069. { to = ''; }
  7070. else if (isX(tm))
  7071. { to = '<' + (+tM + 1) + '.0.0'; }
  7072. else if (isX(tp))
  7073. { to = '<' + tM + '.' + (+tm + 1) + '.0'; }
  7074. else if (tpr)
  7075. { to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; }
  7076. else
  7077. { to = '<=' + to; }
  7078. return (from + ' ' + to).trim();
  7079. }
  7080. // if ANY of the sets match ALL of its comparators, then pass
  7081. Range.prototype.test = function(version) {
  7082. var this$1 = this;
  7083. if (!version)
  7084. { return false; }
  7085. if (typeof version === 'string')
  7086. { version = new SemVer(version, this.loose); }
  7087. for (var i = 0; i < this.set.length; i++) {
  7088. if (testSet(this$1.set[i], version))
  7089. { return true; }
  7090. }
  7091. return false;
  7092. };
  7093. function testSet(set, version) {
  7094. for (var i = 0; i < set.length; i++) {
  7095. if (!set[i].test(version))
  7096. { return false; }
  7097. }
  7098. if (version.prerelease.length) {
  7099. // Find the set of versions that are allowed to have prereleases
  7100. // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
  7101. // That should allow `1.2.3-pr.2` to pass.
  7102. // However, `1.2.4-alpha.notready` should NOT be allowed,
  7103. // even though it's within the range set by the comparators.
  7104. for (var i = 0; i < set.length; i++) {
  7105. debug(set[i].semver);
  7106. if (set[i].semver === ANY)
  7107. { continue; }
  7108. if (set[i].semver.prerelease.length > 0) {
  7109. var allowed = set[i].semver;
  7110. if (allowed.major === version.major &&
  7111. allowed.minor === version.minor &&
  7112. allowed.patch === version.patch)
  7113. { return true; }
  7114. }
  7115. }
  7116. // Version has a -pre, but it's not one of the ones we like.
  7117. return false;
  7118. }
  7119. return true;
  7120. }
  7121. exports.satisfies = satisfies;
  7122. function satisfies(version, range, loose) {
  7123. try {
  7124. range = new Range(range, loose);
  7125. } catch (er) {
  7126. return false;
  7127. }
  7128. return range.test(version);
  7129. }
  7130. exports.maxSatisfying = maxSatisfying;
  7131. function maxSatisfying(versions, range, loose) {
  7132. var max = null;
  7133. var maxSV = null;
  7134. try {
  7135. var rangeObj = new Range(range, loose);
  7136. } catch (er) {
  7137. return null;
  7138. }
  7139. versions.forEach(function (v) {
  7140. if (rangeObj.test(v)) { // satisfies(v, range, loose)
  7141. if (!max || maxSV.compare(v) === -1) { // compare(max, v, true)
  7142. max = v;
  7143. maxSV = new SemVer(max, loose);
  7144. }
  7145. }
  7146. });
  7147. return max;
  7148. }
  7149. exports.minSatisfying = minSatisfying;
  7150. function minSatisfying(versions, range, loose) {
  7151. var min = null;
  7152. var minSV = null;
  7153. try {
  7154. var rangeObj = new Range(range, loose);
  7155. } catch (er) {
  7156. return null;
  7157. }
  7158. versions.forEach(function (v) {
  7159. if (rangeObj.test(v)) { // satisfies(v, range, loose)
  7160. if (!min || minSV.compare(v) === 1) { // compare(min, v, true)
  7161. min = v;
  7162. minSV = new SemVer(min, loose);
  7163. }
  7164. }
  7165. });
  7166. return min;
  7167. }
  7168. exports.validRange = validRange;
  7169. function validRange(range, loose) {
  7170. try {
  7171. // Return '*' instead of '' so that truthiness works.
  7172. // This will throw if it's invalid anyway
  7173. return new Range(range, loose).range || '*';
  7174. } catch (er) {
  7175. return null;
  7176. }
  7177. }
  7178. // Determine if version is less than all the versions possible in the range
  7179. exports.ltr = ltr;
  7180. function ltr(version, range, loose) {
  7181. return outside(version, range, '<', loose);
  7182. }
  7183. // Determine if version is greater than all the versions possible in the range.
  7184. exports.gtr = gtr;
  7185. function gtr(version, range, loose) {
  7186. return outside(version, range, '>', loose);
  7187. }
  7188. exports.outside = outside;
  7189. function outside(version, range, hilo, loose) {
  7190. version = new SemVer(version, loose);
  7191. range = new Range(range, loose);
  7192. var gtfn, ltefn, ltfn, comp, ecomp;
  7193. switch (hilo) {
  7194. case '>':
  7195. gtfn = gt;
  7196. ltefn = lte;
  7197. ltfn = lt;
  7198. comp = '>';
  7199. ecomp = '>=';
  7200. break;
  7201. case '<':
  7202. gtfn = lt;
  7203. ltefn = gte;
  7204. ltfn = gt;
  7205. comp = '<';
  7206. ecomp = '<=';
  7207. break;
  7208. default:
  7209. throw new TypeError('Must provide a hilo val of "<" or ">"');
  7210. }
  7211. // If it satisifes the range it is not outside
  7212. if (satisfies(version, range, loose)) {
  7213. return false;
  7214. }
  7215. // From now on, variable terms are as if we're in "gtr" mode.
  7216. // but note that everything is flipped for the "ltr" function.
  7217. for (var i = 0; i < range.set.length; ++i) {
  7218. var comparators = range.set[i];
  7219. var high = null;
  7220. var low = null;
  7221. comparators.forEach(function(comparator) {
  7222. if (comparator.semver === ANY) {
  7223. comparator = new Comparator('>=0.0.0');
  7224. }
  7225. high = high || comparator;
  7226. low = low || comparator;
  7227. if (gtfn(comparator.semver, high.semver, loose)) {
  7228. high = comparator;
  7229. } else if (ltfn(comparator.semver, low.semver, loose)) {
  7230. low = comparator;
  7231. }
  7232. });
  7233. // If the edge version comparator has a operator then our version
  7234. // isn't outside it
  7235. if (high.operator === comp || high.operator === ecomp) {
  7236. return false;
  7237. }
  7238. // If the lowest version comparator has an operator and our version
  7239. // is less than it then it isn't higher than the range
  7240. if ((!low.operator || low.operator === comp) &&
  7241. ltefn(version, low.semver)) {
  7242. return false;
  7243. } else if (low.operator === ecomp && ltfn(version, low.semver)) {
  7244. return false;
  7245. }
  7246. }
  7247. return true;
  7248. }
  7249. exports.prerelease = prerelease;
  7250. function prerelease(version, loose) {
  7251. var parsed = parse(version, loose);
  7252. return (parsed && parsed.prerelease.length) ? parsed.prerelease : null;
  7253. }
  7254. exports.intersects = intersects;
  7255. function intersects(r1, r2, loose) {
  7256. r1 = new Range(r1, loose);
  7257. r2 = new Range(r2, loose);
  7258. return r1.intersects(r2)
  7259. }
  7260. exports.coerce = coerce;
  7261. function coerce(version) {
  7262. if (version instanceof SemVer)
  7263. { return version; }
  7264. if (typeof version !== 'string')
  7265. { return null; }
  7266. var match = version.match(re[COERCE]);
  7267. if (match == null)
  7268. { return null; }
  7269. return parse((match[1] || '0') + '.' + (match[2] || '0') + '.' + (match[3] || '0'));
  7270. }
  7271. });
  7272. var semver_1$1 = semver$1.SEMVER_SPEC_VERSION;
  7273. var semver_2$1 = semver$1.re;
  7274. var semver_3$1 = semver$1.src;
  7275. var semver_4$1 = semver$1.parse;
  7276. var semver_5$1 = semver$1.valid;
  7277. var semver_6$1 = semver$1.clean;
  7278. var semver_7$1 = semver$1.SemVer;
  7279. var semver_8$1 = semver$1.inc;
  7280. var semver_9$1 = semver$1.diff;
  7281. var semver_10$1 = semver$1.compareIdentifiers;
  7282. var semver_11$1 = semver$1.rcompareIdentifiers;
  7283. var semver_12$1 = semver$1.major;
  7284. var semver_13$1 = semver$1.minor;
  7285. var semver_14$1 = semver$1.patch;
  7286. var semver_15$1 = semver$1.compare;
  7287. var semver_16$1 = semver$1.compareLoose;
  7288. var semver_17$1 = semver$1.rcompare;
  7289. var semver_18$1 = semver$1.sort;
  7290. var semver_19$1 = semver$1.rsort;
  7291. var semver_20$1 = semver$1.gt;
  7292. var semver_21$1 = semver$1.lt;
  7293. var semver_22$1 = semver$1.eq;
  7294. var semver_23$1 = semver$1.neq;
  7295. var semver_24$1 = semver$1.gte;
  7296. var semver_25$1 = semver$1.lte;
  7297. var semver_26$1 = semver$1.cmp;
  7298. var semver_27$1 = semver$1.Comparator;
  7299. var semver_28$1 = semver$1.Range;
  7300. var semver_29$1 = semver$1.toComparators;
  7301. var semver_30$1 = semver$1.satisfies;
  7302. var semver_31$1 = semver$1.maxSatisfying;
  7303. var semver_32$1 = semver$1.minSatisfying;
  7304. var semver_33$1 = semver$1.validRange;
  7305. var semver_34$1 = semver$1.ltr;
  7306. var semver_35$1 = semver$1.gtr;
  7307. var semver_36$1 = semver$1.outside;
  7308. var semver_37$1 = semver$1.prerelease;
  7309. var semver_38$1 = semver$1.intersects;
  7310. var semver_39$1 = semver$1.coerce;
  7311. //
  7312. function isValidSlot(slot) {
  7313. return isVueComponent(slot) || typeof slot === 'string'
  7314. }
  7315. function requiresTemplateCompiler(slot) {
  7316. if (typeof slot === 'string' && !vueTemplateCompiler.compileToFunctions) {
  7317. throwError(
  7318. "vueTemplateCompiler is undefined, you must pass " +
  7319. "precompiled components if vue-template-compiler is " +
  7320. "undefined"
  7321. );
  7322. }
  7323. }
  7324. function validateSlots(slots) {
  7325. Object.keys(slots).forEach(function (key) {
  7326. var slot = Array.isArray(slots[key]) ? slots[key] : [slots[key]];
  7327. slot.forEach(function (slotValue) {
  7328. if (!isValidSlot(slotValue)) {
  7329. throwError(
  7330. "slots[key] must be a Component, string or an array " +
  7331. "of Components"
  7332. );
  7333. }
  7334. requiresTemplateCompiler(slotValue);
  7335. });
  7336. });
  7337. }
  7338. function vueExtendUnsupportedOption(option) {
  7339. return (
  7340. "options." + option + " is not supported for " +
  7341. "components created with Vue.extend in Vue < 2.3. " +
  7342. "You can set " + option + " to false to mount the component."
  7343. )
  7344. }
  7345. // these options aren't supported if Vue is version < 2.3
  7346. // for components using Vue.extend. This is due to a bug
  7347. // that means the mixins we use to add properties are not applied
  7348. // correctly
  7349. var UNSUPPORTED_VERSION_OPTIONS = ['mocks', 'stubs', 'localVue'];
  7350. function validateOptions(options, component) {
  7351. if (options.parentComponent && !isPlainObject(options.parentComponent)) {
  7352. throwError(
  7353. "options.parentComponent should be a valid Vue component options object"
  7354. );
  7355. }
  7356. if (!isFunctionalComponent(component) && options.context) {
  7357. throwError(
  7358. "mount.context can only be used when mounting a functional component"
  7359. );
  7360. }
  7361. if (options.context && !isPlainObject(options.context)) {
  7362. throwError('mount.context must be an object');
  7363. }
  7364. if (VUE_VERSION < 2.3 && isConstructor(component)) {
  7365. UNSUPPORTED_VERSION_OPTIONS.forEach(function (option) {
  7366. if (options[option]) {
  7367. throwError(vueExtendUnsupportedOption(option));
  7368. }
  7369. });
  7370. }
  7371. if (options.slots) {
  7372. compileTemplateForSlots(options.slots);
  7373. // validate slots outside of the createSlots function so
  7374. // that we can throw an error without it being caught by
  7375. // the Vue error handler
  7376. // $FlowIgnore
  7377. validateSlots(options.slots);
  7378. }
  7379. }
  7380. //
  7381. Vue.config.productionTip = false;
  7382. Vue.config.devtools = false;
  7383. function getSyncOption(syncOption) {
  7384. if (syncOption === false) {
  7385. Vue.config.async = true;
  7386. return false
  7387. }
  7388. if (semver$1.lt(Vue.version, '2.5.18')) {
  7389. warn(
  7390. "Vue Test Utils runs in sync mode by default. Due to bugs, sync mode " +
  7391. "requires Vue > 2.5.18. In Vue Test Utils 1.0 sync mode will only be " +
  7392. "supported with Vue 2.5.18+ running in development mode. If you are " +
  7393. "unable to upgrade, you should rewrite your tests to run asynchronously" +
  7394. "you can do this by setting the sync mounting option to false."
  7395. );
  7396. return COMPAT_SYNC_MODE
  7397. }
  7398. if (typeof Vue.config.async === 'undefined') {
  7399. warn(
  7400. "Sync mode only works when Vue runs in dev mode. " +
  7401. "Please set Vue to run in dev mode, or set sync to false"
  7402. );
  7403. }
  7404. Vue.config.async = false;
  7405. return true
  7406. }
  7407. function mount(
  7408. component,
  7409. options
  7410. ) {
  7411. if ( options === void 0 ) options = {};
  7412. warnIfNoWindow();
  7413. addGlobalErrorHandler(Vue);
  7414. var _Vue = createLocalVue(options.localVue);
  7415. var mergedOptions = mergeOptions(options, config);
  7416. validateOptions(mergedOptions, component);
  7417. var parentVm = createInstance(component, mergedOptions, _Vue);
  7418. var el = options.attachToDocument ? createElement() : undefined;
  7419. var vm = parentVm.$mount(el);
  7420. component._Ctor = {};
  7421. throwIfInstancesThrew(vm);
  7422. var sync = getSyncOption(mergedOptions.sync);
  7423. var wrapperOptions = {
  7424. attachedToDocument: !!mergedOptions.attachToDocument,
  7425. sync: sync
  7426. };
  7427. var root = parentVm.$options._isFunctionalContainer
  7428. ? vm._vnode
  7429. : vm.$children[0];
  7430. return createWrapper(root, wrapperOptions)
  7431. }
  7432. //
  7433. function shallowMount(
  7434. component,
  7435. options
  7436. ) {
  7437. if ( options === void 0 ) options = {};
  7438. return mount(component, Object.assign({}, options,
  7439. {shouldProxy: true}))
  7440. }
  7441. //
  7442. var toTypes = [String, Object];
  7443. var eventTypes = [String, Array];
  7444. var RouterLinkStub = {
  7445. name: 'RouterLinkStub',
  7446. props: {
  7447. to: {
  7448. type: toTypes,
  7449. required: true
  7450. },
  7451. tag: {
  7452. type: String,
  7453. default: 'a'
  7454. },
  7455. exact: Boolean,
  7456. append: Boolean,
  7457. replace: Boolean,
  7458. activeClass: String,
  7459. exactActiveClass: String,
  7460. event: {
  7461. type: eventTypes,
  7462. default: 'click'
  7463. }
  7464. },
  7465. render: function render(h) {
  7466. return h(this.tag, undefined, this.$slots.default)
  7467. }
  7468. }
  7469. function shallow(component, options) {
  7470. warn(
  7471. "shallow has been renamed to shallowMount. shallow " +
  7472. "will be removed in 1.0.0, use shallowMount instead"
  7473. );
  7474. return shallowMount(component, options)
  7475. }
  7476. var index = {
  7477. createLocalVue: createLocalVue,
  7478. createWrapper: createWrapper,
  7479. config: config,
  7480. mount: mount,
  7481. shallow: shallow,
  7482. shallowMount: shallowMount,
  7483. TransitionStub: TransitionStub,
  7484. TransitionGroupStub: TransitionGroupStub,
  7485. RouterLinkStub: RouterLinkStub,
  7486. Wrapper: Wrapper,
  7487. WrapperArray: WrapperArray
  7488. }
  7489. return index;
  7490. }(Vue,VueTemplateCompiler));