runtime-core.cjs.prod.js 190 KB

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