uvue.runtime.esm.prod.js 262 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062
  1. function makeMap(str, expectsLowerCase) {
  2. var map = /* @__PURE__ */Object.create(null);
  3. var list = str.split(",");
  4. for (var i = 0; i < list.length; i++) {
  5. map[list[i]] = true;
  6. }
  7. return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
  8. }
  9. var EMPTY_OBJ = {};
  10. var EMPTY_ARR = [];
  11. var NOOP = () => {};
  12. var NO = () => false;
  13. var isOn = key => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && (
  14. // uppercase letter
  15. key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  16. var isModelListener = key => key.startsWith("onUpdate:");
  17. var extend$1 = Object.assign;
  18. var remove = (arr, el) => {
  19. var i = arr.indexOf(el);
  20. if (i > -1) {
  21. arr.splice(i, 1);
  22. }
  23. };
  24. var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  25. var hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  26. var isArray = Array.isArray;
  27. var isMap = val => toTypeString(val) === "[object Map]";
  28. var isSet = val => toTypeString(val) === "[object Set]";
  29. var isRegExp = val => toTypeString(val) === "[object RegExp]";
  30. var isFunction = val => typeof val === "function";
  31. var isString = val => typeof val === "string";
  32. var isSymbol = val => typeof val === "symbol";
  33. var isObject = val => val !== null && typeof val === "object";
  34. var isPromise = val => {
  35. return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  36. };
  37. var objectToString = Object.prototype.toString;
  38. var toTypeString = value => objectToString.call(value);
  39. var toRawType = value => {
  40. return toTypeString(value).slice(8, -1);
  41. };
  42. var isPlainObject = val => toTypeString(val) === "[object Object]";
  43. var isIntegerKey = key => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  44. var isReservedProp = /* @__PURE__ */makeMap(
  45. // the leading comma is intentional so empty string "" is also included
  46. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
  47. var cacheStringFunction = fn => {
  48. var cache = /* @__PURE__ */Object.create(null);
  49. return str => {
  50. var hit = cache[str];
  51. return hit || (cache[str] = fn(str));
  52. };
  53. };
  54. var camelizeRE = /-(\w)/g;
  55. var camelize = cacheStringFunction(str => {
  56. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  57. });
  58. var hyphenateRE = /\B([A-Z])/g;
  59. var hyphenate = cacheStringFunction(str => str.replace(hyphenateRE, "-$1").toLowerCase());
  60. var capitalize = cacheStringFunction(str => {
  61. return str.charAt(0).toUpperCase() + str.slice(1);
  62. });
  63. var toHandlerKey = cacheStringFunction(str => {
  64. var s = str ? "on".concat(capitalize(str)) : "";
  65. return s;
  66. });
  67. var hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  68. var invokeArrayFns = (fns, arg) => {
  69. for (var i = 0; i < fns.length; i++) {
  70. fns[i](arg);
  71. }
  72. };
  73. var def = (obj, key, value) => {
  74. Object.defineProperty(obj, key, {
  75. configurable: true,
  76. enumerable: false,
  77. value
  78. });
  79. };
  80. var looseToNumber = val => {
  81. var n = parseFloat(val);
  82. return isNaN(n) ? val : n;
  83. };
  84. var toNumber = val => {
  85. var n = isString(val) ? Number(val) : NaN;
  86. return isNaN(n) ? val : n;
  87. };
  88. var _globalThis;
  89. var getGlobalThis = () => {
  90. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  91. };
  92. var GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
  93. var isGloballyAllowed = /* @__PURE__ */makeMap(GLOBALS_ALLOWED);
  94. var isGloballyWhitelisted = isGloballyAllowed;
  95. function normalizeStyle(value) {
  96. if (isArray(value)) {
  97. var res = {};
  98. for (var i = 0; i < value.length; i++) {
  99. var item = value[i];
  100. var normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  101. if (normalized) {
  102. for (var key in normalized) {
  103. res[key] = normalized[key];
  104. }
  105. }
  106. }
  107. return res;
  108. } else if (isString(value) || isObject(value)) {
  109. return value;
  110. }
  111. }
  112. var listDelimiterRE = /;(?![^(]*\))/g;
  113. var propertyDelimiterRE = /:([^]+)/;
  114. var styleCommentRE = /\/\*[^]*?\*\//g;
  115. function parseStringStyle(cssText) {
  116. var ret = {};
  117. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach(item => {
  118. if (item) {
  119. var tmp = item.split(propertyDelimiterRE);
  120. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  121. }
  122. });
  123. return ret;
  124. }
  125. function normalizeClass(value) {
  126. var res = "";
  127. if (isString(value)) {
  128. res = value;
  129. } else if (isArray(value)) {
  130. for (var i = 0; i < value.length; i++) {
  131. var normalized = normalizeClass(value[i]);
  132. if (normalized) {
  133. res += normalized + " ";
  134. }
  135. }
  136. } else if (isObject(value)) {
  137. for (var name in value) {
  138. if (value[name]) {
  139. res += name + " ";
  140. }
  141. }
  142. }
  143. return res.trim();
  144. }
  145. function normalizeProps(props) {
  146. if (!props) return null;
  147. var {
  148. class: klass,
  149. style
  150. } = props;
  151. if (klass && !isString(klass)) {
  152. props.class = normalizeClass(klass);
  153. }
  154. if (style) {
  155. props.style = normalizeStyle(style);
  156. }
  157. return props;
  158. }
  159. var toDisplayString = val => {
  160. return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
  161. };
  162. var replacer = (_key, val) => {
  163. if (val && val.__v_isRef) {
  164. return replacer(_key, val.value);
  165. } else if (isMap(val)) {
  166. return {
  167. ["Map(".concat(val.size, ")")]: [...val.entries()].reduce((entries, _ref, i) => {
  168. var [key, val2] = _ref;
  169. entries[stringifySymbol(key, i) + " =>"] = val2;
  170. return entries;
  171. }, {})
  172. };
  173. } else if (isSet(val)) {
  174. return {
  175. ["Set(".concat(val.size, ")")]: [...val.values()].map(v => stringifySymbol(v))
  176. };
  177. } else if (isSymbol(val)) {
  178. return stringifySymbol(val);
  179. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  180. return String(val);
  181. }
  182. return val;
  183. };
  184. var stringifySymbol = function (v) {
  185. var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
  186. var _a;
  187. return isSymbol(v) ? "Symbol(".concat((_a = v.description) != null ? _a : i, ")") : v;
  188. };
  189. var activeEffectScope;
  190. class EffectScope {
  191. constructor() {
  192. var detached = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  193. this.detached = detached;
  194. /**
  195. * @internal
  196. */
  197. this._active = true;
  198. /**
  199. * @internal
  200. */
  201. this.effects = [];
  202. /**
  203. * @internal
  204. */
  205. this.cleanups = [];
  206. this.parent = activeEffectScope;
  207. if (!detached && activeEffectScope) {
  208. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
  209. }
  210. }
  211. get active() {
  212. return this._active;
  213. }
  214. run(fn) {
  215. if (this._active) {
  216. var currentEffectScope = activeEffectScope;
  217. try {
  218. activeEffectScope = this;
  219. return fn();
  220. } finally {
  221. activeEffectScope = currentEffectScope;
  222. }
  223. }
  224. }
  225. /**
  226. * This should only be called on non-detached scopes
  227. * @internal
  228. */
  229. on() {
  230. activeEffectScope = this;
  231. }
  232. /**
  233. * This should only be called on non-detached scopes
  234. * @internal
  235. */
  236. off() {
  237. activeEffectScope = this.parent;
  238. }
  239. stop(fromParent) {
  240. if (this._active) {
  241. var i, l;
  242. for (i = 0, l = this.effects.length; i < l; i++) {
  243. this.effects[i].stop();
  244. }
  245. for (i = 0, l = this.cleanups.length; i < l; i++) {
  246. this.cleanups[i]();
  247. }
  248. if (this.scopes) {
  249. for (i = 0, l = this.scopes.length; i < l; i++) {
  250. this.scopes[i].stop(true);
  251. }
  252. }
  253. if (!this.detached && this.parent && !fromParent) {
  254. var last = this.parent.scopes.pop();
  255. if (last && last !== this) {
  256. this.parent.scopes[this.index] = last;
  257. last.index = this.index;
  258. }
  259. }
  260. this.parent = void 0;
  261. this._active = false;
  262. }
  263. }
  264. }
  265. function effectScope(detached) {
  266. return new EffectScope(detached);
  267. }
  268. function recordEffectScope(effect) {
  269. var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : activeEffectScope;
  270. if (scope && scope.active) {
  271. scope.effects.push(effect);
  272. }
  273. }
  274. function getCurrentScope() {
  275. return activeEffectScope;
  276. }
  277. function onScopeDispose(fn) {
  278. if (activeEffectScope) {
  279. activeEffectScope.cleanups.push(fn);
  280. }
  281. }
  282. var createDep = effects => {
  283. var dep = new Set(effects);
  284. dep.w = 0;
  285. dep.n = 0;
  286. return dep;
  287. };
  288. var wasTracked = dep => (dep.w & trackOpBit) > 0;
  289. var newTracked = dep => (dep.n & trackOpBit) > 0;
  290. var initDepMarkers = _ref2 => {
  291. var {
  292. deps
  293. } = _ref2;
  294. if (deps.length) {
  295. for (var i = 0; i < deps.length; i++) {
  296. deps[i].w |= trackOpBit;
  297. }
  298. }
  299. };
  300. var finalizeDepMarkers = effect => {
  301. var {
  302. deps
  303. } = effect;
  304. if (deps.length) {
  305. var ptr = 0;
  306. for (var i = 0; i < deps.length; i++) {
  307. var dep = deps[i];
  308. if (wasTracked(dep) && !newTracked(dep)) {
  309. dep.delete(effect);
  310. } else {
  311. deps[ptr++] = dep;
  312. }
  313. dep.w &= ~trackOpBit;
  314. dep.n &= ~trackOpBit;
  315. }
  316. deps.length = ptr;
  317. }
  318. };
  319. var targetMap = /* @__PURE__ */new WeakMap();
  320. var effectTrackDepth = 0;
  321. var trackOpBit = 1;
  322. var maxMarkerBits = 30;
  323. var activeEffect;
  324. var ITERATE_KEY = Symbol("");
  325. var MAP_KEY_ITERATE_KEY = Symbol("");
  326. class ReactiveEffect {
  327. constructor(fn) {
  328. var scheduler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  329. var scope = arguments.length > 2 ? arguments[2] : undefined;
  330. this.fn = fn;
  331. this.scheduler = scheduler;
  332. this.active = true;
  333. this.deps = [];
  334. this.parent = void 0;
  335. recordEffectScope(this, scope);
  336. }
  337. run() {
  338. if (!this.active) {
  339. return this.fn();
  340. }
  341. var parent = activeEffect;
  342. var lastShouldTrack = shouldTrack;
  343. while (parent) {
  344. if (parent === this) {
  345. return;
  346. }
  347. parent = parent.parent;
  348. }
  349. try {
  350. this.parent = activeEffect;
  351. activeEffect = this;
  352. shouldTrack = true;
  353. trackOpBit = 1 << ++effectTrackDepth;
  354. if (effectTrackDepth <= maxMarkerBits) {
  355. initDepMarkers(this);
  356. } else {
  357. cleanupEffect(this);
  358. }
  359. return this.fn();
  360. } finally {
  361. if (effectTrackDepth <= maxMarkerBits) {
  362. finalizeDepMarkers(this);
  363. }
  364. trackOpBit = 1 << --effectTrackDepth;
  365. activeEffect = this.parent;
  366. shouldTrack = lastShouldTrack;
  367. this.parent = void 0;
  368. if (this.deferStop) {
  369. this.stop();
  370. }
  371. }
  372. }
  373. stop() {
  374. if (activeEffect === this) {
  375. this.deferStop = true;
  376. } else if (this.active) {
  377. cleanupEffect(this);
  378. if (this.onStop) {
  379. this.onStop();
  380. }
  381. this.active = false;
  382. }
  383. }
  384. }
  385. function cleanupEffect(effect2) {
  386. var {
  387. deps
  388. } = effect2;
  389. if (deps.length) {
  390. for (var i = 0; i < deps.length; i++) {
  391. deps[i].delete(effect2);
  392. }
  393. deps.length = 0;
  394. }
  395. }
  396. function effect(fn, options) {
  397. if (fn.effect instanceof ReactiveEffect) {
  398. fn = fn.effect.fn;
  399. }
  400. var _effect = new ReactiveEffect(fn);
  401. if (options) {
  402. extend$1(_effect, options);
  403. if (options.scope) recordEffectScope(_effect, options.scope);
  404. }
  405. if (!options || !options.lazy) {
  406. _effect.run();
  407. }
  408. var runner = _effect.run.bind(_effect);
  409. runner.effect = _effect;
  410. return runner;
  411. }
  412. function stop(runner) {
  413. runner.effect.stop();
  414. }
  415. var shouldTrack = true;
  416. var trackStack = [];
  417. function pauseTracking() {
  418. trackStack.push(shouldTrack);
  419. shouldTrack = false;
  420. }
  421. function resetTracking() {
  422. var last = trackStack.pop();
  423. shouldTrack = last === void 0 ? true : last;
  424. }
  425. function track(target, type, key) {
  426. if (shouldTrack && activeEffect) {
  427. var depsMap = targetMap.get(target);
  428. if (!depsMap) {
  429. targetMap.set(target, depsMap = /* @__PURE__ */new Map());
  430. }
  431. var dep = depsMap.get(key);
  432. if (!dep) {
  433. depsMap.set(key, dep = createDep());
  434. }
  435. trackEffects(dep);
  436. }
  437. }
  438. function trackEffects(dep, debuggerEventExtraInfo) {
  439. var shouldTrack2 = false;
  440. if (effectTrackDepth <= maxMarkerBits) {
  441. if (!newTracked(dep)) {
  442. dep.n |= trackOpBit;
  443. shouldTrack2 = !wasTracked(dep);
  444. }
  445. } else {
  446. shouldTrack2 = !dep.has(activeEffect);
  447. }
  448. if (shouldTrack2) {
  449. dep.add(activeEffect);
  450. activeEffect.deps.push(dep);
  451. }
  452. }
  453. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  454. var depsMap = targetMap.get(target);
  455. if (!depsMap) {
  456. return;
  457. }
  458. var deps = [];
  459. if (type === "clear") {
  460. deps = [...depsMap.values()];
  461. } else if (key === "length" && isArray(target)) {
  462. var newLength = Number(newValue);
  463. depsMap.forEach((dep, key2) => {
  464. if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
  465. deps.push(dep);
  466. }
  467. });
  468. } else {
  469. if (key !== void 0) {
  470. deps.push(depsMap.get(key));
  471. }
  472. switch (type) {
  473. case "add":
  474. if (!isArray(target)) {
  475. deps.push(depsMap.get(ITERATE_KEY));
  476. if (isMap(target)) {
  477. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  478. }
  479. } else if (isIntegerKey(key)) {
  480. deps.push(depsMap.get("length"));
  481. }
  482. break;
  483. case "delete":
  484. if (!isArray(target)) {
  485. deps.push(depsMap.get(ITERATE_KEY));
  486. if (isMap(target)) {
  487. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  488. }
  489. }
  490. break;
  491. case "set":
  492. if (isMap(target)) {
  493. deps.push(depsMap.get(ITERATE_KEY));
  494. }
  495. break;
  496. }
  497. }
  498. if (deps.length === 1) {
  499. if (deps[0]) {
  500. {
  501. triggerEffects(deps[0]);
  502. }
  503. }
  504. } else {
  505. var effects = [];
  506. for (var dep of deps) {
  507. if (dep) {
  508. effects.push(...dep);
  509. }
  510. }
  511. {
  512. triggerEffects(createDep(effects));
  513. }
  514. }
  515. }
  516. function triggerEffects(dep, debuggerEventExtraInfo) {
  517. var effects = isArray(dep) ? dep : [...dep];
  518. for (var effect2 of effects) {
  519. if (effect2.computed) {
  520. triggerEffect(effect2);
  521. }
  522. }
  523. for (var _effect2 of effects) {
  524. if (!_effect2.computed) {
  525. triggerEffect(_effect2);
  526. }
  527. }
  528. }
  529. function triggerEffect(effect2, debuggerEventExtraInfo) {
  530. if (effect2 !== activeEffect || effect2.allowRecurse) {
  531. if (effect2.scheduler) {
  532. effect2.scheduler();
  533. } else {
  534. effect2.run();
  535. }
  536. }
  537. }
  538. function getDepFromReactive(object, key) {
  539. var _a;
  540. return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
  541. }
  542. var isNonTrackableKeys = /* @__PURE__ */makeMap("__proto__,__v_isRef,__isVue");
  543. var builtInSymbols = new Set( /* @__PURE__ */Object.getOwnPropertyNames(Symbol).filter(key => key !== "arguments" && key !== "caller").map(key => Symbol[key]).filter(isSymbol));
  544. var arrayInstrumentations = /* @__PURE__ */createArrayInstrumentations();
  545. function createArrayInstrumentations() {
  546. var instrumentations = {};
  547. ["includes", "indexOf", "lastIndexOf"].forEach(key => {
  548. instrumentations[key] = function () {
  549. var arr = toRaw(this);
  550. for (var i = 0, l = this.length; i < l; i++) {
  551. track(arr, "get", i + "");
  552. }
  553. for (var _len = arguments.length, args = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
  554. args[_key2] = arguments[_key2];
  555. }
  556. var res = arr[key](...args);
  557. if (res === -1 || res === false) {
  558. return arr[key](...args.map(toRaw));
  559. } else {
  560. return res;
  561. }
  562. };
  563. });
  564. ["push", "pop", "shift", "unshift", "splice"].forEach(key => {
  565. instrumentations[key] = function () {
  566. pauseTracking();
  567. for (var _len2 = arguments.length, args = new Array(_len2), _key3 = 0; _key3 < _len2; _key3++) {
  568. args[_key3] = arguments[_key3];
  569. }
  570. var res = toRaw(this)[key].apply(this, args);
  571. resetTracking();
  572. return res;
  573. };
  574. });
  575. return instrumentations;
  576. }
  577. function hasOwnProperty(key) {
  578. var obj = toRaw(this);
  579. track(obj, "has", key);
  580. return obj.hasOwnProperty(key);
  581. }
  582. class BaseReactiveHandler {
  583. constructor() {
  584. var _isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  585. var _shallow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  586. this._isReadonly = _isReadonly;
  587. this._shallow = _shallow;
  588. }
  589. get(target, key, receiver) {
  590. var isReadonly2 = this._isReadonly,
  591. shallow = this._shallow;
  592. if (key === "__v_isReactive") {
  593. return !isReadonly2;
  594. } else if (key === "__v_isReadonly") {
  595. return isReadonly2;
  596. } else if (key === "__v_isShallow") {
  597. return shallow;
  598. } else if (key === "__v_raw") {
  599. if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) ||
  600. // receiver is not the reactive proxy, but has the same prototype
  601. // this means the reciever is a user proxy of the reactive proxy
  602. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  603. return target;
  604. }
  605. return;
  606. }
  607. var targetIsArray = isArray(target);
  608. if (!isReadonly2) {
  609. if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
  610. return Reflect.get(arrayInstrumentations, key, receiver);
  611. }
  612. if (key === "hasOwnProperty") {
  613. return hasOwnProperty;
  614. }
  615. }
  616. var res = Reflect.get(target, key, receiver);
  617. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  618. return res;
  619. }
  620. if (!isReadonly2) {
  621. track(target, "get", key);
  622. }
  623. if (shallow) {
  624. return res;
  625. }
  626. if (isRef(res)) {
  627. return targetIsArray && isIntegerKey(key) ? res : res.value;
  628. }
  629. if (isObject(res)) {
  630. return isReadonly2 ? readonly(res) : reactive(res);
  631. }
  632. return res;
  633. }
  634. }
  635. class MutableReactiveHandler extends BaseReactiveHandler {
  636. constructor() {
  637. var shallow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  638. super(false, shallow);
  639. }
  640. set(target, key, value, receiver) {
  641. var oldValue = target[key];
  642. if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
  643. return false;
  644. }
  645. if (!this._shallow) {
  646. if (!isShallow(value) && !isReadonly(value)) {
  647. oldValue = toRaw(oldValue);
  648. value = toRaw(value);
  649. }
  650. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  651. oldValue.value = value;
  652. return true;
  653. }
  654. }
  655. var hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  656. var result = Reflect.set(target, key, value, receiver);
  657. if (target === toRaw(receiver)) {
  658. if (!hadKey) {
  659. trigger(target, "add", key, value);
  660. } else if (hasChanged(value, oldValue)) {
  661. trigger(target, "set", key, value);
  662. }
  663. }
  664. return result;
  665. }
  666. deleteProperty(target, key) {
  667. var hadKey = hasOwn(target, key);
  668. target[key];
  669. var result = Reflect.deleteProperty(target, key);
  670. if (result && hadKey) {
  671. trigger(target, "delete", key, void 0);
  672. }
  673. return result;
  674. }
  675. has(target, key) {
  676. var result = Reflect.has(target, key);
  677. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  678. track(target, "has", key);
  679. }
  680. return result;
  681. }
  682. ownKeys(target) {
  683. track(target, "iterate", isArray(target) ? "length" : ITERATE_KEY);
  684. return Reflect.ownKeys(target);
  685. }
  686. }
  687. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  688. constructor() {
  689. var shallow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  690. super(true, shallow);
  691. }
  692. set(target, key) {
  693. return true;
  694. }
  695. deleteProperty(target, key) {
  696. return true;
  697. }
  698. }
  699. var mutableHandlers = /* @__PURE__ */new MutableReactiveHandler();
  700. var readonlyHandlers = /* @__PURE__ */new ReadonlyReactiveHandler();
  701. var shallowReactiveHandlers = /* @__PURE__ */new MutableReactiveHandler(true);
  702. var shallowReadonlyHandlers = /* @__PURE__ */new ReadonlyReactiveHandler(true);
  703. var toShallow = value => value;
  704. var getProto = v => Reflect.getPrototypeOf(v);
  705. function get(target, key) {
  706. var isReadonly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  707. var isShallow = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  708. target = target["__v_raw"];
  709. var rawTarget = toRaw(target);
  710. var rawKey = toRaw(key);
  711. if (!isReadonly) {
  712. if (hasChanged(key, rawKey)) {
  713. track(rawTarget, "get", key);
  714. }
  715. track(rawTarget, "get", rawKey);
  716. }
  717. var {
  718. has: has2
  719. } = getProto(rawTarget);
  720. var wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  721. if (has2.call(rawTarget, key)) {
  722. return wrap(target.get(key));
  723. } else if (has2.call(rawTarget, rawKey)) {
  724. return wrap(target.get(rawKey));
  725. } else if (target !== rawTarget) {
  726. target.get(key);
  727. }
  728. }
  729. function has(key) {
  730. var isReadonly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  731. var target = this["__v_raw"];
  732. var rawTarget = toRaw(target);
  733. var rawKey = toRaw(key);
  734. if (!isReadonly) {
  735. if (hasChanged(key, rawKey)) {
  736. track(rawTarget, "has", key);
  737. }
  738. track(rawTarget, "has", rawKey);
  739. }
  740. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  741. }
  742. function size(target) {
  743. var isReadonly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  744. target = target["__v_raw"];
  745. !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
  746. return Reflect.get(target, "size", target);
  747. }
  748. function add(value) {
  749. value = toRaw(value);
  750. var target = toRaw(this);
  751. var proto = getProto(target);
  752. var hadKey = proto.has.call(target, value);
  753. if (!hadKey) {
  754. target.add(value);
  755. trigger(target, "add", value, value);
  756. }
  757. return this;
  758. }
  759. function set(key, value) {
  760. value = toRaw(value);
  761. var target = toRaw(this);
  762. var {
  763. has: has2,
  764. get: get2
  765. } = getProto(target);
  766. var hadKey = has2.call(target, key);
  767. if (!hadKey) {
  768. key = toRaw(key);
  769. hadKey = has2.call(target, key);
  770. }
  771. var oldValue = get2.call(target, key);
  772. target.set(key, value);
  773. if (!hadKey) {
  774. trigger(target, "add", key, value);
  775. } else if (hasChanged(value, oldValue)) {
  776. trigger(target, "set", key, value);
  777. }
  778. return this;
  779. }
  780. function deleteEntry(key) {
  781. var target = toRaw(this);
  782. var {
  783. has: has2,
  784. get: get2
  785. } = getProto(target);
  786. var hadKey = has2.call(target, key);
  787. if (!hadKey) {
  788. key = toRaw(key);
  789. hadKey = has2.call(target, key);
  790. }
  791. get2 ? get2.call(target, key) : void 0;
  792. var result = target.delete(key);
  793. if (hadKey) {
  794. trigger(target, "delete", key, void 0);
  795. }
  796. return result;
  797. }
  798. function clear() {
  799. var target = toRaw(this);
  800. var hadItems = target.size !== 0;
  801. var result = target.clear();
  802. if (hadItems) {
  803. trigger(target, "clear", void 0, void 0);
  804. }
  805. return result;
  806. }
  807. function createForEach(isReadonly, isShallow) {
  808. return function forEach(callback, thisArg) {
  809. var observed = this;
  810. var target = observed["__v_raw"];
  811. var rawTarget = toRaw(target);
  812. var wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  813. !isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
  814. return target.forEach((value, key) => {
  815. return callback.call(thisArg, wrap(value), wrap(key), observed);
  816. });
  817. };
  818. }
  819. function createIterableMethod(method, isReadonly, isShallow) {
  820. return function () {
  821. var target = this["__v_raw"];
  822. var rawTarget = toRaw(target);
  823. var targetIsMap = isMap(rawTarget);
  824. var isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  825. var isKeyOnly = method === "keys" && targetIsMap;
  826. var innerIterator = target[method](...arguments);
  827. var wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  828. !isReadonly && track(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
  829. return {
  830. // iterator protocol
  831. next() {
  832. var {
  833. value,
  834. done
  835. } = innerIterator.next();
  836. return done ? {
  837. value,
  838. done
  839. } : {
  840. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  841. done
  842. };
  843. },
  844. // iterable protocol
  845. [Symbol.iterator]() {
  846. return this;
  847. }
  848. };
  849. };
  850. }
  851. function createReadonlyMethod(type) {
  852. return function () {
  853. return type === "delete" ? false : type === "clear" ? void 0 : this;
  854. };
  855. }
  856. function createInstrumentations() {
  857. var mutableInstrumentations2 = {
  858. get(key) {
  859. return get(this, key);
  860. },
  861. get size() {
  862. return size(this);
  863. },
  864. has,
  865. add,
  866. set,
  867. delete: deleteEntry,
  868. clear,
  869. forEach: createForEach(false, false)
  870. };
  871. var shallowInstrumentations2 = {
  872. get(key) {
  873. return get(this, key, false, true);
  874. },
  875. get size() {
  876. return size(this);
  877. },
  878. has,
  879. add,
  880. set,
  881. delete: deleteEntry,
  882. clear,
  883. forEach: createForEach(false, true)
  884. };
  885. var readonlyInstrumentations2 = {
  886. get(key) {
  887. return get(this, key, true);
  888. },
  889. get size() {
  890. return size(this, true);
  891. },
  892. has(key) {
  893. return has.call(this, key, true);
  894. },
  895. add: createReadonlyMethod("add"),
  896. set: createReadonlyMethod("set"),
  897. delete: createReadonlyMethod("delete"),
  898. clear: createReadonlyMethod("clear"),
  899. forEach: createForEach(true, false)
  900. };
  901. var shallowReadonlyInstrumentations2 = {
  902. get(key) {
  903. return get(this, key, true, true);
  904. },
  905. get size() {
  906. return size(this, true);
  907. },
  908. has(key) {
  909. return has.call(this, key, true);
  910. },
  911. add: createReadonlyMethod("add"),
  912. set: createReadonlyMethod("set"),
  913. delete: createReadonlyMethod("delete"),
  914. clear: createReadonlyMethod("clear"),
  915. forEach: createForEach(true, true)
  916. };
  917. var iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
  918. iteratorMethods.forEach(method => {
  919. mutableInstrumentations2[method] = createIterableMethod(method, false, false);
  920. readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
  921. shallowInstrumentations2[method] = createIterableMethod(method, false, true);
  922. shallowReadonlyInstrumentations2[method] = createIterableMethod(method, true, true);
  923. });
  924. return [mutableInstrumentations2, readonlyInstrumentations2, shallowInstrumentations2, shallowReadonlyInstrumentations2];
  925. }
  926. var [mutableInstrumentations, readonlyInstrumentations, shallowInstrumentations, shallowReadonlyInstrumentations] = /* @__PURE__ */createInstrumentations();
  927. function createInstrumentationGetter(isReadonly, shallow) {
  928. var instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
  929. return (target, key, receiver) => {
  930. if (key === "__v_isReactive") {
  931. return !isReadonly;
  932. } else if (key === "__v_isReadonly") {
  933. return isReadonly;
  934. } else if (key === "__v_raw") {
  935. return target;
  936. }
  937. return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
  938. };
  939. }
  940. var mutableCollectionHandlers = {
  941. get: /* @__PURE__ */createInstrumentationGetter(false, false)
  942. };
  943. var shallowCollectionHandlers = {
  944. get: /* @__PURE__ */createInstrumentationGetter(false, true)
  945. };
  946. var readonlyCollectionHandlers = {
  947. get: /* @__PURE__ */createInstrumentationGetter(true, false)
  948. };
  949. var shallowReadonlyCollectionHandlers = {
  950. get: /* @__PURE__ */createInstrumentationGetter(true, true)
  951. };
  952. var reactiveMap = /* @__PURE__ */new WeakMap();
  953. var shallowReactiveMap = /* @__PURE__ */new WeakMap();
  954. var readonlyMap = /* @__PURE__ */new WeakMap();
  955. var shallowReadonlyMap = /* @__PURE__ */new WeakMap();
  956. function targetTypeMap(rawType) {
  957. switch (rawType) {
  958. case "Object":
  959. case "Array":
  960. return 1 /* COMMON */;
  961. case "Map":
  962. case "Set":
  963. case "WeakMap":
  964. case "WeakSet":
  965. return 2 /* COLLECTION */;
  966. default:
  967. return 0 /* INVALID */;
  968. }
  969. }
  970. function getTargetType(value) {
  971. return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
  972. }
  973. function reactive(target) {
  974. if (isReadonly(target)) {
  975. return target;
  976. }
  977. return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
  978. }
  979. function shallowReactive(target) {
  980. return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
  981. }
  982. function readonly(target) {
  983. return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
  984. }
  985. function shallowReadonly(target) {
  986. return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
  987. }
  988. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  989. if (!isObject(target)) {
  990. return target;
  991. }
  992. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  993. return target;
  994. }
  995. var existingProxy = proxyMap.get(target);
  996. if (existingProxy) {
  997. return existingProxy;
  998. }
  999. var targetType = getTargetType(target);
  1000. if (targetType === 0 /* INVALID */) {
  1001. return target;
  1002. }
  1003. var proxy = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);
  1004. proxyMap.set(target, proxy);
  1005. return proxy;
  1006. }
  1007. function isReactive(value) {
  1008. if (isReadonly(value)) {
  1009. return isReactive(value["__v_raw"]);
  1010. }
  1011. return !!(value && value["__v_isReactive"]);
  1012. }
  1013. function isReadonly(value) {
  1014. return !!(value && value["__v_isReadonly"]);
  1015. }
  1016. function isShallow(value) {
  1017. return !!(value && value["__v_isShallow"]);
  1018. }
  1019. function isProxy(value) {
  1020. return isReactive(value) || isReadonly(value);
  1021. }
  1022. function toRaw(observed) {
  1023. var raw = observed && observed["__v_raw"];
  1024. return raw ? toRaw(raw) : observed;
  1025. }
  1026. function markRaw(value) {
  1027. def(value, "__v_skip", true);
  1028. return value;
  1029. }
  1030. var toReactive = value => isObject(value) ? reactive(value) : value;
  1031. var toReadonly = value => isObject(value) ? readonly(value) : value;
  1032. function trackRefValue(ref2) {
  1033. if (shouldTrack && activeEffect) {
  1034. ref2 = toRaw(ref2);
  1035. {
  1036. trackEffects(ref2.dep || (ref2.dep = createDep()));
  1037. }
  1038. }
  1039. }
  1040. function triggerRefValue(ref2, newVal) {
  1041. ref2 = toRaw(ref2);
  1042. var dep = ref2.dep;
  1043. if (dep) {
  1044. {
  1045. triggerEffects(dep);
  1046. }
  1047. }
  1048. }
  1049. function isRef(r) {
  1050. return !!(r && r.__v_isRef === true);
  1051. }
  1052. function ref(value) {
  1053. return createRef(value, false);
  1054. }
  1055. function shallowRef(value) {
  1056. return createRef(value, true);
  1057. }
  1058. function createRef(rawValue, shallow) {
  1059. if (isRef(rawValue)) {
  1060. return rawValue;
  1061. }
  1062. return new RefImpl(rawValue, shallow);
  1063. }
  1064. class RefImpl {
  1065. constructor(value, __v_isShallow) {
  1066. this.__v_isShallow = __v_isShallow;
  1067. this.dep = void 0;
  1068. this.__v_isRef = true;
  1069. this._rawValue = __v_isShallow ? value : toRaw(value);
  1070. this._value = __v_isShallow ? value : toReactive(value);
  1071. }
  1072. get value() {
  1073. trackRefValue(this);
  1074. return this._value;
  1075. }
  1076. set value(newVal) {
  1077. var useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
  1078. newVal = useDirectValue ? newVal : toRaw(newVal);
  1079. if (hasChanged(newVal, this._rawValue)) {
  1080. this._rawValue = newVal;
  1081. this._value = useDirectValue ? newVal : toReactive(newVal);
  1082. triggerRefValue(this);
  1083. }
  1084. }
  1085. }
  1086. function triggerRef(ref2) {
  1087. triggerRefValue(ref2);
  1088. }
  1089. function unref(ref2) {
  1090. return isRef(ref2) ? ref2.value : ref2;
  1091. }
  1092. var shallowUnwrapHandlers = {
  1093. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  1094. set: (target, key, value, receiver) => {
  1095. var oldValue = target[key];
  1096. if (isRef(oldValue) && !isRef(value)) {
  1097. oldValue.value = value;
  1098. return true;
  1099. } else {
  1100. return Reflect.set(target, key, value, receiver);
  1101. }
  1102. }
  1103. };
  1104. function proxyRefs(objectWithRefs) {
  1105. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1106. }
  1107. class CustomRefImpl {
  1108. constructor(factory) {
  1109. this.dep = void 0;
  1110. this.__v_isRef = true;
  1111. var {
  1112. get,
  1113. set
  1114. } = factory(() => trackRefValue(this), () => triggerRefValue(this));
  1115. this._get = get;
  1116. this._set = set;
  1117. }
  1118. get value() {
  1119. return this._get();
  1120. }
  1121. set value(newVal) {
  1122. this._set(newVal);
  1123. }
  1124. }
  1125. function customRef(factory) {
  1126. return new CustomRefImpl(factory);
  1127. }
  1128. function toRefs(object) {
  1129. var ret = isArray(object) ? new Array(object.length) : {};
  1130. for (var key in object) {
  1131. ret[key] = propertyToRef(object, key);
  1132. }
  1133. return ret;
  1134. }
  1135. class ObjectRefImpl {
  1136. constructor(_object, _key, _defaultValue) {
  1137. this._object = _object;
  1138. this._key = _key;
  1139. this._defaultValue = _defaultValue;
  1140. this.__v_isRef = true;
  1141. }
  1142. get value() {
  1143. var val = this._object[this._key];
  1144. return val === void 0 ? this._defaultValue : val;
  1145. }
  1146. set value(newVal) {
  1147. this._object[this._key] = newVal;
  1148. }
  1149. get dep() {
  1150. return getDepFromReactive(toRaw(this._object), this._key);
  1151. }
  1152. }
  1153. class GetterRefImpl {
  1154. constructor(_getter) {
  1155. this._getter = _getter;
  1156. this.__v_isRef = true;
  1157. this.__v_isReadonly = true;
  1158. }
  1159. get value() {
  1160. return this._getter();
  1161. }
  1162. }
  1163. function toRef(source, key, defaultValue) {
  1164. if (isRef(source)) {
  1165. return source;
  1166. } else if (isFunction(source)) {
  1167. return new GetterRefImpl(source);
  1168. } else if (isObject(source) && arguments.length > 1) {
  1169. return propertyToRef(source, key, defaultValue);
  1170. } else {
  1171. return ref(source);
  1172. }
  1173. }
  1174. function propertyToRef(source, key, defaultValue) {
  1175. var val = source[key];
  1176. return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
  1177. }
  1178. class ComputedRefImpl {
  1179. constructor(getter, _setter, isReadonly, isSSR) {
  1180. this._setter = _setter;
  1181. this.dep = void 0;
  1182. this.__v_isRef = true;
  1183. this["__v_isReadonly"] = false;
  1184. this._dirty = true;
  1185. this.effect = new ReactiveEffect(getter, () => {
  1186. if (!this._dirty) {
  1187. this._dirty = true;
  1188. triggerRefValue(this);
  1189. }
  1190. });
  1191. this.effect.computed = this;
  1192. this.effect.active = this._cacheable = !isSSR;
  1193. this["__v_isReadonly"] = isReadonly;
  1194. }
  1195. get value() {
  1196. var self = toRaw(this);
  1197. trackRefValue(self);
  1198. if (self._dirty || !self._cacheable) {
  1199. self._dirty = false;
  1200. self._value = self.effect.run();
  1201. }
  1202. return self._value;
  1203. }
  1204. set value(newValue) {
  1205. this._setter(newValue);
  1206. }
  1207. }
  1208. function computed$1(getterOrOptions, debugOptions) {
  1209. var isSSR = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1210. var getter;
  1211. var setter;
  1212. var onlyGetter = isFunction(getterOrOptions);
  1213. if (onlyGetter) {
  1214. getter = getterOrOptions;
  1215. setter = NOOP;
  1216. } else {
  1217. getter = getterOrOptions.get;
  1218. setter = getterOrOptions.set;
  1219. }
  1220. var cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  1221. return cRef;
  1222. }
  1223. // lifecycle
  1224. // App and Page
  1225. var ON_SHOW = 'onShow';
  1226. var ON_HIDE = 'onHide';
  1227. //Page
  1228. var ON_LOAD = 'onLoad';
  1229. var ON_UNLOAD = 'onUnload';
  1230. // 百度特有
  1231. var ON_INIT = 'onInit';
  1232. // 微信特有
  1233. var ON_SAVE_EXIT_STATE = 'onSaveExitState';
  1234. var ON_BACK_PRESS = 'onBackPress';
  1235. var ON_PAGE_SCROLL = 'onPageScroll';
  1236. var ON_TAB_ITEM_TAP = 'onTabItemTap';
  1237. var ON_REACH_BOTTOM = 'onReachBottom';
  1238. var ON_PULL_DOWN_REFRESH = 'onPullDownRefresh';
  1239. var ON_SHARE_TIMELINE = 'onShareTimeline';
  1240. var ON_ADD_TO_FAVORITES = 'onAddToFavorites';
  1241. var ON_SHARE_APP_MESSAGE = 'onShareAppMessage';
  1242. // navigationBar
  1243. var ON_NAVIGATION_BAR_BUTTON_TAP = 'onNavigationBarButtonTap';
  1244. var ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED = 'onNavigationBarSearchInputClicked';
  1245. var ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED = 'onNavigationBarSearchInputChanged';
  1246. var ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED = 'onNavigationBarSearchInputConfirmed';
  1247. var ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED = 'onNavigationBarSearchInputFocusChanged';
  1248. var PAGE_HOOKS = [ON_INIT, ON_LOAD, ON_SHOW, ON_HIDE, ON_UNLOAD, ON_BACK_PRESS, ON_PAGE_SCROLL, ON_TAB_ITEM_TAP, ON_REACH_BOTTOM, ON_PULL_DOWN_REFRESH, ON_SHARE_TIMELINE, ON_SHARE_APP_MESSAGE, ON_ADD_TO_FAVORITES, ON_SAVE_EXIT_STATE, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED];
  1249. var PAGE_SYNC_HOOKS = [ON_LOAD, ON_SHOW];
  1250. function isRootImmediateHook(name) {
  1251. return PAGE_SYNC_HOOKS.indexOf(name) > -1;
  1252. }
  1253. function isRootHook(name) {
  1254. return PAGE_HOOKS.indexOf(name) > -1;
  1255. }
  1256. function warn(msg) {
  1257. return;
  1258. }
  1259. /**
  1260. * @internal
  1261. */
  1262. function assertNumber(val, type) {
  1263. return;
  1264. }
  1265. function callWithErrorHandling(fn, instance, type, args) {
  1266. var res;
  1267. try {
  1268. res = args ? fn(...args) : fn();
  1269. } catch (err) {
  1270. handleError(err, instance, type);
  1271. }
  1272. return res;
  1273. }
  1274. function callWithAsyncErrorHandling(fn, instance, type, args) {
  1275. if (isFunction(fn)) {
  1276. var res = callWithErrorHandling(fn, instance, type, args);
  1277. if (res && isPromise(res)) {
  1278. res.catch(err => {
  1279. handleError(err, instance, type);
  1280. });
  1281. }
  1282. return res;
  1283. }
  1284. var values = [];
  1285. for (var i = 0; i < fn.length; i++) {
  1286. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  1287. }
  1288. return values;
  1289. }
  1290. function handleError(err, instance, type) {
  1291. var throwInDev = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
  1292. var contextVNode = instance ? instance.vnode : null;
  1293. if (instance) {
  1294. var cur = instance.parent;
  1295. // the exposed instance is the render proxy to keep it consistent with 2.x
  1296. var exposedInstance = instance.proxy;
  1297. // in production the hook receives only the error code
  1298. // fixed by xxxxxx
  1299. var errorInfo = type;
  1300. while (cur) {
  1301. var errorCapturedHooks = cur.ec;
  1302. if (errorCapturedHooks) {
  1303. for (var i = 0; i < errorCapturedHooks.length; i++) {
  1304. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  1305. return;
  1306. }
  1307. }
  1308. }
  1309. cur = cur.parent;
  1310. }
  1311. // app-level handling
  1312. var appErrorHandler = instance.appContext.config.errorHandler;
  1313. if (appErrorHandler) {
  1314. callWithErrorHandling(appErrorHandler, null, 10 /* ErrorCodes.APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
  1315. return;
  1316. }
  1317. }
  1318. logError(err, type, contextVNode, throwInDev);
  1319. }
  1320. function logError(err, type, contextVNode) {
  1321. var throwInDev = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
  1322. {
  1323. // recover in prod to reduce the impact on end-user
  1324. console.error(err);
  1325. }
  1326. }
  1327. var isFlushing = false;
  1328. var isFlushPending = false;
  1329. var queue = [];
  1330. var flushIndex = 0;
  1331. var pendingPostFlushCbs = [];
  1332. var activePostFlushCbs = null;
  1333. var postFlushIndex = 0;
  1334. var resolvedPromise = /*#__PURE__*/Promise.resolve();
  1335. var currentFlushPromise = null;
  1336. function nextTick(fn) {
  1337. var instance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getCurrentInstance();
  1338. var promise = currentFlushPromise || resolvedPromise;
  1339. var current = currentFlushPromise === null || instance === null ? promise : promise.then(() => {
  1340. return new Promise(resolve => {
  1341. if (instance === null) {
  1342. resolve();
  1343. } else {
  1344. instance.$waitNativeRender(() => {
  1345. resolve();
  1346. });
  1347. }
  1348. });
  1349. });
  1350. return fn ? current.then(this ? fn.bind(this) : fn) : current;
  1351. }
  1352. // #2768
  1353. // Use binary-search to find a suitable position in the queue,
  1354. // so that the queue maintains the increasing order of job's id,
  1355. // which can prevent the job from being skipped and also can avoid repeated patching.
  1356. function findInsertionIndex(id) {
  1357. // the start index should be `flushIndex + 1`
  1358. var start = flushIndex + 1;
  1359. var end = queue.length;
  1360. while (start < end) {
  1361. var middle = start + end >>> 1;
  1362. var middleJobId = getId(queue[middle]);
  1363. middleJobId < id ? start = middle + 1 : end = middle;
  1364. }
  1365. return start;
  1366. }
  1367. function queueJob(job) {
  1368. // the dedupe search uses the startIndex argument of Array.includes()
  1369. // by default the search index includes the current job that is being run
  1370. // so it cannot recursively trigger itself again.
  1371. // if the job is a watch() callback, the search will start with a +1 index to
  1372. // allow it recursively trigger itself - it is the user's responsibility to
  1373. // ensure it doesn't end up in an infinite loop.
  1374. if (!queue.length || !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) {
  1375. if (job.id == null) {
  1376. queue.push(job);
  1377. } else {
  1378. queue.splice(findInsertionIndex(job.id), 0, job);
  1379. }
  1380. queueFlush();
  1381. }
  1382. }
  1383. function queueFlush() {
  1384. if (!isFlushing && !isFlushPending) {
  1385. isFlushPending = true;
  1386. currentFlushPromise = resolvedPromise.then(flushJobs);
  1387. }
  1388. }
  1389. function invalidateJob(job) {
  1390. var i = queue.indexOf(job);
  1391. if (i > flushIndex) {
  1392. queue.splice(i, 1);
  1393. }
  1394. }
  1395. function queuePostFlushCb(cb) {
  1396. if (!isArray(cb)) {
  1397. if (!activePostFlushCbs || !activePostFlushCbs.includes(cb, cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex)) {
  1398. pendingPostFlushCbs.push(cb);
  1399. }
  1400. } else {
  1401. // if cb is an array, it is a component lifecycle hook which can only be
  1402. // triggered by a job, which is already deduped in the main queue, so
  1403. // we can skip duplicate check here to improve perf
  1404. pendingPostFlushCbs.push(...cb);
  1405. }
  1406. queueFlush();
  1407. }
  1408. function flushPreFlushCbs(seen) {
  1409. var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isFlushing ? flushIndex + 1 : 0;
  1410. for (; i < queue.length; i++) {
  1411. var cb = queue[i];
  1412. if (cb && cb.pre) {
  1413. queue.splice(i, 1);
  1414. i--;
  1415. cb();
  1416. }
  1417. }
  1418. }
  1419. function flushPostFlushCbs(seen) {
  1420. if (pendingPostFlushCbs.length) {
  1421. var deduped = [...new Set(pendingPostFlushCbs)];
  1422. pendingPostFlushCbs.length = 0;
  1423. // #1947 already has active queue, nested flushPostFlushCbs call
  1424. if (activePostFlushCbs) {
  1425. activePostFlushCbs.push(...deduped);
  1426. return;
  1427. }
  1428. activePostFlushCbs = deduped;
  1429. activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
  1430. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  1431. activePostFlushCbs[postFlushIndex]();
  1432. }
  1433. activePostFlushCbs = null;
  1434. postFlushIndex = 0;
  1435. }
  1436. }
  1437. var getId = job => job.id == null ? Infinity : job.id;
  1438. var comparator = (a, b) => {
  1439. var diff = getId(a) - getId(b);
  1440. if (diff === 0) {
  1441. if (a.pre && !b.pre) return -1;
  1442. if (b.pre && !a.pre) return 1;
  1443. }
  1444. return diff;
  1445. };
  1446. function flushJobs(seen) {
  1447. isFlushPending = false;
  1448. isFlushing = true;
  1449. // Sort queue before flush.
  1450. // This ensures that:
  1451. // 1. Components are updated from parent to child. (because parent is always
  1452. // created before the child so its render effect will have smaller
  1453. // priority number)
  1454. // 2. If a component is unmounted during a parent component's update,
  1455. // its update can be skipped.
  1456. queue.sort(comparator);
  1457. // conditional usage of checkRecursiveUpdate must be determined out of
  1458. // try ... catch block since Rollup by default de-optimizes treeshaking
  1459. // inside try-catch. This can leave all warning code unshaked. Although
  1460. // they would get eventually shaken by a minifier like terser, some minifiers
  1461. // would fail to do that (e.g. https://github.com/evanw/esbuild/issues/1610)
  1462. var check = NOOP;
  1463. try {
  1464. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  1465. var job = queue[flushIndex];
  1466. if (job && job.active !== false) {
  1467. if ("production" !== 'production' && check(job)) ;
  1468. // console.log(`running:`, job.id)
  1469. callWithErrorHandling(job, null, 14 /* ErrorCodes.SCHEDULER */);
  1470. }
  1471. }
  1472. } finally {
  1473. flushIndex = 0;
  1474. queue.length = 0;
  1475. flushPostFlushCbs();
  1476. isFlushing = false;
  1477. currentFlushPromise = null;
  1478. // some postFlushCb queued jobs!
  1479. // keep flushing until it drains.
  1480. if (queue.length || pendingPostFlushCbs.length) {
  1481. flushJobs();
  1482. }
  1483. }
  1484. }
  1485. var devtools;
  1486. var buffer = [];
  1487. function setDevtoolsHook(hook, target) {
  1488. var _a, _b;
  1489. devtools = hook;
  1490. if (devtools) {
  1491. devtools.enabled = true;
  1492. buffer.forEach(_ref3 => {
  1493. var {
  1494. event,
  1495. args
  1496. } = _ref3;
  1497. return devtools.emit(event, ...args);
  1498. });
  1499. buffer = [];
  1500. } else if (
  1501. // handle late devtools injection - only do this if we are in an actual
  1502. // browser environment to avoid the timer handle stalling test runner exit
  1503. // (#4815)
  1504. typeof window !== 'undefined' &&
  1505. // some envs mock window but not fully
  1506. window.HTMLElement &&
  1507. // also exclude jsdom
  1508. !((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.includes('jsdom'))) {
  1509. var replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  1510. replay.push(newHook => {
  1511. setDevtoolsHook(newHook, target);
  1512. });
  1513. // clear buffer after 3s - the user probably doesn't have devtools installed
  1514. // at all, and keeping the buffer will cause memory leaks (#4738)
  1515. setTimeout(() => {
  1516. if (!devtools) {
  1517. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  1518. buffer = [];
  1519. }
  1520. }, 3000);
  1521. } else {
  1522. buffer = [];
  1523. }
  1524. }
  1525. function emit(instance, event) {
  1526. if (instance.isUnmounted) return;
  1527. var props = instance.vnode.props || EMPTY_OBJ;
  1528. for (var _len3 = arguments.length, rawArgs = new Array(_len3 > 2 ? _len3 - 2 : 0), _key4 = 2; _key4 < _len3; _key4++) {
  1529. rawArgs[_key4 - 2] = arguments[_key4];
  1530. }
  1531. var args = rawArgs;
  1532. var isModelListener = event.startsWith('update:');
  1533. // for v-model update:xxx events, apply modifiers on args
  1534. var modelArg = isModelListener && event.slice(7);
  1535. if (modelArg && modelArg in props) {
  1536. var modifiersKey = "".concat(modelArg === 'modelValue' ? 'model' : modelArg, "Modifiers");
  1537. var {
  1538. number,
  1539. trim
  1540. } = props[modifiersKey] || EMPTY_OBJ;
  1541. if (trim) {
  1542. args = rawArgs.map(a => isString(a) ? a.trim() : a);
  1543. }
  1544. if (number) {
  1545. args = rawArgs.map(looseToNumber);
  1546. }
  1547. }
  1548. var handlerName;
  1549. var handler = props[handlerName = toHandlerKey(event)] ||
  1550. // also try camelCase event handler (#2249)
  1551. props[handlerName = toHandlerKey(camelize(event))];
  1552. // for v-model update:xxx events, also trigger kebab-case equivalent
  1553. // for props passed via kebab-case
  1554. if (!handler && isModelListener) {
  1555. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  1556. }
  1557. if (handler) {
  1558. callWithAsyncErrorHandling(handler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
  1559. }
  1560. var onceHandler = props[handlerName + "Once"];
  1561. if (onceHandler) {
  1562. if (!instance.emitted) {
  1563. instance.emitted = {};
  1564. } else if (instance.emitted[handlerName]) {
  1565. return;
  1566. }
  1567. instance.emitted[handlerName] = true;
  1568. callWithAsyncErrorHandling(onceHandler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
  1569. }
  1570. }
  1571. function normalizeEmitsOptions(comp, appContext) {
  1572. var asMixin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1573. var cache = appContext.emitsCache;
  1574. var cached = cache.get(comp);
  1575. if (cached !== undefined) {
  1576. return cached;
  1577. }
  1578. var raw = comp.emits;
  1579. var normalized = {};
  1580. // apply mixin/extends props
  1581. var hasExtends = false;
  1582. if (!isFunction(comp)) {
  1583. var extendEmits = raw => {
  1584. var normalizedFromExtend = normalizeEmitsOptions(raw, appContext, true);
  1585. if (normalizedFromExtend) {
  1586. hasExtends = true;
  1587. extend$1(normalized, normalizedFromExtend);
  1588. }
  1589. };
  1590. if (!asMixin && appContext.mixins.length) {
  1591. appContext.mixins.forEach(extendEmits);
  1592. }
  1593. if (comp.extends) {
  1594. extendEmits(comp.extends);
  1595. }
  1596. if (comp.mixins) {
  1597. comp.mixins.forEach(extendEmits);
  1598. }
  1599. }
  1600. if (!raw && !hasExtends) {
  1601. if (isObject(comp)) {
  1602. cache.set(comp, null);
  1603. }
  1604. return null;
  1605. }
  1606. if (isArray(raw)) {
  1607. raw.forEach(key => normalized[key] = null);
  1608. } else {
  1609. extend$1(normalized, raw);
  1610. }
  1611. if (isObject(comp)) {
  1612. cache.set(comp, normalized);
  1613. }
  1614. return normalized;
  1615. }
  1616. // Check if an incoming prop key is a declared emit event listener.
  1617. // e.g. With `emits: { click: null }`, props named `onClick` and `onclick` are
  1618. // both considered matched listeners.
  1619. function isEmitListener(options, key) {
  1620. if (!options || !isOn(key)) {
  1621. return false;
  1622. }
  1623. key = key.slice(2).replace(/Once$/, '');
  1624. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  1625. }
  1626. /**
  1627. * mark the current rendering instance for asset resolution (e.g.
  1628. * resolveComponent, resolveDirective) during render
  1629. */
  1630. var currentRenderingInstance = null;
  1631. var currentScopeId = null;
  1632. /**
  1633. * Note: rendering calls maybe nested. The function returns the parent rendering
  1634. * instance if present, which should be restored after the render is done:
  1635. *
  1636. * ```js
  1637. * const prev = setCurrentRenderingInstance(i)
  1638. * // ...render
  1639. * setCurrentRenderingInstance(prev)
  1640. * ```
  1641. */
  1642. function setCurrentRenderingInstance(instance) {
  1643. var prev = currentRenderingInstance;
  1644. currentRenderingInstance = instance;
  1645. currentScopeId = instance && instance.type.__scopeId || null;
  1646. return prev;
  1647. }
  1648. /**
  1649. * Set scope id when creating hoisted vnodes.
  1650. * @private compiler helper
  1651. */
  1652. function pushScopeId(id) {
  1653. currentScopeId = id;
  1654. }
  1655. /**
  1656. * Technically we no longer need this after 3.0.8 but we need to keep the same
  1657. * API for backwards compat w/ code generated by compilers.
  1658. * @private
  1659. */
  1660. function popScopeId() {
  1661. currentScopeId = null;
  1662. }
  1663. /**
  1664. * Only for backwards compat
  1665. * @private
  1666. */
  1667. var withScopeId = _id => withCtx;
  1668. /**
  1669. * Wrap a slot function to memoize current rendering instance
  1670. * @private compiler helper
  1671. */
  1672. function withCtx(fn) {
  1673. var ctx = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : currentRenderingInstance;
  1674. var isNonScopedSlot // false only
  1675. = arguments.length > 2 ? arguments[2] : undefined;
  1676. if (!ctx) return fn;
  1677. // already normalized
  1678. if (fn._n) {
  1679. return fn;
  1680. }
  1681. var renderFnWithContext = function () {
  1682. // If a user calls a compiled slot inside a template expression (#1745), it
  1683. // can mess up block tracking, so by default we disable block tracking and
  1684. // force bail out when invoking a compiled slot (indicated by the ._d flag).
  1685. // This isn't necessary if rendering a compiled `<slot>`, so we flip the
  1686. // ._d flag off when invoking the wrapped fn inside `renderSlot`.
  1687. if (renderFnWithContext._d) {
  1688. setBlockTracking(-1);
  1689. }
  1690. var prevInstance = setCurrentRenderingInstance(ctx);
  1691. var res;
  1692. try {
  1693. res = fn(...arguments);
  1694. } finally {
  1695. setCurrentRenderingInstance(prevInstance);
  1696. if (renderFnWithContext._d) {
  1697. setBlockTracking(1);
  1698. }
  1699. }
  1700. return res;
  1701. };
  1702. // mark normalized to avoid duplicated wrapping
  1703. renderFnWithContext._n = true;
  1704. // mark this as compiled by default
  1705. // this is used in vnode.ts -> normalizeChildren() to set the slot
  1706. // rendering flag.
  1707. renderFnWithContext._c = true;
  1708. // disable block tracking by default
  1709. renderFnWithContext._d = true;
  1710. return renderFnWithContext;
  1711. }
  1712. function markAttrsAccessed() {}
  1713. function renderComponentRoot(instance) {
  1714. var {
  1715. type: Component,
  1716. vnode,
  1717. proxy,
  1718. withProxy,
  1719. props,
  1720. propsOptions: [propsOptions],
  1721. slots,
  1722. attrs,
  1723. emit,
  1724. render,
  1725. renderCache,
  1726. data,
  1727. setupState,
  1728. ctx,
  1729. inheritAttrs
  1730. } = instance;
  1731. var result;
  1732. var fallthroughAttrs;
  1733. var prev = setCurrentRenderingInstance(instance);
  1734. try {
  1735. if (vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) {
  1736. // withProxy is a proxy with a different `has` trap only for
  1737. // runtime-compiled render functions using `with` block.
  1738. var proxyToUse = withProxy || proxy;
  1739. result = normalizeVNode(render.call(proxyToUse, proxyToUse, renderCache, props, setupState, data, ctx));
  1740. fallthroughAttrs = attrs;
  1741. } else {
  1742. // functional
  1743. var _render = Component;
  1744. // in dev, mark attrs accessed if optional props (attrs === props)
  1745. if ("production" !== 'production' && attrs === props) ;
  1746. result = normalizeVNode(_render.length > 1 ? _render(props, "production" !== 'production' ? {
  1747. get attrs() {
  1748. markAttrsAccessed();
  1749. return attrs;
  1750. },
  1751. slots,
  1752. emit
  1753. } : {
  1754. attrs,
  1755. slots,
  1756. emit
  1757. }) : _render(props, null /* we know it doesn't need it */));
  1758. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  1759. }
  1760. } catch (err) {
  1761. blockStack.length = 0;
  1762. handleError(err, instance, 1 /* ErrorCodes.RENDER_FUNCTION */);
  1763. result = createVNode(Comment);
  1764. }
  1765. // attr merging
  1766. // in dev mode, comments are preserved, and it's possible for a template
  1767. // to have comments along side the root element which makes it a fragment
  1768. var root = result;
  1769. if (fallthroughAttrs && inheritAttrs !== false) {
  1770. var keys = Object.keys(fallthroughAttrs);
  1771. var {
  1772. shapeFlag
  1773. } = root;
  1774. if (keys.length) {
  1775. if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 6 /* ShapeFlags.COMPONENT */)) {
  1776. if (propsOptions && keys.some(isModelListener)) {
  1777. // If a v-model listener (onUpdate:xxx) has a corresponding declared
  1778. // prop, it indicates this component expects to handle v-model and
  1779. // it should not fallthrough.
  1780. // related: #1543, #1643, #1989
  1781. fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
  1782. }
  1783. root = cloneVNode(root, fallthroughAttrs);
  1784. }
  1785. }
  1786. }
  1787. // inherit directives
  1788. if (vnode.dirs) {
  1789. // clone before mutating since the root may be a hoisted vnode
  1790. root = cloneVNode(root);
  1791. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  1792. }
  1793. // inherit transition data
  1794. if (vnode.transition) {
  1795. root.transition = vnode.transition;
  1796. }
  1797. {
  1798. result = root;
  1799. }
  1800. setCurrentRenderingInstance(prev);
  1801. return result;
  1802. }
  1803. function filterSingleRoot(children) {
  1804. var singleRoot;
  1805. for (var i = 0; i < children.length; i++) {
  1806. var child = children[i];
  1807. if (isVNode(child)) {
  1808. // ignore user comment
  1809. if (child.type !== Comment || child.children === 'v-if') {
  1810. if (singleRoot) {
  1811. // has more than 1 non-comment child, return now
  1812. return;
  1813. } else {
  1814. singleRoot = child;
  1815. }
  1816. }
  1817. } else {
  1818. return;
  1819. }
  1820. }
  1821. return singleRoot;
  1822. }
  1823. var getFunctionalFallthrough = attrs => {
  1824. var res;
  1825. for (var key in attrs) {
  1826. if (key === 'class' || key === 'style' || isOn(key)) {
  1827. (res || (res = {}))[key] = attrs[key];
  1828. }
  1829. }
  1830. return res;
  1831. };
  1832. var filterModelListeners = (attrs, props) => {
  1833. var res = {};
  1834. for (var key in attrs) {
  1835. if (!isModelListener(key) || !(key.slice(9) in props)) {
  1836. res[key] = attrs[key];
  1837. }
  1838. }
  1839. return res;
  1840. };
  1841. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  1842. var {
  1843. props: prevProps,
  1844. children: prevChildren,
  1845. component
  1846. } = prevVNode;
  1847. var {
  1848. props: nextProps,
  1849. children: nextChildren,
  1850. patchFlag
  1851. } = nextVNode;
  1852. var emits = component.emitsOptions;
  1853. // force child update for runtime directive or transition on component vnode.
  1854. if (nextVNode.dirs || nextVNode.transition) {
  1855. return true;
  1856. }
  1857. if (optimized && patchFlag >= 0) {
  1858. if (patchFlag & 1024 /* PatchFlags.DYNAMIC_SLOTS */) {
  1859. // slot content that references values that might have changed,
  1860. // e.g. in a v-for
  1861. return true;
  1862. }
  1863. if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
  1864. if (!prevProps) {
  1865. return !!nextProps;
  1866. }
  1867. // presence of this flag indicates props are always non-null
  1868. return hasPropsChanged(prevProps, nextProps, emits);
  1869. } else if (patchFlag & 8 /* PatchFlags.PROPS */) {
  1870. var dynamicProps = nextVNode.dynamicProps;
  1871. for (var i = 0; i < dynamicProps.length; i++) {
  1872. var key = dynamicProps[i];
  1873. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  1874. return true;
  1875. }
  1876. }
  1877. }
  1878. } else {
  1879. // this path is only taken by manually written render functions
  1880. // so presence of any children leads to a forced update
  1881. if (prevChildren || nextChildren) {
  1882. if (!nextChildren || !nextChildren.$stable) {
  1883. return true;
  1884. }
  1885. }
  1886. if (prevProps === nextProps) {
  1887. return false;
  1888. }
  1889. if (!prevProps) {
  1890. return !!nextProps;
  1891. }
  1892. if (!nextProps) {
  1893. return true;
  1894. }
  1895. return hasPropsChanged(prevProps, nextProps, emits);
  1896. }
  1897. return false;
  1898. }
  1899. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  1900. var nextKeys = Object.keys(nextProps);
  1901. if (nextKeys.length !== Object.keys(prevProps).length) {
  1902. return true;
  1903. }
  1904. for (var i = 0; i < nextKeys.length; i++) {
  1905. var key = nextKeys[i];
  1906. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  1907. return true;
  1908. }
  1909. }
  1910. return false;
  1911. }
  1912. function updateHOCHostEl(_ref4, el // HostNode
  1913. ) {
  1914. var {
  1915. vnode,
  1916. parent
  1917. } = _ref4;
  1918. while (parent && parent.subTree === vnode) {
  1919. (vnode = parent.vnode).el = el;
  1920. parent = parent.parent;
  1921. }
  1922. }
  1923. var isSuspense = type => type.__isSuspense;
  1924. // Suspense exposes a component-like API, and is treated like a component
  1925. // in the compiler, but internally it's a special built-in type that hooks
  1926. // directly into the renderer.
  1927. var SuspenseImpl = {
  1928. name: 'Suspense',
  1929. // In order to make Suspense tree-shakable, we need to avoid importing it
  1930. // directly in the renderer. The renderer checks for the __isSuspense flag
  1931. // on a vnode's type and calls the `process` method, passing in renderer
  1932. // internals.
  1933. __isSuspense: true,
  1934. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized,
  1935. // platform-specific impl passed from renderer
  1936. rendererInternals) {
  1937. if (n1 == null) {
  1938. mountSuspense(n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals);
  1939. } else {
  1940. patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, rendererInternals);
  1941. }
  1942. },
  1943. hydrate: hydrateSuspense,
  1944. create: createSuspenseBoundary,
  1945. normalize: normalizeSuspenseChildren
  1946. };
  1947. // Force-casted public typing for h and TSX props inference
  1948. var Suspense = SuspenseImpl;
  1949. function triggerEvent(vnode, name) {
  1950. var eventListener = vnode.props && vnode.props[name];
  1951. if (isFunction(eventListener)) {
  1952. eventListener();
  1953. }
  1954. }
  1955. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
  1956. var {
  1957. p: patch,
  1958. o: {
  1959. createElement
  1960. }
  1961. } = rendererInternals;
  1962. // @ts-expect-error fixed by xxxxxx
  1963. var hiddenContainer = createElement('div');
  1964. var suspense = vnode.suspense = createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals);
  1965. // start mounting the content subtree in an off-dom container
  1966. patch(null, suspense.pendingBranch = vnode.ssContent, hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds);
  1967. // now check if we have encountered any async deps
  1968. if (suspense.deps > 0) {
  1969. // has async
  1970. // invoke @fallback event
  1971. triggerEvent(vnode, 'onPending');
  1972. triggerEvent(vnode, 'onFallback');
  1973. // mount the fallback tree
  1974. patch(null, vnode.ssFallback, container, anchor, parentComponent, null,
  1975. // fallback tree will not have suspense context
  1976. isSVG, slotScopeIds);
  1977. setActiveBranch(suspense, vnode.ssFallback);
  1978. } else {
  1979. // Suspense has no async deps. Just resolve.
  1980. suspense.resolve();
  1981. }
  1982. }
  1983. function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, _ref5) {
  1984. var {
  1985. p: patch,
  1986. um: unmount,
  1987. o: {
  1988. createElement
  1989. }
  1990. } = _ref5;
  1991. var suspense = n2.suspense = n1.suspense;
  1992. suspense.vnode = n2;
  1993. n2.el = n1.el;
  1994. var newBranch = n2.ssContent;
  1995. var newFallback = n2.ssFallback;
  1996. var {
  1997. activeBranch,
  1998. pendingBranch,
  1999. isInFallback,
  2000. isHydrating
  2001. } = suspense;
  2002. if (pendingBranch) {
  2003. suspense.pendingBranch = newBranch;
  2004. if (isSameVNodeType(newBranch, pendingBranch)) {
  2005. // same root type but content may have changed.
  2006. patch(pendingBranch, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds, optimized);
  2007. if (suspense.deps <= 0) {
  2008. suspense.resolve();
  2009. } else if (isInFallback) {
  2010. patch(activeBranch, newFallback, container, anchor, parentComponent, null,
  2011. // fallback tree will not have suspense context
  2012. isSVG, slotScopeIds, optimized);
  2013. setActiveBranch(suspense, newFallback);
  2014. }
  2015. } else {
  2016. // toggled before pending tree is resolved
  2017. suspense.pendingId++;
  2018. if (isHydrating) {
  2019. // if toggled before hydration is finished, the current DOM tree is
  2020. // no longer valid. set it as the active branch so it will be unmounted
  2021. // when resolved
  2022. suspense.isHydrating = false;
  2023. suspense.activeBranch = pendingBranch;
  2024. } else {
  2025. unmount(pendingBranch, parentComponent, suspense);
  2026. }
  2027. // increment pending ID. this is used to invalidate async callbacks
  2028. // reset suspense state
  2029. suspense.deps = 0;
  2030. // discard effects from pending branch
  2031. suspense.effects.length = 0;
  2032. // discard previous container
  2033. // @ts-expect-error fixed by xxxxxx
  2034. suspense.hiddenContainer = createElement('div');
  2035. if (isInFallback) {
  2036. // already in fallback state
  2037. patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds, optimized);
  2038. if (suspense.deps <= 0) {
  2039. suspense.resolve();
  2040. } else {
  2041. patch(activeBranch, newFallback, container, anchor, parentComponent, null,
  2042. // fallback tree will not have suspense context
  2043. isSVG, slotScopeIds, optimized);
  2044. setActiveBranch(suspense, newFallback);
  2045. }
  2046. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  2047. // toggled "back" to current active branch
  2048. patch(activeBranch, newBranch, container, anchor, parentComponent, suspense, isSVG, slotScopeIds, optimized);
  2049. // force resolve
  2050. suspense.resolve(true);
  2051. } else {
  2052. // switched to a 3rd branch
  2053. patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds, optimized);
  2054. if (suspense.deps <= 0) {
  2055. suspense.resolve();
  2056. }
  2057. }
  2058. }
  2059. } else {
  2060. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  2061. // root did not change, just normal patch
  2062. patch(activeBranch, newBranch, container, anchor, parentComponent, suspense, isSVG, slotScopeIds, optimized);
  2063. setActiveBranch(suspense, newBranch);
  2064. } else {
  2065. // root node toggled
  2066. // invoke @pending event
  2067. triggerEvent(n2, 'onPending');
  2068. // mount pending branch in off-dom container
  2069. suspense.pendingBranch = newBranch;
  2070. suspense.pendingId++;
  2071. patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds, optimized);
  2072. if (suspense.deps <= 0) {
  2073. // incoming branch has no async deps, resolve now.
  2074. suspense.resolve();
  2075. } else {
  2076. var {
  2077. timeout,
  2078. pendingId
  2079. } = suspense;
  2080. if (timeout > 0) {
  2081. setTimeout(() => {
  2082. if (suspense.pendingId === pendingId) {
  2083. suspense.fallback(newFallback);
  2084. }
  2085. }, timeout);
  2086. } else if (timeout === 0) {
  2087. suspense.fallback(newFallback);
  2088. }
  2089. }
  2090. }
  2091. }
  2092. }
  2093. function createSuspenseBoundary(vnode, parent, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals) {
  2094. var isHydrating = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
  2095. var {
  2096. p: patch,
  2097. m: move,
  2098. um: unmount,
  2099. n: next,
  2100. o: {
  2101. parentNode,
  2102. remove
  2103. }
  2104. } = rendererInternals;
  2105. var timeout = vnode.props ? toNumber(vnode.props.timeout) : undefined;
  2106. var suspense = {
  2107. vnode,
  2108. parent,
  2109. parentComponent,
  2110. isSVG,
  2111. container,
  2112. hiddenContainer,
  2113. anchor,
  2114. deps: 0,
  2115. pendingId: 0,
  2116. timeout: typeof timeout === 'number' ? timeout : -1,
  2117. activeBranch: null,
  2118. pendingBranch: null,
  2119. isInFallback: true,
  2120. isHydrating,
  2121. isUnmounted: false,
  2122. effects: [],
  2123. resolve() {
  2124. var resume = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  2125. var {
  2126. vnode,
  2127. activeBranch,
  2128. pendingBranch,
  2129. pendingId,
  2130. effects,
  2131. parentComponent,
  2132. container
  2133. } = suspense;
  2134. if (suspense.isHydrating) {
  2135. suspense.isHydrating = false;
  2136. } else if (!resume) {
  2137. var delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === 'out-in';
  2138. if (delayEnter) {
  2139. activeBranch.transition.afterLeave = () => {
  2140. if (pendingId === suspense.pendingId) {
  2141. move(pendingBranch, container, _anchor, 0 /* MoveType.ENTER */);
  2142. }
  2143. };
  2144. }
  2145. // this is initial anchor on mount
  2146. var {
  2147. anchor: _anchor
  2148. } = suspense;
  2149. // unmount current active tree
  2150. if (activeBranch) {
  2151. // if the fallback tree was mounted, it may have been moved
  2152. // as part of a parent suspense. get the latest anchor for insertion
  2153. _anchor = next(activeBranch);
  2154. unmount(activeBranch, parentComponent, suspense, true);
  2155. }
  2156. if (!delayEnter) {
  2157. // move content from off-dom container to actual container
  2158. move(pendingBranch, container, _anchor, 0 /* MoveType.ENTER */);
  2159. }
  2160. }
  2161. setActiveBranch(suspense, pendingBranch);
  2162. suspense.pendingBranch = null;
  2163. suspense.isInFallback = false;
  2164. // flush buffered effects
  2165. // check if there is a pending parent suspense
  2166. var parent = suspense.parent;
  2167. var hasUnresolvedAncestor = false;
  2168. while (parent) {
  2169. if (parent.pendingBranch) {
  2170. // found a pending parent suspense, merge buffered post jobs
  2171. // into that parent
  2172. parent.effects.push(...effects);
  2173. hasUnresolvedAncestor = true;
  2174. break;
  2175. }
  2176. parent = parent.parent;
  2177. }
  2178. // no pending parent suspense, flush all jobs
  2179. if (!hasUnresolvedAncestor) {
  2180. queuePostFlushCb(effects);
  2181. }
  2182. suspense.effects = [];
  2183. // invoke @resolve event
  2184. triggerEvent(vnode, 'onResolve');
  2185. },
  2186. fallback(fallbackVNode) {
  2187. if (!suspense.pendingBranch) {
  2188. return;
  2189. }
  2190. var {
  2191. vnode,
  2192. activeBranch,
  2193. parentComponent,
  2194. container,
  2195. isSVG
  2196. } = suspense;
  2197. // invoke @fallback event
  2198. triggerEvent(vnode, 'onFallback');
  2199. var anchor = next(activeBranch);
  2200. var mountFallback = () => {
  2201. if (!suspense.isInFallback) {
  2202. return;
  2203. }
  2204. // mount the fallback tree
  2205. patch(null, fallbackVNode, container, anchor, parentComponent, null,
  2206. // fallback tree will not have suspense context
  2207. isSVG, slotScopeIds, optimized);
  2208. setActiveBranch(suspense, fallbackVNode);
  2209. };
  2210. var delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === 'out-in';
  2211. if (delayEnter) {
  2212. activeBranch.transition.afterLeave = mountFallback;
  2213. }
  2214. suspense.isInFallback = true;
  2215. // unmount current active branch
  2216. unmount(activeBranch, parentComponent, null,
  2217. // no suspense so unmount hooks fire now
  2218. true // shouldRemove
  2219. );
  2220. if (!delayEnter) {
  2221. mountFallback();
  2222. }
  2223. },
  2224. move(container, anchor, type) {
  2225. suspense.activeBranch && move(suspense.activeBranch, container, anchor, type);
  2226. suspense.container = container;
  2227. },
  2228. next() {
  2229. return suspense.activeBranch && next(suspense.activeBranch);
  2230. },
  2231. registerDep(instance, setupRenderEffect) {
  2232. var isInPendingSuspense = !!suspense.pendingBranch;
  2233. if (isInPendingSuspense) {
  2234. suspense.deps++;
  2235. }
  2236. var hydratedEl = instance.vnode.el;
  2237. instance.asyncDep.catch(err => {
  2238. handleError(err, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
  2239. }).then(asyncSetupResult => {
  2240. // retry when the setup() promise resolves.
  2241. // component may have been unmounted before resolve.
  2242. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  2243. return;
  2244. }
  2245. // retry from this component
  2246. instance.asyncResolved = true;
  2247. var {
  2248. vnode
  2249. } = instance;
  2250. handleSetupResult(instance, asyncSetupResult, false);
  2251. if (hydratedEl) {
  2252. // vnode may have been replaced if an update happened before the
  2253. // async dep is resolved.
  2254. vnode.el = hydratedEl;
  2255. }
  2256. var placeholder = !hydratedEl && instance.subTree.el;
  2257. setupRenderEffect(instance, vnode,
  2258. // component may have been moved before resolve.
  2259. // if this is not a hydration, instance.subTree will be the comment
  2260. // placeholder.
  2261. parentNode(hydratedEl || instance.subTree.el),
  2262. // anchor will not be used if this is hydration, so only need to
  2263. // consider the comment placeholder case.
  2264. hydratedEl ? null : next(instance.subTree), suspense, isSVG, optimized);
  2265. if (placeholder) {
  2266. remove(placeholder);
  2267. }
  2268. updateHOCHostEl(instance, vnode.el);
  2269. // only decrease deps count if suspense is not already resolved
  2270. if (isInPendingSuspense && --suspense.deps === 0) {
  2271. suspense.resolve();
  2272. }
  2273. });
  2274. },
  2275. unmount(parentSuspense, doRemove) {
  2276. suspense.isUnmounted = true;
  2277. if (suspense.activeBranch) {
  2278. unmount(suspense.activeBranch, parentComponent, parentSuspense, doRemove);
  2279. }
  2280. if (suspense.pendingBranch) {
  2281. unmount(suspense.pendingBranch, parentComponent, parentSuspense, doRemove);
  2282. }
  2283. }
  2284. };
  2285. return suspense;
  2286. }
  2287. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  2288. /* eslint-disable no-restricted-globals */
  2289. var suspense = vnode.suspense = createSuspenseBoundary(vnode, parentSuspense, parentComponent, node.parentNode, document.createElement('div'), null, isSVG, slotScopeIds, optimized, rendererInternals, true /* hydrating */);
  2290. // there are two possible scenarios for server-rendered suspense:
  2291. // - success: ssr content should be fully resolved
  2292. // - failure: ssr content should be the fallback branch.
  2293. // however, on the client we don't really know if it has failed or not
  2294. // attempt to hydrate the DOM assuming it has succeeded, but we still
  2295. // need to construct a suspense boundary first
  2296. var result = hydrateNode(node, suspense.pendingBranch = vnode.ssContent, parentComponent, suspense, slotScopeIds, optimized);
  2297. if (suspense.deps === 0) {
  2298. suspense.resolve();
  2299. }
  2300. return result;
  2301. /* eslint-enable no-restricted-globals */
  2302. }
  2303. function normalizeSuspenseChildren(vnode) {
  2304. var {
  2305. shapeFlag,
  2306. children
  2307. } = vnode;
  2308. var isSlotChildren = shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */;
  2309. vnode.ssContent = normalizeSuspenseSlot(isSlotChildren ? children.default : children);
  2310. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  2311. }
  2312. function normalizeSuspenseSlot(s) {
  2313. var block;
  2314. if (isFunction(s)) {
  2315. var trackBlock = isBlockTreeEnabled && s._c;
  2316. if (trackBlock) {
  2317. // disableTracking: false
  2318. // allow block tracking for compiled slots
  2319. // (see ./componentRenderContext.ts)
  2320. s._d = false;
  2321. openBlock();
  2322. }
  2323. s = s();
  2324. if (trackBlock) {
  2325. s._d = true;
  2326. block = currentBlock;
  2327. closeBlock();
  2328. }
  2329. }
  2330. if (isArray(s)) {
  2331. var singleChild = filterSingleRoot(s);
  2332. s = singleChild;
  2333. }
  2334. s = normalizeVNode(s);
  2335. if (block && !s.dynamicChildren) {
  2336. s.dynamicChildren = block.filter(c => c !== s);
  2337. }
  2338. return s;
  2339. }
  2340. function queueEffectWithSuspense(fn, suspense) {
  2341. if (suspense && suspense.pendingBranch) {
  2342. if (isArray(fn)) {
  2343. suspense.effects.push(...fn);
  2344. } else {
  2345. suspense.effects.push(fn);
  2346. }
  2347. } else {
  2348. queuePostFlushCb(fn);
  2349. }
  2350. }
  2351. function setActiveBranch(suspense, branch) {
  2352. suspense.activeBranch = branch;
  2353. var {
  2354. vnode,
  2355. parentComponent
  2356. } = suspense;
  2357. var el = vnode.el = branch.el;
  2358. // in case suspense is the root node of a component,
  2359. // recursively update the HOC el
  2360. if (parentComponent && parentComponent.subTree === vnode) {
  2361. parentComponent.vnode.el = el;
  2362. updateHOCHostEl(parentComponent, el);
  2363. }
  2364. }
  2365. function provide(key, value) {
  2366. if (!currentInstance) ;else {
  2367. var provides = currentInstance.provides;
  2368. // by default an instance inherits its parent's provides object
  2369. // but when it needs to provide values of its own, it creates its
  2370. // own provides object using parent provides object as prototype.
  2371. // this way in `inject` we can simply look up injections from direct
  2372. // parent and let the prototype chain do the work.
  2373. var parentProvides = currentInstance.parent && currentInstance.parent.provides;
  2374. if (parentProvides === provides) {
  2375. provides = currentInstance.provides = Object.create(parentProvides);
  2376. }
  2377. // TS doesn't allow symbol as index type
  2378. provides[key] = value;
  2379. // 当实例为 App 时,同步到全局 provide
  2380. if (currentInstance.type.mpType === 'app') {
  2381. currentInstance.appContext.app.provide(key, value);
  2382. }
  2383. }
  2384. }
  2385. function inject(key, defaultValue) {
  2386. var treatDefaultAsFactory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  2387. // fallback to `currentRenderingInstance` so that this can be called in
  2388. // a functional component
  2389. var instance = currentInstance || currentRenderingInstance;
  2390. if (instance) {
  2391. // #2400
  2392. // to support `app.use` plugins,
  2393. // fallback to appContext's `provides` if the instance is at root
  2394. var provides = instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides;
  2395. if (provides && key in provides) {
  2396. // TS doesn't allow symbol as index type
  2397. return provides[key];
  2398. } else if (arguments.length > 1) {
  2399. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance.proxy) : defaultValue;
  2400. } else ;
  2401. }
  2402. }
  2403. // Simple effect.
  2404. function watchEffect(effect, options) {
  2405. return doWatch(effect, null, options);
  2406. }
  2407. function watchPostEffect(effect, options) {
  2408. return doWatch(effect, null, {
  2409. flush: 'post'
  2410. });
  2411. }
  2412. function watchSyncEffect(effect, options) {
  2413. return doWatch(effect, null, {
  2414. flush: 'sync'
  2415. });
  2416. }
  2417. // initial value for watchers to trigger on undefined initial values
  2418. var INITIAL_WATCHER_VALUE = {};
  2419. // implementation
  2420. function watch(source, cb, options) {
  2421. return doWatch(source, cb, options);
  2422. }
  2423. function doWatch(source, cb) {
  2424. var {
  2425. immediate,
  2426. deep,
  2427. flush,
  2428. onTrack,
  2429. onTrigger
  2430. } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EMPTY_OBJ;
  2431. var instance = getCurrentScope() === (currentInstance === null || currentInstance === void 0 ? void 0 : currentInstance.scope) ? currentInstance : null;
  2432. // const instance = currentInstance
  2433. var getter;
  2434. var forceTrigger = false;
  2435. var isMultiSource = false;
  2436. if (isRef(source)) {
  2437. getter = () => source.value;
  2438. forceTrigger = isShallow(source);
  2439. } else if (isReactive(source)) {
  2440. getter = () => source;
  2441. deep = true;
  2442. } else if (isArray(source)) {
  2443. isMultiSource = true;
  2444. forceTrigger = source.some(s => isReactive(s) || isShallow(s));
  2445. getter = () => source.map(s => {
  2446. if (isRef(s)) {
  2447. return s.value;
  2448. } else if (isReactive(s)) {
  2449. return traverse(s);
  2450. } else if (isFunction(s)) {
  2451. return callWithErrorHandling(s, instance, 2 /* ErrorCodes.WATCH_GETTER */);
  2452. } else ;
  2453. });
  2454. } else if (isFunction(source)) {
  2455. if (cb) {
  2456. // getter with cb
  2457. getter = () => callWithErrorHandling(source, instance, 2 /* ErrorCodes.WATCH_GETTER */);
  2458. } else {
  2459. // no cb -> simple effect
  2460. getter = () => {
  2461. if (instance && instance.isUnmounted) {
  2462. return;
  2463. }
  2464. if (cleanup) {
  2465. cleanup();
  2466. }
  2467. return callWithAsyncErrorHandling(source, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [onCleanup]);
  2468. };
  2469. }
  2470. } else {
  2471. getter = NOOP;
  2472. }
  2473. if (cb && deep) {
  2474. var baseGetter = getter;
  2475. getter = () => traverse(baseGetter());
  2476. }
  2477. var cleanup;
  2478. var onCleanup = fn => {
  2479. cleanup = effect.onStop = () => {
  2480. callWithErrorHandling(fn, instance, 4 /* ErrorCodes.WATCH_CLEANUP */);
  2481. };
  2482. };
  2483. var oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  2484. var job = () => {
  2485. if (!effect.active) {
  2486. return;
  2487. }
  2488. if (cb) {
  2489. // watch(source, cb)
  2490. var newValue = effect.run();
  2491. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
  2492. // cleanup before running cb again
  2493. if (cleanup) {
  2494. cleanup();
  2495. }
  2496. callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [newValue,
  2497. // pass undefined as the old value when it's changed for the first time
  2498. oldValue === INITIAL_WATCHER_VALUE ? undefined : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, onCleanup]);
  2499. oldValue = newValue;
  2500. }
  2501. } else {
  2502. // watchEffect
  2503. effect.run();
  2504. }
  2505. };
  2506. // important: mark the job as a watcher callback so that scheduler knows
  2507. // it is allowed to self-trigger (#1727)
  2508. job.allowRecurse = !!cb;
  2509. var scheduler;
  2510. if (flush === 'sync') {
  2511. scheduler = job; // the scheduler function gets called directly
  2512. } else if (flush === 'post') {
  2513. scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
  2514. } else {
  2515. // default: 'pre'
  2516. job.pre = true;
  2517. if (instance) job.id = instance.uid;
  2518. scheduler = () => queueJob(job);
  2519. }
  2520. var effect = new ReactiveEffect(getter, scheduler);
  2521. // initial run
  2522. if (cb) {
  2523. if (immediate) {
  2524. job();
  2525. } else {
  2526. oldValue = effect.run();
  2527. }
  2528. } else if (flush === 'post') {
  2529. queuePostRenderEffect(effect.run.bind(effect), instance && instance.suspense);
  2530. } else {
  2531. effect.run();
  2532. }
  2533. var unwatch = () => {
  2534. effect.stop();
  2535. if (instance && instance.scope) {
  2536. remove(instance.scope.effects, effect);
  2537. }
  2538. };
  2539. return unwatch;
  2540. }
  2541. // this.$watch
  2542. function instanceWatch(source, value, options) {
  2543. var publicThis = this.proxy;
  2544. var getter = isString(source) ? source.includes('.') ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  2545. var cb;
  2546. if (isFunction(value)) {
  2547. cb = value;
  2548. } else {
  2549. cb = value.handler;
  2550. options = value;
  2551. }
  2552. var cur = currentInstance;
  2553. setCurrentInstance(this);
  2554. var res = doWatch(getter, cb.bind(publicThis), options);
  2555. if (cur) {
  2556. setCurrentInstance(cur);
  2557. } else {
  2558. unsetCurrentInstance();
  2559. }
  2560. return res;
  2561. }
  2562. function createPathGetter(ctx, path) {
  2563. var segments = path.split('.');
  2564. return () => {
  2565. var cur = ctx;
  2566. for (var i = 0; i < segments.length && cur; i++) {
  2567. cur = cur[segments[i]];
  2568. }
  2569. return cur;
  2570. };
  2571. }
  2572. function traverse(value, seen) {
  2573. if (!isObject(value) || value["__v_skip" /* ReactiveFlags.SKIP */]) {
  2574. return value;
  2575. }
  2576. seen = seen || new Set();
  2577. if (seen.has(value)) {
  2578. return value;
  2579. }
  2580. seen.add(value);
  2581. if (isRef(value)) {
  2582. traverse(value.value, seen);
  2583. } else if (isArray(value)) {
  2584. for (var i = 0; i < value.length; i++) {
  2585. traverse(value[i], seen);
  2586. }
  2587. } else if (isSet(value) || isMap(value)) {
  2588. value.forEach(v => {
  2589. traverse(v, seen);
  2590. });
  2591. } else if (isPlainObject(value)) {
  2592. for (var key in value) {
  2593. traverse(value[key], seen);
  2594. }
  2595. }
  2596. return value;
  2597. }
  2598. function useTransitionState() {
  2599. var state = {
  2600. isMounted: false,
  2601. isLeaving: false,
  2602. isUnmounting: false,
  2603. leavingVNodes: new Map()
  2604. };
  2605. onMounted(() => {
  2606. state.isMounted = true;
  2607. });
  2608. onBeforeUnmount(() => {
  2609. state.isUnmounting = true;
  2610. });
  2611. return state;
  2612. }
  2613. var TransitionHookValidator = [Function, Array];
  2614. var BaseTransitionPropsValidators = {
  2615. mode: String,
  2616. appear: Boolean,
  2617. persisted: Boolean,
  2618. // enter
  2619. onBeforeEnter: TransitionHookValidator,
  2620. onEnter: TransitionHookValidator,
  2621. onAfterEnter: TransitionHookValidator,
  2622. onEnterCancelled: TransitionHookValidator,
  2623. // leave
  2624. onBeforeLeave: TransitionHookValidator,
  2625. onLeave: TransitionHookValidator,
  2626. onAfterLeave: TransitionHookValidator,
  2627. onLeaveCancelled: TransitionHookValidator,
  2628. // appear
  2629. onBeforeAppear: TransitionHookValidator,
  2630. onAppear: TransitionHookValidator,
  2631. onAfterAppear: TransitionHookValidator,
  2632. onAppearCancelled: TransitionHookValidator
  2633. };
  2634. var BaseTransitionImpl = {
  2635. name: "BaseTransition",
  2636. props: BaseTransitionPropsValidators,
  2637. setup(props, _ref6) {
  2638. var {
  2639. slots
  2640. } = _ref6;
  2641. var instance = getCurrentInstance();
  2642. var state = useTransitionState();
  2643. var prevTransitionKey;
  2644. return () => {
  2645. var children = slots.default && getTransitionRawChildren(slots.default(), true);
  2646. if (!children || !children.length) {
  2647. return;
  2648. }
  2649. var child = children[0];
  2650. if (children.length > 1) {
  2651. // locate first non-comment child
  2652. for (var c of children) {
  2653. if (c.type !== Comment) {
  2654. child = c;
  2655. break;
  2656. }
  2657. }
  2658. }
  2659. // there's no need to track reactivity for these props so use the raw
  2660. // props for a bit better perf
  2661. var rawProps = toRaw(props);
  2662. var {
  2663. mode
  2664. } = rawProps;
  2665. if (state.isLeaving) {
  2666. return emptyPlaceholder(child);
  2667. }
  2668. // in the case of <transition><keep-alive/></transition>, we need to
  2669. // compare the type of the kept-alive children.
  2670. var innerChild = getKeepAliveChild(child);
  2671. if (!innerChild) {
  2672. return emptyPlaceholder(child);
  2673. }
  2674. var enterHooks = resolveTransitionHooks(innerChild, rawProps, state, instance);
  2675. setTransitionHooks(innerChild, enterHooks);
  2676. var oldChild = instance.subTree;
  2677. var oldInnerChild = oldChild && getKeepAliveChild(oldChild);
  2678. var transitionKeyChanged = false;
  2679. var {
  2680. getTransitionKey
  2681. } = innerChild.type;
  2682. if (getTransitionKey) {
  2683. var key = getTransitionKey();
  2684. if (prevTransitionKey === undefined) {
  2685. prevTransitionKey = key;
  2686. } else if (key !== prevTransitionKey) {
  2687. prevTransitionKey = key;
  2688. transitionKeyChanged = true;
  2689. }
  2690. }
  2691. // handle mode
  2692. if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
  2693. var leavingHooks = resolveTransitionHooks(oldInnerChild, rawProps, state, instance);
  2694. // update old tree's hooks in case of dynamic transition
  2695. setTransitionHooks(oldInnerChild, leavingHooks);
  2696. // switching between different views
  2697. if (mode === 'out-in') {
  2698. state.isLeaving = true;
  2699. // return placeholder node and queue update when leave finishes
  2700. leavingHooks.afterLeave = () => {
  2701. state.isLeaving = false;
  2702. // #6835
  2703. // it also needs to be updated when active is undefined
  2704. if (instance.update.active !== false) {
  2705. instance.update();
  2706. }
  2707. };
  2708. return emptyPlaceholder(child);
  2709. } else if (mode === 'in-out' && innerChild.type !== Comment) {
  2710. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  2711. var leavingVNodesCache = getLeavingNodesForType(state, oldInnerChild);
  2712. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  2713. // early removal callback
  2714. el._leaveCb = () => {
  2715. earlyRemove();
  2716. el._leaveCb = undefined;
  2717. delete enterHooks.delayedLeave;
  2718. };
  2719. enterHooks.delayedLeave = delayedLeave;
  2720. };
  2721. }
  2722. }
  2723. return child;
  2724. };
  2725. }
  2726. };
  2727. // export the public type for h/tsx inference
  2728. // also to avoid inline import() in generated d.ts files
  2729. var BaseTransition = BaseTransitionImpl;
  2730. function getLeavingNodesForType(state, vnode) {
  2731. var {
  2732. leavingVNodes
  2733. } = state;
  2734. var leavingVNodesCache = leavingVNodes.get(vnode.type);
  2735. if (!leavingVNodesCache) {
  2736. leavingVNodesCache = Object.create(null);
  2737. leavingVNodes.set(vnode.type, leavingVNodesCache);
  2738. }
  2739. return leavingVNodesCache;
  2740. }
  2741. // The transition hooks are attached to the vnode as vnode.transition
  2742. // and will be called at appropriate timing in the renderer.
  2743. function resolveTransitionHooks(vnode, props, state, instance) {
  2744. var {
  2745. appear,
  2746. mode,
  2747. persisted = false,
  2748. onBeforeEnter,
  2749. onEnter,
  2750. onAfterEnter,
  2751. onEnterCancelled,
  2752. onBeforeLeave,
  2753. onLeave,
  2754. onAfterLeave,
  2755. onLeaveCancelled,
  2756. onBeforeAppear,
  2757. onAppear,
  2758. onAfterAppear,
  2759. onAppearCancelled
  2760. } = props;
  2761. var key = String(vnode.key);
  2762. var leavingVNodesCache = getLeavingNodesForType(state, vnode);
  2763. var callHook = (hook, args) => {
  2764. hook && callWithAsyncErrorHandling(hook, instance, 9 /* ErrorCodes.TRANSITION_HOOK */, args);
  2765. };
  2766. var callAsyncHook = (hook, args) => {
  2767. var done = args[1];
  2768. callHook(hook, args);
  2769. if (isArray(hook)) {
  2770. if (hook.every(hook => hook.length <= 1)) done();
  2771. } else if (hook.length <= 1) {
  2772. done();
  2773. }
  2774. };
  2775. var hooks = {
  2776. mode,
  2777. persisted,
  2778. beforeEnter(el) {
  2779. var hook = onBeforeEnter;
  2780. if (!state.isMounted) {
  2781. if (appear) {
  2782. hook = onBeforeAppear || onBeforeEnter;
  2783. } else {
  2784. return;
  2785. }
  2786. }
  2787. // for same element (v-show)
  2788. if (el._leaveCb) {
  2789. el._leaveCb(true /* cancelled */);
  2790. }
  2791. // for toggled element with same key (v-if)
  2792. var leavingVNode = leavingVNodesCache[key];
  2793. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el._leaveCb) {
  2794. // force early removal (not cancelled)
  2795. leavingVNode.el._leaveCb();
  2796. }
  2797. callHook(hook, [el]);
  2798. },
  2799. enter(el) {
  2800. var hook = onEnter;
  2801. var afterHook = onAfterEnter;
  2802. var cancelHook = onEnterCancelled;
  2803. if (!state.isMounted) {
  2804. if (appear) {
  2805. hook = onAppear || onEnter;
  2806. afterHook = onAfterAppear || onAfterEnter;
  2807. cancelHook = onAppearCancelled || onEnterCancelled;
  2808. } else {
  2809. return;
  2810. }
  2811. }
  2812. var called = false;
  2813. var done = el._enterCb = cancelled => {
  2814. if (called) return;
  2815. called = true;
  2816. if (cancelled) {
  2817. callHook(cancelHook, [el]);
  2818. } else {
  2819. callHook(afterHook, [el]);
  2820. }
  2821. if (hooks.delayedLeave) {
  2822. hooks.delayedLeave();
  2823. }
  2824. el._enterCb = undefined;
  2825. };
  2826. if (hook) {
  2827. callAsyncHook(hook, [el, done]);
  2828. } else {
  2829. done();
  2830. }
  2831. },
  2832. leave(el, remove) {
  2833. var key = String(vnode.key);
  2834. if (el._enterCb) {
  2835. el._enterCb(true /* cancelled */);
  2836. }
  2837. if (state.isUnmounting) {
  2838. return remove();
  2839. }
  2840. callHook(onBeforeLeave, [el]);
  2841. var called = false;
  2842. var done = el._leaveCb = cancelled => {
  2843. if (called) return;
  2844. called = true;
  2845. remove();
  2846. if (cancelled) {
  2847. callHook(onLeaveCancelled, [el]);
  2848. } else {
  2849. callHook(onAfterLeave, [el]);
  2850. }
  2851. el._leaveCb = undefined;
  2852. if (leavingVNodesCache[key] === vnode) {
  2853. delete leavingVNodesCache[key];
  2854. }
  2855. };
  2856. leavingVNodesCache[key] = vnode;
  2857. if (onLeave) {
  2858. callAsyncHook(onLeave, [el, done]);
  2859. } else {
  2860. done();
  2861. }
  2862. },
  2863. clone(vnode) {
  2864. return resolveTransitionHooks(vnode, props, state, instance);
  2865. }
  2866. };
  2867. return hooks;
  2868. }
  2869. // the placeholder really only handles one special case: KeepAlive
  2870. // in the case of a KeepAlive in a leave phase we need to return a KeepAlive
  2871. // placeholder with empty content to avoid the KeepAlive instance from being
  2872. // unmounted.
  2873. function emptyPlaceholder(vnode) {
  2874. if (isKeepAlive(vnode)) {
  2875. vnode = cloneVNode(vnode);
  2876. vnode.children = null;
  2877. return vnode;
  2878. }
  2879. }
  2880. function getKeepAliveChild(vnode) {
  2881. return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : undefined : vnode;
  2882. }
  2883. function setTransitionHooks(vnode, hooks) {
  2884. if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */ && vnode.component) {
  2885. setTransitionHooks(vnode.component.subTree, hooks);
  2886. } else if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
  2887. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  2888. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  2889. } else {
  2890. vnode.transition = hooks;
  2891. }
  2892. }
  2893. function getTransitionRawChildren(children) {
  2894. var keepComment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2895. var parentKey = arguments.length > 2 ? arguments[2] : undefined;
  2896. var ret = [];
  2897. var keyedFragmentCount = 0;
  2898. for (var i = 0; i < children.length; i++) {
  2899. var child = children[i];
  2900. // #5360 inherit parent key in case of <template v-for>
  2901. var key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  2902. // handle fragment children case, e.g. v-for
  2903. if (child.type === Fragment) {
  2904. if (child.patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */) keyedFragmentCount++;
  2905. ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
  2906. }
  2907. // comment placeholders should be skipped, e.g. v-if
  2908. else if (keepComment || child.type !== Comment) {
  2909. ret.push(key != null ? cloneVNode(child, {
  2910. key
  2911. }) : child);
  2912. }
  2913. }
  2914. // #1126 if a transition children list contains multiple sub fragments, these
  2915. // fragments will be merged into a flat children array. Since each v-for
  2916. // fragment may contain different static bindings inside, we need to de-op
  2917. // these children to force full diffs to ensure correct behavior.
  2918. if (keyedFragmentCount > 1) {
  2919. for (var _i = 0; _i < ret.length; _i++) {
  2920. ret[_i].patchFlag = -2 /* PatchFlags.BAIL */;
  2921. }
  2922. }
  2923. return ret;
  2924. }
  2925. // implementation, close to no-op
  2926. function defineComponent(options) {
  2927. return isFunction(options) ? {
  2928. setup: options,
  2929. name: options.name
  2930. } : options;
  2931. }
  2932. var isAsyncWrapper = i => !!i.type.__asyncLoader;
  2933. function defineAsyncComponent(source) {
  2934. if (isFunction(source)) {
  2935. source = {
  2936. loader: source
  2937. };
  2938. }
  2939. var {
  2940. loader,
  2941. loadingComponent,
  2942. errorComponent,
  2943. delay = 200,
  2944. timeout,
  2945. // undefined = never times out
  2946. suspensible = true,
  2947. onError: userOnError
  2948. } = source;
  2949. var pendingRequest = null;
  2950. var resolvedComp;
  2951. var retries = 0;
  2952. var retry = () => {
  2953. retries++;
  2954. pendingRequest = null;
  2955. return load();
  2956. };
  2957. var load = () => {
  2958. var thisRequest;
  2959. return pendingRequest || (thisRequest = pendingRequest = loader().catch(err => {
  2960. err = err instanceof Error ? err : new Error(String(err));
  2961. if (userOnError) {
  2962. return new Promise((resolve, reject) => {
  2963. var userRetry = () => resolve(retry());
  2964. var userFail = () => reject(err);
  2965. userOnError(err, userRetry, userFail, retries + 1);
  2966. });
  2967. } else {
  2968. throw err;
  2969. }
  2970. }).then(comp => {
  2971. if (thisRequest !== pendingRequest && pendingRequest) {
  2972. return pendingRequest;
  2973. }
  2974. // interop module default
  2975. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
  2976. comp = comp.default;
  2977. }
  2978. resolvedComp = comp;
  2979. return comp;
  2980. }));
  2981. };
  2982. return defineComponent({
  2983. name: 'AsyncComponentWrapper',
  2984. __asyncLoader: load,
  2985. get __asyncResolved() {
  2986. return resolvedComp;
  2987. },
  2988. setup() {
  2989. var instance = currentInstance;
  2990. // already resolved
  2991. if (resolvedComp) {
  2992. return () => createInnerComp(resolvedComp, instance);
  2993. }
  2994. var onError = err => {
  2995. pendingRequest = null;
  2996. handleError(err, instance, 13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
  2997. };
  2998. // suspense-controlled or SSR.
  2999. if (suspensible && instance.suspense || false) {
  3000. return load().then(comp => {
  3001. return () => createInnerComp(comp, instance);
  3002. }).catch(err => {
  3003. onError(err);
  3004. return () => errorComponent ? createVNode(errorComponent, {
  3005. error: err
  3006. }) : null;
  3007. });
  3008. }
  3009. var loaded = ref(false);
  3010. var error = ref();
  3011. var delayed = ref(!!delay);
  3012. if (delay) {
  3013. setTimeout(() => {
  3014. delayed.value = false;
  3015. }, delay);
  3016. }
  3017. if (timeout != null) {
  3018. setTimeout(() => {
  3019. if (!loaded.value && !error.value) {
  3020. var err = new Error("Async component timed out after ".concat(timeout, "ms."));
  3021. onError(err);
  3022. error.value = err;
  3023. }
  3024. }, timeout);
  3025. }
  3026. load().then(() => {
  3027. loaded.value = true;
  3028. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  3029. // parent is keep-alive, force update so the loaded component's
  3030. // name is taken into account
  3031. queueJob(instance.parent.update);
  3032. }
  3033. }).catch(err => {
  3034. onError(err);
  3035. error.value = err;
  3036. });
  3037. return () => {
  3038. if (loaded.value && resolvedComp) {
  3039. return createInnerComp(resolvedComp, instance);
  3040. } else if (error.value && errorComponent) {
  3041. return createVNode(errorComponent, {
  3042. error: error.value
  3043. });
  3044. } else if (loadingComponent && !delayed.value) {
  3045. return createVNode(loadingComponent);
  3046. }
  3047. };
  3048. }
  3049. });
  3050. }
  3051. function createInnerComp(comp, parent) {
  3052. var {
  3053. ref,
  3054. props,
  3055. children,
  3056. ce
  3057. } = parent.vnode;
  3058. var vnode = createVNode(comp, props, children);
  3059. // ensure inner component inherits the async wrapper's ref owner
  3060. vnode.ref = ref;
  3061. // pass the custom element callback on to the inner comp
  3062. // and remove it from the async wrapper
  3063. vnode.ce = ce;
  3064. delete parent.vnode.ce;
  3065. return vnode;
  3066. }
  3067. var isKeepAlive = vnode => vnode.type.__isKeepAlive;
  3068. var KeepAliveImpl = {
  3069. name: "KeepAlive",
  3070. // Marker for special handling inside the renderer. We are not using a ===
  3071. // check directly on KeepAlive in the renderer, because importing it directly
  3072. // would prevent it from being tree-shaken.
  3073. __isKeepAlive: true,
  3074. props: {
  3075. include: [String, RegExp, Array],
  3076. exclude: [String, RegExp, Array],
  3077. max: [String, Number]
  3078. },
  3079. setup(props, _ref7) {
  3080. var {
  3081. slots
  3082. } = _ref7;
  3083. var instance = getCurrentInstance();
  3084. // KeepAlive communicates with the instantiated renderer via the
  3085. // ctx where the renderer passes in its internals,
  3086. // and the KeepAlive instance exposes activate/deactivate implementations.
  3087. // The whole point of this is to avoid importing KeepAlive directly in the
  3088. // renderer to facilitate tree-shaking.
  3089. var sharedContext = instance.ctx;
  3090. var cache = new Map();
  3091. var keys = new Set();
  3092. var current = null;
  3093. var parentSuspense = instance.suspense;
  3094. var {
  3095. renderer: {
  3096. p: patch,
  3097. m: move,
  3098. um: _unmount,
  3099. o: {
  3100. createElement
  3101. }
  3102. }
  3103. } = sharedContext;
  3104. // @ts-expect-error fixed by xxxxxx
  3105. var storageContainer = createElement('div');
  3106. sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
  3107. var instance = vnode.component;
  3108. move(vnode, container, anchor, 0 /* MoveType.ENTER */, parentSuspense);
  3109. // in case props have changed
  3110. patch(instance.vnode, vnode, container, anchor, instance, parentSuspense, isSVG, vnode.slotScopeIds, optimized);
  3111. queuePostRenderEffect(() => {
  3112. instance.isDeactivated = false;
  3113. if (instance.a) {
  3114. invokeArrayFns(instance.a);
  3115. }
  3116. var vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  3117. if (vnodeHook) {
  3118. invokeVNodeHook(vnodeHook, instance.parent, vnode);
  3119. }
  3120. }, parentSuspense);
  3121. };
  3122. sharedContext.deactivate = vnode => {
  3123. var instance = vnode.component;
  3124. move(vnode, storageContainer, null, 1 /* MoveType.LEAVE */, parentSuspense);
  3125. queuePostRenderEffect(() => {
  3126. if (instance.da) {
  3127. invokeArrayFns(instance.da);
  3128. }
  3129. var vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  3130. if (vnodeHook) {
  3131. invokeVNodeHook(vnodeHook, instance.parent, vnode);
  3132. }
  3133. instance.isDeactivated = true;
  3134. }, parentSuspense);
  3135. };
  3136. function unmount(vnode) {
  3137. // reset the shapeFlag so it can be properly unmounted
  3138. resetShapeFlag(vnode);
  3139. _unmount(vnode, instance, parentSuspense, true);
  3140. }
  3141. function pruneCache(filter) {
  3142. cache.forEach((vnode, key) => {
  3143. var name = getComponentName(vnode.type);
  3144. if (name && (!filter || !filter(name))) {
  3145. pruneCacheEntry(key);
  3146. }
  3147. });
  3148. }
  3149. function pruneCacheEntry(key) {
  3150. var cached = cache.get(key);
  3151. if (!current || !isSameVNodeType(cached, current)) {
  3152. unmount(cached);
  3153. } else if (current) {
  3154. // current active instance should no longer be kept-alive.
  3155. // we can't unmount it now but it might be later, so reset its flag now.
  3156. resetShapeFlag(current);
  3157. }
  3158. cache.delete(key);
  3159. keys.delete(key);
  3160. }
  3161. // prune cache on include/exclude prop change
  3162. watch(() => [props.include, props.exclude], _ref8 => {
  3163. var [include, exclude] = _ref8;
  3164. include && pruneCache(name => matches(include, name));
  3165. exclude && pruneCache(name => !matches(exclude, name));
  3166. },
  3167. // prune post-render after `current` has been updated
  3168. {
  3169. flush: 'post',
  3170. deep: true
  3171. });
  3172. // cache sub tree after render
  3173. var pendingCacheKey = null;
  3174. var cacheSubtree = () => {
  3175. // fix #1621, the pendingCacheKey could be 0
  3176. if (pendingCacheKey != null) {
  3177. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  3178. }
  3179. };
  3180. onMounted(cacheSubtree);
  3181. onUpdated(cacheSubtree);
  3182. onBeforeUnmount(() => {
  3183. cache.forEach(cached => {
  3184. var {
  3185. subTree,
  3186. suspense
  3187. } = instance;
  3188. var vnode = getInnerChild(subTree);
  3189. if (cached.type === vnode.type && cached.key === vnode.key) {
  3190. // current instance will be unmounted as part of keep-alive's unmount
  3191. resetShapeFlag(vnode);
  3192. // but invoke its deactivated hook here
  3193. var da = vnode.component.da;
  3194. da && queuePostRenderEffect(da, suspense);
  3195. return;
  3196. }
  3197. unmount(cached);
  3198. });
  3199. });
  3200. return () => {
  3201. pendingCacheKey = null;
  3202. if (!slots.default) {
  3203. return null;
  3204. }
  3205. var children = slots.default();
  3206. var rawVNode = children[0];
  3207. if (children.length > 1) {
  3208. current = null;
  3209. return children;
  3210. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) && !(rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */)) {
  3211. current = null;
  3212. return rawVNode;
  3213. }
  3214. var vnode = getInnerChild(rawVNode);
  3215. var comp = vnode.type;
  3216. // for async components, name check should be based in its loaded
  3217. // inner component if available
  3218. var name = getComponentName(isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp);
  3219. var {
  3220. include,
  3221. exclude,
  3222. max
  3223. } = props;
  3224. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  3225. current = vnode;
  3226. return rawVNode;
  3227. }
  3228. var key = vnode.key == null ? comp : vnode.key;
  3229. var cachedVNode = cache.get(key);
  3230. // clone vnode if it's reused because we are going to mutate it
  3231. if (vnode.el) {
  3232. vnode = cloneVNode(vnode);
  3233. if (rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
  3234. rawVNode.ssContent = vnode;
  3235. }
  3236. }
  3237. // #1513 it's possible for the returned vnode to be cloned due to attr
  3238. // fallthrough or scopeId, so the vnode here may not be the final vnode
  3239. // that is mounted. Instead of caching it directly, we store the pending
  3240. // key and cache `instance.subTree` (the normalized vnode) in
  3241. // beforeMount/beforeUpdate hooks.
  3242. pendingCacheKey = key;
  3243. if (cachedVNode) {
  3244. // copy over mounted state
  3245. vnode.el = cachedVNode.el;
  3246. vnode.component = cachedVNode.component;
  3247. if (vnode.transition) {
  3248. // recursively update transition hooks on subTree
  3249. setTransitionHooks(vnode, vnode.transition);
  3250. }
  3251. // avoid vnode being mounted as fresh
  3252. vnode.shapeFlag |= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
  3253. // make this key the freshest
  3254. keys.delete(key);
  3255. keys.add(key);
  3256. } else {
  3257. keys.add(key);
  3258. // prune oldest entry
  3259. if (max && keys.size > parseInt(max, 10)) {
  3260. pruneCacheEntry(keys.values().next().value);
  3261. }
  3262. }
  3263. // avoid vnode being unmounted
  3264. vnode.shapeFlag |= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
  3265. current = vnode;
  3266. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  3267. };
  3268. }
  3269. };
  3270. // export the public type for h/tsx inference
  3271. // also to avoid inline import() in generated d.ts files
  3272. var KeepAlive = KeepAliveImpl;
  3273. function matches(pattern, name) {
  3274. if (isArray(pattern)) {
  3275. return pattern.some(p => matches(p, name));
  3276. } else if (isString(pattern)) {
  3277. return pattern.split(',').includes(name);
  3278. } else if (isRegExp(pattern)) {
  3279. return pattern.test(name);
  3280. }
  3281. /* istanbul ignore next */
  3282. return false;
  3283. }
  3284. function onActivated(hook, target) {
  3285. registerKeepAliveHook(hook, "a" /* LifecycleHooks.ACTIVATED */, target);
  3286. }
  3287. function onDeactivated(hook, target) {
  3288. registerKeepAliveHook(hook, "da" /* LifecycleHooks.DEACTIVATED */, target);
  3289. }
  3290. function registerKeepAliveHook(hook, type) {
  3291. var target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : currentInstance;
  3292. // cache the deactivate branch check wrapper for injected hooks so the same
  3293. // hook can be properly deduped by the scheduler. "__wdc" stands for "with
  3294. // deactivation check".
  3295. var wrappedHook = hook.__wdc || (hook.__wdc = () => {
  3296. // only fire the hook if the target instance is NOT in a deactivated branch.
  3297. var current = target;
  3298. while (current) {
  3299. if (current.isDeactivated) {
  3300. return;
  3301. }
  3302. current = current.parent;
  3303. }
  3304. return hook();
  3305. });
  3306. injectHook(type, wrappedHook, target);
  3307. // In addition to registering it on the target instance, we walk up the parent
  3308. // chain and register it on all ancestor instances that are keep-alive roots.
  3309. // This avoids the need to walk the entire component tree when invoking these
  3310. // hooks, and more importantly, avoids the need to track child components in
  3311. // arrays.
  3312. if (target) {
  3313. var current = target.parent;
  3314. while (current && current.parent) {
  3315. if (isKeepAlive(current.parent.vnode)) {
  3316. injectToKeepAliveRoot(wrappedHook, type, target, current);
  3317. }
  3318. current = current.parent;
  3319. }
  3320. }
  3321. }
  3322. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  3323. // injectHook wraps the original for error handling, so make sure to remove
  3324. // the wrapped version.
  3325. var injected = injectHook(type, hook, keepAliveRoot, true /* prepend */);
  3326. onUnmounted(() => {
  3327. remove(keepAliveRoot[type], injected);
  3328. }, target);
  3329. }
  3330. function resetShapeFlag(vnode) {
  3331. // bitwise operations to remove keep alive flags
  3332. vnode.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
  3333. vnode.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
  3334. }
  3335. function getInnerChild(vnode) {
  3336. return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
  3337. }
  3338. function injectHook(type, hook) {
  3339. var target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : currentInstance;
  3340. var prepend = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  3341. if (target) {
  3342. // fixed by xxxxxx
  3343. if (isRootHook(type) && target !== target.root) {
  3344. target = target.root;
  3345. if (isRootImmediateHook(type)) {
  3346. // 作用域应该是组件还是页面?目前绑定的是页面
  3347. var proxy = target.proxy;
  3348. callWithAsyncErrorHandling(hook.bind(proxy), target, type, ON_LOAD === type ? [proxy.$page.options] : []);
  3349. }
  3350. }
  3351. var hooks = target[type] || (target[type] = []);
  3352. // cache the error handling wrapper for injected hooks so the same hook
  3353. // can be properly deduped by the scheduler. "__weh" stands for "with error
  3354. // handling".
  3355. var wrappedHook = hook.__weh || (hook.__weh = function () {
  3356. if (target.isUnmounted) {
  3357. return;
  3358. }
  3359. // disable tracking inside all lifecycle hooks
  3360. // since they can potentially be called inside effects.
  3361. pauseTracking();
  3362. // Set currentInstance during hook invocation.
  3363. // This assumes the hook does not synchronously trigger other hooks, which
  3364. // can only be false when the user does something really funky.
  3365. setCurrentInstance(target);
  3366. for (var _len4 = arguments.length, args = new Array(_len4), _key5 = 0; _key5 < _len4; _key5++) {
  3367. args[_key5] = arguments[_key5];
  3368. }
  3369. var res = callWithAsyncErrorHandling(hook, target, type, args);
  3370. unsetCurrentInstance();
  3371. resetTracking();
  3372. return res;
  3373. });
  3374. if (prepend) {
  3375. hooks.unshift(wrappedHook);
  3376. } else {
  3377. hooks.push(wrappedHook);
  3378. }
  3379. return wrappedHook;
  3380. }
  3381. }
  3382. var createHook = lifecycle => function (hook) {
  3383. var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : currentInstance;
  3384. return (
  3385. // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
  3386. (!isInSSRComponentSetup || lifecycle === "sp" /* LifecycleHooks.SERVER_PREFETCH */) && injectHook(lifecycle, function () {
  3387. return hook(...arguments);
  3388. }, target)
  3389. );
  3390. };
  3391. var onBeforeMount = createHook("bm" /* LifecycleHooks.BEFORE_MOUNT */);
  3392. var onMounted = createHook("m" /* LifecycleHooks.MOUNTED */);
  3393. var onBeforeUpdate = createHook("bu" /* LifecycleHooks.BEFORE_UPDATE */);
  3394. var onUpdated = createHook("u" /* LifecycleHooks.UPDATED */);
  3395. var onBeforeUnmount = createHook("bum" /* LifecycleHooks.BEFORE_UNMOUNT */);
  3396. var onUnmounted = createHook("um" /* LifecycleHooks.UNMOUNTED */);
  3397. var onServerPrefetch = createHook("sp" /* LifecycleHooks.SERVER_PREFETCH */);
  3398. var onRenderTriggered = createHook("rtg" /* LifecycleHooks.RENDER_TRIGGERED */);
  3399. var onRenderTracked = createHook("rtc" /* LifecycleHooks.RENDER_TRACKED */);
  3400. function onErrorCaptured(hook) {
  3401. var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : currentInstance;
  3402. injectHook("ec" /* LifecycleHooks.ERROR_CAPTURED */, hook, target);
  3403. }
  3404. /**
  3405. * Adds directives to a VNode.
  3406. */
  3407. function withDirectives(vnode, directives) {
  3408. var internalInstance = currentRenderingInstance;
  3409. if (internalInstance === null) {
  3410. return vnode;
  3411. }
  3412. var instance = getExposeProxy(internalInstance) || internalInstance.proxy;
  3413. var bindings = vnode.dirs || (vnode.dirs = []);
  3414. for (var i = 0; i < directives.length; i++) {
  3415. var [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  3416. if (dir) {
  3417. if (isFunction(dir)) {
  3418. dir = {
  3419. mounted: dir,
  3420. updated: dir
  3421. };
  3422. }
  3423. if (dir.deep) {
  3424. traverse(value);
  3425. }
  3426. bindings.push({
  3427. dir,
  3428. instance,
  3429. value,
  3430. oldValue: void 0,
  3431. arg,
  3432. modifiers
  3433. });
  3434. }
  3435. }
  3436. return vnode;
  3437. }
  3438. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  3439. var bindings = vnode.dirs;
  3440. var oldBindings = prevVNode && prevVNode.dirs;
  3441. for (var i = 0; i < bindings.length; i++) {
  3442. var binding = bindings[i];
  3443. if (oldBindings) {
  3444. binding.oldValue = oldBindings[i].value;
  3445. }
  3446. var hook = binding.dir[name];
  3447. if (hook) {
  3448. // disable tracking inside all lifecycle hooks
  3449. // since they can potentially be called inside effects.
  3450. pauseTracking();
  3451. callWithAsyncErrorHandling(hook, instance, 8 /* ErrorCodes.DIRECTIVE_HOOK */, [vnode.el, binding, vnode, prevVNode]);
  3452. resetTracking();
  3453. }
  3454. }
  3455. }
  3456. var COMPONENTS = 'components';
  3457. var DIRECTIVES = 'directives';
  3458. /**
  3459. * @private
  3460. */
  3461. function resolveComponent(name, maybeSelfReference) {
  3462. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  3463. }
  3464. var NULL_DYNAMIC_COMPONENT = Symbol();
  3465. /**
  3466. * @private
  3467. */
  3468. function resolveDynamicComponent(component) {
  3469. if (isString(component)) {
  3470. return resolveAsset(COMPONENTS, component, false) || component;
  3471. } else {
  3472. // invalid types will fallthrough to createVNode and raise warning
  3473. return component || NULL_DYNAMIC_COMPONENT;
  3474. }
  3475. }
  3476. /**
  3477. * @private
  3478. */
  3479. function resolveDirective(name) {
  3480. return resolveAsset(DIRECTIVES, name);
  3481. }
  3482. // implementation
  3483. function resolveAsset(type, name) {
  3484. var warnMissing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  3485. var maybeSelfReference = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  3486. var instance = currentRenderingInstance || currentInstance;
  3487. if (instance) {
  3488. var Component = instance.type;
  3489. // explicit self name has highest priority
  3490. if (type === COMPONENTS) {
  3491. var selfName = getComponentName(Component, false /* do not include inferred name to avoid breaking existing code */);
  3492. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  3493. return Component;
  3494. }
  3495. }
  3496. var res =
  3497. // local registration
  3498. // check instance[type] first which is resolved for options API
  3499. resolve(instance[type] || Component[type], name) ||
  3500. // global registration
  3501. resolve(instance.appContext[type], name);
  3502. if (!res && maybeSelfReference) {
  3503. // fallback to implicit self-reference
  3504. return Component;
  3505. }
  3506. return res;
  3507. }
  3508. }
  3509. function resolve(registry, name) {
  3510. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  3511. }
  3512. /**
  3513. * Actual implementation
  3514. */
  3515. function renderList(source, renderItem, cache, index) {
  3516. var ret;
  3517. var cached = cache && cache[index];
  3518. if (isArray(source) || isString(source)) {
  3519. ret = new Array(source.length);
  3520. for (var i = 0, l = source.length; i < l; i++) {
  3521. ret[i] = renderItem(source[i], i, undefined, cached && cached[i]);
  3522. }
  3523. } else if (typeof source === 'number') {
  3524. ret = new Array(source);
  3525. for (var _i2 = 0; _i2 < source; _i2++) {
  3526. ret[_i2] = renderItem(_i2 + 1, _i2, undefined, cached && cached[_i2]);
  3527. }
  3528. } else if (isObject(source)) {
  3529. if (source[Symbol.iterator]) {
  3530. ret = Array.from(source, (item, i) => renderItem(item, i, undefined, cached && cached[i]));
  3531. } else {
  3532. var keys = Object.keys(source);
  3533. ret = new Array(keys.length);
  3534. for (var _i3 = 0, _l = keys.length; _i3 < _l; _i3++) {
  3535. var key = keys[_i3];
  3536. ret[_i3] = renderItem(source[key], key, _i3, cached && cached[_i3]);
  3537. }
  3538. }
  3539. } else {
  3540. ret = [];
  3541. }
  3542. if (cache) {
  3543. cache[index] = ret;
  3544. }
  3545. return ret;
  3546. }
  3547. /**
  3548. * Compiler runtime helper for creating dynamic slots object
  3549. * @private
  3550. */
  3551. function createSlots(slots, dynamicSlots) {
  3552. var _loop = function (i) {
  3553. var slot = dynamicSlots[i];
  3554. // array of dynamic slot generated by <template v-for="..." #[...]>
  3555. if (isArray(slot)) {
  3556. for (var j = 0; j < slot.length; j++) {
  3557. slots[slot[j].name] = slot[j].fn;
  3558. }
  3559. } else if (slot) {
  3560. // conditional single slot generated by <template v-if="..." #foo>
  3561. slots[slot.name] = slot.key ? function () {
  3562. var res = slot.fn(...arguments);
  3563. // attach branch key so each conditional branch is considered a
  3564. // different fragment
  3565. if (res) res.key = slot.key;
  3566. return res;
  3567. } : slot.fn;
  3568. }
  3569. };
  3570. for (var i = 0; i < dynamicSlots.length; i++) {
  3571. _loop(i);
  3572. }
  3573. return slots;
  3574. }
  3575. /**
  3576. * Compiler runtime helper for rendering `<slot/>`
  3577. * @private
  3578. */
  3579. function renderSlot(slots, name) {
  3580. var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  3581. var
  3582. // this is not a user-facing function, so the fallback is always generated by
  3583. // the compiler and guaranteed to be a function returning an array
  3584. fallback = arguments.length > 3 ? arguments[3] : undefined;
  3585. var noSlotted = arguments.length > 4 ? arguments[4] : undefined;
  3586. if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
  3587. if (name !== 'default') props.name = name;
  3588. return createVNode('slot', props, fallback && fallback());
  3589. }
  3590. var slot = slots[name];
  3591. // a compiled slot disables block tracking by default to avoid manual
  3592. // invocation interfering with template-based block tracking, but in
  3593. // `renderSlot` we can be sure that it's template-based so we can force
  3594. // enable it.
  3595. if (slot && slot._c) {
  3596. slot._d = false;
  3597. }
  3598. openBlock();
  3599. var validSlotContent = slot && ensureValidVNode(slot(props));
  3600. var rendered = createBlock(Fragment, {
  3601. key: props.key ||
  3602. // slot content array of a dynamic conditional slot may have a branch
  3603. // key attached in the `createSlots` helper, respect that
  3604. validSlotContent && validSlotContent.key || "_".concat(name)
  3605. }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* SlotFlags.STABLE */ ? 64 /* PatchFlags.STABLE_FRAGMENT */ : -2 /* PatchFlags.BAIL */);
  3606. if (!noSlotted && rendered.scopeId) {
  3607. rendered.slotScopeIds = [rendered.scopeId + '-s'];
  3608. }
  3609. if (slot && slot._c) {
  3610. slot._d = true;
  3611. }
  3612. return rendered;
  3613. }
  3614. function ensureValidVNode(vnodes) {
  3615. return vnodes.some(child => {
  3616. if (!isVNode(child)) return true;
  3617. if (child.type === Comment) return false;
  3618. if (child.type === Fragment && !ensureValidVNode(child.children)) return false;
  3619. return true;
  3620. }) ? vnodes : null;
  3621. }
  3622. /**
  3623. * For prefixing keys in v-on="obj" with "on"
  3624. * @private
  3625. */
  3626. function toHandlers(obj, preserveCaseIfNecessary) {
  3627. var ret = {};
  3628. for (var key in obj) {
  3629. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? "on:".concat(key) : toHandlerKey(key)] = obj[key];
  3630. }
  3631. return ret;
  3632. }
  3633. /**
  3634. * #2437 In Vue 3, functional components do not have a public instance proxy but
  3635. * they exist in the internal parent chain. For code that relies on traversing
  3636. * public $parent chains, skip functional ones and go to the parent instead.
  3637. */
  3638. var getPublicInstance = i => {
  3639. if (!i) return null;
  3640. if (isStatefulComponent(i)) return getExposeProxy(i) || i.proxy;
  3641. return getPublicInstance(i.parent);
  3642. };
  3643. var publicPropertiesMap =
  3644. // Move PURE marker to new line to workaround compiler discarding it
  3645. // due to type annotation
  3646. /*#__PURE__*/
  3647. extend$1(Object.create(null), {
  3648. $: i => i,
  3649. $el: i => i.vnode.el,
  3650. $data: i => i.data,
  3651. $props: i => i.props,
  3652. $attrs: i => i.attrs,
  3653. $slots: i => i.slots,
  3654. $refs: i => i.refs,
  3655. $parent: i => getPublicInstance(i.parent),
  3656. $root: i => getPublicInstance(i.root),
  3657. $emit: i => i.emit,
  3658. $options: i => resolveMergedOptions(i),
  3659. $forceUpdate: i => i.f || (i.f = () => queueJob(i.update)),
  3660. $nextTick: i => i.n || (i.n = nextTick.bind(i.proxy)),
  3661. $watch: i => instanceWatch.bind(i)
  3662. });
  3663. var hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  3664. var PublicInstanceProxyHandlers = {
  3665. get(_ref9, key) {
  3666. var {
  3667. _: instance
  3668. } = _ref9;
  3669. var {
  3670. ctx,
  3671. setupState,
  3672. data,
  3673. props,
  3674. accessCache,
  3675. type,
  3676. appContext
  3677. } = instance;
  3678. // data / props / ctx
  3679. // This getter gets called for every property access on the render context
  3680. // during render and is a major hotspot. The most expensive part of this
  3681. // is the multiple hasOwn() calls. It's much faster to do a simple property
  3682. // access on a plain object, so we use an accessCache object (with null
  3683. // prototype) to memoize what access type a key corresponds to.
  3684. var normalizedProps;
  3685. if (key[0] !== '$') {
  3686. var n = accessCache[key];
  3687. if (n !== undefined) {
  3688. switch (n) {
  3689. case 1 /* AccessTypes.SETUP */:
  3690. return setupState[key];
  3691. case 2 /* AccessTypes.DATA */:
  3692. return data[key];
  3693. case 4 /* AccessTypes.CONTEXT */:
  3694. return ctx[key];
  3695. case 3 /* AccessTypes.PROPS */:
  3696. return props[key];
  3697. // default: just fallthrough
  3698. }
  3699. } else if (hasSetupBinding(setupState, key)) {
  3700. accessCache[key] = 1 /* AccessTypes.SETUP */;
  3701. return setupState[key];
  3702. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  3703. accessCache[key] = 2 /* AccessTypes.DATA */;
  3704. return data[key];
  3705. } else if (
  3706. // only cache other properties when instance has declared (thus stable)
  3707. // props
  3708. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)) {
  3709. accessCache[key] = 3 /* AccessTypes.PROPS */;
  3710. return props[key];
  3711. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  3712. accessCache[key] = 4 /* AccessTypes.CONTEXT */;
  3713. return ctx[key];
  3714. } else if (shouldCacheAccess) {
  3715. accessCache[key] = 0 /* AccessTypes.OTHER */;
  3716. }
  3717. }
  3718. var publicGetter = publicPropertiesMap[key];
  3719. var cssModule, globalProperties;
  3720. // public $xxx properties
  3721. if (publicGetter) {
  3722. if (key === '$attrs') {
  3723. track(instance, "get" /* TrackOpTypes.GET */, key);
  3724. }
  3725. return publicGetter(instance);
  3726. } else if (
  3727. // css module (injected by vue-loader)
  3728. (cssModule = type.__cssModules) && (cssModule = cssModule[key])) {
  3729. return cssModule;
  3730. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  3731. // user may set custom properties to `this` that start with `$`
  3732. accessCache[key] = 4 /* AccessTypes.CONTEXT */;
  3733. return ctx[key];
  3734. } else if (
  3735. // global properties
  3736. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)) {
  3737. {
  3738. return globalProperties[key];
  3739. }
  3740. } else ;
  3741. },
  3742. set(_ref10, key, value) {
  3743. var {
  3744. _: instance
  3745. } = _ref10;
  3746. var {
  3747. data,
  3748. setupState,
  3749. ctx
  3750. } = instance;
  3751. if (hasSetupBinding(setupState, key)) {
  3752. setupState[key] = value;
  3753. return true;
  3754. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  3755. data[key] = value;
  3756. return true;
  3757. } else if (hasOwn(instance.props, key)) {
  3758. return false;
  3759. }
  3760. if (key[0] === '$' && key.slice(1) in instance) {
  3761. return false;
  3762. } else {
  3763. {
  3764. ctx[key] = value;
  3765. }
  3766. }
  3767. return true;
  3768. },
  3769. has(_ref11, key) {
  3770. var {
  3771. _: {
  3772. data,
  3773. setupState,
  3774. accessCache,
  3775. ctx,
  3776. appContext,
  3777. propsOptions
  3778. }
  3779. } = _ref11;
  3780. var normalizedProps;
  3781. return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
  3782. },
  3783. defineProperty(target, key, descriptor) {
  3784. if (descriptor.get != null) {
  3785. // invalidate key cache of a getter based property #5417
  3786. target._.accessCache[key] = 0;
  3787. } else if (hasOwn(descriptor, 'value')) {
  3788. this.set(target, key, descriptor.value, null);
  3789. }
  3790. return Reflect.defineProperty(target, key, descriptor);
  3791. }
  3792. };
  3793. var RuntimeCompiledPublicInstanceProxyHandlers = /*#__PURE__*/extend$1({}, PublicInstanceProxyHandlers, {
  3794. get(target, key) {
  3795. // fast path for unscopables when using `with` block
  3796. if (key === Symbol.unscopables) {
  3797. return;
  3798. }
  3799. return PublicInstanceProxyHandlers.get(target, key, target);
  3800. },
  3801. has(_, key) {
  3802. var has = key[0] !== '_' && !isGloballyWhitelisted(key);
  3803. return has;
  3804. }
  3805. });
  3806. var shouldCacheAccess = true;
  3807. function applyOptions(instance) {
  3808. var options = resolveMergedOptions(instance);
  3809. var publicThis = instance.proxy;
  3810. var ctx = instance.ctx;
  3811. // do not cache property access on public proxy during state initialization
  3812. shouldCacheAccess = false;
  3813. // call beforeCreate first before accessing other options since
  3814. // the hook may mutate resolved options (#2791)
  3815. if (options.beforeCreate) {
  3816. callHook(options.beforeCreate, instance, "bc" /* LifecycleHooks.BEFORE_CREATE */);
  3817. }
  3818. var {
  3819. // state
  3820. data: dataOptions,
  3821. computed: computedOptions,
  3822. methods,
  3823. watch: watchOptions,
  3824. provide: provideOptions,
  3825. inject: injectOptions,
  3826. // lifecycle
  3827. created,
  3828. beforeMount,
  3829. mounted,
  3830. beforeUpdate,
  3831. updated,
  3832. activated,
  3833. deactivated,
  3834. beforeDestroy,
  3835. beforeUnmount,
  3836. destroyed,
  3837. unmounted,
  3838. render,
  3839. renderTracked,
  3840. renderTriggered,
  3841. errorCaptured,
  3842. serverPrefetch,
  3843. // public API
  3844. expose,
  3845. inheritAttrs,
  3846. // assets
  3847. components,
  3848. directives,
  3849. filters
  3850. } = options;
  3851. var checkDuplicateProperties = null;
  3852. // options initialization order (to be consistent with Vue 2):
  3853. // - props (already done outside of this function)
  3854. // - inject
  3855. // - methods
  3856. // - data (deferred since it relies on `this` access)
  3857. // - computed
  3858. // - watch (deferred since it relies on `this` access)
  3859. if (injectOptions) {
  3860. resolveInjections(injectOptions, ctx, checkDuplicateProperties, instance.appContext.config.unwrapInjectedRef);
  3861. }
  3862. if (methods) {
  3863. for (var key in methods) {
  3864. var methodHandler = methods[key];
  3865. if (isFunction(methodHandler)) {
  3866. // In dev mode, we use the `createRenderContext` function to define
  3867. // methods to the proxy target, and those are read-only but
  3868. // reconfigurable, so it needs to be redefined here
  3869. {
  3870. ctx[key] = methodHandler.bind(publicThis);
  3871. }
  3872. }
  3873. }
  3874. }
  3875. if (dataOptions) {
  3876. var data = dataOptions.call(publicThis, publicThis);
  3877. if (!isObject(data)) ;else {
  3878. instance.data = reactive(data);
  3879. }
  3880. }
  3881. // state initialization complete at this point - start caching access
  3882. shouldCacheAccess = true;
  3883. if (computedOptions) {
  3884. var _loop2 = function (_key6) {
  3885. var opt = computedOptions[_key6];
  3886. var get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  3887. var set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : NOOP;
  3888. var c = computed({
  3889. get,
  3890. set
  3891. });
  3892. Object.defineProperty(ctx, _key6, {
  3893. enumerable: true,
  3894. configurable: true,
  3895. get: () => c.value,
  3896. set: v => c.value = v
  3897. });
  3898. };
  3899. for (var _key6 in computedOptions) {
  3900. _loop2(_key6);
  3901. }
  3902. }
  3903. if (watchOptions) {
  3904. for (var _key7 in watchOptions) {
  3905. createWatcher(watchOptions[_key7], ctx, publicThis, _key7);
  3906. }
  3907. }
  3908. if (provideOptions) {
  3909. var provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  3910. Reflect.ownKeys(provides).forEach(key => {
  3911. provide(key, provides[key]);
  3912. });
  3913. }
  3914. if (created) {
  3915. callHook(created, instance, "c" /* LifecycleHooks.CREATED */);
  3916. }
  3917. function registerLifecycleHook(register, hook) {
  3918. if (isArray(hook)) {
  3919. hook.forEach(_hook => register(_hook.bind(publicThis)));
  3920. } else if (hook) {
  3921. register(hook.bind(publicThis));
  3922. }
  3923. }
  3924. registerLifecycleHook(onBeforeMount, beforeMount);
  3925. registerLifecycleHook(onMounted, mounted);
  3926. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  3927. registerLifecycleHook(onUpdated, updated);
  3928. registerLifecycleHook(onActivated, activated);
  3929. registerLifecycleHook(onDeactivated, deactivated);
  3930. registerLifecycleHook(onErrorCaptured, errorCaptured);
  3931. registerLifecycleHook(onRenderTracked, renderTracked);
  3932. registerLifecycleHook(onRenderTriggered, renderTriggered);
  3933. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  3934. registerLifecycleHook(onUnmounted, unmounted);
  3935. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  3936. if (isArray(expose)) {
  3937. if (expose.length) {
  3938. var exposed = instance.exposed || (instance.exposed = {});
  3939. expose.forEach(key => {
  3940. Object.defineProperty(exposed, key, {
  3941. get: () => publicThis[key],
  3942. set: val => publicThis[key] = val
  3943. });
  3944. });
  3945. } else if (!instance.exposed) {
  3946. instance.exposed = {};
  3947. }
  3948. }
  3949. // options that are handled when creating the instance but also need to be
  3950. // applied from mixins
  3951. if (render && instance.render === NOOP) {
  3952. instance.render = render;
  3953. }
  3954. if (inheritAttrs != null) {
  3955. instance.inheritAttrs = inheritAttrs;
  3956. }
  3957. // asset options.
  3958. if (components) instance.components = components;
  3959. if (directives) instance.directives = directives;
  3960. // fixed by xxxxxx
  3961. var customApplyOptions = instance.appContext.config.globalProperties.$applyOptions;
  3962. if (customApplyOptions) {
  3963. customApplyOptions(options, instance, publicThis);
  3964. }
  3965. }
  3966. function resolveInjections(injectOptions, ctx) {
  3967. var checkDuplicateProperties = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : NOOP;
  3968. var unwrapRef = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  3969. if (isArray(injectOptions)) {
  3970. injectOptions = normalizeInject(injectOptions);
  3971. }
  3972. var _loop3 = function (key) {
  3973. var opt = injectOptions[key];
  3974. var injected = void 0;
  3975. if (isObject(opt)) {
  3976. if ('default' in opt) {
  3977. injected = inject(opt.from || key, opt.default, true /* treat default function as factory */);
  3978. } else {
  3979. injected = inject(opt.from || key);
  3980. }
  3981. } else {
  3982. injected = inject(opt);
  3983. }
  3984. if (isRef(injected)) {
  3985. // TODO remove the check in 3.3
  3986. if (unwrapRef) {
  3987. Object.defineProperty(ctx, key, {
  3988. enumerable: true,
  3989. configurable: true,
  3990. get: () => injected.value,
  3991. set: v => injected.value = v
  3992. });
  3993. } else {
  3994. ctx[key] = injected;
  3995. }
  3996. } else {
  3997. ctx[key] = injected;
  3998. }
  3999. };
  4000. for (var key in injectOptions) {
  4001. _loop3(key);
  4002. }
  4003. }
  4004. function callHook(hook, instance, type) {
  4005. callWithAsyncErrorHandling(isArray(hook) ? hook.map(h => h.bind(instance.proxy)) : hook.bind(instance.proxy), instance, type);
  4006. }
  4007. function createWatcher(raw, ctx, publicThis, key) {
  4008. var getter = key.includes('.') ? createPathGetter(publicThis, key) : () => publicThis[key];
  4009. if (isString(raw)) {
  4010. var handler = ctx[raw];
  4011. if (isFunction(handler)) {
  4012. watch(getter, handler);
  4013. }
  4014. } else if (isFunction(raw)) {
  4015. watch(getter, raw.bind(publicThis));
  4016. } else if (isObject(raw)) {
  4017. if (isArray(raw)) {
  4018. raw.forEach(r => createWatcher(r, ctx, publicThis, key));
  4019. } else {
  4020. var _handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  4021. if (isFunction(_handler)) {
  4022. watch(getter, _handler, raw);
  4023. }
  4024. }
  4025. } else ;
  4026. }
  4027. /**
  4028. * Resolve merged options and cache it on the component.
  4029. * This is done only once per-component since the merging does not involve
  4030. * instances.
  4031. */
  4032. function resolveMergedOptions(instance) {
  4033. var base = instance.type;
  4034. var {
  4035. mixins,
  4036. extends: extendsOptions
  4037. } = base;
  4038. var {
  4039. mixins: globalMixins,
  4040. optionsCache: cache,
  4041. config: {
  4042. optionMergeStrategies
  4043. }
  4044. } = instance.appContext;
  4045. var cached = cache.get(base);
  4046. var resolved;
  4047. if (cached) {
  4048. resolved = cached;
  4049. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  4050. {
  4051. resolved = base;
  4052. }
  4053. } else {
  4054. resolved = {};
  4055. if (globalMixins.length) {
  4056. globalMixins.forEach(m => mergeOptions(resolved, m, optionMergeStrategies, true));
  4057. }
  4058. mergeOptions(resolved, base, optionMergeStrategies);
  4059. }
  4060. if (isObject(base)) {
  4061. cache.set(base, resolved);
  4062. }
  4063. return resolved;
  4064. }
  4065. function mergeOptions(to, from, strats) {
  4066. var asMixin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  4067. var {
  4068. mixins,
  4069. extends: extendsOptions
  4070. } = from;
  4071. if (extendsOptions) {
  4072. mergeOptions(to, extendsOptions, strats, true);
  4073. }
  4074. if (mixins) {
  4075. mixins.forEach(m => mergeOptions(to, m, strats, true));
  4076. }
  4077. for (var key in from) {
  4078. if (asMixin && key === 'expose') ;else {
  4079. var strat = internalOptionMergeStrats[key] || strats && strats[key];
  4080. to[key] = strat ? strat(to[key], from[key]) : from[key];
  4081. }
  4082. }
  4083. return to;
  4084. }
  4085. var internalOptionMergeStrats = {
  4086. data: mergeDataFn,
  4087. props: mergeObjectOptions,
  4088. emits: mergeObjectOptions,
  4089. // objects
  4090. methods: mergeObjectOptions,
  4091. computed: mergeObjectOptions,
  4092. // lifecycle
  4093. beforeCreate: mergeAsArray,
  4094. created: mergeAsArray,
  4095. beforeMount: mergeAsArray,
  4096. mounted: mergeAsArray,
  4097. beforeUpdate: mergeAsArray,
  4098. updated: mergeAsArray,
  4099. beforeDestroy: mergeAsArray,
  4100. beforeUnmount: mergeAsArray,
  4101. destroyed: mergeAsArray,
  4102. unmounted: mergeAsArray,
  4103. activated: mergeAsArray,
  4104. deactivated: mergeAsArray,
  4105. errorCaptured: mergeAsArray,
  4106. serverPrefetch: mergeAsArray,
  4107. // assets
  4108. components: mergeObjectOptions,
  4109. directives: mergeObjectOptions,
  4110. // watch
  4111. watch: mergeWatchOptions,
  4112. // provide / inject
  4113. provide: mergeDataFn,
  4114. inject: mergeInject
  4115. };
  4116. function mergeDataFn(to, from) {
  4117. if (!from) {
  4118. return to;
  4119. }
  4120. if (!to) {
  4121. return from;
  4122. }
  4123. return function mergedDataFn() {
  4124. return extend$1(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);
  4125. };
  4126. }
  4127. function mergeInject(to, from) {
  4128. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  4129. }
  4130. function normalizeInject(raw) {
  4131. if (isArray(raw)) {
  4132. var res = {};
  4133. for (var i = 0; i < raw.length; i++) {
  4134. res[raw[i]] = raw[i];
  4135. }
  4136. return res;
  4137. }
  4138. return raw;
  4139. }
  4140. function mergeAsArray(to, from) {
  4141. return to ? [...new Set([].concat(to, from))] : from;
  4142. }
  4143. function mergeObjectOptions(to, from) {
  4144. return to ? extend$1(extend$1(Object.create(null), to), from) : from;
  4145. }
  4146. function mergeWatchOptions(to, from) {
  4147. if (!to) return from;
  4148. if (!from) return to;
  4149. var merged = extend$1(Object.create(null), to);
  4150. for (var key in from) {
  4151. merged[key] = mergeAsArray(to[key], from[key]);
  4152. }
  4153. return merged;
  4154. }
  4155. function initProps(instance, rawProps, isStateful) {
  4156. var isSSR = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  4157. var props = {};
  4158. var attrs = {};
  4159. def(attrs, InternalObjectKey, 1);
  4160. instance.propsDefaults = Object.create(null);
  4161. setFullProps(instance, rawProps, props, attrs);
  4162. // ensure all declared prop keys are present
  4163. for (var key in instance.propsOptions[0]) {
  4164. if (!(key in props)) {
  4165. props[key] = undefined;
  4166. }
  4167. }
  4168. if (isStateful) {
  4169. // stateful
  4170. instance.props = isSSR ? props : shallowReactive(props);
  4171. } else {
  4172. if (!instance.type.props) {
  4173. // functional w/ optional props, props === attrs
  4174. instance.props = attrs;
  4175. } else {
  4176. // functional w/ declared props
  4177. instance.props = props;
  4178. }
  4179. }
  4180. instance.attrs = attrs;
  4181. }
  4182. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  4183. var {
  4184. props,
  4185. attrs,
  4186. vnode: {
  4187. patchFlag
  4188. }
  4189. } = instance;
  4190. var rawCurrentProps = toRaw(props);
  4191. var [options] = instance.propsOptions;
  4192. var hasAttrsChanged = false;
  4193. if (
  4194. // always force full diff in dev
  4195. // - #1942 if hmr is enabled with sfc component
  4196. // - vite#872 non-sfc component used by sfc component
  4197. (optimized || patchFlag > 0) && !(patchFlag & 16 /* PatchFlags.FULL_PROPS */)) {
  4198. if (patchFlag & 8 /* PatchFlags.PROPS */) {
  4199. // Compiler-generated props & no keys change, just set the updated
  4200. // the props.
  4201. var propsToUpdate = instance.vnode.dynamicProps;
  4202. for (var i = 0; i < propsToUpdate.length; i++) {
  4203. var key = propsToUpdate[i];
  4204. // skip if the prop key is a declared emit event listener
  4205. if (isEmitListener(instance.emitsOptions, key)) {
  4206. continue;
  4207. }
  4208. // PROPS flag guarantees rawProps to be non-null
  4209. var value = rawProps[key];
  4210. if (options) {
  4211. // attr / props separation was done on init and will be consistent
  4212. // in this code path, so just check if attrs have it.
  4213. if (hasOwn(attrs, key)) {
  4214. if (value !== attrs[key]) {
  4215. attrs[key] = value;
  4216. hasAttrsChanged = true;
  4217. }
  4218. } else {
  4219. var camelizedKey = camelize(key);
  4220. props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false /* isAbsent */);
  4221. }
  4222. } else {
  4223. if (value !== attrs[key]) {
  4224. attrs[key] = value;
  4225. hasAttrsChanged = true;
  4226. }
  4227. }
  4228. }
  4229. }
  4230. } else {
  4231. // full props update.
  4232. if (setFullProps(instance, rawProps, props, attrs)) {
  4233. hasAttrsChanged = true;
  4234. }
  4235. // in case of dynamic props, check if we need to delete keys from
  4236. // the props object
  4237. var kebabKey;
  4238. for (var _key8 in rawCurrentProps) {
  4239. if (!rawProps ||
  4240. // for camelCase
  4241. !hasOwn(rawProps, _key8) && (
  4242. // it's possible the original props was passed in as kebab-case
  4243. // and converted to camelCase (#955)
  4244. (kebabKey = hyphenate(_key8)) === _key8 || !hasOwn(rawProps, kebabKey))) {
  4245. if (options) {
  4246. if (rawPrevProps && (
  4247. // for camelCase
  4248. rawPrevProps[_key8] !== undefined ||
  4249. // for kebab-case
  4250. rawPrevProps[kebabKey] !== undefined)) {
  4251. props[_key8] = resolvePropValue(options, rawCurrentProps, _key8, undefined, instance, true /* isAbsent */);
  4252. }
  4253. } else {
  4254. delete props[_key8];
  4255. }
  4256. }
  4257. }
  4258. // in the case of functional component w/o props declaration, props and
  4259. // attrs point to the same object so it should already have been updated.
  4260. if (attrs !== rawCurrentProps) {
  4261. for (var _key9 in attrs) {
  4262. if (!rawProps || !hasOwn(rawProps, _key9) && !false) {
  4263. delete attrs[_key9];
  4264. hasAttrsChanged = true;
  4265. }
  4266. }
  4267. }
  4268. }
  4269. // trigger updates for $attrs in case it's used in component slots
  4270. if (hasAttrsChanged) {
  4271. trigger(instance, "set" /* TriggerOpTypes.SET */, '$attrs');
  4272. }
  4273. }
  4274. function setFullProps(instance, rawProps, props, attrs) {
  4275. var [options, needCastKeys] = instance.propsOptions;
  4276. var hasAttrsChanged = false;
  4277. var rawCastValues;
  4278. if (rawProps) {
  4279. for (var key in rawProps) {
  4280. // key, ref are reserved and never passed down
  4281. if (isReservedProp(key)) {
  4282. continue;
  4283. }
  4284. var value = rawProps[key];
  4285. // prop option names are camelized during normalization, so to support
  4286. // kebab -> camel conversion here we need to camelize the key.
  4287. var camelKey = void 0;
  4288. if (options && hasOwn(options, camelKey = camelize(key))) {
  4289. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  4290. props[camelKey] = value;
  4291. } else {
  4292. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  4293. }
  4294. } else if (!isEmitListener(instance.emitsOptions, key)) {
  4295. if (!(key in attrs) || value !== attrs[key]) {
  4296. attrs[key] = value;
  4297. hasAttrsChanged = true;
  4298. }
  4299. }
  4300. }
  4301. }
  4302. if (needCastKeys) {
  4303. var rawCurrentProps = toRaw(props);
  4304. var castValues = rawCastValues || EMPTY_OBJ;
  4305. for (var i = 0; i < needCastKeys.length; i++) {
  4306. var _key10 = needCastKeys[i];
  4307. props[_key10] = resolvePropValue(options, rawCurrentProps, _key10, castValues[_key10], instance, !hasOwn(castValues, _key10));
  4308. }
  4309. }
  4310. return hasAttrsChanged;
  4311. }
  4312. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  4313. var opt = options[key];
  4314. if (opt != null) {
  4315. var hasDefault = hasOwn(opt, 'default');
  4316. // default values
  4317. if (hasDefault && value === undefined) {
  4318. var defaultValue = opt.default;
  4319. if (opt.type !== Function && isFunction(defaultValue)) {
  4320. var {
  4321. propsDefaults
  4322. } = instance;
  4323. if (key in propsDefaults) {
  4324. value = propsDefaults[key];
  4325. } else {
  4326. setCurrentInstance(instance);
  4327. value = propsDefaults[key] = defaultValue.call(null, props);
  4328. unsetCurrentInstance();
  4329. }
  4330. } else {
  4331. value = defaultValue;
  4332. }
  4333. }
  4334. // boolean casting
  4335. if (opt[0 /* BooleanFlags.shouldCast */]) {
  4336. if (isAbsent && !hasDefault) {
  4337. value = false;
  4338. } else if (opt[1 /* BooleanFlags.shouldCastTrue */] && (value === '' || value === hyphenate(key))) {
  4339. value = true;
  4340. }
  4341. }
  4342. }
  4343. return value;
  4344. }
  4345. function normalizePropsOptions(comp, appContext) {
  4346. var asMixin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  4347. var cache = appContext.propsCache;
  4348. var cached = cache.get(comp);
  4349. if (cached) {
  4350. return cached;
  4351. }
  4352. var raw = comp.props;
  4353. var normalized = {};
  4354. var needCastKeys = [];
  4355. // apply mixin/extends props
  4356. var hasExtends = false;
  4357. if (!isFunction(comp)) {
  4358. var extendProps = raw => {
  4359. hasExtends = true;
  4360. var [props, keys] = normalizePropsOptions(raw, appContext, true);
  4361. extend$1(normalized, props);
  4362. if (keys) needCastKeys.push(...keys);
  4363. };
  4364. if (!asMixin && appContext.mixins.length) {
  4365. appContext.mixins.forEach(extendProps);
  4366. }
  4367. if (comp.extends) {
  4368. extendProps(comp.extends);
  4369. }
  4370. if (comp.mixins) {
  4371. comp.mixins.forEach(extendProps);
  4372. }
  4373. }
  4374. if (!raw && !hasExtends) {
  4375. if (isObject(comp)) {
  4376. cache.set(comp, EMPTY_ARR);
  4377. }
  4378. return EMPTY_ARR;
  4379. }
  4380. if (isArray(raw)) {
  4381. for (var i = 0; i < raw.length; i++) {
  4382. var normalizedKey = camelize(raw[i]);
  4383. if (validatePropName(normalizedKey)) {
  4384. normalized[normalizedKey] = EMPTY_OBJ;
  4385. }
  4386. }
  4387. } else if (raw) {
  4388. for (var key in raw) {
  4389. var _normalizedKey = camelize(key);
  4390. if (validatePropName(_normalizedKey)) {
  4391. var opt = raw[key];
  4392. var prop = normalized[_normalizedKey] = isArray(opt) || isFunction(opt) ? {
  4393. type: opt
  4394. } : Object.assign({}, opt);
  4395. if (prop) {
  4396. var booleanIndex = getTypeIndex(Boolean, prop.type);
  4397. var stringIndex = getTypeIndex(String, prop.type);
  4398. prop[0 /* BooleanFlags.shouldCast */] = booleanIndex > -1;
  4399. prop[1 /* BooleanFlags.shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
  4400. // if the prop needs boolean casting or default value
  4401. if (booleanIndex > -1 || hasOwn(prop, 'default')) {
  4402. needCastKeys.push(_normalizedKey);
  4403. }
  4404. }
  4405. }
  4406. }
  4407. }
  4408. var res = [normalized, needCastKeys];
  4409. if (isObject(comp)) {
  4410. cache.set(comp, res);
  4411. }
  4412. return res;
  4413. }
  4414. function validatePropName(key) {
  4415. if (key[0] !== '$') {
  4416. return true;
  4417. }
  4418. return false;
  4419. }
  4420. // use function string name to check type constructors
  4421. // so that it works across vms / iframes.
  4422. function getType(ctor) {
  4423. var match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
  4424. return match ? match[2] : ctor === null ? 'null' : '';
  4425. }
  4426. function isSameType(a, b) {
  4427. return getType(a) === getType(b);
  4428. }
  4429. function getTypeIndex(type, expectedTypes) {
  4430. if (isArray(expectedTypes)) {
  4431. return expectedTypes.findIndex(t => isSameType(t, type));
  4432. } else if (isFunction(expectedTypes)) {
  4433. return isSameType(expectedTypes, type) ? 0 : -1;
  4434. }
  4435. return -1;
  4436. }
  4437. var isInternalKey = key => key[0] === '_' || key === '$stable';
  4438. var normalizeSlotValue = value => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  4439. var normalizeSlot = (key, rawSlot, ctx) => {
  4440. if (rawSlot._n) {
  4441. // already normalized - #5353
  4442. return rawSlot;
  4443. }
  4444. var normalized = withCtx(function () {
  4445. if ("production" !== 'production' && currentInstance) ;
  4446. return normalizeSlotValue(rawSlot(...arguments));
  4447. }, ctx);
  4448. normalized._c = false;
  4449. return normalized;
  4450. };
  4451. var normalizeObjectSlots = (rawSlots, slots, instance) => {
  4452. var ctx = rawSlots._ctx;
  4453. for (var key in rawSlots) {
  4454. if (isInternalKey(key)) continue;
  4455. var value = rawSlots[key];
  4456. if (isFunction(value)) {
  4457. slots[key] = normalizeSlot(key, value, ctx);
  4458. } else if (value != null) {
  4459. (function () {
  4460. var normalized = normalizeSlotValue(value);
  4461. slots[key] = () => normalized;
  4462. })();
  4463. }
  4464. }
  4465. };
  4466. var normalizeVNodeSlots = (instance, children) => {
  4467. var normalized = normalizeSlotValue(children);
  4468. instance.slots.default = () => normalized;
  4469. };
  4470. var initSlots = (instance, children) => {
  4471. if (instance.vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
  4472. var type = children._;
  4473. if (type) {
  4474. // users can get the shallow readonly version of the slots object through `this.$slots`,
  4475. // we should avoid the proxy object polluting the slots of the internal instance
  4476. instance.slots = toRaw(children);
  4477. // make compiler marker non-enumerable
  4478. def(children, '_', type);
  4479. } else {
  4480. normalizeObjectSlots(children, instance.slots = {});
  4481. }
  4482. } else {
  4483. instance.slots = {};
  4484. if (children) {
  4485. normalizeVNodeSlots(instance, children);
  4486. }
  4487. }
  4488. def(instance.slots, InternalObjectKey, 1);
  4489. };
  4490. var updateSlots = (instance, children, optimized) => {
  4491. var {
  4492. vnode,
  4493. slots
  4494. } = instance;
  4495. var needDeletionCheck = true;
  4496. var deletionComparisonTarget = EMPTY_OBJ;
  4497. if (vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
  4498. var type = children._;
  4499. if (type) {
  4500. // compiled slots.
  4501. if (optimized && type === 1 /* SlotFlags.STABLE */) {
  4502. // compiled AND stable.
  4503. // no need to update, and skip stale slots removal.
  4504. needDeletionCheck = false;
  4505. } else {
  4506. // compiled but dynamic (v-if/v-for on slots) - update slots, but skip
  4507. // normalization.
  4508. extend$1(slots, children);
  4509. // #2893
  4510. // when rendering the optimized slots by manually written render function,
  4511. // we need to delete the `slots._` flag if necessary to make subsequent updates reliable,
  4512. // i.e. let the `renderSlot` create the bailed Fragment
  4513. if (!optimized && type === 1 /* SlotFlags.STABLE */) {
  4514. delete slots._;
  4515. }
  4516. }
  4517. } else {
  4518. needDeletionCheck = !children.$stable;
  4519. normalizeObjectSlots(children, slots);
  4520. }
  4521. deletionComparisonTarget = children;
  4522. } else if (children) {
  4523. // non slot object children (direct value) passed to a component
  4524. normalizeVNodeSlots(instance, children);
  4525. deletionComparisonTarget = {
  4526. default: 1
  4527. };
  4528. }
  4529. // delete stale slots
  4530. if (needDeletionCheck) {
  4531. for (var key in slots) {
  4532. if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
  4533. delete slots[key];
  4534. }
  4535. }
  4536. }
  4537. };
  4538. function createAppContext() {
  4539. return {
  4540. app: null,
  4541. config: {
  4542. isNativeTag: NO,
  4543. performance: false,
  4544. globalProperties: {},
  4545. optionMergeStrategies: {},
  4546. errorHandler: undefined,
  4547. warnHandler: undefined,
  4548. compilerOptions: {}
  4549. },
  4550. mixins: [],
  4551. components: {},
  4552. directives: {},
  4553. provides: Object.create(null),
  4554. optionsCache: new WeakMap(),
  4555. propsCache: new WeakMap(),
  4556. emitsCache: new WeakMap()
  4557. };
  4558. }
  4559. var uid$1 = 0;
  4560. function createAppAPI(render, hydrate) {
  4561. return function createApp(rootComponent) {
  4562. var rootProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  4563. if (!isFunction(rootComponent)) {
  4564. rootComponent = Object.assign({}, rootComponent);
  4565. }
  4566. if (rootProps != null && !isObject(rootProps)) {
  4567. rootProps = null;
  4568. }
  4569. var context = createAppContext();
  4570. var installedPlugins = new Set();
  4571. var isMounted = false;
  4572. var app = context.app = {
  4573. _uid: uid$1++,
  4574. _component: rootComponent,
  4575. _props: rootProps,
  4576. _container: null,
  4577. _context: context,
  4578. _instance: null,
  4579. version,
  4580. get config() {
  4581. return context.config;
  4582. },
  4583. set config(v) {},
  4584. use(plugin) {
  4585. for (var _len5 = arguments.length, options = new Array(_len5 > 1 ? _len5 - 1 : 0), _key11 = 1; _key11 < _len5; _key11++) {
  4586. options[_key11 - 1] = arguments[_key11];
  4587. }
  4588. if (installedPlugins.has(plugin)) ;else if (plugin && isFunction(plugin.install)) {
  4589. installedPlugins.add(plugin);
  4590. plugin.install(app, ...options);
  4591. } else if (isFunction(plugin)) {
  4592. installedPlugins.add(plugin);
  4593. plugin(app, ...options);
  4594. } else ;
  4595. return app;
  4596. },
  4597. mixin(mixin) {
  4598. {
  4599. if (!context.mixins.includes(mixin)) {
  4600. context.mixins.push(mixin);
  4601. }
  4602. }
  4603. return app;
  4604. },
  4605. component(name, component) {
  4606. if (!component) {
  4607. return context.components[name];
  4608. }
  4609. context.components[name] = component;
  4610. return app;
  4611. },
  4612. directive(name, directive) {
  4613. if (!directive) {
  4614. return context.directives[name];
  4615. }
  4616. context.directives[name] = directive;
  4617. return app;
  4618. },
  4619. mount(rootContainer, isHydrate, isSVG) {
  4620. if (!isMounted) {
  4621. var vnode = createVNode(rootComponent, rootProps);
  4622. // store app context on the root VNode.
  4623. // this will be set on the root instance on initial mount.
  4624. vnode.appContext = context;
  4625. if (isHydrate && hydrate) {
  4626. hydrate(vnode, rootContainer);
  4627. } else {
  4628. render(vnode, rootContainer, isSVG);
  4629. }
  4630. isMounted = true;
  4631. app._container = rootContainer;
  4632. rootContainer.__vue_app__ = app;
  4633. // fixed by xxxxxx (始终暴露,因为 onError 要访问)
  4634. app._instance = vnode.component;
  4635. return getExposeProxy(vnode.component) || vnode.component.proxy;
  4636. }
  4637. },
  4638. unmount() {
  4639. if (isMounted) {
  4640. render(null, app._container);
  4641. delete app._container.__vue_app__;
  4642. }
  4643. },
  4644. provide(key, value) {
  4645. context.provides[key] = value;
  4646. return app;
  4647. }
  4648. };
  4649. return app;
  4650. };
  4651. }
  4652. /**
  4653. * Function for handling a template ref
  4654. */
  4655. function setRef(rawRef, oldRawRef, parentSuspense, vnode) {
  4656. var isUnmount = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  4657. if (isArray(rawRef)) {
  4658. rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
  4659. return;
  4660. }
  4661. if (isAsyncWrapper(vnode) && !isUnmount) {
  4662. // when mounting async components, nothing needs to be done,
  4663. // because the template ref is forwarded to inner component
  4664. return;
  4665. }
  4666. var refValue = vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */ && !vnode.component.type.rootElement // fixed by xxxxxx 非 x 项目或者非内置组件
  4667. ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
  4668. var value = isUnmount ? null : refValue;
  4669. var {
  4670. i: owner,
  4671. r: ref
  4672. } = rawRef;
  4673. var oldRef = oldRawRef && oldRawRef.r;
  4674. var refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  4675. var setupState = owner.setupState;
  4676. // dynamic ref changed. unset old ref
  4677. if (oldRef != null && oldRef !== ref) {
  4678. if (isString(oldRef)) {
  4679. refs[oldRef] = null;
  4680. if (hasOwn(setupState, oldRef)) {
  4681. setupState[oldRef] = null;
  4682. }
  4683. } else if (isRef(oldRef)) {
  4684. oldRef.value = null;
  4685. }
  4686. }
  4687. if (isFunction(ref)) {
  4688. callWithErrorHandling(ref, owner, 12 /* ErrorCodes.FUNCTION_REF */, [value, refs]);
  4689. } else {
  4690. var _isString = isString(ref);
  4691. var _isRef = isRef(ref);
  4692. if (_isString || _isRef) {
  4693. var doSet = () => {
  4694. if (rawRef.f) {
  4695. var existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
  4696. if (isUnmount) {
  4697. isArray(existing) && remove(existing, refValue);
  4698. } else {
  4699. if (!isArray(existing)) {
  4700. if (_isString) {
  4701. refs[ref] = [refValue];
  4702. if (hasOwn(setupState, ref)) {
  4703. setupState[ref] = refs[ref];
  4704. }
  4705. } else {
  4706. ref.value = [refValue];
  4707. if (rawRef.k) refs[rawRef.k] = ref.value;
  4708. }
  4709. } else if (!existing.includes(refValue)) {
  4710. existing.push(refValue);
  4711. }
  4712. }
  4713. } else if (_isString) {
  4714. refs[ref] = value;
  4715. if (hasOwn(setupState, ref)) {
  4716. setupState[ref] = value;
  4717. }
  4718. } else if (_isRef) {
  4719. ref.value = value;
  4720. if (rawRef.k) refs[rawRef.k] = value;
  4721. } else ;
  4722. };
  4723. if (value) {
  4724. doSet.id = -1;
  4725. queuePostRenderEffect(doSet, parentSuspense);
  4726. } else {
  4727. doSet();
  4728. }
  4729. }
  4730. }
  4731. }
  4732. var hasMismatch = false;
  4733. var isSVGContainer = container => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
  4734. var isComment = node => node.nodeType === 8 /* DOMNodeTypes.COMMENT */;
  4735. // Note: hydration is DOM-specific
  4736. // But we have to place it in core due to tight coupling with core - splitting
  4737. // it out creates a ton of unnecessary complexity.
  4738. // Hydration also depends on some renderer internal logic which needs to be
  4739. // passed in via arguments.
  4740. function createHydrationFunctions(rendererInternals) {
  4741. var {
  4742. mt: mountComponent,
  4743. p: patch,
  4744. o: {
  4745. patchProp,
  4746. createText,
  4747. nextSibling,
  4748. parentNode,
  4749. remove,
  4750. insert,
  4751. createComment
  4752. }
  4753. } = rendererInternals;
  4754. var hydrate = (vnode, container) => {
  4755. if (!container.hasChildNodes()) {
  4756. patch(null, vnode, container);
  4757. flushPostFlushCbs();
  4758. container._vnode = vnode;
  4759. return;
  4760. }
  4761. hasMismatch = false;
  4762. hydrateNode(container.firstChild, vnode, null, null, null);
  4763. flushPostFlushCbs();
  4764. container._vnode = vnode;
  4765. if (hasMismatch && !false) {
  4766. // this error should show up in production
  4767. console.error("Hydration completed but contains mismatches.");
  4768. }
  4769. };
  4770. var hydrateNode = function (node, vnode, parentComponent, parentSuspense, slotScopeIds) {
  4771. var optimized = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  4772. var isFragmentStart = isComment(node) && node.data === '[';
  4773. var onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
  4774. var {
  4775. type,
  4776. ref,
  4777. shapeFlag,
  4778. patchFlag
  4779. } = vnode;
  4780. var domType = node.nodeType;
  4781. vnode.el = node;
  4782. if (patchFlag === -2 /* PatchFlags.BAIL */) {
  4783. optimized = false;
  4784. vnode.dynamicChildren = null;
  4785. }
  4786. var nextNode = null;
  4787. switch (type) {
  4788. case Text:
  4789. if (domType !== 3 /* DOMNodeTypes.TEXT */) {
  4790. // #5728 empty text node inside a slot can cause hydration failure
  4791. // because the server rendered HTML won't contain a text node
  4792. if (vnode.children === '') {
  4793. // @ts-expect-error fixed by xxxxxx
  4794. insert(vnode.el = createText(''), parentNode(node), node);
  4795. nextNode = node;
  4796. } else {
  4797. nextNode = onMismatch();
  4798. }
  4799. } else {
  4800. if (node.data !== vnode.children) {
  4801. hasMismatch = true;
  4802. node.data = vnode.children;
  4803. }
  4804. nextNode = nextSibling(node);
  4805. }
  4806. break;
  4807. case Comment:
  4808. if (domType !== 8 /* DOMNodeTypes.COMMENT */ || isFragmentStart) {
  4809. nextNode = onMismatch();
  4810. } else {
  4811. nextNode = nextSibling(node);
  4812. }
  4813. break;
  4814. case Static:
  4815. if (isFragmentStart) {
  4816. // entire template is static but SSRed as a fragment
  4817. node = nextSibling(node);
  4818. domType = node.nodeType;
  4819. }
  4820. if (domType === 1 /* DOMNodeTypes.ELEMENT */ || domType === 3 /* DOMNodeTypes.TEXT */) {
  4821. // determine anchor, adopt content
  4822. nextNode = node;
  4823. // if the static vnode has its content stripped during build,
  4824. // adopt it from the server-rendered HTML.
  4825. var needToAdoptContent = !vnode.children.length;
  4826. for (var i = 0; i < vnode.staticCount; i++) {
  4827. if (needToAdoptContent) vnode.children += nextNode.nodeType === 1 /* DOMNodeTypes.ELEMENT */ ? nextNode.outerHTML : nextNode.data;
  4828. if (i === vnode.staticCount - 1) {
  4829. vnode.anchor = nextNode;
  4830. }
  4831. nextNode = nextSibling(nextNode);
  4832. }
  4833. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  4834. } else {
  4835. onMismatch();
  4836. }
  4837. break;
  4838. case Fragment:
  4839. if (!isFragmentStart) {
  4840. nextNode = onMismatch();
  4841. } else {
  4842. nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
  4843. }
  4844. break;
  4845. default:
  4846. if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
  4847. if (domType !== 1 /* DOMNodeTypes.ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
  4848. nextNode = onMismatch();
  4849. } else {
  4850. nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
  4851. }
  4852. } else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
  4853. // when setting up the render effect, if the initial vnode already
  4854. // has .el set, the component will perform hydration instead of mount
  4855. // on its sub-tree.
  4856. vnode.slotScopeIds = slotScopeIds;
  4857. var container = parentNode(node);
  4858. mountComponent(vnode, container, null, parentComponent, parentSuspense, isSVGContainer(container), optimized);
  4859. // component may be async, so in the case of fragments we cannot rely
  4860. // on component's rendered output to determine the end of the fragment
  4861. // instead, we do a lookahead to find the end anchor node.
  4862. nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
  4863. // #4293 teleport as component root
  4864. if (nextNode && isComment(nextNode) && nextNode.data === 'teleport end') {
  4865. nextNode = nextSibling(nextNode);
  4866. }
  4867. // #3787
  4868. // if component is async, it may get moved / unmounted before its
  4869. // inner component is loaded, so we need to give it a placeholder
  4870. // vnode that matches its adopted DOM.
  4871. if (isAsyncWrapper(vnode)) {
  4872. var subTree;
  4873. if (isFragmentStart) {
  4874. subTree = createVNode(Fragment);
  4875. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  4876. } else {
  4877. subTree = node.nodeType === 3 ? createTextVNode('') : createVNode('div');
  4878. }
  4879. subTree.el = node;
  4880. vnode.component.subTree = subTree;
  4881. }
  4882. } else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
  4883. if (domType !== 8 /* DOMNodeTypes.COMMENT */) {
  4884. nextNode = onMismatch();
  4885. } else {
  4886. nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
  4887. }
  4888. } else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
  4889. nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, isSVGContainer(parentNode(node)), slotScopeIds, optimized, rendererInternals, hydrateNode);
  4890. } else ;
  4891. }
  4892. if (ref != null) {
  4893. setRef(ref, null, parentSuspense, vnode);
  4894. }
  4895. return nextNode;
  4896. };
  4897. var hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4898. optimized = optimized || !!vnode.dynamicChildren;
  4899. var {
  4900. type,
  4901. props,
  4902. patchFlag,
  4903. shapeFlag,
  4904. dirs
  4905. } = vnode;
  4906. // #4006 for form elements with non-string v-model value bindings
  4907. // e.g. <option :value="obj">, <input type="checkbox" :true-value="1">
  4908. var forcePatchValue = type === 'input' && dirs || type === 'option';
  4909. // skip props & children if this is hoisted static nodes
  4910. // #5405 in dev, always hydrate children for HMR
  4911. if (forcePatchValue || patchFlag !== -1 /* PatchFlags.HOISTED */) {
  4912. if (dirs) {
  4913. invokeDirectiveHook(vnode, null, parentComponent, 'created');
  4914. }
  4915. // props
  4916. if (props) {
  4917. if (forcePatchValue || !optimized || patchFlag & (16 /* PatchFlags.FULL_PROPS */ | 32 /* PatchFlags.HYDRATE_EVENTS */)) {
  4918. for (var key in props) {
  4919. if (forcePatchValue && key.endsWith('value') || isOn(key) && !isReservedProp(key)) {
  4920. patchProp(el, key, null, props[key], false, undefined, parentComponent);
  4921. }
  4922. }
  4923. } else if (props.onClick) {
  4924. // Fast path for click listeners (which is most often) to avoid
  4925. // iterating through props.
  4926. patchProp(el, 'onClick', null, props.onClick, false, undefined, parentComponent);
  4927. }
  4928. }
  4929. // vnode / directive hooks
  4930. var vnodeHooks;
  4931. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  4932. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4933. }
  4934. if (dirs) {
  4935. invokeDirectiveHook(vnode, null, parentComponent, 'beforeMount');
  4936. }
  4937. if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
  4938. queueEffectWithSuspense(() => {
  4939. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4940. dirs && invokeDirectiveHook(vnode, null, parentComponent, 'mounted');
  4941. }, parentSuspense);
  4942. }
  4943. // children
  4944. if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */ &&
  4945. // skip if element has innerHTML / textContent
  4946. !(props && (props.innerHTML || props.textContent))) {
  4947. var next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
  4948. while (next) {
  4949. hasMismatch = true;
  4950. // The SSRed DOM contains more nodes than it should. Remove them.
  4951. var cur = next;
  4952. next = next.nextSibling;
  4953. remove(cur);
  4954. }
  4955. } else if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
  4956. if (el.textContent !== vnode.children) {
  4957. hasMismatch = true;
  4958. el.textContent = vnode.children;
  4959. }
  4960. }
  4961. }
  4962. return el.nextSibling;
  4963. };
  4964. var hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4965. optimized = optimized || !!parentVNode.dynamicChildren;
  4966. var children = parentVNode.children;
  4967. var l = children.length;
  4968. for (var i = 0; i < l; i++) {
  4969. var vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  4970. if (node) {
  4971. node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
  4972. } else if (vnode.type === Text && !vnode.children) {
  4973. continue;
  4974. } else {
  4975. hasMismatch = true;
  4976. // the SSRed DOM didn't contain enough nodes. Mount the missing ones.
  4977. patch(null, vnode, container, null, parentComponent, parentSuspense, isSVGContainer(container), slotScopeIds);
  4978. }
  4979. }
  4980. return node;
  4981. };
  4982. var hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4983. var {
  4984. slotScopeIds: fragmentSlotScopeIds
  4985. } = vnode;
  4986. if (fragmentSlotScopeIds) {
  4987. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  4988. }
  4989. var container = parentNode(node);
  4990. var next = hydrateChildren(nextSibling(node), vnode, container, parentComponent, parentSuspense, slotScopeIds, optimized);
  4991. if (next && isComment(next) && next.data === ']') {
  4992. return nextSibling(vnode.anchor = next);
  4993. } else {
  4994. // fragment didn't hydrate successfully, since we didn't get a end anchor
  4995. // back. This should have led to node/children mismatch warnings.
  4996. hasMismatch = true;
  4997. // since the anchor is missing, we need to create one and insert it
  4998. // @ts-expect-error fixed by xxxxxx
  4999. insert(vnode.anchor = createComment("]"), container, next);
  5000. return next;
  5001. }
  5002. };
  5003. var handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  5004. hasMismatch = true;
  5005. vnode.el = null;
  5006. if (isFragment) {
  5007. // remove excessive fragment nodes
  5008. var end = locateClosingAsyncAnchor(node);
  5009. while (true) {
  5010. var _next = nextSibling(node);
  5011. if (_next && _next !== end) {
  5012. remove(_next);
  5013. } else {
  5014. break;
  5015. }
  5016. }
  5017. }
  5018. var next = nextSibling(node);
  5019. var container = parentNode(node);
  5020. remove(node);
  5021. patch(null, vnode, container, next, parentComponent, parentSuspense, isSVGContainer(container), slotScopeIds);
  5022. return next;
  5023. };
  5024. var locateClosingAsyncAnchor = node => {
  5025. var match = 0;
  5026. while (node) {
  5027. node = nextSibling(node);
  5028. if (node && isComment(node)) {
  5029. if (node.data === '[') match++;
  5030. if (node.data === ']') {
  5031. if (match === 0) {
  5032. return nextSibling(node);
  5033. } else {
  5034. match--;
  5035. }
  5036. }
  5037. }
  5038. }
  5039. return node;
  5040. };
  5041. return [hydrate, hydrateNode];
  5042. }
  5043. var queuePostRenderEffect = queueEffectWithSuspense;
  5044. /**
  5045. * The createRenderer function accepts two generic arguments:
  5046. * HostNode and HostElement, corresponding to Node and Element types in the
  5047. * host environment. For example, for runtime-dom, HostNode would be the DOM
  5048. * `Node` interface and HostElement would be the DOM `Element` interface.
  5049. *
  5050. * Custom renderers can pass in the platform specific types like this:
  5051. *
  5052. * ``` js
  5053. * const { render, createApp } = createRenderer<Node, Element>({
  5054. * patchProp,
  5055. * ...nodeOps
  5056. * })
  5057. * ```
  5058. */
  5059. function createRenderer(options) {
  5060. return baseCreateRenderer(options);
  5061. }
  5062. // Separate API for creating hydration-enabled renderer.
  5063. // Hydration logic is only used when calling this function, making it
  5064. // tree-shakable.
  5065. function createHydrationRenderer(options) {
  5066. return baseCreateRenderer(options, createHydrationFunctions);
  5067. }
  5068. // implementation
  5069. function baseCreateRenderer(options, createHydrationFns) {
  5070. var target = getGlobalThis();
  5071. target.__VUE__ = true;
  5072. var {
  5073. insert: hostInsert,
  5074. remove: hostRemove,
  5075. patchProp: hostPatchProp,
  5076. forcePatchProp: hostForcePatchProp,
  5077. // fixed by xxxxxx
  5078. createElement: hostCreateElement,
  5079. createText: hostCreateText,
  5080. createComment: hostCreateComment,
  5081. setText: hostSetText,
  5082. setElementText: hostSetElementText,
  5083. parentNode: hostParentNode,
  5084. nextSibling: hostNextSibling,
  5085. setScopeId: hostSetScopeId = NOOP,
  5086. insertStaticContent: hostInsertStaticContent
  5087. } = options;
  5088. // Note: functions inside this closure should use `const xxx = () => {}`
  5089. // style in order to prevent being inlined by minifiers.
  5090. var patch = function (n1, n2, container) {
  5091. var anchor = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  5092. var parentComponent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  5093. var parentSuspense = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
  5094. var isSVG = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
  5095. var slotScopeIds = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  5096. var optimized = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : !!n2.dynamicChildren;
  5097. if (n1 === n2) {
  5098. return;
  5099. }
  5100. // patching & not same type, unmount old tree
  5101. if (n1 && !isSameVNodeType(n1, n2)) {
  5102. anchor = getNextHostNode(n1);
  5103. unmount(n1, parentComponent, parentSuspense, true);
  5104. n1 = null;
  5105. }
  5106. if (n2.patchFlag === -2 /* PatchFlags.BAIL */) {
  5107. optimized = false;
  5108. n2.dynamicChildren = null;
  5109. }
  5110. var {
  5111. type,
  5112. ref,
  5113. shapeFlag
  5114. } = n2;
  5115. switch (type) {
  5116. case Text:
  5117. processText(n1, n2, container, anchor);
  5118. break;
  5119. case Comment:
  5120. processCommentNode(n1, n2, container, anchor);
  5121. break;
  5122. case Static:
  5123. if (n1 == null) {
  5124. mountStaticNode(n2, container, anchor, isSVG);
  5125. }
  5126. break;
  5127. case Fragment:
  5128. processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  5129. break;
  5130. default:
  5131. if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
  5132. processElement(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  5133. } else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
  5134. processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  5135. } else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
  5136. type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
  5137. } else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
  5138. type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
  5139. } else ;
  5140. }
  5141. // set ref
  5142. if (ref != null && parentComponent) {
  5143. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  5144. }
  5145. };
  5146. var processText = (n1, n2, container, anchor) => {
  5147. if (n1 == null) {
  5148. hostInsert(n2.el = hostCreateText(n2.children, container),
  5149. // fixed by xxxxxx
  5150. container, anchor);
  5151. } else {
  5152. var el = n2.el = n1.el;
  5153. if (n2.children !== n1.children) {
  5154. hostSetText(el, n2.children);
  5155. }
  5156. }
  5157. };
  5158. var processCommentNode = (n1, n2, container, anchor) => {
  5159. if (n1 == null) {
  5160. hostInsert(n2.el = hostCreateComment(n2.children || '', container),
  5161. // fixed by xxxxxx
  5162. container, anchor);
  5163. } else {
  5164. // there's no support for dynamic comments
  5165. n2.el = n1.el;
  5166. }
  5167. };
  5168. var mountStaticNode = (n2, container, anchor, isSVG) => {
  5169. [n2.el, n2.anchor] = hostInsertStaticContent(n2.children, container, anchor, isSVG, n2.el, n2.anchor);
  5170. };
  5171. var moveStaticNode = (_ref12, container, nextSibling) => {
  5172. var {
  5173. el,
  5174. anchor
  5175. } = _ref12;
  5176. var next;
  5177. while (el && el !== anchor) {
  5178. next = hostNextSibling(el);
  5179. hostInsert(el, container, nextSibling);
  5180. el = next;
  5181. }
  5182. hostInsert(anchor, container, nextSibling);
  5183. };
  5184. var removeStaticNode = _ref13 => {
  5185. var {
  5186. el,
  5187. anchor
  5188. } = _ref13;
  5189. var next;
  5190. while (el && el !== anchor) {
  5191. next = hostNextSibling(el);
  5192. hostRemove(el);
  5193. el = next;
  5194. }
  5195. hostRemove(anchor);
  5196. };
  5197. var processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  5198. isSVG = isSVG || n2.type === 'svg';
  5199. if (n1 == null) {
  5200. mountElement(n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  5201. } else {
  5202. patchElement(n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  5203. }
  5204. };
  5205. var mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  5206. var el;
  5207. var vnodeHook;
  5208. var {
  5209. type,
  5210. props,
  5211. shapeFlag,
  5212. transition,
  5213. dirs
  5214. } = vnode;
  5215. el = vnode.el = hostCreateElement(vnode.type,
  5216. // fixed by xxxxxx
  5217. container);
  5218. // mount children first, since some props may rely on child content
  5219. // being already rendered, e.g. `<select value>`
  5220. if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
  5221. hostSetElementText(el, vnode.children);
  5222. } else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  5223. mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
  5224. }
  5225. if (dirs) {
  5226. invokeDirectiveHook(vnode, null, parentComponent, 'created');
  5227. }
  5228. // scopeId
  5229. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  5230. // props
  5231. if (props) {
  5232. for (var key in props) {
  5233. if (key !== 'value' && !isReservedProp(key)) {
  5234. hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren,
  5235. // fixed by xxxxxx
  5236. vnode.hostInstance);
  5237. }
  5238. }
  5239. /**
  5240. * Special case for setting value on DOM elements:
  5241. * - it can be order-sensitive (e.g. should be set *after* min/max, #2325, #4024)
  5242. * - it needs to be forced (#1471)
  5243. * #2353 proposes adding another renderer option to configure this, but
  5244. * the properties affects are so finite it is worth special casing it
  5245. * here to reduce the complexity. (Special casing it also should not
  5246. * affect non-DOM renderers)
  5247. */
  5248. if ('value' in props) {
  5249. // fixed by xxxxxx
  5250. hostPatchProp(el, 'value', null, props.value, false, [], parentComponent, null, undefined,
  5251. // fixed by xxxxxx
  5252. vnode.hostInstance);
  5253. }
  5254. if (vnodeHook = props.onVnodeBeforeMount) {
  5255. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  5256. }
  5257. }
  5258. if (dirs) {
  5259. invokeDirectiveHook(vnode, null, parentComponent, 'beforeMount');
  5260. }
  5261. // #1583 For inside suspense + suspense not resolved case, enter hook should call when suspense resolved
  5262. // #1689 For inside suspense + suspense resolved case, just call it
  5263. var needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  5264. if (needCallTransitionHooks) {
  5265. transition.beforeEnter(el);
  5266. }
  5267. hostInsert(el, container, anchor);
  5268. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  5269. queuePostRenderEffect(() => {
  5270. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  5271. needCallTransitionHooks && transition.enter(el);
  5272. dirs && invokeDirectiveHook(vnode, null, parentComponent, 'mounted');
  5273. }, parentSuspense);
  5274. }
  5275. };
  5276. var setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  5277. if (scopeId) {
  5278. hostSetScopeId(el, scopeId);
  5279. }
  5280. if (slotScopeIds) {
  5281. for (var i = 0; i < slotScopeIds.length; i++) {
  5282. hostSetScopeId(el, slotScopeIds[i]);
  5283. }
  5284. }
  5285. if (parentComponent) {
  5286. var subTree = parentComponent.subTree;
  5287. if (vnode === subTree) {
  5288. var parentVNode = parentComponent.vnode;
  5289. setScopeId(el, parentVNode, parentVNode.scopeId, parentVNode.slotScopeIds, parentComponent.parent);
  5290. }
  5291. }
  5292. };
  5293. var mountChildren = function (children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) {
  5294. var start = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 0;
  5295. for (var i = start; i < children.length; i++) {
  5296. var child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  5297. patch(null, child, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  5298. }
  5299. };
  5300. var patchElement = (n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  5301. var el = n2.el = n1.el;
  5302. var {
  5303. patchFlag,
  5304. dynamicChildren,
  5305. dirs
  5306. } = n2;
  5307. // #1426 take the old vnode's patch flag into account since user may clone a
  5308. // compiler-generated vnode, which de-opts to FULL_PROPS
  5309. patchFlag |= n1.patchFlag & 16 /* PatchFlags.FULL_PROPS */;
  5310. var oldProps = n1.props || EMPTY_OBJ;
  5311. var newProps = n2.props || EMPTY_OBJ;
  5312. var vnodeHook;
  5313. // disable recurse in beforeUpdate hooks
  5314. parentComponent && toggleRecurse(parentComponent, false);
  5315. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  5316. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  5317. }
  5318. if (dirs) {
  5319. invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
  5320. }
  5321. parentComponent && toggleRecurse(parentComponent, true);
  5322. var areChildrenSVG = isSVG && n2.type !== 'foreignObject';
  5323. if (dynamicChildren) {
  5324. patchBlockChildren(n1.dynamicChildren, dynamicChildren, el, parentComponent, parentSuspense, areChildrenSVG, slotScopeIds);
  5325. } else if (!optimized) {
  5326. // full diff
  5327. patchChildren(n1, n2, el, null, parentComponent, parentSuspense, areChildrenSVG, slotScopeIds, false);
  5328. }
  5329. if (patchFlag > 0) {
  5330. // the presence of a patchFlag means this element's render code was
  5331. // generated by the compiler and can take the fast path.
  5332. // in this path old node and new node are guaranteed to have the same shape
  5333. // (i.e. at the exact same position in the source template)
  5334. if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
  5335. // element props contain dynamic keys, full diff needed
  5336. patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
  5337. } else {
  5338. // class
  5339. // this flag is matched when the element has dynamic class bindings.
  5340. if (patchFlag & 2 /* PatchFlags.CLASS */) {
  5341. if (oldProps.class !== newProps.class) {
  5342. // fixed by xxxxxx
  5343. hostPatchProp(el, 'class', null, newProps.class, isSVG, [], parentComponent, null, undefined,
  5344. // fixed by xxxxxx
  5345. n2.hostInstance);
  5346. }
  5347. }
  5348. // style
  5349. // this flag is matched when the element has dynamic style bindings
  5350. if (patchFlag & 4 /* PatchFlags.STYLE */) {
  5351. // fixed by xxxxxx
  5352. hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG, [], parentComponent, null, undefined,
  5353. // fixed by xxxxxx
  5354. n2.hostInstance);
  5355. }
  5356. // props
  5357. // This flag is matched when the element has dynamic prop/attr bindings
  5358. // other than class and style. The keys of dynamic prop/attrs are saved for
  5359. // faster iteration.
  5360. // Note dynamic keys like :[foo]="bar" will cause this optimization to
  5361. // bail out and go through a full diff because we need to unset the old key
  5362. if (patchFlag & 8 /* PatchFlags.PROPS */) {
  5363. // if the flag is present then dynamicProps must be non-null
  5364. var propsToUpdate = n2.dynamicProps;
  5365. for (var i = 0; i < propsToUpdate.length; i++) {
  5366. var key = propsToUpdate[i];
  5367. var prev = oldProps[key];
  5368. var next = newProps[key];
  5369. // #1471 force patch value
  5370. if (next !== prev || key === 'value' || hostForcePatchProp && hostForcePatchProp(el, key) // fixed by xxxxxx
  5371. ) {
  5372. hostPatchProp(el, key, prev, next, isSVG, n1.children, parentComponent, parentSuspense, unmountChildren,
  5373. // fixed by xxxxxx
  5374. n2.hostInstance);
  5375. }
  5376. }
  5377. }
  5378. }
  5379. // text
  5380. // This flag is matched when the element has only dynamic text children.
  5381. if (patchFlag & 1 /* PatchFlags.TEXT */) {
  5382. if (n1.children !== n2.children) {
  5383. hostSetElementText(el, n2.children);
  5384. }
  5385. }
  5386. } else if (!optimized && dynamicChildren == null) {
  5387. // unoptimized, full diff
  5388. patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
  5389. }
  5390. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  5391. queuePostRenderEffect(() => {
  5392. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  5393. dirs && invokeDirectiveHook(n2, n1, parentComponent, 'updated');
  5394. }, parentSuspense);
  5395. }
  5396. };
  5397. // The fast path for blocks.
  5398. var patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG, slotScopeIds) => {
  5399. for (var i = 0; i < newChildren.length; i++) {
  5400. var oldVNode = oldChildren[i];
  5401. var newVNode = newChildren[i];
  5402. // Determine the container (parent element) for the patch.
  5403. var container =
  5404. // oldVNode may be an errored async setup() component inside Suspense
  5405. // which will not have a mounted element
  5406. oldVNode.el && (
  5407. // - In the case of a Fragment, we need to provide the actual parent
  5408. // of the Fragment itself so it can move its children.
  5409. oldVNode.type === Fragment ||
  5410. // - In the case of different nodes, there is going to be a replacement
  5411. // which also requires the correct parent container
  5412. !isSameVNodeType(oldVNode, newVNode) ||
  5413. // - In the case of a component, it could contain anything.
  5414. oldVNode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 64 /* ShapeFlags.TELEPORT */)) ? hostParentNode(oldVNode.el) :
  5415. // In other cases, the parent container is not actually used so we
  5416. // just pass the block element here to avoid a DOM parentNode call.
  5417. fallbackContainer;
  5418. patch(oldVNode, newVNode, container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, true);
  5419. }
  5420. };
  5421. var patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
  5422. if (oldProps !== newProps) {
  5423. if (oldProps !== EMPTY_OBJ) {
  5424. for (var key in oldProps) {
  5425. if (!isReservedProp(key) && !(key in newProps)) {
  5426. hostPatchProp(el, key, oldProps[key], null, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren,
  5427. // fixed by xxxxxx
  5428. vnode.hostInstance);
  5429. }
  5430. }
  5431. }
  5432. for (var _key12 in newProps) {
  5433. // empty string is not valid prop
  5434. if (isReservedProp(_key12)) continue;
  5435. var next = newProps[_key12];
  5436. var prev = oldProps[_key12];
  5437. // defer patching value
  5438. if (next !== prev && _key12 !== 'value' || hostForcePatchProp && hostForcePatchProp(el, _key12) // fixed by xxxxxx
  5439. ) {
  5440. hostPatchProp(el, _key12, prev, next, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren,
  5441. // fixed by xxxxxx
  5442. vnode.hostInstance);
  5443. }
  5444. }
  5445. if ('value' in newProps) {
  5446. // fixed by xxxxxx
  5447. hostPatchProp(el, 'value', oldProps.value, newProps.value, false, [], parentComponent, null, undefined,
  5448. // fixed by xxxxxx
  5449. vnode.hostInstance);
  5450. }
  5451. }
  5452. };
  5453. var processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  5454. var fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateComment('', container); // fixed by xxxxxx
  5455. var fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateComment('', container); // fixed by xxxxxx
  5456. var {
  5457. patchFlag,
  5458. dynamicChildren,
  5459. slotScopeIds: fragmentSlotScopeIds
  5460. } = n2;
  5461. // check if this is a slot fragment with :slotted scope ids
  5462. if (fragmentSlotScopeIds) {
  5463. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  5464. }
  5465. if (n1 == null) {
  5466. hostInsert(fragmentStartAnchor, container, anchor);
  5467. hostInsert(fragmentEndAnchor, container, anchor);
  5468. // a fragment can only have array children
  5469. // since they are either generated by the compiler, or implicitly created
  5470. // from arrays.
  5471. mountChildren(n2.children, container, fragmentEndAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  5472. } else {
  5473. if (patchFlag > 0 && patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */ && dynamicChildren &&
  5474. // #2715 the previous fragment could've been a BAILed one as a result
  5475. // of renderSlot() with no valid children
  5476. n1.dynamicChildren) {
  5477. // a stable fragment (template root or <template v-for>) doesn't need to
  5478. // patch children order, but it may contain dynamicChildren.
  5479. patchBlockChildren(n1.dynamicChildren, dynamicChildren, container, parentComponent, parentSuspense, isSVG, slotScopeIds);
  5480. if (
  5481. // #2080 if the stable fragment has a key, it's a <template v-for> that may
  5482. // get moved around. Make sure all root level vnodes inherit el.
  5483. // #2134 or if it's a component root, it may also get moved around
  5484. // as the component is being moved.
  5485. n2.key != null || parentComponent && n2 === parentComponent.subTree) {
  5486. traverseStaticChildren(n1, n2, true /* shallow */);
  5487. }
  5488. } else {
  5489. // keyed / unkeyed, or manual fragments.
  5490. // for keyed & unkeyed, since they are compiler generated from v-for,
  5491. // each child is guaranteed to be a block so the fragment will never
  5492. // have dynamicChildren.
  5493. patchChildren(n1, n2, container, fragmentEndAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  5494. }
  5495. }
  5496. };
  5497. var processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  5498. n2.slotScopeIds = slotScopeIds;
  5499. if (n1 == null) {
  5500. if (n2.shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
  5501. parentComponent.ctx.activate(n2, container, anchor, isSVG, optimized);
  5502. } else {
  5503. mountComponent(n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized);
  5504. }
  5505. } else {
  5506. updateComponent(n1, n2, optimized);
  5507. }
  5508. };
  5509. var mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
  5510. var instance = initialVNode.component = createComponentInstance(initialVNode, parentComponent, parentSuspense);
  5511. // inject renderer internals for keepAlive
  5512. if (isKeepAlive(initialVNode)) {
  5513. instance.ctx.renderer = internals;
  5514. }
  5515. // resolve props and slots for setup context
  5516. {
  5517. setupComponent(instance);
  5518. }
  5519. // setup() is async. This component relies on async logic to be resolved
  5520. // before proceeding
  5521. if (instance.asyncDep) {
  5522. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
  5523. // Give it a placeholder if this is not hydration
  5524. // TODO handle self-defined fallback
  5525. if (!initialVNode.el) {
  5526. var placeholder = instance.subTree = createVNode(Comment);
  5527. processCommentNode(null, placeholder, container, anchor);
  5528. }
  5529. return;
  5530. }
  5531. setupRenderEffect(instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized);
  5532. };
  5533. var updateComponent = (n1, n2, optimized) => {
  5534. var instance = n2.component = n1.component;
  5535. if (shouldUpdateComponent(n1, n2, optimized)) {
  5536. if (instance.asyncDep && !instance.asyncResolved) {
  5537. updateComponentPreRender(instance, n2, optimized);
  5538. return;
  5539. } else {
  5540. // normal update
  5541. instance.next = n2;
  5542. // in case the child component is also queued, remove it to avoid
  5543. // double updating the same child component in the same flush.
  5544. invalidateJob(instance.update);
  5545. // instance.update is the reactive effect.
  5546. instance.update();
  5547. }
  5548. } else {
  5549. // no update needed. just copy over properties
  5550. n2.el = n1.el;
  5551. instance.vnode = n2;
  5552. }
  5553. };
  5554. var setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized) => {
  5555. var componentUpdateFn = () => {
  5556. if (!instance.isMounted) {
  5557. var vnodeHook;
  5558. var {
  5559. el,
  5560. props
  5561. } = initialVNode;
  5562. var {
  5563. bm,
  5564. m,
  5565. parent
  5566. } = instance;
  5567. var isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  5568. toggleRecurse(instance, false);
  5569. // beforeMount hook
  5570. if (bm) {
  5571. invokeArrayFns(bm);
  5572. }
  5573. // onVnodeBeforeMount
  5574. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  5575. invokeVNodeHook(vnodeHook, parent, initialVNode);
  5576. }
  5577. toggleRecurse(instance, true);
  5578. if (el && hydrateNode) {
  5579. // vnode has adopted host node - perform hydration instead of mount.
  5580. var hydrateSubTree = () => {
  5581. instance.subTree = renderComponentRoot(instance);
  5582. hydrateNode(el, instance.subTree, instance, parentSuspense, null);
  5583. };
  5584. if (isAsyncWrapperVNode) {
  5585. initialVNode.type.__asyncLoader().then(
  5586. // note: we are moving the render call into an async callback,
  5587. // which means it won't track dependencies - but it's ok because
  5588. // a server-rendered async wrapper is already in resolved state
  5589. // and it will never need to change.
  5590. () => !instance.isUnmounted && hydrateSubTree());
  5591. } else {
  5592. hydrateSubTree();
  5593. }
  5594. } else {
  5595. var subTree = instance.subTree = renderComponentRoot(instance);
  5596. patch(null, subTree, container, anchor, instance, parentSuspense, isSVG);
  5597. initialVNode.el = subTree.el;
  5598. }
  5599. // mounted hook
  5600. if (m) {
  5601. queuePostRenderEffect(m, parentSuspense);
  5602. }
  5603. // onVnodeMounted
  5604. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  5605. var scopedInitialVNode = initialVNode;
  5606. queuePostRenderEffect(() => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode), parentSuspense);
  5607. }
  5608. // activated hook for keep-alive roots.
  5609. // #1742 activated hook must be accessed after first render
  5610. // since the hook may be injected by a child keep-alive
  5611. if (initialVNode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */ || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
  5612. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  5613. }
  5614. instance.isMounted = true;
  5615. // #2458: deference mount-only object parameters to prevent memleaks
  5616. initialVNode = container = anchor = null;
  5617. } else {
  5618. // updateComponent
  5619. // This is triggered by mutation of component's own state (next: null)
  5620. // OR parent calling processComponent (next: VNode)
  5621. var {
  5622. next,
  5623. bu,
  5624. u,
  5625. parent: _parent,
  5626. vnode
  5627. } = instance;
  5628. var originNext = next;
  5629. var _vnodeHook;
  5630. // Disallow component effect recursion during pre-lifecycle hooks.
  5631. toggleRecurse(instance, false);
  5632. if (next) {
  5633. next.el = vnode.el;
  5634. updateComponentPreRender(instance, next, optimized);
  5635. } else {
  5636. next = vnode;
  5637. }
  5638. // beforeUpdate hook
  5639. if (bu) {
  5640. invokeArrayFns(bu);
  5641. }
  5642. // onVnodeBeforeUpdate
  5643. if (_vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  5644. invokeVNodeHook(_vnodeHook, _parent, next, vnode);
  5645. }
  5646. toggleRecurse(instance, true);
  5647. var nextTree = renderComponentRoot(instance);
  5648. var prevTree = instance.subTree;
  5649. instance.subTree = nextTree;
  5650. patch(prevTree, nextTree,
  5651. // parent may have changed if it's in a teleport
  5652. hostParentNode(prevTree.el),
  5653. // anchor may have changed if it's in a fragment
  5654. getNextHostNode(prevTree), instance, parentSuspense, isSVG);
  5655. next.el = nextTree.el;
  5656. if (originNext === null) {
  5657. // self-triggered update. In case of HOC, update parent component
  5658. // vnode el. HOC is indicated by parent instance's subTree pointing
  5659. // to child component's vnode
  5660. updateHOCHostEl(instance, nextTree.el);
  5661. }
  5662. // updated hook
  5663. if (u) {
  5664. queuePostRenderEffect(u, parentSuspense);
  5665. }
  5666. // onVnodeUpdated
  5667. if (_vnodeHook = next.props && next.props.onVnodeUpdated) {
  5668. queuePostRenderEffect(() => invokeVNodeHook(_vnodeHook, _parent, next, vnode), parentSuspense);
  5669. }
  5670. }
  5671. };
  5672. // create reactive effect for rendering
  5673. var effect = instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(update), instance.scope // track it in component's effect scope
  5674. );
  5675. var update = instance.update = () => effect.run();
  5676. update.id = instance.uid;
  5677. // allowRecurse
  5678. // #1801, #2043 component render effects should allow recursive updates
  5679. toggleRecurse(instance, true);
  5680. update();
  5681. };
  5682. var updateComponentPreRender = (instance, nextVNode, optimized) => {
  5683. nextVNode.component = instance;
  5684. var prevProps = instance.vnode.props;
  5685. instance.vnode = nextVNode;
  5686. instance.next = null;
  5687. updateProps(instance, nextVNode.props, prevProps, optimized);
  5688. updateSlots(instance, nextVNode.children, optimized);
  5689. pauseTracking();
  5690. // props update may have triggered pre-flush watchers.
  5691. // flush them before the render update.
  5692. flushPreFlushCbs();
  5693. resetTracking();
  5694. };
  5695. var patchChildren = function (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds) {
  5696. var optimized = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
  5697. var c1 = n1 && n1.children;
  5698. var prevShapeFlag = n1 ? n1.shapeFlag : 0;
  5699. var c2 = n2.children;
  5700. var {
  5701. patchFlag,
  5702. shapeFlag
  5703. } = n2;
  5704. // fast path
  5705. if (patchFlag > 0) {
  5706. if (patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */) {
  5707. // this could be either fully-keyed or mixed (some keyed some not)
  5708. // presence of patchFlag means children are guaranteed to be arrays
  5709. patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  5710. return;
  5711. } else if (patchFlag & 256 /* PatchFlags.UNKEYED_FRAGMENT */) {
  5712. // unkeyed
  5713. patchUnkeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  5714. return;
  5715. }
  5716. }
  5717. // children has 3 possibilities: text, array or no children.
  5718. if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
  5719. // text children fast path
  5720. if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  5721. unmountChildren(c1, parentComponent, parentSuspense);
  5722. }
  5723. if (c2 !== c1) {
  5724. hostSetElementText(container, c2);
  5725. }
  5726. } else {
  5727. if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  5728. // prev children was array
  5729. if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  5730. // two arrays, cannot assume anything, do full diff
  5731. patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  5732. } else {
  5733. // no new children, just unmount old
  5734. unmountChildren(c1, parentComponent, parentSuspense, true);
  5735. }
  5736. } else {
  5737. // prev children was text OR null
  5738. // new children is array OR null
  5739. if (prevShapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
  5740. hostSetElementText(container, '');
  5741. }
  5742. // mount new if array
  5743. if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  5744. mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  5745. }
  5746. }
  5747. }
  5748. };
  5749. var patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  5750. c1 = c1 || EMPTY_ARR;
  5751. c2 = c2 || EMPTY_ARR;
  5752. var oldLength = c1.length;
  5753. var newLength = c2.length;
  5754. var commonLength = Math.min(oldLength, newLength);
  5755. var i;
  5756. for (i = 0; i < commonLength; i++) {
  5757. var nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  5758. patch(c1[i], nextChild, container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  5759. }
  5760. if (oldLength > newLength) {
  5761. // remove old
  5762. unmountChildren(c1, parentComponent, parentSuspense, true, false, commonLength);
  5763. } else {
  5764. // mount new
  5765. mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, commonLength);
  5766. }
  5767. };
  5768. // can be all-keyed or mixed
  5769. var patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  5770. var i = 0;
  5771. var l2 = c2.length;
  5772. var e1 = c1.length - 1; // prev ending index
  5773. var e2 = l2 - 1; // next ending index
  5774. // 1. sync from start
  5775. // (a b) c
  5776. // (a b) d e
  5777. while (i <= e1 && i <= e2) {
  5778. var n1 = c1[i];
  5779. var n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  5780. if (isSameVNodeType(n1, n2)) {
  5781. patch(n1, n2, container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  5782. } else {
  5783. break;
  5784. }
  5785. i++;
  5786. }
  5787. // 2. sync from end
  5788. // a (b c)
  5789. // d e (b c)
  5790. while (i <= e1 && i <= e2) {
  5791. var _n = c1[e1];
  5792. var _n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  5793. if (isSameVNodeType(_n, _n2)) {
  5794. patch(_n, _n2, container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  5795. } else {
  5796. break;
  5797. }
  5798. e1--;
  5799. e2--;
  5800. }
  5801. // 3. common sequence + mount
  5802. // (a b)
  5803. // (a b) c
  5804. // i = 2, e1 = 1, e2 = 2
  5805. // (a b)
  5806. // c (a b)
  5807. // i = 0, e1 = -1, e2 = 0
  5808. if (i > e1) {
  5809. if (i <= e2) {
  5810. var nextPos = e2 + 1;
  5811. var anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  5812. while (i <= e2) {
  5813. patch(null, c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]), container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  5814. i++;
  5815. }
  5816. }
  5817. }
  5818. // 4. common sequence + unmount
  5819. // (a b) c
  5820. // (a b)
  5821. // i = 2, e1 = 2, e2 = 1
  5822. // a (b c)
  5823. // (b c)
  5824. // i = 0, e1 = 0, e2 = -1
  5825. else if (i > e2) {
  5826. while (i <= e1) {
  5827. unmount(c1[i], parentComponent, parentSuspense, true);
  5828. i++;
  5829. }
  5830. }
  5831. // 5. unknown sequence
  5832. // [i ... e1 + 1]: a b [c d e] f g
  5833. // [i ... e2 + 1]: a b [e d c h] f g
  5834. // i = 2, e1 = 4, e2 = 5
  5835. else {
  5836. var s1 = i; // prev starting index
  5837. var s2 = i; // next starting index
  5838. // 5.1 build key:index map for newChildren
  5839. var keyToNewIndexMap = new Map();
  5840. for (i = s2; i <= e2; i++) {
  5841. var nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  5842. if (nextChild.key != null) {
  5843. keyToNewIndexMap.set(nextChild.key, i);
  5844. }
  5845. }
  5846. // 5.2 loop through old children left to be patched and try to patch
  5847. // matching nodes & remove nodes that are no longer present
  5848. var j;
  5849. var patched = 0;
  5850. var toBePatched = e2 - s2 + 1;
  5851. var moved = false;
  5852. // used to track whether any node has moved
  5853. var maxNewIndexSoFar = 0;
  5854. // works as Map<newIndex, oldIndex>
  5855. // Note that oldIndex is offset by +1
  5856. // and oldIndex = 0 is a special value indicating the new node has
  5857. // no corresponding old node.
  5858. // used for determining longest stable subsequence
  5859. var newIndexToOldIndexMap = new Array(toBePatched);
  5860. for (i = 0; i < toBePatched; i++) {
  5861. newIndexToOldIndexMap[i] = 0;
  5862. }
  5863. for (i = s1; i <= e1; i++) {
  5864. var prevChild = c1[i];
  5865. if (patched >= toBePatched) {
  5866. // all new children have been patched so this can only be a removal
  5867. unmount(prevChild, parentComponent, parentSuspense, true);
  5868. continue;
  5869. }
  5870. var newIndex = void 0;
  5871. if (prevChild.key != null) {
  5872. newIndex = keyToNewIndexMap.get(prevChild.key);
  5873. } else {
  5874. // key-less node, try to locate a key-less node of the same type
  5875. for (j = s2; j <= e2; j++) {
  5876. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  5877. newIndex = j;
  5878. break;
  5879. }
  5880. }
  5881. }
  5882. if (newIndex === undefined) {
  5883. unmount(prevChild, parentComponent, parentSuspense, true);
  5884. } else {
  5885. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  5886. if (newIndex >= maxNewIndexSoFar) {
  5887. maxNewIndexSoFar = newIndex;
  5888. } else {
  5889. moved = true;
  5890. }
  5891. patch(prevChild, c2[newIndex], container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  5892. patched++;
  5893. }
  5894. }
  5895. // 5.3 move and mount
  5896. // generate longest stable subsequence only when nodes have moved
  5897. var increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  5898. j = increasingNewIndexSequence.length - 1;
  5899. // looping backwards so that we can use last patched node as anchor
  5900. for (i = toBePatched - 1; i >= 0; i--) {
  5901. var nextIndex = s2 + i;
  5902. var _nextChild = c2[nextIndex];
  5903. var _anchor2 = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
  5904. if (newIndexToOldIndexMap[i] === 0) {
  5905. // mount new
  5906. patch(null, _nextChild, container, _anchor2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  5907. } else if (moved) {
  5908. // move if:
  5909. // There is no stable subsequence (e.g. a reverse)
  5910. // OR current node is not among the stable sequence
  5911. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  5912. move(_nextChild, container, _anchor2, 2 /* MoveType.REORDER */);
  5913. } else {
  5914. j--;
  5915. }
  5916. }
  5917. }
  5918. }
  5919. };
  5920. var move = function (vnode, container, anchor, moveType) {
  5921. var parentSuspense = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  5922. var {
  5923. el,
  5924. type,
  5925. transition,
  5926. children,
  5927. shapeFlag
  5928. } = vnode;
  5929. if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
  5930. move(vnode.component.subTree, container, anchor, moveType);
  5931. return;
  5932. }
  5933. if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
  5934. vnode.suspense.move(container, anchor, moveType);
  5935. return;
  5936. }
  5937. if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
  5938. type.move(vnode, container, anchor, internals);
  5939. return;
  5940. }
  5941. if (type === Fragment) {
  5942. hostInsert(el, container, anchor);
  5943. for (var i = 0; i < children.length; i++) {
  5944. move(children[i], container, anchor, moveType);
  5945. }
  5946. hostInsert(vnode.anchor, container, anchor);
  5947. return;
  5948. }
  5949. if (type === Static) {
  5950. moveStaticNode(vnode, container, anchor);
  5951. return;
  5952. }
  5953. // single nodes
  5954. var needTransition = moveType !== 2 /* MoveType.REORDER */ && shapeFlag & 1 /* ShapeFlags.ELEMENT */ && transition;
  5955. if (needTransition) {
  5956. if (moveType === 0 /* MoveType.ENTER */) {
  5957. transition.beforeEnter(el);
  5958. hostInsert(el, container, anchor);
  5959. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  5960. } else {
  5961. var {
  5962. leave,
  5963. delayLeave,
  5964. afterLeave
  5965. } = transition;
  5966. var _remove = () => hostInsert(el, container, anchor);
  5967. var performLeave = () => {
  5968. leave(el, () => {
  5969. _remove();
  5970. afterLeave && afterLeave();
  5971. });
  5972. };
  5973. if (delayLeave) {
  5974. delayLeave(el, _remove, performLeave);
  5975. } else {
  5976. performLeave();
  5977. }
  5978. }
  5979. } else {
  5980. hostInsert(el, container, anchor);
  5981. }
  5982. };
  5983. var unmount = function (vnode, parentComponent, parentSuspense) {
  5984. var doRemove = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  5985. var optimized = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  5986. var {
  5987. type,
  5988. props,
  5989. ref,
  5990. children,
  5991. dynamicChildren,
  5992. shapeFlag,
  5993. patchFlag,
  5994. dirs
  5995. } = vnode;
  5996. // unset ref
  5997. if (ref != null) {
  5998. setRef(ref, null, parentSuspense, vnode, true);
  5999. }
  6000. if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
  6001. parentComponent.ctx.deactivate(vnode);
  6002. return;
  6003. }
  6004. var shouldInvokeDirs = shapeFlag & 1 /* ShapeFlags.ELEMENT */ && dirs;
  6005. var shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  6006. var vnodeHook;
  6007. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  6008. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6009. }
  6010. if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
  6011. unmountComponent(vnode.component, parentSuspense, doRemove);
  6012. } else {
  6013. if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
  6014. vnode.suspense.unmount(parentSuspense, doRemove);
  6015. return;
  6016. }
  6017. if (shouldInvokeDirs) {
  6018. invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount');
  6019. }
  6020. if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
  6021. vnode.type.remove(vnode, parentComponent, parentSuspense, optimized, internals, doRemove);
  6022. } else if (dynamicChildren && (
  6023. // #1153: fast path should not be taken for non-stable (v-for) fragments
  6024. type !== Fragment || patchFlag > 0 && patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */)) {
  6025. // fast path for block nodes: only need to unmount dynamic children.
  6026. unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
  6027. } else if (type === Fragment && patchFlag & (128 /* PatchFlags.KEYED_FRAGMENT */ | 256 /* PatchFlags.UNKEYED_FRAGMENT */) || !optimized && shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  6028. unmountChildren(children, parentComponent, parentSuspense);
  6029. }
  6030. if (doRemove) {
  6031. remove(vnode);
  6032. }
  6033. }
  6034. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  6035. queuePostRenderEffect(() => {
  6036. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6037. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, 'unmounted');
  6038. }, parentSuspense);
  6039. }
  6040. };
  6041. var remove = vnode => {
  6042. var {
  6043. type,
  6044. el,
  6045. anchor,
  6046. transition
  6047. } = vnode;
  6048. if (type === Fragment) {
  6049. {
  6050. removeFragment(el, anchor);
  6051. }
  6052. return;
  6053. }
  6054. if (type === Static) {
  6055. removeStaticNode(vnode);
  6056. return;
  6057. }
  6058. var performRemove = () => {
  6059. hostRemove(el);
  6060. if (transition && !transition.persisted && transition.afterLeave) {
  6061. transition.afterLeave();
  6062. }
  6063. };
  6064. if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && transition && !transition.persisted) {
  6065. var {
  6066. leave,
  6067. delayLeave
  6068. } = transition;
  6069. var performLeave = () => leave(el, performRemove);
  6070. if (delayLeave) {
  6071. delayLeave(vnode.el, performRemove, performLeave);
  6072. } else {
  6073. performLeave();
  6074. }
  6075. } else {
  6076. performRemove();
  6077. }
  6078. };
  6079. var removeFragment = (cur, end) => {
  6080. // For fragments, directly remove all contained DOM nodes.
  6081. // (fragment child nodes cannot have transition)
  6082. var next;
  6083. while (cur !== end) {
  6084. next = hostNextSibling(cur);
  6085. hostRemove(cur);
  6086. cur = next;
  6087. }
  6088. hostRemove(end);
  6089. };
  6090. var unmountComponent = (instance, parentSuspense, doRemove) => {
  6091. var {
  6092. bum,
  6093. scope,
  6094. update,
  6095. subTree,
  6096. um
  6097. } = instance;
  6098. // beforeUnmount hook
  6099. if (bum) {
  6100. invokeArrayFns(bum);
  6101. }
  6102. // stop effects in component scope
  6103. scope.stop();
  6104. // update may be null if a component is unmounted before its async
  6105. // setup has resolved.
  6106. if (update) {
  6107. // so that scheduler will no longer invoke it
  6108. update.active = false;
  6109. unmount(subTree, instance, parentSuspense, doRemove);
  6110. }
  6111. // unmounted hook
  6112. if (um) {
  6113. queuePostRenderEffect(um, parentSuspense);
  6114. }
  6115. queuePostRenderEffect(() => {
  6116. instance.isUnmounted = true;
  6117. }, parentSuspense);
  6118. // A component with async dep inside a pending suspense is unmounted before
  6119. // its async dep resolves. This should remove the dep from the suspense, and
  6120. // cause the suspense to resolve immediately if that was the last dep.
  6121. if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
  6122. parentSuspense.deps--;
  6123. if (parentSuspense.deps === 0) {
  6124. parentSuspense.resolve();
  6125. }
  6126. }
  6127. };
  6128. var unmountChildren = function (children, parentComponent, parentSuspense) {
  6129. var doRemove = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  6130. var optimized = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  6131. var start = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  6132. for (var i = start; i < children.length; i++) {
  6133. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  6134. }
  6135. };
  6136. var getNextHostNode = vnode => {
  6137. if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
  6138. return getNextHostNode(vnode.component.subTree);
  6139. }
  6140. if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
  6141. return vnode.suspense.next();
  6142. }
  6143. return hostNextSibling(vnode.anchor || vnode.el);
  6144. };
  6145. var render = (vnode, container, isSVG) => {
  6146. if (vnode == null) {
  6147. if (container._vnode) {
  6148. unmount(container._vnode, null, null, true);
  6149. }
  6150. } else {
  6151. patch(container._vnode || null, vnode, container, null, null, null, isSVG);
  6152. }
  6153. flushPreFlushCbs();
  6154. flushPostFlushCbs();
  6155. container._vnode = vnode;
  6156. };
  6157. var internals = {
  6158. p: patch,
  6159. um: unmount,
  6160. m: move,
  6161. r: remove,
  6162. mt: mountComponent,
  6163. mc: mountChildren,
  6164. pc: patchChildren,
  6165. pbc: patchBlockChildren,
  6166. n: getNextHostNode,
  6167. o: options
  6168. };
  6169. var hydrate;
  6170. var hydrateNode;
  6171. if (createHydrationFns) {
  6172. [hydrate, hydrateNode] = createHydrationFns(internals);
  6173. }
  6174. return {
  6175. render,
  6176. hydrate,
  6177. createApp: createAppAPI(render, hydrate)
  6178. };
  6179. }
  6180. function toggleRecurse(_ref14, allowed) {
  6181. var {
  6182. effect,
  6183. update
  6184. } = _ref14;
  6185. effect.allowRecurse = update.allowRecurse = allowed;
  6186. }
  6187. /**
  6188. * #1156
  6189. * When a component is HMR-enabled, we need to make sure that all static nodes
  6190. * inside a block also inherit the DOM element from the previous tree so that
  6191. * HMR updates (which are full updates) can retrieve the element for patching.
  6192. *
  6193. * #2080
  6194. * Inside keyed `template` fragment static children, if a fragment is moved,
  6195. * the children will always be moved. Therefore, in order to ensure correct move
  6196. * position, el should be inherited from previous nodes.
  6197. */
  6198. function traverseStaticChildren(n1, n2) {
  6199. var shallow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  6200. var ch1 = n1.children;
  6201. var ch2 = n2.children;
  6202. if (isArray(ch1) && isArray(ch2)) {
  6203. for (var i = 0; i < ch1.length; i++) {
  6204. // this is only called in the optimized path so array children are
  6205. // guaranteed to be vnodes
  6206. var c1 = ch1[i];
  6207. var c2 = ch2[i];
  6208. if (c2.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && !c2.dynamicChildren) {
  6209. if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* PatchFlags.HYDRATE_EVENTS */) {
  6210. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  6211. c2.el = c1.el;
  6212. }
  6213. if (!shallow) traverseStaticChildren(c1, c2);
  6214. }
  6215. // #6852 also inherit for text nodes
  6216. if (c2.type === Text) {
  6217. c2.el = c1.el;
  6218. }
  6219. }
  6220. }
  6221. }
  6222. // https://en.wikipedia.org/wiki/Longest_increasing_subsequence
  6223. function getSequence(arr) {
  6224. var p = arr.slice();
  6225. var result = [0];
  6226. var i, j, u, v, c;
  6227. var len = arr.length;
  6228. for (i = 0; i < len; i++) {
  6229. var arrI = arr[i];
  6230. if (arrI !== 0) {
  6231. j = result[result.length - 1];
  6232. if (arr[j] < arrI) {
  6233. p[i] = j;
  6234. result.push(i);
  6235. continue;
  6236. }
  6237. u = 0;
  6238. v = result.length - 1;
  6239. while (u < v) {
  6240. c = u + v >> 1;
  6241. if (arr[result[c]] < arrI) {
  6242. u = c + 1;
  6243. } else {
  6244. v = c;
  6245. }
  6246. }
  6247. if (arrI < arr[result[u]]) {
  6248. if (u > 0) {
  6249. p[i] = result[u - 1];
  6250. }
  6251. result[u] = i;
  6252. }
  6253. }
  6254. }
  6255. u = result.length;
  6256. v = result[u - 1];
  6257. while (u-- > 0) {
  6258. result[u] = v;
  6259. v = p[v];
  6260. }
  6261. return result;
  6262. }
  6263. var isTeleport = type => type.__isTeleport;
  6264. var isTeleportDisabled = props => props && (props.disabled || props.disabled === '');
  6265. var isTargetSVG = target => typeof SVGElement !== 'undefined' && target instanceof SVGElement;
  6266. var resolveTarget = (props, select) => {
  6267. var targetSelector = props && props.to;
  6268. if (isString(targetSelector)) {
  6269. if (!select) {
  6270. return null;
  6271. } else {
  6272. var target = select(targetSelector);
  6273. return target;
  6274. }
  6275. } else {
  6276. return targetSelector;
  6277. }
  6278. };
  6279. var TeleportImpl = {
  6280. __isTeleport: true,
  6281. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
  6282. var {
  6283. mc: mountChildren,
  6284. pc: patchChildren,
  6285. pbc: patchBlockChildren,
  6286. o: {
  6287. insert,
  6288. querySelector,
  6289. createText,
  6290. createComment
  6291. }
  6292. } = internals;
  6293. var disabled = isTeleportDisabled(n2.props);
  6294. var {
  6295. shapeFlag,
  6296. children,
  6297. dynamicChildren
  6298. } = n2;
  6299. if (n1 == null) {
  6300. // insert anchors in the main view
  6301. var placeholder = n2.el =
  6302. // @ts-expect-error fixed by xxxxxx
  6303. createText('');
  6304. var mainAnchor = n2.anchor =
  6305. // @ts-expect-error fixed by xxxxxx
  6306. createText('');
  6307. insert(placeholder, container, anchor);
  6308. insert(mainAnchor, container, anchor);
  6309. var target = n2.target = resolveTarget(n2.props, querySelector);
  6310. // @ts-expect-error fixed by xxxxxx
  6311. var targetAnchor = n2.targetAnchor = createText('');
  6312. if (target) {
  6313. insert(targetAnchor, target);
  6314. // #2652 we could be teleporting from a non-SVG tree into an SVG tree
  6315. isSVG = isSVG || isTargetSVG(target);
  6316. }
  6317. var mount = (container, anchor) => {
  6318. // Teleport *always* has Array children. This is enforced in both the
  6319. // compiler and vnode children normalization.
  6320. if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  6321. mountChildren(children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
  6322. }
  6323. };
  6324. if (disabled) {
  6325. mount(container, mainAnchor);
  6326. } else if (target) {
  6327. mount(target, targetAnchor);
  6328. }
  6329. } else {
  6330. // update content
  6331. n2.el = n1.el;
  6332. var _mainAnchor = n2.anchor = n1.anchor;
  6333. var _target = n2.target = n1.target;
  6334. var _targetAnchor = n2.targetAnchor = n1.targetAnchor;
  6335. var wasDisabled = isTeleportDisabled(n1.props);
  6336. var currentContainer = wasDisabled ? container : _target;
  6337. var currentAnchor = wasDisabled ? _mainAnchor : _targetAnchor;
  6338. isSVG = isSVG || isTargetSVG(_target);
  6339. if (dynamicChildren) {
  6340. // fast path when the teleport happens to be a block root
  6341. patchBlockChildren(n1.dynamicChildren, dynamicChildren, currentContainer, parentComponent, parentSuspense, isSVG, slotScopeIds);
  6342. // even in block tree mode we need to make sure all root-level nodes
  6343. // in the teleport inherit previous DOM references so that they can
  6344. // be moved in future patches.
  6345. traverseStaticChildren(n1, n2, true);
  6346. } else if (!optimized) {
  6347. patchChildren(n1, n2, currentContainer, currentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, false);
  6348. }
  6349. if (disabled) {
  6350. if (!wasDisabled) {
  6351. // enabled -> disabled
  6352. // move into main container
  6353. moveTeleport(n2, container, _mainAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
  6354. }
  6355. } else {
  6356. // target changed
  6357. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  6358. var nextTarget = n2.target = resolveTarget(n2.props, querySelector);
  6359. if (nextTarget) {
  6360. moveTeleport(n2, nextTarget, null, internals, 0 /* TeleportMoveTypes.TARGET_CHANGE */);
  6361. }
  6362. } else if (wasDisabled) {
  6363. // disabled -> enabled
  6364. // move into teleport target
  6365. moveTeleport(n2, _target, _targetAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
  6366. }
  6367. }
  6368. }
  6369. updateCssVars(n2);
  6370. },
  6371. remove(vnode, parentComponent, parentSuspense, optimized, _ref15, doRemove) {
  6372. var {
  6373. um: unmount,
  6374. o: {
  6375. remove: hostRemove
  6376. }
  6377. } = _ref15;
  6378. var {
  6379. shapeFlag,
  6380. children,
  6381. anchor,
  6382. targetAnchor,
  6383. target,
  6384. props
  6385. } = vnode;
  6386. if (target) {
  6387. hostRemove(targetAnchor);
  6388. }
  6389. // an unmounted teleport should always remove its children if not disabled
  6390. if (doRemove || !isTeleportDisabled(props)) {
  6391. hostRemove(anchor);
  6392. if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  6393. for (var i = 0; i < children.length; i++) {
  6394. var child = children[i];
  6395. unmount(child, parentComponent, parentSuspense, true, !!child.dynamicChildren);
  6396. }
  6397. }
  6398. }
  6399. },
  6400. move: moveTeleport,
  6401. hydrate: hydrateTeleport
  6402. };
  6403. function moveTeleport(vnode, container, parentAnchor, _ref16) {
  6404. var {
  6405. o: {
  6406. insert
  6407. },
  6408. m: move
  6409. } = _ref16;
  6410. var moveType = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  6411. // move target anchor if this is a target change.
  6412. if (moveType === 0 /* TeleportMoveTypes.TARGET_CHANGE */) {
  6413. insert(vnode.targetAnchor, container, parentAnchor);
  6414. }
  6415. var {
  6416. el,
  6417. anchor,
  6418. shapeFlag,
  6419. children,
  6420. props
  6421. } = vnode;
  6422. var isReorder = moveType === 2 /* TeleportMoveTypes.REORDER */;
  6423. // move main view anchor if this is a re-order.
  6424. if (isReorder) {
  6425. insert(el, container, parentAnchor);
  6426. }
  6427. // if this is a re-order and teleport is enabled (content is in target)
  6428. // do not move children. So the opposite is: only move children if this
  6429. // is not a reorder, or the teleport is disabled
  6430. if (!isReorder || isTeleportDisabled(props)) {
  6431. // Teleport has either Array children or no children.
  6432. if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  6433. for (var i = 0; i < children.length; i++) {
  6434. move(children[i], container, parentAnchor, 2 /* MoveType.REORDER */);
  6435. }
  6436. }
  6437. }
  6438. // move main view anchor if this is a re-order.
  6439. if (isReorder) {
  6440. insert(anchor, container, parentAnchor);
  6441. }
  6442. }
  6443. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, _ref17, hydrateChildren) {
  6444. var {
  6445. o: {
  6446. nextSibling,
  6447. parentNode,
  6448. querySelector
  6449. }
  6450. } = _ref17;
  6451. var target = vnode.target = resolveTarget(vnode.props, querySelector);
  6452. if (target) {
  6453. // if multiple teleports rendered to the same target element, we need to
  6454. // pick up from where the last teleport finished instead of the first node
  6455. var targetNode = target._lpa || target.firstChild;
  6456. if (vnode.shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
  6457. if (isTeleportDisabled(vnode.props)) {
  6458. vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, slotScopeIds, optimized);
  6459. vnode.targetAnchor = targetNode;
  6460. } else {
  6461. vnode.anchor = nextSibling(node);
  6462. // lookahead until we find the target anchor
  6463. // we cannot rely on return value of hydrateChildren() because there
  6464. // could be nested teleports
  6465. var targetAnchor = targetNode;
  6466. while (targetAnchor) {
  6467. targetAnchor = nextSibling(targetAnchor);
  6468. if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === 'teleport anchor') {
  6469. vnode.targetAnchor = targetAnchor;
  6470. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  6471. break;
  6472. }
  6473. }
  6474. hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
  6475. }
  6476. }
  6477. updateCssVars(vnode);
  6478. }
  6479. return vnode.anchor && nextSibling(vnode.anchor);
  6480. }
  6481. // Force-casted public typing for h and TSX props inference
  6482. var Teleport = TeleportImpl;
  6483. function updateCssVars(vnode) {
  6484. // presence of .ut method indicates owner component uses css vars.
  6485. // code path here can assume browser environment.
  6486. var ctx = vnode.ctx;
  6487. if (ctx && ctx.ut) {
  6488. var node = vnode.children[0].el;
  6489. while (node !== vnode.targetAnchor) {
  6490. if (node.nodeType === 1) node.setAttribute('data-v-owner', ctx.uid);
  6491. node = node.nextSibling;
  6492. }
  6493. ctx.ut();
  6494. }
  6495. }
  6496. var Fragment = Symbol(undefined);
  6497. var Text = Symbol(undefined);
  6498. var Comment = Symbol(undefined);
  6499. var Static = Symbol(undefined);
  6500. // Since v-if and v-for are the two possible ways node structure can dynamically
  6501. // change, once we consider v-if branches and each v-for fragment a block, we
  6502. // can divide a template into nested blocks, and within each block the node
  6503. // structure would be stable. This allows us to skip most children diffing
  6504. // and only worry about the dynamic nodes (indicated by patch flags).
  6505. var blockStack = [];
  6506. var currentBlock = null;
  6507. /**
  6508. * Open a block.
  6509. * This must be called before `createBlock`. It cannot be part of `createBlock`
  6510. * because the children of the block are evaluated before `createBlock` itself
  6511. * is called. The generated code typically looks like this:
  6512. *
  6513. * ```js
  6514. * function render() {
  6515. * return (openBlock(),createBlock('div', null, [...]))
  6516. * }
  6517. * ```
  6518. * disableTracking is true when creating a v-for fragment block, since a v-for
  6519. * fragment always diffs its children.
  6520. *
  6521. * @private
  6522. */
  6523. function openBlock() {
  6524. var disableTracking = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  6525. blockStack.push(currentBlock = disableTracking ? null : []);
  6526. }
  6527. function closeBlock() {
  6528. blockStack.pop();
  6529. currentBlock = blockStack[blockStack.length - 1] || null;
  6530. }
  6531. // Whether we should be tracking dynamic child nodes inside a block.
  6532. // Only tracks when this value is > 0
  6533. // We are not using a simple boolean because this value may need to be
  6534. // incremented/decremented by nested usage of v-once (see below)
  6535. var isBlockTreeEnabled = 1;
  6536. /**
  6537. * Block tracking sometimes needs to be disabled, for example during the
  6538. * creation of a tree that needs to be cached by v-once. The compiler generates
  6539. * code like this:
  6540. *
  6541. * ``` js
  6542. * _cache[1] || (
  6543. * setBlockTracking(-1),
  6544. * _cache[1] = createVNode(...),
  6545. * setBlockTracking(1),
  6546. * _cache[1]
  6547. * )
  6548. * ```
  6549. *
  6550. * @private
  6551. */
  6552. function setBlockTracking(value) {
  6553. isBlockTreeEnabled += value;
  6554. }
  6555. function setupBlock(vnode) {
  6556. // save current block children on the block vnode
  6557. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  6558. // close block
  6559. closeBlock();
  6560. // a block is always going to be patched, so track it as a child of its
  6561. // parent block
  6562. if (isBlockTreeEnabled > 0 && currentBlock) {
  6563. currentBlock.push(vnode);
  6564. }
  6565. return vnode;
  6566. }
  6567. /**
  6568. * @private
  6569. */
  6570. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  6571. return setupBlock(createBaseVNode(type, props, children, patchFlag, dynamicProps, shapeFlag, true /* isBlock */));
  6572. }
  6573. /**
  6574. * Create a block root vnode. Takes the same exact arguments as `createVNode`.
  6575. * A block root keeps track of dynamic nodes within the block in the
  6576. * `dynamicChildren` array.
  6577. *
  6578. * @private
  6579. */
  6580. function createBlock(type, props, children, patchFlag, dynamicProps) {
  6581. return setupBlock(createVNode(type, props, children, patchFlag, dynamicProps, true /* isBlock: prevent a block from tracking itself */));
  6582. }
  6583. function isVNode(value) {
  6584. return value ? value.__v_isVNode === true : false;
  6585. }
  6586. function isSameVNodeType(n1, n2) {
  6587. return n1.type === n2.type && n1.key === n2.key;
  6588. }
  6589. /**
  6590. * Internal API for registering an arguments transform for createVNode
  6591. * used for creating stubs in the test-utils
  6592. * It is *internal* but needs to be exposed for test-utils to pick up proper
  6593. * typings
  6594. */
  6595. function transformVNodeArgs(transformer) {}
  6596. var InternalObjectKey = "__vInternal";
  6597. var normalizeKey = _ref18 => {
  6598. var {
  6599. key
  6600. } = _ref18;
  6601. return key != null ? key : null;
  6602. };
  6603. var normalizeRef = _ref19 => {
  6604. var {
  6605. ref,
  6606. ref_key,
  6607. ref_for
  6608. } = _ref19;
  6609. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? {
  6610. i: currentRenderingInstance,
  6611. r: ref,
  6612. k: ref_key,
  6613. f: !!ref_for
  6614. } : ref : null;
  6615. };
  6616. function createBaseVNode(type) {
  6617. var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  6618. var children = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  6619. var patchFlag = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  6620. var dynamicProps = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  6621. var shapeFlag = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : type === Fragment ? 0 : 1;
  6622. var isBlockNode = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
  6623. var needFullChildrenNormalization = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
  6624. var vnode = {
  6625. __v_isVNode: true,
  6626. __v_skip: true,
  6627. type,
  6628. props,
  6629. key: props && normalizeKey(props),
  6630. ref: props && normalizeRef(props),
  6631. scopeId: currentScopeId,
  6632. slotScopeIds: null,
  6633. children,
  6634. component: null,
  6635. suspense: null,
  6636. ssContent: null,
  6637. ssFallback: null,
  6638. dirs: null,
  6639. transition: null,
  6640. el: null,
  6641. anchor: null,
  6642. target: null,
  6643. targetAnchor: null,
  6644. staticCount: 0,
  6645. shapeFlag,
  6646. patchFlag,
  6647. dynamicProps,
  6648. dynamicChildren: null,
  6649. appContext: null,
  6650. // fixed by xxxxxx
  6651. hostInstance: currentRenderingInstance,
  6652. ctx: currentRenderingInstance
  6653. };
  6654. if (needFullChildrenNormalization) {
  6655. normalizeChildren(vnode, children);
  6656. // normalize suspense children
  6657. if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
  6658. type.normalize(vnode);
  6659. }
  6660. } else if (children) {
  6661. // compiled element vnode - if children is passed, only possible types are
  6662. // string or Array.
  6663. vnode.shapeFlag |= isString(children) ? 8 /* ShapeFlags.TEXT_CHILDREN */ : 16 /* ShapeFlags.ARRAY_CHILDREN */;
  6664. }
  6665. // track vnode for block tree
  6666. if (isBlockTreeEnabled > 0 &&
  6667. // avoid a block node from tracking itself
  6668. !isBlockNode &&
  6669. // has current parent block
  6670. currentBlock && (
  6671. // presence of a patch flag indicates this node needs patching on updates.
  6672. // component nodes also should always be patched, because even if the
  6673. // component doesn't need to update, it needs to persist the instance on to
  6674. // the next vnode so that it can be properly unmounted later.
  6675. vnode.patchFlag > 0 || shapeFlag & 6 /* ShapeFlags.COMPONENT */) &&
  6676. // the EVENTS flag is only for hydration and if it is the only flag, the
  6677. // vnode should not be considered dynamic due to handler caching.
  6678. vnode.patchFlag !== 32 /* PatchFlags.HYDRATE_EVENTS */) {
  6679. currentBlock.push(vnode);
  6680. }
  6681. return vnode;
  6682. }
  6683. var createVNode = _createVNode;
  6684. function _createVNode(type) {
  6685. var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  6686. var children = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  6687. var patchFlag = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  6688. var dynamicProps = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  6689. var isBlockNode = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  6690. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  6691. type = Comment;
  6692. }
  6693. if (isVNode(type)) {
  6694. // createVNode receiving an existing vnode. This happens in cases like
  6695. // <component :is="vnode"/>
  6696. // #2078 make sure to merge refs during the clone instead of overwriting it
  6697. var cloned = cloneVNode(type, props, true /* mergeRef: true */);
  6698. if (children) {
  6699. normalizeChildren(cloned, children);
  6700. }
  6701. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  6702. if (cloned.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
  6703. currentBlock[currentBlock.indexOf(type)] = cloned;
  6704. } else {
  6705. currentBlock.push(cloned);
  6706. }
  6707. }
  6708. cloned.patchFlag |= -2 /* PatchFlags.BAIL */;
  6709. return cloned;
  6710. }
  6711. // class component normalization.
  6712. if (isClassComponent(type)) {
  6713. type = type.__vccOpts;
  6714. }
  6715. // class & style normalization.
  6716. if (props) {
  6717. // for reactive or proxy objects, we need to clone it to enable mutation.
  6718. props = guardReactiveProps(props);
  6719. var {
  6720. class: klass,
  6721. style
  6722. } = props;
  6723. if (klass && !isString(klass)) {
  6724. props.class = normalizeClass(klass);
  6725. }
  6726. if (isObject(style)) {
  6727. // reactive state objects need to be cloned since they are likely to be
  6728. // mutated
  6729. if (isProxy(style) && !isArray(style)) {
  6730. style = extend$1({}, style);
  6731. }
  6732. props.style = normalizeStyle(style);
  6733. }
  6734. }
  6735. // encode the vnode type information into a bitmap
  6736. var shapeFlag = isString(type) ? 1 /* ShapeFlags.ELEMENT */ : isSuspense(type) ? 128 /* ShapeFlags.SUSPENSE */ : isTeleport(type) ? 64 /* ShapeFlags.TELEPORT */ : isObject(type) ? 4 /* ShapeFlags.STATEFUL_COMPONENT */ : isFunction(type) ? 2 /* ShapeFlags.FUNCTIONAL_COMPONENT */ : 0;
  6737. return createBaseVNode(type, props, children, patchFlag, dynamicProps, shapeFlag, isBlockNode, true);
  6738. }
  6739. function guardReactiveProps(props) {
  6740. if (!props) return null;
  6741. return isProxy(props) || InternalObjectKey in props ? extend$1({}, props) : props;
  6742. }
  6743. function cloneVNode(vnode, extraProps) {
  6744. var mergeRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  6745. // This is intentionally NOT using spread or extend to avoid the runtime
  6746. // key enumeration cost.
  6747. var {
  6748. props,
  6749. ref,
  6750. patchFlag,
  6751. children
  6752. } = vnode;
  6753. var mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  6754. var cloned = {
  6755. __v_isVNode: true,
  6756. __v_skip: true,
  6757. type: vnode.type,
  6758. props: mergedProps,
  6759. key: mergedProps && normalizeKey(mergedProps),
  6760. ref: extraProps && extraProps.ref ?
  6761. // #2078 in the case of <component :is="vnode" ref="extra"/>
  6762. // if the vnode itself already has a ref, cloneVNode will need to merge
  6763. // the refs so the single vnode can be set on multiple refs
  6764. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps) : ref,
  6765. scopeId: vnode.scopeId,
  6766. slotScopeIds: vnode.slotScopeIds,
  6767. children: children,
  6768. target: vnode.target,
  6769. targetAnchor: vnode.targetAnchor,
  6770. staticCount: vnode.staticCount,
  6771. shapeFlag: vnode.shapeFlag,
  6772. // if the vnode is cloned with extra props, we can no longer assume its
  6773. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  6774. // note: preserve flag for fragments since they use the flag for children
  6775. // fast paths only.
  6776. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 // hoisted node
  6777. ? 16 /* PatchFlags.FULL_PROPS */ : patchFlag | 16 /* PatchFlags.FULL_PROPS */ : patchFlag,
  6778. dynamicProps: vnode.dynamicProps,
  6779. dynamicChildren: vnode.dynamicChildren,
  6780. appContext: vnode.appContext,
  6781. // fixed by xxxxxx
  6782. hostInstance: vnode.hostInstance,
  6783. dirs: vnode.dirs,
  6784. transition: vnode.transition,
  6785. // These should technically only be non-null on mounted VNodes. However,
  6786. // they *should* be copied for kept-alive vnodes. So we just always copy
  6787. // them since them being non-null during a mount doesn't affect the logic as
  6788. // they will simply be overwritten.
  6789. component: vnode.component,
  6790. suspense: vnode.suspense,
  6791. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  6792. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  6793. el: vnode.el,
  6794. anchor: vnode.anchor,
  6795. ctx: vnode.ctx,
  6796. ce: vnode.ce
  6797. };
  6798. return cloned;
  6799. }
  6800. /**
  6801. * @private
  6802. */
  6803. function createTextVNode() {
  6804. var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ' ';
  6805. var flag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  6806. return createVNode(Text, null, text, flag);
  6807. }
  6808. /**
  6809. * @private
  6810. */
  6811. function createStaticVNode(content, numberOfNodes) {
  6812. // A static vnode can contain multiple stringified elements, and the number
  6813. // of elements is necessary for hydration.
  6814. var vnode = createVNode(Static, null, content);
  6815. vnode.staticCount = numberOfNodes;
  6816. return vnode;
  6817. }
  6818. /**
  6819. * @private
  6820. */
  6821. function createCommentVNode() {
  6822. var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  6823. var asBlock = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  6824. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  6825. }
  6826. function normalizeVNode(child) {
  6827. if (child == null || typeof child === 'boolean') {
  6828. // empty placeholder
  6829. return createVNode(Comment);
  6830. } else if (isArray(child)) {
  6831. // fragment
  6832. return createVNode(Fragment, null,
  6833. // #3666, avoid reference pollution when reusing vnode
  6834. child.slice());
  6835. } else if (typeof child === 'object') {
  6836. // already vnode, this should be the most common since compiled templates
  6837. // always produce all-vnode children arrays
  6838. return cloneIfMounted(child);
  6839. } else {
  6840. // strings and numbers
  6841. return createVNode(Text, null, String(child));
  6842. }
  6843. }
  6844. // optimized normalization for template-compiled render fns
  6845. function cloneIfMounted(child) {
  6846. return child.el === null && child.patchFlag !== -1 /* PatchFlags.HOISTED */ || child.memo ? child : cloneVNode(child);
  6847. }
  6848. function normalizeChildren(vnode, children) {
  6849. var type = 0;
  6850. var {
  6851. shapeFlag
  6852. } = vnode;
  6853. if (children == null) {
  6854. children = null;
  6855. } else if (isArray(children)) {
  6856. type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
  6857. } else if (typeof children === 'object') {
  6858. if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 64 /* ShapeFlags.TELEPORT */)) {
  6859. // Normalize slot to plain children for plain element and Teleport
  6860. var slot = children.default;
  6861. if (slot) {
  6862. // _c marker is added by withCtx() indicating this is a compiled slot
  6863. slot._c && (slot._d = false);
  6864. normalizeChildren(vnode, slot());
  6865. slot._c && (slot._d = true);
  6866. }
  6867. return;
  6868. } else {
  6869. type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
  6870. var slotFlag = children._;
  6871. if (!slotFlag && !(InternalObjectKey in children)) {
  6872. children._ctx = currentRenderingInstance;
  6873. } else if (slotFlag === 3 /* SlotFlags.FORWARDED */ && currentRenderingInstance) {
  6874. // a child component receives forwarded slots from the parent.
  6875. // its slot type is determined by its parent's slot type.
  6876. if (currentRenderingInstance.slots._ === 1 /* SlotFlags.STABLE */) {
  6877. children._ = 1 /* SlotFlags.STABLE */;
  6878. } else {
  6879. children._ = 2 /* SlotFlags.DYNAMIC */;
  6880. vnode.patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
  6881. }
  6882. }
  6883. }
  6884. } else if (isFunction(children)) {
  6885. children = {
  6886. default: children,
  6887. _ctx: currentRenderingInstance
  6888. };
  6889. type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
  6890. } else {
  6891. children = String(children);
  6892. // force teleport children to array so it can be moved around
  6893. if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
  6894. type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
  6895. children = [createTextVNode(children)];
  6896. } else {
  6897. type = 8 /* ShapeFlags.TEXT_CHILDREN */;
  6898. }
  6899. }
  6900. vnode.children = children;
  6901. vnode.shapeFlag |= type;
  6902. }
  6903. function mergeProps() {
  6904. var ret = {};
  6905. for (var i = 0; i < arguments.length; i++) {
  6906. var toMerge = i < 0 || arguments.length <= i ? undefined : arguments[i];
  6907. for (var key in toMerge) {
  6908. if (key === 'class') {
  6909. if (ret.class !== toMerge.class) {
  6910. ret.class = normalizeClass([ret.class, toMerge.class]);
  6911. }
  6912. } else if (key === 'style') {
  6913. ret.style = normalizeStyle([ret.style, toMerge.style]);
  6914. } else if (isOn(key)) {
  6915. var existing = ret[key];
  6916. var incoming = toMerge[key];
  6917. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  6918. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  6919. }
  6920. } else if (key !== '') {
  6921. ret[key] = toMerge[key];
  6922. }
  6923. }
  6924. }
  6925. return ret;
  6926. }
  6927. function invokeVNodeHook(hook, instance, vnode) {
  6928. var prevVNode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  6929. callWithAsyncErrorHandling(hook, instance, 7 /* ErrorCodes.VNODE_HOOK */, [vnode, prevVNode]);
  6930. }
  6931. var emptyAppContext = createAppContext();
  6932. var uid = 0;
  6933. function createComponentInstance(vnode, parent, suspense) {
  6934. var type = vnode.type;
  6935. // inherit parent app context - or - if root, adopt from root vnode
  6936. var appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  6937. var instance = {
  6938. uid: uid++,
  6939. vnode,
  6940. type,
  6941. parent,
  6942. appContext,
  6943. root: null,
  6944. next: null,
  6945. subTree: null,
  6946. effect: null,
  6947. update: null,
  6948. scope: new EffectScope(true /* detached */),
  6949. render: null,
  6950. proxy: null,
  6951. exposed: null,
  6952. exposeProxy: null,
  6953. withProxy: null,
  6954. provides: parent ? parent.provides : Object.create(appContext.provides),
  6955. accessCache: null,
  6956. renderCache: [],
  6957. // local resolved assets
  6958. components: null,
  6959. directives: null,
  6960. // resolved props and emits options
  6961. propsOptions: normalizePropsOptions(type, appContext),
  6962. emitsOptions: normalizeEmitsOptions(type, appContext),
  6963. // emit
  6964. emit: null,
  6965. emitted: null,
  6966. // props default value
  6967. propsDefaults: EMPTY_OBJ,
  6968. // inheritAttrs
  6969. inheritAttrs: type.inheritAttrs,
  6970. // state
  6971. ctx: EMPTY_OBJ,
  6972. data: EMPTY_OBJ,
  6973. props: EMPTY_OBJ,
  6974. attrs: EMPTY_OBJ,
  6975. slots: EMPTY_OBJ,
  6976. refs: EMPTY_OBJ,
  6977. setupState: EMPTY_OBJ,
  6978. setupContext: null,
  6979. // suspense related
  6980. suspense,
  6981. suspenseId: suspense ? suspense.pendingId : 0,
  6982. asyncDep: null,
  6983. asyncResolved: false,
  6984. // lifecycle hooks
  6985. // not using enums here because it results in computed properties
  6986. isMounted: false,
  6987. isUnmounted: false,
  6988. isDeactivated: false,
  6989. bc: null,
  6990. c: null,
  6991. bm: null,
  6992. m: null,
  6993. bu: null,
  6994. u: null,
  6995. um: null,
  6996. bum: null,
  6997. da: null,
  6998. a: null,
  6999. rtg: null,
  7000. rtc: null,
  7001. ec: null,
  7002. sp: null,
  7003. $waitNativeRender(fn) {
  7004. // TODO use native
  7005. setTimeout(fn, 150);
  7006. }
  7007. };
  7008. {
  7009. instance.ctx = {
  7010. _: instance
  7011. };
  7012. }
  7013. instance.root = parent ? parent.root : instance;
  7014. instance.emit = emit.bind(null, instance);
  7015. // apply custom element special handling
  7016. if (vnode.ce) {
  7017. vnode.ce(instance);
  7018. }
  7019. return instance;
  7020. }
  7021. var currentInstance = null;
  7022. var getCurrentInstance = () => currentInstance || currentRenderingInstance;
  7023. var setCurrentInstance = instance => {
  7024. currentInstance = instance;
  7025. instance.scope.on();
  7026. };
  7027. var unsetCurrentInstance = () => {
  7028. currentInstance && currentInstance.scope.off();
  7029. currentInstance = null;
  7030. };
  7031. function isStatefulComponent(instance) {
  7032. return instance.vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */;
  7033. }
  7034. var isInSSRComponentSetup = false;
  7035. function setupComponent(instance) {
  7036. var isSSR = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  7037. isInSSRComponentSetup = isSSR;
  7038. var {
  7039. props,
  7040. children
  7041. } = instance.vnode;
  7042. var isStateful = isStatefulComponent(instance);
  7043. initProps(instance, props, isStateful, isSSR);
  7044. initSlots(instance, children);
  7045. var setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : undefined;
  7046. isInSSRComponentSetup = false;
  7047. return setupResult;
  7048. }
  7049. function setupStatefulComponent(instance, isSSR) {
  7050. var Component = instance.type;
  7051. // 0. create render proxy property access cache
  7052. instance.accessCache = Object.create(null);
  7053. // 1. create public instance / render proxy
  7054. // also mark it raw so it's never observed
  7055. instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
  7056. // 2. call setup()
  7057. var {
  7058. setup
  7059. } = Component;
  7060. if (setup) {
  7061. var setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  7062. setCurrentInstance(instance);
  7063. pauseTracking();
  7064. var setupResult = callWithErrorHandling(setup, instance, 0 /* ErrorCodes.SETUP_FUNCTION */, [instance.props, setupContext]);
  7065. resetTracking();
  7066. unsetCurrentInstance();
  7067. if (isPromise(setupResult)) {
  7068. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  7069. if (isSSR) {
  7070. // return the promise so server-renderer can wait on it
  7071. return setupResult.then(resolvedResult => {
  7072. handleSetupResult(instance, resolvedResult, isSSR);
  7073. }).catch(e => {
  7074. handleError(e, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
  7075. });
  7076. } else {
  7077. // async setup returned Promise.
  7078. // bail here and wait for re-entry.
  7079. instance.asyncDep = setupResult;
  7080. }
  7081. } else {
  7082. handleSetupResult(instance, setupResult, isSSR);
  7083. }
  7084. } else {
  7085. finishComponentSetup(instance, isSSR);
  7086. }
  7087. }
  7088. function handleSetupResult(instance, setupResult, isSSR) {
  7089. if (isFunction(setupResult)) {
  7090. // setup returned an inline render function
  7091. {
  7092. instance.render = setupResult;
  7093. }
  7094. } else if (isObject(setupResult)) {
  7095. instance.setupState = proxyRefs(setupResult);
  7096. } else ;
  7097. finishComponentSetup(instance, isSSR);
  7098. }
  7099. var compile;
  7100. var installWithProxy;
  7101. /**
  7102. * For runtime-dom to register the compiler.
  7103. * Note the exported method uses any to avoid d.ts relying on the compiler types.
  7104. */
  7105. function registerRuntimeCompiler(_compile) {
  7106. compile = _compile;
  7107. installWithProxy = i => {
  7108. if (i.render._rc) {
  7109. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  7110. }
  7111. };
  7112. }
  7113. // dev only
  7114. var isRuntimeOnly = () => !compile;
  7115. function finishComponentSetup(instance, isSSR, skipOptions) {
  7116. var Component = instance.type;
  7117. // template / render function normalization
  7118. // could be already set when returned from setup()
  7119. if (!instance.render) {
  7120. // only do on-the-fly compile if not in SSR - SSR on-the-fly compilation
  7121. // is done by server-renderer
  7122. if (!isSSR && compile && !Component.render) {
  7123. var template = Component.template || resolveMergedOptions(instance).template;
  7124. if (template) {
  7125. var {
  7126. isCustomElement,
  7127. compilerOptions
  7128. } = instance.appContext.config;
  7129. var {
  7130. delimiters,
  7131. compilerOptions: componentCompilerOptions
  7132. } = Component;
  7133. var finalCompilerOptions = extend$1(extend$1({
  7134. isCustomElement,
  7135. delimiters
  7136. }, compilerOptions), componentCompilerOptions);
  7137. Component.render = compile(template, finalCompilerOptions);
  7138. }
  7139. }
  7140. instance.render = Component.render || NOOP;
  7141. // for runtime-compiled render functions using `with` blocks, the render
  7142. // proxy used needs a different `has` handler which is more performant and
  7143. // also only allows a whitelist of globals to fallthrough.
  7144. if (installWithProxy) {
  7145. installWithProxy(instance);
  7146. }
  7147. }
  7148. // support for 2.x options
  7149. {
  7150. setCurrentInstance(instance);
  7151. pauseTracking();
  7152. applyOptions(instance);
  7153. resetTracking();
  7154. unsetCurrentInstance();
  7155. }
  7156. }
  7157. function createAttrsProxy(instance) {
  7158. return new Proxy(instance.attrs, {
  7159. get(target, key) {
  7160. track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
  7161. return target[key];
  7162. }
  7163. });
  7164. }
  7165. function createSetupContext(instance) {
  7166. var expose = exposed => {
  7167. instance.exposed = exposed || {};
  7168. };
  7169. var attrs;
  7170. {
  7171. return {
  7172. get attrs() {
  7173. return attrs || (attrs = createAttrsProxy(instance));
  7174. },
  7175. slots: instance.slots,
  7176. emit: instance.emit,
  7177. expose
  7178. };
  7179. }
  7180. }
  7181. function getExposeProxy(instance) {
  7182. if (instance.exposed) {
  7183. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  7184. get(target, key) {
  7185. if (key in target) {
  7186. return target[key];
  7187. } else if (key in publicPropertiesMap) {
  7188. return publicPropertiesMap[key](instance);
  7189. }
  7190. },
  7191. has(target, key) {
  7192. return key in target || key in publicPropertiesMap;
  7193. }
  7194. }));
  7195. }
  7196. }
  7197. function getComponentName(Component) {
  7198. var includeInferred = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  7199. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  7200. }
  7201. function isClassComponent(value) {
  7202. return isFunction(value) && '__vccOpts' in value;
  7203. }
  7204. var computed = (getterOrOptions, debugOptions) => {
  7205. // @ts-ignore
  7206. return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  7207. };
  7208. // implementation
  7209. function defineProps() {
  7210. return null;
  7211. }
  7212. // implementation
  7213. function defineEmits() {
  7214. return null;
  7215. }
  7216. /**
  7217. * Vue `<script setup>` compiler macro for declaring a component's exposed
  7218. * instance properties when it is accessed by a parent component via template
  7219. * refs.
  7220. *
  7221. * `<script setup>` components are closed by default - i.e. variables inside
  7222. * the `<script setup>` scope is not exposed to parent unless explicitly exposed
  7223. * via `defineExpose`.
  7224. *
  7225. * This is only usable inside `<script setup>`, is compiled away in the
  7226. * output and should **not** be actually called at runtime.
  7227. */
  7228. function defineExpose(exposed) {}
  7229. /**
  7230. * Vue `<script setup>` compiler macro for providing props default values when
  7231. * using type-based `defineProps` declaration.
  7232. *
  7233. * Example usage:
  7234. * ```ts
  7235. * withDefaults(defineProps<{
  7236. * size?: number
  7237. * labels?: string[]
  7238. * }>(), {
  7239. * size: 3,
  7240. * labels: () => ['default label']
  7241. * })
  7242. * ```
  7243. *
  7244. * This is only usable inside `<script setup>`, is compiled away in the output
  7245. * and should **not** be actually called at runtime.
  7246. */
  7247. function withDefaults(props, defaults) {
  7248. return null;
  7249. }
  7250. function useSlots() {
  7251. return getContext().slots;
  7252. }
  7253. function useAttrs() {
  7254. return getContext().attrs;
  7255. }
  7256. function getContext() {
  7257. var i = getCurrentInstance();
  7258. return i.setupContext || (i.setupContext = createSetupContext(i));
  7259. }
  7260. /**
  7261. * Runtime helper for merging default declarations. Imported by compiled code
  7262. * only.
  7263. * @internal
  7264. */
  7265. function mergeDefaults(raw, defaults) {
  7266. var props = isArray(raw) ? raw.reduce((normalized, p) => (normalized[p] = {}, normalized), {}) : raw;
  7267. for (var key in defaults) {
  7268. var opt = props[key];
  7269. if (opt) {
  7270. if (isArray(opt) || isFunction(opt)) {
  7271. props[key] = {
  7272. type: opt,
  7273. default: defaults[key]
  7274. };
  7275. } else {
  7276. opt.default = defaults[key];
  7277. }
  7278. } else if (opt === null) {
  7279. props[key] = {
  7280. default: defaults[key]
  7281. };
  7282. } else ;
  7283. }
  7284. return props;
  7285. }
  7286. /**
  7287. * Used to create a proxy for the rest element when destructuring props with
  7288. * defineProps().
  7289. * @internal
  7290. */
  7291. function createPropsRestProxy(props, excludedKeys) {
  7292. var ret = {};
  7293. var _loop4 = function (key) {
  7294. if (!excludedKeys.includes(key)) {
  7295. Object.defineProperty(ret, key, {
  7296. enumerable: true,
  7297. get: () => props[key]
  7298. });
  7299. }
  7300. };
  7301. for (var key in props) {
  7302. _loop4(key);
  7303. }
  7304. return ret;
  7305. }
  7306. /**
  7307. * `<script setup>` helper for persisting the current instance context over
  7308. * async/await flows.
  7309. *
  7310. * `@vue/compiler-sfc` converts the following:
  7311. *
  7312. * ```ts
  7313. * const x = await foo()
  7314. * ```
  7315. *
  7316. * into:
  7317. *
  7318. * ```ts
  7319. * let __temp, __restore
  7320. * const x = (([__temp, __restore] = withAsyncContext(() => foo())),__temp=await __temp,__restore(),__temp)
  7321. * ```
  7322. * @internal
  7323. */
  7324. function withAsyncContext(getAwaitable) {
  7325. var ctx = getCurrentInstance();
  7326. var awaitable = getAwaitable();
  7327. unsetCurrentInstance();
  7328. if (isPromise(awaitable)) {
  7329. awaitable = awaitable.catch(e => {
  7330. setCurrentInstance(ctx);
  7331. throw e;
  7332. });
  7333. }
  7334. return [awaitable, () => setCurrentInstance(ctx)];
  7335. }
  7336. // Actual implementation
  7337. function h(type, propsOrChildren, children) {
  7338. var l = arguments.length;
  7339. if (l === 2) {
  7340. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  7341. // single vnode without props
  7342. if (isVNode(propsOrChildren)) {
  7343. return createVNode(type, null, [propsOrChildren]);
  7344. }
  7345. // props without children
  7346. return createVNode(type, propsOrChildren);
  7347. } else {
  7348. // omit props
  7349. return createVNode(type, null, propsOrChildren);
  7350. }
  7351. } else {
  7352. if (l > 3) {
  7353. children = Array.prototype.slice.call(arguments, 2);
  7354. } else if (l === 3 && isVNode(children)) {
  7355. children = [children];
  7356. }
  7357. return createVNode(type, propsOrChildren, children);
  7358. }
  7359. }
  7360. var ssrContextKey = Symbol("");
  7361. var useSSRContext = () => {
  7362. {
  7363. var ctx = inject(ssrContextKey);
  7364. return ctx;
  7365. }
  7366. };
  7367. function initCustomFormatter() {
  7368. /* eslint-disable no-restricted-globals */
  7369. {
  7370. return;
  7371. }
  7372. }
  7373. function withMemo(memo, render, cache, index) {
  7374. var cached = cache[index];
  7375. if (cached && isMemoSame(cached, memo)) {
  7376. return cached;
  7377. }
  7378. var ret = render();
  7379. // shallow clone
  7380. ret.memo = memo.slice();
  7381. return cache[index] = ret;
  7382. }
  7383. function isMemoSame(cached, memo) {
  7384. var prev = cached.memo;
  7385. if (prev.length != memo.length) {
  7386. return false;
  7387. }
  7388. for (var i = 0; i < prev.length; i++) {
  7389. if (hasChanged(prev[i], memo[i])) {
  7390. return false;
  7391. }
  7392. }
  7393. // make sure to let parent block track it when returning cached
  7394. if (isBlockTreeEnabled > 0 && currentBlock) {
  7395. currentBlock.push(cached);
  7396. }
  7397. return true;
  7398. }
  7399. // Core API ------------------------------------------------------------------
  7400. var version = "3.2.47";
  7401. /**
  7402. * SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
  7403. * @internal
  7404. */
  7405. var ssrUtils = null;
  7406. /**
  7407. * @internal only exposed in compat builds
  7408. */
  7409. var resolveFilter = null;
  7410. /**
  7411. * @internal only exposed in compat builds.
  7412. */
  7413. var compatUtils = null;
  7414. // 样式相关
  7415. var NODE_EXT_STYLES = 'styles'; // node 中存储的可用样式表
  7416. var NODE_EXT_CLASS_STYLE = 'classStyle'; // node 中存储的 classStyle
  7417. var NODE_EXT_STYLE = 'style'; // node 中存储的 style
  7418. function setNodeExtraData(el, name, value) {
  7419. el.ext.set(name, value);
  7420. }
  7421. function getNodeExtraData(el, name) {
  7422. return el.ext.get(name);
  7423. }
  7424. function getExtraStyles(el) {
  7425. return getNodeExtraData(el, NODE_EXT_STYLES);
  7426. }
  7427. function setExtraStyles(el, styles) {
  7428. setNodeExtraData(el, NODE_EXT_STYLES, styles);
  7429. }
  7430. function getExtraClassStyle(el) {
  7431. return getNodeExtraData(el, NODE_EXT_CLASS_STYLE);
  7432. }
  7433. function setExtraClassStyle(el, classStyle) {
  7434. setNodeExtraData(el, NODE_EXT_CLASS_STYLE, classStyle);
  7435. }
  7436. function getExtraStyle(el) {
  7437. return getNodeExtraData(el, NODE_EXT_STYLE);
  7438. }
  7439. function setExtraStyle(el, style) {
  7440. setNodeExtraData(el, NODE_EXT_STYLE, style);
  7441. }
  7442. function isCommentNode(node) {
  7443. return node.nodeName == '#comment';
  7444. }
  7445. function each(obj) {
  7446. return Object.keys(obj);
  7447. }
  7448. function useCssStyles(componentStyles) {
  7449. var normalized = {};
  7450. if (!isArray(componentStyles)) {
  7451. return normalized;
  7452. }
  7453. componentStyles.forEach(componentStyle => {
  7454. each(componentStyle).forEach(className => {
  7455. var parentStyles = componentStyle[className];
  7456. var normalizedStyles = normalized[className] || (normalized[className] = {});
  7457. each(parentStyles).forEach(parentSelector => {
  7458. var parentStyle = parentStyles[parentSelector];
  7459. var normalizedStyle = normalizedStyles[parentSelector] || (normalizedStyles[parentSelector] = {});
  7460. each(parentStyle).forEach(name => {
  7461. if (name[0] === '!') {
  7462. // 如果以包含important属性,则移除非important
  7463. normalizedStyle[name] = parentStyle[name];
  7464. delete normalizedStyle[name.slice(1)];
  7465. } else {
  7466. // 当前属性非important,且不存在同名important属性
  7467. if (!hasOwn(normalizedStyle, '!' + name)) {
  7468. normalizedStyle[name] = parentStyle[name];
  7469. }
  7470. }
  7471. });
  7472. });
  7473. });
  7474. });
  7475. return normalized;
  7476. }
  7477. function hasClass(calssName, el) {
  7478. var classList = el && el.classList;
  7479. return classList && classList.includes(calssName);
  7480. }
  7481. var TYPE_RE = /[+~> ]$/;
  7482. var PROPERTY_PARENT_NODE = 'parentNode';
  7483. var PROPERTY_PREVIOUS_SIBLING = 'previousSibling';
  7484. function isMatchParentSelector(parentSelector, el) {
  7485. var classArray = parentSelector.split('.');
  7486. for (var i = classArray.length - 1; i > 0; i--) {
  7487. var item = classArray[i];
  7488. var type = item[item.length - 1];
  7489. var className = item.replace(TYPE_RE, '');
  7490. if (type === '~' || type === ' ') {
  7491. var property = type === '~' ? PROPERTY_PREVIOUS_SIBLING : PROPERTY_PARENT_NODE;
  7492. while (el) {
  7493. el = el[property];
  7494. if (hasClass(className, el)) {
  7495. break;
  7496. }
  7497. }
  7498. if (!el) {
  7499. return false;
  7500. }
  7501. } else {
  7502. if (type === '>') {
  7503. el = el && el[PROPERTY_PARENT_NODE];
  7504. } else if (type === '+') {
  7505. el = el && el[PROPERTY_PREVIOUS_SIBLING];
  7506. }
  7507. if (!hasClass(className, el)) {
  7508. return false;
  7509. }
  7510. }
  7511. }
  7512. return true;
  7513. }
  7514. var WEIGHT_IMPORTANT = 1000;
  7515. function parseClassName(_ref20, parentStyles, el) {
  7516. var {
  7517. styles,
  7518. weights
  7519. } = _ref20;
  7520. each(parentStyles).forEach(parentSelector => {
  7521. if (parentSelector && el) {
  7522. if (!isMatchParentSelector(parentSelector, el)) {
  7523. return;
  7524. }
  7525. }
  7526. var classWeight = parentSelector.split('.').length;
  7527. var style = parentStyles[parentSelector];
  7528. each(style).forEach(name => {
  7529. var value = style[name];
  7530. var isImportant = name[0] === '!';
  7531. if (isImportant) {
  7532. name = name.slice(1);
  7533. }
  7534. var oldWeight = weights[name] || 0;
  7535. var weight = classWeight + (isImportant ? WEIGHT_IMPORTANT : 0);
  7536. if (weight >= oldWeight) {
  7537. weights[name] = weight;
  7538. styles.set(name, value);
  7539. }
  7540. });
  7541. });
  7542. }
  7543. function parseClassListWithStyleSheet(classList, stylesheet) {
  7544. var el = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  7545. var context = {
  7546. styles: new Map(),
  7547. weights: {}
  7548. };
  7549. classList.forEach(className => {
  7550. var parentStyles = stylesheet && stylesheet[className];
  7551. if (parentStyles) {
  7552. parseClassName(context, parentStyles, el);
  7553. }
  7554. });
  7555. return context;
  7556. }
  7557. function parseClassStyles(el) {
  7558. var styles = getExtraStyles(el);
  7559. return parseClassListWithStyleSheet(el.classList, styles, el);
  7560. }
  7561. function parseClassList(classList, instance) {
  7562. var el = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  7563. return parseClassListWithStyleSheet(classList, parseStyleSheet(instance), el);
  7564. }
  7565. function parseStyleSheet(_ref21) {
  7566. var {
  7567. type,
  7568. appContext,
  7569. root
  7570. } = _ref21;
  7571. var component = type;
  7572. if (!component.__styles) {
  7573. var __globalStyles = appContext.provides.__globalStyles;
  7574. // nvue 和 vue 混合开发时,__globalStyles注入的是未处理过的
  7575. if (appContext && isArray(__globalStyles)) {
  7576. appContext.provides.__globalStyles = useCssStyles(__globalStyles);
  7577. }
  7578. var styles = [];
  7579. if (appContext && __globalStyles) {
  7580. // 全局样式,包括 app.css 以及 page.css
  7581. styles.push(__globalStyles);
  7582. }
  7583. // 合并页面样式
  7584. // TODO 添加额外缓存
  7585. var page = root.type;
  7586. if (component !== page && isArray(page.styles)) {
  7587. styles.push(...page.styles);
  7588. }
  7589. if (isArray(component.styles)) {
  7590. styles.push(...component.styles);
  7591. }
  7592. component.__styles = useCssStyles(styles);
  7593. }
  7594. return component.__styles;
  7595. }
  7596. function extend(a, b) {
  7597. b.forEach((value, key) => {
  7598. a.set(key, value);
  7599. });
  7600. return a;
  7601. }
  7602. function toStyle(el, classStyle, classStyleWeights) {
  7603. var res = extend(new Map(), classStyle);
  7604. var style = getExtraStyle(el);
  7605. if (style != null) {
  7606. style.forEach((value, key) => {
  7607. var weight = classStyleWeights[key];
  7608. // TODO: 目前只计算了 class 中 important 的权重,会存在 style class 同时设置 important 时,class 优先级更高的问题
  7609. if (weight == null || weight < WEIGHT_IMPORTANT) {
  7610. res.set(key, value);
  7611. }
  7612. });
  7613. }
  7614. return res;
  7615. }
  7616. function patchClass(el, pre, next) {
  7617. var instance = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  7618. if (!instance) {
  7619. return;
  7620. }
  7621. var classList = next ? next.split(' ') : [];
  7622. el.classList = classList;
  7623. setExtraStyles(el, parseStyleSheet(instance));
  7624. // TODO 如果当前元素是组件根节点(非页面)
  7625. updateClassStyles(el);
  7626. }
  7627. function updateClassStyles(el) {
  7628. if (el.parentNode == null || isCommentNode(el)) {
  7629. return;
  7630. }
  7631. if (getExtraClassStyle(el) == null) {
  7632. setExtraClassStyle(el, new Map());
  7633. }
  7634. var oldClassStyle = getExtraClassStyle(el);
  7635. // reset previous class style to empty string
  7636. oldClassStyle.forEach((_value, key) => {
  7637. oldClassStyle.set(key, '');
  7638. });
  7639. var parseClassStylesResult = parseClassStyles(el);
  7640. parseClassStylesResult.styles.forEach((value, key) => {
  7641. oldClassStyle.set(key, value);
  7642. });
  7643. var styles = toStyle(el, oldClassStyle, parseClassStylesResult.weights);
  7644. if (styles.size == 0) {
  7645. return;
  7646. }
  7647. // TODO validateStyles
  7648. // validateStyles(el, oldClassStyle)
  7649. el.updateStyle(styles);
  7650. }
  7651. var rootPage = null;
  7652. var rootDocument = null;
  7653. function getDocument() {
  7654. if (!rootPage) {
  7655. rootPage = __pageManager.createPage('', '', new Map());
  7656. }
  7657. if (!rootDocument) {
  7658. rootDocument = rootPage.document;
  7659. }
  7660. return rootDocument;
  7661. }
  7662. /**
  7663. * 判断是否在document中
  7664. * @param el
  7665. * @returns
  7666. */
  7667. function isInDocument(parent) {
  7668. return !!parent.pageId;
  7669. }
  7670. var nodeOps = {
  7671. insert: (el, parent, anchor) => {
  7672. if (!anchor) {
  7673. parent.appendChild(el);
  7674. } else {
  7675. parent.insertBefore(el, anchor);
  7676. }
  7677. // 判断是不是首次被完整插入DOM树中
  7678. // vue 插入节点的顺序是,先子后父,所以等待父真正被完整插入document时,再遍历一遍子节点校正父子选择器样式
  7679. if (isInDocument(parent)) {
  7680. updateClassStyles(el);
  7681. updateChildrenClassStyle(el);
  7682. }
  7683. },
  7684. remove: child => {
  7685. var parent = child.parentNode;
  7686. if (parent) {
  7687. parent.removeChild(child);
  7688. }
  7689. },
  7690. createElement: (tag, container) => {
  7691. return getDocument().createElement(tag);
  7692. },
  7693. createText: (text, container) => {
  7694. var textNode = getDocument().createElement('text');
  7695. textNode.setAttribute('value', text);
  7696. return textNode;
  7697. },
  7698. createComment: (text, container) => {
  7699. return getDocument().createComment(text);
  7700. },
  7701. setText: (node, text) => {
  7702. node.setAttribute('value', text);
  7703. },
  7704. setElementText: (el, text) => {
  7705. el.setAttribute('value', text);
  7706. },
  7707. parentNode: node => node.parentNode,
  7708. nextSibling: node => node.nextSibling
  7709. };
  7710. // patchClass 先子后父,所以插入父的时候 updateChildrenClassStyle
  7711. function updateChildrenClassStyle(el) {
  7712. if (el !== null) {
  7713. el.childNodes.forEach(child => {
  7714. updateClassStyles(child);
  7715. updateChildrenClassStyle(child);
  7716. });
  7717. }
  7718. }
  7719. function patchAttr(el, key, value) {
  7720. var instance = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  7721. if (instance) {
  7722. [key, value] = transformAttr(el, key, value, instance);
  7723. }
  7724. el.setAnyAttribute(key, value);
  7725. }
  7726. var ATTR_HOVER_CLASS = 'hoverClass';
  7727. var ATTR_PLACEHOLDER_CLASS = 'placeholderClass';
  7728. var ATTR_PLACEHOLDER_STYLE = 'placeholderStyle';
  7729. var ATTR_INDICATOR_CLASS = 'indicatorClass';
  7730. var ATTR_INDICATOR_STYLE = 'indicatorStyle';
  7731. var ATTR_MASK_CLASS = 'maskClass';
  7732. var ATTR_MASK_STYLE = 'maskStyle';
  7733. var CLASS_AND_STYLES = {
  7734. view: {
  7735. class: [ATTR_HOVER_CLASS],
  7736. style: []
  7737. },
  7738. button: {
  7739. class: [ATTR_HOVER_CLASS],
  7740. style: []
  7741. },
  7742. navigator: {
  7743. class: [ATTR_HOVER_CLASS],
  7744. style: []
  7745. },
  7746. 'u-input': {
  7747. class: [ATTR_PLACEHOLDER_CLASS],
  7748. style: [ATTR_PLACEHOLDER_STYLE]
  7749. },
  7750. 'u-textarea': {
  7751. class: [ATTR_PLACEHOLDER_CLASS],
  7752. style: [ATTR_PLACEHOLDER_STYLE]
  7753. },
  7754. 'picker-view': {
  7755. class: [ATTR_INDICATOR_CLASS, ATTR_MASK_CLASS],
  7756. style: [ATTR_INDICATOR_STYLE, ATTR_MASK_STYLE]
  7757. }
  7758. };
  7759. function transformAttr(el, key, value, instance) {
  7760. if (!value) {
  7761. return [key, value];
  7762. }
  7763. var opts = CLASS_AND_STYLES[el.tagName.toLowerCase()];
  7764. if (opts) {
  7765. var camelized = camelize(key);
  7766. if (opts['class'].indexOf(camelized) > -1) {
  7767. return [camelized, parseClassList([value], instance, el)];
  7768. }
  7769. if (opts['style'].indexOf(key) > -1) {
  7770. if (isString(value)) {
  7771. return [camelized, parseStringStyle(value)];
  7772. }
  7773. return [camelized, normalizeStyle(value)];
  7774. }
  7775. }
  7776. return [key, value];
  7777. }
  7778. function addEventListener(el, event, handler, options) {
  7779. el.addEventListener(event, handler);
  7780. }
  7781. function removeEventListener(el, event) {
  7782. el.removeEventListener(event);
  7783. }
  7784. function patchEvent(el, rawName, prevValue, nextValue) {
  7785. var instance = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  7786. // vei = vue event invokers
  7787. var invokers = el._vei || (el._vei = {});
  7788. var existingInvoker = invokers[rawName];
  7789. if (nextValue && existingInvoker) {
  7790. // patch
  7791. existingInvoker.value = nextValue;
  7792. } else {
  7793. var [name, options] = parseName(rawName);
  7794. if (nextValue) {
  7795. // add
  7796. var invoker = invokers[rawName] = createInvoker(nextValue, instance);
  7797. addEventListener(el, name, invoker);
  7798. } else if (existingInvoker) {
  7799. // remove
  7800. removeEventListener(el, name);
  7801. invokers[rawName] = undefined;
  7802. }
  7803. }
  7804. }
  7805. var optionsModifierRE = /(?:Once|Passive|Capture)$/;
  7806. function formatEventName(name) {
  7807. if (name === 'on-post-message') {
  7808. return 'onPostMessage';
  7809. }
  7810. return name;
  7811. }
  7812. function parseName(name) {
  7813. var options;
  7814. if (optionsModifierRE.test(name)) {
  7815. options = {};
  7816. var m;
  7817. while (m = name.match(optionsModifierRE)) {
  7818. name = name.slice(0, name.length - m[0].length);
  7819. options[m[0].toLowerCase()] = true;
  7820. }
  7821. }
  7822. var event = name[2] === ':' ? name.slice(3) : name.slice(2);
  7823. return [formatEventName(hyphenate(event)), options];
  7824. }
  7825. function createInvoker(initialValue, instance) {
  7826. var invoker = e => {
  7827. callWithAsyncErrorHandling(invoker.value, instance, 5 /* ErrorCodes.NATIVE_EVENT_HANDLER */, [e]);
  7828. };
  7829. invoker.value = initialValue;
  7830. var modifiers = new Set();
  7831. // 合并 modifiers
  7832. if (isArray(invoker.value)) {
  7833. invoker.value.forEach(v => {
  7834. if (v.modifiers) {
  7835. v.modifiers.forEach(m => {
  7836. modifiers.add(m);
  7837. });
  7838. }
  7839. });
  7840. } else {
  7841. if (invoker.value.modifiers) {
  7842. invoker.value.modifiers.forEach(m => {
  7843. modifiers.add(m);
  7844. });
  7845. }
  7846. }
  7847. invoker.modifiers = [...modifiers];
  7848. return invoker;
  7849. }
  7850. function patchStyle(el, prev, next) {
  7851. if (!next) {
  7852. // TODO remove styles
  7853. // el.setStyles({})
  7854. return;
  7855. }
  7856. if (isString(next)) {
  7857. next = parseStringStyle(next);
  7858. }
  7859. var batchedStyles = new Map();
  7860. var isPrevObj = prev && !isString(prev);
  7861. if (isPrevObj) {
  7862. for (var key in prev) {
  7863. if (next[key] == null) {
  7864. batchedStyles.set(camelize(key), '');
  7865. }
  7866. }
  7867. for (var _key13 in next) {
  7868. var value = next[_key13];
  7869. batchedStyles.set(camelize(_key13), value);
  7870. }
  7871. } else {
  7872. for (var _key14 in next) {
  7873. batchedStyles.set(camelize(_key14), next[_key14]);
  7874. }
  7875. setExtraStyle(el, batchedStyles);
  7876. }
  7877. // TODO validateStyles(el, batchedStyles)
  7878. el.updateStyle(batchedStyles);
  7879. }
  7880. var vModelTags = ['u-input', 'u-textarea'];
  7881. var patchProp = function (el, key, prevValue, nextValue) {
  7882. var isSVG = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  7883. var prevChildren = arguments.length > 5 ? arguments[5] : undefined;
  7884. var parentComponent = arguments.length > 6 ? arguments[6] : undefined;
  7885. var parentSuspense = arguments.length > 7 ? arguments[7] : undefined;
  7886. var unmountChildren = arguments.length > 8 ? arguments[8] : undefined;
  7887. var hostInstance = arguments.length > 9 ? arguments[9] : undefined;
  7888. if (key === 'class') {
  7889. patchClass(el, prevValue, nextValue, hostInstance || parentComponent);
  7890. } else if (key === 'style') {
  7891. patchStyle(el, prevValue, nextValue);
  7892. } else if (isOn(key)) {
  7893. // ignore v-model listeners
  7894. if (!isModelListener(key)) {
  7895. patchEvent(el, key, prevValue, nextValue, parentComponent);
  7896. }
  7897. } else if (key === 'modelValue' && vModelTags.includes(el.tagName.toLocaleLowerCase())) {
  7898. // v-model 时,原生 input 和 textarea 接收的是 value
  7899. el.setAnyAttribute('modelValue', nextValue);
  7900. el.setAnyAttribute('value', nextValue);
  7901. } else {
  7902. patchAttr(el, key, nextValue, parentComponent);
  7903. }
  7904. };
  7905. function useCssModule() {
  7906. var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '$style';
  7907. /* istanbul ignore else */
  7908. {
  7909. var instance = getCurrentInstance();
  7910. if (!instance) {
  7911. return EMPTY_OBJ;
  7912. }
  7913. var modules = instance.type.__cssModules;
  7914. if (!modules) {
  7915. return EMPTY_OBJ;
  7916. }
  7917. var mod = modules[name];
  7918. if (!mod) {
  7919. return EMPTY_OBJ;
  7920. }
  7921. return mod;
  7922. }
  7923. }
  7924. /**
  7925. * Runtime helper for SFC's CSS variable injection feature.
  7926. * @private
  7927. */
  7928. function useCssVars(getter) {
  7929. var instance = getCurrentInstance();
  7930. /* istanbul ignore next */
  7931. if (!instance) {
  7932. return;
  7933. }
  7934. var setVars = () => setVarsOnVNode(instance.subTree, getter(instance.proxy));
  7935. onMounted(() => watchEffect(setVars, {
  7936. flush: 'post'
  7937. }));
  7938. onUpdated(setVars);
  7939. }
  7940. function setVarsOnVNode(vnode, vars) {
  7941. if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
  7942. var suspense = vnode.suspense;
  7943. vnode = suspense.activeBranch;
  7944. if (suspense.pendingBranch && !suspense.isHydrating) {
  7945. suspense.effects.push(() => {
  7946. setVarsOnVNode(suspense.activeBranch, vars);
  7947. });
  7948. }
  7949. }
  7950. // drill down HOCs until it's a non-component vnode
  7951. while (vnode.component) {
  7952. vnode = vnode.component.subTree;
  7953. }
  7954. if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && vnode.el) {
  7955. var style = vnode.el.style;
  7956. for (var key in vars) {
  7957. style.setProperty("--".concat(key), vars[key]);
  7958. }
  7959. } else if (vnode.type === Fragment) {
  7960. vnode.children.forEach(c => setVarsOnVNode(c, vars));
  7961. }
  7962. }
  7963. var systemModifiers = ['ctrl', 'shift', 'alt', 'meta'];
  7964. var modifierGuards = {
  7965. stop: e => e.stopPropagation(),
  7966. prevent: e => e.preventDefault(),
  7967. self: e => e.target !== e.currentTarget,
  7968. ctrl: e => !e.ctrlKey,
  7969. shift: e => !e.shiftKey,
  7970. alt: e => !e.altKey,
  7971. meta: e => !e.metaKey,
  7972. left: e => 'button' in e && e.button !== 0,
  7973. middle: e => 'button' in e && e.button !== 1,
  7974. right: e => 'button' in e && e.button !== 2,
  7975. exact: (e, modifiers) => systemModifiers.some(m => e["".concat(m, "Key")] && !modifiers.includes(m))
  7976. };
  7977. /**
  7978. * @private
  7979. */
  7980. var withModifiers = (fn, modifiers) => {
  7981. return function (event) {
  7982. for (var i = 0; i < modifiers.length; i++) {
  7983. var guard = modifierGuards[modifiers[i]];
  7984. if (guard && guard(event, modifiers)) return;
  7985. }
  7986. for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key15 = 1; _key15 < _len6; _key15++) {
  7987. args[_key15 - 1] = arguments[_key15];
  7988. }
  7989. return fn(event, ...args);
  7990. };
  7991. };
  7992. /**
  7993. * @private
  7994. */
  7995. var withKeys = (fn, modifiers) => {
  7996. return event => {
  7997. if (!('key' in event)) {
  7998. return;
  7999. }
  8000. var eventKey = hyphenate(event.key);
  8001. if (modifiers.some(k => k === eventKey)) {
  8002. return fn(event);
  8003. }
  8004. };
  8005. };
  8006. var rendererOptions = extend$1({
  8007. patchProp
  8008. }, nodeOps);
  8009. // lazy create the renderer - this makes core renderer logic tree-shakable
  8010. // in case the user only imports reactivity utilities from Vue.
  8011. var renderer;
  8012. function ensureRenderer() {
  8013. return renderer || (renderer = createRenderer(rendererOptions));
  8014. }
  8015. // use explicit type casts here to avoid import() calls in rolled-up d.ts
  8016. var render = function () {
  8017. ensureRenderer().render(...arguments);
  8018. };
  8019. var createApp = function () {
  8020. var app = ensureRenderer().createApp(...arguments);
  8021. var {
  8022. mount
  8023. } = app;
  8024. app.mount = container => {
  8025. if (container === '#app') {
  8026. container = getDocument().body;
  8027. }
  8028. return mount(container);
  8029. };
  8030. return app;
  8031. };
  8032. export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineProps, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hyphenate, initCustomFormatter, inject, injectHook, isInSSRComponentSetup, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, parseClassList, parseClassStyles, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssStyles, useCssVars, useSSRContext, useSlots, useTransitionState, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };