1
0

vue.esm.js 409 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918
  1. /*!
  2. * Vue.js v2.7.16
  3. * (c) 2014-2023 Evan You
  4. * Released under the MIT License.
  5. */
  6. var emptyObject = Object.freeze({});
  7. var isArray = Array.isArray;
  8. // These helpers produce better VM code in JS engines due to their
  9. // explicitness and function inlining.
  10. function isUndef(v) {
  11. return v === undefined || v === null;
  12. }
  13. function isDef(v) {
  14. return v !== undefined && v !== null;
  15. }
  16. function isTrue(v) {
  17. return v === true;
  18. }
  19. function isFalse(v) {
  20. return v === false;
  21. }
  22. /**
  23. * Check if value is primitive.
  24. */
  25. function isPrimitive(value) {
  26. return (typeof value === 'string' ||
  27. typeof value === 'number' ||
  28. // $flow-disable-line
  29. typeof value === 'symbol' ||
  30. typeof value === 'boolean');
  31. }
  32. function isFunction(value) {
  33. return typeof value === 'function';
  34. }
  35. /**
  36. * Quick object check - this is primarily used to tell
  37. * objects from primitive values when we know the value
  38. * is a JSON-compliant type.
  39. */
  40. function isObject(obj) {
  41. return obj !== null && typeof obj === 'object';
  42. }
  43. /**
  44. * Get the raw type string of a value, e.g., [object Object].
  45. */
  46. var _toString = Object.prototype.toString;
  47. function toRawType(value) {
  48. return _toString.call(value).slice(8, -1);
  49. }
  50. /**
  51. * Strict object type check. Only returns true
  52. * for plain JavaScript objects.
  53. */
  54. function isPlainObject(obj) {
  55. return _toString.call(obj) === '[object Object]';
  56. }
  57. function isRegExp(v) {
  58. return _toString.call(v) === '[object RegExp]';
  59. }
  60. /**
  61. * Check if val is a valid array index.
  62. */
  63. function isValidArrayIndex(val) {
  64. var n = parseFloat(String(val));
  65. return n >= 0 && Math.floor(n) === n && isFinite(val);
  66. }
  67. function isPromise(val) {
  68. return (isDef(val) &&
  69. typeof val.then === 'function' &&
  70. typeof val.catch === 'function');
  71. }
  72. /**
  73. * Convert a value to a string that is actually rendered.
  74. */
  75. function toString(val) {
  76. return val == null
  77. ? ''
  78. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  79. ? JSON.stringify(val, replacer, 2)
  80. : String(val);
  81. }
  82. function replacer(_key, val) {
  83. // avoid circular deps from v3
  84. if (val && val.__v_isRef) {
  85. return val.value;
  86. }
  87. return val;
  88. }
  89. /**
  90. * Convert an input value to a number for persistence.
  91. * If the conversion fails, return original string.
  92. */
  93. function toNumber(val) {
  94. var n = parseFloat(val);
  95. return isNaN(n) ? val : n;
  96. }
  97. /**
  98. * Make a map and return a function for checking if a key
  99. * is in that map.
  100. */
  101. function makeMap(str, expectsLowerCase) {
  102. var map = Object.create(null);
  103. var list = str.split(',');
  104. for (var i = 0; i < list.length; i++) {
  105. map[list[i]] = true;
  106. }
  107. return expectsLowerCase ? function (val) { return map[val.toLowerCase()]; } : function (val) { return map[val]; };
  108. }
  109. /**
  110. * Check if a tag is a built-in tag.
  111. */
  112. var isBuiltInTag = makeMap('slot,component', true);
  113. /**
  114. * Check if an attribute is a reserved attribute.
  115. */
  116. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  117. /**
  118. * Remove an item from an array.
  119. */
  120. function remove$2(arr, item) {
  121. var len = arr.length;
  122. if (len) {
  123. // fast path for the only / last item
  124. if (item === arr[len - 1]) {
  125. arr.length = len - 1;
  126. return;
  127. }
  128. var index = arr.indexOf(item);
  129. if (index > -1) {
  130. return arr.splice(index, 1);
  131. }
  132. }
  133. }
  134. /**
  135. * Check whether an object has the property.
  136. */
  137. var hasOwnProperty = Object.prototype.hasOwnProperty;
  138. function hasOwn(obj, key) {
  139. return hasOwnProperty.call(obj, key);
  140. }
  141. /**
  142. * Create a cached version of a pure function.
  143. */
  144. function cached(fn) {
  145. var cache = Object.create(null);
  146. return function cachedFn(str) {
  147. var hit = cache[str];
  148. return hit || (cache[str] = fn(str));
  149. };
  150. }
  151. /**
  152. * Camelize a hyphen-delimited string.
  153. */
  154. var camelizeRE = /-(\w)/g;
  155. var camelize = cached(function (str) {
  156. return str.replace(camelizeRE, function (_, c) { return (c ? c.toUpperCase() : ''); });
  157. });
  158. /**
  159. * Capitalize a string.
  160. */
  161. var capitalize = cached(function (str) {
  162. return str.charAt(0).toUpperCase() + str.slice(1);
  163. });
  164. /**
  165. * Hyphenate a camelCase string.
  166. */
  167. var hyphenateRE = /\B([A-Z])/g;
  168. var hyphenate = cached(function (str) {
  169. return str.replace(hyphenateRE, '-$1').toLowerCase();
  170. });
  171. /**
  172. * Simple bind polyfill for environments that do not support it,
  173. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  174. * since native bind is now performant enough in most browsers.
  175. * But removing it would mean breaking code that was able to run in
  176. * PhantomJS 1.x, so this must be kept for backward compatibility.
  177. */
  178. /* istanbul ignore next */
  179. function polyfillBind(fn, ctx) {
  180. function boundFn(a) {
  181. var l = arguments.length;
  182. return l
  183. ? l > 1
  184. ? fn.apply(ctx, arguments)
  185. : fn.call(ctx, a)
  186. : fn.call(ctx);
  187. }
  188. boundFn._length = fn.length;
  189. return boundFn;
  190. }
  191. function nativeBind(fn, ctx) {
  192. return fn.bind(ctx);
  193. }
  194. // @ts-expect-error bind cannot be `undefined`
  195. var bind$1 = Function.prototype.bind ? nativeBind : polyfillBind;
  196. /**
  197. * Convert an Array-like object to a real Array.
  198. */
  199. function toArray(list, start) {
  200. start = start || 0;
  201. var i = list.length - start;
  202. var ret = new Array(i);
  203. while (i--) {
  204. ret[i] = list[i + start];
  205. }
  206. return ret;
  207. }
  208. /**
  209. * Mix properties into target object.
  210. */
  211. function extend(to, _from) {
  212. for (var key in _from) {
  213. to[key] = _from[key];
  214. }
  215. return to;
  216. }
  217. /**
  218. * Merge an Array of Objects into a single Object.
  219. */
  220. function toObject(arr) {
  221. var res = {};
  222. for (var i = 0; i < arr.length; i++) {
  223. if (arr[i]) {
  224. extend(res, arr[i]);
  225. }
  226. }
  227. return res;
  228. }
  229. /* eslint-disable no-unused-vars */
  230. /**
  231. * Perform no operation.
  232. * Stubbing args to make Flow happy without leaving useless transpiled code
  233. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  234. */
  235. function noop(a, b, c) { }
  236. /**
  237. * Always return false.
  238. */
  239. var no = function (a, b, c) { return false; };
  240. /* eslint-enable no-unused-vars */
  241. /**
  242. * Return the same value.
  243. */
  244. var identity = function (_) { return _; };
  245. /**
  246. * Generate a string containing static keys from compiler modules.
  247. */
  248. function genStaticKeys$1(modules) {
  249. return modules
  250. .reduce(function (keys, m) { return keys.concat(m.staticKeys || []); }, [])
  251. .join(',');
  252. }
  253. /**
  254. * Check if two values are loosely equal - that is,
  255. * if they are plain objects, do they have the same shape?
  256. */
  257. function looseEqual(a, b) {
  258. if (a === b)
  259. return true;
  260. var isObjectA = isObject(a);
  261. var isObjectB = isObject(b);
  262. if (isObjectA && isObjectB) {
  263. try {
  264. var isArrayA = Array.isArray(a);
  265. var isArrayB = Array.isArray(b);
  266. if (isArrayA && isArrayB) {
  267. return (a.length === b.length &&
  268. a.every(function (e, i) {
  269. return looseEqual(e, b[i]);
  270. }));
  271. }
  272. else if (a instanceof Date && b instanceof Date) {
  273. return a.getTime() === b.getTime();
  274. }
  275. else if (!isArrayA && !isArrayB) {
  276. var keysA = Object.keys(a);
  277. var keysB = Object.keys(b);
  278. return (keysA.length === keysB.length &&
  279. keysA.every(function (key) {
  280. return looseEqual(a[key], b[key]);
  281. }));
  282. }
  283. else {
  284. /* istanbul ignore next */
  285. return false;
  286. }
  287. }
  288. catch (e) {
  289. /* istanbul ignore next */
  290. return false;
  291. }
  292. }
  293. else if (!isObjectA && !isObjectB) {
  294. return String(a) === String(b);
  295. }
  296. else {
  297. return false;
  298. }
  299. }
  300. /**
  301. * Return the first index at which a loosely equal value can be
  302. * found in the array (if value is a plain object, the array must
  303. * contain an object of the same shape), or -1 if it is not present.
  304. */
  305. function looseIndexOf(arr, val) {
  306. for (var i = 0; i < arr.length; i++) {
  307. if (looseEqual(arr[i], val))
  308. return i;
  309. }
  310. return -1;
  311. }
  312. /**
  313. * Ensure a function is called only once.
  314. */
  315. function once(fn) {
  316. var called = false;
  317. return function () {
  318. if (!called) {
  319. called = true;
  320. fn.apply(this, arguments);
  321. }
  322. };
  323. }
  324. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is#polyfill
  325. function hasChanged(x, y) {
  326. if (x === y) {
  327. return x === 0 && 1 / x !== 1 / y;
  328. }
  329. else {
  330. return x === x || y === y;
  331. }
  332. }
  333. var SSR_ATTR = 'data-server-rendered';
  334. var ASSET_TYPES = ['component', 'directive', 'filter'];
  335. var LIFECYCLE_HOOKS = [
  336. 'beforeCreate',
  337. 'created',
  338. 'beforeMount',
  339. 'mounted',
  340. 'beforeUpdate',
  341. 'updated',
  342. 'beforeDestroy',
  343. 'destroyed',
  344. 'activated',
  345. 'deactivated',
  346. 'errorCaptured',
  347. 'serverPrefetch',
  348. 'renderTracked',
  349. 'renderTriggered'
  350. ];
  351. var config = {
  352. /**
  353. * Option merge strategies (used in core/util/options)
  354. */
  355. // $flow-disable-line
  356. optionMergeStrategies: Object.create(null),
  357. /**
  358. * Whether to suppress warnings.
  359. */
  360. silent: false,
  361. /**
  362. * Show production mode tip message on boot?
  363. */
  364. productionTip: process.env.NODE_ENV !== 'production',
  365. /**
  366. * Whether to enable devtools
  367. */
  368. devtools: process.env.NODE_ENV !== 'production',
  369. /**
  370. * Whether to record perf
  371. */
  372. performance: false,
  373. /**
  374. * Error handler for watcher errors
  375. */
  376. errorHandler: null,
  377. /**
  378. * Warn handler for watcher warns
  379. */
  380. warnHandler: null,
  381. /**
  382. * Ignore certain custom elements
  383. */
  384. ignoredElements: [],
  385. /**
  386. * Custom user key aliases for v-on
  387. */
  388. // $flow-disable-line
  389. keyCodes: Object.create(null),
  390. /**
  391. * Check if a tag is reserved so that it cannot be registered as a
  392. * component. This is platform-dependent and may be overwritten.
  393. */
  394. isReservedTag: no,
  395. /**
  396. * Check if an attribute is reserved so that it cannot be used as a component
  397. * prop. This is platform-dependent and may be overwritten.
  398. */
  399. isReservedAttr: no,
  400. /**
  401. * Check if a tag is an unknown element.
  402. * Platform-dependent.
  403. */
  404. isUnknownElement: no,
  405. /**
  406. * Get the namespace of an element
  407. */
  408. getTagNamespace: noop,
  409. /**
  410. * Parse the real tag name for the specific platform.
  411. */
  412. parsePlatformTagName: identity,
  413. /**
  414. * Check if an attribute must be bound using property, e.g. value
  415. * Platform-dependent.
  416. */
  417. mustUseProp: no,
  418. /**
  419. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  420. * This will significantly reduce performance if set to false.
  421. */
  422. async: true,
  423. /**
  424. * Exposed for legacy reasons
  425. */
  426. _lifecycleHooks: LIFECYCLE_HOOKS
  427. };
  428. /**
  429. * unicode letters used for parsing html tags, component names and property paths.
  430. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  431. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  432. */
  433. 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/;
  434. /**
  435. * Check if a string starts with $ or _
  436. */
  437. function isReserved(str) {
  438. var c = (str + '').charCodeAt(0);
  439. return c === 0x24 || c === 0x5f;
  440. }
  441. /**
  442. * Define a property.
  443. */
  444. function def(obj, key, val, enumerable) {
  445. Object.defineProperty(obj, key, {
  446. value: val,
  447. enumerable: !!enumerable,
  448. writable: true,
  449. configurable: true
  450. });
  451. }
  452. /**
  453. * Parse simple path.
  454. */
  455. var bailRE = new RegExp("[^".concat(unicodeRegExp.source, ".$_\\d]"));
  456. function parsePath(path) {
  457. if (bailRE.test(path)) {
  458. return;
  459. }
  460. var segments = path.split('.');
  461. return function (obj) {
  462. for (var i = 0; i < segments.length; i++) {
  463. if (!obj)
  464. return;
  465. obj = obj[segments[i]];
  466. }
  467. return obj;
  468. };
  469. }
  470. // can we use __proto__?
  471. var hasProto = '__proto__' in {};
  472. // Browser environment sniffing
  473. var inBrowser = typeof window !== 'undefined';
  474. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  475. var isIE = UA && /msie|trident/.test(UA);
  476. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  477. var isEdge = UA && UA.indexOf('edge/') > 0;
  478. UA && UA.indexOf('android') > 0;
  479. var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
  480. UA && /chrome\/\d+/.test(UA) && !isEdge;
  481. UA && /phantomjs/.test(UA);
  482. var isFF = UA && UA.match(/firefox\/(\d+)/);
  483. // Firefox has a "watch" function on Object.prototype...
  484. // @ts-expect-error firebox support
  485. var nativeWatch = {}.watch;
  486. var supportsPassive = false;
  487. if (inBrowser) {
  488. try {
  489. var opts = {};
  490. Object.defineProperty(opts, 'passive', {
  491. get: function () {
  492. /* istanbul ignore next */
  493. supportsPassive = true;
  494. }
  495. }); // https://github.com/facebook/flow/issues/285
  496. window.addEventListener('test-passive', null, opts);
  497. }
  498. catch (e) { }
  499. }
  500. // this needs to be lazy-evaled because vue may be required before
  501. // vue-server-renderer can set VUE_ENV
  502. var _isServer;
  503. var isServerRendering = function () {
  504. if (_isServer === undefined) {
  505. /* istanbul ignore if */
  506. if (!inBrowser && typeof global !== 'undefined') {
  507. // detect presence of vue-server-renderer and avoid
  508. // Webpack shimming the process
  509. _isServer =
  510. global['process'] && global['process'].env.VUE_ENV === 'server';
  511. }
  512. else {
  513. _isServer = false;
  514. }
  515. }
  516. return _isServer;
  517. };
  518. // detect devtools
  519. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  520. /* istanbul ignore next */
  521. function isNative(Ctor) {
  522. return typeof Ctor === 'function' && /native code/.test(Ctor.toString());
  523. }
  524. var hasSymbol = typeof Symbol !== 'undefined' &&
  525. isNative(Symbol) &&
  526. typeof Reflect !== 'undefined' &&
  527. isNative(Reflect.ownKeys);
  528. var _Set; // $flow-disable-line
  529. /* istanbul ignore if */ if (typeof Set !== 'undefined' && isNative(Set)) {
  530. // use native Set when available.
  531. _Set = Set;
  532. }
  533. else {
  534. // a non-standard Set polyfill that only works with primitive keys.
  535. _Set = /** @class */ (function () {
  536. function Set() {
  537. this.set = Object.create(null);
  538. }
  539. Set.prototype.has = function (key) {
  540. return this.set[key] === true;
  541. };
  542. Set.prototype.add = function (key) {
  543. this.set[key] = true;
  544. };
  545. Set.prototype.clear = function () {
  546. this.set = Object.create(null);
  547. };
  548. return Set;
  549. }());
  550. }
  551. var currentInstance = null;
  552. /**
  553. * This is exposed for compatibility with v3 (e.g. some functions in VueUse
  554. * relies on it). Do not use this internally, just use `currentInstance`.
  555. *
  556. * @internal this function needs manual type declaration because it relies
  557. * on previously manually authored types from Vue 2
  558. */
  559. function getCurrentInstance() {
  560. return currentInstance && { proxy: currentInstance };
  561. }
  562. /**
  563. * @internal
  564. */
  565. function setCurrentInstance(vm) {
  566. if (vm === void 0) { vm = null; }
  567. if (!vm)
  568. currentInstance && currentInstance._scope.off();
  569. currentInstance = vm;
  570. vm && vm._scope.on();
  571. }
  572. /**
  573. * @internal
  574. */
  575. var VNode = /** @class */ (function () {
  576. function VNode(tag, data, children, text, elm, context, componentOptions, asyncFactory) {
  577. this.tag = tag;
  578. this.data = data;
  579. this.children = children;
  580. this.text = text;
  581. this.elm = elm;
  582. this.ns = undefined;
  583. this.context = context;
  584. this.fnContext = undefined;
  585. this.fnOptions = undefined;
  586. this.fnScopeId = undefined;
  587. this.key = data && data.key;
  588. this.componentOptions = componentOptions;
  589. this.componentInstance = undefined;
  590. this.parent = undefined;
  591. this.raw = false;
  592. this.isStatic = false;
  593. this.isRootInsert = true;
  594. this.isComment = false;
  595. this.isCloned = false;
  596. this.isOnce = false;
  597. this.asyncFactory = asyncFactory;
  598. this.asyncMeta = undefined;
  599. this.isAsyncPlaceholder = false;
  600. }
  601. Object.defineProperty(VNode.prototype, "child", {
  602. // DEPRECATED: alias for componentInstance for backwards compat.
  603. /* istanbul ignore next */
  604. get: function () {
  605. return this.componentInstance;
  606. },
  607. enumerable: false,
  608. configurable: true
  609. });
  610. return VNode;
  611. }());
  612. var createEmptyVNode = function (text) {
  613. if (text === void 0) { text = ''; }
  614. var node = new VNode();
  615. node.text = text;
  616. node.isComment = true;
  617. return node;
  618. };
  619. function createTextVNode(val) {
  620. return new VNode(undefined, undefined, undefined, String(val));
  621. }
  622. // optimized shallow clone
  623. // used for static nodes and slot nodes because they may be reused across
  624. // multiple renders, cloning them avoids errors when DOM manipulations rely
  625. // on their elm reference.
  626. function cloneVNode(vnode) {
  627. var cloned = new VNode(vnode.tag, vnode.data,
  628. // #7975
  629. // clone children array to avoid mutating original in case of cloning
  630. // a child.
  631. vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, vnode.asyncFactory);
  632. cloned.ns = vnode.ns;
  633. cloned.isStatic = vnode.isStatic;
  634. cloned.key = vnode.key;
  635. cloned.isComment = vnode.isComment;
  636. cloned.fnContext = vnode.fnContext;
  637. cloned.fnOptions = vnode.fnOptions;
  638. cloned.fnScopeId = vnode.fnScopeId;
  639. cloned.asyncMeta = vnode.asyncMeta;
  640. cloned.isCloned = true;
  641. return cloned;
  642. }
  643. /* not type checking this file because flow doesn't play well with Proxy */
  644. var initProxy;
  645. if (process.env.NODE_ENV !== 'production') {
  646. var allowedGlobals_1 = makeMap('Infinity,undefined,NaN,isFinite,isNaN,' +
  647. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  648. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
  649. 'require' // for Webpack/Browserify
  650. );
  651. var warnNonPresent_1 = function (target, key) {
  652. warn$2("Property or method \"".concat(key, "\" is not defined on the instance but ") +
  653. 'referenced during render. Make sure that this property is reactive, ' +
  654. 'either in the data option, or for class-based components, by ' +
  655. 'initializing the property. ' +
  656. 'See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target);
  657. };
  658. var warnReservedPrefix_1 = function (target, key) {
  659. warn$2("Property \"".concat(key, "\" must be accessed with \"$data.").concat(key, "\" because ") +
  660. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  661. 'prevent conflicts with Vue internals. ' +
  662. 'See: https://v2.vuejs.org/v2/api/#data', target);
  663. };
  664. var hasProxy_1 = typeof Proxy !== 'undefined' && isNative(Proxy);
  665. if (hasProxy_1) {
  666. var isBuiltInModifier_1 = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  667. config.keyCodes = new Proxy(config.keyCodes, {
  668. set: function (target, key, value) {
  669. if (isBuiltInModifier_1(key)) {
  670. warn$2("Avoid overwriting built-in modifier in config.keyCodes: .".concat(key));
  671. return false;
  672. }
  673. else {
  674. target[key] = value;
  675. return true;
  676. }
  677. }
  678. });
  679. }
  680. var hasHandler_1 = {
  681. has: function (target, key) {
  682. var has = key in target;
  683. var isAllowed = allowedGlobals_1(key) ||
  684. (typeof key === 'string' &&
  685. key.charAt(0) === '_' &&
  686. !(key in target.$data));
  687. if (!has && !isAllowed) {
  688. if (key in target.$data)
  689. warnReservedPrefix_1(target, key);
  690. else
  691. warnNonPresent_1(target, key);
  692. }
  693. return has || !isAllowed;
  694. }
  695. };
  696. var getHandler_1 = {
  697. get: function (target, key) {
  698. if (typeof key === 'string' && !(key in target)) {
  699. if (key in target.$data)
  700. warnReservedPrefix_1(target, key);
  701. else
  702. warnNonPresent_1(target, key);
  703. }
  704. return target[key];
  705. }
  706. };
  707. initProxy = function initProxy(vm) {
  708. if (hasProxy_1) {
  709. // determine which proxy handler to use
  710. var options = vm.$options;
  711. var handlers = options.render && options.render._withStripped ? getHandler_1 : hasHandler_1;
  712. vm._renderProxy = new Proxy(vm, handlers);
  713. }
  714. else {
  715. vm._renderProxy = vm;
  716. }
  717. };
  718. }
  719. /******************************************************************************
  720. Copyright (c) Microsoft Corporation.
  721. Permission to use, copy, modify, and/or distribute this software for any
  722. purpose with or without fee is hereby granted.
  723. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  724. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  725. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  726. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  727. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  728. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  729. PERFORMANCE OF THIS SOFTWARE.
  730. ***************************************************************************** */
  731. var __assign = function() {
  732. __assign = Object.assign || function __assign(t) {
  733. for (var s, i = 1, n = arguments.length; i < n; i++) {
  734. s = arguments[i];
  735. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  736. }
  737. return t;
  738. };
  739. return __assign.apply(this, arguments);
  740. };
  741. typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
  742. var e = new Error(message);
  743. return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
  744. };
  745. var uid$2 = 0;
  746. var pendingCleanupDeps = [];
  747. var cleanupDeps = function () {
  748. for (var i = 0; i < pendingCleanupDeps.length; i++) {
  749. var dep = pendingCleanupDeps[i];
  750. dep.subs = dep.subs.filter(function (s) { return s; });
  751. dep._pending = false;
  752. }
  753. pendingCleanupDeps.length = 0;
  754. };
  755. /**
  756. * A dep is an observable that can have multiple
  757. * directives subscribing to it.
  758. * @internal
  759. */
  760. var Dep = /** @class */ (function () {
  761. function Dep() {
  762. // pending subs cleanup
  763. this._pending = false;
  764. this.id = uid$2++;
  765. this.subs = [];
  766. }
  767. Dep.prototype.addSub = function (sub) {
  768. this.subs.push(sub);
  769. };
  770. Dep.prototype.removeSub = function (sub) {
  771. // #12696 deps with massive amount of subscribers are extremely slow to
  772. // clean up in Chromium
  773. // to workaround this, we unset the sub for now, and clear them on
  774. // next scheduler flush.
  775. this.subs[this.subs.indexOf(sub)] = null;
  776. if (!this._pending) {
  777. this._pending = true;
  778. pendingCleanupDeps.push(this);
  779. }
  780. };
  781. Dep.prototype.depend = function (info) {
  782. if (Dep.target) {
  783. Dep.target.addDep(this);
  784. if (process.env.NODE_ENV !== 'production' && info && Dep.target.onTrack) {
  785. Dep.target.onTrack(__assign({ effect: Dep.target }, info));
  786. }
  787. }
  788. };
  789. Dep.prototype.notify = function (info) {
  790. // stabilize the subscriber list first
  791. var subs = this.subs.filter(function (s) { return s; });
  792. if (process.env.NODE_ENV !== 'production' && !config.async) {
  793. // subs aren't sorted in scheduler if not running async
  794. // we need to sort them now to make sure they fire in correct
  795. // order
  796. subs.sort(function (a, b) { return a.id - b.id; });
  797. }
  798. for (var i = 0, l = subs.length; i < l; i++) {
  799. var sub = subs[i];
  800. if (process.env.NODE_ENV !== 'production' && info) {
  801. sub.onTrigger &&
  802. sub.onTrigger(__assign({ effect: subs[i] }, info));
  803. }
  804. sub.update();
  805. }
  806. };
  807. return Dep;
  808. }());
  809. // The current target watcher being evaluated.
  810. // This is globally unique because only one watcher
  811. // can be evaluated at a time.
  812. Dep.target = null;
  813. var targetStack = [];
  814. function pushTarget(target) {
  815. targetStack.push(target);
  816. Dep.target = target;
  817. }
  818. function popTarget() {
  819. targetStack.pop();
  820. Dep.target = targetStack[targetStack.length - 1];
  821. }
  822. /*
  823. * not type checking this file because flow doesn't play well with
  824. * dynamically accessing methods on Array prototype
  825. */
  826. var arrayProto = Array.prototype;
  827. var arrayMethods = Object.create(arrayProto);
  828. var methodsToPatch = [
  829. 'push',
  830. 'pop',
  831. 'shift',
  832. 'unshift',
  833. 'splice',
  834. 'sort',
  835. 'reverse'
  836. ];
  837. /**
  838. * Intercept mutating methods and emit events
  839. */
  840. methodsToPatch.forEach(function (method) {
  841. // cache original method
  842. var original = arrayProto[method];
  843. def(arrayMethods, method, function mutator() {
  844. var args = [];
  845. for (var _i = 0; _i < arguments.length; _i++) {
  846. args[_i] = arguments[_i];
  847. }
  848. var result = original.apply(this, args);
  849. var ob = this.__ob__;
  850. var inserted;
  851. switch (method) {
  852. case 'push':
  853. case 'unshift':
  854. inserted = args;
  855. break;
  856. case 'splice':
  857. inserted = args.slice(2);
  858. break;
  859. }
  860. if (inserted)
  861. ob.observeArray(inserted);
  862. // notify change
  863. if (process.env.NODE_ENV !== 'production') {
  864. ob.dep.notify({
  865. type: "array mutation" /* TriggerOpTypes.ARRAY_MUTATION */,
  866. target: this,
  867. key: method
  868. });
  869. }
  870. else {
  871. ob.dep.notify();
  872. }
  873. return result;
  874. });
  875. });
  876. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  877. var NO_INITIAL_VALUE = {};
  878. /**
  879. * In some cases we may want to disable observation inside a component's
  880. * update computation.
  881. */
  882. var shouldObserve = true;
  883. function toggleObserving(value) {
  884. shouldObserve = value;
  885. }
  886. // ssr mock dep
  887. var mockDep = {
  888. notify: noop,
  889. depend: noop,
  890. addSub: noop,
  891. removeSub: noop
  892. };
  893. /**
  894. * Observer class that is attached to each observed
  895. * object. Once attached, the observer converts the target
  896. * object's property keys into getter/setters that
  897. * collect dependencies and dispatch updates.
  898. */
  899. var Observer = /** @class */ (function () {
  900. function Observer(value, shallow, mock) {
  901. if (shallow === void 0) { shallow = false; }
  902. if (mock === void 0) { mock = false; }
  903. this.value = value;
  904. this.shallow = shallow;
  905. this.mock = mock;
  906. // this.value = value
  907. this.dep = mock ? mockDep : new Dep();
  908. this.vmCount = 0;
  909. def(value, '__ob__', this);
  910. if (isArray(value)) {
  911. if (!mock) {
  912. if (hasProto) {
  913. value.__proto__ = arrayMethods;
  914. /* eslint-enable no-proto */
  915. }
  916. else {
  917. for (var i = 0, l = arrayKeys.length; i < l; i++) {
  918. var key = arrayKeys[i];
  919. def(value, key, arrayMethods[key]);
  920. }
  921. }
  922. }
  923. if (!shallow) {
  924. this.observeArray(value);
  925. }
  926. }
  927. else {
  928. /**
  929. * Walk through all properties and convert them into
  930. * getter/setters. This method should only be called when
  931. * value type is Object.
  932. */
  933. var keys = Object.keys(value);
  934. for (var i = 0; i < keys.length; i++) {
  935. var key = keys[i];
  936. defineReactive(value, key, NO_INITIAL_VALUE, undefined, shallow, mock);
  937. }
  938. }
  939. }
  940. /**
  941. * Observe a list of Array items.
  942. */
  943. Observer.prototype.observeArray = function (value) {
  944. for (var i = 0, l = value.length; i < l; i++) {
  945. observe(value[i], false, this.mock);
  946. }
  947. };
  948. return Observer;
  949. }());
  950. // helpers
  951. /**
  952. * Attempt to create an observer instance for a value,
  953. * returns the new observer if successfully observed,
  954. * or the existing observer if the value already has one.
  955. */
  956. function observe(value, shallow, ssrMockReactivity) {
  957. if (value && hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  958. return value.__ob__;
  959. }
  960. if (shouldObserve &&
  961. (ssrMockReactivity || !isServerRendering()) &&
  962. (isArray(value) || isPlainObject(value)) &&
  963. Object.isExtensible(value) &&
  964. !value.__v_skip /* ReactiveFlags.SKIP */ &&
  965. !isRef(value) &&
  966. !(value instanceof VNode)) {
  967. return new Observer(value, shallow, ssrMockReactivity);
  968. }
  969. }
  970. /**
  971. * Define a reactive property on an Object.
  972. */
  973. function defineReactive(obj, key, val, customSetter, shallow, mock, observeEvenIfShallow) {
  974. if (observeEvenIfShallow === void 0) { observeEvenIfShallow = false; }
  975. var dep = new Dep();
  976. var property = Object.getOwnPropertyDescriptor(obj, key);
  977. if (property && property.configurable === false) {
  978. return;
  979. }
  980. // cater for pre-defined getter/setters
  981. var getter = property && property.get;
  982. var setter = property && property.set;
  983. if ((!getter || setter) &&
  984. (val === NO_INITIAL_VALUE || arguments.length === 2)) {
  985. val = obj[key];
  986. }
  987. var childOb = shallow ? val && val.__ob__ : observe(val, false, mock);
  988. Object.defineProperty(obj, key, {
  989. enumerable: true,
  990. configurable: true,
  991. get: function reactiveGetter() {
  992. var value = getter ? getter.call(obj) : val;
  993. if (Dep.target) {
  994. if (process.env.NODE_ENV !== 'production') {
  995. dep.depend({
  996. target: obj,
  997. type: "get" /* TrackOpTypes.GET */,
  998. key: key
  999. });
  1000. }
  1001. else {
  1002. dep.depend();
  1003. }
  1004. if (childOb) {
  1005. childOb.dep.depend();
  1006. if (isArray(value)) {
  1007. dependArray(value);
  1008. }
  1009. }
  1010. }
  1011. return isRef(value) && !shallow ? value.value : value;
  1012. },
  1013. set: function reactiveSetter(newVal) {
  1014. var value = getter ? getter.call(obj) : val;
  1015. if (!hasChanged(value, newVal)) {
  1016. return;
  1017. }
  1018. if (process.env.NODE_ENV !== 'production' && customSetter) {
  1019. customSetter();
  1020. }
  1021. if (setter) {
  1022. setter.call(obj, newVal);
  1023. }
  1024. else if (getter) {
  1025. // #7981: for accessor properties without setter
  1026. return;
  1027. }
  1028. else if (!shallow && isRef(value) && !isRef(newVal)) {
  1029. value.value = newVal;
  1030. return;
  1031. }
  1032. else {
  1033. val = newVal;
  1034. }
  1035. childOb = shallow ? newVal && newVal.__ob__ : observe(newVal, false, mock);
  1036. if (process.env.NODE_ENV !== 'production') {
  1037. dep.notify({
  1038. type: "set" /* TriggerOpTypes.SET */,
  1039. target: obj,
  1040. key: key,
  1041. newValue: newVal,
  1042. oldValue: value
  1043. });
  1044. }
  1045. else {
  1046. dep.notify();
  1047. }
  1048. }
  1049. });
  1050. return dep;
  1051. }
  1052. function set(target, key, val) {
  1053. if (process.env.NODE_ENV !== 'production' && (isUndef(target) || isPrimitive(target))) {
  1054. warn$2("Cannot set reactive property on undefined, null, or primitive value: ".concat(target));
  1055. }
  1056. if (isReadonly(target)) {
  1057. process.env.NODE_ENV !== 'production' && warn$2("Set operation on key \"".concat(key, "\" failed: target is readonly."));
  1058. return;
  1059. }
  1060. var ob = target.__ob__;
  1061. if (isArray(target) && isValidArrayIndex(key)) {
  1062. target.length = Math.max(target.length, key);
  1063. target.splice(key, 1, val);
  1064. // when mocking for SSR, array methods are not hijacked
  1065. if (ob && !ob.shallow && ob.mock) {
  1066. observe(val, false, true);
  1067. }
  1068. return val;
  1069. }
  1070. if (key in target && !(key in Object.prototype)) {
  1071. target[key] = val;
  1072. return val;
  1073. }
  1074. if (target._isVue || (ob && ob.vmCount)) {
  1075. process.env.NODE_ENV !== 'production' &&
  1076. warn$2('Avoid adding reactive properties to a Vue instance or its root $data ' +
  1077. 'at runtime - declare it upfront in the data option.');
  1078. return val;
  1079. }
  1080. if (!ob) {
  1081. target[key] = val;
  1082. return val;
  1083. }
  1084. defineReactive(ob.value, key, val, undefined, ob.shallow, ob.mock);
  1085. if (process.env.NODE_ENV !== 'production') {
  1086. ob.dep.notify({
  1087. type: "add" /* TriggerOpTypes.ADD */,
  1088. target: target,
  1089. key: key,
  1090. newValue: val,
  1091. oldValue: undefined
  1092. });
  1093. }
  1094. else {
  1095. ob.dep.notify();
  1096. }
  1097. return val;
  1098. }
  1099. function del(target, key) {
  1100. if (process.env.NODE_ENV !== 'production' && (isUndef(target) || isPrimitive(target))) {
  1101. warn$2("Cannot delete reactive property on undefined, null, or primitive value: ".concat(target));
  1102. }
  1103. if (isArray(target) && isValidArrayIndex(key)) {
  1104. target.splice(key, 1);
  1105. return;
  1106. }
  1107. var ob = target.__ob__;
  1108. if (target._isVue || (ob && ob.vmCount)) {
  1109. process.env.NODE_ENV !== 'production' &&
  1110. warn$2('Avoid deleting properties on a Vue instance or its root $data ' +
  1111. '- just set it to null.');
  1112. return;
  1113. }
  1114. if (isReadonly(target)) {
  1115. process.env.NODE_ENV !== 'production' &&
  1116. warn$2("Delete operation on key \"".concat(key, "\" failed: target is readonly."));
  1117. return;
  1118. }
  1119. if (!hasOwn(target, key)) {
  1120. return;
  1121. }
  1122. delete target[key];
  1123. if (!ob) {
  1124. return;
  1125. }
  1126. if (process.env.NODE_ENV !== 'production') {
  1127. ob.dep.notify({
  1128. type: "delete" /* TriggerOpTypes.DELETE */,
  1129. target: target,
  1130. key: key
  1131. });
  1132. }
  1133. else {
  1134. ob.dep.notify();
  1135. }
  1136. }
  1137. /**
  1138. * Collect dependencies on array elements when the array is touched, since
  1139. * we cannot intercept array element access like property getters.
  1140. */
  1141. function dependArray(value) {
  1142. for (var e = void 0, i = 0, l = value.length; i < l; i++) {
  1143. e = value[i];
  1144. if (e && e.__ob__) {
  1145. e.__ob__.dep.depend();
  1146. }
  1147. if (isArray(e)) {
  1148. dependArray(e);
  1149. }
  1150. }
  1151. }
  1152. function reactive(target) {
  1153. makeReactive(target, false);
  1154. return target;
  1155. }
  1156. /**
  1157. * Return a shallowly-reactive copy of the original object, where only the root
  1158. * level properties are reactive. It also does not auto-unwrap refs (even at the
  1159. * root level).
  1160. */
  1161. function shallowReactive(target) {
  1162. makeReactive(target, true);
  1163. def(target, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
  1164. return target;
  1165. }
  1166. function makeReactive(target, shallow) {
  1167. // if trying to observe a readonly proxy, return the readonly version.
  1168. if (!isReadonly(target)) {
  1169. if (process.env.NODE_ENV !== 'production') {
  1170. if (isArray(target)) {
  1171. 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."));
  1172. }
  1173. var existingOb = target && target.__ob__;
  1174. if (existingOb && existingOb.shallow !== shallow) {
  1175. warn$2("Target is already a ".concat(existingOb.shallow ? "" : "non-", "shallow reactive object, and cannot be converted to ").concat(shallow ? "" : "non-", "shallow."));
  1176. }
  1177. }
  1178. var ob = observe(target, shallow, isServerRendering() /* ssr mock reactivity */);
  1179. if (process.env.NODE_ENV !== 'production' && !ob) {
  1180. if (target == null || isPrimitive(target)) {
  1181. warn$2("value cannot be made reactive: ".concat(String(target)));
  1182. }
  1183. if (isCollectionType(target)) {
  1184. warn$2("Vue 2 does not support reactive collection types such as Map or Set.");
  1185. }
  1186. }
  1187. }
  1188. }
  1189. function isReactive(value) {
  1190. if (isReadonly(value)) {
  1191. return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
  1192. }
  1193. return !!(value && value.__ob__);
  1194. }
  1195. function isShallow(value) {
  1196. return !!(value && value.__v_isShallow);
  1197. }
  1198. function isReadonly(value) {
  1199. return !!(value && value.__v_isReadonly);
  1200. }
  1201. function isProxy(value) {
  1202. return isReactive(value) || isReadonly(value);
  1203. }
  1204. function toRaw(observed) {
  1205. var raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
  1206. return raw ? toRaw(raw) : observed;
  1207. }
  1208. function markRaw(value) {
  1209. // non-extensible objects won't be observed anyway
  1210. if (Object.isExtensible(value)) {
  1211. def(value, "__v_skip" /* ReactiveFlags.SKIP */, true);
  1212. }
  1213. return value;
  1214. }
  1215. /**
  1216. * @internal
  1217. */
  1218. function isCollectionType(value) {
  1219. var type = toRawType(value);
  1220. return (type === 'Map' || type === 'WeakMap' || type === 'Set' || type === 'WeakSet');
  1221. }
  1222. /**
  1223. * @internal
  1224. */
  1225. var RefFlag = "__v_isRef";
  1226. function isRef(r) {
  1227. return !!(r && r.__v_isRef === true);
  1228. }
  1229. function ref$1(value) {
  1230. return createRef(value, false);
  1231. }
  1232. function shallowRef(value) {
  1233. return createRef(value, true);
  1234. }
  1235. function createRef(rawValue, shallow) {
  1236. if (isRef(rawValue)) {
  1237. return rawValue;
  1238. }
  1239. var ref = {};
  1240. def(ref, RefFlag, true);
  1241. def(ref, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, shallow);
  1242. def(ref, 'dep', defineReactive(ref, 'value', rawValue, null, shallow, isServerRendering()));
  1243. return ref;
  1244. }
  1245. function triggerRef(ref) {
  1246. if (process.env.NODE_ENV !== 'production' && !ref.dep) {
  1247. warn$2("received object is not a triggerable ref.");
  1248. }
  1249. if (process.env.NODE_ENV !== 'production') {
  1250. ref.dep &&
  1251. ref.dep.notify({
  1252. type: "set" /* TriggerOpTypes.SET */,
  1253. target: ref,
  1254. key: 'value'
  1255. });
  1256. }
  1257. else {
  1258. ref.dep && ref.dep.notify();
  1259. }
  1260. }
  1261. function unref(ref) {
  1262. return isRef(ref) ? ref.value : ref;
  1263. }
  1264. function proxyRefs(objectWithRefs) {
  1265. if (isReactive(objectWithRefs)) {
  1266. return objectWithRefs;
  1267. }
  1268. var proxy = {};
  1269. var keys = Object.keys(objectWithRefs);
  1270. for (var i = 0; i < keys.length; i++) {
  1271. proxyWithRefUnwrap(proxy, objectWithRefs, keys[i]);
  1272. }
  1273. return proxy;
  1274. }
  1275. function proxyWithRefUnwrap(target, source, key) {
  1276. Object.defineProperty(target, key, {
  1277. enumerable: true,
  1278. configurable: true,
  1279. get: function () {
  1280. var val = source[key];
  1281. if (isRef(val)) {
  1282. return val.value;
  1283. }
  1284. else {
  1285. var ob = val && val.__ob__;
  1286. if (ob)
  1287. ob.dep.depend();
  1288. return val;
  1289. }
  1290. },
  1291. set: function (value) {
  1292. var oldValue = source[key];
  1293. if (isRef(oldValue) && !isRef(value)) {
  1294. oldValue.value = value;
  1295. }
  1296. else {
  1297. source[key] = value;
  1298. }
  1299. }
  1300. });
  1301. }
  1302. function customRef(factory) {
  1303. var dep = new Dep();
  1304. var _a = factory(function () {
  1305. if (process.env.NODE_ENV !== 'production') {
  1306. dep.depend({
  1307. target: ref,
  1308. type: "get" /* TrackOpTypes.GET */,
  1309. key: 'value'
  1310. });
  1311. }
  1312. else {
  1313. dep.depend();
  1314. }
  1315. }, function () {
  1316. if (process.env.NODE_ENV !== 'production') {
  1317. dep.notify({
  1318. target: ref,
  1319. type: "set" /* TriggerOpTypes.SET */,
  1320. key: 'value'
  1321. });
  1322. }
  1323. else {
  1324. dep.notify();
  1325. }
  1326. }), get = _a.get, set = _a.set;
  1327. var ref = {
  1328. get value() {
  1329. return get();
  1330. },
  1331. set value(newVal) {
  1332. set(newVal);
  1333. }
  1334. };
  1335. def(ref, RefFlag, true);
  1336. return ref;
  1337. }
  1338. function toRefs(object) {
  1339. if (process.env.NODE_ENV !== 'production' && !isReactive(object)) {
  1340. warn$2("toRefs() expects a reactive object but received a plain one.");
  1341. }
  1342. var ret = isArray(object) ? new Array(object.length) : {};
  1343. for (var key in object) {
  1344. ret[key] = toRef(object, key);
  1345. }
  1346. return ret;
  1347. }
  1348. function toRef(object, key, defaultValue) {
  1349. var val = object[key];
  1350. if (isRef(val)) {
  1351. return val;
  1352. }
  1353. var ref = {
  1354. get value() {
  1355. var val = object[key];
  1356. return val === undefined ? defaultValue : val;
  1357. },
  1358. set value(newVal) {
  1359. object[key] = newVal;
  1360. }
  1361. };
  1362. def(ref, RefFlag, true);
  1363. return ref;
  1364. }
  1365. var rawToReadonlyFlag = "__v_rawToReadonly";
  1366. var rawToShallowReadonlyFlag = "__v_rawToShallowReadonly";
  1367. function readonly(target) {
  1368. return createReadonly(target, false);
  1369. }
  1370. function createReadonly(target, shallow) {
  1371. if (!isPlainObject(target)) {
  1372. if (process.env.NODE_ENV !== 'production') {
  1373. if (isArray(target)) {
  1374. warn$2("Vue 2 does not support readonly arrays.");
  1375. }
  1376. else if (isCollectionType(target)) {
  1377. warn$2("Vue 2 does not support readonly collection types such as Map or Set.");
  1378. }
  1379. else {
  1380. warn$2("value cannot be made readonly: ".concat(typeof target));
  1381. }
  1382. }
  1383. return target;
  1384. }
  1385. if (process.env.NODE_ENV !== 'production' && !Object.isExtensible(target)) {
  1386. warn$2("Vue 2 does not support creating readonly proxy for non-extensible object.");
  1387. }
  1388. // already a readonly object
  1389. if (isReadonly(target)) {
  1390. return target;
  1391. }
  1392. // already has a readonly proxy
  1393. var existingFlag = shallow ? rawToShallowReadonlyFlag : rawToReadonlyFlag;
  1394. var existingProxy = target[existingFlag];
  1395. if (existingProxy) {
  1396. return existingProxy;
  1397. }
  1398. var proxy = Object.create(Object.getPrototypeOf(target));
  1399. def(target, existingFlag, proxy);
  1400. def(proxy, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, true);
  1401. def(proxy, "__v_raw" /* ReactiveFlags.RAW */, target);
  1402. if (isRef(target)) {
  1403. def(proxy, RefFlag, true);
  1404. }
  1405. if (shallow || isShallow(target)) {
  1406. def(proxy, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
  1407. }
  1408. var keys = Object.keys(target);
  1409. for (var i = 0; i < keys.length; i++) {
  1410. defineReadonlyProperty(proxy, target, keys[i], shallow);
  1411. }
  1412. return proxy;
  1413. }
  1414. function defineReadonlyProperty(proxy, target, key, shallow) {
  1415. Object.defineProperty(proxy, key, {
  1416. enumerable: true,
  1417. configurable: true,
  1418. get: function () {
  1419. var val = target[key];
  1420. return shallow || !isPlainObject(val) ? val : readonly(val);
  1421. },
  1422. set: function () {
  1423. process.env.NODE_ENV !== 'production' &&
  1424. warn$2("Set operation on key \"".concat(key, "\" failed: target is readonly."));
  1425. }
  1426. });
  1427. }
  1428. /**
  1429. * Returns a reactive-copy of the original object, where only the root level
  1430. * properties are readonly, and does NOT unwrap refs nor recursively convert
  1431. * returned properties.
  1432. * This is used for creating the props proxy object for stateful components.
  1433. */
  1434. function shallowReadonly(target) {
  1435. return createReadonly(target, true);
  1436. }
  1437. function computed(getterOrOptions, debugOptions) {
  1438. var getter;
  1439. var setter;
  1440. var onlyGetter = isFunction(getterOrOptions);
  1441. if (onlyGetter) {
  1442. getter = getterOrOptions;
  1443. setter = process.env.NODE_ENV !== 'production'
  1444. ? function () {
  1445. warn$2('Write operation failed: computed value is readonly');
  1446. }
  1447. : noop;
  1448. }
  1449. else {
  1450. getter = getterOrOptions.get;
  1451. setter = getterOrOptions.set;
  1452. }
  1453. var watcher = isServerRendering()
  1454. ? null
  1455. : new Watcher(currentInstance, getter, noop, { lazy: true });
  1456. if (process.env.NODE_ENV !== 'production' && watcher && debugOptions) {
  1457. watcher.onTrack = debugOptions.onTrack;
  1458. watcher.onTrigger = debugOptions.onTrigger;
  1459. }
  1460. var ref = {
  1461. // some libs rely on the presence effect for checking computed refs
  1462. // from normal refs, but the implementation doesn't matter
  1463. effect: watcher,
  1464. get value() {
  1465. if (watcher) {
  1466. if (watcher.dirty) {
  1467. watcher.evaluate();
  1468. }
  1469. if (Dep.target) {
  1470. if (process.env.NODE_ENV !== 'production' && Dep.target.onTrack) {
  1471. Dep.target.onTrack({
  1472. effect: Dep.target,
  1473. target: ref,
  1474. type: "get" /* TrackOpTypes.GET */,
  1475. key: 'value'
  1476. });
  1477. }
  1478. watcher.depend();
  1479. }
  1480. return watcher.value;
  1481. }
  1482. else {
  1483. return getter();
  1484. }
  1485. },
  1486. set value(newVal) {
  1487. setter(newVal);
  1488. }
  1489. };
  1490. def(ref, RefFlag, true);
  1491. def(ref, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, onlyGetter);
  1492. return ref;
  1493. }
  1494. var mark;
  1495. var measure;
  1496. if (process.env.NODE_ENV !== 'production') {
  1497. var perf_1 = inBrowser && window.performance;
  1498. /* istanbul ignore if */
  1499. if (perf_1 &&
  1500. // @ts-ignore
  1501. perf_1.mark &&
  1502. // @ts-ignore
  1503. perf_1.measure &&
  1504. // @ts-ignore
  1505. perf_1.clearMarks &&
  1506. // @ts-ignore
  1507. perf_1.clearMeasures) {
  1508. mark = function (tag) { return perf_1.mark(tag); };
  1509. measure = function (name, startTag, endTag) {
  1510. perf_1.measure(name, startTag, endTag);
  1511. perf_1.clearMarks(startTag);
  1512. perf_1.clearMarks(endTag);
  1513. // perf.clearMeasures(name)
  1514. };
  1515. }
  1516. }
  1517. var normalizeEvent = cached(function (name) {
  1518. var passive = name.charAt(0) === '&';
  1519. name = passive ? name.slice(1) : name;
  1520. var once = name.charAt(0) === '~'; // Prefixed last, checked first
  1521. name = once ? name.slice(1) : name;
  1522. var capture = name.charAt(0) === '!';
  1523. name = capture ? name.slice(1) : name;
  1524. return {
  1525. name: name,
  1526. once: once,
  1527. capture: capture,
  1528. passive: passive
  1529. };
  1530. });
  1531. function createFnInvoker(fns, vm) {
  1532. function invoker() {
  1533. var fns = invoker.fns;
  1534. if (isArray(fns)) {
  1535. var cloned = fns.slice();
  1536. for (var i = 0; i < cloned.length; i++) {
  1537. invokeWithErrorHandling(cloned[i], null, arguments, vm, "v-on handler");
  1538. }
  1539. }
  1540. else {
  1541. // return handler return value for single handlers
  1542. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler");
  1543. }
  1544. }
  1545. invoker.fns = fns;
  1546. return invoker;
  1547. }
  1548. function updateListeners(on, oldOn, add, remove, createOnceHandler, vm) {
  1549. var name, cur, old, event;
  1550. for (name in on) {
  1551. cur = on[name];
  1552. old = oldOn[name];
  1553. event = normalizeEvent(name);
  1554. if (isUndef(cur)) {
  1555. process.env.NODE_ENV !== 'production' &&
  1556. warn$2("Invalid handler for event \"".concat(event.name, "\": got ") + String(cur), vm);
  1557. }
  1558. else if (isUndef(old)) {
  1559. if (isUndef(cur.fns)) {
  1560. cur = on[name] = createFnInvoker(cur, vm);
  1561. }
  1562. if (isTrue(event.once)) {
  1563. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  1564. }
  1565. add(event.name, cur, event.capture, event.passive, event.params);
  1566. }
  1567. else if (cur !== old) {
  1568. old.fns = cur;
  1569. on[name] = old;
  1570. }
  1571. }
  1572. for (name in oldOn) {
  1573. if (isUndef(on[name])) {
  1574. event = normalizeEvent(name);
  1575. remove(event.name, oldOn[name], event.capture);
  1576. }
  1577. }
  1578. }
  1579. function mergeVNodeHook(def, hookKey, hook) {
  1580. if (def instanceof VNode) {
  1581. def = def.data.hook || (def.data.hook = {});
  1582. }
  1583. var invoker;
  1584. var oldHook = def[hookKey];
  1585. function wrappedHook() {
  1586. hook.apply(this, arguments);
  1587. // important: remove merged hook to ensure it's called only once
  1588. // and prevent memory leak
  1589. remove$2(invoker.fns, wrappedHook);
  1590. }
  1591. if (isUndef(oldHook)) {
  1592. // no existing hook
  1593. invoker = createFnInvoker([wrappedHook]);
  1594. }
  1595. else {
  1596. /* istanbul ignore if */
  1597. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  1598. // already a merged invoker
  1599. invoker = oldHook;
  1600. invoker.fns.push(wrappedHook);
  1601. }
  1602. else {
  1603. // existing plain hook
  1604. invoker = createFnInvoker([oldHook, wrappedHook]);
  1605. }
  1606. }
  1607. invoker.merged = true;
  1608. def[hookKey] = invoker;
  1609. }
  1610. function extractPropsFromVNodeData(data, Ctor, tag) {
  1611. // we are only extracting raw values here.
  1612. // validation and default values are handled in the child
  1613. // component itself.
  1614. var propOptions = Ctor.options.props;
  1615. if (isUndef(propOptions)) {
  1616. return;
  1617. }
  1618. var res = {};
  1619. var attrs = data.attrs, props = data.props;
  1620. if (isDef(attrs) || isDef(props)) {
  1621. for (var key in propOptions) {
  1622. var altKey = hyphenate(key);
  1623. if (process.env.NODE_ENV !== 'production') {
  1624. var keyInLowerCase = key.toLowerCase();
  1625. if (key !== keyInLowerCase && attrs && hasOwn(attrs, keyInLowerCase)) {
  1626. tip("Prop \"".concat(keyInLowerCase, "\" is passed to component ") +
  1627. "".concat(formatComponentName(
  1628. // @ts-expect-error tag is string
  1629. tag || Ctor), ", but the declared prop name is") +
  1630. " \"".concat(key, "\". ") +
  1631. "Note that HTML attributes are case-insensitive and camelCased " +
  1632. "props need to use their kebab-case equivalents when using in-DOM " +
  1633. "templates. You should probably use \"".concat(altKey, "\" instead of \"").concat(key, "\"."));
  1634. }
  1635. }
  1636. checkProp(res, props, key, altKey, true) ||
  1637. checkProp(res, attrs, key, altKey, false);
  1638. }
  1639. }
  1640. return res;
  1641. }
  1642. function checkProp(res, hash, key, altKey, preserve) {
  1643. if (isDef(hash)) {
  1644. if (hasOwn(hash, key)) {
  1645. res[key] = hash[key];
  1646. if (!preserve) {
  1647. delete hash[key];
  1648. }
  1649. return true;
  1650. }
  1651. else if (hasOwn(hash, altKey)) {
  1652. res[key] = hash[altKey];
  1653. if (!preserve) {
  1654. delete hash[altKey];
  1655. }
  1656. return true;
  1657. }
  1658. }
  1659. return false;
  1660. }
  1661. // The template compiler attempts to minimize the need for normalization by
  1662. // statically analyzing the template at compile time.
  1663. //
  1664. // For plain HTML markup, normalization can be completely skipped because the
  1665. // generated render function is guaranteed to return Array<VNode>. There are
  1666. // two cases where extra normalization is needed:
  1667. // 1. When the children contains components - because a functional component
  1668. // may return an Array instead of a single root. In this case, just a simple
  1669. // normalization is needed - if any child is an Array, we flatten the whole
  1670. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  1671. // because functional components already normalize their own children.
  1672. function simpleNormalizeChildren(children) {
  1673. for (var i = 0; i < children.length; i++) {
  1674. if (isArray(children[i])) {
  1675. return Array.prototype.concat.apply([], children);
  1676. }
  1677. }
  1678. return children;
  1679. }
  1680. // 2. When the children contains constructs that always generated nested Arrays,
  1681. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  1682. // with hand-written render functions / JSX. In such cases a full normalization
  1683. // is needed to cater to all possible types of children values.
  1684. function normalizeChildren(children) {
  1685. return isPrimitive(children)
  1686. ? [createTextVNode(children)]
  1687. : isArray(children)
  1688. ? normalizeArrayChildren(children)
  1689. : undefined;
  1690. }
  1691. function isTextNode(node) {
  1692. return isDef(node) && isDef(node.text) && isFalse(node.isComment);
  1693. }
  1694. function normalizeArrayChildren(children, nestedIndex) {
  1695. var res = [];
  1696. var i, c, lastIndex, last;
  1697. for (i = 0; i < children.length; i++) {
  1698. c = children[i];
  1699. if (isUndef(c) || typeof c === 'boolean')
  1700. continue;
  1701. lastIndex = res.length - 1;
  1702. last = res[lastIndex];
  1703. // nested
  1704. if (isArray(c)) {
  1705. if (c.length > 0) {
  1706. c = normalizeArrayChildren(c, "".concat(nestedIndex || '', "_").concat(i));
  1707. // merge adjacent text nodes
  1708. if (isTextNode(c[0]) && isTextNode(last)) {
  1709. res[lastIndex] = createTextVNode(last.text + c[0].text);
  1710. c.shift();
  1711. }
  1712. res.push.apply(res, c);
  1713. }
  1714. }
  1715. else if (isPrimitive(c)) {
  1716. if (isTextNode(last)) {
  1717. // merge adjacent text nodes
  1718. // this is necessary for SSR hydration because text nodes are
  1719. // essentially merged when rendered to HTML strings
  1720. res[lastIndex] = createTextVNode(last.text + c);
  1721. }
  1722. else if (c !== '') {
  1723. // convert primitive to vnode
  1724. res.push(createTextVNode(c));
  1725. }
  1726. }
  1727. else {
  1728. if (isTextNode(c) && isTextNode(last)) {
  1729. // merge adjacent text nodes
  1730. res[lastIndex] = createTextVNode(last.text + c.text);
  1731. }
  1732. else {
  1733. // default key for nested array children (likely generated by v-for)
  1734. if (isTrue(children._isVList) &&
  1735. isDef(c.tag) &&
  1736. isUndef(c.key) &&
  1737. isDef(nestedIndex)) {
  1738. c.key = "__vlist".concat(nestedIndex, "_").concat(i, "__");
  1739. }
  1740. res.push(c);
  1741. }
  1742. }
  1743. }
  1744. return res;
  1745. }
  1746. var SIMPLE_NORMALIZE = 1;
  1747. var ALWAYS_NORMALIZE = 2;
  1748. // wrapper function for providing a more flexible interface
  1749. // without getting yelled at by flow
  1750. function createElement$1(context, tag, data, children, normalizationType, alwaysNormalize) {
  1751. if (isArray(data) || isPrimitive(data)) {
  1752. normalizationType = children;
  1753. children = data;
  1754. data = undefined;
  1755. }
  1756. if (isTrue(alwaysNormalize)) {
  1757. normalizationType = ALWAYS_NORMALIZE;
  1758. }
  1759. return _createElement(context, tag, data, children, normalizationType);
  1760. }
  1761. function _createElement(context, tag, data, children, normalizationType) {
  1762. if (isDef(data) && isDef(data.__ob__)) {
  1763. process.env.NODE_ENV !== 'production' &&
  1764. 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);
  1765. return createEmptyVNode();
  1766. }
  1767. // object syntax in v-bind
  1768. if (isDef(data) && isDef(data.is)) {
  1769. tag = data.is;
  1770. }
  1771. if (!tag) {
  1772. // in case of component :is set to falsy value
  1773. return createEmptyVNode();
  1774. }
  1775. // warn against non-primitive key
  1776. if (process.env.NODE_ENV !== 'production' && isDef(data) && isDef(data.key) && !isPrimitive(data.key)) {
  1777. warn$2('Avoid using non-primitive value as key, ' +
  1778. 'use string/number value instead.', context);
  1779. }
  1780. // support single function children as default scoped slot
  1781. if (isArray(children) && isFunction(children[0])) {
  1782. data = data || {};
  1783. data.scopedSlots = { default: children[0] };
  1784. children.length = 0;
  1785. }
  1786. if (normalizationType === ALWAYS_NORMALIZE) {
  1787. children = normalizeChildren(children);
  1788. }
  1789. else if (normalizationType === SIMPLE_NORMALIZE) {
  1790. children = simpleNormalizeChildren(children);
  1791. }
  1792. var vnode, ns;
  1793. if (typeof tag === 'string') {
  1794. var Ctor = void 0;
  1795. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  1796. if (config.isReservedTag(tag)) {
  1797. // platform built-in elements
  1798. if (process.env.NODE_ENV !== 'production' &&
  1799. isDef(data) &&
  1800. isDef(data.nativeOn) &&
  1801. data.tag !== 'component') {
  1802. warn$2("The .native modifier for v-on is only valid on components but it was used on <".concat(tag, ">."), context);
  1803. }
  1804. vnode = new VNode(config.parsePlatformTagName(tag), data, children, undefined, undefined, context);
  1805. }
  1806. else if ((!data || !data.pre) &&
  1807. isDef((Ctor = resolveAsset(context.$options, 'components', tag)))) {
  1808. // component
  1809. vnode = createComponent(Ctor, data, context, children, tag);
  1810. }
  1811. else {
  1812. // unknown or unlisted namespaced elements
  1813. // check at runtime because it may get assigned a namespace when its
  1814. // parent normalizes children
  1815. vnode = new VNode(tag, data, children, undefined, undefined, context);
  1816. }
  1817. }
  1818. else {
  1819. // direct component options / constructor
  1820. vnode = createComponent(tag, data, context, children);
  1821. }
  1822. if (isArray(vnode)) {
  1823. return vnode;
  1824. }
  1825. else if (isDef(vnode)) {
  1826. if (isDef(ns))
  1827. applyNS(vnode, ns);
  1828. if (isDef(data))
  1829. registerDeepBindings(data);
  1830. return vnode;
  1831. }
  1832. else {
  1833. return createEmptyVNode();
  1834. }
  1835. }
  1836. function applyNS(vnode, ns, force) {
  1837. vnode.ns = ns;
  1838. if (vnode.tag === 'foreignObject') {
  1839. // use default namespace inside foreignObject
  1840. ns = undefined;
  1841. force = true;
  1842. }
  1843. if (isDef(vnode.children)) {
  1844. for (var i = 0, l = vnode.children.length; i < l; i++) {
  1845. var child = vnode.children[i];
  1846. if (isDef(child.tag) &&
  1847. (isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  1848. applyNS(child, ns, force);
  1849. }
  1850. }
  1851. }
  1852. }
  1853. // ref #5318
  1854. // necessary to ensure parent re-render when deep bindings like :style and
  1855. // :class are used on slot nodes
  1856. function registerDeepBindings(data) {
  1857. if (isObject(data.style)) {
  1858. traverse(data.style);
  1859. }
  1860. if (isObject(data.class)) {
  1861. traverse(data.class);
  1862. }
  1863. }
  1864. /**
  1865. * Runtime helper for rendering v-for lists.
  1866. */
  1867. function renderList(val, render) {
  1868. var ret = null, i, l, keys, key;
  1869. if (isArray(val) || typeof val === 'string') {
  1870. ret = new Array(val.length);
  1871. for (i = 0, l = val.length; i < l; i++) {
  1872. ret[i] = render(val[i], i);
  1873. }
  1874. }
  1875. else if (typeof val === 'number') {
  1876. ret = new Array(val);
  1877. for (i = 0; i < val; i++) {
  1878. ret[i] = render(i + 1, i);
  1879. }
  1880. }
  1881. else if (isObject(val)) {
  1882. if (hasSymbol && val[Symbol.iterator]) {
  1883. ret = [];
  1884. var iterator = val[Symbol.iterator]();
  1885. var result = iterator.next();
  1886. while (!result.done) {
  1887. ret.push(render(result.value, ret.length));
  1888. result = iterator.next();
  1889. }
  1890. }
  1891. else {
  1892. keys = Object.keys(val);
  1893. ret = new Array(keys.length);
  1894. for (i = 0, l = keys.length; i < l; i++) {
  1895. key = keys[i];
  1896. ret[i] = render(val[key], key, i);
  1897. }
  1898. }
  1899. }
  1900. if (!isDef(ret)) {
  1901. ret = [];
  1902. }
  1903. ret._isVList = true;
  1904. return ret;
  1905. }
  1906. /**
  1907. * Runtime helper for rendering <slot>
  1908. */
  1909. function renderSlot(name, fallbackRender, props, bindObject) {
  1910. var scopedSlotFn = this.$scopedSlots[name];
  1911. var nodes;
  1912. if (scopedSlotFn) {
  1913. // scoped slot
  1914. props = props || {};
  1915. if (bindObject) {
  1916. if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) {
  1917. warn$2('slot v-bind without argument expects an Object', this);
  1918. }
  1919. props = extend(extend({}, bindObject), props);
  1920. }
  1921. nodes =
  1922. scopedSlotFn(props) ||
  1923. (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);
  1924. }
  1925. else {
  1926. nodes =
  1927. this.$slots[name] ||
  1928. (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);
  1929. }
  1930. var target = props && props.slot;
  1931. if (target) {
  1932. return this.$createElement('template', { slot: target }, nodes);
  1933. }
  1934. else {
  1935. return nodes;
  1936. }
  1937. }
  1938. /**
  1939. * Runtime helper for resolving filters
  1940. */
  1941. function resolveFilter(id) {
  1942. return resolveAsset(this.$options, 'filters', id, true) || identity;
  1943. }
  1944. function isKeyNotMatch(expect, actual) {
  1945. if (isArray(expect)) {
  1946. return expect.indexOf(actual) === -1;
  1947. }
  1948. else {
  1949. return expect !== actual;
  1950. }
  1951. }
  1952. /**
  1953. * Runtime helper for checking keyCodes from config.
  1954. * exposed as Vue.prototype._k
  1955. * passing in eventKeyName as last argument separately for backwards compat
  1956. */
  1957. function checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInKeyName) {
  1958. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  1959. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  1960. return isKeyNotMatch(builtInKeyName, eventKeyName);
  1961. }
  1962. else if (mappedKeyCode) {
  1963. return isKeyNotMatch(mappedKeyCode, eventKeyCode);
  1964. }
  1965. else if (eventKeyName) {
  1966. return hyphenate(eventKeyName) !== key;
  1967. }
  1968. return eventKeyCode === undefined;
  1969. }
  1970. /**
  1971. * Runtime helper for merging v-bind="object" into a VNode's data.
  1972. */
  1973. function bindObjectProps(data, tag, value, asProp, isSync) {
  1974. if (value) {
  1975. if (!isObject(value)) {
  1976. process.env.NODE_ENV !== 'production' &&
  1977. warn$2('v-bind without argument expects an Object or Array value', this);
  1978. }
  1979. else {
  1980. if (isArray(value)) {
  1981. value = toObject(value);
  1982. }
  1983. var hash = void 0;
  1984. var _loop_1 = function (key) {
  1985. if (key === 'class' || key === 'style' || isReservedAttribute(key)) {
  1986. hash = data;
  1987. }
  1988. else {
  1989. var type = data.attrs && data.attrs.type;
  1990. hash =
  1991. asProp || config.mustUseProp(tag, type, key)
  1992. ? data.domProps || (data.domProps = {})
  1993. : data.attrs || (data.attrs = {});
  1994. }
  1995. var camelizedKey = camelize(key);
  1996. var hyphenatedKey = hyphenate(key);
  1997. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  1998. hash[key] = value[key];
  1999. if (isSync) {
  2000. var on = data.on || (data.on = {});
  2001. on["update:".concat(key)] = function ($event) {
  2002. value[key] = $event;
  2003. };
  2004. }
  2005. }
  2006. };
  2007. for (var key in value) {
  2008. _loop_1(key);
  2009. }
  2010. }
  2011. }
  2012. return data;
  2013. }
  2014. /**
  2015. * Runtime helper for rendering static trees.
  2016. */
  2017. function renderStatic(index, isInFor) {
  2018. var cached = this._staticTrees || (this._staticTrees = []);
  2019. var tree = cached[index];
  2020. // if has already-rendered static tree and not inside v-for,
  2021. // we can reuse the same tree.
  2022. if (tree && !isInFor) {
  2023. return tree;
  2024. }
  2025. // otherwise, render a fresh tree.
  2026. tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, this._c, this // for render fns generated for functional component templates
  2027. );
  2028. markStatic$1(tree, "__static__".concat(index), false);
  2029. return tree;
  2030. }
  2031. /**
  2032. * Runtime helper for v-once.
  2033. * Effectively it means marking the node as static with a unique key.
  2034. */
  2035. function markOnce(tree, index, key) {
  2036. markStatic$1(tree, "__once__".concat(index).concat(key ? "_".concat(key) : ""), true);
  2037. return tree;
  2038. }
  2039. function markStatic$1(tree, key, isOnce) {
  2040. if (isArray(tree)) {
  2041. for (var i = 0; i < tree.length; i++) {
  2042. if (tree[i] && typeof tree[i] !== 'string') {
  2043. markStaticNode(tree[i], "".concat(key, "_").concat(i), isOnce);
  2044. }
  2045. }
  2046. }
  2047. else {
  2048. markStaticNode(tree, key, isOnce);
  2049. }
  2050. }
  2051. function markStaticNode(node, key, isOnce) {
  2052. node.isStatic = true;
  2053. node.key = key;
  2054. node.isOnce = isOnce;
  2055. }
  2056. function bindObjectListeners(data, value) {
  2057. if (value) {
  2058. if (!isPlainObject(value)) {
  2059. process.env.NODE_ENV !== 'production' && warn$2('v-on without argument expects an Object value', this);
  2060. }
  2061. else {
  2062. var on = (data.on = data.on ? extend({}, data.on) : {});
  2063. for (var key in value) {
  2064. var existing = on[key];
  2065. var ours = value[key];
  2066. on[key] = existing ? [].concat(existing, ours) : ours;
  2067. }
  2068. }
  2069. }
  2070. return data;
  2071. }
  2072. function resolveScopedSlots(fns, res,
  2073. // the following are added in 2.6
  2074. hasDynamicKeys, contentHashKey) {
  2075. res = res || { $stable: !hasDynamicKeys };
  2076. for (var i = 0; i < fns.length; i++) {
  2077. var slot = fns[i];
  2078. if (isArray(slot)) {
  2079. resolveScopedSlots(slot, res, hasDynamicKeys);
  2080. }
  2081. else if (slot) {
  2082. // marker for reverse proxying v-slot without scope on this.$slots
  2083. // @ts-expect-error
  2084. if (slot.proxy) {
  2085. // @ts-expect-error
  2086. slot.fn.proxy = true;
  2087. }
  2088. res[slot.key] = slot.fn;
  2089. }
  2090. }
  2091. if (contentHashKey) {
  2092. res.$key = contentHashKey;
  2093. }
  2094. return res;
  2095. }
  2096. // helper to process dynamic keys for dynamic arguments in v-bind and v-on.
  2097. function bindDynamicKeys(baseObj, values) {
  2098. for (var i = 0; i < values.length; i += 2) {
  2099. var key = values[i];
  2100. if (typeof key === 'string' && key) {
  2101. baseObj[values[i]] = values[i + 1];
  2102. }
  2103. else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) {
  2104. // null is a special value for explicitly removing a binding
  2105. warn$2("Invalid value for dynamic directive argument (expected string or null): ".concat(key), this);
  2106. }
  2107. }
  2108. return baseObj;
  2109. }
  2110. // helper to dynamically append modifier runtime markers to event names.
  2111. // ensure only append when value is already string, otherwise it will be cast
  2112. // to string and cause the type check to miss.
  2113. function prependModifier(value, symbol) {
  2114. return typeof value === 'string' ? symbol + value : value;
  2115. }
  2116. function installRenderHelpers(target) {
  2117. target._o = markOnce;
  2118. target._n = toNumber;
  2119. target._s = toString;
  2120. target._l = renderList;
  2121. target._t = renderSlot;
  2122. target._q = looseEqual;
  2123. target._i = looseIndexOf;
  2124. target._m = renderStatic;
  2125. target._f = resolveFilter;
  2126. target._k = checkKeyCodes;
  2127. target._b = bindObjectProps;
  2128. target._v = createTextVNode;
  2129. target._e = createEmptyVNode;
  2130. target._u = resolveScopedSlots;
  2131. target._g = bindObjectListeners;
  2132. target._d = bindDynamicKeys;
  2133. target._p = prependModifier;
  2134. }
  2135. /**
  2136. * Runtime helper for resolving raw children VNodes into a slot object.
  2137. */
  2138. function resolveSlots(children, context) {
  2139. if (!children || !children.length) {
  2140. return {};
  2141. }
  2142. var slots = {};
  2143. for (var i = 0, l = children.length; i < l; i++) {
  2144. var child = children[i];
  2145. var data = child.data;
  2146. // remove slot attribute if the node is resolved as a Vue slot node
  2147. if (data && data.attrs && data.attrs.slot) {
  2148. delete data.attrs.slot;
  2149. }
  2150. // named slots should only be respected if the vnode was rendered in the
  2151. // same context.
  2152. if ((child.context === context || child.fnContext === context) &&
  2153. data &&
  2154. data.slot != null) {
  2155. var name_1 = data.slot;
  2156. var slot = slots[name_1] || (slots[name_1] = []);
  2157. if (child.tag === 'template') {
  2158. slot.push.apply(slot, child.children || []);
  2159. }
  2160. else {
  2161. slot.push(child);
  2162. }
  2163. }
  2164. else {
  2165. (slots.default || (slots.default = [])).push(child);
  2166. }
  2167. }
  2168. // ignore slots that contains only whitespace
  2169. for (var name_2 in slots) {
  2170. if (slots[name_2].every(isWhitespace)) {
  2171. delete slots[name_2];
  2172. }
  2173. }
  2174. return slots;
  2175. }
  2176. function isWhitespace(node) {
  2177. return (node.isComment && !node.asyncFactory) || node.text === ' ';
  2178. }
  2179. function isAsyncPlaceholder(node) {
  2180. // @ts-expect-error not really boolean type
  2181. return node.isComment && node.asyncFactory;
  2182. }
  2183. function normalizeScopedSlots(ownerVm, scopedSlots, normalSlots, prevScopedSlots) {
  2184. var res;
  2185. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  2186. var isStable = scopedSlots ? !!scopedSlots.$stable : !hasNormalSlots;
  2187. var key = scopedSlots && scopedSlots.$key;
  2188. if (!scopedSlots) {
  2189. res = {};
  2190. }
  2191. else if (scopedSlots._normalized) {
  2192. // fast path 1: child component re-render only, parent did not change
  2193. return scopedSlots._normalized;
  2194. }
  2195. else if (isStable &&
  2196. prevScopedSlots &&
  2197. prevScopedSlots !== emptyObject &&
  2198. key === prevScopedSlots.$key &&
  2199. !hasNormalSlots &&
  2200. !prevScopedSlots.$hasNormal) {
  2201. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  2202. // only need to normalize once
  2203. return prevScopedSlots;
  2204. }
  2205. else {
  2206. res = {};
  2207. for (var key_1 in scopedSlots) {
  2208. if (scopedSlots[key_1] && key_1[0] !== '$') {
  2209. res[key_1] = normalizeScopedSlot(ownerVm, normalSlots, key_1, scopedSlots[key_1]);
  2210. }
  2211. }
  2212. }
  2213. // expose normal slots on scopedSlots
  2214. for (var key_2 in normalSlots) {
  2215. if (!(key_2 in res)) {
  2216. res[key_2] = proxyNormalSlot(normalSlots, key_2);
  2217. }
  2218. }
  2219. // avoriaz seems to mock a non-extensible $scopedSlots object
  2220. // and when that is passed down this would cause an error
  2221. if (scopedSlots && Object.isExtensible(scopedSlots)) {
  2222. scopedSlots._normalized = res;
  2223. }
  2224. def(res, '$stable', isStable);
  2225. def(res, '$key', key);
  2226. def(res, '$hasNormal', hasNormalSlots);
  2227. return res;
  2228. }
  2229. function normalizeScopedSlot(vm, normalSlots, key, fn) {
  2230. var normalized = function () {
  2231. var cur = currentInstance;
  2232. setCurrentInstance(vm);
  2233. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  2234. res =
  2235. res && typeof res === 'object' && !isArray(res)
  2236. ? [res] // single vnode
  2237. : normalizeChildren(res);
  2238. var vnode = res && res[0];
  2239. setCurrentInstance(cur);
  2240. return res &&
  2241. (!vnode ||
  2242. (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391
  2243. ? undefined
  2244. : res;
  2245. };
  2246. // this is a slot using the new v-slot syntax without scope. although it is
  2247. // compiled as a scoped slot, render fn users would expect it to be present
  2248. // on this.$slots because the usage is semantically a normal slot.
  2249. if (fn.proxy) {
  2250. Object.defineProperty(normalSlots, key, {
  2251. get: normalized,
  2252. enumerable: true,
  2253. configurable: true
  2254. });
  2255. }
  2256. return normalized;
  2257. }
  2258. function proxyNormalSlot(slots, key) {
  2259. return function () { return slots[key]; };
  2260. }
  2261. function initSetup(vm) {
  2262. var options = vm.$options;
  2263. var setup = options.setup;
  2264. if (setup) {
  2265. var ctx = (vm._setupContext = createSetupContext(vm));
  2266. setCurrentInstance(vm);
  2267. pushTarget();
  2268. var setupResult = invokeWithErrorHandling(setup, null, [vm._props || shallowReactive({}), ctx], vm, "setup");
  2269. popTarget();
  2270. setCurrentInstance();
  2271. if (isFunction(setupResult)) {
  2272. // render function
  2273. // @ts-ignore
  2274. options.render = setupResult;
  2275. }
  2276. else if (isObject(setupResult)) {
  2277. // bindings
  2278. if (process.env.NODE_ENV !== 'production' && setupResult instanceof VNode) {
  2279. warn$2("setup() should not return VNodes directly - " +
  2280. "return a render function instead.");
  2281. }
  2282. vm._setupState = setupResult;
  2283. // __sfc indicates compiled bindings from <script setup>
  2284. if (!setupResult.__sfc) {
  2285. for (var key in setupResult) {
  2286. if (!isReserved(key)) {
  2287. proxyWithRefUnwrap(vm, setupResult, key);
  2288. }
  2289. else if (process.env.NODE_ENV !== 'production') {
  2290. warn$2("Avoid using variables that start with _ or $ in setup().");
  2291. }
  2292. }
  2293. }
  2294. else {
  2295. // exposed for compiled render fn
  2296. var proxy = (vm._setupProxy = {});
  2297. for (var key in setupResult) {
  2298. if (key !== '__sfc') {
  2299. proxyWithRefUnwrap(proxy, setupResult, key);
  2300. }
  2301. }
  2302. }
  2303. }
  2304. else if (process.env.NODE_ENV !== 'production' && setupResult !== undefined) {
  2305. warn$2("setup() should return an object. Received: ".concat(setupResult === null ? 'null' : typeof setupResult));
  2306. }
  2307. }
  2308. }
  2309. function createSetupContext(vm) {
  2310. var exposeCalled = false;
  2311. return {
  2312. get attrs() {
  2313. if (!vm._attrsProxy) {
  2314. var proxy = (vm._attrsProxy = {});
  2315. def(proxy, '_v_attr_proxy', true);
  2316. syncSetupProxy(proxy, vm.$attrs, emptyObject, vm, '$attrs');
  2317. }
  2318. return vm._attrsProxy;
  2319. },
  2320. get listeners() {
  2321. if (!vm._listenersProxy) {
  2322. var proxy = (vm._listenersProxy = {});
  2323. syncSetupProxy(proxy, vm.$listeners, emptyObject, vm, '$listeners');
  2324. }
  2325. return vm._listenersProxy;
  2326. },
  2327. get slots() {
  2328. return initSlotsProxy(vm);
  2329. },
  2330. emit: bind$1(vm.$emit, vm),
  2331. expose: function (exposed) {
  2332. if (process.env.NODE_ENV !== 'production') {
  2333. if (exposeCalled) {
  2334. warn$2("expose() should be called only once per setup().", vm);
  2335. }
  2336. exposeCalled = true;
  2337. }
  2338. if (exposed) {
  2339. Object.keys(exposed).forEach(function (key) {
  2340. return proxyWithRefUnwrap(vm, exposed, key);
  2341. });
  2342. }
  2343. }
  2344. };
  2345. }
  2346. function syncSetupProxy(to, from, prev, instance, type) {
  2347. var changed = false;
  2348. for (var key in from) {
  2349. if (!(key in to)) {
  2350. changed = true;
  2351. defineProxyAttr(to, key, instance, type);
  2352. }
  2353. else if (from[key] !== prev[key]) {
  2354. changed = true;
  2355. }
  2356. }
  2357. for (var key in to) {
  2358. if (!(key in from)) {
  2359. changed = true;
  2360. delete to[key];
  2361. }
  2362. }
  2363. return changed;
  2364. }
  2365. function defineProxyAttr(proxy, key, instance, type) {
  2366. Object.defineProperty(proxy, key, {
  2367. enumerable: true,
  2368. configurable: true,
  2369. get: function () {
  2370. return instance[type][key];
  2371. }
  2372. });
  2373. }
  2374. function initSlotsProxy(vm) {
  2375. if (!vm._slotsProxy) {
  2376. syncSetupSlots((vm._slotsProxy = {}), vm.$scopedSlots);
  2377. }
  2378. return vm._slotsProxy;
  2379. }
  2380. function syncSetupSlots(to, from) {
  2381. for (var key in from) {
  2382. to[key] = from[key];
  2383. }
  2384. for (var key in to) {
  2385. if (!(key in from)) {
  2386. delete to[key];
  2387. }
  2388. }
  2389. }
  2390. /**
  2391. * @internal use manual type def because public setup context type relies on
  2392. * legacy VNode types
  2393. */
  2394. function useSlots() {
  2395. return getContext().slots;
  2396. }
  2397. /**
  2398. * @internal use manual type def because public setup context type relies on
  2399. * legacy VNode types
  2400. */
  2401. function useAttrs() {
  2402. return getContext().attrs;
  2403. }
  2404. /**
  2405. * Vue 2 only
  2406. * @internal use manual type def because public setup context type relies on
  2407. * legacy VNode types
  2408. */
  2409. function useListeners() {
  2410. return getContext().listeners;
  2411. }
  2412. function getContext() {
  2413. if (process.env.NODE_ENV !== 'production' && !currentInstance) {
  2414. warn$2("useContext() called without active instance.");
  2415. }
  2416. var vm = currentInstance;
  2417. return vm._setupContext || (vm._setupContext = createSetupContext(vm));
  2418. }
  2419. /**
  2420. * Runtime helper for merging default declarations. Imported by compiled code
  2421. * only.
  2422. * @internal
  2423. */
  2424. function mergeDefaults(raw, defaults) {
  2425. var props = isArray(raw)
  2426. ? raw.reduce(function (normalized, p) { return ((normalized[p] = {}), normalized); }, {})
  2427. : raw;
  2428. for (var key in defaults) {
  2429. var opt = props[key];
  2430. if (opt) {
  2431. if (isArray(opt) || isFunction(opt)) {
  2432. props[key] = { type: opt, default: defaults[key] };
  2433. }
  2434. else {
  2435. opt.default = defaults[key];
  2436. }
  2437. }
  2438. else if (opt === null) {
  2439. props[key] = { default: defaults[key] };
  2440. }
  2441. else if (process.env.NODE_ENV !== 'production') {
  2442. warn$2("props default key \"".concat(key, "\" has no corresponding declaration."));
  2443. }
  2444. }
  2445. return props;
  2446. }
  2447. function initRender(vm) {
  2448. vm._vnode = null; // the root of the child tree
  2449. vm._staticTrees = null; // v-once cached trees
  2450. var options = vm.$options;
  2451. var parentVnode = (vm.$vnode = options._parentVnode); // the placeholder node in parent tree
  2452. var renderContext = parentVnode && parentVnode.context;
  2453. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  2454. vm.$scopedSlots = parentVnode
  2455. ? normalizeScopedSlots(vm.$parent, parentVnode.data.scopedSlots, vm.$slots)
  2456. : emptyObject;
  2457. // bind the createElement fn to this instance
  2458. // so that we get proper render context inside it.
  2459. // args order: tag, data, children, normalizationType, alwaysNormalize
  2460. // internal version is used by render functions compiled from templates
  2461. // @ts-expect-error
  2462. vm._c = function (a, b, c, d) { return createElement$1(vm, a, b, c, d, false); };
  2463. // normalization is always applied for the public version, used in
  2464. // user-written render functions.
  2465. // @ts-expect-error
  2466. vm.$createElement = function (a, b, c, d) { return createElement$1(vm, a, b, c, d, true); };
  2467. // $attrs & $listeners are exposed for easier HOC creation.
  2468. // they need to be reactive so that HOCs using them are always updated
  2469. var parentData = parentVnode && parentVnode.data;
  2470. /* istanbul ignore else */
  2471. if (process.env.NODE_ENV !== 'production') {
  2472. defineReactive(vm, '$attrs', (parentData && parentData.attrs) || emptyObject, function () {
  2473. !isUpdatingChildComponent && warn$2("$attrs is readonly.", vm);
  2474. }, true);
  2475. defineReactive(vm, '$listeners', options._parentListeners || emptyObject, function () {
  2476. !isUpdatingChildComponent && warn$2("$listeners is readonly.", vm);
  2477. }, true);
  2478. }
  2479. else {
  2480. defineReactive(vm, '$attrs', (parentData && parentData.attrs) || emptyObject, null, true);
  2481. defineReactive(vm, '$listeners', options._parentListeners || emptyObject, null, true);
  2482. }
  2483. }
  2484. var currentRenderingInstance = null;
  2485. function renderMixin(Vue) {
  2486. // install runtime convenience helpers
  2487. installRenderHelpers(Vue.prototype);
  2488. Vue.prototype.$nextTick = function (fn) {
  2489. return nextTick(fn, this);
  2490. };
  2491. Vue.prototype._render = function () {
  2492. var vm = this;
  2493. var _a = vm.$options, render = _a.render, _parentVnode = _a._parentVnode;
  2494. if (_parentVnode && vm._isMounted) {
  2495. vm.$scopedSlots = normalizeScopedSlots(vm.$parent, _parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);
  2496. if (vm._slotsProxy) {
  2497. syncSetupSlots(vm._slotsProxy, vm.$scopedSlots);
  2498. }
  2499. }
  2500. // set parent vnode. this allows render functions to have access
  2501. // to the data on the placeholder node.
  2502. vm.$vnode = _parentVnode;
  2503. // render self
  2504. var prevInst = currentInstance;
  2505. var prevRenderInst = currentRenderingInstance;
  2506. var vnode;
  2507. try {
  2508. setCurrentInstance(vm);
  2509. currentRenderingInstance = vm;
  2510. vnode = render.call(vm._renderProxy, vm.$createElement);
  2511. }
  2512. catch (e) {
  2513. handleError(e, vm, "render");
  2514. // return error render result,
  2515. // or previous vnode to prevent render error causing blank component
  2516. /* istanbul ignore else */
  2517. if (process.env.NODE_ENV !== 'production' && vm.$options.renderError) {
  2518. try {
  2519. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  2520. }
  2521. catch (e) {
  2522. handleError(e, vm, "renderError");
  2523. vnode = vm._vnode;
  2524. }
  2525. }
  2526. else {
  2527. vnode = vm._vnode;
  2528. }
  2529. }
  2530. finally {
  2531. currentRenderingInstance = prevRenderInst;
  2532. setCurrentInstance(prevInst);
  2533. }
  2534. // if the returned array contains only a single node, allow it
  2535. if (isArray(vnode) && vnode.length === 1) {
  2536. vnode = vnode[0];
  2537. }
  2538. // return empty vnode in case the render function errored out
  2539. if (!(vnode instanceof VNode)) {
  2540. if (process.env.NODE_ENV !== 'production' && isArray(vnode)) {
  2541. warn$2('Multiple root nodes returned from render function. Render function ' +
  2542. 'should return a single root node.', vm);
  2543. }
  2544. vnode = createEmptyVNode();
  2545. }
  2546. // set parent
  2547. vnode.parent = _parentVnode;
  2548. return vnode;
  2549. };
  2550. }
  2551. function ensureCtor(comp, base) {
  2552. if (comp.__esModule || (hasSymbol && comp[Symbol.toStringTag] === 'Module')) {
  2553. comp = comp.default;
  2554. }
  2555. return isObject(comp) ? base.extend(comp) : comp;
  2556. }
  2557. function createAsyncPlaceholder(factory, data, context, children, tag) {
  2558. var node = createEmptyVNode();
  2559. node.asyncFactory = factory;
  2560. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  2561. return node;
  2562. }
  2563. function resolveAsyncComponent(factory, baseCtor) {
  2564. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  2565. return factory.errorComp;
  2566. }
  2567. if (isDef(factory.resolved)) {
  2568. return factory.resolved;
  2569. }
  2570. var owner = currentRenderingInstance;
  2571. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  2572. // already pending
  2573. factory.owners.push(owner);
  2574. }
  2575. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  2576. return factory.loadingComp;
  2577. }
  2578. if (owner && !isDef(factory.owners)) {
  2579. var owners_1 = (factory.owners = [owner]);
  2580. var sync_1 = true;
  2581. var timerLoading_1 = null;
  2582. var timerTimeout_1 = null;
  2583. owner.$on('hook:destroyed', function () { return remove$2(owners_1, owner); });
  2584. var forceRender_1 = function (renderCompleted) {
  2585. for (var i = 0, l = owners_1.length; i < l; i++) {
  2586. owners_1[i].$forceUpdate();
  2587. }
  2588. if (renderCompleted) {
  2589. owners_1.length = 0;
  2590. if (timerLoading_1 !== null) {
  2591. clearTimeout(timerLoading_1);
  2592. timerLoading_1 = null;
  2593. }
  2594. if (timerTimeout_1 !== null) {
  2595. clearTimeout(timerTimeout_1);
  2596. timerTimeout_1 = null;
  2597. }
  2598. }
  2599. };
  2600. var resolve = once(function (res) {
  2601. // cache resolved
  2602. factory.resolved = ensureCtor(res, baseCtor);
  2603. // invoke callbacks only if this is not a synchronous resolve
  2604. // (async resolves are shimmed as synchronous during SSR)
  2605. if (!sync_1) {
  2606. forceRender_1(true);
  2607. }
  2608. else {
  2609. owners_1.length = 0;
  2610. }
  2611. });
  2612. var reject_1 = once(function (reason) {
  2613. process.env.NODE_ENV !== 'production' &&
  2614. warn$2("Failed to resolve async component: ".concat(String(factory)) +
  2615. (reason ? "\nReason: ".concat(reason) : ''));
  2616. if (isDef(factory.errorComp)) {
  2617. factory.error = true;
  2618. forceRender_1(true);
  2619. }
  2620. });
  2621. var res_1 = factory(resolve, reject_1);
  2622. if (isObject(res_1)) {
  2623. if (isPromise(res_1)) {
  2624. // () => Promise
  2625. if (isUndef(factory.resolved)) {
  2626. res_1.then(resolve, reject_1);
  2627. }
  2628. }
  2629. else if (isPromise(res_1.component)) {
  2630. res_1.component.then(resolve, reject_1);
  2631. if (isDef(res_1.error)) {
  2632. factory.errorComp = ensureCtor(res_1.error, baseCtor);
  2633. }
  2634. if (isDef(res_1.loading)) {
  2635. factory.loadingComp = ensureCtor(res_1.loading, baseCtor);
  2636. if (res_1.delay === 0) {
  2637. factory.loading = true;
  2638. }
  2639. else {
  2640. // @ts-expect-error NodeJS timeout type
  2641. timerLoading_1 = setTimeout(function () {
  2642. timerLoading_1 = null;
  2643. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  2644. factory.loading = true;
  2645. forceRender_1(false);
  2646. }
  2647. }, res_1.delay || 200);
  2648. }
  2649. }
  2650. if (isDef(res_1.timeout)) {
  2651. // @ts-expect-error NodeJS timeout type
  2652. timerTimeout_1 = setTimeout(function () {
  2653. timerTimeout_1 = null;
  2654. if (isUndef(factory.resolved)) {
  2655. reject_1(process.env.NODE_ENV !== 'production' ? "timeout (".concat(res_1.timeout, "ms)") : null);
  2656. }
  2657. }, res_1.timeout);
  2658. }
  2659. }
  2660. }
  2661. sync_1 = false;
  2662. // return in case resolved synchronously
  2663. return factory.loading ? factory.loadingComp : factory.resolved;
  2664. }
  2665. }
  2666. function getFirstComponentChild(children) {
  2667. if (isArray(children)) {
  2668. for (var i = 0; i < children.length; i++) {
  2669. var c = children[i];
  2670. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  2671. return c;
  2672. }
  2673. }
  2674. }
  2675. }
  2676. function initEvents(vm) {
  2677. vm._events = Object.create(null);
  2678. vm._hasHookEvent = false;
  2679. // init parent attached events
  2680. var listeners = vm.$options._parentListeners;
  2681. if (listeners) {
  2682. updateComponentListeners(vm, listeners);
  2683. }
  2684. }
  2685. var target$1;
  2686. function add$1(event, fn) {
  2687. target$1.$on(event, fn);
  2688. }
  2689. function remove$1(event, fn) {
  2690. target$1.$off(event, fn);
  2691. }
  2692. function createOnceHandler$1(event, fn) {
  2693. var _target = target$1;
  2694. return function onceHandler() {
  2695. var res = fn.apply(null, arguments);
  2696. if (res !== null) {
  2697. _target.$off(event, onceHandler);
  2698. }
  2699. };
  2700. }
  2701. function updateComponentListeners(vm, listeners, oldListeners) {
  2702. target$1 = vm;
  2703. updateListeners(listeners, oldListeners || {}, add$1, remove$1, createOnceHandler$1, vm);
  2704. target$1 = undefined;
  2705. }
  2706. function eventsMixin(Vue) {
  2707. var hookRE = /^hook:/;
  2708. Vue.prototype.$on = function (event, fn) {
  2709. var vm = this;
  2710. if (isArray(event)) {
  2711. for (var i = 0, l = event.length; i < l; i++) {
  2712. vm.$on(event[i], fn);
  2713. }
  2714. }
  2715. else {
  2716. (vm._events[event] || (vm._events[event] = [])).push(fn);
  2717. // optimize hook:event cost by using a boolean flag marked at registration
  2718. // instead of a hash lookup
  2719. if (hookRE.test(event)) {
  2720. vm._hasHookEvent = true;
  2721. }
  2722. }
  2723. return vm;
  2724. };
  2725. Vue.prototype.$once = function (event, fn) {
  2726. var vm = this;
  2727. function on() {
  2728. vm.$off(event, on);
  2729. fn.apply(vm, arguments);
  2730. }
  2731. on.fn = fn;
  2732. vm.$on(event, on);
  2733. return vm;
  2734. };
  2735. Vue.prototype.$off = function (event, fn) {
  2736. var vm = this;
  2737. // all
  2738. if (!arguments.length) {
  2739. vm._events = Object.create(null);
  2740. return vm;
  2741. }
  2742. // array of events
  2743. if (isArray(event)) {
  2744. for (var i_1 = 0, l = event.length; i_1 < l; i_1++) {
  2745. vm.$off(event[i_1], fn);
  2746. }
  2747. return vm;
  2748. }
  2749. // specific event
  2750. var cbs = vm._events[event];
  2751. if (!cbs) {
  2752. return vm;
  2753. }
  2754. if (!fn) {
  2755. vm._events[event] = null;
  2756. return vm;
  2757. }
  2758. // specific handler
  2759. var cb;
  2760. var i = cbs.length;
  2761. while (i--) {
  2762. cb = cbs[i];
  2763. if (cb === fn || cb.fn === fn) {
  2764. cbs.splice(i, 1);
  2765. break;
  2766. }
  2767. }
  2768. return vm;
  2769. };
  2770. Vue.prototype.$emit = function (event) {
  2771. var vm = this;
  2772. if (process.env.NODE_ENV !== 'production') {
  2773. var lowerCaseEvent = event.toLowerCase();
  2774. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  2775. tip("Event \"".concat(lowerCaseEvent, "\" is emitted in component ") +
  2776. "".concat(formatComponentName(vm), " but the handler is registered for \"").concat(event, "\". ") +
  2777. "Note that HTML attributes are case-insensitive and you cannot use " +
  2778. "v-on to listen to camelCase events when using in-DOM templates. " +
  2779. "You should probably use \"".concat(hyphenate(event), "\" instead of \"").concat(event, "\"."));
  2780. }
  2781. }
  2782. var cbs = vm._events[event];
  2783. if (cbs) {
  2784. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  2785. var args = toArray(arguments, 1);
  2786. var info = "event handler for \"".concat(event, "\"");
  2787. for (var i = 0, l = cbs.length; i < l; i++) {
  2788. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  2789. }
  2790. }
  2791. return vm;
  2792. };
  2793. }
  2794. var activeEffectScope;
  2795. var EffectScope = /** @class */ (function () {
  2796. function EffectScope(detached) {
  2797. if (detached === void 0) { detached = false; }
  2798. this.detached = detached;
  2799. /**
  2800. * @internal
  2801. */
  2802. this.active = true;
  2803. /**
  2804. * @internal
  2805. */
  2806. this.effects = [];
  2807. /**
  2808. * @internal
  2809. */
  2810. this.cleanups = [];
  2811. this.parent = activeEffectScope;
  2812. if (!detached && activeEffectScope) {
  2813. this.index =
  2814. (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
  2815. }
  2816. }
  2817. EffectScope.prototype.run = function (fn) {
  2818. if (this.active) {
  2819. var currentEffectScope = activeEffectScope;
  2820. try {
  2821. activeEffectScope = this;
  2822. return fn();
  2823. }
  2824. finally {
  2825. activeEffectScope = currentEffectScope;
  2826. }
  2827. }
  2828. else if (process.env.NODE_ENV !== 'production') {
  2829. warn$2("cannot run an inactive effect scope.");
  2830. }
  2831. };
  2832. /**
  2833. * This should only be called on non-detached scopes
  2834. * @internal
  2835. */
  2836. EffectScope.prototype.on = function () {
  2837. activeEffectScope = this;
  2838. };
  2839. /**
  2840. * This should only be called on non-detached scopes
  2841. * @internal
  2842. */
  2843. EffectScope.prototype.off = function () {
  2844. activeEffectScope = this.parent;
  2845. };
  2846. EffectScope.prototype.stop = function (fromParent) {
  2847. if (this.active) {
  2848. var i = void 0, l = void 0;
  2849. for (i = 0, l = this.effects.length; i < l; i++) {
  2850. this.effects[i].teardown();
  2851. }
  2852. for (i = 0, l = this.cleanups.length; i < l; i++) {
  2853. this.cleanups[i]();
  2854. }
  2855. if (this.scopes) {
  2856. for (i = 0, l = this.scopes.length; i < l; i++) {
  2857. this.scopes[i].stop(true);
  2858. }
  2859. }
  2860. // nested scope, dereference from parent to avoid memory leaks
  2861. if (!this.detached && this.parent && !fromParent) {
  2862. // optimized O(1) removal
  2863. var last = this.parent.scopes.pop();
  2864. if (last && last !== this) {
  2865. this.parent.scopes[this.index] = last;
  2866. last.index = this.index;
  2867. }
  2868. }
  2869. this.parent = undefined;
  2870. this.active = false;
  2871. }
  2872. };
  2873. return EffectScope;
  2874. }());
  2875. function effectScope(detached) {
  2876. return new EffectScope(detached);
  2877. }
  2878. /**
  2879. * @internal
  2880. */
  2881. function recordEffectScope(effect, scope) {
  2882. if (scope === void 0) { scope = activeEffectScope; }
  2883. if (scope && scope.active) {
  2884. scope.effects.push(effect);
  2885. }
  2886. }
  2887. function getCurrentScope() {
  2888. return activeEffectScope;
  2889. }
  2890. function onScopeDispose(fn) {
  2891. if (activeEffectScope) {
  2892. activeEffectScope.cleanups.push(fn);
  2893. }
  2894. else if (process.env.NODE_ENV !== 'production') {
  2895. warn$2("onScopeDispose() is called when there is no active effect scope" +
  2896. " to be associated with.");
  2897. }
  2898. }
  2899. var activeInstance = null;
  2900. var isUpdatingChildComponent = false;
  2901. function setActiveInstance(vm) {
  2902. var prevActiveInstance = activeInstance;
  2903. activeInstance = vm;
  2904. return function () {
  2905. activeInstance = prevActiveInstance;
  2906. };
  2907. }
  2908. function initLifecycle(vm) {
  2909. var options = vm.$options;
  2910. // locate first non-abstract parent
  2911. var parent = options.parent;
  2912. if (parent && !options.abstract) {
  2913. while (parent.$options.abstract && parent.$parent) {
  2914. parent = parent.$parent;
  2915. }
  2916. parent.$children.push(vm);
  2917. }
  2918. vm.$parent = parent;
  2919. vm.$root = parent ? parent.$root : vm;
  2920. vm.$children = [];
  2921. vm.$refs = {};
  2922. vm._provided = parent ? parent._provided : Object.create(null);
  2923. vm._watcher = null;
  2924. vm._inactive = null;
  2925. vm._directInactive = false;
  2926. vm._isMounted = false;
  2927. vm._isDestroyed = false;
  2928. vm._isBeingDestroyed = false;
  2929. }
  2930. function lifecycleMixin(Vue) {
  2931. Vue.prototype._update = function (vnode, hydrating) {
  2932. var vm = this;
  2933. var prevEl = vm.$el;
  2934. var prevVnode = vm._vnode;
  2935. var restoreActiveInstance = setActiveInstance(vm);
  2936. vm._vnode = vnode;
  2937. // Vue.prototype.__patch__ is injected in entry points
  2938. // based on the rendering backend used.
  2939. if (!prevVnode) {
  2940. // initial render
  2941. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  2942. }
  2943. else {
  2944. // updates
  2945. vm.$el = vm.__patch__(prevVnode, vnode);
  2946. }
  2947. restoreActiveInstance();
  2948. // update __vue__ reference
  2949. if (prevEl) {
  2950. prevEl.__vue__ = null;
  2951. }
  2952. if (vm.$el) {
  2953. vm.$el.__vue__ = vm;
  2954. }
  2955. // if parent is an HOC, update its $el as well
  2956. var wrapper = vm;
  2957. while (wrapper &&
  2958. wrapper.$vnode &&
  2959. wrapper.$parent &&
  2960. wrapper.$vnode === wrapper.$parent._vnode) {
  2961. wrapper.$parent.$el = wrapper.$el;
  2962. wrapper = wrapper.$parent;
  2963. }
  2964. // updated hook is called by the scheduler to ensure that children are
  2965. // updated in a parent's updated hook.
  2966. };
  2967. Vue.prototype.$forceUpdate = function () {
  2968. var vm = this;
  2969. if (vm._watcher) {
  2970. vm._watcher.update();
  2971. }
  2972. };
  2973. Vue.prototype.$destroy = function () {
  2974. var vm = this;
  2975. if (vm._isBeingDestroyed) {
  2976. return;
  2977. }
  2978. callHook$1(vm, 'beforeDestroy');
  2979. vm._isBeingDestroyed = true;
  2980. // remove self from parent
  2981. var parent = vm.$parent;
  2982. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  2983. remove$2(parent.$children, vm);
  2984. }
  2985. // teardown scope. this includes both the render watcher and other
  2986. // watchers created
  2987. vm._scope.stop();
  2988. // remove reference from data ob
  2989. // frozen object may not have observer.
  2990. if (vm._data.__ob__) {
  2991. vm._data.__ob__.vmCount--;
  2992. }
  2993. // call the last hook...
  2994. vm._isDestroyed = true;
  2995. // invoke destroy hooks on current rendered tree
  2996. vm.__patch__(vm._vnode, null);
  2997. // fire destroyed hook
  2998. callHook$1(vm, 'destroyed');
  2999. // turn off all instance listeners.
  3000. vm.$off();
  3001. // remove __vue__ reference
  3002. if (vm.$el) {
  3003. vm.$el.__vue__ = null;
  3004. }
  3005. // release circular reference (#6759)
  3006. if (vm.$vnode) {
  3007. vm.$vnode.parent = null;
  3008. }
  3009. };
  3010. }
  3011. function mountComponent(vm, el, hydrating) {
  3012. vm.$el = el;
  3013. if (!vm.$options.render) {
  3014. // @ts-expect-error invalid type
  3015. vm.$options.render = createEmptyVNode;
  3016. if (process.env.NODE_ENV !== 'production') {
  3017. /* istanbul ignore if */
  3018. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  3019. vm.$options.el ||
  3020. el) {
  3021. warn$2('You are using the runtime-only build of Vue where the template ' +
  3022. 'compiler is not available. Either pre-compile the templates into ' +
  3023. 'render functions, or use the compiler-included build.', vm);
  3024. }
  3025. else {
  3026. warn$2('Failed to mount component: template or render function not defined.', vm);
  3027. }
  3028. }
  3029. }
  3030. callHook$1(vm, 'beforeMount');
  3031. var updateComponent;
  3032. /* istanbul ignore if */
  3033. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  3034. updateComponent = function () {
  3035. var name = vm._name;
  3036. var id = vm._uid;
  3037. var startTag = "vue-perf-start:".concat(id);
  3038. var endTag = "vue-perf-end:".concat(id);
  3039. mark(startTag);
  3040. var vnode = vm._render();
  3041. mark(endTag);
  3042. measure("vue ".concat(name, " render"), startTag, endTag);
  3043. mark(startTag);
  3044. vm._update(vnode, hydrating);
  3045. mark(endTag);
  3046. measure("vue ".concat(name, " patch"), startTag, endTag);
  3047. };
  3048. }
  3049. else {
  3050. updateComponent = function () {
  3051. vm._update(vm._render(), hydrating);
  3052. };
  3053. }
  3054. var watcherOptions = {
  3055. before: function () {
  3056. if (vm._isMounted && !vm._isDestroyed) {
  3057. callHook$1(vm, 'beforeUpdate');
  3058. }
  3059. }
  3060. };
  3061. if (process.env.NODE_ENV !== 'production') {
  3062. watcherOptions.onTrack = function (e) { return callHook$1(vm, 'renderTracked', [e]); };
  3063. watcherOptions.onTrigger = function (e) { return callHook$1(vm, 'renderTriggered', [e]); };
  3064. }
  3065. // we set this to vm._watcher inside the watcher's constructor
  3066. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  3067. // component's mounted hook), which relies on vm._watcher being already defined
  3068. new Watcher(vm, updateComponent, noop, watcherOptions, true /* isRenderWatcher */);
  3069. hydrating = false;
  3070. // flush buffer for flush: "pre" watchers queued in setup()
  3071. var preWatchers = vm._preWatchers;
  3072. if (preWatchers) {
  3073. for (var i = 0; i < preWatchers.length; i++) {
  3074. preWatchers[i].run();
  3075. }
  3076. }
  3077. // manually mounted instance, call mounted on self
  3078. // mounted is called for render-created child components in its inserted hook
  3079. if (vm.$vnode == null) {
  3080. vm._isMounted = true;
  3081. callHook$1(vm, 'mounted');
  3082. }
  3083. return vm;
  3084. }
  3085. function updateChildComponent(vm, propsData, listeners, parentVnode, renderChildren) {
  3086. if (process.env.NODE_ENV !== 'production') {
  3087. isUpdatingChildComponent = true;
  3088. }
  3089. // determine whether component has slot children
  3090. // we need to do this before overwriting $options._renderChildren.
  3091. // check if there are dynamic scopedSlots (hand-written or compiled but with
  3092. // dynamic slot names). Static scoped slots compiled from template has the
  3093. // "$stable" marker.
  3094. var newScopedSlots = parentVnode.data.scopedSlots;
  3095. var oldScopedSlots = vm.$scopedSlots;
  3096. var hasDynamicScopedSlot = !!((newScopedSlots && !newScopedSlots.$stable) ||
  3097. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  3098. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
  3099. (!newScopedSlots && vm.$scopedSlots.$key));
  3100. // Any static slot children from the parent may have changed during parent's
  3101. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  3102. // update is necessary to ensure correctness.
  3103. var needsForceUpdate = !!(renderChildren || // has new static slots
  3104. vm.$options._renderChildren || // has old static slots
  3105. hasDynamicScopedSlot);
  3106. var prevVNode = vm.$vnode;
  3107. vm.$options._parentVnode = parentVnode;
  3108. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  3109. if (vm._vnode) {
  3110. // update child tree's parent
  3111. vm._vnode.parent = parentVnode;
  3112. }
  3113. vm.$options._renderChildren = renderChildren;
  3114. // update $attrs and $listeners hash
  3115. // these are also reactive so they may trigger child update if the child
  3116. // used them during render
  3117. var attrs = parentVnode.data.attrs || emptyObject;
  3118. if (vm._attrsProxy) {
  3119. // force update if attrs are accessed and has changed since it may be
  3120. // passed to a child component.
  3121. if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
  3122. needsForceUpdate = true;
  3123. }
  3124. }
  3125. vm.$attrs = attrs;
  3126. // update listeners
  3127. listeners = listeners || emptyObject;
  3128. var prevListeners = vm.$options._parentListeners;
  3129. if (vm._listenersProxy) {
  3130. syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
  3131. }
  3132. vm.$listeners = vm.$options._parentListeners = listeners;
  3133. updateComponentListeners(vm, listeners, prevListeners);
  3134. // update props
  3135. if (propsData && vm.$options.props) {
  3136. toggleObserving(false);
  3137. var props = vm._props;
  3138. var propKeys = vm.$options._propKeys || [];
  3139. for (var i = 0; i < propKeys.length; i++) {
  3140. var key = propKeys[i];
  3141. var propOptions = vm.$options.props; // wtf flow?
  3142. props[key] = validateProp(key, propOptions, propsData, vm);
  3143. }
  3144. toggleObserving(true);
  3145. // keep a copy of raw propsData
  3146. vm.$options.propsData = propsData;
  3147. }
  3148. // resolve slots + force update if has children
  3149. if (needsForceUpdate) {
  3150. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3151. vm.$forceUpdate();
  3152. }
  3153. if (process.env.NODE_ENV !== 'production') {
  3154. isUpdatingChildComponent = false;
  3155. }
  3156. }
  3157. function isInInactiveTree(vm) {
  3158. while (vm && (vm = vm.$parent)) {
  3159. if (vm._inactive)
  3160. return true;
  3161. }
  3162. return false;
  3163. }
  3164. function activateChildComponent(vm, direct) {
  3165. if (direct) {
  3166. vm._directInactive = false;
  3167. if (isInInactiveTree(vm)) {
  3168. return;
  3169. }
  3170. }
  3171. else if (vm._directInactive) {
  3172. return;
  3173. }
  3174. if (vm._inactive || vm._inactive === null) {
  3175. vm._inactive = false;
  3176. for (var i = 0; i < vm.$children.length; i++) {
  3177. activateChildComponent(vm.$children[i]);
  3178. }
  3179. callHook$1(vm, 'activated');
  3180. }
  3181. }
  3182. function deactivateChildComponent(vm, direct) {
  3183. if (direct) {
  3184. vm._directInactive = true;
  3185. if (isInInactiveTree(vm)) {
  3186. return;
  3187. }
  3188. }
  3189. if (!vm._inactive) {
  3190. vm._inactive = true;
  3191. for (var i = 0; i < vm.$children.length; i++) {
  3192. deactivateChildComponent(vm.$children[i]);
  3193. }
  3194. callHook$1(vm, 'deactivated');
  3195. }
  3196. }
  3197. function callHook$1(vm, hook, args, setContext) {
  3198. if (setContext === void 0) { setContext = true; }
  3199. // #7573 disable dep collection when invoking lifecycle hooks
  3200. pushTarget();
  3201. var prevInst = currentInstance;
  3202. var prevScope = getCurrentScope();
  3203. setContext && setCurrentInstance(vm);
  3204. var handlers = vm.$options[hook];
  3205. var info = "".concat(hook, " hook");
  3206. if (handlers) {
  3207. for (var i = 0, j = handlers.length; i < j; i++) {
  3208. invokeWithErrorHandling(handlers[i], vm, args || null, vm, info);
  3209. }
  3210. }
  3211. if (vm._hasHookEvent) {
  3212. vm.$emit('hook:' + hook);
  3213. }
  3214. if (setContext) {
  3215. setCurrentInstance(prevInst);
  3216. prevScope && prevScope.on();
  3217. }
  3218. popTarget();
  3219. }
  3220. var MAX_UPDATE_COUNT = 100;
  3221. var queue = [];
  3222. var activatedChildren = [];
  3223. var has = {};
  3224. var circular = {};
  3225. var waiting = false;
  3226. var flushing = false;
  3227. var index$1 = 0;
  3228. /**
  3229. * Reset the scheduler's state.
  3230. */
  3231. function resetSchedulerState() {
  3232. index$1 = queue.length = activatedChildren.length = 0;
  3233. has = {};
  3234. if (process.env.NODE_ENV !== 'production') {
  3235. circular = {};
  3236. }
  3237. waiting = flushing = false;
  3238. }
  3239. // Async edge case #6566 requires saving the timestamp when event listeners are
  3240. // attached. However, calling performance.now() has a perf overhead especially
  3241. // if the page has thousands of event listeners. Instead, we take a timestamp
  3242. // every time the scheduler flushes and use that for all event listeners
  3243. // attached during that flush.
  3244. var currentFlushTimestamp = 0;
  3245. // Async edge case fix requires storing an event listener's attach timestamp.
  3246. var getNow = Date.now;
  3247. // Determine what event timestamp the browser is using. Annoyingly, the
  3248. // timestamp can either be hi-res (relative to page load) or low-res
  3249. // (relative to UNIX epoch), so in order to compare time we have to use the
  3250. // same timestamp type when saving the flush timestamp.
  3251. // All IE versions use low-res event timestamps, and have problematic clock
  3252. // implementations (#9632)
  3253. if (inBrowser && !isIE) {
  3254. var performance_1 = window.performance;
  3255. if (performance_1 &&
  3256. typeof performance_1.now === 'function' &&
  3257. getNow() > document.createEvent('Event').timeStamp) {
  3258. // if the event timestamp, although evaluated AFTER the Date.now(), is
  3259. // smaller than it, it means the event is using a hi-res timestamp,
  3260. // and we need to use the hi-res version for event listener timestamps as
  3261. // well.
  3262. getNow = function () { return performance_1.now(); };
  3263. }
  3264. }
  3265. var sortCompareFn = function (a, b) {
  3266. if (a.post) {
  3267. if (!b.post)
  3268. return 1;
  3269. }
  3270. else if (b.post) {
  3271. return -1;
  3272. }
  3273. return a.id - b.id;
  3274. };
  3275. /**
  3276. * Flush both queues and run the watchers.
  3277. */
  3278. function flushSchedulerQueue() {
  3279. currentFlushTimestamp = getNow();
  3280. flushing = true;
  3281. var watcher, id;
  3282. // Sort queue before flush.
  3283. // This ensures that:
  3284. // 1. Components are updated from parent to child. (because parent is always
  3285. // created before the child)
  3286. // 2. A component's user watchers are run before its render watcher (because
  3287. // user watchers are created before the render watcher)
  3288. // 3. If a component is destroyed during a parent component's watcher run,
  3289. // its watchers can be skipped.
  3290. queue.sort(sortCompareFn);
  3291. // do not cache length because more watchers might be pushed
  3292. // as we run existing watchers
  3293. for (index$1 = 0; index$1 < queue.length; index$1++) {
  3294. watcher = queue[index$1];
  3295. if (watcher.before) {
  3296. watcher.before();
  3297. }
  3298. id = watcher.id;
  3299. has[id] = null;
  3300. watcher.run();
  3301. // in dev build, check and stop circular updates.
  3302. if (process.env.NODE_ENV !== 'production' && has[id] != null) {
  3303. circular[id] = (circular[id] || 0) + 1;
  3304. if (circular[id] > MAX_UPDATE_COUNT) {
  3305. warn$2('You may have an infinite update loop ' +
  3306. (watcher.user
  3307. ? "in watcher with expression \"".concat(watcher.expression, "\"")
  3308. : "in a component render function."), watcher.vm);
  3309. break;
  3310. }
  3311. }
  3312. }
  3313. // keep copies of post queues before resetting state
  3314. var activatedQueue = activatedChildren.slice();
  3315. var updatedQueue = queue.slice();
  3316. resetSchedulerState();
  3317. // call component updated and activated hooks
  3318. callActivatedHooks(activatedQueue);
  3319. callUpdatedHooks(updatedQueue);
  3320. cleanupDeps();
  3321. // devtool hook
  3322. /* istanbul ignore if */
  3323. if (devtools && config.devtools) {
  3324. devtools.emit('flush');
  3325. }
  3326. }
  3327. function callUpdatedHooks(queue) {
  3328. var i = queue.length;
  3329. while (i--) {
  3330. var watcher = queue[i];
  3331. var vm = watcher.vm;
  3332. if (vm && vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3333. callHook$1(vm, 'updated');
  3334. }
  3335. }
  3336. }
  3337. /**
  3338. * Queue a kept-alive component that was activated during patch.
  3339. * The queue will be processed after the entire tree has been patched.
  3340. */
  3341. function queueActivatedComponent(vm) {
  3342. // setting _inactive to false here so that a render function can
  3343. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3344. vm._inactive = false;
  3345. activatedChildren.push(vm);
  3346. }
  3347. function callActivatedHooks(queue) {
  3348. for (var i = 0; i < queue.length; i++) {
  3349. queue[i]._inactive = true;
  3350. activateChildComponent(queue[i], true /* true */);
  3351. }
  3352. }
  3353. /**
  3354. * Push a watcher into the watcher queue.
  3355. * Jobs with duplicate IDs will be skipped unless it's
  3356. * pushed when the queue is being flushed.
  3357. */
  3358. function queueWatcher(watcher) {
  3359. var id = watcher.id;
  3360. if (has[id] != null) {
  3361. return;
  3362. }
  3363. if (watcher === Dep.target && watcher.noRecurse) {
  3364. return;
  3365. }
  3366. has[id] = true;
  3367. if (!flushing) {
  3368. queue.push(watcher);
  3369. }
  3370. else {
  3371. // if already flushing, splice the watcher based on its id
  3372. // if already past its id, it will be run next immediately.
  3373. var i = queue.length - 1;
  3374. while (i > index$1 && queue[i].id > watcher.id) {
  3375. i--;
  3376. }
  3377. queue.splice(i + 1, 0, watcher);
  3378. }
  3379. // queue the flush
  3380. if (!waiting) {
  3381. waiting = true;
  3382. if (process.env.NODE_ENV !== 'production' && !config.async) {
  3383. flushSchedulerQueue();
  3384. return;
  3385. }
  3386. nextTick(flushSchedulerQueue);
  3387. }
  3388. }
  3389. var WATCHER = "watcher";
  3390. var WATCHER_CB = "".concat(WATCHER, " callback");
  3391. var WATCHER_GETTER = "".concat(WATCHER, " getter");
  3392. var WATCHER_CLEANUP = "".concat(WATCHER, " cleanup");
  3393. // Simple effect.
  3394. function watchEffect(effect, options) {
  3395. return doWatch(effect, null, options);
  3396. }
  3397. function watchPostEffect(effect, options) {
  3398. return doWatch(effect, null, (process.env.NODE_ENV !== 'production'
  3399. ? __assign(__assign({}, options), { flush: 'post' }) : { flush: 'post' }));
  3400. }
  3401. function watchSyncEffect(effect, options) {
  3402. return doWatch(effect, null, (process.env.NODE_ENV !== 'production'
  3403. ? __assign(__assign({}, options), { flush: 'sync' }) : { flush: 'sync' }));
  3404. }
  3405. // initial value for watchers to trigger on undefined initial values
  3406. var INITIAL_WATCHER_VALUE = {};
  3407. // implementation
  3408. function watch(source, cb, options) {
  3409. if (process.env.NODE_ENV !== 'production' && typeof cb !== 'function') {
  3410. warn$2("`watch(fn, options?)` signature has been moved to a separate API. " +
  3411. "Use `watchEffect(fn, options?)` instead. `watch` now only " +
  3412. "supports `watch(source, cb, options?) signature.");
  3413. }
  3414. return doWatch(source, cb, options);
  3415. }
  3416. function doWatch(source, cb, _a) {
  3417. 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;
  3418. if (process.env.NODE_ENV !== 'production' && !cb) {
  3419. if (immediate !== undefined) {
  3420. warn$2("watch() \"immediate\" option is only respected when using the " +
  3421. "watch(source, callback, options?) signature.");
  3422. }
  3423. if (deep !== undefined) {
  3424. warn$2("watch() \"deep\" option is only respected when using the " +
  3425. "watch(source, callback, options?) signature.");
  3426. }
  3427. }
  3428. var warnInvalidSource = function (s) {
  3429. warn$2("Invalid watch source: ".concat(s, ". A watch source can only be a getter/effect ") +
  3430. "function, a ref, a reactive object, or an array of these types.");
  3431. };
  3432. var instance = currentInstance;
  3433. var call = function (fn, type, args) {
  3434. if (args === void 0) { args = null; }
  3435. var res = invokeWithErrorHandling(fn, null, args, instance, type);
  3436. if (deep && res && res.__ob__)
  3437. res.__ob__.dep.depend();
  3438. return res;
  3439. };
  3440. var getter;
  3441. var forceTrigger = false;
  3442. var isMultiSource = false;
  3443. if (isRef(source)) {
  3444. getter = function () { return source.value; };
  3445. forceTrigger = isShallow(source);
  3446. }
  3447. else if (isReactive(source)) {
  3448. getter = function () {
  3449. source.__ob__.dep.depend();
  3450. return source;
  3451. };
  3452. deep = true;
  3453. }
  3454. else if (isArray(source)) {
  3455. isMultiSource = true;
  3456. forceTrigger = source.some(function (s) { return isReactive(s) || isShallow(s); });
  3457. getter = function () {
  3458. return source.map(function (s) {
  3459. if (isRef(s)) {
  3460. return s.value;
  3461. }
  3462. else if (isReactive(s)) {
  3463. s.__ob__.dep.depend();
  3464. return traverse(s);
  3465. }
  3466. else if (isFunction(s)) {
  3467. return call(s, WATCHER_GETTER);
  3468. }
  3469. else {
  3470. process.env.NODE_ENV !== 'production' && warnInvalidSource(s);
  3471. }
  3472. });
  3473. };
  3474. }
  3475. else if (isFunction(source)) {
  3476. if (cb) {
  3477. // getter with cb
  3478. getter = function () { return call(source, WATCHER_GETTER); };
  3479. }
  3480. else {
  3481. // no cb -> simple effect
  3482. getter = function () {
  3483. if (instance && instance._isDestroyed) {
  3484. return;
  3485. }
  3486. if (cleanup) {
  3487. cleanup();
  3488. }
  3489. return call(source, WATCHER, [onCleanup]);
  3490. };
  3491. }
  3492. }
  3493. else {
  3494. getter = noop;
  3495. process.env.NODE_ENV !== 'production' && warnInvalidSource(source);
  3496. }
  3497. if (cb && deep) {
  3498. var baseGetter_1 = getter;
  3499. getter = function () { return traverse(baseGetter_1()); };
  3500. }
  3501. var cleanup;
  3502. var onCleanup = function (fn) {
  3503. cleanup = watcher.onStop = function () {
  3504. call(fn, WATCHER_CLEANUP);
  3505. };
  3506. };
  3507. // in SSR there is no need to setup an actual effect, and it should be noop
  3508. // unless it's eager
  3509. if (isServerRendering()) {
  3510. // we will also not call the invalidate callback (+ runner is not set up)
  3511. onCleanup = noop;
  3512. if (!cb) {
  3513. getter();
  3514. }
  3515. else if (immediate) {
  3516. call(cb, WATCHER_CB, [
  3517. getter(),
  3518. isMultiSource ? [] : undefined,
  3519. onCleanup
  3520. ]);
  3521. }
  3522. return noop;
  3523. }
  3524. var watcher = new Watcher(currentInstance, getter, noop, {
  3525. lazy: true
  3526. });
  3527. watcher.noRecurse = !cb;
  3528. var oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
  3529. // overwrite default run
  3530. watcher.run = function () {
  3531. if (!watcher.active) {
  3532. return;
  3533. }
  3534. if (cb) {
  3535. // watch(source, cb)
  3536. var newValue = watcher.get();
  3537. if (deep ||
  3538. forceTrigger ||
  3539. (isMultiSource
  3540. ? newValue.some(function (v, i) {
  3541. return hasChanged(v, oldValue[i]);
  3542. })
  3543. : hasChanged(newValue, oldValue))) {
  3544. // cleanup before running cb again
  3545. if (cleanup) {
  3546. cleanup();
  3547. }
  3548. call(cb, WATCHER_CB, [
  3549. newValue,
  3550. // pass undefined as the old value when it's changed for the first time
  3551. oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
  3552. onCleanup
  3553. ]);
  3554. oldValue = newValue;
  3555. }
  3556. }
  3557. else {
  3558. // watchEffect
  3559. watcher.get();
  3560. }
  3561. };
  3562. if (flush === 'sync') {
  3563. watcher.update = watcher.run;
  3564. }
  3565. else if (flush === 'post') {
  3566. watcher.post = true;
  3567. watcher.update = function () { return queueWatcher(watcher); };
  3568. }
  3569. else {
  3570. // pre
  3571. watcher.update = function () {
  3572. if (instance && instance === currentInstance && !instance._isMounted) {
  3573. // pre-watcher triggered before
  3574. var buffer = instance._preWatchers || (instance._preWatchers = []);
  3575. if (buffer.indexOf(watcher) < 0)
  3576. buffer.push(watcher);
  3577. }
  3578. else {
  3579. queueWatcher(watcher);
  3580. }
  3581. };
  3582. }
  3583. if (process.env.NODE_ENV !== 'production') {
  3584. watcher.onTrack = onTrack;
  3585. watcher.onTrigger = onTrigger;
  3586. }
  3587. // initial run
  3588. if (cb) {
  3589. if (immediate) {
  3590. watcher.run();
  3591. }
  3592. else {
  3593. oldValue = watcher.get();
  3594. }
  3595. }
  3596. else if (flush === 'post' && instance) {
  3597. instance.$once('hook:mounted', function () { return watcher.get(); });
  3598. }
  3599. else {
  3600. watcher.get();
  3601. }
  3602. return function () {
  3603. watcher.teardown();
  3604. };
  3605. }
  3606. function provide(key, value) {
  3607. if (!currentInstance) {
  3608. if (process.env.NODE_ENV !== 'production') {
  3609. warn$2("provide() can only be used inside setup().");
  3610. }
  3611. }
  3612. else {
  3613. // TS doesn't allow symbol as index type
  3614. resolveProvided(currentInstance)[key] = value;
  3615. }
  3616. }
  3617. function resolveProvided(vm) {
  3618. // by default an instance inherits its parent's provides object
  3619. // but when it needs to provide values of its own, it creates its
  3620. // own provides object using parent provides object as prototype.
  3621. // this way in `inject` we can simply look up injections from direct
  3622. // parent and let the prototype chain do the work.
  3623. var existing = vm._provided;
  3624. var parentProvides = vm.$parent && vm.$parent._provided;
  3625. if (parentProvides === existing) {
  3626. return (vm._provided = Object.create(parentProvides));
  3627. }
  3628. else {
  3629. return existing;
  3630. }
  3631. }
  3632. function inject(key, defaultValue, treatDefaultAsFactory) {
  3633. if (treatDefaultAsFactory === void 0) { treatDefaultAsFactory = false; }
  3634. // fallback to `currentRenderingInstance` so that this can be called in
  3635. // a functional component
  3636. var instance = currentInstance;
  3637. if (instance) {
  3638. // #2400
  3639. // to support `app.use` plugins,
  3640. // fallback to appContext's `provides` if the instance is at root
  3641. var provides = instance.$parent && instance.$parent._provided;
  3642. if (provides && key in provides) {
  3643. // TS doesn't allow symbol as index type
  3644. return provides[key];
  3645. }
  3646. else if (arguments.length > 1) {
  3647. return treatDefaultAsFactory && isFunction(defaultValue)
  3648. ? defaultValue.call(instance)
  3649. : defaultValue;
  3650. }
  3651. else if (process.env.NODE_ENV !== 'production') {
  3652. warn$2("injection \"".concat(String(key), "\" not found."));
  3653. }
  3654. }
  3655. else if (process.env.NODE_ENV !== 'production') {
  3656. warn$2("inject() can only be used inside setup() or functional components.");
  3657. }
  3658. }
  3659. /**
  3660. * @internal this function needs manual public type declaration because it relies
  3661. * on previously manually authored types from Vue 2
  3662. */
  3663. function h(type, props, children) {
  3664. if (!currentInstance) {
  3665. process.env.NODE_ENV !== 'production' &&
  3666. warn$2("globally imported h() can only be invoked when there is an active " +
  3667. "component instance, e.g. synchronously in a component's render or setup function.");
  3668. }
  3669. return createElement$1(currentInstance, type, props, children, 2, true);
  3670. }
  3671. function handleError(err, vm, info) {
  3672. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  3673. // See: https://github.com/vuejs/vuex/issues/1505
  3674. pushTarget();
  3675. try {
  3676. if (vm) {
  3677. var cur = vm;
  3678. while ((cur = cur.$parent)) {
  3679. var hooks = cur.$options.errorCaptured;
  3680. if (hooks) {
  3681. for (var i = 0; i < hooks.length; i++) {
  3682. try {
  3683. var capture = hooks[i].call(cur, err, vm, info) === false;
  3684. if (capture)
  3685. return;
  3686. }
  3687. catch (e) {
  3688. globalHandleError(e, cur, 'errorCaptured hook');
  3689. }
  3690. }
  3691. }
  3692. }
  3693. }
  3694. globalHandleError(err, vm, info);
  3695. }
  3696. finally {
  3697. popTarget();
  3698. }
  3699. }
  3700. function invokeWithErrorHandling(handler, context, args, vm, info) {
  3701. var res;
  3702. try {
  3703. res = args ? handler.apply(context, args) : handler.call(context);
  3704. if (res && !res._isVue && isPromise(res) && !res._handled) {
  3705. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  3706. res._handled = true;
  3707. }
  3708. }
  3709. catch (e) {
  3710. handleError(e, vm, info);
  3711. }
  3712. return res;
  3713. }
  3714. function globalHandleError(err, vm, info) {
  3715. if (config.errorHandler) {
  3716. try {
  3717. return config.errorHandler.call(null, err, vm, info);
  3718. }
  3719. catch (e) {
  3720. // if the user intentionally throws the original error in the handler,
  3721. // do not log it twice
  3722. if (e !== err) {
  3723. logError(e, null, 'config.errorHandler');
  3724. }
  3725. }
  3726. }
  3727. logError(err, vm, info);
  3728. }
  3729. function logError(err, vm, info) {
  3730. if (process.env.NODE_ENV !== 'production') {
  3731. warn$2("Error in ".concat(info, ": \"").concat(err.toString(), "\""), vm);
  3732. }
  3733. /* istanbul ignore else */
  3734. if (inBrowser && typeof console !== 'undefined') {
  3735. console.error(err);
  3736. }
  3737. else {
  3738. throw err;
  3739. }
  3740. }
  3741. /* globals MutationObserver */
  3742. var isUsingMicroTask = false;
  3743. var callbacks = [];
  3744. var pending = false;
  3745. function flushCallbacks() {
  3746. pending = false;
  3747. var copies = callbacks.slice(0);
  3748. callbacks.length = 0;
  3749. for (var i = 0; i < copies.length; i++) {
  3750. copies[i]();
  3751. }
  3752. }
  3753. // Here we have async deferring wrappers using microtasks.
  3754. // In 2.5 we used (macro) tasks (in combination with microtasks).
  3755. // However, it has subtle problems when state is changed right before repaint
  3756. // (e.g. #6813, out-in transitions).
  3757. // Also, using (macro) tasks in event handler would cause some weird behaviors
  3758. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  3759. // So we now use microtasks everywhere, again.
  3760. // A major drawback of this tradeoff is that there are some scenarios
  3761. // where microtasks have too high a priority and fire in between supposedly
  3762. // sequential events (e.g. #4521, #6690, which have workarounds)
  3763. // or even between bubbling of the same event (#6566).
  3764. var timerFunc;
  3765. // The nextTick behavior leverages the microtask queue, which can be accessed
  3766. // via either native Promise.then or MutationObserver.
  3767. // MutationObserver has wider support, however it is seriously bugged in
  3768. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  3769. // completely stops working after triggering a few times... so, if native
  3770. // Promise is available, we will use it:
  3771. /* istanbul ignore next, $flow-disable-line */
  3772. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  3773. var p_1 = Promise.resolve();
  3774. timerFunc = function () {
  3775. p_1.then(flushCallbacks);
  3776. // In problematic UIWebViews, Promise.then doesn't completely break, but
  3777. // it can get stuck in a weird state where callbacks are pushed into the
  3778. // microtask queue but the queue isn't being flushed, until the browser
  3779. // needs to do some other work, e.g. handle a timer. Therefore we can
  3780. // "force" the microtask queue to be flushed by adding an empty timer.
  3781. if (isIOS)
  3782. setTimeout(noop);
  3783. };
  3784. isUsingMicroTask = true;
  3785. }
  3786. else if (!isIE &&
  3787. typeof MutationObserver !== 'undefined' &&
  3788. (isNative(MutationObserver) ||
  3789. // PhantomJS and iOS 7.x
  3790. MutationObserver.toString() === '[object MutationObserverConstructor]')) {
  3791. // Use MutationObserver where native Promise is not available,
  3792. // e.g. PhantomJS, iOS7, Android 4.4
  3793. // (#6466 MutationObserver is unreliable in IE11)
  3794. var counter_1 = 1;
  3795. var observer = new MutationObserver(flushCallbacks);
  3796. var textNode_1 = document.createTextNode(String(counter_1));
  3797. observer.observe(textNode_1, {
  3798. characterData: true
  3799. });
  3800. timerFunc = function () {
  3801. counter_1 = (counter_1 + 1) % 2;
  3802. textNode_1.data = String(counter_1);
  3803. };
  3804. isUsingMicroTask = true;
  3805. }
  3806. else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  3807. // Fallback to setImmediate.
  3808. // Technically it leverages the (macro) task queue,
  3809. // but it is still a better choice than setTimeout.
  3810. timerFunc = function () {
  3811. setImmediate(flushCallbacks);
  3812. };
  3813. }
  3814. else {
  3815. // Fallback to setTimeout.
  3816. timerFunc = function () {
  3817. setTimeout(flushCallbacks, 0);
  3818. };
  3819. }
  3820. /**
  3821. * @internal
  3822. */
  3823. function nextTick(cb, ctx) {
  3824. var _resolve;
  3825. callbacks.push(function () {
  3826. if (cb) {
  3827. try {
  3828. cb.call(ctx);
  3829. }
  3830. catch (e) {
  3831. handleError(e, ctx, 'nextTick');
  3832. }
  3833. }
  3834. else if (_resolve) {
  3835. _resolve(ctx);
  3836. }
  3837. });
  3838. if (!pending) {
  3839. pending = true;
  3840. timerFunc();
  3841. }
  3842. // $flow-disable-line
  3843. if (!cb && typeof Promise !== 'undefined') {
  3844. return new Promise(function (resolve) {
  3845. _resolve = resolve;
  3846. });
  3847. }
  3848. }
  3849. function useCssModule(name) {
  3850. if (name === void 0) { name = '$style'; }
  3851. /* istanbul ignore else */
  3852. {
  3853. if (!currentInstance) {
  3854. process.env.NODE_ENV !== 'production' && warn$2("useCssModule must be called inside setup()");
  3855. return emptyObject;
  3856. }
  3857. var mod = currentInstance[name];
  3858. if (!mod) {
  3859. process.env.NODE_ENV !== 'production' &&
  3860. warn$2("Current instance does not have CSS module named \"".concat(name, "\"."));
  3861. return emptyObject;
  3862. }
  3863. return mod;
  3864. }
  3865. }
  3866. /**
  3867. * Runtime helper for SFC's CSS variable injection feature.
  3868. * @private
  3869. */
  3870. function useCssVars(getter) {
  3871. if (!inBrowser && !false)
  3872. return;
  3873. var instance = currentInstance;
  3874. if (!instance) {
  3875. process.env.NODE_ENV !== 'production' &&
  3876. warn$2("useCssVars is called without current active component instance.");
  3877. return;
  3878. }
  3879. watchPostEffect(function () {
  3880. var el = instance.$el;
  3881. var vars = getter(instance, instance._setupProxy);
  3882. if (el && el.nodeType === 1) {
  3883. var style = el.style;
  3884. for (var key in vars) {
  3885. style.setProperty("--".concat(key), vars[key]);
  3886. }
  3887. }
  3888. });
  3889. }
  3890. /**
  3891. * v3-compatible async component API.
  3892. * @internal the type is manually declared in <root>/types/v3-define-async-component.d.ts
  3893. * because it relies on existing manual types
  3894. */
  3895. function defineAsyncComponent(source) {
  3896. if (isFunction(source)) {
  3897. source = { loader: source };
  3898. }
  3899. 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
  3900. _b = source.suspensible, // undefined = never times out
  3901. suspensible = _b === void 0 ? false : _b, // in Vue 3 default is true
  3902. userOnError = source.onError;
  3903. if (process.env.NODE_ENV !== 'production' && suspensible) {
  3904. warn$2("The suspensible option for async components is not supported in Vue2. It is ignored.");
  3905. }
  3906. var pendingRequest = null;
  3907. var retries = 0;
  3908. var retry = function () {
  3909. retries++;
  3910. pendingRequest = null;
  3911. return load();
  3912. };
  3913. var load = function () {
  3914. var thisRequest;
  3915. return (pendingRequest ||
  3916. (thisRequest = pendingRequest =
  3917. loader()
  3918. .catch(function (err) {
  3919. err = err instanceof Error ? err : new Error(String(err));
  3920. if (userOnError) {
  3921. return new Promise(function (resolve, reject) {
  3922. var userRetry = function () { return resolve(retry()); };
  3923. var userFail = function () { return reject(err); };
  3924. userOnError(err, userRetry, userFail, retries + 1);
  3925. });
  3926. }
  3927. else {
  3928. throw err;
  3929. }
  3930. })
  3931. .then(function (comp) {
  3932. if (thisRequest !== pendingRequest && pendingRequest) {
  3933. return pendingRequest;
  3934. }
  3935. if (process.env.NODE_ENV !== 'production' && !comp) {
  3936. warn$2("Async component loader resolved to undefined. " +
  3937. "If you are using retry(), make sure to return its return value.");
  3938. }
  3939. // interop module default
  3940. if (comp &&
  3941. (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
  3942. comp = comp.default;
  3943. }
  3944. if (process.env.NODE_ENV !== 'production' && comp && !isObject(comp) && !isFunction(comp)) {
  3945. throw new Error("Invalid async component load result: ".concat(comp));
  3946. }
  3947. return comp;
  3948. })));
  3949. };
  3950. return function () {
  3951. var component = load();
  3952. return {
  3953. component: component,
  3954. delay: delay,
  3955. timeout: timeout,
  3956. error: errorComponent,
  3957. loading: loadingComponent
  3958. };
  3959. };
  3960. }
  3961. function createLifeCycle(hookName) {
  3962. return function (fn, target) {
  3963. if (target === void 0) { target = currentInstance; }
  3964. if (!target) {
  3965. process.env.NODE_ENV !== 'production' &&
  3966. warn$2("".concat(formatName(hookName), " is called when there is no active component instance to be ") +
  3967. "associated with. " +
  3968. "Lifecycle injection APIs can only be used during execution of setup().");
  3969. return;
  3970. }
  3971. return injectHook(target, hookName, fn);
  3972. };
  3973. }
  3974. function formatName(name) {
  3975. if (name === 'beforeDestroy') {
  3976. name = 'beforeUnmount';
  3977. }
  3978. else if (name === 'destroyed') {
  3979. name = 'unmounted';
  3980. }
  3981. return "on".concat(name[0].toUpperCase() + name.slice(1));
  3982. }
  3983. function injectHook(instance, hookName, fn) {
  3984. var options = instance.$options;
  3985. options[hookName] = mergeLifecycleHook(options[hookName], fn);
  3986. }
  3987. var onBeforeMount = createLifeCycle('beforeMount');
  3988. var onMounted = createLifeCycle('mounted');
  3989. var onBeforeUpdate = createLifeCycle('beforeUpdate');
  3990. var onUpdated = createLifeCycle('updated');
  3991. var onBeforeUnmount = createLifeCycle('beforeDestroy');
  3992. var onUnmounted = createLifeCycle('destroyed');
  3993. var onActivated = createLifeCycle('activated');
  3994. var onDeactivated = createLifeCycle('deactivated');
  3995. var onServerPrefetch = createLifeCycle('serverPrefetch');
  3996. var onRenderTracked = createLifeCycle('renderTracked');
  3997. var onRenderTriggered = createLifeCycle('renderTriggered');
  3998. var injectErrorCapturedHook = createLifeCycle('errorCaptured');
  3999. function onErrorCaptured(hook, target) {
  4000. if (target === void 0) { target = currentInstance; }
  4001. injectErrorCapturedHook(hook, target);
  4002. }
  4003. /**
  4004. * Note: also update dist/vue.runtime.mjs when adding new exports to this file.
  4005. */
  4006. var version = '2.7.16';
  4007. /**
  4008. * @internal type is manually declared in <root>/types/v3-define-component.d.ts
  4009. */
  4010. function defineComponent(options) {
  4011. return options;
  4012. }
  4013. var seenObjects = new _Set();
  4014. /**
  4015. * Recursively traverse an object to evoke all converted
  4016. * getters, so that every nested property inside the object
  4017. * is collected as a "deep" dependency.
  4018. */
  4019. function traverse(val) {
  4020. _traverse(val, seenObjects);
  4021. seenObjects.clear();
  4022. return val;
  4023. }
  4024. function _traverse(val, seen) {
  4025. var i, keys;
  4026. var isA = isArray(val);
  4027. if ((!isA && !isObject(val)) ||
  4028. val.__v_skip /* ReactiveFlags.SKIP */ ||
  4029. Object.isFrozen(val) ||
  4030. val instanceof VNode) {
  4031. return;
  4032. }
  4033. if (val.__ob__) {
  4034. var depId = val.__ob__.dep.id;
  4035. if (seen.has(depId)) {
  4036. return;
  4037. }
  4038. seen.add(depId);
  4039. }
  4040. if (isA) {
  4041. i = val.length;
  4042. while (i--)
  4043. _traverse(val[i], seen);
  4044. }
  4045. else if (isRef(val)) {
  4046. _traverse(val.value, seen);
  4047. }
  4048. else {
  4049. keys = Object.keys(val);
  4050. i = keys.length;
  4051. while (i--)
  4052. _traverse(val[keys[i]], seen);
  4053. }
  4054. }
  4055. var uid$1 = 0;
  4056. /**
  4057. * A watcher parses an expression, collects dependencies,
  4058. * and fires callback when the expression value changes.
  4059. * This is used for both the $watch() api and directives.
  4060. * @internal
  4061. */
  4062. var Watcher = /** @class */ (function () {
  4063. function Watcher(vm, expOrFn, cb, options, isRenderWatcher) {
  4064. recordEffectScope(this,
  4065. // if the active effect scope is manually created (not a component scope),
  4066. // prioritize it
  4067. activeEffectScope && !activeEffectScope._vm
  4068. ? activeEffectScope
  4069. : vm
  4070. ? vm._scope
  4071. : undefined);
  4072. if ((this.vm = vm) && isRenderWatcher) {
  4073. vm._watcher = this;
  4074. }
  4075. // options
  4076. if (options) {
  4077. this.deep = !!options.deep;
  4078. this.user = !!options.user;
  4079. this.lazy = !!options.lazy;
  4080. this.sync = !!options.sync;
  4081. this.before = options.before;
  4082. if (process.env.NODE_ENV !== 'production') {
  4083. this.onTrack = options.onTrack;
  4084. this.onTrigger = options.onTrigger;
  4085. }
  4086. }
  4087. else {
  4088. this.deep = this.user = this.lazy = this.sync = false;
  4089. }
  4090. this.cb = cb;
  4091. this.id = ++uid$1; // uid for batching
  4092. this.active = true;
  4093. this.post = false;
  4094. this.dirty = this.lazy; // for lazy watchers
  4095. this.deps = [];
  4096. this.newDeps = [];
  4097. this.depIds = new _Set();
  4098. this.newDepIds = new _Set();
  4099. this.expression = process.env.NODE_ENV !== 'production' ? expOrFn.toString() : '';
  4100. // parse expression for getter
  4101. if (isFunction(expOrFn)) {
  4102. this.getter = expOrFn;
  4103. }
  4104. else {
  4105. this.getter = parsePath(expOrFn);
  4106. if (!this.getter) {
  4107. this.getter = noop;
  4108. process.env.NODE_ENV !== 'production' &&
  4109. warn$2("Failed watching path: \"".concat(expOrFn, "\" ") +
  4110. 'Watcher only accepts simple dot-delimited paths. ' +
  4111. 'For full control, use a function instead.', vm);
  4112. }
  4113. }
  4114. this.value = this.lazy ? undefined : this.get();
  4115. }
  4116. /**
  4117. * Evaluate the getter, and re-collect dependencies.
  4118. */
  4119. Watcher.prototype.get = function () {
  4120. pushTarget(this);
  4121. var value;
  4122. var vm = this.vm;
  4123. try {
  4124. value = this.getter.call(vm, vm);
  4125. }
  4126. catch (e) {
  4127. if (this.user) {
  4128. handleError(e, vm, "getter for watcher \"".concat(this.expression, "\""));
  4129. }
  4130. else {
  4131. throw e;
  4132. }
  4133. }
  4134. finally {
  4135. // "touch" every property so they are all tracked as
  4136. // dependencies for deep watching
  4137. if (this.deep) {
  4138. traverse(value);
  4139. }
  4140. popTarget();
  4141. this.cleanupDeps();
  4142. }
  4143. return value;
  4144. };
  4145. /**
  4146. * Add a dependency to this directive.
  4147. */
  4148. Watcher.prototype.addDep = function (dep) {
  4149. var id = dep.id;
  4150. if (!this.newDepIds.has(id)) {
  4151. this.newDepIds.add(id);
  4152. this.newDeps.push(dep);
  4153. if (!this.depIds.has(id)) {
  4154. dep.addSub(this);
  4155. }
  4156. }
  4157. };
  4158. /**
  4159. * Clean up for dependency collection.
  4160. */
  4161. Watcher.prototype.cleanupDeps = function () {
  4162. var i = this.deps.length;
  4163. while (i--) {
  4164. var dep = this.deps[i];
  4165. if (!this.newDepIds.has(dep.id)) {
  4166. dep.removeSub(this);
  4167. }
  4168. }
  4169. var tmp = this.depIds;
  4170. this.depIds = this.newDepIds;
  4171. this.newDepIds = tmp;
  4172. this.newDepIds.clear();
  4173. tmp = this.deps;
  4174. this.deps = this.newDeps;
  4175. this.newDeps = tmp;
  4176. this.newDeps.length = 0;
  4177. };
  4178. /**
  4179. * Subscriber interface.
  4180. * Will be called when a dependency changes.
  4181. */
  4182. Watcher.prototype.update = function () {
  4183. /* istanbul ignore else */
  4184. if (this.lazy) {
  4185. this.dirty = true;
  4186. }
  4187. else if (this.sync) {
  4188. this.run();
  4189. }
  4190. else {
  4191. queueWatcher(this);
  4192. }
  4193. };
  4194. /**
  4195. * Scheduler job interface.
  4196. * Will be called by the scheduler.
  4197. */
  4198. Watcher.prototype.run = function () {
  4199. if (this.active) {
  4200. var value = this.get();
  4201. if (value !== this.value ||
  4202. // Deep watchers and watchers on Object/Arrays should fire even
  4203. // when the value is the same, because the value may
  4204. // have mutated.
  4205. isObject(value) ||
  4206. this.deep) {
  4207. // set new value
  4208. var oldValue = this.value;
  4209. this.value = value;
  4210. if (this.user) {
  4211. var info = "callback for watcher \"".concat(this.expression, "\"");
  4212. invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);
  4213. }
  4214. else {
  4215. this.cb.call(this.vm, value, oldValue);
  4216. }
  4217. }
  4218. }
  4219. };
  4220. /**
  4221. * Evaluate the value of the watcher.
  4222. * This only gets called for lazy watchers.
  4223. */
  4224. Watcher.prototype.evaluate = function () {
  4225. this.value = this.get();
  4226. this.dirty = false;
  4227. };
  4228. /**
  4229. * Depend on all deps collected by this watcher.
  4230. */
  4231. Watcher.prototype.depend = function () {
  4232. var i = this.deps.length;
  4233. while (i--) {
  4234. this.deps[i].depend();
  4235. }
  4236. };
  4237. /**
  4238. * Remove self from all dependencies' subscriber list.
  4239. */
  4240. Watcher.prototype.teardown = function () {
  4241. if (this.vm && !this.vm._isBeingDestroyed) {
  4242. remove$2(this.vm._scope.effects, this);
  4243. }
  4244. if (this.active) {
  4245. var i = this.deps.length;
  4246. while (i--) {
  4247. this.deps[i].removeSub(this);
  4248. }
  4249. this.active = false;
  4250. if (this.onStop) {
  4251. this.onStop();
  4252. }
  4253. }
  4254. };
  4255. return Watcher;
  4256. }());
  4257. var sharedPropertyDefinition = {
  4258. enumerable: true,
  4259. configurable: true,
  4260. get: noop,
  4261. set: noop
  4262. };
  4263. function proxy(target, sourceKey, key) {
  4264. sharedPropertyDefinition.get = function proxyGetter() {
  4265. return this[sourceKey][key];
  4266. };
  4267. sharedPropertyDefinition.set = function proxySetter(val) {
  4268. this[sourceKey][key] = val;
  4269. };
  4270. Object.defineProperty(target, key, sharedPropertyDefinition);
  4271. }
  4272. function initState(vm) {
  4273. var opts = vm.$options;
  4274. if (opts.props)
  4275. initProps$1(vm, opts.props);
  4276. // Composition API
  4277. initSetup(vm);
  4278. if (opts.methods)
  4279. initMethods(vm, opts.methods);
  4280. if (opts.data) {
  4281. initData(vm);
  4282. }
  4283. else {
  4284. var ob = observe((vm._data = {}));
  4285. ob && ob.vmCount++;
  4286. }
  4287. if (opts.computed)
  4288. initComputed$1(vm, opts.computed);
  4289. if (opts.watch && opts.watch !== nativeWatch) {
  4290. initWatch(vm, opts.watch);
  4291. }
  4292. }
  4293. function initProps$1(vm, propsOptions) {
  4294. var propsData = vm.$options.propsData || {};
  4295. var props = (vm._props = shallowReactive({}));
  4296. // cache prop keys so that future props updates can iterate using Array
  4297. // instead of dynamic object key enumeration.
  4298. var keys = (vm.$options._propKeys = []);
  4299. var isRoot = !vm.$parent;
  4300. // root instance props should be converted
  4301. if (!isRoot) {
  4302. toggleObserving(false);
  4303. }
  4304. var _loop_1 = function (key) {
  4305. keys.push(key);
  4306. var value = validateProp(key, propsOptions, propsData, vm);
  4307. /* istanbul ignore else */
  4308. if (process.env.NODE_ENV !== 'production') {
  4309. var hyphenatedKey = hyphenate(key);
  4310. if (isReservedAttribute(hyphenatedKey) ||
  4311. config.isReservedAttr(hyphenatedKey)) {
  4312. warn$2("\"".concat(hyphenatedKey, "\" is a reserved attribute and cannot be used as component prop."), vm);
  4313. }
  4314. defineReactive(props, key, value, function () {
  4315. if (!isRoot && !isUpdatingChildComponent) {
  4316. warn$2("Avoid mutating a prop directly since the value will be " +
  4317. "overwritten whenever the parent component re-renders. " +
  4318. "Instead, use a data or computed property based on the prop's " +
  4319. "value. Prop being mutated: \"".concat(key, "\""), vm);
  4320. }
  4321. }, true /* shallow */);
  4322. }
  4323. else {
  4324. defineReactive(props, key, value, undefined, true /* shallow */);
  4325. }
  4326. // static props are already proxied on the component's prototype
  4327. // during Vue.extend(). We only need to proxy props defined at
  4328. // instantiation here.
  4329. if (!(key in vm)) {
  4330. proxy(vm, "_props", key);
  4331. }
  4332. };
  4333. for (var key in propsOptions) {
  4334. _loop_1(key);
  4335. }
  4336. toggleObserving(true);
  4337. }
  4338. function initData(vm) {
  4339. var data = vm.$options.data;
  4340. data = vm._data = isFunction(data) ? getData(data, vm) : data || {};
  4341. if (!isPlainObject(data)) {
  4342. data = {};
  4343. process.env.NODE_ENV !== 'production' &&
  4344. warn$2('data functions should return an object:\n' +
  4345. 'https://v2.vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm);
  4346. }
  4347. // proxy data on instance
  4348. var keys = Object.keys(data);
  4349. var props = vm.$options.props;
  4350. var methods = vm.$options.methods;
  4351. var i = keys.length;
  4352. while (i--) {
  4353. var key = keys[i];
  4354. if (process.env.NODE_ENV !== 'production') {
  4355. if (methods && hasOwn(methods, key)) {
  4356. warn$2("Method \"".concat(key, "\" has already been defined as a data property."), vm);
  4357. }
  4358. }
  4359. if (props && hasOwn(props, key)) {
  4360. process.env.NODE_ENV !== 'production' &&
  4361. warn$2("The data property \"".concat(key, "\" is already declared as a prop. ") +
  4362. "Use prop default value instead.", vm);
  4363. }
  4364. else if (!isReserved(key)) {
  4365. proxy(vm, "_data", key);
  4366. }
  4367. }
  4368. // observe data
  4369. var ob = observe(data);
  4370. ob && ob.vmCount++;
  4371. }
  4372. function getData(data, vm) {
  4373. // #7573 disable dep collection when invoking data getters
  4374. pushTarget();
  4375. try {
  4376. return data.call(vm, vm);
  4377. }
  4378. catch (e) {
  4379. handleError(e, vm, "data()");
  4380. return {};
  4381. }
  4382. finally {
  4383. popTarget();
  4384. }
  4385. }
  4386. var computedWatcherOptions = { lazy: true };
  4387. function initComputed$1(vm, computed) {
  4388. // $flow-disable-line
  4389. var watchers = (vm._computedWatchers = Object.create(null));
  4390. // computed properties are just getters during SSR
  4391. var isSSR = isServerRendering();
  4392. for (var key in computed) {
  4393. var userDef = computed[key];
  4394. var getter = isFunction(userDef) ? userDef : userDef.get;
  4395. if (process.env.NODE_ENV !== 'production' && getter == null) {
  4396. warn$2("Getter is missing for computed property \"".concat(key, "\"."), vm);
  4397. }
  4398. if (!isSSR) {
  4399. // create internal watcher for the computed property.
  4400. watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);
  4401. }
  4402. // component-defined computed properties are already defined on the
  4403. // component prototype. We only need to define computed properties defined
  4404. // at instantiation here.
  4405. if (!(key in vm)) {
  4406. defineComputed(vm, key, userDef);
  4407. }
  4408. else if (process.env.NODE_ENV !== 'production') {
  4409. if (key in vm.$data) {
  4410. warn$2("The computed property \"".concat(key, "\" is already defined in data."), vm);
  4411. }
  4412. else if (vm.$options.props && key in vm.$options.props) {
  4413. warn$2("The computed property \"".concat(key, "\" is already defined as a prop."), vm);
  4414. }
  4415. else if (vm.$options.methods && key in vm.$options.methods) {
  4416. warn$2("The computed property \"".concat(key, "\" is already defined as a method."), vm);
  4417. }
  4418. }
  4419. }
  4420. }
  4421. function defineComputed(target, key, userDef) {
  4422. var shouldCache = !isServerRendering();
  4423. if (isFunction(userDef)) {
  4424. sharedPropertyDefinition.get = shouldCache
  4425. ? createComputedGetter(key)
  4426. : createGetterInvoker(userDef);
  4427. sharedPropertyDefinition.set = noop;
  4428. }
  4429. else {
  4430. sharedPropertyDefinition.get = userDef.get
  4431. ? shouldCache && userDef.cache !== false
  4432. ? createComputedGetter(key)
  4433. : createGetterInvoker(userDef.get)
  4434. : noop;
  4435. sharedPropertyDefinition.set = userDef.set || noop;
  4436. }
  4437. if (process.env.NODE_ENV !== 'production' && sharedPropertyDefinition.set === noop) {
  4438. sharedPropertyDefinition.set = function () {
  4439. warn$2("Computed property \"".concat(key, "\" was assigned to but it has no setter."), this);
  4440. };
  4441. }
  4442. Object.defineProperty(target, key, sharedPropertyDefinition);
  4443. }
  4444. function createComputedGetter(key) {
  4445. return function computedGetter() {
  4446. var watcher = this._computedWatchers && this._computedWatchers[key];
  4447. if (watcher) {
  4448. if (watcher.dirty) {
  4449. watcher.evaluate();
  4450. }
  4451. if (Dep.target) {
  4452. if (process.env.NODE_ENV !== 'production' && Dep.target.onTrack) {
  4453. Dep.target.onTrack({
  4454. effect: Dep.target,
  4455. target: this,
  4456. type: "get" /* TrackOpTypes.GET */,
  4457. key: key
  4458. });
  4459. }
  4460. watcher.depend();
  4461. }
  4462. return watcher.value;
  4463. }
  4464. };
  4465. }
  4466. function createGetterInvoker(fn) {
  4467. return function computedGetter() {
  4468. return fn.call(this, this);
  4469. };
  4470. }
  4471. function initMethods(vm, methods) {
  4472. var props = vm.$options.props;
  4473. for (var key in methods) {
  4474. if (process.env.NODE_ENV !== 'production') {
  4475. if (typeof methods[key] !== 'function') {
  4476. warn$2("Method \"".concat(key, "\" has type \"").concat(typeof methods[key], "\" in the component definition. ") +
  4477. "Did you reference the function correctly?", vm);
  4478. }
  4479. if (props && hasOwn(props, key)) {
  4480. warn$2("Method \"".concat(key, "\" has already been defined as a prop."), vm);
  4481. }
  4482. if (key in vm && isReserved(key)) {
  4483. warn$2("Method \"".concat(key, "\" conflicts with an existing Vue instance method. ") +
  4484. "Avoid defining component methods that start with _ or $.");
  4485. }
  4486. }
  4487. vm[key] = typeof methods[key] !== 'function' ? noop : bind$1(methods[key], vm);
  4488. }
  4489. }
  4490. function initWatch(vm, watch) {
  4491. for (var key in watch) {
  4492. var handler = watch[key];
  4493. if (isArray(handler)) {
  4494. for (var i = 0; i < handler.length; i++) {
  4495. createWatcher(vm, key, handler[i]);
  4496. }
  4497. }
  4498. else {
  4499. createWatcher(vm, key, handler);
  4500. }
  4501. }
  4502. }
  4503. function createWatcher(vm, expOrFn, handler, options) {
  4504. if (isPlainObject(handler)) {
  4505. options = handler;
  4506. handler = handler.handler;
  4507. }
  4508. if (typeof handler === 'string') {
  4509. handler = vm[handler];
  4510. }
  4511. return vm.$watch(expOrFn, handler, options);
  4512. }
  4513. function stateMixin(Vue) {
  4514. // flow somehow has problems with directly declared definition object
  4515. // when using Object.defineProperty, so we have to procedurally build up
  4516. // the object here.
  4517. var dataDef = {};
  4518. dataDef.get = function () {
  4519. return this._data;
  4520. };
  4521. var propsDef = {};
  4522. propsDef.get = function () {
  4523. return this._props;
  4524. };
  4525. if (process.env.NODE_ENV !== 'production') {
  4526. dataDef.set = function () {
  4527. warn$2('Avoid replacing instance root $data. ' +
  4528. 'Use nested data properties instead.', this);
  4529. };
  4530. propsDef.set = function () {
  4531. warn$2("$props is readonly.", this);
  4532. };
  4533. }
  4534. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4535. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4536. Vue.prototype.$set = set;
  4537. Vue.prototype.$delete = del;
  4538. Vue.prototype.$watch = function (expOrFn, cb, options) {
  4539. var vm = this;
  4540. if (isPlainObject(cb)) {
  4541. return createWatcher(vm, expOrFn, cb, options);
  4542. }
  4543. options = options || {};
  4544. options.user = true;
  4545. var watcher = new Watcher(vm, expOrFn, cb, options);
  4546. if (options.immediate) {
  4547. var info = "callback for immediate watcher \"".concat(watcher.expression, "\"");
  4548. pushTarget();
  4549. invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
  4550. popTarget();
  4551. }
  4552. return function unwatchFn() {
  4553. watcher.teardown();
  4554. };
  4555. };
  4556. }
  4557. function initProvide(vm) {
  4558. var provideOption = vm.$options.provide;
  4559. if (provideOption) {
  4560. var provided = isFunction(provideOption)
  4561. ? provideOption.call(vm)
  4562. : provideOption;
  4563. if (!isObject(provided)) {
  4564. return;
  4565. }
  4566. var source = resolveProvided(vm);
  4567. // IE9 doesn't support Object.getOwnPropertyDescriptors so we have to
  4568. // iterate the keys ourselves.
  4569. var keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided);
  4570. for (var i = 0; i < keys.length; i++) {
  4571. var key = keys[i];
  4572. Object.defineProperty(source, key, Object.getOwnPropertyDescriptor(provided, key));
  4573. }
  4574. }
  4575. }
  4576. function initInjections(vm) {
  4577. var result = resolveInject(vm.$options.inject, vm);
  4578. if (result) {
  4579. toggleObserving(false);
  4580. Object.keys(result).forEach(function (key) {
  4581. /* istanbul ignore else */
  4582. if (process.env.NODE_ENV !== 'production') {
  4583. defineReactive(vm, key, result[key], function () {
  4584. warn$2("Avoid mutating an injected value directly since the changes will be " +
  4585. "overwritten whenever the provided component re-renders. " +
  4586. "injection being mutated: \"".concat(key, "\""), vm);
  4587. });
  4588. }
  4589. else {
  4590. defineReactive(vm, key, result[key]);
  4591. }
  4592. });
  4593. toggleObserving(true);
  4594. }
  4595. }
  4596. function resolveInject(inject, vm) {
  4597. if (inject) {
  4598. // inject is :any because flow is not smart enough to figure out cached
  4599. var result = Object.create(null);
  4600. var keys = hasSymbol ? Reflect.ownKeys(inject) : Object.keys(inject);
  4601. for (var i = 0; i < keys.length; i++) {
  4602. var key = keys[i];
  4603. // #6574 in case the inject object is observed...
  4604. if (key === '__ob__')
  4605. continue;
  4606. var provideKey = inject[key].from;
  4607. if (provideKey in vm._provided) {
  4608. result[key] = vm._provided[provideKey];
  4609. }
  4610. else if ('default' in inject[key]) {
  4611. var provideDefault = inject[key].default;
  4612. result[key] = isFunction(provideDefault)
  4613. ? provideDefault.call(vm)
  4614. : provideDefault;
  4615. }
  4616. else if (process.env.NODE_ENV !== 'production') {
  4617. warn$2("Injection \"".concat(key, "\" not found"), vm);
  4618. }
  4619. }
  4620. return result;
  4621. }
  4622. }
  4623. var uid = 0;
  4624. function initMixin$1(Vue) {
  4625. Vue.prototype._init = function (options) {
  4626. var vm = this;
  4627. // a uid
  4628. vm._uid = uid++;
  4629. var startTag, endTag;
  4630. /* istanbul ignore if */
  4631. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  4632. startTag = "vue-perf-start:".concat(vm._uid);
  4633. endTag = "vue-perf-end:".concat(vm._uid);
  4634. mark(startTag);
  4635. }
  4636. // a flag to mark this as a Vue instance without having to do instanceof
  4637. // check
  4638. vm._isVue = true;
  4639. // avoid instances from being observed
  4640. vm.__v_skip = true;
  4641. // effect scope
  4642. vm._scope = new EffectScope(true /* detached */);
  4643. // #13134 edge case where a child component is manually created during the
  4644. // render of a parent component
  4645. vm._scope.parent = undefined;
  4646. vm._scope._vm = true;
  4647. // merge options
  4648. if (options && options._isComponent) {
  4649. // optimize internal component instantiation
  4650. // since dynamic options merging is pretty slow, and none of the
  4651. // internal component options needs special treatment.
  4652. initInternalComponent(vm, options);
  4653. }
  4654. else {
  4655. vm.$options = mergeOptions(resolveConstructorOptions(vm.constructor), options || {}, vm);
  4656. }
  4657. /* istanbul ignore else */
  4658. if (process.env.NODE_ENV !== 'production') {
  4659. initProxy(vm);
  4660. }
  4661. else {
  4662. vm._renderProxy = vm;
  4663. }
  4664. // expose real self
  4665. vm._self = vm;
  4666. initLifecycle(vm);
  4667. initEvents(vm);
  4668. initRender(vm);
  4669. callHook$1(vm, 'beforeCreate', undefined, false /* setContext */);
  4670. initInjections(vm); // resolve injections before data/props
  4671. initState(vm);
  4672. initProvide(vm); // resolve provide after data/props
  4673. callHook$1(vm, 'created');
  4674. /* istanbul ignore if */
  4675. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  4676. vm._name = formatComponentName(vm, false);
  4677. mark(endTag);
  4678. measure("vue ".concat(vm._name, " init"), startTag, endTag);
  4679. }
  4680. if (vm.$options.el) {
  4681. vm.$mount(vm.$options.el);
  4682. }
  4683. };
  4684. }
  4685. function initInternalComponent(vm, options) {
  4686. var opts = (vm.$options = Object.create(vm.constructor.options));
  4687. // doing this because it's faster than dynamic enumeration.
  4688. var parentVnode = options._parentVnode;
  4689. opts.parent = options.parent;
  4690. opts._parentVnode = parentVnode;
  4691. var vnodeComponentOptions = parentVnode.componentOptions;
  4692. opts.propsData = vnodeComponentOptions.propsData;
  4693. opts._parentListeners = vnodeComponentOptions.listeners;
  4694. opts._renderChildren = vnodeComponentOptions.children;
  4695. opts._componentTag = vnodeComponentOptions.tag;
  4696. if (options.render) {
  4697. opts.render = options.render;
  4698. opts.staticRenderFns = options.staticRenderFns;
  4699. }
  4700. }
  4701. function resolveConstructorOptions(Ctor) {
  4702. var options = Ctor.options;
  4703. if (Ctor.super) {
  4704. var superOptions = resolveConstructorOptions(Ctor.super);
  4705. var cachedSuperOptions = Ctor.superOptions;
  4706. if (superOptions !== cachedSuperOptions) {
  4707. // super option changed,
  4708. // need to resolve new options.
  4709. Ctor.superOptions = superOptions;
  4710. // check if there are any late-modified/attached options (#4976)
  4711. var modifiedOptions = resolveModifiedOptions(Ctor);
  4712. // update base extend options
  4713. if (modifiedOptions) {
  4714. extend(Ctor.extendOptions, modifiedOptions);
  4715. }
  4716. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4717. if (options.name) {
  4718. options.components[options.name] = Ctor;
  4719. }
  4720. }
  4721. }
  4722. return options;
  4723. }
  4724. function resolveModifiedOptions(Ctor) {
  4725. var modified;
  4726. var latest = Ctor.options;
  4727. var sealed = Ctor.sealedOptions;
  4728. for (var key in latest) {
  4729. if (latest[key] !== sealed[key]) {
  4730. if (!modified)
  4731. modified = {};
  4732. modified[key] = latest[key];
  4733. }
  4734. }
  4735. return modified;
  4736. }
  4737. function FunctionalRenderContext(data, props, children, parent, Ctor) {
  4738. var _this = this;
  4739. var options = Ctor.options;
  4740. // ensure the createElement function in functional components
  4741. // gets a unique context - this is necessary for correct named slot check
  4742. var contextVm;
  4743. if (hasOwn(parent, '_uid')) {
  4744. contextVm = Object.create(parent);
  4745. contextVm._original = parent;
  4746. }
  4747. else {
  4748. // the context vm passed in is a functional context as well.
  4749. // in this case we want to make sure we are able to get a hold to the
  4750. // real context instance.
  4751. contextVm = parent;
  4752. // @ts-ignore
  4753. parent = parent._original;
  4754. }
  4755. var isCompiled = isTrue(options._compiled);
  4756. var needNormalization = !isCompiled;
  4757. this.data = data;
  4758. this.props = props;
  4759. this.children = children;
  4760. this.parent = parent;
  4761. this.listeners = data.on || emptyObject;
  4762. this.injections = resolveInject(options.inject, parent);
  4763. this.slots = function () {
  4764. if (!_this.$slots) {
  4765. normalizeScopedSlots(parent, data.scopedSlots, (_this.$slots = resolveSlots(children, parent)));
  4766. }
  4767. return _this.$slots;
  4768. };
  4769. Object.defineProperty(this, 'scopedSlots', {
  4770. enumerable: true,
  4771. get: function () {
  4772. return normalizeScopedSlots(parent, data.scopedSlots, this.slots());
  4773. }
  4774. });
  4775. // support for compiled functional template
  4776. if (isCompiled) {
  4777. // exposing $options for renderStatic()
  4778. this.$options = options;
  4779. // pre-resolve slots for renderSlot()
  4780. this.$slots = this.slots();
  4781. this.$scopedSlots = normalizeScopedSlots(parent, data.scopedSlots, this.$slots);
  4782. }
  4783. if (options._scopeId) {
  4784. this._c = function (a, b, c, d) {
  4785. var vnode = createElement$1(contextVm, a, b, c, d, needNormalization);
  4786. if (vnode && !isArray(vnode)) {
  4787. vnode.fnScopeId = options._scopeId;
  4788. vnode.fnContext = parent;
  4789. }
  4790. return vnode;
  4791. };
  4792. }
  4793. else {
  4794. this._c = function (a, b, c, d) {
  4795. return createElement$1(contextVm, a, b, c, d, needNormalization);
  4796. };
  4797. }
  4798. }
  4799. installRenderHelpers(FunctionalRenderContext.prototype);
  4800. function createFunctionalComponent(Ctor, propsData, data, contextVm, children) {
  4801. var options = Ctor.options;
  4802. var props = {};
  4803. var propOptions = options.props;
  4804. if (isDef(propOptions)) {
  4805. for (var key in propOptions) {
  4806. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  4807. }
  4808. }
  4809. else {
  4810. if (isDef(data.attrs))
  4811. mergeProps(props, data.attrs);
  4812. if (isDef(data.props))
  4813. mergeProps(props, data.props);
  4814. }
  4815. var renderContext = new FunctionalRenderContext(data, props, children, contextVm, Ctor);
  4816. var vnode = options.render.call(null, renderContext._c, renderContext);
  4817. if (vnode instanceof VNode) {
  4818. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext);
  4819. }
  4820. else if (isArray(vnode)) {
  4821. var vnodes = normalizeChildren(vnode) || [];
  4822. var res = new Array(vnodes.length);
  4823. for (var i = 0; i < vnodes.length; i++) {
  4824. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  4825. }
  4826. return res;
  4827. }
  4828. }
  4829. function cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) {
  4830. // #7817 clone node before setting fnContext, otherwise if the node is reused
  4831. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  4832. // that should not be matched to match.
  4833. var clone = cloneVNode(vnode);
  4834. clone.fnContext = contextVm;
  4835. clone.fnOptions = options;
  4836. if (process.env.NODE_ENV !== 'production') {
  4837. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext =
  4838. renderContext;
  4839. }
  4840. if (data.slot) {
  4841. (clone.data || (clone.data = {})).slot = data.slot;
  4842. }
  4843. return clone;
  4844. }
  4845. function mergeProps(to, from) {
  4846. for (var key in from) {
  4847. to[camelize(key)] = from[key];
  4848. }
  4849. }
  4850. function getComponentName(options) {
  4851. return options.name || options.__name || options._componentTag;
  4852. }
  4853. // inline hooks to be invoked on component VNodes during patch
  4854. var componentVNodeHooks = {
  4855. init: function (vnode, hydrating) {
  4856. if (vnode.componentInstance &&
  4857. !vnode.componentInstance._isDestroyed &&
  4858. vnode.data.keepAlive) {
  4859. // kept-alive components, treat as a patch
  4860. var mountedNode = vnode; // work around flow
  4861. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  4862. }
  4863. else {
  4864. var child = (vnode.componentInstance = createComponentInstanceForVnode(vnode, activeInstance));
  4865. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  4866. }
  4867. },
  4868. prepatch: function (oldVnode, vnode) {
  4869. var options = vnode.componentOptions;
  4870. var child = (vnode.componentInstance = oldVnode.componentInstance);
  4871. updateChildComponent(child, options.propsData, // updated props
  4872. options.listeners, // updated listeners
  4873. vnode, // new parent vnode
  4874. options.children // new children
  4875. );
  4876. },
  4877. insert: function (vnode) {
  4878. var context = vnode.context, componentInstance = vnode.componentInstance;
  4879. if (!componentInstance._isMounted) {
  4880. componentInstance._isMounted = true;
  4881. callHook$1(componentInstance, 'mounted');
  4882. }
  4883. if (vnode.data.keepAlive) {
  4884. if (context._isMounted) {
  4885. // vue-router#1212
  4886. // During updates, a kept-alive component's child components may
  4887. // change, so directly walking the tree here may call activated hooks
  4888. // on incorrect children. Instead we push them into a queue which will
  4889. // be processed after the whole patch process ended.
  4890. queueActivatedComponent(componentInstance);
  4891. }
  4892. else {
  4893. activateChildComponent(componentInstance, true /* direct */);
  4894. }
  4895. }
  4896. },
  4897. destroy: function (vnode) {
  4898. var componentInstance = vnode.componentInstance;
  4899. if (!componentInstance._isDestroyed) {
  4900. if (!vnode.data.keepAlive) {
  4901. componentInstance.$destroy();
  4902. }
  4903. else {
  4904. deactivateChildComponent(componentInstance, true /* direct */);
  4905. }
  4906. }
  4907. }
  4908. };
  4909. var hooksToMerge = Object.keys(componentVNodeHooks);
  4910. function createComponent(Ctor, data, context, children, tag) {
  4911. if (isUndef(Ctor)) {
  4912. return;
  4913. }
  4914. var baseCtor = context.$options._base;
  4915. // plain options object: turn it into a constructor
  4916. if (isObject(Ctor)) {
  4917. Ctor = baseCtor.extend(Ctor);
  4918. }
  4919. // if at this stage it's not a constructor or an async component factory,
  4920. // reject.
  4921. if (typeof Ctor !== 'function') {
  4922. if (process.env.NODE_ENV !== 'production') {
  4923. warn$2("Invalid Component definition: ".concat(String(Ctor)), context);
  4924. }
  4925. return;
  4926. }
  4927. // async component
  4928. var asyncFactory;
  4929. // @ts-expect-error
  4930. if (isUndef(Ctor.cid)) {
  4931. asyncFactory = Ctor;
  4932. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  4933. if (Ctor === undefined) {
  4934. // return a placeholder node for async component, which is rendered
  4935. // as a comment node but preserves all the raw information for the node.
  4936. // the information will be used for async server-rendering and hydration.
  4937. return createAsyncPlaceholder(asyncFactory, data, context, children, tag);
  4938. }
  4939. }
  4940. data = data || {};
  4941. // resolve constructor options in case global mixins are applied after
  4942. // component constructor creation
  4943. resolveConstructorOptions(Ctor);
  4944. // transform component v-model data into props & events
  4945. if (isDef(data.model)) {
  4946. // @ts-expect-error
  4947. transformModel(Ctor.options, data);
  4948. }
  4949. // extract props
  4950. // @ts-expect-error
  4951. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  4952. // functional component
  4953. // @ts-expect-error
  4954. if (isTrue(Ctor.options.functional)) {
  4955. return createFunctionalComponent(Ctor, propsData, data, context, children);
  4956. }
  4957. // extract listeners, since these needs to be treated as
  4958. // child component listeners instead of DOM listeners
  4959. var listeners = data.on;
  4960. // replace with listeners with .native modifier
  4961. // so it gets processed during parent component patch.
  4962. data.on = data.nativeOn;
  4963. // @ts-expect-error
  4964. if (isTrue(Ctor.options.abstract)) {
  4965. // abstract components do not keep anything
  4966. // other than props & listeners & slot
  4967. // work around flow
  4968. var slot = data.slot;
  4969. data = {};
  4970. if (slot) {
  4971. data.slot = slot;
  4972. }
  4973. }
  4974. // install component management hooks onto the placeholder node
  4975. installComponentHooks(data);
  4976. // return a placeholder vnode
  4977. // @ts-expect-error
  4978. var name = getComponentName(Ctor.options) || tag;
  4979. var vnode = new VNode(
  4980. // @ts-expect-error
  4981. "vue-component-".concat(Ctor.cid).concat(name ? "-".concat(name) : ''), data, undefined, undefined, undefined, context,
  4982. // @ts-expect-error
  4983. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, asyncFactory);
  4984. return vnode;
  4985. }
  4986. function createComponentInstanceForVnode(
  4987. // we know it's MountedComponentVNode but flow doesn't
  4988. vnode,
  4989. // activeInstance in lifecycle state
  4990. parent) {
  4991. var options = {
  4992. _isComponent: true,
  4993. _parentVnode: vnode,
  4994. parent: parent
  4995. };
  4996. // check inline-template render functions
  4997. var inlineTemplate = vnode.data.inlineTemplate;
  4998. if (isDef(inlineTemplate)) {
  4999. options.render = inlineTemplate.render;
  5000. options.staticRenderFns = inlineTemplate.staticRenderFns;
  5001. }
  5002. return new vnode.componentOptions.Ctor(options);
  5003. }
  5004. function installComponentHooks(data) {
  5005. var hooks = data.hook || (data.hook = {});
  5006. for (var i = 0; i < hooksToMerge.length; i++) {
  5007. var key = hooksToMerge[i];
  5008. var existing = hooks[key];
  5009. var toMerge = componentVNodeHooks[key];
  5010. // @ts-expect-error
  5011. if (existing !== toMerge && !(existing && existing._merged)) {
  5012. hooks[key] = existing ? mergeHook(toMerge, existing) : toMerge;
  5013. }
  5014. }
  5015. }
  5016. function mergeHook(f1, f2) {
  5017. var merged = function (a, b) {
  5018. // flow complains about extra args which is why we use any
  5019. f1(a, b);
  5020. f2(a, b);
  5021. };
  5022. merged._merged = true;
  5023. return merged;
  5024. }
  5025. // transform component v-model info (value and callback) into
  5026. // prop and event handler respectively.
  5027. function transformModel(options, data) {
  5028. var prop = (options.model && options.model.prop) || 'value';
  5029. var event = (options.model && options.model.event) || 'input';
  5030. (data.attrs || (data.attrs = {}))[prop] = data.model.value;
  5031. var on = data.on || (data.on = {});
  5032. var existing = on[event];
  5033. var callback = data.model.callback;
  5034. if (isDef(existing)) {
  5035. if (isArray(existing)
  5036. ? existing.indexOf(callback) === -1
  5037. : existing !== callback) {
  5038. on[event] = [callback].concat(existing);
  5039. }
  5040. }
  5041. else {
  5042. on[event] = callback;
  5043. }
  5044. }
  5045. var warn$2 = noop;
  5046. var tip = noop;
  5047. var generateComponentTrace; // work around flow check
  5048. var formatComponentName;
  5049. if (process.env.NODE_ENV !== 'production') {
  5050. var hasConsole_1 = typeof console !== 'undefined';
  5051. var classifyRE_1 = /(?:^|[-_])(\w)/g;
  5052. var classify_1 = function (str) {
  5053. return str.replace(classifyRE_1, function (c) { return c.toUpperCase(); }).replace(/[-_]/g, '');
  5054. };
  5055. warn$2 = function (msg, vm) {
  5056. if (vm === void 0) { vm = currentInstance; }
  5057. var trace = vm ? generateComponentTrace(vm) : '';
  5058. if (config.warnHandler) {
  5059. config.warnHandler.call(null, msg, vm, trace);
  5060. }
  5061. else if (hasConsole_1 && !config.silent) {
  5062. console.error("[Vue warn]: ".concat(msg).concat(trace));
  5063. }
  5064. };
  5065. tip = function (msg, vm) {
  5066. if (hasConsole_1 && !config.silent) {
  5067. console.warn("[Vue tip]: ".concat(msg) + (vm ? generateComponentTrace(vm) : ''));
  5068. }
  5069. };
  5070. formatComponentName = function (vm, includeFile) {
  5071. if (vm.$root === vm) {
  5072. return '<Root>';
  5073. }
  5074. var options = isFunction(vm) && vm.cid != null
  5075. ? vm.options
  5076. : vm._isVue
  5077. ? vm.$options || vm.constructor.options
  5078. : vm;
  5079. var name = getComponentName(options);
  5080. var file = options.__file;
  5081. if (!name && file) {
  5082. var match = file.match(/([^/\\]+)\.vue$/);
  5083. name = match && match[1];
  5084. }
  5085. return ((name ? "<".concat(classify_1(name), ">") : "<Anonymous>") +
  5086. (file && includeFile !== false ? " at ".concat(file) : ''));
  5087. };
  5088. var repeat_1 = function (str, n) {
  5089. var res = '';
  5090. while (n) {
  5091. if (n % 2 === 1)
  5092. res += str;
  5093. if (n > 1)
  5094. str += str;
  5095. n >>= 1;
  5096. }
  5097. return res;
  5098. };
  5099. generateComponentTrace = function (vm) {
  5100. if (vm._isVue && vm.$parent) {
  5101. var tree = [];
  5102. var currentRecursiveSequence = 0;
  5103. while (vm) {
  5104. if (tree.length > 0) {
  5105. var last = tree[tree.length - 1];
  5106. if (last.constructor === vm.constructor) {
  5107. currentRecursiveSequence++;
  5108. vm = vm.$parent;
  5109. continue;
  5110. }
  5111. else if (currentRecursiveSequence > 0) {
  5112. tree[tree.length - 1] = [last, currentRecursiveSequence];
  5113. currentRecursiveSequence = 0;
  5114. }
  5115. }
  5116. tree.push(vm);
  5117. vm = vm.$parent;
  5118. }
  5119. return ('\n\nfound in\n\n' +
  5120. tree
  5121. .map(function (vm, i) {
  5122. return "".concat(i === 0 ? '---> ' : repeat_1(' ', 5 + i * 2)).concat(isArray(vm)
  5123. ? "".concat(formatComponentName(vm[0]), "... (").concat(vm[1], " recursive calls)")
  5124. : formatComponentName(vm));
  5125. })
  5126. .join('\n'));
  5127. }
  5128. else {
  5129. return "\n\n(found in ".concat(formatComponentName(vm), ")");
  5130. }
  5131. };
  5132. }
  5133. /**
  5134. * Option overwriting strategies are functions that handle
  5135. * how to merge a parent option value and a child option
  5136. * value into the final value.
  5137. */
  5138. var strats = config.optionMergeStrategies;
  5139. /**
  5140. * Options with restrictions
  5141. */
  5142. if (process.env.NODE_ENV !== 'production') {
  5143. strats.el = strats.propsData = function (parent, child, vm, key) {
  5144. if (!vm) {
  5145. warn$2("option \"".concat(key, "\" can only be used during instance ") +
  5146. 'creation with the `new` keyword.');
  5147. }
  5148. return defaultStrat(parent, child);
  5149. };
  5150. }
  5151. /**
  5152. * Helper that recursively merges two data objects together.
  5153. */
  5154. function mergeData(to, from, recursive) {
  5155. if (recursive === void 0) { recursive = true; }
  5156. if (!from)
  5157. return to;
  5158. var key, toVal, fromVal;
  5159. var keys = hasSymbol
  5160. ? Reflect.ownKeys(from)
  5161. : Object.keys(from);
  5162. for (var i = 0; i < keys.length; i++) {
  5163. key = keys[i];
  5164. // in case the object is already observed...
  5165. if (key === '__ob__')
  5166. continue;
  5167. toVal = to[key];
  5168. fromVal = from[key];
  5169. if (!recursive || !hasOwn(to, key)) {
  5170. set(to, key, fromVal);
  5171. }
  5172. else if (toVal !== fromVal &&
  5173. isPlainObject(toVal) &&
  5174. isPlainObject(fromVal)) {
  5175. mergeData(toVal, fromVal);
  5176. }
  5177. }
  5178. return to;
  5179. }
  5180. /**
  5181. * Data
  5182. */
  5183. function mergeDataOrFn(parentVal, childVal, vm) {
  5184. if (!vm) {
  5185. // in a Vue.extend merge, both should be functions
  5186. if (!childVal) {
  5187. return parentVal;
  5188. }
  5189. if (!parentVal) {
  5190. return childVal;
  5191. }
  5192. // when parentVal & childVal are both present,
  5193. // we need to return a function that returns the
  5194. // merged result of both functions... no need to
  5195. // check if parentVal is a function here because
  5196. // it has to be a function to pass previous merges.
  5197. return function mergedDataFn() {
  5198. return mergeData(isFunction(childVal) ? childVal.call(this, this) : childVal, isFunction(parentVal) ? parentVal.call(this, this) : parentVal);
  5199. };
  5200. }
  5201. else {
  5202. return function mergedInstanceDataFn() {
  5203. // instance merge
  5204. var instanceData = isFunction(childVal)
  5205. ? childVal.call(vm, vm)
  5206. : childVal;
  5207. var defaultData = isFunction(parentVal)
  5208. ? parentVal.call(vm, vm)
  5209. : parentVal;
  5210. if (instanceData) {
  5211. return mergeData(instanceData, defaultData);
  5212. }
  5213. else {
  5214. return defaultData;
  5215. }
  5216. };
  5217. }
  5218. }
  5219. strats.data = function (parentVal, childVal, vm) {
  5220. if (!vm) {
  5221. if (childVal && typeof childVal !== 'function') {
  5222. process.env.NODE_ENV !== 'production' &&
  5223. warn$2('The "data" option should be a function ' +
  5224. 'that returns a per-instance value in component ' +
  5225. 'definitions.', vm);
  5226. return parentVal;
  5227. }
  5228. return mergeDataOrFn(parentVal, childVal);
  5229. }
  5230. return mergeDataOrFn(parentVal, childVal, vm);
  5231. };
  5232. /**
  5233. * Hooks and props are merged as arrays.
  5234. */
  5235. function mergeLifecycleHook(parentVal, childVal) {
  5236. var res = childVal
  5237. ? parentVal
  5238. ? parentVal.concat(childVal)
  5239. : isArray(childVal)
  5240. ? childVal
  5241. : [childVal]
  5242. : parentVal;
  5243. return res ? dedupeHooks(res) : res;
  5244. }
  5245. function dedupeHooks(hooks) {
  5246. var res = [];
  5247. for (var i = 0; i < hooks.length; i++) {
  5248. if (res.indexOf(hooks[i]) === -1) {
  5249. res.push(hooks[i]);
  5250. }
  5251. }
  5252. return res;
  5253. }
  5254. LIFECYCLE_HOOKS.forEach(function (hook) {
  5255. strats[hook] = mergeLifecycleHook;
  5256. });
  5257. /**
  5258. * Assets
  5259. *
  5260. * When a vm is present (instance creation), we need to do
  5261. * a three-way merge between constructor options, instance
  5262. * options and parent options.
  5263. */
  5264. function mergeAssets(parentVal, childVal, vm, key) {
  5265. var res = Object.create(parentVal || null);
  5266. if (childVal) {
  5267. process.env.NODE_ENV !== 'production' && assertObjectType(key, childVal, vm);
  5268. return extend(res, childVal);
  5269. }
  5270. else {
  5271. return res;
  5272. }
  5273. }
  5274. ASSET_TYPES.forEach(function (type) {
  5275. strats[type + 's'] = mergeAssets;
  5276. });
  5277. /**
  5278. * Watchers.
  5279. *
  5280. * Watchers hashes should not overwrite one
  5281. * another, so we merge them as arrays.
  5282. */
  5283. strats.watch = function (parentVal, childVal, vm, key) {
  5284. // work around Firefox's Object.prototype.watch...
  5285. //@ts-expect-error work around
  5286. if (parentVal === nativeWatch)
  5287. parentVal = undefined;
  5288. //@ts-expect-error work around
  5289. if (childVal === nativeWatch)
  5290. childVal = undefined;
  5291. /* istanbul ignore if */
  5292. if (!childVal)
  5293. return Object.create(parentVal || null);
  5294. if (process.env.NODE_ENV !== 'production') {
  5295. assertObjectType(key, childVal, vm);
  5296. }
  5297. if (!parentVal)
  5298. return childVal;
  5299. var ret = {};
  5300. extend(ret, parentVal);
  5301. for (var key_1 in childVal) {
  5302. var parent_1 = ret[key_1];
  5303. var child = childVal[key_1];
  5304. if (parent_1 && !isArray(parent_1)) {
  5305. parent_1 = [parent_1];
  5306. }
  5307. ret[key_1] = parent_1 ? parent_1.concat(child) : isArray(child) ? child : [child];
  5308. }
  5309. return ret;
  5310. };
  5311. /**
  5312. * Other object hashes.
  5313. */
  5314. strats.props =
  5315. strats.methods =
  5316. strats.inject =
  5317. strats.computed =
  5318. function (parentVal, childVal, vm, key) {
  5319. if (childVal && process.env.NODE_ENV !== 'production') {
  5320. assertObjectType(key, childVal, vm);
  5321. }
  5322. if (!parentVal)
  5323. return childVal;
  5324. var ret = Object.create(null);
  5325. extend(ret, parentVal);
  5326. if (childVal)
  5327. extend(ret, childVal);
  5328. return ret;
  5329. };
  5330. strats.provide = function (parentVal, childVal) {
  5331. if (!parentVal)
  5332. return childVal;
  5333. return function () {
  5334. var ret = Object.create(null);
  5335. mergeData(ret, isFunction(parentVal) ? parentVal.call(this) : parentVal);
  5336. if (childVal) {
  5337. mergeData(ret, isFunction(childVal) ? childVal.call(this) : childVal, false // non-recursive
  5338. );
  5339. }
  5340. return ret;
  5341. };
  5342. };
  5343. /**
  5344. * Default strategy.
  5345. */
  5346. var defaultStrat = function (parentVal, childVal) {
  5347. return childVal === undefined ? parentVal : childVal;
  5348. };
  5349. /**
  5350. * Validate component names
  5351. */
  5352. function checkComponents(options) {
  5353. for (var key in options.components) {
  5354. validateComponentName(key);
  5355. }
  5356. }
  5357. function validateComponentName(name) {
  5358. if (!new RegExp("^[a-zA-Z][\\-\\.0-9_".concat(unicodeRegExp.source, "]*$")).test(name)) {
  5359. warn$2('Invalid component name: "' +
  5360. name +
  5361. '". Component names ' +
  5362. 'should conform to valid custom element name in html5 specification.');
  5363. }
  5364. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  5365. warn$2('Do not use built-in or reserved HTML elements as component ' +
  5366. 'id: ' +
  5367. name);
  5368. }
  5369. }
  5370. /**
  5371. * Ensure all props option syntax are normalized into the
  5372. * Object-based format.
  5373. */
  5374. function normalizeProps(options, vm) {
  5375. var props = options.props;
  5376. if (!props)
  5377. return;
  5378. var res = {};
  5379. var i, val, name;
  5380. if (isArray(props)) {
  5381. i = props.length;
  5382. while (i--) {
  5383. val = props[i];
  5384. if (typeof val === 'string') {
  5385. name = camelize(val);
  5386. res[name] = { type: null };
  5387. }
  5388. else if (process.env.NODE_ENV !== 'production') {
  5389. warn$2('props must be strings when using array syntax.');
  5390. }
  5391. }
  5392. }
  5393. else if (isPlainObject(props)) {
  5394. for (var key in props) {
  5395. val = props[key];
  5396. name = camelize(key);
  5397. res[name] = isPlainObject(val) ? val : { type: val };
  5398. }
  5399. }
  5400. else if (process.env.NODE_ENV !== 'production') {
  5401. warn$2("Invalid value for option \"props\": expected an Array or an Object, " +
  5402. "but got ".concat(toRawType(props), "."), vm);
  5403. }
  5404. options.props = res;
  5405. }
  5406. /**
  5407. * Normalize all injections into Object-based format
  5408. */
  5409. function normalizeInject(options, vm) {
  5410. var inject = options.inject;
  5411. if (!inject)
  5412. return;
  5413. var normalized = (options.inject = {});
  5414. if (isArray(inject)) {
  5415. for (var i = 0; i < inject.length; i++) {
  5416. normalized[inject[i]] = { from: inject[i] };
  5417. }
  5418. }
  5419. else if (isPlainObject(inject)) {
  5420. for (var key in inject) {
  5421. var val = inject[key];
  5422. normalized[key] = isPlainObject(val)
  5423. ? extend({ from: key }, val)
  5424. : { from: val };
  5425. }
  5426. }
  5427. else if (process.env.NODE_ENV !== 'production') {
  5428. warn$2("Invalid value for option \"inject\": expected an Array or an Object, " +
  5429. "but got ".concat(toRawType(inject), "."), vm);
  5430. }
  5431. }
  5432. /**
  5433. * Normalize raw function directives into object format.
  5434. */
  5435. function normalizeDirectives$1(options) {
  5436. var dirs = options.directives;
  5437. if (dirs) {
  5438. for (var key in dirs) {
  5439. var def = dirs[key];
  5440. if (isFunction(def)) {
  5441. dirs[key] = { bind: def, update: def };
  5442. }
  5443. }
  5444. }
  5445. }
  5446. function assertObjectType(name, value, vm) {
  5447. if (!isPlainObject(value)) {
  5448. warn$2("Invalid value for option \"".concat(name, "\": expected an Object, ") +
  5449. "but got ".concat(toRawType(value), "."), vm);
  5450. }
  5451. }
  5452. /**
  5453. * Merge two option objects into a new one.
  5454. * Core utility used in both instantiation and inheritance.
  5455. */
  5456. function mergeOptions(parent, child, vm) {
  5457. if (process.env.NODE_ENV !== 'production') {
  5458. checkComponents(child);
  5459. }
  5460. if (isFunction(child)) {
  5461. // @ts-expect-error
  5462. child = child.options;
  5463. }
  5464. normalizeProps(child, vm);
  5465. normalizeInject(child, vm);
  5466. normalizeDirectives$1(child);
  5467. // Apply extends and mixins on the child options,
  5468. // but only if it is a raw options object that isn't
  5469. // the result of another mergeOptions call.
  5470. // Only merged options has the _base property.
  5471. if (!child._base) {
  5472. if (child.extends) {
  5473. parent = mergeOptions(parent, child.extends, vm);
  5474. }
  5475. if (child.mixins) {
  5476. for (var i = 0, l = child.mixins.length; i < l; i++) {
  5477. parent = mergeOptions(parent, child.mixins[i], vm);
  5478. }
  5479. }
  5480. }
  5481. var options = {};
  5482. var key;
  5483. for (key in parent) {
  5484. mergeField(key);
  5485. }
  5486. for (key in child) {
  5487. if (!hasOwn(parent, key)) {
  5488. mergeField(key);
  5489. }
  5490. }
  5491. function mergeField(key) {
  5492. var strat = strats[key] || defaultStrat;
  5493. options[key] = strat(parent[key], child[key], vm, key);
  5494. }
  5495. return options;
  5496. }
  5497. /**
  5498. * Resolve an asset.
  5499. * This function is used because child instances need access
  5500. * to assets defined in its ancestor chain.
  5501. */
  5502. function resolveAsset(options, type, id, warnMissing) {
  5503. /* istanbul ignore if */
  5504. if (typeof id !== 'string') {
  5505. return;
  5506. }
  5507. var assets = options[type];
  5508. // check local registration variations first
  5509. if (hasOwn(assets, id))
  5510. return assets[id];
  5511. var camelizedId = camelize(id);
  5512. if (hasOwn(assets, camelizedId))
  5513. return assets[camelizedId];
  5514. var PascalCaseId = capitalize(camelizedId);
  5515. if (hasOwn(assets, PascalCaseId))
  5516. return assets[PascalCaseId];
  5517. // fallback to prototype chain
  5518. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  5519. if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
  5520. warn$2('Failed to resolve ' + type.slice(0, -1) + ': ' + id);
  5521. }
  5522. return res;
  5523. }
  5524. function validateProp(key, propOptions, propsData, vm) {
  5525. var prop = propOptions[key];
  5526. var absent = !hasOwn(propsData, key);
  5527. var value = propsData[key];
  5528. // boolean casting
  5529. var booleanIndex = getTypeIndex(Boolean, prop.type);
  5530. if (booleanIndex > -1) {
  5531. if (absent && !hasOwn(prop, 'default')) {
  5532. value = false;
  5533. }
  5534. else if (value === '' || value === hyphenate(key)) {
  5535. // only cast empty string / same name to boolean if
  5536. // boolean has higher priority
  5537. var stringIndex = getTypeIndex(String, prop.type);
  5538. if (stringIndex < 0 || booleanIndex < stringIndex) {
  5539. value = true;
  5540. }
  5541. }
  5542. }
  5543. // check default value
  5544. if (value === undefined) {
  5545. value = getPropDefaultValue(vm, prop, key);
  5546. // since the default value is a fresh copy,
  5547. // make sure to observe it.
  5548. var prevShouldObserve = shouldObserve;
  5549. toggleObserving(true);
  5550. observe(value);
  5551. toggleObserving(prevShouldObserve);
  5552. }
  5553. if (process.env.NODE_ENV !== 'production') {
  5554. assertProp(prop, key, value, vm, absent);
  5555. }
  5556. return value;
  5557. }
  5558. /**
  5559. * Get the default value of a prop.
  5560. */
  5561. function getPropDefaultValue(vm, prop, key) {
  5562. // no default, return undefined
  5563. if (!hasOwn(prop, 'default')) {
  5564. return undefined;
  5565. }
  5566. var def = prop.default;
  5567. // warn against non-factory defaults for Object & Array
  5568. if (process.env.NODE_ENV !== 'production' && isObject(def)) {
  5569. warn$2('Invalid default value for prop "' +
  5570. key +
  5571. '": ' +
  5572. 'Props with type Object/Array must use a factory function ' +
  5573. 'to return the default value.', vm);
  5574. }
  5575. // the raw prop value was also undefined from previous render,
  5576. // return previous default value to avoid unnecessary watcher trigger
  5577. if (vm &&
  5578. vm.$options.propsData &&
  5579. vm.$options.propsData[key] === undefined &&
  5580. vm._props[key] !== undefined) {
  5581. return vm._props[key];
  5582. }
  5583. // call factory function for non-Function types
  5584. // a value is Function if its prototype is function even across different execution context
  5585. return isFunction(def) && getType(prop.type) !== 'Function'
  5586. ? def.call(vm)
  5587. : def;
  5588. }
  5589. /**
  5590. * Assert whether a prop is valid.
  5591. */
  5592. function assertProp(prop, name, value, vm, absent) {
  5593. if (prop.required && absent) {
  5594. warn$2('Missing required prop: "' + name + '"', vm);
  5595. return;
  5596. }
  5597. if (value == null && !prop.required) {
  5598. return;
  5599. }
  5600. var type = prop.type;
  5601. var valid = !type || type === true;
  5602. var expectedTypes = [];
  5603. if (type) {
  5604. if (!isArray(type)) {
  5605. type = [type];
  5606. }
  5607. for (var i = 0; i < type.length && !valid; i++) {
  5608. var assertedType = assertType(value, type[i], vm);
  5609. expectedTypes.push(assertedType.expectedType || '');
  5610. valid = assertedType.valid;
  5611. }
  5612. }
  5613. var haveExpectedTypes = expectedTypes.some(function (t) { return t; });
  5614. if (!valid && haveExpectedTypes) {
  5615. warn$2(getInvalidTypeMessage(name, value, expectedTypes), vm);
  5616. return;
  5617. }
  5618. var validator = prop.validator;
  5619. if (validator) {
  5620. if (!validator(value)) {
  5621. warn$2('Invalid prop: custom validator check failed for prop "' + name + '".', vm);
  5622. }
  5623. }
  5624. }
  5625. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
  5626. function assertType(value, type, vm) {
  5627. var valid;
  5628. var expectedType = getType(type);
  5629. if (simpleCheckRE.test(expectedType)) {
  5630. var t = typeof value;
  5631. valid = t === expectedType.toLowerCase();
  5632. // for primitive wrapper objects
  5633. if (!valid && t === 'object') {
  5634. valid = value instanceof type;
  5635. }
  5636. }
  5637. else if (expectedType === 'Object') {
  5638. valid = isPlainObject(value);
  5639. }
  5640. else if (expectedType === 'Array') {
  5641. valid = isArray(value);
  5642. }
  5643. else {
  5644. try {
  5645. valid = value instanceof type;
  5646. }
  5647. catch (e) {
  5648. warn$2('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
  5649. valid = false;
  5650. }
  5651. }
  5652. return {
  5653. valid: valid,
  5654. expectedType: expectedType
  5655. };
  5656. }
  5657. var functionTypeCheckRE = /^\s*function (\w+)/;
  5658. /**
  5659. * Use function string name to check built-in types,
  5660. * because a simple equality check will fail when running
  5661. * across different vms / iframes.
  5662. */
  5663. function getType(fn) {
  5664. var match = fn && fn.toString().match(functionTypeCheckRE);
  5665. return match ? match[1] : '';
  5666. }
  5667. function isSameType(a, b) {
  5668. return getType(a) === getType(b);
  5669. }
  5670. function getTypeIndex(type, expectedTypes) {
  5671. if (!isArray(expectedTypes)) {
  5672. return isSameType(expectedTypes, type) ? 0 : -1;
  5673. }
  5674. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  5675. if (isSameType(expectedTypes[i], type)) {
  5676. return i;
  5677. }
  5678. }
  5679. return -1;
  5680. }
  5681. function getInvalidTypeMessage(name, value, expectedTypes) {
  5682. var message = "Invalid prop: type check failed for prop \"".concat(name, "\".") +
  5683. " Expected ".concat(expectedTypes.map(capitalize).join(', '));
  5684. var expectedType = expectedTypes[0];
  5685. var receivedType = toRawType(value);
  5686. // check if we need to specify expected value
  5687. if (expectedTypes.length === 1 &&
  5688. isExplicable(expectedType) &&
  5689. isExplicable(typeof value) &&
  5690. !isBoolean(expectedType, receivedType)) {
  5691. message += " with value ".concat(styleValue(value, expectedType));
  5692. }
  5693. message += ", got ".concat(receivedType, " ");
  5694. // check if we need to specify received value
  5695. if (isExplicable(receivedType)) {
  5696. message += "with value ".concat(styleValue(value, receivedType), ".");
  5697. }
  5698. return message;
  5699. }
  5700. function styleValue(value, type) {
  5701. if (type === 'String') {
  5702. return "\"".concat(value, "\"");
  5703. }
  5704. else if (type === 'Number') {
  5705. return "".concat(Number(value));
  5706. }
  5707. else {
  5708. return "".concat(value);
  5709. }
  5710. }
  5711. var EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
  5712. function isExplicable(value) {
  5713. return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; });
  5714. }
  5715. function isBoolean() {
  5716. var args = [];
  5717. for (var _i = 0; _i < arguments.length; _i++) {
  5718. args[_i] = arguments[_i];
  5719. }
  5720. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; });
  5721. }
  5722. function Vue(options) {
  5723. if (process.env.NODE_ENV !== 'production' && !(this instanceof Vue)) {
  5724. warn$2('Vue is a constructor and should be called with the `new` keyword');
  5725. }
  5726. this._init(options);
  5727. }
  5728. //@ts-expect-error Vue has function type
  5729. initMixin$1(Vue);
  5730. //@ts-expect-error Vue has function type
  5731. stateMixin(Vue);
  5732. //@ts-expect-error Vue has function type
  5733. eventsMixin(Vue);
  5734. //@ts-expect-error Vue has function type
  5735. lifecycleMixin(Vue);
  5736. //@ts-expect-error Vue has function type
  5737. renderMixin(Vue);
  5738. function initUse(Vue) {
  5739. Vue.use = function (plugin) {
  5740. var installedPlugins = this._installedPlugins || (this._installedPlugins = []);
  5741. if (installedPlugins.indexOf(plugin) > -1) {
  5742. return this;
  5743. }
  5744. // additional parameters
  5745. var args = toArray(arguments, 1);
  5746. args.unshift(this);
  5747. if (isFunction(plugin.install)) {
  5748. plugin.install.apply(plugin, args);
  5749. }
  5750. else if (isFunction(plugin)) {
  5751. plugin.apply(null, args);
  5752. }
  5753. installedPlugins.push(plugin);
  5754. return this;
  5755. };
  5756. }
  5757. function initMixin(Vue) {
  5758. Vue.mixin = function (mixin) {
  5759. this.options = mergeOptions(this.options, mixin);
  5760. return this;
  5761. };
  5762. }
  5763. function initExtend(Vue) {
  5764. /**
  5765. * Each instance constructor, including Vue, has a unique
  5766. * cid. This enables us to create wrapped "child
  5767. * constructors" for prototypal inheritance and cache them.
  5768. */
  5769. Vue.cid = 0;
  5770. var cid = 1;
  5771. /**
  5772. * Class inheritance
  5773. */
  5774. Vue.extend = function (extendOptions) {
  5775. extendOptions = extendOptions || {};
  5776. var Super = this;
  5777. var SuperId = Super.cid;
  5778. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  5779. if (cachedCtors[SuperId]) {
  5780. return cachedCtors[SuperId];
  5781. }
  5782. var name = getComponentName(extendOptions) || getComponentName(Super.options);
  5783. if (process.env.NODE_ENV !== 'production' && name) {
  5784. validateComponentName(name);
  5785. }
  5786. var Sub = function VueComponent(options) {
  5787. this._init(options);
  5788. };
  5789. Sub.prototype = Object.create(Super.prototype);
  5790. Sub.prototype.constructor = Sub;
  5791. Sub.cid = cid++;
  5792. Sub.options = mergeOptions(Super.options, extendOptions);
  5793. Sub['super'] = Super;
  5794. // For props and computed properties, we define the proxy getters on
  5795. // the Vue instances at extension time, on the extended prototype. This
  5796. // avoids Object.defineProperty calls for each instance created.
  5797. if (Sub.options.props) {
  5798. initProps(Sub);
  5799. }
  5800. if (Sub.options.computed) {
  5801. initComputed(Sub);
  5802. }
  5803. // allow further extension/mixin/plugin usage
  5804. Sub.extend = Super.extend;
  5805. Sub.mixin = Super.mixin;
  5806. Sub.use = Super.use;
  5807. // create asset registers, so extended classes
  5808. // can have their private assets too.
  5809. ASSET_TYPES.forEach(function (type) {
  5810. Sub[type] = Super[type];
  5811. });
  5812. // enable recursive self-lookup
  5813. if (name) {
  5814. Sub.options.components[name] = Sub;
  5815. }
  5816. // keep a reference to the super options at extension time.
  5817. // later at instantiation we can check if Super's options have
  5818. // been updated.
  5819. Sub.superOptions = Super.options;
  5820. Sub.extendOptions = extendOptions;
  5821. Sub.sealedOptions = extend({}, Sub.options);
  5822. // cache constructor
  5823. cachedCtors[SuperId] = Sub;
  5824. return Sub;
  5825. };
  5826. }
  5827. function initProps(Comp) {
  5828. var props = Comp.options.props;
  5829. for (var key in props) {
  5830. proxy(Comp.prototype, "_props", key);
  5831. }
  5832. }
  5833. function initComputed(Comp) {
  5834. var computed = Comp.options.computed;
  5835. for (var key in computed) {
  5836. defineComputed(Comp.prototype, key, computed[key]);
  5837. }
  5838. }
  5839. function initAssetRegisters(Vue) {
  5840. /**
  5841. * Create asset registration methods.
  5842. */
  5843. ASSET_TYPES.forEach(function (type) {
  5844. // @ts-expect-error function is not exact same type
  5845. Vue[type] = function (id, definition) {
  5846. if (!definition) {
  5847. return this.options[type + 's'][id];
  5848. }
  5849. else {
  5850. /* istanbul ignore if */
  5851. if (process.env.NODE_ENV !== 'production' && type === 'component') {
  5852. validateComponentName(id);
  5853. }
  5854. if (type === 'component' && isPlainObject(definition)) {
  5855. // @ts-expect-error
  5856. definition.name = definition.name || id;
  5857. definition = this.options._base.extend(definition);
  5858. }
  5859. if (type === 'directive' && isFunction(definition)) {
  5860. definition = { bind: definition, update: definition };
  5861. }
  5862. this.options[type + 's'][id] = definition;
  5863. return definition;
  5864. }
  5865. };
  5866. });
  5867. }
  5868. function _getComponentName(opts) {
  5869. return opts && (getComponentName(opts.Ctor.options) || opts.tag);
  5870. }
  5871. function matches(pattern, name) {
  5872. if (isArray(pattern)) {
  5873. return pattern.indexOf(name) > -1;
  5874. }
  5875. else if (typeof pattern === 'string') {
  5876. return pattern.split(',').indexOf(name) > -1;
  5877. }
  5878. else if (isRegExp(pattern)) {
  5879. return pattern.test(name);
  5880. }
  5881. /* istanbul ignore next */
  5882. return false;
  5883. }
  5884. function pruneCache(keepAliveInstance, filter) {
  5885. var cache = keepAliveInstance.cache, keys = keepAliveInstance.keys, _vnode = keepAliveInstance._vnode, $vnode = keepAliveInstance.$vnode;
  5886. for (var key in cache) {
  5887. var entry = cache[key];
  5888. if (entry) {
  5889. var name_1 = entry.name;
  5890. if (name_1 && !filter(name_1)) {
  5891. pruneCacheEntry(cache, key, keys, _vnode);
  5892. }
  5893. }
  5894. }
  5895. $vnode.componentOptions.children = undefined;
  5896. }
  5897. function pruneCacheEntry(cache, key, keys, current) {
  5898. var entry = cache[key];
  5899. if (entry && (!current || entry.tag !== current.tag)) {
  5900. // @ts-expect-error can be undefined
  5901. entry.componentInstance.$destroy();
  5902. }
  5903. cache[key] = null;
  5904. remove$2(keys, key);
  5905. }
  5906. var patternTypes = [String, RegExp, Array];
  5907. // TODO defineComponent
  5908. var KeepAlive = {
  5909. name: 'keep-alive',
  5910. abstract: true,
  5911. props: {
  5912. include: patternTypes,
  5913. exclude: patternTypes,
  5914. max: [String, Number]
  5915. },
  5916. methods: {
  5917. cacheVNode: function () {
  5918. var _a = this, cache = _a.cache, keys = _a.keys, vnodeToCache = _a.vnodeToCache, keyToCache = _a.keyToCache;
  5919. if (vnodeToCache) {
  5920. var tag = vnodeToCache.tag, componentInstance = vnodeToCache.componentInstance, componentOptions = vnodeToCache.componentOptions;
  5921. cache[keyToCache] = {
  5922. name: _getComponentName(componentOptions),
  5923. tag: tag,
  5924. componentInstance: componentInstance
  5925. };
  5926. keys.push(keyToCache);
  5927. // prune oldest entry
  5928. if (this.max && keys.length > parseInt(this.max)) {
  5929. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  5930. }
  5931. this.vnodeToCache = null;
  5932. }
  5933. }
  5934. },
  5935. created: function () {
  5936. this.cache = Object.create(null);
  5937. this.keys = [];
  5938. },
  5939. destroyed: function () {
  5940. for (var key in this.cache) {
  5941. pruneCacheEntry(this.cache, key, this.keys);
  5942. }
  5943. },
  5944. mounted: function () {
  5945. var _this = this;
  5946. this.cacheVNode();
  5947. this.$watch('include', function (val) {
  5948. pruneCache(_this, function (name) { return matches(val, name); });
  5949. });
  5950. this.$watch('exclude', function (val) {
  5951. pruneCache(_this, function (name) { return !matches(val, name); });
  5952. });
  5953. },
  5954. updated: function () {
  5955. this.cacheVNode();
  5956. },
  5957. render: function () {
  5958. var slot = this.$slots.default;
  5959. var vnode = getFirstComponentChild(slot);
  5960. var componentOptions = vnode && vnode.componentOptions;
  5961. if (componentOptions) {
  5962. // check pattern
  5963. var name_2 = _getComponentName(componentOptions);
  5964. var _a = this, include = _a.include, exclude = _a.exclude;
  5965. if (
  5966. // not included
  5967. (include && (!name_2 || !matches(include, name_2))) ||
  5968. // excluded
  5969. (exclude && name_2 && matches(exclude, name_2))) {
  5970. return vnode;
  5971. }
  5972. var _b = this, cache = _b.cache, keys = _b.keys;
  5973. var key = vnode.key == null
  5974. ? // same constructor may get registered as different local components
  5975. // so cid alone is not enough (#3269)
  5976. componentOptions.Ctor.cid +
  5977. (componentOptions.tag ? "::".concat(componentOptions.tag) : '')
  5978. : vnode.key;
  5979. if (cache[key]) {
  5980. vnode.componentInstance = cache[key].componentInstance;
  5981. // make current key freshest
  5982. remove$2(keys, key);
  5983. keys.push(key);
  5984. }
  5985. else {
  5986. // delay setting the cache until update
  5987. this.vnodeToCache = vnode;
  5988. this.keyToCache = key;
  5989. }
  5990. // @ts-expect-error can vnode.data can be undefined
  5991. vnode.data.keepAlive = true;
  5992. }
  5993. return vnode || (slot && slot[0]);
  5994. }
  5995. };
  5996. var builtInComponents = {
  5997. KeepAlive: KeepAlive
  5998. };
  5999. function initGlobalAPI(Vue) {
  6000. // config
  6001. var configDef = {};
  6002. configDef.get = function () { return config; };
  6003. if (process.env.NODE_ENV !== 'production') {
  6004. configDef.set = function () {
  6005. warn$2('Do not replace the Vue.config object, set individual fields instead.');
  6006. };
  6007. }
  6008. Object.defineProperty(Vue, 'config', configDef);
  6009. // exposed util methods.
  6010. // NOTE: these are not considered part of the public API - avoid relying on
  6011. // them unless you are aware of the risk.
  6012. Vue.util = {
  6013. warn: warn$2,
  6014. extend: extend,
  6015. mergeOptions: mergeOptions,
  6016. defineReactive: defineReactive
  6017. };
  6018. Vue.set = set;
  6019. Vue.delete = del;
  6020. Vue.nextTick = nextTick;
  6021. // 2.6 explicit observable API
  6022. Vue.observable = function (obj) {
  6023. observe(obj);
  6024. return obj;
  6025. };
  6026. Vue.options = Object.create(null);
  6027. ASSET_TYPES.forEach(function (type) {
  6028. Vue.options[type + 's'] = Object.create(null);
  6029. });
  6030. // this is used to identify the "base" constructor to extend all plain-object
  6031. // components with in Weex's multi-instance scenarios.
  6032. Vue.options._base = Vue;
  6033. extend(Vue.options.components, builtInComponents);
  6034. initUse(Vue);
  6035. initMixin(Vue);
  6036. initExtend(Vue);
  6037. initAssetRegisters(Vue);
  6038. }
  6039. initGlobalAPI(Vue);
  6040. Object.defineProperty(Vue.prototype, '$isServer', {
  6041. get: isServerRendering
  6042. });
  6043. Object.defineProperty(Vue.prototype, '$ssrContext', {
  6044. get: function () {
  6045. /* istanbul ignore next */
  6046. return this.$vnode && this.$vnode.ssrContext;
  6047. }
  6048. });
  6049. // expose FunctionalRenderContext for ssr runtime helper installation
  6050. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  6051. value: FunctionalRenderContext
  6052. });
  6053. Vue.version = version;
  6054. // these are reserved for web because they are directly compiled away
  6055. // during template compilation
  6056. var isReservedAttr = makeMap('style,class');
  6057. // attributes that should be using props for binding
  6058. var acceptValue = makeMap('input,textarea,option,select,progress');
  6059. var mustUseProp = function (tag, type, attr) {
  6060. return ((attr === 'value' && acceptValue(tag) && type !== 'button') ||
  6061. (attr === 'selected' && tag === 'option') ||
  6062. (attr === 'checked' && tag === 'input') ||
  6063. (attr === 'muted' && tag === 'video'));
  6064. };
  6065. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  6066. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  6067. var convertEnumeratedValue = function (key, value) {
  6068. return isFalsyAttrValue(value) || value === 'false'
  6069. ? 'false'
  6070. : // allow arbitrary string value for contenteditable
  6071. key === 'contenteditable' && isValidContentEditableValue(value)
  6072. ? value
  6073. : 'true';
  6074. };
  6075. var isBooleanAttr = makeMap('allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  6076. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  6077. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  6078. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  6079. 'required,reversed,scoped,seamless,selected,sortable,' +
  6080. 'truespeed,typemustmatch,visible');
  6081. var xlinkNS = 'http://www.w3.org/1999/xlink';
  6082. var isXlink = function (name) {
  6083. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink';
  6084. };
  6085. var getXlinkProp = function (name) {
  6086. return isXlink(name) ? name.slice(6, name.length) : '';
  6087. };
  6088. var isFalsyAttrValue = function (val) {
  6089. return val == null || val === false;
  6090. };
  6091. function genClassForVnode(vnode) {
  6092. var data = vnode.data;
  6093. var parentNode = vnode;
  6094. var childNode = vnode;
  6095. while (isDef(childNode.componentInstance)) {
  6096. childNode = childNode.componentInstance._vnode;
  6097. if (childNode && childNode.data) {
  6098. data = mergeClassData(childNode.data, data);
  6099. }
  6100. }
  6101. // @ts-expect-error parentNode.parent not VNodeWithData
  6102. while (isDef((parentNode = parentNode.parent))) {
  6103. if (parentNode && parentNode.data) {
  6104. data = mergeClassData(data, parentNode.data);
  6105. }
  6106. }
  6107. return renderClass(data.staticClass, data.class);
  6108. }
  6109. function mergeClassData(child, parent) {
  6110. return {
  6111. staticClass: concat(child.staticClass, parent.staticClass),
  6112. class: isDef(child.class) ? [child.class, parent.class] : parent.class
  6113. };
  6114. }
  6115. function renderClass(staticClass, dynamicClass) {
  6116. if (isDef(staticClass) || isDef(dynamicClass)) {
  6117. return concat(staticClass, stringifyClass(dynamicClass));
  6118. }
  6119. /* istanbul ignore next */
  6120. return '';
  6121. }
  6122. function concat(a, b) {
  6123. return a ? (b ? a + ' ' + b : a) : b || '';
  6124. }
  6125. function stringifyClass(value) {
  6126. if (Array.isArray(value)) {
  6127. return stringifyArray(value);
  6128. }
  6129. if (isObject(value)) {
  6130. return stringifyObject(value);
  6131. }
  6132. if (typeof value === 'string') {
  6133. return value;
  6134. }
  6135. /* istanbul ignore next */
  6136. return '';
  6137. }
  6138. function stringifyArray(value) {
  6139. var res = '';
  6140. var stringified;
  6141. for (var i = 0, l = value.length; i < l; i++) {
  6142. if (isDef((stringified = stringifyClass(value[i]))) && stringified !== '') {
  6143. if (res)
  6144. res += ' ';
  6145. res += stringified;
  6146. }
  6147. }
  6148. return res;
  6149. }
  6150. function stringifyObject(value) {
  6151. var res = '';
  6152. for (var key in value) {
  6153. if (value[key]) {
  6154. if (res)
  6155. res += ' ';
  6156. res += key;
  6157. }
  6158. }
  6159. return res;
  6160. }
  6161. var namespaceMap = {
  6162. svg: 'http://www.w3.org/2000/svg',
  6163. math: 'http://www.w3.org/1998/Math/MathML'
  6164. };
  6165. var isHTMLTag = makeMap('html,body,base,head,link,meta,style,title,' +
  6166. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  6167. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  6168. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  6169. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  6170. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  6171. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  6172. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  6173. 'output,progress,select,textarea,' +
  6174. 'details,dialog,menu,menuitem,summary,' +
  6175. 'content,element,shadow,template,blockquote,iframe,tfoot');
  6176. // this map is intentionally selective, only covering SVG elements that may
  6177. // contain child elements.
  6178. var isSVG = makeMap('svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  6179. 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  6180. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', true);
  6181. var isPreTag = function (tag) { return tag === 'pre'; };
  6182. var isReservedTag = function (tag) {
  6183. return isHTMLTag(tag) || isSVG(tag);
  6184. };
  6185. function getTagNamespace(tag) {
  6186. if (isSVG(tag)) {
  6187. return 'svg';
  6188. }
  6189. // basic support for MathML
  6190. // note it doesn't support other MathML elements being component roots
  6191. if (tag === 'math') {
  6192. return 'math';
  6193. }
  6194. }
  6195. var unknownElementCache = Object.create(null);
  6196. function isUnknownElement(tag) {
  6197. /* istanbul ignore if */
  6198. if (!inBrowser) {
  6199. return true;
  6200. }
  6201. if (isReservedTag(tag)) {
  6202. return false;
  6203. }
  6204. tag = tag.toLowerCase();
  6205. /* istanbul ignore if */
  6206. if (unknownElementCache[tag] != null) {
  6207. return unknownElementCache[tag];
  6208. }
  6209. var el = document.createElement(tag);
  6210. if (tag.indexOf('-') > -1) {
  6211. // https://stackoverflow.com/a/28210364/1070244
  6212. return (unknownElementCache[tag] =
  6213. el.constructor === window.HTMLUnknownElement ||
  6214. el.constructor === window.HTMLElement);
  6215. }
  6216. else {
  6217. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()));
  6218. }
  6219. }
  6220. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  6221. /**
  6222. * Query an element selector if it's not an element already.
  6223. */
  6224. function query(el) {
  6225. if (typeof el === 'string') {
  6226. var selected = document.querySelector(el);
  6227. if (!selected) {
  6228. process.env.NODE_ENV !== 'production' && warn$2('Cannot find element: ' + el);
  6229. return document.createElement('div');
  6230. }
  6231. return selected;
  6232. }
  6233. else {
  6234. return el;
  6235. }
  6236. }
  6237. function createElement(tagName, vnode) {
  6238. var elm = document.createElement(tagName);
  6239. if (tagName !== 'select') {
  6240. return elm;
  6241. }
  6242. // false or null will remove the attribute but undefined will not
  6243. if (vnode.data &&
  6244. vnode.data.attrs &&
  6245. vnode.data.attrs.multiple !== undefined) {
  6246. elm.setAttribute('multiple', 'multiple');
  6247. }
  6248. return elm;
  6249. }
  6250. function createElementNS(namespace, tagName) {
  6251. return document.createElementNS(namespaceMap[namespace], tagName);
  6252. }
  6253. function createTextNode(text) {
  6254. return document.createTextNode(text);
  6255. }
  6256. function createComment(text) {
  6257. return document.createComment(text);
  6258. }
  6259. function insertBefore(parentNode, newNode, referenceNode) {
  6260. parentNode.insertBefore(newNode, referenceNode);
  6261. }
  6262. function removeChild(node, child) {
  6263. node.removeChild(child);
  6264. }
  6265. function appendChild(node, child) {
  6266. node.appendChild(child);
  6267. }
  6268. function parentNode(node) {
  6269. return node.parentNode;
  6270. }
  6271. function nextSibling(node) {
  6272. return node.nextSibling;
  6273. }
  6274. function tagName(node) {
  6275. return node.tagName;
  6276. }
  6277. function setTextContent(node, text) {
  6278. node.textContent = text;
  6279. }
  6280. function setStyleScope(node, scopeId) {
  6281. node.setAttribute(scopeId, '');
  6282. }
  6283. var nodeOps = /*#__PURE__*/Object.freeze({
  6284. __proto__: null,
  6285. createElement: createElement,
  6286. createElementNS: createElementNS,
  6287. createTextNode: createTextNode,
  6288. createComment: createComment,
  6289. insertBefore: insertBefore,
  6290. removeChild: removeChild,
  6291. appendChild: appendChild,
  6292. parentNode: parentNode,
  6293. nextSibling: nextSibling,
  6294. tagName: tagName,
  6295. setTextContent: setTextContent,
  6296. setStyleScope: setStyleScope
  6297. });
  6298. var ref = {
  6299. create: function (_, vnode) {
  6300. registerRef(vnode);
  6301. },
  6302. update: function (oldVnode, vnode) {
  6303. if (oldVnode.data.ref !== vnode.data.ref) {
  6304. registerRef(oldVnode, true);
  6305. registerRef(vnode);
  6306. }
  6307. },
  6308. destroy: function (vnode) {
  6309. registerRef(vnode, true);
  6310. }
  6311. };
  6312. function registerRef(vnode, isRemoval) {
  6313. var ref = vnode.data.ref;
  6314. if (!isDef(ref))
  6315. return;
  6316. var vm = vnode.context;
  6317. var refValue = vnode.componentInstance || vnode.elm;
  6318. var value = isRemoval ? null : refValue;
  6319. var $refsValue = isRemoval ? undefined : refValue;
  6320. if (isFunction(ref)) {
  6321. invokeWithErrorHandling(ref, vm, [value], vm, "template ref function");
  6322. return;
  6323. }
  6324. var isFor = vnode.data.refInFor;
  6325. var _isString = typeof ref === 'string' || typeof ref === 'number';
  6326. var _isRef = isRef(ref);
  6327. var refs = vm.$refs;
  6328. if (_isString || _isRef) {
  6329. if (isFor) {
  6330. var existing = _isString ? refs[ref] : ref.value;
  6331. if (isRemoval) {
  6332. isArray(existing) && remove$2(existing, refValue);
  6333. }
  6334. else {
  6335. if (!isArray(existing)) {
  6336. if (_isString) {
  6337. refs[ref] = [refValue];
  6338. setSetupRef(vm, ref, refs[ref]);
  6339. }
  6340. else {
  6341. ref.value = [refValue];
  6342. }
  6343. }
  6344. else if (!existing.includes(refValue)) {
  6345. existing.push(refValue);
  6346. }
  6347. }
  6348. }
  6349. else if (_isString) {
  6350. if (isRemoval && refs[ref] !== refValue) {
  6351. return;
  6352. }
  6353. refs[ref] = $refsValue;
  6354. setSetupRef(vm, ref, value);
  6355. }
  6356. else if (_isRef) {
  6357. if (isRemoval && ref.value !== refValue) {
  6358. return;
  6359. }
  6360. ref.value = value;
  6361. }
  6362. else if (process.env.NODE_ENV !== 'production') {
  6363. warn$2("Invalid template ref type: ".concat(typeof ref));
  6364. }
  6365. }
  6366. }
  6367. function setSetupRef(_a, key, val) {
  6368. var _setupState = _a._setupState;
  6369. if (_setupState && hasOwn(_setupState, key)) {
  6370. if (isRef(_setupState[key])) {
  6371. _setupState[key].value = val;
  6372. }
  6373. else {
  6374. _setupState[key] = val;
  6375. }
  6376. }
  6377. }
  6378. /**
  6379. * Virtual DOM patching algorithm based on Snabbdom by
  6380. * Simon Friis Vindum (@paldepind)
  6381. * Licensed under the MIT License
  6382. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  6383. *
  6384. * modified by Evan You (@yyx990803)
  6385. *
  6386. * Not type-checking this because this file is perf-critical and the cost
  6387. * of making flow understand it is not worth it.
  6388. */
  6389. var emptyNode = new VNode('', {}, []);
  6390. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  6391. function sameVnode(a, b) {
  6392. return (a.key === b.key &&
  6393. a.asyncFactory === b.asyncFactory &&
  6394. ((a.tag === b.tag &&
  6395. a.isComment === b.isComment &&
  6396. isDef(a.data) === isDef(b.data) &&
  6397. sameInputType(a, b)) ||
  6398. (isTrue(a.isAsyncPlaceholder) && isUndef(b.asyncFactory.error))));
  6399. }
  6400. function sameInputType(a, b) {
  6401. if (a.tag !== 'input')
  6402. return true;
  6403. var i;
  6404. var typeA = isDef((i = a.data)) && isDef((i = i.attrs)) && i.type;
  6405. var typeB = isDef((i = b.data)) && isDef((i = i.attrs)) && i.type;
  6406. return typeA === typeB || (isTextInputType(typeA) && isTextInputType(typeB));
  6407. }
  6408. function createKeyToOldIdx(children, beginIdx, endIdx) {
  6409. var i, key;
  6410. var map = {};
  6411. for (i = beginIdx; i <= endIdx; ++i) {
  6412. key = children[i].key;
  6413. if (isDef(key))
  6414. map[key] = i;
  6415. }
  6416. return map;
  6417. }
  6418. function createPatchFunction(backend) {
  6419. var i, j;
  6420. var cbs = {};
  6421. var modules = backend.modules, nodeOps = backend.nodeOps;
  6422. for (i = 0; i < hooks.length; ++i) {
  6423. cbs[hooks[i]] = [];
  6424. for (j = 0; j < modules.length; ++j) {
  6425. if (isDef(modules[j][hooks[i]])) {
  6426. cbs[hooks[i]].push(modules[j][hooks[i]]);
  6427. }
  6428. }
  6429. }
  6430. function emptyNodeAt(elm) {
  6431. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm);
  6432. }
  6433. function createRmCb(childElm, listeners) {
  6434. function remove() {
  6435. if (--remove.listeners === 0) {
  6436. removeNode(childElm);
  6437. }
  6438. }
  6439. remove.listeners = listeners;
  6440. return remove;
  6441. }
  6442. function removeNode(el) {
  6443. var parent = nodeOps.parentNode(el);
  6444. // element may have already been removed due to v-html / v-text
  6445. if (isDef(parent)) {
  6446. nodeOps.removeChild(parent, el);
  6447. }
  6448. }
  6449. function isUnknownElement(vnode, inVPre) {
  6450. return (!inVPre &&
  6451. !vnode.ns &&
  6452. !(config.ignoredElements.length &&
  6453. config.ignoredElements.some(function (ignore) {
  6454. return isRegExp(ignore)
  6455. ? ignore.test(vnode.tag)
  6456. : ignore === vnode.tag;
  6457. })) &&
  6458. config.isUnknownElement(vnode.tag));
  6459. }
  6460. var creatingElmInVPre = 0;
  6461. function createElm(vnode, insertedVnodeQueue, parentElm, refElm, nested, ownerArray, index) {
  6462. if (isDef(vnode.elm) && isDef(ownerArray)) {
  6463. // This vnode was used in a previous render!
  6464. // now it's used as a new node, overwriting its elm would cause
  6465. // potential patch errors down the road when it's used as an insertion
  6466. // reference node. Instead, we clone the node on-demand before creating
  6467. // associated DOM element for it.
  6468. vnode = ownerArray[index] = cloneVNode(vnode);
  6469. }
  6470. vnode.isRootInsert = !nested; // for transition enter check
  6471. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  6472. return;
  6473. }
  6474. var data = vnode.data;
  6475. var children = vnode.children;
  6476. var tag = vnode.tag;
  6477. if (isDef(tag)) {
  6478. if (process.env.NODE_ENV !== 'production') {
  6479. if (data && data.pre) {
  6480. creatingElmInVPre++;
  6481. }
  6482. if (isUnknownElement(vnode, creatingElmInVPre)) {
  6483. warn$2('Unknown custom element: <' +
  6484. tag +
  6485. '> - did you ' +
  6486. 'register the component correctly? For recursive components, ' +
  6487. 'make sure to provide the "name" option.', vnode.context);
  6488. }
  6489. }
  6490. vnode.elm = vnode.ns
  6491. ? nodeOps.createElementNS(vnode.ns, tag)
  6492. : nodeOps.createElement(tag, vnode);
  6493. setScope(vnode);
  6494. createChildren(vnode, children, insertedVnodeQueue);
  6495. if (isDef(data)) {
  6496. invokeCreateHooks(vnode, insertedVnodeQueue);
  6497. }
  6498. insert(parentElm, vnode.elm, refElm);
  6499. if (process.env.NODE_ENV !== 'production' && data && data.pre) {
  6500. creatingElmInVPre--;
  6501. }
  6502. }
  6503. else if (isTrue(vnode.isComment)) {
  6504. vnode.elm = nodeOps.createComment(vnode.text);
  6505. insert(parentElm, vnode.elm, refElm);
  6506. }
  6507. else {
  6508. vnode.elm = nodeOps.createTextNode(vnode.text);
  6509. insert(parentElm, vnode.elm, refElm);
  6510. }
  6511. }
  6512. function createComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
  6513. var i = vnode.data;
  6514. if (isDef(i)) {
  6515. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  6516. if (isDef((i = i.hook)) && isDef((i = i.init))) {
  6517. i(vnode, false /* hydrating */);
  6518. }
  6519. // after calling the init hook, if the vnode is a child component
  6520. // it should've created a child instance and mounted it. the child
  6521. // component also has set the placeholder vnode's elm.
  6522. // in that case we can just return the element and be done.
  6523. if (isDef(vnode.componentInstance)) {
  6524. initComponent(vnode, insertedVnodeQueue);
  6525. insert(parentElm, vnode.elm, refElm);
  6526. if (isTrue(isReactivated)) {
  6527. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  6528. }
  6529. return true;
  6530. }
  6531. }
  6532. }
  6533. function initComponent(vnode, insertedVnodeQueue) {
  6534. if (isDef(vnode.data.pendingInsert)) {
  6535. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  6536. vnode.data.pendingInsert = null;
  6537. }
  6538. vnode.elm = vnode.componentInstance.$el;
  6539. if (isPatchable(vnode)) {
  6540. invokeCreateHooks(vnode, insertedVnodeQueue);
  6541. setScope(vnode);
  6542. }
  6543. else {
  6544. // empty component root.
  6545. // skip all element-related modules except for ref (#3455)
  6546. registerRef(vnode);
  6547. // make sure to invoke the insert hook
  6548. insertedVnodeQueue.push(vnode);
  6549. }
  6550. }
  6551. function reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
  6552. var i;
  6553. // hack for #4339: a reactivated component with inner transition
  6554. // does not trigger because the inner node's created hooks are not called
  6555. // again. It's not ideal to involve module-specific logic in here but
  6556. // there doesn't seem to be a better way to do it.
  6557. var innerNode = vnode;
  6558. while (innerNode.componentInstance) {
  6559. innerNode = innerNode.componentInstance._vnode;
  6560. if (isDef((i = innerNode.data)) && isDef((i = i.transition))) {
  6561. for (i = 0; i < cbs.activate.length; ++i) {
  6562. cbs.activate[i](emptyNode, innerNode);
  6563. }
  6564. insertedVnodeQueue.push(innerNode);
  6565. break;
  6566. }
  6567. }
  6568. // unlike a newly created component,
  6569. // a reactivated keep-alive component doesn't insert itself
  6570. insert(parentElm, vnode.elm, refElm);
  6571. }
  6572. function insert(parent, elm, ref) {
  6573. if (isDef(parent)) {
  6574. if (isDef(ref)) {
  6575. if (nodeOps.parentNode(ref) === parent) {
  6576. nodeOps.insertBefore(parent, elm, ref);
  6577. }
  6578. }
  6579. else {
  6580. nodeOps.appendChild(parent, elm);
  6581. }
  6582. }
  6583. }
  6584. function createChildren(vnode, children, insertedVnodeQueue) {
  6585. if (isArray(children)) {
  6586. if (process.env.NODE_ENV !== 'production') {
  6587. checkDuplicateKeys(children);
  6588. }
  6589. for (var i_1 = 0; i_1 < children.length; ++i_1) {
  6590. createElm(children[i_1], insertedVnodeQueue, vnode.elm, null, true, children, i_1);
  6591. }
  6592. }
  6593. else if (isPrimitive(vnode.text)) {
  6594. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  6595. }
  6596. }
  6597. function isPatchable(vnode) {
  6598. while (vnode.componentInstance) {
  6599. vnode = vnode.componentInstance._vnode;
  6600. }
  6601. return isDef(vnode.tag);
  6602. }
  6603. function invokeCreateHooks(vnode, insertedVnodeQueue) {
  6604. for (var i_2 = 0; i_2 < cbs.create.length; ++i_2) {
  6605. cbs.create[i_2](emptyNode, vnode);
  6606. }
  6607. i = vnode.data.hook; // Reuse variable
  6608. if (isDef(i)) {
  6609. if (isDef(i.create))
  6610. i.create(emptyNode, vnode);
  6611. if (isDef(i.insert))
  6612. insertedVnodeQueue.push(vnode);
  6613. }
  6614. }
  6615. // set scope id attribute for scoped CSS.
  6616. // this is implemented as a special case to avoid the overhead
  6617. // of going through the normal attribute patching process.
  6618. function setScope(vnode) {
  6619. var i;
  6620. if (isDef((i = vnode.fnScopeId))) {
  6621. nodeOps.setStyleScope(vnode.elm, i);
  6622. }
  6623. else {
  6624. var ancestor = vnode;
  6625. while (ancestor) {
  6626. if (isDef((i = ancestor.context)) && isDef((i = i.$options._scopeId))) {
  6627. nodeOps.setStyleScope(vnode.elm, i);
  6628. }
  6629. ancestor = ancestor.parent;
  6630. }
  6631. }
  6632. // for slot content they should also get the scopeId from the host instance.
  6633. if (isDef((i = activeInstance)) &&
  6634. i !== vnode.context &&
  6635. i !== vnode.fnContext &&
  6636. isDef((i = i.$options._scopeId))) {
  6637. nodeOps.setStyleScope(vnode.elm, i);
  6638. }
  6639. }
  6640. function addVnodes(parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  6641. for (; startIdx <= endIdx; ++startIdx) {
  6642. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  6643. }
  6644. }
  6645. function invokeDestroyHook(vnode) {
  6646. var i, j;
  6647. var data = vnode.data;
  6648. if (isDef(data)) {
  6649. if (isDef((i = data.hook)) && isDef((i = i.destroy)))
  6650. i(vnode);
  6651. for (i = 0; i < cbs.destroy.length; ++i)
  6652. cbs.destroy[i](vnode);
  6653. }
  6654. if (isDef((i = vnode.children))) {
  6655. for (j = 0; j < vnode.children.length; ++j) {
  6656. invokeDestroyHook(vnode.children[j]);
  6657. }
  6658. }
  6659. }
  6660. function removeVnodes(vnodes, startIdx, endIdx) {
  6661. for (; startIdx <= endIdx; ++startIdx) {
  6662. var ch = vnodes[startIdx];
  6663. if (isDef(ch)) {
  6664. if (isDef(ch.tag)) {
  6665. removeAndInvokeRemoveHook(ch);
  6666. invokeDestroyHook(ch);
  6667. }
  6668. else {
  6669. // Text node
  6670. removeNode(ch.elm);
  6671. }
  6672. }
  6673. }
  6674. }
  6675. function removeAndInvokeRemoveHook(vnode, rm) {
  6676. if (isDef(rm) || isDef(vnode.data)) {
  6677. var i_3;
  6678. var listeners = cbs.remove.length + 1;
  6679. if (isDef(rm)) {
  6680. // we have a recursively passed down rm callback
  6681. // increase the listeners count
  6682. rm.listeners += listeners;
  6683. }
  6684. else {
  6685. // directly removing
  6686. rm = createRmCb(vnode.elm, listeners);
  6687. }
  6688. // recursively invoke hooks on child component root node
  6689. if (isDef((i_3 = vnode.componentInstance)) &&
  6690. isDef((i_3 = i_3._vnode)) &&
  6691. isDef(i_3.data)) {
  6692. removeAndInvokeRemoveHook(i_3, rm);
  6693. }
  6694. for (i_3 = 0; i_3 < cbs.remove.length; ++i_3) {
  6695. cbs.remove[i_3](vnode, rm);
  6696. }
  6697. if (isDef((i_3 = vnode.data.hook)) && isDef((i_3 = i_3.remove))) {
  6698. i_3(vnode, rm);
  6699. }
  6700. else {
  6701. rm();
  6702. }
  6703. }
  6704. else {
  6705. removeNode(vnode.elm);
  6706. }
  6707. }
  6708. function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  6709. var oldStartIdx = 0;
  6710. var newStartIdx = 0;
  6711. var oldEndIdx = oldCh.length - 1;
  6712. var oldStartVnode = oldCh[0];
  6713. var oldEndVnode = oldCh[oldEndIdx];
  6714. var newEndIdx = newCh.length - 1;
  6715. var newStartVnode = newCh[0];
  6716. var newEndVnode = newCh[newEndIdx];
  6717. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  6718. // removeOnly is a special flag used only by <transition-group>
  6719. // to ensure removed elements stay in correct relative positions
  6720. // during leaving transitions
  6721. var canMove = !removeOnly;
  6722. if (process.env.NODE_ENV !== 'production') {
  6723. checkDuplicateKeys(newCh);
  6724. }
  6725. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  6726. if (isUndef(oldStartVnode)) {
  6727. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  6728. }
  6729. else if (isUndef(oldEndVnode)) {
  6730. oldEndVnode = oldCh[--oldEndIdx];
  6731. }
  6732. else if (sameVnode(oldStartVnode, newStartVnode)) {
  6733. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  6734. oldStartVnode = oldCh[++oldStartIdx];
  6735. newStartVnode = newCh[++newStartIdx];
  6736. }
  6737. else if (sameVnode(oldEndVnode, newEndVnode)) {
  6738. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  6739. oldEndVnode = oldCh[--oldEndIdx];
  6740. newEndVnode = newCh[--newEndIdx];
  6741. }
  6742. else if (sameVnode(oldStartVnode, newEndVnode)) {
  6743. // Vnode moved right
  6744. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  6745. canMove &&
  6746. nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  6747. oldStartVnode = oldCh[++oldStartIdx];
  6748. newEndVnode = newCh[--newEndIdx];
  6749. }
  6750. else if (sameVnode(oldEndVnode, newStartVnode)) {
  6751. // Vnode moved left
  6752. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  6753. canMove &&
  6754. nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  6755. oldEndVnode = oldCh[--oldEndIdx];
  6756. newStartVnode = newCh[++newStartIdx];
  6757. }
  6758. else {
  6759. if (isUndef(oldKeyToIdx))
  6760. oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
  6761. idxInOld = isDef(newStartVnode.key)
  6762. ? oldKeyToIdx[newStartVnode.key]
  6763. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  6764. if (isUndef(idxInOld)) {
  6765. // New element
  6766. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  6767. }
  6768. else {
  6769. vnodeToMove = oldCh[idxInOld];
  6770. if (sameVnode(vnodeToMove, newStartVnode)) {
  6771. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  6772. oldCh[idxInOld] = undefined;
  6773. canMove &&
  6774. nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  6775. }
  6776. else {
  6777. // same key but different element. treat as new element
  6778. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  6779. }
  6780. }
  6781. newStartVnode = newCh[++newStartIdx];
  6782. }
  6783. }
  6784. if (oldStartIdx > oldEndIdx) {
  6785. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  6786. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  6787. }
  6788. else if (newStartIdx > newEndIdx) {
  6789. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  6790. }
  6791. }
  6792. function checkDuplicateKeys(children) {
  6793. var seenKeys = {};
  6794. for (var i_4 = 0; i_4 < children.length; i_4++) {
  6795. var vnode = children[i_4];
  6796. var key = vnode.key;
  6797. if (isDef(key)) {
  6798. if (seenKeys[key]) {
  6799. warn$2("Duplicate keys detected: '".concat(key, "'. This may cause an update error."), vnode.context);
  6800. }
  6801. else {
  6802. seenKeys[key] = true;
  6803. }
  6804. }
  6805. }
  6806. }
  6807. function findIdxInOld(node, oldCh, start, end) {
  6808. for (var i_5 = start; i_5 < end; i_5++) {
  6809. var c = oldCh[i_5];
  6810. if (isDef(c) && sameVnode(node, c))
  6811. return i_5;
  6812. }
  6813. }
  6814. function patchVnode(oldVnode, vnode, insertedVnodeQueue, ownerArray, index, removeOnly) {
  6815. if (oldVnode === vnode) {
  6816. return;
  6817. }
  6818. if (isDef(vnode.elm) && isDef(ownerArray)) {
  6819. // clone reused vnode
  6820. vnode = ownerArray[index] = cloneVNode(vnode);
  6821. }
  6822. var elm = (vnode.elm = oldVnode.elm);
  6823. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  6824. if (isDef(vnode.asyncFactory.resolved)) {
  6825. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  6826. }
  6827. else {
  6828. vnode.isAsyncPlaceholder = true;
  6829. }
  6830. return;
  6831. }
  6832. // reuse element for static trees.
  6833. // note we only do this if the vnode is cloned -
  6834. // if the new node is not cloned it means the render functions have been
  6835. // reset by the hot-reload-api and we need to do a proper re-render.
  6836. if (isTrue(vnode.isStatic) &&
  6837. isTrue(oldVnode.isStatic) &&
  6838. vnode.key === oldVnode.key &&
  6839. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {
  6840. vnode.componentInstance = oldVnode.componentInstance;
  6841. return;
  6842. }
  6843. var i;
  6844. var data = vnode.data;
  6845. if (isDef(data) && isDef((i = data.hook)) && isDef((i = i.prepatch))) {
  6846. i(oldVnode, vnode);
  6847. }
  6848. var oldCh = oldVnode.children;
  6849. var ch = vnode.children;
  6850. if (isDef(data) && isPatchable(vnode)) {
  6851. for (i = 0; i < cbs.update.length; ++i)
  6852. cbs.update[i](oldVnode, vnode);
  6853. if (isDef((i = data.hook)) && isDef((i = i.update)))
  6854. i(oldVnode, vnode);
  6855. }
  6856. if (isUndef(vnode.text)) {
  6857. if (isDef(oldCh) && isDef(ch)) {
  6858. if (oldCh !== ch)
  6859. updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly);
  6860. }
  6861. else if (isDef(ch)) {
  6862. if (process.env.NODE_ENV !== 'production') {
  6863. checkDuplicateKeys(ch);
  6864. }
  6865. if (isDef(oldVnode.text))
  6866. nodeOps.setTextContent(elm, '');
  6867. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  6868. }
  6869. else if (isDef(oldCh)) {
  6870. removeVnodes(oldCh, 0, oldCh.length - 1);
  6871. }
  6872. else if (isDef(oldVnode.text)) {
  6873. nodeOps.setTextContent(elm, '');
  6874. }
  6875. }
  6876. else if (oldVnode.text !== vnode.text) {
  6877. nodeOps.setTextContent(elm, vnode.text);
  6878. }
  6879. if (isDef(data)) {
  6880. if (isDef((i = data.hook)) && isDef((i = i.postpatch)))
  6881. i(oldVnode, vnode);
  6882. }
  6883. }
  6884. function invokeInsertHook(vnode, queue, initial) {
  6885. // delay insert hooks for component root nodes, invoke them after the
  6886. // element is really inserted
  6887. if (isTrue(initial) && isDef(vnode.parent)) {
  6888. vnode.parent.data.pendingInsert = queue;
  6889. }
  6890. else {
  6891. for (var i_6 = 0; i_6 < queue.length; ++i_6) {
  6892. queue[i_6].data.hook.insert(queue[i_6]);
  6893. }
  6894. }
  6895. }
  6896. var hydrationBailed = false;
  6897. // list of modules that can skip create hook during hydration because they
  6898. // are already rendered on the client or has no need for initialization
  6899. // Note: style is excluded because it relies on initial clone for future
  6900. // deep updates (#7063).
  6901. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  6902. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  6903. function hydrate(elm, vnode, insertedVnodeQueue, inVPre) {
  6904. var i;
  6905. var tag = vnode.tag, data = vnode.data, children = vnode.children;
  6906. inVPre = inVPre || (data && data.pre);
  6907. vnode.elm = elm;
  6908. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  6909. vnode.isAsyncPlaceholder = true;
  6910. return true;
  6911. }
  6912. // assert node match
  6913. if (process.env.NODE_ENV !== 'production') {
  6914. if (!assertNodeMatch(elm, vnode, inVPre)) {
  6915. return false;
  6916. }
  6917. }
  6918. if (isDef(data)) {
  6919. if (isDef((i = data.hook)) && isDef((i = i.init)))
  6920. i(vnode, true /* hydrating */);
  6921. if (isDef((i = vnode.componentInstance))) {
  6922. // child component. it should have hydrated its own tree.
  6923. initComponent(vnode, insertedVnodeQueue);
  6924. return true;
  6925. }
  6926. }
  6927. if (isDef(tag)) {
  6928. if (isDef(children)) {
  6929. // empty element, allow client to pick up and populate children
  6930. if (!elm.hasChildNodes()) {
  6931. createChildren(vnode, children, insertedVnodeQueue);
  6932. }
  6933. else {
  6934. // v-html and domProps: innerHTML
  6935. if (isDef((i = data)) &&
  6936. isDef((i = i.domProps)) &&
  6937. isDef((i = i.innerHTML))) {
  6938. if (i !== elm.innerHTML) {
  6939. /* istanbul ignore if */
  6940. if (process.env.NODE_ENV !== 'production' &&
  6941. typeof console !== 'undefined' &&
  6942. !hydrationBailed) {
  6943. hydrationBailed = true;
  6944. console.warn('Parent: ', elm);
  6945. console.warn('server innerHTML: ', i);
  6946. console.warn('client innerHTML: ', elm.innerHTML);
  6947. }
  6948. return false;
  6949. }
  6950. }
  6951. else {
  6952. // iterate and compare children lists
  6953. var childrenMatch = true;
  6954. var childNode = elm.firstChild;
  6955. for (var i_7 = 0; i_7 < children.length; i_7++) {
  6956. if (!childNode ||
  6957. !hydrate(childNode, children[i_7], insertedVnodeQueue, inVPre)) {
  6958. childrenMatch = false;
  6959. break;
  6960. }
  6961. childNode = childNode.nextSibling;
  6962. }
  6963. // if childNode is not null, it means the actual childNodes list is
  6964. // longer than the virtual children list.
  6965. if (!childrenMatch || childNode) {
  6966. /* istanbul ignore if */
  6967. if (process.env.NODE_ENV !== 'production' &&
  6968. typeof console !== 'undefined' &&
  6969. !hydrationBailed) {
  6970. hydrationBailed = true;
  6971. console.warn('Parent: ', elm);
  6972. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  6973. }
  6974. return false;
  6975. }
  6976. }
  6977. }
  6978. }
  6979. if (isDef(data)) {
  6980. var fullInvoke = false;
  6981. for (var key in data) {
  6982. if (!isRenderedModule(key)) {
  6983. fullInvoke = true;
  6984. invokeCreateHooks(vnode, insertedVnodeQueue);
  6985. break;
  6986. }
  6987. }
  6988. if (!fullInvoke && data['class']) {
  6989. // ensure collecting deps for deep class bindings for future updates
  6990. traverse(data['class']);
  6991. }
  6992. }
  6993. }
  6994. else if (elm.data !== vnode.text) {
  6995. elm.data = vnode.text;
  6996. }
  6997. return true;
  6998. }
  6999. function assertNodeMatch(node, vnode, inVPre) {
  7000. if (isDef(vnode.tag)) {
  7001. return (vnode.tag.indexOf('vue-component') === 0 ||
  7002. (!isUnknownElement(vnode, inVPre) &&
  7003. vnode.tag.toLowerCase() ===
  7004. (node.tagName && node.tagName.toLowerCase())));
  7005. }
  7006. else {
  7007. return node.nodeType === (vnode.isComment ? 8 : 3);
  7008. }
  7009. }
  7010. return function patch(oldVnode, vnode, hydrating, removeOnly) {
  7011. if (isUndef(vnode)) {
  7012. if (isDef(oldVnode))
  7013. invokeDestroyHook(oldVnode);
  7014. return;
  7015. }
  7016. var isInitialPatch = false;
  7017. var insertedVnodeQueue = [];
  7018. if (isUndef(oldVnode)) {
  7019. // empty mount (likely as component), create new root element
  7020. isInitialPatch = true;
  7021. createElm(vnode, insertedVnodeQueue);
  7022. }
  7023. else {
  7024. var isRealElement = isDef(oldVnode.nodeType);
  7025. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  7026. // patch existing root node
  7027. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  7028. }
  7029. else {
  7030. if (isRealElement) {
  7031. // mounting to a real element
  7032. // check if this is server-rendered content and if we can perform
  7033. // a successful hydration.
  7034. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  7035. oldVnode.removeAttribute(SSR_ATTR);
  7036. hydrating = true;
  7037. }
  7038. if (isTrue(hydrating)) {
  7039. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  7040. invokeInsertHook(vnode, insertedVnodeQueue, true);
  7041. return oldVnode;
  7042. }
  7043. else if (process.env.NODE_ENV !== 'production') {
  7044. warn$2('The client-side rendered virtual DOM tree is not matching ' +
  7045. 'server-rendered content. This is likely caused by incorrect ' +
  7046. 'HTML markup, for example nesting block-level elements inside ' +
  7047. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  7048. 'full client-side render.');
  7049. }
  7050. }
  7051. // either not server-rendered, or hydration failed.
  7052. // create an empty node and replace it
  7053. oldVnode = emptyNodeAt(oldVnode);
  7054. }
  7055. // replacing existing element
  7056. var oldElm = oldVnode.elm;
  7057. var parentElm = nodeOps.parentNode(oldElm);
  7058. // create new node
  7059. createElm(vnode, insertedVnodeQueue,
  7060. // extremely rare edge case: do not insert if old element is in a
  7061. // leaving transition. Only happens when combining transition +
  7062. // keep-alive + HOCs. (#4590)
  7063. oldElm._leaveCb ? null : parentElm, nodeOps.nextSibling(oldElm));
  7064. // update parent placeholder node element, recursively
  7065. if (isDef(vnode.parent)) {
  7066. var ancestor = vnode.parent;
  7067. var patchable = isPatchable(vnode);
  7068. while (ancestor) {
  7069. for (var i_8 = 0; i_8 < cbs.destroy.length; ++i_8) {
  7070. cbs.destroy[i_8](ancestor);
  7071. }
  7072. ancestor.elm = vnode.elm;
  7073. if (patchable) {
  7074. for (var i_9 = 0; i_9 < cbs.create.length; ++i_9) {
  7075. cbs.create[i_9](emptyNode, ancestor);
  7076. }
  7077. // #6513
  7078. // invoke insert hooks that may have been merged by create hooks.
  7079. // e.g. for directives that uses the "inserted" hook.
  7080. var insert_1 = ancestor.data.hook.insert;
  7081. if (insert_1.merged) {
  7082. // start at index 1 to avoid re-invoking component mounted hook
  7083. // clone insert hooks to avoid being mutated during iteration.
  7084. // e.g. for customed directives under transition group.
  7085. var cloned = insert_1.fns.slice(1);
  7086. for (var i_10 = 0; i_10 < cloned.length; i_10++) {
  7087. cloned[i_10]();
  7088. }
  7089. }
  7090. }
  7091. else {
  7092. registerRef(ancestor);
  7093. }
  7094. ancestor = ancestor.parent;
  7095. }
  7096. }
  7097. // destroy old node
  7098. if (isDef(parentElm)) {
  7099. removeVnodes([oldVnode], 0, 0);
  7100. }
  7101. else if (isDef(oldVnode.tag)) {
  7102. invokeDestroyHook(oldVnode);
  7103. }
  7104. }
  7105. }
  7106. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  7107. return vnode.elm;
  7108. };
  7109. }
  7110. var directives$1 = {
  7111. create: updateDirectives,
  7112. update: updateDirectives,
  7113. destroy: function unbindDirectives(vnode) {
  7114. // @ts-expect-error emptyNode is not VNodeWithData
  7115. updateDirectives(vnode, emptyNode);
  7116. }
  7117. };
  7118. function updateDirectives(oldVnode, vnode) {
  7119. if (oldVnode.data.directives || vnode.data.directives) {
  7120. _update(oldVnode, vnode);
  7121. }
  7122. }
  7123. function _update(oldVnode, vnode) {
  7124. var isCreate = oldVnode === emptyNode;
  7125. var isDestroy = vnode === emptyNode;
  7126. var oldDirs = normalizeDirectives(oldVnode.data.directives, oldVnode.context);
  7127. var newDirs = normalizeDirectives(vnode.data.directives, vnode.context);
  7128. var dirsWithInsert = [];
  7129. var dirsWithPostpatch = [];
  7130. var key, oldDir, dir;
  7131. for (key in newDirs) {
  7132. oldDir = oldDirs[key];
  7133. dir = newDirs[key];
  7134. if (!oldDir) {
  7135. // new directive, bind
  7136. callHook(dir, 'bind', vnode, oldVnode);
  7137. if (dir.def && dir.def.inserted) {
  7138. dirsWithInsert.push(dir);
  7139. }
  7140. }
  7141. else {
  7142. // existing directive, update
  7143. dir.oldValue = oldDir.value;
  7144. dir.oldArg = oldDir.arg;
  7145. callHook(dir, 'update', vnode, oldVnode);
  7146. if (dir.def && dir.def.componentUpdated) {
  7147. dirsWithPostpatch.push(dir);
  7148. }
  7149. }
  7150. }
  7151. if (dirsWithInsert.length) {
  7152. var callInsert = function () {
  7153. for (var i = 0; i < dirsWithInsert.length; i++) {
  7154. callHook(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  7155. }
  7156. };
  7157. if (isCreate) {
  7158. mergeVNodeHook(vnode, 'insert', callInsert);
  7159. }
  7160. else {
  7161. callInsert();
  7162. }
  7163. }
  7164. if (dirsWithPostpatch.length) {
  7165. mergeVNodeHook(vnode, 'postpatch', function () {
  7166. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  7167. callHook(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  7168. }
  7169. });
  7170. }
  7171. if (!isCreate) {
  7172. for (key in oldDirs) {
  7173. if (!newDirs[key]) {
  7174. // no longer present, unbind
  7175. callHook(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  7176. }
  7177. }
  7178. }
  7179. }
  7180. var emptyModifiers = Object.create(null);
  7181. function normalizeDirectives(dirs, vm) {
  7182. var res = Object.create(null);
  7183. if (!dirs) {
  7184. // $flow-disable-line
  7185. return res;
  7186. }
  7187. var i, dir;
  7188. for (i = 0; i < dirs.length; i++) {
  7189. dir = dirs[i];
  7190. if (!dir.modifiers) {
  7191. // $flow-disable-line
  7192. dir.modifiers = emptyModifiers;
  7193. }
  7194. res[getRawDirName(dir)] = dir;
  7195. if (vm._setupState && vm._setupState.__sfc) {
  7196. var setupDef = dir.def || resolveAsset(vm, '_setupState', 'v-' + dir.name);
  7197. if (typeof setupDef === 'function') {
  7198. dir.def = {
  7199. bind: setupDef,
  7200. update: setupDef,
  7201. };
  7202. }
  7203. else {
  7204. dir.def = setupDef;
  7205. }
  7206. }
  7207. dir.def = dir.def || resolveAsset(vm.$options, 'directives', dir.name, true);
  7208. }
  7209. // $flow-disable-line
  7210. return res;
  7211. }
  7212. function getRawDirName(dir) {
  7213. return (dir.rawName || "".concat(dir.name, ".").concat(Object.keys(dir.modifiers || {}).join('.')));
  7214. }
  7215. function callHook(dir, hook, vnode, oldVnode, isDestroy) {
  7216. var fn = dir.def && dir.def[hook];
  7217. if (fn) {
  7218. try {
  7219. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  7220. }
  7221. catch (e) {
  7222. handleError(e, vnode.context, "directive ".concat(dir.name, " ").concat(hook, " hook"));
  7223. }
  7224. }
  7225. }
  7226. var baseModules = [ref, directives$1];
  7227. function updateAttrs(oldVnode, vnode) {
  7228. var opts = vnode.componentOptions;
  7229. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  7230. return;
  7231. }
  7232. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  7233. return;
  7234. }
  7235. var key, cur, old;
  7236. var elm = vnode.elm;
  7237. var oldAttrs = oldVnode.data.attrs || {};
  7238. var attrs = vnode.data.attrs || {};
  7239. // clone observed objects, as the user probably wants to mutate it
  7240. if (isDef(attrs.__ob__) || isTrue(attrs._v_attr_proxy)) {
  7241. attrs = vnode.data.attrs = extend({}, attrs);
  7242. }
  7243. for (key in attrs) {
  7244. cur = attrs[key];
  7245. old = oldAttrs[key];
  7246. if (old !== cur) {
  7247. setAttr(elm, key, cur, vnode.data.pre);
  7248. }
  7249. }
  7250. // #4391: in IE9, setting type can reset value for input[type=radio]
  7251. // #6666: IE/Edge forces progress value down to 1 before setting a max
  7252. /* istanbul ignore if */
  7253. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  7254. setAttr(elm, 'value', attrs.value);
  7255. }
  7256. for (key in oldAttrs) {
  7257. if (isUndef(attrs[key])) {
  7258. if (isXlink(key)) {
  7259. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  7260. }
  7261. else if (!isEnumeratedAttr(key)) {
  7262. elm.removeAttribute(key);
  7263. }
  7264. }
  7265. }
  7266. }
  7267. function setAttr(el, key, value, isInPre) {
  7268. if (isInPre || el.tagName.indexOf('-') > -1) {
  7269. baseSetAttr(el, key, value);
  7270. }
  7271. else if (isBooleanAttr(key)) {
  7272. // set attribute for blank value
  7273. // e.g. <option disabled>Select one</option>
  7274. if (isFalsyAttrValue(value)) {
  7275. el.removeAttribute(key);
  7276. }
  7277. else {
  7278. // technically allowfullscreen is a boolean attribute for <iframe>,
  7279. // but Flash expects a value of "true" when used on <embed> tag
  7280. value = key === 'allowfullscreen' && el.tagName === 'EMBED' ? 'true' : key;
  7281. el.setAttribute(key, value);
  7282. }
  7283. }
  7284. else if (isEnumeratedAttr(key)) {
  7285. el.setAttribute(key, convertEnumeratedValue(key, value));
  7286. }
  7287. else if (isXlink(key)) {
  7288. if (isFalsyAttrValue(value)) {
  7289. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  7290. }
  7291. else {
  7292. el.setAttributeNS(xlinkNS, key, value);
  7293. }
  7294. }
  7295. else {
  7296. baseSetAttr(el, key, value);
  7297. }
  7298. }
  7299. function baseSetAttr(el, key, value) {
  7300. if (isFalsyAttrValue(value)) {
  7301. el.removeAttribute(key);
  7302. }
  7303. else {
  7304. // #7138: IE10 & 11 fires input event when setting placeholder on
  7305. // <textarea>... block the first input event and remove the blocker
  7306. // immediately.
  7307. /* istanbul ignore if */
  7308. if (isIE &&
  7309. !isIE9 &&
  7310. el.tagName === 'TEXTAREA' &&
  7311. key === 'placeholder' &&
  7312. value !== '' &&
  7313. !el.__ieph) {
  7314. var blocker_1 = function (e) {
  7315. e.stopImmediatePropagation();
  7316. el.removeEventListener('input', blocker_1);
  7317. };
  7318. el.addEventListener('input', blocker_1);
  7319. // $flow-disable-line
  7320. el.__ieph = true; /* IE placeholder patched */
  7321. }
  7322. el.setAttribute(key, value);
  7323. }
  7324. }
  7325. var attrs = {
  7326. create: updateAttrs,
  7327. update: updateAttrs
  7328. };
  7329. function updateClass(oldVnode, vnode) {
  7330. var el = vnode.elm;
  7331. var data = vnode.data;
  7332. var oldData = oldVnode.data;
  7333. if (isUndef(data.staticClass) &&
  7334. isUndef(data.class) &&
  7335. (isUndef(oldData) ||
  7336. (isUndef(oldData.staticClass) && isUndef(oldData.class)))) {
  7337. return;
  7338. }
  7339. var cls = genClassForVnode(vnode);
  7340. // handle transition classes
  7341. var transitionClass = el._transitionClasses;
  7342. if (isDef(transitionClass)) {
  7343. cls = concat(cls, stringifyClass(transitionClass));
  7344. }
  7345. // set the class
  7346. if (cls !== el._prevClass) {
  7347. el.setAttribute('class', cls);
  7348. el._prevClass = cls;
  7349. }
  7350. }
  7351. var klass$1 = {
  7352. create: updateClass,
  7353. update: updateClass
  7354. };
  7355. var validDivisionCharRE = /[\w).+\-_$\]]/;
  7356. function parseFilters(exp) {
  7357. var inSingle = false;
  7358. var inDouble = false;
  7359. var inTemplateString = false;
  7360. var inRegex = false;
  7361. var curly = 0;
  7362. var square = 0;
  7363. var paren = 0;
  7364. var lastFilterIndex = 0;
  7365. var c, prev, i, expression, filters;
  7366. for (i = 0; i < exp.length; i++) {
  7367. prev = c;
  7368. c = exp.charCodeAt(i);
  7369. if (inSingle) {
  7370. if (c === 0x27 && prev !== 0x5c)
  7371. inSingle = false;
  7372. }
  7373. else if (inDouble) {
  7374. if (c === 0x22 && prev !== 0x5c)
  7375. inDouble = false;
  7376. }
  7377. else if (inTemplateString) {
  7378. if (c === 0x60 && prev !== 0x5c)
  7379. inTemplateString = false;
  7380. }
  7381. else if (inRegex) {
  7382. if (c === 0x2f && prev !== 0x5c)
  7383. inRegex = false;
  7384. }
  7385. else if (c === 0x7c && // pipe
  7386. exp.charCodeAt(i + 1) !== 0x7c &&
  7387. exp.charCodeAt(i - 1) !== 0x7c &&
  7388. !curly &&
  7389. !square &&
  7390. !paren) {
  7391. if (expression === undefined) {
  7392. // first filter, end of expression
  7393. lastFilterIndex = i + 1;
  7394. expression = exp.slice(0, i).trim();
  7395. }
  7396. else {
  7397. pushFilter();
  7398. }
  7399. }
  7400. else {
  7401. switch (c) {
  7402. case 0x22:
  7403. inDouble = true;
  7404. break; // "
  7405. case 0x27:
  7406. inSingle = true;
  7407. break; // '
  7408. case 0x60:
  7409. inTemplateString = true;
  7410. break; // `
  7411. case 0x28:
  7412. paren++;
  7413. break; // (
  7414. case 0x29:
  7415. paren--;
  7416. break; // )
  7417. case 0x5b:
  7418. square++;
  7419. break; // [
  7420. case 0x5d:
  7421. square--;
  7422. break; // ]
  7423. case 0x7b:
  7424. curly++;
  7425. break; // {
  7426. case 0x7d:
  7427. curly--;
  7428. break; // }
  7429. }
  7430. if (c === 0x2f) {
  7431. // /
  7432. var j = i - 1;
  7433. var p
  7434. // find first non-whitespace prev char
  7435. = void 0;
  7436. // find first non-whitespace prev char
  7437. for (; j >= 0; j--) {
  7438. p = exp.charAt(j);
  7439. if (p !== ' ')
  7440. break;
  7441. }
  7442. if (!p || !validDivisionCharRE.test(p)) {
  7443. inRegex = true;
  7444. }
  7445. }
  7446. }
  7447. }
  7448. if (expression === undefined) {
  7449. expression = exp.slice(0, i).trim();
  7450. }
  7451. else if (lastFilterIndex !== 0) {
  7452. pushFilter();
  7453. }
  7454. function pushFilter() {
  7455. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  7456. lastFilterIndex = i + 1;
  7457. }
  7458. if (filters) {
  7459. for (i = 0; i < filters.length; i++) {
  7460. expression = wrapFilter(expression, filters[i]);
  7461. }
  7462. }
  7463. return expression;
  7464. }
  7465. function wrapFilter(exp, filter) {
  7466. var i = filter.indexOf('(');
  7467. if (i < 0) {
  7468. // _f: resolveFilter
  7469. return "_f(\"".concat(filter, "\")(").concat(exp, ")");
  7470. }
  7471. else {
  7472. var name_1 = filter.slice(0, i);
  7473. var args = filter.slice(i + 1);
  7474. return "_f(\"".concat(name_1, "\")(").concat(exp).concat(args !== ')' ? ',' + args : args);
  7475. }
  7476. }
  7477. /* eslint-disable no-unused-vars */
  7478. function baseWarn(msg, range) {
  7479. console.error("[Vue compiler]: ".concat(msg));
  7480. }
  7481. /* eslint-enable no-unused-vars */
  7482. function pluckModuleFunction(modules, key) {
  7483. return modules ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; }) : [];
  7484. }
  7485. function addProp(el, name, value, range, dynamic) {
  7486. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  7487. el.plain = false;
  7488. }
  7489. function addAttr(el, name, value, range, dynamic) {
  7490. var attrs = dynamic
  7491. ? el.dynamicAttrs || (el.dynamicAttrs = [])
  7492. : el.attrs || (el.attrs = []);
  7493. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  7494. el.plain = false;
  7495. }
  7496. // add a raw attr (use this in preTransforms)
  7497. function addRawAttr(el, name, value, range) {
  7498. el.attrsMap[name] = value;
  7499. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  7500. }
  7501. function addDirective(el, name, rawName, value, arg, isDynamicArg, modifiers, range) {
  7502. (el.directives || (el.directives = [])).push(rangeSetItem({
  7503. name: name,
  7504. rawName: rawName,
  7505. value: value,
  7506. arg: arg,
  7507. isDynamicArg: isDynamicArg,
  7508. modifiers: modifiers
  7509. }, range));
  7510. el.plain = false;
  7511. }
  7512. function prependModifierMarker(symbol, name, dynamic) {
  7513. return dynamic ? "_p(".concat(name, ",\"").concat(symbol, "\")") : symbol + name; // mark the event as captured
  7514. }
  7515. function addHandler(el, name, value, modifiers, important, warn, range, dynamic) {
  7516. modifiers = modifiers || emptyObject;
  7517. // warn prevent and passive modifier
  7518. /* istanbul ignore if */
  7519. if (process.env.NODE_ENV !== 'production' && warn && modifiers.prevent && modifiers.passive) {
  7520. warn("passive and prevent can't be used together. " +
  7521. "Passive handler can't prevent default event.", range);
  7522. }
  7523. // normalize click.right and click.middle since they don't actually fire
  7524. // this is technically browser-specific, but at least for now browsers are
  7525. // the only target envs that have right/middle clicks.
  7526. if (modifiers.right) {
  7527. if (dynamic) {
  7528. name = "(".concat(name, ")==='click'?'contextmenu':(").concat(name, ")");
  7529. }
  7530. else if (name === 'click') {
  7531. name = 'contextmenu';
  7532. delete modifiers.right;
  7533. }
  7534. }
  7535. else if (modifiers.middle) {
  7536. if (dynamic) {
  7537. name = "(".concat(name, ")==='click'?'mouseup':(").concat(name, ")");
  7538. }
  7539. else if (name === 'click') {
  7540. name = 'mouseup';
  7541. }
  7542. }
  7543. // check capture modifier
  7544. if (modifiers.capture) {
  7545. delete modifiers.capture;
  7546. name = prependModifierMarker('!', name, dynamic);
  7547. }
  7548. if (modifiers.once) {
  7549. delete modifiers.once;
  7550. name = prependModifierMarker('~', name, dynamic);
  7551. }
  7552. /* istanbul ignore if */
  7553. if (modifiers.passive) {
  7554. delete modifiers.passive;
  7555. name = prependModifierMarker('&', name, dynamic);
  7556. }
  7557. var events;
  7558. if (modifiers.native) {
  7559. delete modifiers.native;
  7560. events = el.nativeEvents || (el.nativeEvents = {});
  7561. }
  7562. else {
  7563. events = el.events || (el.events = {});
  7564. }
  7565. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  7566. if (modifiers !== emptyObject) {
  7567. newHandler.modifiers = modifiers;
  7568. }
  7569. var handlers = events[name];
  7570. /* istanbul ignore if */
  7571. if (Array.isArray(handlers)) {
  7572. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  7573. }
  7574. else if (handlers) {
  7575. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  7576. }
  7577. else {
  7578. events[name] = newHandler;
  7579. }
  7580. el.plain = false;
  7581. }
  7582. function getRawBindingAttr(el, name) {
  7583. return (el.rawAttrsMap[':' + name] ||
  7584. el.rawAttrsMap['v-bind:' + name] ||
  7585. el.rawAttrsMap[name]);
  7586. }
  7587. function getBindingAttr(el, name, getStatic) {
  7588. var dynamicValue = getAndRemoveAttr(el, ':' + name) || getAndRemoveAttr(el, 'v-bind:' + name);
  7589. if (dynamicValue != null) {
  7590. return parseFilters(dynamicValue);
  7591. }
  7592. else if (getStatic !== false) {
  7593. var staticValue = getAndRemoveAttr(el, name);
  7594. if (staticValue != null) {
  7595. return JSON.stringify(staticValue);
  7596. }
  7597. }
  7598. }
  7599. // note: this only removes the attr from the Array (attrsList) so that it
  7600. // doesn't get processed by processAttrs.
  7601. // By default it does NOT remove it from the map (attrsMap) because the map is
  7602. // needed during codegen.
  7603. function getAndRemoveAttr(el, name, removeFromMap) {
  7604. var val;
  7605. if ((val = el.attrsMap[name]) != null) {
  7606. var list = el.attrsList;
  7607. for (var i = 0, l = list.length; i < l; i++) {
  7608. if (list[i].name === name) {
  7609. list.splice(i, 1);
  7610. break;
  7611. }
  7612. }
  7613. }
  7614. if (removeFromMap) {
  7615. delete el.attrsMap[name];
  7616. }
  7617. return val;
  7618. }
  7619. function getAndRemoveAttrByRegex(el, name) {
  7620. var list = el.attrsList;
  7621. for (var i = 0, l = list.length; i < l; i++) {
  7622. var attr = list[i];
  7623. if (name.test(attr.name)) {
  7624. list.splice(i, 1);
  7625. return attr;
  7626. }
  7627. }
  7628. }
  7629. function rangeSetItem(item, range) {
  7630. if (range) {
  7631. if (range.start != null) {
  7632. item.start = range.start;
  7633. }
  7634. if (range.end != null) {
  7635. item.end = range.end;
  7636. }
  7637. }
  7638. return item;
  7639. }
  7640. /**
  7641. * Cross-platform code generation for component v-model
  7642. */
  7643. function genComponentModel(el, value, modifiers) {
  7644. var _a = modifiers || {}, number = _a.number, trim = _a.trim;
  7645. var baseValueExpression = '$$v';
  7646. var valueExpression = baseValueExpression;
  7647. if (trim) {
  7648. valueExpression =
  7649. "(typeof ".concat(baseValueExpression, " === 'string'") +
  7650. "? ".concat(baseValueExpression, ".trim()") +
  7651. ": ".concat(baseValueExpression, ")");
  7652. }
  7653. if (number) {
  7654. valueExpression = "_n(".concat(valueExpression, ")");
  7655. }
  7656. var assignment = genAssignmentCode(value, valueExpression);
  7657. el.model = {
  7658. value: "(".concat(value, ")"),
  7659. expression: JSON.stringify(value),
  7660. callback: "function (".concat(baseValueExpression, ") {").concat(assignment, "}")
  7661. };
  7662. }
  7663. /**
  7664. * Cross-platform codegen helper for generating v-model value assignment code.
  7665. */
  7666. function genAssignmentCode(value, assignment) {
  7667. var res = parseModel(value);
  7668. if (res.key === null) {
  7669. return "".concat(value, "=").concat(assignment);
  7670. }
  7671. else {
  7672. return "$set(".concat(res.exp, ", ").concat(res.key, ", ").concat(assignment, ")");
  7673. }
  7674. }
  7675. /**
  7676. * Parse a v-model expression into a base path and a final key segment.
  7677. * Handles both dot-path and possible square brackets.
  7678. *
  7679. * Possible cases:
  7680. *
  7681. * - test
  7682. * - test[key]
  7683. * - test[test1[key]]
  7684. * - test["a"][key]
  7685. * - xxx.test[a[a].test1[key]]
  7686. * - test.xxx.a["asa"][test1[key]]
  7687. *
  7688. */
  7689. var len, str, chr, index, expressionPos, expressionEndPos;
  7690. function parseModel(val) {
  7691. // Fix https://github.com/vuejs/vue/pull/7730
  7692. // allow v-model="obj.val " (trailing whitespace)
  7693. val = val.trim();
  7694. len = val.length;
  7695. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  7696. index = val.lastIndexOf('.');
  7697. if (index > -1) {
  7698. return {
  7699. exp: val.slice(0, index),
  7700. key: '"' + val.slice(index + 1) + '"'
  7701. };
  7702. }
  7703. else {
  7704. return {
  7705. exp: val,
  7706. key: null
  7707. };
  7708. }
  7709. }
  7710. str = val;
  7711. index = expressionPos = expressionEndPos = 0;
  7712. while (!eof()) {
  7713. chr = next();
  7714. /* istanbul ignore if */
  7715. if (isStringStart(chr)) {
  7716. parseString(chr);
  7717. }
  7718. else if (chr === 0x5b) {
  7719. parseBracket(chr);
  7720. }
  7721. }
  7722. return {
  7723. exp: val.slice(0, expressionPos),
  7724. key: val.slice(expressionPos + 1, expressionEndPos)
  7725. };
  7726. }
  7727. function next() {
  7728. return str.charCodeAt(++index);
  7729. }
  7730. function eof() {
  7731. return index >= len;
  7732. }
  7733. function isStringStart(chr) {
  7734. return chr === 0x22 || chr === 0x27;
  7735. }
  7736. function parseBracket(chr) {
  7737. var inBracket = 1;
  7738. expressionPos = index;
  7739. while (!eof()) {
  7740. chr = next();
  7741. if (isStringStart(chr)) {
  7742. parseString(chr);
  7743. continue;
  7744. }
  7745. if (chr === 0x5b)
  7746. inBracket++;
  7747. if (chr === 0x5d)
  7748. inBracket--;
  7749. if (inBracket === 0) {
  7750. expressionEndPos = index;
  7751. break;
  7752. }
  7753. }
  7754. }
  7755. function parseString(chr) {
  7756. var stringQuote = chr;
  7757. while (!eof()) {
  7758. chr = next();
  7759. if (chr === stringQuote) {
  7760. break;
  7761. }
  7762. }
  7763. }
  7764. var warn$1;
  7765. // in some cases, the event used has to be determined at runtime
  7766. // so we used some reserved tokens during compile.
  7767. var RANGE_TOKEN = '__r';
  7768. var CHECKBOX_RADIO_TOKEN = '__c';
  7769. function model$1(el, dir, _warn) {
  7770. warn$1 = _warn;
  7771. var value = dir.value;
  7772. var modifiers = dir.modifiers;
  7773. var tag = el.tag;
  7774. var type = el.attrsMap.type;
  7775. if (process.env.NODE_ENV !== 'production') {
  7776. // inputs with type="file" are read only and setting the input's
  7777. // value will throw an error.
  7778. if (tag === 'input' && type === 'file') {
  7779. warn$1("<".concat(el.tag, " v-model=\"").concat(value, "\" type=\"file\">:\n") +
  7780. "File inputs are read only. Use a v-on:change listener instead.", el.rawAttrsMap['v-model']);
  7781. }
  7782. }
  7783. if (el.component) {
  7784. genComponentModel(el, value, modifiers);
  7785. // component v-model doesn't need extra runtime
  7786. return false;
  7787. }
  7788. else if (tag === 'select') {
  7789. genSelect(el, value, modifiers);
  7790. }
  7791. else if (tag === 'input' && type === 'checkbox') {
  7792. genCheckboxModel(el, value, modifiers);
  7793. }
  7794. else if (tag === 'input' && type === 'radio') {
  7795. genRadioModel(el, value, modifiers);
  7796. }
  7797. else if (tag === 'input' || tag === 'textarea') {
  7798. genDefaultModel(el, value, modifiers);
  7799. }
  7800. else if (!config.isReservedTag(tag)) {
  7801. genComponentModel(el, value, modifiers);
  7802. // component v-model doesn't need extra runtime
  7803. return false;
  7804. }
  7805. else if (process.env.NODE_ENV !== 'production') {
  7806. warn$1("<".concat(el.tag, " v-model=\"").concat(value, "\">: ") +
  7807. "v-model is not supported on this element type. " +
  7808. "If you are working with contenteditable, it's recommended to " +
  7809. 'wrap a library dedicated for that purpose inside a custom component.', el.rawAttrsMap['v-model']);
  7810. }
  7811. // ensure runtime directive metadata
  7812. return true;
  7813. }
  7814. function genCheckboxModel(el, value, modifiers) {
  7815. var number = modifiers && modifiers.number;
  7816. var valueBinding = getBindingAttr(el, 'value') || 'null';
  7817. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  7818. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  7819. addProp(el, 'checked', "Array.isArray(".concat(value, ")") +
  7820. "?_i(".concat(value, ",").concat(valueBinding, ")>-1") +
  7821. (trueValueBinding === 'true'
  7822. ? ":(".concat(value, ")")
  7823. : ":_q(".concat(value, ",").concat(trueValueBinding, ")")));
  7824. addHandler(el, 'change', "var $$a=".concat(value, ",") +
  7825. '$$el=$event.target,' +
  7826. "$$c=$$el.checked?(".concat(trueValueBinding, "):(").concat(falseValueBinding, ");") +
  7827. 'if(Array.isArray($$a)){' +
  7828. "var $$v=".concat(number ? '_n(' + valueBinding + ')' : valueBinding, ",") +
  7829. '$$i=_i($$a,$$v);' +
  7830. "if($$el.checked){$$i<0&&(".concat(genAssignmentCode(value, '$$a.concat([$$v])'), ")}") +
  7831. "else{$$i>-1&&(".concat(genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))'), ")}") +
  7832. "}else{".concat(genAssignmentCode(value, '$$c'), "}"), null, true);
  7833. }
  7834. function genRadioModel(el, value, modifiers) {
  7835. var number = modifiers && modifiers.number;
  7836. var valueBinding = getBindingAttr(el, 'value') || 'null';
  7837. valueBinding = number ? "_n(".concat(valueBinding, ")") : valueBinding;
  7838. addProp(el, 'checked', "_q(".concat(value, ",").concat(valueBinding, ")"));
  7839. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  7840. }
  7841. function genSelect(el, value, modifiers) {
  7842. var number = modifiers && modifiers.number;
  7843. var selectedVal = "Array.prototype.filter" +
  7844. ".call($event.target.options,function(o){return o.selected})" +
  7845. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  7846. "return ".concat(number ? '_n(val)' : 'val', "})");
  7847. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  7848. var code = "var $$selectedVal = ".concat(selectedVal, ";");
  7849. code = "".concat(code, " ").concat(genAssignmentCode(value, assignment));
  7850. addHandler(el, 'change', code, null, true);
  7851. }
  7852. function genDefaultModel(el, value, modifiers) {
  7853. var type = el.attrsMap.type;
  7854. // warn if v-bind:value conflicts with v-model
  7855. // except for inputs with v-bind:type
  7856. if (process.env.NODE_ENV !== 'production') {
  7857. var value_1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  7858. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  7859. if (value_1 && !typeBinding) {
  7860. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  7861. warn$1("".concat(binding, "=\"").concat(value_1, "\" conflicts with v-model on the same element ") +
  7862. 'because the latter already expands to a value binding internally', el.rawAttrsMap[binding]);
  7863. }
  7864. }
  7865. var _a = modifiers || {}, lazy = _a.lazy, number = _a.number, trim = _a.trim;
  7866. var needCompositionGuard = !lazy && type !== 'range';
  7867. var event = lazy ? 'change' : type === 'range' ? RANGE_TOKEN : 'input';
  7868. var valueExpression = '$event.target.value';
  7869. if (trim) {
  7870. valueExpression = "$event.target.value.trim()";
  7871. }
  7872. if (number) {
  7873. valueExpression = "_n(".concat(valueExpression, ")");
  7874. }
  7875. var code = genAssignmentCode(value, valueExpression);
  7876. if (needCompositionGuard) {
  7877. code = "if($event.target.composing)return;".concat(code);
  7878. }
  7879. addProp(el, 'value', "(".concat(value, ")"));
  7880. addHandler(el, event, code, null, true);
  7881. if (trim || number) {
  7882. addHandler(el, 'blur', '$forceUpdate()');
  7883. }
  7884. }
  7885. // normalize v-model event tokens that can only be determined at runtime.
  7886. // it's important to place the event as the first in the array because
  7887. // the whole point is ensuring the v-model callback gets called before
  7888. // user-attached handlers.
  7889. function normalizeEvents(on) {
  7890. /* istanbul ignore if */
  7891. if (isDef(on[RANGE_TOKEN])) {
  7892. // IE input[type=range] only supports `change` event
  7893. var event_1 = isIE ? 'change' : 'input';
  7894. on[event_1] = [].concat(on[RANGE_TOKEN], on[event_1] || []);
  7895. delete on[RANGE_TOKEN];
  7896. }
  7897. // This was originally intended to fix #4521 but no longer necessary
  7898. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  7899. /* istanbul ignore if */
  7900. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  7901. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  7902. delete on[CHECKBOX_RADIO_TOKEN];
  7903. }
  7904. }
  7905. var target;
  7906. function createOnceHandler(event, handler, capture) {
  7907. var _target = target; // save current target element in closure
  7908. return function onceHandler() {
  7909. var res = handler.apply(null, arguments);
  7910. if (res !== null) {
  7911. remove(event, onceHandler, capture, _target);
  7912. }
  7913. };
  7914. }
  7915. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  7916. // implementation and does not fire microtasks in between event propagation, so
  7917. // safe to exclude.
  7918. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  7919. function add(name, handler, capture, passive) {
  7920. // async edge case #6566: inner click event triggers patch, event handler
  7921. // attached to outer element during patch, and triggered again. This
  7922. // happens because browsers fire microtask ticks between event propagation.
  7923. // the solution is simple: we save the timestamp when a handler is attached,
  7924. // and the handler would only fire if the event passed to it was fired
  7925. // AFTER it was attached.
  7926. if (useMicrotaskFix) {
  7927. var attachedTimestamp_1 = currentFlushTimestamp;
  7928. var original_1 = handler;
  7929. //@ts-expect-error
  7930. handler = original_1._wrapper = function (e) {
  7931. if (
  7932. // no bubbling, should always fire.
  7933. // this is just a safety net in case event.timeStamp is unreliable in
  7934. // certain weird environments...
  7935. e.target === e.currentTarget ||
  7936. // event is fired after handler attachment
  7937. e.timeStamp >= attachedTimestamp_1 ||
  7938. // bail for environments that have buggy event.timeStamp implementations
  7939. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  7940. // #9681 QtWebEngine event.timeStamp is negative value
  7941. e.timeStamp <= 0 ||
  7942. // #9448 bail if event is fired in another document in a multi-page
  7943. // electron/nw.js app, since event.timeStamp will be using a different
  7944. // starting reference
  7945. e.target.ownerDocument !== document) {
  7946. return original_1.apply(this, arguments);
  7947. }
  7948. };
  7949. }
  7950. target.addEventListener(name, handler, supportsPassive ? { capture: capture, passive: passive } : capture);
  7951. }
  7952. function remove(name, handler, capture, _target) {
  7953. (_target || target).removeEventListener(name,
  7954. //@ts-expect-error
  7955. handler._wrapper || handler, capture);
  7956. }
  7957. function updateDOMListeners(oldVnode, vnode) {
  7958. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  7959. return;
  7960. }
  7961. var on = vnode.data.on || {};
  7962. var oldOn = oldVnode.data.on || {};
  7963. // vnode is empty when removing all listeners,
  7964. // and use old vnode dom element
  7965. target = vnode.elm || oldVnode.elm;
  7966. normalizeEvents(on);
  7967. updateListeners(on, oldOn, add, remove, createOnceHandler, vnode.context);
  7968. target = undefined;
  7969. }
  7970. var events = {
  7971. create: updateDOMListeners,
  7972. update: updateDOMListeners,
  7973. // @ts-expect-error emptyNode has actually data
  7974. destroy: function (vnode) { return updateDOMListeners(vnode, emptyNode); }
  7975. };
  7976. var svgContainer;
  7977. function updateDOMProps(oldVnode, vnode) {
  7978. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  7979. return;
  7980. }
  7981. var key, cur;
  7982. var elm = vnode.elm;
  7983. var oldProps = oldVnode.data.domProps || {};
  7984. var props = vnode.data.domProps || {};
  7985. // clone observed objects, as the user probably wants to mutate it
  7986. if (isDef(props.__ob__) || isTrue(props._v_attr_proxy)) {
  7987. props = vnode.data.domProps = extend({}, props);
  7988. }
  7989. for (key in oldProps) {
  7990. if (!(key in props)) {
  7991. elm[key] = '';
  7992. }
  7993. }
  7994. for (key in props) {
  7995. cur = props[key];
  7996. // ignore children if the node has textContent or innerHTML,
  7997. // as these will throw away existing DOM nodes and cause removal errors
  7998. // on subsequent patches (#3360)
  7999. if (key === 'textContent' || key === 'innerHTML') {
  8000. if (vnode.children)
  8001. vnode.children.length = 0;
  8002. if (cur === oldProps[key])
  8003. continue;
  8004. // #6601 work around Chrome version <= 55 bug where single textNode
  8005. // replaced by innerHTML/textContent retains its parentNode property
  8006. if (elm.childNodes.length === 1) {
  8007. elm.removeChild(elm.childNodes[0]);
  8008. }
  8009. }
  8010. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  8011. // store value as _value as well since
  8012. // non-string values will be stringified
  8013. elm._value = cur;
  8014. // avoid resetting cursor position when value is the same
  8015. var strCur = isUndef(cur) ? '' : String(cur);
  8016. if (shouldUpdateValue(elm, strCur)) {
  8017. elm.value = strCur;
  8018. }
  8019. }
  8020. else if (key === 'innerHTML' &&
  8021. isSVG(elm.tagName) &&
  8022. isUndef(elm.innerHTML)) {
  8023. // IE doesn't support innerHTML for SVG elements
  8024. svgContainer = svgContainer || document.createElement('div');
  8025. svgContainer.innerHTML = "<svg>".concat(cur, "</svg>");
  8026. var svg = svgContainer.firstChild;
  8027. while (elm.firstChild) {
  8028. elm.removeChild(elm.firstChild);
  8029. }
  8030. while (svg.firstChild) {
  8031. elm.appendChild(svg.firstChild);
  8032. }
  8033. }
  8034. else if (
  8035. // skip the update if old and new VDOM state is the same.
  8036. // `value` is handled separately because the DOM value may be temporarily
  8037. // out of sync with VDOM state due to focus, composition and modifiers.
  8038. // This #4521 by skipping the unnecessary `checked` update.
  8039. cur !== oldProps[key]) {
  8040. // some property updates can throw
  8041. // e.g. `value` on <progress> w/ non-finite value
  8042. try {
  8043. elm[key] = cur;
  8044. }
  8045. catch (e) { }
  8046. }
  8047. }
  8048. }
  8049. function shouldUpdateValue(elm, checkVal) {
  8050. return (
  8051. //@ts-expect-error
  8052. !elm.composing &&
  8053. (elm.tagName === 'OPTION' ||
  8054. isNotInFocusAndDirty(elm, checkVal) ||
  8055. isDirtyWithModifiers(elm, checkVal)));
  8056. }
  8057. function isNotInFocusAndDirty(elm, checkVal) {
  8058. // return true when textbox (.number and .trim) loses focus and its value is
  8059. // not equal to the updated value
  8060. var notInFocus = true;
  8061. // #6157
  8062. // work around IE bug when accessing document.activeElement in an iframe
  8063. try {
  8064. notInFocus = document.activeElement !== elm;
  8065. }
  8066. catch (e) { }
  8067. return notInFocus && elm.value !== checkVal;
  8068. }
  8069. function isDirtyWithModifiers(elm, newVal) {
  8070. var value = elm.value;
  8071. var modifiers = elm._vModifiers; // injected by v-model runtime
  8072. if (isDef(modifiers)) {
  8073. if (modifiers.number) {
  8074. return toNumber(value) !== toNumber(newVal);
  8075. }
  8076. if (modifiers.trim) {
  8077. return value.trim() !== newVal.trim();
  8078. }
  8079. }
  8080. return value !== newVal;
  8081. }
  8082. var domProps = {
  8083. create: updateDOMProps,
  8084. update: updateDOMProps
  8085. };
  8086. var parseStyleText = cached(function (cssText) {
  8087. var res = {};
  8088. var listDelimiter = /;(?![^(]*\))/g;
  8089. var propertyDelimiter = /:(.+)/;
  8090. cssText.split(listDelimiter).forEach(function (item) {
  8091. if (item) {
  8092. var tmp = item.split(propertyDelimiter);
  8093. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  8094. }
  8095. });
  8096. return res;
  8097. });
  8098. // merge static and dynamic style data on the same vnode
  8099. function normalizeStyleData(data) {
  8100. var style = normalizeStyleBinding(data.style);
  8101. // static style is pre-processed into an object during compilation
  8102. // and is always a fresh object, so it's safe to merge into it
  8103. return data.staticStyle ? extend(data.staticStyle, style) : style;
  8104. }
  8105. // normalize possible array / string values into Object
  8106. function normalizeStyleBinding(bindingStyle) {
  8107. if (Array.isArray(bindingStyle)) {
  8108. return toObject(bindingStyle);
  8109. }
  8110. if (typeof bindingStyle === 'string') {
  8111. return parseStyleText(bindingStyle);
  8112. }
  8113. return bindingStyle;
  8114. }
  8115. /**
  8116. * parent component style should be after child's
  8117. * so that parent component's style could override it
  8118. */
  8119. function getStyle(vnode, checkChild) {
  8120. var res = {};
  8121. var styleData;
  8122. if (checkChild) {
  8123. var childNode = vnode;
  8124. while (childNode.componentInstance) {
  8125. childNode = childNode.componentInstance._vnode;
  8126. if (childNode &&
  8127. childNode.data &&
  8128. (styleData = normalizeStyleData(childNode.data))) {
  8129. extend(res, styleData);
  8130. }
  8131. }
  8132. }
  8133. if ((styleData = normalizeStyleData(vnode.data))) {
  8134. extend(res, styleData);
  8135. }
  8136. var parentNode = vnode;
  8137. // @ts-expect-error parentNode.parent not VNodeWithData
  8138. while ((parentNode = parentNode.parent)) {
  8139. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  8140. extend(res, styleData);
  8141. }
  8142. }
  8143. return res;
  8144. }
  8145. var cssVarRE = /^--/;
  8146. var importantRE = /\s*!important$/;
  8147. var setProp = function (el, name, val) {
  8148. /* istanbul ignore if */
  8149. if (cssVarRE.test(name)) {
  8150. el.style.setProperty(name, val);
  8151. }
  8152. else if (importantRE.test(val)) {
  8153. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  8154. }
  8155. else {
  8156. var normalizedName = normalize(name);
  8157. if (Array.isArray(val)) {
  8158. // Support values array created by autoprefixer, e.g.
  8159. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  8160. // Set them one by one, and the browser will only set those it can recognize
  8161. for (var i = 0, len = val.length; i < len; i++) {
  8162. el.style[normalizedName] = val[i];
  8163. }
  8164. }
  8165. else {
  8166. el.style[normalizedName] = val;
  8167. }
  8168. }
  8169. };
  8170. var vendorNames = ['Webkit', 'Moz', 'ms'];
  8171. var emptyStyle;
  8172. var normalize = cached(function (prop) {
  8173. emptyStyle = emptyStyle || document.createElement('div').style;
  8174. prop = camelize(prop);
  8175. if (prop !== 'filter' && prop in emptyStyle) {
  8176. return prop;
  8177. }
  8178. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  8179. for (var i = 0; i < vendorNames.length; i++) {
  8180. var name_1 = vendorNames[i] + capName;
  8181. if (name_1 in emptyStyle) {
  8182. return name_1;
  8183. }
  8184. }
  8185. });
  8186. function updateStyle(oldVnode, vnode) {
  8187. var data = vnode.data;
  8188. var oldData = oldVnode.data;
  8189. if (isUndef(data.staticStyle) &&
  8190. isUndef(data.style) &&
  8191. isUndef(oldData.staticStyle) &&
  8192. isUndef(oldData.style)) {
  8193. return;
  8194. }
  8195. var cur, name;
  8196. var el = vnode.elm;
  8197. var oldStaticStyle = oldData.staticStyle;
  8198. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  8199. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  8200. var oldStyle = oldStaticStyle || oldStyleBinding;
  8201. var style = normalizeStyleBinding(vnode.data.style) || {};
  8202. // store normalized style under a different key for next diff
  8203. // make sure to clone it if it's reactive, since the user likely wants
  8204. // to mutate it.
  8205. vnode.data.normalizedStyle = isDef(style.__ob__) ? extend({}, style) : style;
  8206. var newStyle = getStyle(vnode, true);
  8207. for (name in oldStyle) {
  8208. if (isUndef(newStyle[name])) {
  8209. setProp(el, name, '');
  8210. }
  8211. }
  8212. for (name in newStyle) {
  8213. cur = newStyle[name];
  8214. // ie9 setting to null has no effect, must use empty string
  8215. setProp(el, name, cur == null ? '' : cur);
  8216. }
  8217. }
  8218. var style$1 = {
  8219. create: updateStyle,
  8220. update: updateStyle
  8221. };
  8222. var whitespaceRE$1 = /\s+/;
  8223. /**
  8224. * Add class with compatibility for SVG since classList is not supported on
  8225. * SVG elements in IE
  8226. */
  8227. function addClass(el, cls) {
  8228. /* istanbul ignore if */
  8229. if (!cls || !(cls = cls.trim())) {
  8230. return;
  8231. }
  8232. /* istanbul ignore else */
  8233. if (el.classList) {
  8234. if (cls.indexOf(' ') > -1) {
  8235. cls.split(whitespaceRE$1).forEach(function (c) { return el.classList.add(c); });
  8236. }
  8237. else {
  8238. el.classList.add(cls);
  8239. }
  8240. }
  8241. else {
  8242. var cur = " ".concat(el.getAttribute('class') || '', " ");
  8243. if (cur.indexOf(' ' + cls + ' ') < 0) {
  8244. el.setAttribute('class', (cur + cls).trim());
  8245. }
  8246. }
  8247. }
  8248. /**
  8249. * Remove class with compatibility for SVG since classList is not supported on
  8250. * SVG elements in IE
  8251. */
  8252. function removeClass(el, cls) {
  8253. /* istanbul ignore if */
  8254. if (!cls || !(cls = cls.trim())) {
  8255. return;
  8256. }
  8257. /* istanbul ignore else */
  8258. if (el.classList) {
  8259. if (cls.indexOf(' ') > -1) {
  8260. cls.split(whitespaceRE$1).forEach(function (c) { return el.classList.remove(c); });
  8261. }
  8262. else {
  8263. el.classList.remove(cls);
  8264. }
  8265. if (!el.classList.length) {
  8266. el.removeAttribute('class');
  8267. }
  8268. }
  8269. else {
  8270. var cur = " ".concat(el.getAttribute('class') || '', " ");
  8271. var tar = ' ' + cls + ' ';
  8272. while (cur.indexOf(tar) >= 0) {
  8273. cur = cur.replace(tar, ' ');
  8274. }
  8275. cur = cur.trim();
  8276. if (cur) {
  8277. el.setAttribute('class', cur);
  8278. }
  8279. else {
  8280. el.removeAttribute('class');
  8281. }
  8282. }
  8283. }
  8284. function resolveTransition(def) {
  8285. if (!def) {
  8286. return;
  8287. }
  8288. /* istanbul ignore else */
  8289. if (typeof def === 'object') {
  8290. var res = {};
  8291. if (def.css !== false) {
  8292. extend(res, autoCssTransition(def.name || 'v'));
  8293. }
  8294. extend(res, def);
  8295. return res;
  8296. }
  8297. else if (typeof def === 'string') {
  8298. return autoCssTransition(def);
  8299. }
  8300. }
  8301. var autoCssTransition = cached(function (name) {
  8302. return {
  8303. enterClass: "".concat(name, "-enter"),
  8304. enterToClass: "".concat(name, "-enter-to"),
  8305. enterActiveClass: "".concat(name, "-enter-active"),
  8306. leaveClass: "".concat(name, "-leave"),
  8307. leaveToClass: "".concat(name, "-leave-to"),
  8308. leaveActiveClass: "".concat(name, "-leave-active")
  8309. };
  8310. });
  8311. var hasTransition = inBrowser && !isIE9;
  8312. var TRANSITION = 'transition';
  8313. var ANIMATION = 'animation';
  8314. // Transition property/event sniffing
  8315. var transitionProp = 'transition';
  8316. var transitionEndEvent = 'transitionend';
  8317. var animationProp = 'animation';
  8318. var animationEndEvent = 'animationend';
  8319. if (hasTransition) {
  8320. /* istanbul ignore if */
  8321. if (window.ontransitionend === undefined &&
  8322. window.onwebkittransitionend !== undefined) {
  8323. transitionProp = 'WebkitTransition';
  8324. transitionEndEvent = 'webkitTransitionEnd';
  8325. }
  8326. if (window.onanimationend === undefined &&
  8327. window.onwebkitanimationend !== undefined) {
  8328. animationProp = 'WebkitAnimation';
  8329. animationEndEvent = 'webkitAnimationEnd';
  8330. }
  8331. }
  8332. // binding to window is necessary to make hot reload work in IE in strict mode
  8333. var raf = inBrowser
  8334. ? window.requestAnimationFrame
  8335. ? window.requestAnimationFrame.bind(window)
  8336. : setTimeout
  8337. : /* istanbul ignore next */ function (/* istanbul ignore next */ fn) { return fn(); };
  8338. function nextFrame(fn) {
  8339. raf(function () {
  8340. // @ts-expect-error
  8341. raf(fn);
  8342. });
  8343. }
  8344. function addTransitionClass(el, cls) {
  8345. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  8346. if (transitionClasses.indexOf(cls) < 0) {
  8347. transitionClasses.push(cls);
  8348. addClass(el, cls);
  8349. }
  8350. }
  8351. function removeTransitionClass(el, cls) {
  8352. if (el._transitionClasses) {
  8353. remove$2(el._transitionClasses, cls);
  8354. }
  8355. removeClass(el, cls);
  8356. }
  8357. function whenTransitionEnds(el, expectedType, cb) {
  8358. var _a = getTransitionInfo(el, expectedType), type = _a.type, timeout = _a.timeout, propCount = _a.propCount;
  8359. if (!type)
  8360. return cb();
  8361. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  8362. var ended = 0;
  8363. var end = function () {
  8364. el.removeEventListener(event, onEnd);
  8365. cb();
  8366. };
  8367. var onEnd = function (e) {
  8368. if (e.target === el) {
  8369. if (++ended >= propCount) {
  8370. end();
  8371. }
  8372. }
  8373. };
  8374. setTimeout(function () {
  8375. if (ended < propCount) {
  8376. end();
  8377. }
  8378. }, timeout + 1);
  8379. el.addEventListener(event, onEnd);
  8380. }
  8381. var transformRE = /\b(transform|all)(,|$)/;
  8382. function getTransitionInfo(el, expectedType) {
  8383. var styles = window.getComputedStyle(el);
  8384. // JSDOM may return undefined for transition properties
  8385. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  8386. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  8387. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  8388. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  8389. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  8390. var animationTimeout = getTimeout(animationDelays, animationDurations);
  8391. var type;
  8392. var timeout = 0;
  8393. var propCount = 0;
  8394. /* istanbul ignore if */
  8395. if (expectedType === TRANSITION) {
  8396. if (transitionTimeout > 0) {
  8397. type = TRANSITION;
  8398. timeout = transitionTimeout;
  8399. propCount = transitionDurations.length;
  8400. }
  8401. }
  8402. else if (expectedType === ANIMATION) {
  8403. if (animationTimeout > 0) {
  8404. type = ANIMATION;
  8405. timeout = animationTimeout;
  8406. propCount = animationDurations.length;
  8407. }
  8408. }
  8409. else {
  8410. timeout = Math.max(transitionTimeout, animationTimeout);
  8411. type =
  8412. timeout > 0
  8413. ? transitionTimeout > animationTimeout
  8414. ? TRANSITION
  8415. : ANIMATION
  8416. : null;
  8417. propCount = type
  8418. ? type === TRANSITION
  8419. ? transitionDurations.length
  8420. : animationDurations.length
  8421. : 0;
  8422. }
  8423. var hasTransform = type === TRANSITION && transformRE.test(styles[transitionProp + 'Property']);
  8424. return {
  8425. type: type,
  8426. timeout: timeout,
  8427. propCount: propCount,
  8428. hasTransform: hasTransform
  8429. };
  8430. }
  8431. function getTimeout(delays, durations) {
  8432. /* istanbul ignore next */
  8433. while (delays.length < durations.length) {
  8434. delays = delays.concat(delays);
  8435. }
  8436. return Math.max.apply(null, durations.map(function (d, i) {
  8437. return toMs(d) + toMs(delays[i]);
  8438. }));
  8439. }
  8440. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  8441. // in a locale-dependent way, using a comma instead of a dot.
  8442. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  8443. // as a floor function) causing unexpected behaviors
  8444. function toMs(s) {
  8445. return Number(s.slice(0, -1).replace(',', '.')) * 1000;
  8446. }
  8447. function enter(vnode, toggleDisplay) {
  8448. var el = vnode.elm;
  8449. // call leave callback now
  8450. if (isDef(el._leaveCb)) {
  8451. el._leaveCb.cancelled = true;
  8452. el._leaveCb();
  8453. }
  8454. var data = resolveTransition(vnode.data.transition);
  8455. if (isUndef(data)) {
  8456. return;
  8457. }
  8458. /* istanbul ignore if */
  8459. if (isDef(el._enterCb) || el.nodeType !== 1) {
  8460. return;
  8461. }
  8462. 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;
  8463. // activeInstance will always be the <transition> component managing this
  8464. // transition. One edge case to check is when the <transition> is placed
  8465. // as the root node of a child component. In that case we need to check
  8466. // <transition>'s parent for appear check.
  8467. var context = activeInstance;
  8468. var transitionNode = activeInstance.$vnode;
  8469. while (transitionNode && transitionNode.parent) {
  8470. context = transitionNode.context;
  8471. transitionNode = transitionNode.parent;
  8472. }
  8473. var isAppear = !context._isMounted || !vnode.isRootInsert;
  8474. if (isAppear && !appear && appear !== '') {
  8475. return;
  8476. }
  8477. var startClass = isAppear && appearClass ? appearClass : enterClass;
  8478. var activeClass = isAppear && appearActiveClass ? appearActiveClass : enterActiveClass;
  8479. var toClass = isAppear && appearToClass ? appearToClass : enterToClass;
  8480. var beforeEnterHook = isAppear ? beforeAppear || beforeEnter : beforeEnter;
  8481. var enterHook = isAppear ? (isFunction(appear) ? appear : enter) : enter;
  8482. var afterEnterHook = isAppear ? afterAppear || afterEnter : afterEnter;
  8483. var enterCancelledHook = isAppear
  8484. ? appearCancelled || enterCancelled
  8485. : enterCancelled;
  8486. var explicitEnterDuration = toNumber(isObject(duration) ? duration.enter : duration);
  8487. if (process.env.NODE_ENV !== 'production' && explicitEnterDuration != null) {
  8488. checkDuration(explicitEnterDuration, 'enter', vnode);
  8489. }
  8490. var expectsCSS = css !== false && !isIE9;
  8491. var userWantsControl = getHookArgumentsLength(enterHook);
  8492. var cb = (el._enterCb = once(function () {
  8493. if (expectsCSS) {
  8494. removeTransitionClass(el, toClass);
  8495. removeTransitionClass(el, activeClass);
  8496. }
  8497. // @ts-expect-error
  8498. if (cb.cancelled) {
  8499. if (expectsCSS) {
  8500. removeTransitionClass(el, startClass);
  8501. }
  8502. enterCancelledHook && enterCancelledHook(el);
  8503. }
  8504. else {
  8505. afterEnterHook && afterEnterHook(el);
  8506. }
  8507. el._enterCb = null;
  8508. }));
  8509. if (!vnode.data.show) {
  8510. // remove pending leave element on enter by injecting an insert hook
  8511. mergeVNodeHook(vnode, 'insert', function () {
  8512. var parent = el.parentNode;
  8513. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  8514. if (pendingNode &&
  8515. pendingNode.tag === vnode.tag &&
  8516. pendingNode.elm._leaveCb) {
  8517. pendingNode.elm._leaveCb();
  8518. }
  8519. enterHook && enterHook(el, cb);
  8520. });
  8521. }
  8522. // start enter transition
  8523. beforeEnterHook && beforeEnterHook(el);
  8524. if (expectsCSS) {
  8525. addTransitionClass(el, startClass);
  8526. addTransitionClass(el, activeClass);
  8527. nextFrame(function () {
  8528. removeTransitionClass(el, startClass);
  8529. // @ts-expect-error
  8530. if (!cb.cancelled) {
  8531. addTransitionClass(el, toClass);
  8532. if (!userWantsControl) {
  8533. if (isValidDuration(explicitEnterDuration)) {
  8534. setTimeout(cb, explicitEnterDuration);
  8535. }
  8536. else {
  8537. whenTransitionEnds(el, type, cb);
  8538. }
  8539. }
  8540. }
  8541. });
  8542. }
  8543. if (vnode.data.show) {
  8544. toggleDisplay && toggleDisplay();
  8545. enterHook && enterHook(el, cb);
  8546. }
  8547. if (!expectsCSS && !userWantsControl) {
  8548. cb();
  8549. }
  8550. }
  8551. function leave(vnode, rm) {
  8552. var el = vnode.elm;
  8553. // call enter callback now
  8554. if (isDef(el._enterCb)) {
  8555. el._enterCb.cancelled = true;
  8556. el._enterCb();
  8557. }
  8558. var data = resolveTransition(vnode.data.transition);
  8559. if (isUndef(data) || el.nodeType !== 1) {
  8560. return rm();
  8561. }
  8562. /* istanbul ignore if */
  8563. if (isDef(el._leaveCb)) {
  8564. return;
  8565. }
  8566. 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;
  8567. var expectsCSS = css !== false && !isIE9;
  8568. var userWantsControl = getHookArgumentsLength(leave);
  8569. var explicitLeaveDuration = toNumber(isObject(duration) ? duration.leave : duration);
  8570. if (process.env.NODE_ENV !== 'production' && isDef(explicitLeaveDuration)) {
  8571. checkDuration(explicitLeaveDuration, 'leave', vnode);
  8572. }
  8573. var cb = (el._leaveCb = once(function () {
  8574. if (el.parentNode && el.parentNode._pending) {
  8575. el.parentNode._pending[vnode.key] = null;
  8576. }
  8577. if (expectsCSS) {
  8578. removeTransitionClass(el, leaveToClass);
  8579. removeTransitionClass(el, leaveActiveClass);
  8580. }
  8581. // @ts-expect-error
  8582. if (cb.cancelled) {
  8583. if (expectsCSS) {
  8584. removeTransitionClass(el, leaveClass);
  8585. }
  8586. leaveCancelled && leaveCancelled(el);
  8587. }
  8588. else {
  8589. rm();
  8590. afterLeave && afterLeave(el);
  8591. }
  8592. el._leaveCb = null;
  8593. }));
  8594. if (delayLeave) {
  8595. delayLeave(performLeave);
  8596. }
  8597. else {
  8598. performLeave();
  8599. }
  8600. function performLeave() {
  8601. // the delayed leave may have already been cancelled
  8602. // @ts-expect-error
  8603. if (cb.cancelled) {
  8604. return;
  8605. }
  8606. // record leaving element
  8607. if (!vnode.data.show && el.parentNode) {
  8608. (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] =
  8609. vnode;
  8610. }
  8611. beforeLeave && beforeLeave(el);
  8612. if (expectsCSS) {
  8613. addTransitionClass(el, leaveClass);
  8614. addTransitionClass(el, leaveActiveClass);
  8615. nextFrame(function () {
  8616. removeTransitionClass(el, leaveClass);
  8617. // @ts-expect-error
  8618. if (!cb.cancelled) {
  8619. addTransitionClass(el, leaveToClass);
  8620. if (!userWantsControl) {
  8621. if (isValidDuration(explicitLeaveDuration)) {
  8622. setTimeout(cb, explicitLeaveDuration);
  8623. }
  8624. else {
  8625. whenTransitionEnds(el, type, cb);
  8626. }
  8627. }
  8628. }
  8629. });
  8630. }
  8631. leave && leave(el, cb);
  8632. if (!expectsCSS && !userWantsControl) {
  8633. cb();
  8634. }
  8635. }
  8636. }
  8637. // only used in dev mode
  8638. function checkDuration(val, name, vnode) {
  8639. if (typeof val !== 'number') {
  8640. warn$2("<transition> explicit ".concat(name, " duration is not a valid number - ") +
  8641. "got ".concat(JSON.stringify(val), "."), vnode.context);
  8642. }
  8643. else if (isNaN(val)) {
  8644. warn$2("<transition> explicit ".concat(name, " duration is NaN - ") +
  8645. 'the duration expression might be incorrect.', vnode.context);
  8646. }
  8647. }
  8648. function isValidDuration(val) {
  8649. return typeof val === 'number' && !isNaN(val);
  8650. }
  8651. /**
  8652. * Normalize a transition hook's argument length. The hook may be:
  8653. * - a merged hook (invoker) with the original in .fns
  8654. * - a wrapped component method (check ._length)
  8655. * - a plain function (.length)
  8656. */
  8657. function getHookArgumentsLength(fn) {
  8658. if (isUndef(fn)) {
  8659. return false;
  8660. }
  8661. // @ts-expect-error
  8662. var invokerFns = fn.fns;
  8663. if (isDef(invokerFns)) {
  8664. // invoker
  8665. return getHookArgumentsLength(Array.isArray(invokerFns) ? invokerFns[0] : invokerFns);
  8666. }
  8667. else {
  8668. // @ts-expect-error
  8669. return (fn._length || fn.length) > 1;
  8670. }
  8671. }
  8672. function _enter(_, vnode) {
  8673. if (vnode.data.show !== true) {
  8674. enter(vnode);
  8675. }
  8676. }
  8677. var transition = inBrowser
  8678. ? {
  8679. create: _enter,
  8680. activate: _enter,
  8681. remove: function (vnode, rm) {
  8682. /* istanbul ignore else */
  8683. if (vnode.data.show !== true) {
  8684. // @ts-expect-error
  8685. leave(vnode, rm);
  8686. }
  8687. else {
  8688. rm();
  8689. }
  8690. }
  8691. }
  8692. : {};
  8693. var platformModules = [attrs, klass$1, events, domProps, style$1, transition];
  8694. // the directive module should be applied last, after all
  8695. // built-in modules have been applied.
  8696. var modules$1 = platformModules.concat(baseModules);
  8697. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules$1 });
  8698. /**
  8699. * Not type checking this file because flow doesn't like attaching
  8700. * properties to Elements.
  8701. */
  8702. /* istanbul ignore if */
  8703. if (isIE9) {
  8704. // http://www.matts411.com/post/internet-explorer-9-oninput/
  8705. document.addEventListener('selectionchange', function () {
  8706. var el = document.activeElement;
  8707. // @ts-expect-error
  8708. if (el && el.vmodel) {
  8709. trigger(el, 'input');
  8710. }
  8711. });
  8712. }
  8713. var directive = {
  8714. inserted: function (el, binding, vnode, oldVnode) {
  8715. if (vnode.tag === 'select') {
  8716. // #6903
  8717. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  8718. mergeVNodeHook(vnode, 'postpatch', function () {
  8719. directive.componentUpdated(el, binding, vnode);
  8720. });
  8721. }
  8722. else {
  8723. setSelected(el, binding, vnode.context);
  8724. }
  8725. el._vOptions = [].map.call(el.options, getValue);
  8726. }
  8727. else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  8728. el._vModifiers = binding.modifiers;
  8729. if (!binding.modifiers.lazy) {
  8730. el.addEventListener('compositionstart', onCompositionStart);
  8731. el.addEventListener('compositionend', onCompositionEnd);
  8732. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  8733. // switching focus before confirming composition choice
  8734. // this also fixes the issue where some browsers e.g. iOS Chrome
  8735. // fires "change" instead of "input" on autocomplete.
  8736. el.addEventListener('change', onCompositionEnd);
  8737. /* istanbul ignore if */
  8738. if (isIE9) {
  8739. el.vmodel = true;
  8740. }
  8741. }
  8742. }
  8743. },
  8744. componentUpdated: function (el, binding, vnode) {
  8745. if (vnode.tag === 'select') {
  8746. setSelected(el, binding, vnode.context);
  8747. // in case the options rendered by v-for have changed,
  8748. // it's possible that the value is out-of-sync with the rendered options.
  8749. // detect such cases and filter out values that no longer has a matching
  8750. // option in the DOM.
  8751. var prevOptions_1 = el._vOptions;
  8752. var curOptions_1 = (el._vOptions = [].map.call(el.options, getValue));
  8753. if (curOptions_1.some(function (o, i) { return !looseEqual(o, prevOptions_1[i]); })) {
  8754. // trigger change event if
  8755. // no matching option found for at least one value
  8756. var needReset = el.multiple
  8757. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions_1); })
  8758. : binding.value !== binding.oldValue &&
  8759. hasNoMatchingOption(binding.value, curOptions_1);
  8760. if (needReset) {
  8761. trigger(el, 'change');
  8762. }
  8763. }
  8764. }
  8765. }
  8766. };
  8767. function setSelected(el, binding, vm) {
  8768. actuallySetSelected(el, binding, vm);
  8769. /* istanbul ignore if */
  8770. if (isIE || isEdge) {
  8771. setTimeout(function () {
  8772. actuallySetSelected(el, binding, vm);
  8773. }, 0);
  8774. }
  8775. }
  8776. function actuallySetSelected(el, binding, vm) {
  8777. var value = binding.value;
  8778. var isMultiple = el.multiple;
  8779. if (isMultiple && !Array.isArray(value)) {
  8780. process.env.NODE_ENV !== 'production' &&
  8781. warn$2("<select multiple v-model=\"".concat(binding.expression, "\"> ") +
  8782. "expects an Array value for its binding, but got ".concat(Object.prototype.toString
  8783. .call(value)
  8784. .slice(8, -1)), vm);
  8785. return;
  8786. }
  8787. var selected, option;
  8788. for (var i = 0, l = el.options.length; i < l; i++) {
  8789. option = el.options[i];
  8790. if (isMultiple) {
  8791. selected = looseIndexOf(value, getValue(option)) > -1;
  8792. if (option.selected !== selected) {
  8793. option.selected = selected;
  8794. }
  8795. }
  8796. else {
  8797. if (looseEqual(getValue(option), value)) {
  8798. if (el.selectedIndex !== i) {
  8799. el.selectedIndex = i;
  8800. }
  8801. return;
  8802. }
  8803. }
  8804. }
  8805. if (!isMultiple) {
  8806. el.selectedIndex = -1;
  8807. }
  8808. }
  8809. function hasNoMatchingOption(value, options) {
  8810. return options.every(function (o) { return !looseEqual(o, value); });
  8811. }
  8812. function getValue(option) {
  8813. return '_value' in option ? option._value : option.value;
  8814. }
  8815. function onCompositionStart(e) {
  8816. e.target.composing = true;
  8817. }
  8818. function onCompositionEnd(e) {
  8819. // prevent triggering an input event for no reason
  8820. if (!e.target.composing)
  8821. return;
  8822. e.target.composing = false;
  8823. trigger(e.target, 'input');
  8824. }
  8825. function trigger(el, type) {
  8826. var e = document.createEvent('HTMLEvents');
  8827. e.initEvent(type, true, true);
  8828. el.dispatchEvent(e);
  8829. }
  8830. // recursively search for possible transition defined inside the component root
  8831. function locateNode(vnode) {
  8832. // @ts-expect-error
  8833. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  8834. ? locateNode(vnode.componentInstance._vnode)
  8835. : vnode;
  8836. }
  8837. var show = {
  8838. bind: function (el, _a, vnode) {
  8839. var value = _a.value;
  8840. vnode = locateNode(vnode);
  8841. var transition = vnode.data && vnode.data.transition;
  8842. var originalDisplay = (el.__vOriginalDisplay =
  8843. el.style.display === 'none' ? '' : el.style.display);
  8844. if (value && transition) {
  8845. vnode.data.show = true;
  8846. enter(vnode, function () {
  8847. el.style.display = originalDisplay;
  8848. });
  8849. }
  8850. else {
  8851. el.style.display = value ? originalDisplay : 'none';
  8852. }
  8853. },
  8854. update: function (el, _a, vnode) {
  8855. var value = _a.value, oldValue = _a.oldValue;
  8856. /* istanbul ignore if */
  8857. if (!value === !oldValue)
  8858. return;
  8859. vnode = locateNode(vnode);
  8860. var transition = vnode.data && vnode.data.transition;
  8861. if (transition) {
  8862. vnode.data.show = true;
  8863. if (value) {
  8864. enter(vnode, function () {
  8865. el.style.display = el.__vOriginalDisplay;
  8866. });
  8867. }
  8868. else {
  8869. leave(vnode, function () {
  8870. el.style.display = 'none';
  8871. });
  8872. }
  8873. }
  8874. else {
  8875. el.style.display = value ? el.__vOriginalDisplay : 'none';
  8876. }
  8877. },
  8878. unbind: function (el, binding, vnode, oldVnode, isDestroy) {
  8879. if (!isDestroy) {
  8880. el.style.display = el.__vOriginalDisplay;
  8881. }
  8882. }
  8883. };
  8884. var platformDirectives = {
  8885. model: directive,
  8886. show: show
  8887. };
  8888. // Provides transition support for a single element/component.
  8889. var transitionProps = {
  8890. name: String,
  8891. appear: Boolean,
  8892. css: Boolean,
  8893. mode: String,
  8894. type: String,
  8895. enterClass: String,
  8896. leaveClass: String,
  8897. enterToClass: String,
  8898. leaveToClass: String,
  8899. enterActiveClass: String,
  8900. leaveActiveClass: String,
  8901. appearClass: String,
  8902. appearActiveClass: String,
  8903. appearToClass: String,
  8904. duration: [Number, String, Object]
  8905. };
  8906. // in case the child is also an abstract component, e.g. <keep-alive>
  8907. // we want to recursively retrieve the real component to be rendered
  8908. function getRealChild(vnode) {
  8909. var compOptions = vnode && vnode.componentOptions;
  8910. if (compOptions && compOptions.Ctor.options.abstract) {
  8911. return getRealChild(getFirstComponentChild(compOptions.children));
  8912. }
  8913. else {
  8914. return vnode;
  8915. }
  8916. }
  8917. function extractTransitionData(comp) {
  8918. var data = {};
  8919. var options = comp.$options;
  8920. // props
  8921. for (var key in options.propsData) {
  8922. data[key] = comp[key];
  8923. }
  8924. // events.
  8925. // extract listeners and pass them directly to the transition methods
  8926. var listeners = options._parentListeners;
  8927. for (var key in listeners) {
  8928. data[camelize(key)] = listeners[key];
  8929. }
  8930. return data;
  8931. }
  8932. function placeholder(h, rawChild) {
  8933. // @ts-expect-error
  8934. if (/\d-keep-alive$/.test(rawChild.tag)) {
  8935. return h('keep-alive', {
  8936. props: rawChild.componentOptions.propsData
  8937. });
  8938. }
  8939. }
  8940. function hasParentTransition(vnode) {
  8941. while ((vnode = vnode.parent)) {
  8942. if (vnode.data.transition) {
  8943. return true;
  8944. }
  8945. }
  8946. }
  8947. function isSameChild(child, oldChild) {
  8948. return oldChild.key === child.key && oldChild.tag === child.tag;
  8949. }
  8950. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  8951. var isVShowDirective = function (d) { return d.name === 'show'; };
  8952. var Transition = {
  8953. name: 'transition',
  8954. props: transitionProps,
  8955. abstract: true,
  8956. render: function (h) {
  8957. var _this = this;
  8958. var children = this.$slots.default;
  8959. if (!children) {
  8960. return;
  8961. }
  8962. // filter out text nodes (possible whitespaces)
  8963. children = children.filter(isNotTextNode);
  8964. /* istanbul ignore if */
  8965. if (!children.length) {
  8966. return;
  8967. }
  8968. // warn multiple elements
  8969. if (process.env.NODE_ENV !== 'production' && children.length > 1) {
  8970. warn$2('<transition> can only be used on a single element. Use ' +
  8971. '<transition-group> for lists.', this.$parent);
  8972. }
  8973. var mode = this.mode;
  8974. // warn invalid mode
  8975. if (process.env.NODE_ENV !== 'production' && mode && mode !== 'in-out' && mode !== 'out-in') {
  8976. warn$2('invalid <transition> mode: ' + mode, this.$parent);
  8977. }
  8978. var rawChild = children[0];
  8979. // if this is a component root node and the component's
  8980. // parent container node also has transition, skip.
  8981. if (hasParentTransition(this.$vnode)) {
  8982. return rawChild;
  8983. }
  8984. // apply transition data to child
  8985. // use getRealChild() to ignore abstract components e.g. keep-alive
  8986. var child = getRealChild(rawChild);
  8987. /* istanbul ignore if */
  8988. if (!child) {
  8989. return rawChild;
  8990. }
  8991. if (this._leaving) {
  8992. return placeholder(h, rawChild);
  8993. }
  8994. // ensure a key that is unique to the vnode type and to this transition
  8995. // component instance. This key will be used to remove pending leaving nodes
  8996. // during entering.
  8997. var id = "__transition-".concat(this._uid, "-");
  8998. child.key =
  8999. child.key == null
  9000. ? child.isComment
  9001. ? id + 'comment'
  9002. : id + child.tag
  9003. : isPrimitive(child.key)
  9004. ? String(child.key).indexOf(id) === 0
  9005. ? child.key
  9006. : id + child.key
  9007. : child.key;
  9008. var data = ((child.data || (child.data = {})).transition =
  9009. extractTransitionData(this));
  9010. var oldRawChild = this._vnode;
  9011. var oldChild = getRealChild(oldRawChild);
  9012. // mark v-show
  9013. // so that the transition module can hand over the control to the directive
  9014. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  9015. child.data.show = true;
  9016. }
  9017. if (oldChild &&
  9018. oldChild.data &&
  9019. !isSameChild(child, oldChild) &&
  9020. !isAsyncPlaceholder(oldChild) &&
  9021. // #6687 component root is a comment node
  9022. !(oldChild.componentInstance &&
  9023. oldChild.componentInstance._vnode.isComment)) {
  9024. // replace old child transition data with fresh one
  9025. // important for dynamic transitions!
  9026. var oldData = (oldChild.data.transition = extend({}, data));
  9027. // handle transition mode
  9028. if (mode === 'out-in') {
  9029. // return placeholder node and queue update when leave finishes
  9030. this._leaving = true;
  9031. mergeVNodeHook(oldData, 'afterLeave', function () {
  9032. _this._leaving = false;
  9033. _this.$forceUpdate();
  9034. });
  9035. return placeholder(h, rawChild);
  9036. }
  9037. else if (mode === 'in-out') {
  9038. if (isAsyncPlaceholder(child)) {
  9039. return oldRawChild;
  9040. }
  9041. var delayedLeave_1;
  9042. var performLeave = function () {
  9043. delayedLeave_1();
  9044. };
  9045. mergeVNodeHook(data, 'afterEnter', performLeave);
  9046. mergeVNodeHook(data, 'enterCancelled', performLeave);
  9047. mergeVNodeHook(oldData, 'delayLeave', function (leave) {
  9048. delayedLeave_1 = leave;
  9049. });
  9050. }
  9051. }
  9052. return rawChild;
  9053. }
  9054. };
  9055. // Provides transition support for list items.
  9056. var props = extend({
  9057. tag: String,
  9058. moveClass: String
  9059. }, transitionProps);
  9060. delete props.mode;
  9061. var TransitionGroup = {
  9062. props: props,
  9063. beforeMount: function () {
  9064. var _this = this;
  9065. var update = this._update;
  9066. this._update = function (vnode, hydrating) {
  9067. var restoreActiveInstance = setActiveInstance(_this);
  9068. // force removing pass
  9069. _this.__patch__(_this._vnode, _this.kept, false, // hydrating
  9070. true // removeOnly (!important, avoids unnecessary moves)
  9071. );
  9072. _this._vnode = _this.kept;
  9073. restoreActiveInstance();
  9074. update.call(_this, vnode, hydrating);
  9075. };
  9076. },
  9077. render: function (h) {
  9078. var tag = this.tag || this.$vnode.data.tag || 'span';
  9079. var map = Object.create(null);
  9080. var prevChildren = (this.prevChildren = this.children);
  9081. var rawChildren = this.$slots.default || [];
  9082. var children = (this.children = []);
  9083. var transitionData = extractTransitionData(this);
  9084. for (var i = 0; i < rawChildren.length; i++) {
  9085. var c = rawChildren[i];
  9086. if (c.tag) {
  9087. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  9088. children.push(c);
  9089. map[c.key] = c;
  9090. (c.data || (c.data = {})).transition = transitionData;
  9091. }
  9092. else if (process.env.NODE_ENV !== 'production') {
  9093. var opts = c.componentOptions;
  9094. var name_1 = opts
  9095. ? getComponentName(opts.Ctor.options) || opts.tag || ''
  9096. : c.tag;
  9097. warn$2("<transition-group> children must be keyed: <".concat(name_1, ">"));
  9098. }
  9099. }
  9100. }
  9101. if (prevChildren) {
  9102. var kept = [];
  9103. var removed = [];
  9104. for (var i = 0; i < prevChildren.length; i++) {
  9105. var c = prevChildren[i];
  9106. c.data.transition = transitionData;
  9107. // @ts-expect-error .getBoundingClientRect is not typed in Node
  9108. c.data.pos = c.elm.getBoundingClientRect();
  9109. if (map[c.key]) {
  9110. kept.push(c);
  9111. }
  9112. else {
  9113. removed.push(c);
  9114. }
  9115. }
  9116. this.kept = h(tag, null, kept);
  9117. this.removed = removed;
  9118. }
  9119. return h(tag, null, children);
  9120. },
  9121. updated: function () {
  9122. var children = this.prevChildren;
  9123. var moveClass = this.moveClass || (this.name || 'v') + '-move';
  9124. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  9125. return;
  9126. }
  9127. // we divide the work into three loops to avoid mixing DOM reads and writes
  9128. // in each iteration - which helps prevent layout thrashing.
  9129. children.forEach(callPendingCbs);
  9130. children.forEach(recordPosition);
  9131. children.forEach(applyTranslation);
  9132. // force reflow to put everything in position
  9133. // assign to this to avoid being removed in tree-shaking
  9134. // $flow-disable-line
  9135. this._reflow = document.body.offsetHeight;
  9136. children.forEach(function (c) {
  9137. if (c.data.moved) {
  9138. var el_1 = c.elm;
  9139. var s = el_1.style;
  9140. addTransitionClass(el_1, moveClass);
  9141. s.transform = s.WebkitTransform = s.transitionDuration = '';
  9142. el_1.addEventListener(transitionEndEvent, (el_1._moveCb = function cb(e) {
  9143. if (e && e.target !== el_1) {
  9144. return;
  9145. }
  9146. if (!e || /transform$/.test(e.propertyName)) {
  9147. el_1.removeEventListener(transitionEndEvent, cb);
  9148. el_1._moveCb = null;
  9149. removeTransitionClass(el_1, moveClass);
  9150. }
  9151. }));
  9152. }
  9153. });
  9154. },
  9155. methods: {
  9156. hasMove: function (el, moveClass) {
  9157. /* istanbul ignore if */
  9158. if (!hasTransition) {
  9159. return false;
  9160. }
  9161. /* istanbul ignore if */
  9162. if (this._hasMove) {
  9163. return this._hasMove;
  9164. }
  9165. // Detect whether an element with the move class applied has
  9166. // CSS transitions. Since the element may be inside an entering
  9167. // transition at this very moment, we make a clone of it and remove
  9168. // all other transition classes applied to ensure only the move class
  9169. // is applied.
  9170. var clone = el.cloneNode();
  9171. if (el._transitionClasses) {
  9172. el._transitionClasses.forEach(function (cls) {
  9173. removeClass(clone, cls);
  9174. });
  9175. }
  9176. addClass(clone, moveClass);
  9177. clone.style.display = 'none';
  9178. this.$el.appendChild(clone);
  9179. var info = getTransitionInfo(clone);
  9180. this.$el.removeChild(clone);
  9181. return (this._hasMove = info.hasTransform);
  9182. }
  9183. }
  9184. };
  9185. function callPendingCbs(c) {
  9186. /* istanbul ignore if */
  9187. if (c.elm._moveCb) {
  9188. c.elm._moveCb();
  9189. }
  9190. /* istanbul ignore if */
  9191. if (c.elm._enterCb) {
  9192. c.elm._enterCb();
  9193. }
  9194. }
  9195. function recordPosition(c) {
  9196. c.data.newPos = c.elm.getBoundingClientRect();
  9197. }
  9198. function applyTranslation(c) {
  9199. var oldPos = c.data.pos;
  9200. var newPos = c.data.newPos;
  9201. var dx = oldPos.left - newPos.left;
  9202. var dy = oldPos.top - newPos.top;
  9203. if (dx || dy) {
  9204. c.data.moved = true;
  9205. var s = c.elm.style;
  9206. s.transform = s.WebkitTransform = "translate(".concat(dx, "px,").concat(dy, "px)");
  9207. s.transitionDuration = '0s';
  9208. }
  9209. }
  9210. var platformComponents = {
  9211. Transition: Transition,
  9212. TransitionGroup: TransitionGroup
  9213. };
  9214. // install platform specific utils
  9215. Vue.config.mustUseProp = mustUseProp;
  9216. Vue.config.isReservedTag = isReservedTag;
  9217. Vue.config.isReservedAttr = isReservedAttr;
  9218. Vue.config.getTagNamespace = getTagNamespace;
  9219. Vue.config.isUnknownElement = isUnknownElement;
  9220. // install platform runtime directives & components
  9221. extend(Vue.options.directives, platformDirectives);
  9222. extend(Vue.options.components, platformComponents);
  9223. // install platform patch function
  9224. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  9225. // public mount method
  9226. Vue.prototype.$mount = function (el, hydrating) {
  9227. el = el && inBrowser ? query(el) : undefined;
  9228. return mountComponent(this, el, hydrating);
  9229. };
  9230. // devtools global hook
  9231. /* istanbul ignore next */
  9232. if (inBrowser) {
  9233. setTimeout(function () {
  9234. if (config.devtools) {
  9235. if (devtools) {
  9236. devtools.emit('init', Vue);
  9237. }
  9238. else if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test') {
  9239. // @ts-expect-error
  9240. console[console.info ? 'info' : 'log']('Download the Vue Devtools extension for a better development experience:\n' +
  9241. 'https://github.com/vuejs/vue-devtools');
  9242. }
  9243. }
  9244. if (process.env.NODE_ENV !== 'production' &&
  9245. process.env.NODE_ENV !== 'test' &&
  9246. config.productionTip !== false &&
  9247. typeof console !== 'undefined') {
  9248. // @ts-expect-error
  9249. console[console.info ? 'info' : 'log']("You are running Vue in development mode.\n" +
  9250. "Make sure to turn on production mode when deploying for production.\n" +
  9251. "See more tips at https://vuejs.org/guide/deployment.html");
  9252. }
  9253. }, 0);
  9254. }
  9255. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  9256. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  9257. var buildRegex = cached(function (delimiters) {
  9258. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  9259. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  9260. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g');
  9261. });
  9262. function parseText(text, delimiters) {
  9263. //@ts-expect-error
  9264. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  9265. if (!tagRE.test(text)) {
  9266. return;
  9267. }
  9268. var tokens = [];
  9269. var rawTokens = [];
  9270. var lastIndex = (tagRE.lastIndex = 0);
  9271. var match, index, tokenValue;
  9272. while ((match = tagRE.exec(text))) {
  9273. index = match.index;
  9274. // push text token
  9275. if (index > lastIndex) {
  9276. rawTokens.push((tokenValue = text.slice(lastIndex, index)));
  9277. tokens.push(JSON.stringify(tokenValue));
  9278. }
  9279. // tag token
  9280. var exp = parseFilters(match[1].trim());
  9281. tokens.push("_s(".concat(exp, ")"));
  9282. rawTokens.push({ '@binding': exp });
  9283. lastIndex = index + match[0].length;
  9284. }
  9285. if (lastIndex < text.length) {
  9286. rawTokens.push((tokenValue = text.slice(lastIndex)));
  9287. tokens.push(JSON.stringify(tokenValue));
  9288. }
  9289. return {
  9290. expression: tokens.join('+'),
  9291. tokens: rawTokens
  9292. };
  9293. }
  9294. function transformNode$1(el, options) {
  9295. var warn = options.warn || baseWarn;
  9296. var staticClass = getAndRemoveAttr(el, 'class');
  9297. if (process.env.NODE_ENV !== 'production' && staticClass) {
  9298. var res = parseText(staticClass, options.delimiters);
  9299. if (res) {
  9300. warn("class=\"".concat(staticClass, "\": ") +
  9301. 'Interpolation inside attributes has been removed. ' +
  9302. 'Use v-bind or the colon shorthand instead. For example, ' +
  9303. 'instead of <div class="{{ val }}">, use <div :class="val">.', el.rawAttrsMap['class']);
  9304. }
  9305. }
  9306. if (staticClass) {
  9307. el.staticClass = JSON.stringify(staticClass.replace(/\s+/g, ' ').trim());
  9308. }
  9309. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  9310. if (classBinding) {
  9311. el.classBinding = classBinding;
  9312. }
  9313. }
  9314. function genData$2(el) {
  9315. var data = '';
  9316. if (el.staticClass) {
  9317. data += "staticClass:".concat(el.staticClass, ",");
  9318. }
  9319. if (el.classBinding) {
  9320. data += "class:".concat(el.classBinding, ",");
  9321. }
  9322. return data;
  9323. }
  9324. var klass = {
  9325. staticKeys: ['staticClass'],
  9326. transformNode: transformNode$1,
  9327. genData: genData$2
  9328. };
  9329. function transformNode(el, options) {
  9330. var warn = options.warn || baseWarn;
  9331. var staticStyle = getAndRemoveAttr(el, 'style');
  9332. if (staticStyle) {
  9333. /* istanbul ignore if */
  9334. if (process.env.NODE_ENV !== 'production') {
  9335. var res = parseText(staticStyle, options.delimiters);
  9336. if (res) {
  9337. warn("style=\"".concat(staticStyle, "\": ") +
  9338. 'Interpolation inside attributes has been removed. ' +
  9339. 'Use v-bind or the colon shorthand instead. For example, ' +
  9340. 'instead of <div style="{{ val }}">, use <div :style="val">.', el.rawAttrsMap['style']);
  9341. }
  9342. }
  9343. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  9344. }
  9345. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  9346. if (styleBinding) {
  9347. el.styleBinding = styleBinding;
  9348. }
  9349. }
  9350. function genData$1(el) {
  9351. var data = '';
  9352. if (el.staticStyle) {
  9353. data += "staticStyle:".concat(el.staticStyle, ",");
  9354. }
  9355. if (el.styleBinding) {
  9356. data += "style:(".concat(el.styleBinding, "),");
  9357. }
  9358. return data;
  9359. }
  9360. var style = {
  9361. staticKeys: ['staticStyle'],
  9362. transformNode: transformNode,
  9363. genData: genData$1
  9364. };
  9365. var decoder;
  9366. var he = {
  9367. decode: function (html) {
  9368. decoder = decoder || document.createElement('div');
  9369. decoder.innerHTML = html;
  9370. return decoder.textContent;
  9371. }
  9372. };
  9373. var isUnaryTag = makeMap('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  9374. 'link,meta,param,source,track,wbr');
  9375. // Elements that you can, intentionally, leave open
  9376. // (and which close themselves)
  9377. var canBeLeftOpenTag = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source');
  9378. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  9379. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  9380. var isNonPhrasingTag = makeMap('address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  9381. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  9382. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  9383. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  9384. 'title,tr,track');
  9385. /**
  9386. * Not type-checking this file because it's mostly vendor code.
  9387. */
  9388. // Regular Expressions for parsing tags and attributes
  9389. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  9390. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  9391. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z".concat(unicodeRegExp.source, "]*");
  9392. var qnameCapture = "((?:".concat(ncname, "\\:)?").concat(ncname, ")");
  9393. var startTagOpen = new RegExp("^<".concat(qnameCapture));
  9394. var startTagClose = /^\s*(\/?)>/;
  9395. var endTag = new RegExp("^<\\/".concat(qnameCapture, "[^>]*>"));
  9396. var doctype = /^<!DOCTYPE [^>]+>/i;
  9397. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  9398. var comment = /^<!\--/;
  9399. var conditionalComment = /^<!\[/;
  9400. // Special Elements (can contain anything)
  9401. var isPlainTextElement = makeMap('script,style,textarea', true);
  9402. var reCache = {};
  9403. var decodingMap = {
  9404. '&lt;': '<',
  9405. '&gt;': '>',
  9406. '&quot;': '"',
  9407. '&amp;': '&',
  9408. '&#10;': '\n',
  9409. '&#9;': '\t',
  9410. '&#39;': "'"
  9411. };
  9412. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  9413. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  9414. // #5992
  9415. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  9416. var shouldIgnoreFirstNewline = function (tag, html) {
  9417. return tag && isIgnoreNewlineTag(tag) && html[0] === '\n';
  9418. };
  9419. function decodeAttr(value, shouldDecodeNewlines) {
  9420. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  9421. return value.replace(re, function (match) { return decodingMap[match]; });
  9422. }
  9423. function parseHTML(html, options) {
  9424. var stack = [];
  9425. var expectHTML = options.expectHTML;
  9426. var isUnaryTag = options.isUnaryTag || no;
  9427. var canBeLeftOpenTag = options.canBeLeftOpenTag || no;
  9428. var index = 0;
  9429. var last, lastTag;
  9430. var _loop_1 = function () {
  9431. last = html;
  9432. // Make sure we're not in a plaintext content element like script/style
  9433. if (!lastTag || !isPlainTextElement(lastTag)) {
  9434. var textEnd = html.indexOf('<');
  9435. if (textEnd === 0) {
  9436. // Comment:
  9437. if (comment.test(html)) {
  9438. var commentEnd = html.indexOf('-->');
  9439. if (commentEnd >= 0) {
  9440. if (options.shouldKeepComment && options.comment) {
  9441. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  9442. }
  9443. advance(commentEnd + 3);
  9444. return "continue";
  9445. }
  9446. }
  9447. // https://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  9448. if (conditionalComment.test(html)) {
  9449. var conditionalEnd = html.indexOf(']>');
  9450. if (conditionalEnd >= 0) {
  9451. advance(conditionalEnd + 2);
  9452. return "continue";
  9453. }
  9454. }
  9455. // Doctype:
  9456. var doctypeMatch = html.match(doctype);
  9457. if (doctypeMatch) {
  9458. advance(doctypeMatch[0].length);
  9459. return "continue";
  9460. }
  9461. // End tag:
  9462. var endTagMatch = html.match(endTag);
  9463. if (endTagMatch) {
  9464. var curIndex = index;
  9465. advance(endTagMatch[0].length);
  9466. parseEndTag(endTagMatch[1], curIndex, index);
  9467. return "continue";
  9468. }
  9469. // Start tag:
  9470. var startTagMatch = parseStartTag();
  9471. if (startTagMatch) {
  9472. handleStartTag(startTagMatch);
  9473. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  9474. advance(1);
  9475. }
  9476. return "continue";
  9477. }
  9478. }
  9479. var text = void 0, rest = void 0, next = void 0;
  9480. if (textEnd >= 0) {
  9481. rest = html.slice(textEnd);
  9482. while (!endTag.test(rest) &&
  9483. !startTagOpen.test(rest) &&
  9484. !comment.test(rest) &&
  9485. !conditionalComment.test(rest)) {
  9486. // < in plain text, be forgiving and treat it as text
  9487. next = rest.indexOf('<', 1);
  9488. if (next < 0)
  9489. break;
  9490. textEnd += next;
  9491. rest = html.slice(textEnd);
  9492. }
  9493. text = html.substring(0, textEnd);
  9494. }
  9495. if (textEnd < 0) {
  9496. text = html;
  9497. }
  9498. if (text) {
  9499. advance(text.length);
  9500. }
  9501. if (options.chars && text) {
  9502. options.chars(text, index - text.length, index);
  9503. }
  9504. }
  9505. else {
  9506. var endTagLength_1 = 0;
  9507. var stackedTag_1 = lastTag.toLowerCase();
  9508. var reStackedTag = reCache[stackedTag_1] ||
  9509. (reCache[stackedTag_1] = new RegExp('([\\s\\S]*?)(</' + stackedTag_1 + '[^>]*>)', 'i'));
  9510. var rest = html.replace(reStackedTag, function (all, text, endTag) {
  9511. endTagLength_1 = endTag.length;
  9512. if (!isPlainTextElement(stackedTag_1) && stackedTag_1 !== 'noscript') {
  9513. text = text
  9514. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  9515. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  9516. }
  9517. if (shouldIgnoreFirstNewline(stackedTag_1, text)) {
  9518. text = text.slice(1);
  9519. }
  9520. if (options.chars) {
  9521. options.chars(text);
  9522. }
  9523. return '';
  9524. });
  9525. index += html.length - rest.length;
  9526. html = rest;
  9527. parseEndTag(stackedTag_1, index - endTagLength_1, index);
  9528. }
  9529. if (html === last) {
  9530. options.chars && options.chars(html);
  9531. if (process.env.NODE_ENV !== 'production' && !stack.length && options.warn) {
  9532. options.warn("Mal-formatted tag at end of template: \"".concat(html, "\""), {
  9533. start: index + html.length
  9534. });
  9535. }
  9536. return "break";
  9537. }
  9538. };
  9539. while (html) {
  9540. var state_1 = _loop_1();
  9541. if (state_1 === "break")
  9542. break;
  9543. }
  9544. // Clean up any remaining tags
  9545. parseEndTag();
  9546. function advance(n) {
  9547. index += n;
  9548. html = html.substring(n);
  9549. }
  9550. function parseStartTag() {
  9551. var start = html.match(startTagOpen);
  9552. if (start) {
  9553. var match = {
  9554. tagName: start[1],
  9555. attrs: [],
  9556. start: index
  9557. };
  9558. advance(start[0].length);
  9559. var end = void 0, attr = void 0;
  9560. while (!(end = html.match(startTagClose)) &&
  9561. (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  9562. attr.start = index;
  9563. advance(attr[0].length);
  9564. attr.end = index;
  9565. match.attrs.push(attr);
  9566. }
  9567. if (end) {
  9568. match.unarySlash = end[1];
  9569. advance(end[0].length);
  9570. match.end = index;
  9571. return match;
  9572. }
  9573. }
  9574. }
  9575. function handleStartTag(match) {
  9576. var tagName = match.tagName;
  9577. var unarySlash = match.unarySlash;
  9578. if (expectHTML) {
  9579. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  9580. parseEndTag(lastTag);
  9581. }
  9582. if (canBeLeftOpenTag(tagName) && lastTag === tagName) {
  9583. parseEndTag(tagName);
  9584. }
  9585. }
  9586. var unary = isUnaryTag(tagName) || !!unarySlash;
  9587. var l = match.attrs.length;
  9588. var attrs = new Array(l);
  9589. for (var i = 0; i < l; i++) {
  9590. var args = match.attrs[i];
  9591. var value = args[3] || args[4] || args[5] || '';
  9592. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  9593. ? options.shouldDecodeNewlinesForHref
  9594. : options.shouldDecodeNewlines;
  9595. attrs[i] = {
  9596. name: args[1],
  9597. value: decodeAttr(value, shouldDecodeNewlines)
  9598. };
  9599. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  9600. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  9601. attrs[i].end = args.end;
  9602. }
  9603. }
  9604. if (!unary) {
  9605. stack.push({
  9606. tag: tagName,
  9607. lowerCasedTag: tagName.toLowerCase(),
  9608. attrs: attrs,
  9609. start: match.start,
  9610. end: match.end
  9611. });
  9612. lastTag = tagName;
  9613. }
  9614. if (options.start) {
  9615. options.start(tagName, attrs, unary, match.start, match.end);
  9616. }
  9617. }
  9618. function parseEndTag(tagName, start, end) {
  9619. var pos, lowerCasedTagName;
  9620. if (start == null)
  9621. start = index;
  9622. if (end == null)
  9623. end = index;
  9624. // Find the closest opened tag of the same type
  9625. if (tagName) {
  9626. lowerCasedTagName = tagName.toLowerCase();
  9627. for (pos = stack.length - 1; pos >= 0; pos--) {
  9628. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  9629. break;
  9630. }
  9631. }
  9632. }
  9633. else {
  9634. // If no tag name is provided, clean shop
  9635. pos = 0;
  9636. }
  9637. if (pos >= 0) {
  9638. // Close all the open elements, up the stack
  9639. for (var i = stack.length - 1; i >= pos; i--) {
  9640. if (process.env.NODE_ENV !== 'production' && (i > pos || !tagName) && options.warn) {
  9641. options.warn("tag <".concat(stack[i].tag, "> has no matching end tag."), {
  9642. start: stack[i].start,
  9643. end: stack[i].end
  9644. });
  9645. }
  9646. if (options.end) {
  9647. options.end(stack[i].tag, start, end);
  9648. }
  9649. }
  9650. // Remove the open elements from the stack
  9651. stack.length = pos;
  9652. lastTag = pos && stack[pos - 1].tag;
  9653. }
  9654. else if (lowerCasedTagName === 'br') {
  9655. if (options.start) {
  9656. options.start(tagName, [], true, start, end);
  9657. }
  9658. }
  9659. else if (lowerCasedTagName === 'p') {
  9660. if (options.start) {
  9661. options.start(tagName, [], false, start, end);
  9662. }
  9663. if (options.end) {
  9664. options.end(tagName, start, end);
  9665. }
  9666. }
  9667. }
  9668. }
  9669. var onRE = /^@|^v-on:/;
  9670. var dirRE = /^v-|^@|^:|^#/;
  9671. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  9672. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  9673. var stripParensRE = /^\(|\)$/g;
  9674. var dynamicArgRE = /^\[.*\]$/;
  9675. var argRE = /:(.*)$/;
  9676. var bindRE = /^:|^\.|^v-bind:/;
  9677. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  9678. var slotRE = /^v-slot(:|$)|^#/;
  9679. var lineBreakRE = /[\r\n]/;
  9680. var whitespaceRE = /[ \f\t\r\n]+/g;
  9681. var invalidAttributeRE = /[\s"'<>\/=]/;
  9682. var decodeHTMLCached = cached(he.decode);
  9683. var emptySlotScopeToken = "_empty_";
  9684. // configurable state
  9685. var warn;
  9686. var delimiters;
  9687. var transforms;
  9688. var preTransforms;
  9689. var postTransforms;
  9690. var platformIsPreTag;
  9691. var platformMustUseProp;
  9692. var platformGetTagNamespace;
  9693. var maybeComponent;
  9694. function createASTElement(tag, attrs, parent) {
  9695. return {
  9696. type: 1,
  9697. tag: tag,
  9698. attrsList: attrs,
  9699. attrsMap: makeAttrsMap(attrs),
  9700. rawAttrsMap: {},
  9701. parent: parent,
  9702. children: []
  9703. };
  9704. }
  9705. /**
  9706. * Convert HTML string to AST.
  9707. */
  9708. function parse(template, options) {
  9709. warn = options.warn || baseWarn;
  9710. platformIsPreTag = options.isPreTag || no;
  9711. platformMustUseProp = options.mustUseProp || no;
  9712. platformGetTagNamespace = options.getTagNamespace || no;
  9713. var isReservedTag = options.isReservedTag || no;
  9714. maybeComponent = function (el) {
  9715. return !!(el.component ||
  9716. el.attrsMap[':is'] ||
  9717. el.attrsMap['v-bind:is'] ||
  9718. !(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag)));
  9719. };
  9720. transforms = pluckModuleFunction(options.modules, 'transformNode');
  9721. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  9722. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  9723. delimiters = options.delimiters;
  9724. var stack = [];
  9725. var preserveWhitespace = options.preserveWhitespace !== false;
  9726. var whitespaceOption = options.whitespace;
  9727. var root;
  9728. var currentParent;
  9729. var inVPre = false;
  9730. var inPre = false;
  9731. var warned = false;
  9732. function warnOnce(msg, range) {
  9733. if (!warned) {
  9734. warned = true;
  9735. warn(msg, range);
  9736. }
  9737. }
  9738. function closeElement(element) {
  9739. trimEndingWhitespace(element);
  9740. if (!inVPre && !element.processed) {
  9741. element = processElement(element, options);
  9742. }
  9743. // tree management
  9744. if (!stack.length && element !== root) {
  9745. // allow root elements with v-if, v-else-if and v-else
  9746. if (root.if && (element.elseif || element.else)) {
  9747. if (process.env.NODE_ENV !== 'production') {
  9748. checkRootConstraints(element);
  9749. }
  9750. addIfCondition(root, {
  9751. exp: element.elseif,
  9752. block: element
  9753. });
  9754. }
  9755. else if (process.env.NODE_ENV !== 'production') {
  9756. warnOnce("Component template should contain exactly one root element. " +
  9757. "If you are using v-if on multiple elements, " +
  9758. "use v-else-if to chain them instead.", { start: element.start });
  9759. }
  9760. }
  9761. if (currentParent && !element.forbidden) {
  9762. if (element.elseif || element.else) {
  9763. processIfConditions(element, currentParent);
  9764. }
  9765. else {
  9766. if (element.slotScope) {
  9767. // scoped slot
  9768. // keep it in the children list so that v-else(-if) conditions can
  9769. // find it as the prev node.
  9770. var name_1 = element.slotTarget || '"default"';
  9771. (currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name_1] = element;
  9772. }
  9773. currentParent.children.push(element);
  9774. element.parent = currentParent;
  9775. }
  9776. }
  9777. // final children cleanup
  9778. // filter out scoped slots
  9779. element.children = element.children.filter(function (c) { return !c.slotScope; });
  9780. // remove trailing whitespace node again
  9781. trimEndingWhitespace(element);
  9782. // check pre state
  9783. if (element.pre) {
  9784. inVPre = false;
  9785. }
  9786. if (platformIsPreTag(element.tag)) {
  9787. inPre = false;
  9788. }
  9789. // apply post-transforms
  9790. for (var i = 0; i < postTransforms.length; i++) {
  9791. postTransforms[i](element, options);
  9792. }
  9793. }
  9794. function trimEndingWhitespace(el) {
  9795. // remove trailing whitespace node
  9796. if (!inPre) {
  9797. var lastNode = void 0;
  9798. while ((lastNode = el.children[el.children.length - 1]) &&
  9799. lastNode.type === 3 &&
  9800. lastNode.text === ' ') {
  9801. el.children.pop();
  9802. }
  9803. }
  9804. }
  9805. function checkRootConstraints(el) {
  9806. if (el.tag === 'slot' || el.tag === 'template') {
  9807. warnOnce("Cannot use <".concat(el.tag, "> as component root element because it may ") +
  9808. 'contain multiple nodes.', { start: el.start });
  9809. }
  9810. if (el.attrsMap.hasOwnProperty('v-for')) {
  9811. warnOnce('Cannot use v-for on stateful component root element because ' +
  9812. 'it renders multiple elements.', el.rawAttrsMap['v-for']);
  9813. }
  9814. }
  9815. parseHTML(template, {
  9816. warn: warn,
  9817. expectHTML: options.expectHTML,
  9818. isUnaryTag: options.isUnaryTag,
  9819. canBeLeftOpenTag: options.canBeLeftOpenTag,
  9820. shouldDecodeNewlines: options.shouldDecodeNewlines,
  9821. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  9822. shouldKeepComment: options.comments,
  9823. outputSourceRange: options.outputSourceRange,
  9824. start: function (tag, attrs, unary, start, end) {
  9825. // check namespace.
  9826. // inherit parent ns if there is one
  9827. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  9828. // handle IE svg bug
  9829. /* istanbul ignore if */
  9830. if (isIE && ns === 'svg') {
  9831. attrs = guardIESVGBug(attrs);
  9832. }
  9833. var element = createASTElement(tag, attrs, currentParent);
  9834. if (ns) {
  9835. element.ns = ns;
  9836. }
  9837. if (process.env.NODE_ENV !== 'production') {
  9838. if (options.outputSourceRange) {
  9839. element.start = start;
  9840. element.end = end;
  9841. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  9842. cumulated[attr.name] = attr;
  9843. return cumulated;
  9844. }, {});
  9845. }
  9846. attrs.forEach(function (attr) {
  9847. if (invalidAttributeRE.test(attr.name)) {
  9848. warn("Invalid dynamic argument expression: attribute names cannot contain " +
  9849. "spaces, quotes, <, >, / or =.", options.outputSourceRange
  9850. ? {
  9851. start: attr.start + attr.name.indexOf("["),
  9852. end: attr.start + attr.name.length
  9853. }
  9854. : undefined);
  9855. }
  9856. });
  9857. }
  9858. if (isForbiddenTag(element) && !isServerRendering()) {
  9859. element.forbidden = true;
  9860. process.env.NODE_ENV !== 'production' &&
  9861. warn('Templates should only be responsible for mapping the state to the ' +
  9862. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  9863. "<".concat(tag, ">") +
  9864. ', as they will not be parsed.', { start: element.start });
  9865. }
  9866. // apply pre-transforms
  9867. for (var i = 0; i < preTransforms.length; i++) {
  9868. element = preTransforms[i](element, options) || element;
  9869. }
  9870. if (!inVPre) {
  9871. processPre(element);
  9872. if (element.pre) {
  9873. inVPre = true;
  9874. }
  9875. }
  9876. if (platformIsPreTag(element.tag)) {
  9877. inPre = true;
  9878. }
  9879. if (inVPre) {
  9880. processRawAttrs(element);
  9881. }
  9882. else if (!element.processed) {
  9883. // structural directives
  9884. processFor(element);
  9885. processIf(element);
  9886. processOnce(element);
  9887. }
  9888. if (!root) {
  9889. root = element;
  9890. if (process.env.NODE_ENV !== 'production') {
  9891. checkRootConstraints(root);
  9892. }
  9893. }
  9894. if (!unary) {
  9895. currentParent = element;
  9896. stack.push(element);
  9897. }
  9898. else {
  9899. closeElement(element);
  9900. }
  9901. },
  9902. end: function (tag, start, end) {
  9903. var element = stack[stack.length - 1];
  9904. // pop stack
  9905. stack.length -= 1;
  9906. currentParent = stack[stack.length - 1];
  9907. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  9908. element.end = end;
  9909. }
  9910. closeElement(element);
  9911. },
  9912. chars: function (text, start, end) {
  9913. if (!currentParent) {
  9914. if (process.env.NODE_ENV !== 'production') {
  9915. if (text === template) {
  9916. warnOnce('Component template requires a root element, rather than just text.', { start: start });
  9917. }
  9918. else if ((text = text.trim())) {
  9919. warnOnce("text \"".concat(text, "\" outside root element will be ignored."), {
  9920. start: start
  9921. });
  9922. }
  9923. }
  9924. return;
  9925. }
  9926. // IE textarea placeholder bug
  9927. /* istanbul ignore if */
  9928. if (isIE &&
  9929. currentParent.tag === 'textarea' &&
  9930. currentParent.attrsMap.placeholder === text) {
  9931. return;
  9932. }
  9933. var children = currentParent.children;
  9934. if (inPre || text.trim()) {
  9935. text = isTextTag(currentParent)
  9936. ? text
  9937. : decodeHTMLCached(text);
  9938. }
  9939. else if (!children.length) {
  9940. // remove the whitespace-only node right after an opening tag
  9941. text = '';
  9942. }
  9943. else if (whitespaceOption) {
  9944. if (whitespaceOption === 'condense') {
  9945. // in condense mode, remove the whitespace node if it contains
  9946. // line break, otherwise condense to a single space
  9947. text = lineBreakRE.test(text) ? '' : ' ';
  9948. }
  9949. else {
  9950. text = ' ';
  9951. }
  9952. }
  9953. else {
  9954. text = preserveWhitespace ? ' ' : '';
  9955. }
  9956. if (text) {
  9957. if (!inPre && whitespaceOption === 'condense') {
  9958. // condense consecutive whitespaces into single space
  9959. text = text.replace(whitespaceRE, ' ');
  9960. }
  9961. var res = void 0;
  9962. var child = void 0;
  9963. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  9964. child = {
  9965. type: 2,
  9966. expression: res.expression,
  9967. tokens: res.tokens,
  9968. text: text
  9969. };
  9970. }
  9971. else if (text !== ' ' ||
  9972. !children.length ||
  9973. children[children.length - 1].text !== ' ') {
  9974. child = {
  9975. type: 3,
  9976. text: text
  9977. };
  9978. }
  9979. if (child) {
  9980. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  9981. child.start = start;
  9982. child.end = end;
  9983. }
  9984. children.push(child);
  9985. }
  9986. }
  9987. },
  9988. comment: function (text, start, end) {
  9989. // adding anything as a sibling to the root node is forbidden
  9990. // comments should still be allowed, but ignored
  9991. if (currentParent) {
  9992. var child = {
  9993. type: 3,
  9994. text: text,
  9995. isComment: true
  9996. };
  9997. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  9998. child.start = start;
  9999. child.end = end;
  10000. }
  10001. currentParent.children.push(child);
  10002. }
  10003. }
  10004. });
  10005. return root;
  10006. }
  10007. function processPre(el) {
  10008. if (getAndRemoveAttr(el, 'v-pre') != null) {
  10009. el.pre = true;
  10010. }
  10011. }
  10012. function processRawAttrs(el) {
  10013. var list = el.attrsList;
  10014. var len = list.length;
  10015. if (len) {
  10016. var attrs = (el.attrs = new Array(len));
  10017. for (var i = 0; i < len; i++) {
  10018. attrs[i] = {
  10019. name: list[i].name,
  10020. value: JSON.stringify(list[i].value)
  10021. };
  10022. if (list[i].start != null) {
  10023. attrs[i].start = list[i].start;
  10024. attrs[i].end = list[i].end;
  10025. }
  10026. }
  10027. }
  10028. else if (!el.pre) {
  10029. // non root node in pre blocks with no attributes
  10030. el.plain = true;
  10031. }
  10032. }
  10033. function processElement(element, options) {
  10034. processKey(element);
  10035. // determine whether this is a plain element after
  10036. // removing structural attributes
  10037. element.plain =
  10038. !element.key && !element.scopedSlots && !element.attrsList.length;
  10039. processRef(element);
  10040. processSlotContent(element);
  10041. processSlotOutlet(element);
  10042. processComponent(element);
  10043. for (var i = 0; i < transforms.length; i++) {
  10044. element = transforms[i](element, options) || element;
  10045. }
  10046. processAttrs(element);
  10047. return element;
  10048. }
  10049. function processKey(el) {
  10050. var exp = getBindingAttr(el, 'key');
  10051. if (exp) {
  10052. if (process.env.NODE_ENV !== 'production') {
  10053. if (el.tag === 'template') {
  10054. warn("<template> cannot be keyed. Place the key on real elements instead.", getRawBindingAttr(el, 'key'));
  10055. }
  10056. if (el.for) {
  10057. var iterator = el.iterator2 || el.iterator1;
  10058. var parent_1 = el.parent;
  10059. if (iterator &&
  10060. iterator === exp &&
  10061. parent_1 &&
  10062. parent_1.tag === 'transition-group') {
  10063. warn("Do not use v-for index as key on <transition-group> children, " +
  10064. "this is the same as not using keys.", getRawBindingAttr(el, 'key'), true /* tip */);
  10065. }
  10066. }
  10067. }
  10068. el.key = exp;
  10069. }
  10070. }
  10071. function processRef(el) {
  10072. var ref = getBindingAttr(el, 'ref');
  10073. if (ref) {
  10074. el.ref = ref;
  10075. el.refInFor = checkInFor(el);
  10076. }
  10077. }
  10078. function processFor(el) {
  10079. var exp;
  10080. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  10081. var res = parseFor(exp);
  10082. if (res) {
  10083. extend(el, res);
  10084. }
  10085. else if (process.env.NODE_ENV !== 'production') {
  10086. warn("Invalid v-for expression: ".concat(exp), el.rawAttrsMap['v-for']);
  10087. }
  10088. }
  10089. }
  10090. function parseFor(exp) {
  10091. var inMatch = exp.match(forAliasRE);
  10092. if (!inMatch)
  10093. return;
  10094. var res = {};
  10095. res.for = inMatch[2].trim();
  10096. var alias = inMatch[1].trim().replace(stripParensRE, '');
  10097. var iteratorMatch = alias.match(forIteratorRE);
  10098. if (iteratorMatch) {
  10099. res.alias = alias.replace(forIteratorRE, '').trim();
  10100. res.iterator1 = iteratorMatch[1].trim();
  10101. if (iteratorMatch[2]) {
  10102. res.iterator2 = iteratorMatch[2].trim();
  10103. }
  10104. }
  10105. else {
  10106. res.alias = alias;
  10107. }
  10108. return res;
  10109. }
  10110. function processIf(el) {
  10111. var exp = getAndRemoveAttr(el, 'v-if');
  10112. if (exp) {
  10113. el.if = exp;
  10114. addIfCondition(el, {
  10115. exp: exp,
  10116. block: el
  10117. });
  10118. }
  10119. else {
  10120. if (getAndRemoveAttr(el, 'v-else') != null) {
  10121. el.else = true;
  10122. }
  10123. var elseif = getAndRemoveAttr(el, 'v-else-if');
  10124. if (elseif) {
  10125. el.elseif = elseif;
  10126. }
  10127. }
  10128. }
  10129. function processIfConditions(el, parent) {
  10130. var prev = findPrevElement(parent.children);
  10131. if (prev && prev.if) {
  10132. addIfCondition(prev, {
  10133. exp: el.elseif,
  10134. block: el
  10135. });
  10136. }
  10137. else if (process.env.NODE_ENV !== 'production') {
  10138. warn("v-".concat(el.elseif ? 'else-if="' + el.elseif + '"' : 'else', " ") +
  10139. "used on element <".concat(el.tag, "> without corresponding v-if."), el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']);
  10140. }
  10141. }
  10142. function findPrevElement(children) {
  10143. var i = children.length;
  10144. while (i--) {
  10145. if (children[i].type === 1) {
  10146. return children[i];
  10147. }
  10148. else {
  10149. if (process.env.NODE_ENV !== 'production' && children[i].text !== ' ') {
  10150. warn("text \"".concat(children[i].text.trim(), "\" between v-if and v-else(-if) ") +
  10151. "will be ignored.", children[i]);
  10152. }
  10153. children.pop();
  10154. }
  10155. }
  10156. }
  10157. function addIfCondition(el, condition) {
  10158. if (!el.ifConditions) {
  10159. el.ifConditions = [];
  10160. }
  10161. el.ifConditions.push(condition);
  10162. }
  10163. function processOnce(el) {
  10164. var once = getAndRemoveAttr(el, 'v-once');
  10165. if (once != null) {
  10166. el.once = true;
  10167. }
  10168. }
  10169. // handle content being passed to a component as slot,
  10170. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  10171. function processSlotContent(el) {
  10172. var slotScope;
  10173. if (el.tag === 'template') {
  10174. slotScope = getAndRemoveAttr(el, 'scope');
  10175. /* istanbul ignore if */
  10176. if (process.env.NODE_ENV !== 'production' && slotScope) {
  10177. warn("the \"scope\" attribute for scoped slots have been deprecated and " +
  10178. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  10179. "can also be used on plain elements in addition to <template> to " +
  10180. "denote scoped slots.", el.rawAttrsMap['scope'], true);
  10181. }
  10182. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  10183. }
  10184. else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  10185. /* istanbul ignore if */
  10186. if (process.env.NODE_ENV !== 'production' && el.attrsMap['v-for']) {
  10187. warn("Ambiguous combined usage of slot-scope and v-for on <".concat(el.tag, "> ") +
  10188. "(v-for takes higher priority). Use a wrapper <template> for the " +
  10189. "scoped slot to make it clearer.", el.rawAttrsMap['slot-scope'], true);
  10190. }
  10191. el.slotScope = slotScope;
  10192. }
  10193. // slot="xxx"
  10194. var slotTarget = getBindingAttr(el, 'slot');
  10195. if (slotTarget) {
  10196. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  10197. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  10198. // preserve slot as an attribute for native shadow DOM compat
  10199. // only for non-scoped slots.
  10200. if (el.tag !== 'template' && !el.slotScope) {
  10201. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  10202. }
  10203. }
  10204. // 2.6 v-slot syntax
  10205. {
  10206. if (el.tag === 'template') {
  10207. // v-slot on <template>
  10208. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  10209. if (slotBinding) {
  10210. if (process.env.NODE_ENV !== 'production') {
  10211. if (el.slotTarget || el.slotScope) {
  10212. warn("Unexpected mixed usage of different slot syntaxes.", el);
  10213. }
  10214. if (el.parent && !maybeComponent(el.parent)) {
  10215. warn("<template v-slot> can only appear at the root level inside " +
  10216. "the receiving component", el);
  10217. }
  10218. }
  10219. var _a = getSlotName(slotBinding), name_2 = _a.name, dynamic = _a.dynamic;
  10220. el.slotTarget = name_2;
  10221. el.slotTargetDynamic = dynamic;
  10222. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  10223. }
  10224. }
  10225. else {
  10226. // v-slot on component, denotes default slot
  10227. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  10228. if (slotBinding) {
  10229. if (process.env.NODE_ENV !== 'production') {
  10230. if (!maybeComponent(el)) {
  10231. warn("v-slot can only be used on components or <template>.", slotBinding);
  10232. }
  10233. if (el.slotScope || el.slotTarget) {
  10234. warn("Unexpected mixed usage of different slot syntaxes.", el);
  10235. }
  10236. if (el.scopedSlots) {
  10237. warn("To avoid scope ambiguity, the default slot should also use " +
  10238. "<template> syntax when there are other named slots.", slotBinding);
  10239. }
  10240. }
  10241. // add the component's children to its default slot
  10242. var slots = el.scopedSlots || (el.scopedSlots = {});
  10243. var _b = getSlotName(slotBinding), name_3 = _b.name, dynamic = _b.dynamic;
  10244. var slotContainer_1 = (slots[name_3] = createASTElement('template', [], el));
  10245. slotContainer_1.slotTarget = name_3;
  10246. slotContainer_1.slotTargetDynamic = dynamic;
  10247. slotContainer_1.children = el.children.filter(function (c) {
  10248. if (!c.slotScope) {
  10249. c.parent = slotContainer_1;
  10250. return true;
  10251. }
  10252. });
  10253. slotContainer_1.slotScope = slotBinding.value || emptySlotScopeToken;
  10254. // remove children as they are returned from scopedSlots now
  10255. el.children = [];
  10256. // mark el non-plain so data gets generated
  10257. el.plain = false;
  10258. }
  10259. }
  10260. }
  10261. }
  10262. function getSlotName(binding) {
  10263. var name = binding.name.replace(slotRE, '');
  10264. if (!name) {
  10265. if (binding.name[0] !== '#') {
  10266. name = 'default';
  10267. }
  10268. else if (process.env.NODE_ENV !== 'production') {
  10269. warn("v-slot shorthand syntax requires a slot name.", binding);
  10270. }
  10271. }
  10272. return dynamicArgRE.test(name)
  10273. ? // dynamic [name]
  10274. { name: name.slice(1, -1), dynamic: true }
  10275. : // static name
  10276. { name: "\"".concat(name, "\""), dynamic: false };
  10277. }
  10278. // handle <slot/> outlets
  10279. function processSlotOutlet(el) {
  10280. if (el.tag === 'slot') {
  10281. el.slotName = getBindingAttr(el, 'name');
  10282. if (process.env.NODE_ENV !== 'production' && el.key) {
  10283. warn("`key` does not work on <slot> because slots are abstract outlets " +
  10284. "and can possibly expand into multiple elements. " +
  10285. "Use the key on a wrapping element instead.", getRawBindingAttr(el, 'key'));
  10286. }
  10287. }
  10288. }
  10289. function processComponent(el) {
  10290. var binding;
  10291. if ((binding = getBindingAttr(el, 'is'))) {
  10292. el.component = binding;
  10293. }
  10294. if (getAndRemoveAttr(el, 'inline-template') != null) {
  10295. el.inlineTemplate = true;
  10296. }
  10297. }
  10298. function processAttrs(el) {
  10299. var list = el.attrsList;
  10300. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  10301. for (i = 0, l = list.length; i < l; i++) {
  10302. name = rawName = list[i].name;
  10303. value = list[i].value;
  10304. if (dirRE.test(name)) {
  10305. // mark element as dynamic
  10306. el.hasBindings = true;
  10307. // modifiers
  10308. modifiers = parseModifiers(name.replace(dirRE, ''));
  10309. // support .foo shorthand syntax for the .prop modifier
  10310. if (modifiers) {
  10311. name = name.replace(modifierRE, '');
  10312. }
  10313. if (bindRE.test(name)) {
  10314. // v-bind
  10315. name = name.replace(bindRE, '');
  10316. value = parseFilters(value);
  10317. isDynamic = dynamicArgRE.test(name);
  10318. if (isDynamic) {
  10319. name = name.slice(1, -1);
  10320. }
  10321. if (process.env.NODE_ENV !== 'production' && value.trim().length === 0) {
  10322. warn("The value for a v-bind expression cannot be empty. Found in \"v-bind:".concat(name, "\""));
  10323. }
  10324. if (modifiers) {
  10325. if (modifiers.prop && !isDynamic) {
  10326. name = camelize(name);
  10327. if (name === 'innerHtml')
  10328. name = 'innerHTML';
  10329. }
  10330. if (modifiers.camel && !isDynamic) {
  10331. name = camelize(name);
  10332. }
  10333. if (modifiers.sync) {
  10334. syncGen = genAssignmentCode(value, "$event");
  10335. if (!isDynamic) {
  10336. addHandler(el, "update:".concat(camelize(name)), syncGen, null, false, warn, list[i]);
  10337. if (hyphenate(name) !== camelize(name)) {
  10338. addHandler(el, "update:".concat(hyphenate(name)), syncGen, null, false, warn, list[i]);
  10339. }
  10340. }
  10341. else {
  10342. // handler w/ dynamic event name
  10343. addHandler(el, "\"update:\"+(".concat(name, ")"), syncGen, null, false, warn, list[i], true // dynamic
  10344. );
  10345. }
  10346. }
  10347. }
  10348. if ((modifiers && modifiers.prop) ||
  10349. (!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name))) {
  10350. addProp(el, name, value, list[i], isDynamic);
  10351. }
  10352. else {
  10353. addAttr(el, name, value, list[i], isDynamic);
  10354. }
  10355. }
  10356. else if (onRE.test(name)) {
  10357. // v-on
  10358. name = name.replace(onRE, '');
  10359. isDynamic = dynamicArgRE.test(name);
  10360. if (isDynamic) {
  10361. name = name.slice(1, -1);
  10362. }
  10363. addHandler(el, name, value, modifiers, false, warn, list[i], isDynamic);
  10364. }
  10365. else {
  10366. // normal directives
  10367. name = name.replace(dirRE, '');
  10368. // parse arg
  10369. var argMatch = name.match(argRE);
  10370. var arg = argMatch && argMatch[1];
  10371. isDynamic = false;
  10372. if (arg) {
  10373. name = name.slice(0, -(arg.length + 1));
  10374. if (dynamicArgRE.test(arg)) {
  10375. arg = arg.slice(1, -1);
  10376. isDynamic = true;
  10377. }
  10378. }
  10379. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  10380. if (process.env.NODE_ENV !== 'production' && name === 'model') {
  10381. checkForAliasModel(el, value);
  10382. }
  10383. }
  10384. }
  10385. else {
  10386. // literal attribute
  10387. if (process.env.NODE_ENV !== 'production') {
  10388. var res = parseText(value, delimiters);
  10389. if (res) {
  10390. warn("".concat(name, "=\"").concat(value, "\": ") +
  10391. 'Interpolation inside attributes has been removed. ' +
  10392. 'Use v-bind or the colon shorthand instead. For example, ' +
  10393. 'instead of <div id="{{ val }}">, use <div :id="val">.', list[i]);
  10394. }
  10395. }
  10396. addAttr(el, name, JSON.stringify(value), list[i]);
  10397. // #6887 firefox doesn't update muted state if set via attribute
  10398. // even immediately after element creation
  10399. if (!el.component &&
  10400. name === 'muted' &&
  10401. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  10402. addProp(el, name, 'true', list[i]);
  10403. }
  10404. }
  10405. }
  10406. }
  10407. function checkInFor(el) {
  10408. var parent = el;
  10409. while (parent) {
  10410. if (parent.for !== undefined) {
  10411. return true;
  10412. }
  10413. parent = parent.parent;
  10414. }
  10415. return false;
  10416. }
  10417. function parseModifiers(name) {
  10418. var match = name.match(modifierRE);
  10419. if (match) {
  10420. var ret_1 = {};
  10421. match.forEach(function (m) {
  10422. ret_1[m.slice(1)] = true;
  10423. });
  10424. return ret_1;
  10425. }
  10426. }
  10427. function makeAttrsMap(attrs) {
  10428. var map = {};
  10429. for (var i = 0, l = attrs.length; i < l; i++) {
  10430. if (process.env.NODE_ENV !== 'production' && map[attrs[i].name] && !isIE && !isEdge) {
  10431. warn('duplicate attribute: ' + attrs[i].name, attrs[i]);
  10432. }
  10433. map[attrs[i].name] = attrs[i].value;
  10434. }
  10435. return map;
  10436. }
  10437. // for script (e.g. type="x/template") or style, do not decode content
  10438. function isTextTag(el) {
  10439. return el.tag === 'script' || el.tag === 'style';
  10440. }
  10441. function isForbiddenTag(el) {
  10442. return (el.tag === 'style' ||
  10443. (el.tag === 'script' &&
  10444. (!el.attrsMap.type || el.attrsMap.type === 'text/javascript')));
  10445. }
  10446. var ieNSBug = /^xmlns:NS\d+/;
  10447. var ieNSPrefix = /^NS\d+:/;
  10448. /* istanbul ignore next */
  10449. function guardIESVGBug(attrs) {
  10450. var res = [];
  10451. for (var i = 0; i < attrs.length; i++) {
  10452. var attr = attrs[i];
  10453. if (!ieNSBug.test(attr.name)) {
  10454. attr.name = attr.name.replace(ieNSPrefix, '');
  10455. res.push(attr);
  10456. }
  10457. }
  10458. return res;
  10459. }
  10460. function checkForAliasModel(el, value) {
  10461. var _el = el;
  10462. while (_el) {
  10463. if (_el.for && _el.alias === value) {
  10464. warn("<".concat(el.tag, " v-model=\"").concat(value, "\">: ") +
  10465. "You are binding v-model directly to a v-for iteration alias. " +
  10466. "This will not be able to modify the v-for source array because " +
  10467. "writing to the alias is like modifying a function local variable. " +
  10468. "Consider using an array of objects and use v-model on an object property instead.", el.rawAttrsMap['v-model']);
  10469. }
  10470. _el = _el.parent;
  10471. }
  10472. }
  10473. /**
  10474. * Expand input[v-model] with dynamic type bindings into v-if-else chains
  10475. * Turn this:
  10476. * <input v-model="data[type]" :type="type">
  10477. * into this:
  10478. * <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
  10479. * <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
  10480. * <input v-else :type="type" v-model="data[type]">
  10481. */
  10482. function preTransformNode(el, options) {
  10483. if (el.tag === 'input') {
  10484. var map = el.attrsMap;
  10485. if (!map['v-model']) {
  10486. return;
  10487. }
  10488. var typeBinding = void 0;
  10489. if (map[':type'] || map['v-bind:type']) {
  10490. typeBinding = getBindingAttr(el, 'type');
  10491. }
  10492. if (!map.type && !typeBinding && map['v-bind']) {
  10493. typeBinding = "(".concat(map['v-bind'], ").type");
  10494. }
  10495. if (typeBinding) {
  10496. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  10497. var ifConditionExtra = ifCondition ? "&&(".concat(ifCondition, ")") : "";
  10498. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  10499. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  10500. // 1. checkbox
  10501. var branch0 = cloneASTElement(el);
  10502. // process for on the main node
  10503. processFor(branch0);
  10504. addRawAttr(branch0, 'type', 'checkbox');
  10505. processElement(branch0, options);
  10506. branch0.processed = true; // prevent it from double-processed
  10507. branch0.if = "(".concat(typeBinding, ")==='checkbox'") + ifConditionExtra;
  10508. addIfCondition(branch0, {
  10509. exp: branch0.if,
  10510. block: branch0
  10511. });
  10512. // 2. add radio else-if condition
  10513. var branch1 = cloneASTElement(el);
  10514. getAndRemoveAttr(branch1, 'v-for', true);
  10515. addRawAttr(branch1, 'type', 'radio');
  10516. processElement(branch1, options);
  10517. addIfCondition(branch0, {
  10518. exp: "(".concat(typeBinding, ")==='radio'") + ifConditionExtra,
  10519. block: branch1
  10520. });
  10521. // 3. other
  10522. var branch2 = cloneASTElement(el);
  10523. getAndRemoveAttr(branch2, 'v-for', true);
  10524. addRawAttr(branch2, ':type', typeBinding);
  10525. processElement(branch2, options);
  10526. addIfCondition(branch0, {
  10527. exp: ifCondition,
  10528. block: branch2
  10529. });
  10530. if (hasElse) {
  10531. branch0.else = true;
  10532. }
  10533. else if (elseIfCondition) {
  10534. branch0.elseif = elseIfCondition;
  10535. }
  10536. return branch0;
  10537. }
  10538. }
  10539. }
  10540. function cloneASTElement(el) {
  10541. return createASTElement(el.tag, el.attrsList.slice(), el.parent);
  10542. }
  10543. var model = {
  10544. preTransformNode: preTransformNode
  10545. };
  10546. var modules = [klass, style, model];
  10547. function text(el, dir) {
  10548. if (dir.value) {
  10549. addProp(el, 'textContent', "_s(".concat(dir.value, ")"), dir);
  10550. }
  10551. }
  10552. function html(el, dir) {
  10553. if (dir.value) {
  10554. addProp(el, 'innerHTML', "_s(".concat(dir.value, ")"), dir);
  10555. }
  10556. }
  10557. var directives = {
  10558. model: model$1,
  10559. text: text,
  10560. html: html
  10561. };
  10562. var baseOptions = {
  10563. expectHTML: true,
  10564. modules: modules,
  10565. directives: directives,
  10566. isPreTag: isPreTag,
  10567. isUnaryTag: isUnaryTag,
  10568. mustUseProp: mustUseProp,
  10569. canBeLeftOpenTag: canBeLeftOpenTag,
  10570. isReservedTag: isReservedTag,
  10571. getTagNamespace: getTagNamespace,
  10572. staticKeys: genStaticKeys$1(modules)
  10573. };
  10574. var isStaticKey;
  10575. var isPlatformReservedTag;
  10576. var genStaticKeysCached = cached(genStaticKeys);
  10577. /**
  10578. * Goal of the optimizer: walk the generated template AST tree
  10579. * and detect sub-trees that are purely static, i.e. parts of
  10580. * the DOM that never needs to change.
  10581. *
  10582. * Once we detect these sub-trees, we can:
  10583. *
  10584. * 1. Hoist them into constants, so that we no longer need to
  10585. * create fresh nodes for them on each re-render;
  10586. * 2. Completely skip them in the patching process.
  10587. */
  10588. function optimize(root, options) {
  10589. if (!root)
  10590. return;
  10591. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  10592. isPlatformReservedTag = options.isReservedTag || no;
  10593. // first pass: mark all non-static nodes.
  10594. markStatic(root);
  10595. // second pass: mark static roots.
  10596. markStaticRoots(root, false);
  10597. }
  10598. function genStaticKeys(keys) {
  10599. return makeMap('type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  10600. (keys ? ',' + keys : ''));
  10601. }
  10602. function markStatic(node) {
  10603. node.static = isStatic(node);
  10604. if (node.type === 1) {
  10605. // do not make component slot content static. this avoids
  10606. // 1. components not able to mutate slot nodes
  10607. // 2. static slot content fails for hot-reloading
  10608. if (!isPlatformReservedTag(node.tag) &&
  10609. node.tag !== 'slot' &&
  10610. node.attrsMap['inline-template'] == null) {
  10611. return;
  10612. }
  10613. for (var i = 0, l = node.children.length; i < l; i++) {
  10614. var child = node.children[i];
  10615. markStatic(child);
  10616. if (!child.static) {
  10617. node.static = false;
  10618. }
  10619. }
  10620. if (node.ifConditions) {
  10621. for (var i = 1, l = node.ifConditions.length; i < l; i++) {
  10622. var block = node.ifConditions[i].block;
  10623. markStatic(block);
  10624. if (!block.static) {
  10625. node.static = false;
  10626. }
  10627. }
  10628. }
  10629. }
  10630. }
  10631. function markStaticRoots(node, isInFor) {
  10632. if (node.type === 1) {
  10633. if (node.static || node.once) {
  10634. node.staticInFor = isInFor;
  10635. }
  10636. // For a node to qualify as a static root, it should have children that
  10637. // are not just static text. Otherwise the cost of hoisting out will
  10638. // outweigh the benefits and it's better off to just always render it fresh.
  10639. if (node.static &&
  10640. node.children.length &&
  10641. !(node.children.length === 1 && node.children[0].type === 3)) {
  10642. node.staticRoot = true;
  10643. return;
  10644. }
  10645. else {
  10646. node.staticRoot = false;
  10647. }
  10648. if (node.children) {
  10649. for (var i = 0, l = node.children.length; i < l; i++) {
  10650. markStaticRoots(node.children[i], isInFor || !!node.for);
  10651. }
  10652. }
  10653. if (node.ifConditions) {
  10654. for (var i = 1, l = node.ifConditions.length; i < l; i++) {
  10655. markStaticRoots(node.ifConditions[i].block, isInFor);
  10656. }
  10657. }
  10658. }
  10659. }
  10660. function isStatic(node) {
  10661. if (node.type === 2) {
  10662. // expression
  10663. return false;
  10664. }
  10665. if (node.type === 3) {
  10666. // text
  10667. return true;
  10668. }
  10669. return !!(node.pre ||
  10670. (!node.hasBindings && // no dynamic bindings
  10671. !node.if &&
  10672. !node.for && // not v-if or v-for or v-else
  10673. !isBuiltInTag(node.tag) && // not a built-in
  10674. isPlatformReservedTag(node.tag) && // not a component
  10675. !isDirectChildOfTemplateFor(node) &&
  10676. Object.keys(node).every(isStaticKey)));
  10677. }
  10678. function isDirectChildOfTemplateFor(node) {
  10679. while (node.parent) {
  10680. node = node.parent;
  10681. if (node.tag !== 'template') {
  10682. return false;
  10683. }
  10684. if (node.for) {
  10685. return true;
  10686. }
  10687. }
  10688. return false;
  10689. }
  10690. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  10691. var fnInvokeRE = /\([^)]*?\);*$/;
  10692. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  10693. // KeyboardEvent.keyCode aliases
  10694. var keyCodes = {
  10695. esc: 27,
  10696. tab: 9,
  10697. enter: 13,
  10698. space: 32,
  10699. up: 38,
  10700. left: 37,
  10701. right: 39,
  10702. down: 40,
  10703. delete: [8, 46]
  10704. };
  10705. // KeyboardEvent.key aliases
  10706. var keyNames = {
  10707. // #7880: IE11 and Edge use `Esc` for Escape key name.
  10708. esc: ['Esc', 'Escape'],
  10709. tab: 'Tab',
  10710. enter: 'Enter',
  10711. // #9112: IE11 uses `Spacebar` for Space key name.
  10712. space: [' ', 'Spacebar'],
  10713. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  10714. up: ['Up', 'ArrowUp'],
  10715. left: ['Left', 'ArrowLeft'],
  10716. right: ['Right', 'ArrowRight'],
  10717. down: ['Down', 'ArrowDown'],
  10718. // #9112: IE11 uses `Del` for Delete key name.
  10719. delete: ['Backspace', 'Delete', 'Del']
  10720. };
  10721. // #4868: modifiers that prevent the execution of the listener
  10722. // need to explicitly return null so that we can determine whether to remove
  10723. // the listener for .once
  10724. var genGuard = function (condition) { return "if(".concat(condition, ")return null;"); };
  10725. var modifierCode = {
  10726. stop: '$event.stopPropagation();',
  10727. prevent: '$event.preventDefault();',
  10728. self: genGuard("$event.target !== $event.currentTarget"),
  10729. ctrl: genGuard("!$event.ctrlKey"),
  10730. shift: genGuard("!$event.shiftKey"),
  10731. alt: genGuard("!$event.altKey"),
  10732. meta: genGuard("!$event.metaKey"),
  10733. left: genGuard("'button' in $event && $event.button !== 0"),
  10734. middle: genGuard("'button' in $event && $event.button !== 1"),
  10735. right: genGuard("'button' in $event && $event.button !== 2")
  10736. };
  10737. function genHandlers(events, isNative) {
  10738. var prefix = isNative ? 'nativeOn:' : 'on:';
  10739. var staticHandlers = "";
  10740. var dynamicHandlers = "";
  10741. for (var name_1 in events) {
  10742. var handlerCode = genHandler(events[name_1]);
  10743. //@ts-expect-error
  10744. if (events[name_1] && events[name_1].dynamic) {
  10745. dynamicHandlers += "".concat(name_1, ",").concat(handlerCode, ",");
  10746. }
  10747. else {
  10748. staticHandlers += "\"".concat(name_1, "\":").concat(handlerCode, ",");
  10749. }
  10750. }
  10751. staticHandlers = "{".concat(staticHandlers.slice(0, -1), "}");
  10752. if (dynamicHandlers) {
  10753. return prefix + "_d(".concat(staticHandlers, ",[").concat(dynamicHandlers.slice(0, -1), "])");
  10754. }
  10755. else {
  10756. return prefix + staticHandlers;
  10757. }
  10758. }
  10759. function genHandler(handler) {
  10760. if (!handler) {
  10761. return 'function(){}';
  10762. }
  10763. if (Array.isArray(handler)) {
  10764. return "[".concat(handler.map(function (handler) { return genHandler(handler); }).join(','), "]");
  10765. }
  10766. var isMethodPath = simplePathRE.test(handler.value);
  10767. var isFunctionExpression = fnExpRE.test(handler.value);
  10768. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  10769. if (!handler.modifiers) {
  10770. if (isMethodPath || isFunctionExpression) {
  10771. return handler.value;
  10772. }
  10773. return "function($event){".concat(isFunctionInvocation ? "return ".concat(handler.value) : handler.value, "}"); // inline statement
  10774. }
  10775. else {
  10776. var code = '';
  10777. var genModifierCode = '';
  10778. var keys = [];
  10779. var _loop_1 = function (key) {
  10780. if (modifierCode[key]) {
  10781. genModifierCode += modifierCode[key];
  10782. // left/right
  10783. if (keyCodes[key]) {
  10784. keys.push(key);
  10785. }
  10786. }
  10787. else if (key === 'exact') {
  10788. var modifiers_1 = handler.modifiers;
  10789. genModifierCode += genGuard(['ctrl', 'shift', 'alt', 'meta']
  10790. .filter(function (keyModifier) { return !modifiers_1[keyModifier]; })
  10791. .map(function (keyModifier) { return "$event.".concat(keyModifier, "Key"); })
  10792. .join('||'));
  10793. }
  10794. else {
  10795. keys.push(key);
  10796. }
  10797. };
  10798. for (var key in handler.modifiers) {
  10799. _loop_1(key);
  10800. }
  10801. if (keys.length) {
  10802. code += genKeyFilter(keys);
  10803. }
  10804. // Make sure modifiers like prevent and stop get executed after key filtering
  10805. if (genModifierCode) {
  10806. code += genModifierCode;
  10807. }
  10808. var handlerCode = isMethodPath
  10809. ? "return ".concat(handler.value, ".apply(null, arguments)")
  10810. : isFunctionExpression
  10811. ? "return (".concat(handler.value, ").apply(null, arguments)")
  10812. : isFunctionInvocation
  10813. ? "return ".concat(handler.value)
  10814. : handler.value;
  10815. return "function($event){".concat(code).concat(handlerCode, "}");
  10816. }
  10817. }
  10818. function genKeyFilter(keys) {
  10819. return (
  10820. // make sure the key filters only apply to KeyboardEvents
  10821. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  10822. // key events that do not have keyCode property...
  10823. "if(!$event.type.indexOf('key')&&" +
  10824. "".concat(keys.map(genFilterCode).join('&&'), ")return null;"));
  10825. }
  10826. function genFilterCode(key) {
  10827. var keyVal = parseInt(key, 10);
  10828. if (keyVal) {
  10829. return "$event.keyCode!==".concat(keyVal);
  10830. }
  10831. var keyCode = keyCodes[key];
  10832. var keyName = keyNames[key];
  10833. return ("_k($event.keyCode," +
  10834. "".concat(JSON.stringify(key), ",") +
  10835. "".concat(JSON.stringify(keyCode), ",") +
  10836. "$event.key," +
  10837. "".concat(JSON.stringify(keyName)) +
  10838. ")");
  10839. }
  10840. function on(el, dir) {
  10841. if (process.env.NODE_ENV !== 'production' && dir.modifiers) {
  10842. warn$2("v-on without argument does not support modifiers.");
  10843. }
  10844. el.wrapListeners = function (code) { return "_g(".concat(code, ",").concat(dir.value, ")"); };
  10845. }
  10846. function bind(el, dir) {
  10847. el.wrapData = function (code) {
  10848. 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' : '', ")");
  10849. };
  10850. }
  10851. var baseDirectives = {
  10852. on: on,
  10853. bind: bind,
  10854. cloak: noop
  10855. };
  10856. var CodegenState = /** @class */ (function () {
  10857. function CodegenState(options) {
  10858. this.options = options;
  10859. this.warn = options.warn || baseWarn;
  10860. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  10861. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  10862. this.directives = extend(extend({}, baseDirectives), options.directives);
  10863. var isReservedTag = options.isReservedTag || no;
  10864. this.maybeComponent = function (el) {
  10865. return !!el.component || !isReservedTag(el.tag);
  10866. };
  10867. this.onceId = 0;
  10868. this.staticRenderFns = [];
  10869. this.pre = false;
  10870. }
  10871. return CodegenState;
  10872. }());
  10873. function generate(ast, options) {
  10874. var state = new CodegenState(options);
  10875. // fix #11483, Root level <script> tags should not be rendered.
  10876. var code = ast
  10877. ? ast.tag === 'script'
  10878. ? 'null'
  10879. : genElement(ast, state)
  10880. : '_c("div")';
  10881. return {
  10882. render: "with(this){return ".concat(code, "}"),
  10883. staticRenderFns: state.staticRenderFns
  10884. };
  10885. }
  10886. function genElement(el, state) {
  10887. if (el.parent) {
  10888. el.pre = el.pre || el.parent.pre;
  10889. }
  10890. if (el.staticRoot && !el.staticProcessed) {
  10891. return genStatic(el, state);
  10892. }
  10893. else if (el.once && !el.onceProcessed) {
  10894. return genOnce(el, state);
  10895. }
  10896. else if (el.for && !el.forProcessed) {
  10897. return genFor(el, state);
  10898. }
  10899. else if (el.if && !el.ifProcessed) {
  10900. return genIf(el, state);
  10901. }
  10902. else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  10903. return genChildren(el, state) || 'void 0';
  10904. }
  10905. else if (el.tag === 'slot') {
  10906. return genSlot(el, state);
  10907. }
  10908. else {
  10909. // component or element
  10910. var code = void 0;
  10911. if (el.component) {
  10912. code = genComponent(el.component, el, state);
  10913. }
  10914. else {
  10915. var data = void 0;
  10916. var maybeComponent = state.maybeComponent(el);
  10917. if (!el.plain || (el.pre && maybeComponent)) {
  10918. data = genData(el, state);
  10919. }
  10920. var tag
  10921. // check if this is a component in <script setup>
  10922. = void 0;
  10923. // check if this is a component in <script setup>
  10924. var bindings = state.options.bindings;
  10925. if (maybeComponent && bindings && bindings.__isScriptSetup !== false) {
  10926. tag = checkBindingType(bindings, el.tag);
  10927. }
  10928. if (!tag)
  10929. tag = "'".concat(el.tag, "'");
  10930. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  10931. code = "_c(".concat(tag).concat(data ? ",".concat(data) : '' // data
  10932. ).concat(children ? ",".concat(children) : '' // children
  10933. , ")");
  10934. }
  10935. // module transforms
  10936. for (var i = 0; i < state.transforms.length; i++) {
  10937. code = state.transforms[i](el, code);
  10938. }
  10939. return code;
  10940. }
  10941. }
  10942. function checkBindingType(bindings, key) {
  10943. var camelName = camelize(key);
  10944. var PascalName = capitalize(camelName);
  10945. var checkType = function (type) {
  10946. if (bindings[key] === type) {
  10947. return key;
  10948. }
  10949. if (bindings[camelName] === type) {
  10950. return camelName;
  10951. }
  10952. if (bindings[PascalName] === type) {
  10953. return PascalName;
  10954. }
  10955. };
  10956. var fromConst = checkType("setup-const" /* BindingTypes.SETUP_CONST */) ||
  10957. checkType("setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */);
  10958. if (fromConst) {
  10959. return fromConst;
  10960. }
  10961. var fromMaybeRef = checkType("setup-let" /* BindingTypes.SETUP_LET */) ||
  10962. checkType("setup-ref" /* BindingTypes.SETUP_REF */) ||
  10963. checkType("setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
  10964. if (fromMaybeRef) {
  10965. return fromMaybeRef;
  10966. }
  10967. }
  10968. // hoist static sub-trees out
  10969. function genStatic(el, state) {
  10970. el.staticProcessed = true;
  10971. // Some elements (templates) need to behave differently inside of a v-pre
  10972. // node. All pre nodes are static roots, so we can use this as a location to
  10973. // wrap a state change and reset it upon exiting the pre node.
  10974. var originalPreState = state.pre;
  10975. if (el.pre) {
  10976. state.pre = el.pre;
  10977. }
  10978. state.staticRenderFns.push("with(this){return ".concat(genElement(el, state), "}"));
  10979. state.pre = originalPreState;
  10980. return "_m(".concat(state.staticRenderFns.length - 1).concat(el.staticInFor ? ',true' : '', ")");
  10981. }
  10982. // v-once
  10983. function genOnce(el, state) {
  10984. el.onceProcessed = true;
  10985. if (el.if && !el.ifProcessed) {
  10986. return genIf(el, state);
  10987. }
  10988. else if (el.staticInFor) {
  10989. var key = '';
  10990. var parent_1 = el.parent;
  10991. while (parent_1) {
  10992. if (parent_1.for) {
  10993. key = parent_1.key;
  10994. break;
  10995. }
  10996. parent_1 = parent_1.parent;
  10997. }
  10998. if (!key) {
  10999. process.env.NODE_ENV !== 'production' &&
  11000. state.warn("v-once can only be used inside v-for that is keyed. ", el.rawAttrsMap['v-once']);
  11001. return genElement(el, state);
  11002. }
  11003. return "_o(".concat(genElement(el, state), ",").concat(state.onceId++, ",").concat(key, ")");
  11004. }
  11005. else {
  11006. return genStatic(el, state);
  11007. }
  11008. }
  11009. function genIf(el, state, altGen, altEmpty) {
  11010. el.ifProcessed = true; // avoid recursion
  11011. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty);
  11012. }
  11013. function genIfConditions(conditions, state, altGen, altEmpty) {
  11014. if (!conditions.length) {
  11015. return altEmpty || '_e()';
  11016. }
  11017. var condition = conditions.shift();
  11018. if (condition.exp) {
  11019. return "(".concat(condition.exp, ")?").concat(genTernaryExp(condition.block), ":").concat(genIfConditions(conditions, state, altGen, altEmpty));
  11020. }
  11021. else {
  11022. return "".concat(genTernaryExp(condition.block));
  11023. }
  11024. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  11025. function genTernaryExp(el) {
  11026. return altGen
  11027. ? altGen(el, state)
  11028. : el.once
  11029. ? genOnce(el, state)
  11030. : genElement(el, state);
  11031. }
  11032. }
  11033. function genFor(el, state, altGen, altHelper) {
  11034. var exp = el.for;
  11035. var alias = el.alias;
  11036. var iterator1 = el.iterator1 ? ",".concat(el.iterator1) : '';
  11037. var iterator2 = el.iterator2 ? ",".concat(el.iterator2) : '';
  11038. if (process.env.NODE_ENV !== 'production' &&
  11039. state.maybeComponent(el) &&
  11040. el.tag !== 'slot' &&
  11041. el.tag !== 'template' &&
  11042. !el.key) {
  11043. state.warn("<".concat(el.tag, " v-for=\"").concat(alias, " in ").concat(exp, "\">: component lists rendered with ") +
  11044. "v-for should have explicit keys. " +
  11045. "See https://v2.vuejs.org/v2/guide/list.html#key for more info.", el.rawAttrsMap['v-for'], true /* tip */);
  11046. }
  11047. el.forProcessed = true; // avoid recursion
  11048. return ("".concat(altHelper || '_l', "((").concat(exp, "),") +
  11049. "function(".concat(alias).concat(iterator1).concat(iterator2, "){") +
  11050. "return ".concat((altGen || genElement)(el, state)) +
  11051. '})');
  11052. }
  11053. function genData(el, state) {
  11054. var data = '{';
  11055. // directives first.
  11056. // directives may mutate the el's other properties before they are generated.
  11057. var dirs = genDirectives(el, state);
  11058. if (dirs)
  11059. data += dirs + ',';
  11060. // key
  11061. if (el.key) {
  11062. data += "key:".concat(el.key, ",");
  11063. }
  11064. // ref
  11065. if (el.ref) {
  11066. data += "ref:".concat(el.ref, ",");
  11067. }
  11068. if (el.refInFor) {
  11069. data += "refInFor:true,";
  11070. }
  11071. // pre
  11072. if (el.pre) {
  11073. data += "pre:true,";
  11074. }
  11075. // record original tag name for components using "is" attribute
  11076. if (el.component) {
  11077. data += "tag:\"".concat(el.tag, "\",");
  11078. }
  11079. // module data generation functions
  11080. for (var i = 0; i < state.dataGenFns.length; i++) {
  11081. data += state.dataGenFns[i](el);
  11082. }
  11083. // attributes
  11084. if (el.attrs) {
  11085. data += "attrs:".concat(genProps(el.attrs), ",");
  11086. }
  11087. // DOM props
  11088. if (el.props) {
  11089. data += "domProps:".concat(genProps(el.props), ",");
  11090. }
  11091. // event handlers
  11092. if (el.events) {
  11093. data += "".concat(genHandlers(el.events, false), ",");
  11094. }
  11095. if (el.nativeEvents) {
  11096. data += "".concat(genHandlers(el.nativeEvents, true), ",");
  11097. }
  11098. // slot target
  11099. // only for non-scoped slots
  11100. if (el.slotTarget && !el.slotScope) {
  11101. data += "slot:".concat(el.slotTarget, ",");
  11102. }
  11103. // scoped slots
  11104. if (el.scopedSlots) {
  11105. data += "".concat(genScopedSlots(el, el.scopedSlots, state), ",");
  11106. }
  11107. // component v-model
  11108. if (el.model) {
  11109. data += "model:{value:".concat(el.model.value, ",callback:").concat(el.model.callback, ",expression:").concat(el.model.expression, "},");
  11110. }
  11111. // inline-template
  11112. if (el.inlineTemplate) {
  11113. var inlineTemplate = genInlineTemplate(el, state);
  11114. if (inlineTemplate) {
  11115. data += "".concat(inlineTemplate, ",");
  11116. }
  11117. }
  11118. data = data.replace(/,$/, '') + '}';
  11119. // v-bind dynamic argument wrap
  11120. // v-bind with dynamic arguments must be applied using the same v-bind object
  11121. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  11122. if (el.dynamicAttrs) {
  11123. data = "_b(".concat(data, ",\"").concat(el.tag, "\",").concat(genProps(el.dynamicAttrs), ")");
  11124. }
  11125. // v-bind data wrap
  11126. if (el.wrapData) {
  11127. data = el.wrapData(data);
  11128. }
  11129. // v-on data wrap
  11130. if (el.wrapListeners) {
  11131. data = el.wrapListeners(data);
  11132. }
  11133. return data;
  11134. }
  11135. function genDirectives(el, state) {
  11136. var dirs = el.directives;
  11137. if (!dirs)
  11138. return;
  11139. var res = 'directives:[';
  11140. var hasRuntime = false;
  11141. var i, l, dir, needRuntime;
  11142. for (i = 0, l = dirs.length; i < l; i++) {
  11143. dir = dirs[i];
  11144. needRuntime = true;
  11145. var gen = state.directives[dir.name];
  11146. if (gen) {
  11147. // compile-time directive that manipulates AST.
  11148. // returns true if it also needs a runtime counterpart.
  11149. needRuntime = !!gen(el, dir, state.warn);
  11150. }
  11151. if (needRuntime) {
  11152. hasRuntime = true;
  11153. res += "{name:\"".concat(dir.name, "\",rawName:\"").concat(dir.rawName, "\"").concat(dir.value
  11154. ? ",value:(".concat(dir.value, "),expression:").concat(JSON.stringify(dir.value))
  11155. : '').concat(dir.arg ? ",arg:".concat(dir.isDynamicArg ? dir.arg : "\"".concat(dir.arg, "\"")) : '').concat(dir.modifiers ? ",modifiers:".concat(JSON.stringify(dir.modifiers)) : '', "},");
  11156. }
  11157. }
  11158. if (hasRuntime) {
  11159. return res.slice(0, -1) + ']';
  11160. }
  11161. }
  11162. function genInlineTemplate(el, state) {
  11163. var ast = el.children[0];
  11164. if (process.env.NODE_ENV !== 'production' && (el.children.length !== 1 || ast.type !== 1)) {
  11165. state.warn('Inline-template components must have exactly one child element.', { start: el.start });
  11166. }
  11167. if (ast && ast.type === 1) {
  11168. var inlineRenderFns = generate(ast, state.options);
  11169. return "inlineTemplate:{render:function(){".concat(inlineRenderFns.render, "},staticRenderFns:[").concat(inlineRenderFns.staticRenderFns
  11170. .map(function (code) { return "function(){".concat(code, "}"); })
  11171. .join(','), "]}");
  11172. }
  11173. }
  11174. function genScopedSlots(el, slots, state) {
  11175. // by default scoped slots are considered "stable", this allows child
  11176. // components with only scoped slots to skip forced updates from parent.
  11177. // but in some cases we have to bail-out of this optimization
  11178. // for example if the slot contains dynamic names, has v-if or v-for on them...
  11179. var needsForceUpdate = el.for ||
  11180. Object.keys(slots).some(function (key) {
  11181. var slot = slots[key];
  11182. return (slot.slotTargetDynamic || slot.if || slot.for || containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  11183. );
  11184. });
  11185. // #9534: if a component with scoped slots is inside a conditional branch,
  11186. // it's possible for the same component to be reused but with different
  11187. // compiled slot content. To avoid that, we generate a unique key based on
  11188. // the generated code of all the slot contents.
  11189. var needsKey = !!el.if;
  11190. // OR when it is inside another scoped slot or v-for (the reactivity may be
  11191. // disconnected due to the intermediate scope variable)
  11192. // #9438, #9506
  11193. // TODO: this can be further optimized by properly analyzing in-scope bindings
  11194. // and skip force updating ones that do not actually use scope variables.
  11195. if (!needsForceUpdate) {
  11196. var parent_2 = el.parent;
  11197. while (parent_2) {
  11198. if ((parent_2.slotScope && parent_2.slotScope !== emptySlotScopeToken) ||
  11199. parent_2.for) {
  11200. needsForceUpdate = true;
  11201. break;
  11202. }
  11203. if (parent_2.if) {
  11204. needsKey = true;
  11205. }
  11206. parent_2 = parent_2.parent;
  11207. }
  11208. }
  11209. var generatedSlots = Object.keys(slots)
  11210. .map(function (key) { return genScopedSlot(slots[key], state); })
  11211. .join(',');
  11212. return "scopedSlots:_u([".concat(generatedSlots, "]").concat(needsForceUpdate ? ",null,true" : "").concat(!needsForceUpdate && needsKey ? ",null,false,".concat(hash(generatedSlots)) : "", ")");
  11213. }
  11214. function hash(str) {
  11215. var hash = 5381;
  11216. var i = str.length;
  11217. while (i) {
  11218. hash = (hash * 33) ^ str.charCodeAt(--i);
  11219. }
  11220. return hash >>> 0;
  11221. }
  11222. function containsSlotChild(el) {
  11223. if (el.type === 1) {
  11224. if (el.tag === 'slot') {
  11225. return true;
  11226. }
  11227. return el.children.some(containsSlotChild);
  11228. }
  11229. return false;
  11230. }
  11231. function genScopedSlot(el, state) {
  11232. var isLegacySyntax = el.attrsMap['slot-scope'];
  11233. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  11234. return genIf(el, state, genScopedSlot, "null");
  11235. }
  11236. if (el.for && !el.forProcessed) {
  11237. return genFor(el, state, genScopedSlot);
  11238. }
  11239. var slotScope = el.slotScope === emptySlotScopeToken ? "" : String(el.slotScope);
  11240. var fn = "function(".concat(slotScope, "){") +
  11241. "return ".concat(el.tag === 'template'
  11242. ? el.if && isLegacySyntax
  11243. ? "(".concat(el.if, ")?").concat(genChildren(el, state) || 'undefined', ":undefined")
  11244. : genChildren(el, state) || 'undefined'
  11245. : genElement(el, state), "}");
  11246. // reverse proxy v-slot without scope on this.$slots
  11247. var reverseProxy = slotScope ? "" : ",proxy:true";
  11248. return "{key:".concat(el.slotTarget || "\"default\"", ",fn:").concat(fn).concat(reverseProxy, "}");
  11249. }
  11250. function genChildren(el, state, checkSkip, altGenElement, altGenNode) {
  11251. var children = el.children;
  11252. if (children.length) {
  11253. var el_1 = children[0];
  11254. // optimize single v-for
  11255. if (children.length === 1 &&
  11256. el_1.for &&
  11257. el_1.tag !== 'template' &&
  11258. el_1.tag !== 'slot') {
  11259. var normalizationType_1 = checkSkip
  11260. ? state.maybeComponent(el_1)
  11261. ? ",1"
  11262. : ",0"
  11263. : "";
  11264. return "".concat((altGenElement || genElement)(el_1, state)).concat(normalizationType_1);
  11265. }
  11266. var normalizationType = checkSkip
  11267. ? getNormalizationType(children, state.maybeComponent)
  11268. : 0;
  11269. var gen_1 = altGenNode || genNode;
  11270. return "[".concat(children.map(function (c) { return gen_1(c, state); }).join(','), "]").concat(normalizationType ? ",".concat(normalizationType) : '');
  11271. }
  11272. }
  11273. // determine the normalization needed for the children array.
  11274. // 0: no normalization needed
  11275. // 1: simple normalization needed (possible 1-level deep nested array)
  11276. // 2: full normalization needed
  11277. function getNormalizationType(children, maybeComponent) {
  11278. var res = 0;
  11279. for (var i = 0; i < children.length; i++) {
  11280. var el = children[i];
  11281. if (el.type !== 1) {
  11282. continue;
  11283. }
  11284. if (needsNormalization(el) ||
  11285. (el.ifConditions &&
  11286. el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  11287. res = 2;
  11288. break;
  11289. }
  11290. if (maybeComponent(el) ||
  11291. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  11292. res = 1;
  11293. }
  11294. }
  11295. return res;
  11296. }
  11297. function needsNormalization(el) {
  11298. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot';
  11299. }
  11300. function genNode(node, state) {
  11301. if (node.type === 1) {
  11302. return genElement(node, state);
  11303. }
  11304. else if (node.type === 3 && node.isComment) {
  11305. return genComment(node);
  11306. }
  11307. else {
  11308. return genText(node);
  11309. }
  11310. }
  11311. function genText(text) {
  11312. return "_v(".concat(text.type === 2
  11313. ? text.expression // no need for () because already wrapped in _s()
  11314. : transformSpecialNewlines(JSON.stringify(text.text)), ")");
  11315. }
  11316. function genComment(comment) {
  11317. return "_e(".concat(JSON.stringify(comment.text), ")");
  11318. }
  11319. function genSlot(el, state) {
  11320. var slotName = el.slotName || '"default"';
  11321. var children = genChildren(el, state);
  11322. var res = "_t(".concat(slotName).concat(children ? ",function(){return ".concat(children, "}") : '');
  11323. var attrs = el.attrs || el.dynamicAttrs
  11324. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  11325. // slot props are camelized
  11326. name: camelize(attr.name),
  11327. value: attr.value,
  11328. dynamic: attr.dynamic
  11329. }); }))
  11330. : null;
  11331. var bind = el.attrsMap['v-bind'];
  11332. if ((attrs || bind) && !children) {
  11333. res += ",null";
  11334. }
  11335. if (attrs) {
  11336. res += ",".concat(attrs);
  11337. }
  11338. if (bind) {
  11339. res += "".concat(attrs ? '' : ',null', ",").concat(bind);
  11340. }
  11341. return res + ')';
  11342. }
  11343. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  11344. function genComponent(componentName, el, state) {
  11345. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  11346. return "_c(".concat(componentName, ",").concat(genData(el, state)).concat(children ? ",".concat(children) : '', ")");
  11347. }
  11348. function genProps(props) {
  11349. var staticProps = "";
  11350. var dynamicProps = "";
  11351. for (var i = 0; i < props.length; i++) {
  11352. var prop = props[i];
  11353. var value = transformSpecialNewlines(prop.value);
  11354. if (prop.dynamic) {
  11355. dynamicProps += "".concat(prop.name, ",").concat(value, ",");
  11356. }
  11357. else {
  11358. staticProps += "\"".concat(prop.name, "\":").concat(value, ",");
  11359. }
  11360. }
  11361. staticProps = "{".concat(staticProps.slice(0, -1), "}");
  11362. if (dynamicProps) {
  11363. return "_d(".concat(staticProps, ",[").concat(dynamicProps.slice(0, -1), "])");
  11364. }
  11365. else {
  11366. return staticProps;
  11367. }
  11368. }
  11369. // #3895, #4268
  11370. function transformSpecialNewlines(text) {
  11371. return text.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
  11372. }
  11373. // these keywords should not appear inside expressions, but operators like
  11374. // typeof, instanceof and in are allowed
  11375. var prohibitedKeywordRE = new RegExp('\\b' +
  11376. ('do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  11377. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  11378. 'extends,finally,continue,debugger,function,arguments')
  11379. .split(',')
  11380. .join('\\b|\\b') +
  11381. '\\b');
  11382. // these unary operators should not be used as property/method names
  11383. var unaryOperatorsRE = new RegExp('\\b' +
  11384. 'delete,typeof,void'.split(',').join('\\s*\\([^\\)]*\\)|\\b') +
  11385. '\\s*\\([^\\)]*\\)');
  11386. // strip strings in expressions
  11387. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  11388. // detect problematic expressions in a template
  11389. function detectErrors(ast, warn) {
  11390. if (ast) {
  11391. checkNode(ast, warn);
  11392. }
  11393. }
  11394. function checkNode(node, warn) {
  11395. if (node.type === 1) {
  11396. for (var name_1 in node.attrsMap) {
  11397. if (dirRE.test(name_1)) {
  11398. var value = node.attrsMap[name_1];
  11399. if (value) {
  11400. var range = node.rawAttrsMap[name_1];
  11401. if (name_1 === 'v-for') {
  11402. checkFor(node, "v-for=\"".concat(value, "\""), warn, range);
  11403. }
  11404. else if (name_1 === 'v-slot' || name_1[0] === '#') {
  11405. checkFunctionParameterExpression(value, "".concat(name_1, "=\"").concat(value, "\""), warn, range);
  11406. }
  11407. else if (onRE.test(name_1)) {
  11408. checkEvent(value, "".concat(name_1, "=\"").concat(value, "\""), warn, range);
  11409. }
  11410. else {
  11411. checkExpression(value, "".concat(name_1, "=\"").concat(value, "\""), warn, range);
  11412. }
  11413. }
  11414. }
  11415. }
  11416. if (node.children) {
  11417. for (var i = 0; i < node.children.length; i++) {
  11418. checkNode(node.children[i], warn);
  11419. }
  11420. }
  11421. }
  11422. else if (node.type === 2) {
  11423. checkExpression(node.expression, node.text, warn, node);
  11424. }
  11425. }
  11426. function checkEvent(exp, text, warn, range) {
  11427. var stripped = exp.replace(stripStringRE, '');
  11428. var keywordMatch = stripped.match(unaryOperatorsRE);
  11429. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  11430. warn("avoid using JavaScript unary operator as property name: " +
  11431. "\"".concat(keywordMatch[0], "\" in expression ").concat(text.trim()), range);
  11432. }
  11433. checkExpression(exp, text, warn, range);
  11434. }
  11435. function checkFor(node, text, warn, range) {
  11436. checkExpression(node.for || '', text, warn, range);
  11437. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  11438. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  11439. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  11440. }
  11441. function checkIdentifier(ident, type, text, warn, range) {
  11442. if (typeof ident === 'string') {
  11443. try {
  11444. new Function("var ".concat(ident, "=_"));
  11445. }
  11446. catch (e) {
  11447. warn("invalid ".concat(type, " \"").concat(ident, "\" in expression: ").concat(text.trim()), range);
  11448. }
  11449. }
  11450. }
  11451. function checkExpression(exp, text, warn, range) {
  11452. try {
  11453. new Function("return ".concat(exp));
  11454. }
  11455. catch (e) {
  11456. var keywordMatch = exp
  11457. .replace(stripStringRE, '')
  11458. .match(prohibitedKeywordRE);
  11459. if (keywordMatch) {
  11460. warn("avoid using JavaScript keyword as property name: " +
  11461. "\"".concat(keywordMatch[0], "\"\n Raw expression: ").concat(text.trim()), range);
  11462. }
  11463. else {
  11464. warn("invalid expression: ".concat(e.message, " in\n\n") +
  11465. " ".concat(exp, "\n\n") +
  11466. " Raw expression: ".concat(text.trim(), "\n"), range);
  11467. }
  11468. }
  11469. }
  11470. function checkFunctionParameterExpression(exp, text, warn, range) {
  11471. try {
  11472. new Function(exp, '');
  11473. }
  11474. catch (e) {
  11475. warn("invalid function parameter expression: ".concat(e.message, " in\n\n") +
  11476. " ".concat(exp, "\n\n") +
  11477. " Raw expression: ".concat(text.trim(), "\n"), range);
  11478. }
  11479. }
  11480. var range = 2;
  11481. function generateCodeFrame(source, start, end) {
  11482. if (start === void 0) { start = 0; }
  11483. if (end === void 0) { end = source.length; }
  11484. var lines = source.split(/\r?\n/);
  11485. var count = 0;
  11486. var res = [];
  11487. for (var i = 0; i < lines.length; i++) {
  11488. count += lines[i].length + 1;
  11489. if (count >= start) {
  11490. for (var j = i - range; j <= i + range || end > count; j++) {
  11491. if (j < 0 || j >= lines.length)
  11492. continue;
  11493. res.push("".concat(j + 1).concat(repeat(" ", 3 - String(j + 1).length), "| ").concat(lines[j]));
  11494. var lineLength = lines[j].length;
  11495. if (j === i) {
  11496. // push underline
  11497. var pad = start - (count - lineLength) + 1;
  11498. var length_1 = end > count ? lineLength - pad : end - start;
  11499. res.push(" | " + repeat(" ", pad) + repeat("^", length_1));
  11500. }
  11501. else if (j > i) {
  11502. if (end > count) {
  11503. var length_2 = Math.min(end - count, lineLength);
  11504. res.push(" | " + repeat("^", length_2));
  11505. }
  11506. count += lineLength + 1;
  11507. }
  11508. }
  11509. break;
  11510. }
  11511. }
  11512. return res.join('\n');
  11513. }
  11514. function repeat(str, n) {
  11515. var result = '';
  11516. if (n > 0) {
  11517. // eslint-disable-next-line no-constant-condition
  11518. while (true) {
  11519. // eslint-disable-line
  11520. if (n & 1)
  11521. result += str;
  11522. n >>>= 1;
  11523. if (n <= 0)
  11524. break;
  11525. str += str;
  11526. }
  11527. }
  11528. return result;
  11529. }
  11530. function createFunction(code, errors) {
  11531. try {
  11532. return new Function(code);
  11533. }
  11534. catch (err) {
  11535. errors.push({ err: err, code: code });
  11536. return noop;
  11537. }
  11538. }
  11539. function createCompileToFunctionFn(compile) {
  11540. var cache = Object.create(null);
  11541. return function compileToFunctions(template, options, vm) {
  11542. options = extend({}, options);
  11543. var warn = options.warn || warn$2;
  11544. delete options.warn;
  11545. /* istanbul ignore if */
  11546. if (process.env.NODE_ENV !== 'production') {
  11547. // detect possible CSP restriction
  11548. try {
  11549. new Function('return 1');
  11550. }
  11551. catch (e) {
  11552. if (e.toString().match(/unsafe-eval|CSP/)) {
  11553. warn('It seems you are using the standalone build of Vue.js in an ' +
  11554. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  11555. 'The template compiler cannot work in this environment. Consider ' +
  11556. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  11557. 'templates into render functions.');
  11558. }
  11559. }
  11560. }
  11561. // check cache
  11562. var key = options.delimiters
  11563. ? String(options.delimiters) + template
  11564. : template;
  11565. if (cache[key]) {
  11566. return cache[key];
  11567. }
  11568. // compile
  11569. var compiled = compile(template, options);
  11570. // check compilation errors/tips
  11571. if (process.env.NODE_ENV !== 'production') {
  11572. if (compiled.errors && compiled.errors.length) {
  11573. if (options.outputSourceRange) {
  11574. compiled.errors.forEach(function (e) {
  11575. warn("Error compiling template:\n\n".concat(e.msg, "\n\n") +
  11576. generateCodeFrame(template, e.start, e.end), vm);
  11577. });
  11578. }
  11579. else {
  11580. warn("Error compiling template:\n\n".concat(template, "\n\n") +
  11581. compiled.errors.map(function (e) { return "- ".concat(e); }).join('\n') +
  11582. '\n', vm);
  11583. }
  11584. }
  11585. if (compiled.tips && compiled.tips.length) {
  11586. if (options.outputSourceRange) {
  11587. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  11588. }
  11589. else {
  11590. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  11591. }
  11592. }
  11593. }
  11594. // turn code into functions
  11595. var res = {};
  11596. var fnGenErrors = [];
  11597. res.render = createFunction(compiled.render, fnGenErrors);
  11598. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  11599. return createFunction(code, fnGenErrors);
  11600. });
  11601. // check function generation errors.
  11602. // this should only happen if there is a bug in the compiler itself.
  11603. // mostly for codegen development use
  11604. /* istanbul ignore if */
  11605. if (process.env.NODE_ENV !== 'production') {
  11606. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  11607. warn("Failed to generate render function:\n\n" +
  11608. fnGenErrors
  11609. .map(function (_a) {
  11610. var err = _a.err, code = _a.code;
  11611. return "".concat(err.toString(), " in\n\n").concat(code, "\n");
  11612. })
  11613. .join('\n'), vm);
  11614. }
  11615. }
  11616. return (cache[key] = res);
  11617. };
  11618. }
  11619. function createCompilerCreator(baseCompile) {
  11620. return function createCompiler(baseOptions) {
  11621. function compile(template, options) {
  11622. var finalOptions = Object.create(baseOptions);
  11623. var errors = [];
  11624. var tips = [];
  11625. var warn = function (msg, range, tip) {
  11626. (tip ? tips : errors).push(msg);
  11627. };
  11628. if (options) {
  11629. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  11630. // $flow-disable-line
  11631. var leadingSpaceLength_1 = template.match(/^\s*/)[0].length;
  11632. warn = function (msg, range, tip) {
  11633. var data = typeof msg === 'string' ? { msg: msg } : msg;
  11634. if (range) {
  11635. if (range.start != null) {
  11636. data.start = range.start + leadingSpaceLength_1;
  11637. }
  11638. if (range.end != null) {
  11639. data.end = range.end + leadingSpaceLength_1;
  11640. }
  11641. }
  11642. (tip ? tips : errors).push(data);
  11643. };
  11644. }
  11645. // merge custom modules
  11646. if (options.modules) {
  11647. finalOptions.modules = (baseOptions.modules || []).concat(options.modules);
  11648. }
  11649. // merge custom directives
  11650. if (options.directives) {
  11651. finalOptions.directives = extend(Object.create(baseOptions.directives || null), options.directives);
  11652. }
  11653. // copy other options
  11654. for (var key in options) {
  11655. if (key !== 'modules' && key !== 'directives') {
  11656. finalOptions[key] = options[key];
  11657. }
  11658. }
  11659. }
  11660. finalOptions.warn = warn;
  11661. var compiled = baseCompile(template.trim(), finalOptions);
  11662. if (process.env.NODE_ENV !== 'production') {
  11663. detectErrors(compiled.ast, warn);
  11664. }
  11665. compiled.errors = errors;
  11666. compiled.tips = tips;
  11667. return compiled;
  11668. }
  11669. return {
  11670. compile: compile,
  11671. compileToFunctions: createCompileToFunctionFn(compile)
  11672. };
  11673. };
  11674. }
  11675. // `createCompilerCreator` allows creating compilers that use alternative
  11676. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  11677. // Here we just export a default compiler using the default parts.
  11678. var createCompiler = createCompilerCreator(function baseCompile(template, options) {
  11679. var ast = parse(template.trim(), options);
  11680. if (options.optimize !== false) {
  11681. optimize(ast, options);
  11682. }
  11683. var code = generate(ast, options);
  11684. return {
  11685. ast: ast,
  11686. render: code.render,
  11687. staticRenderFns: code.staticRenderFns
  11688. };
  11689. });
  11690. var _a = createCompiler(baseOptions), compileToFunctions = _a.compileToFunctions;
  11691. // check whether current browser encodes a char inside attribute values
  11692. var div;
  11693. function getShouldDecode(href) {
  11694. div = div || document.createElement('div');
  11695. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  11696. return div.innerHTML.indexOf('&#10;') > 0;
  11697. }
  11698. // #3663: IE encodes newlines inside attribute values while other browsers don't
  11699. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  11700. // #6828: chrome encodes content in a[href]
  11701. var shouldDecodeNewlinesForHref = inBrowser
  11702. ? getShouldDecode(true)
  11703. : false;
  11704. var idToTemplate = cached(function (id) {
  11705. var el = query(id);
  11706. return el && el.innerHTML;
  11707. });
  11708. var mount = Vue.prototype.$mount;
  11709. Vue.prototype.$mount = function (el, hydrating) {
  11710. el = el && query(el);
  11711. /* istanbul ignore if */
  11712. if (el === document.body || el === document.documentElement) {
  11713. process.env.NODE_ENV !== 'production' &&
  11714. warn$2("Do not mount Vue to <html> or <body> - mount to normal elements instead.");
  11715. return this;
  11716. }
  11717. var options = this.$options;
  11718. // resolve template/el and convert to render function
  11719. if (!options.render) {
  11720. var template = options.template;
  11721. if (template) {
  11722. if (typeof template === 'string') {
  11723. if (template.charAt(0) === '#') {
  11724. template = idToTemplate(template);
  11725. /* istanbul ignore if */
  11726. if (process.env.NODE_ENV !== 'production' && !template) {
  11727. warn$2("Template element not found or is empty: ".concat(options.template), this);
  11728. }
  11729. }
  11730. }
  11731. else if (template.nodeType) {
  11732. template = template.innerHTML;
  11733. }
  11734. else {
  11735. if (process.env.NODE_ENV !== 'production') {
  11736. warn$2('invalid template option:' + template, this);
  11737. }
  11738. return this;
  11739. }
  11740. }
  11741. else if (el) {
  11742. // @ts-expect-error
  11743. template = getOuterHTML(el);
  11744. }
  11745. if (template) {
  11746. /* istanbul ignore if */
  11747. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  11748. mark('compile');
  11749. }
  11750. var _a = compileToFunctions(template, {
  11751. outputSourceRange: process.env.NODE_ENV !== 'production',
  11752. shouldDecodeNewlines: shouldDecodeNewlines,
  11753. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  11754. delimiters: options.delimiters,
  11755. comments: options.comments
  11756. }, this), render = _a.render, staticRenderFns = _a.staticRenderFns;
  11757. options.render = render;
  11758. options.staticRenderFns = staticRenderFns;
  11759. /* istanbul ignore if */
  11760. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  11761. mark('compile end');
  11762. measure("vue ".concat(this._name, " compile"), 'compile', 'compile end');
  11763. }
  11764. }
  11765. }
  11766. return mount.call(this, el, hydrating);
  11767. };
  11768. /**
  11769. * Get outerHTML of elements, taking care
  11770. * of SVG elements in IE as well.
  11771. */
  11772. function getOuterHTML(el) {
  11773. if (el.outerHTML) {
  11774. return el.outerHTML;
  11775. }
  11776. else {
  11777. var container = document.createElement('div');
  11778. container.appendChild(el.cloneNode(true));
  11779. return container.innerHTML;
  11780. }
  11781. }
  11782. Vue.compile = compileToFunctions;
  11783. export { EffectScope, computed, customRef, Vue as default, defineAsyncComponent, defineComponent, del, effectScope, getCurrentInstance, getCurrentScope, h, inject, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, mergeDefaults, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, provide, proxyRefs, reactive, readonly, ref$1 as ref, set, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useListeners, useSlots, version, watch, watchEffect, watchPostEffect, watchSyncEffect };