vue.js 422 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864
  1. /*!
  2. * Vue.js v2.7.10
  3. * (c) 2014-2022 Evan You
  4. * Released under the MIT License.
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  8. typeof define === 'function' && define.amd ? define(factory) :
  9. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Vue = factory());
  10. })(this, (function () { 'use strict';
  11. var emptyObject = Object.freeze({});
  12. var isArray = Array.isArray;
  13. // These helpers produce better VM code in JS engines due to their
  14. // explicitness and function inlining.
  15. function isUndef(v) {
  16. return v === undefined || v === null;
  17. }
  18. function isDef(v) {
  19. return v !== undefined && v !== null;
  20. }
  21. function isTrue(v) {
  22. return v === true;
  23. }
  24. function isFalse(v) {
  25. return v === false;
  26. }
  27. /**
  28. * Check if value is primitive.
  29. */
  30. function isPrimitive(value) {
  31. return (typeof value === 'string' ||
  32. typeof value === 'number' ||
  33. // $flow-disable-line
  34. typeof value === 'symbol' ||
  35. typeof value === 'boolean');
  36. }
  37. function isFunction(value) {
  38. return typeof value === 'function';
  39. }
  40. /**
  41. * Quick object check - this is primarily used to tell
  42. * objects from primitive values when we know the value
  43. * is a JSON-compliant type.
  44. */
  45. function isObject(obj) {
  46. return obj !== null && typeof obj === 'object';
  47. }
  48. /**
  49. * Get the raw type string of a value, e.g., [object Object].
  50. */
  51. var _toString = Object.prototype.toString;
  52. function toRawType(value) {
  53. return _toString.call(value).slice(8, -1);
  54. }
  55. /**
  56. * Strict object type check. Only returns true
  57. * for plain JavaScript objects.
  58. */
  59. function isPlainObject(obj) {
  60. return _toString.call(obj) === '[object Object]';
  61. }
  62. function isRegExp(v) {
  63. return _toString.call(v) === '[object RegExp]';
  64. }
  65. /**
  66. * Check if val is a valid array index.
  67. */
  68. function isValidArrayIndex(val) {
  69. var n = parseFloat(String(val));
  70. return n >= 0 && Math.floor(n) === n && isFinite(val);
  71. }
  72. function isPromise(val) {
  73. return (isDef(val) &&
  74. typeof val.then === 'function' &&
  75. typeof val.catch === 'function');
  76. }
  77. /**
  78. * Convert a value to a string that is actually rendered.
  79. */
  80. function toString(val) {
  81. return val == null
  82. ? ''
  83. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  84. ? JSON.stringify(val, null, 2)
  85. : String(val);
  86. }
  87. /**
  88. * Convert an input value to a number for persistence.
  89. * If the conversion fails, return original string.
  90. */
  91. function toNumber(val) {
  92. var n = parseFloat(val);
  93. return isNaN(n) ? val : n;
  94. }
  95. /**
  96. * Make a map and return a function for checking if a key
  97. * is in that map.
  98. */
  99. function makeMap(str, expectsLowerCase) {
  100. var map = Object.create(null);
  101. var list = str.split(',');
  102. for (var i = 0; i < list.length; i++) {
  103. map[list[i]] = true;
  104. }
  105. return expectsLowerCase ? function (val) { return map[val.toLowerCase()]; } : function (val) { return map[val]; };
  106. }
  107. /**
  108. * Check if a tag is a built-in tag.
  109. */
  110. var isBuiltInTag = makeMap('slot,component', true);
  111. /**
  112. * Check if an attribute is a reserved attribute.
  113. */
  114. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  115. /**
  116. * Remove an item from an array.
  117. */
  118. function remove$2(arr, item) {
  119. if (arr.length) {
  120. var index = arr.indexOf(item);
  121. if (index > -1) {
  122. return arr.splice(index, 1);
  123. }
  124. }
  125. }
  126. /**
  127. * Check whether an object has the property.
  128. */
  129. var hasOwnProperty = Object.prototype.hasOwnProperty;
  130. function hasOwn(obj, key) {
  131. return hasOwnProperty.call(obj, key);
  132. }
  133. /**
  134. * Create a cached version of a pure function.
  135. */
  136. function cached(fn) {
  137. var cache = Object.create(null);
  138. return function cachedFn(str) {
  139. var hit = cache[str];
  140. return hit || (cache[str] = fn(str));
  141. };
  142. }
  143. /**
  144. * Camelize a hyphen-delimited string.
  145. */
  146. var camelizeRE = /-(\w)/g;
  147. var camelize = cached(function (str) {
  148. return str.replace(camelizeRE, function (_, c) { return (c ? c.toUpperCase() : ''); });
  149. });
  150. /**
  151. * Capitalize a string.
  152. */
  153. var capitalize = cached(function (str) {
  154. return str.charAt(0).toUpperCase() + str.slice(1);
  155. });
  156. /**
  157. * Hyphenate a camelCase string.
  158. */
  159. var hyphenateRE = /\B([A-Z])/g;
  160. var hyphenate = cached(function (str) {
  161. return str.replace(hyphenateRE, '-$1').toLowerCase();
  162. });
  163. /**
  164. * Simple bind polyfill for environments that do not support it,
  165. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  166. * since native bind is now performant enough in most browsers.
  167. * But removing it would mean breaking code that was able to run in
  168. * PhantomJS 1.x, so this must be kept for backward compatibility.
  169. */
  170. /* istanbul ignore next */
  171. function polyfillBind(fn, ctx) {
  172. function boundFn(a) {
  173. var l = arguments.length;
  174. return l
  175. ? l > 1
  176. ? fn.apply(ctx, arguments)
  177. : fn.call(ctx, a)
  178. : fn.call(ctx);
  179. }
  180. boundFn._length = fn.length;
  181. return boundFn;
  182. }
  183. function nativeBind(fn, ctx) {
  184. return fn.bind(ctx);
  185. }
  186. // @ts-expect-error bind cannot be `undefined`
  187. var bind$1 = Function.prototype.bind ? nativeBind : polyfillBind;
  188. /**
  189. * Convert an Array-like object to a real Array.
  190. */
  191. function toArray(list, start) {
  192. start = start || 0;
  193. var i = list.length - start;
  194. var ret = new Array(i);
  195. while (i--) {
  196. ret[i] = list[i + start];
  197. }
  198. return ret;
  199. }
  200. /**
  201. * Mix properties into target object.
  202. */
  203. function extend(to, _from) {
  204. for (var key in _from) {
  205. to[key] = _from[key];
  206. }
  207. return to;
  208. }
  209. /**
  210. * Merge an Array of Objects into a single Object.
  211. */
  212. function toObject(arr) {
  213. var res = {};
  214. for (var i = 0; i < arr.length; i++) {
  215. if (arr[i]) {
  216. extend(res, arr[i]);
  217. }
  218. }
  219. return res;
  220. }
  221. /* eslint-disable no-unused-vars */
  222. /**
  223. * Perform no operation.
  224. * Stubbing args to make Flow happy without leaving useless transpiled code
  225. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  226. */
  227. function noop(a, b, c) { }
  228. /**
  229. * Always return false.
  230. */
  231. var no = function (a, b, c) { return false; };
  232. /* eslint-enable no-unused-vars */
  233. /**
  234. * Return the same value.
  235. */
  236. var identity = function (_) { return _; };
  237. /**
  238. * Generate a string containing static keys from compiler modules.
  239. */
  240. function genStaticKeys$1(modules) {
  241. return modules
  242. .reduce(function (keys, m) {
  243. return keys.concat(m.staticKeys || []);
  244. }, [])
  245. .join(',');
  246. }
  247. /**
  248. * Check if two values are loosely equal - that is,
  249. * if they are plain objects, do they have the same shape?
  250. */
  251. function looseEqual(a, b) {
  252. if (a === b)
  253. return true;
  254. var isObjectA = isObject(a);
  255. var isObjectB = isObject(b);
  256. if (isObjectA && isObjectB) {
  257. try {
  258. var isArrayA = Array.isArray(a);
  259. var isArrayB = Array.isArray(b);
  260. if (isArrayA && isArrayB) {
  261. return (a.length === b.length &&
  262. a.every(function (e, i) {
  263. return looseEqual(e, b[i]);
  264. }));
  265. }
  266. else if (a instanceof Date && b instanceof Date) {
  267. return a.getTime() === b.getTime();
  268. }
  269. else if (!isArrayA && !isArrayB) {
  270. var keysA = Object.keys(a);
  271. var keysB = Object.keys(b);
  272. return (keysA.length === keysB.length &&
  273. keysA.every(function (key) {
  274. return looseEqual(a[key], b[key]);
  275. }));
  276. }
  277. else {
  278. /* istanbul ignore next */
  279. return false;
  280. }
  281. }
  282. catch (e) {
  283. /* istanbul ignore next */
  284. return false;
  285. }
  286. }
  287. else if (!isObjectA && !isObjectB) {
  288. return String(a) === String(b);
  289. }
  290. else {
  291. return false;
  292. }
  293. }
  294. /**
  295. * Return the first index at which a loosely equal value can be
  296. * found in the array (if value is a plain object, the array must
  297. * contain an object of the same shape), or -1 if it is not present.
  298. */
  299. function looseIndexOf(arr, val) {
  300. for (var i = 0; i < arr.length; i++) {
  301. if (looseEqual(arr[i], val))
  302. return i;
  303. }
  304. return -1;
  305. }
  306. /**
  307. * Ensure a function is called only once.
  308. */
  309. function once(fn) {
  310. var called = false;
  311. return function () {
  312. if (!called) {
  313. called = true;
  314. fn.apply(this, arguments);
  315. }
  316. };
  317. }
  318. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is#polyfill
  319. function hasChanged(x, y) {
  320. if (x === y) {
  321. return x === 0 && 1 / x !== 1 / y;
  322. }
  323. else {
  324. return x === x || y === y;
  325. }
  326. }
  327. var SSR_ATTR = 'data-server-rendered';
  328. var ASSET_TYPES = ['component', 'directive', 'filter'];
  329. var LIFECYCLE_HOOKS = [
  330. 'beforeCreate',
  331. 'created',
  332. 'beforeMount',
  333. 'mounted',
  334. 'beforeUpdate',
  335. 'updated',
  336. 'beforeDestroy',
  337. 'destroyed',
  338. 'activated',
  339. 'deactivated',
  340. 'errorCaptured',
  341. 'serverPrefetch',
  342. 'renderTracked',
  343. 'renderTriggered'
  344. ];
  345. var config = {
  346. /**
  347. * Option merge strategies (used in core/util/options)
  348. */
  349. // $flow-disable-line
  350. optionMergeStrategies: Object.create(null),
  351. /**
  352. * Whether to suppress warnings.
  353. */
  354. silent: false,
  355. /**
  356. * Show production mode tip message on boot?
  357. */
  358. productionTip: true,
  359. /**
  360. * Whether to enable devtools
  361. */
  362. devtools: true,
  363. /**
  364. * Whether to record perf
  365. */
  366. performance: false,
  367. /**
  368. * Error handler for watcher errors
  369. */
  370. errorHandler: null,
  371. /**
  372. * Warn handler for watcher warns
  373. */
  374. warnHandler: null,
  375. /**
  376. * Ignore certain custom elements
  377. */
  378. ignoredElements: [],
  379. /**
  380. * Custom user key aliases for v-on
  381. */
  382. // $flow-disable-line
  383. keyCodes: Object.create(null),
  384. /**
  385. * Check if a tag is reserved so that it cannot be registered as a
  386. * component. This is platform-dependent and may be overwritten.
  387. */
  388. isReservedTag: no,
  389. /**
  390. * Check if an attribute is reserved so that it cannot be used as a component
  391. * prop. This is platform-dependent and may be overwritten.
  392. */
  393. isReservedAttr: no,
  394. /**
  395. * Check if a tag is an unknown element.
  396. * Platform-dependent.
  397. */
  398. isUnknownElement: no,
  399. /**
  400. * Get the namespace of an element
  401. */
  402. getTagNamespace: noop,
  403. /**
  404. * Parse the real tag name for the specific platform.
  405. */
  406. parsePlatformTagName: identity,
  407. /**
  408. * Check if an attribute must be bound using property, e.g. value
  409. * Platform-dependent.
  410. */
  411. mustUseProp: no,
  412. /**
  413. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  414. * This will significantly reduce performance if set to false.
  415. */
  416. async: true,
  417. /**
  418. * Exposed for legacy reasons
  419. */
  420. _lifecycleHooks: LIFECYCLE_HOOKS
  421. };
  422. /**
  423. * unicode letters used for parsing html tags, component names and property paths.
  424. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  425. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  426. */
  427. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  428. /**
  429. * Check if a string starts with $ or _
  430. */
  431. function isReserved(str) {
  432. var c = (str + '').charCodeAt(0);
  433. return c === 0x24 || c === 0x5f;
  434. }
  435. /**
  436. * Define a property.
  437. */
  438. function def(obj, key, val, enumerable) {
  439. Object.defineProperty(obj, key, {
  440. value: val,
  441. enumerable: !!enumerable,
  442. writable: true,
  443. configurable: true
  444. });
  445. }
  446. /**
  447. * Parse simple path.
  448. */
  449. var bailRE = new RegExp("[^".concat(unicodeRegExp.source, ".$_\\d]"));
  450. function parsePath(path) {
  451. if (bailRE.test(path)) {
  452. return;
  453. }
  454. var segments = path.split('.');
  455. return function (obj) {
  456. for (var i = 0; i < segments.length; i++) {
  457. if (!obj)
  458. return;
  459. obj = obj[segments[i]];
  460. }
  461. return obj;
  462. };
  463. }
  464. // can we use __proto__?
  465. var hasProto = '__proto__' in {};
  466. // Browser environment sniffing
  467. var inBrowser = typeof window !== 'undefined';
  468. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  469. var isIE = UA && /msie|trident/.test(UA);
  470. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  471. var isEdge = UA && UA.indexOf('edge/') > 0;
  472. UA && UA.indexOf('android') > 0;
  473. var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
  474. UA && /chrome\/\d+/.test(UA) && !isEdge;
  475. UA && /phantomjs/.test(UA);
  476. var isFF = UA && UA.match(/firefox\/(\d+)/);
  477. // Firefox has a "watch" function on Object.prototype...
  478. // @ts-expect-error firebox support
  479. var nativeWatch = {}.watch;
  480. var supportsPassive = false;
  481. if (inBrowser) {
  482. try {
  483. var opts = {};
  484. Object.defineProperty(opts, 'passive', {
  485. get: function () {
  486. /* istanbul ignore next */
  487. supportsPassive = true;
  488. }
  489. }); // https://github.com/facebook/flow/issues/285
  490. window.addEventListener('test-passive', null, opts);
  491. }
  492. catch (e) { }
  493. }
  494. // this needs to be lazy-evaled because vue may be required before
  495. // vue-server-renderer can set VUE_ENV
  496. var _isServer;
  497. var isServerRendering = function () {
  498. if (_isServer === undefined) {
  499. /* istanbul ignore if */
  500. if (!inBrowser && typeof global !== 'undefined') {
  501. // detect presence of vue-server-renderer and avoid
  502. // Webpack shimming the process
  503. _isServer =
  504. global['process'] && global['process'].env.VUE_ENV === 'server';
  505. }
  506. else {
  507. _isServer = false;
  508. }
  509. }
  510. return _isServer;
  511. };
  512. // detect devtools
  513. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  514. /* istanbul ignore next */
  515. function isNative(Ctor) {
  516. return typeof Ctor === 'function' && /native code/.test(Ctor.toString());
  517. }
  518. var hasSymbol = typeof Symbol !== 'undefined' &&
  519. isNative(Symbol) &&
  520. typeof Reflect !== 'undefined' &&
  521. isNative(Reflect.ownKeys);
  522. var _Set; // $flow-disable-line
  523. /* istanbul ignore if */ if (typeof Set !== 'undefined' && isNative(Set)) {
  524. // use native Set when available.
  525. _Set = Set;
  526. }
  527. else {
  528. // a non-standard Set polyfill that only works with primitive keys.
  529. _Set = /** @class */ (function () {
  530. function Set() {
  531. this.set = Object.create(null);
  532. }
  533. Set.prototype.has = function (key) {
  534. return this.set[key] === true;
  535. };
  536. Set.prototype.add = function (key) {
  537. this.set[key] = true;
  538. };
  539. Set.prototype.clear = function () {
  540. this.set = Object.create(null);
  541. };
  542. return Set;
  543. }());
  544. }
  545. var currentInstance = null;
  546. /**
  547. * This is exposed for compatibility with v3 (e.g. some functions in VueUse
  548. * relies on it). Do not use this internally, just use `currentInstance`.
  549. *
  550. * @internal this function needs manual type declaration because it relies
  551. * on previously manually authored types from Vue 2
  552. */
  553. function getCurrentInstance() {
  554. return currentInstance && { proxy: currentInstance };
  555. }
  556. /**
  557. * @internal
  558. */
  559. function setCurrentInstance(vm) {
  560. if (vm === void 0) { vm = null; }
  561. if (!vm)
  562. currentInstance && currentInstance._scope.off();
  563. currentInstance = vm;
  564. vm && vm._scope.on();
  565. }
  566. /**
  567. * @internal
  568. */
  569. var VNode = /** @class */ (function () {
  570. function VNode(tag, data, children, text, elm, context, componentOptions, asyncFactory) {
  571. this.tag = tag;
  572. this.data = data;
  573. this.children = children;
  574. this.text = text;
  575. this.elm = elm;
  576. this.ns = undefined;
  577. this.context = context;
  578. this.fnContext = undefined;
  579. this.fnOptions = undefined;
  580. this.fnScopeId = undefined;
  581. this.key = data && data.key;
  582. this.componentOptions = componentOptions;
  583. this.componentInstance = undefined;
  584. this.parent = undefined;
  585. this.raw = false;
  586. this.isStatic = false;
  587. this.isRootInsert = true;
  588. this.isComment = false;
  589. this.isCloned = false;
  590. this.isOnce = false;
  591. this.asyncFactory = asyncFactory;
  592. this.asyncMeta = undefined;
  593. this.isAsyncPlaceholder = false;
  594. }
  595. Object.defineProperty(VNode.prototype, "child", {
  596. // DEPRECATED: alias for componentInstance for backwards compat.
  597. /* istanbul ignore next */
  598. get: function () {
  599. return this.componentInstance;
  600. },
  601. enumerable: false,
  602. configurable: true
  603. });
  604. return VNode;
  605. }());
  606. var createEmptyVNode = function (text) {
  607. if (text === void 0) { text = ''; }
  608. var node = new VNode();
  609. node.text = text;
  610. node.isComment = true;
  611. return node;
  612. };
  613. function createTextVNode(val) {
  614. return new VNode(undefined, undefined, undefined, String(val));
  615. }
  616. // optimized shallow clone
  617. // used for static nodes and slot nodes because they may be reused across
  618. // multiple renders, cloning them avoids errors when DOM manipulations rely
  619. // on their elm reference.
  620. function cloneVNode(vnode) {
  621. var cloned = new VNode(vnode.tag, vnode.data,
  622. // #7975
  623. // clone children array to avoid mutating original in case of cloning
  624. // a child.
  625. vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, vnode.asyncFactory);
  626. cloned.ns = vnode.ns;
  627. cloned.isStatic = vnode.isStatic;
  628. cloned.key = vnode.key;
  629. cloned.isComment = vnode.isComment;
  630. cloned.fnContext = vnode.fnContext;
  631. cloned.fnOptions = vnode.fnOptions;
  632. cloned.fnScopeId = vnode.fnScopeId;
  633. cloned.asyncMeta = vnode.asyncMeta;
  634. cloned.isCloned = true;
  635. return cloned;
  636. }
  637. /* not type checking this file because flow doesn't play well with Proxy */
  638. var initProxy;
  639. {
  640. var allowedGlobals_1 = makeMap('Infinity,undefined,NaN,isFinite,isNaN,' +
  641. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  642. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
  643. 'require' // for Webpack/Browserify
  644. );
  645. var warnNonPresent_1 = function (target, key) {
  646. warn$2("Property or method \"".concat(key, "\" is not defined on the instance but ") +
  647. 'referenced during render. Make sure that this property is reactive, ' +
  648. 'either in the data option, or for class-based components, by ' +
  649. 'initializing the property. ' +
  650. 'See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target);
  651. };
  652. var warnReservedPrefix_1 = function (target, key) {
  653. warn$2("Property \"".concat(key, "\" must be accessed with \"$data.").concat(key, "\" because ") +
  654. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  655. 'prevent conflicts with Vue internals. ' +
  656. 'See: https://v2.vuejs.org/v2/api/#data', target);
  657. };
  658. var hasProxy_1 = typeof Proxy !== 'undefined' && isNative(Proxy);
  659. if (hasProxy_1) {
  660. var isBuiltInModifier_1 = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  661. config.keyCodes = new Proxy(config.keyCodes, {
  662. set: function (target, key, value) {
  663. if (isBuiltInModifier_1(key)) {
  664. warn$2("Avoid overwriting built-in modifier in config.keyCodes: .".concat(key));
  665. return false;
  666. }
  667. else {
  668. target[key] = value;
  669. return true;
  670. }
  671. }
  672. });
  673. }
  674. var hasHandler_1 = {
  675. has: function (target, key) {
  676. var has = key in target;
  677. var isAllowed = allowedGlobals_1(key) ||
  678. (typeof key === 'string' &&
  679. key.charAt(0) === '_' &&
  680. !(key in target.$data));
  681. if (!has && !isAllowed) {
  682. if (key in target.$data)
  683. warnReservedPrefix_1(target, key);
  684. else
  685. warnNonPresent_1(target, key);
  686. }
  687. return has || !isAllowed;
  688. }
  689. };
  690. var getHandler_1 = {
  691. get: function (target, key) {
  692. if (typeof key === 'string' && !(key in target)) {
  693. if (key in target.$data)
  694. warnReservedPrefix_1(target, key);
  695. else
  696. warnNonPresent_1(target, key);
  697. }
  698. return target[key];
  699. }
  700. };
  701. initProxy = function initProxy(vm) {
  702. if (hasProxy_1) {
  703. // determine which proxy handler to use
  704. var options = vm.$options;
  705. var handlers = options.render && options.render._withStripped ? getHandler_1 : hasHandler_1;
  706. vm._renderProxy = new Proxy(vm, handlers);
  707. }
  708. else {
  709. vm._renderProxy = vm;
  710. }
  711. };
  712. }
  713. /******************************************************************************
  714. Copyright (c) Microsoft Corporation.
  715. Permission to use, copy, modify, and/or distribute this software for any
  716. purpose with or without fee is hereby granted.
  717. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  718. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  719. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  720. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  721. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  722. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  723. PERFORMANCE OF THIS SOFTWARE.
  724. ***************************************************************************** */
  725. var __assign = function() {
  726. __assign = Object.assign || function __assign(t) {
  727. for (var s, i = 1, n = arguments.length; i < n; i++) {
  728. s = arguments[i];
  729. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  730. }
  731. return t;
  732. };
  733. return __assign.apply(this, arguments);
  734. };
  735. var uid$2 = 0;
  736. /**
  737. * A dep is an observable that can have multiple
  738. * directives subscribing to it.
  739. * @internal
  740. */
  741. var Dep = /** @class */ (function () {
  742. function Dep() {
  743. this.id = uid$2++;
  744. this.subs = [];
  745. }
  746. Dep.prototype.addSub = function (sub) {
  747. this.subs.push(sub);
  748. };
  749. Dep.prototype.removeSub = function (sub) {
  750. remove$2(this.subs, sub);
  751. };
  752. Dep.prototype.depend = function (info) {
  753. if (Dep.target) {
  754. Dep.target.addDep(this);
  755. if (info && Dep.target.onTrack) {
  756. Dep.target.onTrack(__assign({ effect: Dep.target }, info));
  757. }
  758. }
  759. };
  760. Dep.prototype.notify = function (info) {
  761. // stabilize the subscriber list first
  762. var subs = this.subs.slice();
  763. if (!config.async) {
  764. // subs aren't sorted in scheduler if not running async
  765. // we need to sort them now to make sure they fire in correct
  766. // order
  767. subs.sort(function (a, b) { return a.id - b.id; });
  768. }
  769. for (var i = 0, l = subs.length; i < l; i++) {
  770. if (info) {
  771. var sub = subs[i];
  772. sub.onTrigger &&
  773. sub.onTrigger(__assign({ effect: subs[i] }, info));
  774. }
  775. subs[i].update();
  776. }
  777. };
  778. return Dep;
  779. }());
  780. // The current target watcher being evaluated.
  781. // This is globally unique because only one watcher
  782. // can be evaluated at a time.
  783. Dep.target = null;
  784. var targetStack = [];
  785. function pushTarget(target) {
  786. targetStack.push(target);
  787. Dep.target = target;
  788. }
  789. function popTarget() {
  790. targetStack.pop();
  791. Dep.target = targetStack[targetStack.length - 1];
  792. }
  793. /*
  794. * not type checking this file because flow doesn't play well with
  795. * dynamically accessing methods on Array prototype
  796. */
  797. var arrayProto = Array.prototype;
  798. var arrayMethods = Object.create(arrayProto);
  799. var methodsToPatch = [
  800. 'push',
  801. 'pop',
  802. 'shift',
  803. 'unshift',
  804. 'splice',
  805. 'sort',
  806. 'reverse'
  807. ];
  808. /**
  809. * Intercept mutating methods and emit events
  810. */
  811. methodsToPatch.forEach(function (method) {
  812. // cache original method
  813. var original = arrayProto[method];
  814. def(arrayMethods, method, function mutator() {
  815. var args = [];
  816. for (var _i = 0; _i < arguments.length; _i++) {
  817. args[_i] = arguments[_i];
  818. }
  819. var result = original.apply(this, args);
  820. var ob = this.__ob__;
  821. var inserted;
  822. switch (method) {
  823. case 'push':
  824. case 'unshift':
  825. inserted = args;
  826. break;
  827. case 'splice':
  828. inserted = args.slice(2);
  829. break;
  830. }
  831. if (inserted)
  832. ob.observeArray(inserted);
  833. // notify change
  834. {
  835. ob.dep.notify({
  836. type: "array mutation" /* TriggerOpTypes.ARRAY_MUTATION */,
  837. target: this,
  838. key: method
  839. });
  840. }
  841. return result;
  842. });
  843. });
  844. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  845. var NO_INIITIAL_VALUE = {};
  846. /**
  847. * In some cases we may want to disable observation inside a component's
  848. * update computation.
  849. */
  850. var shouldObserve = true;
  851. function toggleObserving(value) {
  852. shouldObserve = value;
  853. }
  854. // ssr mock dep
  855. var mockDep = {
  856. notify: noop,
  857. depend: noop,
  858. addSub: noop,
  859. removeSub: noop
  860. };
  861. /**
  862. * Observer class that is attached to each observed
  863. * object. Once attached, the observer converts the target
  864. * object's property keys into getter/setters that
  865. * collect dependencies and dispatch updates.
  866. */
  867. var Observer = /** @class */ (function () {
  868. function Observer(value, shallow, mock) {
  869. if (shallow === void 0) { shallow = false; }
  870. if (mock === void 0) { mock = false; }
  871. this.value = value;
  872. this.shallow = shallow;
  873. this.mock = mock;
  874. // this.value = value
  875. this.dep = mock ? mockDep : new Dep();
  876. this.vmCount = 0;
  877. def(value, '__ob__', this);
  878. if (isArray(value)) {
  879. if (!mock) {
  880. if (hasProto) {
  881. value.__proto__ = arrayMethods;
  882. /* eslint-enable no-proto */
  883. }
  884. else {
  885. for (var i = 0, l = arrayKeys.length; i < l; i++) {
  886. var key = arrayKeys[i];
  887. def(value, key, arrayMethods[key]);
  888. }
  889. }
  890. }
  891. if (!shallow) {
  892. this.observeArray(value);
  893. }
  894. }
  895. else {
  896. /**
  897. * Walk through all properties and convert them into
  898. * getter/setters. This method should only be called when
  899. * value type is Object.
  900. */
  901. var keys = Object.keys(value);
  902. for (var i = 0; i < keys.length; i++) {
  903. var key = keys[i];
  904. defineReactive(value, key, NO_INIITIAL_VALUE, undefined, shallow, mock);
  905. }
  906. }
  907. }
  908. /**
  909. * Observe a list of Array items.
  910. */
  911. Observer.prototype.observeArray = function (value) {
  912. for (var i = 0, l = value.length; i < l; i++) {
  913. observe(value[i], false, this.mock);
  914. }
  915. };
  916. return Observer;
  917. }());
  918. // helpers
  919. /**
  920. * Attempt to create an observer instance for a value,
  921. * returns the new observer if successfully observed,
  922. * or the existing observer if the value already has one.
  923. */
  924. function observe(value, shallow, ssrMockReactivity) {
  925. if (!isObject(value) || isRef(value) || value instanceof VNode) {
  926. return;
  927. }
  928. var ob;
  929. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  930. ob = value.__ob__;
  931. }
  932. else if (shouldObserve &&
  933. (ssrMockReactivity || !isServerRendering()) &&
  934. (isArray(value) || isPlainObject(value)) &&
  935. Object.isExtensible(value) &&
  936. !value.__v_skip /* ReactiveFlags.SKIP */) {
  937. ob = new Observer(value, shallow, ssrMockReactivity);
  938. }
  939. return ob;
  940. }
  941. /**
  942. * Define a reactive property on an Object.
  943. */
  944. function defineReactive(obj, key, val, customSetter, shallow, mock) {
  945. var dep = new Dep();
  946. var property = Object.getOwnPropertyDescriptor(obj, key);
  947. if (property && property.configurable === false) {
  948. return;
  949. }
  950. // cater for pre-defined getter/setters
  951. var getter = property && property.get;
  952. var setter = property && property.set;
  953. if ((!getter || setter) &&
  954. (val === NO_INIITIAL_VALUE || arguments.length === 2)) {
  955. val = obj[key];
  956. }
  957. var childOb = !shallow && observe(val, false, mock);
  958. Object.defineProperty(obj, key, {
  959. enumerable: true,
  960. configurable: true,
  961. get: function reactiveGetter() {
  962. var value = getter ? getter.call(obj) : val;
  963. if (Dep.target) {
  964. {
  965. dep.depend({
  966. target: obj,
  967. type: "get" /* TrackOpTypes.GET */,
  968. key: key
  969. });
  970. }
  971. if (childOb) {
  972. childOb.dep.depend();
  973. if (isArray(value)) {
  974. dependArray(value);
  975. }
  976. }
  977. }
  978. return isRef(value) && !shallow ? value.value : value;
  979. },
  980. set: function reactiveSetter(newVal) {
  981. var value = getter ? getter.call(obj) : val;
  982. if (!hasChanged(value, newVal)) {
  983. return;
  984. }
  985. if (customSetter) {
  986. customSetter();
  987. }
  988. if (setter) {
  989. setter.call(obj, newVal);
  990. }
  991. else if (getter) {
  992. // #7981: for accessor properties without setter
  993. return;
  994. }
  995. else if (!shallow && isRef(value) && !isRef(newVal)) {
  996. value.value = newVal;
  997. return;
  998. }
  999. else {
  1000. val = newVal;
  1001. }
  1002. childOb = !shallow && observe(newVal, false, mock);
  1003. {
  1004. dep.notify({
  1005. type: "set" /* TriggerOpTypes.SET */,
  1006. target: obj,
  1007. key: key,
  1008. newValue: newVal,
  1009. oldValue: value
  1010. });
  1011. }
  1012. }
  1013. });
  1014. return dep;
  1015. }
  1016. function set(target, key, val) {
  1017. if ((isUndef(target) || isPrimitive(target))) {
  1018. warn$2("Cannot set reactive property on undefined, null, or primitive value: ".concat(target));
  1019. }
  1020. if (isReadonly(target)) {
  1021. warn$2("Set operation on key \"".concat(key, "\" failed: target is readonly."));
  1022. return;
  1023. }
  1024. var ob = target.__ob__;
  1025. if (isArray(target) && isValidArrayIndex(key)) {
  1026. target.length = Math.max(target.length, key);
  1027. target.splice(key, 1, val);
  1028. // when mocking for SSR, array methods are not hijacked
  1029. if (ob && !ob.shallow && ob.mock) {
  1030. observe(val, false, true);
  1031. }
  1032. return val;
  1033. }
  1034. if (key in target && !(key in Object.prototype)) {
  1035. target[key] = val;
  1036. return val;
  1037. }
  1038. if (target._isVue || (ob && ob.vmCount)) {
  1039. warn$2('Avoid adding reactive properties to a Vue instance or its root $data ' +
  1040. 'at runtime - declare it upfront in the data option.');
  1041. return val;
  1042. }
  1043. if (!ob) {
  1044. target[key] = val;
  1045. return val;
  1046. }
  1047. defineReactive(ob.value, key, val, undefined, ob.shallow, ob.mock);
  1048. {
  1049. ob.dep.notify({
  1050. type: "add" /* TriggerOpTypes.ADD */,
  1051. target: target,
  1052. key: key,
  1053. newValue: val,
  1054. oldValue: undefined
  1055. });
  1056. }
  1057. return val;
  1058. }
  1059. function del(target, key) {
  1060. if ((isUndef(target) || isPrimitive(target))) {
  1061. warn$2("Cannot delete reactive property on undefined, null, or primitive value: ".concat(target));
  1062. }
  1063. if (isArray(target) && isValidArrayIndex(key)) {
  1064. target.splice(key, 1);
  1065. return;
  1066. }
  1067. var ob = target.__ob__;
  1068. if (target._isVue || (ob && ob.vmCount)) {
  1069. warn$2('Avoid deleting properties on a Vue instance or its root $data ' +
  1070. '- just set it to null.');
  1071. return;
  1072. }
  1073. if (isReadonly(target)) {
  1074. warn$2("Delete operation on key \"".concat(key, "\" failed: target is readonly."));
  1075. return;
  1076. }
  1077. if (!hasOwn(target, key)) {
  1078. return;
  1079. }
  1080. delete target[key];
  1081. if (!ob) {
  1082. return;
  1083. }
  1084. {
  1085. ob.dep.notify({
  1086. type: "delete" /* TriggerOpTypes.DELETE */,
  1087. target: target,
  1088. key: key
  1089. });
  1090. }
  1091. }
  1092. /**
  1093. * Collect dependencies on array elements when the array is touched, since
  1094. * we cannot intercept array element access like property getters.
  1095. */
  1096. function dependArray(value) {
  1097. for (var e = void 0, i = 0, l = value.length; i < l; i++) {
  1098. e = value[i];
  1099. if (e && e.__ob__) {
  1100. e.__ob__.dep.depend();
  1101. }
  1102. if (isArray(e)) {
  1103. dependArray(e);
  1104. }
  1105. }
  1106. }
  1107. function reactive(target) {
  1108. makeReactive(target, false);
  1109. return target;
  1110. }
  1111. /**
  1112. * Return a shallowly-reactive copy of the original object, where only the root
  1113. * level properties are reactive. It also does not auto-unwrap refs (even at the
  1114. * root level).
  1115. */
  1116. function shallowReactive(target) {
  1117. makeReactive(target, true);
  1118. def(target, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
  1119. return target;
  1120. }
  1121. function makeReactive(target, shallow) {
  1122. // if trying to observe a readonly proxy, return the readonly version.
  1123. if (!isReadonly(target)) {
  1124. {
  1125. if (isArray(target)) {
  1126. warn$2("Avoid using Array as root value for ".concat(shallow ? "shallowReactive()" : "reactive()", " as it cannot be tracked in watch() or watchEffect(). Use ").concat(shallow ? "shallowRef()" : "ref()", " instead. This is a Vue-2-only limitation."));
  1127. }
  1128. var existingOb = target && target.__ob__;
  1129. if (existingOb && existingOb.shallow !== shallow) {
  1130. warn$2("Target is already a ".concat(existingOb.shallow ? "" : "non-", "shallow reactive object, and cannot be converted to ").concat(shallow ? "" : "non-", "shallow."));
  1131. }
  1132. }
  1133. var ob = observe(target, shallow, isServerRendering() /* ssr mock reactivity */);
  1134. if (!ob) {
  1135. if (target == null || isPrimitive(target)) {
  1136. warn$2("value cannot be made reactive: ".concat(String(target)));
  1137. }
  1138. if (isCollectionType(target)) {
  1139. warn$2("Vue 2 does not support reactive collection types such as Map or Set.");
  1140. }
  1141. }
  1142. }
  1143. }
  1144. function isReactive(value) {
  1145. if (isReadonly(value)) {
  1146. return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
  1147. }
  1148. return !!(value && value.__ob__);
  1149. }
  1150. function isShallow(value) {
  1151. return !!(value && value.__v_isShallow);
  1152. }
  1153. function isReadonly(value) {
  1154. return !!(value && value.__v_isReadonly);
  1155. }
  1156. function isProxy(value) {
  1157. return isReactive(value) || isReadonly(value);
  1158. }
  1159. function toRaw(observed) {
  1160. var raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
  1161. return raw ? toRaw(raw) : observed;
  1162. }
  1163. function markRaw(value) {
  1164. def(value, "__v_skip" /* ReactiveFlags.SKIP */, true);
  1165. return value;
  1166. }
  1167. /**
  1168. * @internal
  1169. */
  1170. function isCollectionType(value) {
  1171. var type = toRawType(value);
  1172. return (type === 'Map' || type === 'WeakMap' || type === 'Set' || type === 'WeakSet');
  1173. }
  1174. /**
  1175. * @internal
  1176. */
  1177. var RefFlag = "__v_isRef";
  1178. function isRef(r) {
  1179. return !!(r && r.__v_isRef === true);
  1180. }
  1181. function ref$1(value) {
  1182. return createRef(value, false);
  1183. }
  1184. function shallowRef(value) {
  1185. return createRef(value, true);
  1186. }
  1187. function createRef(rawValue, shallow) {
  1188. if (isRef(rawValue)) {
  1189. return rawValue;
  1190. }
  1191. var ref = {};
  1192. def(ref, RefFlag, true);
  1193. def(ref, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, shallow);
  1194. def(ref, 'dep', defineReactive(ref, 'value', rawValue, null, shallow, isServerRendering()));
  1195. return ref;
  1196. }
  1197. function triggerRef(ref) {
  1198. if (!ref.dep) {
  1199. warn$2("received object is not a triggerable ref.");
  1200. }
  1201. {
  1202. ref.dep &&
  1203. ref.dep.notify({
  1204. type: "set" /* TriggerOpTypes.SET */,
  1205. target: ref,
  1206. key: 'value'
  1207. });
  1208. }
  1209. }
  1210. function unref(ref) {
  1211. return isRef(ref) ? ref.value : ref;
  1212. }
  1213. function proxyRefs(objectWithRefs) {
  1214. if (isReactive(objectWithRefs)) {
  1215. return objectWithRefs;
  1216. }
  1217. var proxy = {};
  1218. var keys = Object.keys(objectWithRefs);
  1219. for (var i = 0; i < keys.length; i++) {
  1220. proxyWithRefUnwrap(proxy, objectWithRefs, keys[i]);
  1221. }
  1222. return proxy;
  1223. }
  1224. function proxyWithRefUnwrap(target, source, key) {
  1225. Object.defineProperty(target, key, {
  1226. enumerable: true,
  1227. configurable: true,
  1228. get: function () {
  1229. var val = source[key];
  1230. if (isRef(val)) {
  1231. return val.value;
  1232. }
  1233. else {
  1234. var ob = val && val.__ob__;
  1235. if (ob)
  1236. ob.dep.depend();
  1237. return val;
  1238. }
  1239. },
  1240. set: function (value) {
  1241. var oldValue = source[key];
  1242. if (isRef(oldValue) && !isRef(value)) {
  1243. oldValue.value = value;
  1244. }
  1245. else {
  1246. source[key] = value;
  1247. }
  1248. }
  1249. });
  1250. }
  1251. function customRef(factory) {
  1252. var dep = new Dep();
  1253. var _a = factory(function () {
  1254. {
  1255. dep.depend({
  1256. target: ref,
  1257. type: "get" /* TrackOpTypes.GET */,
  1258. key: 'value'
  1259. });
  1260. }
  1261. }, function () {
  1262. {
  1263. dep.notify({
  1264. target: ref,
  1265. type: "set" /* TriggerOpTypes.SET */,
  1266. key: 'value'
  1267. });
  1268. }
  1269. }), get = _a.get, set = _a.set;
  1270. var ref = {
  1271. get value() {
  1272. return get();
  1273. },
  1274. set value(newVal) {
  1275. set(newVal);
  1276. }
  1277. };
  1278. def(ref, RefFlag, true);
  1279. return ref;
  1280. }
  1281. function toRefs(object) {
  1282. if (!isReactive(object)) {
  1283. warn$2("toRefs() expects a reactive object but received a plain one.");
  1284. }
  1285. var ret = isArray(object) ? new Array(object.length) : {};
  1286. for (var key in object) {
  1287. ret[key] = toRef(object, key);
  1288. }
  1289. return ret;
  1290. }
  1291. function toRef(object, key, defaultValue) {
  1292. var val = object[key];
  1293. if (isRef(val)) {
  1294. return val;
  1295. }
  1296. var ref = {
  1297. get value() {
  1298. var val = object[key];
  1299. return val === undefined ? defaultValue : val;
  1300. },
  1301. set value(newVal) {
  1302. object[key] = newVal;
  1303. }
  1304. };
  1305. def(ref, RefFlag, true);
  1306. return ref;
  1307. }
  1308. var rawToReadonlyFlag = "__v_rawToReadonly";
  1309. var rawToShallowReadonlyFlag = "__v_rawToShallowReadonly";
  1310. function readonly(target) {
  1311. return createReadonly(target, false);
  1312. }
  1313. function createReadonly(target, shallow) {
  1314. if (!isPlainObject(target)) {
  1315. {
  1316. if (isArray(target)) {
  1317. warn$2("Vue 2 does not support readonly arrays.");
  1318. }
  1319. else if (isCollectionType(target)) {
  1320. warn$2("Vue 2 does not support readonly collection types such as Map or Set.");
  1321. }
  1322. else {
  1323. warn$2("value cannot be made readonly: ".concat(typeof target));
  1324. }
  1325. }
  1326. return target;
  1327. }
  1328. // already a readonly object
  1329. if (isReadonly(target)) {
  1330. return target;
  1331. }
  1332. // already has a readonly proxy
  1333. var existingFlag = shallow ? rawToShallowReadonlyFlag : rawToReadonlyFlag;
  1334. var existingProxy = target[existingFlag];
  1335. if (existingProxy) {
  1336. return existingProxy;
  1337. }
  1338. var proxy = Object.create(Object.getPrototypeOf(target));
  1339. def(target, existingFlag, proxy);
  1340. def(proxy, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, true);
  1341. def(proxy, "__v_raw" /* ReactiveFlags.RAW */, target);
  1342. if (isRef(target)) {
  1343. def(proxy, RefFlag, true);
  1344. }
  1345. if (shallow || isShallow(target)) {
  1346. def(proxy, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
  1347. }
  1348. var keys = Object.keys(target);
  1349. for (var i = 0; i < keys.length; i++) {
  1350. defineReadonlyProperty(proxy, target, keys[i], shallow);
  1351. }
  1352. return proxy;
  1353. }
  1354. function defineReadonlyProperty(proxy, target, key, shallow) {
  1355. Object.defineProperty(proxy, key, {
  1356. enumerable: true,
  1357. configurable: true,
  1358. get: function () {
  1359. var val = target[key];
  1360. return shallow || !isPlainObject(val) ? val : readonly(val);
  1361. },
  1362. set: function () {
  1363. warn$2("Set operation on key \"".concat(key, "\" failed: target is readonly."));
  1364. }
  1365. });
  1366. }
  1367. /**
  1368. * Returns a reactive-copy of the original object, where only the root level
  1369. * properties are readonly, and does NOT unwrap refs nor recursively convert
  1370. * returned properties.
  1371. * This is used for creating the props proxy object for stateful components.
  1372. */
  1373. function shallowReadonly(target) {
  1374. return createReadonly(target, true);
  1375. }
  1376. function computed(getterOrOptions, debugOptions) {
  1377. var getter;
  1378. var setter;
  1379. var onlyGetter = isFunction(getterOrOptions);
  1380. if (onlyGetter) {
  1381. getter = getterOrOptions;
  1382. setter = function () {
  1383. warn$2('Write operation failed: computed value is readonly');
  1384. }
  1385. ;
  1386. }
  1387. else {
  1388. getter = getterOrOptions.get;
  1389. setter = getterOrOptions.set;
  1390. }
  1391. var watcher = isServerRendering()
  1392. ? null
  1393. : new Watcher(currentInstance, getter, noop, { lazy: true });
  1394. if (watcher && debugOptions) {
  1395. watcher.onTrack = debugOptions.onTrack;
  1396. watcher.onTrigger = debugOptions.onTrigger;
  1397. }
  1398. var ref = {
  1399. // some libs rely on the presence effect for checking computed refs
  1400. // from normal refs, but the implementation doesn't matter
  1401. effect: watcher,
  1402. get value() {
  1403. if (watcher) {
  1404. if (watcher.dirty) {
  1405. watcher.evaluate();
  1406. }
  1407. if (Dep.target) {
  1408. if (Dep.target.onTrack) {
  1409. Dep.target.onTrack({
  1410. effect: Dep.target,
  1411. target: ref,
  1412. type: "get" /* TrackOpTypes.GET */,
  1413. key: 'value'
  1414. });
  1415. }
  1416. watcher.depend();
  1417. }
  1418. return watcher.value;
  1419. }
  1420. else {
  1421. return getter();
  1422. }
  1423. },
  1424. set value(newVal) {
  1425. setter(newVal);
  1426. }
  1427. };
  1428. def(ref, RefFlag, true);
  1429. def(ref, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, onlyGetter);
  1430. return ref;
  1431. }
  1432. var mark;
  1433. var measure;
  1434. {
  1435. var perf_1 = inBrowser && window.performance;
  1436. /* istanbul ignore if */
  1437. if (perf_1 &&
  1438. // @ts-ignore
  1439. perf_1.mark &&
  1440. // @ts-ignore
  1441. perf_1.measure &&
  1442. // @ts-ignore
  1443. perf_1.clearMarks &&
  1444. // @ts-ignore
  1445. perf_1.clearMeasures) {
  1446. mark = function (tag) { return perf_1.mark(tag); };
  1447. measure = function (name, startTag, endTag) {
  1448. perf_1.measure(name, startTag, endTag);
  1449. perf_1.clearMarks(startTag);
  1450. perf_1.clearMarks(endTag);
  1451. // perf.clearMeasures(name)
  1452. };
  1453. }
  1454. }
  1455. var normalizeEvent = cached(function (name) {
  1456. var passive = name.charAt(0) === '&';
  1457. name = passive ? name.slice(1) : name;
  1458. var once = name.charAt(0) === '~'; // Prefixed last, checked first
  1459. name = once ? name.slice(1) : name;
  1460. var capture = name.charAt(0) === '!';
  1461. name = capture ? name.slice(1) : name;
  1462. return {
  1463. name: name,
  1464. once: once,
  1465. capture: capture,
  1466. passive: passive
  1467. };
  1468. });
  1469. function createFnInvoker(fns, vm) {
  1470. function invoker() {
  1471. var fns = invoker.fns;
  1472. if (isArray(fns)) {
  1473. var cloned = fns.slice();
  1474. for (var i = 0; i < cloned.length; i++) {
  1475. invokeWithErrorHandling(cloned[i], null, arguments, vm, "v-on handler");
  1476. }
  1477. }
  1478. else {
  1479. // return handler return value for single handlers
  1480. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler");
  1481. }
  1482. }
  1483. invoker.fns = fns;
  1484. return invoker;
  1485. }
  1486. function updateListeners(on, oldOn, add, remove, createOnceHandler, vm) {
  1487. var name, cur, old, event;
  1488. for (name in on) {
  1489. cur = on[name];
  1490. old = oldOn[name];
  1491. event = normalizeEvent(name);
  1492. if (isUndef(cur)) {
  1493. warn$2("Invalid handler for event \"".concat(event.name, "\": got ") + String(cur), vm);
  1494. }
  1495. else if (isUndef(old)) {
  1496. if (isUndef(cur.fns)) {
  1497. cur = on[name] = createFnInvoker(cur, vm);
  1498. }
  1499. if (isTrue(event.once)) {
  1500. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  1501. }
  1502. add(event.name, cur, event.capture, event.passive, event.params);
  1503. }
  1504. else if (cur !== old) {
  1505. old.fns = cur;
  1506. on[name] = old;
  1507. }
  1508. }
  1509. for (name in oldOn) {
  1510. if (isUndef(on[name])) {
  1511. event = normalizeEvent(name);
  1512. remove(event.name, oldOn[name], event.capture);
  1513. }
  1514. }
  1515. }
  1516. function mergeVNodeHook(def, hookKey, hook) {
  1517. if (def instanceof VNode) {
  1518. def = def.data.hook || (def.data.hook = {});
  1519. }
  1520. var invoker;
  1521. var oldHook = def[hookKey];
  1522. function wrappedHook() {
  1523. hook.apply(this, arguments);
  1524. // important: remove merged hook to ensure it's called only once
  1525. // and prevent memory leak
  1526. remove$2(invoker.fns, wrappedHook);
  1527. }
  1528. if (isUndef(oldHook)) {
  1529. // no existing hook
  1530. invoker = createFnInvoker([wrappedHook]);
  1531. }
  1532. else {
  1533. /* istanbul ignore if */
  1534. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  1535. // already a merged invoker
  1536. invoker = oldHook;
  1537. invoker.fns.push(wrappedHook);
  1538. }
  1539. else {
  1540. // existing plain hook
  1541. invoker = createFnInvoker([oldHook, wrappedHook]);
  1542. }
  1543. }
  1544. invoker.merged = true;
  1545. def[hookKey] = invoker;
  1546. }
  1547. function extractPropsFromVNodeData(data, Ctor, tag) {
  1548. // we are only extracting raw values here.
  1549. // validation and default values are handled in the child
  1550. // component itself.
  1551. var propOptions = Ctor.options.props;
  1552. if (isUndef(propOptions)) {
  1553. return;
  1554. }
  1555. var res = {};
  1556. var attrs = data.attrs, props = data.props;
  1557. if (isDef(attrs) || isDef(props)) {
  1558. for (var key in propOptions) {
  1559. var altKey = hyphenate(key);
  1560. {
  1561. var keyInLowerCase = key.toLowerCase();
  1562. if (key !== keyInLowerCase && attrs && hasOwn(attrs, keyInLowerCase)) {
  1563. tip("Prop \"".concat(keyInLowerCase, "\" is passed to component ") +
  1564. "".concat(formatComponentName(
  1565. // @ts-expect-error tag is string
  1566. tag || Ctor), ", but the declared prop name is") +
  1567. " \"".concat(key, "\". ") +
  1568. "Note that HTML attributes are case-insensitive and camelCased " +
  1569. "props need to use their kebab-case equivalents when using in-DOM " +
  1570. "templates. You should probably use \"".concat(altKey, "\" instead of \"").concat(key, "\"."));
  1571. }
  1572. }
  1573. checkProp(res, props, key, altKey, true) ||
  1574. checkProp(res, attrs, key, altKey, false);
  1575. }
  1576. }
  1577. return res;
  1578. }
  1579. function checkProp(res, hash, key, altKey, preserve) {
  1580. if (isDef(hash)) {
  1581. if (hasOwn(hash, key)) {
  1582. res[key] = hash[key];
  1583. if (!preserve) {
  1584. delete hash[key];
  1585. }
  1586. return true;
  1587. }
  1588. else if (hasOwn(hash, altKey)) {
  1589. res[key] = hash[altKey];
  1590. if (!preserve) {
  1591. delete hash[altKey];
  1592. }
  1593. return true;
  1594. }
  1595. }
  1596. return false;
  1597. }
  1598. // The template compiler attempts to minimize the need for normalization by
  1599. // statically analyzing the template at compile time.
  1600. //
  1601. // For plain HTML markup, normalization can be completely skipped because the
  1602. // generated render function is guaranteed to return Array<VNode>. There are
  1603. // two cases where extra normalization is needed:
  1604. // 1. When the children contains components - because a functional component
  1605. // may return an Array instead of a single root. In this case, just a simple
  1606. // normalization is needed - if any child is an Array, we flatten the whole
  1607. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  1608. // because functional components already normalize their own children.
  1609. function simpleNormalizeChildren(children) {
  1610. for (var i = 0; i < children.length; i++) {
  1611. if (isArray(children[i])) {
  1612. return Array.prototype.concat.apply([], children);
  1613. }
  1614. }
  1615. return children;
  1616. }
  1617. // 2. When the children contains constructs that always generated nested Arrays,
  1618. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  1619. // with hand-written render functions / JSX. In such cases a full normalization
  1620. // is needed to cater to all possible types of children values.
  1621. function normalizeChildren(children) {
  1622. return isPrimitive(children)
  1623. ? [createTextVNode(children)]
  1624. : isArray(children)
  1625. ? normalizeArrayChildren(children)
  1626. : undefined;
  1627. }
  1628. function isTextNode(node) {
  1629. return isDef(node) && isDef(node.text) && isFalse(node.isComment);
  1630. }
  1631. function normalizeArrayChildren(children, nestedIndex) {
  1632. var res = [];
  1633. var i, c, lastIndex, last;
  1634. for (i = 0; i < children.length; i++) {
  1635. c = children[i];
  1636. if (isUndef(c) || typeof c === 'boolean')
  1637. continue;
  1638. lastIndex = res.length - 1;
  1639. last = res[lastIndex];
  1640. // nested
  1641. if (isArray(c)) {
  1642. if (c.length > 0) {
  1643. c = normalizeArrayChildren(c, "".concat(nestedIndex || '', "_").concat(i));
  1644. // merge adjacent text nodes
  1645. if (isTextNode(c[0]) && isTextNode(last)) {
  1646. res[lastIndex] = createTextVNode(last.text + c[0].text);
  1647. c.shift();
  1648. }
  1649. res.push.apply(res, c);
  1650. }
  1651. }
  1652. else if (isPrimitive(c)) {
  1653. if (isTextNode(last)) {
  1654. // merge adjacent text nodes
  1655. // this is necessary for SSR hydration because text nodes are
  1656. // essentially merged when rendered to HTML strings
  1657. res[lastIndex] = createTextVNode(last.text + c);
  1658. }
  1659. else if (c !== '') {
  1660. // convert primitive to vnode
  1661. res.push(createTextVNode(c));
  1662. }
  1663. }
  1664. else {
  1665. if (isTextNode(c) && isTextNode(last)) {
  1666. // merge adjacent text nodes
  1667. res[lastIndex] = createTextVNode(last.text + c.text);
  1668. }
  1669. else {
  1670. // default key for nested array children (likely generated by v-for)
  1671. if (isTrue(children._isVList) &&
  1672. isDef(c.tag) &&
  1673. isUndef(c.key) &&
  1674. isDef(nestedIndex)) {
  1675. c.key = "__vlist".concat(nestedIndex, "_").concat(i, "__");
  1676. }
  1677. res.push(c);
  1678. }
  1679. }
  1680. }
  1681. return res;
  1682. }
  1683. var SIMPLE_NORMALIZE = 1;
  1684. var ALWAYS_NORMALIZE = 2;
  1685. // wrapper function for providing a more flexible interface
  1686. // without getting yelled at by flow
  1687. function createElement$1(context, tag, data, children, normalizationType, alwaysNormalize) {
  1688. if (isArray(data) || isPrimitive(data)) {
  1689. normalizationType = children;
  1690. children = data;
  1691. data = undefined;
  1692. }
  1693. if (isTrue(alwaysNormalize)) {
  1694. normalizationType = ALWAYS_NORMALIZE;
  1695. }
  1696. return _createElement(context, tag, data, children, normalizationType);
  1697. }
  1698. function _createElement(context, tag, data, children, normalizationType) {
  1699. if (isDef(data) && isDef(data.__ob__)) {
  1700. warn$2("Avoid using observed data object as vnode data: ".concat(JSON.stringify(data), "\n") + 'Always create fresh vnode data objects in each render!', context);
  1701. return createEmptyVNode();
  1702. }
  1703. // object syntax in v-bind
  1704. if (isDef(data) && isDef(data.is)) {
  1705. tag = data.is;
  1706. }
  1707. if (!tag) {
  1708. // in case of component :is set to falsy value
  1709. return createEmptyVNode();
  1710. }
  1711. // warn against non-primitive key
  1712. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)) {
  1713. warn$2('Avoid using non-primitive value as key, ' +
  1714. 'use string/number value instead.', context);
  1715. }
  1716. // support single function children as default scoped slot
  1717. if (isArray(children) && isFunction(children[0])) {
  1718. data = data || {};
  1719. data.scopedSlots = { default: children[0] };
  1720. children.length = 0;
  1721. }
  1722. if (normalizationType === ALWAYS_NORMALIZE) {
  1723. children = normalizeChildren(children);
  1724. }
  1725. else if (normalizationType === SIMPLE_NORMALIZE) {
  1726. children = simpleNormalizeChildren(children);
  1727. }
  1728. var vnode, ns;
  1729. if (typeof tag === 'string') {
  1730. var Ctor = void 0;
  1731. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  1732. if (config.isReservedTag(tag)) {
  1733. // platform built-in elements
  1734. if (isDef(data) &&
  1735. isDef(data.nativeOn) &&
  1736. data.tag !== 'component') {
  1737. warn$2("The .native modifier for v-on is only valid on components but it was used on <".concat(tag, ">."), context);
  1738. }
  1739. vnode = new VNode(config.parsePlatformTagName(tag), data, children, undefined, undefined, context);
  1740. }
  1741. else if ((!data || !data.pre) &&
  1742. isDef((Ctor = resolveAsset(context.$options, 'components', tag)))) {
  1743. // component
  1744. vnode = createComponent(Ctor, data, context, children, tag);
  1745. }
  1746. else {
  1747. // unknown or unlisted namespaced elements
  1748. // check at runtime because it may get assigned a namespace when its
  1749. // parent normalizes children
  1750. vnode = new VNode(tag, data, children, undefined, undefined, context);
  1751. }
  1752. }
  1753. else {
  1754. // direct component options / constructor
  1755. vnode = createComponent(tag, data, context, children);
  1756. }
  1757. if (isArray(vnode)) {
  1758. return vnode;
  1759. }
  1760. else if (isDef(vnode)) {
  1761. if (isDef(ns))
  1762. applyNS(vnode, ns);
  1763. if (isDef(data))
  1764. registerDeepBindings(data);
  1765. return vnode;
  1766. }
  1767. else {
  1768. return createEmptyVNode();
  1769. }
  1770. }
  1771. function applyNS(vnode, ns, force) {
  1772. vnode.ns = ns;
  1773. if (vnode.tag === 'foreignObject') {
  1774. // use default namespace inside foreignObject
  1775. ns = undefined;
  1776. force = true;
  1777. }
  1778. if (isDef(vnode.children)) {
  1779. for (var i = 0, l = vnode.children.length; i < l; i++) {
  1780. var child = vnode.children[i];
  1781. if (isDef(child.tag) &&
  1782. (isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  1783. applyNS(child, ns, force);
  1784. }
  1785. }
  1786. }
  1787. }
  1788. // ref #5318
  1789. // necessary to ensure parent re-render when deep bindings like :style and
  1790. // :class are used on slot nodes
  1791. function registerDeepBindings(data) {
  1792. if (isObject(data.style)) {
  1793. traverse(data.style);
  1794. }
  1795. if (isObject(data.class)) {
  1796. traverse(data.class);
  1797. }
  1798. }
  1799. /**
  1800. * Runtime helper for rendering v-for lists.
  1801. */
  1802. function renderList(val, render) {
  1803. var ret = null, i, l, keys, key;
  1804. if (isArray(val) || typeof val === 'string') {
  1805. ret = new Array(val.length);
  1806. for (i = 0, l = val.length; i < l; i++) {
  1807. ret[i] = render(val[i], i);
  1808. }
  1809. }
  1810. else if (typeof val === 'number') {
  1811. ret = new Array(val);
  1812. for (i = 0; i < val; i++) {
  1813. ret[i] = render(i + 1, i);
  1814. }
  1815. }
  1816. else if (isObject(val)) {
  1817. if (hasSymbol && val[Symbol.iterator]) {
  1818. ret = [];
  1819. var iterator = val[Symbol.iterator]();
  1820. var result = iterator.next();
  1821. while (!result.done) {
  1822. ret.push(render(result.value, ret.length));
  1823. result = iterator.next();
  1824. }
  1825. }
  1826. else {
  1827. keys = Object.keys(val);
  1828. ret = new Array(keys.length);
  1829. for (i = 0, l = keys.length; i < l; i++) {
  1830. key = keys[i];
  1831. ret[i] = render(val[key], key, i);
  1832. }
  1833. }
  1834. }
  1835. if (!isDef(ret)) {
  1836. ret = [];
  1837. }
  1838. ret._isVList = true;
  1839. return ret;
  1840. }
  1841. /**
  1842. * Runtime helper for rendering <slot>
  1843. */
  1844. function renderSlot(name, fallbackRender, props, bindObject) {
  1845. var scopedSlotFn = this.$scopedSlots[name];
  1846. var nodes;
  1847. if (scopedSlotFn) {
  1848. // scoped slot
  1849. props = props || {};
  1850. if (bindObject) {
  1851. if (!isObject(bindObject)) {
  1852. warn$2('slot v-bind without argument expects an Object', this);
  1853. }
  1854. props = extend(extend({}, bindObject), props);
  1855. }
  1856. nodes =
  1857. scopedSlotFn(props) ||
  1858. (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);
  1859. }
  1860. else {
  1861. nodes =
  1862. this.$slots[name] ||
  1863. (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);
  1864. }
  1865. var target = props && props.slot;
  1866. if (target) {
  1867. return this.$createElement('template', { slot: target }, nodes);
  1868. }
  1869. else {
  1870. return nodes;
  1871. }
  1872. }
  1873. /**
  1874. * Runtime helper for resolving filters
  1875. */
  1876. function resolveFilter(id) {
  1877. return resolveAsset(this.$options, 'filters', id, true) || identity;
  1878. }
  1879. function isKeyNotMatch(expect, actual) {
  1880. if (isArray(expect)) {
  1881. return expect.indexOf(actual) === -1;
  1882. }
  1883. else {
  1884. return expect !== actual;
  1885. }
  1886. }
  1887. /**
  1888. * Runtime helper for checking keyCodes from config.
  1889. * exposed as Vue.prototype._k
  1890. * passing in eventKeyName as last argument separately for backwards compat
  1891. */
  1892. function checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInKeyName) {
  1893. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  1894. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  1895. return isKeyNotMatch(builtInKeyName, eventKeyName);
  1896. }
  1897. else if (mappedKeyCode) {
  1898. return isKeyNotMatch(mappedKeyCode, eventKeyCode);
  1899. }
  1900. else if (eventKeyName) {
  1901. return hyphenate(eventKeyName) !== key;
  1902. }
  1903. return eventKeyCode === undefined;
  1904. }
  1905. /**
  1906. * Runtime helper for merging v-bind="object" into a VNode's data.
  1907. */
  1908. function bindObjectProps(data, tag, value, asProp, isSync) {
  1909. if (value) {
  1910. if (!isObject(value)) {
  1911. warn$2('v-bind without argument expects an Object or Array value', this);
  1912. }
  1913. else {
  1914. if (isArray(value)) {
  1915. value = toObject(value);
  1916. }
  1917. var hash = void 0;
  1918. var _loop_1 = function (key) {
  1919. if (key === 'class' || key === 'style' || isReservedAttribute(key)) {
  1920. hash = data;
  1921. }
  1922. else {
  1923. var type = data.attrs && data.attrs.type;
  1924. hash =
  1925. asProp || config.mustUseProp(tag, type, key)
  1926. ? data.domProps || (data.domProps = {})
  1927. : data.attrs || (data.attrs = {});
  1928. }
  1929. var camelizedKey = camelize(key);
  1930. var hyphenatedKey = hyphenate(key);
  1931. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  1932. hash[key] = value[key];
  1933. if (isSync) {
  1934. var on = data.on || (data.on = {});
  1935. on["update:".concat(key)] = function ($event) {
  1936. value[key] = $event;
  1937. };
  1938. }
  1939. }
  1940. };
  1941. for (var key in value) {
  1942. _loop_1(key);
  1943. }
  1944. }
  1945. }
  1946. return data;
  1947. }
  1948. /**
  1949. * Runtime helper for rendering static trees.
  1950. */
  1951. function renderStatic(index, isInFor) {
  1952. var cached = this._staticTrees || (this._staticTrees = []);
  1953. var tree = cached[index];
  1954. // if has already-rendered static tree and not inside v-for,
  1955. // we can reuse the same tree.
  1956. if (tree && !isInFor) {
  1957. return tree;
  1958. }
  1959. // otherwise, render a fresh tree.
  1960. tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, this._c, this // for render fns generated for functional component templates
  1961. );
  1962. markStatic$1(tree, "__static__".concat(index), false);
  1963. return tree;
  1964. }
  1965. /**
  1966. * Runtime helper for v-once.
  1967. * Effectively it means marking the node as static with a unique key.
  1968. */
  1969. function markOnce(tree, index, key) {
  1970. markStatic$1(tree, "__once__".concat(index).concat(key ? "_".concat(key) : ""), true);
  1971. return tree;
  1972. }
  1973. function markStatic$1(tree, key, isOnce) {
  1974. if (isArray(tree)) {
  1975. for (var i = 0; i < tree.length; i++) {
  1976. if (tree[i] && typeof tree[i] !== 'string') {
  1977. markStaticNode(tree[i], "".concat(key, "_").concat(i), isOnce);
  1978. }
  1979. }
  1980. }
  1981. else {
  1982. markStaticNode(tree, key, isOnce);
  1983. }
  1984. }
  1985. function markStaticNode(node, key, isOnce) {
  1986. node.isStatic = true;
  1987. node.key = key;
  1988. node.isOnce = isOnce;
  1989. }
  1990. function bindObjectListeners(data, value) {
  1991. if (value) {
  1992. if (!isPlainObject(value)) {
  1993. warn$2('v-on without argument expects an Object value', this);
  1994. }
  1995. else {
  1996. var on = (data.on = data.on ? extend({}, data.on) : {});
  1997. for (var key in value) {
  1998. var existing = on[key];
  1999. var ours = value[key];
  2000. on[key] = existing ? [].concat(existing, ours) : ours;
  2001. }
  2002. }
  2003. }
  2004. return data;
  2005. }
  2006. function resolveScopedSlots(fns, res,
  2007. // the following are added in 2.6
  2008. hasDynamicKeys, contentHashKey) {
  2009. res = res || { $stable: !hasDynamicKeys };
  2010. for (var i = 0; i < fns.length; i++) {
  2011. var slot = fns[i];
  2012. if (isArray(slot)) {
  2013. resolveScopedSlots(slot, res, hasDynamicKeys);
  2014. }
  2015. else if (slot) {
  2016. // marker for reverse proxying v-slot without scope on this.$slots
  2017. // @ts-expect-error
  2018. if (slot.proxy) {
  2019. // @ts-expect-error
  2020. slot.fn.proxy = true;
  2021. }
  2022. res[slot.key] = slot.fn;
  2023. }
  2024. }
  2025. if (contentHashKey) {
  2026. res.$key = contentHashKey;
  2027. }
  2028. return res;
  2029. }
  2030. // helper to process dynamic keys for dynamic arguments in v-bind and v-on.
  2031. function bindDynamicKeys(baseObj, values) {
  2032. for (var i = 0; i < values.length; i += 2) {
  2033. var key = values[i];
  2034. if (typeof key === 'string' && key) {
  2035. baseObj[values[i]] = values[i + 1];
  2036. }
  2037. else if (key !== '' && key !== null) {
  2038. // null is a special value for explicitly removing a binding
  2039. warn$2("Invalid value for dynamic directive argument (expected string or null): ".concat(key), this);
  2040. }
  2041. }
  2042. return baseObj;
  2043. }
  2044. // helper to dynamically append modifier runtime markers to event names.
  2045. // ensure only append when value is already string, otherwise it will be cast
  2046. // to string and cause the type check to miss.
  2047. function prependModifier(value, symbol) {
  2048. return typeof value === 'string' ? symbol + value : value;
  2049. }
  2050. function installRenderHelpers(target) {
  2051. target._o = markOnce;
  2052. target._n = toNumber;
  2053. target._s = toString;
  2054. target._l = renderList;
  2055. target._t = renderSlot;
  2056. target._q = looseEqual;
  2057. target._i = looseIndexOf;
  2058. target._m = renderStatic;
  2059. target._f = resolveFilter;
  2060. target._k = checkKeyCodes;
  2061. target._b = bindObjectProps;
  2062. target._v = createTextVNode;
  2063. target._e = createEmptyVNode;
  2064. target._u = resolveScopedSlots;
  2065. target._g = bindObjectListeners;
  2066. target._d = bindDynamicKeys;
  2067. target._p = prependModifier;
  2068. }
  2069. /**
  2070. * Runtime helper for resolving raw children VNodes into a slot object.
  2071. */
  2072. function resolveSlots(children, context) {
  2073. if (!children || !children.length) {
  2074. return {};
  2075. }
  2076. var slots = {};
  2077. for (var i = 0, l = children.length; i < l; i++) {
  2078. var child = children[i];
  2079. var data = child.data;
  2080. // remove slot attribute if the node is resolved as a Vue slot node
  2081. if (data && data.attrs && data.attrs.slot) {
  2082. delete data.attrs.slot;
  2083. }
  2084. // named slots should only be respected if the vnode was rendered in the
  2085. // same context.
  2086. if ((child.context === context || child.fnContext === context) &&
  2087. data &&
  2088. data.slot != null) {
  2089. var name_1 = data.slot;
  2090. var slot = slots[name_1] || (slots[name_1] = []);
  2091. if (child.tag === 'template') {
  2092. slot.push.apply(slot, child.children || []);
  2093. }
  2094. else {
  2095. slot.push(child);
  2096. }
  2097. }
  2098. else {
  2099. (slots.default || (slots.default = [])).push(child);
  2100. }
  2101. }
  2102. // ignore slots that contains only whitespace
  2103. for (var name_2 in slots) {
  2104. if (slots[name_2].every(isWhitespace)) {
  2105. delete slots[name_2];
  2106. }
  2107. }
  2108. return slots;
  2109. }
  2110. function isWhitespace(node) {
  2111. return (node.isComment && !node.asyncFactory) || node.text === ' ';
  2112. }
  2113. function isAsyncPlaceholder(node) {
  2114. // @ts-expect-error not really boolean type
  2115. return node.isComment && node.asyncFactory;
  2116. }
  2117. function normalizeScopedSlots(ownerVm, scopedSlots, normalSlots, prevScopedSlots) {
  2118. var res;
  2119. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  2120. var isStable = scopedSlots ? !!scopedSlots.$stable : !hasNormalSlots;
  2121. var key = scopedSlots && scopedSlots.$key;
  2122. if (!scopedSlots) {
  2123. res = {};
  2124. }
  2125. else if (scopedSlots._normalized) {
  2126. // fast path 1: child component re-render only, parent did not change
  2127. return scopedSlots._normalized;
  2128. }
  2129. else if (isStable &&
  2130. prevScopedSlots &&
  2131. prevScopedSlots !== emptyObject &&
  2132. key === prevScopedSlots.$key &&
  2133. !hasNormalSlots &&
  2134. !prevScopedSlots.$hasNormal) {
  2135. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  2136. // only need to normalize once
  2137. return prevScopedSlots;
  2138. }
  2139. else {
  2140. res = {};
  2141. for (var key_1 in scopedSlots) {
  2142. if (scopedSlots[key_1] && key_1[0] !== '$') {
  2143. res[key_1] = normalizeScopedSlot(ownerVm, normalSlots, key_1, scopedSlots[key_1]);
  2144. }
  2145. }
  2146. }
  2147. // expose normal slots on scopedSlots
  2148. for (var key_2 in normalSlots) {
  2149. if (!(key_2 in res)) {
  2150. res[key_2] = proxyNormalSlot(normalSlots, key_2);
  2151. }
  2152. }
  2153. // avoriaz seems to mock a non-extensible $scopedSlots object
  2154. // and when that is passed down this would cause an error
  2155. if (scopedSlots && Object.isExtensible(scopedSlots)) {
  2156. scopedSlots._normalized = res;
  2157. }
  2158. def(res, '$stable', isStable);
  2159. def(res, '$key', key);
  2160. def(res, '$hasNormal', hasNormalSlots);
  2161. return res;
  2162. }
  2163. function normalizeScopedSlot(vm, normalSlots, key, fn) {
  2164. var normalized = function () {
  2165. var cur = currentInstance;
  2166. setCurrentInstance(vm);
  2167. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  2168. res =
  2169. res && typeof res === 'object' && !isArray(res)
  2170. ? [res] // single vnode
  2171. : normalizeChildren(res);
  2172. var vnode = res && res[0];
  2173. setCurrentInstance(cur);
  2174. return res &&
  2175. (!vnode ||
  2176. (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391
  2177. ? undefined
  2178. : res;
  2179. };
  2180. // this is a slot using the new v-slot syntax without scope. although it is
  2181. // compiled as a scoped slot, render fn users would expect it to be present
  2182. // on this.$slots because the usage is semantically a normal slot.
  2183. if (fn.proxy) {
  2184. Object.defineProperty(normalSlots, key, {
  2185. get: normalized,
  2186. enumerable: true,
  2187. configurable: true
  2188. });
  2189. }
  2190. return normalized;
  2191. }
  2192. function proxyNormalSlot(slots, key) {
  2193. return function () { return slots[key]; };
  2194. }
  2195. function initSetup(vm) {
  2196. var options = vm.$options;
  2197. var setup = options.setup;
  2198. if (setup) {
  2199. var ctx = (vm._setupContext = createSetupContext(vm));
  2200. setCurrentInstance(vm);
  2201. pushTarget();
  2202. var setupResult = invokeWithErrorHandling(setup, null, [vm._props || shallowReactive({}), ctx], vm, "setup");
  2203. popTarget();
  2204. setCurrentInstance();
  2205. if (isFunction(setupResult)) {
  2206. // render function
  2207. // @ts-ignore
  2208. options.render = setupResult;
  2209. }
  2210. else if (isObject(setupResult)) {
  2211. // bindings
  2212. if (setupResult instanceof VNode) {
  2213. warn$2("setup() should not return VNodes directly - " +
  2214. "return a render function instead.");
  2215. }
  2216. vm._setupState = setupResult;
  2217. // __sfc indicates compiled bindings from <script setup>
  2218. if (!setupResult.__sfc) {
  2219. for (var key in setupResult) {
  2220. if (!isReserved(key)) {
  2221. proxyWithRefUnwrap(vm, setupResult, key);
  2222. }
  2223. else {
  2224. warn$2("Avoid using variables that start with _ or $ in setup().");
  2225. }
  2226. }
  2227. }
  2228. else {
  2229. // exposed for compiled render fn
  2230. var proxy = (vm._setupProxy = {});
  2231. for (var key in setupResult) {
  2232. if (key !== '__sfc') {
  2233. proxyWithRefUnwrap(proxy, setupResult, key);
  2234. }
  2235. }
  2236. }
  2237. }
  2238. else if (setupResult !== undefined) {
  2239. warn$2("setup() should return an object. Received: ".concat(setupResult === null ? 'null' : typeof setupResult));
  2240. }
  2241. }
  2242. }
  2243. function createSetupContext(vm) {
  2244. var exposeCalled = false;
  2245. return {
  2246. get attrs() {
  2247. if (!vm._attrsProxy) {
  2248. var proxy = (vm._attrsProxy = {});
  2249. def(proxy, '_v_attr_proxy', true);
  2250. syncSetupProxy(proxy, vm.$attrs, emptyObject, vm, '$attrs');
  2251. }
  2252. return vm._attrsProxy;
  2253. },
  2254. get listeners() {
  2255. if (!vm._listenersProxy) {
  2256. var proxy = (vm._listenersProxy = {});
  2257. syncSetupProxy(proxy, vm.$listeners, emptyObject, vm, '$listeners');
  2258. }
  2259. return vm._listenersProxy;
  2260. },
  2261. get slots() {
  2262. return initSlotsProxy(vm);
  2263. },
  2264. emit: bind$1(vm.$emit, vm),
  2265. expose: function (exposed) {
  2266. {
  2267. if (exposeCalled) {
  2268. warn$2("expose() should be called only once per setup().", vm);
  2269. }
  2270. exposeCalled = true;
  2271. }
  2272. if (exposed) {
  2273. Object.keys(exposed).forEach(function (key) {
  2274. return proxyWithRefUnwrap(vm, exposed, key);
  2275. });
  2276. }
  2277. }
  2278. };
  2279. }
  2280. function syncSetupProxy(to, from, prev, instance, type) {
  2281. var changed = false;
  2282. for (var key in from) {
  2283. if (!(key in to)) {
  2284. changed = true;
  2285. defineProxyAttr(to, key, instance, type);
  2286. }
  2287. else if (from[key] !== prev[key]) {
  2288. changed = true;
  2289. }
  2290. }
  2291. for (var key in to) {
  2292. if (!(key in from)) {
  2293. changed = true;
  2294. delete to[key];
  2295. }
  2296. }
  2297. return changed;
  2298. }
  2299. function defineProxyAttr(proxy, key, instance, type) {
  2300. Object.defineProperty(proxy, key, {
  2301. enumerable: true,
  2302. configurable: true,
  2303. get: function () {
  2304. return instance[type][key];
  2305. }
  2306. });
  2307. }
  2308. function initSlotsProxy(vm) {
  2309. if (!vm._slotsProxy) {
  2310. syncSetupSlots((vm._slotsProxy = {}), vm.$scopedSlots);
  2311. }
  2312. return vm._slotsProxy;
  2313. }
  2314. function syncSetupSlots(to, from) {
  2315. for (var key in from) {
  2316. to[key] = from[key];
  2317. }
  2318. for (var key in to) {
  2319. if (!(key in from)) {
  2320. delete to[key];
  2321. }
  2322. }
  2323. }
  2324. /**
  2325. * @internal use manual type def because public setup context type relies on
  2326. * legacy VNode types
  2327. */
  2328. function useSlots() {
  2329. return getContext().slots;
  2330. }
  2331. /**
  2332. * @internal use manual type def because public setup context type relies on
  2333. * legacy VNode types
  2334. */
  2335. function useAttrs() {
  2336. return getContext().attrs;
  2337. }
  2338. /**
  2339. * Vue 2 only
  2340. * @internal use manual type def because public setup context type relies on
  2341. * legacy VNode types
  2342. */
  2343. function useListeners() {
  2344. return getContext().listeners;
  2345. }
  2346. function getContext() {
  2347. if (!currentInstance) {
  2348. warn$2("useContext() called without active instance.");
  2349. }
  2350. var vm = currentInstance;
  2351. return vm._setupContext || (vm._setupContext = createSetupContext(vm));
  2352. }
  2353. /**
  2354. * Runtime helper for merging default declarations. Imported by compiled code
  2355. * only.
  2356. * @internal
  2357. */
  2358. function mergeDefaults(raw, defaults) {
  2359. var props = isArray(raw)
  2360. ? raw.reduce(function (normalized, p) { return ((normalized[p] = {}), normalized); }, {})
  2361. : raw;
  2362. for (var key in defaults) {
  2363. var opt = props[key];
  2364. if (opt) {
  2365. if (isArray(opt) || isFunction(opt)) {
  2366. props[key] = { type: opt, default: defaults[key] };
  2367. }
  2368. else {
  2369. opt.default = defaults[key];
  2370. }
  2371. }
  2372. else if (opt === null) {
  2373. props[key] = { default: defaults[key] };
  2374. }
  2375. else {
  2376. warn$2("props default key \"".concat(key, "\" has no corresponding declaration."));
  2377. }
  2378. }
  2379. return props;
  2380. }
  2381. function initRender(vm) {
  2382. vm._vnode = null; // the root of the child tree
  2383. vm._staticTrees = null; // v-once cached trees
  2384. var options = vm.$options;
  2385. var parentVnode = (vm.$vnode = options._parentVnode); // the placeholder node in parent tree
  2386. var renderContext = parentVnode && parentVnode.context;
  2387. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  2388. vm.$scopedSlots = parentVnode
  2389. ? normalizeScopedSlots(vm.$parent, parentVnode.data.scopedSlots, vm.$slots)
  2390. : emptyObject;
  2391. // bind the createElement fn to this instance
  2392. // so that we get proper render context inside it.
  2393. // args order: tag, data, children, normalizationType, alwaysNormalize
  2394. // internal version is used by render functions compiled from templates
  2395. // @ts-expect-error
  2396. vm._c = function (a, b, c, d) { return createElement$1(vm, a, b, c, d, false); };
  2397. // normalization is always applied for the public version, used in
  2398. // user-written render functions.
  2399. // @ts-expect-error
  2400. vm.$createElement = function (a, b, c, d) { return createElement$1(vm, a, b, c, d, true); };
  2401. // $attrs & $listeners are exposed for easier HOC creation.
  2402. // they need to be reactive so that HOCs using them are always updated
  2403. var parentData = parentVnode && parentVnode.data;
  2404. /* istanbul ignore else */
  2405. {
  2406. defineReactive(vm, '$attrs', (parentData && parentData.attrs) || emptyObject, function () {
  2407. !isUpdatingChildComponent && warn$2("$attrs is readonly.", vm);
  2408. }, true);
  2409. defineReactive(vm, '$listeners', options._parentListeners || emptyObject, function () {
  2410. !isUpdatingChildComponent && warn$2("$listeners is readonly.", vm);
  2411. }, true);
  2412. }
  2413. }
  2414. var currentRenderingInstance = null;
  2415. function renderMixin(Vue) {
  2416. // install runtime convenience helpers
  2417. installRenderHelpers(Vue.prototype);
  2418. Vue.prototype.$nextTick = function (fn) {
  2419. return nextTick(fn, this);
  2420. };
  2421. Vue.prototype._render = function () {
  2422. var vm = this;
  2423. var _a = vm.$options, render = _a.render, _parentVnode = _a._parentVnode;
  2424. if (_parentVnode && vm._isMounted) {
  2425. vm.$scopedSlots = normalizeScopedSlots(vm.$parent, _parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);
  2426. if (vm._slotsProxy) {
  2427. syncSetupSlots(vm._slotsProxy, vm.$scopedSlots);
  2428. }
  2429. }
  2430. // set parent vnode. this allows render functions to have access
  2431. // to the data on the placeholder node.
  2432. vm.$vnode = _parentVnode;
  2433. // render self
  2434. var vnode;
  2435. try {
  2436. // There's no need to maintain a stack because all render fns are called
  2437. // separately from one another. Nested component's render fns are called
  2438. // when parent component is patched.
  2439. setCurrentInstance(vm);
  2440. currentRenderingInstance = vm;
  2441. vnode = render.call(vm._renderProxy, vm.$createElement);
  2442. }
  2443. catch (e) {
  2444. handleError(e, vm, "render");
  2445. // return error render result,
  2446. // or previous vnode to prevent render error causing blank component
  2447. /* istanbul ignore else */
  2448. if (vm.$options.renderError) {
  2449. try {
  2450. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  2451. }
  2452. catch (e) {
  2453. handleError(e, vm, "renderError");
  2454. vnode = vm._vnode;
  2455. }
  2456. }
  2457. else {
  2458. vnode = vm._vnode;
  2459. }
  2460. }
  2461. finally {
  2462. currentRenderingInstance = null;
  2463. setCurrentInstance();
  2464. }
  2465. // if the returned array contains only a single node, allow it
  2466. if (isArray(vnode) && vnode.length === 1) {
  2467. vnode = vnode[0];
  2468. }
  2469. // return empty vnode in case the render function errored out
  2470. if (!(vnode instanceof VNode)) {
  2471. if (isArray(vnode)) {
  2472. warn$2('Multiple root nodes returned from render function. Render function ' +
  2473. 'should return a single root node.', vm);
  2474. }
  2475. vnode = createEmptyVNode();
  2476. }
  2477. // set parent
  2478. vnode.parent = _parentVnode;
  2479. return vnode;
  2480. };
  2481. }
  2482. function ensureCtor(comp, base) {
  2483. if (comp.__esModule || (hasSymbol && comp[Symbol.toStringTag] === 'Module')) {
  2484. comp = comp.default;
  2485. }
  2486. return isObject(comp) ? base.extend(comp) : comp;
  2487. }
  2488. function createAsyncPlaceholder(factory, data, context, children, tag) {
  2489. var node = createEmptyVNode();
  2490. node.asyncFactory = factory;
  2491. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  2492. return node;
  2493. }
  2494. function resolveAsyncComponent(factory, baseCtor) {
  2495. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  2496. return factory.errorComp;
  2497. }
  2498. if (isDef(factory.resolved)) {
  2499. return factory.resolved;
  2500. }
  2501. var owner = currentRenderingInstance;
  2502. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  2503. // already pending
  2504. factory.owners.push(owner);
  2505. }
  2506. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  2507. return factory.loadingComp;
  2508. }
  2509. if (owner && !isDef(factory.owners)) {
  2510. var owners_1 = (factory.owners = [owner]);
  2511. var sync_1 = true;
  2512. var timerLoading_1 = null;
  2513. var timerTimeout_1 = null;
  2514. owner.$on('hook:destroyed', function () { return remove$2(owners_1, owner); });
  2515. var forceRender_1 = function (renderCompleted) {
  2516. for (var i = 0, l = owners_1.length; i < l; i++) {
  2517. owners_1[i].$forceUpdate();
  2518. }
  2519. if (renderCompleted) {
  2520. owners_1.length = 0;
  2521. if (timerLoading_1 !== null) {
  2522. clearTimeout(timerLoading_1);
  2523. timerLoading_1 = null;
  2524. }
  2525. if (timerTimeout_1 !== null) {
  2526. clearTimeout(timerTimeout_1);
  2527. timerTimeout_1 = null;
  2528. }
  2529. }
  2530. };
  2531. var resolve = once(function (res) {
  2532. // cache resolved
  2533. factory.resolved = ensureCtor(res, baseCtor);
  2534. // invoke callbacks only if this is not a synchronous resolve
  2535. // (async resolves are shimmed as synchronous during SSR)
  2536. if (!sync_1) {
  2537. forceRender_1(true);
  2538. }
  2539. else {
  2540. owners_1.length = 0;
  2541. }
  2542. });
  2543. var reject_1 = once(function (reason) {
  2544. warn$2("Failed to resolve async component: ".concat(String(factory)) +
  2545. (reason ? "\nReason: ".concat(reason) : ''));
  2546. if (isDef(factory.errorComp)) {
  2547. factory.error = true;
  2548. forceRender_1(true);
  2549. }
  2550. });
  2551. var res_1 = factory(resolve, reject_1);
  2552. if (isObject(res_1)) {
  2553. if (isPromise(res_1)) {
  2554. // () => Promise
  2555. if (isUndef(factory.resolved)) {
  2556. res_1.then(resolve, reject_1);
  2557. }
  2558. }
  2559. else if (isPromise(res_1.component)) {
  2560. res_1.component.then(resolve, reject_1);
  2561. if (isDef(res_1.error)) {
  2562. factory.errorComp = ensureCtor(res_1.error, baseCtor);
  2563. }
  2564. if (isDef(res_1.loading)) {
  2565. factory.loadingComp = ensureCtor(res_1.loading, baseCtor);
  2566. if (res_1.delay === 0) {
  2567. factory.loading = true;
  2568. }
  2569. else {
  2570. // @ts-expect-error NodeJS timeout type
  2571. timerLoading_1 = setTimeout(function () {
  2572. timerLoading_1 = null;
  2573. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  2574. factory.loading = true;
  2575. forceRender_1(false);
  2576. }
  2577. }, res_1.delay || 200);
  2578. }
  2579. }
  2580. if (isDef(res_1.timeout)) {
  2581. // @ts-expect-error NodeJS timeout type
  2582. timerTimeout_1 = setTimeout(function () {
  2583. timerTimeout_1 = null;
  2584. if (isUndef(factory.resolved)) {
  2585. reject_1("timeout (".concat(res_1.timeout, "ms)") );
  2586. }
  2587. }, res_1.timeout);
  2588. }
  2589. }
  2590. }
  2591. sync_1 = false;
  2592. // return in case resolved synchronously
  2593. return factory.loading ? factory.loadingComp : factory.resolved;
  2594. }
  2595. }
  2596. function getFirstComponentChild(children) {
  2597. if (isArray(children)) {
  2598. for (var i = 0; i < children.length; i++) {
  2599. var c = children[i];
  2600. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  2601. return c;
  2602. }
  2603. }
  2604. }
  2605. }
  2606. function initEvents(vm) {
  2607. vm._events = Object.create(null);
  2608. vm._hasHookEvent = false;
  2609. // init parent attached events
  2610. var listeners = vm.$options._parentListeners;
  2611. if (listeners) {
  2612. updateComponentListeners(vm, listeners);
  2613. }
  2614. }
  2615. var target$1;
  2616. function add$1(event, fn) {
  2617. target$1.$on(event, fn);
  2618. }
  2619. function remove$1(event, fn) {
  2620. target$1.$off(event, fn);
  2621. }
  2622. function createOnceHandler$1(event, fn) {
  2623. var _target = target$1;
  2624. return function onceHandler() {
  2625. var res = fn.apply(null, arguments);
  2626. if (res !== null) {
  2627. _target.$off(event, onceHandler);
  2628. }
  2629. };
  2630. }
  2631. function updateComponentListeners(vm, listeners, oldListeners) {
  2632. target$1 = vm;
  2633. updateListeners(listeners, oldListeners || {}, add$1, remove$1, createOnceHandler$1, vm);
  2634. target$1 = undefined;
  2635. }
  2636. function eventsMixin(Vue) {
  2637. var hookRE = /^hook:/;
  2638. Vue.prototype.$on = function (event, fn) {
  2639. var vm = this;
  2640. if (isArray(event)) {
  2641. for (var i = 0, l = event.length; i < l; i++) {
  2642. vm.$on(event[i], fn);
  2643. }
  2644. }
  2645. else {
  2646. (vm._events[event] || (vm._events[event] = [])).push(fn);
  2647. // optimize hook:event cost by using a boolean flag marked at registration
  2648. // instead of a hash lookup
  2649. if (hookRE.test(event)) {
  2650. vm._hasHookEvent = true;
  2651. }
  2652. }
  2653. return vm;
  2654. };
  2655. Vue.prototype.$once = function (event, fn) {
  2656. var vm = this;
  2657. function on() {
  2658. vm.$off(event, on);
  2659. fn.apply(vm, arguments);
  2660. }
  2661. on.fn = fn;
  2662. vm.$on(event, on);
  2663. return vm;
  2664. };
  2665. Vue.prototype.$off = function (event, fn) {
  2666. var vm = this;
  2667. // all
  2668. if (!arguments.length) {
  2669. vm._events = Object.create(null);
  2670. return vm;
  2671. }
  2672. // array of events
  2673. if (isArray(event)) {
  2674. for (var i_1 = 0, l = event.length; i_1 < l; i_1++) {
  2675. vm.$off(event[i_1], fn);
  2676. }
  2677. return vm;
  2678. }
  2679. // specific event
  2680. var cbs = vm._events[event];
  2681. if (!cbs) {
  2682. return vm;
  2683. }
  2684. if (!fn) {
  2685. vm._events[event] = null;
  2686. return vm;
  2687. }
  2688. // specific handler
  2689. var cb;
  2690. var i = cbs.length;
  2691. while (i--) {
  2692. cb = cbs[i];
  2693. if (cb === fn || cb.fn === fn) {
  2694. cbs.splice(i, 1);
  2695. break;
  2696. }
  2697. }
  2698. return vm;
  2699. };
  2700. Vue.prototype.$emit = function (event) {
  2701. var vm = this;
  2702. {
  2703. var lowerCaseEvent = event.toLowerCase();
  2704. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  2705. tip("Event \"".concat(lowerCaseEvent, "\" is emitted in component ") +
  2706. "".concat(formatComponentName(vm), " but the handler is registered for \"").concat(event, "\". ") +
  2707. "Note that HTML attributes are case-insensitive and you cannot use " +
  2708. "v-on to listen to camelCase events when using in-DOM templates. " +
  2709. "You should probably use \"".concat(hyphenate(event), "\" instead of \"").concat(event, "\"."));
  2710. }
  2711. }
  2712. var cbs = vm._events[event];
  2713. if (cbs) {
  2714. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  2715. var args = toArray(arguments, 1);
  2716. var info = "event handler for \"".concat(event, "\"");
  2717. for (var i = 0, l = cbs.length; i < l; i++) {
  2718. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  2719. }
  2720. }
  2721. return vm;
  2722. };
  2723. }
  2724. var activeInstance = null;
  2725. var isUpdatingChildComponent = false;
  2726. function setActiveInstance(vm) {
  2727. var prevActiveInstance = activeInstance;
  2728. activeInstance = vm;
  2729. return function () {
  2730. activeInstance = prevActiveInstance;
  2731. };
  2732. }
  2733. function initLifecycle(vm) {
  2734. var options = vm.$options;
  2735. // locate first non-abstract parent
  2736. var parent = options.parent;
  2737. if (parent && !options.abstract) {
  2738. while (parent.$options.abstract && parent.$parent) {
  2739. parent = parent.$parent;
  2740. }
  2741. parent.$children.push(vm);
  2742. }
  2743. vm.$parent = parent;
  2744. vm.$root = parent ? parent.$root : vm;
  2745. vm.$children = [];
  2746. vm.$refs = {};
  2747. vm._provided = parent ? parent._provided : Object.create(null);
  2748. vm._watcher = null;
  2749. vm._inactive = null;
  2750. vm._directInactive = false;
  2751. vm._isMounted = false;
  2752. vm._isDestroyed = false;
  2753. vm._isBeingDestroyed = false;
  2754. }
  2755. function lifecycleMixin(Vue) {
  2756. Vue.prototype._update = function (vnode, hydrating) {
  2757. var vm = this;
  2758. var prevEl = vm.$el;
  2759. var prevVnode = vm._vnode;
  2760. var restoreActiveInstance = setActiveInstance(vm);
  2761. vm._vnode = vnode;
  2762. // Vue.prototype.__patch__ is injected in entry points
  2763. // based on the rendering backend used.
  2764. if (!prevVnode) {
  2765. // initial render
  2766. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  2767. }
  2768. else {
  2769. // updates
  2770. vm.$el = vm.__patch__(prevVnode, vnode);
  2771. }
  2772. restoreActiveInstance();
  2773. // update __vue__ reference
  2774. if (prevEl) {
  2775. prevEl.__vue__ = null;
  2776. }
  2777. if (vm.$el) {
  2778. vm.$el.__vue__ = vm;
  2779. }
  2780. // if parent is an HOC, update its $el as well
  2781. var wrapper = vm;
  2782. while (wrapper &&
  2783. wrapper.$vnode &&
  2784. wrapper.$parent &&
  2785. wrapper.$vnode === wrapper.$parent._vnode) {
  2786. wrapper.$parent.$el = wrapper.$el;
  2787. wrapper = wrapper.$parent;
  2788. }
  2789. // updated hook is called by the scheduler to ensure that children are
  2790. // updated in a parent's updated hook.
  2791. };
  2792. Vue.prototype.$forceUpdate = function () {
  2793. var vm = this;
  2794. if (vm._watcher) {
  2795. vm._watcher.update();
  2796. }
  2797. };
  2798. Vue.prototype.$destroy = function () {
  2799. var vm = this;
  2800. if (vm._isBeingDestroyed) {
  2801. return;
  2802. }
  2803. callHook$1(vm, 'beforeDestroy');
  2804. vm._isBeingDestroyed = true;
  2805. // remove self from parent
  2806. var parent = vm.$parent;
  2807. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  2808. remove$2(parent.$children, vm);
  2809. }
  2810. // teardown scope. this includes both the render watcher and other
  2811. // watchers created
  2812. vm._scope.stop();
  2813. // remove reference from data ob
  2814. // frozen object may not have observer.
  2815. if (vm._data.__ob__) {
  2816. vm._data.__ob__.vmCount--;
  2817. }
  2818. // call the last hook...
  2819. vm._isDestroyed = true;
  2820. // invoke destroy hooks on current rendered tree
  2821. vm.__patch__(vm._vnode, null);
  2822. // fire destroyed hook
  2823. callHook$1(vm, 'destroyed');
  2824. // turn off all instance listeners.
  2825. vm.$off();
  2826. // remove __vue__ reference
  2827. if (vm.$el) {
  2828. vm.$el.__vue__ = null;
  2829. }
  2830. // release circular reference (#6759)
  2831. if (vm.$vnode) {
  2832. vm.$vnode.parent = null;
  2833. }
  2834. };
  2835. }
  2836. function mountComponent(vm, el, hydrating) {
  2837. vm.$el = el;
  2838. if (!vm.$options.render) {
  2839. // @ts-expect-error invalid type
  2840. vm.$options.render = createEmptyVNode;
  2841. {
  2842. /* istanbul ignore if */
  2843. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  2844. vm.$options.el ||
  2845. el) {
  2846. warn$2('You are using the runtime-only build of Vue where the template ' +
  2847. 'compiler is not available. Either pre-compile the templates into ' +
  2848. 'render functions, or use the compiler-included build.', vm);
  2849. }
  2850. else {
  2851. warn$2('Failed to mount component: template or render function not defined.', vm);
  2852. }
  2853. }
  2854. }
  2855. callHook$1(vm, 'beforeMount');
  2856. var updateComponent;
  2857. /* istanbul ignore if */
  2858. if (config.performance && mark) {
  2859. updateComponent = function () {
  2860. var name = vm._name;
  2861. var id = vm._uid;
  2862. var startTag = "vue-perf-start:".concat(id);
  2863. var endTag = "vue-perf-end:".concat(id);
  2864. mark(startTag);
  2865. var vnode = vm._render();
  2866. mark(endTag);
  2867. measure("vue ".concat(name, " render"), startTag, endTag);
  2868. mark(startTag);
  2869. vm._update(vnode, hydrating);
  2870. mark(endTag);
  2871. measure("vue ".concat(name, " patch"), startTag, endTag);
  2872. };
  2873. }
  2874. else {
  2875. updateComponent = function () {
  2876. vm._update(vm._render(), hydrating);
  2877. };
  2878. }
  2879. var watcherOptions = {
  2880. before: function () {
  2881. if (vm._isMounted && !vm._isDestroyed) {
  2882. callHook$1(vm, 'beforeUpdate');
  2883. }
  2884. }
  2885. };
  2886. {
  2887. watcherOptions.onTrack = function (e) { return callHook$1(vm, 'renderTracked', [e]); };
  2888. watcherOptions.onTrigger = function (e) { return callHook$1(vm, 'renderTriggered', [e]); };
  2889. }
  2890. // we set this to vm._watcher inside the watcher's constructor
  2891. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  2892. // component's mounted hook), which relies on vm._watcher being already defined
  2893. new Watcher(vm, updateComponent, noop, watcherOptions, true /* isRenderWatcher */);
  2894. hydrating = false;
  2895. // flush buffer for flush: "pre" watchers queued in setup()
  2896. var preWatchers = vm._preWatchers;
  2897. if (preWatchers) {
  2898. for (var i = 0; i < preWatchers.length; i++) {
  2899. preWatchers[i].run();
  2900. }
  2901. }
  2902. // manually mounted instance, call mounted on self
  2903. // mounted is called for render-created child components in its inserted hook
  2904. if (vm.$vnode == null) {
  2905. vm._isMounted = true;
  2906. callHook$1(vm, 'mounted');
  2907. }
  2908. return vm;
  2909. }
  2910. function updateChildComponent(vm, propsData, listeners, parentVnode, renderChildren) {
  2911. {
  2912. isUpdatingChildComponent = true;
  2913. }
  2914. // determine whether component has slot children
  2915. // we need to do this before overwriting $options._renderChildren.
  2916. // check if there are dynamic scopedSlots (hand-written or compiled but with
  2917. // dynamic slot names). Static scoped slots compiled from template has the
  2918. // "$stable" marker.
  2919. var newScopedSlots = parentVnode.data.scopedSlots;
  2920. var oldScopedSlots = vm.$scopedSlots;
  2921. var hasDynamicScopedSlot = !!((newScopedSlots && !newScopedSlots.$stable) ||
  2922. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  2923. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
  2924. (!newScopedSlots && vm.$scopedSlots.$key));
  2925. // Any static slot children from the parent may have changed during parent's
  2926. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  2927. // update is necessary to ensure correctness.
  2928. var needsForceUpdate = !!(renderChildren || // has new static slots
  2929. vm.$options._renderChildren || // has old static slots
  2930. hasDynamicScopedSlot);
  2931. var prevVNode = vm.$vnode;
  2932. vm.$options._parentVnode = parentVnode;
  2933. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  2934. if (vm._vnode) {
  2935. // update child tree's parent
  2936. vm._vnode.parent = parentVnode;
  2937. }
  2938. vm.$options._renderChildren = renderChildren;
  2939. // update $attrs and $listeners hash
  2940. // these are also reactive so they may trigger child update if the child
  2941. // used them during render
  2942. var attrs = parentVnode.data.attrs || emptyObject;
  2943. if (vm._attrsProxy) {
  2944. // force update if attrs are accessed and has changed since it may be
  2945. // passed to a child component.
  2946. if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
  2947. needsForceUpdate = true;
  2948. }
  2949. }
  2950. vm.$attrs = attrs;
  2951. // update listeners
  2952. listeners = listeners || emptyObject;
  2953. var prevListeners = vm.$options._parentListeners;
  2954. if (vm._listenersProxy) {
  2955. syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
  2956. }
  2957. vm.$listeners = vm.$options._parentListeners = listeners;
  2958. updateComponentListeners(vm, listeners, prevListeners);
  2959. // update props
  2960. if (propsData && vm.$options.props) {
  2961. toggleObserving(false);
  2962. var props = vm._props;
  2963. var propKeys = vm.$options._propKeys || [];
  2964. for (var i = 0; i < propKeys.length; i++) {
  2965. var key = propKeys[i];
  2966. var propOptions = vm.$options.props; // wtf flow?
  2967. props[key] = validateProp(key, propOptions, propsData, vm);
  2968. }
  2969. toggleObserving(true);
  2970. // keep a copy of raw propsData
  2971. vm.$options.propsData = propsData;
  2972. }
  2973. // resolve slots + force update if has children
  2974. if (needsForceUpdate) {
  2975. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  2976. vm.$forceUpdate();
  2977. }
  2978. {
  2979. isUpdatingChildComponent = false;
  2980. }
  2981. }
  2982. function isInInactiveTree(vm) {
  2983. while (vm && (vm = vm.$parent)) {
  2984. if (vm._inactive)
  2985. return true;
  2986. }
  2987. return false;
  2988. }
  2989. function activateChildComponent(vm, direct) {
  2990. if (direct) {
  2991. vm._directInactive = false;
  2992. if (isInInactiveTree(vm)) {
  2993. return;
  2994. }
  2995. }
  2996. else if (vm._directInactive) {
  2997. return;
  2998. }
  2999. if (vm._inactive || vm._inactive === null) {
  3000. vm._inactive = false;
  3001. for (var i = 0; i < vm.$children.length; i++) {
  3002. activateChildComponent(vm.$children[i]);
  3003. }
  3004. callHook$1(vm, 'activated');
  3005. }
  3006. }
  3007. function deactivateChildComponent(vm, direct) {
  3008. if (direct) {
  3009. vm._directInactive = true;
  3010. if (isInInactiveTree(vm)) {
  3011. return;
  3012. }
  3013. }
  3014. if (!vm._inactive) {
  3015. vm._inactive = true;
  3016. for (var i = 0; i < vm.$children.length; i++) {
  3017. deactivateChildComponent(vm.$children[i]);
  3018. }
  3019. callHook$1(vm, 'deactivated');
  3020. }
  3021. }
  3022. function callHook$1(vm, hook, args, setContext) {
  3023. if (setContext === void 0) { setContext = true; }
  3024. // #7573 disable dep collection when invoking lifecycle hooks
  3025. pushTarget();
  3026. var prev = currentInstance;
  3027. setContext && setCurrentInstance(vm);
  3028. var handlers = vm.$options[hook];
  3029. var info = "".concat(hook, " hook");
  3030. if (handlers) {
  3031. for (var i = 0, j = handlers.length; i < j; i++) {
  3032. invokeWithErrorHandling(handlers[i], vm, args || null, vm, info);
  3033. }
  3034. }
  3035. if (vm._hasHookEvent) {
  3036. vm.$emit('hook:' + hook);
  3037. }
  3038. setContext && setCurrentInstance(prev);
  3039. popTarget();
  3040. }
  3041. var MAX_UPDATE_COUNT = 100;
  3042. var queue = [];
  3043. var activatedChildren = [];
  3044. var has = {};
  3045. var circular = {};
  3046. var waiting = false;
  3047. var flushing = false;
  3048. var index$1 = 0;
  3049. /**
  3050. * Reset the scheduler's state.
  3051. */
  3052. function resetSchedulerState() {
  3053. index$1 = queue.length = activatedChildren.length = 0;
  3054. has = {};
  3055. {
  3056. circular = {};
  3057. }
  3058. waiting = flushing = false;
  3059. }
  3060. // Async edge case #6566 requires saving the timestamp when event listeners are
  3061. // attached. However, calling performance.now() has a perf overhead especially
  3062. // if the page has thousands of event listeners. Instead, we take a timestamp
  3063. // every time the scheduler flushes and use that for all event listeners
  3064. // attached during that flush.
  3065. var currentFlushTimestamp = 0;
  3066. // Async edge case fix requires storing an event listener's attach timestamp.
  3067. var getNow = Date.now;
  3068. // Determine what event timestamp the browser is using. Annoyingly, the
  3069. // timestamp can either be hi-res (relative to page load) or low-res
  3070. // (relative to UNIX epoch), so in order to compare time we have to use the
  3071. // same timestamp type when saving the flush timestamp.
  3072. // All IE versions use low-res event timestamps, and have problematic clock
  3073. // implementations (#9632)
  3074. if (inBrowser && !isIE) {
  3075. var performance_1 = window.performance;
  3076. if (performance_1 &&
  3077. typeof performance_1.now === 'function' &&
  3078. getNow() > document.createEvent('Event').timeStamp) {
  3079. // if the event timestamp, although evaluated AFTER the Date.now(), is
  3080. // smaller than it, it means the event is using a hi-res timestamp,
  3081. // and we need to use the hi-res version for event listener timestamps as
  3082. // well.
  3083. getNow = function () { return performance_1.now(); };
  3084. }
  3085. }
  3086. var sortCompareFn = function (a, b) {
  3087. if (a.post) {
  3088. if (!b.post)
  3089. return 1;
  3090. }
  3091. else if (b.post) {
  3092. return -1;
  3093. }
  3094. return a.id - b.id;
  3095. };
  3096. /**
  3097. * Flush both queues and run the watchers.
  3098. */
  3099. function flushSchedulerQueue() {
  3100. currentFlushTimestamp = getNow();
  3101. flushing = true;
  3102. var watcher, id;
  3103. // Sort queue before flush.
  3104. // This ensures that:
  3105. // 1. Components are updated from parent to child. (because parent is always
  3106. // created before the child)
  3107. // 2. A component's user watchers are run before its render watcher (because
  3108. // user watchers are created before the render watcher)
  3109. // 3. If a component is destroyed during a parent component's watcher run,
  3110. // its watchers can be skipped.
  3111. queue.sort(sortCompareFn);
  3112. // do not cache length because more watchers might be pushed
  3113. // as we run existing watchers
  3114. for (index$1 = 0; index$1 < queue.length; index$1++) {
  3115. watcher = queue[index$1];
  3116. if (watcher.before) {
  3117. watcher.before();
  3118. }
  3119. id = watcher.id;
  3120. has[id] = null;
  3121. watcher.run();
  3122. // in dev build, check and stop circular updates.
  3123. if (has[id] != null) {
  3124. circular[id] = (circular[id] || 0) + 1;
  3125. if (circular[id] > MAX_UPDATE_COUNT) {
  3126. warn$2('You may have an infinite update loop ' +
  3127. (watcher.user
  3128. ? "in watcher with expression \"".concat(watcher.expression, "\"")
  3129. : "in a component render function."), watcher.vm);
  3130. break;
  3131. }
  3132. }
  3133. }
  3134. // keep copies of post queues before resetting state
  3135. var activatedQueue = activatedChildren.slice();
  3136. var updatedQueue = queue.slice();
  3137. resetSchedulerState();
  3138. // call component updated and activated hooks
  3139. callActivatedHooks(activatedQueue);
  3140. callUpdatedHooks(updatedQueue);
  3141. // devtool hook
  3142. /* istanbul ignore if */
  3143. if (devtools && config.devtools) {
  3144. devtools.emit('flush');
  3145. }
  3146. }
  3147. function callUpdatedHooks(queue) {
  3148. var i = queue.length;
  3149. while (i--) {
  3150. var watcher = queue[i];
  3151. var vm = watcher.vm;
  3152. if (vm && vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3153. callHook$1(vm, 'updated');
  3154. }
  3155. }
  3156. }
  3157. /**
  3158. * Queue a kept-alive component that was activated during patch.
  3159. * The queue will be processed after the entire tree has been patched.
  3160. */
  3161. function queueActivatedComponent(vm) {
  3162. // setting _inactive to false here so that a render function can
  3163. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3164. vm._inactive = false;
  3165. activatedChildren.push(vm);
  3166. }
  3167. function callActivatedHooks(queue) {
  3168. for (var i = 0; i < queue.length; i++) {
  3169. queue[i]._inactive = true;
  3170. activateChildComponent(queue[i], true /* true */);
  3171. }
  3172. }
  3173. /**
  3174. * Push a watcher into the watcher queue.
  3175. * Jobs with duplicate IDs will be skipped unless it's
  3176. * pushed when the queue is being flushed.
  3177. */
  3178. function queueWatcher(watcher) {
  3179. var id = watcher.id;
  3180. if (has[id] != null) {
  3181. return;
  3182. }
  3183. if (watcher === Dep.target && watcher.noRecurse) {
  3184. return;
  3185. }
  3186. has[id] = true;
  3187. if (!flushing) {
  3188. queue.push(watcher);
  3189. }
  3190. else {
  3191. // if already flushing, splice the watcher based on its id
  3192. // if already past its id, it will be run next immediately.
  3193. var i = queue.length - 1;
  3194. while (i > index$1 && queue[i].id > watcher.id) {
  3195. i--;
  3196. }
  3197. queue.splice(i + 1, 0, watcher);
  3198. }
  3199. // queue the flush
  3200. if (!waiting) {
  3201. waiting = true;
  3202. if (!config.async) {
  3203. flushSchedulerQueue();
  3204. return;
  3205. }
  3206. nextTick(flushSchedulerQueue);
  3207. }
  3208. }
  3209. var WATCHER = "watcher";
  3210. var WATCHER_CB = "".concat(WATCHER, " callback");
  3211. var WATCHER_GETTER = "".concat(WATCHER, " getter");
  3212. var WATCHER_CLEANUP = "".concat(WATCHER, " cleanup");
  3213. // Simple effect.
  3214. function watchEffect(effect, options) {
  3215. return doWatch(effect, null, options);
  3216. }
  3217. function watchPostEffect(effect, options) {
  3218. return doWatch(effect, null, (__assign(__assign({}, options), { flush: 'post' }) ));
  3219. }
  3220. function watchSyncEffect(effect, options) {
  3221. return doWatch(effect, null, (__assign(__assign({}, options), { flush: 'sync' }) ));
  3222. }
  3223. // initial value for watchers to trigger on undefined initial values
  3224. var INITIAL_WATCHER_VALUE = {};
  3225. // implementation
  3226. function watch(source, cb, options) {
  3227. if (typeof cb !== 'function') {
  3228. warn$2("`watch(fn, options?)` signature has been moved to a separate API. " +
  3229. "Use `watchEffect(fn, options?)` instead. `watch` now only " +
  3230. "supports `watch(source, cb, options?) signature.");
  3231. }
  3232. return doWatch(source, cb, options);
  3233. }
  3234. function doWatch(source, cb, _a) {
  3235. var _b = _a === void 0 ? emptyObject : _a, immediate = _b.immediate, deep = _b.deep, _c = _b.flush, flush = _c === void 0 ? 'pre' : _c, onTrack = _b.onTrack, onTrigger = _b.onTrigger;
  3236. if (!cb) {
  3237. if (immediate !== undefined) {
  3238. warn$2("watch() \"immediate\" option is only respected when using the " +
  3239. "watch(source, callback, options?) signature.");
  3240. }
  3241. if (deep !== undefined) {
  3242. warn$2("watch() \"deep\" option is only respected when using the " +
  3243. "watch(source, callback, options?) signature.");
  3244. }
  3245. }
  3246. var warnInvalidSource = function (s) {
  3247. warn$2("Invalid watch source: ".concat(s, ". A watch source can only be a getter/effect ") +
  3248. "function, a ref, a reactive object, or an array of these types.");
  3249. };
  3250. var instance = currentInstance;
  3251. var call = function (fn, type, args) {
  3252. if (args === void 0) { args = null; }
  3253. return invokeWithErrorHandling(fn, null, args, instance, type);
  3254. };
  3255. var getter;
  3256. var forceTrigger = false;
  3257. var isMultiSource = false;
  3258. if (isRef(source)) {
  3259. getter = function () { return source.value; };
  3260. forceTrigger = isShallow(source);
  3261. }
  3262. else if (isReactive(source)) {
  3263. getter = function () {
  3264. source.__ob__.dep.depend();
  3265. return source;
  3266. };
  3267. deep = true;
  3268. }
  3269. else if (isArray(source)) {
  3270. isMultiSource = true;
  3271. forceTrigger = source.some(function (s) { return isReactive(s) || isShallow(s); });
  3272. getter = function () {
  3273. return source.map(function (s) {
  3274. if (isRef(s)) {
  3275. return s.value;
  3276. }
  3277. else if (isReactive(s)) {
  3278. return traverse(s);
  3279. }
  3280. else if (isFunction(s)) {
  3281. return call(s, WATCHER_GETTER);
  3282. }
  3283. else {
  3284. warnInvalidSource(s);
  3285. }
  3286. });
  3287. };
  3288. }
  3289. else if (isFunction(source)) {
  3290. if (cb) {
  3291. // getter with cb
  3292. getter = function () { return call(source, WATCHER_GETTER); };
  3293. }
  3294. else {
  3295. // no cb -> simple effect
  3296. getter = function () {
  3297. if (instance && instance._isDestroyed) {
  3298. return;
  3299. }
  3300. if (cleanup) {
  3301. cleanup();
  3302. }
  3303. return call(source, WATCHER, [onCleanup]);
  3304. };
  3305. }
  3306. }
  3307. else {
  3308. getter = noop;
  3309. warnInvalidSource(source);
  3310. }
  3311. if (cb && deep) {
  3312. var baseGetter_1 = getter;
  3313. getter = function () { return traverse(baseGetter_1()); };
  3314. }
  3315. var cleanup;
  3316. var onCleanup = function (fn) {
  3317. cleanup = watcher.onStop = function () {
  3318. call(fn, WATCHER_CLEANUP);
  3319. };
  3320. };
  3321. // in SSR there is no need to setup an actual effect, and it should be noop
  3322. // unless it's eager
  3323. if (isServerRendering()) {
  3324. // we will also not call the invalidate callback (+ runner is not set up)
  3325. onCleanup = noop;
  3326. if (!cb) {
  3327. getter();
  3328. }
  3329. else if (immediate) {
  3330. call(cb, WATCHER_CB, [
  3331. getter(),
  3332. isMultiSource ? [] : undefined,
  3333. onCleanup
  3334. ]);
  3335. }
  3336. return noop;
  3337. }
  3338. var watcher = new Watcher(currentInstance, getter, noop, {
  3339. lazy: true
  3340. });
  3341. watcher.noRecurse = !cb;
  3342. var oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
  3343. // overwrite default run
  3344. watcher.run = function () {
  3345. if (!watcher.active) {
  3346. return;
  3347. }
  3348. if (cb) {
  3349. // watch(source, cb)
  3350. var newValue = watcher.get();
  3351. if (deep ||
  3352. forceTrigger ||
  3353. (isMultiSource
  3354. ? newValue.some(function (v, i) {
  3355. return hasChanged(v, oldValue[i]);
  3356. })
  3357. : hasChanged(newValue, oldValue))) {
  3358. // cleanup before running cb again
  3359. if (cleanup) {
  3360. cleanup();
  3361. }
  3362. call(cb, WATCHER_CB, [
  3363. newValue,
  3364. // pass undefined as the old value when it's changed for the first time
  3365. oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
  3366. onCleanup
  3367. ]);
  3368. oldValue = newValue;
  3369. }
  3370. }
  3371. else {
  3372. // watchEffect
  3373. watcher.get();
  3374. }
  3375. };
  3376. if (flush === 'sync') {
  3377. watcher.update = watcher.run;
  3378. }
  3379. else if (flush === 'post') {
  3380. watcher.post = true;
  3381. watcher.update = function () { return queueWatcher(watcher); };
  3382. }
  3383. else {
  3384. // pre
  3385. watcher.update = function () {
  3386. if (instance && instance === currentInstance && !instance._isMounted) {
  3387. // pre-watcher triggered before
  3388. var buffer = instance._preWatchers || (instance._preWatchers = []);
  3389. if (buffer.indexOf(watcher) < 0)
  3390. buffer.push(watcher);
  3391. }
  3392. else {
  3393. queueWatcher(watcher);
  3394. }
  3395. };
  3396. }
  3397. {
  3398. watcher.onTrack = onTrack;
  3399. watcher.onTrigger = onTrigger;
  3400. }
  3401. // initial run
  3402. if (cb) {
  3403. if (immediate) {
  3404. watcher.run();
  3405. }
  3406. else {
  3407. oldValue = watcher.get();
  3408. }
  3409. }
  3410. else if (flush === 'post' && instance) {
  3411. instance.$once('hook:mounted', function () { return watcher.get(); });
  3412. }
  3413. else {
  3414. watcher.get();
  3415. }
  3416. return function () {
  3417. watcher.teardown();
  3418. };
  3419. }
  3420. var activeEffectScope;
  3421. var EffectScope = /** @class */ (function () {
  3422. function EffectScope(detached) {
  3423. if (detached === void 0) { detached = false; }
  3424. /**
  3425. * @internal
  3426. */
  3427. this.active = true;
  3428. /**
  3429. * @internal
  3430. */
  3431. this.effects = [];
  3432. /**
  3433. * @internal
  3434. */
  3435. this.cleanups = [];
  3436. if (!detached && activeEffectScope) {
  3437. this.parent = activeEffectScope;
  3438. this.index =
  3439. (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
  3440. }
  3441. }
  3442. EffectScope.prototype.run = function (fn) {
  3443. if (this.active) {
  3444. var currentEffectScope = activeEffectScope;
  3445. try {
  3446. activeEffectScope = this;
  3447. return fn();
  3448. }
  3449. finally {
  3450. activeEffectScope = currentEffectScope;
  3451. }
  3452. }
  3453. else {
  3454. warn$2("cannot run an inactive effect scope.");
  3455. }
  3456. };
  3457. /**
  3458. * This should only be called on non-detached scopes
  3459. * @internal
  3460. */
  3461. EffectScope.prototype.on = function () {
  3462. activeEffectScope = this;
  3463. };
  3464. /**
  3465. * This should only be called on non-detached scopes
  3466. * @internal
  3467. */
  3468. EffectScope.prototype.off = function () {
  3469. activeEffectScope = this.parent;
  3470. };
  3471. EffectScope.prototype.stop = function (fromParent) {
  3472. if (this.active) {
  3473. var i = void 0, l = void 0;
  3474. for (i = 0, l = this.effects.length; i < l; i++) {
  3475. this.effects[i].teardown();
  3476. }
  3477. for (i = 0, l = this.cleanups.length; i < l; i++) {
  3478. this.cleanups[i]();
  3479. }
  3480. if (this.scopes) {
  3481. for (i = 0, l = this.scopes.length; i < l; i++) {
  3482. this.scopes[i].stop(true);
  3483. }
  3484. }
  3485. // nested scope, dereference from parent to avoid memory leaks
  3486. if (this.parent && !fromParent) {
  3487. // optimized O(1) removal
  3488. var last = this.parent.scopes.pop();
  3489. if (last && last !== this) {
  3490. this.parent.scopes[this.index] = last;
  3491. last.index = this.index;
  3492. }
  3493. }
  3494. this.active = false;
  3495. }
  3496. };
  3497. return EffectScope;
  3498. }());
  3499. function effectScope(detached) {
  3500. return new EffectScope(detached);
  3501. }
  3502. /**
  3503. * @internal
  3504. */
  3505. function recordEffectScope(effect, scope) {
  3506. if (scope === void 0) { scope = activeEffectScope; }
  3507. if (scope && scope.active) {
  3508. scope.effects.push(effect);
  3509. }
  3510. }
  3511. function getCurrentScope() {
  3512. return activeEffectScope;
  3513. }
  3514. function onScopeDispose(fn) {
  3515. if (activeEffectScope) {
  3516. activeEffectScope.cleanups.push(fn);
  3517. }
  3518. else {
  3519. warn$2("onScopeDispose() is called when there is no active effect scope" +
  3520. " to be associated with.");
  3521. }
  3522. }
  3523. function provide(key, value) {
  3524. if (!currentInstance) {
  3525. {
  3526. warn$2("provide() can only be used inside setup().");
  3527. }
  3528. }
  3529. else {
  3530. // TS doesn't allow symbol as index type
  3531. resolveProvided(currentInstance)[key] = value;
  3532. }
  3533. }
  3534. function resolveProvided(vm) {
  3535. // by default an instance inherits its parent's provides object
  3536. // but when it needs to provide values of its own, it creates its
  3537. // own provides object using parent provides object as prototype.
  3538. // this way in `inject` we can simply look up injections from direct
  3539. // parent and let the prototype chain do the work.
  3540. var existing = vm._provided;
  3541. var parentProvides = vm.$parent && vm.$parent._provided;
  3542. if (parentProvides === existing) {
  3543. return (vm._provided = Object.create(parentProvides));
  3544. }
  3545. else {
  3546. return existing;
  3547. }
  3548. }
  3549. function inject(key, defaultValue, treatDefaultAsFactory) {
  3550. if (treatDefaultAsFactory === void 0) { treatDefaultAsFactory = false; }
  3551. // fallback to `currentRenderingInstance` so that this can be called in
  3552. // a functional component
  3553. var instance = currentInstance;
  3554. if (instance) {
  3555. // #2400
  3556. // to support `app.use` plugins,
  3557. // fallback to appContext's `provides` if the instance is at root
  3558. var provides = instance.$parent && instance.$parent._provided;
  3559. if (provides && key in provides) {
  3560. // TS doesn't allow symbol as index type
  3561. return provides[key];
  3562. }
  3563. else if (arguments.length > 1) {
  3564. return treatDefaultAsFactory && isFunction(defaultValue)
  3565. ? defaultValue.call(instance)
  3566. : defaultValue;
  3567. }
  3568. else {
  3569. warn$2("injection \"".concat(String(key), "\" not found."));
  3570. }
  3571. }
  3572. else {
  3573. warn$2("inject() can only be used inside setup() or functional components.");
  3574. }
  3575. }
  3576. /**
  3577. * @internal this function needs manual public type declaration because it relies
  3578. * on previously manually authored types from Vue 2
  3579. */
  3580. function h(type, props, children) {
  3581. if (!currentInstance) {
  3582. warn$2("globally imported h() can only be invoked when there is an active " +
  3583. "component instance, e.g. synchronously in a component's render or setup function.");
  3584. }
  3585. return createElement$1(currentInstance, type, props, children, 2, true);
  3586. }
  3587. function handleError(err, vm, info) {
  3588. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  3589. // See: https://github.com/vuejs/vuex/issues/1505
  3590. pushTarget();
  3591. try {
  3592. if (vm) {
  3593. var cur = vm;
  3594. while ((cur = cur.$parent)) {
  3595. var hooks = cur.$options.errorCaptured;
  3596. if (hooks) {
  3597. for (var i = 0; i < hooks.length; i++) {
  3598. try {
  3599. var capture = hooks[i].call(cur, err, vm, info) === false;
  3600. if (capture)
  3601. return;
  3602. }
  3603. catch (e) {
  3604. globalHandleError(e, cur, 'errorCaptured hook');
  3605. }
  3606. }
  3607. }
  3608. }
  3609. }
  3610. globalHandleError(err, vm, info);
  3611. }
  3612. finally {
  3613. popTarget();
  3614. }
  3615. }
  3616. function invokeWithErrorHandling(handler, context, args, vm, info) {
  3617. var res;
  3618. try {
  3619. res = args ? handler.apply(context, args) : handler.call(context);
  3620. if (res && !res._isVue && isPromise(res) && !res._handled) {
  3621. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  3622. res._handled = true;
  3623. }
  3624. }
  3625. catch (e) {
  3626. handleError(e, vm, info);
  3627. }
  3628. return res;
  3629. }
  3630. function globalHandleError(err, vm, info) {
  3631. if (config.errorHandler) {
  3632. try {
  3633. return config.errorHandler.call(null, err, vm, info);
  3634. }
  3635. catch (e) {
  3636. // if the user intentionally throws the original error in the handler,
  3637. // do not log it twice
  3638. if (e !== err) {
  3639. logError(e, null, 'config.errorHandler');
  3640. }
  3641. }
  3642. }
  3643. logError(err, vm, info);
  3644. }
  3645. function logError(err, vm, info) {
  3646. {
  3647. warn$2("Error in ".concat(info, ": \"").concat(err.toString(), "\""), vm);
  3648. }
  3649. /* istanbul ignore else */
  3650. if (inBrowser && typeof console !== 'undefined') {
  3651. console.error(err);
  3652. }
  3653. else {
  3654. throw err;
  3655. }
  3656. }
  3657. /* globals MutationObserver */
  3658. var isUsingMicroTask = false;
  3659. var callbacks = [];
  3660. var pending = false;
  3661. function flushCallbacks() {
  3662. pending = false;
  3663. var copies = callbacks.slice(0);
  3664. callbacks.length = 0;
  3665. for (var i = 0; i < copies.length; i++) {
  3666. copies[i]();
  3667. }
  3668. }
  3669. // Here we have async deferring wrappers using microtasks.
  3670. // In 2.5 we used (macro) tasks (in combination with microtasks).
  3671. // However, it has subtle problems when state is changed right before repaint
  3672. // (e.g. #6813, out-in transitions).
  3673. // Also, using (macro) tasks in event handler would cause some weird behaviors
  3674. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  3675. // So we now use microtasks everywhere, again.
  3676. // A major drawback of this tradeoff is that there are some scenarios
  3677. // where microtasks have too high a priority and fire in between supposedly
  3678. // sequential events (e.g. #4521, #6690, which have workarounds)
  3679. // or even between bubbling of the same event (#6566).
  3680. var timerFunc;
  3681. // The nextTick behavior leverages the microtask queue, which can be accessed
  3682. // via either native Promise.then or MutationObserver.
  3683. // MutationObserver has wider support, however it is seriously bugged in
  3684. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  3685. // completely stops working after triggering a few times... so, if native
  3686. // Promise is available, we will use it:
  3687. /* istanbul ignore next, $flow-disable-line */
  3688. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  3689. var p_1 = Promise.resolve();
  3690. timerFunc = function () {
  3691. p_1.then(flushCallbacks);
  3692. // In problematic UIWebViews, Promise.then doesn't completely break, but
  3693. // it can get stuck in a weird state where callbacks are pushed into the
  3694. // microtask queue but the queue isn't being flushed, until the browser
  3695. // needs to do some other work, e.g. handle a timer. Therefore we can
  3696. // "force" the microtask queue to be flushed by adding an empty timer.
  3697. if (isIOS)
  3698. setTimeout(noop);
  3699. };
  3700. isUsingMicroTask = true;
  3701. }
  3702. else if (!isIE &&
  3703. typeof MutationObserver !== 'undefined' &&
  3704. (isNative(MutationObserver) ||
  3705. // PhantomJS and iOS 7.x
  3706. MutationObserver.toString() === '[object MutationObserverConstructor]')) {
  3707. // Use MutationObserver where native Promise is not available,
  3708. // e.g. PhantomJS, iOS7, Android 4.4
  3709. // (#6466 MutationObserver is unreliable in IE11)
  3710. var counter_1 = 1;
  3711. var observer = new MutationObserver(flushCallbacks);
  3712. var textNode_1 = document.createTextNode(String(counter_1));
  3713. observer.observe(textNode_1, {
  3714. characterData: true
  3715. });
  3716. timerFunc = function () {
  3717. counter_1 = (counter_1 + 1) % 2;
  3718. textNode_1.data = String(counter_1);
  3719. };
  3720. isUsingMicroTask = true;
  3721. }
  3722. else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  3723. // Fallback to setImmediate.
  3724. // Technically it leverages the (macro) task queue,
  3725. // but it is still a better choice than setTimeout.
  3726. timerFunc = function () {
  3727. setImmediate(flushCallbacks);
  3728. };
  3729. }
  3730. else {
  3731. // Fallback to setTimeout.
  3732. timerFunc = function () {
  3733. setTimeout(flushCallbacks, 0);
  3734. };
  3735. }
  3736. /**
  3737. * @internal
  3738. */
  3739. function nextTick(cb, ctx) {
  3740. var _resolve;
  3741. callbacks.push(function () {
  3742. if (cb) {
  3743. try {
  3744. cb.call(ctx);
  3745. }
  3746. catch (e) {
  3747. handleError(e, ctx, 'nextTick');
  3748. }
  3749. }
  3750. else if (_resolve) {
  3751. _resolve(ctx);
  3752. }
  3753. });
  3754. if (!pending) {
  3755. pending = true;
  3756. timerFunc();
  3757. }
  3758. // $flow-disable-line
  3759. if (!cb && typeof Promise !== 'undefined') {
  3760. return new Promise(function (resolve) {
  3761. _resolve = resolve;
  3762. });
  3763. }
  3764. }
  3765. function useCssModule(name) {
  3766. /* istanbul ignore else */
  3767. {
  3768. {
  3769. warn$2("useCssModule() is not supported in the global build.");
  3770. }
  3771. return emptyObject;
  3772. }
  3773. }
  3774. /**
  3775. * Runtime helper for SFC's CSS variable injection feature.
  3776. * @private
  3777. */
  3778. function useCssVars(getter) {
  3779. if (!inBrowser && !false)
  3780. return;
  3781. var instance = currentInstance;
  3782. if (!instance) {
  3783. warn$2("useCssVars is called without current active component instance.");
  3784. return;
  3785. }
  3786. watchPostEffect(function () {
  3787. var el = instance.$el;
  3788. var vars = getter(instance, instance._setupProxy);
  3789. if (el && el.nodeType === 1) {
  3790. var style = el.style;
  3791. for (var key in vars) {
  3792. style.setProperty("--".concat(key), vars[key]);
  3793. }
  3794. }
  3795. });
  3796. }
  3797. /**
  3798. * v3-compatible async component API.
  3799. * @internal the type is manually declared in <root>/types/v3-define-async-component.d.ts
  3800. * because it relies on existing manual types
  3801. */
  3802. function defineAsyncComponent(source) {
  3803. if (isFunction(source)) {
  3804. source = { loader: source };
  3805. }
  3806. var loader = source.loader, loadingComponent = source.loadingComponent, errorComponent = source.errorComponent, _a = source.delay, delay = _a === void 0 ? 200 : _a, timeout = source.timeout, // undefined = never times out
  3807. _b = source.suspensible, // undefined = never times out
  3808. suspensible = _b === void 0 ? false : _b, // in Vue 3 default is true
  3809. userOnError = source.onError;
  3810. if (suspensible) {
  3811. warn$2("The suspensiblbe option for async components is not supported in Vue2. It is ignored.");
  3812. }
  3813. var pendingRequest = null;
  3814. var retries = 0;
  3815. var retry = function () {
  3816. retries++;
  3817. pendingRequest = null;
  3818. return load();
  3819. };
  3820. var load = function () {
  3821. var thisRequest;
  3822. return (pendingRequest ||
  3823. (thisRequest = pendingRequest =
  3824. loader()
  3825. .catch(function (err) {
  3826. err = err instanceof Error ? err : new Error(String(err));
  3827. if (userOnError) {
  3828. return new Promise(function (resolve, reject) {
  3829. var userRetry = function () { return resolve(retry()); };
  3830. var userFail = function () { return reject(err); };
  3831. userOnError(err, userRetry, userFail, retries + 1);
  3832. });
  3833. }
  3834. else {
  3835. throw err;
  3836. }
  3837. })
  3838. .then(function (comp) {
  3839. if (thisRequest !== pendingRequest && pendingRequest) {
  3840. return pendingRequest;
  3841. }
  3842. if (!comp) {
  3843. warn$2("Async component loader resolved to undefined. " +
  3844. "If you are using retry(), make sure to return its return value.");
  3845. }
  3846. // interop module default
  3847. if (comp &&
  3848. (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
  3849. comp = comp.default;
  3850. }
  3851. if (comp && !isObject(comp) && !isFunction(comp)) {
  3852. throw new Error("Invalid async component load result: ".concat(comp));
  3853. }
  3854. return comp;
  3855. })));
  3856. };
  3857. return function () {
  3858. var component = load();
  3859. return {
  3860. component: component,
  3861. delay: delay,
  3862. timeout: timeout,
  3863. error: errorComponent,
  3864. loading: loadingComponent
  3865. };
  3866. };
  3867. }
  3868. function createLifeCycle(hookName) {
  3869. return function (fn, target) {
  3870. if (target === void 0) { target = currentInstance; }
  3871. if (!target) {
  3872. warn$2("".concat(formatName(hookName), " is called when there is no active component instance to be ") +
  3873. "associated with. " +
  3874. "Lifecycle injection APIs can only be used during execution of setup().");
  3875. return;
  3876. }
  3877. return injectHook(target, hookName, fn);
  3878. };
  3879. }
  3880. function formatName(name) {
  3881. if (name === 'beforeDestroy') {
  3882. name = 'beforeUnmount';
  3883. }
  3884. else if (name === 'destroyed') {
  3885. name = 'unmounted';
  3886. }
  3887. return "on".concat(name[0].toUpperCase() + name.slice(1));
  3888. }
  3889. function injectHook(instance, hookName, fn) {
  3890. var options = instance.$options;
  3891. options[hookName] = mergeLifecycleHook(options[hookName], fn);
  3892. }
  3893. var onBeforeMount = createLifeCycle('beforeMount');
  3894. var onMounted = createLifeCycle('mounted');
  3895. var onBeforeUpdate = createLifeCycle('beforeUpdate');
  3896. var onUpdated = createLifeCycle('updated');
  3897. var onBeforeUnmount = createLifeCycle('beforeDestroy');
  3898. var onUnmounted = createLifeCycle('destroyed');
  3899. var onActivated = createLifeCycle('activated');
  3900. var onDeactivated = createLifeCycle('deactivated');
  3901. var onServerPrefetch = createLifeCycle('serverPrefetch');
  3902. var onRenderTracked = createLifeCycle('renderTracked');
  3903. var onRenderTriggered = createLifeCycle('renderTriggered');
  3904. var injectErrorCapturedHook = createLifeCycle('errorCaptured');
  3905. function onErrorCaptured(hook, target) {
  3906. if (target === void 0) { target = currentInstance; }
  3907. injectErrorCapturedHook(hook, target);
  3908. }
  3909. /**
  3910. * Note: also update dist/vue.runtime.mjs when adding new exports to this file.
  3911. */
  3912. var version = '2.7.10';
  3913. /**
  3914. * @internal type is manually declared in <root>/types/v3-define-component.d.ts
  3915. */
  3916. function defineComponent(options) {
  3917. return options;
  3918. }
  3919. var vca = /*#__PURE__*/Object.freeze({
  3920. __proto__: null,
  3921. version: version,
  3922. defineComponent: defineComponent,
  3923. ref: ref$1,
  3924. shallowRef: shallowRef,
  3925. isRef: isRef,
  3926. toRef: toRef,
  3927. toRefs: toRefs,
  3928. unref: unref,
  3929. proxyRefs: proxyRefs,
  3930. customRef: customRef,
  3931. triggerRef: triggerRef,
  3932. reactive: reactive,
  3933. isReactive: isReactive,
  3934. isReadonly: isReadonly,
  3935. isShallow: isShallow,
  3936. isProxy: isProxy,
  3937. shallowReactive: shallowReactive,
  3938. markRaw: markRaw,
  3939. toRaw: toRaw,
  3940. readonly: readonly,
  3941. shallowReadonly: shallowReadonly,
  3942. computed: computed,
  3943. watch: watch,
  3944. watchEffect: watchEffect,
  3945. watchPostEffect: watchPostEffect,
  3946. watchSyncEffect: watchSyncEffect,
  3947. EffectScope: EffectScope,
  3948. effectScope: effectScope,
  3949. onScopeDispose: onScopeDispose,
  3950. getCurrentScope: getCurrentScope,
  3951. provide: provide,
  3952. inject: inject,
  3953. h: h,
  3954. getCurrentInstance: getCurrentInstance,
  3955. useSlots: useSlots,
  3956. useAttrs: useAttrs,
  3957. useListeners: useListeners,
  3958. mergeDefaults: mergeDefaults,
  3959. nextTick: nextTick,
  3960. set: set,
  3961. del: del,
  3962. useCssModule: useCssModule,
  3963. useCssVars: useCssVars,
  3964. defineAsyncComponent: defineAsyncComponent,
  3965. onBeforeMount: onBeforeMount,
  3966. onMounted: onMounted,
  3967. onBeforeUpdate: onBeforeUpdate,
  3968. onUpdated: onUpdated,
  3969. onBeforeUnmount: onBeforeUnmount,
  3970. onUnmounted: onUnmounted,
  3971. onActivated: onActivated,
  3972. onDeactivated: onDeactivated,
  3973. onServerPrefetch: onServerPrefetch,
  3974. onRenderTracked: onRenderTracked,
  3975. onRenderTriggered: onRenderTriggered,
  3976. onErrorCaptured: onErrorCaptured
  3977. });
  3978. var seenObjects = new _Set();
  3979. /**
  3980. * Recursively traverse an object to evoke all converted
  3981. * getters, so that every nested property inside the object
  3982. * is collected as a "deep" dependency.
  3983. */
  3984. function traverse(val) {
  3985. _traverse(val, seenObjects);
  3986. seenObjects.clear();
  3987. return val;
  3988. }
  3989. function _traverse(val, seen) {
  3990. var i, keys;
  3991. var isA = isArray(val);
  3992. if ((!isA && !isObject(val)) ||
  3993. Object.isFrozen(val) ||
  3994. val instanceof VNode) {
  3995. return;
  3996. }
  3997. if (val.__ob__) {
  3998. var depId = val.__ob__.dep.id;
  3999. if (seen.has(depId)) {
  4000. return;
  4001. }
  4002. seen.add(depId);
  4003. }
  4004. if (isA) {
  4005. i = val.length;
  4006. while (i--)
  4007. _traverse(val[i], seen);
  4008. }
  4009. else if (isRef(val)) {
  4010. _traverse(val.value, seen);
  4011. }
  4012. else {
  4013. keys = Object.keys(val);
  4014. i = keys.length;
  4015. while (i--)
  4016. _traverse(val[keys[i]], seen);
  4017. }
  4018. }
  4019. var uid$1 = 0;
  4020. /**
  4021. * A watcher parses an expression, collects dependencies,
  4022. * and fires callback when the expression value changes.
  4023. * This is used for both the $watch() api and directives.
  4024. * @internal
  4025. */
  4026. var Watcher = /** @class */ (function () {
  4027. function Watcher(vm, expOrFn, cb, options, isRenderWatcher) {
  4028. recordEffectScope(this,
  4029. // if the active effect scope is manually created (not a component scope),
  4030. // prioritize it
  4031. activeEffectScope && !activeEffectScope._vm
  4032. ? activeEffectScope
  4033. : vm
  4034. ? vm._scope
  4035. : undefined);
  4036. if ((this.vm = vm) && isRenderWatcher) {
  4037. vm._watcher = this;
  4038. }
  4039. // options
  4040. if (options) {
  4041. this.deep = !!options.deep;
  4042. this.user = !!options.user;
  4043. this.lazy = !!options.lazy;
  4044. this.sync = !!options.sync;
  4045. this.before = options.before;
  4046. {
  4047. this.onTrack = options.onTrack;
  4048. this.onTrigger = options.onTrigger;
  4049. }
  4050. }
  4051. else {
  4052. this.deep = this.user = this.lazy = this.sync = false;
  4053. }
  4054. this.cb = cb;
  4055. this.id = ++uid$1; // uid for batching
  4056. this.active = true;
  4057. this.post = false;
  4058. this.dirty = this.lazy; // for lazy watchers
  4059. this.deps = [];
  4060. this.newDeps = [];
  4061. this.depIds = new _Set();
  4062. this.newDepIds = new _Set();
  4063. this.expression = expOrFn.toString() ;
  4064. // parse expression for getter
  4065. if (isFunction(expOrFn)) {
  4066. this.getter = expOrFn;
  4067. }
  4068. else {
  4069. this.getter = parsePath(expOrFn);
  4070. if (!this.getter) {
  4071. this.getter = noop;
  4072. warn$2("Failed watching path: \"".concat(expOrFn, "\" ") +
  4073. 'Watcher only accepts simple dot-delimited paths. ' +
  4074. 'For full control, use a function instead.', vm);
  4075. }
  4076. }
  4077. this.value = this.lazy ? undefined : this.get();
  4078. }
  4079. /**
  4080. * Evaluate the getter, and re-collect dependencies.
  4081. */
  4082. Watcher.prototype.get = function () {
  4083. pushTarget(this);
  4084. var value;
  4085. var vm = this.vm;
  4086. try {
  4087. value = this.getter.call(vm, vm);
  4088. }
  4089. catch (e) {
  4090. if (this.user) {
  4091. handleError(e, vm, "getter for watcher \"".concat(this.expression, "\""));
  4092. }
  4093. else {
  4094. throw e;
  4095. }
  4096. }
  4097. finally {
  4098. // "touch" every property so they are all tracked as
  4099. // dependencies for deep watching
  4100. if (this.deep) {
  4101. traverse(value);
  4102. }
  4103. popTarget();
  4104. this.cleanupDeps();
  4105. }
  4106. return value;
  4107. };
  4108. /**
  4109. * Add a dependency to this directive.
  4110. */
  4111. Watcher.prototype.addDep = function (dep) {
  4112. var id = dep.id;
  4113. if (!this.newDepIds.has(id)) {
  4114. this.newDepIds.add(id);
  4115. this.newDeps.push(dep);
  4116. if (!this.depIds.has(id)) {
  4117. dep.addSub(this);
  4118. }
  4119. }
  4120. };
  4121. /**
  4122. * Clean up for dependency collection.
  4123. */
  4124. Watcher.prototype.cleanupDeps = function () {
  4125. var i = this.deps.length;
  4126. while (i--) {
  4127. var dep = this.deps[i];
  4128. if (!this.newDepIds.has(dep.id)) {
  4129. dep.removeSub(this);
  4130. }
  4131. }
  4132. var tmp = this.depIds;
  4133. this.depIds = this.newDepIds;
  4134. this.newDepIds = tmp;
  4135. this.newDepIds.clear();
  4136. tmp = this.deps;
  4137. this.deps = this.newDeps;
  4138. this.newDeps = tmp;
  4139. this.newDeps.length = 0;
  4140. };
  4141. /**
  4142. * Subscriber interface.
  4143. * Will be called when a dependency changes.
  4144. */
  4145. Watcher.prototype.update = function () {
  4146. /* istanbul ignore else */
  4147. if (this.lazy) {
  4148. this.dirty = true;
  4149. }
  4150. else if (this.sync) {
  4151. this.run();
  4152. }
  4153. else {
  4154. queueWatcher(this);
  4155. }
  4156. };
  4157. /**
  4158. * Scheduler job interface.
  4159. * Will be called by the scheduler.
  4160. */
  4161. Watcher.prototype.run = function () {
  4162. if (this.active) {
  4163. var value = this.get();
  4164. if (value !== this.value ||
  4165. // Deep watchers and watchers on Object/Arrays should fire even
  4166. // when the value is the same, because the value may
  4167. // have mutated.
  4168. isObject(value) ||
  4169. this.deep) {
  4170. // set new value
  4171. var oldValue = this.value;
  4172. this.value = value;
  4173. if (this.user) {
  4174. var info = "callback for watcher \"".concat(this.expression, "\"");
  4175. invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);
  4176. }
  4177. else {
  4178. this.cb.call(this.vm, value, oldValue);
  4179. }
  4180. }
  4181. }
  4182. };
  4183. /**
  4184. * Evaluate the value of the watcher.
  4185. * This only gets called for lazy watchers.
  4186. */
  4187. Watcher.prototype.evaluate = function () {
  4188. this.value = this.get();
  4189. this.dirty = false;
  4190. };
  4191. /**
  4192. * Depend on all deps collected by this watcher.
  4193. */
  4194. Watcher.prototype.depend = function () {
  4195. var i = this.deps.length;
  4196. while (i--) {
  4197. this.deps[i].depend();
  4198. }
  4199. };
  4200. /**
  4201. * Remove self from all dependencies' subscriber list.
  4202. */
  4203. Watcher.prototype.teardown = function () {
  4204. if (this.vm && !this.vm._isBeingDestroyed) {
  4205. remove$2(this.vm._scope.effects, this);
  4206. }
  4207. if (this.active) {
  4208. var i = this.deps.length;
  4209. while (i--) {
  4210. this.deps[i].removeSub(this);
  4211. }
  4212. this.active = false;
  4213. if (this.onStop) {
  4214. this.onStop();
  4215. }
  4216. }
  4217. };
  4218. return Watcher;
  4219. }());
  4220. var sharedPropertyDefinition = {
  4221. enumerable: true,
  4222. configurable: true,
  4223. get: noop,
  4224. set: noop
  4225. };
  4226. function proxy(target, sourceKey, key) {
  4227. sharedPropertyDefinition.get = function proxyGetter() {
  4228. return this[sourceKey][key];
  4229. };
  4230. sharedPropertyDefinition.set = function proxySetter(val) {
  4231. this[sourceKey][key] = val;
  4232. };
  4233. Object.defineProperty(target, key, sharedPropertyDefinition);
  4234. }
  4235. function initState(vm) {
  4236. var opts = vm.$options;
  4237. if (opts.props)
  4238. initProps$1(vm, opts.props);
  4239. // Composition API
  4240. initSetup(vm);
  4241. if (opts.methods)
  4242. initMethods(vm, opts.methods);
  4243. if (opts.data) {
  4244. initData(vm);
  4245. }
  4246. else {
  4247. var ob = observe((vm._data = {}));
  4248. ob && ob.vmCount++;
  4249. }
  4250. if (opts.computed)
  4251. initComputed$1(vm, opts.computed);
  4252. if (opts.watch && opts.watch !== nativeWatch) {
  4253. initWatch(vm, opts.watch);
  4254. }
  4255. }
  4256. function initProps$1(vm, propsOptions) {
  4257. var propsData = vm.$options.propsData || {};
  4258. var props = (vm._props = shallowReactive({}));
  4259. // cache prop keys so that future props updates can iterate using Array
  4260. // instead of dynamic object key enumeration.
  4261. var keys = (vm.$options._propKeys = []);
  4262. var isRoot = !vm.$parent;
  4263. // root instance props should be converted
  4264. if (!isRoot) {
  4265. toggleObserving(false);
  4266. }
  4267. var _loop_1 = function (key) {
  4268. keys.push(key);
  4269. var value = validateProp(key, propsOptions, propsData, vm);
  4270. /* istanbul ignore else */
  4271. {
  4272. var hyphenatedKey = hyphenate(key);
  4273. if (isReservedAttribute(hyphenatedKey) ||
  4274. config.isReservedAttr(hyphenatedKey)) {
  4275. warn$2("\"".concat(hyphenatedKey, "\" is a reserved attribute and cannot be used as component prop."), vm);
  4276. }
  4277. defineReactive(props, key, value, function () {
  4278. if (!isRoot && !isUpdatingChildComponent) {
  4279. warn$2("Avoid mutating a prop directly since the value will be " +
  4280. "overwritten whenever the parent component re-renders. " +
  4281. "Instead, use a data or computed property based on the prop's " +
  4282. "value. Prop being mutated: \"".concat(key, "\""), vm);
  4283. }
  4284. });
  4285. }
  4286. // static props are already proxied on the component's prototype
  4287. // during Vue.extend(). We only need to proxy props defined at
  4288. // instantiation here.
  4289. if (!(key in vm)) {
  4290. proxy(vm, "_props", key);
  4291. }
  4292. };
  4293. for (var key in propsOptions) {
  4294. _loop_1(key);
  4295. }
  4296. toggleObserving(true);
  4297. }
  4298. function initData(vm) {
  4299. var data = vm.$options.data;
  4300. data = vm._data = isFunction(data) ? getData(data, vm) : data || {};
  4301. if (!isPlainObject(data)) {
  4302. data = {};
  4303. warn$2('data functions should return an object:\n' +
  4304. 'https://v2.vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm);
  4305. }
  4306. // proxy data on instance
  4307. var keys = Object.keys(data);
  4308. var props = vm.$options.props;
  4309. var methods = vm.$options.methods;
  4310. var i = keys.length;
  4311. while (i--) {
  4312. var key = keys[i];
  4313. {
  4314. if (methods && hasOwn(methods, key)) {
  4315. warn$2("Method \"".concat(key, "\" has already been defined as a data property."), vm);
  4316. }
  4317. }
  4318. if (props && hasOwn(props, key)) {
  4319. warn$2("The data property \"".concat(key, "\" is already declared as a prop. ") +
  4320. "Use prop default value instead.", vm);
  4321. }
  4322. else if (!isReserved(key)) {
  4323. proxy(vm, "_data", key);
  4324. }
  4325. }
  4326. // observe data
  4327. var ob = observe(data);
  4328. ob && ob.vmCount++;
  4329. }
  4330. function getData(data, vm) {
  4331. // #7573 disable dep collection when invoking data getters
  4332. pushTarget();
  4333. try {
  4334. return data.call(vm, vm);
  4335. }
  4336. catch (e) {
  4337. handleError(e, vm, "data()");
  4338. return {};
  4339. }
  4340. finally {
  4341. popTarget();
  4342. }
  4343. }
  4344. var computedWatcherOptions = { lazy: true };
  4345. function initComputed$1(vm, computed) {
  4346. // $flow-disable-line
  4347. var watchers = (vm._computedWatchers = Object.create(null));
  4348. // computed properties are just getters during SSR
  4349. var isSSR = isServerRendering();
  4350. for (var key in computed) {
  4351. var userDef = computed[key];
  4352. var getter = isFunction(userDef) ? userDef : userDef.get;
  4353. if (getter == null) {
  4354. warn$2("Getter is missing for computed property \"".concat(key, "\"."), vm);
  4355. }
  4356. if (!isSSR) {
  4357. // create internal watcher for the computed property.
  4358. watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);
  4359. }
  4360. // component-defined computed properties are already defined on the
  4361. // component prototype. We only need to define computed properties defined
  4362. // at instantiation here.
  4363. if (!(key in vm)) {
  4364. defineComputed(vm, key, userDef);
  4365. }
  4366. else {
  4367. if (key in vm.$data) {
  4368. warn$2("The computed property \"".concat(key, "\" is already defined in data."), vm);
  4369. }
  4370. else if (vm.$options.props && key in vm.$options.props) {
  4371. warn$2("The computed property \"".concat(key, "\" is already defined as a prop."), vm);
  4372. }
  4373. else if (vm.$options.methods && key in vm.$options.methods) {
  4374. warn$2("The computed property \"".concat(key, "\" is already defined as a method."), vm);
  4375. }
  4376. }
  4377. }
  4378. }
  4379. function defineComputed(target, key, userDef) {
  4380. var shouldCache = !isServerRendering();
  4381. if (isFunction(userDef)) {
  4382. sharedPropertyDefinition.get = shouldCache
  4383. ? createComputedGetter(key)
  4384. : createGetterInvoker(userDef);
  4385. sharedPropertyDefinition.set = noop;
  4386. }
  4387. else {
  4388. sharedPropertyDefinition.get = userDef.get
  4389. ? shouldCache && userDef.cache !== false
  4390. ? createComputedGetter(key)
  4391. : createGetterInvoker(userDef.get)
  4392. : noop;
  4393. sharedPropertyDefinition.set = userDef.set || noop;
  4394. }
  4395. if (sharedPropertyDefinition.set === noop) {
  4396. sharedPropertyDefinition.set = function () {
  4397. warn$2("Computed property \"".concat(key, "\" was assigned to but it has no setter."), this);
  4398. };
  4399. }
  4400. Object.defineProperty(target, key, sharedPropertyDefinition);
  4401. }
  4402. function createComputedGetter(key) {
  4403. return function computedGetter() {
  4404. var watcher = this._computedWatchers && this._computedWatchers[key];
  4405. if (watcher) {
  4406. if (watcher.dirty) {
  4407. watcher.evaluate();
  4408. }
  4409. if (Dep.target) {
  4410. if (Dep.target.onTrack) {
  4411. Dep.target.onTrack({
  4412. effect: Dep.target,
  4413. target: this,
  4414. type: "get" /* TrackOpTypes.GET */,
  4415. key: key
  4416. });
  4417. }
  4418. watcher.depend();
  4419. }
  4420. return watcher.value;
  4421. }
  4422. };
  4423. }
  4424. function createGetterInvoker(fn) {
  4425. return function computedGetter() {
  4426. return fn.call(this, this);
  4427. };
  4428. }
  4429. function initMethods(vm, methods) {
  4430. var props = vm.$options.props;
  4431. for (var key in methods) {
  4432. {
  4433. if (typeof methods[key] !== 'function') {
  4434. warn$2("Method \"".concat(key, "\" has type \"").concat(typeof methods[key], "\" in the component definition. ") +
  4435. "Did you reference the function correctly?", vm);
  4436. }
  4437. if (props && hasOwn(props, key)) {
  4438. warn$2("Method \"".concat(key, "\" has already been defined as a prop."), vm);
  4439. }
  4440. if (key in vm && isReserved(key)) {
  4441. warn$2("Method \"".concat(key, "\" conflicts with an existing Vue instance method. ") +
  4442. "Avoid defining component methods that start with _ or $.");
  4443. }
  4444. }
  4445. vm[key] = typeof methods[key] !== 'function' ? noop : bind$1(methods[key], vm);
  4446. }
  4447. }
  4448. function initWatch(vm, watch) {
  4449. for (var key in watch) {
  4450. var handler = watch[key];
  4451. if (isArray(handler)) {
  4452. for (var i = 0; i < handler.length; i++) {
  4453. createWatcher(vm, key, handler[i]);
  4454. }
  4455. }
  4456. else {
  4457. createWatcher(vm, key, handler);
  4458. }
  4459. }
  4460. }
  4461. function createWatcher(vm, expOrFn, handler, options) {
  4462. if (isPlainObject(handler)) {
  4463. options = handler;
  4464. handler = handler.handler;
  4465. }
  4466. if (typeof handler === 'string') {
  4467. handler = vm[handler];
  4468. }
  4469. return vm.$watch(expOrFn, handler, options);
  4470. }
  4471. function stateMixin(Vue) {
  4472. // flow somehow has problems with directly declared definition object
  4473. // when using Object.defineProperty, so we have to procedurally build up
  4474. // the object here.
  4475. var dataDef = {};
  4476. dataDef.get = function () {
  4477. return this._data;
  4478. };
  4479. var propsDef = {};
  4480. propsDef.get = function () {
  4481. return this._props;
  4482. };
  4483. {
  4484. dataDef.set = function () {
  4485. warn$2('Avoid replacing instance root $data. ' +
  4486. 'Use nested data properties instead.', this);
  4487. };
  4488. propsDef.set = function () {
  4489. warn$2("$props is readonly.", this);
  4490. };
  4491. }
  4492. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4493. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4494. Vue.prototype.$set = set;
  4495. Vue.prototype.$delete = del;
  4496. Vue.prototype.$watch = function (expOrFn, cb, options) {
  4497. var vm = this;
  4498. if (isPlainObject(cb)) {
  4499. return createWatcher(vm, expOrFn, cb, options);
  4500. }
  4501. options = options || {};
  4502. options.user = true;
  4503. var watcher = new Watcher(vm, expOrFn, cb, options);
  4504. if (options.immediate) {
  4505. var info = "callback for immediate watcher \"".concat(watcher.expression, "\"");
  4506. pushTarget();
  4507. invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
  4508. popTarget();
  4509. }
  4510. return function unwatchFn() {
  4511. watcher.teardown();
  4512. };
  4513. };
  4514. }
  4515. function initProvide(vm) {
  4516. var provideOption = vm.$options.provide;
  4517. if (provideOption) {
  4518. var provided = isFunction(provideOption)
  4519. ? provideOption.call(vm)
  4520. : provideOption;
  4521. if (!isObject(provided)) {
  4522. return;
  4523. }
  4524. var source = resolveProvided(vm);
  4525. // IE9 doesn't support Object.getOwnPropertyDescriptors so we have to
  4526. // iterate the keys ourselves.
  4527. var keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided);
  4528. for (var i = 0; i < keys.length; i++) {
  4529. var key = keys[i];
  4530. Object.defineProperty(source, key, Object.getOwnPropertyDescriptor(provided, key));
  4531. }
  4532. }
  4533. }
  4534. function initInjections(vm) {
  4535. var result = resolveInject(vm.$options.inject, vm);
  4536. if (result) {
  4537. toggleObserving(false);
  4538. Object.keys(result).forEach(function (key) {
  4539. /* istanbul ignore else */
  4540. {
  4541. defineReactive(vm, key, result[key], function () {
  4542. warn$2("Avoid mutating an injected value directly since the changes will be " +
  4543. "overwritten whenever the provided component re-renders. " +
  4544. "injection being mutated: \"".concat(key, "\""), vm);
  4545. });
  4546. }
  4547. });
  4548. toggleObserving(true);
  4549. }
  4550. }
  4551. function resolveInject(inject, vm) {
  4552. if (inject) {
  4553. // inject is :any because flow is not smart enough to figure out cached
  4554. var result = Object.create(null);
  4555. var keys = hasSymbol ? Reflect.ownKeys(inject) : Object.keys(inject);
  4556. for (var i = 0; i < keys.length; i++) {
  4557. var key = keys[i];
  4558. // #6574 in case the inject object is observed...
  4559. if (key === '__ob__')
  4560. continue;
  4561. var provideKey = inject[key].from;
  4562. if (provideKey in vm._provided) {
  4563. result[key] = vm._provided[provideKey];
  4564. }
  4565. else if ('default' in inject[key]) {
  4566. var provideDefault = inject[key].default;
  4567. result[key] = isFunction(provideDefault)
  4568. ? provideDefault.call(vm)
  4569. : provideDefault;
  4570. }
  4571. else {
  4572. warn$2("Injection \"".concat(key, "\" not found"), vm);
  4573. }
  4574. }
  4575. return result;
  4576. }
  4577. }
  4578. var uid = 0;
  4579. function initMixin$1(Vue) {
  4580. Vue.prototype._init = function (options) {
  4581. var vm = this;
  4582. // a uid
  4583. vm._uid = uid++;
  4584. var startTag, endTag;
  4585. /* istanbul ignore if */
  4586. if (config.performance && mark) {
  4587. startTag = "vue-perf-start:".concat(vm._uid);
  4588. endTag = "vue-perf-end:".concat(vm._uid);
  4589. mark(startTag);
  4590. }
  4591. // a flag to mark this as a Vue instance without having to do instanceof
  4592. // check
  4593. vm._isVue = true;
  4594. // avoid instances from being observed
  4595. vm.__v_skip = true;
  4596. // effect scope
  4597. vm._scope = new EffectScope(true /* detached */);
  4598. vm._scope._vm = true;
  4599. // merge options
  4600. if (options && options._isComponent) {
  4601. // optimize internal component instantiation
  4602. // since dynamic options merging is pretty slow, and none of the
  4603. // internal component options needs special treatment.
  4604. initInternalComponent(vm, options);
  4605. }
  4606. else {
  4607. vm.$options = mergeOptions(resolveConstructorOptions(vm.constructor), options || {}, vm);
  4608. }
  4609. /* istanbul ignore else */
  4610. {
  4611. initProxy(vm);
  4612. }
  4613. // expose real self
  4614. vm._self = vm;
  4615. initLifecycle(vm);
  4616. initEvents(vm);
  4617. initRender(vm);
  4618. callHook$1(vm, 'beforeCreate', undefined, false /* setContext */);
  4619. initInjections(vm); // resolve injections before data/props
  4620. initState(vm);
  4621. initProvide(vm); // resolve provide after data/props
  4622. callHook$1(vm, 'created');
  4623. /* istanbul ignore if */
  4624. if (config.performance && mark) {
  4625. vm._name = formatComponentName(vm, false);
  4626. mark(endTag);
  4627. measure("vue ".concat(vm._name, " init"), startTag, endTag);
  4628. }
  4629. if (vm.$options.el) {
  4630. vm.$mount(vm.$options.el);
  4631. }
  4632. };
  4633. }
  4634. function initInternalComponent(vm, options) {
  4635. var opts = (vm.$options = Object.create(vm.constructor.options));
  4636. // doing this because it's faster than dynamic enumeration.
  4637. var parentVnode = options._parentVnode;
  4638. opts.parent = options.parent;
  4639. opts._parentVnode = parentVnode;
  4640. var vnodeComponentOptions = parentVnode.componentOptions;
  4641. opts.propsData = vnodeComponentOptions.propsData;
  4642. opts._parentListeners = vnodeComponentOptions.listeners;
  4643. opts._renderChildren = vnodeComponentOptions.children;
  4644. opts._componentTag = vnodeComponentOptions.tag;
  4645. if (options.render) {
  4646. opts.render = options.render;
  4647. opts.staticRenderFns = options.staticRenderFns;
  4648. }
  4649. }
  4650. function resolveConstructorOptions(Ctor) {
  4651. var options = Ctor.options;
  4652. if (Ctor.super) {
  4653. var superOptions = resolveConstructorOptions(Ctor.super);
  4654. var cachedSuperOptions = Ctor.superOptions;
  4655. if (superOptions !== cachedSuperOptions) {
  4656. // super option changed,
  4657. // need to resolve new options.
  4658. Ctor.superOptions = superOptions;
  4659. // check if there are any late-modified/attached options (#4976)
  4660. var modifiedOptions = resolveModifiedOptions(Ctor);
  4661. // update base extend options
  4662. if (modifiedOptions) {
  4663. extend(Ctor.extendOptions, modifiedOptions);
  4664. }
  4665. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4666. if (options.name) {
  4667. options.components[options.name] = Ctor;
  4668. }
  4669. }
  4670. }
  4671. return options;
  4672. }
  4673. function resolveModifiedOptions(Ctor) {
  4674. var modified;
  4675. var latest = Ctor.options;
  4676. var sealed = Ctor.sealedOptions;
  4677. for (var key in latest) {
  4678. if (latest[key] !== sealed[key]) {
  4679. if (!modified)
  4680. modified = {};
  4681. modified[key] = latest[key];
  4682. }
  4683. }
  4684. return modified;
  4685. }
  4686. function FunctionalRenderContext(data, props, children, parent, Ctor) {
  4687. var _this = this;
  4688. var options = Ctor.options;
  4689. // ensure the createElement function in functional components
  4690. // gets a unique context - this is necessary for correct named slot check
  4691. var contextVm;
  4692. if (hasOwn(parent, '_uid')) {
  4693. contextVm = Object.create(parent);
  4694. contextVm._original = parent;
  4695. }
  4696. else {
  4697. // the context vm passed in is a functional context as well.
  4698. // in this case we want to make sure we are able to get a hold to the
  4699. // real context instance.
  4700. contextVm = parent;
  4701. // @ts-ignore
  4702. parent = parent._original;
  4703. }
  4704. var isCompiled = isTrue(options._compiled);
  4705. var needNormalization = !isCompiled;
  4706. this.data = data;
  4707. this.props = props;
  4708. this.children = children;
  4709. this.parent = parent;
  4710. this.listeners = data.on || emptyObject;
  4711. this.injections = resolveInject(options.inject, parent);
  4712. this.slots = function () {
  4713. if (!_this.$slots) {
  4714. normalizeScopedSlots(parent, data.scopedSlots, (_this.$slots = resolveSlots(children, parent)));
  4715. }
  4716. return _this.$slots;
  4717. };
  4718. Object.defineProperty(this, 'scopedSlots', {
  4719. enumerable: true,
  4720. get: function () {
  4721. return normalizeScopedSlots(parent, data.scopedSlots, this.slots());
  4722. }
  4723. });
  4724. // support for compiled functional template
  4725. if (isCompiled) {
  4726. // exposing $options for renderStatic()
  4727. this.$options = options;
  4728. // pre-resolve slots for renderSlot()
  4729. this.$slots = this.slots();
  4730. this.$scopedSlots = normalizeScopedSlots(parent, data.scopedSlots, this.$slots);
  4731. }
  4732. if (options._scopeId) {
  4733. this._c = function (a, b, c, d) {
  4734. var vnode = createElement$1(contextVm, a, b, c, d, needNormalization);
  4735. if (vnode && !isArray(vnode)) {
  4736. vnode.fnScopeId = options._scopeId;
  4737. vnode.fnContext = parent;
  4738. }
  4739. return vnode;
  4740. };
  4741. }
  4742. else {
  4743. this._c = function (a, b, c, d) {
  4744. return createElement$1(contextVm, a, b, c, d, needNormalization);
  4745. };
  4746. }
  4747. }
  4748. installRenderHelpers(FunctionalRenderContext.prototype);
  4749. function createFunctionalComponent(Ctor, propsData, data, contextVm, children) {
  4750. var options = Ctor.options;
  4751. var props = {};
  4752. var propOptions = options.props;
  4753. if (isDef(propOptions)) {
  4754. for (var key in propOptions) {
  4755. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  4756. }
  4757. }
  4758. else {
  4759. if (isDef(data.attrs))
  4760. mergeProps(props, data.attrs);
  4761. if (isDef(data.props))
  4762. mergeProps(props, data.props);
  4763. }
  4764. var renderContext = new FunctionalRenderContext(data, props, children, contextVm, Ctor);
  4765. var vnode = options.render.call(null, renderContext._c, renderContext);
  4766. if (vnode instanceof VNode) {
  4767. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext);
  4768. }
  4769. else if (isArray(vnode)) {
  4770. var vnodes = normalizeChildren(vnode) || [];
  4771. var res = new Array(vnodes.length);
  4772. for (var i = 0; i < vnodes.length; i++) {
  4773. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  4774. }
  4775. return res;
  4776. }
  4777. }
  4778. function cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) {
  4779. // #7817 clone node before setting fnContext, otherwise if the node is reused
  4780. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  4781. // that should not be matched to match.
  4782. var clone = cloneVNode(vnode);
  4783. clone.fnContext = contextVm;
  4784. clone.fnOptions = options;
  4785. {
  4786. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext =
  4787. renderContext;
  4788. }
  4789. if (data.slot) {
  4790. (clone.data || (clone.data = {})).slot = data.slot;
  4791. }
  4792. return clone;
  4793. }
  4794. function mergeProps(to, from) {
  4795. for (var key in from) {
  4796. to[camelize(key)] = from[key];
  4797. }
  4798. }
  4799. function getComponentName(options) {
  4800. return options.name || options.__name || options._componentTag;
  4801. }
  4802. // inline hooks to be invoked on component VNodes during patch
  4803. var componentVNodeHooks = {
  4804. init: function (vnode, hydrating) {
  4805. if (vnode.componentInstance &&
  4806. !vnode.componentInstance._isDestroyed &&
  4807. vnode.data.keepAlive) {
  4808. // kept-alive components, treat as a patch
  4809. var mountedNode = vnode; // work around flow
  4810. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  4811. }
  4812. else {
  4813. var child = (vnode.componentInstance = createComponentInstanceForVnode(vnode, activeInstance));
  4814. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  4815. }
  4816. },
  4817. prepatch: function (oldVnode, vnode) {
  4818. var options = vnode.componentOptions;
  4819. var child = (vnode.componentInstance = oldVnode.componentInstance);
  4820. updateChildComponent(child, options.propsData, // updated props
  4821. options.listeners, // updated listeners
  4822. vnode, // new parent vnode
  4823. options.children // new children
  4824. );
  4825. },
  4826. insert: function (vnode) {
  4827. var context = vnode.context, componentInstance = vnode.componentInstance;
  4828. if (!componentInstance._isMounted) {
  4829. componentInstance._isMounted = true;
  4830. callHook$1(componentInstance, 'mounted');
  4831. }
  4832. if (vnode.data.keepAlive) {
  4833. if (context._isMounted) {
  4834. // vue-router#1212
  4835. // During updates, a kept-alive component's child components may
  4836. // change, so directly walking the tree here may call activated hooks
  4837. // on incorrect children. Instead we push them into a queue which will
  4838. // be processed after the whole patch process ended.
  4839. queueActivatedComponent(componentInstance);
  4840. }
  4841. else {
  4842. activateChildComponent(componentInstance, true /* direct */);
  4843. }
  4844. }
  4845. },
  4846. destroy: function (vnode) {
  4847. var componentInstance = vnode.componentInstance;
  4848. if (!componentInstance._isDestroyed) {
  4849. if (!vnode.data.keepAlive) {
  4850. componentInstance.$destroy();
  4851. }
  4852. else {
  4853. deactivateChildComponent(componentInstance, true /* direct */);
  4854. }
  4855. }
  4856. }
  4857. };
  4858. var hooksToMerge = Object.keys(componentVNodeHooks);
  4859. function createComponent(Ctor, data, context, children, tag) {
  4860. if (isUndef(Ctor)) {
  4861. return;
  4862. }
  4863. var baseCtor = context.$options._base;
  4864. // plain options object: turn it into a constructor
  4865. if (isObject(Ctor)) {
  4866. Ctor = baseCtor.extend(Ctor);
  4867. }
  4868. // if at this stage it's not a constructor or an async component factory,
  4869. // reject.
  4870. if (typeof Ctor !== 'function') {
  4871. {
  4872. warn$2("Invalid Component definition: ".concat(String(Ctor)), context);
  4873. }
  4874. return;
  4875. }
  4876. // async component
  4877. var asyncFactory;
  4878. // @ts-expect-error
  4879. if (isUndef(Ctor.cid)) {
  4880. asyncFactory = Ctor;
  4881. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  4882. if (Ctor === undefined) {
  4883. // return a placeholder node for async component, which is rendered
  4884. // as a comment node but preserves all the raw information for the node.
  4885. // the information will be used for async server-rendering and hydration.
  4886. return createAsyncPlaceholder(asyncFactory, data, context, children, tag);
  4887. }
  4888. }
  4889. data = data || {};
  4890. // resolve constructor options in case global mixins are applied after
  4891. // component constructor creation
  4892. resolveConstructorOptions(Ctor);
  4893. // transform component v-model data into props & events
  4894. if (isDef(data.model)) {
  4895. // @ts-expect-error
  4896. transformModel(Ctor.options, data);
  4897. }
  4898. // extract props
  4899. // @ts-expect-error
  4900. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  4901. // functional component
  4902. // @ts-expect-error
  4903. if (isTrue(Ctor.options.functional)) {
  4904. return createFunctionalComponent(Ctor, propsData, data, context, children);
  4905. }
  4906. // extract listeners, since these needs to be treated as
  4907. // child component listeners instead of DOM listeners
  4908. var listeners = data.on;
  4909. // replace with listeners with .native modifier
  4910. // so it gets processed during parent component patch.
  4911. data.on = data.nativeOn;
  4912. // @ts-expect-error
  4913. if (isTrue(Ctor.options.abstract)) {
  4914. // abstract components do not keep anything
  4915. // other than props & listeners & slot
  4916. // work around flow
  4917. var slot = data.slot;
  4918. data = {};
  4919. if (slot) {
  4920. data.slot = slot;
  4921. }
  4922. }
  4923. // install component management hooks onto the placeholder node
  4924. installComponentHooks(data);
  4925. // return a placeholder vnode
  4926. // @ts-expect-error
  4927. var name = getComponentName(Ctor.options) || tag;
  4928. var vnode = new VNode(
  4929. // @ts-expect-error
  4930. "vue-component-".concat(Ctor.cid).concat(name ? "-".concat(name) : ''), data, undefined, undefined, undefined, context,
  4931. // @ts-expect-error
  4932. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, asyncFactory);
  4933. return vnode;
  4934. }
  4935. function createComponentInstanceForVnode(
  4936. // we know it's MountedComponentVNode but flow doesn't
  4937. vnode,
  4938. // activeInstance in lifecycle state
  4939. parent) {
  4940. var options = {
  4941. _isComponent: true,
  4942. _parentVnode: vnode,
  4943. parent: parent
  4944. };
  4945. // check inline-template render functions
  4946. var inlineTemplate = vnode.data.inlineTemplate;
  4947. if (isDef(inlineTemplate)) {
  4948. options.render = inlineTemplate.render;
  4949. options.staticRenderFns = inlineTemplate.staticRenderFns;
  4950. }
  4951. return new vnode.componentOptions.Ctor(options);
  4952. }
  4953. function installComponentHooks(data) {
  4954. var hooks = data.hook || (data.hook = {});
  4955. for (var i = 0; i < hooksToMerge.length; i++) {
  4956. var key = hooksToMerge[i];
  4957. var existing = hooks[key];
  4958. var toMerge = componentVNodeHooks[key];
  4959. // @ts-expect-error
  4960. if (existing !== toMerge && !(existing && existing._merged)) {
  4961. hooks[key] = existing ? mergeHook(toMerge, existing) : toMerge;
  4962. }
  4963. }
  4964. }
  4965. function mergeHook(f1, f2) {
  4966. var merged = function (a, b) {
  4967. // flow complains about extra args which is why we use any
  4968. f1(a, b);
  4969. f2(a, b);
  4970. };
  4971. merged._merged = true;
  4972. return merged;
  4973. }
  4974. // transform component v-model info (value and callback) into
  4975. // prop and event handler respectively.
  4976. function transformModel(options, data) {
  4977. var prop = (options.model && options.model.prop) || 'value';
  4978. var event = (options.model && options.model.event) || 'input';
  4979. (data.attrs || (data.attrs = {}))[prop] = data.model.value;
  4980. var on = data.on || (data.on = {});
  4981. var existing = on[event];
  4982. var callback = data.model.callback;
  4983. if (isDef(existing)) {
  4984. if (isArray(existing)
  4985. ? existing.indexOf(callback) === -1
  4986. : existing !== callback) {
  4987. on[event] = [callback].concat(existing);
  4988. }
  4989. }
  4990. else {
  4991. on[event] = callback;
  4992. }
  4993. }
  4994. var warn$2 = noop;
  4995. var tip = noop;
  4996. var generateComponentTrace; // work around flow check
  4997. var formatComponentName;
  4998. {
  4999. var hasConsole_1 = typeof console !== 'undefined';
  5000. var classifyRE_1 = /(?:^|[-_])(\w)/g;
  5001. var classify_1 = function (str) {
  5002. return str.replace(classifyRE_1, function (c) { return c.toUpperCase(); }).replace(/[-_]/g, '');
  5003. };
  5004. warn$2 = function (msg, vm) {
  5005. if (vm === void 0) { vm = currentInstance; }
  5006. var trace = vm ? generateComponentTrace(vm) : '';
  5007. if (config.warnHandler) {
  5008. config.warnHandler.call(null, msg, vm, trace);
  5009. }
  5010. else if (hasConsole_1 && !config.silent) {
  5011. console.error("[Vue warn]: ".concat(msg).concat(trace));
  5012. }
  5013. };
  5014. tip = function (msg, vm) {
  5015. if (hasConsole_1 && !config.silent) {
  5016. console.warn("[Vue tip]: ".concat(msg) + (vm ? generateComponentTrace(vm) : ''));
  5017. }
  5018. };
  5019. formatComponentName = function (vm, includeFile) {
  5020. if (vm.$root === vm) {
  5021. return '<Root>';
  5022. }
  5023. var options = isFunction(vm) && vm.cid != null
  5024. ? vm.options
  5025. : vm._isVue
  5026. ? vm.$options || vm.constructor.options
  5027. : vm;
  5028. var name = getComponentName(options);
  5029. var file = options.__file;
  5030. if (!name && file) {
  5031. var match = file.match(/([^/\\]+)\.vue$/);
  5032. name = match && match[1];
  5033. }
  5034. return ((name ? "<".concat(classify_1(name), ">") : "<Anonymous>") +
  5035. (file && includeFile !== false ? " at ".concat(file) : ''));
  5036. };
  5037. var repeat_1 = function (str, n) {
  5038. var res = '';
  5039. while (n) {
  5040. if (n % 2 === 1)
  5041. res += str;
  5042. if (n > 1)
  5043. str += str;
  5044. n >>= 1;
  5045. }
  5046. return res;
  5047. };
  5048. generateComponentTrace = function (vm) {
  5049. if (vm._isVue && vm.$parent) {
  5050. var tree = [];
  5051. var currentRecursiveSequence = 0;
  5052. while (vm) {
  5053. if (tree.length > 0) {
  5054. var last = tree[tree.length - 1];
  5055. if (last.constructor === vm.constructor) {
  5056. currentRecursiveSequence++;
  5057. vm = vm.$parent;
  5058. continue;
  5059. }
  5060. else if (currentRecursiveSequence > 0) {
  5061. tree[tree.length - 1] = [last, currentRecursiveSequence];
  5062. currentRecursiveSequence = 0;
  5063. }
  5064. }
  5065. tree.push(vm);
  5066. vm = vm.$parent;
  5067. }
  5068. return ('\n\nfound in\n\n' +
  5069. tree
  5070. .map(function (vm, i) {
  5071. return "".concat(i === 0 ? '---> ' : repeat_1(' ', 5 + i * 2)).concat(isArray(vm)
  5072. ? "".concat(formatComponentName(vm[0]), "... (").concat(vm[1], " recursive calls)")
  5073. : formatComponentName(vm));
  5074. })
  5075. .join('\n'));
  5076. }
  5077. else {
  5078. return "\n\n(found in ".concat(formatComponentName(vm), ")");
  5079. }
  5080. };
  5081. }
  5082. /**
  5083. * Option overwriting strategies are functions that handle
  5084. * how to merge a parent option value and a child option
  5085. * value into the final value.
  5086. */
  5087. var strats = config.optionMergeStrategies;
  5088. /**
  5089. * Options with restrictions
  5090. */
  5091. {
  5092. strats.el = strats.propsData = function (parent, child, vm, key) {
  5093. if (!vm) {
  5094. warn$2("option \"".concat(key, "\" can only be used during instance ") +
  5095. 'creation with the `new` keyword.');
  5096. }
  5097. return defaultStrat(parent, child);
  5098. };
  5099. }
  5100. /**
  5101. * Helper that recursively merges two data objects together.
  5102. */
  5103. function mergeData(to, from) {
  5104. if (!from)
  5105. return to;
  5106. var key, toVal, fromVal;
  5107. var keys = hasSymbol
  5108. ? Reflect.ownKeys(from)
  5109. : Object.keys(from);
  5110. for (var i = 0; i < keys.length; i++) {
  5111. key = keys[i];
  5112. // in case the object is already observed...
  5113. if (key === '__ob__')
  5114. continue;
  5115. toVal = to[key];
  5116. fromVal = from[key];
  5117. if (!hasOwn(to, key)) {
  5118. set(to, key, fromVal);
  5119. }
  5120. else if (toVal !== fromVal &&
  5121. isPlainObject(toVal) &&
  5122. isPlainObject(fromVal)) {
  5123. mergeData(toVal, fromVal);
  5124. }
  5125. }
  5126. return to;
  5127. }
  5128. /**
  5129. * Data
  5130. */
  5131. function mergeDataOrFn(parentVal, childVal, vm) {
  5132. if (!vm) {
  5133. // in a Vue.extend merge, both should be functions
  5134. if (!childVal) {
  5135. return parentVal;
  5136. }
  5137. if (!parentVal) {
  5138. return childVal;
  5139. }
  5140. // when parentVal & childVal are both present,
  5141. // we need to return a function that returns the
  5142. // merged result of both functions... no need to
  5143. // check if parentVal is a function here because
  5144. // it has to be a function to pass previous merges.
  5145. return function mergedDataFn() {
  5146. return mergeData(isFunction(childVal) ? childVal.call(this, this) : childVal, isFunction(parentVal) ? parentVal.call(this, this) : parentVal);
  5147. };
  5148. }
  5149. else {
  5150. return function mergedInstanceDataFn() {
  5151. // instance merge
  5152. var instanceData = isFunction(childVal)
  5153. ? childVal.call(vm, vm)
  5154. : childVal;
  5155. var defaultData = isFunction(parentVal)
  5156. ? parentVal.call(vm, vm)
  5157. : parentVal;
  5158. if (instanceData) {
  5159. return mergeData(instanceData, defaultData);
  5160. }
  5161. else {
  5162. return defaultData;
  5163. }
  5164. };
  5165. }
  5166. }
  5167. strats.data = function (parentVal, childVal, vm) {
  5168. if (!vm) {
  5169. if (childVal && typeof childVal !== 'function') {
  5170. warn$2('The "data" option should be a function ' +
  5171. 'that returns a per-instance value in component ' +
  5172. 'definitions.', vm);
  5173. return parentVal;
  5174. }
  5175. return mergeDataOrFn(parentVal, childVal);
  5176. }
  5177. return mergeDataOrFn(parentVal, childVal, vm);
  5178. };
  5179. /**
  5180. * Hooks and props are merged as arrays.
  5181. */
  5182. function mergeLifecycleHook(parentVal, childVal) {
  5183. var res = childVal
  5184. ? parentVal
  5185. ? parentVal.concat(childVal)
  5186. : isArray(childVal)
  5187. ? childVal
  5188. : [childVal]
  5189. : parentVal;
  5190. return res ? dedupeHooks(res) : res;
  5191. }
  5192. function dedupeHooks(hooks) {
  5193. var res = [];
  5194. for (var i = 0; i < hooks.length; i++) {
  5195. if (res.indexOf(hooks[i]) === -1) {
  5196. res.push(hooks[i]);
  5197. }
  5198. }
  5199. return res;
  5200. }
  5201. LIFECYCLE_HOOKS.forEach(function (hook) {
  5202. strats[hook] = mergeLifecycleHook;
  5203. });
  5204. /**
  5205. * Assets
  5206. *
  5207. * When a vm is present (instance creation), we need to do
  5208. * a three-way merge between constructor options, instance
  5209. * options and parent options.
  5210. */
  5211. function mergeAssets(parentVal, childVal, vm, key) {
  5212. var res = Object.create(parentVal || null);
  5213. if (childVal) {
  5214. assertObjectType(key, childVal, vm);
  5215. return extend(res, childVal);
  5216. }
  5217. else {
  5218. return res;
  5219. }
  5220. }
  5221. ASSET_TYPES.forEach(function (type) {
  5222. strats[type + 's'] = mergeAssets;
  5223. });
  5224. /**
  5225. * Watchers.
  5226. *
  5227. * Watchers hashes should not overwrite one
  5228. * another, so we merge them as arrays.
  5229. */
  5230. strats.watch = function (parentVal, childVal, vm, key) {
  5231. // work around Firefox's Object.prototype.watch...
  5232. //@ts-expect-error work around
  5233. if (parentVal === nativeWatch)
  5234. parentVal = undefined;
  5235. //@ts-expect-error work around
  5236. if (childVal === nativeWatch)
  5237. childVal = undefined;
  5238. /* istanbul ignore if */
  5239. if (!childVal)
  5240. return Object.create(parentVal || null);
  5241. {
  5242. assertObjectType(key, childVal, vm);
  5243. }
  5244. if (!parentVal)
  5245. return childVal;
  5246. var ret = {};
  5247. extend(ret, parentVal);
  5248. for (var key_1 in childVal) {
  5249. var parent_1 = ret[key_1];
  5250. var child = childVal[key_1];
  5251. if (parent_1 && !isArray(parent_1)) {
  5252. parent_1 = [parent_1];
  5253. }
  5254. ret[key_1] = parent_1 ? parent_1.concat(child) : isArray(child) ? child : [child];
  5255. }
  5256. return ret;
  5257. };
  5258. /**
  5259. * Other object hashes.
  5260. */
  5261. strats.props =
  5262. strats.methods =
  5263. strats.inject =
  5264. strats.computed =
  5265. function (parentVal, childVal, vm, key) {
  5266. if (childVal && true) {
  5267. assertObjectType(key, childVal, vm);
  5268. }
  5269. if (!parentVal)
  5270. return childVal;
  5271. var ret = Object.create(null);
  5272. extend(ret, parentVal);
  5273. if (childVal)
  5274. extend(ret, childVal);
  5275. return ret;
  5276. };
  5277. strats.provide = mergeDataOrFn;
  5278. /**
  5279. * Default strategy.
  5280. */
  5281. var defaultStrat = function (parentVal, childVal) {
  5282. return childVal === undefined ? parentVal : childVal;
  5283. };
  5284. /**
  5285. * Validate component names
  5286. */
  5287. function checkComponents(options) {
  5288. for (var key in options.components) {
  5289. validateComponentName(key);
  5290. }
  5291. }
  5292. function validateComponentName(name) {
  5293. if (!new RegExp("^[a-zA-Z][\\-\\.0-9_".concat(unicodeRegExp.source, "]*$")).test(name)) {
  5294. warn$2('Invalid component name: "' +
  5295. name +
  5296. '". Component names ' +
  5297. 'should conform to valid custom element name in html5 specification.');
  5298. }
  5299. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  5300. warn$2('Do not use built-in or reserved HTML elements as component ' +
  5301. 'id: ' +
  5302. name);
  5303. }
  5304. }
  5305. /**
  5306. * Ensure all props option syntax are normalized into the
  5307. * Object-based format.
  5308. */
  5309. function normalizeProps(options, vm) {
  5310. var props = options.props;
  5311. if (!props)
  5312. return;
  5313. var res = {};
  5314. var i, val, name;
  5315. if (isArray(props)) {
  5316. i = props.length;
  5317. while (i--) {
  5318. val = props[i];
  5319. if (typeof val === 'string') {
  5320. name = camelize(val);
  5321. res[name] = { type: null };
  5322. }
  5323. else {
  5324. warn$2('props must be strings when using array syntax.');
  5325. }
  5326. }
  5327. }
  5328. else if (isPlainObject(props)) {
  5329. for (var key in props) {
  5330. val = props[key];
  5331. name = camelize(key);
  5332. res[name] = isPlainObject(val) ? val : { type: val };
  5333. }
  5334. }
  5335. else {
  5336. warn$2("Invalid value for option \"props\": expected an Array or an Object, " +
  5337. "but got ".concat(toRawType(props), "."), vm);
  5338. }
  5339. options.props = res;
  5340. }
  5341. /**
  5342. * Normalize all injections into Object-based format
  5343. */
  5344. function normalizeInject(options, vm) {
  5345. var inject = options.inject;
  5346. if (!inject)
  5347. return;
  5348. var normalized = (options.inject = {});
  5349. if (isArray(inject)) {
  5350. for (var i = 0; i < inject.length; i++) {
  5351. normalized[inject[i]] = { from: inject[i] };
  5352. }
  5353. }
  5354. else if (isPlainObject(inject)) {
  5355. for (var key in inject) {
  5356. var val = inject[key];
  5357. normalized[key] = isPlainObject(val)
  5358. ? extend({ from: key }, val)
  5359. : { from: val };
  5360. }
  5361. }
  5362. else {
  5363. warn$2("Invalid value for option \"inject\": expected an Array or an Object, " +
  5364. "but got ".concat(toRawType(inject), "."), vm);
  5365. }
  5366. }
  5367. /**
  5368. * Normalize raw function directives into object format.
  5369. */
  5370. function normalizeDirectives$1(options) {
  5371. var dirs = options.directives;
  5372. if (dirs) {
  5373. for (var key in dirs) {
  5374. var def = dirs[key];
  5375. if (isFunction(def)) {
  5376. dirs[key] = { bind: def, update: def };
  5377. }
  5378. }
  5379. }
  5380. }
  5381. function assertObjectType(name, value, vm) {
  5382. if (!isPlainObject(value)) {
  5383. warn$2("Invalid value for option \"".concat(name, "\": expected an Object, ") +
  5384. "but got ".concat(toRawType(value), "."), vm);
  5385. }
  5386. }
  5387. /**
  5388. * Merge two option objects into a new one.
  5389. * Core utility used in both instantiation and inheritance.
  5390. */
  5391. function mergeOptions(parent, child, vm) {
  5392. {
  5393. checkComponents(child);
  5394. }
  5395. if (isFunction(child)) {
  5396. // @ts-expect-error
  5397. child = child.options;
  5398. }
  5399. normalizeProps(child, vm);
  5400. normalizeInject(child, vm);
  5401. normalizeDirectives$1(child);
  5402. // Apply extends and mixins on the child options,
  5403. // but only if it is a raw options object that isn't
  5404. // the result of another mergeOptions call.
  5405. // Only merged options has the _base property.
  5406. if (!child._base) {
  5407. if (child.extends) {
  5408. parent = mergeOptions(parent, child.extends, vm);
  5409. }
  5410. if (child.mixins) {
  5411. for (var i = 0, l = child.mixins.length; i < l; i++) {
  5412. parent = mergeOptions(parent, child.mixins[i], vm);
  5413. }
  5414. }
  5415. }
  5416. var options = {};
  5417. var key;
  5418. for (key in parent) {
  5419. mergeField(key);
  5420. }
  5421. for (key in child) {
  5422. if (!hasOwn(parent, key)) {
  5423. mergeField(key);
  5424. }
  5425. }
  5426. function mergeField(key) {
  5427. var strat = strats[key] || defaultStrat;
  5428. options[key] = strat(parent[key], child[key], vm, key);
  5429. }
  5430. return options;
  5431. }
  5432. /**
  5433. * Resolve an asset.
  5434. * This function is used because child instances need access
  5435. * to assets defined in its ancestor chain.
  5436. */
  5437. function resolveAsset(options, type, id, warnMissing) {
  5438. /* istanbul ignore if */
  5439. if (typeof id !== 'string') {
  5440. return;
  5441. }
  5442. var assets = options[type];
  5443. // check local registration variations first
  5444. if (hasOwn(assets, id))
  5445. return assets[id];
  5446. var camelizedId = camelize(id);
  5447. if (hasOwn(assets, camelizedId))
  5448. return assets[camelizedId];
  5449. var PascalCaseId = capitalize(camelizedId);
  5450. if (hasOwn(assets, PascalCaseId))
  5451. return assets[PascalCaseId];
  5452. // fallback to prototype chain
  5453. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  5454. if (warnMissing && !res) {
  5455. warn$2('Failed to resolve ' + type.slice(0, -1) + ': ' + id);
  5456. }
  5457. return res;
  5458. }
  5459. function validateProp(key, propOptions, propsData, vm) {
  5460. var prop = propOptions[key];
  5461. var absent = !hasOwn(propsData, key);
  5462. var value = propsData[key];
  5463. // boolean casting
  5464. var booleanIndex = getTypeIndex(Boolean, prop.type);
  5465. if (booleanIndex > -1) {
  5466. if (absent && !hasOwn(prop, 'default')) {
  5467. value = false;
  5468. }
  5469. else if (value === '' || value === hyphenate(key)) {
  5470. // only cast empty string / same name to boolean if
  5471. // boolean has higher priority
  5472. var stringIndex = getTypeIndex(String, prop.type);
  5473. if (stringIndex < 0 || booleanIndex < stringIndex) {
  5474. value = true;
  5475. }
  5476. }
  5477. }
  5478. // check default value
  5479. if (value === undefined) {
  5480. value = getPropDefaultValue(vm, prop, key);
  5481. // since the default value is a fresh copy,
  5482. // make sure to observe it.
  5483. var prevShouldObserve = shouldObserve;
  5484. toggleObserving(true);
  5485. observe(value);
  5486. toggleObserving(prevShouldObserve);
  5487. }
  5488. {
  5489. assertProp(prop, key, value, vm, absent);
  5490. }
  5491. return value;
  5492. }
  5493. /**
  5494. * Get the default value of a prop.
  5495. */
  5496. function getPropDefaultValue(vm, prop, key) {
  5497. // no default, return undefined
  5498. if (!hasOwn(prop, 'default')) {
  5499. return undefined;
  5500. }
  5501. var def = prop.default;
  5502. // warn against non-factory defaults for Object & Array
  5503. if (isObject(def)) {
  5504. warn$2('Invalid default value for prop "' +
  5505. key +
  5506. '": ' +
  5507. 'Props with type Object/Array must use a factory function ' +
  5508. 'to return the default value.', vm);
  5509. }
  5510. // the raw prop value was also undefined from previous render,
  5511. // return previous default value to avoid unnecessary watcher trigger
  5512. if (vm &&
  5513. vm.$options.propsData &&
  5514. vm.$options.propsData[key] === undefined &&
  5515. vm._props[key] !== undefined) {
  5516. return vm._props[key];
  5517. }
  5518. // call factory function for non-Function types
  5519. // a value is Function if its prototype is function even across different execution context
  5520. return isFunction(def) && getType(prop.type) !== 'Function'
  5521. ? def.call(vm)
  5522. : def;
  5523. }
  5524. /**
  5525. * Assert whether a prop is valid.
  5526. */
  5527. function assertProp(prop, name, value, vm, absent) {
  5528. if (prop.required && absent) {
  5529. warn$2('Missing required prop: "' + name + '"', vm);
  5530. return;
  5531. }
  5532. if (value == null && !prop.required) {
  5533. return;
  5534. }
  5535. var type = prop.type;
  5536. var valid = !type || type === true;
  5537. var expectedTypes = [];
  5538. if (type) {
  5539. if (!isArray(type)) {
  5540. type = [type];
  5541. }
  5542. for (var i = 0; i < type.length && !valid; i++) {
  5543. var assertedType = assertType(value, type[i], vm);
  5544. expectedTypes.push(assertedType.expectedType || '');
  5545. valid = assertedType.valid;
  5546. }
  5547. }
  5548. var haveExpectedTypes = expectedTypes.some(function (t) { return t; });
  5549. if (!valid && haveExpectedTypes) {
  5550. warn$2(getInvalidTypeMessage(name, value, expectedTypes), vm);
  5551. return;
  5552. }
  5553. var validator = prop.validator;
  5554. if (validator) {
  5555. if (!validator(value)) {
  5556. warn$2('Invalid prop: custom validator check failed for prop "' + name + '".', vm);
  5557. }
  5558. }
  5559. }
  5560. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
  5561. function assertType(value, type, vm) {
  5562. var valid;
  5563. var expectedType = getType(type);
  5564. if (simpleCheckRE.test(expectedType)) {
  5565. var t = typeof value;
  5566. valid = t === expectedType.toLowerCase();
  5567. // for primitive wrapper objects
  5568. if (!valid && t === 'object') {
  5569. valid = value instanceof type;
  5570. }
  5571. }
  5572. else if (expectedType === 'Object') {
  5573. valid = isPlainObject(value);
  5574. }
  5575. else if (expectedType === 'Array') {
  5576. valid = isArray(value);
  5577. }
  5578. else {
  5579. try {
  5580. valid = value instanceof type;
  5581. }
  5582. catch (e) {
  5583. warn$2('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
  5584. valid = false;
  5585. }
  5586. }
  5587. return {
  5588. valid: valid,
  5589. expectedType: expectedType
  5590. };
  5591. }
  5592. var functionTypeCheckRE = /^\s*function (\w+)/;
  5593. /**
  5594. * Use function string name to check built-in types,
  5595. * because a simple equality check will fail when running
  5596. * across different vms / iframes.
  5597. */
  5598. function getType(fn) {
  5599. var match = fn && fn.toString().match(functionTypeCheckRE);
  5600. return match ? match[1] : '';
  5601. }
  5602. function isSameType(a, b) {
  5603. return getType(a) === getType(b);
  5604. }
  5605. function getTypeIndex(type, expectedTypes) {
  5606. if (!isArray(expectedTypes)) {
  5607. return isSameType(expectedTypes, type) ? 0 : -1;
  5608. }
  5609. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  5610. if (isSameType(expectedTypes[i], type)) {
  5611. return i;
  5612. }
  5613. }
  5614. return -1;
  5615. }
  5616. function getInvalidTypeMessage(name, value, expectedTypes) {
  5617. var message = "Invalid prop: type check failed for prop \"".concat(name, "\".") +
  5618. " Expected ".concat(expectedTypes.map(capitalize).join(', '));
  5619. var expectedType = expectedTypes[0];
  5620. var receivedType = toRawType(value);
  5621. // check if we need to specify expected value
  5622. if (expectedTypes.length === 1 &&
  5623. isExplicable(expectedType) &&
  5624. isExplicable(typeof value) &&
  5625. !isBoolean(expectedType, receivedType)) {
  5626. message += " with value ".concat(styleValue(value, expectedType));
  5627. }
  5628. message += ", got ".concat(receivedType, " ");
  5629. // check if we need to specify received value
  5630. if (isExplicable(receivedType)) {
  5631. message += "with value ".concat(styleValue(value, receivedType), ".");
  5632. }
  5633. return message;
  5634. }
  5635. function styleValue(value, type) {
  5636. if (type === 'String') {
  5637. return "\"".concat(value, "\"");
  5638. }
  5639. else if (type === 'Number') {
  5640. return "".concat(Number(value));
  5641. }
  5642. else {
  5643. return "".concat(value);
  5644. }
  5645. }
  5646. var EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
  5647. function isExplicable(value) {
  5648. return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; });
  5649. }
  5650. function isBoolean() {
  5651. var args = [];
  5652. for (var _i = 0; _i < arguments.length; _i++) {
  5653. args[_i] = arguments[_i];
  5654. }
  5655. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; });
  5656. }
  5657. function Vue(options) {
  5658. if (!(this instanceof Vue)) {
  5659. warn$2('Vue is a constructor and should be called with the `new` keyword');
  5660. }
  5661. this._init(options);
  5662. }
  5663. //@ts-expect-error Vue has function type
  5664. initMixin$1(Vue);
  5665. //@ts-expect-error Vue has function type
  5666. stateMixin(Vue);
  5667. //@ts-expect-error Vue has function type
  5668. eventsMixin(Vue);
  5669. //@ts-expect-error Vue has function type
  5670. lifecycleMixin(Vue);
  5671. //@ts-expect-error Vue has function type
  5672. renderMixin(Vue);
  5673. function initUse(Vue) {
  5674. Vue.use = function (plugin) {
  5675. var installedPlugins = this._installedPlugins || (this._installedPlugins = []);
  5676. if (installedPlugins.indexOf(plugin) > -1) {
  5677. return this;
  5678. }
  5679. // additional parameters
  5680. var args = toArray(arguments, 1);
  5681. args.unshift(this);
  5682. if (isFunction(plugin.install)) {
  5683. plugin.install.apply(plugin, args);
  5684. }
  5685. else if (isFunction(plugin)) {
  5686. plugin.apply(null, args);
  5687. }
  5688. installedPlugins.push(plugin);
  5689. return this;
  5690. };
  5691. }
  5692. function initMixin(Vue) {
  5693. Vue.mixin = function (mixin) {
  5694. this.options = mergeOptions(this.options, mixin);
  5695. return this;
  5696. };
  5697. }
  5698. function initExtend(Vue) {
  5699. /**
  5700. * Each instance constructor, including Vue, has a unique
  5701. * cid. This enables us to create wrapped "child
  5702. * constructors" for prototypal inheritance and cache them.
  5703. */
  5704. Vue.cid = 0;
  5705. var cid = 1;
  5706. /**
  5707. * Class inheritance
  5708. */
  5709. Vue.extend = function (extendOptions) {
  5710. extendOptions = extendOptions || {};
  5711. var Super = this;
  5712. var SuperId = Super.cid;
  5713. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  5714. if (cachedCtors[SuperId]) {
  5715. return cachedCtors[SuperId];
  5716. }
  5717. var name = getComponentName(extendOptions) || getComponentName(Super.options);
  5718. if (name) {
  5719. validateComponentName(name);
  5720. }
  5721. var Sub = function VueComponent(options) {
  5722. this._init(options);
  5723. };
  5724. Sub.prototype = Object.create(Super.prototype);
  5725. Sub.prototype.constructor = Sub;
  5726. Sub.cid = cid++;
  5727. Sub.options = mergeOptions(Super.options, extendOptions);
  5728. Sub['super'] = Super;
  5729. // For props and computed properties, we define the proxy getters on
  5730. // the Vue instances at extension time, on the extended prototype. This
  5731. // avoids Object.defineProperty calls for each instance created.
  5732. if (Sub.options.props) {
  5733. initProps(Sub);
  5734. }
  5735. if (Sub.options.computed) {
  5736. initComputed(Sub);
  5737. }
  5738. // allow further extension/mixin/plugin usage
  5739. Sub.extend = Super.extend;
  5740. Sub.mixin = Super.mixin;
  5741. Sub.use = Super.use;
  5742. // create asset registers, so extended classes
  5743. // can have their private assets too.
  5744. ASSET_TYPES.forEach(function (type) {
  5745. Sub[type] = Super[type];
  5746. });
  5747. // enable recursive self-lookup
  5748. if (name) {
  5749. Sub.options.components[name] = Sub;
  5750. }
  5751. // keep a reference to the super options at extension time.
  5752. // later at instantiation we can check if Super's options have
  5753. // been updated.
  5754. Sub.superOptions = Super.options;
  5755. Sub.extendOptions = extendOptions;
  5756. Sub.sealedOptions = extend({}, Sub.options);
  5757. // cache constructor
  5758. cachedCtors[SuperId] = Sub;
  5759. return Sub;
  5760. };
  5761. }
  5762. function initProps(Comp) {
  5763. var props = Comp.options.props;
  5764. for (var key in props) {
  5765. proxy(Comp.prototype, "_props", key);
  5766. }
  5767. }
  5768. function initComputed(Comp) {
  5769. var computed = Comp.options.computed;
  5770. for (var key in computed) {
  5771. defineComputed(Comp.prototype, key, computed[key]);
  5772. }
  5773. }
  5774. function initAssetRegisters(Vue) {
  5775. /**
  5776. * Create asset registration methods.
  5777. */
  5778. ASSET_TYPES.forEach(function (type) {
  5779. // @ts-expect-error function is not exact same type
  5780. Vue[type] = function (id, definition) {
  5781. if (!definition) {
  5782. return this.options[type + 's'][id];
  5783. }
  5784. else {
  5785. /* istanbul ignore if */
  5786. if (type === 'component') {
  5787. validateComponentName(id);
  5788. }
  5789. if (type === 'component' && isPlainObject(definition)) {
  5790. // @ts-expect-error
  5791. definition.name = definition.name || id;
  5792. definition = this.options._base.extend(definition);
  5793. }
  5794. if (type === 'directive' && isFunction(definition)) {
  5795. definition = { bind: definition, update: definition };
  5796. }
  5797. this.options[type + 's'][id] = definition;
  5798. return definition;
  5799. }
  5800. };
  5801. });
  5802. }
  5803. function _getComponentName(opts) {
  5804. return opts && (getComponentName(opts.Ctor.options) || opts.tag);
  5805. }
  5806. function matches(pattern, name) {
  5807. if (isArray(pattern)) {
  5808. return pattern.indexOf(name) > -1;
  5809. }
  5810. else if (typeof pattern === 'string') {
  5811. return pattern.split(',').indexOf(name) > -1;
  5812. }
  5813. else if (isRegExp(pattern)) {
  5814. return pattern.test(name);
  5815. }
  5816. /* istanbul ignore next */
  5817. return false;
  5818. }
  5819. function pruneCache(keepAliveInstance, filter) {
  5820. var cache = keepAliveInstance.cache, keys = keepAliveInstance.keys, _vnode = keepAliveInstance._vnode;
  5821. for (var key in cache) {
  5822. var entry = cache[key];
  5823. if (entry) {
  5824. var name_1 = entry.name;
  5825. if (name_1 && !filter(name_1)) {
  5826. pruneCacheEntry(cache, key, keys, _vnode);
  5827. }
  5828. }
  5829. }
  5830. }
  5831. function pruneCacheEntry(cache, key, keys, current) {
  5832. var entry = cache[key];
  5833. if (entry && (!current || entry.tag !== current.tag)) {
  5834. // @ts-expect-error can be undefined
  5835. entry.componentInstance.$destroy();
  5836. }
  5837. cache[key] = null;
  5838. remove$2(keys, key);
  5839. }
  5840. var patternTypes = [String, RegExp, Array];
  5841. // TODO defineComponent
  5842. var KeepAlive = {
  5843. name: 'keep-alive',
  5844. abstract: true,
  5845. props: {
  5846. include: patternTypes,
  5847. exclude: patternTypes,
  5848. max: [String, Number]
  5849. },
  5850. methods: {
  5851. cacheVNode: function () {
  5852. var _a = this, cache = _a.cache, keys = _a.keys, vnodeToCache = _a.vnodeToCache, keyToCache = _a.keyToCache;
  5853. if (vnodeToCache) {
  5854. var tag = vnodeToCache.tag, componentInstance = vnodeToCache.componentInstance, componentOptions = vnodeToCache.componentOptions;
  5855. cache[keyToCache] = {
  5856. name: _getComponentName(componentOptions),
  5857. tag: tag,
  5858. componentInstance: componentInstance
  5859. };
  5860. keys.push(keyToCache);
  5861. // prune oldest entry
  5862. if (this.max && keys.length > parseInt(this.max)) {
  5863. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  5864. }
  5865. this.vnodeToCache = null;
  5866. }
  5867. }
  5868. },
  5869. created: function () {
  5870. this.cache = Object.create(null);
  5871. this.keys = [];
  5872. },
  5873. destroyed: function () {
  5874. for (var key in this.cache) {
  5875. pruneCacheEntry(this.cache, key, this.keys);
  5876. }
  5877. },
  5878. mounted: function () {
  5879. var _this = this;
  5880. this.cacheVNode();
  5881. this.$watch('include', function (val) {
  5882. pruneCache(_this, function (name) { return matches(val, name); });
  5883. });
  5884. this.$watch('exclude', function (val) {
  5885. pruneCache(_this, function (name) { return !matches(val, name); });
  5886. });
  5887. },
  5888. updated: function () {
  5889. this.cacheVNode();
  5890. },
  5891. render: function () {
  5892. var slot = this.$slots.default;
  5893. var vnode = getFirstComponentChild(slot);
  5894. var componentOptions = vnode && vnode.componentOptions;
  5895. if (componentOptions) {
  5896. // check pattern
  5897. var name_2 = _getComponentName(componentOptions);
  5898. var _a = this, include = _a.include, exclude = _a.exclude;
  5899. if (
  5900. // not included
  5901. (include && (!name_2 || !matches(include, name_2))) ||
  5902. // excluded
  5903. (exclude && name_2 && matches(exclude, name_2))) {
  5904. return vnode;
  5905. }
  5906. var _b = this, cache = _b.cache, keys = _b.keys;
  5907. var key = vnode.key == null
  5908. ? // same constructor may get registered as different local components
  5909. // so cid alone is not enough (#3269)
  5910. componentOptions.Ctor.cid +
  5911. (componentOptions.tag ? "::".concat(componentOptions.tag) : '')
  5912. : vnode.key;
  5913. if (cache[key]) {
  5914. vnode.componentInstance = cache[key].componentInstance;
  5915. // make current key freshest
  5916. remove$2(keys, key);
  5917. keys.push(key);
  5918. }
  5919. else {
  5920. // delay setting the cache until update
  5921. this.vnodeToCache = vnode;
  5922. this.keyToCache = key;
  5923. }
  5924. // @ts-expect-error can vnode.data can be undefined
  5925. vnode.data.keepAlive = true;
  5926. }
  5927. return vnode || (slot && slot[0]);
  5928. }
  5929. };
  5930. var builtInComponents = {
  5931. KeepAlive: KeepAlive
  5932. };
  5933. function initGlobalAPI(Vue) {
  5934. // config
  5935. var configDef = {};
  5936. configDef.get = function () { return config; };
  5937. {
  5938. configDef.set = function () {
  5939. warn$2('Do not replace the Vue.config object, set individual fields instead.');
  5940. };
  5941. }
  5942. Object.defineProperty(Vue, 'config', configDef);
  5943. // exposed util methods.
  5944. // NOTE: these are not considered part of the public API - avoid relying on
  5945. // them unless you are aware of the risk.
  5946. Vue.util = {
  5947. warn: warn$2,
  5948. extend: extend,
  5949. mergeOptions: mergeOptions,
  5950. defineReactive: defineReactive
  5951. };
  5952. Vue.set = set;
  5953. Vue.delete = del;
  5954. Vue.nextTick = nextTick;
  5955. // 2.6 explicit observable API
  5956. Vue.observable = function (obj) {
  5957. observe(obj);
  5958. return obj;
  5959. };
  5960. Vue.options = Object.create(null);
  5961. ASSET_TYPES.forEach(function (type) {
  5962. Vue.options[type + 's'] = Object.create(null);
  5963. });
  5964. // this is used to identify the "base" constructor to extend all plain-object
  5965. // components with in Weex's multi-instance scenarios.
  5966. Vue.options._base = Vue;
  5967. extend(Vue.options.components, builtInComponents);
  5968. initUse(Vue);
  5969. initMixin(Vue);
  5970. initExtend(Vue);
  5971. initAssetRegisters(Vue);
  5972. }
  5973. initGlobalAPI(Vue);
  5974. Object.defineProperty(Vue.prototype, '$isServer', {
  5975. get: isServerRendering
  5976. });
  5977. Object.defineProperty(Vue.prototype, '$ssrContext', {
  5978. get: function () {
  5979. /* istanbul ignore next */
  5980. return this.$vnode && this.$vnode.ssrContext;
  5981. }
  5982. });
  5983. // expose FunctionalRenderContext for ssr runtime helper installation
  5984. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  5985. value: FunctionalRenderContext
  5986. });
  5987. Vue.version = version;
  5988. // these are reserved for web because they are directly compiled away
  5989. // during template compilation
  5990. var isReservedAttr = makeMap('style,class');
  5991. // attributes that should be using props for binding
  5992. var acceptValue = makeMap('input,textarea,option,select,progress');
  5993. var mustUseProp = function (tag, type, attr) {
  5994. return ((attr === 'value' && acceptValue(tag) && type !== 'button') ||
  5995. (attr === 'selected' && tag === 'option') ||
  5996. (attr === 'checked' && tag === 'input') ||
  5997. (attr === 'muted' && tag === 'video'));
  5998. };
  5999. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  6000. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  6001. var convertEnumeratedValue = function (key, value) {
  6002. return isFalsyAttrValue(value) || value === 'false'
  6003. ? 'false'
  6004. : // allow arbitrary string value for contenteditable
  6005. key === 'contenteditable' && isValidContentEditableValue(value)
  6006. ? value
  6007. : 'true';
  6008. };
  6009. var isBooleanAttr = makeMap('allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  6010. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  6011. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  6012. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  6013. 'required,reversed,scoped,seamless,selected,sortable,' +
  6014. 'truespeed,typemustmatch,visible');
  6015. var xlinkNS = 'http://www.w3.org/1999/xlink';
  6016. var isXlink = function (name) {
  6017. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink';
  6018. };
  6019. var getXlinkProp = function (name) {
  6020. return isXlink(name) ? name.slice(6, name.length) : '';
  6021. };
  6022. var isFalsyAttrValue = function (val) {
  6023. return val == null || val === false;
  6024. };
  6025. function genClassForVnode(vnode) {
  6026. var data = vnode.data;
  6027. var parentNode = vnode;
  6028. var childNode = vnode;
  6029. while (isDef(childNode.componentInstance)) {
  6030. childNode = childNode.componentInstance._vnode;
  6031. if (childNode && childNode.data) {
  6032. data = mergeClassData(childNode.data, data);
  6033. }
  6034. }
  6035. // @ts-expect-error parentNode.parent not VNodeWithData
  6036. while (isDef((parentNode = parentNode.parent))) {
  6037. if (parentNode && parentNode.data) {
  6038. data = mergeClassData(data, parentNode.data);
  6039. }
  6040. }
  6041. return renderClass(data.staticClass, data.class);
  6042. }
  6043. function mergeClassData(child, parent) {
  6044. return {
  6045. staticClass: concat(child.staticClass, parent.staticClass),
  6046. class: isDef(child.class) ? [child.class, parent.class] : parent.class
  6047. };
  6048. }
  6049. function renderClass(staticClass, dynamicClass) {
  6050. if (isDef(staticClass) || isDef(dynamicClass)) {
  6051. return concat(staticClass, stringifyClass(dynamicClass));
  6052. }
  6053. /* istanbul ignore next */
  6054. return '';
  6055. }
  6056. function concat(a, b) {
  6057. return a ? (b ? a + ' ' + b : a) : b || '';
  6058. }
  6059. function stringifyClass(value) {
  6060. if (Array.isArray(value)) {
  6061. return stringifyArray(value);
  6062. }
  6063. if (isObject(value)) {
  6064. return stringifyObject(value);
  6065. }
  6066. if (typeof value === 'string') {
  6067. return value;
  6068. }
  6069. /* istanbul ignore next */
  6070. return '';
  6071. }
  6072. function stringifyArray(value) {
  6073. var res = '';
  6074. var stringified;
  6075. for (var i = 0, l = value.length; i < l; i++) {
  6076. if (isDef((stringified = stringifyClass(value[i]))) && stringified !== '') {
  6077. if (res)
  6078. res += ' ';
  6079. res += stringified;
  6080. }
  6081. }
  6082. return res;
  6083. }
  6084. function stringifyObject(value) {
  6085. var res = '';
  6086. for (var key in value) {
  6087. if (value[key]) {
  6088. if (res)
  6089. res += ' ';
  6090. res += key;
  6091. }
  6092. }
  6093. return res;
  6094. }
  6095. var namespaceMap = {
  6096. svg: 'http://www.w3.org/2000/svg',
  6097. math: 'http://www.w3.org/1998/Math/MathML'
  6098. };
  6099. var isHTMLTag = makeMap('html,body,base,head,link,meta,style,title,' +
  6100. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  6101. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  6102. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  6103. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  6104. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  6105. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  6106. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  6107. 'output,progress,select,textarea,' +
  6108. 'details,dialog,menu,menuitem,summary,' +
  6109. 'content,element,shadow,template,blockquote,iframe,tfoot');
  6110. // this map is intentionally selective, only covering SVG elements that may
  6111. // contain child elements.
  6112. var isSVG = makeMap('svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  6113. 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  6114. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', true);
  6115. var isPreTag = function (tag) { return tag === 'pre'; };
  6116. var isReservedTag = function (tag) {
  6117. return isHTMLTag(tag) || isSVG(tag);
  6118. };
  6119. function getTagNamespace(tag) {
  6120. if (isSVG(tag)) {
  6121. return 'svg';
  6122. }
  6123. // basic support for MathML
  6124. // note it doesn't support other MathML elements being component roots
  6125. if (tag === 'math') {
  6126. return 'math';
  6127. }
  6128. }
  6129. var unknownElementCache = Object.create(null);
  6130. function isUnknownElement(tag) {
  6131. /* istanbul ignore if */
  6132. if (!inBrowser) {
  6133. return true;
  6134. }
  6135. if (isReservedTag(tag)) {
  6136. return false;
  6137. }
  6138. tag = tag.toLowerCase();
  6139. /* istanbul ignore if */
  6140. if (unknownElementCache[tag] != null) {
  6141. return unknownElementCache[tag];
  6142. }
  6143. var el = document.createElement(tag);
  6144. if (tag.indexOf('-') > -1) {
  6145. // http://stackoverflow.com/a/28210364/1070244
  6146. return (unknownElementCache[tag] =
  6147. el.constructor === window.HTMLUnknownElement ||
  6148. el.constructor === window.HTMLElement);
  6149. }
  6150. else {
  6151. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()));
  6152. }
  6153. }
  6154. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  6155. /**
  6156. * Query an element selector if it's not an element already.
  6157. */
  6158. function query(el) {
  6159. if (typeof el === 'string') {
  6160. var selected = document.querySelector(el);
  6161. if (!selected) {
  6162. warn$2('Cannot find element: ' + el);
  6163. return document.createElement('div');
  6164. }
  6165. return selected;
  6166. }
  6167. else {
  6168. return el;
  6169. }
  6170. }
  6171. function createElement(tagName, vnode) {
  6172. var elm = document.createElement(tagName);
  6173. if (tagName !== 'select') {
  6174. return elm;
  6175. }
  6176. // false or null will remove the attribute but undefined will not
  6177. if (vnode.data &&
  6178. vnode.data.attrs &&
  6179. vnode.data.attrs.multiple !== undefined) {
  6180. elm.setAttribute('multiple', 'multiple');
  6181. }
  6182. return elm;
  6183. }
  6184. function createElementNS(namespace, tagName) {
  6185. return document.createElementNS(namespaceMap[namespace], tagName);
  6186. }
  6187. function createTextNode(text) {
  6188. return document.createTextNode(text);
  6189. }
  6190. function createComment(text) {
  6191. return document.createComment(text);
  6192. }
  6193. function insertBefore(parentNode, newNode, referenceNode) {
  6194. parentNode.insertBefore(newNode, referenceNode);
  6195. }
  6196. function removeChild(node, child) {
  6197. node.removeChild(child);
  6198. }
  6199. function appendChild(node, child) {
  6200. node.appendChild(child);
  6201. }
  6202. function parentNode(node) {
  6203. return node.parentNode;
  6204. }
  6205. function nextSibling(node) {
  6206. return node.nextSibling;
  6207. }
  6208. function tagName(node) {
  6209. return node.tagName;
  6210. }
  6211. function setTextContent(node, text) {
  6212. node.textContent = text;
  6213. }
  6214. function setStyleScope(node, scopeId) {
  6215. node.setAttribute(scopeId, '');
  6216. }
  6217. var nodeOps = /*#__PURE__*/Object.freeze({
  6218. __proto__: null,
  6219. createElement: createElement,
  6220. createElementNS: createElementNS,
  6221. createTextNode: createTextNode,
  6222. createComment: createComment,
  6223. insertBefore: insertBefore,
  6224. removeChild: removeChild,
  6225. appendChild: appendChild,
  6226. parentNode: parentNode,
  6227. nextSibling: nextSibling,
  6228. tagName: tagName,
  6229. setTextContent: setTextContent,
  6230. setStyleScope: setStyleScope
  6231. });
  6232. var ref = {
  6233. create: function (_, vnode) {
  6234. registerRef(vnode);
  6235. },
  6236. update: function (oldVnode, vnode) {
  6237. if (oldVnode.data.ref !== vnode.data.ref) {
  6238. registerRef(oldVnode, true);
  6239. registerRef(vnode);
  6240. }
  6241. },
  6242. destroy: function (vnode) {
  6243. registerRef(vnode, true);
  6244. }
  6245. };
  6246. function registerRef(vnode, isRemoval) {
  6247. var ref = vnode.data.ref;
  6248. if (!isDef(ref))
  6249. return;
  6250. var vm = vnode.context;
  6251. var refValue = vnode.componentInstance || vnode.elm;
  6252. var value = isRemoval ? null : refValue;
  6253. var $refsValue = isRemoval ? undefined : refValue;
  6254. if (isFunction(ref)) {
  6255. invokeWithErrorHandling(ref, vm, [value], vm, "template ref function");
  6256. return;
  6257. }
  6258. var isFor = vnode.data.refInFor;
  6259. var _isString = typeof ref === 'string' || typeof ref === 'number';
  6260. var _isRef = isRef(ref);
  6261. var refs = vm.$refs;
  6262. if (_isString || _isRef) {
  6263. if (isFor) {
  6264. var existing = _isString ? refs[ref] : ref.value;
  6265. if (isRemoval) {
  6266. isArray(existing) && remove$2(existing, refValue);
  6267. }
  6268. else {
  6269. if (!isArray(existing)) {
  6270. if (_isString) {
  6271. refs[ref] = [refValue];
  6272. setSetupRef(vm, ref, refs[ref]);
  6273. }
  6274. else {
  6275. ref.value = [refValue];
  6276. }
  6277. }
  6278. else if (!existing.includes(refValue)) {
  6279. existing.push(refValue);
  6280. }
  6281. }
  6282. }
  6283. else if (_isString) {
  6284. if (isRemoval && refs[ref] !== refValue) {
  6285. return;
  6286. }
  6287. refs[ref] = $refsValue;
  6288. setSetupRef(vm, ref, value);
  6289. }
  6290. else if (_isRef) {
  6291. if (isRemoval && ref.value !== refValue) {
  6292. return;
  6293. }
  6294. ref.value = value;
  6295. }
  6296. else {
  6297. warn$2("Invalid template ref type: ".concat(typeof ref));
  6298. }
  6299. }
  6300. }
  6301. function setSetupRef(_a, key, val) {
  6302. var _setupState = _a._setupState;
  6303. if (_setupState && hasOwn(_setupState, key)) {
  6304. if (isRef(_setupState[key])) {
  6305. _setupState[key].value = val;
  6306. }
  6307. else {
  6308. _setupState[key] = val;
  6309. }
  6310. }
  6311. }
  6312. /**
  6313. * Virtual DOM patching algorithm based on Snabbdom by
  6314. * Simon Friis Vindum (@paldepind)
  6315. * Licensed under the MIT License
  6316. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  6317. *
  6318. * modified by Evan You (@yyx990803)
  6319. *
  6320. * Not type-checking this because this file is perf-critical and the cost
  6321. * of making flow understand it is not worth it.
  6322. */
  6323. var emptyNode = new VNode('', {}, []);
  6324. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  6325. function sameVnode(a, b) {
  6326. return (a.key === b.key &&
  6327. a.asyncFactory === b.asyncFactory &&
  6328. ((a.tag === b.tag &&
  6329. a.isComment === b.isComment &&
  6330. isDef(a.data) === isDef(b.data) &&
  6331. sameInputType(a, b)) ||
  6332. (isTrue(a.isAsyncPlaceholder) && isUndef(b.asyncFactory.error))));
  6333. }
  6334. function sameInputType(a, b) {
  6335. if (a.tag !== 'input')
  6336. return true;
  6337. var i;
  6338. var typeA = isDef((i = a.data)) && isDef((i = i.attrs)) && i.type;
  6339. var typeB = isDef((i = b.data)) && isDef((i = i.attrs)) && i.type;
  6340. return typeA === typeB || (isTextInputType(typeA) && isTextInputType(typeB));
  6341. }
  6342. function createKeyToOldIdx(children, beginIdx, endIdx) {
  6343. var i, key;
  6344. var map = {};
  6345. for (i = beginIdx; i <= endIdx; ++i) {
  6346. key = children[i].key;
  6347. if (isDef(key))
  6348. map[key] = i;
  6349. }
  6350. return map;
  6351. }
  6352. function createPatchFunction(backend) {
  6353. var i, j;
  6354. var cbs = {};
  6355. var modules = backend.modules, nodeOps = backend.nodeOps;
  6356. for (i = 0; i < hooks.length; ++i) {
  6357. cbs[hooks[i]] = [];
  6358. for (j = 0; j < modules.length; ++j) {
  6359. if (isDef(modules[j][hooks[i]])) {
  6360. cbs[hooks[i]].push(modules[j][hooks[i]]);
  6361. }
  6362. }
  6363. }
  6364. function emptyNodeAt(elm) {
  6365. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm);
  6366. }
  6367. function createRmCb(childElm, listeners) {
  6368. function remove() {
  6369. if (--remove.listeners === 0) {
  6370. removeNode(childElm);
  6371. }
  6372. }
  6373. remove.listeners = listeners;
  6374. return remove;
  6375. }
  6376. function removeNode(el) {
  6377. var parent = nodeOps.parentNode(el);
  6378. // element may have already been removed due to v-html / v-text
  6379. if (isDef(parent)) {
  6380. nodeOps.removeChild(parent, el);
  6381. }
  6382. }
  6383. function isUnknownElement(vnode, inVPre) {
  6384. return (!inVPre &&
  6385. !vnode.ns &&
  6386. !(config.ignoredElements.length &&
  6387. config.ignoredElements.some(function (ignore) {
  6388. return isRegExp(ignore)
  6389. ? ignore.test(vnode.tag)
  6390. : ignore === vnode.tag;
  6391. })) &&
  6392. config.isUnknownElement(vnode.tag));
  6393. }
  6394. var creatingElmInVPre = 0;
  6395. function createElm(vnode, insertedVnodeQueue, parentElm, refElm, nested, ownerArray, index) {
  6396. if (isDef(vnode.elm) && isDef(ownerArray)) {
  6397. // This vnode was used in a previous render!
  6398. // now it's used as a new node, overwriting its elm would cause
  6399. // potential patch errors down the road when it's used as an insertion
  6400. // reference node. Instead, we clone the node on-demand before creating
  6401. // associated DOM element for it.
  6402. vnode = ownerArray[index] = cloneVNode(vnode);
  6403. }
  6404. vnode.isRootInsert = !nested; // for transition enter check
  6405. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  6406. return;
  6407. }
  6408. var data = vnode.data;
  6409. var children = vnode.children;
  6410. var tag = vnode.tag;
  6411. if (isDef(tag)) {
  6412. {
  6413. if (data && data.pre) {
  6414. creatingElmInVPre++;
  6415. }
  6416. if (isUnknownElement(vnode, creatingElmInVPre)) {
  6417. warn$2('Unknown custom element: <' +
  6418. tag +
  6419. '> - did you ' +
  6420. 'register the component correctly? For recursive components, ' +
  6421. 'make sure to provide the "name" option.', vnode.context);
  6422. }
  6423. }
  6424. vnode.elm = vnode.ns
  6425. ? nodeOps.createElementNS(vnode.ns, tag)
  6426. : nodeOps.createElement(tag, vnode);
  6427. setScope(vnode);
  6428. createChildren(vnode, children, insertedVnodeQueue);
  6429. if (isDef(data)) {
  6430. invokeCreateHooks(vnode, insertedVnodeQueue);
  6431. }
  6432. insert(parentElm, vnode.elm, refElm);
  6433. if (data && data.pre) {
  6434. creatingElmInVPre--;
  6435. }
  6436. }
  6437. else if (isTrue(vnode.isComment)) {
  6438. vnode.elm = nodeOps.createComment(vnode.text);
  6439. insert(parentElm, vnode.elm, refElm);
  6440. }
  6441. else {
  6442. vnode.elm = nodeOps.createTextNode(vnode.text);
  6443. insert(parentElm, vnode.elm, refElm);
  6444. }
  6445. }
  6446. function createComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
  6447. var i = vnode.data;
  6448. if (isDef(i)) {
  6449. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  6450. if (isDef((i = i.hook)) && isDef((i = i.init))) {
  6451. i(vnode, false /* hydrating */);
  6452. }
  6453. // after calling the init hook, if the vnode is a child component
  6454. // it should've created a child instance and mounted it. the child
  6455. // component also has set the placeholder vnode's elm.
  6456. // in that case we can just return the element and be done.
  6457. if (isDef(vnode.componentInstance)) {
  6458. initComponent(vnode, insertedVnodeQueue);
  6459. insert(parentElm, vnode.elm, refElm);
  6460. if (isTrue(isReactivated)) {
  6461. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  6462. }
  6463. return true;
  6464. }
  6465. }
  6466. }
  6467. function initComponent(vnode, insertedVnodeQueue) {
  6468. if (isDef(vnode.data.pendingInsert)) {
  6469. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  6470. vnode.data.pendingInsert = null;
  6471. }
  6472. vnode.elm = vnode.componentInstance.$el;
  6473. if (isPatchable(vnode)) {
  6474. invokeCreateHooks(vnode, insertedVnodeQueue);
  6475. setScope(vnode);
  6476. }
  6477. else {
  6478. // empty component root.
  6479. // skip all element-related modules except for ref (#3455)
  6480. registerRef(vnode);
  6481. // make sure to invoke the insert hook
  6482. insertedVnodeQueue.push(vnode);
  6483. }
  6484. }
  6485. function reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
  6486. var i;
  6487. // hack for #4339: a reactivated component with inner transition
  6488. // does not trigger because the inner node's created hooks are not called
  6489. // again. It's not ideal to involve module-specific logic in here but
  6490. // there doesn't seem to be a better way to do it.
  6491. var innerNode = vnode;
  6492. while (innerNode.componentInstance) {
  6493. innerNode = innerNode.componentInstance._vnode;
  6494. if (isDef((i = innerNode.data)) && isDef((i = i.transition))) {
  6495. for (i = 0; i < cbs.activate.length; ++i) {
  6496. cbs.activate[i](emptyNode, innerNode);
  6497. }
  6498. insertedVnodeQueue.push(innerNode);
  6499. break;
  6500. }
  6501. }
  6502. // unlike a newly created component,
  6503. // a reactivated keep-alive component doesn't insert itself
  6504. insert(parentElm, vnode.elm, refElm);
  6505. }
  6506. function insert(parent, elm, ref) {
  6507. if (isDef(parent)) {
  6508. if (isDef(ref)) {
  6509. if (nodeOps.parentNode(ref) === parent) {
  6510. nodeOps.insertBefore(parent, elm, ref);
  6511. }
  6512. }
  6513. else {
  6514. nodeOps.appendChild(parent, elm);
  6515. }
  6516. }
  6517. }
  6518. function createChildren(vnode, children, insertedVnodeQueue) {
  6519. if (isArray(children)) {
  6520. {
  6521. checkDuplicateKeys(children);
  6522. }
  6523. for (var i_1 = 0; i_1 < children.length; ++i_1) {
  6524. createElm(children[i_1], insertedVnodeQueue, vnode.elm, null, true, children, i_1);
  6525. }
  6526. }
  6527. else if (isPrimitive(vnode.text)) {
  6528. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  6529. }
  6530. }
  6531. function isPatchable(vnode) {
  6532. while (vnode.componentInstance) {
  6533. vnode = vnode.componentInstance._vnode;
  6534. }
  6535. return isDef(vnode.tag);
  6536. }
  6537. function invokeCreateHooks(vnode, insertedVnodeQueue) {
  6538. for (var i_2 = 0; i_2 < cbs.create.length; ++i_2) {
  6539. cbs.create[i_2](emptyNode, vnode);
  6540. }
  6541. i = vnode.data.hook; // Reuse variable
  6542. if (isDef(i)) {
  6543. if (isDef(i.create))
  6544. i.create(emptyNode, vnode);
  6545. if (isDef(i.insert))
  6546. insertedVnodeQueue.push(vnode);
  6547. }
  6548. }
  6549. // set scope id attribute for scoped CSS.
  6550. // this is implemented as a special case to avoid the overhead
  6551. // of going through the normal attribute patching process.
  6552. function setScope(vnode) {
  6553. var i;
  6554. if (isDef((i = vnode.fnScopeId))) {
  6555. nodeOps.setStyleScope(vnode.elm, i);
  6556. }
  6557. else {
  6558. var ancestor = vnode;
  6559. while (ancestor) {
  6560. if (isDef((i = ancestor.context)) && isDef((i = i.$options._scopeId))) {
  6561. nodeOps.setStyleScope(vnode.elm, i);
  6562. }
  6563. ancestor = ancestor.parent;
  6564. }
  6565. }
  6566. // for slot content they should also get the scopeId from the host instance.
  6567. if (isDef((i = activeInstance)) &&
  6568. i !== vnode.context &&
  6569. i !== vnode.fnContext &&
  6570. isDef((i = i.$options._scopeId))) {
  6571. nodeOps.setStyleScope(vnode.elm, i);
  6572. }
  6573. }
  6574. function addVnodes(parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  6575. for (; startIdx <= endIdx; ++startIdx) {
  6576. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  6577. }
  6578. }
  6579. function invokeDestroyHook(vnode) {
  6580. var i, j;
  6581. var data = vnode.data;
  6582. if (isDef(data)) {
  6583. if (isDef((i = data.hook)) && isDef((i = i.destroy)))
  6584. i(vnode);
  6585. for (i = 0; i < cbs.destroy.length; ++i)
  6586. cbs.destroy[i](vnode);
  6587. }
  6588. if (isDef((i = vnode.children))) {
  6589. for (j = 0; j < vnode.children.length; ++j) {
  6590. invokeDestroyHook(vnode.children[j]);
  6591. }
  6592. }
  6593. }
  6594. function removeVnodes(vnodes, startIdx, endIdx) {
  6595. for (; startIdx <= endIdx; ++startIdx) {
  6596. var ch = vnodes[startIdx];
  6597. if (isDef(ch)) {
  6598. if (isDef(ch.tag)) {
  6599. removeAndInvokeRemoveHook(ch);
  6600. invokeDestroyHook(ch);
  6601. }
  6602. else {
  6603. // Text node
  6604. removeNode(ch.elm);
  6605. }
  6606. }
  6607. }
  6608. }
  6609. function removeAndInvokeRemoveHook(vnode, rm) {
  6610. if (isDef(rm) || isDef(vnode.data)) {
  6611. var i_3;
  6612. var listeners = cbs.remove.length + 1;
  6613. if (isDef(rm)) {
  6614. // we have a recursively passed down rm callback
  6615. // increase the listeners count
  6616. rm.listeners += listeners;
  6617. }
  6618. else {
  6619. // directly removing
  6620. rm = createRmCb(vnode.elm, listeners);
  6621. }
  6622. // recursively invoke hooks on child component root node
  6623. if (isDef((i_3 = vnode.componentInstance)) &&
  6624. isDef((i_3 = i_3._vnode)) &&
  6625. isDef(i_3.data)) {
  6626. removeAndInvokeRemoveHook(i_3, rm);
  6627. }
  6628. for (i_3 = 0; i_3 < cbs.remove.length; ++i_3) {
  6629. cbs.remove[i_3](vnode, rm);
  6630. }
  6631. if (isDef((i_3 = vnode.data.hook)) && isDef((i_3 = i_3.remove))) {
  6632. i_3(vnode, rm);
  6633. }
  6634. else {
  6635. rm();
  6636. }
  6637. }
  6638. else {
  6639. removeNode(vnode.elm);
  6640. }
  6641. }
  6642. function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  6643. var oldStartIdx = 0;
  6644. var newStartIdx = 0;
  6645. var oldEndIdx = oldCh.length - 1;
  6646. var oldStartVnode = oldCh[0];
  6647. var oldEndVnode = oldCh[oldEndIdx];
  6648. var newEndIdx = newCh.length - 1;
  6649. var newStartVnode = newCh[0];
  6650. var newEndVnode = newCh[newEndIdx];
  6651. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  6652. // removeOnly is a special flag used only by <transition-group>
  6653. // to ensure removed elements stay in correct relative positions
  6654. // during leaving transitions
  6655. var canMove = !removeOnly;
  6656. {
  6657. checkDuplicateKeys(newCh);
  6658. }
  6659. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  6660. if (isUndef(oldStartVnode)) {
  6661. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  6662. }
  6663. else if (isUndef(oldEndVnode)) {
  6664. oldEndVnode = oldCh[--oldEndIdx];
  6665. }
  6666. else if (sameVnode(oldStartVnode, newStartVnode)) {
  6667. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  6668. oldStartVnode = oldCh[++oldStartIdx];
  6669. newStartVnode = newCh[++newStartIdx];
  6670. }
  6671. else if (sameVnode(oldEndVnode, newEndVnode)) {
  6672. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  6673. oldEndVnode = oldCh[--oldEndIdx];
  6674. newEndVnode = newCh[--newEndIdx];
  6675. }
  6676. else if (sameVnode(oldStartVnode, newEndVnode)) {
  6677. // Vnode moved right
  6678. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  6679. canMove &&
  6680. nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  6681. oldStartVnode = oldCh[++oldStartIdx];
  6682. newEndVnode = newCh[--newEndIdx];
  6683. }
  6684. else if (sameVnode(oldEndVnode, newStartVnode)) {
  6685. // Vnode moved left
  6686. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  6687. canMove &&
  6688. nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  6689. oldEndVnode = oldCh[--oldEndIdx];
  6690. newStartVnode = newCh[++newStartIdx];
  6691. }
  6692. else {
  6693. if (isUndef(oldKeyToIdx))
  6694. oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
  6695. idxInOld = isDef(newStartVnode.key)
  6696. ? oldKeyToIdx[newStartVnode.key]
  6697. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  6698. if (isUndef(idxInOld)) {
  6699. // New element
  6700. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  6701. }
  6702. else {
  6703. vnodeToMove = oldCh[idxInOld];
  6704. if (sameVnode(vnodeToMove, newStartVnode)) {
  6705. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  6706. oldCh[idxInOld] = undefined;
  6707. canMove &&
  6708. nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  6709. }
  6710. else {
  6711. // same key but different element. treat as new element
  6712. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  6713. }
  6714. }
  6715. newStartVnode = newCh[++newStartIdx];
  6716. }
  6717. }
  6718. if (oldStartIdx > oldEndIdx) {
  6719. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  6720. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  6721. }
  6722. else if (newStartIdx > newEndIdx) {
  6723. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  6724. }
  6725. }
  6726. function checkDuplicateKeys(children) {
  6727. var seenKeys = {};
  6728. for (var i_4 = 0; i_4 < children.length; i_4++) {
  6729. var vnode = children[i_4];
  6730. var key = vnode.key;
  6731. if (isDef(key)) {
  6732. if (seenKeys[key]) {
  6733. warn$2("Duplicate keys detected: '".concat(key, "'. This may cause an update error."), vnode.context);
  6734. }
  6735. else {
  6736. seenKeys[key] = true;
  6737. }
  6738. }
  6739. }
  6740. }
  6741. function findIdxInOld(node, oldCh, start, end) {
  6742. for (var i_5 = start; i_5 < end; i_5++) {
  6743. var c = oldCh[i_5];
  6744. if (isDef(c) && sameVnode(node, c))
  6745. return i_5;
  6746. }
  6747. }
  6748. function patchVnode(oldVnode, vnode, insertedVnodeQueue, ownerArray, index, removeOnly) {
  6749. if (oldVnode === vnode) {
  6750. return;
  6751. }
  6752. if (isDef(vnode.elm) && isDef(ownerArray)) {
  6753. // clone reused vnode
  6754. vnode = ownerArray[index] = cloneVNode(vnode);
  6755. }
  6756. var elm = (vnode.elm = oldVnode.elm);
  6757. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  6758. if (isDef(vnode.asyncFactory.resolved)) {
  6759. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  6760. }
  6761. else {
  6762. vnode.isAsyncPlaceholder = true;
  6763. }
  6764. return;
  6765. }
  6766. // reuse element for static trees.
  6767. // note we only do this if the vnode is cloned -
  6768. // if the new node is not cloned it means the render functions have been
  6769. // reset by the hot-reload-api and we need to do a proper re-render.
  6770. if (isTrue(vnode.isStatic) &&
  6771. isTrue(oldVnode.isStatic) &&
  6772. vnode.key === oldVnode.key &&
  6773. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {
  6774. vnode.componentInstance = oldVnode.componentInstance;
  6775. return;
  6776. }
  6777. var i;
  6778. var data = vnode.data;
  6779. if (isDef(data) && isDef((i = data.hook)) && isDef((i = i.prepatch))) {
  6780. i(oldVnode, vnode);
  6781. }
  6782. var oldCh = oldVnode.children;
  6783. var ch = vnode.children;
  6784. if (isDef(data) && isPatchable(vnode)) {
  6785. for (i = 0; i < cbs.update.length; ++i)
  6786. cbs.update[i](oldVnode, vnode);
  6787. if (isDef((i = data.hook)) && isDef((i = i.update)))
  6788. i(oldVnode, vnode);
  6789. }
  6790. if (isUndef(vnode.text)) {
  6791. if (isDef(oldCh) && isDef(ch)) {
  6792. if (oldCh !== ch)
  6793. updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly);
  6794. }
  6795. else if (isDef(ch)) {
  6796. {
  6797. checkDuplicateKeys(ch);
  6798. }
  6799. if (isDef(oldVnode.text))
  6800. nodeOps.setTextContent(elm, '');
  6801. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  6802. }
  6803. else if (isDef(oldCh)) {
  6804. removeVnodes(oldCh, 0, oldCh.length - 1);
  6805. }
  6806. else if (isDef(oldVnode.text)) {
  6807. nodeOps.setTextContent(elm, '');
  6808. }
  6809. }
  6810. else if (oldVnode.text !== vnode.text) {
  6811. nodeOps.setTextContent(elm, vnode.text);
  6812. }
  6813. if (isDef(data)) {
  6814. if (isDef((i = data.hook)) && isDef((i = i.postpatch)))
  6815. i(oldVnode, vnode);
  6816. }
  6817. }
  6818. function invokeInsertHook(vnode, queue, initial) {
  6819. // delay insert hooks for component root nodes, invoke them after the
  6820. // element is really inserted
  6821. if (isTrue(initial) && isDef(vnode.parent)) {
  6822. vnode.parent.data.pendingInsert = queue;
  6823. }
  6824. else {
  6825. for (var i_6 = 0; i_6 < queue.length; ++i_6) {
  6826. queue[i_6].data.hook.insert(queue[i_6]);
  6827. }
  6828. }
  6829. }
  6830. var hydrationBailed = false;
  6831. // list of modules that can skip create hook during hydration because they
  6832. // are already rendered on the client or has no need for initialization
  6833. // Note: style is excluded because it relies on initial clone for future
  6834. // deep updates (#7063).
  6835. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  6836. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  6837. function hydrate(elm, vnode, insertedVnodeQueue, inVPre) {
  6838. var i;
  6839. var tag = vnode.tag, data = vnode.data, children = vnode.children;
  6840. inVPre = inVPre || (data && data.pre);
  6841. vnode.elm = elm;
  6842. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  6843. vnode.isAsyncPlaceholder = true;
  6844. return true;
  6845. }
  6846. // assert node match
  6847. {
  6848. if (!assertNodeMatch(elm, vnode, inVPre)) {
  6849. return false;
  6850. }
  6851. }
  6852. if (isDef(data)) {
  6853. if (isDef((i = data.hook)) && isDef((i = i.init)))
  6854. i(vnode, true /* hydrating */);
  6855. if (isDef((i = vnode.componentInstance))) {
  6856. // child component. it should have hydrated its own tree.
  6857. initComponent(vnode, insertedVnodeQueue);
  6858. return true;
  6859. }
  6860. }
  6861. if (isDef(tag)) {
  6862. if (isDef(children)) {
  6863. // empty element, allow client to pick up and populate children
  6864. if (!elm.hasChildNodes()) {
  6865. createChildren(vnode, children, insertedVnodeQueue);
  6866. }
  6867. else {
  6868. // v-html and domProps: innerHTML
  6869. if (isDef((i = data)) &&
  6870. isDef((i = i.domProps)) &&
  6871. isDef((i = i.innerHTML))) {
  6872. if (i !== elm.innerHTML) {
  6873. /* istanbul ignore if */
  6874. if (typeof console !== 'undefined' &&
  6875. !hydrationBailed) {
  6876. hydrationBailed = true;
  6877. console.warn('Parent: ', elm);
  6878. console.warn('server innerHTML: ', i);
  6879. console.warn('client innerHTML: ', elm.innerHTML);
  6880. }
  6881. return false;
  6882. }
  6883. }
  6884. else {
  6885. // iterate and compare children lists
  6886. var childrenMatch = true;
  6887. var childNode = elm.firstChild;
  6888. for (var i_7 = 0; i_7 < children.length; i_7++) {
  6889. if (!childNode ||
  6890. !hydrate(childNode, children[i_7], insertedVnodeQueue, inVPre)) {
  6891. childrenMatch = false;
  6892. break;
  6893. }
  6894. childNode = childNode.nextSibling;
  6895. }
  6896. // if childNode is not null, it means the actual childNodes list is
  6897. // longer than the virtual children list.
  6898. if (!childrenMatch || childNode) {
  6899. /* istanbul ignore if */
  6900. if (typeof console !== 'undefined' &&
  6901. !hydrationBailed) {
  6902. hydrationBailed = true;
  6903. console.warn('Parent: ', elm);
  6904. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  6905. }
  6906. return false;
  6907. }
  6908. }
  6909. }
  6910. }
  6911. if (isDef(data)) {
  6912. var fullInvoke = false;
  6913. for (var key in data) {
  6914. if (!isRenderedModule(key)) {
  6915. fullInvoke = true;
  6916. invokeCreateHooks(vnode, insertedVnodeQueue);
  6917. break;
  6918. }
  6919. }
  6920. if (!fullInvoke && data['class']) {
  6921. // ensure collecting deps for deep class bindings for future updates
  6922. traverse(data['class']);
  6923. }
  6924. }
  6925. }
  6926. else if (elm.data !== vnode.text) {
  6927. elm.data = vnode.text;
  6928. }
  6929. return true;
  6930. }
  6931. function assertNodeMatch(node, vnode, inVPre) {
  6932. if (isDef(vnode.tag)) {
  6933. return (vnode.tag.indexOf('vue-component') === 0 ||
  6934. (!isUnknownElement(vnode, inVPre) &&
  6935. vnode.tag.toLowerCase() ===
  6936. (node.tagName && node.tagName.toLowerCase())));
  6937. }
  6938. else {
  6939. return node.nodeType === (vnode.isComment ? 8 : 3);
  6940. }
  6941. }
  6942. return function patch(oldVnode, vnode, hydrating, removeOnly) {
  6943. if (isUndef(vnode)) {
  6944. if (isDef(oldVnode))
  6945. invokeDestroyHook(oldVnode);
  6946. return;
  6947. }
  6948. var isInitialPatch = false;
  6949. var insertedVnodeQueue = [];
  6950. if (isUndef(oldVnode)) {
  6951. // empty mount (likely as component), create new root element
  6952. isInitialPatch = true;
  6953. createElm(vnode, insertedVnodeQueue);
  6954. }
  6955. else {
  6956. var isRealElement = isDef(oldVnode.nodeType);
  6957. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  6958. // patch existing root node
  6959. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  6960. }
  6961. else {
  6962. if (isRealElement) {
  6963. // mounting to a real element
  6964. // check if this is server-rendered content and if we can perform
  6965. // a successful hydration.
  6966. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  6967. oldVnode.removeAttribute(SSR_ATTR);
  6968. hydrating = true;
  6969. }
  6970. if (isTrue(hydrating)) {
  6971. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  6972. invokeInsertHook(vnode, insertedVnodeQueue, true);
  6973. return oldVnode;
  6974. }
  6975. else {
  6976. warn$2('The client-side rendered virtual DOM tree is not matching ' +
  6977. 'server-rendered content. This is likely caused by incorrect ' +
  6978. 'HTML markup, for example nesting block-level elements inside ' +
  6979. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  6980. 'full client-side render.');
  6981. }
  6982. }
  6983. // either not server-rendered, or hydration failed.
  6984. // create an empty node and replace it
  6985. oldVnode = emptyNodeAt(oldVnode);
  6986. }
  6987. // replacing existing element
  6988. var oldElm = oldVnode.elm;
  6989. var parentElm = nodeOps.parentNode(oldElm);
  6990. // create new node
  6991. createElm(vnode, insertedVnodeQueue,
  6992. // extremely rare edge case: do not insert if old element is in a
  6993. // leaving transition. Only happens when combining transition +
  6994. // keep-alive + HOCs. (#4590)
  6995. oldElm._leaveCb ? null : parentElm, nodeOps.nextSibling(oldElm));
  6996. // update parent placeholder node element, recursively
  6997. if (isDef(vnode.parent)) {
  6998. var ancestor = vnode.parent;
  6999. var patchable = isPatchable(vnode);
  7000. while (ancestor) {
  7001. for (var i_8 = 0; i_8 < cbs.destroy.length; ++i_8) {
  7002. cbs.destroy[i_8](ancestor);
  7003. }
  7004. ancestor.elm = vnode.elm;
  7005. if (patchable) {
  7006. for (var i_9 = 0; i_9 < cbs.create.length; ++i_9) {
  7007. cbs.create[i_9](emptyNode, ancestor);
  7008. }
  7009. // #6513
  7010. // invoke insert hooks that may have been merged by create hooks.
  7011. // e.g. for directives that uses the "inserted" hook.
  7012. var insert_1 = ancestor.data.hook.insert;
  7013. if (insert_1.merged) {
  7014. // start at index 1 to avoid re-invoking component mounted hook
  7015. for (var i_10 = 1; i_10 < insert_1.fns.length; i_10++) {
  7016. insert_1.fns[i_10]();
  7017. }
  7018. }
  7019. }
  7020. else {
  7021. registerRef(ancestor);
  7022. }
  7023. ancestor = ancestor.parent;
  7024. }
  7025. }
  7026. // destroy old node
  7027. if (isDef(parentElm)) {
  7028. removeVnodes([oldVnode], 0, 0);
  7029. }
  7030. else if (isDef(oldVnode.tag)) {
  7031. invokeDestroyHook(oldVnode);
  7032. }
  7033. }
  7034. }
  7035. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  7036. return vnode.elm;
  7037. };
  7038. }
  7039. var directives$1 = {
  7040. create: updateDirectives,
  7041. update: updateDirectives,
  7042. destroy: function unbindDirectives(vnode) {
  7043. // @ts-expect-error emptyNode is not VNodeWithData
  7044. updateDirectives(vnode, emptyNode);
  7045. }
  7046. };
  7047. function updateDirectives(oldVnode, vnode) {
  7048. if (oldVnode.data.directives || vnode.data.directives) {
  7049. _update(oldVnode, vnode);
  7050. }
  7051. }
  7052. function _update(oldVnode, vnode) {
  7053. var isCreate = oldVnode === emptyNode;
  7054. var isDestroy = vnode === emptyNode;
  7055. var oldDirs = normalizeDirectives(oldVnode.data.directives, oldVnode.context);
  7056. var newDirs = normalizeDirectives(vnode.data.directives, vnode.context);
  7057. var dirsWithInsert = [];
  7058. var dirsWithPostpatch = [];
  7059. var key, oldDir, dir;
  7060. for (key in newDirs) {
  7061. oldDir = oldDirs[key];
  7062. dir = newDirs[key];
  7063. if (!oldDir) {
  7064. // new directive, bind
  7065. callHook(dir, 'bind', vnode, oldVnode);
  7066. if (dir.def && dir.def.inserted) {
  7067. dirsWithInsert.push(dir);
  7068. }
  7069. }
  7070. else {
  7071. // existing directive, update
  7072. dir.oldValue = oldDir.value;
  7073. dir.oldArg = oldDir.arg;
  7074. callHook(dir, 'update', vnode, oldVnode);
  7075. if (dir.def && dir.def.componentUpdated) {
  7076. dirsWithPostpatch.push(dir);
  7077. }
  7078. }
  7079. }
  7080. if (dirsWithInsert.length) {
  7081. var callInsert = function () {
  7082. for (var i = 0; i < dirsWithInsert.length; i++) {
  7083. callHook(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  7084. }
  7085. };
  7086. if (isCreate) {
  7087. mergeVNodeHook(vnode, 'insert', callInsert);
  7088. }
  7089. else {
  7090. callInsert();
  7091. }
  7092. }
  7093. if (dirsWithPostpatch.length) {
  7094. mergeVNodeHook(vnode, 'postpatch', function () {
  7095. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  7096. callHook(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  7097. }
  7098. });
  7099. }
  7100. if (!isCreate) {
  7101. for (key in oldDirs) {
  7102. if (!newDirs[key]) {
  7103. // no longer present, unbind
  7104. callHook(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  7105. }
  7106. }
  7107. }
  7108. }
  7109. var emptyModifiers = Object.create(null);
  7110. function normalizeDirectives(dirs, vm) {
  7111. var res = Object.create(null);
  7112. if (!dirs) {
  7113. // $flow-disable-line
  7114. return res;
  7115. }
  7116. var i, dir;
  7117. for (i = 0; i < dirs.length; i++) {
  7118. dir = dirs[i];
  7119. if (!dir.modifiers) {
  7120. // $flow-disable-line
  7121. dir.modifiers = emptyModifiers;
  7122. }
  7123. res[getRawDirName(dir)] = dir;
  7124. if (vm._setupState && vm._setupState.__sfc) {
  7125. var setupDef = dir.def || resolveAsset(vm, '_setupState', 'v-' + dir.name);
  7126. if (typeof setupDef === 'function') {
  7127. dir.def = {
  7128. bind: setupDef,
  7129. update: setupDef,
  7130. };
  7131. }
  7132. else {
  7133. dir.def = setupDef;
  7134. }
  7135. }
  7136. dir.def = dir.def || resolveAsset(vm.$options, 'directives', dir.name, true);
  7137. }
  7138. // $flow-disable-line
  7139. return res;
  7140. }
  7141. function getRawDirName(dir) {
  7142. return (dir.rawName || "".concat(dir.name, ".").concat(Object.keys(dir.modifiers || {}).join('.')));
  7143. }
  7144. function callHook(dir, hook, vnode, oldVnode, isDestroy) {
  7145. var fn = dir.def && dir.def[hook];
  7146. if (fn) {
  7147. try {
  7148. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  7149. }
  7150. catch (e) {
  7151. handleError(e, vnode.context, "directive ".concat(dir.name, " ").concat(hook, " hook"));
  7152. }
  7153. }
  7154. }
  7155. var baseModules = [ref, directives$1];
  7156. function updateAttrs(oldVnode, vnode) {
  7157. var opts = vnode.componentOptions;
  7158. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  7159. return;
  7160. }
  7161. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  7162. return;
  7163. }
  7164. var key, cur, old;
  7165. var elm = vnode.elm;
  7166. var oldAttrs = oldVnode.data.attrs || {};
  7167. var attrs = vnode.data.attrs || {};
  7168. // clone observed objects, as the user probably wants to mutate it
  7169. if (isDef(attrs.__ob__) || isTrue(attrs._v_attr_proxy)) {
  7170. attrs = vnode.data.attrs = extend({}, attrs);
  7171. }
  7172. for (key in attrs) {
  7173. cur = attrs[key];
  7174. old = oldAttrs[key];
  7175. if (old !== cur) {
  7176. setAttr(elm, key, cur, vnode.data.pre);
  7177. }
  7178. }
  7179. // #4391: in IE9, setting type can reset value for input[type=radio]
  7180. // #6666: IE/Edge forces progress value down to 1 before setting a max
  7181. /* istanbul ignore if */
  7182. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  7183. setAttr(elm, 'value', attrs.value);
  7184. }
  7185. for (key in oldAttrs) {
  7186. if (isUndef(attrs[key])) {
  7187. if (isXlink(key)) {
  7188. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  7189. }
  7190. else if (!isEnumeratedAttr(key)) {
  7191. elm.removeAttribute(key);
  7192. }
  7193. }
  7194. }
  7195. }
  7196. function setAttr(el, key, value, isInPre) {
  7197. if (isInPre || el.tagName.indexOf('-') > -1) {
  7198. baseSetAttr(el, key, value);
  7199. }
  7200. else if (isBooleanAttr(key)) {
  7201. // set attribute for blank value
  7202. // e.g. <option disabled>Select one</option>
  7203. if (isFalsyAttrValue(value)) {
  7204. el.removeAttribute(key);
  7205. }
  7206. else {
  7207. // technically allowfullscreen is a boolean attribute for <iframe>,
  7208. // but Flash expects a value of "true" when used on <embed> tag
  7209. value = key === 'allowfullscreen' && el.tagName === 'EMBED' ? 'true' : key;
  7210. el.setAttribute(key, value);
  7211. }
  7212. }
  7213. else if (isEnumeratedAttr(key)) {
  7214. el.setAttribute(key, convertEnumeratedValue(key, value));
  7215. }
  7216. else if (isXlink(key)) {
  7217. if (isFalsyAttrValue(value)) {
  7218. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  7219. }
  7220. else {
  7221. el.setAttributeNS(xlinkNS, key, value);
  7222. }
  7223. }
  7224. else {
  7225. baseSetAttr(el, key, value);
  7226. }
  7227. }
  7228. function baseSetAttr(el, key, value) {
  7229. if (isFalsyAttrValue(value)) {
  7230. el.removeAttribute(key);
  7231. }
  7232. else {
  7233. // #7138: IE10 & 11 fires input event when setting placeholder on
  7234. // <textarea>... block the first input event and remove the blocker
  7235. // immediately.
  7236. /* istanbul ignore if */
  7237. if (isIE &&
  7238. !isIE9 &&
  7239. el.tagName === 'TEXTAREA' &&
  7240. key === 'placeholder' &&
  7241. value !== '' &&
  7242. !el.__ieph) {
  7243. var blocker_1 = function (e) {
  7244. e.stopImmediatePropagation();
  7245. el.removeEventListener('input', blocker_1);
  7246. };
  7247. el.addEventListener('input', blocker_1);
  7248. // $flow-disable-line
  7249. el.__ieph = true; /* IE placeholder patched */
  7250. }
  7251. el.setAttribute(key, value);
  7252. }
  7253. }
  7254. var attrs = {
  7255. create: updateAttrs,
  7256. update: updateAttrs
  7257. };
  7258. function updateClass(oldVnode, vnode) {
  7259. var el = vnode.elm;
  7260. var data = vnode.data;
  7261. var oldData = oldVnode.data;
  7262. if (isUndef(data.staticClass) &&
  7263. isUndef(data.class) &&
  7264. (isUndef(oldData) ||
  7265. (isUndef(oldData.staticClass) && isUndef(oldData.class)))) {
  7266. return;
  7267. }
  7268. var cls = genClassForVnode(vnode);
  7269. // handle transition classes
  7270. var transitionClass = el._transitionClasses;
  7271. if (isDef(transitionClass)) {
  7272. cls = concat(cls, stringifyClass(transitionClass));
  7273. }
  7274. // set the class
  7275. if (cls !== el._prevClass) {
  7276. el.setAttribute('class', cls);
  7277. el._prevClass = cls;
  7278. }
  7279. }
  7280. var klass$1 = {
  7281. create: updateClass,
  7282. update: updateClass
  7283. };
  7284. var validDivisionCharRE = /[\w).+\-_$\]]/;
  7285. function parseFilters(exp) {
  7286. var inSingle = false;
  7287. var inDouble = false;
  7288. var inTemplateString = false;
  7289. var inRegex = false;
  7290. var curly = 0;
  7291. var square = 0;
  7292. var paren = 0;
  7293. var lastFilterIndex = 0;
  7294. var c, prev, i, expression, filters;
  7295. for (i = 0; i < exp.length; i++) {
  7296. prev = c;
  7297. c = exp.charCodeAt(i);
  7298. if (inSingle) {
  7299. if (c === 0x27 && prev !== 0x5c)
  7300. inSingle = false;
  7301. }
  7302. else if (inDouble) {
  7303. if (c === 0x22 && prev !== 0x5c)
  7304. inDouble = false;
  7305. }
  7306. else if (inTemplateString) {
  7307. if (c === 0x60 && prev !== 0x5c)
  7308. inTemplateString = false;
  7309. }
  7310. else if (inRegex) {
  7311. if (c === 0x2f && prev !== 0x5c)
  7312. inRegex = false;
  7313. }
  7314. else if (c === 0x7c && // pipe
  7315. exp.charCodeAt(i + 1) !== 0x7c &&
  7316. exp.charCodeAt(i - 1) !== 0x7c &&
  7317. !curly &&
  7318. !square &&
  7319. !paren) {
  7320. if (expression === undefined) {
  7321. // first filter, end of expression
  7322. lastFilterIndex = i + 1;
  7323. expression = exp.slice(0, i).trim();
  7324. }
  7325. else {
  7326. pushFilter();
  7327. }
  7328. }
  7329. else {
  7330. switch (c) {
  7331. case 0x22:
  7332. inDouble = true;
  7333. break; // "
  7334. case 0x27:
  7335. inSingle = true;
  7336. break; // '
  7337. case 0x60:
  7338. inTemplateString = true;
  7339. break; // `
  7340. case 0x28:
  7341. paren++;
  7342. break; // (
  7343. case 0x29:
  7344. paren--;
  7345. break; // )
  7346. case 0x5b:
  7347. square++;
  7348. break; // [
  7349. case 0x5d:
  7350. square--;
  7351. break; // ]
  7352. case 0x7b:
  7353. curly++;
  7354. break; // {
  7355. case 0x7d:
  7356. curly--;
  7357. break; // }
  7358. }
  7359. if (c === 0x2f) {
  7360. // /
  7361. var j = i - 1;
  7362. var p
  7363. // find first non-whitespace prev char
  7364. = void 0;
  7365. // find first non-whitespace prev char
  7366. for (; j >= 0; j--) {
  7367. p = exp.charAt(j);
  7368. if (p !== ' ')
  7369. break;
  7370. }
  7371. if (!p || !validDivisionCharRE.test(p)) {
  7372. inRegex = true;
  7373. }
  7374. }
  7375. }
  7376. }
  7377. if (expression === undefined) {
  7378. expression = exp.slice(0, i).trim();
  7379. }
  7380. else if (lastFilterIndex !== 0) {
  7381. pushFilter();
  7382. }
  7383. function pushFilter() {
  7384. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  7385. lastFilterIndex = i + 1;
  7386. }
  7387. if (filters) {
  7388. for (i = 0; i < filters.length; i++) {
  7389. expression = wrapFilter(expression, filters[i]);
  7390. }
  7391. }
  7392. return expression;
  7393. }
  7394. function wrapFilter(exp, filter) {
  7395. var i = filter.indexOf('(');
  7396. if (i < 0) {
  7397. // _f: resolveFilter
  7398. return "_f(\"".concat(filter, "\")(").concat(exp, ")");
  7399. }
  7400. else {
  7401. var name_1 = filter.slice(0, i);
  7402. var args = filter.slice(i + 1);
  7403. return "_f(\"".concat(name_1, "\")(").concat(exp).concat(args !== ')' ? ',' + args : args);
  7404. }
  7405. }
  7406. /* eslint-disable no-unused-vars */
  7407. function baseWarn(msg, range) {
  7408. console.error("[Vue compiler]: ".concat(msg));
  7409. }
  7410. /* eslint-enable no-unused-vars */
  7411. function pluckModuleFunction(modules, key) {
  7412. return modules ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; }) : [];
  7413. }
  7414. function addProp(el, name, value, range, dynamic) {
  7415. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  7416. el.plain = false;
  7417. }
  7418. function addAttr(el, name, value, range, dynamic) {
  7419. var attrs = dynamic
  7420. ? el.dynamicAttrs || (el.dynamicAttrs = [])
  7421. : el.attrs || (el.attrs = []);
  7422. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  7423. el.plain = false;
  7424. }
  7425. // add a raw attr (use this in preTransforms)
  7426. function addRawAttr(el, name, value, range) {
  7427. el.attrsMap[name] = value;
  7428. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  7429. }
  7430. function addDirective(el, name, rawName, value, arg, isDynamicArg, modifiers, range) {
  7431. (el.directives || (el.directives = [])).push(rangeSetItem({
  7432. name: name,
  7433. rawName: rawName,
  7434. value: value,
  7435. arg: arg,
  7436. isDynamicArg: isDynamicArg,
  7437. modifiers: modifiers
  7438. }, range));
  7439. el.plain = false;
  7440. }
  7441. function prependModifierMarker(symbol, name, dynamic) {
  7442. return dynamic ? "_p(".concat(name, ",\"").concat(symbol, "\")") : symbol + name; // mark the event as captured
  7443. }
  7444. function addHandler(el, name, value, modifiers, important, warn, range, dynamic) {
  7445. modifiers = modifiers || emptyObject;
  7446. // warn prevent and passive modifier
  7447. /* istanbul ignore if */
  7448. if (warn && modifiers.prevent && modifiers.passive) {
  7449. warn("passive and prevent can't be used together. " +
  7450. "Passive handler can't prevent default event.", range);
  7451. }
  7452. // normalize click.right and click.middle since they don't actually fire
  7453. // this is technically browser-specific, but at least for now browsers are
  7454. // the only target envs that have right/middle clicks.
  7455. if (modifiers.right) {
  7456. if (dynamic) {
  7457. name = "(".concat(name, ")==='click'?'contextmenu':(").concat(name, ")");
  7458. }
  7459. else if (name === 'click') {
  7460. name = 'contextmenu';
  7461. delete modifiers.right;
  7462. }
  7463. }
  7464. else if (modifiers.middle) {
  7465. if (dynamic) {
  7466. name = "(".concat(name, ")==='click'?'mouseup':(").concat(name, ")");
  7467. }
  7468. else if (name === 'click') {
  7469. name = 'mouseup';
  7470. }
  7471. }
  7472. // check capture modifier
  7473. if (modifiers.capture) {
  7474. delete modifiers.capture;
  7475. name = prependModifierMarker('!', name, dynamic);
  7476. }
  7477. if (modifiers.once) {
  7478. delete modifiers.once;
  7479. name = prependModifierMarker('~', name, dynamic);
  7480. }
  7481. /* istanbul ignore if */
  7482. if (modifiers.passive) {
  7483. delete modifiers.passive;
  7484. name = prependModifierMarker('&', name, dynamic);
  7485. }
  7486. var events;
  7487. if (modifiers.native) {
  7488. delete modifiers.native;
  7489. events = el.nativeEvents || (el.nativeEvents = {});
  7490. }
  7491. else {
  7492. events = el.events || (el.events = {});
  7493. }
  7494. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  7495. if (modifiers !== emptyObject) {
  7496. newHandler.modifiers = modifiers;
  7497. }
  7498. var handlers = events[name];
  7499. /* istanbul ignore if */
  7500. if (Array.isArray(handlers)) {
  7501. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  7502. }
  7503. else if (handlers) {
  7504. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  7505. }
  7506. else {
  7507. events[name] = newHandler;
  7508. }
  7509. el.plain = false;
  7510. }
  7511. function getRawBindingAttr(el, name) {
  7512. return (el.rawAttrsMap[':' + name] ||
  7513. el.rawAttrsMap['v-bind:' + name] ||
  7514. el.rawAttrsMap[name]);
  7515. }
  7516. function getBindingAttr(el, name, getStatic) {
  7517. var dynamicValue = getAndRemoveAttr(el, ':' + name) || getAndRemoveAttr(el, 'v-bind:' + name);
  7518. if (dynamicValue != null) {
  7519. return parseFilters(dynamicValue);
  7520. }
  7521. else if (getStatic !== false) {
  7522. var staticValue = getAndRemoveAttr(el, name);
  7523. if (staticValue != null) {
  7524. return JSON.stringify(staticValue);
  7525. }
  7526. }
  7527. }
  7528. // note: this only removes the attr from the Array (attrsList) so that it
  7529. // doesn't get processed by processAttrs.
  7530. // By default it does NOT remove it from the map (attrsMap) because the map is
  7531. // needed during codegen.
  7532. function getAndRemoveAttr(el, name, removeFromMap) {
  7533. var val;
  7534. if ((val = el.attrsMap[name]) != null) {
  7535. var list = el.attrsList;
  7536. for (var i = 0, l = list.length; i < l; i++) {
  7537. if (list[i].name === name) {
  7538. list.splice(i, 1);
  7539. break;
  7540. }
  7541. }
  7542. }
  7543. if (removeFromMap) {
  7544. delete el.attrsMap[name];
  7545. }
  7546. return val;
  7547. }
  7548. function getAndRemoveAttrByRegex(el, name) {
  7549. var list = el.attrsList;
  7550. for (var i = 0, l = list.length; i < l; i++) {
  7551. var attr = list[i];
  7552. if (name.test(attr.name)) {
  7553. list.splice(i, 1);
  7554. return attr;
  7555. }
  7556. }
  7557. }
  7558. function rangeSetItem(item, range) {
  7559. if (range) {
  7560. if (range.start != null) {
  7561. item.start = range.start;
  7562. }
  7563. if (range.end != null) {
  7564. item.end = range.end;
  7565. }
  7566. }
  7567. return item;
  7568. }
  7569. /**
  7570. * Cross-platform code generation for component v-model
  7571. */
  7572. function genComponentModel(el, value, modifiers) {
  7573. var _a = modifiers || {}, number = _a.number, trim = _a.trim;
  7574. var baseValueExpression = '$$v';
  7575. var valueExpression = baseValueExpression;
  7576. if (trim) {
  7577. valueExpression =
  7578. "(typeof ".concat(baseValueExpression, " === 'string'") +
  7579. "? ".concat(baseValueExpression, ".trim()") +
  7580. ": ".concat(baseValueExpression, ")");
  7581. }
  7582. if (number) {
  7583. valueExpression = "_n(".concat(valueExpression, ")");
  7584. }
  7585. var assignment = genAssignmentCode(value, valueExpression);
  7586. el.model = {
  7587. value: "(".concat(value, ")"),
  7588. expression: JSON.stringify(value),
  7589. callback: "function (".concat(baseValueExpression, ") {").concat(assignment, "}")
  7590. };
  7591. }
  7592. /**
  7593. * Cross-platform codegen helper for generating v-model value assignment code.
  7594. */
  7595. function genAssignmentCode(value, assignment) {
  7596. var res = parseModel(value);
  7597. if (res.key === null) {
  7598. return "".concat(value, "=").concat(assignment);
  7599. }
  7600. else {
  7601. return "$set(".concat(res.exp, ", ").concat(res.key, ", ").concat(assignment, ")");
  7602. }
  7603. }
  7604. /**
  7605. * Parse a v-model expression into a base path and a final key segment.
  7606. * Handles both dot-path and possible square brackets.
  7607. *
  7608. * Possible cases:
  7609. *
  7610. * - test
  7611. * - test[key]
  7612. * - test[test1[key]]
  7613. * - test["a"][key]
  7614. * - xxx.test[a[a].test1[key]]
  7615. * - test.xxx.a["asa"][test1[key]]
  7616. *
  7617. */
  7618. var len, str, chr, index, expressionPos, expressionEndPos;
  7619. function parseModel(val) {
  7620. // Fix https://github.com/vuejs/vue/pull/7730
  7621. // allow v-model="obj.val " (trailing whitespace)
  7622. val = val.trim();
  7623. len = val.length;
  7624. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  7625. index = val.lastIndexOf('.');
  7626. if (index > -1) {
  7627. return {
  7628. exp: val.slice(0, index),
  7629. key: '"' + val.slice(index + 1) + '"'
  7630. };
  7631. }
  7632. else {
  7633. return {
  7634. exp: val,
  7635. key: null
  7636. };
  7637. }
  7638. }
  7639. str = val;
  7640. index = expressionPos = expressionEndPos = 0;
  7641. while (!eof()) {
  7642. chr = next();
  7643. /* istanbul ignore if */
  7644. if (isStringStart(chr)) {
  7645. parseString(chr);
  7646. }
  7647. else if (chr === 0x5b) {
  7648. parseBracket(chr);
  7649. }
  7650. }
  7651. return {
  7652. exp: val.slice(0, expressionPos),
  7653. key: val.slice(expressionPos + 1, expressionEndPos)
  7654. };
  7655. }
  7656. function next() {
  7657. return str.charCodeAt(++index);
  7658. }
  7659. function eof() {
  7660. return index >= len;
  7661. }
  7662. function isStringStart(chr) {
  7663. return chr === 0x22 || chr === 0x27;
  7664. }
  7665. function parseBracket(chr) {
  7666. var inBracket = 1;
  7667. expressionPos = index;
  7668. while (!eof()) {
  7669. chr = next();
  7670. if (isStringStart(chr)) {
  7671. parseString(chr);
  7672. continue;
  7673. }
  7674. if (chr === 0x5b)
  7675. inBracket++;
  7676. if (chr === 0x5d)
  7677. inBracket--;
  7678. if (inBracket === 0) {
  7679. expressionEndPos = index;
  7680. break;
  7681. }
  7682. }
  7683. }
  7684. function parseString(chr) {
  7685. var stringQuote = chr;
  7686. while (!eof()) {
  7687. chr = next();
  7688. if (chr === stringQuote) {
  7689. break;
  7690. }
  7691. }
  7692. }
  7693. var warn$1;
  7694. // in some cases, the event used has to be determined at runtime
  7695. // so we used some reserved tokens during compile.
  7696. var RANGE_TOKEN = '__r';
  7697. var CHECKBOX_RADIO_TOKEN = '__c';
  7698. function model$1(el, dir, _warn) {
  7699. warn$1 = _warn;
  7700. var value = dir.value;
  7701. var modifiers = dir.modifiers;
  7702. var tag = el.tag;
  7703. var type = el.attrsMap.type;
  7704. {
  7705. // inputs with type="file" are read only and setting the input's
  7706. // value will throw an error.
  7707. if (tag === 'input' && type === 'file') {
  7708. warn$1("<".concat(el.tag, " v-model=\"").concat(value, "\" type=\"file\">:\n") +
  7709. "File inputs are read only. Use a v-on:change listener instead.", el.rawAttrsMap['v-model']);
  7710. }
  7711. }
  7712. if (el.component) {
  7713. genComponentModel(el, value, modifiers);
  7714. // component v-model doesn't need extra runtime
  7715. return false;
  7716. }
  7717. else if (tag === 'select') {
  7718. genSelect(el, value, modifiers);
  7719. }
  7720. else if (tag === 'input' && type === 'checkbox') {
  7721. genCheckboxModel(el, value, modifiers);
  7722. }
  7723. else if (tag === 'input' && type === 'radio') {
  7724. genRadioModel(el, value, modifiers);
  7725. }
  7726. else if (tag === 'input' || tag === 'textarea') {
  7727. genDefaultModel(el, value, modifiers);
  7728. }
  7729. else if (!config.isReservedTag(tag)) {
  7730. genComponentModel(el, value, modifiers);
  7731. // component v-model doesn't need extra runtime
  7732. return false;
  7733. }
  7734. else {
  7735. warn$1("<".concat(el.tag, " v-model=\"").concat(value, "\">: ") +
  7736. "v-model is not supported on this element type. " +
  7737. "If you are working with contenteditable, it's recommended to " +
  7738. 'wrap a library dedicated for that purpose inside a custom component.', el.rawAttrsMap['v-model']);
  7739. }
  7740. // ensure runtime directive metadata
  7741. return true;
  7742. }
  7743. function genCheckboxModel(el, value, modifiers) {
  7744. var number = modifiers && modifiers.number;
  7745. var valueBinding = getBindingAttr(el, 'value') || 'null';
  7746. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  7747. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  7748. addProp(el, 'checked', "Array.isArray(".concat(value, ")") +
  7749. "?_i(".concat(value, ",").concat(valueBinding, ")>-1") +
  7750. (trueValueBinding === 'true'
  7751. ? ":(".concat(value, ")")
  7752. : ":_q(".concat(value, ",").concat(trueValueBinding, ")")));
  7753. addHandler(el, 'change', "var $$a=".concat(value, ",") +
  7754. '$$el=$event.target,' +
  7755. "$$c=$$el.checked?(".concat(trueValueBinding, "):(").concat(falseValueBinding, ");") +
  7756. 'if(Array.isArray($$a)){' +
  7757. "var $$v=".concat(number ? '_n(' + valueBinding + ')' : valueBinding, ",") +
  7758. '$$i=_i($$a,$$v);' +
  7759. "if($$el.checked){$$i<0&&(".concat(genAssignmentCode(value, '$$a.concat([$$v])'), ")}") +
  7760. "else{$$i>-1&&(".concat(genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))'), ")}") +
  7761. "}else{".concat(genAssignmentCode(value, '$$c'), "}"), null, true);
  7762. }
  7763. function genRadioModel(el, value, modifiers) {
  7764. var number = modifiers && modifiers.number;
  7765. var valueBinding = getBindingAttr(el, 'value') || 'null';
  7766. valueBinding = number ? "_n(".concat(valueBinding, ")") : valueBinding;
  7767. addProp(el, 'checked', "_q(".concat(value, ",").concat(valueBinding, ")"));
  7768. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  7769. }
  7770. function genSelect(el, value, modifiers) {
  7771. var number = modifiers && modifiers.number;
  7772. var selectedVal = "Array.prototype.filter" +
  7773. ".call($event.target.options,function(o){return o.selected})" +
  7774. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  7775. "return ".concat(number ? '_n(val)' : 'val', "})");
  7776. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  7777. var code = "var $$selectedVal = ".concat(selectedVal, ";");
  7778. code = "".concat(code, " ").concat(genAssignmentCode(value, assignment));
  7779. addHandler(el, 'change', code, null, true);
  7780. }
  7781. function genDefaultModel(el, value, modifiers) {
  7782. var type = el.attrsMap.type;
  7783. // warn if v-bind:value conflicts with v-model
  7784. // except for inputs with v-bind:type
  7785. {
  7786. var value_1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  7787. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  7788. if (value_1 && !typeBinding) {
  7789. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  7790. warn$1("".concat(binding, "=\"").concat(value_1, "\" conflicts with v-model on the same element ") +
  7791. 'because the latter already expands to a value binding internally', el.rawAttrsMap[binding]);
  7792. }
  7793. }
  7794. var _a = modifiers || {}, lazy = _a.lazy, number = _a.number, trim = _a.trim;
  7795. var needCompositionGuard = !lazy && type !== 'range';
  7796. var event = lazy ? 'change' : type === 'range' ? RANGE_TOKEN : 'input';
  7797. var valueExpression = '$event.target.value';
  7798. if (trim) {
  7799. valueExpression = "$event.target.value.trim()";
  7800. }
  7801. if (number) {
  7802. valueExpression = "_n(".concat(valueExpression, ")");
  7803. }
  7804. var code = genAssignmentCode(value, valueExpression);
  7805. if (needCompositionGuard) {
  7806. code = "if($event.target.composing)return;".concat(code);
  7807. }
  7808. addProp(el, 'value', "(".concat(value, ")"));
  7809. addHandler(el, event, code, null, true);
  7810. if (trim || number) {
  7811. addHandler(el, 'blur', '$forceUpdate()');
  7812. }
  7813. }
  7814. // normalize v-model event tokens that can only be determined at runtime.
  7815. // it's important to place the event as the first in the array because
  7816. // the whole point is ensuring the v-model callback gets called before
  7817. // user-attached handlers.
  7818. function normalizeEvents(on) {
  7819. /* istanbul ignore if */
  7820. if (isDef(on[RANGE_TOKEN])) {
  7821. // IE input[type=range] only supports `change` event
  7822. var event_1 = isIE ? 'change' : 'input';
  7823. on[event_1] = [].concat(on[RANGE_TOKEN], on[event_1] || []);
  7824. delete on[RANGE_TOKEN];
  7825. }
  7826. // This was originally intended to fix #4521 but no longer necessary
  7827. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  7828. /* istanbul ignore if */
  7829. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  7830. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  7831. delete on[CHECKBOX_RADIO_TOKEN];
  7832. }
  7833. }
  7834. var target;
  7835. function createOnceHandler(event, handler, capture) {
  7836. var _target = target; // save current target element in closure
  7837. return function onceHandler() {
  7838. var res = handler.apply(null, arguments);
  7839. if (res !== null) {
  7840. remove(event, onceHandler, capture, _target);
  7841. }
  7842. };
  7843. }
  7844. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  7845. // implementation and does not fire microtasks in between event propagation, so
  7846. // safe to exclude.
  7847. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  7848. function add(name, handler, capture, passive) {
  7849. // async edge case #6566: inner click event triggers patch, event handler
  7850. // attached to outer element during patch, and triggered again. This
  7851. // happens because browsers fire microtask ticks between event propagation.
  7852. // the solution is simple: we save the timestamp when a handler is attached,
  7853. // and the handler would only fire if the event passed to it was fired
  7854. // AFTER it was attached.
  7855. if (useMicrotaskFix) {
  7856. var attachedTimestamp_1 = currentFlushTimestamp;
  7857. var original_1 = handler;
  7858. //@ts-expect-error
  7859. handler = original_1._wrapper = function (e) {
  7860. if (
  7861. // no bubbling, should always fire.
  7862. // this is just a safety net in case event.timeStamp is unreliable in
  7863. // certain weird environments...
  7864. e.target === e.currentTarget ||
  7865. // event is fired after handler attachment
  7866. e.timeStamp >= attachedTimestamp_1 ||
  7867. // bail for environments that have buggy event.timeStamp implementations
  7868. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  7869. // #9681 QtWebEngine event.timeStamp is negative value
  7870. e.timeStamp <= 0 ||
  7871. // #9448 bail if event is fired in another document in a multi-page
  7872. // electron/nw.js app, since event.timeStamp will be using a different
  7873. // starting reference
  7874. e.target.ownerDocument !== document) {
  7875. return original_1.apply(this, arguments);
  7876. }
  7877. };
  7878. }
  7879. target.addEventListener(name, handler, supportsPassive ? { capture: capture, passive: passive } : capture);
  7880. }
  7881. function remove(name, handler, capture, _target) {
  7882. (_target || target).removeEventListener(name,
  7883. //@ts-expect-error
  7884. handler._wrapper || handler, capture);
  7885. }
  7886. function updateDOMListeners(oldVnode, vnode) {
  7887. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  7888. return;
  7889. }
  7890. var on = vnode.data.on || {};
  7891. var oldOn = oldVnode.data.on || {};
  7892. // vnode is empty when removing all listeners,
  7893. // and use old vnode dom element
  7894. target = vnode.elm || oldVnode.elm;
  7895. normalizeEvents(on);
  7896. updateListeners(on, oldOn, add, remove, createOnceHandler, vnode.context);
  7897. target = undefined;
  7898. }
  7899. var events = {
  7900. create: updateDOMListeners,
  7901. update: updateDOMListeners,
  7902. // @ts-expect-error emptyNode has actually data
  7903. destroy: function (vnode) { return updateDOMListeners(vnode, emptyNode); }
  7904. };
  7905. var svgContainer;
  7906. function updateDOMProps(oldVnode, vnode) {
  7907. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  7908. return;
  7909. }
  7910. var key, cur;
  7911. var elm = vnode.elm;
  7912. var oldProps = oldVnode.data.domProps || {};
  7913. var props = vnode.data.domProps || {};
  7914. // clone observed objects, as the user probably wants to mutate it
  7915. if (isDef(props.__ob__) || isTrue(props._v_attr_proxy)) {
  7916. props = vnode.data.domProps = extend({}, props);
  7917. }
  7918. for (key in oldProps) {
  7919. if (!(key in props)) {
  7920. elm[key] = '';
  7921. }
  7922. }
  7923. for (key in props) {
  7924. cur = props[key];
  7925. // ignore children if the node has textContent or innerHTML,
  7926. // as these will throw away existing DOM nodes and cause removal errors
  7927. // on subsequent patches (#3360)
  7928. if (key === 'textContent' || key === 'innerHTML') {
  7929. if (vnode.children)
  7930. vnode.children.length = 0;
  7931. if (cur === oldProps[key])
  7932. continue;
  7933. // #6601 work around Chrome version <= 55 bug where single textNode
  7934. // replaced by innerHTML/textContent retains its parentNode property
  7935. if (elm.childNodes.length === 1) {
  7936. elm.removeChild(elm.childNodes[0]);
  7937. }
  7938. }
  7939. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  7940. // store value as _value as well since
  7941. // non-string values will be stringified
  7942. elm._value = cur;
  7943. // avoid resetting cursor position when value is the same
  7944. var strCur = isUndef(cur) ? '' : String(cur);
  7945. if (shouldUpdateValue(elm, strCur)) {
  7946. elm.value = strCur;
  7947. }
  7948. }
  7949. else if (key === 'innerHTML' &&
  7950. isSVG(elm.tagName) &&
  7951. isUndef(elm.innerHTML)) {
  7952. // IE doesn't support innerHTML for SVG elements
  7953. svgContainer = svgContainer || document.createElement('div');
  7954. svgContainer.innerHTML = "<svg>".concat(cur, "</svg>");
  7955. var svg = svgContainer.firstChild;
  7956. while (elm.firstChild) {
  7957. elm.removeChild(elm.firstChild);
  7958. }
  7959. while (svg.firstChild) {
  7960. elm.appendChild(svg.firstChild);
  7961. }
  7962. }
  7963. else if (
  7964. // skip the update if old and new VDOM state is the same.
  7965. // `value` is handled separately because the DOM value may be temporarily
  7966. // out of sync with VDOM state due to focus, composition and modifiers.
  7967. // This #4521 by skipping the unnecessary `checked` update.
  7968. cur !== oldProps[key]) {
  7969. // some property updates can throw
  7970. // e.g. `value` on <progress> w/ non-finite value
  7971. try {
  7972. elm[key] = cur;
  7973. }
  7974. catch (e) { }
  7975. }
  7976. }
  7977. }
  7978. function shouldUpdateValue(elm, checkVal) {
  7979. return (
  7980. //@ts-expect-error
  7981. !elm.composing &&
  7982. (elm.tagName === 'OPTION' ||
  7983. isNotInFocusAndDirty(elm, checkVal) ||
  7984. isDirtyWithModifiers(elm, checkVal)));
  7985. }
  7986. function isNotInFocusAndDirty(elm, checkVal) {
  7987. // return true when textbox (.number and .trim) loses focus and its value is
  7988. // not equal to the updated value
  7989. var notInFocus = true;
  7990. // #6157
  7991. // work around IE bug when accessing document.activeElement in an iframe
  7992. try {
  7993. notInFocus = document.activeElement !== elm;
  7994. }
  7995. catch (e) { }
  7996. return notInFocus && elm.value !== checkVal;
  7997. }
  7998. function isDirtyWithModifiers(elm, newVal) {
  7999. var value = elm.value;
  8000. var modifiers = elm._vModifiers; // injected by v-model runtime
  8001. if (isDef(modifiers)) {
  8002. if (modifiers.number) {
  8003. return toNumber(value) !== toNumber(newVal);
  8004. }
  8005. if (modifiers.trim) {
  8006. return value.trim() !== newVal.trim();
  8007. }
  8008. }
  8009. return value !== newVal;
  8010. }
  8011. var domProps = {
  8012. create: updateDOMProps,
  8013. update: updateDOMProps
  8014. };
  8015. var parseStyleText = cached(function (cssText) {
  8016. var res = {};
  8017. var listDelimiter = /;(?![^(]*\))/g;
  8018. var propertyDelimiter = /:(.+)/;
  8019. cssText.split(listDelimiter).forEach(function (item) {
  8020. if (item) {
  8021. var tmp = item.split(propertyDelimiter);
  8022. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  8023. }
  8024. });
  8025. return res;
  8026. });
  8027. // merge static and dynamic style data on the same vnode
  8028. function normalizeStyleData(data) {
  8029. var style = normalizeStyleBinding(data.style);
  8030. // static style is pre-processed into an object during compilation
  8031. // and is always a fresh object, so it's safe to merge into it
  8032. return data.staticStyle ? extend(data.staticStyle, style) : style;
  8033. }
  8034. // normalize possible array / string values into Object
  8035. function normalizeStyleBinding(bindingStyle) {
  8036. if (Array.isArray(bindingStyle)) {
  8037. return toObject(bindingStyle);
  8038. }
  8039. if (typeof bindingStyle === 'string') {
  8040. return parseStyleText(bindingStyle);
  8041. }
  8042. return bindingStyle;
  8043. }
  8044. /**
  8045. * parent component style should be after child's
  8046. * so that parent component's style could override it
  8047. */
  8048. function getStyle(vnode, checkChild) {
  8049. var res = {};
  8050. var styleData;
  8051. if (checkChild) {
  8052. var childNode = vnode;
  8053. while (childNode.componentInstance) {
  8054. childNode = childNode.componentInstance._vnode;
  8055. if (childNode &&
  8056. childNode.data &&
  8057. (styleData = normalizeStyleData(childNode.data))) {
  8058. extend(res, styleData);
  8059. }
  8060. }
  8061. }
  8062. if ((styleData = normalizeStyleData(vnode.data))) {
  8063. extend(res, styleData);
  8064. }
  8065. var parentNode = vnode;
  8066. // @ts-expect-error parentNode.parent not VNodeWithData
  8067. while ((parentNode = parentNode.parent)) {
  8068. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  8069. extend(res, styleData);
  8070. }
  8071. }
  8072. return res;
  8073. }
  8074. var cssVarRE = /^--/;
  8075. var importantRE = /\s*!important$/;
  8076. var setProp = function (el, name, val) {
  8077. /* istanbul ignore if */
  8078. if (cssVarRE.test(name)) {
  8079. el.style.setProperty(name, val);
  8080. }
  8081. else if (importantRE.test(val)) {
  8082. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  8083. }
  8084. else {
  8085. var normalizedName = normalize(name);
  8086. if (Array.isArray(val)) {
  8087. // Support values array created by autoprefixer, e.g.
  8088. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  8089. // Set them one by one, and the browser will only set those it can recognize
  8090. for (var i = 0, len = val.length; i < len; i++) {
  8091. el.style[normalizedName] = val[i];
  8092. }
  8093. }
  8094. else {
  8095. el.style[normalizedName] = val;
  8096. }
  8097. }
  8098. };
  8099. var vendorNames = ['Webkit', 'Moz', 'ms'];
  8100. var emptyStyle;
  8101. var normalize = cached(function (prop) {
  8102. emptyStyle = emptyStyle || document.createElement('div').style;
  8103. prop = camelize(prop);
  8104. if (prop !== 'filter' && prop in emptyStyle) {
  8105. return prop;
  8106. }
  8107. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  8108. for (var i = 0; i < vendorNames.length; i++) {
  8109. var name_1 = vendorNames[i] + capName;
  8110. if (name_1 in emptyStyle) {
  8111. return name_1;
  8112. }
  8113. }
  8114. });
  8115. function updateStyle(oldVnode, vnode) {
  8116. var data = vnode.data;
  8117. var oldData = oldVnode.data;
  8118. if (isUndef(data.staticStyle) &&
  8119. isUndef(data.style) &&
  8120. isUndef(oldData.staticStyle) &&
  8121. isUndef(oldData.style)) {
  8122. return;
  8123. }
  8124. var cur, name;
  8125. var el = vnode.elm;
  8126. var oldStaticStyle = oldData.staticStyle;
  8127. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  8128. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  8129. var oldStyle = oldStaticStyle || oldStyleBinding;
  8130. var style = normalizeStyleBinding(vnode.data.style) || {};
  8131. // store normalized style under a different key for next diff
  8132. // make sure to clone it if it's reactive, since the user likely wants
  8133. // to mutate it.
  8134. vnode.data.normalizedStyle = isDef(style.__ob__) ? extend({}, style) : style;
  8135. var newStyle = getStyle(vnode, true);
  8136. for (name in oldStyle) {
  8137. if (isUndef(newStyle[name])) {
  8138. setProp(el, name, '');
  8139. }
  8140. }
  8141. for (name in newStyle) {
  8142. cur = newStyle[name];
  8143. if (cur !== oldStyle[name]) {
  8144. // ie9 setting to null has no effect, must use empty string
  8145. setProp(el, name, cur == null ? '' : cur);
  8146. }
  8147. }
  8148. }
  8149. var style$1 = {
  8150. create: updateStyle,
  8151. update: updateStyle
  8152. };
  8153. var whitespaceRE$1 = /\s+/;
  8154. /**
  8155. * Add class with compatibility for SVG since classList is not supported on
  8156. * SVG elements in IE
  8157. */
  8158. function addClass(el, cls) {
  8159. /* istanbul ignore if */
  8160. if (!cls || !(cls = cls.trim())) {
  8161. return;
  8162. }
  8163. /* istanbul ignore else */
  8164. if (el.classList) {
  8165. if (cls.indexOf(' ') > -1) {
  8166. cls.split(whitespaceRE$1).forEach(function (c) { return el.classList.add(c); });
  8167. }
  8168. else {
  8169. el.classList.add(cls);
  8170. }
  8171. }
  8172. else {
  8173. var cur = " ".concat(el.getAttribute('class') || '', " ");
  8174. if (cur.indexOf(' ' + cls + ' ') < 0) {
  8175. el.setAttribute('class', (cur + cls).trim());
  8176. }
  8177. }
  8178. }
  8179. /**
  8180. * Remove class with compatibility for SVG since classList is not supported on
  8181. * SVG elements in IE
  8182. */
  8183. function removeClass(el, cls) {
  8184. /* istanbul ignore if */
  8185. if (!cls || !(cls = cls.trim())) {
  8186. return;
  8187. }
  8188. /* istanbul ignore else */
  8189. if (el.classList) {
  8190. if (cls.indexOf(' ') > -1) {
  8191. cls.split(whitespaceRE$1).forEach(function (c) { return el.classList.remove(c); });
  8192. }
  8193. else {
  8194. el.classList.remove(cls);
  8195. }
  8196. if (!el.classList.length) {
  8197. el.removeAttribute('class');
  8198. }
  8199. }
  8200. else {
  8201. var cur = " ".concat(el.getAttribute('class') || '', " ");
  8202. var tar = ' ' + cls + ' ';
  8203. while (cur.indexOf(tar) >= 0) {
  8204. cur = cur.replace(tar, ' ');
  8205. }
  8206. cur = cur.trim();
  8207. if (cur) {
  8208. el.setAttribute('class', cur);
  8209. }
  8210. else {
  8211. el.removeAttribute('class');
  8212. }
  8213. }
  8214. }
  8215. function resolveTransition(def) {
  8216. if (!def) {
  8217. return;
  8218. }
  8219. /* istanbul ignore else */
  8220. if (typeof def === 'object') {
  8221. var res = {};
  8222. if (def.css !== false) {
  8223. extend(res, autoCssTransition(def.name || 'v'));
  8224. }
  8225. extend(res, def);
  8226. return res;
  8227. }
  8228. else if (typeof def === 'string') {
  8229. return autoCssTransition(def);
  8230. }
  8231. }
  8232. var autoCssTransition = cached(function (name) {
  8233. return {
  8234. enterClass: "".concat(name, "-enter"),
  8235. enterToClass: "".concat(name, "-enter-to"),
  8236. enterActiveClass: "".concat(name, "-enter-active"),
  8237. leaveClass: "".concat(name, "-leave"),
  8238. leaveToClass: "".concat(name, "-leave-to"),
  8239. leaveActiveClass: "".concat(name, "-leave-active")
  8240. };
  8241. });
  8242. var hasTransition = inBrowser && !isIE9;
  8243. var TRANSITION = 'transition';
  8244. var ANIMATION = 'animation';
  8245. // Transition property/event sniffing
  8246. var transitionProp = 'transition';
  8247. var transitionEndEvent = 'transitionend';
  8248. var animationProp = 'animation';
  8249. var animationEndEvent = 'animationend';
  8250. if (hasTransition) {
  8251. /* istanbul ignore if */
  8252. if (window.ontransitionend === undefined &&
  8253. window.onwebkittransitionend !== undefined) {
  8254. transitionProp = 'WebkitTransition';
  8255. transitionEndEvent = 'webkitTransitionEnd';
  8256. }
  8257. if (window.onanimationend === undefined &&
  8258. window.onwebkitanimationend !== undefined) {
  8259. animationProp = 'WebkitAnimation';
  8260. animationEndEvent = 'webkitAnimationEnd';
  8261. }
  8262. }
  8263. // binding to window is necessary to make hot reload work in IE in strict mode
  8264. var raf = inBrowser
  8265. ? window.requestAnimationFrame
  8266. ? window.requestAnimationFrame.bind(window)
  8267. : setTimeout
  8268. : /* istanbul ignore next */ function (/* istanbul ignore next */ fn) { return fn(); };
  8269. function nextFrame(fn) {
  8270. raf(function () {
  8271. // @ts-expect-error
  8272. raf(fn);
  8273. });
  8274. }
  8275. function addTransitionClass(el, cls) {
  8276. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  8277. if (transitionClasses.indexOf(cls) < 0) {
  8278. transitionClasses.push(cls);
  8279. addClass(el, cls);
  8280. }
  8281. }
  8282. function removeTransitionClass(el, cls) {
  8283. if (el._transitionClasses) {
  8284. remove$2(el._transitionClasses, cls);
  8285. }
  8286. removeClass(el, cls);
  8287. }
  8288. function whenTransitionEnds(el, expectedType, cb) {
  8289. var _a = getTransitionInfo(el, expectedType), type = _a.type, timeout = _a.timeout, propCount = _a.propCount;
  8290. if (!type)
  8291. return cb();
  8292. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  8293. var ended = 0;
  8294. var end = function () {
  8295. el.removeEventListener(event, onEnd);
  8296. cb();
  8297. };
  8298. var onEnd = function (e) {
  8299. if (e.target === el) {
  8300. if (++ended >= propCount) {
  8301. end();
  8302. }
  8303. }
  8304. };
  8305. setTimeout(function () {
  8306. if (ended < propCount) {
  8307. end();
  8308. }
  8309. }, timeout + 1);
  8310. el.addEventListener(event, onEnd);
  8311. }
  8312. var transformRE = /\b(transform|all)(,|$)/;
  8313. function getTransitionInfo(el, expectedType) {
  8314. var styles = window.getComputedStyle(el);
  8315. // JSDOM may return undefined for transition properties
  8316. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  8317. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  8318. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  8319. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  8320. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  8321. var animationTimeout = getTimeout(animationDelays, animationDurations);
  8322. var type;
  8323. var timeout = 0;
  8324. var propCount = 0;
  8325. /* istanbul ignore if */
  8326. if (expectedType === TRANSITION) {
  8327. if (transitionTimeout > 0) {
  8328. type = TRANSITION;
  8329. timeout = transitionTimeout;
  8330. propCount = transitionDurations.length;
  8331. }
  8332. }
  8333. else if (expectedType === ANIMATION) {
  8334. if (animationTimeout > 0) {
  8335. type = ANIMATION;
  8336. timeout = animationTimeout;
  8337. propCount = animationDurations.length;
  8338. }
  8339. }
  8340. else {
  8341. timeout = Math.max(transitionTimeout, animationTimeout);
  8342. type =
  8343. timeout > 0
  8344. ? transitionTimeout > animationTimeout
  8345. ? TRANSITION
  8346. : ANIMATION
  8347. : null;
  8348. propCount = type
  8349. ? type === TRANSITION
  8350. ? transitionDurations.length
  8351. : animationDurations.length
  8352. : 0;
  8353. }
  8354. var hasTransform = type === TRANSITION && transformRE.test(styles[transitionProp + 'Property']);
  8355. return {
  8356. type: type,
  8357. timeout: timeout,
  8358. propCount: propCount,
  8359. hasTransform: hasTransform
  8360. };
  8361. }
  8362. function getTimeout(delays, durations) {
  8363. /* istanbul ignore next */
  8364. while (delays.length < durations.length) {
  8365. delays = delays.concat(delays);
  8366. }
  8367. return Math.max.apply(null, durations.map(function (d, i) {
  8368. return toMs(d) + toMs(delays[i]);
  8369. }));
  8370. }
  8371. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  8372. // in a locale-dependent way, using a comma instead of a dot.
  8373. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  8374. // as a floor function) causing unexpected behaviors
  8375. function toMs(s) {
  8376. return Number(s.slice(0, -1).replace(',', '.')) * 1000;
  8377. }
  8378. function enter(vnode, toggleDisplay) {
  8379. var el = vnode.elm;
  8380. // call leave callback now
  8381. if (isDef(el._leaveCb)) {
  8382. el._leaveCb.cancelled = true;
  8383. el._leaveCb();
  8384. }
  8385. var data = resolveTransition(vnode.data.transition);
  8386. if (isUndef(data)) {
  8387. return;
  8388. }
  8389. /* istanbul ignore if */
  8390. if (isDef(el._enterCb) || el.nodeType !== 1) {
  8391. return;
  8392. }
  8393. var css = data.css, type = data.type, enterClass = data.enterClass, enterToClass = data.enterToClass, enterActiveClass = data.enterActiveClass, appearClass = data.appearClass, appearToClass = data.appearToClass, appearActiveClass = data.appearActiveClass, beforeEnter = data.beforeEnter, enter = data.enter, afterEnter = data.afterEnter, enterCancelled = data.enterCancelled, beforeAppear = data.beforeAppear, appear = data.appear, afterAppear = data.afterAppear, appearCancelled = data.appearCancelled, duration = data.duration;
  8394. // activeInstance will always be the <transition> component managing this
  8395. // transition. One edge case to check is when the <transition> is placed
  8396. // as the root node of a child component. In that case we need to check
  8397. // <transition>'s parent for appear check.
  8398. var context = activeInstance;
  8399. var transitionNode = activeInstance.$vnode;
  8400. while (transitionNode && transitionNode.parent) {
  8401. context = transitionNode.context;
  8402. transitionNode = transitionNode.parent;
  8403. }
  8404. var isAppear = !context._isMounted || !vnode.isRootInsert;
  8405. if (isAppear && !appear && appear !== '') {
  8406. return;
  8407. }
  8408. var startClass = isAppear && appearClass ? appearClass : enterClass;
  8409. var activeClass = isAppear && appearActiveClass ? appearActiveClass : enterActiveClass;
  8410. var toClass = isAppear && appearToClass ? appearToClass : enterToClass;
  8411. var beforeEnterHook = isAppear ? beforeAppear || beforeEnter : beforeEnter;
  8412. var enterHook = isAppear ? (isFunction(appear) ? appear : enter) : enter;
  8413. var afterEnterHook = isAppear ? afterAppear || afterEnter : afterEnter;
  8414. var enterCancelledHook = isAppear
  8415. ? appearCancelled || enterCancelled
  8416. : enterCancelled;
  8417. var explicitEnterDuration = toNumber(isObject(duration) ? duration.enter : duration);
  8418. if (explicitEnterDuration != null) {
  8419. checkDuration(explicitEnterDuration, 'enter', vnode);
  8420. }
  8421. var expectsCSS = css !== false && !isIE9;
  8422. var userWantsControl = getHookArgumentsLength(enterHook);
  8423. var cb = (el._enterCb = once(function () {
  8424. if (expectsCSS) {
  8425. removeTransitionClass(el, toClass);
  8426. removeTransitionClass(el, activeClass);
  8427. }
  8428. // @ts-expect-error
  8429. if (cb.cancelled) {
  8430. if (expectsCSS) {
  8431. removeTransitionClass(el, startClass);
  8432. }
  8433. enterCancelledHook && enterCancelledHook(el);
  8434. }
  8435. else {
  8436. afterEnterHook && afterEnterHook(el);
  8437. }
  8438. el._enterCb = null;
  8439. }));
  8440. if (!vnode.data.show) {
  8441. // remove pending leave element on enter by injecting an insert hook
  8442. mergeVNodeHook(vnode, 'insert', function () {
  8443. var parent = el.parentNode;
  8444. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  8445. if (pendingNode &&
  8446. pendingNode.tag === vnode.tag &&
  8447. pendingNode.elm._leaveCb) {
  8448. pendingNode.elm._leaveCb();
  8449. }
  8450. enterHook && enterHook(el, cb);
  8451. });
  8452. }
  8453. // start enter transition
  8454. beforeEnterHook && beforeEnterHook(el);
  8455. if (expectsCSS) {
  8456. addTransitionClass(el, startClass);
  8457. addTransitionClass(el, activeClass);
  8458. nextFrame(function () {
  8459. removeTransitionClass(el, startClass);
  8460. // @ts-expect-error
  8461. if (!cb.cancelled) {
  8462. addTransitionClass(el, toClass);
  8463. if (!userWantsControl) {
  8464. if (isValidDuration(explicitEnterDuration)) {
  8465. setTimeout(cb, explicitEnterDuration);
  8466. }
  8467. else {
  8468. whenTransitionEnds(el, type, cb);
  8469. }
  8470. }
  8471. }
  8472. });
  8473. }
  8474. if (vnode.data.show) {
  8475. toggleDisplay && toggleDisplay();
  8476. enterHook && enterHook(el, cb);
  8477. }
  8478. if (!expectsCSS && !userWantsControl) {
  8479. cb();
  8480. }
  8481. }
  8482. function leave(vnode, rm) {
  8483. var el = vnode.elm;
  8484. // call enter callback now
  8485. if (isDef(el._enterCb)) {
  8486. el._enterCb.cancelled = true;
  8487. el._enterCb();
  8488. }
  8489. var data = resolveTransition(vnode.data.transition);
  8490. if (isUndef(data) || el.nodeType !== 1) {
  8491. return rm();
  8492. }
  8493. /* istanbul ignore if */
  8494. if (isDef(el._leaveCb)) {
  8495. return;
  8496. }
  8497. var css = data.css, type = data.type, leaveClass = data.leaveClass, leaveToClass = data.leaveToClass, leaveActiveClass = data.leaveActiveClass, beforeLeave = data.beforeLeave, leave = data.leave, afterLeave = data.afterLeave, leaveCancelled = data.leaveCancelled, delayLeave = data.delayLeave, duration = data.duration;
  8498. var expectsCSS = css !== false && !isIE9;
  8499. var userWantsControl = getHookArgumentsLength(leave);
  8500. var explicitLeaveDuration = toNumber(isObject(duration) ? duration.leave : duration);
  8501. if (isDef(explicitLeaveDuration)) {
  8502. checkDuration(explicitLeaveDuration, 'leave', vnode);
  8503. }
  8504. var cb = (el._leaveCb = once(function () {
  8505. if (el.parentNode && el.parentNode._pending) {
  8506. el.parentNode._pending[vnode.key] = null;
  8507. }
  8508. if (expectsCSS) {
  8509. removeTransitionClass(el, leaveToClass);
  8510. removeTransitionClass(el, leaveActiveClass);
  8511. }
  8512. // @ts-expect-error
  8513. if (cb.cancelled) {
  8514. if (expectsCSS) {
  8515. removeTransitionClass(el, leaveClass);
  8516. }
  8517. leaveCancelled && leaveCancelled(el);
  8518. }
  8519. else {
  8520. rm();
  8521. afterLeave && afterLeave(el);
  8522. }
  8523. el._leaveCb = null;
  8524. }));
  8525. if (delayLeave) {
  8526. delayLeave(performLeave);
  8527. }
  8528. else {
  8529. performLeave();
  8530. }
  8531. function performLeave() {
  8532. // the delayed leave may have already been cancelled
  8533. // @ts-expect-error
  8534. if (cb.cancelled) {
  8535. return;
  8536. }
  8537. // record leaving element
  8538. if (!vnode.data.show && el.parentNode) {
  8539. (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] =
  8540. vnode;
  8541. }
  8542. beforeLeave && beforeLeave(el);
  8543. if (expectsCSS) {
  8544. addTransitionClass(el, leaveClass);
  8545. addTransitionClass(el, leaveActiveClass);
  8546. nextFrame(function () {
  8547. removeTransitionClass(el, leaveClass);
  8548. // @ts-expect-error
  8549. if (!cb.cancelled) {
  8550. addTransitionClass(el, leaveToClass);
  8551. if (!userWantsControl) {
  8552. if (isValidDuration(explicitLeaveDuration)) {
  8553. setTimeout(cb, explicitLeaveDuration);
  8554. }
  8555. else {
  8556. whenTransitionEnds(el, type, cb);
  8557. }
  8558. }
  8559. }
  8560. });
  8561. }
  8562. leave && leave(el, cb);
  8563. if (!expectsCSS && !userWantsControl) {
  8564. cb();
  8565. }
  8566. }
  8567. }
  8568. // only used in dev mode
  8569. function checkDuration(val, name, vnode) {
  8570. if (typeof val !== 'number') {
  8571. warn$2("<transition> explicit ".concat(name, " duration is not a valid number - ") +
  8572. "got ".concat(JSON.stringify(val), "."), vnode.context);
  8573. }
  8574. else if (isNaN(val)) {
  8575. warn$2("<transition> explicit ".concat(name, " duration is NaN - ") +
  8576. 'the duration expression might be incorrect.', vnode.context);
  8577. }
  8578. }
  8579. function isValidDuration(val) {
  8580. return typeof val === 'number' && !isNaN(val);
  8581. }
  8582. /**
  8583. * Normalize a transition hook's argument length. The hook may be:
  8584. * - a merged hook (invoker) with the original in .fns
  8585. * - a wrapped component method (check ._length)
  8586. * - a plain function (.length)
  8587. */
  8588. function getHookArgumentsLength(fn) {
  8589. if (isUndef(fn)) {
  8590. return false;
  8591. }
  8592. // @ts-expect-error
  8593. var invokerFns = fn.fns;
  8594. if (isDef(invokerFns)) {
  8595. // invoker
  8596. return getHookArgumentsLength(Array.isArray(invokerFns) ? invokerFns[0] : invokerFns);
  8597. }
  8598. else {
  8599. // @ts-expect-error
  8600. return (fn._length || fn.length) > 1;
  8601. }
  8602. }
  8603. function _enter(_, vnode) {
  8604. if (vnode.data.show !== true) {
  8605. enter(vnode);
  8606. }
  8607. }
  8608. var transition = inBrowser
  8609. ? {
  8610. create: _enter,
  8611. activate: _enter,
  8612. remove: function (vnode, rm) {
  8613. /* istanbul ignore else */
  8614. if (vnode.data.show !== true) {
  8615. // @ts-expect-error
  8616. leave(vnode, rm);
  8617. }
  8618. else {
  8619. rm();
  8620. }
  8621. }
  8622. }
  8623. : {};
  8624. var platformModules = [attrs, klass$1, events, domProps, style$1, transition];
  8625. // the directive module should be applied last, after all
  8626. // built-in modules have been applied.
  8627. var modules$1 = platformModules.concat(baseModules);
  8628. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules$1 });
  8629. /**
  8630. * Not type checking this file because flow doesn't like attaching
  8631. * properties to Elements.
  8632. */
  8633. /* istanbul ignore if */
  8634. if (isIE9) {
  8635. // http://www.matts411.com/post/internet-explorer-9-oninput/
  8636. document.addEventListener('selectionchange', function () {
  8637. var el = document.activeElement;
  8638. // @ts-expect-error
  8639. if (el && el.vmodel) {
  8640. trigger(el, 'input');
  8641. }
  8642. });
  8643. }
  8644. var directive = {
  8645. inserted: function (el, binding, vnode, oldVnode) {
  8646. if (vnode.tag === 'select') {
  8647. // #6903
  8648. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  8649. mergeVNodeHook(vnode, 'postpatch', function () {
  8650. directive.componentUpdated(el, binding, vnode);
  8651. });
  8652. }
  8653. else {
  8654. setSelected(el, binding, vnode.context);
  8655. }
  8656. el._vOptions = [].map.call(el.options, getValue);
  8657. }
  8658. else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  8659. el._vModifiers = binding.modifiers;
  8660. if (!binding.modifiers.lazy) {
  8661. el.addEventListener('compositionstart', onCompositionStart);
  8662. el.addEventListener('compositionend', onCompositionEnd);
  8663. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  8664. // switching focus before confirming composition choice
  8665. // this also fixes the issue where some browsers e.g. iOS Chrome
  8666. // fires "change" instead of "input" on autocomplete.
  8667. el.addEventListener('change', onCompositionEnd);
  8668. /* istanbul ignore if */
  8669. if (isIE9) {
  8670. el.vmodel = true;
  8671. }
  8672. }
  8673. }
  8674. },
  8675. componentUpdated: function (el, binding, vnode) {
  8676. if (vnode.tag === 'select') {
  8677. setSelected(el, binding, vnode.context);
  8678. // in case the options rendered by v-for have changed,
  8679. // it's possible that the value is out-of-sync with the rendered options.
  8680. // detect such cases and filter out values that no longer has a matching
  8681. // option in the DOM.
  8682. var prevOptions_1 = el._vOptions;
  8683. var curOptions_1 = (el._vOptions = [].map.call(el.options, getValue));
  8684. if (curOptions_1.some(function (o, i) { return !looseEqual(o, prevOptions_1[i]); })) {
  8685. // trigger change event if
  8686. // no matching option found for at least one value
  8687. var needReset = el.multiple
  8688. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions_1); })
  8689. : binding.value !== binding.oldValue &&
  8690. hasNoMatchingOption(binding.value, curOptions_1);
  8691. if (needReset) {
  8692. trigger(el, 'change');
  8693. }
  8694. }
  8695. }
  8696. }
  8697. };
  8698. function setSelected(el, binding, vm) {
  8699. actuallySetSelected(el, binding, vm);
  8700. /* istanbul ignore if */
  8701. if (isIE || isEdge) {
  8702. setTimeout(function () {
  8703. actuallySetSelected(el, binding, vm);
  8704. }, 0);
  8705. }
  8706. }
  8707. function actuallySetSelected(el, binding, vm) {
  8708. var value = binding.value;
  8709. var isMultiple = el.multiple;
  8710. if (isMultiple && !Array.isArray(value)) {
  8711. warn$2("<select multiple v-model=\"".concat(binding.expression, "\"> ") +
  8712. "expects an Array value for its binding, but got ".concat(Object.prototype.toString
  8713. .call(value)
  8714. .slice(8, -1)), vm);
  8715. return;
  8716. }
  8717. var selected, option;
  8718. for (var i = 0, l = el.options.length; i < l; i++) {
  8719. option = el.options[i];
  8720. if (isMultiple) {
  8721. selected = looseIndexOf(value, getValue(option)) > -1;
  8722. if (option.selected !== selected) {
  8723. option.selected = selected;
  8724. }
  8725. }
  8726. else {
  8727. if (looseEqual(getValue(option), value)) {
  8728. if (el.selectedIndex !== i) {
  8729. el.selectedIndex = i;
  8730. }
  8731. return;
  8732. }
  8733. }
  8734. }
  8735. if (!isMultiple) {
  8736. el.selectedIndex = -1;
  8737. }
  8738. }
  8739. function hasNoMatchingOption(value, options) {
  8740. return options.every(function (o) { return !looseEqual(o, value); });
  8741. }
  8742. function getValue(option) {
  8743. return '_value' in option ? option._value : option.value;
  8744. }
  8745. function onCompositionStart(e) {
  8746. e.target.composing = true;
  8747. }
  8748. function onCompositionEnd(e) {
  8749. // prevent triggering an input event for no reason
  8750. if (!e.target.composing)
  8751. return;
  8752. e.target.composing = false;
  8753. trigger(e.target, 'input');
  8754. }
  8755. function trigger(el, type) {
  8756. var e = document.createEvent('HTMLEvents');
  8757. e.initEvent(type, true, true);
  8758. el.dispatchEvent(e);
  8759. }
  8760. // recursively search for possible transition defined inside the component root
  8761. function locateNode(vnode) {
  8762. // @ts-expect-error
  8763. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  8764. ? locateNode(vnode.componentInstance._vnode)
  8765. : vnode;
  8766. }
  8767. var show = {
  8768. bind: function (el, _a, vnode) {
  8769. var value = _a.value;
  8770. vnode = locateNode(vnode);
  8771. var transition = vnode.data && vnode.data.transition;
  8772. var originalDisplay = (el.__vOriginalDisplay =
  8773. el.style.display === 'none' ? '' : el.style.display);
  8774. if (value && transition) {
  8775. vnode.data.show = true;
  8776. enter(vnode, function () {
  8777. el.style.display = originalDisplay;
  8778. });
  8779. }
  8780. else {
  8781. el.style.display = value ? originalDisplay : 'none';
  8782. }
  8783. },
  8784. update: function (el, _a, vnode) {
  8785. var value = _a.value, oldValue = _a.oldValue;
  8786. /* istanbul ignore if */
  8787. if (!value === !oldValue)
  8788. return;
  8789. vnode = locateNode(vnode);
  8790. var transition = vnode.data && vnode.data.transition;
  8791. if (transition) {
  8792. vnode.data.show = true;
  8793. if (value) {
  8794. enter(vnode, function () {
  8795. el.style.display = el.__vOriginalDisplay;
  8796. });
  8797. }
  8798. else {
  8799. leave(vnode, function () {
  8800. el.style.display = 'none';
  8801. });
  8802. }
  8803. }
  8804. else {
  8805. el.style.display = value ? el.__vOriginalDisplay : 'none';
  8806. }
  8807. },
  8808. unbind: function (el, binding, vnode, oldVnode, isDestroy) {
  8809. if (!isDestroy) {
  8810. el.style.display = el.__vOriginalDisplay;
  8811. }
  8812. }
  8813. };
  8814. var platformDirectives = {
  8815. model: directive,
  8816. show: show
  8817. };
  8818. // Provides transition support for a single element/component.
  8819. var transitionProps = {
  8820. name: String,
  8821. appear: Boolean,
  8822. css: Boolean,
  8823. mode: String,
  8824. type: String,
  8825. enterClass: String,
  8826. leaveClass: String,
  8827. enterToClass: String,
  8828. leaveToClass: String,
  8829. enterActiveClass: String,
  8830. leaveActiveClass: String,
  8831. appearClass: String,
  8832. appearActiveClass: String,
  8833. appearToClass: String,
  8834. duration: [Number, String, Object]
  8835. };
  8836. // in case the child is also an abstract component, e.g. <keep-alive>
  8837. // we want to recursively retrieve the real component to be rendered
  8838. function getRealChild(vnode) {
  8839. var compOptions = vnode && vnode.componentOptions;
  8840. if (compOptions && compOptions.Ctor.options.abstract) {
  8841. return getRealChild(getFirstComponentChild(compOptions.children));
  8842. }
  8843. else {
  8844. return vnode;
  8845. }
  8846. }
  8847. function extractTransitionData(comp) {
  8848. var data = {};
  8849. var options = comp.$options;
  8850. // props
  8851. for (var key in options.propsData) {
  8852. data[key] = comp[key];
  8853. }
  8854. // events.
  8855. // extract listeners and pass them directly to the transition methods
  8856. var listeners = options._parentListeners;
  8857. for (var key in listeners) {
  8858. data[camelize(key)] = listeners[key];
  8859. }
  8860. return data;
  8861. }
  8862. function placeholder(h, rawChild) {
  8863. // @ts-expect-error
  8864. if (/\d-keep-alive$/.test(rawChild.tag)) {
  8865. return h('keep-alive', {
  8866. props: rawChild.componentOptions.propsData
  8867. });
  8868. }
  8869. }
  8870. function hasParentTransition(vnode) {
  8871. while ((vnode = vnode.parent)) {
  8872. if (vnode.data.transition) {
  8873. return true;
  8874. }
  8875. }
  8876. }
  8877. function isSameChild(child, oldChild) {
  8878. return oldChild.key === child.key && oldChild.tag === child.tag;
  8879. }
  8880. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  8881. var isVShowDirective = function (d) { return d.name === 'show'; };
  8882. var Transition = {
  8883. name: 'transition',
  8884. props: transitionProps,
  8885. abstract: true,
  8886. render: function (h) {
  8887. var _this = this;
  8888. var children = this.$slots.default;
  8889. if (!children) {
  8890. return;
  8891. }
  8892. // filter out text nodes (possible whitespaces)
  8893. children = children.filter(isNotTextNode);
  8894. /* istanbul ignore if */
  8895. if (!children.length) {
  8896. return;
  8897. }
  8898. // warn multiple elements
  8899. if (children.length > 1) {
  8900. warn$2('<transition> can only be used on a single element. Use ' +
  8901. '<transition-group> for lists.', this.$parent);
  8902. }
  8903. var mode = this.mode;
  8904. // warn invalid mode
  8905. if (mode && mode !== 'in-out' && mode !== 'out-in') {
  8906. warn$2('invalid <transition> mode: ' + mode, this.$parent);
  8907. }
  8908. var rawChild = children[0];
  8909. // if this is a component root node and the component's
  8910. // parent container node also has transition, skip.
  8911. if (hasParentTransition(this.$vnode)) {
  8912. return rawChild;
  8913. }
  8914. // apply transition data to child
  8915. // use getRealChild() to ignore abstract components e.g. keep-alive
  8916. var child = getRealChild(rawChild);
  8917. /* istanbul ignore if */
  8918. if (!child) {
  8919. return rawChild;
  8920. }
  8921. if (this._leaving) {
  8922. return placeholder(h, rawChild);
  8923. }
  8924. // ensure a key that is unique to the vnode type and to this transition
  8925. // component instance. This key will be used to remove pending leaving nodes
  8926. // during entering.
  8927. var id = "__transition-".concat(this._uid, "-");
  8928. child.key =
  8929. child.key == null
  8930. ? child.isComment
  8931. ? id + 'comment'
  8932. : id + child.tag
  8933. : isPrimitive(child.key)
  8934. ? String(child.key).indexOf(id) === 0
  8935. ? child.key
  8936. : id + child.key
  8937. : child.key;
  8938. var data = ((child.data || (child.data = {})).transition =
  8939. extractTransitionData(this));
  8940. var oldRawChild = this._vnode;
  8941. var oldChild = getRealChild(oldRawChild);
  8942. // mark v-show
  8943. // so that the transition module can hand over the control to the directive
  8944. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  8945. child.data.show = true;
  8946. }
  8947. if (oldChild &&
  8948. oldChild.data &&
  8949. !isSameChild(child, oldChild) &&
  8950. !isAsyncPlaceholder(oldChild) &&
  8951. // #6687 component root is a comment node
  8952. !(oldChild.componentInstance &&
  8953. oldChild.componentInstance._vnode.isComment)) {
  8954. // replace old child transition data with fresh one
  8955. // important for dynamic transitions!
  8956. var oldData = (oldChild.data.transition = extend({}, data));
  8957. // handle transition mode
  8958. if (mode === 'out-in') {
  8959. // return placeholder node and queue update when leave finishes
  8960. this._leaving = true;
  8961. mergeVNodeHook(oldData, 'afterLeave', function () {
  8962. _this._leaving = false;
  8963. _this.$forceUpdate();
  8964. });
  8965. return placeholder(h, rawChild);
  8966. }
  8967. else if (mode === 'in-out') {
  8968. if (isAsyncPlaceholder(child)) {
  8969. return oldRawChild;
  8970. }
  8971. var delayedLeave_1;
  8972. var performLeave = function () {
  8973. delayedLeave_1();
  8974. };
  8975. mergeVNodeHook(data, 'afterEnter', performLeave);
  8976. mergeVNodeHook(data, 'enterCancelled', performLeave);
  8977. mergeVNodeHook(oldData, 'delayLeave', function (leave) {
  8978. delayedLeave_1 = leave;
  8979. });
  8980. }
  8981. }
  8982. return rawChild;
  8983. }
  8984. };
  8985. // Provides transition support for list items.
  8986. var props = extend({
  8987. tag: String,
  8988. moveClass: String
  8989. }, transitionProps);
  8990. delete props.mode;
  8991. var TransitionGroup = {
  8992. props: props,
  8993. beforeMount: function () {
  8994. var _this = this;
  8995. var update = this._update;
  8996. this._update = function (vnode, hydrating) {
  8997. var restoreActiveInstance = setActiveInstance(_this);
  8998. // force removing pass
  8999. _this.__patch__(_this._vnode, _this.kept, false, // hydrating
  9000. true // removeOnly (!important, avoids unnecessary moves)
  9001. );
  9002. _this._vnode = _this.kept;
  9003. restoreActiveInstance();
  9004. update.call(_this, vnode, hydrating);
  9005. };
  9006. },
  9007. render: function (h) {
  9008. var tag = this.tag || this.$vnode.data.tag || 'span';
  9009. var map = Object.create(null);
  9010. var prevChildren = (this.prevChildren = this.children);
  9011. var rawChildren = this.$slots.default || [];
  9012. var children = (this.children = []);
  9013. var transitionData = extractTransitionData(this);
  9014. for (var i = 0; i < rawChildren.length; i++) {
  9015. var c = rawChildren[i];
  9016. if (c.tag) {
  9017. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  9018. children.push(c);
  9019. map[c.key] = c;
  9020. (c.data || (c.data = {})).transition = transitionData;
  9021. }
  9022. else {
  9023. var opts = c.componentOptions;
  9024. var name_1 = opts
  9025. ? getComponentName(opts.Ctor.options) || opts.tag || ''
  9026. : c.tag;
  9027. warn$2("<transition-group> children must be keyed: <".concat(name_1, ">"));
  9028. }
  9029. }
  9030. }
  9031. if (prevChildren) {
  9032. var kept = [];
  9033. var removed = [];
  9034. for (var i = 0; i < prevChildren.length; i++) {
  9035. var c = prevChildren[i];
  9036. c.data.transition = transitionData;
  9037. // @ts-expect-error .getBoundingClientRect is not typed in Node
  9038. c.data.pos = c.elm.getBoundingClientRect();
  9039. if (map[c.key]) {
  9040. kept.push(c);
  9041. }
  9042. else {
  9043. removed.push(c);
  9044. }
  9045. }
  9046. this.kept = h(tag, null, kept);
  9047. this.removed = removed;
  9048. }
  9049. return h(tag, null, children);
  9050. },
  9051. updated: function () {
  9052. var children = this.prevChildren;
  9053. var moveClass = this.moveClass || (this.name || 'v') + '-move';
  9054. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  9055. return;
  9056. }
  9057. // we divide the work into three loops to avoid mixing DOM reads and writes
  9058. // in each iteration - which helps prevent layout thrashing.
  9059. children.forEach(callPendingCbs);
  9060. children.forEach(recordPosition);
  9061. children.forEach(applyTranslation);
  9062. // force reflow to put everything in position
  9063. // assign to this to avoid being removed in tree-shaking
  9064. // $flow-disable-line
  9065. this._reflow = document.body.offsetHeight;
  9066. children.forEach(function (c) {
  9067. if (c.data.moved) {
  9068. var el_1 = c.elm;
  9069. var s = el_1.style;
  9070. addTransitionClass(el_1, moveClass);
  9071. s.transform = s.WebkitTransform = s.transitionDuration = '';
  9072. el_1.addEventListener(transitionEndEvent, (el_1._moveCb = function cb(e) {
  9073. if (e && e.target !== el_1) {
  9074. return;
  9075. }
  9076. if (!e || /transform$/.test(e.propertyName)) {
  9077. el_1.removeEventListener(transitionEndEvent, cb);
  9078. el_1._moveCb = null;
  9079. removeTransitionClass(el_1, moveClass);
  9080. }
  9081. }));
  9082. }
  9083. });
  9084. },
  9085. methods: {
  9086. hasMove: function (el, moveClass) {
  9087. /* istanbul ignore if */
  9088. if (!hasTransition) {
  9089. return false;
  9090. }
  9091. /* istanbul ignore if */
  9092. if (this._hasMove) {
  9093. return this._hasMove;
  9094. }
  9095. // Detect whether an element with the move class applied has
  9096. // CSS transitions. Since the element may be inside an entering
  9097. // transition at this very moment, we make a clone of it and remove
  9098. // all other transition classes applied to ensure only the move class
  9099. // is applied.
  9100. var clone = el.cloneNode();
  9101. if (el._transitionClasses) {
  9102. el._transitionClasses.forEach(function (cls) {
  9103. removeClass(clone, cls);
  9104. });
  9105. }
  9106. addClass(clone, moveClass);
  9107. clone.style.display = 'none';
  9108. this.$el.appendChild(clone);
  9109. var info = getTransitionInfo(clone);
  9110. this.$el.removeChild(clone);
  9111. return (this._hasMove = info.hasTransform);
  9112. }
  9113. }
  9114. };
  9115. function callPendingCbs(c) {
  9116. /* istanbul ignore if */
  9117. if (c.elm._moveCb) {
  9118. c.elm._moveCb();
  9119. }
  9120. /* istanbul ignore if */
  9121. if (c.elm._enterCb) {
  9122. c.elm._enterCb();
  9123. }
  9124. }
  9125. function recordPosition(c) {
  9126. c.data.newPos = c.elm.getBoundingClientRect();
  9127. }
  9128. function applyTranslation(c) {
  9129. var oldPos = c.data.pos;
  9130. var newPos = c.data.newPos;
  9131. var dx = oldPos.left - newPos.left;
  9132. var dy = oldPos.top - newPos.top;
  9133. if (dx || dy) {
  9134. c.data.moved = true;
  9135. var s = c.elm.style;
  9136. s.transform = s.WebkitTransform = "translate(".concat(dx, "px,").concat(dy, "px)");
  9137. s.transitionDuration = '0s';
  9138. }
  9139. }
  9140. var platformComponents = {
  9141. Transition: Transition,
  9142. TransitionGroup: TransitionGroup
  9143. };
  9144. // install platform specific utils
  9145. Vue.config.mustUseProp = mustUseProp;
  9146. Vue.config.isReservedTag = isReservedTag;
  9147. Vue.config.isReservedAttr = isReservedAttr;
  9148. Vue.config.getTagNamespace = getTagNamespace;
  9149. Vue.config.isUnknownElement = isUnknownElement;
  9150. // install platform runtime directives & components
  9151. extend(Vue.options.directives, platformDirectives);
  9152. extend(Vue.options.components, platformComponents);
  9153. // install platform patch function
  9154. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  9155. // public mount method
  9156. Vue.prototype.$mount = function (el, hydrating) {
  9157. el = el && inBrowser ? query(el) : undefined;
  9158. return mountComponent(this, el, hydrating);
  9159. };
  9160. // devtools global hook
  9161. /* istanbul ignore next */
  9162. if (inBrowser) {
  9163. setTimeout(function () {
  9164. if (config.devtools) {
  9165. if (devtools) {
  9166. devtools.emit('init', Vue);
  9167. }
  9168. else {
  9169. // @ts-expect-error
  9170. console[console.info ? 'info' : 'log']('Download the Vue Devtools extension for a better development experience:\n' +
  9171. 'https://github.com/vuejs/vue-devtools');
  9172. }
  9173. }
  9174. if (config.productionTip !== false &&
  9175. typeof console !== 'undefined') {
  9176. // @ts-expect-error
  9177. console[console.info ? 'info' : 'log']("You are running Vue in development mode.\n" +
  9178. "Make sure to turn on production mode when deploying for production.\n" +
  9179. "See more tips at https://vuejs.org/guide/deployment.html");
  9180. }
  9181. }, 0);
  9182. }
  9183. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  9184. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  9185. var buildRegex = cached(function (delimiters) {
  9186. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  9187. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  9188. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g');
  9189. });
  9190. function parseText(text, delimiters) {
  9191. //@ts-expect-error
  9192. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  9193. if (!tagRE.test(text)) {
  9194. return;
  9195. }
  9196. var tokens = [];
  9197. var rawTokens = [];
  9198. var lastIndex = (tagRE.lastIndex = 0);
  9199. var match, index, tokenValue;
  9200. while ((match = tagRE.exec(text))) {
  9201. index = match.index;
  9202. // push text token
  9203. if (index > lastIndex) {
  9204. rawTokens.push((tokenValue = text.slice(lastIndex, index)));
  9205. tokens.push(JSON.stringify(tokenValue));
  9206. }
  9207. // tag token
  9208. var exp = parseFilters(match[1].trim());
  9209. tokens.push("_s(".concat(exp, ")"));
  9210. rawTokens.push({ '@binding': exp });
  9211. lastIndex = index + match[0].length;
  9212. }
  9213. if (lastIndex < text.length) {
  9214. rawTokens.push((tokenValue = text.slice(lastIndex)));
  9215. tokens.push(JSON.stringify(tokenValue));
  9216. }
  9217. return {
  9218. expression: tokens.join('+'),
  9219. tokens: rawTokens
  9220. };
  9221. }
  9222. function transformNode$1(el, options) {
  9223. var warn = options.warn || baseWarn;
  9224. var staticClass = getAndRemoveAttr(el, 'class');
  9225. if (staticClass) {
  9226. var res = parseText(staticClass, options.delimiters);
  9227. if (res) {
  9228. warn("class=\"".concat(staticClass, "\": ") +
  9229. 'Interpolation inside attributes has been removed. ' +
  9230. 'Use v-bind or the colon shorthand instead. For example, ' +
  9231. 'instead of <div class="{{ val }}">, use <div :class="val">.', el.rawAttrsMap['class']);
  9232. }
  9233. }
  9234. if (staticClass) {
  9235. el.staticClass = JSON.stringify(staticClass.replace(/\s+/g, ' ').trim());
  9236. }
  9237. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  9238. if (classBinding) {
  9239. el.classBinding = classBinding;
  9240. }
  9241. }
  9242. function genData$2(el) {
  9243. var data = '';
  9244. if (el.staticClass) {
  9245. data += "staticClass:".concat(el.staticClass, ",");
  9246. }
  9247. if (el.classBinding) {
  9248. data += "class:".concat(el.classBinding, ",");
  9249. }
  9250. return data;
  9251. }
  9252. var klass = {
  9253. staticKeys: ['staticClass'],
  9254. transformNode: transformNode$1,
  9255. genData: genData$2
  9256. };
  9257. function transformNode(el, options) {
  9258. var warn = options.warn || baseWarn;
  9259. var staticStyle = getAndRemoveAttr(el, 'style');
  9260. if (staticStyle) {
  9261. /* istanbul ignore if */
  9262. {
  9263. var res = parseText(staticStyle, options.delimiters);
  9264. if (res) {
  9265. warn("style=\"".concat(staticStyle, "\": ") +
  9266. 'Interpolation inside attributes has been removed. ' +
  9267. 'Use v-bind or the colon shorthand instead. For example, ' +
  9268. 'instead of <div style="{{ val }}">, use <div :style="val">.', el.rawAttrsMap['style']);
  9269. }
  9270. }
  9271. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  9272. }
  9273. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  9274. if (styleBinding) {
  9275. el.styleBinding = styleBinding;
  9276. }
  9277. }
  9278. function genData$1(el) {
  9279. var data = '';
  9280. if (el.staticStyle) {
  9281. data += "staticStyle:".concat(el.staticStyle, ",");
  9282. }
  9283. if (el.styleBinding) {
  9284. data += "style:(".concat(el.styleBinding, "),");
  9285. }
  9286. return data;
  9287. }
  9288. var style = {
  9289. staticKeys: ['staticStyle'],
  9290. transformNode: transformNode,
  9291. genData: genData$1
  9292. };
  9293. var decoder;
  9294. var he = {
  9295. decode: function (html) {
  9296. decoder = decoder || document.createElement('div');
  9297. decoder.innerHTML = html;
  9298. return decoder.textContent;
  9299. }
  9300. };
  9301. var isUnaryTag = makeMap('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  9302. 'link,meta,param,source,track,wbr');
  9303. // Elements that you can, intentionally, leave open
  9304. // (and which close themselves)
  9305. var canBeLeftOpenTag = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source');
  9306. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  9307. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  9308. var isNonPhrasingTag = makeMap('address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  9309. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  9310. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  9311. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  9312. 'title,tr,track');
  9313. /**
  9314. * Not type-checking this file because it's mostly vendor code.
  9315. */
  9316. // Regular Expressions for parsing tags and attributes
  9317. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  9318. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  9319. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z".concat(unicodeRegExp.source, "]*");
  9320. var qnameCapture = "((?:".concat(ncname, "\\:)?").concat(ncname, ")");
  9321. var startTagOpen = new RegExp("^<".concat(qnameCapture));
  9322. var startTagClose = /^\s*(\/?)>/;
  9323. var endTag = new RegExp("^<\\/".concat(qnameCapture, "[^>]*>"));
  9324. var doctype = /^<!DOCTYPE [^>]+>/i;
  9325. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  9326. var comment = /^<!\--/;
  9327. var conditionalComment = /^<!\[/;
  9328. // Special Elements (can contain anything)
  9329. var isPlainTextElement = makeMap('script,style,textarea', true);
  9330. var reCache = {};
  9331. var decodingMap = {
  9332. '&lt;': '<',
  9333. '&gt;': '>',
  9334. '&quot;': '"',
  9335. '&amp;': '&',
  9336. '&#10;': '\n',
  9337. '&#9;': '\t',
  9338. '&#39;': "'"
  9339. };
  9340. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  9341. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  9342. // #5992
  9343. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  9344. var shouldIgnoreFirstNewline = function (tag, html) {
  9345. return tag && isIgnoreNewlineTag(tag) && html[0] === '\n';
  9346. };
  9347. function decodeAttr(value, shouldDecodeNewlines) {
  9348. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  9349. return value.replace(re, function (match) { return decodingMap[match]; });
  9350. }
  9351. function parseHTML(html, options) {
  9352. var stack = [];
  9353. var expectHTML = options.expectHTML;
  9354. var isUnaryTag = options.isUnaryTag || no;
  9355. var canBeLeftOpenTag = options.canBeLeftOpenTag || no;
  9356. var index = 0;
  9357. var last, lastTag;
  9358. var _loop_1 = function () {
  9359. last = html;
  9360. // Make sure we're not in a plaintext content element like script/style
  9361. if (!lastTag || !isPlainTextElement(lastTag)) {
  9362. var textEnd = html.indexOf('<');
  9363. if (textEnd === 0) {
  9364. // Comment:
  9365. if (comment.test(html)) {
  9366. var commentEnd = html.indexOf('-->');
  9367. if (commentEnd >= 0) {
  9368. if (options.shouldKeepComment && options.comment) {
  9369. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  9370. }
  9371. advance(commentEnd + 3);
  9372. return "continue";
  9373. }
  9374. }
  9375. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  9376. if (conditionalComment.test(html)) {
  9377. var conditionalEnd = html.indexOf(']>');
  9378. if (conditionalEnd >= 0) {
  9379. advance(conditionalEnd + 2);
  9380. return "continue";
  9381. }
  9382. }
  9383. // Doctype:
  9384. var doctypeMatch = html.match(doctype);
  9385. if (doctypeMatch) {
  9386. advance(doctypeMatch[0].length);
  9387. return "continue";
  9388. }
  9389. // End tag:
  9390. var endTagMatch = html.match(endTag);
  9391. if (endTagMatch) {
  9392. var curIndex = index;
  9393. advance(endTagMatch[0].length);
  9394. parseEndTag(endTagMatch[1], curIndex, index);
  9395. return "continue";
  9396. }
  9397. // Start tag:
  9398. var startTagMatch = parseStartTag();
  9399. if (startTagMatch) {
  9400. handleStartTag(startTagMatch);
  9401. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  9402. advance(1);
  9403. }
  9404. return "continue";
  9405. }
  9406. }
  9407. var text = void 0, rest = void 0, next = void 0;
  9408. if (textEnd >= 0) {
  9409. rest = html.slice(textEnd);
  9410. while (!endTag.test(rest) &&
  9411. !startTagOpen.test(rest) &&
  9412. !comment.test(rest) &&
  9413. !conditionalComment.test(rest)) {
  9414. // < in plain text, be forgiving and treat it as text
  9415. next = rest.indexOf('<', 1);
  9416. if (next < 0)
  9417. break;
  9418. textEnd += next;
  9419. rest = html.slice(textEnd);
  9420. }
  9421. text = html.substring(0, textEnd);
  9422. }
  9423. if (textEnd < 0) {
  9424. text = html;
  9425. }
  9426. if (text) {
  9427. advance(text.length);
  9428. }
  9429. if (options.chars && text) {
  9430. options.chars(text, index - text.length, index);
  9431. }
  9432. }
  9433. else {
  9434. var endTagLength_1 = 0;
  9435. var stackedTag_1 = lastTag.toLowerCase();
  9436. var reStackedTag = reCache[stackedTag_1] ||
  9437. (reCache[stackedTag_1] = new RegExp('([\\s\\S]*?)(</' + stackedTag_1 + '[^>]*>)', 'i'));
  9438. var rest = html.replace(reStackedTag, function (all, text, endTag) {
  9439. endTagLength_1 = endTag.length;
  9440. if (!isPlainTextElement(stackedTag_1) && stackedTag_1 !== 'noscript') {
  9441. text = text
  9442. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  9443. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  9444. }
  9445. if (shouldIgnoreFirstNewline(stackedTag_1, text)) {
  9446. text = text.slice(1);
  9447. }
  9448. if (options.chars) {
  9449. options.chars(text);
  9450. }
  9451. return '';
  9452. });
  9453. index += html.length - rest.length;
  9454. html = rest;
  9455. parseEndTag(stackedTag_1, index - endTagLength_1, index);
  9456. }
  9457. if (html === last) {
  9458. options.chars && options.chars(html);
  9459. if (!stack.length && options.warn) {
  9460. options.warn("Mal-formatted tag at end of template: \"".concat(html, "\""), {
  9461. start: index + html.length
  9462. });
  9463. }
  9464. return "break";
  9465. }
  9466. };
  9467. while (html) {
  9468. var state_1 = _loop_1();
  9469. if (state_1 === "break")
  9470. break;
  9471. }
  9472. // Clean up any remaining tags
  9473. parseEndTag();
  9474. function advance(n) {
  9475. index += n;
  9476. html = html.substring(n);
  9477. }
  9478. function parseStartTag() {
  9479. var start = html.match(startTagOpen);
  9480. if (start) {
  9481. var match = {
  9482. tagName: start[1],
  9483. attrs: [],
  9484. start: index
  9485. };
  9486. advance(start[0].length);
  9487. var end = void 0, attr = void 0;
  9488. while (!(end = html.match(startTagClose)) &&
  9489. (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  9490. attr.start = index;
  9491. advance(attr[0].length);
  9492. attr.end = index;
  9493. match.attrs.push(attr);
  9494. }
  9495. if (end) {
  9496. match.unarySlash = end[1];
  9497. advance(end[0].length);
  9498. match.end = index;
  9499. return match;
  9500. }
  9501. }
  9502. }
  9503. function handleStartTag(match) {
  9504. var tagName = match.tagName;
  9505. var unarySlash = match.unarySlash;
  9506. if (expectHTML) {
  9507. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  9508. parseEndTag(lastTag);
  9509. }
  9510. if (canBeLeftOpenTag(tagName) && lastTag === tagName) {
  9511. parseEndTag(tagName);
  9512. }
  9513. }
  9514. var unary = isUnaryTag(tagName) || !!unarySlash;
  9515. var l = match.attrs.length;
  9516. var attrs = new Array(l);
  9517. for (var i = 0; i < l; i++) {
  9518. var args = match.attrs[i];
  9519. var value = args[3] || args[4] || args[5] || '';
  9520. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  9521. ? options.shouldDecodeNewlinesForHref
  9522. : options.shouldDecodeNewlines;
  9523. attrs[i] = {
  9524. name: args[1],
  9525. value: decodeAttr(value, shouldDecodeNewlines)
  9526. };
  9527. if (options.outputSourceRange) {
  9528. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  9529. attrs[i].end = args.end;
  9530. }
  9531. }
  9532. if (!unary) {
  9533. stack.push({
  9534. tag: tagName,
  9535. lowerCasedTag: tagName.toLowerCase(),
  9536. attrs: attrs,
  9537. start: match.start,
  9538. end: match.end
  9539. });
  9540. lastTag = tagName;
  9541. }
  9542. if (options.start) {
  9543. options.start(tagName, attrs, unary, match.start, match.end);
  9544. }
  9545. }
  9546. function parseEndTag(tagName, start, end) {
  9547. var pos, lowerCasedTagName;
  9548. if (start == null)
  9549. start = index;
  9550. if (end == null)
  9551. end = index;
  9552. // Find the closest opened tag of the same type
  9553. if (tagName) {
  9554. lowerCasedTagName = tagName.toLowerCase();
  9555. for (pos = stack.length - 1; pos >= 0; pos--) {
  9556. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  9557. break;
  9558. }
  9559. }
  9560. }
  9561. else {
  9562. // If no tag name is provided, clean shop
  9563. pos = 0;
  9564. }
  9565. if (pos >= 0) {
  9566. // Close all the open elements, up the stack
  9567. for (var i = stack.length - 1; i >= pos; i--) {
  9568. if ((i > pos || !tagName) && options.warn) {
  9569. options.warn("tag <".concat(stack[i].tag, "> has no matching end tag."), {
  9570. start: stack[i].start,
  9571. end: stack[i].end
  9572. });
  9573. }
  9574. if (options.end) {
  9575. options.end(stack[i].tag, start, end);
  9576. }
  9577. }
  9578. // Remove the open elements from the stack
  9579. stack.length = pos;
  9580. lastTag = pos && stack[pos - 1].tag;
  9581. }
  9582. else if (lowerCasedTagName === 'br') {
  9583. if (options.start) {
  9584. options.start(tagName, [], true, start, end);
  9585. }
  9586. }
  9587. else if (lowerCasedTagName === 'p') {
  9588. if (options.start) {
  9589. options.start(tagName, [], false, start, end);
  9590. }
  9591. if (options.end) {
  9592. options.end(tagName, start, end);
  9593. }
  9594. }
  9595. }
  9596. }
  9597. var onRE = /^@|^v-on:/;
  9598. var dirRE = /^v-|^@|^:|^#/;
  9599. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  9600. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  9601. var stripParensRE = /^\(|\)$/g;
  9602. var dynamicArgRE = /^\[.*\]$/;
  9603. var argRE = /:(.*)$/;
  9604. var bindRE = /^:|^\.|^v-bind:/;
  9605. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  9606. var slotRE = /^v-slot(:|$)|^#/;
  9607. var lineBreakRE = /[\r\n]/;
  9608. var whitespaceRE = /[ \f\t\r\n]+/g;
  9609. var invalidAttributeRE = /[\s"'<>\/=]/;
  9610. var decodeHTMLCached = cached(he.decode);
  9611. var emptySlotScopeToken = "_empty_";
  9612. // configurable state
  9613. var warn;
  9614. var delimiters;
  9615. var transforms;
  9616. var preTransforms;
  9617. var postTransforms;
  9618. var platformIsPreTag;
  9619. var platformMustUseProp;
  9620. var platformGetTagNamespace;
  9621. var maybeComponent;
  9622. function createASTElement(tag, attrs, parent) {
  9623. return {
  9624. type: 1,
  9625. tag: tag,
  9626. attrsList: attrs,
  9627. attrsMap: makeAttrsMap(attrs),
  9628. rawAttrsMap: {},
  9629. parent: parent,
  9630. children: []
  9631. };
  9632. }
  9633. /**
  9634. * Convert HTML string to AST.
  9635. */
  9636. function parse(template, options) {
  9637. warn = options.warn || baseWarn;
  9638. platformIsPreTag = options.isPreTag || no;
  9639. platformMustUseProp = options.mustUseProp || no;
  9640. platformGetTagNamespace = options.getTagNamespace || no;
  9641. var isReservedTag = options.isReservedTag || no;
  9642. maybeComponent = function (el) {
  9643. return !!(el.component ||
  9644. el.attrsMap[':is'] ||
  9645. el.attrsMap['v-bind:is'] ||
  9646. !(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag)));
  9647. };
  9648. transforms = pluckModuleFunction(options.modules, 'transformNode');
  9649. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  9650. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  9651. delimiters = options.delimiters;
  9652. var stack = [];
  9653. var preserveWhitespace = options.preserveWhitespace !== false;
  9654. var whitespaceOption = options.whitespace;
  9655. var root;
  9656. var currentParent;
  9657. var inVPre = false;
  9658. var inPre = false;
  9659. var warned = false;
  9660. function warnOnce(msg, range) {
  9661. if (!warned) {
  9662. warned = true;
  9663. warn(msg, range);
  9664. }
  9665. }
  9666. function closeElement(element) {
  9667. trimEndingWhitespace(element);
  9668. if (!inVPre && !element.processed) {
  9669. element = processElement(element, options);
  9670. }
  9671. // tree management
  9672. if (!stack.length && element !== root) {
  9673. // allow root elements with v-if, v-else-if and v-else
  9674. if (root.if && (element.elseif || element.else)) {
  9675. {
  9676. checkRootConstraints(element);
  9677. }
  9678. addIfCondition(root, {
  9679. exp: element.elseif,
  9680. block: element
  9681. });
  9682. }
  9683. else {
  9684. warnOnce("Component template should contain exactly one root element. " +
  9685. "If you are using v-if on multiple elements, " +
  9686. "use v-else-if to chain them instead.", { start: element.start });
  9687. }
  9688. }
  9689. if (currentParent && !element.forbidden) {
  9690. if (element.elseif || element.else) {
  9691. processIfConditions(element, currentParent);
  9692. }
  9693. else {
  9694. if (element.slotScope) {
  9695. // scoped slot
  9696. // keep it in the children list so that v-else(-if) conditions can
  9697. // find it as the prev node.
  9698. var name_1 = element.slotTarget || '"default"';
  9699. (currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name_1] = element;
  9700. }
  9701. currentParent.children.push(element);
  9702. element.parent = currentParent;
  9703. }
  9704. }
  9705. // final children cleanup
  9706. // filter out scoped slots
  9707. element.children = element.children.filter(function (c) { return !c.slotScope; });
  9708. // remove trailing whitespace node again
  9709. trimEndingWhitespace(element);
  9710. // check pre state
  9711. if (element.pre) {
  9712. inVPre = false;
  9713. }
  9714. if (platformIsPreTag(element.tag)) {
  9715. inPre = false;
  9716. }
  9717. // apply post-transforms
  9718. for (var i = 0; i < postTransforms.length; i++) {
  9719. postTransforms[i](element, options);
  9720. }
  9721. }
  9722. function trimEndingWhitespace(el) {
  9723. // remove trailing whitespace node
  9724. if (!inPre) {
  9725. var lastNode = void 0;
  9726. while ((lastNode = el.children[el.children.length - 1]) &&
  9727. lastNode.type === 3 &&
  9728. lastNode.text === ' ') {
  9729. el.children.pop();
  9730. }
  9731. }
  9732. }
  9733. function checkRootConstraints(el) {
  9734. if (el.tag === 'slot' || el.tag === 'template') {
  9735. warnOnce("Cannot use <".concat(el.tag, "> as component root element because it may ") +
  9736. 'contain multiple nodes.', { start: el.start });
  9737. }
  9738. if (el.attrsMap.hasOwnProperty('v-for')) {
  9739. warnOnce('Cannot use v-for on stateful component root element because ' +
  9740. 'it renders multiple elements.', el.rawAttrsMap['v-for']);
  9741. }
  9742. }
  9743. parseHTML(template, {
  9744. warn: warn,
  9745. expectHTML: options.expectHTML,
  9746. isUnaryTag: options.isUnaryTag,
  9747. canBeLeftOpenTag: options.canBeLeftOpenTag,
  9748. shouldDecodeNewlines: options.shouldDecodeNewlines,
  9749. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  9750. shouldKeepComment: options.comments,
  9751. outputSourceRange: options.outputSourceRange,
  9752. start: function (tag, attrs, unary, start, end) {
  9753. // check namespace.
  9754. // inherit parent ns if there is one
  9755. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  9756. // handle IE svg bug
  9757. /* istanbul ignore if */
  9758. if (isIE && ns === 'svg') {
  9759. attrs = guardIESVGBug(attrs);
  9760. }
  9761. var element = createASTElement(tag, attrs, currentParent);
  9762. if (ns) {
  9763. element.ns = ns;
  9764. }
  9765. {
  9766. if (options.outputSourceRange) {
  9767. element.start = start;
  9768. element.end = end;
  9769. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  9770. cumulated[attr.name] = attr;
  9771. return cumulated;
  9772. }, {});
  9773. }
  9774. attrs.forEach(function (attr) {
  9775. if (invalidAttributeRE.test(attr.name)) {
  9776. warn("Invalid dynamic argument expression: attribute names cannot contain " +
  9777. "spaces, quotes, <, >, / or =.", options.outputSourceRange
  9778. ? {
  9779. start: attr.start + attr.name.indexOf("["),
  9780. end: attr.start + attr.name.length
  9781. }
  9782. : undefined);
  9783. }
  9784. });
  9785. }
  9786. if (isForbiddenTag(element) && !isServerRendering()) {
  9787. element.forbidden = true;
  9788. warn('Templates should only be responsible for mapping the state to the ' +
  9789. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  9790. "<".concat(tag, ">") +
  9791. ', as they will not be parsed.', { start: element.start });
  9792. }
  9793. // apply pre-transforms
  9794. for (var i = 0; i < preTransforms.length; i++) {
  9795. element = preTransforms[i](element, options) || element;
  9796. }
  9797. if (!inVPre) {
  9798. processPre(element);
  9799. if (element.pre) {
  9800. inVPre = true;
  9801. }
  9802. }
  9803. if (platformIsPreTag(element.tag)) {
  9804. inPre = true;
  9805. }
  9806. if (inVPre) {
  9807. processRawAttrs(element);
  9808. }
  9809. else if (!element.processed) {
  9810. // structural directives
  9811. processFor(element);
  9812. processIf(element);
  9813. processOnce(element);
  9814. }
  9815. if (!root) {
  9816. root = element;
  9817. {
  9818. checkRootConstraints(root);
  9819. }
  9820. }
  9821. if (!unary) {
  9822. currentParent = element;
  9823. stack.push(element);
  9824. }
  9825. else {
  9826. closeElement(element);
  9827. }
  9828. },
  9829. end: function (tag, start, end) {
  9830. var element = stack[stack.length - 1];
  9831. // pop stack
  9832. stack.length -= 1;
  9833. currentParent = stack[stack.length - 1];
  9834. if (options.outputSourceRange) {
  9835. element.end = end;
  9836. }
  9837. closeElement(element);
  9838. },
  9839. chars: function (text, start, end) {
  9840. if (!currentParent) {
  9841. {
  9842. if (text === template) {
  9843. warnOnce('Component template requires a root element, rather than just text.', { start: start });
  9844. }
  9845. else if ((text = text.trim())) {
  9846. warnOnce("text \"".concat(text, "\" outside root element will be ignored."), {
  9847. start: start
  9848. });
  9849. }
  9850. }
  9851. return;
  9852. }
  9853. // IE textarea placeholder bug
  9854. /* istanbul ignore if */
  9855. if (isIE &&
  9856. currentParent.tag === 'textarea' &&
  9857. currentParent.attrsMap.placeholder === text) {
  9858. return;
  9859. }
  9860. var children = currentParent.children;
  9861. if (inPre || text.trim()) {
  9862. text = isTextTag(currentParent)
  9863. ? text
  9864. : decodeHTMLCached(text);
  9865. }
  9866. else if (!children.length) {
  9867. // remove the whitespace-only node right after an opening tag
  9868. text = '';
  9869. }
  9870. else if (whitespaceOption) {
  9871. if (whitespaceOption === 'condense') {
  9872. // in condense mode, remove the whitespace node if it contains
  9873. // line break, otherwise condense to a single space
  9874. text = lineBreakRE.test(text) ? '' : ' ';
  9875. }
  9876. else {
  9877. text = ' ';
  9878. }
  9879. }
  9880. else {
  9881. text = preserveWhitespace ? ' ' : '';
  9882. }
  9883. if (text) {
  9884. if (!inPre && whitespaceOption === 'condense') {
  9885. // condense consecutive whitespaces into single space
  9886. text = text.replace(whitespaceRE, ' ');
  9887. }
  9888. var res = void 0;
  9889. var child = void 0;
  9890. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  9891. child = {
  9892. type: 2,
  9893. expression: res.expression,
  9894. tokens: res.tokens,
  9895. text: text
  9896. };
  9897. }
  9898. else if (text !== ' ' ||
  9899. !children.length ||
  9900. children[children.length - 1].text !== ' ') {
  9901. child = {
  9902. type: 3,
  9903. text: text
  9904. };
  9905. }
  9906. if (child) {
  9907. if (options.outputSourceRange) {
  9908. child.start = start;
  9909. child.end = end;
  9910. }
  9911. children.push(child);
  9912. }
  9913. }
  9914. },
  9915. comment: function (text, start, end) {
  9916. // adding anything as a sibling to the root node is forbidden
  9917. // comments should still be allowed, but ignored
  9918. if (currentParent) {
  9919. var child = {
  9920. type: 3,
  9921. text: text,
  9922. isComment: true
  9923. };
  9924. if (options.outputSourceRange) {
  9925. child.start = start;
  9926. child.end = end;
  9927. }
  9928. currentParent.children.push(child);
  9929. }
  9930. }
  9931. });
  9932. return root;
  9933. }
  9934. function processPre(el) {
  9935. if (getAndRemoveAttr(el, 'v-pre') != null) {
  9936. el.pre = true;
  9937. }
  9938. }
  9939. function processRawAttrs(el) {
  9940. var list = el.attrsList;
  9941. var len = list.length;
  9942. if (len) {
  9943. var attrs = (el.attrs = new Array(len));
  9944. for (var i = 0; i < len; i++) {
  9945. attrs[i] = {
  9946. name: list[i].name,
  9947. value: JSON.stringify(list[i].value)
  9948. };
  9949. if (list[i].start != null) {
  9950. attrs[i].start = list[i].start;
  9951. attrs[i].end = list[i].end;
  9952. }
  9953. }
  9954. }
  9955. else if (!el.pre) {
  9956. // non root node in pre blocks with no attributes
  9957. el.plain = true;
  9958. }
  9959. }
  9960. function processElement(element, options) {
  9961. processKey(element);
  9962. // determine whether this is a plain element after
  9963. // removing structural attributes
  9964. element.plain =
  9965. !element.key && !element.scopedSlots && !element.attrsList.length;
  9966. processRef(element);
  9967. processSlotContent(element);
  9968. processSlotOutlet(element);
  9969. processComponent(element);
  9970. for (var i = 0; i < transforms.length; i++) {
  9971. element = transforms[i](element, options) || element;
  9972. }
  9973. processAttrs(element);
  9974. return element;
  9975. }
  9976. function processKey(el) {
  9977. var exp = getBindingAttr(el, 'key');
  9978. if (exp) {
  9979. {
  9980. if (el.tag === 'template') {
  9981. warn("<template> cannot be keyed. Place the key on real elements instead.", getRawBindingAttr(el, 'key'));
  9982. }
  9983. if (el.for) {
  9984. var iterator = el.iterator2 || el.iterator1;
  9985. var parent_1 = el.parent;
  9986. if (iterator &&
  9987. iterator === exp &&
  9988. parent_1 &&
  9989. parent_1.tag === 'transition-group') {
  9990. warn("Do not use v-for index as key on <transition-group> children, " +
  9991. "this is the same as not using keys.", getRawBindingAttr(el, 'key'), true /* tip */);
  9992. }
  9993. }
  9994. }
  9995. el.key = exp;
  9996. }
  9997. }
  9998. function processRef(el) {
  9999. var ref = getBindingAttr(el, 'ref');
  10000. if (ref) {
  10001. el.ref = ref;
  10002. el.refInFor = checkInFor(el);
  10003. }
  10004. }
  10005. function processFor(el) {
  10006. var exp;
  10007. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  10008. var res = parseFor(exp);
  10009. if (res) {
  10010. extend(el, res);
  10011. }
  10012. else {
  10013. warn("Invalid v-for expression: ".concat(exp), el.rawAttrsMap['v-for']);
  10014. }
  10015. }
  10016. }
  10017. function parseFor(exp) {
  10018. var inMatch = exp.match(forAliasRE);
  10019. if (!inMatch)
  10020. return;
  10021. var res = {};
  10022. res.for = inMatch[2].trim();
  10023. var alias = inMatch[1].trim().replace(stripParensRE, '');
  10024. var iteratorMatch = alias.match(forIteratorRE);
  10025. if (iteratorMatch) {
  10026. res.alias = alias.replace(forIteratorRE, '').trim();
  10027. res.iterator1 = iteratorMatch[1].trim();
  10028. if (iteratorMatch[2]) {
  10029. res.iterator2 = iteratorMatch[2].trim();
  10030. }
  10031. }
  10032. else {
  10033. res.alias = alias;
  10034. }
  10035. return res;
  10036. }
  10037. function processIf(el) {
  10038. var exp = getAndRemoveAttr(el, 'v-if');
  10039. if (exp) {
  10040. el.if = exp;
  10041. addIfCondition(el, {
  10042. exp: exp,
  10043. block: el
  10044. });
  10045. }
  10046. else {
  10047. if (getAndRemoveAttr(el, 'v-else') != null) {
  10048. el.else = true;
  10049. }
  10050. var elseif = getAndRemoveAttr(el, 'v-else-if');
  10051. if (elseif) {
  10052. el.elseif = elseif;
  10053. }
  10054. }
  10055. }
  10056. function processIfConditions(el, parent) {
  10057. var prev = findPrevElement(parent.children);
  10058. if (prev && prev.if) {
  10059. addIfCondition(prev, {
  10060. exp: el.elseif,
  10061. block: el
  10062. });
  10063. }
  10064. else {
  10065. warn("v-".concat(el.elseif ? 'else-if="' + el.elseif + '"' : 'else', " ") +
  10066. "used on element <".concat(el.tag, "> without corresponding v-if."), el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']);
  10067. }
  10068. }
  10069. function findPrevElement(children) {
  10070. var i = children.length;
  10071. while (i--) {
  10072. if (children[i].type === 1) {
  10073. return children[i];
  10074. }
  10075. else {
  10076. if (children[i].text !== ' ') {
  10077. warn("text \"".concat(children[i].text.trim(), "\" between v-if and v-else(-if) ") +
  10078. "will be ignored.", children[i]);
  10079. }
  10080. children.pop();
  10081. }
  10082. }
  10083. }
  10084. function addIfCondition(el, condition) {
  10085. if (!el.ifConditions) {
  10086. el.ifConditions = [];
  10087. }
  10088. el.ifConditions.push(condition);
  10089. }
  10090. function processOnce(el) {
  10091. var once = getAndRemoveAttr(el, 'v-once');
  10092. if (once != null) {
  10093. el.once = true;
  10094. }
  10095. }
  10096. // handle content being passed to a component as slot,
  10097. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  10098. function processSlotContent(el) {
  10099. var slotScope;
  10100. if (el.tag === 'template') {
  10101. slotScope = getAndRemoveAttr(el, 'scope');
  10102. /* istanbul ignore if */
  10103. if (slotScope) {
  10104. warn("the \"scope\" attribute for scoped slots have been deprecated and " +
  10105. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  10106. "can also be used on plain elements in addition to <template> to " +
  10107. "denote scoped slots.", el.rawAttrsMap['scope'], true);
  10108. }
  10109. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  10110. }
  10111. else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  10112. /* istanbul ignore if */
  10113. if (el.attrsMap['v-for']) {
  10114. warn("Ambiguous combined usage of slot-scope and v-for on <".concat(el.tag, "> ") +
  10115. "(v-for takes higher priority). Use a wrapper <template> for the " +
  10116. "scoped slot to make it clearer.", el.rawAttrsMap['slot-scope'], true);
  10117. }
  10118. el.slotScope = slotScope;
  10119. }
  10120. // slot="xxx"
  10121. var slotTarget = getBindingAttr(el, 'slot');
  10122. if (slotTarget) {
  10123. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  10124. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  10125. // preserve slot as an attribute for native shadow DOM compat
  10126. // only for non-scoped slots.
  10127. if (el.tag !== 'template' && !el.slotScope) {
  10128. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  10129. }
  10130. }
  10131. // 2.6 v-slot syntax
  10132. {
  10133. if (el.tag === 'template') {
  10134. // v-slot on <template>
  10135. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  10136. if (slotBinding) {
  10137. {
  10138. if (el.slotTarget || el.slotScope) {
  10139. warn("Unexpected mixed usage of different slot syntaxes.", el);
  10140. }
  10141. if (el.parent && !maybeComponent(el.parent)) {
  10142. warn("<template v-slot> can only appear at the root level inside " +
  10143. "the receiving component", el);
  10144. }
  10145. }
  10146. var _a = getSlotName(slotBinding), name_2 = _a.name, dynamic = _a.dynamic;
  10147. el.slotTarget = name_2;
  10148. el.slotTargetDynamic = dynamic;
  10149. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  10150. }
  10151. }
  10152. else {
  10153. // v-slot on component, denotes default slot
  10154. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  10155. if (slotBinding) {
  10156. {
  10157. if (!maybeComponent(el)) {
  10158. warn("v-slot can only be used on components or <template>.", slotBinding);
  10159. }
  10160. if (el.slotScope || el.slotTarget) {
  10161. warn("Unexpected mixed usage of different slot syntaxes.", el);
  10162. }
  10163. if (el.scopedSlots) {
  10164. warn("To avoid scope ambiguity, the default slot should also use " +
  10165. "<template> syntax when there are other named slots.", slotBinding);
  10166. }
  10167. }
  10168. // add the component's children to its default slot
  10169. var slots = el.scopedSlots || (el.scopedSlots = {});
  10170. var _b = getSlotName(slotBinding), name_3 = _b.name, dynamic = _b.dynamic;
  10171. var slotContainer_1 = (slots[name_3] = createASTElement('template', [], el));
  10172. slotContainer_1.slotTarget = name_3;
  10173. slotContainer_1.slotTargetDynamic = dynamic;
  10174. slotContainer_1.children = el.children.filter(function (c) {
  10175. if (!c.slotScope) {
  10176. c.parent = slotContainer_1;
  10177. return true;
  10178. }
  10179. });
  10180. slotContainer_1.slotScope = slotBinding.value || emptySlotScopeToken;
  10181. // remove children as they are returned from scopedSlots now
  10182. el.children = [];
  10183. // mark el non-plain so data gets generated
  10184. el.plain = false;
  10185. }
  10186. }
  10187. }
  10188. }
  10189. function getSlotName(binding) {
  10190. var name = binding.name.replace(slotRE, '');
  10191. if (!name) {
  10192. if (binding.name[0] !== '#') {
  10193. name = 'default';
  10194. }
  10195. else {
  10196. warn("v-slot shorthand syntax requires a slot name.", binding);
  10197. }
  10198. }
  10199. return dynamicArgRE.test(name)
  10200. ? // dynamic [name]
  10201. { name: name.slice(1, -1), dynamic: true }
  10202. : // static name
  10203. { name: "\"".concat(name, "\""), dynamic: false };
  10204. }
  10205. // handle <slot/> outlets
  10206. function processSlotOutlet(el) {
  10207. if (el.tag === 'slot') {
  10208. el.slotName = getBindingAttr(el, 'name');
  10209. if (el.key) {
  10210. warn("`key` does not work on <slot> because slots are abstract outlets " +
  10211. "and can possibly expand into multiple elements. " +
  10212. "Use the key on a wrapping element instead.", getRawBindingAttr(el, 'key'));
  10213. }
  10214. }
  10215. }
  10216. function processComponent(el) {
  10217. var binding;
  10218. if ((binding = getBindingAttr(el, 'is'))) {
  10219. el.component = binding;
  10220. }
  10221. if (getAndRemoveAttr(el, 'inline-template') != null) {
  10222. el.inlineTemplate = true;
  10223. }
  10224. }
  10225. function processAttrs(el) {
  10226. var list = el.attrsList;
  10227. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  10228. for (i = 0, l = list.length; i < l; i++) {
  10229. name = rawName = list[i].name;
  10230. value = list[i].value;
  10231. if (dirRE.test(name)) {
  10232. // mark element as dynamic
  10233. el.hasBindings = true;
  10234. // modifiers
  10235. modifiers = parseModifiers(name.replace(dirRE, ''));
  10236. // support .foo shorthand syntax for the .prop modifier
  10237. if (modifiers) {
  10238. name = name.replace(modifierRE, '');
  10239. }
  10240. if (bindRE.test(name)) {
  10241. // v-bind
  10242. name = name.replace(bindRE, '');
  10243. value = parseFilters(value);
  10244. isDynamic = dynamicArgRE.test(name);
  10245. if (isDynamic) {
  10246. name = name.slice(1, -1);
  10247. }
  10248. if (value.trim().length === 0) {
  10249. warn("The value for a v-bind expression cannot be empty. Found in \"v-bind:".concat(name, "\""));
  10250. }
  10251. if (modifiers) {
  10252. if (modifiers.prop && !isDynamic) {
  10253. name = camelize(name);
  10254. if (name === 'innerHtml')
  10255. name = 'innerHTML';
  10256. }
  10257. if (modifiers.camel && !isDynamic) {
  10258. name = camelize(name);
  10259. }
  10260. if (modifiers.sync) {
  10261. syncGen = genAssignmentCode(value, "$event");
  10262. if (!isDynamic) {
  10263. addHandler(el, "update:".concat(camelize(name)), syncGen, null, false, warn, list[i]);
  10264. if (hyphenate(name) !== camelize(name)) {
  10265. addHandler(el, "update:".concat(hyphenate(name)), syncGen, null, false, warn, list[i]);
  10266. }
  10267. }
  10268. else {
  10269. // handler w/ dynamic event name
  10270. addHandler(el, "\"update:\"+(".concat(name, ")"), syncGen, null, false, warn, list[i], true // dynamic
  10271. );
  10272. }
  10273. }
  10274. }
  10275. if ((modifiers && modifiers.prop) ||
  10276. (!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name))) {
  10277. addProp(el, name, value, list[i], isDynamic);
  10278. }
  10279. else {
  10280. addAttr(el, name, value, list[i], isDynamic);
  10281. }
  10282. }
  10283. else if (onRE.test(name)) {
  10284. // v-on
  10285. name = name.replace(onRE, '');
  10286. isDynamic = dynamicArgRE.test(name);
  10287. if (isDynamic) {
  10288. name = name.slice(1, -1);
  10289. }
  10290. addHandler(el, name, value, modifiers, false, warn, list[i], isDynamic);
  10291. }
  10292. else {
  10293. // normal directives
  10294. name = name.replace(dirRE, '');
  10295. // parse arg
  10296. var argMatch = name.match(argRE);
  10297. var arg = argMatch && argMatch[1];
  10298. isDynamic = false;
  10299. if (arg) {
  10300. name = name.slice(0, -(arg.length + 1));
  10301. if (dynamicArgRE.test(arg)) {
  10302. arg = arg.slice(1, -1);
  10303. isDynamic = true;
  10304. }
  10305. }
  10306. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  10307. if (name === 'model') {
  10308. checkForAliasModel(el, value);
  10309. }
  10310. }
  10311. }
  10312. else {
  10313. // literal attribute
  10314. {
  10315. var res = parseText(value, delimiters);
  10316. if (res) {
  10317. warn("".concat(name, "=\"").concat(value, "\": ") +
  10318. 'Interpolation inside attributes has been removed. ' +
  10319. 'Use v-bind or the colon shorthand instead. For example, ' +
  10320. 'instead of <div id="{{ val }}">, use <div :id="val">.', list[i]);
  10321. }
  10322. }
  10323. addAttr(el, name, JSON.stringify(value), list[i]);
  10324. // #6887 firefox doesn't update muted state if set via attribute
  10325. // even immediately after element creation
  10326. if (!el.component &&
  10327. name === 'muted' &&
  10328. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  10329. addProp(el, name, 'true', list[i]);
  10330. }
  10331. }
  10332. }
  10333. }
  10334. function checkInFor(el) {
  10335. var parent = el;
  10336. while (parent) {
  10337. if (parent.for !== undefined) {
  10338. return true;
  10339. }
  10340. parent = parent.parent;
  10341. }
  10342. return false;
  10343. }
  10344. function parseModifiers(name) {
  10345. var match = name.match(modifierRE);
  10346. if (match) {
  10347. var ret_1 = {};
  10348. match.forEach(function (m) {
  10349. ret_1[m.slice(1)] = true;
  10350. });
  10351. return ret_1;
  10352. }
  10353. }
  10354. function makeAttrsMap(attrs) {
  10355. var map = {};
  10356. for (var i = 0, l = attrs.length; i < l; i++) {
  10357. if (map[attrs[i].name] && !isIE && !isEdge) {
  10358. warn('duplicate attribute: ' + attrs[i].name, attrs[i]);
  10359. }
  10360. map[attrs[i].name] = attrs[i].value;
  10361. }
  10362. return map;
  10363. }
  10364. // for script (e.g. type="x/template") or style, do not decode content
  10365. function isTextTag(el) {
  10366. return el.tag === 'script' || el.tag === 'style';
  10367. }
  10368. function isForbiddenTag(el) {
  10369. return (el.tag === 'style' ||
  10370. (el.tag === 'script' &&
  10371. (!el.attrsMap.type || el.attrsMap.type === 'text/javascript')));
  10372. }
  10373. var ieNSBug = /^xmlns:NS\d+/;
  10374. var ieNSPrefix = /^NS\d+:/;
  10375. /* istanbul ignore next */
  10376. function guardIESVGBug(attrs) {
  10377. var res = [];
  10378. for (var i = 0; i < attrs.length; i++) {
  10379. var attr = attrs[i];
  10380. if (!ieNSBug.test(attr.name)) {
  10381. attr.name = attr.name.replace(ieNSPrefix, '');
  10382. res.push(attr);
  10383. }
  10384. }
  10385. return res;
  10386. }
  10387. function checkForAliasModel(el, value) {
  10388. var _el = el;
  10389. while (_el) {
  10390. if (_el.for && _el.alias === value) {
  10391. warn("<".concat(el.tag, " v-model=\"").concat(value, "\">: ") +
  10392. "You are binding v-model directly to a v-for iteration alias. " +
  10393. "This will not be able to modify the v-for source array because " +
  10394. "writing to the alias is like modifying a function local variable. " +
  10395. "Consider using an array of objects and use v-model on an object property instead.", el.rawAttrsMap['v-model']);
  10396. }
  10397. _el = _el.parent;
  10398. }
  10399. }
  10400. /**
  10401. * Expand input[v-model] with dynamic type bindings into v-if-else chains
  10402. * Turn this:
  10403. * <input v-model="data[type]" :type="type">
  10404. * into this:
  10405. * <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
  10406. * <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
  10407. * <input v-else :type="type" v-model="data[type]">
  10408. */
  10409. function preTransformNode(el, options) {
  10410. if (el.tag === 'input') {
  10411. var map = el.attrsMap;
  10412. if (!map['v-model']) {
  10413. return;
  10414. }
  10415. var typeBinding = void 0;
  10416. if (map[':type'] || map['v-bind:type']) {
  10417. typeBinding = getBindingAttr(el, 'type');
  10418. }
  10419. if (!map.type && !typeBinding && map['v-bind']) {
  10420. typeBinding = "(".concat(map['v-bind'], ").type");
  10421. }
  10422. if (typeBinding) {
  10423. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  10424. var ifConditionExtra = ifCondition ? "&&(".concat(ifCondition, ")") : "";
  10425. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  10426. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  10427. // 1. checkbox
  10428. var branch0 = cloneASTElement(el);
  10429. // process for on the main node
  10430. processFor(branch0);
  10431. addRawAttr(branch0, 'type', 'checkbox');
  10432. processElement(branch0, options);
  10433. branch0.processed = true; // prevent it from double-processed
  10434. branch0.if = "(".concat(typeBinding, ")==='checkbox'") + ifConditionExtra;
  10435. addIfCondition(branch0, {
  10436. exp: branch0.if,
  10437. block: branch0
  10438. });
  10439. // 2. add radio else-if condition
  10440. var branch1 = cloneASTElement(el);
  10441. getAndRemoveAttr(branch1, 'v-for', true);
  10442. addRawAttr(branch1, 'type', 'radio');
  10443. processElement(branch1, options);
  10444. addIfCondition(branch0, {
  10445. exp: "(".concat(typeBinding, ")==='radio'") + ifConditionExtra,
  10446. block: branch1
  10447. });
  10448. // 3. other
  10449. var branch2 = cloneASTElement(el);
  10450. getAndRemoveAttr(branch2, 'v-for', true);
  10451. addRawAttr(branch2, ':type', typeBinding);
  10452. processElement(branch2, options);
  10453. addIfCondition(branch0, {
  10454. exp: ifCondition,
  10455. block: branch2
  10456. });
  10457. if (hasElse) {
  10458. branch0.else = true;
  10459. }
  10460. else if (elseIfCondition) {
  10461. branch0.elseif = elseIfCondition;
  10462. }
  10463. return branch0;
  10464. }
  10465. }
  10466. }
  10467. function cloneASTElement(el) {
  10468. return createASTElement(el.tag, el.attrsList.slice(), el.parent);
  10469. }
  10470. var model = {
  10471. preTransformNode: preTransformNode
  10472. };
  10473. var modules = [klass, style, model];
  10474. function text(el, dir) {
  10475. if (dir.value) {
  10476. addProp(el, 'textContent', "_s(".concat(dir.value, ")"), dir);
  10477. }
  10478. }
  10479. function html(el, dir) {
  10480. if (dir.value) {
  10481. addProp(el, 'innerHTML', "_s(".concat(dir.value, ")"), dir);
  10482. }
  10483. }
  10484. var directives = {
  10485. model: model$1,
  10486. text: text,
  10487. html: html
  10488. };
  10489. var baseOptions = {
  10490. expectHTML: true,
  10491. modules: modules,
  10492. directives: directives,
  10493. isPreTag: isPreTag,
  10494. isUnaryTag: isUnaryTag,
  10495. mustUseProp: mustUseProp,
  10496. canBeLeftOpenTag: canBeLeftOpenTag,
  10497. isReservedTag: isReservedTag,
  10498. getTagNamespace: getTagNamespace,
  10499. staticKeys: genStaticKeys$1(modules)
  10500. };
  10501. var isStaticKey;
  10502. var isPlatformReservedTag;
  10503. var genStaticKeysCached = cached(genStaticKeys);
  10504. /**
  10505. * Goal of the optimizer: walk the generated template AST tree
  10506. * and detect sub-trees that are purely static, i.e. parts of
  10507. * the DOM that never needs to change.
  10508. *
  10509. * Once we detect these sub-trees, we can:
  10510. *
  10511. * 1. Hoist them into constants, so that we no longer need to
  10512. * create fresh nodes for them on each re-render;
  10513. * 2. Completely skip them in the patching process.
  10514. */
  10515. function optimize(root, options) {
  10516. if (!root)
  10517. return;
  10518. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  10519. isPlatformReservedTag = options.isReservedTag || no;
  10520. // first pass: mark all non-static nodes.
  10521. markStatic(root);
  10522. // second pass: mark static roots.
  10523. markStaticRoots(root, false);
  10524. }
  10525. function genStaticKeys(keys) {
  10526. return makeMap('type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  10527. (keys ? ',' + keys : ''));
  10528. }
  10529. function markStatic(node) {
  10530. node.static = isStatic(node);
  10531. if (node.type === 1) {
  10532. // do not make component slot content static. this avoids
  10533. // 1. components not able to mutate slot nodes
  10534. // 2. static slot content fails for hot-reloading
  10535. if (!isPlatformReservedTag(node.tag) &&
  10536. node.tag !== 'slot' &&
  10537. node.attrsMap['inline-template'] == null) {
  10538. return;
  10539. }
  10540. for (var i = 0, l = node.children.length; i < l; i++) {
  10541. var child = node.children[i];
  10542. markStatic(child);
  10543. if (!child.static) {
  10544. node.static = false;
  10545. }
  10546. }
  10547. if (node.ifConditions) {
  10548. for (var i = 1, l = node.ifConditions.length; i < l; i++) {
  10549. var block = node.ifConditions[i].block;
  10550. markStatic(block);
  10551. if (!block.static) {
  10552. node.static = false;
  10553. }
  10554. }
  10555. }
  10556. }
  10557. }
  10558. function markStaticRoots(node, isInFor) {
  10559. if (node.type === 1) {
  10560. if (node.static || node.once) {
  10561. node.staticInFor = isInFor;
  10562. }
  10563. // For a node to qualify as a static root, it should have children that
  10564. // are not just static text. Otherwise the cost of hoisting out will
  10565. // outweigh the benefits and it's better off to just always render it fresh.
  10566. if (node.static &&
  10567. node.children.length &&
  10568. !(node.children.length === 1 && node.children[0].type === 3)) {
  10569. node.staticRoot = true;
  10570. return;
  10571. }
  10572. else {
  10573. node.staticRoot = false;
  10574. }
  10575. if (node.children) {
  10576. for (var i = 0, l = node.children.length; i < l; i++) {
  10577. markStaticRoots(node.children[i], isInFor || !!node.for);
  10578. }
  10579. }
  10580. if (node.ifConditions) {
  10581. for (var i = 1, l = node.ifConditions.length; i < l; i++) {
  10582. markStaticRoots(node.ifConditions[i].block, isInFor);
  10583. }
  10584. }
  10585. }
  10586. }
  10587. function isStatic(node) {
  10588. if (node.type === 2) {
  10589. // expression
  10590. return false;
  10591. }
  10592. if (node.type === 3) {
  10593. // text
  10594. return true;
  10595. }
  10596. return !!(node.pre ||
  10597. (!node.hasBindings && // no dynamic bindings
  10598. !node.if &&
  10599. !node.for && // not v-if or v-for or v-else
  10600. !isBuiltInTag(node.tag) && // not a built-in
  10601. isPlatformReservedTag(node.tag) && // not a component
  10602. !isDirectChildOfTemplateFor(node) &&
  10603. Object.keys(node).every(isStaticKey)));
  10604. }
  10605. function isDirectChildOfTemplateFor(node) {
  10606. while (node.parent) {
  10607. node = node.parent;
  10608. if (node.tag !== 'template') {
  10609. return false;
  10610. }
  10611. if (node.for) {
  10612. return true;
  10613. }
  10614. }
  10615. return false;
  10616. }
  10617. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  10618. var fnInvokeRE = /\([^)]*?\);*$/;
  10619. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  10620. // KeyboardEvent.keyCode aliases
  10621. var keyCodes = {
  10622. esc: 27,
  10623. tab: 9,
  10624. enter: 13,
  10625. space: 32,
  10626. up: 38,
  10627. left: 37,
  10628. right: 39,
  10629. down: 40,
  10630. delete: [8, 46]
  10631. };
  10632. // KeyboardEvent.key aliases
  10633. var keyNames = {
  10634. // #7880: IE11 and Edge use `Esc` for Escape key name.
  10635. esc: ['Esc', 'Escape'],
  10636. tab: 'Tab',
  10637. enter: 'Enter',
  10638. // #9112: IE11 uses `Spacebar` for Space key name.
  10639. space: [' ', 'Spacebar'],
  10640. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  10641. up: ['Up', 'ArrowUp'],
  10642. left: ['Left', 'ArrowLeft'],
  10643. right: ['Right', 'ArrowRight'],
  10644. down: ['Down', 'ArrowDown'],
  10645. // #9112: IE11 uses `Del` for Delete key name.
  10646. delete: ['Backspace', 'Delete', 'Del']
  10647. };
  10648. // #4868: modifiers that prevent the execution of the listener
  10649. // need to explicitly return null so that we can determine whether to remove
  10650. // the listener for .once
  10651. var genGuard = function (condition) { return "if(".concat(condition, ")return null;"); };
  10652. var modifierCode = {
  10653. stop: '$event.stopPropagation();',
  10654. prevent: '$event.preventDefault();',
  10655. self: genGuard("$event.target !== $event.currentTarget"),
  10656. ctrl: genGuard("!$event.ctrlKey"),
  10657. shift: genGuard("!$event.shiftKey"),
  10658. alt: genGuard("!$event.altKey"),
  10659. meta: genGuard("!$event.metaKey"),
  10660. left: genGuard("'button' in $event && $event.button !== 0"),
  10661. middle: genGuard("'button' in $event && $event.button !== 1"),
  10662. right: genGuard("'button' in $event && $event.button !== 2")
  10663. };
  10664. function genHandlers(events, isNative) {
  10665. var prefix = isNative ? 'nativeOn:' : 'on:';
  10666. var staticHandlers = "";
  10667. var dynamicHandlers = "";
  10668. for (var name_1 in events) {
  10669. var handlerCode = genHandler(events[name_1]);
  10670. //@ts-expect-error
  10671. if (events[name_1] && events[name_1].dynamic) {
  10672. dynamicHandlers += "".concat(name_1, ",").concat(handlerCode, ",");
  10673. }
  10674. else {
  10675. staticHandlers += "\"".concat(name_1, "\":").concat(handlerCode, ",");
  10676. }
  10677. }
  10678. staticHandlers = "{".concat(staticHandlers.slice(0, -1), "}");
  10679. if (dynamicHandlers) {
  10680. return prefix + "_d(".concat(staticHandlers, ",[").concat(dynamicHandlers.slice(0, -1), "])");
  10681. }
  10682. else {
  10683. return prefix + staticHandlers;
  10684. }
  10685. }
  10686. function genHandler(handler) {
  10687. if (!handler) {
  10688. return 'function(){}';
  10689. }
  10690. if (Array.isArray(handler)) {
  10691. return "[".concat(handler.map(function (handler) { return genHandler(handler); }).join(','), "]");
  10692. }
  10693. var isMethodPath = simplePathRE.test(handler.value);
  10694. var isFunctionExpression = fnExpRE.test(handler.value);
  10695. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  10696. if (!handler.modifiers) {
  10697. if (isMethodPath || isFunctionExpression) {
  10698. return handler.value;
  10699. }
  10700. return "function($event){".concat(isFunctionInvocation ? "return ".concat(handler.value) : handler.value, "}"); // inline statement
  10701. }
  10702. else {
  10703. var code = '';
  10704. var genModifierCode = '';
  10705. var keys = [];
  10706. var _loop_1 = function (key) {
  10707. if (modifierCode[key]) {
  10708. genModifierCode += modifierCode[key];
  10709. // left/right
  10710. if (keyCodes[key]) {
  10711. keys.push(key);
  10712. }
  10713. }
  10714. else if (key === 'exact') {
  10715. var modifiers_1 = handler.modifiers;
  10716. genModifierCode += genGuard(['ctrl', 'shift', 'alt', 'meta']
  10717. .filter(function (keyModifier) { return !modifiers_1[keyModifier]; })
  10718. .map(function (keyModifier) { return "$event.".concat(keyModifier, "Key"); })
  10719. .join('||'));
  10720. }
  10721. else {
  10722. keys.push(key);
  10723. }
  10724. };
  10725. for (var key in handler.modifiers) {
  10726. _loop_1(key);
  10727. }
  10728. if (keys.length) {
  10729. code += genKeyFilter(keys);
  10730. }
  10731. // Make sure modifiers like prevent and stop get executed after key filtering
  10732. if (genModifierCode) {
  10733. code += genModifierCode;
  10734. }
  10735. var handlerCode = isMethodPath
  10736. ? "return ".concat(handler.value, ".apply(null, arguments)")
  10737. : isFunctionExpression
  10738. ? "return (".concat(handler.value, ").apply(null, arguments)")
  10739. : isFunctionInvocation
  10740. ? "return ".concat(handler.value)
  10741. : handler.value;
  10742. return "function($event){".concat(code).concat(handlerCode, "}");
  10743. }
  10744. }
  10745. function genKeyFilter(keys) {
  10746. return (
  10747. // make sure the key filters only apply to KeyboardEvents
  10748. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  10749. // key events that do not have keyCode property...
  10750. "if(!$event.type.indexOf('key')&&" +
  10751. "".concat(keys.map(genFilterCode).join('&&'), ")return null;"));
  10752. }
  10753. function genFilterCode(key) {
  10754. var keyVal = parseInt(key, 10);
  10755. if (keyVal) {
  10756. return "$event.keyCode!==".concat(keyVal);
  10757. }
  10758. var keyCode = keyCodes[key];
  10759. var keyName = keyNames[key];
  10760. return ("_k($event.keyCode," +
  10761. "".concat(JSON.stringify(key), ",") +
  10762. "".concat(JSON.stringify(keyCode), ",") +
  10763. "$event.key," +
  10764. "".concat(JSON.stringify(keyName)) +
  10765. ")");
  10766. }
  10767. function on(el, dir) {
  10768. if (dir.modifiers) {
  10769. warn$2("v-on without argument does not support modifiers.");
  10770. }
  10771. el.wrapListeners = function (code) { return "_g(".concat(code, ",").concat(dir.value, ")"); };
  10772. }
  10773. function bind(el, dir) {
  10774. el.wrapData = function (code) {
  10775. return "_b(".concat(code, ",'").concat(el.tag, "',").concat(dir.value, ",").concat(dir.modifiers && dir.modifiers.prop ? 'true' : 'false').concat(dir.modifiers && dir.modifiers.sync ? ',true' : '', ")");
  10776. };
  10777. }
  10778. var baseDirectives = {
  10779. on: on,
  10780. bind: bind,
  10781. cloak: noop
  10782. };
  10783. var CodegenState = /** @class */ (function () {
  10784. function CodegenState(options) {
  10785. this.options = options;
  10786. this.warn = options.warn || baseWarn;
  10787. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  10788. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  10789. this.directives = extend(extend({}, baseDirectives), options.directives);
  10790. var isReservedTag = options.isReservedTag || no;
  10791. this.maybeComponent = function (el) {
  10792. return !!el.component || !isReservedTag(el.tag);
  10793. };
  10794. this.onceId = 0;
  10795. this.staticRenderFns = [];
  10796. this.pre = false;
  10797. }
  10798. return CodegenState;
  10799. }());
  10800. function generate(ast, options) {
  10801. var state = new CodegenState(options);
  10802. // fix #11483, Root level <script> tags should not be rendered.
  10803. var code = ast
  10804. ? ast.tag === 'script'
  10805. ? 'null'
  10806. : genElement(ast, state)
  10807. : '_c("div")';
  10808. return {
  10809. render: "with(this){return ".concat(code, "}"),
  10810. staticRenderFns: state.staticRenderFns
  10811. };
  10812. }
  10813. function genElement(el, state) {
  10814. if (el.parent) {
  10815. el.pre = el.pre || el.parent.pre;
  10816. }
  10817. if (el.staticRoot && !el.staticProcessed) {
  10818. return genStatic(el, state);
  10819. }
  10820. else if (el.once && !el.onceProcessed) {
  10821. return genOnce(el, state);
  10822. }
  10823. else if (el.for && !el.forProcessed) {
  10824. return genFor(el, state);
  10825. }
  10826. else if (el.if && !el.ifProcessed) {
  10827. return genIf(el, state);
  10828. }
  10829. else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  10830. return genChildren(el, state) || 'void 0';
  10831. }
  10832. else if (el.tag === 'slot') {
  10833. return genSlot(el, state);
  10834. }
  10835. else {
  10836. // component or element
  10837. var code = void 0;
  10838. if (el.component) {
  10839. code = genComponent(el.component, el, state);
  10840. }
  10841. else {
  10842. var data = void 0;
  10843. var maybeComponent = state.maybeComponent(el);
  10844. if (!el.plain || (el.pre && maybeComponent)) {
  10845. data = genData(el, state);
  10846. }
  10847. var tag
  10848. // check if this is a component in <script setup>
  10849. = void 0;
  10850. // check if this is a component in <script setup>
  10851. var bindings = state.options.bindings;
  10852. if (maybeComponent && bindings && bindings.__isScriptSetup !== false) {
  10853. tag = checkBindingType(bindings, el.tag);
  10854. }
  10855. if (!tag)
  10856. tag = "'".concat(el.tag, "'");
  10857. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  10858. code = "_c(".concat(tag).concat(data ? ",".concat(data) : '' // data
  10859. ).concat(children ? ",".concat(children) : '' // children
  10860. , ")");
  10861. }
  10862. // module transforms
  10863. for (var i = 0; i < state.transforms.length; i++) {
  10864. code = state.transforms[i](el, code);
  10865. }
  10866. return code;
  10867. }
  10868. }
  10869. function checkBindingType(bindings, key) {
  10870. var camelName = camelize(key);
  10871. var PascalName = capitalize(camelName);
  10872. var checkType = function (type) {
  10873. if (bindings[key] === type) {
  10874. return key;
  10875. }
  10876. if (bindings[camelName] === type) {
  10877. return camelName;
  10878. }
  10879. if (bindings[PascalName] === type) {
  10880. return PascalName;
  10881. }
  10882. };
  10883. var fromConst = checkType("setup-const" /* BindingTypes.SETUP_CONST */) ||
  10884. checkType("setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */);
  10885. if (fromConst) {
  10886. return fromConst;
  10887. }
  10888. var fromMaybeRef = checkType("setup-let" /* BindingTypes.SETUP_LET */) ||
  10889. checkType("setup-ref" /* BindingTypes.SETUP_REF */) ||
  10890. checkType("setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
  10891. if (fromMaybeRef) {
  10892. return fromMaybeRef;
  10893. }
  10894. }
  10895. // hoist static sub-trees out
  10896. function genStatic(el, state) {
  10897. el.staticProcessed = true;
  10898. // Some elements (templates) need to behave differently inside of a v-pre
  10899. // node. All pre nodes are static roots, so we can use this as a location to
  10900. // wrap a state change and reset it upon exiting the pre node.
  10901. var originalPreState = state.pre;
  10902. if (el.pre) {
  10903. state.pre = el.pre;
  10904. }
  10905. state.staticRenderFns.push("with(this){return ".concat(genElement(el, state), "}"));
  10906. state.pre = originalPreState;
  10907. return "_m(".concat(state.staticRenderFns.length - 1).concat(el.staticInFor ? ',true' : '', ")");
  10908. }
  10909. // v-once
  10910. function genOnce(el, state) {
  10911. el.onceProcessed = true;
  10912. if (el.if && !el.ifProcessed) {
  10913. return genIf(el, state);
  10914. }
  10915. else if (el.staticInFor) {
  10916. var key = '';
  10917. var parent_1 = el.parent;
  10918. while (parent_1) {
  10919. if (parent_1.for) {
  10920. key = parent_1.key;
  10921. break;
  10922. }
  10923. parent_1 = parent_1.parent;
  10924. }
  10925. if (!key) {
  10926. state.warn("v-once can only be used inside v-for that is keyed. ", el.rawAttrsMap['v-once']);
  10927. return genElement(el, state);
  10928. }
  10929. return "_o(".concat(genElement(el, state), ",").concat(state.onceId++, ",").concat(key, ")");
  10930. }
  10931. else {
  10932. return genStatic(el, state);
  10933. }
  10934. }
  10935. function genIf(el, state, altGen, altEmpty) {
  10936. el.ifProcessed = true; // avoid recursion
  10937. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty);
  10938. }
  10939. function genIfConditions(conditions, state, altGen, altEmpty) {
  10940. if (!conditions.length) {
  10941. return altEmpty || '_e()';
  10942. }
  10943. var condition = conditions.shift();
  10944. if (condition.exp) {
  10945. return "(".concat(condition.exp, ")?").concat(genTernaryExp(condition.block), ":").concat(genIfConditions(conditions, state, altGen, altEmpty));
  10946. }
  10947. else {
  10948. return "".concat(genTernaryExp(condition.block));
  10949. }
  10950. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  10951. function genTernaryExp(el) {
  10952. return altGen
  10953. ? altGen(el, state)
  10954. : el.once
  10955. ? genOnce(el, state)
  10956. : genElement(el, state);
  10957. }
  10958. }
  10959. function genFor(el, state, altGen, altHelper) {
  10960. var exp = el.for;
  10961. var alias = el.alias;
  10962. var iterator1 = el.iterator1 ? ",".concat(el.iterator1) : '';
  10963. var iterator2 = el.iterator2 ? ",".concat(el.iterator2) : '';
  10964. if (state.maybeComponent(el) &&
  10965. el.tag !== 'slot' &&
  10966. el.tag !== 'template' &&
  10967. !el.key) {
  10968. state.warn("<".concat(el.tag, " v-for=\"").concat(alias, " in ").concat(exp, "\">: component lists rendered with ") +
  10969. "v-for should have explicit keys. " +
  10970. "See https://vuejs.org/guide/list.html#key for more info.", el.rawAttrsMap['v-for'], true /* tip */);
  10971. }
  10972. el.forProcessed = true; // avoid recursion
  10973. return ("".concat(altHelper || '_l', "((").concat(exp, "),") +
  10974. "function(".concat(alias).concat(iterator1).concat(iterator2, "){") +
  10975. "return ".concat((altGen || genElement)(el, state)) +
  10976. '})');
  10977. }
  10978. function genData(el, state) {
  10979. var data = '{';
  10980. // directives first.
  10981. // directives may mutate the el's other properties before they are generated.
  10982. var dirs = genDirectives(el, state);
  10983. if (dirs)
  10984. data += dirs + ',';
  10985. // key
  10986. if (el.key) {
  10987. data += "key:".concat(el.key, ",");
  10988. }
  10989. // ref
  10990. if (el.ref) {
  10991. data += "ref:".concat(el.ref, ",");
  10992. }
  10993. if (el.refInFor) {
  10994. data += "refInFor:true,";
  10995. }
  10996. // pre
  10997. if (el.pre) {
  10998. data += "pre:true,";
  10999. }
  11000. // record original tag name for components using "is" attribute
  11001. if (el.component) {
  11002. data += "tag:\"".concat(el.tag, "\",");
  11003. }
  11004. // module data generation functions
  11005. for (var i = 0; i < state.dataGenFns.length; i++) {
  11006. data += state.dataGenFns[i](el);
  11007. }
  11008. // attributes
  11009. if (el.attrs) {
  11010. data += "attrs:".concat(genProps(el.attrs), ",");
  11011. }
  11012. // DOM props
  11013. if (el.props) {
  11014. data += "domProps:".concat(genProps(el.props), ",");
  11015. }
  11016. // event handlers
  11017. if (el.events) {
  11018. data += "".concat(genHandlers(el.events, false), ",");
  11019. }
  11020. if (el.nativeEvents) {
  11021. data += "".concat(genHandlers(el.nativeEvents, true), ",");
  11022. }
  11023. // slot target
  11024. // only for non-scoped slots
  11025. if (el.slotTarget && !el.slotScope) {
  11026. data += "slot:".concat(el.slotTarget, ",");
  11027. }
  11028. // scoped slots
  11029. if (el.scopedSlots) {
  11030. data += "".concat(genScopedSlots(el, el.scopedSlots, state), ",");
  11031. }
  11032. // component v-model
  11033. if (el.model) {
  11034. data += "model:{value:".concat(el.model.value, ",callback:").concat(el.model.callback, ",expression:").concat(el.model.expression, "},");
  11035. }
  11036. // inline-template
  11037. if (el.inlineTemplate) {
  11038. var inlineTemplate = genInlineTemplate(el, state);
  11039. if (inlineTemplate) {
  11040. data += "".concat(inlineTemplate, ",");
  11041. }
  11042. }
  11043. data = data.replace(/,$/, '') + '}';
  11044. // v-bind dynamic argument wrap
  11045. // v-bind with dynamic arguments must be applied using the same v-bind object
  11046. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  11047. if (el.dynamicAttrs) {
  11048. data = "_b(".concat(data, ",\"").concat(el.tag, "\",").concat(genProps(el.dynamicAttrs), ")");
  11049. }
  11050. // v-bind data wrap
  11051. if (el.wrapData) {
  11052. data = el.wrapData(data);
  11053. }
  11054. // v-on data wrap
  11055. if (el.wrapListeners) {
  11056. data = el.wrapListeners(data);
  11057. }
  11058. return data;
  11059. }
  11060. function genDirectives(el, state) {
  11061. var dirs = el.directives;
  11062. if (!dirs)
  11063. return;
  11064. var res = 'directives:[';
  11065. var hasRuntime = false;
  11066. var i, l, dir, needRuntime;
  11067. for (i = 0, l = dirs.length; i < l; i++) {
  11068. dir = dirs[i];
  11069. needRuntime = true;
  11070. var gen = state.directives[dir.name];
  11071. if (gen) {
  11072. // compile-time directive that manipulates AST.
  11073. // returns true if it also needs a runtime counterpart.
  11074. needRuntime = !!gen(el, dir, state.warn);
  11075. }
  11076. if (needRuntime) {
  11077. hasRuntime = true;
  11078. res += "{name:\"".concat(dir.name, "\",rawName:\"").concat(dir.rawName, "\"").concat(dir.value
  11079. ? ",value:(".concat(dir.value, "),expression:").concat(JSON.stringify(dir.value))
  11080. : '').concat(dir.arg ? ",arg:".concat(dir.isDynamicArg ? dir.arg : "\"".concat(dir.arg, "\"")) : '').concat(dir.modifiers ? ",modifiers:".concat(JSON.stringify(dir.modifiers)) : '', "},");
  11081. }
  11082. }
  11083. if (hasRuntime) {
  11084. return res.slice(0, -1) + ']';
  11085. }
  11086. }
  11087. function genInlineTemplate(el, state) {
  11088. var ast = el.children[0];
  11089. if ((el.children.length !== 1 || ast.type !== 1)) {
  11090. state.warn('Inline-template components must have exactly one child element.', { start: el.start });
  11091. }
  11092. if (ast && ast.type === 1) {
  11093. var inlineRenderFns = generate(ast, state.options);
  11094. return "inlineTemplate:{render:function(){".concat(inlineRenderFns.render, "},staticRenderFns:[").concat(inlineRenderFns.staticRenderFns
  11095. .map(function (code) { return "function(){".concat(code, "}"); })
  11096. .join(','), "]}");
  11097. }
  11098. }
  11099. function genScopedSlots(el, slots, state) {
  11100. // by default scoped slots are considered "stable", this allows child
  11101. // components with only scoped slots to skip forced updates from parent.
  11102. // but in some cases we have to bail-out of this optimization
  11103. // for example if the slot contains dynamic names, has v-if or v-for on them...
  11104. var needsForceUpdate = el.for ||
  11105. Object.keys(slots).some(function (key) {
  11106. var slot = slots[key];
  11107. return (slot.slotTargetDynamic || slot.if || slot.for || containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  11108. );
  11109. });
  11110. // #9534: if a component with scoped slots is inside a conditional branch,
  11111. // it's possible for the same component to be reused but with different
  11112. // compiled slot content. To avoid that, we generate a unique key based on
  11113. // the generated code of all the slot contents.
  11114. var needsKey = !!el.if;
  11115. // OR when it is inside another scoped slot or v-for (the reactivity may be
  11116. // disconnected due to the intermediate scope variable)
  11117. // #9438, #9506
  11118. // TODO: this can be further optimized by properly analyzing in-scope bindings
  11119. // and skip force updating ones that do not actually use scope variables.
  11120. if (!needsForceUpdate) {
  11121. var parent_2 = el.parent;
  11122. while (parent_2) {
  11123. if ((parent_2.slotScope && parent_2.slotScope !== emptySlotScopeToken) ||
  11124. parent_2.for) {
  11125. needsForceUpdate = true;
  11126. break;
  11127. }
  11128. if (parent_2.if) {
  11129. needsKey = true;
  11130. }
  11131. parent_2 = parent_2.parent;
  11132. }
  11133. }
  11134. var generatedSlots = Object.keys(slots)
  11135. .map(function (key) { return genScopedSlot(slots[key], state); })
  11136. .join(',');
  11137. return "scopedSlots:_u([".concat(generatedSlots, "]").concat(needsForceUpdate ? ",null,true" : "").concat(!needsForceUpdate && needsKey ? ",null,false,".concat(hash(generatedSlots)) : "", ")");
  11138. }
  11139. function hash(str) {
  11140. var hash = 5381;
  11141. var i = str.length;
  11142. while (i) {
  11143. hash = (hash * 33) ^ str.charCodeAt(--i);
  11144. }
  11145. return hash >>> 0;
  11146. }
  11147. function containsSlotChild(el) {
  11148. if (el.type === 1) {
  11149. if (el.tag === 'slot') {
  11150. return true;
  11151. }
  11152. return el.children.some(containsSlotChild);
  11153. }
  11154. return false;
  11155. }
  11156. function genScopedSlot(el, state) {
  11157. var isLegacySyntax = el.attrsMap['slot-scope'];
  11158. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  11159. return genIf(el, state, genScopedSlot, "null");
  11160. }
  11161. if (el.for && !el.forProcessed) {
  11162. return genFor(el, state, genScopedSlot);
  11163. }
  11164. var slotScope = el.slotScope === emptySlotScopeToken ? "" : String(el.slotScope);
  11165. var fn = "function(".concat(slotScope, "){") +
  11166. "return ".concat(el.tag === 'template'
  11167. ? el.if && isLegacySyntax
  11168. ? "(".concat(el.if, ")?").concat(genChildren(el, state) || 'undefined', ":undefined")
  11169. : genChildren(el, state) || 'undefined'
  11170. : genElement(el, state), "}");
  11171. // reverse proxy v-slot without scope on this.$slots
  11172. var reverseProxy = slotScope ? "" : ",proxy:true";
  11173. return "{key:".concat(el.slotTarget || "\"default\"", ",fn:").concat(fn).concat(reverseProxy, "}");
  11174. }
  11175. function genChildren(el, state, checkSkip, altGenElement, altGenNode) {
  11176. var children = el.children;
  11177. if (children.length) {
  11178. var el_1 = children[0];
  11179. // optimize single v-for
  11180. if (children.length === 1 &&
  11181. el_1.for &&
  11182. el_1.tag !== 'template' &&
  11183. el_1.tag !== 'slot') {
  11184. var normalizationType_1 = checkSkip
  11185. ? state.maybeComponent(el_1)
  11186. ? ",1"
  11187. : ",0"
  11188. : "";
  11189. return "".concat((altGenElement || genElement)(el_1, state)).concat(normalizationType_1);
  11190. }
  11191. var normalizationType = checkSkip
  11192. ? getNormalizationType(children, state.maybeComponent)
  11193. : 0;
  11194. var gen_1 = altGenNode || genNode;
  11195. return "[".concat(children.map(function (c) { return gen_1(c, state); }).join(','), "]").concat(normalizationType ? ",".concat(normalizationType) : '');
  11196. }
  11197. }
  11198. // determine the normalization needed for the children array.
  11199. // 0: no normalization needed
  11200. // 1: simple normalization needed (possible 1-level deep nested array)
  11201. // 2: full normalization needed
  11202. function getNormalizationType(children, maybeComponent) {
  11203. var res = 0;
  11204. for (var i = 0; i < children.length; i++) {
  11205. var el = children[i];
  11206. if (el.type !== 1) {
  11207. continue;
  11208. }
  11209. if (needsNormalization(el) ||
  11210. (el.ifConditions &&
  11211. el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  11212. res = 2;
  11213. break;
  11214. }
  11215. if (maybeComponent(el) ||
  11216. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  11217. res = 1;
  11218. }
  11219. }
  11220. return res;
  11221. }
  11222. function needsNormalization(el) {
  11223. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot';
  11224. }
  11225. function genNode(node, state) {
  11226. if (node.type === 1) {
  11227. return genElement(node, state);
  11228. }
  11229. else if (node.type === 3 && node.isComment) {
  11230. return genComment(node);
  11231. }
  11232. else {
  11233. return genText(node);
  11234. }
  11235. }
  11236. function genText(text) {
  11237. return "_v(".concat(text.type === 2
  11238. ? text.expression // no need for () because already wrapped in _s()
  11239. : transformSpecialNewlines(JSON.stringify(text.text)), ")");
  11240. }
  11241. function genComment(comment) {
  11242. return "_e(".concat(JSON.stringify(comment.text), ")");
  11243. }
  11244. function genSlot(el, state) {
  11245. var slotName = el.slotName || '"default"';
  11246. var children = genChildren(el, state);
  11247. var res = "_t(".concat(slotName).concat(children ? ",function(){return ".concat(children, "}") : '');
  11248. var attrs = el.attrs || el.dynamicAttrs
  11249. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  11250. // slot props are camelized
  11251. name: camelize(attr.name),
  11252. value: attr.value,
  11253. dynamic: attr.dynamic
  11254. }); }))
  11255. : null;
  11256. var bind = el.attrsMap['v-bind'];
  11257. if ((attrs || bind) && !children) {
  11258. res += ",null";
  11259. }
  11260. if (attrs) {
  11261. res += ",".concat(attrs);
  11262. }
  11263. if (bind) {
  11264. res += "".concat(attrs ? '' : ',null', ",").concat(bind);
  11265. }
  11266. return res + ')';
  11267. }
  11268. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  11269. function genComponent(componentName, el, state) {
  11270. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  11271. return "_c(".concat(componentName, ",").concat(genData(el, state)).concat(children ? ",".concat(children) : '', ")");
  11272. }
  11273. function genProps(props) {
  11274. var staticProps = "";
  11275. var dynamicProps = "";
  11276. for (var i = 0; i < props.length; i++) {
  11277. var prop = props[i];
  11278. var value = transformSpecialNewlines(prop.value);
  11279. if (prop.dynamic) {
  11280. dynamicProps += "".concat(prop.name, ",").concat(value, ",");
  11281. }
  11282. else {
  11283. staticProps += "\"".concat(prop.name, "\":").concat(value, ",");
  11284. }
  11285. }
  11286. staticProps = "{".concat(staticProps.slice(0, -1), "}");
  11287. if (dynamicProps) {
  11288. return "_d(".concat(staticProps, ",[").concat(dynamicProps.slice(0, -1), "])");
  11289. }
  11290. else {
  11291. return staticProps;
  11292. }
  11293. }
  11294. // #3895, #4268
  11295. function transformSpecialNewlines(text) {
  11296. return text.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
  11297. }
  11298. // these keywords should not appear inside expressions, but operators like
  11299. // typeof, instanceof and in are allowed
  11300. var prohibitedKeywordRE = new RegExp('\\b' +
  11301. ('do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  11302. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  11303. 'extends,finally,continue,debugger,function,arguments')
  11304. .split(',')
  11305. .join('\\b|\\b') +
  11306. '\\b');
  11307. // these unary operators should not be used as property/method names
  11308. var unaryOperatorsRE = new RegExp('\\b' +
  11309. 'delete,typeof,void'.split(',').join('\\s*\\([^\\)]*\\)|\\b') +
  11310. '\\s*\\([^\\)]*\\)');
  11311. // strip strings in expressions
  11312. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  11313. // detect problematic expressions in a template
  11314. function detectErrors(ast, warn) {
  11315. if (ast) {
  11316. checkNode(ast, warn);
  11317. }
  11318. }
  11319. function checkNode(node, warn) {
  11320. if (node.type === 1) {
  11321. for (var name_1 in node.attrsMap) {
  11322. if (dirRE.test(name_1)) {
  11323. var value = node.attrsMap[name_1];
  11324. if (value) {
  11325. var range = node.rawAttrsMap[name_1];
  11326. if (name_1 === 'v-for') {
  11327. checkFor(node, "v-for=\"".concat(value, "\""), warn, range);
  11328. }
  11329. else if (name_1 === 'v-slot' || name_1[0] === '#') {
  11330. checkFunctionParameterExpression(value, "".concat(name_1, "=\"").concat(value, "\""), warn, range);
  11331. }
  11332. else if (onRE.test(name_1)) {
  11333. checkEvent(value, "".concat(name_1, "=\"").concat(value, "\""), warn, range);
  11334. }
  11335. else {
  11336. checkExpression(value, "".concat(name_1, "=\"").concat(value, "\""), warn, range);
  11337. }
  11338. }
  11339. }
  11340. }
  11341. if (node.children) {
  11342. for (var i = 0; i < node.children.length; i++) {
  11343. checkNode(node.children[i], warn);
  11344. }
  11345. }
  11346. }
  11347. else if (node.type === 2) {
  11348. checkExpression(node.expression, node.text, warn, node);
  11349. }
  11350. }
  11351. function checkEvent(exp, text, warn, range) {
  11352. var stripped = exp.replace(stripStringRE, '');
  11353. var keywordMatch = stripped.match(unaryOperatorsRE);
  11354. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  11355. warn("avoid using JavaScript unary operator as property name: " +
  11356. "\"".concat(keywordMatch[0], "\" in expression ").concat(text.trim()), range);
  11357. }
  11358. checkExpression(exp, text, warn, range);
  11359. }
  11360. function checkFor(node, text, warn, range) {
  11361. checkExpression(node.for || '', text, warn, range);
  11362. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  11363. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  11364. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  11365. }
  11366. function checkIdentifier(ident, type, text, warn, range) {
  11367. if (typeof ident === 'string') {
  11368. try {
  11369. new Function("var ".concat(ident, "=_"));
  11370. }
  11371. catch (e) {
  11372. warn("invalid ".concat(type, " \"").concat(ident, "\" in expression: ").concat(text.trim()), range);
  11373. }
  11374. }
  11375. }
  11376. function checkExpression(exp, text, warn, range) {
  11377. try {
  11378. new Function("return ".concat(exp));
  11379. }
  11380. catch (e) {
  11381. var keywordMatch = exp
  11382. .replace(stripStringRE, '')
  11383. .match(prohibitedKeywordRE);
  11384. if (keywordMatch) {
  11385. warn("avoid using JavaScript keyword as property name: " +
  11386. "\"".concat(keywordMatch[0], "\"\n Raw expression: ").concat(text.trim()), range);
  11387. }
  11388. else {
  11389. warn("invalid expression: ".concat(e.message, " in\n\n") +
  11390. " ".concat(exp, "\n\n") +
  11391. " Raw expression: ".concat(text.trim(), "\n"), range);
  11392. }
  11393. }
  11394. }
  11395. function checkFunctionParameterExpression(exp, text, warn, range) {
  11396. try {
  11397. new Function(exp, '');
  11398. }
  11399. catch (e) {
  11400. warn("invalid function parameter expression: ".concat(e.message, " in\n\n") +
  11401. " ".concat(exp, "\n\n") +
  11402. " Raw expression: ".concat(text.trim(), "\n"), range);
  11403. }
  11404. }
  11405. var range = 2;
  11406. function generateCodeFrame(source, start, end) {
  11407. if (start === void 0) { start = 0; }
  11408. if (end === void 0) { end = source.length; }
  11409. var lines = source.split(/\r?\n/);
  11410. var count = 0;
  11411. var res = [];
  11412. for (var i = 0; i < lines.length; i++) {
  11413. count += lines[i].length + 1;
  11414. if (count >= start) {
  11415. for (var j = i - range; j <= i + range || end > count; j++) {
  11416. if (j < 0 || j >= lines.length)
  11417. continue;
  11418. res.push("".concat(j + 1).concat(repeat(" ", 3 - String(j + 1).length), "| ").concat(lines[j]));
  11419. var lineLength = lines[j].length;
  11420. if (j === i) {
  11421. // push underline
  11422. var pad = start - (count - lineLength) + 1;
  11423. var length_1 = end > count ? lineLength - pad : end - start;
  11424. res.push(" | " + repeat(" ", pad) + repeat("^", length_1));
  11425. }
  11426. else if (j > i) {
  11427. if (end > count) {
  11428. var length_2 = Math.min(end - count, lineLength);
  11429. res.push(" | " + repeat("^", length_2));
  11430. }
  11431. count += lineLength + 1;
  11432. }
  11433. }
  11434. break;
  11435. }
  11436. }
  11437. return res.join('\n');
  11438. }
  11439. function repeat(str, n) {
  11440. var result = '';
  11441. if (n > 0) {
  11442. // eslint-disable-next-line no-constant-condition
  11443. while (true) {
  11444. // eslint-disable-line
  11445. if (n & 1)
  11446. result += str;
  11447. n >>>= 1;
  11448. if (n <= 0)
  11449. break;
  11450. str += str;
  11451. }
  11452. }
  11453. return result;
  11454. }
  11455. function createFunction(code, errors) {
  11456. try {
  11457. return new Function(code);
  11458. }
  11459. catch (err) {
  11460. errors.push({ err: err, code: code });
  11461. return noop;
  11462. }
  11463. }
  11464. function createCompileToFunctionFn(compile) {
  11465. var cache = Object.create(null);
  11466. return function compileToFunctions(template, options, vm) {
  11467. options = extend({}, options);
  11468. var warn = options.warn || warn$2;
  11469. delete options.warn;
  11470. /* istanbul ignore if */
  11471. {
  11472. // detect possible CSP restriction
  11473. try {
  11474. new Function('return 1');
  11475. }
  11476. catch (e) {
  11477. if (e.toString().match(/unsafe-eval|CSP/)) {
  11478. warn('It seems you are using the standalone build of Vue.js in an ' +
  11479. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  11480. 'The template compiler cannot work in this environment. Consider ' +
  11481. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  11482. 'templates into render functions.');
  11483. }
  11484. }
  11485. }
  11486. // check cache
  11487. var key = options.delimiters
  11488. ? String(options.delimiters) + template
  11489. : template;
  11490. if (cache[key]) {
  11491. return cache[key];
  11492. }
  11493. // compile
  11494. var compiled = compile(template, options);
  11495. // check compilation errors/tips
  11496. {
  11497. if (compiled.errors && compiled.errors.length) {
  11498. if (options.outputSourceRange) {
  11499. compiled.errors.forEach(function (e) {
  11500. warn("Error compiling template:\n\n".concat(e.msg, "\n\n") +
  11501. generateCodeFrame(template, e.start, e.end), vm);
  11502. });
  11503. }
  11504. else {
  11505. warn("Error compiling template:\n\n".concat(template, "\n\n") +
  11506. compiled.errors.map(function (e) { return "- ".concat(e); }).join('\n') +
  11507. '\n', vm);
  11508. }
  11509. }
  11510. if (compiled.tips && compiled.tips.length) {
  11511. if (options.outputSourceRange) {
  11512. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  11513. }
  11514. else {
  11515. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  11516. }
  11517. }
  11518. }
  11519. // turn code into functions
  11520. var res = {};
  11521. var fnGenErrors = [];
  11522. res.render = createFunction(compiled.render, fnGenErrors);
  11523. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  11524. return createFunction(code, fnGenErrors);
  11525. });
  11526. // check function generation errors.
  11527. // this should only happen if there is a bug in the compiler itself.
  11528. // mostly for codegen development use
  11529. /* istanbul ignore if */
  11530. {
  11531. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  11532. warn("Failed to generate render function:\n\n" +
  11533. fnGenErrors
  11534. .map(function (_a) {
  11535. var err = _a.err, code = _a.code;
  11536. return "".concat(err.toString(), " in\n\n").concat(code, "\n");
  11537. })
  11538. .join('\n'), vm);
  11539. }
  11540. }
  11541. return (cache[key] = res);
  11542. };
  11543. }
  11544. function createCompilerCreator(baseCompile) {
  11545. return function createCompiler(baseOptions) {
  11546. function compile(template, options) {
  11547. var finalOptions = Object.create(baseOptions);
  11548. var errors = [];
  11549. var tips = [];
  11550. var warn = function (msg, range, tip) {
  11551. (tip ? tips : errors).push(msg);
  11552. };
  11553. if (options) {
  11554. if (options.outputSourceRange) {
  11555. // $flow-disable-line
  11556. var leadingSpaceLength_1 = template.match(/^\s*/)[0].length;
  11557. warn = function (msg, range, tip) {
  11558. var data = typeof msg === 'string' ? { msg: msg } : msg;
  11559. if (range) {
  11560. if (range.start != null) {
  11561. data.start = range.start + leadingSpaceLength_1;
  11562. }
  11563. if (range.end != null) {
  11564. data.end = range.end + leadingSpaceLength_1;
  11565. }
  11566. }
  11567. (tip ? tips : errors).push(data);
  11568. };
  11569. }
  11570. // merge custom modules
  11571. if (options.modules) {
  11572. finalOptions.modules = (baseOptions.modules || []).concat(options.modules);
  11573. }
  11574. // merge custom directives
  11575. if (options.directives) {
  11576. finalOptions.directives = extend(Object.create(baseOptions.directives || null), options.directives);
  11577. }
  11578. // copy other options
  11579. for (var key in options) {
  11580. if (key !== 'modules' && key !== 'directives') {
  11581. finalOptions[key] = options[key];
  11582. }
  11583. }
  11584. }
  11585. finalOptions.warn = warn;
  11586. var compiled = baseCompile(template.trim(), finalOptions);
  11587. {
  11588. detectErrors(compiled.ast, warn);
  11589. }
  11590. compiled.errors = errors;
  11591. compiled.tips = tips;
  11592. return compiled;
  11593. }
  11594. return {
  11595. compile: compile,
  11596. compileToFunctions: createCompileToFunctionFn(compile)
  11597. };
  11598. };
  11599. }
  11600. // `createCompilerCreator` allows creating compilers that use alternative
  11601. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  11602. // Here we just export a default compiler using the default parts.
  11603. var createCompiler = createCompilerCreator(function baseCompile(template, options) {
  11604. var ast = parse(template.trim(), options);
  11605. if (options.optimize !== false) {
  11606. optimize(ast, options);
  11607. }
  11608. var code = generate(ast, options);
  11609. return {
  11610. ast: ast,
  11611. render: code.render,
  11612. staticRenderFns: code.staticRenderFns
  11613. };
  11614. });
  11615. var _a = createCompiler(baseOptions), compileToFunctions = _a.compileToFunctions;
  11616. // check whether current browser encodes a char inside attribute values
  11617. var div;
  11618. function getShouldDecode(href) {
  11619. div = div || document.createElement('div');
  11620. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  11621. return div.innerHTML.indexOf('&#10;') > 0;
  11622. }
  11623. // #3663: IE encodes newlines inside attribute values while other browsers don't
  11624. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  11625. // #6828: chrome encodes content in a[href]
  11626. var shouldDecodeNewlinesForHref = inBrowser
  11627. ? getShouldDecode(true)
  11628. : false;
  11629. var idToTemplate = cached(function (id) {
  11630. var el = query(id);
  11631. return el && el.innerHTML;
  11632. });
  11633. var mount = Vue.prototype.$mount;
  11634. Vue.prototype.$mount = function (el, hydrating) {
  11635. el = el && query(el);
  11636. /* istanbul ignore if */
  11637. if (el === document.body || el === document.documentElement) {
  11638. warn$2("Do not mount Vue to <html> or <body> - mount to normal elements instead.");
  11639. return this;
  11640. }
  11641. var options = this.$options;
  11642. // resolve template/el and convert to render function
  11643. if (!options.render) {
  11644. var template = options.template;
  11645. if (template) {
  11646. if (typeof template === 'string') {
  11647. if (template.charAt(0) === '#') {
  11648. template = idToTemplate(template);
  11649. /* istanbul ignore if */
  11650. if (!template) {
  11651. warn$2("Template element not found or is empty: ".concat(options.template), this);
  11652. }
  11653. }
  11654. }
  11655. else if (template.nodeType) {
  11656. template = template.innerHTML;
  11657. }
  11658. else {
  11659. {
  11660. warn$2('invalid template option:' + template, this);
  11661. }
  11662. return this;
  11663. }
  11664. }
  11665. else if (el) {
  11666. // @ts-expect-error
  11667. template = getOuterHTML(el);
  11668. }
  11669. if (template) {
  11670. /* istanbul ignore if */
  11671. if (config.performance && mark) {
  11672. mark('compile');
  11673. }
  11674. var _a = compileToFunctions(template, {
  11675. outputSourceRange: true,
  11676. shouldDecodeNewlines: shouldDecodeNewlines,
  11677. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  11678. delimiters: options.delimiters,
  11679. comments: options.comments
  11680. }, this), render = _a.render, staticRenderFns = _a.staticRenderFns;
  11681. options.render = render;
  11682. options.staticRenderFns = staticRenderFns;
  11683. /* istanbul ignore if */
  11684. if (config.performance && mark) {
  11685. mark('compile end');
  11686. measure("vue ".concat(this._name, " compile"), 'compile', 'compile end');
  11687. }
  11688. }
  11689. }
  11690. return mount.call(this, el, hydrating);
  11691. };
  11692. /**
  11693. * Get outerHTML of elements, taking care
  11694. * of SVG elements in IE as well.
  11695. */
  11696. function getOuterHTML(el) {
  11697. if (el.outerHTML) {
  11698. return el.outerHTML;
  11699. }
  11700. else {
  11701. var container = document.createElement('div');
  11702. container.appendChild(el.cloneNode(true));
  11703. return container.innerHTML;
  11704. }
  11705. }
  11706. Vue.compile = compileToFunctions;
  11707. // export type EffectScheduler = (...args: any[]) => any
  11708. /**
  11709. * @internal since we are not exposing this in Vue 2, it's used only for
  11710. * internal testing.
  11711. */
  11712. function effect(fn, scheduler) {
  11713. var watcher = new Watcher(currentInstance, fn, noop, {
  11714. sync: true
  11715. });
  11716. if (scheduler) {
  11717. watcher.update = function () {
  11718. scheduler(function () { return watcher.run(); });
  11719. };
  11720. }
  11721. }
  11722. extend(Vue, vca);
  11723. Vue.effect = effect;
  11724. return Vue;
  11725. }));