runtime-core.cjs.prod.js 177 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var reactivity = require('@vue/reactivity');
  4. var shared = require('@vue/shared');
  5. function warn$1(msg, ...args) {
  6. return;
  7. }
  8. function assertNumber(val, type) {
  9. return;
  10. }
  11. function callWithErrorHandling(fn, instance, type, args) {
  12. let res;
  13. try {
  14. res = args ? fn(...args) : fn();
  15. } catch (err) {
  16. handleError(err, instance, type);
  17. }
  18. return res;
  19. }
  20. function callWithAsyncErrorHandling(fn, instance, type, args) {
  21. if (shared.isFunction(fn)) {
  22. const res = callWithErrorHandling(fn, instance, type, args);
  23. if (res && shared.isPromise(res)) {
  24. res.catch((err) => {
  25. handleError(err, instance, type);
  26. });
  27. }
  28. return res;
  29. }
  30. const values = [];
  31. for (let i = 0; i < fn.length; i++) {
  32. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  33. }
  34. return values;
  35. }
  36. function handleError(err, instance, type, throwInDev = true) {
  37. const contextVNode = instance ? instance.vnode : null;
  38. if (instance) {
  39. let cur = instance.parent;
  40. const exposedInstance = instance.proxy;
  41. const errorInfo = type;
  42. while (cur) {
  43. const errorCapturedHooks = cur.ec;
  44. if (errorCapturedHooks) {
  45. for (let i = 0; i < errorCapturedHooks.length; i++) {
  46. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  47. return;
  48. }
  49. }
  50. }
  51. cur = cur.parent;
  52. }
  53. const appErrorHandler = instance.appContext.config.errorHandler;
  54. if (appErrorHandler) {
  55. callWithErrorHandling(
  56. appErrorHandler,
  57. null,
  58. 10,
  59. [err, exposedInstance, errorInfo]
  60. );
  61. return;
  62. }
  63. }
  64. logError(err, type, contextVNode, throwInDev);
  65. }
  66. function logError(err, type, contextVNode, throwInDev = true) {
  67. {
  68. console.error(err);
  69. }
  70. }
  71. let isFlushing = false;
  72. let isFlushPending = false;
  73. const queue = [];
  74. let flushIndex = 0;
  75. const pendingPostFlushCbs = [];
  76. let activePostFlushCbs = null;
  77. let postFlushIndex = 0;
  78. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  79. let currentFlushPromise = null;
  80. function nextTick(fn) {
  81. const p = currentFlushPromise || resolvedPromise;
  82. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  83. }
  84. function findInsertionIndex(id) {
  85. let start = flushIndex + 1;
  86. let end = queue.length;
  87. while (start < end) {
  88. const middle = start + end >>> 1;
  89. const middleJob = queue[middle];
  90. const middleJobId = getId(middleJob);
  91. if (middleJobId < id || middleJobId === id && middleJob.pre) {
  92. start = middle + 1;
  93. } else {
  94. end = middle;
  95. }
  96. }
  97. return start;
  98. }
  99. function queueJob(job) {
  100. if (!queue.length || !queue.includes(
  101. job,
  102. isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
  103. )) {
  104. if (job.id == null) {
  105. queue.push(job);
  106. } else {
  107. queue.splice(findInsertionIndex(job.id), 0, job);
  108. }
  109. queueFlush();
  110. }
  111. }
  112. function queueFlush() {
  113. if (!isFlushing && !isFlushPending) {
  114. isFlushPending = true;
  115. currentFlushPromise = resolvedPromise.then(flushJobs);
  116. }
  117. }
  118. function invalidateJob(job) {
  119. const i = queue.indexOf(job);
  120. if (i > flushIndex) {
  121. queue.splice(i, 1);
  122. }
  123. }
  124. function queuePostFlushCb(cb) {
  125. if (!shared.isArray(cb)) {
  126. if (!activePostFlushCbs || !activePostFlushCbs.includes(
  127. cb,
  128. cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
  129. )) {
  130. pendingPostFlushCbs.push(cb);
  131. }
  132. } else {
  133. pendingPostFlushCbs.push(...cb);
  134. }
  135. queueFlush();
  136. }
  137. function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
  138. for (; i < queue.length; i++) {
  139. const cb = queue[i];
  140. if (cb && cb.pre) {
  141. if (instance && cb.id !== instance.uid) {
  142. continue;
  143. }
  144. queue.splice(i, 1);
  145. i--;
  146. cb();
  147. }
  148. }
  149. }
  150. function flushPostFlushCbs(seen) {
  151. if (pendingPostFlushCbs.length) {
  152. const deduped = [...new Set(pendingPostFlushCbs)];
  153. pendingPostFlushCbs.length = 0;
  154. if (activePostFlushCbs) {
  155. activePostFlushCbs.push(...deduped);
  156. return;
  157. }
  158. activePostFlushCbs = deduped;
  159. activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
  160. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  161. activePostFlushCbs[postFlushIndex]();
  162. }
  163. activePostFlushCbs = null;
  164. postFlushIndex = 0;
  165. }
  166. }
  167. const getId = (job) => job.id == null ? Infinity : job.id;
  168. const comparator = (a, b) => {
  169. const diff = getId(a) - getId(b);
  170. if (diff === 0) {
  171. if (a.pre && !b.pre)
  172. return -1;
  173. if (b.pre && !a.pre)
  174. return 1;
  175. }
  176. return diff;
  177. };
  178. function flushJobs(seen) {
  179. isFlushPending = false;
  180. isFlushing = true;
  181. queue.sort(comparator);
  182. try {
  183. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  184. const job = queue[flushIndex];
  185. if (job && job.active !== false) {
  186. if (false) ;
  187. callWithErrorHandling(job, null, 14);
  188. }
  189. }
  190. } finally {
  191. flushIndex = 0;
  192. queue.length = 0;
  193. flushPostFlushCbs();
  194. isFlushing = false;
  195. currentFlushPromise = null;
  196. if (queue.length || pendingPostFlushCbs.length) {
  197. flushJobs();
  198. }
  199. }
  200. }
  201. exports.devtools = void 0;
  202. let buffer = [];
  203. function setDevtoolsHook(hook, target) {
  204. var _a, _b;
  205. exports.devtools = hook;
  206. if (exports.devtools) {
  207. exports.devtools.enabled = true;
  208. buffer.forEach(({ event, args }) => exports.devtools.emit(event, ...args));
  209. buffer = [];
  210. } else if (
  211. // handle late devtools injection - only do this if we are in an actual
  212. // browser environment to avoid the timer handle stalling test runner exit
  213. // (#4815)
  214. typeof window !== "undefined" && // some envs mock window but not fully
  215. window.HTMLElement && // also exclude jsdom
  216. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  217. ) {
  218. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  219. replay.push((newHook) => {
  220. setDevtoolsHook(newHook, target);
  221. });
  222. setTimeout(() => {
  223. if (!exports.devtools) {
  224. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  225. buffer = [];
  226. }
  227. }, 3e3);
  228. } else {
  229. buffer = [];
  230. }
  231. }
  232. function emit(instance, event, ...rawArgs) {
  233. if (instance.isUnmounted)
  234. return;
  235. const props = instance.vnode.props || shared.EMPTY_OBJ;
  236. let args = rawArgs;
  237. const isModelListener = event.startsWith("update:");
  238. const modelArg = isModelListener && event.slice(7);
  239. if (modelArg && modelArg in props) {
  240. const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
  241. const { number, trim } = props[modifiersKey] || shared.EMPTY_OBJ;
  242. if (trim) {
  243. args = rawArgs.map((a) => shared.isString(a) ? a.trim() : a);
  244. }
  245. if (number) {
  246. args = rawArgs.map(shared.looseToNumber);
  247. }
  248. }
  249. let handlerName;
  250. let handler = props[handlerName = shared.toHandlerKey(event)] || // also try camelCase event handler (#2249)
  251. props[handlerName = shared.toHandlerKey(shared.camelize(event))];
  252. if (!handler && isModelListener) {
  253. handler = props[handlerName = shared.toHandlerKey(shared.hyphenate(event))];
  254. }
  255. if (handler) {
  256. callWithAsyncErrorHandling(
  257. handler,
  258. instance,
  259. 6,
  260. args
  261. );
  262. }
  263. const onceHandler = props[handlerName + `Once`];
  264. if (onceHandler) {
  265. if (!instance.emitted) {
  266. instance.emitted = {};
  267. } else if (instance.emitted[handlerName]) {
  268. return;
  269. }
  270. instance.emitted[handlerName] = true;
  271. callWithAsyncErrorHandling(
  272. onceHandler,
  273. instance,
  274. 6,
  275. args
  276. );
  277. }
  278. }
  279. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  280. const cache = appContext.emitsCache;
  281. const cached = cache.get(comp);
  282. if (cached !== void 0) {
  283. return cached;
  284. }
  285. const raw = comp.emits;
  286. let normalized = {};
  287. let hasExtends = false;
  288. if (!shared.isFunction(comp)) {
  289. const extendEmits = (raw2) => {
  290. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  291. if (normalizedFromExtend) {
  292. hasExtends = true;
  293. shared.extend(normalized, normalizedFromExtend);
  294. }
  295. };
  296. if (!asMixin && appContext.mixins.length) {
  297. appContext.mixins.forEach(extendEmits);
  298. }
  299. if (comp.extends) {
  300. extendEmits(comp.extends);
  301. }
  302. if (comp.mixins) {
  303. comp.mixins.forEach(extendEmits);
  304. }
  305. }
  306. if (!raw && !hasExtends) {
  307. if (shared.isObject(comp)) {
  308. cache.set(comp, null);
  309. }
  310. return null;
  311. }
  312. if (shared.isArray(raw)) {
  313. raw.forEach((key) => normalized[key] = null);
  314. } else {
  315. shared.extend(normalized, raw);
  316. }
  317. if (shared.isObject(comp)) {
  318. cache.set(comp, normalized);
  319. }
  320. return normalized;
  321. }
  322. function isEmitListener(options, key) {
  323. if (!options || !shared.isOn(key)) {
  324. return false;
  325. }
  326. key = key.slice(2).replace(/Once$/, "");
  327. return shared.hasOwn(options, key[0].toLowerCase() + key.slice(1)) || shared.hasOwn(options, shared.hyphenate(key)) || shared.hasOwn(options, key);
  328. }
  329. let currentRenderingInstance = null;
  330. let currentScopeId = null;
  331. function setCurrentRenderingInstance(instance) {
  332. const prev = currentRenderingInstance;
  333. currentRenderingInstance = instance;
  334. currentScopeId = instance && instance.type.__scopeId || null;
  335. return prev;
  336. }
  337. function pushScopeId(id) {
  338. currentScopeId = id;
  339. }
  340. function popScopeId() {
  341. currentScopeId = null;
  342. }
  343. const withScopeId = (_id) => withCtx;
  344. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  345. if (!ctx)
  346. return fn;
  347. if (fn._n) {
  348. return fn;
  349. }
  350. const renderFnWithContext = (...args) => {
  351. if (renderFnWithContext._d) {
  352. setBlockTracking(-1);
  353. }
  354. const prevInstance = setCurrentRenderingInstance(ctx);
  355. let res;
  356. try {
  357. res = fn(...args);
  358. } finally {
  359. setCurrentRenderingInstance(prevInstance);
  360. if (renderFnWithContext._d) {
  361. setBlockTracking(1);
  362. }
  363. }
  364. return res;
  365. };
  366. renderFnWithContext._n = true;
  367. renderFnWithContext._c = true;
  368. renderFnWithContext._d = true;
  369. return renderFnWithContext;
  370. }
  371. function markAttrsAccessed() {
  372. }
  373. function renderComponentRoot(instance) {
  374. const {
  375. type: Component,
  376. vnode,
  377. proxy,
  378. withProxy,
  379. props,
  380. propsOptions: [propsOptions],
  381. slots,
  382. attrs,
  383. emit,
  384. render,
  385. renderCache,
  386. data,
  387. setupState,
  388. ctx,
  389. inheritAttrs
  390. } = instance;
  391. let result;
  392. let fallthroughAttrs;
  393. const prev = setCurrentRenderingInstance(instance);
  394. try {
  395. if (vnode.shapeFlag & 4) {
  396. const proxyToUse = withProxy || proxy;
  397. const thisProxy = false ? new Proxy(proxyToUse, {
  398. get(target, key, receiver) {
  399. warn(
  400. `Property '${String(
  401. key
  402. )}' was accessed via 'this'. Avoid using 'this' in templates.`
  403. );
  404. return Reflect.get(target, key, receiver);
  405. }
  406. }) : proxyToUse;
  407. result = normalizeVNode(
  408. render.call(
  409. thisProxy,
  410. proxyToUse,
  411. renderCache,
  412. props,
  413. setupState,
  414. data,
  415. ctx
  416. )
  417. );
  418. fallthroughAttrs = attrs;
  419. } else {
  420. const render2 = Component;
  421. if (false) ;
  422. result = normalizeVNode(
  423. render2.length > 1 ? render2(
  424. props,
  425. false ? {
  426. get attrs() {
  427. markAttrsAccessed();
  428. return attrs;
  429. },
  430. slots,
  431. emit
  432. } : { attrs, slots, emit }
  433. ) : render2(
  434. props,
  435. null
  436. /* we know it doesn't need it */
  437. )
  438. );
  439. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  440. }
  441. } catch (err) {
  442. blockStack.length = 0;
  443. handleError(err, instance, 1);
  444. result = createVNode(Comment);
  445. }
  446. let root = result;
  447. if (fallthroughAttrs && inheritAttrs !== false) {
  448. const keys = Object.keys(fallthroughAttrs);
  449. const { shapeFlag } = root;
  450. if (keys.length) {
  451. if (shapeFlag & (1 | 6)) {
  452. if (propsOptions && keys.some(shared.isModelListener)) {
  453. fallthroughAttrs = filterModelListeners(
  454. fallthroughAttrs,
  455. propsOptions
  456. );
  457. }
  458. root = cloneVNode(root, fallthroughAttrs);
  459. }
  460. }
  461. }
  462. if (vnode.dirs) {
  463. root = cloneVNode(root);
  464. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  465. }
  466. if (vnode.transition) {
  467. root.transition = vnode.transition;
  468. }
  469. {
  470. result = root;
  471. }
  472. setCurrentRenderingInstance(prev);
  473. return result;
  474. }
  475. function filterSingleRoot(children) {
  476. let singleRoot;
  477. for (let i = 0; i < children.length; i++) {
  478. const child = children[i];
  479. if (isVNode(child)) {
  480. if (child.type !== Comment || child.children === "v-if") {
  481. if (singleRoot) {
  482. return;
  483. } else {
  484. singleRoot = child;
  485. }
  486. }
  487. } else {
  488. return;
  489. }
  490. }
  491. return singleRoot;
  492. }
  493. const getFunctionalFallthrough = (attrs) => {
  494. let res;
  495. for (const key in attrs) {
  496. if (key === "class" || key === "style" || shared.isOn(key)) {
  497. (res || (res = {}))[key] = attrs[key];
  498. }
  499. }
  500. return res;
  501. };
  502. const filterModelListeners = (attrs, props) => {
  503. const res = {};
  504. for (const key in attrs) {
  505. if (!shared.isModelListener(key) || !(key.slice(9) in props)) {
  506. res[key] = attrs[key];
  507. }
  508. }
  509. return res;
  510. };
  511. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  512. const { props: prevProps, children: prevChildren, component } = prevVNode;
  513. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  514. const emits = component.emitsOptions;
  515. if (nextVNode.dirs || nextVNode.transition) {
  516. return true;
  517. }
  518. if (optimized && patchFlag >= 0) {
  519. if (patchFlag & 1024) {
  520. return true;
  521. }
  522. if (patchFlag & 16) {
  523. if (!prevProps) {
  524. return !!nextProps;
  525. }
  526. return hasPropsChanged(prevProps, nextProps, emits);
  527. } else if (patchFlag & 8) {
  528. const dynamicProps = nextVNode.dynamicProps;
  529. for (let i = 0; i < dynamicProps.length; i++) {
  530. const key = dynamicProps[i];
  531. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  532. return true;
  533. }
  534. }
  535. }
  536. } else {
  537. if (prevChildren || nextChildren) {
  538. if (!nextChildren || !nextChildren.$stable) {
  539. return true;
  540. }
  541. }
  542. if (prevProps === nextProps) {
  543. return false;
  544. }
  545. if (!prevProps) {
  546. return !!nextProps;
  547. }
  548. if (!nextProps) {
  549. return true;
  550. }
  551. return hasPropsChanged(prevProps, nextProps, emits);
  552. }
  553. return false;
  554. }
  555. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  556. const nextKeys = Object.keys(nextProps);
  557. if (nextKeys.length !== Object.keys(prevProps).length) {
  558. return true;
  559. }
  560. for (let i = 0; i < nextKeys.length; i++) {
  561. const key = nextKeys[i];
  562. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  563. return true;
  564. }
  565. }
  566. return false;
  567. }
  568. function updateHOCHostEl({ vnode, parent }, el) {
  569. while (parent && parent.subTree === vnode) {
  570. (vnode = parent.vnode).el = el;
  571. parent = parent.parent;
  572. }
  573. }
  574. const COMPONENTS = "components";
  575. const DIRECTIVES = "directives";
  576. function resolveComponent(name, maybeSelfReference) {
  577. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  578. }
  579. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  580. function resolveDynamicComponent(component) {
  581. if (shared.isString(component)) {
  582. return resolveAsset(COMPONENTS, component, false) || component;
  583. } else {
  584. return component || NULL_DYNAMIC_COMPONENT;
  585. }
  586. }
  587. function resolveDirective(name) {
  588. return resolveAsset(DIRECTIVES, name);
  589. }
  590. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  591. const instance = currentRenderingInstance || currentInstance;
  592. if (instance) {
  593. const Component = instance.type;
  594. if (type === COMPONENTS) {
  595. const selfName = getComponentName(
  596. Component,
  597. false
  598. /* do not include inferred name to avoid breaking existing code */
  599. );
  600. if (selfName && (selfName === name || selfName === shared.camelize(name) || selfName === shared.capitalize(shared.camelize(name)))) {
  601. return Component;
  602. }
  603. }
  604. const res = (
  605. // local registration
  606. // check instance[type] first which is resolved for options API
  607. resolve(instance[type] || Component[type], name) || // global registration
  608. resolve(instance.appContext[type], name)
  609. );
  610. if (!res && maybeSelfReference) {
  611. return Component;
  612. }
  613. return res;
  614. }
  615. }
  616. function resolve(registry, name) {
  617. return registry && (registry[name] || registry[shared.camelize(name)] || registry[shared.capitalize(shared.camelize(name))]);
  618. }
  619. const isSuspense = (type) => type.__isSuspense;
  620. const SuspenseImpl = {
  621. name: "Suspense",
  622. // In order to make Suspense tree-shakable, we need to avoid importing it
  623. // directly in the renderer. The renderer checks for the __isSuspense flag
  624. // on a vnode's type and calls the `process` method, passing in renderer
  625. // internals.
  626. __isSuspense: true,
  627. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
  628. if (n1 == null) {
  629. mountSuspense(
  630. n2,
  631. container,
  632. anchor,
  633. parentComponent,
  634. parentSuspense,
  635. isSVG,
  636. slotScopeIds,
  637. optimized,
  638. rendererInternals
  639. );
  640. } else {
  641. patchSuspense(
  642. n1,
  643. n2,
  644. container,
  645. anchor,
  646. parentComponent,
  647. isSVG,
  648. slotScopeIds,
  649. optimized,
  650. rendererInternals
  651. );
  652. }
  653. },
  654. hydrate: hydrateSuspense,
  655. create: createSuspenseBoundary,
  656. normalize: normalizeSuspenseChildren
  657. };
  658. const Suspense = SuspenseImpl ;
  659. function triggerEvent(vnode, name) {
  660. const eventListener = vnode.props && vnode.props[name];
  661. if (shared.isFunction(eventListener)) {
  662. eventListener();
  663. }
  664. }
  665. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
  666. const {
  667. p: patch,
  668. o: { createElement }
  669. } = rendererInternals;
  670. const hiddenContainer = createElement("div");
  671. const suspense = vnode.suspense = createSuspenseBoundary(
  672. vnode,
  673. parentSuspense,
  674. parentComponent,
  675. container,
  676. hiddenContainer,
  677. anchor,
  678. isSVG,
  679. slotScopeIds,
  680. optimized,
  681. rendererInternals
  682. );
  683. patch(
  684. null,
  685. suspense.pendingBranch = vnode.ssContent,
  686. hiddenContainer,
  687. null,
  688. parentComponent,
  689. suspense,
  690. isSVG,
  691. slotScopeIds
  692. );
  693. if (suspense.deps > 0) {
  694. triggerEvent(vnode, "onPending");
  695. triggerEvent(vnode, "onFallback");
  696. patch(
  697. null,
  698. vnode.ssFallback,
  699. container,
  700. anchor,
  701. parentComponent,
  702. null,
  703. // fallback tree will not have suspense context
  704. isSVG,
  705. slotScopeIds
  706. );
  707. setActiveBranch(suspense, vnode.ssFallback);
  708. } else {
  709. suspense.resolve(false, true);
  710. }
  711. }
  712. function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  713. const suspense = n2.suspense = n1.suspense;
  714. suspense.vnode = n2;
  715. n2.el = n1.el;
  716. const newBranch = n2.ssContent;
  717. const newFallback = n2.ssFallback;
  718. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  719. if (pendingBranch) {
  720. suspense.pendingBranch = newBranch;
  721. if (isSameVNodeType(newBranch, pendingBranch)) {
  722. patch(
  723. pendingBranch,
  724. newBranch,
  725. suspense.hiddenContainer,
  726. null,
  727. parentComponent,
  728. suspense,
  729. isSVG,
  730. slotScopeIds,
  731. optimized
  732. );
  733. if (suspense.deps <= 0) {
  734. suspense.resolve();
  735. } else if (isInFallback) {
  736. patch(
  737. activeBranch,
  738. newFallback,
  739. container,
  740. anchor,
  741. parentComponent,
  742. null,
  743. // fallback tree will not have suspense context
  744. isSVG,
  745. slotScopeIds,
  746. optimized
  747. );
  748. setActiveBranch(suspense, newFallback);
  749. }
  750. } else {
  751. suspense.pendingId++;
  752. if (isHydrating) {
  753. suspense.isHydrating = false;
  754. suspense.activeBranch = pendingBranch;
  755. } else {
  756. unmount(pendingBranch, parentComponent, suspense);
  757. }
  758. suspense.deps = 0;
  759. suspense.effects.length = 0;
  760. suspense.hiddenContainer = createElement("div");
  761. if (isInFallback) {
  762. patch(
  763. null,
  764. newBranch,
  765. suspense.hiddenContainer,
  766. null,
  767. parentComponent,
  768. suspense,
  769. isSVG,
  770. slotScopeIds,
  771. optimized
  772. );
  773. if (suspense.deps <= 0) {
  774. suspense.resolve();
  775. } else {
  776. patch(
  777. activeBranch,
  778. newFallback,
  779. container,
  780. anchor,
  781. parentComponent,
  782. null,
  783. // fallback tree will not have suspense context
  784. isSVG,
  785. slotScopeIds,
  786. optimized
  787. );
  788. setActiveBranch(suspense, newFallback);
  789. }
  790. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  791. patch(
  792. activeBranch,
  793. newBranch,
  794. container,
  795. anchor,
  796. parentComponent,
  797. suspense,
  798. isSVG,
  799. slotScopeIds,
  800. optimized
  801. );
  802. suspense.resolve(true);
  803. } else {
  804. patch(
  805. null,
  806. newBranch,
  807. suspense.hiddenContainer,
  808. null,
  809. parentComponent,
  810. suspense,
  811. isSVG,
  812. slotScopeIds,
  813. optimized
  814. );
  815. if (suspense.deps <= 0) {
  816. suspense.resolve();
  817. }
  818. }
  819. }
  820. } else {
  821. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  822. patch(
  823. activeBranch,
  824. newBranch,
  825. container,
  826. anchor,
  827. parentComponent,
  828. suspense,
  829. isSVG,
  830. slotScopeIds,
  831. optimized
  832. );
  833. setActiveBranch(suspense, newBranch);
  834. } else {
  835. triggerEvent(n2, "onPending");
  836. suspense.pendingBranch = newBranch;
  837. suspense.pendingId++;
  838. patch(
  839. null,
  840. newBranch,
  841. suspense.hiddenContainer,
  842. null,
  843. parentComponent,
  844. suspense,
  845. isSVG,
  846. slotScopeIds,
  847. optimized
  848. );
  849. if (suspense.deps <= 0) {
  850. suspense.resolve();
  851. } else {
  852. const { timeout, pendingId } = suspense;
  853. if (timeout > 0) {
  854. setTimeout(() => {
  855. if (suspense.pendingId === pendingId) {
  856. suspense.fallback(newFallback);
  857. }
  858. }, timeout);
  859. } else if (timeout === 0) {
  860. suspense.fallback(newFallback);
  861. }
  862. }
  863. }
  864. }
  865. }
  866. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  867. const {
  868. p: patch,
  869. m: move,
  870. um: unmount,
  871. n: next,
  872. o: { parentNode, remove }
  873. } = rendererInternals;
  874. let parentSuspenseId;
  875. const isSuspensible = isVNodeSuspensible(vnode);
  876. if (isSuspensible) {
  877. if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
  878. parentSuspenseId = parentSuspense.pendingId;
  879. parentSuspense.deps++;
  880. }
  881. }
  882. const timeout = vnode.props ? shared.toNumber(vnode.props.timeout) : void 0;
  883. const suspense = {
  884. vnode,
  885. parent: parentSuspense,
  886. parentComponent,
  887. isSVG,
  888. container,
  889. hiddenContainer,
  890. anchor,
  891. deps: 0,
  892. pendingId: 0,
  893. timeout: typeof timeout === "number" ? timeout : -1,
  894. activeBranch: null,
  895. pendingBranch: null,
  896. isInFallback: true,
  897. isHydrating,
  898. isUnmounted: false,
  899. effects: [],
  900. resolve(resume = false, sync = false) {
  901. const {
  902. vnode: vnode2,
  903. activeBranch,
  904. pendingBranch,
  905. pendingId,
  906. effects,
  907. parentComponent: parentComponent2,
  908. container: container2
  909. } = suspense;
  910. let delayEnter = false;
  911. if (suspense.isHydrating) {
  912. suspense.isHydrating = false;
  913. } else if (!resume) {
  914. delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  915. if (delayEnter) {
  916. activeBranch.transition.afterLeave = () => {
  917. if (pendingId === suspense.pendingId) {
  918. move(
  919. pendingBranch,
  920. container2,
  921. next(activeBranch),
  922. 0
  923. );
  924. queuePostFlushCb(effects);
  925. }
  926. };
  927. }
  928. let { anchor: anchor2 } = suspense;
  929. if (activeBranch) {
  930. anchor2 = next(activeBranch);
  931. unmount(activeBranch, parentComponent2, suspense, true);
  932. }
  933. if (!delayEnter) {
  934. move(pendingBranch, container2, anchor2, 0);
  935. }
  936. }
  937. setActiveBranch(suspense, pendingBranch);
  938. suspense.pendingBranch = null;
  939. suspense.isInFallback = false;
  940. let parent = suspense.parent;
  941. let hasUnresolvedAncestor = false;
  942. while (parent) {
  943. if (parent.pendingBranch) {
  944. parent.effects.push(...effects);
  945. hasUnresolvedAncestor = true;
  946. break;
  947. }
  948. parent = parent.parent;
  949. }
  950. if (!hasUnresolvedAncestor && !delayEnter) {
  951. queuePostFlushCb(effects);
  952. }
  953. suspense.effects = [];
  954. if (isSuspensible) {
  955. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  956. parentSuspense.deps--;
  957. if (parentSuspense.deps === 0 && !sync) {
  958. parentSuspense.resolve();
  959. }
  960. }
  961. }
  962. triggerEvent(vnode2, "onResolve");
  963. },
  964. fallback(fallbackVNode) {
  965. if (!suspense.pendingBranch) {
  966. return;
  967. }
  968. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
  969. triggerEvent(vnode2, "onFallback");
  970. const anchor2 = next(activeBranch);
  971. const mountFallback = () => {
  972. if (!suspense.isInFallback) {
  973. return;
  974. }
  975. patch(
  976. null,
  977. fallbackVNode,
  978. container2,
  979. anchor2,
  980. parentComponent2,
  981. null,
  982. // fallback tree will not have suspense context
  983. isSVG2,
  984. slotScopeIds,
  985. optimized
  986. );
  987. setActiveBranch(suspense, fallbackVNode);
  988. };
  989. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  990. if (delayEnter) {
  991. activeBranch.transition.afterLeave = mountFallback;
  992. }
  993. suspense.isInFallback = true;
  994. unmount(
  995. activeBranch,
  996. parentComponent2,
  997. null,
  998. // no suspense so unmount hooks fire now
  999. true
  1000. // shouldRemove
  1001. );
  1002. if (!delayEnter) {
  1003. mountFallback();
  1004. }
  1005. },
  1006. move(container2, anchor2, type) {
  1007. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  1008. suspense.container = container2;
  1009. },
  1010. next() {
  1011. return suspense.activeBranch && next(suspense.activeBranch);
  1012. },
  1013. registerDep(instance, setupRenderEffect) {
  1014. const isInPendingSuspense = !!suspense.pendingBranch;
  1015. if (isInPendingSuspense) {
  1016. suspense.deps++;
  1017. }
  1018. const hydratedEl = instance.vnode.el;
  1019. instance.asyncDep.catch((err) => {
  1020. handleError(err, instance, 0);
  1021. }).then((asyncSetupResult) => {
  1022. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  1023. return;
  1024. }
  1025. instance.asyncResolved = true;
  1026. const { vnode: vnode2 } = instance;
  1027. handleSetupResult(instance, asyncSetupResult, false);
  1028. if (hydratedEl) {
  1029. vnode2.el = hydratedEl;
  1030. }
  1031. const placeholder = !hydratedEl && instance.subTree.el;
  1032. setupRenderEffect(
  1033. instance,
  1034. vnode2,
  1035. // component may have been moved before resolve.
  1036. // if this is not a hydration, instance.subTree will be the comment
  1037. // placeholder.
  1038. parentNode(hydratedEl || instance.subTree.el),
  1039. // anchor will not be used if this is hydration, so only need to
  1040. // consider the comment placeholder case.
  1041. hydratedEl ? null : next(instance.subTree),
  1042. suspense,
  1043. isSVG,
  1044. optimized
  1045. );
  1046. if (placeholder) {
  1047. remove(placeholder);
  1048. }
  1049. updateHOCHostEl(instance, vnode2.el);
  1050. if (isInPendingSuspense && --suspense.deps === 0) {
  1051. suspense.resolve();
  1052. }
  1053. });
  1054. },
  1055. unmount(parentSuspense2, doRemove) {
  1056. suspense.isUnmounted = true;
  1057. if (suspense.activeBranch) {
  1058. unmount(
  1059. suspense.activeBranch,
  1060. parentComponent,
  1061. parentSuspense2,
  1062. doRemove
  1063. );
  1064. }
  1065. if (suspense.pendingBranch) {
  1066. unmount(
  1067. suspense.pendingBranch,
  1068. parentComponent,
  1069. parentSuspense2,
  1070. doRemove
  1071. );
  1072. }
  1073. }
  1074. };
  1075. return suspense;
  1076. }
  1077. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  1078. const suspense = vnode.suspense = createSuspenseBoundary(
  1079. vnode,
  1080. parentSuspense,
  1081. parentComponent,
  1082. node.parentNode,
  1083. document.createElement("div"),
  1084. null,
  1085. isSVG,
  1086. slotScopeIds,
  1087. optimized,
  1088. rendererInternals,
  1089. true
  1090. /* hydrating */
  1091. );
  1092. const result = hydrateNode(
  1093. node,
  1094. suspense.pendingBranch = vnode.ssContent,
  1095. parentComponent,
  1096. suspense,
  1097. slotScopeIds,
  1098. optimized
  1099. );
  1100. if (suspense.deps === 0) {
  1101. suspense.resolve(false, true);
  1102. }
  1103. return result;
  1104. }
  1105. function normalizeSuspenseChildren(vnode) {
  1106. const { shapeFlag, children } = vnode;
  1107. const isSlotChildren = shapeFlag & 32;
  1108. vnode.ssContent = normalizeSuspenseSlot(
  1109. isSlotChildren ? children.default : children
  1110. );
  1111. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  1112. }
  1113. function normalizeSuspenseSlot(s) {
  1114. let block;
  1115. if (shared.isFunction(s)) {
  1116. const trackBlock = isBlockTreeEnabled && s._c;
  1117. if (trackBlock) {
  1118. s._d = false;
  1119. openBlock();
  1120. }
  1121. s = s();
  1122. if (trackBlock) {
  1123. s._d = true;
  1124. block = currentBlock;
  1125. closeBlock();
  1126. }
  1127. }
  1128. if (shared.isArray(s)) {
  1129. const singleChild = filterSingleRoot(s);
  1130. s = singleChild;
  1131. }
  1132. s = normalizeVNode(s);
  1133. if (block && !s.dynamicChildren) {
  1134. s.dynamicChildren = block.filter((c) => c !== s);
  1135. }
  1136. return s;
  1137. }
  1138. function queueEffectWithSuspense(fn, suspense) {
  1139. if (suspense && suspense.pendingBranch) {
  1140. if (shared.isArray(fn)) {
  1141. suspense.effects.push(...fn);
  1142. } else {
  1143. suspense.effects.push(fn);
  1144. }
  1145. } else {
  1146. queuePostFlushCb(fn);
  1147. }
  1148. }
  1149. function setActiveBranch(suspense, branch) {
  1150. suspense.activeBranch = branch;
  1151. const { vnode, parentComponent } = suspense;
  1152. const el = vnode.el = branch.el;
  1153. if (parentComponent && parentComponent.subTree === vnode) {
  1154. parentComponent.vnode.el = el;
  1155. updateHOCHostEl(parentComponent, el);
  1156. }
  1157. }
  1158. function isVNodeSuspensible(vnode) {
  1159. var _a;
  1160. return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
  1161. }
  1162. function watchEffect(effect, options) {
  1163. return doWatch(effect, null, options);
  1164. }
  1165. function watchPostEffect(effect, options) {
  1166. return doWatch(
  1167. effect,
  1168. null,
  1169. { flush: "post" }
  1170. );
  1171. }
  1172. function watchSyncEffect(effect, options) {
  1173. return doWatch(
  1174. effect,
  1175. null,
  1176. { flush: "sync" }
  1177. );
  1178. }
  1179. const INITIAL_WATCHER_VALUE = {};
  1180. function watch(source, cb, options) {
  1181. return doWatch(source, cb, options);
  1182. }
  1183. function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = shared.EMPTY_OBJ) {
  1184. var _a;
  1185. const instance = reactivity.getCurrentScope() === ((_a = currentInstance) == null ? void 0 : _a.scope) ? currentInstance : null;
  1186. let getter;
  1187. let forceTrigger = false;
  1188. let isMultiSource = false;
  1189. if (reactivity.isRef(source)) {
  1190. getter = () => source.value;
  1191. forceTrigger = reactivity.isShallow(source);
  1192. } else if (reactivity.isReactive(source)) {
  1193. getter = () => source;
  1194. deep = true;
  1195. } else if (shared.isArray(source)) {
  1196. isMultiSource = true;
  1197. forceTrigger = source.some((s) => reactivity.isReactive(s) || reactivity.isShallow(s));
  1198. getter = () => source.map((s) => {
  1199. if (reactivity.isRef(s)) {
  1200. return s.value;
  1201. } else if (reactivity.isReactive(s)) {
  1202. return traverse(s);
  1203. } else if (shared.isFunction(s)) {
  1204. return callWithErrorHandling(s, instance, 2);
  1205. } else ;
  1206. });
  1207. } else if (shared.isFunction(source)) {
  1208. if (cb) {
  1209. getter = () => callWithErrorHandling(source, instance, 2);
  1210. } else {
  1211. getter = () => {
  1212. if (instance && instance.isUnmounted) {
  1213. return;
  1214. }
  1215. if (cleanup) {
  1216. cleanup();
  1217. }
  1218. return callWithAsyncErrorHandling(
  1219. source,
  1220. instance,
  1221. 3,
  1222. [onCleanup]
  1223. );
  1224. };
  1225. }
  1226. } else {
  1227. getter = shared.NOOP;
  1228. }
  1229. if (cb && deep) {
  1230. const baseGetter = getter;
  1231. getter = () => traverse(baseGetter());
  1232. }
  1233. let cleanup;
  1234. let onCleanup = (fn) => {
  1235. cleanup = effect.onStop = () => {
  1236. callWithErrorHandling(fn, instance, 4);
  1237. cleanup = effect.onStop = void 0;
  1238. };
  1239. };
  1240. let ssrCleanup;
  1241. if (isInSSRComponentSetup) {
  1242. onCleanup = shared.NOOP;
  1243. if (!cb) {
  1244. getter();
  1245. } else if (immediate) {
  1246. callWithAsyncErrorHandling(cb, instance, 3, [
  1247. getter(),
  1248. isMultiSource ? [] : void 0,
  1249. onCleanup
  1250. ]);
  1251. }
  1252. if (flush === "sync") {
  1253. const ctx = useSSRContext();
  1254. ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
  1255. } else {
  1256. return shared.NOOP;
  1257. }
  1258. }
  1259. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  1260. const job = () => {
  1261. if (!effect.active) {
  1262. return;
  1263. }
  1264. if (cb) {
  1265. const newValue = effect.run();
  1266. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => shared.hasChanged(v, oldValue[i])) : shared.hasChanged(newValue, oldValue)) || false) {
  1267. if (cleanup) {
  1268. cleanup();
  1269. }
  1270. callWithAsyncErrorHandling(cb, instance, 3, [
  1271. newValue,
  1272. // pass undefined as the old value when it's changed for the first time
  1273. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  1274. onCleanup
  1275. ]);
  1276. oldValue = newValue;
  1277. }
  1278. } else {
  1279. effect.run();
  1280. }
  1281. };
  1282. job.allowRecurse = !!cb;
  1283. let scheduler;
  1284. if (flush === "sync") {
  1285. scheduler = job;
  1286. } else if (flush === "post") {
  1287. scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
  1288. } else {
  1289. job.pre = true;
  1290. if (instance)
  1291. job.id = instance.uid;
  1292. scheduler = () => queueJob(job);
  1293. }
  1294. const effect = new reactivity.ReactiveEffect(getter, scheduler);
  1295. if (cb) {
  1296. if (immediate) {
  1297. job();
  1298. } else {
  1299. oldValue = effect.run();
  1300. }
  1301. } else if (flush === "post") {
  1302. queuePostRenderEffect(
  1303. effect.run.bind(effect),
  1304. instance && instance.suspense
  1305. );
  1306. } else {
  1307. effect.run();
  1308. }
  1309. const unwatch = () => {
  1310. effect.stop();
  1311. if (instance && instance.scope) {
  1312. shared.remove(instance.scope.effects, effect);
  1313. }
  1314. };
  1315. if (ssrCleanup)
  1316. ssrCleanup.push(unwatch);
  1317. return unwatch;
  1318. }
  1319. function instanceWatch(source, value, options) {
  1320. const publicThis = this.proxy;
  1321. const getter = shared.isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  1322. let cb;
  1323. if (shared.isFunction(value)) {
  1324. cb = value;
  1325. } else {
  1326. cb = value.handler;
  1327. options = value;
  1328. }
  1329. const cur = currentInstance;
  1330. setCurrentInstance(this);
  1331. const res = doWatch(getter, cb.bind(publicThis), options);
  1332. if (cur) {
  1333. setCurrentInstance(cur);
  1334. } else {
  1335. unsetCurrentInstance();
  1336. }
  1337. return res;
  1338. }
  1339. function createPathGetter(ctx, path) {
  1340. const segments = path.split(".");
  1341. return () => {
  1342. let cur = ctx;
  1343. for (let i = 0; i < segments.length && cur; i++) {
  1344. cur = cur[segments[i]];
  1345. }
  1346. return cur;
  1347. };
  1348. }
  1349. function traverse(value, seen) {
  1350. if (!shared.isObject(value) || value["__v_skip"]) {
  1351. return value;
  1352. }
  1353. seen = seen || /* @__PURE__ */ new Set();
  1354. if (seen.has(value)) {
  1355. return value;
  1356. }
  1357. seen.add(value);
  1358. if (reactivity.isRef(value)) {
  1359. traverse(value.value, seen);
  1360. } else if (shared.isArray(value)) {
  1361. for (let i = 0; i < value.length; i++) {
  1362. traverse(value[i], seen);
  1363. }
  1364. } else if (shared.isSet(value) || shared.isMap(value)) {
  1365. value.forEach((v) => {
  1366. traverse(v, seen);
  1367. });
  1368. } else if (shared.isPlainObject(value)) {
  1369. for (const key in value) {
  1370. traverse(value[key], seen);
  1371. }
  1372. }
  1373. return value;
  1374. }
  1375. function withDirectives(vnode, directives) {
  1376. const internalInstance = currentRenderingInstance;
  1377. if (internalInstance === null) {
  1378. return vnode;
  1379. }
  1380. const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
  1381. const bindings = vnode.dirs || (vnode.dirs = []);
  1382. for (let i = 0; i < directives.length; i++) {
  1383. let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
  1384. if (dir) {
  1385. if (shared.isFunction(dir)) {
  1386. dir = {
  1387. mounted: dir,
  1388. updated: dir
  1389. };
  1390. }
  1391. if (dir.deep) {
  1392. traverse(value);
  1393. }
  1394. bindings.push({
  1395. dir,
  1396. instance,
  1397. value,
  1398. oldValue: void 0,
  1399. arg,
  1400. modifiers
  1401. });
  1402. }
  1403. }
  1404. return vnode;
  1405. }
  1406. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  1407. const bindings = vnode.dirs;
  1408. const oldBindings = prevVNode && prevVNode.dirs;
  1409. for (let i = 0; i < bindings.length; i++) {
  1410. const binding = bindings[i];
  1411. if (oldBindings) {
  1412. binding.oldValue = oldBindings[i].value;
  1413. }
  1414. let hook = binding.dir[name];
  1415. if (hook) {
  1416. reactivity.pauseTracking();
  1417. callWithAsyncErrorHandling(hook, instance, 8, [
  1418. vnode.el,
  1419. binding,
  1420. vnode,
  1421. prevVNode
  1422. ]);
  1423. reactivity.resetTracking();
  1424. }
  1425. }
  1426. }
  1427. const leaveCbKey = Symbol("_leaveCb");
  1428. const enterCbKey = Symbol("_enterCb");
  1429. function useTransitionState() {
  1430. const state = {
  1431. isMounted: false,
  1432. isLeaving: false,
  1433. isUnmounting: false,
  1434. leavingVNodes: /* @__PURE__ */ new Map()
  1435. };
  1436. onMounted(() => {
  1437. state.isMounted = true;
  1438. });
  1439. onBeforeUnmount(() => {
  1440. state.isUnmounting = true;
  1441. });
  1442. return state;
  1443. }
  1444. const TransitionHookValidator = [Function, Array];
  1445. const BaseTransitionPropsValidators = {
  1446. mode: String,
  1447. appear: Boolean,
  1448. persisted: Boolean,
  1449. // enter
  1450. onBeforeEnter: TransitionHookValidator,
  1451. onEnter: TransitionHookValidator,
  1452. onAfterEnter: TransitionHookValidator,
  1453. onEnterCancelled: TransitionHookValidator,
  1454. // leave
  1455. onBeforeLeave: TransitionHookValidator,
  1456. onLeave: TransitionHookValidator,
  1457. onAfterLeave: TransitionHookValidator,
  1458. onLeaveCancelled: TransitionHookValidator,
  1459. // appear
  1460. onBeforeAppear: TransitionHookValidator,
  1461. onAppear: TransitionHookValidator,
  1462. onAfterAppear: TransitionHookValidator,
  1463. onAppearCancelled: TransitionHookValidator
  1464. };
  1465. const BaseTransitionImpl = {
  1466. name: `BaseTransition`,
  1467. props: BaseTransitionPropsValidators,
  1468. setup(props, { slots }) {
  1469. const instance = getCurrentInstance();
  1470. const state = useTransitionState();
  1471. let prevTransitionKey;
  1472. return () => {
  1473. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  1474. if (!children || !children.length) {
  1475. return;
  1476. }
  1477. let child = children[0];
  1478. if (children.length > 1) {
  1479. for (const c of children) {
  1480. if (c.type !== Comment) {
  1481. child = c;
  1482. break;
  1483. }
  1484. }
  1485. }
  1486. const rawProps = reactivity.toRaw(props);
  1487. const { mode } = rawProps;
  1488. if (state.isLeaving) {
  1489. return emptyPlaceholder(child);
  1490. }
  1491. const innerChild = getKeepAliveChild(child);
  1492. if (!innerChild) {
  1493. return emptyPlaceholder(child);
  1494. }
  1495. const enterHooks = resolveTransitionHooks(
  1496. innerChild,
  1497. rawProps,
  1498. state,
  1499. instance
  1500. );
  1501. setTransitionHooks(innerChild, enterHooks);
  1502. const oldChild = instance.subTree;
  1503. const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
  1504. let transitionKeyChanged = false;
  1505. const { getTransitionKey } = innerChild.type;
  1506. if (getTransitionKey) {
  1507. const key = getTransitionKey();
  1508. if (prevTransitionKey === void 0) {
  1509. prevTransitionKey = key;
  1510. } else if (key !== prevTransitionKey) {
  1511. prevTransitionKey = key;
  1512. transitionKeyChanged = true;
  1513. }
  1514. }
  1515. if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
  1516. const leavingHooks = resolveTransitionHooks(
  1517. oldInnerChild,
  1518. rawProps,
  1519. state,
  1520. instance
  1521. );
  1522. setTransitionHooks(oldInnerChild, leavingHooks);
  1523. if (mode === "out-in") {
  1524. state.isLeaving = true;
  1525. leavingHooks.afterLeave = () => {
  1526. state.isLeaving = false;
  1527. if (instance.update.active !== false) {
  1528. instance.update();
  1529. }
  1530. };
  1531. return emptyPlaceholder(child);
  1532. } else if (mode === "in-out" && innerChild.type !== Comment) {
  1533. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  1534. const leavingVNodesCache = getLeavingNodesForType(
  1535. state,
  1536. oldInnerChild
  1537. );
  1538. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  1539. el[leaveCbKey] = () => {
  1540. earlyRemove();
  1541. el[leaveCbKey] = void 0;
  1542. delete enterHooks.delayedLeave;
  1543. };
  1544. enterHooks.delayedLeave = delayedLeave;
  1545. };
  1546. }
  1547. }
  1548. return child;
  1549. };
  1550. }
  1551. };
  1552. const BaseTransition = BaseTransitionImpl;
  1553. function getLeavingNodesForType(state, vnode) {
  1554. const { leavingVNodes } = state;
  1555. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  1556. if (!leavingVNodesCache) {
  1557. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  1558. leavingVNodes.set(vnode.type, leavingVNodesCache);
  1559. }
  1560. return leavingVNodesCache;
  1561. }
  1562. function resolveTransitionHooks(vnode, props, state, instance) {
  1563. const {
  1564. appear,
  1565. mode,
  1566. persisted = false,
  1567. onBeforeEnter,
  1568. onEnter,
  1569. onAfterEnter,
  1570. onEnterCancelled,
  1571. onBeforeLeave,
  1572. onLeave,
  1573. onAfterLeave,
  1574. onLeaveCancelled,
  1575. onBeforeAppear,
  1576. onAppear,
  1577. onAfterAppear,
  1578. onAppearCancelled
  1579. } = props;
  1580. const key = String(vnode.key);
  1581. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  1582. const callHook = (hook, args) => {
  1583. hook && callWithAsyncErrorHandling(
  1584. hook,
  1585. instance,
  1586. 9,
  1587. args
  1588. );
  1589. };
  1590. const callAsyncHook = (hook, args) => {
  1591. const done = args[1];
  1592. callHook(hook, args);
  1593. if (shared.isArray(hook)) {
  1594. if (hook.every((hook2) => hook2.length <= 1))
  1595. done();
  1596. } else if (hook.length <= 1) {
  1597. done();
  1598. }
  1599. };
  1600. const hooks = {
  1601. mode,
  1602. persisted,
  1603. beforeEnter(el) {
  1604. let hook = onBeforeEnter;
  1605. if (!state.isMounted) {
  1606. if (appear) {
  1607. hook = onBeforeAppear || onBeforeEnter;
  1608. } else {
  1609. return;
  1610. }
  1611. }
  1612. if (el[leaveCbKey]) {
  1613. el[leaveCbKey](
  1614. true
  1615. /* cancelled */
  1616. );
  1617. }
  1618. const leavingVNode = leavingVNodesCache[key];
  1619. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
  1620. leavingVNode.el[leaveCbKey]();
  1621. }
  1622. callHook(hook, [el]);
  1623. },
  1624. enter(el) {
  1625. let hook = onEnter;
  1626. let afterHook = onAfterEnter;
  1627. let cancelHook = onEnterCancelled;
  1628. if (!state.isMounted) {
  1629. if (appear) {
  1630. hook = onAppear || onEnter;
  1631. afterHook = onAfterAppear || onAfterEnter;
  1632. cancelHook = onAppearCancelled || onEnterCancelled;
  1633. } else {
  1634. return;
  1635. }
  1636. }
  1637. let called = false;
  1638. const done = el[enterCbKey] = (cancelled) => {
  1639. if (called)
  1640. return;
  1641. called = true;
  1642. if (cancelled) {
  1643. callHook(cancelHook, [el]);
  1644. } else {
  1645. callHook(afterHook, [el]);
  1646. }
  1647. if (hooks.delayedLeave) {
  1648. hooks.delayedLeave();
  1649. }
  1650. el[enterCbKey] = void 0;
  1651. };
  1652. if (hook) {
  1653. callAsyncHook(hook, [el, done]);
  1654. } else {
  1655. done();
  1656. }
  1657. },
  1658. leave(el, remove) {
  1659. const key2 = String(vnode.key);
  1660. if (el[enterCbKey]) {
  1661. el[enterCbKey](
  1662. true
  1663. /* cancelled */
  1664. );
  1665. }
  1666. if (state.isUnmounting) {
  1667. return remove();
  1668. }
  1669. callHook(onBeforeLeave, [el]);
  1670. let called = false;
  1671. const done = el[leaveCbKey] = (cancelled) => {
  1672. if (called)
  1673. return;
  1674. called = true;
  1675. remove();
  1676. if (cancelled) {
  1677. callHook(onLeaveCancelled, [el]);
  1678. } else {
  1679. callHook(onAfterLeave, [el]);
  1680. }
  1681. el[leaveCbKey] = void 0;
  1682. if (leavingVNodesCache[key2] === vnode) {
  1683. delete leavingVNodesCache[key2];
  1684. }
  1685. };
  1686. leavingVNodesCache[key2] = vnode;
  1687. if (onLeave) {
  1688. callAsyncHook(onLeave, [el, done]);
  1689. } else {
  1690. done();
  1691. }
  1692. },
  1693. clone(vnode2) {
  1694. return resolveTransitionHooks(vnode2, props, state, instance);
  1695. }
  1696. };
  1697. return hooks;
  1698. }
  1699. function emptyPlaceholder(vnode) {
  1700. if (isKeepAlive(vnode)) {
  1701. vnode = cloneVNode(vnode);
  1702. vnode.children = null;
  1703. return vnode;
  1704. }
  1705. }
  1706. function getKeepAliveChild(vnode) {
  1707. return isKeepAlive(vnode) ? (
  1708. // #7121 ensure get the child component subtree in case
  1709. // it's been replaced during HMR
  1710. vnode.children ? vnode.children[0] : void 0
  1711. ) : vnode;
  1712. }
  1713. function setTransitionHooks(vnode, hooks) {
  1714. if (vnode.shapeFlag & 6 && vnode.component) {
  1715. setTransitionHooks(vnode.component.subTree, hooks);
  1716. } else if (vnode.shapeFlag & 128) {
  1717. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  1718. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  1719. } else {
  1720. vnode.transition = hooks;
  1721. }
  1722. }
  1723. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  1724. let ret = [];
  1725. let keyedFragmentCount = 0;
  1726. for (let i = 0; i < children.length; i++) {
  1727. let child = children[i];
  1728. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  1729. if (child.type === Fragment) {
  1730. if (child.patchFlag & 128)
  1731. keyedFragmentCount++;
  1732. ret = ret.concat(
  1733. getTransitionRawChildren(child.children, keepComment, key)
  1734. );
  1735. } else if (keepComment || child.type !== Comment) {
  1736. ret.push(key != null ? cloneVNode(child, { key }) : child);
  1737. }
  1738. }
  1739. if (keyedFragmentCount > 1) {
  1740. for (let i = 0; i < ret.length; i++) {
  1741. ret[i].patchFlag = -2;
  1742. }
  1743. }
  1744. return ret;
  1745. }
  1746. /*! #__NO_SIDE_EFFECTS__ */
  1747. // @__NO_SIDE_EFFECTS__
  1748. function defineComponent(options, extraOptions) {
  1749. return shared.isFunction(options) ? (
  1750. // #8326: extend call and options.name access are considered side-effects
  1751. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  1752. /* @__PURE__ */ (() => shared.extend({ name: options.name }, extraOptions, { setup: options }))()
  1753. ) : options;
  1754. }
  1755. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  1756. /*! #__NO_SIDE_EFFECTS__ */
  1757. // @__NO_SIDE_EFFECTS__
  1758. function defineAsyncComponent(source) {
  1759. if (shared.isFunction(source)) {
  1760. source = { loader: source };
  1761. }
  1762. const {
  1763. loader,
  1764. loadingComponent,
  1765. errorComponent,
  1766. delay = 200,
  1767. timeout,
  1768. // undefined = never times out
  1769. suspensible = true,
  1770. onError: userOnError
  1771. } = source;
  1772. let pendingRequest = null;
  1773. let resolvedComp;
  1774. let retries = 0;
  1775. const retry = () => {
  1776. retries++;
  1777. pendingRequest = null;
  1778. return load();
  1779. };
  1780. const load = () => {
  1781. let thisRequest;
  1782. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  1783. err = err instanceof Error ? err : new Error(String(err));
  1784. if (userOnError) {
  1785. return new Promise((resolve, reject) => {
  1786. const userRetry = () => resolve(retry());
  1787. const userFail = () => reject(err);
  1788. userOnError(err, userRetry, userFail, retries + 1);
  1789. });
  1790. } else {
  1791. throw err;
  1792. }
  1793. }).then((comp) => {
  1794. if (thisRequest !== pendingRequest && pendingRequest) {
  1795. return pendingRequest;
  1796. }
  1797. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  1798. comp = comp.default;
  1799. }
  1800. resolvedComp = comp;
  1801. return comp;
  1802. }));
  1803. };
  1804. return defineComponent({
  1805. name: "AsyncComponentWrapper",
  1806. __asyncLoader: load,
  1807. get __asyncResolved() {
  1808. return resolvedComp;
  1809. },
  1810. setup() {
  1811. const instance = currentInstance;
  1812. if (resolvedComp) {
  1813. return () => createInnerComp(resolvedComp, instance);
  1814. }
  1815. const onError = (err) => {
  1816. pendingRequest = null;
  1817. handleError(
  1818. err,
  1819. instance,
  1820. 13,
  1821. !errorComponent
  1822. /* do not throw in dev if user provided error component */
  1823. );
  1824. };
  1825. if (suspensible && instance.suspense || isInSSRComponentSetup) {
  1826. return load().then((comp) => {
  1827. return () => createInnerComp(comp, instance);
  1828. }).catch((err) => {
  1829. onError(err);
  1830. return () => errorComponent ? createVNode(errorComponent, {
  1831. error: err
  1832. }) : null;
  1833. });
  1834. }
  1835. const loaded = reactivity.ref(false);
  1836. const error = reactivity.ref();
  1837. const delayed = reactivity.ref(!!delay);
  1838. if (delay) {
  1839. setTimeout(() => {
  1840. delayed.value = false;
  1841. }, delay);
  1842. }
  1843. if (timeout != null) {
  1844. setTimeout(() => {
  1845. if (!loaded.value && !error.value) {
  1846. const err = new Error(
  1847. `Async component timed out after ${timeout}ms.`
  1848. );
  1849. onError(err);
  1850. error.value = err;
  1851. }
  1852. }, timeout);
  1853. }
  1854. load().then(() => {
  1855. loaded.value = true;
  1856. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  1857. queueJob(instance.parent.update);
  1858. }
  1859. }).catch((err) => {
  1860. onError(err);
  1861. error.value = err;
  1862. });
  1863. return () => {
  1864. if (loaded.value && resolvedComp) {
  1865. return createInnerComp(resolvedComp, instance);
  1866. } else if (error.value && errorComponent) {
  1867. return createVNode(errorComponent, {
  1868. error: error.value
  1869. });
  1870. } else if (loadingComponent && !delayed.value) {
  1871. return createVNode(loadingComponent);
  1872. }
  1873. };
  1874. }
  1875. });
  1876. }
  1877. function createInnerComp(comp, parent) {
  1878. const { ref: ref2, props, children, ce } = parent.vnode;
  1879. const vnode = createVNode(comp, props, children);
  1880. vnode.ref = ref2;
  1881. vnode.ce = ce;
  1882. delete parent.vnode.ce;
  1883. return vnode;
  1884. }
  1885. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  1886. const KeepAliveImpl = {
  1887. name: `KeepAlive`,
  1888. // Marker for special handling inside the renderer. We are not using a ===
  1889. // check directly on KeepAlive in the renderer, because importing it directly
  1890. // would prevent it from being tree-shaken.
  1891. __isKeepAlive: true,
  1892. props: {
  1893. include: [String, RegExp, Array],
  1894. exclude: [String, RegExp, Array],
  1895. max: [String, Number]
  1896. },
  1897. setup(props, { slots }) {
  1898. const instance = getCurrentInstance();
  1899. const sharedContext = instance.ctx;
  1900. if (!sharedContext.renderer) {
  1901. return () => {
  1902. const children = slots.default && slots.default();
  1903. return children && children.length === 1 ? children[0] : children;
  1904. };
  1905. }
  1906. const cache = /* @__PURE__ */ new Map();
  1907. const keys = /* @__PURE__ */ new Set();
  1908. let current = null;
  1909. const parentSuspense = instance.suspense;
  1910. const {
  1911. renderer: {
  1912. p: patch,
  1913. m: move,
  1914. um: _unmount,
  1915. o: { createElement }
  1916. }
  1917. } = sharedContext;
  1918. const storageContainer = createElement("div");
  1919. sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
  1920. const instance2 = vnode.component;
  1921. move(vnode, container, anchor, 0, parentSuspense);
  1922. patch(
  1923. instance2.vnode,
  1924. vnode,
  1925. container,
  1926. anchor,
  1927. instance2,
  1928. parentSuspense,
  1929. isSVG,
  1930. vnode.slotScopeIds,
  1931. optimized
  1932. );
  1933. queuePostRenderEffect(() => {
  1934. instance2.isDeactivated = false;
  1935. if (instance2.a) {
  1936. shared.invokeArrayFns(instance2.a);
  1937. }
  1938. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  1939. if (vnodeHook) {
  1940. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  1941. }
  1942. }, parentSuspense);
  1943. };
  1944. sharedContext.deactivate = (vnode) => {
  1945. const instance2 = vnode.component;
  1946. move(vnode, storageContainer, null, 1, parentSuspense);
  1947. queuePostRenderEffect(() => {
  1948. if (instance2.da) {
  1949. shared.invokeArrayFns(instance2.da);
  1950. }
  1951. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  1952. if (vnodeHook) {
  1953. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  1954. }
  1955. instance2.isDeactivated = true;
  1956. }, parentSuspense);
  1957. };
  1958. function unmount(vnode) {
  1959. resetShapeFlag(vnode);
  1960. _unmount(vnode, instance, parentSuspense, true);
  1961. }
  1962. function pruneCache(filter) {
  1963. cache.forEach((vnode, key) => {
  1964. const name = getComponentName(vnode.type);
  1965. if (name && (!filter || !filter(name))) {
  1966. pruneCacheEntry(key);
  1967. }
  1968. });
  1969. }
  1970. function pruneCacheEntry(key) {
  1971. const cached = cache.get(key);
  1972. if (!current || !isSameVNodeType(cached, current)) {
  1973. unmount(cached);
  1974. } else if (current) {
  1975. resetShapeFlag(current);
  1976. }
  1977. cache.delete(key);
  1978. keys.delete(key);
  1979. }
  1980. watch(
  1981. () => [props.include, props.exclude],
  1982. ([include, exclude]) => {
  1983. include && pruneCache((name) => matches(include, name));
  1984. exclude && pruneCache((name) => !matches(exclude, name));
  1985. },
  1986. // prune post-render after `current` has been updated
  1987. { flush: "post", deep: true }
  1988. );
  1989. let pendingCacheKey = null;
  1990. const cacheSubtree = () => {
  1991. if (pendingCacheKey != null) {
  1992. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  1993. }
  1994. };
  1995. onMounted(cacheSubtree);
  1996. onUpdated(cacheSubtree);
  1997. onBeforeUnmount(() => {
  1998. cache.forEach((cached) => {
  1999. const { subTree, suspense } = instance;
  2000. const vnode = getInnerChild(subTree);
  2001. if (cached.type === vnode.type && cached.key === vnode.key) {
  2002. resetShapeFlag(vnode);
  2003. const da = vnode.component.da;
  2004. da && queuePostRenderEffect(da, suspense);
  2005. return;
  2006. }
  2007. unmount(cached);
  2008. });
  2009. });
  2010. return () => {
  2011. pendingCacheKey = null;
  2012. if (!slots.default) {
  2013. return null;
  2014. }
  2015. const children = slots.default();
  2016. const rawVNode = children[0];
  2017. if (children.length > 1) {
  2018. current = null;
  2019. return children;
  2020. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  2021. current = null;
  2022. return rawVNode;
  2023. }
  2024. let vnode = getInnerChild(rawVNode);
  2025. const comp = vnode.type;
  2026. const name = getComponentName(
  2027. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  2028. );
  2029. const { include, exclude, max } = props;
  2030. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  2031. current = vnode;
  2032. return rawVNode;
  2033. }
  2034. const key = vnode.key == null ? comp : vnode.key;
  2035. const cachedVNode = cache.get(key);
  2036. if (vnode.el) {
  2037. vnode = cloneVNode(vnode);
  2038. if (rawVNode.shapeFlag & 128) {
  2039. rawVNode.ssContent = vnode;
  2040. }
  2041. }
  2042. pendingCacheKey = key;
  2043. if (cachedVNode) {
  2044. vnode.el = cachedVNode.el;
  2045. vnode.component = cachedVNode.component;
  2046. if (vnode.transition) {
  2047. setTransitionHooks(vnode, vnode.transition);
  2048. }
  2049. vnode.shapeFlag |= 512;
  2050. keys.delete(key);
  2051. keys.add(key);
  2052. } else {
  2053. keys.add(key);
  2054. if (max && keys.size > parseInt(max, 10)) {
  2055. pruneCacheEntry(keys.values().next().value);
  2056. }
  2057. }
  2058. vnode.shapeFlag |= 256;
  2059. current = vnode;
  2060. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  2061. };
  2062. }
  2063. };
  2064. const KeepAlive = KeepAliveImpl;
  2065. function matches(pattern, name) {
  2066. if (shared.isArray(pattern)) {
  2067. return pattern.some((p) => matches(p, name));
  2068. } else if (shared.isString(pattern)) {
  2069. return pattern.split(",").includes(name);
  2070. } else if (shared.isRegExp(pattern)) {
  2071. return pattern.test(name);
  2072. }
  2073. return false;
  2074. }
  2075. function onActivated(hook, target) {
  2076. registerKeepAliveHook(hook, "a", target);
  2077. }
  2078. function onDeactivated(hook, target) {
  2079. registerKeepAliveHook(hook, "da", target);
  2080. }
  2081. function registerKeepAliveHook(hook, type, target = currentInstance) {
  2082. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  2083. let current = target;
  2084. while (current) {
  2085. if (current.isDeactivated) {
  2086. return;
  2087. }
  2088. current = current.parent;
  2089. }
  2090. return hook();
  2091. });
  2092. injectHook(type, wrappedHook, target);
  2093. if (target) {
  2094. let current = target.parent;
  2095. while (current && current.parent) {
  2096. if (isKeepAlive(current.parent.vnode)) {
  2097. injectToKeepAliveRoot(wrappedHook, type, target, current);
  2098. }
  2099. current = current.parent;
  2100. }
  2101. }
  2102. }
  2103. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  2104. const injected = injectHook(
  2105. type,
  2106. hook,
  2107. keepAliveRoot,
  2108. true
  2109. /* prepend */
  2110. );
  2111. onUnmounted(() => {
  2112. shared.remove(keepAliveRoot[type], injected);
  2113. }, target);
  2114. }
  2115. function resetShapeFlag(vnode) {
  2116. vnode.shapeFlag &= ~256;
  2117. vnode.shapeFlag &= ~512;
  2118. }
  2119. function getInnerChild(vnode) {
  2120. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  2121. }
  2122. function injectHook(type, hook, target = currentInstance, prepend = false) {
  2123. if (target) {
  2124. const hooks = target[type] || (target[type] = []);
  2125. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  2126. if (target.isUnmounted) {
  2127. return;
  2128. }
  2129. reactivity.pauseTracking();
  2130. setCurrentInstance(target);
  2131. const res = callWithAsyncErrorHandling(hook, target, type, args);
  2132. unsetCurrentInstance();
  2133. reactivity.resetTracking();
  2134. return res;
  2135. });
  2136. if (prepend) {
  2137. hooks.unshift(wrappedHook);
  2138. } else {
  2139. hooks.push(wrappedHook);
  2140. }
  2141. return wrappedHook;
  2142. }
  2143. }
  2144. const createHook = (lifecycle) => (hook, target = currentInstance) => (
  2145. // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
  2146. (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
  2147. );
  2148. const onBeforeMount = createHook("bm");
  2149. const onMounted = createHook("m");
  2150. const onBeforeUpdate = createHook("bu");
  2151. const onUpdated = createHook("u");
  2152. const onBeforeUnmount = createHook("bum");
  2153. const onUnmounted = createHook("um");
  2154. const onServerPrefetch = createHook("sp");
  2155. const onRenderTriggered = createHook(
  2156. "rtg"
  2157. );
  2158. const onRenderTracked = createHook(
  2159. "rtc"
  2160. );
  2161. function onErrorCaptured(hook, target = currentInstance) {
  2162. injectHook("ec", hook, target);
  2163. }
  2164. function renderList(source, renderItem, cache, index) {
  2165. let ret;
  2166. const cached = cache && cache[index];
  2167. if (shared.isArray(source) || shared.isString(source)) {
  2168. ret = new Array(source.length);
  2169. for (let i = 0, l = source.length; i < l; i++) {
  2170. ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
  2171. }
  2172. } else if (typeof source === "number") {
  2173. ret = new Array(source);
  2174. for (let i = 0; i < source; i++) {
  2175. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  2176. }
  2177. } else if (shared.isObject(source)) {
  2178. if (source[Symbol.iterator]) {
  2179. ret = Array.from(
  2180. source,
  2181. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  2182. );
  2183. } else {
  2184. const keys = Object.keys(source);
  2185. ret = new Array(keys.length);
  2186. for (let i = 0, l = keys.length; i < l; i++) {
  2187. const key = keys[i];
  2188. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  2189. }
  2190. }
  2191. } else {
  2192. ret = [];
  2193. }
  2194. if (cache) {
  2195. cache[index] = ret;
  2196. }
  2197. return ret;
  2198. }
  2199. function createSlots(slots, dynamicSlots) {
  2200. for (let i = 0; i < dynamicSlots.length; i++) {
  2201. const slot = dynamicSlots[i];
  2202. if (shared.isArray(slot)) {
  2203. for (let j = 0; j < slot.length; j++) {
  2204. slots[slot[j].name] = slot[j].fn;
  2205. }
  2206. } else if (slot) {
  2207. slots[slot.name] = slot.key ? (...args) => {
  2208. const res = slot.fn(...args);
  2209. if (res)
  2210. res.key = slot.key;
  2211. return res;
  2212. } : slot.fn;
  2213. }
  2214. }
  2215. return slots;
  2216. }
  2217. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  2218. if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
  2219. if (name !== "default")
  2220. props.name = name;
  2221. return createVNode("slot", props, fallback && fallback());
  2222. }
  2223. let slot = slots[name];
  2224. if (slot && slot._c) {
  2225. slot._d = false;
  2226. }
  2227. openBlock();
  2228. const validSlotContent = slot && ensureValidVNode(slot(props));
  2229. const rendered = createBlock(
  2230. Fragment,
  2231. {
  2232. key: props.key || // slot content array of a dynamic conditional slot may have a branch
  2233. // key attached in the `createSlots` helper, respect that
  2234. validSlotContent && validSlotContent.key || `_${name}`
  2235. },
  2236. validSlotContent || (fallback ? fallback() : []),
  2237. validSlotContent && slots._ === 1 ? 64 : -2
  2238. );
  2239. if (!noSlotted && rendered.scopeId) {
  2240. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  2241. }
  2242. if (slot && slot._c) {
  2243. slot._d = true;
  2244. }
  2245. return rendered;
  2246. }
  2247. function ensureValidVNode(vnodes) {
  2248. return vnodes.some((child) => {
  2249. if (!isVNode(child))
  2250. return true;
  2251. if (child.type === Comment)
  2252. return false;
  2253. if (child.type === Fragment && !ensureValidVNode(child.children))
  2254. return false;
  2255. return true;
  2256. }) ? vnodes : null;
  2257. }
  2258. function toHandlers(obj, preserveCaseIfNecessary) {
  2259. const ret = {};
  2260. for (const key in obj) {
  2261. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : shared.toHandlerKey(key)] = obj[key];
  2262. }
  2263. return ret;
  2264. }
  2265. const getPublicInstance = (i) => {
  2266. if (!i)
  2267. return null;
  2268. if (isStatefulComponent(i))
  2269. return getExposeProxy(i) || i.proxy;
  2270. return getPublicInstance(i.parent);
  2271. };
  2272. const publicPropertiesMap = (
  2273. // Move PURE marker to new line to workaround compiler discarding it
  2274. // due to type annotation
  2275. /* @__PURE__ */ shared.extend(/* @__PURE__ */ Object.create(null), {
  2276. $: (i) => i,
  2277. $el: (i) => i.vnode.el,
  2278. $data: (i) => i.data,
  2279. $props: (i) => i.props,
  2280. $attrs: (i) => i.attrs,
  2281. $slots: (i) => i.slots,
  2282. $refs: (i) => i.refs,
  2283. $parent: (i) => getPublicInstance(i.parent),
  2284. $root: (i) => getPublicInstance(i.root),
  2285. $emit: (i) => i.emit,
  2286. $options: (i) => resolveMergedOptions(i) ,
  2287. $forceUpdate: (i) => i.f || (i.f = () => queueJob(i.update)),
  2288. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  2289. $watch: (i) => instanceWatch.bind(i)
  2290. })
  2291. );
  2292. const hasSetupBinding = (state, key) => state !== shared.EMPTY_OBJ && !state.__isScriptSetup && shared.hasOwn(state, key);
  2293. const PublicInstanceProxyHandlers = {
  2294. get({ _: instance }, key) {
  2295. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  2296. let normalizedProps;
  2297. if (key[0] !== "$") {
  2298. const n = accessCache[key];
  2299. if (n !== void 0) {
  2300. switch (n) {
  2301. case 1 /* SETUP */:
  2302. return setupState[key];
  2303. case 2 /* DATA */:
  2304. return data[key];
  2305. case 4 /* CONTEXT */:
  2306. return ctx[key];
  2307. case 3 /* PROPS */:
  2308. return props[key];
  2309. }
  2310. } else if (hasSetupBinding(setupState, key)) {
  2311. accessCache[key] = 1 /* SETUP */;
  2312. return setupState[key];
  2313. } else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
  2314. accessCache[key] = 2 /* DATA */;
  2315. return data[key];
  2316. } else if (
  2317. // only cache other properties when instance has declared (thus stable)
  2318. // props
  2319. (normalizedProps = instance.propsOptions[0]) && shared.hasOwn(normalizedProps, key)
  2320. ) {
  2321. accessCache[key] = 3 /* PROPS */;
  2322. return props[key];
  2323. } else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
  2324. accessCache[key] = 4 /* CONTEXT */;
  2325. return ctx[key];
  2326. } else if (shouldCacheAccess) {
  2327. accessCache[key] = 0 /* OTHER */;
  2328. }
  2329. }
  2330. const publicGetter = publicPropertiesMap[key];
  2331. let cssModule, globalProperties;
  2332. if (publicGetter) {
  2333. if (key === "$attrs") {
  2334. reactivity.track(instance, "get", key);
  2335. }
  2336. return publicGetter(instance);
  2337. } else if (
  2338. // css module (injected by vue-loader)
  2339. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  2340. ) {
  2341. return cssModule;
  2342. } else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
  2343. accessCache[key] = 4 /* CONTEXT */;
  2344. return ctx[key];
  2345. } else if (
  2346. // global properties
  2347. globalProperties = appContext.config.globalProperties, shared.hasOwn(globalProperties, key)
  2348. ) {
  2349. {
  2350. return globalProperties[key];
  2351. }
  2352. } else ;
  2353. },
  2354. set({ _: instance }, key, value) {
  2355. const { data, setupState, ctx } = instance;
  2356. if (hasSetupBinding(setupState, key)) {
  2357. setupState[key] = value;
  2358. return true;
  2359. } else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
  2360. data[key] = value;
  2361. return true;
  2362. } else if (shared.hasOwn(instance.props, key)) {
  2363. return false;
  2364. }
  2365. if (key[0] === "$" && key.slice(1) in instance) {
  2366. return false;
  2367. } else {
  2368. {
  2369. ctx[key] = value;
  2370. }
  2371. }
  2372. return true;
  2373. },
  2374. has({
  2375. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  2376. }, key) {
  2377. let normalizedProps;
  2378. return !!accessCache[key] || data !== shared.EMPTY_OBJ && shared.hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key) || shared.hasOwn(ctx, key) || shared.hasOwn(publicPropertiesMap, key) || shared.hasOwn(appContext.config.globalProperties, key);
  2379. },
  2380. defineProperty(target, key, descriptor) {
  2381. if (descriptor.get != null) {
  2382. target._.accessCache[key] = 0;
  2383. } else if (shared.hasOwn(descriptor, "value")) {
  2384. this.set(target, key, descriptor.value, null);
  2385. }
  2386. return Reflect.defineProperty(target, key, descriptor);
  2387. }
  2388. };
  2389. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ shared.extend(
  2390. {},
  2391. PublicInstanceProxyHandlers,
  2392. {
  2393. get(target, key) {
  2394. if (key === Symbol.unscopables) {
  2395. return;
  2396. }
  2397. return PublicInstanceProxyHandlers.get(target, key, target);
  2398. },
  2399. has(_, key) {
  2400. const has = key[0] !== "_" && !shared.isGloballyAllowed(key);
  2401. return has;
  2402. }
  2403. }
  2404. );
  2405. function defineProps() {
  2406. return null;
  2407. }
  2408. function defineEmits() {
  2409. return null;
  2410. }
  2411. function defineExpose(exposed) {
  2412. }
  2413. function defineOptions(options) {
  2414. }
  2415. function defineSlots() {
  2416. return null;
  2417. }
  2418. function defineModel() {
  2419. }
  2420. function withDefaults(props, defaults) {
  2421. return null;
  2422. }
  2423. function useSlots() {
  2424. return getContext().slots;
  2425. }
  2426. function useAttrs() {
  2427. return getContext().attrs;
  2428. }
  2429. function useModel(props, name, options) {
  2430. const i = getCurrentInstance();
  2431. if (options && options.local) {
  2432. const proxy = reactivity.ref(props[name]);
  2433. watch(
  2434. () => props[name],
  2435. (v) => proxy.value = v
  2436. );
  2437. watch(proxy, (value) => {
  2438. if (value !== props[name]) {
  2439. i.emit(`update:${name}`, value);
  2440. }
  2441. });
  2442. return proxy;
  2443. } else {
  2444. return {
  2445. __v_isRef: true,
  2446. get value() {
  2447. return props[name];
  2448. },
  2449. set value(value) {
  2450. i.emit(`update:${name}`, value);
  2451. }
  2452. };
  2453. }
  2454. }
  2455. function getContext() {
  2456. const i = getCurrentInstance();
  2457. return i.setupContext || (i.setupContext = createSetupContext(i));
  2458. }
  2459. function normalizePropsOrEmits(props) {
  2460. return shared.isArray(props) ? props.reduce(
  2461. (normalized, p) => (normalized[p] = null, normalized),
  2462. {}
  2463. ) : props;
  2464. }
  2465. function mergeDefaults(raw, defaults) {
  2466. const props = normalizePropsOrEmits(raw);
  2467. for (const key in defaults) {
  2468. if (key.startsWith("__skip"))
  2469. continue;
  2470. let opt = props[key];
  2471. if (opt) {
  2472. if (shared.isArray(opt) || shared.isFunction(opt)) {
  2473. opt = props[key] = { type: opt, default: defaults[key] };
  2474. } else {
  2475. opt.default = defaults[key];
  2476. }
  2477. } else if (opt === null) {
  2478. opt = props[key] = { default: defaults[key] };
  2479. } else ;
  2480. if (opt && defaults[`__skip_${key}`]) {
  2481. opt.skipFactory = true;
  2482. }
  2483. }
  2484. return props;
  2485. }
  2486. function mergeModels(a, b) {
  2487. if (!a || !b)
  2488. return a || b;
  2489. if (shared.isArray(a) && shared.isArray(b))
  2490. return a.concat(b);
  2491. return shared.extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  2492. }
  2493. function createPropsRestProxy(props, excludedKeys) {
  2494. const ret = {};
  2495. for (const key in props) {
  2496. if (!excludedKeys.includes(key)) {
  2497. Object.defineProperty(ret, key, {
  2498. enumerable: true,
  2499. get: () => props[key]
  2500. });
  2501. }
  2502. }
  2503. return ret;
  2504. }
  2505. function withAsyncContext(getAwaitable) {
  2506. const ctx = getCurrentInstance();
  2507. let awaitable = getAwaitable();
  2508. unsetCurrentInstance();
  2509. if (shared.isPromise(awaitable)) {
  2510. awaitable = awaitable.catch((e) => {
  2511. setCurrentInstance(ctx);
  2512. throw e;
  2513. });
  2514. }
  2515. return [awaitable, () => setCurrentInstance(ctx)];
  2516. }
  2517. let shouldCacheAccess = true;
  2518. function applyOptions(instance) {
  2519. const options = resolveMergedOptions(instance);
  2520. const publicThis = instance.proxy;
  2521. const ctx = instance.ctx;
  2522. shouldCacheAccess = false;
  2523. if (options.beforeCreate) {
  2524. callHook(options.beforeCreate, instance, "bc");
  2525. }
  2526. const {
  2527. // state
  2528. data: dataOptions,
  2529. computed: computedOptions,
  2530. methods,
  2531. watch: watchOptions,
  2532. provide: provideOptions,
  2533. inject: injectOptions,
  2534. // lifecycle
  2535. created,
  2536. beforeMount,
  2537. mounted,
  2538. beforeUpdate,
  2539. updated,
  2540. activated,
  2541. deactivated,
  2542. beforeDestroy,
  2543. beforeUnmount,
  2544. destroyed,
  2545. unmounted,
  2546. render,
  2547. renderTracked,
  2548. renderTriggered,
  2549. errorCaptured,
  2550. serverPrefetch,
  2551. // public API
  2552. expose,
  2553. inheritAttrs,
  2554. // assets
  2555. components,
  2556. directives,
  2557. filters
  2558. } = options;
  2559. const checkDuplicateProperties = null;
  2560. if (injectOptions) {
  2561. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  2562. }
  2563. if (methods) {
  2564. for (const key in methods) {
  2565. const methodHandler = methods[key];
  2566. if (shared.isFunction(methodHandler)) {
  2567. {
  2568. ctx[key] = methodHandler.bind(publicThis);
  2569. }
  2570. }
  2571. }
  2572. }
  2573. if (dataOptions) {
  2574. const data = dataOptions.call(publicThis, publicThis);
  2575. if (!shared.isObject(data)) ; else {
  2576. instance.data = reactivity.reactive(data);
  2577. }
  2578. }
  2579. shouldCacheAccess = true;
  2580. if (computedOptions) {
  2581. for (const key in computedOptions) {
  2582. const opt = computedOptions[key];
  2583. const get = shared.isFunction(opt) ? opt.bind(publicThis, publicThis) : shared.isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : shared.NOOP;
  2584. const set = !shared.isFunction(opt) && shared.isFunction(opt.set) ? opt.set.bind(publicThis) : shared.NOOP;
  2585. const c = computed({
  2586. get,
  2587. set
  2588. });
  2589. Object.defineProperty(ctx, key, {
  2590. enumerable: true,
  2591. configurable: true,
  2592. get: () => c.value,
  2593. set: (v) => c.value = v
  2594. });
  2595. }
  2596. }
  2597. if (watchOptions) {
  2598. for (const key in watchOptions) {
  2599. createWatcher(watchOptions[key], ctx, publicThis, key);
  2600. }
  2601. }
  2602. if (provideOptions) {
  2603. const provides = shared.isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  2604. Reflect.ownKeys(provides).forEach((key) => {
  2605. provide(key, provides[key]);
  2606. });
  2607. }
  2608. if (created) {
  2609. callHook(created, instance, "c");
  2610. }
  2611. function registerLifecycleHook(register, hook) {
  2612. if (shared.isArray(hook)) {
  2613. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  2614. } else if (hook) {
  2615. register(hook.bind(publicThis));
  2616. }
  2617. }
  2618. registerLifecycleHook(onBeforeMount, beforeMount);
  2619. registerLifecycleHook(onMounted, mounted);
  2620. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  2621. registerLifecycleHook(onUpdated, updated);
  2622. registerLifecycleHook(onActivated, activated);
  2623. registerLifecycleHook(onDeactivated, deactivated);
  2624. registerLifecycleHook(onErrorCaptured, errorCaptured);
  2625. registerLifecycleHook(onRenderTracked, renderTracked);
  2626. registerLifecycleHook(onRenderTriggered, renderTriggered);
  2627. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  2628. registerLifecycleHook(onUnmounted, unmounted);
  2629. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  2630. if (shared.isArray(expose)) {
  2631. if (expose.length) {
  2632. const exposed = instance.exposed || (instance.exposed = {});
  2633. expose.forEach((key) => {
  2634. Object.defineProperty(exposed, key, {
  2635. get: () => publicThis[key],
  2636. set: (val) => publicThis[key] = val
  2637. });
  2638. });
  2639. } else if (!instance.exposed) {
  2640. instance.exposed = {};
  2641. }
  2642. }
  2643. if (render && instance.render === shared.NOOP) {
  2644. instance.render = render;
  2645. }
  2646. if (inheritAttrs != null) {
  2647. instance.inheritAttrs = inheritAttrs;
  2648. }
  2649. if (components)
  2650. instance.components = components;
  2651. if (directives)
  2652. instance.directives = directives;
  2653. }
  2654. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared.NOOP) {
  2655. if (shared.isArray(injectOptions)) {
  2656. injectOptions = normalizeInject(injectOptions);
  2657. }
  2658. for (const key in injectOptions) {
  2659. const opt = injectOptions[key];
  2660. let injected;
  2661. if (shared.isObject(opt)) {
  2662. if ("default" in opt) {
  2663. injected = inject(
  2664. opt.from || key,
  2665. opt.default,
  2666. true
  2667. /* treat default function as factory */
  2668. );
  2669. } else {
  2670. injected = inject(opt.from || key);
  2671. }
  2672. } else {
  2673. injected = inject(opt);
  2674. }
  2675. if (reactivity.isRef(injected)) {
  2676. Object.defineProperty(ctx, key, {
  2677. enumerable: true,
  2678. configurable: true,
  2679. get: () => injected.value,
  2680. set: (v) => injected.value = v
  2681. });
  2682. } else {
  2683. ctx[key] = injected;
  2684. }
  2685. }
  2686. }
  2687. function callHook(hook, instance, type) {
  2688. callWithAsyncErrorHandling(
  2689. shared.isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  2690. instance,
  2691. type
  2692. );
  2693. }
  2694. function createWatcher(raw, ctx, publicThis, key) {
  2695. const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  2696. if (shared.isString(raw)) {
  2697. const handler = ctx[raw];
  2698. if (shared.isFunction(handler)) {
  2699. watch(getter, handler);
  2700. }
  2701. } else if (shared.isFunction(raw)) {
  2702. watch(getter, raw.bind(publicThis));
  2703. } else if (shared.isObject(raw)) {
  2704. if (shared.isArray(raw)) {
  2705. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  2706. } else {
  2707. const handler = shared.isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  2708. if (shared.isFunction(handler)) {
  2709. watch(getter, handler, raw);
  2710. }
  2711. }
  2712. } else ;
  2713. }
  2714. function resolveMergedOptions(instance) {
  2715. const base = instance.type;
  2716. const { mixins, extends: extendsOptions } = base;
  2717. const {
  2718. mixins: globalMixins,
  2719. optionsCache: cache,
  2720. config: { optionMergeStrategies }
  2721. } = instance.appContext;
  2722. const cached = cache.get(base);
  2723. let resolved;
  2724. if (cached) {
  2725. resolved = cached;
  2726. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  2727. {
  2728. resolved = base;
  2729. }
  2730. } else {
  2731. resolved = {};
  2732. if (globalMixins.length) {
  2733. globalMixins.forEach(
  2734. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  2735. );
  2736. }
  2737. mergeOptions(resolved, base, optionMergeStrategies);
  2738. }
  2739. if (shared.isObject(base)) {
  2740. cache.set(base, resolved);
  2741. }
  2742. return resolved;
  2743. }
  2744. function mergeOptions(to, from, strats, asMixin = false) {
  2745. const { mixins, extends: extendsOptions } = from;
  2746. if (extendsOptions) {
  2747. mergeOptions(to, extendsOptions, strats, true);
  2748. }
  2749. if (mixins) {
  2750. mixins.forEach(
  2751. (m) => mergeOptions(to, m, strats, true)
  2752. );
  2753. }
  2754. for (const key in from) {
  2755. if (asMixin && key === "expose") ; else {
  2756. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  2757. to[key] = strat ? strat(to[key], from[key]) : from[key];
  2758. }
  2759. }
  2760. return to;
  2761. }
  2762. const internalOptionMergeStrats = {
  2763. data: mergeDataFn,
  2764. props: mergeEmitsOrPropsOptions,
  2765. emits: mergeEmitsOrPropsOptions,
  2766. // objects
  2767. methods: mergeObjectOptions,
  2768. computed: mergeObjectOptions,
  2769. // lifecycle
  2770. beforeCreate: mergeAsArray,
  2771. created: mergeAsArray,
  2772. beforeMount: mergeAsArray,
  2773. mounted: mergeAsArray,
  2774. beforeUpdate: mergeAsArray,
  2775. updated: mergeAsArray,
  2776. beforeDestroy: mergeAsArray,
  2777. beforeUnmount: mergeAsArray,
  2778. destroyed: mergeAsArray,
  2779. unmounted: mergeAsArray,
  2780. activated: mergeAsArray,
  2781. deactivated: mergeAsArray,
  2782. errorCaptured: mergeAsArray,
  2783. serverPrefetch: mergeAsArray,
  2784. // assets
  2785. components: mergeObjectOptions,
  2786. directives: mergeObjectOptions,
  2787. // watch
  2788. watch: mergeWatchOptions,
  2789. // provide / inject
  2790. provide: mergeDataFn,
  2791. inject: mergeInject
  2792. };
  2793. function mergeDataFn(to, from) {
  2794. if (!from) {
  2795. return to;
  2796. }
  2797. if (!to) {
  2798. return from;
  2799. }
  2800. return function mergedDataFn() {
  2801. return (shared.extend)(
  2802. shared.isFunction(to) ? to.call(this, this) : to,
  2803. shared.isFunction(from) ? from.call(this, this) : from
  2804. );
  2805. };
  2806. }
  2807. function mergeInject(to, from) {
  2808. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  2809. }
  2810. function normalizeInject(raw) {
  2811. if (shared.isArray(raw)) {
  2812. const res = {};
  2813. for (let i = 0; i < raw.length; i++) {
  2814. res[raw[i]] = raw[i];
  2815. }
  2816. return res;
  2817. }
  2818. return raw;
  2819. }
  2820. function mergeAsArray(to, from) {
  2821. return to ? [...new Set([].concat(to, from))] : from;
  2822. }
  2823. function mergeObjectOptions(to, from) {
  2824. return to ? shared.extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  2825. }
  2826. function mergeEmitsOrPropsOptions(to, from) {
  2827. if (to) {
  2828. if (shared.isArray(to) && shared.isArray(from)) {
  2829. return [.../* @__PURE__ */ new Set([...to, ...from])];
  2830. }
  2831. return shared.extend(
  2832. /* @__PURE__ */ Object.create(null),
  2833. normalizePropsOrEmits(to),
  2834. normalizePropsOrEmits(from != null ? from : {})
  2835. );
  2836. } else {
  2837. return from;
  2838. }
  2839. }
  2840. function mergeWatchOptions(to, from) {
  2841. if (!to)
  2842. return from;
  2843. if (!from)
  2844. return to;
  2845. const merged = shared.extend(/* @__PURE__ */ Object.create(null), to);
  2846. for (const key in from) {
  2847. merged[key] = mergeAsArray(to[key], from[key]);
  2848. }
  2849. return merged;
  2850. }
  2851. function createAppContext() {
  2852. return {
  2853. app: null,
  2854. config: {
  2855. isNativeTag: shared.NO,
  2856. performance: false,
  2857. globalProperties: {},
  2858. optionMergeStrategies: {},
  2859. errorHandler: void 0,
  2860. warnHandler: void 0,
  2861. compilerOptions: {}
  2862. },
  2863. mixins: [],
  2864. components: {},
  2865. directives: {},
  2866. provides: /* @__PURE__ */ Object.create(null),
  2867. optionsCache: /* @__PURE__ */ new WeakMap(),
  2868. propsCache: /* @__PURE__ */ new WeakMap(),
  2869. emitsCache: /* @__PURE__ */ new WeakMap()
  2870. };
  2871. }
  2872. let uid$1 = 0;
  2873. function createAppAPI(render, hydrate) {
  2874. return function createApp(rootComponent, rootProps = null) {
  2875. if (!shared.isFunction(rootComponent)) {
  2876. rootComponent = shared.extend({}, rootComponent);
  2877. }
  2878. if (rootProps != null && !shared.isObject(rootProps)) {
  2879. rootProps = null;
  2880. }
  2881. const context = createAppContext();
  2882. const installedPlugins = /* @__PURE__ */ new WeakSet();
  2883. let isMounted = false;
  2884. const app = context.app = {
  2885. _uid: uid$1++,
  2886. _component: rootComponent,
  2887. _props: rootProps,
  2888. _container: null,
  2889. _context: context,
  2890. _instance: null,
  2891. version,
  2892. get config() {
  2893. return context.config;
  2894. },
  2895. set config(v) {
  2896. },
  2897. use(plugin, ...options) {
  2898. if (installedPlugins.has(plugin)) ; else if (plugin && shared.isFunction(plugin.install)) {
  2899. installedPlugins.add(plugin);
  2900. plugin.install(app, ...options);
  2901. } else if (shared.isFunction(plugin)) {
  2902. installedPlugins.add(plugin);
  2903. plugin(app, ...options);
  2904. } else ;
  2905. return app;
  2906. },
  2907. mixin(mixin) {
  2908. {
  2909. if (!context.mixins.includes(mixin)) {
  2910. context.mixins.push(mixin);
  2911. }
  2912. }
  2913. return app;
  2914. },
  2915. component(name, component) {
  2916. if (!component) {
  2917. return context.components[name];
  2918. }
  2919. context.components[name] = component;
  2920. return app;
  2921. },
  2922. directive(name, directive) {
  2923. if (!directive) {
  2924. return context.directives[name];
  2925. }
  2926. context.directives[name] = directive;
  2927. return app;
  2928. },
  2929. mount(rootContainer, isHydrate, isSVG) {
  2930. if (!isMounted) {
  2931. const vnode = createVNode(rootComponent, rootProps);
  2932. vnode.appContext = context;
  2933. if (isHydrate && hydrate) {
  2934. hydrate(vnode, rootContainer);
  2935. } else {
  2936. render(vnode, rootContainer, isSVG);
  2937. }
  2938. isMounted = true;
  2939. app._container = rootContainer;
  2940. rootContainer.__vue_app__ = app;
  2941. return getExposeProxy(vnode.component) || vnode.component.proxy;
  2942. }
  2943. },
  2944. unmount() {
  2945. if (isMounted) {
  2946. render(null, app._container);
  2947. delete app._container.__vue_app__;
  2948. }
  2949. },
  2950. provide(key, value) {
  2951. context.provides[key] = value;
  2952. return app;
  2953. },
  2954. runWithContext(fn) {
  2955. currentApp = app;
  2956. try {
  2957. return fn();
  2958. } finally {
  2959. currentApp = null;
  2960. }
  2961. }
  2962. };
  2963. return app;
  2964. };
  2965. }
  2966. let currentApp = null;
  2967. function provide(key, value) {
  2968. if (!currentInstance) ; else {
  2969. let provides = currentInstance.provides;
  2970. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  2971. if (parentProvides === provides) {
  2972. provides = currentInstance.provides = Object.create(parentProvides);
  2973. }
  2974. provides[key] = value;
  2975. }
  2976. }
  2977. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  2978. const instance = currentInstance || currentRenderingInstance;
  2979. if (instance || currentApp) {
  2980. const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
  2981. if (provides && key in provides) {
  2982. return provides[key];
  2983. } else if (arguments.length > 1) {
  2984. return treatDefaultAsFactory && shared.isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  2985. } else ;
  2986. }
  2987. }
  2988. function hasInjectionContext() {
  2989. return !!(currentInstance || currentRenderingInstance || currentApp);
  2990. }
  2991. function initProps(instance, rawProps, isStateful, isSSR = false) {
  2992. const props = {};
  2993. const attrs = {};
  2994. shared.def(attrs, InternalObjectKey, 1);
  2995. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  2996. setFullProps(instance, rawProps, props, attrs);
  2997. for (const key in instance.propsOptions[0]) {
  2998. if (!(key in props)) {
  2999. props[key] = void 0;
  3000. }
  3001. }
  3002. if (isStateful) {
  3003. instance.props = isSSR ? props : reactivity.shallowReactive(props);
  3004. } else {
  3005. if (!instance.type.props) {
  3006. instance.props = attrs;
  3007. } else {
  3008. instance.props = props;
  3009. }
  3010. }
  3011. instance.attrs = attrs;
  3012. }
  3013. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  3014. const {
  3015. props,
  3016. attrs,
  3017. vnode: { patchFlag }
  3018. } = instance;
  3019. const rawCurrentProps = reactivity.toRaw(props);
  3020. const [options] = instance.propsOptions;
  3021. let hasAttrsChanged = false;
  3022. if (
  3023. // always force full diff in dev
  3024. // - #1942 if hmr is enabled with sfc component
  3025. // - vite#872 non-sfc component used by sfc component
  3026. (optimized || patchFlag > 0) && !(patchFlag & 16)
  3027. ) {
  3028. if (patchFlag & 8) {
  3029. const propsToUpdate = instance.vnode.dynamicProps;
  3030. for (let i = 0; i < propsToUpdate.length; i++) {
  3031. let key = propsToUpdate[i];
  3032. if (isEmitListener(instance.emitsOptions, key)) {
  3033. continue;
  3034. }
  3035. const value = rawProps[key];
  3036. if (options) {
  3037. if (shared.hasOwn(attrs, key)) {
  3038. if (value !== attrs[key]) {
  3039. attrs[key] = value;
  3040. hasAttrsChanged = true;
  3041. }
  3042. } else {
  3043. const camelizedKey = shared.camelize(key);
  3044. props[camelizedKey] = resolvePropValue(
  3045. options,
  3046. rawCurrentProps,
  3047. camelizedKey,
  3048. value,
  3049. instance,
  3050. false
  3051. /* isAbsent */
  3052. );
  3053. }
  3054. } else {
  3055. if (value !== attrs[key]) {
  3056. attrs[key] = value;
  3057. hasAttrsChanged = true;
  3058. }
  3059. }
  3060. }
  3061. }
  3062. } else {
  3063. if (setFullProps(instance, rawProps, props, attrs)) {
  3064. hasAttrsChanged = true;
  3065. }
  3066. let kebabKey;
  3067. for (const key in rawCurrentProps) {
  3068. if (!rawProps || // for camelCase
  3069. !shared.hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  3070. // and converted to camelCase (#955)
  3071. ((kebabKey = shared.hyphenate(key)) === key || !shared.hasOwn(rawProps, kebabKey))) {
  3072. if (options) {
  3073. if (rawPrevProps && // for camelCase
  3074. (rawPrevProps[key] !== void 0 || // for kebab-case
  3075. rawPrevProps[kebabKey] !== void 0)) {
  3076. props[key] = resolvePropValue(
  3077. options,
  3078. rawCurrentProps,
  3079. key,
  3080. void 0,
  3081. instance,
  3082. true
  3083. /* isAbsent */
  3084. );
  3085. }
  3086. } else {
  3087. delete props[key];
  3088. }
  3089. }
  3090. }
  3091. if (attrs !== rawCurrentProps) {
  3092. for (const key in attrs) {
  3093. if (!rawProps || !shared.hasOwn(rawProps, key) && true) {
  3094. delete attrs[key];
  3095. hasAttrsChanged = true;
  3096. }
  3097. }
  3098. }
  3099. }
  3100. if (hasAttrsChanged) {
  3101. reactivity.trigger(instance, "set", "$attrs");
  3102. }
  3103. }
  3104. function setFullProps(instance, rawProps, props, attrs) {
  3105. const [options, needCastKeys] = instance.propsOptions;
  3106. let hasAttrsChanged = false;
  3107. let rawCastValues;
  3108. if (rawProps) {
  3109. for (let key in rawProps) {
  3110. if (shared.isReservedProp(key)) {
  3111. continue;
  3112. }
  3113. const value = rawProps[key];
  3114. let camelKey;
  3115. if (options && shared.hasOwn(options, camelKey = shared.camelize(key))) {
  3116. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  3117. props[camelKey] = value;
  3118. } else {
  3119. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  3120. }
  3121. } else if (!isEmitListener(instance.emitsOptions, key)) {
  3122. if (!(key in attrs) || value !== attrs[key]) {
  3123. attrs[key] = value;
  3124. hasAttrsChanged = true;
  3125. }
  3126. }
  3127. }
  3128. }
  3129. if (needCastKeys) {
  3130. const rawCurrentProps = reactivity.toRaw(props);
  3131. const castValues = rawCastValues || shared.EMPTY_OBJ;
  3132. for (let i = 0; i < needCastKeys.length; i++) {
  3133. const key = needCastKeys[i];
  3134. props[key] = resolvePropValue(
  3135. options,
  3136. rawCurrentProps,
  3137. key,
  3138. castValues[key],
  3139. instance,
  3140. !shared.hasOwn(castValues, key)
  3141. );
  3142. }
  3143. }
  3144. return hasAttrsChanged;
  3145. }
  3146. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  3147. const opt = options[key];
  3148. if (opt != null) {
  3149. const hasDefault = shared.hasOwn(opt, "default");
  3150. if (hasDefault && value === void 0) {
  3151. const defaultValue = opt.default;
  3152. if (opt.type !== Function && !opt.skipFactory && shared.isFunction(defaultValue)) {
  3153. const { propsDefaults } = instance;
  3154. if (key in propsDefaults) {
  3155. value = propsDefaults[key];
  3156. } else {
  3157. setCurrentInstance(instance);
  3158. value = propsDefaults[key] = defaultValue.call(
  3159. null,
  3160. props
  3161. );
  3162. unsetCurrentInstance();
  3163. }
  3164. } else {
  3165. value = defaultValue;
  3166. }
  3167. }
  3168. if (opt[0 /* shouldCast */]) {
  3169. if (isAbsent && !hasDefault) {
  3170. value = false;
  3171. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === shared.hyphenate(key))) {
  3172. value = true;
  3173. }
  3174. }
  3175. }
  3176. return value;
  3177. }
  3178. function normalizePropsOptions(comp, appContext, asMixin = false) {
  3179. const cache = appContext.propsCache;
  3180. const cached = cache.get(comp);
  3181. if (cached) {
  3182. return cached;
  3183. }
  3184. const raw = comp.props;
  3185. const normalized = {};
  3186. const needCastKeys = [];
  3187. let hasExtends = false;
  3188. if (!shared.isFunction(comp)) {
  3189. const extendProps = (raw2) => {
  3190. hasExtends = true;
  3191. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  3192. shared.extend(normalized, props);
  3193. if (keys)
  3194. needCastKeys.push(...keys);
  3195. };
  3196. if (!asMixin && appContext.mixins.length) {
  3197. appContext.mixins.forEach(extendProps);
  3198. }
  3199. if (comp.extends) {
  3200. extendProps(comp.extends);
  3201. }
  3202. if (comp.mixins) {
  3203. comp.mixins.forEach(extendProps);
  3204. }
  3205. }
  3206. if (!raw && !hasExtends) {
  3207. if (shared.isObject(comp)) {
  3208. cache.set(comp, shared.EMPTY_ARR);
  3209. }
  3210. return shared.EMPTY_ARR;
  3211. }
  3212. if (shared.isArray(raw)) {
  3213. for (let i = 0; i < raw.length; i++) {
  3214. const normalizedKey = shared.camelize(raw[i]);
  3215. if (validatePropName(normalizedKey)) {
  3216. normalized[normalizedKey] = shared.EMPTY_OBJ;
  3217. }
  3218. }
  3219. } else if (raw) {
  3220. for (const key in raw) {
  3221. const normalizedKey = shared.camelize(key);
  3222. if (validatePropName(normalizedKey)) {
  3223. const opt = raw[key];
  3224. const prop = normalized[normalizedKey] = shared.isArray(opt) || shared.isFunction(opt) ? { type: opt } : shared.extend({}, opt);
  3225. if (prop) {
  3226. const booleanIndex = getTypeIndex(Boolean, prop.type);
  3227. const stringIndex = getTypeIndex(String, prop.type);
  3228. prop[0 /* shouldCast */] = booleanIndex > -1;
  3229. prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
  3230. if (booleanIndex > -1 || shared.hasOwn(prop, "default")) {
  3231. needCastKeys.push(normalizedKey);
  3232. }
  3233. }
  3234. }
  3235. }
  3236. }
  3237. const res = [normalized, needCastKeys];
  3238. if (shared.isObject(comp)) {
  3239. cache.set(comp, res);
  3240. }
  3241. return res;
  3242. }
  3243. function validatePropName(key) {
  3244. if (key[0] !== "$") {
  3245. return true;
  3246. }
  3247. return false;
  3248. }
  3249. function getType(ctor) {
  3250. const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
  3251. return match ? match[2] : ctor === null ? "null" : "";
  3252. }
  3253. function isSameType(a, b) {
  3254. return getType(a) === getType(b);
  3255. }
  3256. function getTypeIndex(type, expectedTypes) {
  3257. if (shared.isArray(expectedTypes)) {
  3258. return expectedTypes.findIndex((t) => isSameType(t, type));
  3259. } else if (shared.isFunction(expectedTypes)) {
  3260. return isSameType(expectedTypes, type) ? 0 : -1;
  3261. }
  3262. return -1;
  3263. }
  3264. const isInternalKey = (key) => key[0] === "_" || key === "$stable";
  3265. const normalizeSlotValue = (value) => shared.isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  3266. const normalizeSlot = (key, rawSlot, ctx) => {
  3267. if (rawSlot._n) {
  3268. return rawSlot;
  3269. }
  3270. const normalized = withCtx((...args) => {
  3271. if (false) ;
  3272. return normalizeSlotValue(rawSlot(...args));
  3273. }, ctx);
  3274. normalized._c = false;
  3275. return normalized;
  3276. };
  3277. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  3278. const ctx = rawSlots._ctx;
  3279. for (const key in rawSlots) {
  3280. if (isInternalKey(key))
  3281. continue;
  3282. const value = rawSlots[key];
  3283. if (shared.isFunction(value)) {
  3284. slots[key] = normalizeSlot(key, value, ctx);
  3285. } else if (value != null) {
  3286. const normalized = normalizeSlotValue(value);
  3287. slots[key] = () => normalized;
  3288. }
  3289. }
  3290. };
  3291. const normalizeVNodeSlots = (instance, children) => {
  3292. const normalized = normalizeSlotValue(children);
  3293. instance.slots.default = () => normalized;
  3294. };
  3295. const initSlots = (instance, children) => {
  3296. if (instance.vnode.shapeFlag & 32) {
  3297. const type = children._;
  3298. if (type) {
  3299. instance.slots = reactivity.toRaw(children);
  3300. shared.def(children, "_", type);
  3301. } else {
  3302. normalizeObjectSlots(
  3303. children,
  3304. instance.slots = {});
  3305. }
  3306. } else {
  3307. instance.slots = {};
  3308. if (children) {
  3309. normalizeVNodeSlots(instance, children);
  3310. }
  3311. }
  3312. shared.def(instance.slots, InternalObjectKey, 1);
  3313. };
  3314. const updateSlots = (instance, children, optimized) => {
  3315. const { vnode, slots } = instance;
  3316. let needDeletionCheck = true;
  3317. let deletionComparisonTarget = shared.EMPTY_OBJ;
  3318. if (vnode.shapeFlag & 32) {
  3319. const type = children._;
  3320. if (type) {
  3321. if (optimized && type === 1) {
  3322. needDeletionCheck = false;
  3323. } else {
  3324. shared.extend(slots, children);
  3325. if (!optimized && type === 1) {
  3326. delete slots._;
  3327. }
  3328. }
  3329. } else {
  3330. needDeletionCheck = !children.$stable;
  3331. normalizeObjectSlots(children, slots);
  3332. }
  3333. deletionComparisonTarget = children;
  3334. } else if (children) {
  3335. normalizeVNodeSlots(instance, children);
  3336. deletionComparisonTarget = { default: 1 };
  3337. }
  3338. if (needDeletionCheck) {
  3339. for (const key in slots) {
  3340. if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
  3341. delete slots[key];
  3342. }
  3343. }
  3344. }
  3345. };
  3346. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  3347. if (shared.isArray(rawRef)) {
  3348. rawRef.forEach(
  3349. (r, i) => setRef(
  3350. r,
  3351. oldRawRef && (shared.isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  3352. parentSuspense,
  3353. vnode,
  3354. isUnmount
  3355. )
  3356. );
  3357. return;
  3358. }
  3359. if (isAsyncWrapper(vnode) && !isUnmount) {
  3360. return;
  3361. }
  3362. const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
  3363. const value = isUnmount ? null : refValue;
  3364. const { i: owner, r: ref } = rawRef;
  3365. const oldRef = oldRawRef && oldRawRef.r;
  3366. const refs = owner.refs === shared.EMPTY_OBJ ? owner.refs = {} : owner.refs;
  3367. const setupState = owner.setupState;
  3368. if (oldRef != null && oldRef !== ref) {
  3369. if (shared.isString(oldRef)) {
  3370. refs[oldRef] = null;
  3371. if (shared.hasOwn(setupState, oldRef)) {
  3372. setupState[oldRef] = null;
  3373. }
  3374. } else if (reactivity.isRef(oldRef)) {
  3375. oldRef.value = null;
  3376. }
  3377. }
  3378. if (shared.isFunction(ref)) {
  3379. callWithErrorHandling(ref, owner, 12, [value, refs]);
  3380. } else {
  3381. const _isString = shared.isString(ref);
  3382. const _isRef = reactivity.isRef(ref);
  3383. if (_isString || _isRef) {
  3384. const doSet = () => {
  3385. if (rawRef.f) {
  3386. const existing = _isString ? shared.hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
  3387. if (isUnmount) {
  3388. shared.isArray(existing) && shared.remove(existing, refValue);
  3389. } else {
  3390. if (!shared.isArray(existing)) {
  3391. if (_isString) {
  3392. refs[ref] = [refValue];
  3393. if (shared.hasOwn(setupState, ref)) {
  3394. setupState[ref] = refs[ref];
  3395. }
  3396. } else {
  3397. ref.value = [refValue];
  3398. if (rawRef.k)
  3399. refs[rawRef.k] = ref.value;
  3400. }
  3401. } else if (!existing.includes(refValue)) {
  3402. existing.push(refValue);
  3403. }
  3404. }
  3405. } else if (_isString) {
  3406. refs[ref] = value;
  3407. if (shared.hasOwn(setupState, ref)) {
  3408. setupState[ref] = value;
  3409. }
  3410. } else if (_isRef) {
  3411. ref.value = value;
  3412. if (rawRef.k)
  3413. refs[rawRef.k] = value;
  3414. } else ;
  3415. };
  3416. if (value) {
  3417. doSet.id = -1;
  3418. queuePostRenderEffect(doSet, parentSuspense);
  3419. } else {
  3420. doSet();
  3421. }
  3422. }
  3423. }
  3424. }
  3425. let hasMismatch = false;
  3426. const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== "foreignObject";
  3427. const isComment = (node) => node.nodeType === 8 /* COMMENT */;
  3428. function createHydrationFunctions(rendererInternals) {
  3429. const {
  3430. mt: mountComponent,
  3431. p: patch,
  3432. o: {
  3433. patchProp,
  3434. createText,
  3435. nextSibling,
  3436. parentNode,
  3437. remove,
  3438. insert,
  3439. createComment
  3440. }
  3441. } = rendererInternals;
  3442. const hydrate = (vnode, container) => {
  3443. if (!container.hasChildNodes()) {
  3444. patch(null, vnode, container);
  3445. flushPostFlushCbs();
  3446. container._vnode = vnode;
  3447. return;
  3448. }
  3449. hasMismatch = false;
  3450. hydrateNode(container.firstChild, vnode, null, null, null);
  3451. flushPostFlushCbs();
  3452. container._vnode = vnode;
  3453. if (hasMismatch && true) {
  3454. console.error(`Hydration completed but contains mismatches.`);
  3455. }
  3456. };
  3457. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  3458. const isFragmentStart = isComment(node) && node.data === "[";
  3459. const onMismatch = () => handleMismatch(
  3460. node,
  3461. vnode,
  3462. parentComponent,
  3463. parentSuspense,
  3464. slotScopeIds,
  3465. isFragmentStart
  3466. );
  3467. const { type, ref, shapeFlag, patchFlag } = vnode;
  3468. let domType = node.nodeType;
  3469. vnode.el = node;
  3470. if (patchFlag === -2) {
  3471. optimized = false;
  3472. vnode.dynamicChildren = null;
  3473. }
  3474. let nextNode = null;
  3475. switch (type) {
  3476. case Text:
  3477. if (domType !== 3 /* TEXT */) {
  3478. if (vnode.children === "") {
  3479. insert(vnode.el = createText(""), parentNode(node), node);
  3480. nextNode = node;
  3481. } else {
  3482. nextNode = onMismatch();
  3483. }
  3484. } else {
  3485. if (node.data !== vnode.children) {
  3486. hasMismatch = true;
  3487. node.data = vnode.children;
  3488. }
  3489. nextNode = nextSibling(node);
  3490. }
  3491. break;
  3492. case Comment:
  3493. if (isTemplateNode(node)) {
  3494. nextNode = nextSibling(node);
  3495. replaceNode(
  3496. vnode.el = node.content.firstChild,
  3497. node,
  3498. parentComponent
  3499. );
  3500. } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
  3501. nextNode = onMismatch();
  3502. } else {
  3503. nextNode = nextSibling(node);
  3504. }
  3505. break;
  3506. case Static:
  3507. if (isFragmentStart) {
  3508. node = nextSibling(node);
  3509. domType = node.nodeType;
  3510. }
  3511. if (domType === 1 /* ELEMENT */ || domType === 3 /* TEXT */) {
  3512. nextNode = node;
  3513. const needToAdoptContent = !vnode.children.length;
  3514. for (let i = 0; i < vnode.staticCount; i++) {
  3515. if (needToAdoptContent)
  3516. vnode.children += nextNode.nodeType === 1 /* ELEMENT */ ? nextNode.outerHTML : nextNode.data;
  3517. if (i === vnode.staticCount - 1) {
  3518. vnode.anchor = nextNode;
  3519. }
  3520. nextNode = nextSibling(nextNode);
  3521. }
  3522. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  3523. } else {
  3524. onMismatch();
  3525. }
  3526. break;
  3527. case Fragment:
  3528. if (!isFragmentStart) {
  3529. nextNode = onMismatch();
  3530. } else {
  3531. nextNode = hydrateFragment(
  3532. node,
  3533. vnode,
  3534. parentComponent,
  3535. parentSuspense,
  3536. slotScopeIds,
  3537. optimized
  3538. );
  3539. }
  3540. break;
  3541. default:
  3542. if (shapeFlag & 1) {
  3543. if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
  3544. nextNode = onMismatch();
  3545. } else {
  3546. nextNode = hydrateElement(
  3547. node,
  3548. vnode,
  3549. parentComponent,
  3550. parentSuspense,
  3551. slotScopeIds,
  3552. optimized
  3553. );
  3554. }
  3555. } else if (shapeFlag & 6) {
  3556. vnode.slotScopeIds = slotScopeIds;
  3557. const container = parentNode(node);
  3558. if (isFragmentStart) {
  3559. nextNode = locateClosingAnchor(node);
  3560. } else if (isComment(node) && node.data === "teleport start") {
  3561. nextNode = locateClosingAnchor(node, node.data, "teleport end");
  3562. } else {
  3563. nextNode = nextSibling(node);
  3564. }
  3565. mountComponent(
  3566. vnode,
  3567. container,
  3568. null,
  3569. parentComponent,
  3570. parentSuspense,
  3571. isSVGContainer(container),
  3572. optimized
  3573. );
  3574. if (isAsyncWrapper(vnode)) {
  3575. let subTree;
  3576. if (isFragmentStart) {
  3577. subTree = createVNode(Fragment);
  3578. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  3579. } else {
  3580. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  3581. }
  3582. subTree.el = node;
  3583. vnode.component.subTree = subTree;
  3584. }
  3585. } else if (shapeFlag & 64) {
  3586. if (domType !== 8 /* COMMENT */) {
  3587. nextNode = onMismatch();
  3588. } else {
  3589. nextNode = vnode.type.hydrate(
  3590. node,
  3591. vnode,
  3592. parentComponent,
  3593. parentSuspense,
  3594. slotScopeIds,
  3595. optimized,
  3596. rendererInternals,
  3597. hydrateChildren
  3598. );
  3599. }
  3600. } else if (shapeFlag & 128) {
  3601. nextNode = vnode.type.hydrate(
  3602. node,
  3603. vnode,
  3604. parentComponent,
  3605. parentSuspense,
  3606. isSVGContainer(parentNode(node)),
  3607. slotScopeIds,
  3608. optimized,
  3609. rendererInternals,
  3610. hydrateNode
  3611. );
  3612. } else ;
  3613. }
  3614. if (ref != null) {
  3615. setRef(ref, null, parentSuspense, vnode);
  3616. }
  3617. return nextNode;
  3618. };
  3619. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  3620. optimized = optimized || !!vnode.dynamicChildren;
  3621. const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
  3622. const forcePatch = type === "input" || type === "option";
  3623. if (forcePatch || patchFlag !== -1) {
  3624. if (dirs) {
  3625. invokeDirectiveHook(vnode, null, parentComponent, "created");
  3626. }
  3627. if (props) {
  3628. if (forcePatch || !optimized || patchFlag & (16 | 32)) {
  3629. for (const key in props) {
  3630. if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
  3631. key[0] === ".") {
  3632. patchProp(
  3633. el,
  3634. key,
  3635. null,
  3636. props[key],
  3637. false,
  3638. void 0,
  3639. parentComponent
  3640. );
  3641. }
  3642. }
  3643. } else if (props.onClick) {
  3644. patchProp(
  3645. el,
  3646. "onClick",
  3647. null,
  3648. props.onClick,
  3649. false,
  3650. void 0,
  3651. parentComponent
  3652. );
  3653. }
  3654. }
  3655. let vnodeHooks;
  3656. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  3657. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  3658. }
  3659. let needCallTransitionHooks = false;
  3660. if (isTemplateNode(el)) {
  3661. needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
  3662. const content = el.content.firstChild;
  3663. if (needCallTransitionHooks) {
  3664. transition.beforeEnter(content);
  3665. }
  3666. replaceNode(content, el, parentComponent);
  3667. vnode.el = el = content;
  3668. }
  3669. if (dirs) {
  3670. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  3671. }
  3672. if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
  3673. queueEffectWithSuspense(() => {
  3674. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  3675. needCallTransitionHooks && transition.enter(el);
  3676. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  3677. }, parentSuspense);
  3678. }
  3679. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  3680. !(props && (props.innerHTML || props.textContent))) {
  3681. let next = hydrateChildren(
  3682. el.firstChild,
  3683. vnode,
  3684. el,
  3685. parentComponent,
  3686. parentSuspense,
  3687. slotScopeIds,
  3688. optimized
  3689. );
  3690. while (next) {
  3691. hasMismatch = true;
  3692. const cur = next;
  3693. next = next.nextSibling;
  3694. remove(cur);
  3695. }
  3696. } else if (shapeFlag & 8) {
  3697. if (el.textContent !== vnode.children) {
  3698. hasMismatch = true;
  3699. el.textContent = vnode.children;
  3700. }
  3701. }
  3702. }
  3703. return el.nextSibling;
  3704. };
  3705. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  3706. optimized = optimized || !!parentVNode.dynamicChildren;
  3707. const children = parentVNode.children;
  3708. const l = children.length;
  3709. for (let i = 0; i < l; i++) {
  3710. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  3711. if (node) {
  3712. node = hydrateNode(
  3713. node,
  3714. vnode,
  3715. parentComponent,
  3716. parentSuspense,
  3717. slotScopeIds,
  3718. optimized
  3719. );
  3720. } else if (vnode.type === Text && !vnode.children) {
  3721. continue;
  3722. } else {
  3723. hasMismatch = true;
  3724. patch(
  3725. null,
  3726. vnode,
  3727. container,
  3728. null,
  3729. parentComponent,
  3730. parentSuspense,
  3731. isSVGContainer(container),
  3732. slotScopeIds
  3733. );
  3734. }
  3735. }
  3736. return node;
  3737. };
  3738. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  3739. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  3740. if (fragmentSlotScopeIds) {
  3741. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  3742. }
  3743. const container = parentNode(node);
  3744. const next = hydrateChildren(
  3745. nextSibling(node),
  3746. vnode,
  3747. container,
  3748. parentComponent,
  3749. parentSuspense,
  3750. slotScopeIds,
  3751. optimized
  3752. );
  3753. if (next && isComment(next) && next.data === "]") {
  3754. return nextSibling(vnode.anchor = next);
  3755. } else {
  3756. hasMismatch = true;
  3757. insert(vnode.anchor = createComment(`]`), container, next);
  3758. return next;
  3759. }
  3760. };
  3761. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  3762. hasMismatch = true;
  3763. vnode.el = null;
  3764. if (isFragment) {
  3765. const end = locateClosingAnchor(node);
  3766. while (true) {
  3767. const next2 = nextSibling(node);
  3768. if (next2 && next2 !== end) {
  3769. remove(next2);
  3770. } else {
  3771. break;
  3772. }
  3773. }
  3774. }
  3775. const next = nextSibling(node);
  3776. const container = parentNode(node);
  3777. remove(node);
  3778. patch(
  3779. null,
  3780. vnode,
  3781. container,
  3782. next,
  3783. parentComponent,
  3784. parentSuspense,
  3785. isSVGContainer(container),
  3786. slotScopeIds
  3787. );
  3788. return next;
  3789. };
  3790. const locateClosingAnchor = (node, open = "[", close = "]") => {
  3791. let match = 0;
  3792. while (node) {
  3793. node = nextSibling(node);
  3794. if (node && isComment(node)) {
  3795. if (node.data === open)
  3796. match++;
  3797. if (node.data === close) {
  3798. if (match === 0) {
  3799. return nextSibling(node);
  3800. } else {
  3801. match--;
  3802. }
  3803. }
  3804. }
  3805. }
  3806. return node;
  3807. };
  3808. const replaceNode = (newNode, oldNode, parentComponent) => {
  3809. const parentNode2 = oldNode.parentNode;
  3810. if (parentNode2) {
  3811. parentNode2.replaceChild(newNode, oldNode);
  3812. }
  3813. let parent = parentComponent;
  3814. while (parent) {
  3815. if (parent.vnode.el === oldNode) {
  3816. parent.vnode.el = parent.subTree.el = newNode;
  3817. }
  3818. parent = parent.parent;
  3819. }
  3820. };
  3821. const isTemplateNode = (node) => {
  3822. return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
  3823. };
  3824. return [hydrate, hydrateNode];
  3825. }
  3826. const queuePostRenderEffect = queueEffectWithSuspense ;
  3827. function createRenderer(options) {
  3828. return baseCreateRenderer(options);
  3829. }
  3830. function createHydrationRenderer(options) {
  3831. return baseCreateRenderer(options, createHydrationFunctions);
  3832. }
  3833. function baseCreateRenderer(options, createHydrationFns) {
  3834. const target = shared.getGlobalThis();
  3835. target.__VUE__ = true;
  3836. const {
  3837. insert: hostInsert,
  3838. remove: hostRemove,
  3839. patchProp: hostPatchProp,
  3840. createElement: hostCreateElement,
  3841. createText: hostCreateText,
  3842. createComment: hostCreateComment,
  3843. setText: hostSetText,
  3844. setElementText: hostSetElementText,
  3845. parentNode: hostParentNode,
  3846. nextSibling: hostNextSibling,
  3847. setScopeId: hostSetScopeId = shared.NOOP,
  3848. insertStaticContent: hostInsertStaticContent
  3849. } = options;
  3850. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = !!n2.dynamicChildren) => {
  3851. if (n1 === n2) {
  3852. return;
  3853. }
  3854. if (n1 && !isSameVNodeType(n1, n2)) {
  3855. anchor = getNextHostNode(n1);
  3856. unmount(n1, parentComponent, parentSuspense, true);
  3857. n1 = null;
  3858. }
  3859. if (n2.patchFlag === -2) {
  3860. optimized = false;
  3861. n2.dynamicChildren = null;
  3862. }
  3863. const { type, ref, shapeFlag } = n2;
  3864. switch (type) {
  3865. case Text:
  3866. processText(n1, n2, container, anchor);
  3867. break;
  3868. case Comment:
  3869. processCommentNode(n1, n2, container, anchor);
  3870. break;
  3871. case Static:
  3872. if (n1 == null) {
  3873. mountStaticNode(n2, container, anchor, isSVG);
  3874. }
  3875. break;
  3876. case Fragment:
  3877. processFragment(
  3878. n1,
  3879. n2,
  3880. container,
  3881. anchor,
  3882. parentComponent,
  3883. parentSuspense,
  3884. isSVG,
  3885. slotScopeIds,
  3886. optimized
  3887. );
  3888. break;
  3889. default:
  3890. if (shapeFlag & 1) {
  3891. processElement(
  3892. n1,
  3893. n2,
  3894. container,
  3895. anchor,
  3896. parentComponent,
  3897. parentSuspense,
  3898. isSVG,
  3899. slotScopeIds,
  3900. optimized
  3901. );
  3902. } else if (shapeFlag & 6) {
  3903. processComponent(
  3904. n1,
  3905. n2,
  3906. container,
  3907. anchor,
  3908. parentComponent,
  3909. parentSuspense,
  3910. isSVG,
  3911. slotScopeIds,
  3912. optimized
  3913. );
  3914. } else if (shapeFlag & 64) {
  3915. type.process(
  3916. n1,
  3917. n2,
  3918. container,
  3919. anchor,
  3920. parentComponent,
  3921. parentSuspense,
  3922. isSVG,
  3923. slotScopeIds,
  3924. optimized,
  3925. internals
  3926. );
  3927. } else if (shapeFlag & 128) {
  3928. type.process(
  3929. n1,
  3930. n2,
  3931. container,
  3932. anchor,
  3933. parentComponent,
  3934. parentSuspense,
  3935. isSVG,
  3936. slotScopeIds,
  3937. optimized,
  3938. internals
  3939. );
  3940. } else ;
  3941. }
  3942. if (ref != null && parentComponent) {
  3943. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  3944. }
  3945. };
  3946. const processText = (n1, n2, container, anchor) => {
  3947. if (n1 == null) {
  3948. hostInsert(
  3949. n2.el = hostCreateText(n2.children),
  3950. container,
  3951. anchor
  3952. );
  3953. } else {
  3954. const el = n2.el = n1.el;
  3955. if (n2.children !== n1.children) {
  3956. hostSetText(el, n2.children);
  3957. }
  3958. }
  3959. };
  3960. const processCommentNode = (n1, n2, container, anchor) => {
  3961. if (n1 == null) {
  3962. hostInsert(
  3963. n2.el = hostCreateComment(n2.children || ""),
  3964. container,
  3965. anchor
  3966. );
  3967. } else {
  3968. n2.el = n1.el;
  3969. }
  3970. };
  3971. const mountStaticNode = (n2, container, anchor, isSVG) => {
  3972. [n2.el, n2.anchor] = hostInsertStaticContent(
  3973. n2.children,
  3974. container,
  3975. anchor,
  3976. isSVG,
  3977. n2.el,
  3978. n2.anchor
  3979. );
  3980. };
  3981. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  3982. let next;
  3983. while (el && el !== anchor) {
  3984. next = hostNextSibling(el);
  3985. hostInsert(el, container, nextSibling);
  3986. el = next;
  3987. }
  3988. hostInsert(anchor, container, nextSibling);
  3989. };
  3990. const removeStaticNode = ({ el, anchor }) => {
  3991. let next;
  3992. while (el && el !== anchor) {
  3993. next = hostNextSibling(el);
  3994. hostRemove(el);
  3995. el = next;
  3996. }
  3997. hostRemove(anchor);
  3998. };
  3999. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  4000. isSVG = isSVG || n2.type === "svg";
  4001. if (n1 == null) {
  4002. mountElement(
  4003. n2,
  4004. container,
  4005. anchor,
  4006. parentComponent,
  4007. parentSuspense,
  4008. isSVG,
  4009. slotScopeIds,
  4010. optimized
  4011. );
  4012. } else {
  4013. patchElement(
  4014. n1,
  4015. n2,
  4016. parentComponent,
  4017. parentSuspense,
  4018. isSVG,
  4019. slotScopeIds,
  4020. optimized
  4021. );
  4022. }
  4023. };
  4024. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  4025. let el;
  4026. let vnodeHook;
  4027. const { type, props, shapeFlag, transition, dirs } = vnode;
  4028. el = vnode.el = hostCreateElement(
  4029. vnode.type,
  4030. isSVG,
  4031. props && props.is,
  4032. props
  4033. );
  4034. if (shapeFlag & 8) {
  4035. hostSetElementText(el, vnode.children);
  4036. } else if (shapeFlag & 16) {
  4037. mountChildren(
  4038. vnode.children,
  4039. el,
  4040. null,
  4041. parentComponent,
  4042. parentSuspense,
  4043. isSVG && type !== "foreignObject",
  4044. slotScopeIds,
  4045. optimized
  4046. );
  4047. }
  4048. if (dirs) {
  4049. invokeDirectiveHook(vnode, null, parentComponent, "created");
  4050. }
  4051. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  4052. if (props) {
  4053. for (const key in props) {
  4054. if (key !== "value" && !shared.isReservedProp(key)) {
  4055. hostPatchProp(
  4056. el,
  4057. key,
  4058. null,
  4059. props[key],
  4060. isSVG,
  4061. vnode.children,
  4062. parentComponent,
  4063. parentSuspense,
  4064. unmountChildren
  4065. );
  4066. }
  4067. }
  4068. if ("value" in props) {
  4069. hostPatchProp(el, "value", null, props.value);
  4070. }
  4071. if (vnodeHook = props.onVnodeBeforeMount) {
  4072. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  4073. }
  4074. }
  4075. if (dirs) {
  4076. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  4077. }
  4078. const needCallTransitionHooks = needTransition(parentSuspense, transition);
  4079. if (needCallTransitionHooks) {
  4080. transition.beforeEnter(el);
  4081. }
  4082. hostInsert(el, container, anchor);
  4083. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  4084. queuePostRenderEffect(() => {
  4085. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  4086. needCallTransitionHooks && transition.enter(el);
  4087. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  4088. }, parentSuspense);
  4089. }
  4090. };
  4091. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  4092. if (scopeId) {
  4093. hostSetScopeId(el, scopeId);
  4094. }
  4095. if (slotScopeIds) {
  4096. for (let i = 0; i < slotScopeIds.length; i++) {
  4097. hostSetScopeId(el, slotScopeIds[i]);
  4098. }
  4099. }
  4100. if (parentComponent) {
  4101. let subTree = parentComponent.subTree;
  4102. if (vnode === subTree) {
  4103. const parentVNode = parentComponent.vnode;
  4104. setScopeId(
  4105. el,
  4106. parentVNode,
  4107. parentVNode.scopeId,
  4108. parentVNode.slotScopeIds,
  4109. parentComponent.parent
  4110. );
  4111. }
  4112. }
  4113. };
  4114. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, start = 0) => {
  4115. for (let i = start; i < children.length; i++) {
  4116. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  4117. patch(
  4118. null,
  4119. child,
  4120. container,
  4121. anchor,
  4122. parentComponent,
  4123. parentSuspense,
  4124. isSVG,
  4125. slotScopeIds,
  4126. optimized
  4127. );
  4128. }
  4129. };
  4130. const patchElement = (n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  4131. const el = n2.el = n1.el;
  4132. let { patchFlag, dynamicChildren, dirs } = n2;
  4133. patchFlag |= n1.patchFlag & 16;
  4134. const oldProps = n1.props || shared.EMPTY_OBJ;
  4135. const newProps = n2.props || shared.EMPTY_OBJ;
  4136. let vnodeHook;
  4137. parentComponent && toggleRecurse(parentComponent, false);
  4138. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  4139. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  4140. }
  4141. if (dirs) {
  4142. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  4143. }
  4144. parentComponent && toggleRecurse(parentComponent, true);
  4145. const areChildrenSVG = isSVG && n2.type !== "foreignObject";
  4146. if (dynamicChildren) {
  4147. patchBlockChildren(
  4148. n1.dynamicChildren,
  4149. dynamicChildren,
  4150. el,
  4151. parentComponent,
  4152. parentSuspense,
  4153. areChildrenSVG,
  4154. slotScopeIds
  4155. );
  4156. } else if (!optimized) {
  4157. patchChildren(
  4158. n1,
  4159. n2,
  4160. el,
  4161. null,
  4162. parentComponent,
  4163. parentSuspense,
  4164. areChildrenSVG,
  4165. slotScopeIds,
  4166. false
  4167. );
  4168. }
  4169. if (patchFlag > 0) {
  4170. if (patchFlag & 16) {
  4171. patchProps(
  4172. el,
  4173. n2,
  4174. oldProps,
  4175. newProps,
  4176. parentComponent,
  4177. parentSuspense,
  4178. isSVG
  4179. );
  4180. } else {
  4181. if (patchFlag & 2) {
  4182. if (oldProps.class !== newProps.class) {
  4183. hostPatchProp(el, "class", null, newProps.class, isSVG);
  4184. }
  4185. }
  4186. if (patchFlag & 4) {
  4187. hostPatchProp(el, "style", oldProps.style, newProps.style, isSVG);
  4188. }
  4189. if (patchFlag & 8) {
  4190. const propsToUpdate = n2.dynamicProps;
  4191. for (let i = 0; i < propsToUpdate.length; i++) {
  4192. const key = propsToUpdate[i];
  4193. const prev = oldProps[key];
  4194. const next = newProps[key];
  4195. if (next !== prev || key === "value") {
  4196. hostPatchProp(
  4197. el,
  4198. key,
  4199. prev,
  4200. next,
  4201. isSVG,
  4202. n1.children,
  4203. parentComponent,
  4204. parentSuspense,
  4205. unmountChildren
  4206. );
  4207. }
  4208. }
  4209. }
  4210. }
  4211. if (patchFlag & 1) {
  4212. if (n1.children !== n2.children) {
  4213. hostSetElementText(el, n2.children);
  4214. }
  4215. }
  4216. } else if (!optimized && dynamicChildren == null) {
  4217. patchProps(
  4218. el,
  4219. n2,
  4220. oldProps,
  4221. newProps,
  4222. parentComponent,
  4223. parentSuspense,
  4224. isSVG
  4225. );
  4226. }
  4227. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  4228. queuePostRenderEffect(() => {
  4229. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  4230. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  4231. }, parentSuspense);
  4232. }
  4233. };
  4234. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG, slotScopeIds) => {
  4235. for (let i = 0; i < newChildren.length; i++) {
  4236. const oldVNode = oldChildren[i];
  4237. const newVNode = newChildren[i];
  4238. const container = (
  4239. // oldVNode may be an errored async setup() component inside Suspense
  4240. // which will not have a mounted element
  4241. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  4242. // of the Fragment itself so it can move its children.
  4243. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  4244. // which also requires the correct parent container
  4245. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  4246. oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
  4247. // In other cases, the parent container is not actually used so we
  4248. // just pass the block element here to avoid a DOM parentNode call.
  4249. fallbackContainer
  4250. )
  4251. );
  4252. patch(
  4253. oldVNode,
  4254. newVNode,
  4255. container,
  4256. null,
  4257. parentComponent,
  4258. parentSuspense,
  4259. isSVG,
  4260. slotScopeIds,
  4261. true
  4262. );
  4263. }
  4264. };
  4265. const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
  4266. if (oldProps !== newProps) {
  4267. if (oldProps !== shared.EMPTY_OBJ) {
  4268. for (const key in oldProps) {
  4269. if (!shared.isReservedProp(key) && !(key in newProps)) {
  4270. hostPatchProp(
  4271. el,
  4272. key,
  4273. oldProps[key],
  4274. null,
  4275. isSVG,
  4276. vnode.children,
  4277. parentComponent,
  4278. parentSuspense,
  4279. unmountChildren
  4280. );
  4281. }
  4282. }
  4283. }
  4284. for (const key in newProps) {
  4285. if (shared.isReservedProp(key))
  4286. continue;
  4287. const next = newProps[key];
  4288. const prev = oldProps[key];
  4289. if (next !== prev && key !== "value") {
  4290. hostPatchProp(
  4291. el,
  4292. key,
  4293. prev,
  4294. next,
  4295. isSVG,
  4296. vnode.children,
  4297. parentComponent,
  4298. parentSuspense,
  4299. unmountChildren
  4300. );
  4301. }
  4302. }
  4303. if ("value" in newProps) {
  4304. hostPatchProp(el, "value", oldProps.value, newProps.value);
  4305. }
  4306. }
  4307. };
  4308. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  4309. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  4310. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  4311. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  4312. if (fragmentSlotScopeIds) {
  4313. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  4314. }
  4315. if (n1 == null) {
  4316. hostInsert(fragmentStartAnchor, container, anchor);
  4317. hostInsert(fragmentEndAnchor, container, anchor);
  4318. mountChildren(
  4319. n2.children,
  4320. container,
  4321. fragmentEndAnchor,
  4322. parentComponent,
  4323. parentSuspense,
  4324. isSVG,
  4325. slotScopeIds,
  4326. optimized
  4327. );
  4328. } else {
  4329. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  4330. // of renderSlot() with no valid children
  4331. n1.dynamicChildren) {
  4332. patchBlockChildren(
  4333. n1.dynamicChildren,
  4334. dynamicChildren,
  4335. container,
  4336. parentComponent,
  4337. parentSuspense,
  4338. isSVG,
  4339. slotScopeIds
  4340. );
  4341. if (
  4342. // #2080 if the stable fragment has a key, it's a <template v-for> that may
  4343. // get moved around. Make sure all root level vnodes inherit el.
  4344. // #2134 or if it's a component root, it may also get moved around
  4345. // as the component is being moved.
  4346. n2.key != null || parentComponent && n2 === parentComponent.subTree
  4347. ) {
  4348. traverseStaticChildren(
  4349. n1,
  4350. n2,
  4351. true
  4352. /* shallow */
  4353. );
  4354. }
  4355. } else {
  4356. patchChildren(
  4357. n1,
  4358. n2,
  4359. container,
  4360. fragmentEndAnchor,
  4361. parentComponent,
  4362. parentSuspense,
  4363. isSVG,
  4364. slotScopeIds,
  4365. optimized
  4366. );
  4367. }
  4368. }
  4369. };
  4370. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  4371. n2.slotScopeIds = slotScopeIds;
  4372. if (n1 == null) {
  4373. if (n2.shapeFlag & 512) {
  4374. parentComponent.ctx.activate(
  4375. n2,
  4376. container,
  4377. anchor,
  4378. isSVG,
  4379. optimized
  4380. );
  4381. } else {
  4382. mountComponent(
  4383. n2,
  4384. container,
  4385. anchor,
  4386. parentComponent,
  4387. parentSuspense,
  4388. isSVG,
  4389. optimized
  4390. );
  4391. }
  4392. } else {
  4393. updateComponent(n1, n2, optimized);
  4394. }
  4395. };
  4396. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
  4397. const instance = (initialVNode.component = createComponentInstance(
  4398. initialVNode,
  4399. parentComponent,
  4400. parentSuspense
  4401. ));
  4402. if (isKeepAlive(initialVNode)) {
  4403. instance.ctx.renderer = internals;
  4404. }
  4405. {
  4406. setupComponent(instance);
  4407. }
  4408. if (instance.asyncDep) {
  4409. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
  4410. if (!initialVNode.el) {
  4411. const placeholder = instance.subTree = createVNode(Comment);
  4412. processCommentNode(null, placeholder, container, anchor);
  4413. }
  4414. return;
  4415. }
  4416. setupRenderEffect(
  4417. instance,
  4418. initialVNode,
  4419. container,
  4420. anchor,
  4421. parentSuspense,
  4422. isSVG,
  4423. optimized
  4424. );
  4425. };
  4426. const updateComponent = (n1, n2, optimized) => {
  4427. const instance = n2.component = n1.component;
  4428. if (shouldUpdateComponent(n1, n2, optimized)) {
  4429. if (instance.asyncDep && !instance.asyncResolved) {
  4430. updateComponentPreRender(instance, n2, optimized);
  4431. return;
  4432. } else {
  4433. instance.next = n2;
  4434. invalidateJob(instance.update);
  4435. instance.update();
  4436. }
  4437. } else {
  4438. n2.el = n1.el;
  4439. instance.vnode = n2;
  4440. }
  4441. };
  4442. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized) => {
  4443. const componentUpdateFn = () => {
  4444. if (!instance.isMounted) {
  4445. let vnodeHook;
  4446. const { el, props } = initialVNode;
  4447. const { bm, m, parent } = instance;
  4448. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  4449. toggleRecurse(instance, false);
  4450. if (bm) {
  4451. shared.invokeArrayFns(bm);
  4452. }
  4453. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  4454. invokeVNodeHook(vnodeHook, parent, initialVNode);
  4455. }
  4456. toggleRecurse(instance, true);
  4457. if (el && hydrateNode) {
  4458. const hydrateSubTree = () => {
  4459. instance.subTree = renderComponentRoot(instance);
  4460. hydrateNode(
  4461. el,
  4462. instance.subTree,
  4463. instance,
  4464. parentSuspense,
  4465. null
  4466. );
  4467. };
  4468. if (isAsyncWrapperVNode) {
  4469. initialVNode.type.__asyncLoader().then(
  4470. // note: we are moving the render call into an async callback,
  4471. // which means it won't track dependencies - but it's ok because
  4472. // a server-rendered async wrapper is already in resolved state
  4473. // and it will never need to change.
  4474. () => !instance.isUnmounted && hydrateSubTree()
  4475. );
  4476. } else {
  4477. hydrateSubTree();
  4478. }
  4479. } else {
  4480. const subTree = instance.subTree = renderComponentRoot(instance);
  4481. patch(
  4482. null,
  4483. subTree,
  4484. container,
  4485. anchor,
  4486. instance,
  4487. parentSuspense,
  4488. isSVG
  4489. );
  4490. initialVNode.el = subTree.el;
  4491. }
  4492. if (m) {
  4493. queuePostRenderEffect(m, parentSuspense);
  4494. }
  4495. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  4496. const scopedInitialVNode = initialVNode;
  4497. queuePostRenderEffect(
  4498. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  4499. parentSuspense
  4500. );
  4501. }
  4502. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  4503. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  4504. }
  4505. instance.isMounted = true;
  4506. initialVNode = container = anchor = null;
  4507. } else {
  4508. let { next, bu, u, parent, vnode } = instance;
  4509. let originNext = next;
  4510. let vnodeHook;
  4511. toggleRecurse(instance, false);
  4512. if (next) {
  4513. next.el = vnode.el;
  4514. updateComponentPreRender(instance, next, optimized);
  4515. } else {
  4516. next = vnode;
  4517. }
  4518. if (bu) {
  4519. shared.invokeArrayFns(bu);
  4520. }
  4521. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  4522. invokeVNodeHook(vnodeHook, parent, next, vnode);
  4523. }
  4524. toggleRecurse(instance, true);
  4525. const nextTree = renderComponentRoot(instance);
  4526. const prevTree = instance.subTree;
  4527. instance.subTree = nextTree;
  4528. patch(
  4529. prevTree,
  4530. nextTree,
  4531. // parent may have changed if it's in a teleport
  4532. hostParentNode(prevTree.el),
  4533. // anchor may have changed if it's in a fragment
  4534. getNextHostNode(prevTree),
  4535. instance,
  4536. parentSuspense,
  4537. isSVG
  4538. );
  4539. next.el = nextTree.el;
  4540. if (originNext === null) {
  4541. updateHOCHostEl(instance, nextTree.el);
  4542. }
  4543. if (u) {
  4544. queuePostRenderEffect(u, parentSuspense);
  4545. }
  4546. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  4547. queuePostRenderEffect(
  4548. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  4549. parentSuspense
  4550. );
  4551. }
  4552. }
  4553. };
  4554. const effect = instance.effect = new reactivity.ReactiveEffect(
  4555. componentUpdateFn,
  4556. () => queueJob(update),
  4557. instance.scope
  4558. // track it in component's effect scope
  4559. );
  4560. const update = instance.update = () => effect.run();
  4561. update.id = instance.uid;
  4562. toggleRecurse(instance, true);
  4563. update();
  4564. };
  4565. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  4566. nextVNode.component = instance;
  4567. const prevProps = instance.vnode.props;
  4568. instance.vnode = nextVNode;
  4569. instance.next = null;
  4570. updateProps(instance, nextVNode.props, prevProps, optimized);
  4571. updateSlots(instance, nextVNode.children, optimized);
  4572. reactivity.pauseTracking();
  4573. flushPreFlushCbs(instance);
  4574. reactivity.resetTracking();
  4575. };
  4576. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
  4577. const c1 = n1 && n1.children;
  4578. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  4579. const c2 = n2.children;
  4580. const { patchFlag, shapeFlag } = n2;
  4581. if (patchFlag > 0) {
  4582. if (patchFlag & 128) {
  4583. patchKeyedChildren(
  4584. c1,
  4585. c2,
  4586. container,
  4587. anchor,
  4588. parentComponent,
  4589. parentSuspense,
  4590. isSVG,
  4591. slotScopeIds,
  4592. optimized
  4593. );
  4594. return;
  4595. } else if (patchFlag & 256) {
  4596. patchUnkeyedChildren(
  4597. c1,
  4598. c2,
  4599. container,
  4600. anchor,
  4601. parentComponent,
  4602. parentSuspense,
  4603. isSVG,
  4604. slotScopeIds,
  4605. optimized
  4606. );
  4607. return;
  4608. }
  4609. }
  4610. if (shapeFlag & 8) {
  4611. if (prevShapeFlag & 16) {
  4612. unmountChildren(c1, parentComponent, parentSuspense);
  4613. }
  4614. if (c2 !== c1) {
  4615. hostSetElementText(container, c2);
  4616. }
  4617. } else {
  4618. if (prevShapeFlag & 16) {
  4619. if (shapeFlag & 16) {
  4620. patchKeyedChildren(
  4621. c1,
  4622. c2,
  4623. container,
  4624. anchor,
  4625. parentComponent,
  4626. parentSuspense,
  4627. isSVG,
  4628. slotScopeIds,
  4629. optimized
  4630. );
  4631. } else {
  4632. unmountChildren(c1, parentComponent, parentSuspense, true);
  4633. }
  4634. } else {
  4635. if (prevShapeFlag & 8) {
  4636. hostSetElementText(container, "");
  4637. }
  4638. if (shapeFlag & 16) {
  4639. mountChildren(
  4640. c2,
  4641. container,
  4642. anchor,
  4643. parentComponent,
  4644. parentSuspense,
  4645. isSVG,
  4646. slotScopeIds,
  4647. optimized
  4648. );
  4649. }
  4650. }
  4651. }
  4652. };
  4653. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  4654. c1 = c1 || shared.EMPTY_ARR;
  4655. c2 = c2 || shared.EMPTY_ARR;
  4656. const oldLength = c1.length;
  4657. const newLength = c2.length;
  4658. const commonLength = Math.min(oldLength, newLength);
  4659. let i;
  4660. for (i = 0; i < commonLength; i++) {
  4661. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  4662. patch(
  4663. c1[i],
  4664. nextChild,
  4665. container,
  4666. null,
  4667. parentComponent,
  4668. parentSuspense,
  4669. isSVG,
  4670. slotScopeIds,
  4671. optimized
  4672. );
  4673. }
  4674. if (oldLength > newLength) {
  4675. unmountChildren(
  4676. c1,
  4677. parentComponent,
  4678. parentSuspense,
  4679. true,
  4680. false,
  4681. commonLength
  4682. );
  4683. } else {
  4684. mountChildren(
  4685. c2,
  4686. container,
  4687. anchor,
  4688. parentComponent,
  4689. parentSuspense,
  4690. isSVG,
  4691. slotScopeIds,
  4692. optimized,
  4693. commonLength
  4694. );
  4695. }
  4696. };
  4697. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  4698. let i = 0;
  4699. const l2 = c2.length;
  4700. let e1 = c1.length - 1;
  4701. let e2 = l2 - 1;
  4702. while (i <= e1 && i <= e2) {
  4703. const n1 = c1[i];
  4704. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  4705. if (isSameVNodeType(n1, n2)) {
  4706. patch(
  4707. n1,
  4708. n2,
  4709. container,
  4710. null,
  4711. parentComponent,
  4712. parentSuspense,
  4713. isSVG,
  4714. slotScopeIds,
  4715. optimized
  4716. );
  4717. } else {
  4718. break;
  4719. }
  4720. i++;
  4721. }
  4722. while (i <= e1 && i <= e2) {
  4723. const n1 = c1[e1];
  4724. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  4725. if (isSameVNodeType(n1, n2)) {
  4726. patch(
  4727. n1,
  4728. n2,
  4729. container,
  4730. null,
  4731. parentComponent,
  4732. parentSuspense,
  4733. isSVG,
  4734. slotScopeIds,
  4735. optimized
  4736. );
  4737. } else {
  4738. break;
  4739. }
  4740. e1--;
  4741. e2--;
  4742. }
  4743. if (i > e1) {
  4744. if (i <= e2) {
  4745. const nextPos = e2 + 1;
  4746. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  4747. while (i <= e2) {
  4748. patch(
  4749. null,
  4750. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  4751. container,
  4752. anchor,
  4753. parentComponent,
  4754. parentSuspense,
  4755. isSVG,
  4756. slotScopeIds,
  4757. optimized
  4758. );
  4759. i++;
  4760. }
  4761. }
  4762. } else if (i > e2) {
  4763. while (i <= e1) {
  4764. unmount(c1[i], parentComponent, parentSuspense, true);
  4765. i++;
  4766. }
  4767. } else {
  4768. const s1 = i;
  4769. const s2 = i;
  4770. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  4771. for (i = s2; i <= e2; i++) {
  4772. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  4773. if (nextChild.key != null) {
  4774. keyToNewIndexMap.set(nextChild.key, i);
  4775. }
  4776. }
  4777. let j;
  4778. let patched = 0;
  4779. const toBePatched = e2 - s2 + 1;
  4780. let moved = false;
  4781. let maxNewIndexSoFar = 0;
  4782. const newIndexToOldIndexMap = new Array(toBePatched);
  4783. for (i = 0; i < toBePatched; i++)
  4784. newIndexToOldIndexMap[i] = 0;
  4785. for (i = s1; i <= e1; i++) {
  4786. const prevChild = c1[i];
  4787. if (patched >= toBePatched) {
  4788. unmount(prevChild, parentComponent, parentSuspense, true);
  4789. continue;
  4790. }
  4791. let newIndex;
  4792. if (prevChild.key != null) {
  4793. newIndex = keyToNewIndexMap.get(prevChild.key);
  4794. } else {
  4795. for (j = s2; j <= e2; j++) {
  4796. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  4797. newIndex = j;
  4798. break;
  4799. }
  4800. }
  4801. }
  4802. if (newIndex === void 0) {
  4803. unmount(prevChild, parentComponent, parentSuspense, true);
  4804. } else {
  4805. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  4806. if (newIndex >= maxNewIndexSoFar) {
  4807. maxNewIndexSoFar = newIndex;
  4808. } else {
  4809. moved = true;
  4810. }
  4811. patch(
  4812. prevChild,
  4813. c2[newIndex],
  4814. container,
  4815. null,
  4816. parentComponent,
  4817. parentSuspense,
  4818. isSVG,
  4819. slotScopeIds,
  4820. optimized
  4821. );
  4822. patched++;
  4823. }
  4824. }
  4825. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : shared.EMPTY_ARR;
  4826. j = increasingNewIndexSequence.length - 1;
  4827. for (i = toBePatched - 1; i >= 0; i--) {
  4828. const nextIndex = s2 + i;
  4829. const nextChild = c2[nextIndex];
  4830. const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
  4831. if (newIndexToOldIndexMap[i] === 0) {
  4832. patch(
  4833. null,
  4834. nextChild,
  4835. container,
  4836. anchor,
  4837. parentComponent,
  4838. parentSuspense,
  4839. isSVG,
  4840. slotScopeIds,
  4841. optimized
  4842. );
  4843. } else if (moved) {
  4844. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  4845. move(nextChild, container, anchor, 2);
  4846. } else {
  4847. j--;
  4848. }
  4849. }
  4850. }
  4851. }
  4852. };
  4853. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  4854. const { el, type, transition, children, shapeFlag } = vnode;
  4855. if (shapeFlag & 6) {
  4856. move(vnode.component.subTree, container, anchor, moveType);
  4857. return;
  4858. }
  4859. if (shapeFlag & 128) {
  4860. vnode.suspense.move(container, anchor, moveType);
  4861. return;
  4862. }
  4863. if (shapeFlag & 64) {
  4864. type.move(vnode, container, anchor, internals);
  4865. return;
  4866. }
  4867. if (type === Fragment) {
  4868. hostInsert(el, container, anchor);
  4869. for (let i = 0; i < children.length; i++) {
  4870. move(children[i], container, anchor, moveType);
  4871. }
  4872. hostInsert(vnode.anchor, container, anchor);
  4873. return;
  4874. }
  4875. if (type === Static) {
  4876. moveStaticNode(vnode, container, anchor);
  4877. return;
  4878. }
  4879. const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
  4880. if (needTransition2) {
  4881. if (moveType === 0) {
  4882. transition.beforeEnter(el);
  4883. hostInsert(el, container, anchor);
  4884. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  4885. } else {
  4886. const { leave, delayLeave, afterLeave } = transition;
  4887. const remove2 = () => hostInsert(el, container, anchor);
  4888. const performLeave = () => {
  4889. leave(el, () => {
  4890. remove2();
  4891. afterLeave && afterLeave();
  4892. });
  4893. };
  4894. if (delayLeave) {
  4895. delayLeave(el, remove2, performLeave);
  4896. } else {
  4897. performLeave();
  4898. }
  4899. }
  4900. } else {
  4901. hostInsert(el, container, anchor);
  4902. }
  4903. };
  4904. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  4905. const {
  4906. type,
  4907. props,
  4908. ref,
  4909. children,
  4910. dynamicChildren,
  4911. shapeFlag,
  4912. patchFlag,
  4913. dirs
  4914. } = vnode;
  4915. if (ref != null) {
  4916. setRef(ref, null, parentSuspense, vnode, true);
  4917. }
  4918. if (shapeFlag & 256) {
  4919. parentComponent.ctx.deactivate(vnode);
  4920. return;
  4921. }
  4922. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  4923. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  4924. let vnodeHook;
  4925. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  4926. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  4927. }
  4928. if (shapeFlag & 6) {
  4929. unmountComponent(vnode.component, parentSuspense, doRemove);
  4930. } else {
  4931. if (shapeFlag & 128) {
  4932. vnode.suspense.unmount(parentSuspense, doRemove);
  4933. return;
  4934. }
  4935. if (shouldInvokeDirs) {
  4936. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  4937. }
  4938. if (shapeFlag & 64) {
  4939. vnode.type.remove(
  4940. vnode,
  4941. parentComponent,
  4942. parentSuspense,
  4943. optimized,
  4944. internals,
  4945. doRemove
  4946. );
  4947. } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
  4948. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  4949. unmountChildren(
  4950. dynamicChildren,
  4951. parentComponent,
  4952. parentSuspense,
  4953. false,
  4954. true
  4955. );
  4956. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  4957. unmountChildren(children, parentComponent, parentSuspense);
  4958. }
  4959. if (doRemove) {
  4960. remove(vnode);
  4961. }
  4962. }
  4963. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  4964. queuePostRenderEffect(() => {
  4965. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  4966. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  4967. }, parentSuspense);
  4968. }
  4969. };
  4970. const remove = (vnode) => {
  4971. const { type, el, anchor, transition } = vnode;
  4972. if (type === Fragment) {
  4973. {
  4974. removeFragment(el, anchor);
  4975. }
  4976. return;
  4977. }
  4978. if (type === Static) {
  4979. removeStaticNode(vnode);
  4980. return;
  4981. }
  4982. const performRemove = () => {
  4983. hostRemove(el);
  4984. if (transition && !transition.persisted && transition.afterLeave) {
  4985. transition.afterLeave();
  4986. }
  4987. };
  4988. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  4989. const { leave, delayLeave } = transition;
  4990. const performLeave = () => leave(el, performRemove);
  4991. if (delayLeave) {
  4992. delayLeave(vnode.el, performRemove, performLeave);
  4993. } else {
  4994. performLeave();
  4995. }
  4996. } else {
  4997. performRemove();
  4998. }
  4999. };
  5000. const removeFragment = (cur, end) => {
  5001. let next;
  5002. while (cur !== end) {
  5003. next = hostNextSibling(cur);
  5004. hostRemove(cur);
  5005. cur = next;
  5006. }
  5007. hostRemove(end);
  5008. };
  5009. const unmountComponent = (instance, parentSuspense, doRemove) => {
  5010. const { bum, scope, update, subTree, um } = instance;
  5011. if (bum) {
  5012. shared.invokeArrayFns(bum);
  5013. }
  5014. scope.stop();
  5015. if (update) {
  5016. update.active = false;
  5017. unmount(subTree, instance, parentSuspense, doRemove);
  5018. }
  5019. if (um) {
  5020. queuePostRenderEffect(um, parentSuspense);
  5021. }
  5022. queuePostRenderEffect(() => {
  5023. instance.isUnmounted = true;
  5024. }, parentSuspense);
  5025. if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
  5026. parentSuspense.deps--;
  5027. if (parentSuspense.deps === 0) {
  5028. parentSuspense.resolve();
  5029. }
  5030. }
  5031. };
  5032. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  5033. for (let i = start; i < children.length; i++) {
  5034. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  5035. }
  5036. };
  5037. const getNextHostNode = (vnode) => {
  5038. if (vnode.shapeFlag & 6) {
  5039. return getNextHostNode(vnode.component.subTree);
  5040. }
  5041. if (vnode.shapeFlag & 128) {
  5042. return vnode.suspense.next();
  5043. }
  5044. return hostNextSibling(vnode.anchor || vnode.el);
  5045. };
  5046. const render = (vnode, container, isSVG) => {
  5047. if (vnode == null) {
  5048. if (container._vnode) {
  5049. unmount(container._vnode, null, null, true);
  5050. }
  5051. } else {
  5052. patch(container._vnode || null, vnode, container, null, null, null, isSVG);
  5053. }
  5054. flushPreFlushCbs();
  5055. flushPostFlushCbs();
  5056. container._vnode = vnode;
  5057. };
  5058. const internals = {
  5059. p: patch,
  5060. um: unmount,
  5061. m: move,
  5062. r: remove,
  5063. mt: mountComponent,
  5064. mc: mountChildren,
  5065. pc: patchChildren,
  5066. pbc: patchBlockChildren,
  5067. n: getNextHostNode,
  5068. o: options
  5069. };
  5070. let hydrate;
  5071. let hydrateNode;
  5072. if (createHydrationFns) {
  5073. [hydrate, hydrateNode] = createHydrationFns(
  5074. internals
  5075. );
  5076. }
  5077. return {
  5078. render,
  5079. hydrate,
  5080. createApp: createAppAPI(render, hydrate)
  5081. };
  5082. }
  5083. function toggleRecurse({ effect, update }, allowed) {
  5084. effect.allowRecurse = update.allowRecurse = allowed;
  5085. }
  5086. function needTransition(parentSuspense, transition) {
  5087. return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  5088. }
  5089. function traverseStaticChildren(n1, n2, shallow = false) {
  5090. const ch1 = n1.children;
  5091. const ch2 = n2.children;
  5092. if (shared.isArray(ch1) && shared.isArray(ch2)) {
  5093. for (let i = 0; i < ch1.length; i++) {
  5094. const c1 = ch1[i];
  5095. let c2 = ch2[i];
  5096. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  5097. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  5098. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  5099. c2.el = c1.el;
  5100. }
  5101. if (!shallow)
  5102. traverseStaticChildren(c1, c2);
  5103. }
  5104. if (c2.type === Text) {
  5105. c2.el = c1.el;
  5106. }
  5107. }
  5108. }
  5109. }
  5110. function getSequence(arr) {
  5111. const p = arr.slice();
  5112. const result = [0];
  5113. let i, j, u, v, c;
  5114. const len = arr.length;
  5115. for (i = 0; i < len; i++) {
  5116. const arrI = arr[i];
  5117. if (arrI !== 0) {
  5118. j = result[result.length - 1];
  5119. if (arr[j] < arrI) {
  5120. p[i] = j;
  5121. result.push(i);
  5122. continue;
  5123. }
  5124. u = 0;
  5125. v = result.length - 1;
  5126. while (u < v) {
  5127. c = u + v >> 1;
  5128. if (arr[result[c]] < arrI) {
  5129. u = c + 1;
  5130. } else {
  5131. v = c;
  5132. }
  5133. }
  5134. if (arrI < arr[result[u]]) {
  5135. if (u > 0) {
  5136. p[i] = result[u - 1];
  5137. }
  5138. result[u] = i;
  5139. }
  5140. }
  5141. }
  5142. u = result.length;
  5143. v = result[u - 1];
  5144. while (u-- > 0) {
  5145. result[u] = v;
  5146. v = p[v];
  5147. }
  5148. return result;
  5149. }
  5150. const isTeleport = (type) => type.__isTeleport;
  5151. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  5152. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  5153. const resolveTarget = (props, select) => {
  5154. const targetSelector = props && props.to;
  5155. if (shared.isString(targetSelector)) {
  5156. if (!select) {
  5157. return null;
  5158. } else {
  5159. const target = select(targetSelector);
  5160. return target;
  5161. }
  5162. } else {
  5163. return targetSelector;
  5164. }
  5165. };
  5166. const TeleportImpl = {
  5167. name: "Teleport",
  5168. __isTeleport: true,
  5169. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
  5170. const {
  5171. mc: mountChildren,
  5172. pc: patchChildren,
  5173. pbc: patchBlockChildren,
  5174. o: { insert, querySelector, createText, createComment }
  5175. } = internals;
  5176. const disabled = isTeleportDisabled(n2.props);
  5177. let { shapeFlag, children, dynamicChildren } = n2;
  5178. if (n1 == null) {
  5179. const placeholder = n2.el = createText("");
  5180. const mainAnchor = n2.anchor = createText("");
  5181. insert(placeholder, container, anchor);
  5182. insert(mainAnchor, container, anchor);
  5183. const target = n2.target = resolveTarget(n2.props, querySelector);
  5184. const targetAnchor = n2.targetAnchor = createText("");
  5185. if (target) {
  5186. insert(targetAnchor, target);
  5187. isSVG = isSVG || isTargetSVG(target);
  5188. }
  5189. const mount = (container2, anchor2) => {
  5190. if (shapeFlag & 16) {
  5191. mountChildren(
  5192. children,
  5193. container2,
  5194. anchor2,
  5195. parentComponent,
  5196. parentSuspense,
  5197. isSVG,
  5198. slotScopeIds,
  5199. optimized
  5200. );
  5201. }
  5202. };
  5203. if (disabled) {
  5204. mount(container, mainAnchor);
  5205. } else if (target) {
  5206. mount(target, targetAnchor);
  5207. }
  5208. } else {
  5209. n2.el = n1.el;
  5210. const mainAnchor = n2.anchor = n1.anchor;
  5211. const target = n2.target = n1.target;
  5212. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  5213. const wasDisabled = isTeleportDisabled(n1.props);
  5214. const currentContainer = wasDisabled ? container : target;
  5215. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  5216. isSVG = isSVG || isTargetSVG(target);
  5217. if (dynamicChildren) {
  5218. patchBlockChildren(
  5219. n1.dynamicChildren,
  5220. dynamicChildren,
  5221. currentContainer,
  5222. parentComponent,
  5223. parentSuspense,
  5224. isSVG,
  5225. slotScopeIds
  5226. );
  5227. traverseStaticChildren(n1, n2, true);
  5228. } else if (!optimized) {
  5229. patchChildren(
  5230. n1,
  5231. n2,
  5232. currentContainer,
  5233. currentAnchor,
  5234. parentComponent,
  5235. parentSuspense,
  5236. isSVG,
  5237. slotScopeIds,
  5238. false
  5239. );
  5240. }
  5241. if (disabled) {
  5242. if (!wasDisabled) {
  5243. moveTeleport(
  5244. n2,
  5245. container,
  5246. mainAnchor,
  5247. internals,
  5248. 1
  5249. );
  5250. } else {
  5251. if (n2.props && n1.props && n2.props.to !== n1.props.to) {
  5252. n2.props.to = n1.props.to;
  5253. }
  5254. }
  5255. } else {
  5256. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  5257. const nextTarget = n2.target = resolveTarget(
  5258. n2.props,
  5259. querySelector
  5260. );
  5261. if (nextTarget) {
  5262. moveTeleport(
  5263. n2,
  5264. nextTarget,
  5265. null,
  5266. internals,
  5267. 0
  5268. );
  5269. }
  5270. } else if (wasDisabled) {
  5271. moveTeleport(
  5272. n2,
  5273. target,
  5274. targetAnchor,
  5275. internals,
  5276. 1
  5277. );
  5278. }
  5279. }
  5280. }
  5281. updateCssVars(n2);
  5282. },
  5283. remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  5284. const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
  5285. if (target) {
  5286. hostRemove(targetAnchor);
  5287. }
  5288. doRemove && hostRemove(anchor);
  5289. if (shapeFlag & 16) {
  5290. const shouldRemove = doRemove || !isTeleportDisabled(props);
  5291. for (let i = 0; i < children.length; i++) {
  5292. const child = children[i];
  5293. unmount(
  5294. child,
  5295. parentComponent,
  5296. parentSuspense,
  5297. shouldRemove,
  5298. !!child.dynamicChildren
  5299. );
  5300. }
  5301. }
  5302. },
  5303. move: moveTeleport,
  5304. hydrate: hydrateTeleport
  5305. };
  5306. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  5307. if (moveType === 0) {
  5308. insert(vnode.targetAnchor, container, parentAnchor);
  5309. }
  5310. const { el, anchor, shapeFlag, children, props } = vnode;
  5311. const isReorder = moveType === 2;
  5312. if (isReorder) {
  5313. insert(el, container, parentAnchor);
  5314. }
  5315. if (!isReorder || isTeleportDisabled(props)) {
  5316. if (shapeFlag & 16) {
  5317. for (let i = 0; i < children.length; i++) {
  5318. move(
  5319. children[i],
  5320. container,
  5321. parentAnchor,
  5322. 2
  5323. );
  5324. }
  5325. }
  5326. }
  5327. if (isReorder) {
  5328. insert(anchor, container, parentAnchor);
  5329. }
  5330. }
  5331. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  5332. o: { nextSibling, parentNode, querySelector }
  5333. }, hydrateChildren) {
  5334. const target = vnode.target = resolveTarget(
  5335. vnode.props,
  5336. querySelector
  5337. );
  5338. if (target) {
  5339. const targetNode = target._lpa || target.firstChild;
  5340. if (vnode.shapeFlag & 16) {
  5341. if (isTeleportDisabled(vnode.props)) {
  5342. vnode.anchor = hydrateChildren(
  5343. nextSibling(node),
  5344. vnode,
  5345. parentNode(node),
  5346. parentComponent,
  5347. parentSuspense,
  5348. slotScopeIds,
  5349. optimized
  5350. );
  5351. vnode.targetAnchor = targetNode;
  5352. } else {
  5353. vnode.anchor = nextSibling(node);
  5354. let targetAnchor = targetNode;
  5355. while (targetAnchor) {
  5356. targetAnchor = nextSibling(targetAnchor);
  5357. if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
  5358. vnode.targetAnchor = targetAnchor;
  5359. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  5360. break;
  5361. }
  5362. }
  5363. hydrateChildren(
  5364. targetNode,
  5365. vnode,
  5366. target,
  5367. parentComponent,
  5368. parentSuspense,
  5369. slotScopeIds,
  5370. optimized
  5371. );
  5372. }
  5373. }
  5374. updateCssVars(vnode);
  5375. }
  5376. return vnode.anchor && nextSibling(vnode.anchor);
  5377. }
  5378. const Teleport = TeleportImpl;
  5379. function updateCssVars(vnode) {
  5380. const ctx = vnode.ctx;
  5381. if (ctx && ctx.ut) {
  5382. let node = vnode.children[0].el;
  5383. while (node && node !== vnode.targetAnchor) {
  5384. if (node.nodeType === 1)
  5385. node.setAttribute("data-v-owner", ctx.uid);
  5386. node = node.nextSibling;
  5387. }
  5388. ctx.ut();
  5389. }
  5390. }
  5391. const Fragment = Symbol.for("v-fgt");
  5392. const Text = Symbol.for("v-txt");
  5393. const Comment = Symbol.for("v-cmt");
  5394. const Static = Symbol.for("v-stc");
  5395. const blockStack = [];
  5396. let currentBlock = null;
  5397. function openBlock(disableTracking = false) {
  5398. blockStack.push(currentBlock = disableTracking ? null : []);
  5399. }
  5400. function closeBlock() {
  5401. blockStack.pop();
  5402. currentBlock = blockStack[blockStack.length - 1] || null;
  5403. }
  5404. let isBlockTreeEnabled = 1;
  5405. function setBlockTracking(value) {
  5406. isBlockTreeEnabled += value;
  5407. }
  5408. function setupBlock(vnode) {
  5409. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || shared.EMPTY_ARR : null;
  5410. closeBlock();
  5411. if (isBlockTreeEnabled > 0 && currentBlock) {
  5412. currentBlock.push(vnode);
  5413. }
  5414. return vnode;
  5415. }
  5416. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  5417. return setupBlock(
  5418. createBaseVNode(
  5419. type,
  5420. props,
  5421. children,
  5422. patchFlag,
  5423. dynamicProps,
  5424. shapeFlag,
  5425. true
  5426. /* isBlock */
  5427. )
  5428. );
  5429. }
  5430. function createBlock(type, props, children, patchFlag, dynamicProps) {
  5431. return setupBlock(
  5432. createVNode(
  5433. type,
  5434. props,
  5435. children,
  5436. patchFlag,
  5437. dynamicProps,
  5438. true
  5439. /* isBlock: prevent a block from tracking itself */
  5440. )
  5441. );
  5442. }
  5443. function isVNode(value) {
  5444. return value ? value.__v_isVNode === true : false;
  5445. }
  5446. function isSameVNodeType(n1, n2) {
  5447. return n1.type === n2.type && n1.key === n2.key;
  5448. }
  5449. function transformVNodeArgs(transformer) {
  5450. }
  5451. const InternalObjectKey = `__vInternal`;
  5452. const normalizeKey = ({ key }) => key != null ? key : null;
  5453. const normalizeRef = ({
  5454. ref,
  5455. ref_key,
  5456. ref_for
  5457. }) => {
  5458. if (typeof ref === "number") {
  5459. ref = "" + ref;
  5460. }
  5461. return ref != null ? shared.isString(ref) || reactivity.isRef(ref) || shared.isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  5462. };
  5463. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  5464. const vnode = {
  5465. __v_isVNode: true,
  5466. __v_skip: true,
  5467. type,
  5468. props,
  5469. key: props && normalizeKey(props),
  5470. ref: props && normalizeRef(props),
  5471. scopeId: currentScopeId,
  5472. slotScopeIds: null,
  5473. children,
  5474. component: null,
  5475. suspense: null,
  5476. ssContent: null,
  5477. ssFallback: null,
  5478. dirs: null,
  5479. transition: null,
  5480. el: null,
  5481. anchor: null,
  5482. target: null,
  5483. targetAnchor: null,
  5484. staticCount: 0,
  5485. shapeFlag,
  5486. patchFlag,
  5487. dynamicProps,
  5488. dynamicChildren: null,
  5489. appContext: null,
  5490. ctx: currentRenderingInstance
  5491. };
  5492. if (needFullChildrenNormalization) {
  5493. normalizeChildren(vnode, children);
  5494. if (shapeFlag & 128) {
  5495. type.normalize(vnode);
  5496. }
  5497. } else if (children) {
  5498. vnode.shapeFlag |= shared.isString(children) ? 8 : 16;
  5499. }
  5500. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  5501. !isBlockNode && // has current parent block
  5502. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  5503. // component nodes also should always be patched, because even if the
  5504. // component doesn't need to update, it needs to persist the instance on to
  5505. // the next vnode so that it can be properly unmounted later.
  5506. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  5507. // vnode should not be considered dynamic due to handler caching.
  5508. vnode.patchFlag !== 32) {
  5509. currentBlock.push(vnode);
  5510. }
  5511. return vnode;
  5512. }
  5513. const createVNode = _createVNode;
  5514. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  5515. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  5516. type = Comment;
  5517. }
  5518. if (isVNode(type)) {
  5519. const cloned = cloneVNode(
  5520. type,
  5521. props,
  5522. true
  5523. /* mergeRef: true */
  5524. );
  5525. if (children) {
  5526. normalizeChildren(cloned, children);
  5527. }
  5528. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  5529. if (cloned.shapeFlag & 6) {
  5530. currentBlock[currentBlock.indexOf(type)] = cloned;
  5531. } else {
  5532. currentBlock.push(cloned);
  5533. }
  5534. }
  5535. cloned.patchFlag |= -2;
  5536. return cloned;
  5537. }
  5538. if (isClassComponent(type)) {
  5539. type = type.__vccOpts;
  5540. }
  5541. if (props) {
  5542. props = guardReactiveProps(props);
  5543. let { class: klass, style } = props;
  5544. if (klass && !shared.isString(klass)) {
  5545. props.class = shared.normalizeClass(klass);
  5546. }
  5547. if (shared.isObject(style)) {
  5548. if (reactivity.isProxy(style) && !shared.isArray(style)) {
  5549. style = shared.extend({}, style);
  5550. }
  5551. props.style = shared.normalizeStyle(style);
  5552. }
  5553. }
  5554. const shapeFlag = shared.isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : shared.isObject(type) ? 4 : shared.isFunction(type) ? 2 : 0;
  5555. return createBaseVNode(
  5556. type,
  5557. props,
  5558. children,
  5559. patchFlag,
  5560. dynamicProps,
  5561. shapeFlag,
  5562. isBlockNode,
  5563. true
  5564. );
  5565. }
  5566. function guardReactiveProps(props) {
  5567. if (!props)
  5568. return null;
  5569. return reactivity.isProxy(props) || InternalObjectKey in props ? shared.extend({}, props) : props;
  5570. }
  5571. function cloneVNode(vnode, extraProps, mergeRef = false) {
  5572. const { props, ref, patchFlag, children } = vnode;
  5573. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  5574. const cloned = {
  5575. __v_isVNode: true,
  5576. __v_skip: true,
  5577. type: vnode.type,
  5578. props: mergedProps,
  5579. key: mergedProps && normalizeKey(mergedProps),
  5580. ref: extraProps && extraProps.ref ? (
  5581. // #2078 in the case of <component :is="vnode" ref="extra"/>
  5582. // if the vnode itself already has a ref, cloneVNode will need to merge
  5583. // the refs so the single vnode can be set on multiple refs
  5584. mergeRef && ref ? shared.isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  5585. ) : ref,
  5586. scopeId: vnode.scopeId,
  5587. slotScopeIds: vnode.slotScopeIds,
  5588. children: children,
  5589. target: vnode.target,
  5590. targetAnchor: vnode.targetAnchor,
  5591. staticCount: vnode.staticCount,
  5592. shapeFlag: vnode.shapeFlag,
  5593. // if the vnode is cloned with extra props, we can no longer assume its
  5594. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  5595. // note: preserve flag for fragments since they use the flag for children
  5596. // fast paths only.
  5597. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  5598. dynamicProps: vnode.dynamicProps,
  5599. dynamicChildren: vnode.dynamicChildren,
  5600. appContext: vnode.appContext,
  5601. dirs: vnode.dirs,
  5602. transition: vnode.transition,
  5603. // These should technically only be non-null on mounted VNodes. However,
  5604. // they *should* be copied for kept-alive vnodes. So we just always copy
  5605. // them since them being non-null during a mount doesn't affect the logic as
  5606. // they will simply be overwritten.
  5607. component: vnode.component,
  5608. suspense: vnode.suspense,
  5609. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  5610. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  5611. el: vnode.el,
  5612. anchor: vnode.anchor,
  5613. ctx: vnode.ctx,
  5614. ce: vnode.ce
  5615. };
  5616. return cloned;
  5617. }
  5618. function createTextVNode(text = " ", flag = 0) {
  5619. return createVNode(Text, null, text, flag);
  5620. }
  5621. function createStaticVNode(content, numberOfNodes) {
  5622. const vnode = createVNode(Static, null, content);
  5623. vnode.staticCount = numberOfNodes;
  5624. return vnode;
  5625. }
  5626. function createCommentVNode(text = "", asBlock = false) {
  5627. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  5628. }
  5629. function normalizeVNode(child) {
  5630. if (child == null || typeof child === "boolean") {
  5631. return createVNode(Comment);
  5632. } else if (shared.isArray(child)) {
  5633. return createVNode(
  5634. Fragment,
  5635. null,
  5636. // #3666, avoid reference pollution when reusing vnode
  5637. child.slice()
  5638. );
  5639. } else if (typeof child === "object") {
  5640. return cloneIfMounted(child);
  5641. } else {
  5642. return createVNode(Text, null, String(child));
  5643. }
  5644. }
  5645. function cloneIfMounted(child) {
  5646. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  5647. }
  5648. function normalizeChildren(vnode, children) {
  5649. let type = 0;
  5650. const { shapeFlag } = vnode;
  5651. if (children == null) {
  5652. children = null;
  5653. } else if (shared.isArray(children)) {
  5654. type = 16;
  5655. } else if (typeof children === "object") {
  5656. if (shapeFlag & (1 | 64)) {
  5657. const slot = children.default;
  5658. if (slot) {
  5659. slot._c && (slot._d = false);
  5660. normalizeChildren(vnode, slot());
  5661. slot._c && (slot._d = true);
  5662. }
  5663. return;
  5664. } else {
  5665. type = 32;
  5666. const slotFlag = children._;
  5667. if (!slotFlag && !(InternalObjectKey in children)) {
  5668. children._ctx = currentRenderingInstance;
  5669. } else if (slotFlag === 3 && currentRenderingInstance) {
  5670. if (currentRenderingInstance.slots._ === 1) {
  5671. children._ = 1;
  5672. } else {
  5673. children._ = 2;
  5674. vnode.patchFlag |= 1024;
  5675. }
  5676. }
  5677. }
  5678. } else if (shared.isFunction(children)) {
  5679. children = { default: children, _ctx: currentRenderingInstance };
  5680. type = 32;
  5681. } else {
  5682. children = String(children);
  5683. if (shapeFlag & 64) {
  5684. type = 16;
  5685. children = [createTextVNode(children)];
  5686. } else {
  5687. type = 8;
  5688. }
  5689. }
  5690. vnode.children = children;
  5691. vnode.shapeFlag |= type;
  5692. }
  5693. function mergeProps(...args) {
  5694. const ret = {};
  5695. for (let i = 0; i < args.length; i++) {
  5696. const toMerge = args[i];
  5697. for (const key in toMerge) {
  5698. if (key === "class") {
  5699. if (ret.class !== toMerge.class) {
  5700. ret.class = shared.normalizeClass([ret.class, toMerge.class]);
  5701. }
  5702. } else if (key === "style") {
  5703. ret.style = shared.normalizeStyle([ret.style, toMerge.style]);
  5704. } else if (shared.isOn(key)) {
  5705. const existing = ret[key];
  5706. const incoming = toMerge[key];
  5707. if (incoming && existing !== incoming && !(shared.isArray(existing) && existing.includes(incoming))) {
  5708. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  5709. }
  5710. } else if (key !== "") {
  5711. ret[key] = toMerge[key];
  5712. }
  5713. }
  5714. }
  5715. return ret;
  5716. }
  5717. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  5718. callWithAsyncErrorHandling(hook, instance, 7, [
  5719. vnode,
  5720. prevVNode
  5721. ]);
  5722. }
  5723. const emptyAppContext = createAppContext();
  5724. let uid = 0;
  5725. function createComponentInstance(vnode, parent, suspense) {
  5726. const type = vnode.type;
  5727. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  5728. const instance = {
  5729. uid: uid++,
  5730. vnode,
  5731. type,
  5732. parent,
  5733. appContext,
  5734. root: null,
  5735. // to be immediately set
  5736. next: null,
  5737. subTree: null,
  5738. // will be set synchronously right after creation
  5739. effect: null,
  5740. update: null,
  5741. // will be set synchronously right after creation
  5742. scope: new reactivity.EffectScope(
  5743. true
  5744. /* detached */
  5745. ),
  5746. render: null,
  5747. proxy: null,
  5748. exposed: null,
  5749. exposeProxy: null,
  5750. withProxy: null,
  5751. provides: parent ? parent.provides : Object.create(appContext.provides),
  5752. accessCache: null,
  5753. renderCache: [],
  5754. // local resolved assets
  5755. components: null,
  5756. directives: null,
  5757. // resolved props and emits options
  5758. propsOptions: normalizePropsOptions(type, appContext),
  5759. emitsOptions: normalizeEmitsOptions(type, appContext),
  5760. // emit
  5761. emit: null,
  5762. // to be set immediately
  5763. emitted: null,
  5764. // props default value
  5765. propsDefaults: shared.EMPTY_OBJ,
  5766. // inheritAttrs
  5767. inheritAttrs: type.inheritAttrs,
  5768. // state
  5769. ctx: shared.EMPTY_OBJ,
  5770. data: shared.EMPTY_OBJ,
  5771. props: shared.EMPTY_OBJ,
  5772. attrs: shared.EMPTY_OBJ,
  5773. slots: shared.EMPTY_OBJ,
  5774. refs: shared.EMPTY_OBJ,
  5775. setupState: shared.EMPTY_OBJ,
  5776. setupContext: null,
  5777. attrsProxy: null,
  5778. slotsProxy: null,
  5779. // suspense related
  5780. suspense,
  5781. suspenseId: suspense ? suspense.pendingId : 0,
  5782. asyncDep: null,
  5783. asyncResolved: false,
  5784. // lifecycle hooks
  5785. // not using enums here because it results in computed properties
  5786. isMounted: false,
  5787. isUnmounted: false,
  5788. isDeactivated: false,
  5789. bc: null,
  5790. c: null,
  5791. bm: null,
  5792. m: null,
  5793. bu: null,
  5794. u: null,
  5795. um: null,
  5796. bum: null,
  5797. da: null,
  5798. a: null,
  5799. rtg: null,
  5800. rtc: null,
  5801. ec: null,
  5802. sp: null
  5803. };
  5804. {
  5805. instance.ctx = { _: instance };
  5806. }
  5807. instance.root = parent ? parent.root : instance;
  5808. instance.emit = emit.bind(null, instance);
  5809. if (vnode.ce) {
  5810. vnode.ce(instance);
  5811. }
  5812. return instance;
  5813. }
  5814. let currentInstance = null;
  5815. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  5816. let internalSetCurrentInstance;
  5817. let globalCurrentInstanceSetters;
  5818. let settersKey = "__VUE_INSTANCE_SETTERS__";
  5819. {
  5820. if (!(globalCurrentInstanceSetters = shared.getGlobalThis()[settersKey])) {
  5821. globalCurrentInstanceSetters = shared.getGlobalThis()[settersKey] = [];
  5822. }
  5823. globalCurrentInstanceSetters.push((i) => currentInstance = i);
  5824. internalSetCurrentInstance = (instance) => {
  5825. if (globalCurrentInstanceSetters.length > 1) {
  5826. globalCurrentInstanceSetters.forEach((s) => s(instance));
  5827. } else {
  5828. globalCurrentInstanceSetters[0](instance);
  5829. }
  5830. };
  5831. }
  5832. const setCurrentInstance = (instance) => {
  5833. internalSetCurrentInstance(instance);
  5834. instance.scope.on();
  5835. };
  5836. const unsetCurrentInstance = () => {
  5837. currentInstance && currentInstance.scope.off();
  5838. internalSetCurrentInstance(null);
  5839. };
  5840. function isStatefulComponent(instance) {
  5841. return instance.vnode.shapeFlag & 4;
  5842. }
  5843. let isInSSRComponentSetup = false;
  5844. function setupComponent(instance, isSSR = false) {
  5845. isInSSRComponentSetup = isSSR;
  5846. const { props, children } = instance.vnode;
  5847. const isStateful = isStatefulComponent(instance);
  5848. initProps(instance, props, isStateful, isSSR);
  5849. initSlots(instance, children);
  5850. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  5851. isInSSRComponentSetup = false;
  5852. return setupResult;
  5853. }
  5854. function setupStatefulComponent(instance, isSSR) {
  5855. const Component = instance.type;
  5856. instance.accessCache = /* @__PURE__ */ Object.create(null);
  5857. instance.proxy = reactivity.markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
  5858. const { setup } = Component;
  5859. if (setup) {
  5860. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  5861. setCurrentInstance(instance);
  5862. reactivity.pauseTracking();
  5863. const setupResult = callWithErrorHandling(
  5864. setup,
  5865. instance,
  5866. 0,
  5867. [instance.props, setupContext]
  5868. );
  5869. reactivity.resetTracking();
  5870. unsetCurrentInstance();
  5871. if (shared.isPromise(setupResult)) {
  5872. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  5873. if (isSSR) {
  5874. return setupResult.then((resolvedResult) => {
  5875. handleSetupResult(instance, resolvedResult, isSSR);
  5876. }).catch((e) => {
  5877. handleError(e, instance, 0);
  5878. });
  5879. } else {
  5880. instance.asyncDep = setupResult;
  5881. }
  5882. } else {
  5883. handleSetupResult(instance, setupResult, isSSR);
  5884. }
  5885. } else {
  5886. finishComponentSetup(instance, isSSR);
  5887. }
  5888. }
  5889. function handleSetupResult(instance, setupResult, isSSR) {
  5890. if (shared.isFunction(setupResult)) {
  5891. if (instance.type.__ssrInlineRender) {
  5892. instance.ssrRender = setupResult;
  5893. } else {
  5894. instance.render = setupResult;
  5895. }
  5896. } else if (shared.isObject(setupResult)) {
  5897. instance.setupState = reactivity.proxyRefs(setupResult);
  5898. } else ;
  5899. finishComponentSetup(instance, isSSR);
  5900. }
  5901. let compile;
  5902. let installWithProxy;
  5903. function registerRuntimeCompiler(_compile) {
  5904. compile = _compile;
  5905. installWithProxy = (i) => {
  5906. if (i.render._rc) {
  5907. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  5908. }
  5909. };
  5910. }
  5911. const isRuntimeOnly = () => !compile;
  5912. function finishComponentSetup(instance, isSSR, skipOptions) {
  5913. const Component = instance.type;
  5914. if (!instance.render) {
  5915. if (!isSSR && compile && !Component.render) {
  5916. const template = Component.template || resolveMergedOptions(instance).template;
  5917. if (template) {
  5918. const { isCustomElement, compilerOptions } = instance.appContext.config;
  5919. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  5920. const finalCompilerOptions = shared.extend(
  5921. shared.extend(
  5922. {
  5923. isCustomElement,
  5924. delimiters
  5925. },
  5926. compilerOptions
  5927. ),
  5928. componentCompilerOptions
  5929. );
  5930. Component.render = compile(template, finalCompilerOptions);
  5931. }
  5932. }
  5933. instance.render = Component.render || shared.NOOP;
  5934. if (installWithProxy) {
  5935. installWithProxy(instance);
  5936. }
  5937. }
  5938. {
  5939. setCurrentInstance(instance);
  5940. reactivity.pauseTracking();
  5941. try {
  5942. applyOptions(instance);
  5943. } finally {
  5944. reactivity.resetTracking();
  5945. unsetCurrentInstance();
  5946. }
  5947. }
  5948. }
  5949. function getAttrsProxy(instance) {
  5950. return instance.attrsProxy || (instance.attrsProxy = new Proxy(
  5951. instance.attrs,
  5952. {
  5953. get(target, key) {
  5954. reactivity.track(instance, "get", "$attrs");
  5955. return target[key];
  5956. }
  5957. }
  5958. ));
  5959. }
  5960. function createSetupContext(instance) {
  5961. const expose = (exposed) => {
  5962. instance.exposed = exposed || {};
  5963. };
  5964. {
  5965. return {
  5966. get attrs() {
  5967. return getAttrsProxy(instance);
  5968. },
  5969. slots: instance.slots,
  5970. emit: instance.emit,
  5971. expose
  5972. };
  5973. }
  5974. }
  5975. function getExposeProxy(instance) {
  5976. if (instance.exposed) {
  5977. return instance.exposeProxy || (instance.exposeProxy = new Proxy(reactivity.proxyRefs(reactivity.markRaw(instance.exposed)), {
  5978. get(target, key) {
  5979. if (key in target) {
  5980. return target[key];
  5981. } else if (key in publicPropertiesMap) {
  5982. return publicPropertiesMap[key](instance);
  5983. }
  5984. },
  5985. has(target, key) {
  5986. return key in target || key in publicPropertiesMap;
  5987. }
  5988. }));
  5989. }
  5990. }
  5991. function getComponentName(Component, includeInferred = true) {
  5992. return shared.isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  5993. }
  5994. function isClassComponent(value) {
  5995. return shared.isFunction(value) && "__vccOpts" in value;
  5996. }
  5997. const computed = (getterOrOptions, debugOptions) => {
  5998. return reactivity.computed(getterOrOptions, debugOptions, isInSSRComponentSetup);
  5999. };
  6000. function h(type, propsOrChildren, children) {
  6001. const l = arguments.length;
  6002. if (l === 2) {
  6003. if (shared.isObject(propsOrChildren) && !shared.isArray(propsOrChildren)) {
  6004. if (isVNode(propsOrChildren)) {
  6005. return createVNode(type, null, [propsOrChildren]);
  6006. }
  6007. return createVNode(type, propsOrChildren);
  6008. } else {
  6009. return createVNode(type, null, propsOrChildren);
  6010. }
  6011. } else {
  6012. if (l > 3) {
  6013. children = Array.prototype.slice.call(arguments, 2);
  6014. } else if (l === 3 && isVNode(children)) {
  6015. children = [children];
  6016. }
  6017. return createVNode(type, propsOrChildren, children);
  6018. }
  6019. }
  6020. const ssrContextKey = Symbol.for("v-scx");
  6021. const useSSRContext = () => {
  6022. {
  6023. const ctx = inject(ssrContextKey);
  6024. return ctx;
  6025. }
  6026. };
  6027. function initCustomFormatter() {
  6028. {
  6029. return;
  6030. }
  6031. }
  6032. function withMemo(memo, render, cache, index) {
  6033. const cached = cache[index];
  6034. if (cached && isMemoSame(cached, memo)) {
  6035. return cached;
  6036. }
  6037. const ret = render();
  6038. ret.memo = memo.slice();
  6039. return cache[index] = ret;
  6040. }
  6041. function isMemoSame(cached, memo) {
  6042. const prev = cached.memo;
  6043. if (prev.length != memo.length) {
  6044. return false;
  6045. }
  6046. for (let i = 0; i < prev.length; i++) {
  6047. if (shared.hasChanged(prev[i], memo[i])) {
  6048. return false;
  6049. }
  6050. }
  6051. if (isBlockTreeEnabled > 0 && currentBlock) {
  6052. currentBlock.push(cached);
  6053. }
  6054. return true;
  6055. }
  6056. const version = "3.3.11";
  6057. const _ssrUtils = {
  6058. createComponentInstance,
  6059. setupComponent,
  6060. renderComponentRoot,
  6061. setCurrentRenderingInstance,
  6062. isVNode: isVNode,
  6063. normalizeVNode
  6064. };
  6065. const ssrUtils = _ssrUtils ;
  6066. const resolveFilter = null;
  6067. const compatUtils = null;
  6068. exports.EffectScope = reactivity.EffectScope;
  6069. exports.ReactiveEffect = reactivity.ReactiveEffect;
  6070. exports.customRef = reactivity.customRef;
  6071. exports.effect = reactivity.effect;
  6072. exports.effectScope = reactivity.effectScope;
  6073. exports.getCurrentScope = reactivity.getCurrentScope;
  6074. exports.isProxy = reactivity.isProxy;
  6075. exports.isReactive = reactivity.isReactive;
  6076. exports.isReadonly = reactivity.isReadonly;
  6077. exports.isRef = reactivity.isRef;
  6078. exports.isShallow = reactivity.isShallow;
  6079. exports.markRaw = reactivity.markRaw;
  6080. exports.onScopeDispose = reactivity.onScopeDispose;
  6081. exports.proxyRefs = reactivity.proxyRefs;
  6082. exports.reactive = reactivity.reactive;
  6083. exports.readonly = reactivity.readonly;
  6084. exports.ref = reactivity.ref;
  6085. exports.shallowReactive = reactivity.shallowReactive;
  6086. exports.shallowReadonly = reactivity.shallowReadonly;
  6087. exports.shallowRef = reactivity.shallowRef;
  6088. exports.stop = reactivity.stop;
  6089. exports.toRaw = reactivity.toRaw;
  6090. exports.toRef = reactivity.toRef;
  6091. exports.toRefs = reactivity.toRefs;
  6092. exports.toValue = reactivity.toValue;
  6093. exports.triggerRef = reactivity.triggerRef;
  6094. exports.unref = reactivity.unref;
  6095. exports.camelize = shared.camelize;
  6096. exports.capitalize = shared.capitalize;
  6097. exports.normalizeClass = shared.normalizeClass;
  6098. exports.normalizeProps = shared.normalizeProps;
  6099. exports.normalizeStyle = shared.normalizeStyle;
  6100. exports.toDisplayString = shared.toDisplayString;
  6101. exports.toHandlerKey = shared.toHandlerKey;
  6102. exports.BaseTransition = BaseTransition;
  6103. exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
  6104. exports.Comment = Comment;
  6105. exports.Fragment = Fragment;
  6106. exports.KeepAlive = KeepAlive;
  6107. exports.Static = Static;
  6108. exports.Suspense = Suspense;
  6109. exports.Teleport = Teleport;
  6110. exports.Text = Text;
  6111. exports.assertNumber = assertNumber;
  6112. exports.callWithAsyncErrorHandling = callWithAsyncErrorHandling;
  6113. exports.callWithErrorHandling = callWithErrorHandling;
  6114. exports.cloneVNode = cloneVNode;
  6115. exports.compatUtils = compatUtils;
  6116. exports.computed = computed;
  6117. exports.createBlock = createBlock;
  6118. exports.createCommentVNode = createCommentVNode;
  6119. exports.createElementBlock = createElementBlock;
  6120. exports.createElementVNode = createBaseVNode;
  6121. exports.createHydrationRenderer = createHydrationRenderer;
  6122. exports.createPropsRestProxy = createPropsRestProxy;
  6123. exports.createRenderer = createRenderer;
  6124. exports.createSlots = createSlots;
  6125. exports.createStaticVNode = createStaticVNode;
  6126. exports.createTextVNode = createTextVNode;
  6127. exports.createVNode = createVNode;
  6128. exports.defineAsyncComponent = defineAsyncComponent;
  6129. exports.defineComponent = defineComponent;
  6130. exports.defineEmits = defineEmits;
  6131. exports.defineExpose = defineExpose;
  6132. exports.defineModel = defineModel;
  6133. exports.defineOptions = defineOptions;
  6134. exports.defineProps = defineProps;
  6135. exports.defineSlots = defineSlots;
  6136. exports.getCurrentInstance = getCurrentInstance;
  6137. exports.getTransitionRawChildren = getTransitionRawChildren;
  6138. exports.guardReactiveProps = guardReactiveProps;
  6139. exports.h = h;
  6140. exports.handleError = handleError;
  6141. exports.hasInjectionContext = hasInjectionContext;
  6142. exports.initCustomFormatter = initCustomFormatter;
  6143. exports.inject = inject;
  6144. exports.isMemoSame = isMemoSame;
  6145. exports.isRuntimeOnly = isRuntimeOnly;
  6146. exports.isVNode = isVNode;
  6147. exports.mergeDefaults = mergeDefaults;
  6148. exports.mergeModels = mergeModels;
  6149. exports.mergeProps = mergeProps;
  6150. exports.nextTick = nextTick;
  6151. exports.onActivated = onActivated;
  6152. exports.onBeforeMount = onBeforeMount;
  6153. exports.onBeforeUnmount = onBeforeUnmount;
  6154. exports.onBeforeUpdate = onBeforeUpdate;
  6155. exports.onDeactivated = onDeactivated;
  6156. exports.onErrorCaptured = onErrorCaptured;
  6157. exports.onMounted = onMounted;
  6158. exports.onRenderTracked = onRenderTracked;
  6159. exports.onRenderTriggered = onRenderTriggered;
  6160. exports.onServerPrefetch = onServerPrefetch;
  6161. exports.onUnmounted = onUnmounted;
  6162. exports.onUpdated = onUpdated;
  6163. exports.openBlock = openBlock;
  6164. exports.popScopeId = popScopeId;
  6165. exports.provide = provide;
  6166. exports.pushScopeId = pushScopeId;
  6167. exports.queuePostFlushCb = queuePostFlushCb;
  6168. exports.registerRuntimeCompiler = registerRuntimeCompiler;
  6169. exports.renderList = renderList;
  6170. exports.renderSlot = renderSlot;
  6171. exports.resolveComponent = resolveComponent;
  6172. exports.resolveDirective = resolveDirective;
  6173. exports.resolveDynamicComponent = resolveDynamicComponent;
  6174. exports.resolveFilter = resolveFilter;
  6175. exports.resolveTransitionHooks = resolveTransitionHooks;
  6176. exports.setBlockTracking = setBlockTracking;
  6177. exports.setDevtoolsHook = setDevtoolsHook;
  6178. exports.setTransitionHooks = setTransitionHooks;
  6179. exports.ssrContextKey = ssrContextKey;
  6180. exports.ssrUtils = ssrUtils;
  6181. exports.toHandlers = toHandlers;
  6182. exports.transformVNodeArgs = transformVNodeArgs;
  6183. exports.useAttrs = useAttrs;
  6184. exports.useModel = useModel;
  6185. exports.useSSRContext = useSSRContext;
  6186. exports.useSlots = useSlots;
  6187. exports.useTransitionState = useTransitionState;
  6188. exports.version = version;
  6189. exports.warn = warn$1;
  6190. exports.watch = watch;
  6191. exports.watchEffect = watchEffect;
  6192. exports.watchPostEffect = watchPostEffect;
  6193. exports.watchSyncEffect = watchSyncEffect;
  6194. exports.withAsyncContext = withAsyncContext;
  6195. exports.withCtx = withCtx;
  6196. exports.withDefaults = withDefaults;
  6197. exports.withDirectives = withDirectives;
  6198. exports.withMemo = withMemo;
  6199. exports.withScopeId = withScopeId;