dep-0fd6fea3.js 293 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757
  1. 'use strict';
  2. var index = require('./dep-689425f3.js');
  3. function _mergeNamespaces(n, m) {
  4. for (var i = 0; i < m.length; i++) {
  5. var e = m[i];
  6. if (typeof e !== 'string' && !Array.isArray(e)) { for (var k in e) {
  7. if (k !== 'default' && !(k in n)) {
  8. n[k] = e[k];
  9. }
  10. } }
  11. }
  12. return n;
  13. }
  14. var compilerDom_cjs$2 = {};
  15. /**
  16. * Make a map and return a function for checking if a key
  17. * is in that map.
  18. * IMPORTANT: all calls of this function must be prefixed with
  19. * \/\*#\_\_PURE\_\_\*\/
  20. * So that rollup can tree-shake them if necessary.
  21. */
  22. function makeMap(str, expectsLowerCase) {
  23. const map = Object.create(null);
  24. const list = str.split(',');
  25. for (let i = 0; i < list.length; i++) {
  26. map[list[i]] = true;
  27. }
  28. return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
  29. }
  30. /**
  31. * dev only flag -> name mapping
  32. */
  33. const PatchFlagNames = {
  34. [1 /* TEXT */]: `TEXT`,
  35. [2 /* CLASS */]: `CLASS`,
  36. [4 /* STYLE */]: `STYLE`,
  37. [8 /* PROPS */]: `PROPS`,
  38. [16 /* FULL_PROPS */]: `FULL_PROPS`,
  39. [32 /* HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,
  40. [64 /* STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,
  41. [128 /* KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,
  42. [256 /* UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
  43. [512 /* NEED_PATCH */]: `NEED_PATCH`,
  44. [1024 /* DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
  45. [2048 /* DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,
  46. [-1 /* HOISTED */]: `HOISTED`,
  47. [-2 /* BAIL */]: `BAIL`
  48. };
  49. /**
  50. * Dev only
  51. */
  52. const slotFlagsText = {
  53. [1 /* STABLE */]: 'STABLE',
  54. [2 /* DYNAMIC */]: 'DYNAMIC',
  55. [3 /* FORWARDED */]: 'FORWARDED'
  56. };
  57. const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
  58. 'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
  59. 'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';
  60. const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);
  61. const range = 2;
  62. function generateCodeFrame(source, start = 0, end = source.length) {
  63. // Split the content into individual lines but capture the newline sequence
  64. // that separated each line. This is important because the actual sequence is
  65. // needed to properly take into account the full line length for offset
  66. // comparison
  67. let lines = source.split(/(\r?\n)/);
  68. // Separate the lines and newline sequences into separate arrays for easier referencing
  69. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  70. lines = lines.filter((_, idx) => idx % 2 === 0);
  71. let count = 0;
  72. const res = [];
  73. for (let i = 0; i < lines.length; i++) {
  74. count +=
  75. lines[i].length +
  76. ((newlineSequences[i] && newlineSequences[i].length) || 0);
  77. if (count >= start) {
  78. for (let j = i - range; j <= i + range || end > count; j++) {
  79. if (j < 0 || j >= lines.length)
  80. continue;
  81. const line = j + 1;
  82. res.push(`${line}${' '.repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
  83. const lineLength = lines[j].length;
  84. const newLineSeqLength = (newlineSequences[j] && newlineSequences[j].length) || 0;
  85. if (j === i) {
  86. // push underline
  87. const pad = start - (count - (lineLength + newLineSeqLength));
  88. const length = Math.max(1, end > count ? lineLength - pad : end - start);
  89. res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));
  90. }
  91. else if (j > i) {
  92. if (end > count) {
  93. const length = Math.max(Math.min(end - count, lineLength), 1);
  94. res.push(` | ` + '^'.repeat(length));
  95. }
  96. count += lineLength + newLineSeqLength;
  97. }
  98. }
  99. break;
  100. }
  101. }
  102. return res.join('\n');
  103. }
  104. /**
  105. * On the client we only need to offer special cases for boolean attributes that
  106. * have different names from their corresponding dom properties:
  107. * - itemscope -> N/A
  108. * - allowfullscreen -> allowFullscreen
  109. * - formnovalidate -> formNoValidate
  110. * - ismap -> isMap
  111. * - nomodule -> noModule
  112. * - novalidate -> noValidate
  113. * - readonly -> readOnly
  114. */
  115. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  116. const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
  117. /**
  118. * The full list is needed during SSR to produce the correct initial markup.
  119. */
  120. const isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs +
  121. `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` +
  122. `loop,open,required,reversed,scoped,seamless,` +
  123. `checked,muted,multiple,selected`);
  124. /**
  125. * Boolean attributes should be included if the value is truthy or ''.
  126. * e.g. `<select multiple>` compiles to `{ multiple: '' }`
  127. */
  128. function includeBooleanAttr(value) {
  129. return !!value || value === '';
  130. }
  131. const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
  132. const attrValidationCache = {};
  133. function isSSRSafeAttrName(name) {
  134. if (attrValidationCache.hasOwnProperty(name)) {
  135. return attrValidationCache[name];
  136. }
  137. const isUnsafe = unsafeAttrCharRE.test(name);
  138. if (isUnsafe) {
  139. console.error(`unsafe attribute name: ${name}`);
  140. }
  141. return (attrValidationCache[name] = !isUnsafe);
  142. }
  143. const propsToAttrMap = {
  144. acceptCharset: 'accept-charset',
  145. className: 'class',
  146. htmlFor: 'for',
  147. httpEquiv: 'http-equiv'
  148. };
  149. /**
  150. * CSS properties that accept plain numbers
  151. */
  152. const isNoUnitNumericStyleProp = /*#__PURE__*/ makeMap(`animation-iteration-count,border-image-outset,border-image-slice,` +
  153. `border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,` +
  154. `columns,flex,flex-grow,flex-positive,flex-shrink,flex-negative,flex-order,` +
  155. `grid-row,grid-row-end,grid-row-span,grid-row-start,grid-column,` +
  156. `grid-column-end,grid-column-span,grid-column-start,font-weight,line-clamp,` +
  157. `line-height,opacity,order,orphans,tab-size,widows,z-index,zoom,` +
  158. // SVG
  159. `fill-opacity,flood-opacity,stop-opacity,stroke-dasharray,stroke-dashoffset,` +
  160. `stroke-miterlimit,stroke-opacity,stroke-width`);
  161. /**
  162. * Known attributes, this is used for stringification of runtime static nodes
  163. * so that we don't stringify bindings that cannot be set from HTML.
  164. * Don't also forget to allow `data-*` and `aria-*`!
  165. * Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
  166. */
  167. const isKnownHtmlAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
  168. `autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +
  169. `border,buffered,capture,challenge,charset,checked,cite,class,code,` +
  170. `codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,` +
  171. `coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,` +
  172. `disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,` +
  173. `formaction,formenctype,formmethod,formnovalidate,formtarget,headers,` +
  174. `height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,` +
  175. `ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,` +
  176. `manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,` +
  177. `open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,` +
  178. `referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,` +
  179. `selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,` +
  180. `start,step,style,summary,tabindex,target,title,translate,type,usemap,` +
  181. `value,width,wrap`);
  182. /**
  183. * Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
  184. */
  185. const isKnownSvgAttr = /*#__PURE__*/ makeMap(`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,` +
  186. `arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,` +
  187. `baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,` +
  188. `clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,` +
  189. `color-interpolation-filters,color-profile,color-rendering,` +
  190. `contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,` +
  191. `descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,` +
  192. `dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,` +
  193. `fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,` +
  194. `font-family,font-size,font-size-adjust,font-stretch,font-style,` +
  195. `font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,` +
  196. `glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,` +
  197. `gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,` +
  198. `horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,` +
  199. `k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,` +
  200. `lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,` +
  201. `marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,` +
  202. `mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,` +
  203. `name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,` +
  204. `overflow,overline-position,overline-thickness,panose-1,paint-order,path,` +
  205. `pathLength,patternContentUnits,patternTransform,patternUnits,ping,` +
  206. `pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,` +
  207. `preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,` +
  208. `rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,` +
  209. `restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,` +
  210. `specularConstant,specularExponent,speed,spreadMethod,startOffset,` +
  211. `stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,` +
  212. `strikethrough-position,strikethrough-thickness,string,stroke,` +
  213. `stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,` +
  214. `stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,` +
  215. `systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,` +
  216. `text-decoration,text-rendering,textLength,to,transform,transform-origin,` +
  217. `type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,` +
  218. `unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,` +
  219. `v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,` +
  220. `vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,` +
  221. `writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,` +
  222. `xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,` +
  223. `xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`);
  224. function normalizeStyle(value) {
  225. if (isArray(value)) {
  226. const res = {};
  227. for (let i = 0; i < value.length; i++) {
  228. const item = value[i];
  229. const normalized = isString(item)
  230. ? parseStringStyle(item)
  231. : normalizeStyle(item);
  232. if (normalized) {
  233. for (const key in normalized) {
  234. res[key] = normalized[key];
  235. }
  236. }
  237. }
  238. return res;
  239. }
  240. else if (isString(value)) {
  241. return value;
  242. }
  243. else if (isObject(value)) {
  244. return value;
  245. }
  246. }
  247. const listDelimiterRE = /;(?![^(]*\))/g;
  248. const propertyDelimiterRE = /:(.+)/;
  249. function parseStringStyle(cssText) {
  250. const ret = {};
  251. cssText.split(listDelimiterRE).forEach(item => {
  252. if (item) {
  253. const tmp = item.split(propertyDelimiterRE);
  254. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  255. }
  256. });
  257. return ret;
  258. }
  259. function stringifyStyle(styles) {
  260. let ret = '';
  261. if (!styles || isString(styles)) {
  262. return ret;
  263. }
  264. for (const key in styles) {
  265. const value = styles[key];
  266. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  267. if (isString(value) ||
  268. (typeof value === 'number' && isNoUnitNumericStyleProp(normalizedKey))) {
  269. // only render valid values
  270. ret += `${normalizedKey}:${value};`;
  271. }
  272. }
  273. return ret;
  274. }
  275. function normalizeClass(value) {
  276. let res = '';
  277. if (isString(value)) {
  278. res = value;
  279. }
  280. else if (isArray(value)) {
  281. for (let i = 0; i < value.length; i++) {
  282. const normalized = normalizeClass(value[i]);
  283. if (normalized) {
  284. res += normalized + ' ';
  285. }
  286. }
  287. }
  288. else if (isObject(value)) {
  289. for (const name in value) {
  290. if (value[name]) {
  291. res += name + ' ';
  292. }
  293. }
  294. }
  295. return res.trim();
  296. }
  297. function normalizeProps(props) {
  298. if (!props)
  299. return null;
  300. let { class: klass, style } = props;
  301. if (klass && !isString(klass)) {
  302. props.class = normalizeClass(klass);
  303. }
  304. if (style) {
  305. props.style = normalizeStyle(style);
  306. }
  307. return props;
  308. }
  309. // These tag configs are shared between compiler-dom and runtime-dom, so they
  310. // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
  311. const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
  312. 'header,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
  313. 'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
  314. 'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +
  315. 'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
  316. 'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
  317. 'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
  318. 'option,output,progress,select,textarea,details,dialog,menu,' +
  319. 'summary,template,blockquote,iframe,tfoot';
  320. // https://developer.mozilla.org/en-US/docs/Web/SVG/Element
  321. const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
  322. 'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
  323. 'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
  324. 'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
  325. 'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
  326. 'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
  327. 'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
  328. 'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
  329. 'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
  330. 'text,textPath,title,tspan,unknown,use,view';
  331. const VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';
  332. /**
  333. * Compiler only.
  334. * Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.
  335. */
  336. const isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);
  337. /**
  338. * Compiler only.
  339. * Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.
  340. */
  341. const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
  342. /**
  343. * Compiler only.
  344. * Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.
  345. */
  346. const isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);
  347. const escapeRE = /["'&<>]/;
  348. function escapeHtml(string) {
  349. const str = '' + string;
  350. const match = escapeRE.exec(str);
  351. if (!match) {
  352. return str;
  353. }
  354. let html = '';
  355. let escaped;
  356. let index;
  357. let lastIndex = 0;
  358. for (index = match.index; index < str.length; index++) {
  359. switch (str.charCodeAt(index)) {
  360. case 34: // "
  361. escaped = '&quot;';
  362. break;
  363. case 38: // &
  364. escaped = '&amp;';
  365. break;
  366. case 39: // '
  367. escaped = '&#39;';
  368. break;
  369. case 60: // <
  370. escaped = '&lt;';
  371. break;
  372. case 62: // >
  373. escaped = '&gt;';
  374. break;
  375. default:
  376. continue;
  377. }
  378. if (lastIndex !== index) {
  379. html += str.slice(lastIndex, index);
  380. }
  381. lastIndex = index + 1;
  382. html += escaped;
  383. }
  384. return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
  385. }
  386. // https://www.w3.org/TR/html52/syntax.html#comments
  387. const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
  388. function escapeHtmlComment(src) {
  389. return src.replace(commentStripRE, '');
  390. }
  391. function looseCompareArrays(a, b) {
  392. if (a.length !== b.length)
  393. return false;
  394. let equal = true;
  395. for (let i = 0; equal && i < a.length; i++) {
  396. equal = looseEqual(a[i], b[i]);
  397. }
  398. return equal;
  399. }
  400. function looseEqual(a, b) {
  401. if (a === b)
  402. return true;
  403. let aValidType = isDate(a);
  404. let bValidType = isDate(b);
  405. if (aValidType || bValidType) {
  406. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  407. }
  408. aValidType = isArray(a);
  409. bValidType = isArray(b);
  410. if (aValidType || bValidType) {
  411. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  412. }
  413. aValidType = isObject(a);
  414. bValidType = isObject(b);
  415. if (aValidType || bValidType) {
  416. /* istanbul ignore if: this if will probably never be called */
  417. if (!aValidType || !bValidType) {
  418. return false;
  419. }
  420. const aKeysCount = Object.keys(a).length;
  421. const bKeysCount = Object.keys(b).length;
  422. if (aKeysCount !== bKeysCount) {
  423. return false;
  424. }
  425. for (const key in a) {
  426. const aHasKey = a.hasOwnProperty(key);
  427. const bHasKey = b.hasOwnProperty(key);
  428. if ((aHasKey && !bHasKey) ||
  429. (!aHasKey && bHasKey) ||
  430. !looseEqual(a[key], b[key])) {
  431. return false;
  432. }
  433. }
  434. }
  435. return String(a) === String(b);
  436. }
  437. function looseIndexOf(arr, val) {
  438. return arr.findIndex(item => looseEqual(item, val));
  439. }
  440. /**
  441. * For converting {{ interpolation }} values to displayed strings.
  442. * @private
  443. */
  444. const toDisplayString = (val) => {
  445. return isString(val)
  446. ? val
  447. : val == null
  448. ? ''
  449. : isArray(val) ||
  450. (isObject(val) &&
  451. (val.toString === objectToString || !isFunction(val.toString)))
  452. ? JSON.stringify(val, replacer, 2)
  453. : String(val);
  454. };
  455. const replacer = (_key, val) => {
  456. // can't use isRef here since @vue/shared has no deps
  457. if (val && val.__v_isRef) {
  458. return replacer(_key, val.value);
  459. }
  460. else if (isMap(val)) {
  461. return {
  462. [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {
  463. entries[`${key} =>`] = val;
  464. return entries;
  465. }, {})
  466. };
  467. }
  468. else if (isSet(val)) {
  469. return {
  470. [`Set(${val.size})`]: [...val.values()]
  471. };
  472. }
  473. else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  474. return String(val);
  475. }
  476. return val;
  477. };
  478. const EMPTY_OBJ = (process.env.NODE_ENV !== 'production')
  479. ? Object.freeze({})
  480. : {};
  481. const EMPTY_ARR = (process.env.NODE_ENV !== 'production') ? Object.freeze([]) : [];
  482. const NOOP = () => { };
  483. /**
  484. * Always return false.
  485. */
  486. const NO = () => false;
  487. const onRE = /^on[^a-z]/;
  488. const isOn = (key) => onRE.test(key);
  489. const isModelListener = (key) => key.startsWith('onUpdate:');
  490. const extend = Object.assign;
  491. const remove = (arr, el) => {
  492. const i = arr.indexOf(el);
  493. if (i > -1) {
  494. arr.splice(i, 1);
  495. }
  496. };
  497. const hasOwnProperty = Object.prototype.hasOwnProperty;
  498. const hasOwn = (val, key) => hasOwnProperty.call(val, key);
  499. const isArray = Array.isArray;
  500. const isMap = (val) => toTypeString(val) === '[object Map]';
  501. const isSet = (val) => toTypeString(val) === '[object Set]';
  502. const isDate = (val) => val instanceof Date;
  503. const isFunction = (val) => typeof val === 'function';
  504. const isString = (val) => typeof val === 'string';
  505. const isSymbol = (val) => typeof val === 'symbol';
  506. const isObject = (val) => val !== null && typeof val === 'object';
  507. const isPromise = (val) => {
  508. return isObject(val) && isFunction(val.then) && isFunction(val.catch);
  509. };
  510. const objectToString = Object.prototype.toString;
  511. const toTypeString = (value) => objectToString.call(value);
  512. const toRawType = (value) => {
  513. // extract "RawType" from strings like "[object RawType]"
  514. return toTypeString(value).slice(8, -1);
  515. };
  516. const isPlainObject = (val) => toTypeString(val) === '[object Object]';
  517. const isIntegerKey = (key) => isString(key) &&
  518. key !== 'NaN' &&
  519. key[0] !== '-' &&
  520. '' + parseInt(key, 10) === key;
  521. const isReservedProp = /*#__PURE__*/ makeMap(
  522. // the leading comma is intentional so empty string "" is also included
  523. ',key,ref,ref_for,ref_key,' +
  524. 'onVnodeBeforeMount,onVnodeMounted,' +
  525. 'onVnodeBeforeUpdate,onVnodeUpdated,' +
  526. 'onVnodeBeforeUnmount,onVnodeUnmounted');
  527. const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
  528. const cacheStringFunction$1 = (fn) => {
  529. const cache = Object.create(null);
  530. return ((str) => {
  531. const hit = cache[str];
  532. return hit || (cache[str] = fn(str));
  533. });
  534. };
  535. const camelizeRE$1 = /-(\w)/g;
  536. /**
  537. * @private
  538. */
  539. const camelize$1 = cacheStringFunction$1((str) => {
  540. return str.replace(camelizeRE$1, (_, c) => (c ? c.toUpperCase() : ''));
  541. });
  542. const hyphenateRE = /\B([A-Z])/g;
  543. /**
  544. * @private
  545. */
  546. const hyphenate = cacheStringFunction$1((str) => str.replace(hyphenateRE, '-$1').toLowerCase());
  547. /**
  548. * @private
  549. */
  550. const capitalize = cacheStringFunction$1((str) => str.charAt(0).toUpperCase() + str.slice(1));
  551. /**
  552. * @private
  553. */
  554. const toHandlerKey = cacheStringFunction$1((str) => str ? `on${capitalize(str)}` : ``);
  555. // compare whether a value has changed, accounting for NaN.
  556. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  557. const invokeArrayFns = (fns, arg) => {
  558. for (let i = 0; i < fns.length; i++) {
  559. fns[i](arg);
  560. }
  561. };
  562. const def = (obj, key, value) => {
  563. Object.defineProperty(obj, key, {
  564. configurable: true,
  565. enumerable: false,
  566. value
  567. });
  568. };
  569. const toNumber = (val) => {
  570. const n = parseFloat(val);
  571. return isNaN(n) ? val : n;
  572. };
  573. let _globalThis;
  574. const getGlobalThis = () => {
  575. return (_globalThis ||
  576. (_globalThis =
  577. typeof globalThis !== 'undefined'
  578. ? globalThis
  579. : typeof self !== 'undefined'
  580. ? self
  581. : typeof window !== 'undefined'
  582. ? window
  583. : typeof global !== 'undefined'
  584. ? global
  585. : {}));
  586. };
  587. var shared_esmBundler = {
  588. __proto__: null,
  589. EMPTY_ARR: EMPTY_ARR,
  590. EMPTY_OBJ: EMPTY_OBJ,
  591. NO: NO,
  592. NOOP: NOOP,
  593. PatchFlagNames: PatchFlagNames,
  594. camelize: camelize$1,
  595. capitalize: capitalize,
  596. def: def,
  597. escapeHtml: escapeHtml,
  598. escapeHtmlComment: escapeHtmlComment,
  599. extend: extend,
  600. generateCodeFrame: generateCodeFrame,
  601. getGlobalThis: getGlobalThis,
  602. hasChanged: hasChanged,
  603. hasOwn: hasOwn,
  604. hyphenate: hyphenate,
  605. includeBooleanAttr: includeBooleanAttr,
  606. invokeArrayFns: invokeArrayFns,
  607. isArray: isArray,
  608. isBooleanAttr: isBooleanAttr,
  609. isBuiltInDirective: isBuiltInDirective,
  610. isDate: isDate,
  611. isFunction: isFunction,
  612. isGloballyWhitelisted: isGloballyWhitelisted,
  613. isHTMLTag: isHTMLTag,
  614. isIntegerKey: isIntegerKey,
  615. isKnownHtmlAttr: isKnownHtmlAttr,
  616. isKnownSvgAttr: isKnownSvgAttr,
  617. isMap: isMap,
  618. isModelListener: isModelListener,
  619. isNoUnitNumericStyleProp: isNoUnitNumericStyleProp,
  620. isObject: isObject,
  621. isOn: isOn,
  622. isPlainObject: isPlainObject,
  623. isPromise: isPromise,
  624. isReservedProp: isReservedProp,
  625. isSSRSafeAttrName: isSSRSafeAttrName,
  626. isSVGTag: isSVGTag,
  627. isSet: isSet,
  628. isSpecialBooleanAttr: isSpecialBooleanAttr,
  629. isString: isString,
  630. isSymbol: isSymbol,
  631. isVoidTag: isVoidTag,
  632. looseEqual: looseEqual,
  633. looseIndexOf: looseIndexOf,
  634. makeMap: makeMap,
  635. normalizeClass: normalizeClass,
  636. normalizeProps: normalizeProps,
  637. normalizeStyle: normalizeStyle,
  638. objectToString: objectToString,
  639. parseStringStyle: parseStringStyle,
  640. propsToAttrMap: propsToAttrMap,
  641. remove: remove,
  642. slotFlagsText: slotFlagsText,
  643. stringifyStyle: stringifyStyle,
  644. toDisplayString: toDisplayString,
  645. toHandlerKey: toHandlerKey,
  646. toNumber: toNumber,
  647. toRawType: toRawType,
  648. toTypeString: toTypeString
  649. };
  650. function defaultOnError(error) {
  651. throw error;
  652. }
  653. function defaultOnWarn(msg) {
  654. (process.env.NODE_ENV !== 'production') && console.warn(`[Vue warn] ${msg.message}`);
  655. }
  656. function createCompilerError(code, loc, messages, additionalMessage) {
  657. const msg = (process.env.NODE_ENV !== 'production') || !true
  658. ? (messages || errorMessages)[code] + (additionalMessage || ``)
  659. : code;
  660. const error = new SyntaxError(String(msg));
  661. error.code = code;
  662. error.loc = loc;
  663. return error;
  664. }
  665. const errorMessages = {
  666. // parse errors
  667. [0 /* ABRUPT_CLOSING_OF_EMPTY_COMMENT */]: 'Illegal comment.',
  668. [1 /* CDATA_IN_HTML_CONTENT */]: 'CDATA section is allowed only in XML context.',
  669. [2 /* DUPLICATE_ATTRIBUTE */]: 'Duplicate attribute.',
  670. [3 /* END_TAG_WITH_ATTRIBUTES */]: 'End tag cannot have attributes.',
  671. [4 /* END_TAG_WITH_TRAILING_SOLIDUS */]: "Illegal '/' in tags.",
  672. [5 /* EOF_BEFORE_TAG_NAME */]: 'Unexpected EOF in tag.',
  673. [6 /* EOF_IN_CDATA */]: 'Unexpected EOF in CDATA section.',
  674. [7 /* EOF_IN_COMMENT */]: 'Unexpected EOF in comment.',
  675. [8 /* EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT */]: 'Unexpected EOF in script.',
  676. [9 /* EOF_IN_TAG */]: 'Unexpected EOF in tag.',
  677. [10 /* INCORRECTLY_CLOSED_COMMENT */]: 'Incorrectly closed comment.',
  678. [11 /* INCORRECTLY_OPENED_COMMENT */]: 'Incorrectly opened comment.',
  679. [12 /* INVALID_FIRST_CHARACTER_OF_TAG_NAME */]: "Illegal tag name. Use '&lt;' to print '<'.",
  680. [13 /* MISSING_ATTRIBUTE_VALUE */]: 'Attribute value was expected.',
  681. [14 /* MISSING_END_TAG_NAME */]: 'End tag name was expected.',
  682. [15 /* MISSING_WHITESPACE_BETWEEN_ATTRIBUTES */]: 'Whitespace was expected.',
  683. [16 /* NESTED_COMMENT */]: "Unexpected '<!--' in comment.",
  684. [17 /* UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME */]: 'Attribute name cannot contain U+0022 ("), U+0027 (\'), and U+003C (<).',
  685. [18 /* UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE */]: 'Unquoted attribute value cannot contain U+0022 ("), U+0027 (\'), U+003C (<), U+003D (=), and U+0060 (`).',
  686. [19 /* UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME */]: "Attribute name cannot start with '='.",
  687. [21 /* UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME */]: "'<?' is allowed only in XML context.",
  688. [20 /* UNEXPECTED_NULL_CHARACTER */]: `Unexpected null character.`,
  689. [22 /* UNEXPECTED_SOLIDUS_IN_TAG */]: "Illegal '/' in tags.",
  690. // Vue-specific parse errors
  691. [23 /* X_INVALID_END_TAG */]: 'Invalid end tag.',
  692. [24 /* X_MISSING_END_TAG */]: 'Element is missing end tag.',
  693. [25 /* X_MISSING_INTERPOLATION_END */]: 'Interpolation end sign was not found.',
  694. [27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */]: 'End bracket for dynamic directive argument was not found. ' +
  695. 'Note that dynamic directive argument cannot contain spaces.',
  696. [26 /* X_MISSING_DIRECTIVE_NAME */]: 'Legal directive name was expected.',
  697. // transform errors
  698. [28 /* X_V_IF_NO_EXPRESSION */]: `v-if/v-else-if is missing expression.`,
  699. [29 /* X_V_IF_SAME_KEY */]: `v-if/else branches must use unique keys.`,
  700. [30 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
  701. [31 /* X_V_FOR_NO_EXPRESSION */]: `v-for is missing expression.`,
  702. [32 /* X_V_FOR_MALFORMED_EXPRESSION */]: `v-for has invalid expression.`,
  703. [33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */]: `<template v-for> key should be placed on the <template> tag.`,
  704. [34 /* X_V_BIND_NO_EXPRESSION */]: `v-bind is missing expression.`,
  705. [35 /* X_V_ON_NO_EXPRESSION */]: `v-on is missing expression.`,
  706. [36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */]: `Unexpected custom directive on <slot> outlet.`,
  707. [37 /* X_V_SLOT_MIXED_SLOT_USAGE */]: `Mixed v-slot usage on both the component and nested <template>.` +
  708. `When there are multiple named slots, all slots should use <template> ` +
  709. `syntax to avoid scope ambiguity.`,
  710. [38 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */]: `Duplicate slot names found. `,
  711. [39 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */]: `Extraneous children found when component already has explicitly named ` +
  712. `default slot. These children will be ignored.`,
  713. [40 /* X_V_SLOT_MISPLACED */]: `v-slot can only be used on components or <template> tags.`,
  714. [41 /* X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
  715. [42 /* X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
  716. [43 /* X_V_MODEL_ON_SCOPE_VARIABLE */]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
  717. [44 /* X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
  718. [45 /* X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
  719. // generic errors
  720. [46 /* X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
  721. [47 /* X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
  722. [48 /* X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
  723. [49 /* X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
  724. // just to fulfill types
  725. [50 /* __EXTEND_POINT__ */]: ``
  726. };
  727. const FRAGMENT = Symbol((process.env.NODE_ENV !== 'production') ? `Fragment` : ``);
  728. const TELEPORT = Symbol((process.env.NODE_ENV !== 'production') ? `Teleport` : ``);
  729. const SUSPENSE = Symbol((process.env.NODE_ENV !== 'production') ? `Suspense` : ``);
  730. const KEEP_ALIVE = Symbol((process.env.NODE_ENV !== 'production') ? `KeepAlive` : ``);
  731. const BASE_TRANSITION = Symbol((process.env.NODE_ENV !== 'production') ? `BaseTransition` : ``);
  732. const OPEN_BLOCK = Symbol((process.env.NODE_ENV !== 'production') ? `openBlock` : ``);
  733. const CREATE_BLOCK = Symbol((process.env.NODE_ENV !== 'production') ? `createBlock` : ``);
  734. const CREATE_ELEMENT_BLOCK = Symbol((process.env.NODE_ENV !== 'production') ? `createElementBlock` : ``);
  735. const CREATE_VNODE = Symbol((process.env.NODE_ENV !== 'production') ? `createVNode` : ``);
  736. const CREATE_ELEMENT_VNODE = Symbol((process.env.NODE_ENV !== 'production') ? `createElementVNode` : ``);
  737. const CREATE_COMMENT = Symbol((process.env.NODE_ENV !== 'production') ? `createCommentVNode` : ``);
  738. const CREATE_TEXT = Symbol((process.env.NODE_ENV !== 'production') ? `createTextVNode` : ``);
  739. const CREATE_STATIC = Symbol((process.env.NODE_ENV !== 'production') ? `createStaticVNode` : ``);
  740. const RESOLVE_COMPONENT = Symbol((process.env.NODE_ENV !== 'production') ? `resolveComponent` : ``);
  741. const RESOLVE_DYNAMIC_COMPONENT = Symbol((process.env.NODE_ENV !== 'production') ? `resolveDynamicComponent` : ``);
  742. const RESOLVE_DIRECTIVE = Symbol((process.env.NODE_ENV !== 'production') ? `resolveDirective` : ``);
  743. const RESOLVE_FILTER = Symbol((process.env.NODE_ENV !== 'production') ? `resolveFilter` : ``);
  744. const WITH_DIRECTIVES = Symbol((process.env.NODE_ENV !== 'production') ? `withDirectives` : ``);
  745. const RENDER_LIST = Symbol((process.env.NODE_ENV !== 'production') ? `renderList` : ``);
  746. const RENDER_SLOT = Symbol((process.env.NODE_ENV !== 'production') ? `renderSlot` : ``);
  747. const CREATE_SLOTS = Symbol((process.env.NODE_ENV !== 'production') ? `createSlots` : ``);
  748. const TO_DISPLAY_STRING = Symbol((process.env.NODE_ENV !== 'production') ? `toDisplayString` : ``);
  749. const MERGE_PROPS = Symbol((process.env.NODE_ENV !== 'production') ? `mergeProps` : ``);
  750. const NORMALIZE_CLASS = Symbol((process.env.NODE_ENV !== 'production') ? `normalizeClass` : ``);
  751. const NORMALIZE_STYLE = Symbol((process.env.NODE_ENV !== 'production') ? `normalizeStyle` : ``);
  752. const NORMALIZE_PROPS = Symbol((process.env.NODE_ENV !== 'production') ? `normalizeProps` : ``);
  753. const GUARD_REACTIVE_PROPS = Symbol((process.env.NODE_ENV !== 'production') ? `guardReactiveProps` : ``);
  754. const TO_HANDLERS = Symbol((process.env.NODE_ENV !== 'production') ? `toHandlers` : ``);
  755. const CAMELIZE = Symbol((process.env.NODE_ENV !== 'production') ? `camelize` : ``);
  756. const CAPITALIZE = Symbol((process.env.NODE_ENV !== 'production') ? `capitalize` : ``);
  757. const TO_HANDLER_KEY = Symbol((process.env.NODE_ENV !== 'production') ? `toHandlerKey` : ``);
  758. const SET_BLOCK_TRACKING = Symbol((process.env.NODE_ENV !== 'production') ? `setBlockTracking` : ``);
  759. const PUSH_SCOPE_ID = Symbol((process.env.NODE_ENV !== 'production') ? `pushScopeId` : ``);
  760. const POP_SCOPE_ID = Symbol((process.env.NODE_ENV !== 'production') ? `popScopeId` : ``);
  761. const WITH_CTX = Symbol((process.env.NODE_ENV !== 'production') ? `withCtx` : ``);
  762. const UNREF = Symbol((process.env.NODE_ENV !== 'production') ? `unref` : ``);
  763. const IS_REF = Symbol((process.env.NODE_ENV !== 'production') ? `isRef` : ``);
  764. const WITH_MEMO = Symbol((process.env.NODE_ENV !== 'production') ? `withMemo` : ``);
  765. const IS_MEMO_SAME = Symbol((process.env.NODE_ENV !== 'production') ? `isMemoSame` : ``);
  766. // Name mapping for runtime helpers that need to be imported from 'vue' in
  767. // generated code. Make sure these are correctly exported in the runtime!
  768. // Using `any` here because TS doesn't allow symbols as index type.
  769. const helperNameMap = {
  770. [FRAGMENT]: `Fragment`,
  771. [TELEPORT]: `Teleport`,
  772. [SUSPENSE]: `Suspense`,
  773. [KEEP_ALIVE]: `KeepAlive`,
  774. [BASE_TRANSITION]: `BaseTransition`,
  775. [OPEN_BLOCK]: `openBlock`,
  776. [CREATE_BLOCK]: `createBlock`,
  777. [CREATE_ELEMENT_BLOCK]: `createElementBlock`,
  778. [CREATE_VNODE]: `createVNode`,
  779. [CREATE_ELEMENT_VNODE]: `createElementVNode`,
  780. [CREATE_COMMENT]: `createCommentVNode`,
  781. [CREATE_TEXT]: `createTextVNode`,
  782. [CREATE_STATIC]: `createStaticVNode`,
  783. [RESOLVE_COMPONENT]: `resolveComponent`,
  784. [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`,
  785. [RESOLVE_DIRECTIVE]: `resolveDirective`,
  786. [RESOLVE_FILTER]: `resolveFilter`,
  787. [WITH_DIRECTIVES]: `withDirectives`,
  788. [RENDER_LIST]: `renderList`,
  789. [RENDER_SLOT]: `renderSlot`,
  790. [CREATE_SLOTS]: `createSlots`,
  791. [TO_DISPLAY_STRING]: `toDisplayString`,
  792. [MERGE_PROPS]: `mergeProps`,
  793. [NORMALIZE_CLASS]: `normalizeClass`,
  794. [NORMALIZE_STYLE]: `normalizeStyle`,
  795. [NORMALIZE_PROPS]: `normalizeProps`,
  796. [GUARD_REACTIVE_PROPS]: `guardReactiveProps`,
  797. [TO_HANDLERS]: `toHandlers`,
  798. [CAMELIZE]: `camelize`,
  799. [CAPITALIZE]: `capitalize`,
  800. [TO_HANDLER_KEY]: `toHandlerKey`,
  801. [SET_BLOCK_TRACKING]: `setBlockTracking`,
  802. [PUSH_SCOPE_ID]: `pushScopeId`,
  803. [POP_SCOPE_ID]: `popScopeId`,
  804. [WITH_CTX]: `withCtx`,
  805. [UNREF]: `unref`,
  806. [IS_REF]: `isRef`,
  807. [WITH_MEMO]: `withMemo`,
  808. [IS_MEMO_SAME]: `isMemoSame`
  809. };
  810. function registerRuntimeHelpers(helpers) {
  811. Object.getOwnPropertySymbols(helpers).forEach(s => {
  812. helperNameMap[s] = helpers[s];
  813. });
  814. }
  815. // AST Utilities ---------------------------------------------------------------
  816. // Some expressions, e.g. sequence and conditional expressions, are never
  817. // associated with template nodes, so their source locations are just a stub.
  818. // Container types like CompoundExpression also don't need a real location.
  819. const locStub = {
  820. source: '',
  821. start: { line: 1, column: 1, offset: 0 },
  822. end: { line: 1, column: 1, offset: 0 }
  823. };
  824. function createRoot(children, loc = locStub) {
  825. return {
  826. type: 0 /* ROOT */,
  827. children,
  828. helpers: [],
  829. components: [],
  830. directives: [],
  831. hoists: [],
  832. imports: [],
  833. cached: 0,
  834. temps: 0,
  835. codegenNode: undefined,
  836. loc
  837. };
  838. }
  839. function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
  840. if (context) {
  841. if (isBlock) {
  842. context.helper(OPEN_BLOCK);
  843. context.helper(getVNodeBlockHelper(context.inSSR, isComponent));
  844. }
  845. else {
  846. context.helper(getVNodeHelper(context.inSSR, isComponent));
  847. }
  848. if (directives) {
  849. context.helper(WITH_DIRECTIVES);
  850. }
  851. }
  852. return {
  853. type: 13 /* VNODE_CALL */,
  854. tag,
  855. props,
  856. children,
  857. patchFlag,
  858. dynamicProps,
  859. directives,
  860. isBlock,
  861. disableTracking,
  862. isComponent,
  863. loc
  864. };
  865. }
  866. function createArrayExpression(elements, loc = locStub) {
  867. return {
  868. type: 17 /* JS_ARRAY_EXPRESSION */,
  869. loc,
  870. elements
  871. };
  872. }
  873. function createObjectExpression(properties, loc = locStub) {
  874. return {
  875. type: 15 /* JS_OBJECT_EXPRESSION */,
  876. loc,
  877. properties
  878. };
  879. }
  880. function createObjectProperty(key, value) {
  881. return {
  882. type: 16 /* JS_PROPERTY */,
  883. loc: locStub,
  884. key: isString(key) ? createSimpleExpression(key, true) : key,
  885. value
  886. };
  887. }
  888. function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0 /* NOT_CONSTANT */) {
  889. return {
  890. type: 4 /* SIMPLE_EXPRESSION */,
  891. loc,
  892. content,
  893. isStatic,
  894. constType: isStatic ? 3 /* CAN_STRINGIFY */ : constType
  895. };
  896. }
  897. function createInterpolation(content, loc) {
  898. return {
  899. type: 5 /* INTERPOLATION */,
  900. loc,
  901. content: isString(content)
  902. ? createSimpleExpression(content, false, loc)
  903. : content
  904. };
  905. }
  906. function createCompoundExpression(children, loc = locStub) {
  907. return {
  908. type: 8 /* COMPOUND_EXPRESSION */,
  909. loc,
  910. children
  911. };
  912. }
  913. function createCallExpression(callee, args = [], loc = locStub) {
  914. return {
  915. type: 14 /* JS_CALL_EXPRESSION */,
  916. loc,
  917. callee,
  918. arguments: args
  919. };
  920. }
  921. function createFunctionExpression(params, returns = undefined, newline = false, isSlot = false, loc = locStub) {
  922. return {
  923. type: 18 /* JS_FUNCTION_EXPRESSION */,
  924. params,
  925. returns,
  926. newline,
  927. isSlot,
  928. loc
  929. };
  930. }
  931. function createConditionalExpression(test, consequent, alternate, newline = true) {
  932. return {
  933. type: 19 /* JS_CONDITIONAL_EXPRESSION */,
  934. test,
  935. consequent,
  936. alternate,
  937. newline,
  938. loc: locStub
  939. };
  940. }
  941. function createCacheExpression(index, value, isVNode = false) {
  942. return {
  943. type: 20 /* JS_CACHE_EXPRESSION */,
  944. index,
  945. value,
  946. isVNode,
  947. loc: locStub
  948. };
  949. }
  950. function createBlockStatement(body) {
  951. return {
  952. type: 21 /* JS_BLOCK_STATEMENT */,
  953. body,
  954. loc: locStub
  955. };
  956. }
  957. function createTemplateLiteral(elements) {
  958. return {
  959. type: 22 /* JS_TEMPLATE_LITERAL */,
  960. elements,
  961. loc: locStub
  962. };
  963. }
  964. function createIfStatement(test, consequent, alternate) {
  965. return {
  966. type: 23 /* JS_IF_STATEMENT */,
  967. test,
  968. consequent,
  969. alternate,
  970. loc: locStub
  971. };
  972. }
  973. function createAssignmentExpression(left, right) {
  974. return {
  975. type: 24 /* JS_ASSIGNMENT_EXPRESSION */,
  976. left,
  977. right,
  978. loc: locStub
  979. };
  980. }
  981. function createSequenceExpression(expressions) {
  982. return {
  983. type: 25 /* JS_SEQUENCE_EXPRESSION */,
  984. expressions,
  985. loc: locStub
  986. };
  987. }
  988. function createReturnStatement(returns) {
  989. return {
  990. type: 26 /* JS_RETURN_STATEMENT */,
  991. returns,
  992. loc: locStub
  993. };
  994. }
  995. const isStaticExp = (p) => p.type === 4 /* SIMPLE_EXPRESSION */ && p.isStatic;
  996. const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
  997. function isCoreComponent(tag) {
  998. if (isBuiltInType(tag, 'Teleport')) {
  999. return TELEPORT;
  1000. }
  1001. else if (isBuiltInType(tag, 'Suspense')) {
  1002. return SUSPENSE;
  1003. }
  1004. else if (isBuiltInType(tag, 'KeepAlive')) {
  1005. return KEEP_ALIVE;
  1006. }
  1007. else if (isBuiltInType(tag, 'BaseTransition')) {
  1008. return BASE_TRANSITION;
  1009. }
  1010. }
  1011. const nonIdentifierRE = /^\d|[^\$\w]/;
  1012. const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
  1013. const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
  1014. const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
  1015. const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
  1016. /**
  1017. * Simple lexer to check if an expression is a member expression. This is
  1018. * lax and only checks validity at the root level (i.e. does not validate exps
  1019. * inside square brackets), but it's ok since these are only used on template
  1020. * expressions and false positives are invalid expressions in the first place.
  1021. */
  1022. const isMemberExpressionBrowser = (path) => {
  1023. // remove whitespaces around . or [ first
  1024. path = path.trim().replace(whitespaceRE, s => s.trim());
  1025. let state = 0 /* inMemberExp */;
  1026. let stateStack = [];
  1027. let currentOpenBracketCount = 0;
  1028. let currentOpenParensCount = 0;
  1029. let currentStringType = null;
  1030. for (let i = 0; i < path.length; i++) {
  1031. const char = path.charAt(i);
  1032. switch (state) {
  1033. case 0 /* inMemberExp */:
  1034. if (char === '[') {
  1035. stateStack.push(state);
  1036. state = 1 /* inBrackets */;
  1037. currentOpenBracketCount++;
  1038. }
  1039. else if (char === '(') {
  1040. stateStack.push(state);
  1041. state = 2 /* inParens */;
  1042. currentOpenParensCount++;
  1043. }
  1044. else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
  1045. return false;
  1046. }
  1047. break;
  1048. case 1 /* inBrackets */:
  1049. if (char === `'` || char === `"` || char === '`') {
  1050. stateStack.push(state);
  1051. state = 3 /* inString */;
  1052. currentStringType = char;
  1053. }
  1054. else if (char === `[`) {
  1055. currentOpenBracketCount++;
  1056. }
  1057. else if (char === `]`) {
  1058. if (!--currentOpenBracketCount) {
  1059. state = stateStack.pop();
  1060. }
  1061. }
  1062. break;
  1063. case 2 /* inParens */:
  1064. if (char === `'` || char === `"` || char === '`') {
  1065. stateStack.push(state);
  1066. state = 3 /* inString */;
  1067. currentStringType = char;
  1068. }
  1069. else if (char === `(`) {
  1070. currentOpenParensCount++;
  1071. }
  1072. else if (char === `)`) {
  1073. // if the exp ends as a call then it should not be considered valid
  1074. if (i === path.length - 1) {
  1075. return false;
  1076. }
  1077. if (!--currentOpenParensCount) {
  1078. state = stateStack.pop();
  1079. }
  1080. }
  1081. break;
  1082. case 3 /* inString */:
  1083. if (char === currentStringType) {
  1084. state = stateStack.pop();
  1085. currentStringType = null;
  1086. }
  1087. break;
  1088. }
  1089. }
  1090. return !currentOpenBracketCount && !currentOpenParensCount;
  1091. };
  1092. const isMemberExpressionNode = NOOP
  1093. ;
  1094. const isMemberExpression = isMemberExpressionBrowser
  1095. ;
  1096. function getInnerRange(loc, offset, length) {
  1097. const source = loc.source.slice(offset, offset + length);
  1098. const newLoc = {
  1099. source,
  1100. start: advancePositionWithClone(loc.start, loc.source, offset),
  1101. end: loc.end
  1102. };
  1103. if (length != null) {
  1104. newLoc.end = advancePositionWithClone(loc.start, loc.source, offset + length);
  1105. }
  1106. return newLoc;
  1107. }
  1108. function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
  1109. return advancePositionWithMutation(extend({}, pos), source, numberOfCharacters);
  1110. }
  1111. // advance by mutation without cloning (for performance reasons), since this
  1112. // gets called a lot in the parser
  1113. function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {
  1114. let linesCount = 0;
  1115. let lastNewLinePos = -1;
  1116. for (let i = 0; i < numberOfCharacters; i++) {
  1117. if (source.charCodeAt(i) === 10 /* newline char code */) {
  1118. linesCount++;
  1119. lastNewLinePos = i;
  1120. }
  1121. }
  1122. pos.offset += numberOfCharacters;
  1123. pos.line += linesCount;
  1124. pos.column =
  1125. lastNewLinePos === -1
  1126. ? pos.column + numberOfCharacters
  1127. : numberOfCharacters - lastNewLinePos;
  1128. return pos;
  1129. }
  1130. function assert(condition, msg) {
  1131. /* istanbul ignore if */
  1132. if (!condition) {
  1133. throw new Error(msg || `unexpected compiler condition`);
  1134. }
  1135. }
  1136. function findDir(node, name, allowEmpty = false) {
  1137. for (let i = 0; i < node.props.length; i++) {
  1138. const p = node.props[i];
  1139. if (p.type === 7 /* DIRECTIVE */ &&
  1140. (allowEmpty || p.exp) &&
  1141. (isString(name) ? p.name === name : name.test(p.name))) {
  1142. return p;
  1143. }
  1144. }
  1145. }
  1146. function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
  1147. for (let i = 0; i < node.props.length; i++) {
  1148. const p = node.props[i];
  1149. if (p.type === 6 /* ATTRIBUTE */) {
  1150. if (dynamicOnly)
  1151. continue;
  1152. if (p.name === name && (p.value || allowEmpty)) {
  1153. return p;
  1154. }
  1155. }
  1156. else if (p.name === 'bind' &&
  1157. (p.exp || allowEmpty) &&
  1158. isStaticArgOf(p.arg, name)) {
  1159. return p;
  1160. }
  1161. }
  1162. }
  1163. function isStaticArgOf(arg, name) {
  1164. return !!(arg && isStaticExp(arg) && arg.content === name);
  1165. }
  1166. function hasDynamicKeyVBind(node) {
  1167. return node.props.some(p => p.type === 7 /* DIRECTIVE */ &&
  1168. p.name === 'bind' &&
  1169. (!p.arg || // v-bind="obj"
  1170. p.arg.type !== 4 /* SIMPLE_EXPRESSION */ || // v-bind:[_ctx.foo]
  1171. !p.arg.isStatic) // v-bind:[foo]
  1172. );
  1173. }
  1174. function isText(node) {
  1175. return node.type === 5 /* INTERPOLATION */ || node.type === 2 /* TEXT */;
  1176. }
  1177. function isVSlot(p) {
  1178. return p.type === 7 /* DIRECTIVE */ && p.name === 'slot';
  1179. }
  1180. function isTemplateNode(node) {
  1181. return (node.type === 1 /* ELEMENT */ && node.tagType === 3 /* TEMPLATE */);
  1182. }
  1183. function isSlotOutlet(node) {
  1184. return node.type === 1 /* ELEMENT */ && node.tagType === 2 /* SLOT */;
  1185. }
  1186. function getVNodeHelper(ssr, isComponent) {
  1187. return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
  1188. }
  1189. function getVNodeBlockHelper(ssr, isComponent) {
  1190. return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
  1191. }
  1192. const propsHelperSet = new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
  1193. function getUnnormalizedProps(props, callPath = []) {
  1194. if (props &&
  1195. !isString(props) &&
  1196. props.type === 14 /* JS_CALL_EXPRESSION */) {
  1197. const callee = props.callee;
  1198. if (!isString(callee) && propsHelperSet.has(callee)) {
  1199. return getUnnormalizedProps(props.arguments[0], callPath.concat(props));
  1200. }
  1201. }
  1202. return [props, callPath];
  1203. }
  1204. function injectProp(node, prop, context) {
  1205. let propsWithInjection;
  1206. /**
  1207. * 1. mergeProps(...)
  1208. * 2. toHandlers(...)
  1209. * 3. normalizeProps(...)
  1210. * 4. normalizeProps(guardReactiveProps(...))
  1211. *
  1212. * we need to get the real props before normalization
  1213. */
  1214. let props = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
  1215. let callPath = [];
  1216. let parentCall;
  1217. if (props &&
  1218. !isString(props) &&
  1219. props.type === 14 /* JS_CALL_EXPRESSION */) {
  1220. const ret = getUnnormalizedProps(props);
  1221. props = ret[0];
  1222. callPath = ret[1];
  1223. parentCall = callPath[callPath.length - 1];
  1224. }
  1225. if (props == null || isString(props)) {
  1226. propsWithInjection = createObjectExpression([prop]);
  1227. }
  1228. else if (props.type === 14 /* JS_CALL_EXPRESSION */) {
  1229. // merged props... add ours
  1230. // only inject key to object literal if it's the first argument so that
  1231. // if doesn't override user provided keys
  1232. const first = props.arguments[0];
  1233. if (!isString(first) && first.type === 15 /* JS_OBJECT_EXPRESSION */) {
  1234. first.properties.unshift(prop);
  1235. }
  1236. else {
  1237. if (props.callee === TO_HANDLERS) {
  1238. // #2366
  1239. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  1240. createObjectExpression([prop]),
  1241. props
  1242. ]);
  1243. }
  1244. else {
  1245. props.arguments.unshift(createObjectExpression([prop]));
  1246. }
  1247. }
  1248. !propsWithInjection && (propsWithInjection = props);
  1249. }
  1250. else if (props.type === 15 /* JS_OBJECT_EXPRESSION */) {
  1251. let alreadyExists = false;
  1252. // check existing key to avoid overriding user provided keys
  1253. if (prop.key.type === 4 /* SIMPLE_EXPRESSION */) {
  1254. const propKeyName = prop.key.content;
  1255. alreadyExists = props.properties.some(p => p.key.type === 4 /* SIMPLE_EXPRESSION */ &&
  1256. p.key.content === propKeyName);
  1257. }
  1258. if (!alreadyExists) {
  1259. props.properties.unshift(prop);
  1260. }
  1261. propsWithInjection = props;
  1262. }
  1263. else {
  1264. // single v-bind with expression, return a merged replacement
  1265. propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
  1266. createObjectExpression([prop]),
  1267. props
  1268. ]);
  1269. // in the case of nested helper call, e.g. `normalizeProps(guardReactiveProps(props))`,
  1270. // it will be rewritten as `normalizeProps(mergeProps({ key: 0 }, props))`,
  1271. // the `guardReactiveProps` will no longer be needed
  1272. if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
  1273. parentCall = callPath[callPath.length - 2];
  1274. }
  1275. }
  1276. if (node.type === 13 /* VNODE_CALL */) {
  1277. if (parentCall) {
  1278. parentCall.arguments[0] = propsWithInjection;
  1279. }
  1280. else {
  1281. node.props = propsWithInjection;
  1282. }
  1283. }
  1284. else {
  1285. if (parentCall) {
  1286. parentCall.arguments[0] = propsWithInjection;
  1287. }
  1288. else {
  1289. node.arguments[2] = propsWithInjection;
  1290. }
  1291. }
  1292. }
  1293. function toValidAssetId(name, type) {
  1294. // see issue#4422, we need adding identifier on validAssetId if variable `name` has specific character
  1295. return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
  1296. return searchValue === '-' ? '_' : name.charCodeAt(replaceValue).toString();
  1297. })}`;
  1298. }
  1299. // Check if a node contains expressions that reference current context scope ids
  1300. function hasScopeRef(node, ids) {
  1301. if (!node || Object.keys(ids).length === 0) {
  1302. return false;
  1303. }
  1304. switch (node.type) {
  1305. case 1 /* ELEMENT */:
  1306. for (let i = 0; i < node.props.length; i++) {
  1307. const p = node.props[i];
  1308. if (p.type === 7 /* DIRECTIVE */ &&
  1309. (hasScopeRef(p.arg, ids) || hasScopeRef(p.exp, ids))) {
  1310. return true;
  1311. }
  1312. }
  1313. return node.children.some(c => hasScopeRef(c, ids));
  1314. case 11 /* FOR */:
  1315. if (hasScopeRef(node.source, ids)) {
  1316. return true;
  1317. }
  1318. return node.children.some(c => hasScopeRef(c, ids));
  1319. case 9 /* IF */:
  1320. return node.branches.some(b => hasScopeRef(b, ids));
  1321. case 10 /* IF_BRANCH */:
  1322. if (hasScopeRef(node.condition, ids)) {
  1323. return true;
  1324. }
  1325. return node.children.some(c => hasScopeRef(c, ids));
  1326. case 4 /* SIMPLE_EXPRESSION */:
  1327. return (!node.isStatic &&
  1328. isSimpleIdentifier(node.content) &&
  1329. !!ids[node.content]);
  1330. case 8 /* COMPOUND_EXPRESSION */:
  1331. return node.children.some(c => isObject(c) && hasScopeRef(c, ids));
  1332. case 5 /* INTERPOLATION */:
  1333. case 12 /* TEXT_CALL */:
  1334. return hasScopeRef(node.content, ids);
  1335. case 2 /* TEXT */:
  1336. case 3 /* COMMENT */:
  1337. return false;
  1338. default:
  1339. if ((process.env.NODE_ENV !== 'production')) ;
  1340. return false;
  1341. }
  1342. }
  1343. function getMemoedVNodeCall(node) {
  1344. if (node.type === 14 /* JS_CALL_EXPRESSION */ && node.callee === WITH_MEMO) {
  1345. return node.arguments[1].returns;
  1346. }
  1347. else {
  1348. return node;
  1349. }
  1350. }
  1351. function makeBlock(node, { helper, removeHelper, inSSR }) {
  1352. if (!node.isBlock) {
  1353. node.isBlock = true;
  1354. removeHelper(getVNodeHelper(inSSR, node.isComponent));
  1355. helper(OPEN_BLOCK);
  1356. helper(getVNodeBlockHelper(inSSR, node.isComponent));
  1357. }
  1358. }
  1359. const deprecationData = {
  1360. ["COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */]: {
  1361. message: `Platform-native elements with "is" prop will no longer be ` +
  1362. `treated as components in Vue 3 unless the "is" value is explicitly ` +
  1363. `prefixed with "vue:".`,
  1364. link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html`
  1365. },
  1366. ["COMPILER_V_BIND_SYNC" /* COMPILER_V_BIND_SYNC */]: {
  1367. message: key => `.sync modifier for v-bind has been removed. Use v-model with ` +
  1368. `argument instead. \`v-bind:${key}.sync\` should be changed to ` +
  1369. `\`v-model:${key}\`.`,
  1370. link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
  1371. },
  1372. ["COMPILER_V_BIND_PROP" /* COMPILER_V_BIND_PROP */]: {
  1373. message: `.prop modifier for v-bind has been removed and no longer necessary. ` +
  1374. `Vue 3 will automatically set a binding as DOM property when appropriate.`
  1375. },
  1376. ["COMPILER_V_BIND_OBJECT_ORDER" /* COMPILER_V_BIND_OBJECT_ORDER */]: {
  1377. message: `v-bind="obj" usage is now order sensitive and behaves like JavaScript ` +
  1378. `object spread: it will now overwrite an existing non-mergeable attribute ` +
  1379. `that appears before v-bind in the case of conflict. ` +
  1380. `To retain 2.x behavior, move v-bind to make it the first attribute. ` +
  1381. `You can also suppress this warning if the usage is intended.`,
  1382. link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
  1383. },
  1384. ["COMPILER_V_ON_NATIVE" /* COMPILER_V_ON_NATIVE */]: {
  1385. message: `.native modifier for v-on has been removed as is no longer necessary.`,
  1386. link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html`
  1387. },
  1388. ["COMPILER_V_IF_V_FOR_PRECEDENCE" /* COMPILER_V_IF_V_FOR_PRECEDENCE */]: {
  1389. message: `v-if / v-for precedence when used on the same element has changed ` +
  1390. `in Vue 3: v-if now takes higher precedence and will no longer have ` +
  1391. `access to v-for scope variables. It is best to avoid the ambiguity ` +
  1392. `with <template> tags or use a computed property that filters v-for ` +
  1393. `data source.`,
  1394. link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html`
  1395. },
  1396. ["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
  1397. message: `<template> with no special directives will render as a native template ` +
  1398. `element instead of its inner content in Vue 3.`
  1399. },
  1400. ["COMPILER_INLINE_TEMPLATE" /* COMPILER_INLINE_TEMPLATE */]: {
  1401. message: `"inline-template" has been removed in Vue 3.`,
  1402. link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
  1403. },
  1404. ["COMPILER_FILTER" /* COMPILER_FILTERS */]: {
  1405. message: `filters have been removed in Vue 3. ` +
  1406. `The "|" symbol will be treated as native JavaScript bitwise OR operator. ` +
  1407. `Use method calls or computed properties instead.`,
  1408. link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
  1409. }
  1410. };
  1411. function getCompatValue(key, context) {
  1412. const config = context.options
  1413. ? context.options.compatConfig
  1414. : context.compatConfig;
  1415. const value = config && config[key];
  1416. if (key === 'MODE') {
  1417. return value || 3; // compiler defaults to v3 behavior
  1418. }
  1419. else {
  1420. return value;
  1421. }
  1422. }
  1423. function isCompatEnabled(key, context) {
  1424. const mode = getCompatValue('MODE', context);
  1425. const value = getCompatValue(key, context);
  1426. // in v3 mode, only enable if explicitly set to true
  1427. // otherwise enable for any non-false value
  1428. return mode === 3 ? value === true : value !== false;
  1429. }
  1430. function checkCompatEnabled(key, context, loc, ...args) {
  1431. const enabled = isCompatEnabled(key, context);
  1432. if ((process.env.NODE_ENV !== 'production') && enabled) {
  1433. warnDeprecation(key, context, loc, ...args);
  1434. }
  1435. return enabled;
  1436. }
  1437. function warnDeprecation(key, context, loc, ...args) {
  1438. const val = getCompatValue(key, context);
  1439. if (val === 'suppress-warning') {
  1440. return;
  1441. }
  1442. const { message, link } = deprecationData[key];
  1443. const msg = `(deprecation ${key}) ${typeof message === 'function' ? message(...args) : message}${link ? `\n Details: ${link}` : ``}`;
  1444. const err = new SyntaxError(msg);
  1445. err.code = key;
  1446. if (loc)
  1447. err.loc = loc;
  1448. context.onWarn(err);
  1449. }
  1450. // The default decoder only provides escapes for characters reserved as part of
  1451. // the template syntax, and is only used if the custom renderer did not provide
  1452. // a platform-specific decoder.
  1453. const decodeRE = /&(gt|lt|amp|apos|quot);/g;
  1454. const decodeMap = {
  1455. gt: '>',
  1456. lt: '<',
  1457. amp: '&',
  1458. apos: "'",
  1459. quot: '"'
  1460. };
  1461. const defaultParserOptions = {
  1462. delimiters: [`{{`, `}}`],
  1463. getNamespace: () => 0 /* HTML */,
  1464. getTextMode: () => 0 /* DATA */,
  1465. isVoidTag: NO,
  1466. isPreTag: NO,
  1467. isCustomElement: NO,
  1468. decodeEntities: (rawText) => rawText.replace(decodeRE, (_, p1) => decodeMap[p1]),
  1469. onError: defaultOnError,
  1470. onWarn: defaultOnWarn,
  1471. comments: (process.env.NODE_ENV !== 'production')
  1472. };
  1473. function baseParse(content, options = {}) {
  1474. const context = createParserContext(content, options);
  1475. const start = getCursor(context);
  1476. return createRoot(parseChildren(context, 0 /* DATA */, []), getSelection(context, start));
  1477. }
  1478. function createParserContext(content, rawOptions) {
  1479. const options = extend({}, defaultParserOptions);
  1480. let key;
  1481. for (key in rawOptions) {
  1482. // @ts-ignore
  1483. options[key] =
  1484. rawOptions[key] === undefined
  1485. ? defaultParserOptions[key]
  1486. : rawOptions[key];
  1487. }
  1488. return {
  1489. options,
  1490. column: 1,
  1491. line: 1,
  1492. offset: 0,
  1493. originalSource: content,
  1494. source: content,
  1495. inPre: false,
  1496. inVPre: false,
  1497. onWarn: options.onWarn
  1498. };
  1499. }
  1500. function parseChildren(context, mode, ancestors) {
  1501. const parent = last(ancestors);
  1502. const ns = parent ? parent.ns : 0 /* HTML */;
  1503. const nodes = [];
  1504. while (!isEnd(context, mode, ancestors)) {
  1505. const s = context.source;
  1506. let node = undefined;
  1507. if (mode === 0 /* DATA */ || mode === 1 /* RCDATA */) {
  1508. if (!context.inVPre && startsWith(s, context.options.delimiters[0])) {
  1509. // '{{'
  1510. node = parseInterpolation(context, mode);
  1511. }
  1512. else if (mode === 0 /* DATA */ && s[0] === '<') {
  1513. // https://html.spec.whatwg.org/multipage/parsing.html#tag-open-state
  1514. if (s.length === 1) {
  1515. emitError(context, 5 /* EOF_BEFORE_TAG_NAME */, 1);
  1516. }
  1517. else if (s[1] === '!') {
  1518. // https://html.spec.whatwg.org/multipage/parsing.html#markup-declaration-open-state
  1519. if (startsWith(s, '<!--')) {
  1520. node = parseComment(context);
  1521. }
  1522. else if (startsWith(s, '<!DOCTYPE')) {
  1523. // Ignore DOCTYPE by a limitation.
  1524. node = parseBogusComment(context);
  1525. }
  1526. else if (startsWith(s, '<![CDATA[')) {
  1527. if (ns !== 0 /* HTML */) {
  1528. node = parseCDATA(context, ancestors);
  1529. }
  1530. else {
  1531. emitError(context, 1 /* CDATA_IN_HTML_CONTENT */);
  1532. node = parseBogusComment(context);
  1533. }
  1534. }
  1535. else {
  1536. emitError(context, 11 /* INCORRECTLY_OPENED_COMMENT */);
  1537. node = parseBogusComment(context);
  1538. }
  1539. }
  1540. else if (s[1] === '/') {
  1541. // https://html.spec.whatwg.org/multipage/parsing.html#end-tag-open-state
  1542. if (s.length === 2) {
  1543. emitError(context, 5 /* EOF_BEFORE_TAG_NAME */, 2);
  1544. }
  1545. else if (s[2] === '>') {
  1546. emitError(context, 14 /* MISSING_END_TAG_NAME */, 2);
  1547. advanceBy(context, 3);
  1548. continue;
  1549. }
  1550. else if (/[a-z]/i.test(s[2])) {
  1551. emitError(context, 23 /* X_INVALID_END_TAG */);
  1552. parseTag(context, 1 /* End */, parent);
  1553. continue;
  1554. }
  1555. else {
  1556. emitError(context, 12 /* INVALID_FIRST_CHARACTER_OF_TAG_NAME */, 2);
  1557. node = parseBogusComment(context);
  1558. }
  1559. }
  1560. else if (/[a-z]/i.test(s[1])) {
  1561. node = parseElement(context, ancestors);
  1562. // 2.x <template> with no directive compat
  1563. if (isCompatEnabled("COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */, context) &&
  1564. node &&
  1565. node.tag === 'template' &&
  1566. !node.props.some(p => p.type === 7 /* DIRECTIVE */ &&
  1567. isSpecialTemplateDirective(p.name))) {
  1568. (process.env.NODE_ENV !== 'production') &&
  1569. warnDeprecation("COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */, context, node.loc);
  1570. node = node.children;
  1571. }
  1572. }
  1573. else if (s[1] === '?') {
  1574. emitError(context, 21 /* UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME */, 1);
  1575. node = parseBogusComment(context);
  1576. }
  1577. else {
  1578. emitError(context, 12 /* INVALID_FIRST_CHARACTER_OF_TAG_NAME */, 1);
  1579. }
  1580. }
  1581. }
  1582. if (!node) {
  1583. node = parseText(context, mode);
  1584. }
  1585. if (isArray(node)) {
  1586. for (let i = 0; i < node.length; i++) {
  1587. pushNode(nodes, node[i]);
  1588. }
  1589. }
  1590. else {
  1591. pushNode(nodes, node);
  1592. }
  1593. }
  1594. // Whitespace handling strategy like v2
  1595. let removedWhitespace = false;
  1596. if (mode !== 2 /* RAWTEXT */ && mode !== 1 /* RCDATA */) {
  1597. const shouldCondense = context.options.whitespace !== 'preserve';
  1598. for (let i = 0; i < nodes.length; i++) {
  1599. const node = nodes[i];
  1600. if (!context.inPre && node.type === 2 /* TEXT */) {
  1601. if (!/[^\t\r\n\f ]/.test(node.content)) {
  1602. const prev = nodes[i - 1];
  1603. const next = nodes[i + 1];
  1604. // Remove if:
  1605. // - the whitespace is the first or last node, or:
  1606. // - (condense mode) the whitespace is adjacent to a comment, or:
  1607. // - (condense mode) the whitespace is between two elements AND contains newline
  1608. if (!prev ||
  1609. !next ||
  1610. (shouldCondense &&
  1611. (prev.type === 3 /* COMMENT */ ||
  1612. next.type === 3 /* COMMENT */ ||
  1613. (prev.type === 1 /* ELEMENT */ &&
  1614. next.type === 1 /* ELEMENT */ &&
  1615. /[\r\n]/.test(node.content))))) {
  1616. removedWhitespace = true;
  1617. nodes[i] = null;
  1618. }
  1619. else {
  1620. // Otherwise, the whitespace is condensed into a single space
  1621. node.content = ' ';
  1622. }
  1623. }
  1624. else if (shouldCondense) {
  1625. // in condense mode, consecutive whitespaces in text are condensed
  1626. // down to a single space.
  1627. node.content = node.content.replace(/[\t\r\n\f ]+/g, ' ');
  1628. }
  1629. }
  1630. // Remove comment nodes if desired by configuration.
  1631. else if (node.type === 3 /* COMMENT */ && !context.options.comments) {
  1632. removedWhitespace = true;
  1633. nodes[i] = null;
  1634. }
  1635. }
  1636. if (context.inPre && parent && context.options.isPreTag(parent.tag)) {
  1637. // remove leading newline per html spec
  1638. // https://html.spec.whatwg.org/multipage/grouping-content.html#the-pre-element
  1639. const first = nodes[0];
  1640. if (first && first.type === 2 /* TEXT */) {
  1641. first.content = first.content.replace(/^\r?\n/, '');
  1642. }
  1643. }
  1644. }
  1645. return removedWhitespace ? nodes.filter(Boolean) : nodes;
  1646. }
  1647. function pushNode(nodes, node) {
  1648. if (node.type === 2 /* TEXT */) {
  1649. const prev = last(nodes);
  1650. // Merge if both this and the previous node are text and those are
  1651. // consecutive. This happens for cases like "a < b".
  1652. if (prev &&
  1653. prev.type === 2 /* TEXT */ &&
  1654. prev.loc.end.offset === node.loc.start.offset) {
  1655. prev.content += node.content;
  1656. prev.loc.end = node.loc.end;
  1657. prev.loc.source += node.loc.source;
  1658. return;
  1659. }
  1660. }
  1661. nodes.push(node);
  1662. }
  1663. function parseCDATA(context, ancestors) {
  1664. advanceBy(context, 9);
  1665. const nodes = parseChildren(context, 3 /* CDATA */, ancestors);
  1666. if (context.source.length === 0) {
  1667. emitError(context, 6 /* EOF_IN_CDATA */);
  1668. }
  1669. else {
  1670. advanceBy(context, 3);
  1671. }
  1672. return nodes;
  1673. }
  1674. function parseComment(context) {
  1675. const start = getCursor(context);
  1676. let content;
  1677. // Regular comment.
  1678. const match = /--(\!)?>/.exec(context.source);
  1679. if (!match) {
  1680. content = context.source.slice(4);
  1681. advanceBy(context, context.source.length);
  1682. emitError(context, 7 /* EOF_IN_COMMENT */);
  1683. }
  1684. else {
  1685. if (match.index <= 3) {
  1686. emitError(context, 0 /* ABRUPT_CLOSING_OF_EMPTY_COMMENT */);
  1687. }
  1688. if (match[1]) {
  1689. emitError(context, 10 /* INCORRECTLY_CLOSED_COMMENT */);
  1690. }
  1691. content = context.source.slice(4, match.index);
  1692. // Advancing with reporting nested comments.
  1693. const s = context.source.slice(0, match.index);
  1694. let prevIndex = 1, nestedIndex = 0;
  1695. while ((nestedIndex = s.indexOf('<!--', prevIndex)) !== -1) {
  1696. advanceBy(context, nestedIndex - prevIndex + 1);
  1697. if (nestedIndex + 4 < s.length) {
  1698. emitError(context, 16 /* NESTED_COMMENT */);
  1699. }
  1700. prevIndex = nestedIndex + 1;
  1701. }
  1702. advanceBy(context, match.index + match[0].length - prevIndex + 1);
  1703. }
  1704. return {
  1705. type: 3 /* COMMENT */,
  1706. content,
  1707. loc: getSelection(context, start)
  1708. };
  1709. }
  1710. function parseBogusComment(context) {
  1711. const start = getCursor(context);
  1712. const contentStart = context.source[1] === '?' ? 1 : 2;
  1713. let content;
  1714. const closeIndex = context.source.indexOf('>');
  1715. if (closeIndex === -1) {
  1716. content = context.source.slice(contentStart);
  1717. advanceBy(context, context.source.length);
  1718. }
  1719. else {
  1720. content = context.source.slice(contentStart, closeIndex);
  1721. advanceBy(context, closeIndex + 1);
  1722. }
  1723. return {
  1724. type: 3 /* COMMENT */,
  1725. content,
  1726. loc: getSelection(context, start)
  1727. };
  1728. }
  1729. function parseElement(context, ancestors) {
  1730. // Start tag.
  1731. const wasInPre = context.inPre;
  1732. const wasInVPre = context.inVPre;
  1733. const parent = last(ancestors);
  1734. const element = parseTag(context, 0 /* Start */, parent);
  1735. const isPreBoundary = context.inPre && !wasInPre;
  1736. const isVPreBoundary = context.inVPre && !wasInVPre;
  1737. if (element.isSelfClosing || context.options.isVoidTag(element.tag)) {
  1738. // #4030 self-closing <pre> tag
  1739. if (isPreBoundary) {
  1740. context.inPre = false;
  1741. }
  1742. if (isVPreBoundary) {
  1743. context.inVPre = false;
  1744. }
  1745. return element;
  1746. }
  1747. // Children.
  1748. ancestors.push(element);
  1749. const mode = context.options.getTextMode(element, parent);
  1750. const children = parseChildren(context, mode, ancestors);
  1751. ancestors.pop();
  1752. // 2.x inline-template compat
  1753. {
  1754. const inlineTemplateProp = element.props.find(p => p.type === 6 /* ATTRIBUTE */ && p.name === 'inline-template');
  1755. if (inlineTemplateProp &&
  1756. checkCompatEnabled("COMPILER_INLINE_TEMPLATE" /* COMPILER_INLINE_TEMPLATE */, context, inlineTemplateProp.loc)) {
  1757. const loc = getSelection(context, element.loc.end);
  1758. inlineTemplateProp.value = {
  1759. type: 2 /* TEXT */,
  1760. content: loc.source,
  1761. loc
  1762. };
  1763. }
  1764. }
  1765. element.children = children;
  1766. // End tag.
  1767. if (startsWithEndTagOpen(context.source, element.tag)) {
  1768. parseTag(context, 1 /* End */, parent);
  1769. }
  1770. else {
  1771. emitError(context, 24 /* X_MISSING_END_TAG */, 0, element.loc.start);
  1772. if (context.source.length === 0 && element.tag.toLowerCase() === 'script') {
  1773. const first = children[0];
  1774. if (first && startsWith(first.loc.source, '<!--')) {
  1775. emitError(context, 8 /* EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT */);
  1776. }
  1777. }
  1778. }
  1779. element.loc = getSelection(context, element.loc.start);
  1780. if (isPreBoundary) {
  1781. context.inPre = false;
  1782. }
  1783. if (isVPreBoundary) {
  1784. context.inVPre = false;
  1785. }
  1786. return element;
  1787. }
  1788. const isSpecialTemplateDirective = /*#__PURE__*/ makeMap(`if,else,else-if,for,slot`);
  1789. function parseTag(context, type, parent) {
  1790. // Tag open.
  1791. const start = getCursor(context);
  1792. const match = /^<\/?([a-z][^\t\r\n\f />]*)/i.exec(context.source);
  1793. const tag = match[1];
  1794. const ns = context.options.getNamespace(tag, parent);
  1795. advanceBy(context, match[0].length);
  1796. advanceSpaces(context);
  1797. // save current state in case we need to re-parse attributes with v-pre
  1798. const cursor = getCursor(context);
  1799. const currentSource = context.source;
  1800. // check <pre> tag
  1801. if (context.options.isPreTag(tag)) {
  1802. context.inPre = true;
  1803. }
  1804. // Attributes.
  1805. let props = parseAttributes(context, type);
  1806. // check v-pre
  1807. if (type === 0 /* Start */ &&
  1808. !context.inVPre &&
  1809. props.some(p => p.type === 7 /* DIRECTIVE */ && p.name === 'pre')) {
  1810. context.inVPre = true;
  1811. // reset context
  1812. extend(context, cursor);
  1813. context.source = currentSource;
  1814. // re-parse attrs and filter out v-pre itself
  1815. props = parseAttributes(context, type).filter(p => p.name !== 'v-pre');
  1816. }
  1817. // Tag close.
  1818. let isSelfClosing = false;
  1819. if (context.source.length === 0) {
  1820. emitError(context, 9 /* EOF_IN_TAG */);
  1821. }
  1822. else {
  1823. isSelfClosing = startsWith(context.source, '/>');
  1824. if (type === 1 /* End */ && isSelfClosing) {
  1825. emitError(context, 4 /* END_TAG_WITH_TRAILING_SOLIDUS */);
  1826. }
  1827. advanceBy(context, isSelfClosing ? 2 : 1);
  1828. }
  1829. if (type === 1 /* End */) {
  1830. return;
  1831. }
  1832. // 2.x deprecation checks
  1833. if ((process.env.NODE_ENV !== 'production') &&
  1834. isCompatEnabled("COMPILER_V_IF_V_FOR_PRECEDENCE" /* COMPILER_V_IF_V_FOR_PRECEDENCE */, context)) {
  1835. let hasIf = false;
  1836. let hasFor = false;
  1837. for (let i = 0; i < props.length; i++) {
  1838. const p = props[i];
  1839. if (p.type === 7 /* DIRECTIVE */) {
  1840. if (p.name === 'if') {
  1841. hasIf = true;
  1842. }
  1843. else if (p.name === 'for') {
  1844. hasFor = true;
  1845. }
  1846. }
  1847. if (hasIf && hasFor) {
  1848. warnDeprecation("COMPILER_V_IF_V_FOR_PRECEDENCE" /* COMPILER_V_IF_V_FOR_PRECEDENCE */, context, getSelection(context, start));
  1849. break;
  1850. }
  1851. }
  1852. }
  1853. let tagType = 0 /* ELEMENT */;
  1854. if (!context.inVPre) {
  1855. if (tag === 'slot') {
  1856. tagType = 2 /* SLOT */;
  1857. }
  1858. else if (tag === 'template') {
  1859. if (props.some(p => p.type === 7 /* DIRECTIVE */ && isSpecialTemplateDirective(p.name))) {
  1860. tagType = 3 /* TEMPLATE */;
  1861. }
  1862. }
  1863. else if (isComponent(tag, props, context)) {
  1864. tagType = 1 /* COMPONENT */;
  1865. }
  1866. }
  1867. return {
  1868. type: 1 /* ELEMENT */,
  1869. ns,
  1870. tag,
  1871. tagType,
  1872. props,
  1873. isSelfClosing,
  1874. children: [],
  1875. loc: getSelection(context, start),
  1876. codegenNode: undefined // to be created during transform phase
  1877. };
  1878. }
  1879. function isComponent(tag, props, context) {
  1880. const options = context.options;
  1881. if (options.isCustomElement(tag)) {
  1882. return false;
  1883. }
  1884. if (tag === 'component' ||
  1885. /^[A-Z]/.test(tag) ||
  1886. isCoreComponent(tag) ||
  1887. (options.isBuiltInComponent && options.isBuiltInComponent(tag)) ||
  1888. (options.isNativeTag && !options.isNativeTag(tag))) {
  1889. return true;
  1890. }
  1891. // at this point the tag should be a native tag, but check for potential "is"
  1892. // casting
  1893. for (let i = 0; i < props.length; i++) {
  1894. const p = props[i];
  1895. if (p.type === 6 /* ATTRIBUTE */) {
  1896. if (p.name === 'is' && p.value) {
  1897. if (p.value.content.startsWith('vue:')) {
  1898. return true;
  1899. }
  1900. else if (checkCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
  1901. return true;
  1902. }
  1903. }
  1904. }
  1905. else {
  1906. // directive
  1907. // v-is (TODO Deprecate)
  1908. if (p.name === 'is') {
  1909. return true;
  1910. }
  1911. else if (
  1912. // :is on plain element - only treat as component in compat mode
  1913. p.name === 'bind' &&
  1914. isStaticArgOf(p.arg, 'is') &&
  1915. true &&
  1916. checkCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
  1917. return true;
  1918. }
  1919. }
  1920. }
  1921. }
  1922. function parseAttributes(context, type) {
  1923. const props = [];
  1924. const attributeNames = new Set();
  1925. while (context.source.length > 0 &&
  1926. !startsWith(context.source, '>') &&
  1927. !startsWith(context.source, '/>')) {
  1928. if (startsWith(context.source, '/')) {
  1929. emitError(context, 22 /* UNEXPECTED_SOLIDUS_IN_TAG */);
  1930. advanceBy(context, 1);
  1931. advanceSpaces(context);
  1932. continue;
  1933. }
  1934. if (type === 1 /* End */) {
  1935. emitError(context, 3 /* END_TAG_WITH_ATTRIBUTES */);
  1936. }
  1937. const attr = parseAttribute(context, attributeNames);
  1938. // Trim whitespace between class
  1939. // https://github.com/vuejs/core/issues/4251
  1940. if (attr.type === 6 /* ATTRIBUTE */ &&
  1941. attr.value &&
  1942. attr.name === 'class') {
  1943. attr.value.content = attr.value.content.replace(/\s+/g, ' ').trim();
  1944. }
  1945. if (type === 0 /* Start */) {
  1946. props.push(attr);
  1947. }
  1948. if (/^[^\t\r\n\f />]/.test(context.source)) {
  1949. emitError(context, 15 /* MISSING_WHITESPACE_BETWEEN_ATTRIBUTES */);
  1950. }
  1951. advanceSpaces(context);
  1952. }
  1953. return props;
  1954. }
  1955. function parseAttribute(context, nameSet) {
  1956. // Name.
  1957. const start = getCursor(context);
  1958. const match = /^[^\t\r\n\f />][^\t\r\n\f />=]*/.exec(context.source);
  1959. const name = match[0];
  1960. if (nameSet.has(name)) {
  1961. emitError(context, 2 /* DUPLICATE_ATTRIBUTE */);
  1962. }
  1963. nameSet.add(name);
  1964. if (name[0] === '=') {
  1965. emitError(context, 19 /* UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME */);
  1966. }
  1967. {
  1968. const pattern = /["'<]/g;
  1969. let m;
  1970. while ((m = pattern.exec(name))) {
  1971. emitError(context, 17 /* UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME */, m.index);
  1972. }
  1973. }
  1974. advanceBy(context, name.length);
  1975. // Value
  1976. let value = undefined;
  1977. if (/^[\t\r\n\f ]*=/.test(context.source)) {
  1978. advanceSpaces(context);
  1979. advanceBy(context, 1);
  1980. advanceSpaces(context);
  1981. value = parseAttributeValue(context);
  1982. if (!value) {
  1983. emitError(context, 13 /* MISSING_ATTRIBUTE_VALUE */);
  1984. }
  1985. }
  1986. const loc = getSelection(context, start);
  1987. if (!context.inVPre && /^(v-[A-Za-z0-9-]|:|\.|@|#)/.test(name)) {
  1988. const match = /(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(name);
  1989. let isPropShorthand = startsWith(name, '.');
  1990. let dirName = match[1] ||
  1991. (isPropShorthand || startsWith(name, ':')
  1992. ? 'bind'
  1993. : startsWith(name, '@')
  1994. ? 'on'
  1995. : 'slot');
  1996. let arg;
  1997. if (match[2]) {
  1998. const isSlot = dirName === 'slot';
  1999. const startOffset = name.lastIndexOf(match[2]);
  2000. const loc = getSelection(context, getNewPosition(context, start, startOffset), getNewPosition(context, start, startOffset + match[2].length + ((isSlot && match[3]) || '').length));
  2001. let content = match[2];
  2002. let isStatic = true;
  2003. if (content.startsWith('[')) {
  2004. isStatic = false;
  2005. if (!content.endsWith(']')) {
  2006. emitError(context, 27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
  2007. content = content.slice(1);
  2008. }
  2009. else {
  2010. content = content.slice(1, content.length - 1);
  2011. }
  2012. }
  2013. else if (isSlot) {
  2014. // #1241 special case for v-slot: vuetify relies extensively on slot
  2015. // names containing dots. v-slot doesn't have any modifiers and Vue 2.x
  2016. // supports such usage so we are keeping it consistent with 2.x.
  2017. content += match[3] || '';
  2018. }
  2019. arg = {
  2020. type: 4 /* SIMPLE_EXPRESSION */,
  2021. content,
  2022. isStatic,
  2023. constType: isStatic
  2024. ? 3 /* CAN_STRINGIFY */
  2025. : 0 /* NOT_CONSTANT */,
  2026. loc
  2027. };
  2028. }
  2029. if (value && value.isQuoted) {
  2030. const valueLoc = value.loc;
  2031. valueLoc.start.offset++;
  2032. valueLoc.start.column++;
  2033. valueLoc.end = advancePositionWithClone(valueLoc.start, value.content);
  2034. valueLoc.source = valueLoc.source.slice(1, -1);
  2035. }
  2036. const modifiers = match[3] ? match[3].slice(1).split('.') : [];
  2037. if (isPropShorthand)
  2038. modifiers.push('prop');
  2039. // 2.x compat v-bind:foo.sync -> v-model:foo
  2040. if (dirName === 'bind' && arg) {
  2041. if (modifiers.includes('sync') &&
  2042. checkCompatEnabled("COMPILER_V_BIND_SYNC" /* COMPILER_V_BIND_SYNC */, context, loc, arg.loc.source)) {
  2043. dirName = 'model';
  2044. modifiers.splice(modifiers.indexOf('sync'), 1);
  2045. }
  2046. if ((process.env.NODE_ENV !== 'production') && modifiers.includes('prop')) {
  2047. checkCompatEnabled("COMPILER_V_BIND_PROP" /* COMPILER_V_BIND_PROP */, context, loc);
  2048. }
  2049. }
  2050. return {
  2051. type: 7 /* DIRECTIVE */,
  2052. name: dirName,
  2053. exp: value && {
  2054. type: 4 /* SIMPLE_EXPRESSION */,
  2055. content: value.content,
  2056. isStatic: false,
  2057. // Treat as non-constant by default. This can be potentially set to
  2058. // other values by `transformExpression` to make it eligible for hoisting.
  2059. constType: 0 /* NOT_CONSTANT */,
  2060. loc: value.loc
  2061. },
  2062. arg,
  2063. modifiers,
  2064. loc
  2065. };
  2066. }
  2067. // missing directive name or illegal directive name
  2068. if (!context.inVPre && startsWith(name, 'v-')) {
  2069. emitError(context, 26 /* X_MISSING_DIRECTIVE_NAME */);
  2070. }
  2071. return {
  2072. type: 6 /* ATTRIBUTE */,
  2073. name,
  2074. value: value && {
  2075. type: 2 /* TEXT */,
  2076. content: value.content,
  2077. loc: value.loc
  2078. },
  2079. loc
  2080. };
  2081. }
  2082. function parseAttributeValue(context) {
  2083. const start = getCursor(context);
  2084. let content;
  2085. const quote = context.source[0];
  2086. const isQuoted = quote === `"` || quote === `'`;
  2087. if (isQuoted) {
  2088. // Quoted value.
  2089. advanceBy(context, 1);
  2090. const endIndex = context.source.indexOf(quote);
  2091. if (endIndex === -1) {
  2092. content = parseTextData(context, context.source.length, 4 /* ATTRIBUTE_VALUE */);
  2093. }
  2094. else {
  2095. content = parseTextData(context, endIndex, 4 /* ATTRIBUTE_VALUE */);
  2096. advanceBy(context, 1);
  2097. }
  2098. }
  2099. else {
  2100. // Unquoted
  2101. const match = /^[^\t\r\n\f >]+/.exec(context.source);
  2102. if (!match) {
  2103. return undefined;
  2104. }
  2105. const unexpectedChars = /["'<=`]/g;
  2106. let m;
  2107. while ((m = unexpectedChars.exec(match[0]))) {
  2108. emitError(context, 18 /* UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE */, m.index);
  2109. }
  2110. content = parseTextData(context, match[0].length, 4 /* ATTRIBUTE_VALUE */);
  2111. }
  2112. return { content, isQuoted, loc: getSelection(context, start) };
  2113. }
  2114. function parseInterpolation(context, mode) {
  2115. const [open, close] = context.options.delimiters;
  2116. const closeIndex = context.source.indexOf(close, open.length);
  2117. if (closeIndex === -1) {
  2118. emitError(context, 25 /* X_MISSING_INTERPOLATION_END */);
  2119. return undefined;
  2120. }
  2121. const start = getCursor(context);
  2122. advanceBy(context, open.length);
  2123. const innerStart = getCursor(context);
  2124. const innerEnd = getCursor(context);
  2125. const rawContentLength = closeIndex - open.length;
  2126. const rawContent = context.source.slice(0, rawContentLength);
  2127. const preTrimContent = parseTextData(context, rawContentLength, mode);
  2128. const content = preTrimContent.trim();
  2129. const startOffset = preTrimContent.indexOf(content);
  2130. if (startOffset > 0) {
  2131. advancePositionWithMutation(innerStart, rawContent, startOffset);
  2132. }
  2133. const endOffset = rawContentLength - (preTrimContent.length - content.length - startOffset);
  2134. advancePositionWithMutation(innerEnd, rawContent, endOffset);
  2135. advanceBy(context, close.length);
  2136. return {
  2137. type: 5 /* INTERPOLATION */,
  2138. content: {
  2139. type: 4 /* SIMPLE_EXPRESSION */,
  2140. isStatic: false,
  2141. // Set `isConstant` to false by default and will decide in transformExpression
  2142. constType: 0 /* NOT_CONSTANT */,
  2143. content,
  2144. loc: getSelection(context, innerStart, innerEnd)
  2145. },
  2146. loc: getSelection(context, start)
  2147. };
  2148. }
  2149. function parseText(context, mode) {
  2150. const endTokens = mode === 3 /* CDATA */ ? [']]>'] : ['<', context.options.delimiters[0]];
  2151. let endIndex = context.source.length;
  2152. for (let i = 0; i < endTokens.length; i++) {
  2153. const index = context.source.indexOf(endTokens[i], 1);
  2154. if (index !== -1 && endIndex > index) {
  2155. endIndex = index;
  2156. }
  2157. }
  2158. const start = getCursor(context);
  2159. const content = parseTextData(context, endIndex, mode);
  2160. return {
  2161. type: 2 /* TEXT */,
  2162. content,
  2163. loc: getSelection(context, start)
  2164. };
  2165. }
  2166. /**
  2167. * Get text data with a given length from the current location.
  2168. * This translates HTML entities in the text data.
  2169. */
  2170. function parseTextData(context, length, mode) {
  2171. const rawText = context.source.slice(0, length);
  2172. advanceBy(context, length);
  2173. if (mode === 2 /* RAWTEXT */ ||
  2174. mode === 3 /* CDATA */ ||
  2175. !rawText.includes('&')) {
  2176. return rawText;
  2177. }
  2178. else {
  2179. // DATA or RCDATA containing "&"". Entity decoding required.
  2180. return context.options.decodeEntities(rawText, mode === 4 /* ATTRIBUTE_VALUE */);
  2181. }
  2182. }
  2183. function getCursor(context) {
  2184. const { column, line, offset } = context;
  2185. return { column, line, offset };
  2186. }
  2187. function getSelection(context, start, end) {
  2188. end = end || getCursor(context);
  2189. return {
  2190. start,
  2191. end,
  2192. source: context.originalSource.slice(start.offset, end.offset)
  2193. };
  2194. }
  2195. function last(xs) {
  2196. return xs[xs.length - 1];
  2197. }
  2198. function startsWith(source, searchString) {
  2199. return source.startsWith(searchString);
  2200. }
  2201. function advanceBy(context, numberOfCharacters) {
  2202. const { source } = context;
  2203. advancePositionWithMutation(context, source, numberOfCharacters);
  2204. context.source = source.slice(numberOfCharacters);
  2205. }
  2206. function advanceSpaces(context) {
  2207. const match = /^[\t\r\n\f ]+/.exec(context.source);
  2208. if (match) {
  2209. advanceBy(context, match[0].length);
  2210. }
  2211. }
  2212. function getNewPosition(context, start, numberOfCharacters) {
  2213. return advancePositionWithClone(start, context.originalSource.slice(start.offset, numberOfCharacters), numberOfCharacters);
  2214. }
  2215. function emitError(context, code, offset, loc = getCursor(context)) {
  2216. if (offset) {
  2217. loc.offset += offset;
  2218. loc.column += offset;
  2219. }
  2220. context.options.onError(createCompilerError(code, {
  2221. start: loc,
  2222. end: loc,
  2223. source: ''
  2224. }));
  2225. }
  2226. function isEnd(context, mode, ancestors) {
  2227. const s = context.source;
  2228. switch (mode) {
  2229. case 0 /* DATA */:
  2230. if (startsWith(s, '</')) {
  2231. // TODO: probably bad performance
  2232. for (let i = ancestors.length - 1; i >= 0; --i) {
  2233. if (startsWithEndTagOpen(s, ancestors[i].tag)) {
  2234. return true;
  2235. }
  2236. }
  2237. }
  2238. break;
  2239. case 1 /* RCDATA */:
  2240. case 2 /* RAWTEXT */: {
  2241. const parent = last(ancestors);
  2242. if (parent && startsWithEndTagOpen(s, parent.tag)) {
  2243. return true;
  2244. }
  2245. break;
  2246. }
  2247. case 3 /* CDATA */:
  2248. if (startsWith(s, ']]>')) {
  2249. return true;
  2250. }
  2251. break;
  2252. }
  2253. return !s;
  2254. }
  2255. function startsWithEndTagOpen(source, tag) {
  2256. return (startsWith(source, '</') &&
  2257. source.slice(2, 2 + tag.length).toLowerCase() === tag.toLowerCase() &&
  2258. /[\t\r\n\f />]/.test(source[2 + tag.length] || '>'));
  2259. }
  2260. function hoistStatic(root, context) {
  2261. walk(root, context,
  2262. // Root node is unfortunately non-hoistable due to potential parent
  2263. // fallthrough attributes.
  2264. isSingleElementRoot(root, root.children[0]));
  2265. }
  2266. function isSingleElementRoot(root, child) {
  2267. const { children } = root;
  2268. return (children.length === 1 &&
  2269. child.type === 1 /* ELEMENT */ &&
  2270. !isSlotOutlet(child));
  2271. }
  2272. function walk(node, context, doNotHoistNode = false) {
  2273. const { children } = node;
  2274. const originalCount = children.length;
  2275. let hoistedCount = 0;
  2276. for (let i = 0; i < children.length; i++) {
  2277. const child = children[i];
  2278. // only plain elements & text calls are eligible for hoisting.
  2279. if (child.type === 1 /* ELEMENT */ &&
  2280. child.tagType === 0 /* ELEMENT */) {
  2281. const constantType = doNotHoistNode
  2282. ? 0 /* NOT_CONSTANT */
  2283. : getConstantType(child, context);
  2284. if (constantType > 0 /* NOT_CONSTANT */) {
  2285. if (constantType >= 2 /* CAN_HOIST */) {
  2286. child.codegenNode.patchFlag =
  2287. -1 /* HOISTED */ + ((process.env.NODE_ENV !== 'production') ? ` /* HOISTED */` : ``);
  2288. child.codegenNode = context.hoist(child.codegenNode);
  2289. hoistedCount++;
  2290. continue;
  2291. }
  2292. }
  2293. else {
  2294. // node may contain dynamic children, but its props may be eligible for
  2295. // hoisting.
  2296. const codegenNode = child.codegenNode;
  2297. if (codegenNode.type === 13 /* VNODE_CALL */) {
  2298. const flag = getPatchFlag(codegenNode);
  2299. if ((!flag ||
  2300. flag === 512 /* NEED_PATCH */ ||
  2301. flag === 1 /* TEXT */) &&
  2302. getGeneratedPropsConstantType(child, context) >=
  2303. 2 /* CAN_HOIST */) {
  2304. const props = getNodeProps(child);
  2305. if (props) {
  2306. codegenNode.props = context.hoist(props);
  2307. }
  2308. }
  2309. if (codegenNode.dynamicProps) {
  2310. codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps);
  2311. }
  2312. }
  2313. }
  2314. }
  2315. else if (child.type === 12 /* TEXT_CALL */ &&
  2316. getConstantType(child.content, context) >= 2 /* CAN_HOIST */) {
  2317. child.codegenNode = context.hoist(child.codegenNode);
  2318. hoistedCount++;
  2319. }
  2320. // walk further
  2321. if (child.type === 1 /* ELEMENT */) {
  2322. const isComponent = child.tagType === 1 /* COMPONENT */;
  2323. if (isComponent) {
  2324. context.scopes.vSlot++;
  2325. }
  2326. walk(child, context);
  2327. if (isComponent) {
  2328. context.scopes.vSlot--;
  2329. }
  2330. }
  2331. else if (child.type === 11 /* FOR */) {
  2332. // Do not hoist v-for single child because it has to be a block
  2333. walk(child, context, child.children.length === 1);
  2334. }
  2335. else if (child.type === 9 /* IF */) {
  2336. for (let i = 0; i < child.branches.length; i++) {
  2337. // Do not hoist v-if single child because it has to be a block
  2338. walk(child.branches[i], context, child.branches[i].children.length === 1);
  2339. }
  2340. }
  2341. }
  2342. if (hoistedCount && context.transformHoist) {
  2343. context.transformHoist(children, context, node);
  2344. }
  2345. // all children were hoisted - the entire children array is hoistable.
  2346. if (hoistedCount &&
  2347. hoistedCount === originalCount &&
  2348. node.type === 1 /* ELEMENT */ &&
  2349. node.tagType === 0 /* ELEMENT */ &&
  2350. node.codegenNode &&
  2351. node.codegenNode.type === 13 /* VNODE_CALL */ &&
  2352. isArray(node.codegenNode.children)) {
  2353. node.codegenNode.children = context.hoist(createArrayExpression(node.codegenNode.children));
  2354. }
  2355. }
  2356. function getConstantType(node, context) {
  2357. const { constantCache } = context;
  2358. switch (node.type) {
  2359. case 1 /* ELEMENT */:
  2360. if (node.tagType !== 0 /* ELEMENT */) {
  2361. return 0 /* NOT_CONSTANT */;
  2362. }
  2363. const cached = constantCache.get(node);
  2364. if (cached !== undefined) {
  2365. return cached;
  2366. }
  2367. const codegenNode = node.codegenNode;
  2368. if (codegenNode.type !== 13 /* VNODE_CALL */) {
  2369. return 0 /* NOT_CONSTANT */;
  2370. }
  2371. if (codegenNode.isBlock &&
  2372. node.tag !== 'svg' &&
  2373. node.tag !== 'foreignObject') {
  2374. return 0 /* NOT_CONSTANT */;
  2375. }
  2376. const flag = getPatchFlag(codegenNode);
  2377. if (!flag) {
  2378. let returnType = 3 /* CAN_STRINGIFY */;
  2379. // Element itself has no patch flag. However we still need to check:
  2380. // 1. Even for a node with no patch flag, it is possible for it to contain
  2381. // non-hoistable expressions that refers to scope variables, e.g. compiler
  2382. // injected keys or cached event handlers. Therefore we need to always
  2383. // check the codegenNode's props to be sure.
  2384. const generatedPropsType = getGeneratedPropsConstantType(node, context);
  2385. if (generatedPropsType === 0 /* NOT_CONSTANT */) {
  2386. constantCache.set(node, 0 /* NOT_CONSTANT */);
  2387. return 0 /* NOT_CONSTANT */;
  2388. }
  2389. if (generatedPropsType < returnType) {
  2390. returnType = generatedPropsType;
  2391. }
  2392. // 2. its children.
  2393. for (let i = 0; i < node.children.length; i++) {
  2394. const childType = getConstantType(node.children[i], context);
  2395. if (childType === 0 /* NOT_CONSTANT */) {
  2396. constantCache.set(node, 0 /* NOT_CONSTANT */);
  2397. return 0 /* NOT_CONSTANT */;
  2398. }
  2399. if (childType < returnType) {
  2400. returnType = childType;
  2401. }
  2402. }
  2403. // 3. if the type is not already CAN_SKIP_PATCH which is the lowest non-0
  2404. // type, check if any of the props can cause the type to be lowered
  2405. // we can skip can_patch because it's guaranteed by the absence of a
  2406. // patchFlag.
  2407. if (returnType > 1 /* CAN_SKIP_PATCH */) {
  2408. for (let i = 0; i < node.props.length; i++) {
  2409. const p = node.props[i];
  2410. if (p.type === 7 /* DIRECTIVE */ && p.name === 'bind' && p.exp) {
  2411. const expType = getConstantType(p.exp, context);
  2412. if (expType === 0 /* NOT_CONSTANT */) {
  2413. constantCache.set(node, 0 /* NOT_CONSTANT */);
  2414. return 0 /* NOT_CONSTANT */;
  2415. }
  2416. if (expType < returnType) {
  2417. returnType = expType;
  2418. }
  2419. }
  2420. }
  2421. }
  2422. // only svg/foreignObject could be block here, however if they are
  2423. // static then they don't need to be blocks since there will be no
  2424. // nested updates.
  2425. if (codegenNode.isBlock) {
  2426. context.removeHelper(OPEN_BLOCK);
  2427. context.removeHelper(getVNodeBlockHelper(context.inSSR, codegenNode.isComponent));
  2428. codegenNode.isBlock = false;
  2429. context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent));
  2430. }
  2431. constantCache.set(node, returnType);
  2432. return returnType;
  2433. }
  2434. else {
  2435. constantCache.set(node, 0 /* NOT_CONSTANT */);
  2436. return 0 /* NOT_CONSTANT */;
  2437. }
  2438. case 2 /* TEXT */:
  2439. case 3 /* COMMENT */:
  2440. return 3 /* CAN_STRINGIFY */;
  2441. case 9 /* IF */:
  2442. case 11 /* FOR */:
  2443. case 10 /* IF_BRANCH */:
  2444. return 0 /* NOT_CONSTANT */;
  2445. case 5 /* INTERPOLATION */:
  2446. case 12 /* TEXT_CALL */:
  2447. return getConstantType(node.content, context);
  2448. case 4 /* SIMPLE_EXPRESSION */:
  2449. return node.constType;
  2450. case 8 /* COMPOUND_EXPRESSION */:
  2451. let returnType = 3 /* CAN_STRINGIFY */;
  2452. for (let i = 0; i < node.children.length; i++) {
  2453. const child = node.children[i];
  2454. if (isString(child) || isSymbol(child)) {
  2455. continue;
  2456. }
  2457. const childType = getConstantType(child, context);
  2458. if (childType === 0 /* NOT_CONSTANT */) {
  2459. return 0 /* NOT_CONSTANT */;
  2460. }
  2461. else if (childType < returnType) {
  2462. returnType = childType;
  2463. }
  2464. }
  2465. return returnType;
  2466. default:
  2467. if ((process.env.NODE_ENV !== 'production')) ;
  2468. return 0 /* NOT_CONSTANT */;
  2469. }
  2470. }
  2471. const allowHoistedHelperSet = new Set([
  2472. NORMALIZE_CLASS,
  2473. NORMALIZE_STYLE,
  2474. NORMALIZE_PROPS,
  2475. GUARD_REACTIVE_PROPS
  2476. ]);
  2477. function getConstantTypeOfHelperCall(value, context) {
  2478. if (value.type === 14 /* JS_CALL_EXPRESSION */ &&
  2479. !isString(value.callee) &&
  2480. allowHoistedHelperSet.has(value.callee)) {
  2481. const arg = value.arguments[0];
  2482. if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
  2483. return getConstantType(arg, context);
  2484. }
  2485. else if (arg.type === 14 /* JS_CALL_EXPRESSION */) {
  2486. // in the case of nested helper call, e.g. `normalizeProps(guardReactiveProps(exp))`
  2487. return getConstantTypeOfHelperCall(arg, context);
  2488. }
  2489. }
  2490. return 0 /* NOT_CONSTANT */;
  2491. }
  2492. function getGeneratedPropsConstantType(node, context) {
  2493. let returnType = 3 /* CAN_STRINGIFY */;
  2494. const props = getNodeProps(node);
  2495. if (props && props.type === 15 /* JS_OBJECT_EXPRESSION */) {
  2496. const { properties } = props;
  2497. for (let i = 0; i < properties.length; i++) {
  2498. const { key, value } = properties[i];
  2499. const keyType = getConstantType(key, context);
  2500. if (keyType === 0 /* NOT_CONSTANT */) {
  2501. return keyType;
  2502. }
  2503. if (keyType < returnType) {
  2504. returnType = keyType;
  2505. }
  2506. let valueType;
  2507. if (value.type === 4 /* SIMPLE_EXPRESSION */) {
  2508. valueType = getConstantType(value, context);
  2509. }
  2510. else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
  2511. // some helper calls can be hoisted,
  2512. // such as the `normalizeProps` generated by the compiler for pre-normalize class,
  2513. // in this case we need to respect the ConstantType of the helper's arguments
  2514. valueType = getConstantTypeOfHelperCall(value, context);
  2515. }
  2516. else {
  2517. valueType = 0 /* NOT_CONSTANT */;
  2518. }
  2519. if (valueType === 0 /* NOT_CONSTANT */) {
  2520. return valueType;
  2521. }
  2522. if (valueType < returnType) {
  2523. returnType = valueType;
  2524. }
  2525. }
  2526. }
  2527. return returnType;
  2528. }
  2529. function getNodeProps(node) {
  2530. const codegenNode = node.codegenNode;
  2531. if (codegenNode.type === 13 /* VNODE_CALL */) {
  2532. return codegenNode.props;
  2533. }
  2534. }
  2535. function getPatchFlag(node) {
  2536. const flag = node.patchFlag;
  2537. return flag ? parseInt(flag, 10) : undefined;
  2538. }
  2539. function createTransformContext(root, { filename = '', prefixIdentifiers = false, hoistStatic = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
  2540. const nameMatch = filename.replace(/\?.*$/, '').match(/([^/\\]+)\.\w+$/);
  2541. const context = {
  2542. // options
  2543. selfName: nameMatch && capitalize(camelize$1(nameMatch[1])),
  2544. prefixIdentifiers,
  2545. hoistStatic,
  2546. cacheHandlers,
  2547. nodeTransforms,
  2548. directiveTransforms,
  2549. transformHoist,
  2550. isBuiltInComponent,
  2551. isCustomElement,
  2552. expressionPlugins,
  2553. scopeId,
  2554. slotted,
  2555. ssr,
  2556. inSSR,
  2557. ssrCssVars,
  2558. bindingMetadata,
  2559. inline,
  2560. isTS,
  2561. onError,
  2562. onWarn,
  2563. compatConfig,
  2564. // state
  2565. root,
  2566. helpers: new Map(),
  2567. components: new Set(),
  2568. directives: new Set(),
  2569. hoists: [],
  2570. imports: [],
  2571. constantCache: new Map(),
  2572. temps: 0,
  2573. cached: 0,
  2574. identifiers: Object.create(null),
  2575. scopes: {
  2576. vFor: 0,
  2577. vSlot: 0,
  2578. vPre: 0,
  2579. vOnce: 0
  2580. },
  2581. parent: null,
  2582. currentNode: root,
  2583. childIndex: 0,
  2584. inVOnce: false,
  2585. // methods
  2586. helper(name) {
  2587. const count = context.helpers.get(name) || 0;
  2588. context.helpers.set(name, count + 1);
  2589. return name;
  2590. },
  2591. removeHelper(name) {
  2592. const count = context.helpers.get(name);
  2593. if (count) {
  2594. const currentCount = count - 1;
  2595. if (!currentCount) {
  2596. context.helpers.delete(name);
  2597. }
  2598. else {
  2599. context.helpers.set(name, currentCount);
  2600. }
  2601. }
  2602. },
  2603. helperString(name) {
  2604. return `_${helperNameMap[context.helper(name)]}`;
  2605. },
  2606. replaceNode(node) {
  2607. /* istanbul ignore if */
  2608. if ((process.env.NODE_ENV !== 'production')) {
  2609. if (!context.currentNode) {
  2610. throw new Error(`Node being replaced is already removed.`);
  2611. }
  2612. if (!context.parent) {
  2613. throw new Error(`Cannot replace root node.`);
  2614. }
  2615. }
  2616. context.parent.children[context.childIndex] = context.currentNode = node;
  2617. },
  2618. removeNode(node) {
  2619. if ((process.env.NODE_ENV !== 'production') && !context.parent) {
  2620. throw new Error(`Cannot remove root node.`);
  2621. }
  2622. const list = context.parent.children;
  2623. const removalIndex = node
  2624. ? list.indexOf(node)
  2625. : context.currentNode
  2626. ? context.childIndex
  2627. : -1;
  2628. /* istanbul ignore if */
  2629. if ((process.env.NODE_ENV !== 'production') && removalIndex < 0) {
  2630. throw new Error(`node being removed is not a child of current parent`);
  2631. }
  2632. if (!node || node === context.currentNode) {
  2633. // current node removed
  2634. context.currentNode = null;
  2635. context.onNodeRemoved();
  2636. }
  2637. else {
  2638. // sibling node removed
  2639. if (context.childIndex > removalIndex) {
  2640. context.childIndex--;
  2641. context.onNodeRemoved();
  2642. }
  2643. }
  2644. context.parent.children.splice(removalIndex, 1);
  2645. },
  2646. onNodeRemoved: () => { },
  2647. addIdentifiers(exp) {
  2648. },
  2649. removeIdentifiers(exp) {
  2650. },
  2651. hoist(exp) {
  2652. if (isString(exp))
  2653. exp = createSimpleExpression(exp);
  2654. context.hoists.push(exp);
  2655. const identifier = createSimpleExpression(`_hoisted_${context.hoists.length}`, false, exp.loc, 2 /* CAN_HOIST */);
  2656. identifier.hoisted = exp;
  2657. return identifier;
  2658. },
  2659. cache(exp, isVNode = false) {
  2660. return createCacheExpression(context.cached++, exp, isVNode);
  2661. }
  2662. };
  2663. {
  2664. context.filters = new Set();
  2665. }
  2666. return context;
  2667. }
  2668. function transform(root, options) {
  2669. const context = createTransformContext(root, options);
  2670. traverseNode(root, context);
  2671. if (options.hoistStatic) {
  2672. hoistStatic(root, context);
  2673. }
  2674. if (!options.ssr) {
  2675. createRootCodegen(root, context);
  2676. }
  2677. // finalize meta information
  2678. root.helpers = [...context.helpers.keys()];
  2679. root.components = [...context.components];
  2680. root.directives = [...context.directives];
  2681. root.imports = context.imports;
  2682. root.hoists = context.hoists;
  2683. root.temps = context.temps;
  2684. root.cached = context.cached;
  2685. {
  2686. root.filters = [...context.filters];
  2687. }
  2688. }
  2689. function createRootCodegen(root, context) {
  2690. const { helper } = context;
  2691. const { children } = root;
  2692. if (children.length === 1) {
  2693. const child = children[0];
  2694. // if the single child is an element, turn it into a block.
  2695. if (isSingleElementRoot(root, child) && child.codegenNode) {
  2696. // single element root is never hoisted so codegenNode will never be
  2697. // SimpleExpressionNode
  2698. const codegenNode = child.codegenNode;
  2699. if (codegenNode.type === 13 /* VNODE_CALL */) {
  2700. makeBlock(codegenNode, context);
  2701. }
  2702. root.codegenNode = codegenNode;
  2703. }
  2704. else {
  2705. // - single <slot/>, IfNode, ForNode: already blocks.
  2706. // - single text node: always patched.
  2707. // root codegen falls through via genNode()
  2708. root.codegenNode = child;
  2709. }
  2710. }
  2711. else if (children.length > 1) {
  2712. // root has multiple nodes - return a fragment block.
  2713. let patchFlag = 64 /* STABLE_FRAGMENT */;
  2714. let patchFlagText = PatchFlagNames[64 /* STABLE_FRAGMENT */];
  2715. // check if the fragment actually contains a single valid child with
  2716. // the rest being comments
  2717. if ((process.env.NODE_ENV !== 'production') &&
  2718. children.filter(c => c.type !== 3 /* COMMENT */).length === 1) {
  2719. patchFlag |= 2048 /* DEV_ROOT_FRAGMENT */;
  2720. patchFlagText += `, ${PatchFlagNames[2048 /* DEV_ROOT_FRAGMENT */]}`;
  2721. }
  2722. root.codegenNode = createVNodeCall(context, helper(FRAGMENT), undefined, root.children, patchFlag + ((process.env.NODE_ENV !== 'production') ? ` /* ${patchFlagText} */` : ``), undefined, undefined, true, undefined, false /* isComponent */);
  2723. }
  2724. else ;
  2725. }
  2726. function traverseChildren(parent, context) {
  2727. let i = 0;
  2728. const nodeRemoved = () => {
  2729. i--;
  2730. };
  2731. for (; i < parent.children.length; i++) {
  2732. const child = parent.children[i];
  2733. if (isString(child))
  2734. continue;
  2735. context.parent = parent;
  2736. context.childIndex = i;
  2737. context.onNodeRemoved = nodeRemoved;
  2738. traverseNode(child, context);
  2739. }
  2740. }
  2741. function traverseNode(node, context) {
  2742. context.currentNode = node;
  2743. // apply transform plugins
  2744. const { nodeTransforms } = context;
  2745. const exitFns = [];
  2746. for (let i = 0; i < nodeTransforms.length; i++) {
  2747. const onExit = nodeTransforms[i](node, context);
  2748. if (onExit) {
  2749. if (isArray(onExit)) {
  2750. exitFns.push(...onExit);
  2751. }
  2752. else {
  2753. exitFns.push(onExit);
  2754. }
  2755. }
  2756. if (!context.currentNode) {
  2757. // node was removed
  2758. return;
  2759. }
  2760. else {
  2761. // node may have been replaced
  2762. node = context.currentNode;
  2763. }
  2764. }
  2765. switch (node.type) {
  2766. case 3 /* COMMENT */:
  2767. if (!context.ssr) {
  2768. // inject import for the Comment symbol, which is needed for creating
  2769. // comment nodes with `createVNode`
  2770. context.helper(CREATE_COMMENT);
  2771. }
  2772. break;
  2773. case 5 /* INTERPOLATION */:
  2774. // no need to traverse, but we need to inject toString helper
  2775. if (!context.ssr) {
  2776. context.helper(TO_DISPLAY_STRING);
  2777. }
  2778. break;
  2779. // for container types, further traverse downwards
  2780. case 9 /* IF */:
  2781. for (let i = 0; i < node.branches.length; i++) {
  2782. traverseNode(node.branches[i], context);
  2783. }
  2784. break;
  2785. case 10 /* IF_BRANCH */:
  2786. case 11 /* FOR */:
  2787. case 1 /* ELEMENT */:
  2788. case 0 /* ROOT */:
  2789. traverseChildren(node, context);
  2790. break;
  2791. }
  2792. // exit transforms
  2793. context.currentNode = node;
  2794. let i = exitFns.length;
  2795. while (i--) {
  2796. exitFns[i]();
  2797. }
  2798. }
  2799. function createStructuralDirectiveTransform(name, fn) {
  2800. const matches = isString(name)
  2801. ? (n) => n === name
  2802. : (n) => name.test(n);
  2803. return (node, context) => {
  2804. if (node.type === 1 /* ELEMENT */) {
  2805. const { props } = node;
  2806. // structural directive transforms are not concerned with slots
  2807. // as they are handled separately in vSlot.ts
  2808. if (node.tagType === 3 /* TEMPLATE */ && props.some(isVSlot)) {
  2809. return;
  2810. }
  2811. const exitFns = [];
  2812. for (let i = 0; i < props.length; i++) {
  2813. const prop = props[i];
  2814. if (prop.type === 7 /* DIRECTIVE */ && matches(prop.name)) {
  2815. // structural directives are removed to avoid infinite recursion
  2816. // also we remove them *before* applying so that it can further
  2817. // traverse itself in case it moves the node around
  2818. props.splice(i, 1);
  2819. i--;
  2820. const onExit = fn(node, prop, context);
  2821. if (onExit)
  2822. exitFns.push(onExit);
  2823. }
  2824. }
  2825. return exitFns;
  2826. }
  2827. };
  2828. }
  2829. const PURE_ANNOTATION = `/*#__PURE__*/`;
  2830. function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode === 'module', sourceMap = false, filename = `template.vue.html`, scopeId = null, optimizeImports = false, runtimeGlobalName = `Vue`, runtimeModuleName = `vue`, ssrRuntimeModuleName = 'vue/server-renderer', ssr = false, isTS = false, inSSR = false }) {
  2831. const context = {
  2832. mode,
  2833. prefixIdentifiers,
  2834. sourceMap,
  2835. filename,
  2836. scopeId,
  2837. optimizeImports,
  2838. runtimeGlobalName,
  2839. runtimeModuleName,
  2840. ssrRuntimeModuleName,
  2841. ssr,
  2842. isTS,
  2843. inSSR,
  2844. source: ast.loc.source,
  2845. code: ``,
  2846. column: 1,
  2847. line: 1,
  2848. offset: 0,
  2849. indentLevel: 0,
  2850. pure: false,
  2851. map: undefined,
  2852. helper(key) {
  2853. return `_${helperNameMap[key]}`;
  2854. },
  2855. push(code, node) {
  2856. context.code += code;
  2857. },
  2858. indent() {
  2859. newline(++context.indentLevel);
  2860. },
  2861. deindent(withoutNewLine = false) {
  2862. if (withoutNewLine) {
  2863. --context.indentLevel;
  2864. }
  2865. else {
  2866. newline(--context.indentLevel);
  2867. }
  2868. },
  2869. newline() {
  2870. newline(context.indentLevel);
  2871. }
  2872. };
  2873. function newline(n) {
  2874. context.push('\n' + ` `.repeat(n));
  2875. }
  2876. return context;
  2877. }
  2878. function generate(ast, options = {}) {
  2879. const context = createCodegenContext(ast, options);
  2880. if (options.onContextCreated)
  2881. options.onContextCreated(context);
  2882. const { mode, push, prefixIdentifiers, indent, deindent, newline, scopeId, ssr } = context;
  2883. const hasHelpers = ast.helpers.length > 0;
  2884. const useWithBlock = !prefixIdentifiers && mode !== 'module';
  2885. // preambles
  2886. // in setup() inline mode, the preamble is generated in a sub context
  2887. // and returned separately.
  2888. const preambleContext = context;
  2889. {
  2890. genFunctionPreamble(ast, preambleContext);
  2891. }
  2892. // enter render function
  2893. const functionName = ssr ? `ssrRender` : `render`;
  2894. const args = ssr ? ['_ctx', '_push', '_parent', '_attrs'] : ['_ctx', '_cache'];
  2895. const signature = args.join(', ');
  2896. {
  2897. push(`function ${functionName}(${signature}) {`);
  2898. }
  2899. indent();
  2900. if (useWithBlock) {
  2901. push(`with (_ctx) {`);
  2902. indent();
  2903. // function mode const declarations should be inside with block
  2904. // also they should be renamed to avoid collision with user properties
  2905. if (hasHelpers) {
  2906. push(`const { ${ast.helpers
  2907. .map(s => `${helperNameMap[s]}: _${helperNameMap[s]}`)
  2908. .join(', ')} } = _Vue`);
  2909. push(`\n`);
  2910. newline();
  2911. }
  2912. }
  2913. // generate asset resolution statements
  2914. if (ast.components.length) {
  2915. genAssets(ast.components, 'component', context);
  2916. if (ast.directives.length || ast.temps > 0) {
  2917. newline();
  2918. }
  2919. }
  2920. if (ast.directives.length) {
  2921. genAssets(ast.directives, 'directive', context);
  2922. if (ast.temps > 0) {
  2923. newline();
  2924. }
  2925. }
  2926. if (ast.filters && ast.filters.length) {
  2927. newline();
  2928. genAssets(ast.filters, 'filter', context);
  2929. newline();
  2930. }
  2931. if (ast.temps > 0) {
  2932. push(`let `);
  2933. for (let i = 0; i < ast.temps; i++) {
  2934. push(`${i > 0 ? `, ` : ``}_temp${i}`);
  2935. }
  2936. }
  2937. if (ast.components.length || ast.directives.length || ast.temps) {
  2938. push(`\n`);
  2939. newline();
  2940. }
  2941. // generate the VNode tree expression
  2942. if (!ssr) {
  2943. push(`return `);
  2944. }
  2945. if (ast.codegenNode) {
  2946. genNode(ast.codegenNode, context);
  2947. }
  2948. else {
  2949. push(`null`);
  2950. }
  2951. if (useWithBlock) {
  2952. deindent();
  2953. push(`}`);
  2954. }
  2955. deindent();
  2956. push(`}`);
  2957. return {
  2958. ast,
  2959. code: context.code,
  2960. preamble: ``,
  2961. // SourceMapGenerator does have toJSON() method but it's not in the types
  2962. map: context.map ? context.map.toJSON() : undefined
  2963. };
  2964. }
  2965. function genFunctionPreamble(ast, context) {
  2966. const { ssr, prefixIdentifiers, push, newline, runtimeModuleName, runtimeGlobalName, ssrRuntimeModuleName } = context;
  2967. const VueBinding = runtimeGlobalName;
  2968. const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
  2969. // Generate const declaration for helpers
  2970. // In prefix mode, we place the const declaration at top so it's done
  2971. // only once; But if we not prefixing, we place the declaration inside the
  2972. // with block so it doesn't incur the `in` check cost for every helper access.
  2973. if (ast.helpers.length > 0) {
  2974. {
  2975. // "with" mode.
  2976. // save Vue in a separate variable to avoid collision
  2977. push(`const _Vue = ${VueBinding}\n`);
  2978. // in "with" mode, helpers are declared inside the with block to avoid
  2979. // has check cost, but hoists are lifted out of the function - we need
  2980. // to provide the helper here.
  2981. if (ast.hoists.length) {
  2982. const staticHelpers = [
  2983. CREATE_VNODE,
  2984. CREATE_ELEMENT_VNODE,
  2985. CREATE_COMMENT,
  2986. CREATE_TEXT,
  2987. CREATE_STATIC
  2988. ]
  2989. .filter(helper => ast.helpers.includes(helper))
  2990. .map(aliasHelper)
  2991. .join(', ');
  2992. push(`const { ${staticHelpers} } = _Vue\n`);
  2993. }
  2994. }
  2995. }
  2996. genHoists(ast.hoists, context);
  2997. newline();
  2998. push(`return `);
  2999. }
  3000. function genAssets(assets, type, { helper, push, newline, isTS }) {
  3001. const resolver = helper(type === 'filter'
  3002. ? RESOLVE_FILTER
  3003. : type === 'component'
  3004. ? RESOLVE_COMPONENT
  3005. : RESOLVE_DIRECTIVE);
  3006. for (let i = 0; i < assets.length; i++) {
  3007. let id = assets[i];
  3008. // potential component implicit self-reference inferred from SFC filename
  3009. const maybeSelfReference = id.endsWith('__self');
  3010. if (maybeSelfReference) {
  3011. id = id.slice(0, -6);
  3012. }
  3013. push(`const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`);
  3014. if (i < assets.length - 1) {
  3015. newline();
  3016. }
  3017. }
  3018. }
  3019. function genHoists(hoists, context) {
  3020. if (!hoists.length) {
  3021. return;
  3022. }
  3023. context.pure = true;
  3024. const { push, newline, helper, scopeId, mode } = context;
  3025. newline();
  3026. for (let i = 0; i < hoists.length; i++) {
  3027. const exp = hoists[i];
  3028. if (exp) {
  3029. push(`const _hoisted_${i + 1} = ${``}`);
  3030. genNode(exp, context);
  3031. newline();
  3032. }
  3033. }
  3034. context.pure = false;
  3035. }
  3036. function isText$1(n) {
  3037. return (isString(n) ||
  3038. n.type === 4 /* SIMPLE_EXPRESSION */ ||
  3039. n.type === 2 /* TEXT */ ||
  3040. n.type === 5 /* INTERPOLATION */ ||
  3041. n.type === 8 /* COMPOUND_EXPRESSION */);
  3042. }
  3043. function genNodeListAsArray(nodes, context) {
  3044. const multilines = nodes.length > 3 ||
  3045. (((process.env.NODE_ENV !== 'production')) && nodes.some(n => isArray(n) || !isText$1(n)));
  3046. context.push(`[`);
  3047. multilines && context.indent();
  3048. genNodeList(nodes, context, multilines);
  3049. multilines && context.deindent();
  3050. context.push(`]`);
  3051. }
  3052. function genNodeList(nodes, context, multilines = false, comma = true) {
  3053. const { push, newline } = context;
  3054. for (let i = 0; i < nodes.length; i++) {
  3055. const node = nodes[i];
  3056. if (isString(node)) {
  3057. push(node);
  3058. }
  3059. else if (isArray(node)) {
  3060. genNodeListAsArray(node, context);
  3061. }
  3062. else {
  3063. genNode(node, context);
  3064. }
  3065. if (i < nodes.length - 1) {
  3066. if (multilines) {
  3067. comma && push(',');
  3068. newline();
  3069. }
  3070. else {
  3071. comma && push(', ');
  3072. }
  3073. }
  3074. }
  3075. }
  3076. function genNode(node, context) {
  3077. if (isString(node)) {
  3078. context.push(node);
  3079. return;
  3080. }
  3081. if (isSymbol(node)) {
  3082. context.push(context.helper(node));
  3083. return;
  3084. }
  3085. switch (node.type) {
  3086. case 1 /* ELEMENT */:
  3087. case 9 /* IF */:
  3088. case 11 /* FOR */:
  3089. (process.env.NODE_ENV !== 'production') &&
  3090. assert(node.codegenNode != null, `Codegen node is missing for element/if/for node. ` +
  3091. `Apply appropriate transforms first.`);
  3092. genNode(node.codegenNode, context);
  3093. break;
  3094. case 2 /* TEXT */:
  3095. genText(node, context);
  3096. break;
  3097. case 4 /* SIMPLE_EXPRESSION */:
  3098. genExpression(node, context);
  3099. break;
  3100. case 5 /* INTERPOLATION */:
  3101. genInterpolation(node, context);
  3102. break;
  3103. case 12 /* TEXT_CALL */:
  3104. genNode(node.codegenNode, context);
  3105. break;
  3106. case 8 /* COMPOUND_EXPRESSION */:
  3107. genCompoundExpression(node, context);
  3108. break;
  3109. case 3 /* COMMENT */:
  3110. genComment(node, context);
  3111. break;
  3112. case 13 /* VNODE_CALL */:
  3113. genVNodeCall(node, context);
  3114. break;
  3115. case 14 /* JS_CALL_EXPRESSION */:
  3116. genCallExpression(node, context);
  3117. break;
  3118. case 15 /* JS_OBJECT_EXPRESSION */:
  3119. genObjectExpression(node, context);
  3120. break;
  3121. case 17 /* JS_ARRAY_EXPRESSION */:
  3122. genArrayExpression(node, context);
  3123. break;
  3124. case 18 /* JS_FUNCTION_EXPRESSION */:
  3125. genFunctionExpression(node, context);
  3126. break;
  3127. case 19 /* JS_CONDITIONAL_EXPRESSION */:
  3128. genConditionalExpression(node, context);
  3129. break;
  3130. case 20 /* JS_CACHE_EXPRESSION */:
  3131. genCacheExpression(node, context);
  3132. break;
  3133. case 21 /* JS_BLOCK_STATEMENT */:
  3134. genNodeList(node.body, context, true, false);
  3135. break;
  3136. // SSR only types
  3137. case 22 /* JS_TEMPLATE_LITERAL */:
  3138. break;
  3139. case 23 /* JS_IF_STATEMENT */:
  3140. break;
  3141. case 24 /* JS_ASSIGNMENT_EXPRESSION */:
  3142. break;
  3143. case 25 /* JS_SEQUENCE_EXPRESSION */:
  3144. break;
  3145. case 26 /* JS_RETURN_STATEMENT */:
  3146. break;
  3147. /* istanbul ignore next */
  3148. case 10 /* IF_BRANCH */:
  3149. // noop
  3150. break;
  3151. default:
  3152. if ((process.env.NODE_ENV !== 'production')) {
  3153. assert(false, `unhandled codegen node type: ${node.type}`);
  3154. // make sure we exhaust all possible types
  3155. const exhaustiveCheck = node;
  3156. return exhaustiveCheck;
  3157. }
  3158. }
  3159. }
  3160. function genText(node, context) {
  3161. context.push(JSON.stringify(node.content), node);
  3162. }
  3163. function genExpression(node, context) {
  3164. const { content, isStatic } = node;
  3165. context.push(isStatic ? JSON.stringify(content) : content, node);
  3166. }
  3167. function genInterpolation(node, context) {
  3168. const { push, helper, pure } = context;
  3169. if (pure)
  3170. push(PURE_ANNOTATION);
  3171. push(`${helper(TO_DISPLAY_STRING)}(`);
  3172. genNode(node.content, context);
  3173. push(`)`);
  3174. }
  3175. function genCompoundExpression(node, context) {
  3176. for (let i = 0; i < node.children.length; i++) {
  3177. const child = node.children[i];
  3178. if (isString(child)) {
  3179. context.push(child);
  3180. }
  3181. else {
  3182. genNode(child, context);
  3183. }
  3184. }
  3185. }
  3186. function genExpressionAsPropertyKey(node, context) {
  3187. const { push } = context;
  3188. if (node.type === 8 /* COMPOUND_EXPRESSION */) {
  3189. push(`[`);
  3190. genCompoundExpression(node, context);
  3191. push(`]`);
  3192. }
  3193. else if (node.isStatic) {
  3194. // only quote keys if necessary
  3195. const text = isSimpleIdentifier(node.content)
  3196. ? node.content
  3197. : JSON.stringify(node.content);
  3198. push(text, node);
  3199. }
  3200. else {
  3201. push(`[${node.content}]`, node);
  3202. }
  3203. }
  3204. function genComment(node, context) {
  3205. const { push, helper, pure } = context;
  3206. if (pure) {
  3207. push(PURE_ANNOTATION);
  3208. }
  3209. push(`${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, node);
  3210. }
  3211. function genVNodeCall(node, context) {
  3212. const { push, helper, pure } = context;
  3213. const { tag, props, children, patchFlag, dynamicProps, directives, isBlock, disableTracking, isComponent } = node;
  3214. if (directives) {
  3215. push(helper(WITH_DIRECTIVES) + `(`);
  3216. }
  3217. if (isBlock) {
  3218. push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
  3219. }
  3220. if (pure) {
  3221. push(PURE_ANNOTATION);
  3222. }
  3223. const callHelper = isBlock
  3224. ? getVNodeBlockHelper(context.inSSR, isComponent)
  3225. : getVNodeHelper(context.inSSR, isComponent);
  3226. push(helper(callHelper) + `(`, node);
  3227. genNodeList(genNullableArgs([tag, props, children, patchFlag, dynamicProps]), context);
  3228. push(`)`);
  3229. if (isBlock) {
  3230. push(`)`);
  3231. }
  3232. if (directives) {
  3233. push(`, `);
  3234. genNode(directives, context);
  3235. push(`)`);
  3236. }
  3237. }
  3238. function genNullableArgs(args) {
  3239. let i = args.length;
  3240. while (i--) {
  3241. if (args[i] != null)
  3242. break;
  3243. }
  3244. return args.slice(0, i + 1).map(arg => arg || `null`);
  3245. }
  3246. // JavaScript
  3247. function genCallExpression(node, context) {
  3248. const { push, helper, pure } = context;
  3249. const callee = isString(node.callee) ? node.callee : helper(node.callee);
  3250. if (pure) {
  3251. push(PURE_ANNOTATION);
  3252. }
  3253. push(callee + `(`, node);
  3254. genNodeList(node.arguments, context);
  3255. push(`)`);
  3256. }
  3257. function genObjectExpression(node, context) {
  3258. const { push, indent, deindent, newline } = context;
  3259. const { properties } = node;
  3260. if (!properties.length) {
  3261. push(`{}`, node);
  3262. return;
  3263. }
  3264. const multilines = properties.length > 1 ||
  3265. (((process.env.NODE_ENV !== 'production')) &&
  3266. properties.some(p => p.value.type !== 4 /* SIMPLE_EXPRESSION */));
  3267. push(multilines ? `{` : `{ `);
  3268. multilines && indent();
  3269. for (let i = 0; i < properties.length; i++) {
  3270. const { key, value } = properties[i];
  3271. // key
  3272. genExpressionAsPropertyKey(key, context);
  3273. push(`: `);
  3274. // value
  3275. genNode(value, context);
  3276. if (i < properties.length - 1) {
  3277. // will only reach this if it's multilines
  3278. push(`,`);
  3279. newline();
  3280. }
  3281. }
  3282. multilines && deindent();
  3283. push(multilines ? `}` : ` }`);
  3284. }
  3285. function genArrayExpression(node, context) {
  3286. genNodeListAsArray(node.elements, context);
  3287. }
  3288. function genFunctionExpression(node, context) {
  3289. const { push, indent, deindent } = context;
  3290. const { params, returns, body, newline, isSlot } = node;
  3291. if (isSlot) {
  3292. // wrap slot functions with owner context
  3293. push(`_${helperNameMap[WITH_CTX]}(`);
  3294. }
  3295. push(`(`, node);
  3296. if (isArray(params)) {
  3297. genNodeList(params, context);
  3298. }
  3299. else if (params) {
  3300. genNode(params, context);
  3301. }
  3302. push(`) => `);
  3303. if (newline || body) {
  3304. push(`{`);
  3305. indent();
  3306. }
  3307. if (returns) {
  3308. if (newline) {
  3309. push(`return `);
  3310. }
  3311. if (isArray(returns)) {
  3312. genNodeListAsArray(returns, context);
  3313. }
  3314. else {
  3315. genNode(returns, context);
  3316. }
  3317. }
  3318. else if (body) {
  3319. genNode(body, context);
  3320. }
  3321. if (newline || body) {
  3322. deindent();
  3323. push(`}`);
  3324. }
  3325. if (isSlot) {
  3326. if (node.isNonScopedSlot) {
  3327. push(`, undefined, true`);
  3328. }
  3329. push(`)`);
  3330. }
  3331. }
  3332. function genConditionalExpression(node, context) {
  3333. const { test, consequent, alternate, newline: needNewline } = node;
  3334. const { push, indent, deindent, newline } = context;
  3335. if (test.type === 4 /* SIMPLE_EXPRESSION */) {
  3336. const needsParens = !isSimpleIdentifier(test.content);
  3337. needsParens && push(`(`);
  3338. genExpression(test, context);
  3339. needsParens && push(`)`);
  3340. }
  3341. else {
  3342. push(`(`);
  3343. genNode(test, context);
  3344. push(`)`);
  3345. }
  3346. needNewline && indent();
  3347. context.indentLevel++;
  3348. needNewline || push(` `);
  3349. push(`? `);
  3350. genNode(consequent, context);
  3351. context.indentLevel--;
  3352. needNewline && newline();
  3353. needNewline || push(` `);
  3354. push(`: `);
  3355. const isNested = alternate.type === 19 /* JS_CONDITIONAL_EXPRESSION */;
  3356. if (!isNested) {
  3357. context.indentLevel++;
  3358. }
  3359. genNode(alternate, context);
  3360. if (!isNested) {
  3361. context.indentLevel--;
  3362. }
  3363. needNewline && deindent(true /* without newline */);
  3364. }
  3365. function genCacheExpression(node, context) {
  3366. const { push, helper, indent, deindent, newline } = context;
  3367. push(`_cache[${node.index}] || (`);
  3368. if (node.isVNode) {
  3369. indent();
  3370. push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
  3371. newline();
  3372. }
  3373. push(`_cache[${node.index}] = `);
  3374. genNode(node.value, context);
  3375. if (node.isVNode) {
  3376. push(`,`);
  3377. newline();
  3378. push(`${helper(SET_BLOCK_TRACKING)}(1),`);
  3379. newline();
  3380. push(`_cache[${node.index}]`);
  3381. deindent();
  3382. }
  3383. push(`)`);
  3384. }
  3385. function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = Object.create(null)) {
  3386. {
  3387. return;
  3388. }
  3389. }
  3390. function isReferencedIdentifier(id, parent, parentStack) {
  3391. {
  3392. return false;
  3393. }
  3394. }
  3395. function isInDestructureAssignment(parent, parentStack) {
  3396. if (parent &&
  3397. (parent.type === 'ObjectProperty' || parent.type === 'ArrayPattern')) {
  3398. let i = parentStack.length;
  3399. while (i--) {
  3400. const p = parentStack[i];
  3401. if (p.type === 'AssignmentExpression') {
  3402. return true;
  3403. }
  3404. else if (p.type !== 'ObjectProperty' && !p.type.endsWith('Pattern')) {
  3405. break;
  3406. }
  3407. }
  3408. }
  3409. return false;
  3410. }
  3411. function walkFunctionParams(node, onIdent) {
  3412. for (const p of node.params) {
  3413. for (const id of extractIdentifiers(p)) {
  3414. onIdent(id);
  3415. }
  3416. }
  3417. }
  3418. function walkBlockDeclarations(block, onIdent) {
  3419. for (const stmt of block.body) {
  3420. if (stmt.type === 'VariableDeclaration') {
  3421. if (stmt.declare)
  3422. continue;
  3423. for (const decl of stmt.declarations) {
  3424. for (const id of extractIdentifiers(decl.id)) {
  3425. onIdent(id);
  3426. }
  3427. }
  3428. }
  3429. else if (stmt.type === 'FunctionDeclaration' ||
  3430. stmt.type === 'ClassDeclaration') {
  3431. if (stmt.declare || !stmt.id)
  3432. continue;
  3433. onIdent(stmt.id);
  3434. }
  3435. }
  3436. }
  3437. function extractIdentifiers(param, nodes = []) {
  3438. switch (param.type) {
  3439. case 'Identifier':
  3440. nodes.push(param);
  3441. break;
  3442. case 'MemberExpression':
  3443. let object = param;
  3444. while (object.type === 'MemberExpression') {
  3445. object = object.object;
  3446. }
  3447. nodes.push(object);
  3448. break;
  3449. case 'ObjectPattern':
  3450. for (const prop of param.properties) {
  3451. if (prop.type === 'RestElement') {
  3452. extractIdentifiers(prop.argument, nodes);
  3453. }
  3454. else {
  3455. extractIdentifiers(prop.value, nodes);
  3456. }
  3457. }
  3458. break;
  3459. case 'ArrayPattern':
  3460. param.elements.forEach(element => {
  3461. if (element)
  3462. extractIdentifiers(element, nodes);
  3463. });
  3464. break;
  3465. case 'RestElement':
  3466. extractIdentifiers(param.argument, nodes);
  3467. break;
  3468. case 'AssignmentPattern':
  3469. extractIdentifiers(param.left, nodes);
  3470. break;
  3471. }
  3472. return nodes;
  3473. }
  3474. const isFunctionType = (node) => {
  3475. return /Function(?:Expression|Declaration)$|Method$/.test(node.type);
  3476. };
  3477. const isStaticProperty = (node) => node &&
  3478. (node.type === 'ObjectProperty' || node.type === 'ObjectMethod') &&
  3479. !node.computed;
  3480. const isStaticPropertyKey = (node, parent) => isStaticProperty(parent) && parent.key === node;
  3481. // these keywords should not appear inside expressions, but operators like
  3482. // typeof, instanceof and in are allowed
  3483. const prohibitedKeywordRE = new RegExp('\\b' +
  3484. ('do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  3485. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  3486. 'extends,finally,continue,debugger,function,arguments,typeof,void')
  3487. .split(',')
  3488. .join('\\b|\\b') +
  3489. '\\b');
  3490. // strip strings in expressions
  3491. const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  3492. /**
  3493. * Validate a non-prefixed expression.
  3494. * This is only called when using the in-browser runtime compiler since it
  3495. * doesn't prefix expressions.
  3496. */
  3497. function validateBrowserExpression(node, context, asParams = false, asRawStatements = false) {
  3498. const exp = node.content;
  3499. // empty expressions are validated per-directive since some directives
  3500. // do allow empty expressions.
  3501. if (!exp.trim()) {
  3502. return;
  3503. }
  3504. try {
  3505. new Function(asRawStatements
  3506. ? ` ${exp} `
  3507. : `return ${asParams ? `(${exp}) => {}` : `(${exp})`}`);
  3508. }
  3509. catch (e) {
  3510. let message = e.message;
  3511. const keywordMatch = exp
  3512. .replace(stripStringRE, '')
  3513. .match(prohibitedKeywordRE);
  3514. if (keywordMatch) {
  3515. message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
  3516. }
  3517. context.onError(createCompilerError(44 /* X_INVALID_EXPRESSION */, node.loc, undefined, message));
  3518. }
  3519. }
  3520. const transformExpression = (node, context) => {
  3521. if (node.type === 5 /* INTERPOLATION */) {
  3522. node.content = processExpression(node.content, context);
  3523. }
  3524. else if (node.type === 1 /* ELEMENT */) {
  3525. // handle directives on element
  3526. for (let i = 0; i < node.props.length; i++) {
  3527. const dir = node.props[i];
  3528. // do not process for v-on & v-for since they are special handled
  3529. if (dir.type === 7 /* DIRECTIVE */ && dir.name !== 'for') {
  3530. const exp = dir.exp;
  3531. const arg = dir.arg;
  3532. // do not process exp if this is v-on:arg - we need special handling
  3533. // for wrapping inline statements.
  3534. if (exp &&
  3535. exp.type === 4 /* SIMPLE_EXPRESSION */ &&
  3536. !(dir.name === 'on' && arg)) {
  3537. dir.exp = processExpression(exp, context,
  3538. // slot args must be processed as function params
  3539. dir.name === 'slot');
  3540. }
  3541. if (arg && arg.type === 4 /* SIMPLE_EXPRESSION */ && !arg.isStatic) {
  3542. dir.arg = processExpression(arg, context);
  3543. }
  3544. }
  3545. }
  3546. }
  3547. };
  3548. // Important: since this function uses Node.js only dependencies, it should
  3549. // always be used with a leading !true check so that it can be
  3550. // tree-shaken from the browser build.
  3551. function processExpression(node, context,
  3552. // some expressions like v-slot props & v-for aliases should be parsed as
  3553. // function params
  3554. asParams = false,
  3555. // v-on handler values may contain multiple statements
  3556. asRawStatements = false, localVars = Object.create(context.identifiers)) {
  3557. {
  3558. if ((process.env.NODE_ENV !== 'production')) {
  3559. // simple in-browser validation (same logic in 2.x)
  3560. validateBrowserExpression(node, context, asParams, asRawStatements);
  3561. }
  3562. return node;
  3563. }
  3564. }
  3565. const transformIf = createStructuralDirectiveTransform(/^(if|else|else-if)$/, (node, dir, context) => {
  3566. return processIf(node, dir, context, (ifNode, branch, isRoot) => {
  3567. // #1587: We need to dynamically increment the key based on the current
  3568. // node's sibling nodes, since chained v-if/else branches are
  3569. // rendered at the same depth
  3570. const siblings = context.parent.children;
  3571. let i = siblings.indexOf(ifNode);
  3572. let key = 0;
  3573. while (i-- >= 0) {
  3574. const sibling = siblings[i];
  3575. if (sibling && sibling.type === 9 /* IF */) {
  3576. key += sibling.branches.length;
  3577. }
  3578. }
  3579. // Exit callback. Complete the codegenNode when all children have been
  3580. // transformed.
  3581. return () => {
  3582. if (isRoot) {
  3583. ifNode.codegenNode = createCodegenNodeForBranch(branch, key, context);
  3584. }
  3585. else {
  3586. // attach this branch's codegen node to the v-if root.
  3587. const parentCondition = getParentCondition(ifNode.codegenNode);
  3588. parentCondition.alternate = createCodegenNodeForBranch(branch, key + ifNode.branches.length - 1, context);
  3589. }
  3590. };
  3591. });
  3592. });
  3593. // target-agnostic transform used for both Client and SSR
  3594. function processIf(node, dir, context, processCodegen) {
  3595. if (dir.name !== 'else' &&
  3596. (!dir.exp || !dir.exp.content.trim())) {
  3597. const loc = dir.exp ? dir.exp.loc : node.loc;
  3598. context.onError(createCompilerError(28 /* X_V_IF_NO_EXPRESSION */, dir.loc));
  3599. dir.exp = createSimpleExpression(`true`, false, loc);
  3600. }
  3601. if ((process.env.NODE_ENV !== 'production') && true && dir.exp) {
  3602. validateBrowserExpression(dir.exp, context);
  3603. }
  3604. if (dir.name === 'if') {
  3605. const branch = createIfBranch(node, dir);
  3606. const ifNode = {
  3607. type: 9 /* IF */,
  3608. loc: node.loc,
  3609. branches: [branch]
  3610. };
  3611. context.replaceNode(ifNode);
  3612. if (processCodegen) {
  3613. return processCodegen(ifNode, branch, true);
  3614. }
  3615. }
  3616. else {
  3617. // locate the adjacent v-if
  3618. const siblings = context.parent.children;
  3619. const comments = [];
  3620. let i = siblings.indexOf(node);
  3621. while (i-- >= -1) {
  3622. const sibling = siblings[i];
  3623. if ((process.env.NODE_ENV !== 'production') && sibling && sibling.type === 3 /* COMMENT */) {
  3624. context.removeNode(sibling);
  3625. comments.unshift(sibling);
  3626. continue;
  3627. }
  3628. if (sibling &&
  3629. sibling.type === 2 /* TEXT */ &&
  3630. !sibling.content.trim().length) {
  3631. context.removeNode(sibling);
  3632. continue;
  3633. }
  3634. if (sibling && sibling.type === 9 /* IF */) {
  3635. // Check if v-else was followed by v-else-if
  3636. if (dir.name === 'else-if' &&
  3637. sibling.branches[sibling.branches.length - 1].condition === undefined) {
  3638. context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
  3639. }
  3640. // move the node to the if node's branches
  3641. context.removeNode();
  3642. const branch = createIfBranch(node, dir);
  3643. if ((process.env.NODE_ENV !== 'production') &&
  3644. comments.length &&
  3645. // #3619 ignore comments if the v-if is direct child of <transition>
  3646. !(context.parent &&
  3647. context.parent.type === 1 /* ELEMENT */ &&
  3648. isBuiltInType(context.parent.tag, 'transition'))) {
  3649. branch.children = [...comments, ...branch.children];
  3650. }
  3651. // check if user is forcing same key on different branches
  3652. if ((process.env.NODE_ENV !== 'production') || !true) {
  3653. const key = branch.userKey;
  3654. if (key) {
  3655. sibling.branches.forEach(({ userKey }) => {
  3656. if (isSameKey(userKey, key)) {
  3657. context.onError(createCompilerError(29 /* X_V_IF_SAME_KEY */, branch.userKey.loc));
  3658. }
  3659. });
  3660. }
  3661. }
  3662. sibling.branches.push(branch);
  3663. const onExit = processCodegen && processCodegen(sibling, branch, false);
  3664. // since the branch was removed, it will not be traversed.
  3665. // make sure to traverse here.
  3666. traverseNode(branch, context);
  3667. // call on exit
  3668. if (onExit)
  3669. onExit();
  3670. // make sure to reset currentNode after traversal to indicate this
  3671. // node has been removed.
  3672. context.currentNode = null;
  3673. }
  3674. else {
  3675. context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
  3676. }
  3677. break;
  3678. }
  3679. }
  3680. }
  3681. function createIfBranch(node, dir) {
  3682. return {
  3683. type: 10 /* IF_BRANCH */,
  3684. loc: node.loc,
  3685. condition: dir.name === 'else' ? undefined : dir.exp,
  3686. children: node.tagType === 3 /* TEMPLATE */ && !findDir(node, 'for')
  3687. ? node.children
  3688. : [node],
  3689. userKey: findProp(node, `key`)
  3690. };
  3691. }
  3692. function createCodegenNodeForBranch(branch, keyIndex, context) {
  3693. if (branch.condition) {
  3694. return createConditionalExpression(branch.condition, createChildrenCodegenNode(branch, keyIndex, context),
  3695. // make sure to pass in asBlock: true so that the comment node call
  3696. // closes the current block.
  3697. createCallExpression(context.helper(CREATE_COMMENT), [
  3698. (process.env.NODE_ENV !== 'production') ? '"v-if"' : '""',
  3699. 'true'
  3700. ]));
  3701. }
  3702. else {
  3703. return createChildrenCodegenNode(branch, keyIndex, context);
  3704. }
  3705. }
  3706. function createChildrenCodegenNode(branch, keyIndex, context) {
  3707. const { helper } = context;
  3708. const keyProperty = createObjectProperty(`key`, createSimpleExpression(`${keyIndex}`, false, locStub, 2 /* CAN_HOIST */));
  3709. const { children } = branch;
  3710. const firstChild = children[0];
  3711. const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1 /* ELEMENT */;
  3712. if (needFragmentWrapper) {
  3713. if (children.length === 1 && firstChild.type === 11 /* FOR */) {
  3714. // optimize away nested fragments when child is a ForNode
  3715. const vnodeCall = firstChild.codegenNode;
  3716. injectProp(vnodeCall, keyProperty, context);
  3717. return vnodeCall;
  3718. }
  3719. else {
  3720. let patchFlag = 64 /* STABLE_FRAGMENT */;
  3721. let patchFlagText = PatchFlagNames[64 /* STABLE_FRAGMENT */];
  3722. // check if the fragment actually contains a single valid child with
  3723. // the rest being comments
  3724. if ((process.env.NODE_ENV !== 'production') &&
  3725. children.filter(c => c.type !== 3 /* COMMENT */).length === 1) {
  3726. patchFlag |= 2048 /* DEV_ROOT_FRAGMENT */;
  3727. patchFlagText += `, ${PatchFlagNames[2048 /* DEV_ROOT_FRAGMENT */]}`;
  3728. }
  3729. return createVNodeCall(context, helper(FRAGMENT), createObjectExpression([keyProperty]), children, patchFlag + ((process.env.NODE_ENV !== 'production') ? ` /* ${patchFlagText} */` : ``), undefined, undefined, true, false, false /* isComponent */, branch.loc);
  3730. }
  3731. }
  3732. else {
  3733. const ret = firstChild.codegenNode;
  3734. const vnodeCall = getMemoedVNodeCall(ret);
  3735. // Change createVNode to createBlock.
  3736. if (vnodeCall.type === 13 /* VNODE_CALL */) {
  3737. makeBlock(vnodeCall, context);
  3738. }
  3739. // inject branch key
  3740. injectProp(vnodeCall, keyProperty, context);
  3741. return ret;
  3742. }
  3743. }
  3744. function isSameKey(a, b) {
  3745. if (!a || a.type !== b.type) {
  3746. return false;
  3747. }
  3748. if (a.type === 6 /* ATTRIBUTE */) {
  3749. if (a.value.content !== b.value.content) {
  3750. return false;
  3751. }
  3752. }
  3753. else {
  3754. // directive
  3755. const exp = a.exp;
  3756. const branchExp = b.exp;
  3757. if (exp.type !== branchExp.type) {
  3758. return false;
  3759. }
  3760. if (exp.type !== 4 /* SIMPLE_EXPRESSION */ ||
  3761. exp.isStatic !== branchExp.isStatic ||
  3762. exp.content !== branchExp.content) {
  3763. return false;
  3764. }
  3765. }
  3766. return true;
  3767. }
  3768. function getParentCondition(node) {
  3769. while (true) {
  3770. if (node.type === 19 /* JS_CONDITIONAL_EXPRESSION */) {
  3771. if (node.alternate.type === 19 /* JS_CONDITIONAL_EXPRESSION */) {
  3772. node = node.alternate;
  3773. }
  3774. else {
  3775. return node;
  3776. }
  3777. }
  3778. else if (node.type === 20 /* JS_CACHE_EXPRESSION */) {
  3779. node = node.value;
  3780. }
  3781. }
  3782. }
  3783. const transformFor = createStructuralDirectiveTransform('for', (node, dir, context) => {
  3784. const { helper, removeHelper } = context;
  3785. return processFor(node, dir, context, forNode => {
  3786. // create the loop render function expression now, and add the
  3787. // iterator on exit after all children have been traversed
  3788. const renderExp = createCallExpression(helper(RENDER_LIST), [
  3789. forNode.source
  3790. ]);
  3791. const isTemplate = isTemplateNode(node);
  3792. const memo = findDir(node, 'memo');
  3793. const keyProp = findProp(node, `key`);
  3794. const keyExp = keyProp &&
  3795. (keyProp.type === 6 /* ATTRIBUTE */
  3796. ? createSimpleExpression(keyProp.value.content, true)
  3797. : keyProp.exp);
  3798. const keyProperty = keyProp ? createObjectProperty(`key`, keyExp) : null;
  3799. const isStableFragment = forNode.source.type === 4 /* SIMPLE_EXPRESSION */ &&
  3800. forNode.source.constType > 0 /* NOT_CONSTANT */;
  3801. const fragmentFlag = isStableFragment
  3802. ? 64 /* STABLE_FRAGMENT */
  3803. : keyProp
  3804. ? 128 /* KEYED_FRAGMENT */
  3805. : 256 /* UNKEYED_FRAGMENT */;
  3806. forNode.codegenNode = createVNodeCall(context, helper(FRAGMENT), undefined, renderExp, fragmentFlag +
  3807. ((process.env.NODE_ENV !== 'production') ? ` /* ${PatchFlagNames[fragmentFlag]} */` : ``), undefined, undefined, true /* isBlock */, !isStableFragment /* disableTracking */, false /* isComponent */, node.loc);
  3808. return () => {
  3809. // finish the codegen now that all children have been traversed
  3810. let childBlock;
  3811. const { children } = forNode;
  3812. // check <template v-for> key placement
  3813. if (((process.env.NODE_ENV !== 'production') || !true) && isTemplate) {
  3814. node.children.some(c => {
  3815. if (c.type === 1 /* ELEMENT */) {
  3816. const key = findProp(c, 'key');
  3817. if (key) {
  3818. context.onError(createCompilerError(33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */, key.loc));
  3819. return true;
  3820. }
  3821. }
  3822. });
  3823. }
  3824. const needFragmentWrapper = children.length !== 1 || children[0].type !== 1 /* ELEMENT */;
  3825. const slotOutlet = isSlotOutlet(node)
  3826. ? node
  3827. : isTemplate &&
  3828. node.children.length === 1 &&
  3829. isSlotOutlet(node.children[0])
  3830. ? node.children[0] // api-extractor somehow fails to infer this
  3831. : null;
  3832. if (slotOutlet) {
  3833. // <slot v-for="..."> or <template v-for="..."><slot/></template>
  3834. childBlock = slotOutlet.codegenNode;
  3835. if (isTemplate && keyProperty) {
  3836. // <template v-for="..." :key="..."><slot/></template>
  3837. // we need to inject the key to the renderSlot() call.
  3838. // the props for renderSlot is passed as the 3rd argument.
  3839. injectProp(childBlock, keyProperty, context);
  3840. }
  3841. }
  3842. else if (needFragmentWrapper) {
  3843. // <template v-for="..."> with text or multi-elements
  3844. // should generate a fragment block for each loop
  3845. childBlock = createVNodeCall(context, helper(FRAGMENT), keyProperty ? createObjectExpression([keyProperty]) : undefined, node.children, 64 /* STABLE_FRAGMENT */ +
  3846. ((process.env.NODE_ENV !== 'production')
  3847. ? ` /* ${PatchFlagNames[64 /* STABLE_FRAGMENT */]} */`
  3848. : ``), undefined, undefined, true, undefined, false /* isComponent */);
  3849. }
  3850. else {
  3851. // Normal element v-for. Directly use the child's codegenNode
  3852. // but mark it as a block.
  3853. childBlock = children[0]
  3854. .codegenNode;
  3855. if (isTemplate && keyProperty) {
  3856. injectProp(childBlock, keyProperty, context);
  3857. }
  3858. if (childBlock.isBlock !== !isStableFragment) {
  3859. if (childBlock.isBlock) {
  3860. // switch from block to vnode
  3861. removeHelper(OPEN_BLOCK);
  3862. removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
  3863. }
  3864. else {
  3865. // switch from vnode to block
  3866. removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
  3867. }
  3868. }
  3869. childBlock.isBlock = !isStableFragment;
  3870. if (childBlock.isBlock) {
  3871. helper(OPEN_BLOCK);
  3872. helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
  3873. }
  3874. else {
  3875. helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
  3876. }
  3877. }
  3878. if (memo) {
  3879. const loop = createFunctionExpression(createForLoopParams(forNode.parseResult, [
  3880. createSimpleExpression(`_cached`)
  3881. ]));
  3882. loop.body = createBlockStatement([
  3883. createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
  3884. createCompoundExpression([
  3885. `if (_cached`,
  3886. ...(keyExp ? [` && _cached.key === `, keyExp] : []),
  3887. ` && ${context.helperString(IS_MEMO_SAME)}(_cached, _memo)) return _cached`
  3888. ]),
  3889. createCompoundExpression([`const _item = `, childBlock]),
  3890. createSimpleExpression(`_item.memo = _memo`),
  3891. createSimpleExpression(`return _item`)
  3892. ]);
  3893. renderExp.arguments.push(loop, createSimpleExpression(`_cache`), createSimpleExpression(String(context.cached++)));
  3894. }
  3895. else {
  3896. renderExp.arguments.push(createFunctionExpression(createForLoopParams(forNode.parseResult), childBlock, true /* force newline */));
  3897. }
  3898. };
  3899. });
  3900. });
  3901. // target-agnostic transform used for both Client and SSR
  3902. function processFor(node, dir, context, processCodegen) {
  3903. if (!dir.exp) {
  3904. context.onError(createCompilerError(31 /* X_V_FOR_NO_EXPRESSION */, dir.loc));
  3905. return;
  3906. }
  3907. const parseResult = parseForExpression(
  3908. // can only be simple expression because vFor transform is applied
  3909. // before expression transform.
  3910. dir.exp, context);
  3911. if (!parseResult) {
  3912. context.onError(createCompilerError(32 /* X_V_FOR_MALFORMED_EXPRESSION */, dir.loc));
  3913. return;
  3914. }
  3915. const { addIdentifiers, removeIdentifiers, scopes } = context;
  3916. const { source, value, key, index } = parseResult;
  3917. const forNode = {
  3918. type: 11 /* FOR */,
  3919. loc: dir.loc,
  3920. source,
  3921. valueAlias: value,
  3922. keyAlias: key,
  3923. objectIndexAlias: index,
  3924. parseResult,
  3925. children: isTemplateNode(node) ? node.children : [node]
  3926. };
  3927. context.replaceNode(forNode);
  3928. // bookkeeping
  3929. scopes.vFor++;
  3930. const onExit = processCodegen && processCodegen(forNode);
  3931. return () => {
  3932. scopes.vFor--;
  3933. if (onExit)
  3934. onExit();
  3935. };
  3936. }
  3937. const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  3938. // This regex doesn't cover the case if key or index aliases have destructuring,
  3939. // but those do not make sense in the first place, so this works in practice.
  3940. const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  3941. const stripParensRE = /^\(|\)$/g;
  3942. function parseForExpression(input, context) {
  3943. const loc = input.loc;
  3944. const exp = input.content;
  3945. const inMatch = exp.match(forAliasRE);
  3946. if (!inMatch)
  3947. return;
  3948. const [, LHS, RHS] = inMatch;
  3949. const result = {
  3950. source: createAliasExpression(loc, RHS.trim(), exp.indexOf(RHS, LHS.length)),
  3951. value: undefined,
  3952. key: undefined,
  3953. index: undefined
  3954. };
  3955. if ((process.env.NODE_ENV !== 'production') && true) {
  3956. validateBrowserExpression(result.source, context);
  3957. }
  3958. let valueContent = LHS.trim().replace(stripParensRE, '').trim();
  3959. const trimmedOffset = LHS.indexOf(valueContent);
  3960. const iteratorMatch = valueContent.match(forIteratorRE);
  3961. if (iteratorMatch) {
  3962. valueContent = valueContent.replace(forIteratorRE, '').trim();
  3963. const keyContent = iteratorMatch[1].trim();
  3964. let keyOffset;
  3965. if (keyContent) {
  3966. keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
  3967. result.key = createAliasExpression(loc, keyContent, keyOffset);
  3968. if ((process.env.NODE_ENV !== 'production') && true) {
  3969. validateBrowserExpression(result.key, context, true);
  3970. }
  3971. }
  3972. if (iteratorMatch[2]) {
  3973. const indexContent = iteratorMatch[2].trim();
  3974. if (indexContent) {
  3975. result.index = createAliasExpression(loc, indexContent, exp.indexOf(indexContent, result.key
  3976. ? keyOffset + keyContent.length
  3977. : trimmedOffset + valueContent.length));
  3978. if ((process.env.NODE_ENV !== 'production') && true) {
  3979. validateBrowserExpression(result.index, context, true);
  3980. }
  3981. }
  3982. }
  3983. }
  3984. if (valueContent) {
  3985. result.value = createAliasExpression(loc, valueContent, trimmedOffset);
  3986. if ((process.env.NODE_ENV !== 'production') && true) {
  3987. validateBrowserExpression(result.value, context, true);
  3988. }
  3989. }
  3990. return result;
  3991. }
  3992. function createAliasExpression(range, content, offset) {
  3993. return createSimpleExpression(content, false, getInnerRange(range, offset, content.length));
  3994. }
  3995. function createForLoopParams({ value, key, index }, memoArgs = []) {
  3996. return createParamsList([value, key, index, ...memoArgs]);
  3997. }
  3998. function createParamsList(args) {
  3999. let i = args.length;
  4000. while (i--) {
  4001. if (args[i])
  4002. break;
  4003. }
  4004. return args
  4005. .slice(0, i + 1)
  4006. .map((arg, i) => arg || createSimpleExpression(`_`.repeat(i + 1), false));
  4007. }
  4008. const defaultFallback = createSimpleExpression(`undefined`, false);
  4009. // A NodeTransform that:
  4010. // 1. Tracks scope identifiers for scoped slots so that they don't get prefixed
  4011. // by transformExpression. This is only applied in non-browser builds with
  4012. // { prefixIdentifiers: true }.
  4013. // 2. Track v-slot depths so that we know a slot is inside another slot.
  4014. // Note the exit callback is executed before buildSlots() on the same node,
  4015. // so only nested slots see positive numbers.
  4016. const trackSlotScopes = (node, context) => {
  4017. if (node.type === 1 /* ELEMENT */ &&
  4018. (node.tagType === 1 /* COMPONENT */ ||
  4019. node.tagType === 3 /* TEMPLATE */)) {
  4020. // We are only checking non-empty v-slot here
  4021. // since we only care about slots that introduce scope variables.
  4022. const vSlot = findDir(node, 'slot');
  4023. if (vSlot) {
  4024. context.scopes.vSlot++;
  4025. return () => {
  4026. context.scopes.vSlot--;
  4027. };
  4028. }
  4029. }
  4030. };
  4031. // A NodeTransform that tracks scope identifiers for scoped slots with v-for.
  4032. // This transform is only applied in non-browser builds with { prefixIdentifiers: true }
  4033. const trackVForSlotScopes = (node, context) => {
  4034. let vFor;
  4035. if (isTemplateNode(node) &&
  4036. node.props.some(isVSlot) &&
  4037. (vFor = findDir(node, 'for'))) {
  4038. const result = (vFor.parseResult = parseForExpression(vFor.exp, context));
  4039. if (result) {
  4040. const { value, key, index } = result;
  4041. const { addIdentifiers, removeIdentifiers } = context;
  4042. value && addIdentifiers(value);
  4043. key && addIdentifiers(key);
  4044. index && addIdentifiers(index);
  4045. return () => {
  4046. value && removeIdentifiers(value);
  4047. key && removeIdentifiers(key);
  4048. index && removeIdentifiers(index);
  4049. };
  4050. }
  4051. }
  4052. };
  4053. const buildClientSlotFn = (props, children, loc) => createFunctionExpression(props, children, false /* newline */, true /* isSlot */, children.length ? children[0].loc : loc);
  4054. // Instead of being a DirectiveTransform, v-slot processing is called during
  4055. // transformElement to build the slots object for a component.
  4056. function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
  4057. context.helper(WITH_CTX);
  4058. const { children, loc } = node;
  4059. const slotsProperties = [];
  4060. const dynamicSlots = [];
  4061. // If the slot is inside a v-for or another v-slot, force it to be dynamic
  4062. // since it likely uses a scope variable.
  4063. let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
  4064. // 1. Check for slot with slotProps on component itself.
  4065. // <Comp v-slot="{ prop }"/>
  4066. const onComponentSlot = findDir(node, 'slot', true);
  4067. if (onComponentSlot) {
  4068. const { arg, exp } = onComponentSlot;
  4069. if (arg && !isStaticExp(arg)) {
  4070. hasDynamicSlots = true;
  4071. }
  4072. slotsProperties.push(createObjectProperty(arg || createSimpleExpression('default', true), buildSlotFn(exp, children, loc)));
  4073. }
  4074. // 2. Iterate through children and check for template slots
  4075. // <template v-slot:foo="{ prop }">
  4076. let hasTemplateSlots = false;
  4077. let hasNamedDefaultSlot = false;
  4078. const implicitDefaultChildren = [];
  4079. const seenSlotNames = new Set();
  4080. for (let i = 0; i < children.length; i++) {
  4081. const slotElement = children[i];
  4082. let slotDir;
  4083. if (!isTemplateNode(slotElement) ||
  4084. !(slotDir = findDir(slotElement, 'slot', true))) {
  4085. // not a <template v-slot>, skip.
  4086. if (slotElement.type !== 3 /* COMMENT */) {
  4087. implicitDefaultChildren.push(slotElement);
  4088. }
  4089. continue;
  4090. }
  4091. if (onComponentSlot) {
  4092. // already has on-component slot - this is incorrect usage.
  4093. context.onError(createCompilerError(37 /* X_V_SLOT_MIXED_SLOT_USAGE */, slotDir.loc));
  4094. break;
  4095. }
  4096. hasTemplateSlots = true;
  4097. const { children: slotChildren, loc: slotLoc } = slotElement;
  4098. const { arg: slotName = createSimpleExpression(`default`, true), exp: slotProps, loc: dirLoc } = slotDir;
  4099. // check if name is dynamic.
  4100. let staticSlotName;
  4101. if (isStaticExp(slotName)) {
  4102. staticSlotName = slotName ? slotName.content : `default`;
  4103. }
  4104. else {
  4105. hasDynamicSlots = true;
  4106. }
  4107. const slotFunction = buildSlotFn(slotProps, slotChildren, slotLoc);
  4108. // check if this slot is conditional (v-if/v-for)
  4109. let vIf;
  4110. let vElse;
  4111. let vFor;
  4112. if ((vIf = findDir(slotElement, 'if'))) {
  4113. hasDynamicSlots = true;
  4114. dynamicSlots.push(createConditionalExpression(vIf.exp, buildDynamicSlot(slotName, slotFunction), defaultFallback));
  4115. }
  4116. else if ((vElse = findDir(slotElement, /^else(-if)?$/, true /* allowEmpty */))) {
  4117. // find adjacent v-if
  4118. let j = i;
  4119. let prev;
  4120. while (j--) {
  4121. prev = children[j];
  4122. if (prev.type !== 3 /* COMMENT */) {
  4123. break;
  4124. }
  4125. }
  4126. if (prev && isTemplateNode(prev) && findDir(prev, 'if')) {
  4127. // remove node
  4128. children.splice(i, 1);
  4129. i--;
  4130. // attach this slot to previous conditional
  4131. let conditional = dynamicSlots[dynamicSlots.length - 1];
  4132. while (conditional.alternate.type === 19 /* JS_CONDITIONAL_EXPRESSION */) {
  4133. conditional = conditional.alternate;
  4134. }
  4135. conditional.alternate = vElse.exp
  4136. ? createConditionalExpression(vElse.exp, buildDynamicSlot(slotName, slotFunction), defaultFallback)
  4137. : buildDynamicSlot(slotName, slotFunction);
  4138. }
  4139. else {
  4140. context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, vElse.loc));
  4141. }
  4142. }
  4143. else if ((vFor = findDir(slotElement, 'for'))) {
  4144. hasDynamicSlots = true;
  4145. const parseResult = vFor.parseResult ||
  4146. parseForExpression(vFor.exp, context);
  4147. if (parseResult) {
  4148. // Render the dynamic slots as an array and add it to the createSlot()
  4149. // args. The runtime knows how to handle it appropriately.
  4150. dynamicSlots.push(createCallExpression(context.helper(RENDER_LIST), [
  4151. parseResult.source,
  4152. createFunctionExpression(createForLoopParams(parseResult), buildDynamicSlot(slotName, slotFunction), true /* force newline */)
  4153. ]));
  4154. }
  4155. else {
  4156. context.onError(createCompilerError(32 /* X_V_FOR_MALFORMED_EXPRESSION */, vFor.loc));
  4157. }
  4158. }
  4159. else {
  4160. // check duplicate static names
  4161. if (staticSlotName) {
  4162. if (seenSlotNames.has(staticSlotName)) {
  4163. context.onError(createCompilerError(38 /* X_V_SLOT_DUPLICATE_SLOT_NAMES */, dirLoc));
  4164. continue;
  4165. }
  4166. seenSlotNames.add(staticSlotName);
  4167. if (staticSlotName === 'default') {
  4168. hasNamedDefaultSlot = true;
  4169. }
  4170. }
  4171. slotsProperties.push(createObjectProperty(slotName, slotFunction));
  4172. }
  4173. }
  4174. if (!onComponentSlot) {
  4175. const buildDefaultSlotProperty = (props, children) => {
  4176. const fn = buildSlotFn(props, children, loc);
  4177. if (context.compatConfig) {
  4178. fn.isNonScopedSlot = true;
  4179. }
  4180. return createObjectProperty(`default`, fn);
  4181. };
  4182. if (!hasTemplateSlots) {
  4183. // implicit default slot (on component)
  4184. slotsProperties.push(buildDefaultSlotProperty(undefined, children));
  4185. }
  4186. else if (implicitDefaultChildren.length &&
  4187. // #3766
  4188. // with whitespace: 'preserve', whitespaces between slots will end up in
  4189. // implicitDefaultChildren. Ignore if all implicit children are whitespaces.
  4190. implicitDefaultChildren.some(node => isNonWhitespaceContent(node))) {
  4191. // implicit default slot (mixed with named slots)
  4192. if (hasNamedDefaultSlot) {
  4193. context.onError(createCompilerError(39 /* X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN */, implicitDefaultChildren[0].loc));
  4194. }
  4195. else {
  4196. slotsProperties.push(buildDefaultSlotProperty(undefined, implicitDefaultChildren));
  4197. }
  4198. }
  4199. }
  4200. const slotFlag = hasDynamicSlots
  4201. ? 2 /* DYNAMIC */
  4202. : hasForwardedSlots(node.children)
  4203. ? 3 /* FORWARDED */
  4204. : 1 /* STABLE */;
  4205. let slots = createObjectExpression(slotsProperties.concat(createObjectProperty(`_`,
  4206. // 2 = compiled but dynamic = can skip normalization, but must run diff
  4207. // 1 = compiled and static = can skip normalization AND diff as optimized
  4208. createSimpleExpression(slotFlag + ((process.env.NODE_ENV !== 'production') ? ` /* ${slotFlagsText[slotFlag]} */` : ``), false))), loc);
  4209. if (dynamicSlots.length) {
  4210. slots = createCallExpression(context.helper(CREATE_SLOTS), [
  4211. slots,
  4212. createArrayExpression(dynamicSlots)
  4213. ]);
  4214. }
  4215. return {
  4216. slots,
  4217. hasDynamicSlots
  4218. };
  4219. }
  4220. function buildDynamicSlot(name, fn) {
  4221. return createObjectExpression([
  4222. createObjectProperty(`name`, name),
  4223. createObjectProperty(`fn`, fn)
  4224. ]);
  4225. }
  4226. function hasForwardedSlots(children) {
  4227. for (let i = 0; i < children.length; i++) {
  4228. const child = children[i];
  4229. switch (child.type) {
  4230. case 1 /* ELEMENT */:
  4231. if (child.tagType === 2 /* SLOT */ ||
  4232. hasForwardedSlots(child.children)) {
  4233. return true;
  4234. }
  4235. break;
  4236. case 9 /* IF */:
  4237. if (hasForwardedSlots(child.branches))
  4238. return true;
  4239. break;
  4240. case 10 /* IF_BRANCH */:
  4241. case 11 /* FOR */:
  4242. if (hasForwardedSlots(child.children))
  4243. return true;
  4244. break;
  4245. }
  4246. }
  4247. return false;
  4248. }
  4249. function isNonWhitespaceContent(node) {
  4250. if (node.type !== 2 /* TEXT */ && node.type !== 12 /* TEXT_CALL */)
  4251. return true;
  4252. return node.type === 2 /* TEXT */
  4253. ? !!node.content.trim()
  4254. : isNonWhitespaceContent(node.content);
  4255. }
  4256. // some directive transforms (e.g. v-model) may return a symbol for runtime
  4257. // import, which should be used instead of a resolveDirective call.
  4258. const directiveImportMap = new WeakMap();
  4259. // generate a JavaScript AST for this element's codegen
  4260. const transformElement = (node, context) => {
  4261. // perform the work on exit, after all child expressions have been
  4262. // processed and merged.
  4263. return function postTransformElement() {
  4264. node = context.currentNode;
  4265. if (!(node.type === 1 /* ELEMENT */ &&
  4266. (node.tagType === 0 /* ELEMENT */ ||
  4267. node.tagType === 1 /* COMPONENT */))) {
  4268. return;
  4269. }
  4270. const { tag, props } = node;
  4271. const isComponent = node.tagType === 1 /* COMPONENT */;
  4272. // The goal of the transform is to create a codegenNode implementing the
  4273. // VNodeCall interface.
  4274. let vnodeTag = isComponent
  4275. ? resolveComponentType(node, context)
  4276. : `"${tag}"`;
  4277. const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
  4278. let vnodeProps;
  4279. let vnodeChildren;
  4280. let vnodePatchFlag;
  4281. let patchFlag = 0;
  4282. let vnodeDynamicProps;
  4283. let dynamicPropNames;
  4284. let vnodeDirectives;
  4285. let shouldUseBlock =
  4286. // dynamic component may resolve to plain elements
  4287. isDynamicComponent ||
  4288. vnodeTag === TELEPORT ||
  4289. vnodeTag === SUSPENSE ||
  4290. (!isComponent &&
  4291. // <svg> and <foreignObject> must be forced into blocks so that block
  4292. // updates inside get proper isSVG flag at runtime. (#639, #643)
  4293. // This is technically web-specific, but splitting the logic out of core
  4294. // leads to too much unnecessary complexity.
  4295. (tag === 'svg' || tag === 'foreignObject'));
  4296. // props
  4297. if (props.length > 0) {
  4298. const propsBuildResult = buildProps(node, context);
  4299. vnodeProps = propsBuildResult.props;
  4300. patchFlag = propsBuildResult.patchFlag;
  4301. dynamicPropNames = propsBuildResult.dynamicPropNames;
  4302. const directives = propsBuildResult.directives;
  4303. vnodeDirectives =
  4304. directives && directives.length
  4305. ? createArrayExpression(directives.map(dir => buildDirectiveArgs(dir, context)))
  4306. : undefined;
  4307. if (propsBuildResult.shouldUseBlock) {
  4308. shouldUseBlock = true;
  4309. }
  4310. }
  4311. // children
  4312. if (node.children.length > 0) {
  4313. if (vnodeTag === KEEP_ALIVE) {
  4314. // Although a built-in component, we compile KeepAlive with raw children
  4315. // instead of slot functions so that it can be used inside Transition
  4316. // or other Transition-wrapping HOCs.
  4317. // To ensure correct updates with block optimizations, we need to:
  4318. // 1. Force keep-alive into a block. This avoids its children being
  4319. // collected by a parent block.
  4320. shouldUseBlock = true;
  4321. // 2. Force keep-alive to always be updated, since it uses raw children.
  4322. patchFlag |= 1024 /* DYNAMIC_SLOTS */;
  4323. if ((process.env.NODE_ENV !== 'production') && node.children.length > 1) {
  4324. context.onError(createCompilerError(45 /* X_KEEP_ALIVE_INVALID_CHILDREN */, {
  4325. start: node.children[0].loc.start,
  4326. end: node.children[node.children.length - 1].loc.end,
  4327. source: ''
  4328. }));
  4329. }
  4330. }
  4331. const shouldBuildAsSlots = isComponent &&
  4332. // Teleport is not a real component and has dedicated runtime handling
  4333. vnodeTag !== TELEPORT &&
  4334. // explained above.
  4335. vnodeTag !== KEEP_ALIVE;
  4336. if (shouldBuildAsSlots) {
  4337. const { slots, hasDynamicSlots } = buildSlots(node, context);
  4338. vnodeChildren = slots;
  4339. if (hasDynamicSlots) {
  4340. patchFlag |= 1024 /* DYNAMIC_SLOTS */;
  4341. }
  4342. }
  4343. else if (node.children.length === 1 && vnodeTag !== TELEPORT) {
  4344. const child = node.children[0];
  4345. const type = child.type;
  4346. // check for dynamic text children
  4347. const hasDynamicTextChild = type === 5 /* INTERPOLATION */ ||
  4348. type === 8 /* COMPOUND_EXPRESSION */;
  4349. if (hasDynamicTextChild &&
  4350. getConstantType(child, context) === 0 /* NOT_CONSTANT */) {
  4351. patchFlag |= 1 /* TEXT */;
  4352. }
  4353. // pass directly if the only child is a text node
  4354. // (plain / interpolation / expression)
  4355. if (hasDynamicTextChild || type === 2 /* TEXT */) {
  4356. vnodeChildren = child;
  4357. }
  4358. else {
  4359. vnodeChildren = node.children;
  4360. }
  4361. }
  4362. else {
  4363. vnodeChildren = node.children;
  4364. }
  4365. }
  4366. // patchFlag & dynamicPropNames
  4367. if (patchFlag !== 0) {
  4368. if ((process.env.NODE_ENV !== 'production')) {
  4369. if (patchFlag < 0) {
  4370. // special flags (negative and mutually exclusive)
  4371. vnodePatchFlag = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
  4372. }
  4373. else {
  4374. // bitwise flags
  4375. const flagNames = Object.keys(PatchFlagNames)
  4376. .map(Number)
  4377. .filter(n => n > 0 && patchFlag & n)
  4378. .map(n => PatchFlagNames[n])
  4379. .join(`, `);
  4380. vnodePatchFlag = patchFlag + ` /* ${flagNames} */`;
  4381. }
  4382. }
  4383. else {
  4384. vnodePatchFlag = String(patchFlag);
  4385. }
  4386. if (dynamicPropNames && dynamicPropNames.length) {
  4387. vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
  4388. }
  4389. }
  4390. node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, vnodePatchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false /* disableTracking */, isComponent, node.loc);
  4391. };
  4392. };
  4393. function resolveComponentType(node, context, ssr = false) {
  4394. let { tag } = node;
  4395. // 1. dynamic component
  4396. const isExplicitDynamic = isComponentTag(tag);
  4397. const isProp = findProp(node, 'is');
  4398. if (isProp) {
  4399. if (isExplicitDynamic ||
  4400. (isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))) {
  4401. const exp = isProp.type === 6 /* ATTRIBUTE */
  4402. ? isProp.value && createSimpleExpression(isProp.value.content, true)
  4403. : isProp.exp;
  4404. if (exp) {
  4405. return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
  4406. exp
  4407. ]);
  4408. }
  4409. }
  4410. else if (isProp.type === 6 /* ATTRIBUTE */ &&
  4411. isProp.value.content.startsWith('vue:')) {
  4412. // <button is="vue:xxx">
  4413. // if not <component>, only is value that starts with "vue:" will be
  4414. // treated as component by the parse phase and reach here, unless it's
  4415. // compat mode where all is values are considered components
  4416. tag = isProp.value.content.slice(4);
  4417. }
  4418. }
  4419. // 1.5 v-is (TODO: Deprecate)
  4420. const isDir = !isExplicitDynamic && findDir(node, 'is');
  4421. if (isDir && isDir.exp) {
  4422. return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
  4423. isDir.exp
  4424. ]);
  4425. }
  4426. // 2. built-in components (Teleport, Transition, KeepAlive, Suspense...)
  4427. const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
  4428. if (builtIn) {
  4429. // built-ins are simply fallthroughs / have special handling during ssr
  4430. // so we don't need to import their runtime equivalents
  4431. if (!ssr)
  4432. context.helper(builtIn);
  4433. return builtIn;
  4434. }
  4435. // 5. user component (resolve)
  4436. context.helper(RESOLVE_COMPONENT);
  4437. context.components.add(tag);
  4438. return toValidAssetId(tag, `component`);
  4439. }
  4440. function buildProps(node, context, props = node.props, ssr = false) {
  4441. const { tag, loc: elementLoc, children } = node;
  4442. const isComponent = node.tagType === 1 /* COMPONENT */;
  4443. let properties = [];
  4444. const mergeArgs = [];
  4445. const runtimeDirectives = [];
  4446. const hasChildren = children.length > 0;
  4447. let shouldUseBlock = false;
  4448. // patchFlag analysis
  4449. let patchFlag = 0;
  4450. let hasRef = false;
  4451. let hasClassBinding = false;
  4452. let hasStyleBinding = false;
  4453. let hasHydrationEventBinding = false;
  4454. let hasDynamicKeys = false;
  4455. let hasVnodeHook = false;
  4456. const dynamicPropNames = [];
  4457. const analyzePatchFlag = ({ key, value }) => {
  4458. if (isStaticExp(key)) {
  4459. const name = key.content;
  4460. const isEventHandler = isOn(name);
  4461. if (!isComponent &&
  4462. isEventHandler &&
  4463. // omit the flag for click handlers because hydration gives click
  4464. // dedicated fast path.
  4465. name.toLowerCase() !== 'onclick' &&
  4466. // omit v-model handlers
  4467. name !== 'onUpdate:modelValue' &&
  4468. // omit onVnodeXXX hooks
  4469. !isReservedProp(name)) {
  4470. hasHydrationEventBinding = true;
  4471. }
  4472. if (isEventHandler && isReservedProp(name)) {
  4473. hasVnodeHook = true;
  4474. }
  4475. if (value.type === 20 /* JS_CACHE_EXPRESSION */ ||
  4476. ((value.type === 4 /* SIMPLE_EXPRESSION */ ||
  4477. value.type === 8 /* COMPOUND_EXPRESSION */) &&
  4478. getConstantType(value, context) > 0)) {
  4479. // skip if the prop is a cached handler or has constant value
  4480. return;
  4481. }
  4482. if (name === 'ref') {
  4483. hasRef = true;
  4484. }
  4485. else if (name === 'class') {
  4486. hasClassBinding = true;
  4487. }
  4488. else if (name === 'style') {
  4489. hasStyleBinding = true;
  4490. }
  4491. else if (name !== 'key' && !dynamicPropNames.includes(name)) {
  4492. dynamicPropNames.push(name);
  4493. }
  4494. // treat the dynamic class and style binding of the component as dynamic props
  4495. if (isComponent &&
  4496. (name === 'class' || name === 'style') &&
  4497. !dynamicPropNames.includes(name)) {
  4498. dynamicPropNames.push(name);
  4499. }
  4500. }
  4501. else {
  4502. hasDynamicKeys = true;
  4503. }
  4504. };
  4505. for (let i = 0; i < props.length; i++) {
  4506. // static attribute
  4507. const prop = props[i];
  4508. if (prop.type === 6 /* ATTRIBUTE */) {
  4509. const { loc, name, value } = prop;
  4510. let isStatic = true;
  4511. if (name === 'ref') {
  4512. hasRef = true;
  4513. if (context.scopes.vFor > 0) {
  4514. properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
  4515. }
  4516. }
  4517. // skip is on <component>, or is="vue:xxx"
  4518. if (name === 'is' &&
  4519. (isComponentTag(tag) ||
  4520. (value && value.content.startsWith('vue:')) ||
  4521. (isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
  4522. continue;
  4523. }
  4524. properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
  4525. }
  4526. else {
  4527. // directives
  4528. const { name, arg, exp, loc } = prop;
  4529. const isVBind = name === 'bind';
  4530. const isVOn = name === 'on';
  4531. // skip v-slot - it is handled by its dedicated transform.
  4532. if (name === 'slot') {
  4533. if (!isComponent) {
  4534. context.onError(createCompilerError(40 /* X_V_SLOT_MISPLACED */, loc));
  4535. }
  4536. continue;
  4537. }
  4538. // skip v-once/v-memo - they are handled by dedicated transforms.
  4539. if (name === 'once' || name === 'memo') {
  4540. continue;
  4541. }
  4542. // skip v-is and :is on <component>
  4543. if (name === 'is' ||
  4544. (isVBind &&
  4545. isStaticArgOf(arg, 'is') &&
  4546. (isComponentTag(tag) ||
  4547. (isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))))) {
  4548. continue;
  4549. }
  4550. // skip v-on in SSR compilation
  4551. if (isVOn && ssr) {
  4552. continue;
  4553. }
  4554. if (
  4555. // #938: elements with dynamic keys should be forced into blocks
  4556. (isVBind && isStaticArgOf(arg, 'key')) ||
  4557. // inline before-update hooks need to force block so that it is invoked
  4558. // before children
  4559. (isVOn && hasChildren && isStaticArgOf(arg, 'vue:before-update'))) {
  4560. shouldUseBlock = true;
  4561. }
  4562. if (isVBind && isStaticArgOf(arg, 'ref') && context.scopes.vFor > 0) {
  4563. properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
  4564. }
  4565. // special case for v-bind and v-on with no argument
  4566. if (!arg && (isVBind || isVOn)) {
  4567. hasDynamicKeys = true;
  4568. if (exp) {
  4569. if (properties.length) {
  4570. mergeArgs.push(createObjectExpression(dedupeProperties(properties), elementLoc));
  4571. properties = [];
  4572. }
  4573. if (isVBind) {
  4574. {
  4575. // 2.x v-bind object order compat
  4576. if ((process.env.NODE_ENV !== 'production')) {
  4577. const hasOverridableKeys = mergeArgs.some(arg => {
  4578. if (arg.type === 15 /* JS_OBJECT_EXPRESSION */) {
  4579. return arg.properties.some(({ key }) => {
  4580. if (key.type !== 4 /* SIMPLE_EXPRESSION */ ||
  4581. !key.isStatic) {
  4582. return true;
  4583. }
  4584. return (key.content !== 'class' &&
  4585. key.content !== 'style' &&
  4586. !isOn(key.content));
  4587. });
  4588. }
  4589. else {
  4590. // dynamic expression
  4591. return true;
  4592. }
  4593. });
  4594. if (hasOverridableKeys) {
  4595. checkCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER" /* COMPILER_V_BIND_OBJECT_ORDER */, context, loc);
  4596. }
  4597. }
  4598. if (isCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER" /* COMPILER_V_BIND_OBJECT_ORDER */, context)) {
  4599. mergeArgs.unshift(exp);
  4600. continue;
  4601. }
  4602. }
  4603. mergeArgs.push(exp);
  4604. }
  4605. else {
  4606. // v-on="obj" -> toHandlers(obj)
  4607. mergeArgs.push({
  4608. type: 14 /* JS_CALL_EXPRESSION */,
  4609. loc,
  4610. callee: context.helper(TO_HANDLERS),
  4611. arguments: [exp]
  4612. });
  4613. }
  4614. }
  4615. else {
  4616. context.onError(createCompilerError(isVBind
  4617. ? 34 /* X_V_BIND_NO_EXPRESSION */
  4618. : 35 /* X_V_ON_NO_EXPRESSION */, loc));
  4619. }
  4620. continue;
  4621. }
  4622. const directiveTransform = context.directiveTransforms[name];
  4623. if (directiveTransform) {
  4624. // has built-in directive transform.
  4625. const { props, needRuntime } = directiveTransform(prop, node, context);
  4626. !ssr && props.forEach(analyzePatchFlag);
  4627. properties.push(...props);
  4628. if (needRuntime) {
  4629. runtimeDirectives.push(prop);
  4630. if (isSymbol(needRuntime)) {
  4631. directiveImportMap.set(prop, needRuntime);
  4632. }
  4633. }
  4634. }
  4635. else if (!isBuiltInDirective(name)) {
  4636. // no built-in transform, this is a user custom directive.
  4637. runtimeDirectives.push(prop);
  4638. // custom dirs may use beforeUpdate so they need to force blocks
  4639. // to ensure before-update gets called before children update
  4640. if (hasChildren) {
  4641. shouldUseBlock = true;
  4642. }
  4643. }
  4644. }
  4645. }
  4646. let propsExpression = undefined;
  4647. // has v-bind="object" or v-on="object", wrap with mergeProps
  4648. if (mergeArgs.length) {
  4649. if (properties.length) {
  4650. mergeArgs.push(createObjectExpression(dedupeProperties(properties), elementLoc));
  4651. }
  4652. if (mergeArgs.length > 1) {
  4653. propsExpression = createCallExpression(context.helper(MERGE_PROPS), mergeArgs, elementLoc);
  4654. }
  4655. else {
  4656. // single v-bind with nothing else - no need for a mergeProps call
  4657. propsExpression = mergeArgs[0];
  4658. }
  4659. }
  4660. else if (properties.length) {
  4661. propsExpression = createObjectExpression(dedupeProperties(properties), elementLoc);
  4662. }
  4663. // patchFlag analysis
  4664. if (hasDynamicKeys) {
  4665. patchFlag |= 16 /* FULL_PROPS */;
  4666. }
  4667. else {
  4668. if (hasClassBinding && !isComponent) {
  4669. patchFlag |= 2 /* CLASS */;
  4670. }
  4671. if (hasStyleBinding && !isComponent) {
  4672. patchFlag |= 4 /* STYLE */;
  4673. }
  4674. if (dynamicPropNames.length) {
  4675. patchFlag |= 8 /* PROPS */;
  4676. }
  4677. if (hasHydrationEventBinding) {
  4678. patchFlag |= 32 /* HYDRATE_EVENTS */;
  4679. }
  4680. }
  4681. if (!shouldUseBlock &&
  4682. (patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
  4683. (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
  4684. patchFlag |= 512 /* NEED_PATCH */;
  4685. }
  4686. // pre-normalize props, SSR is skipped for now
  4687. if (!context.inSSR && propsExpression) {
  4688. switch (propsExpression.type) {
  4689. case 15 /* JS_OBJECT_EXPRESSION */:
  4690. // means that there is no v-bind,
  4691. // but still need to deal with dynamic key binding
  4692. let classKeyIndex = -1;
  4693. let styleKeyIndex = -1;
  4694. let hasDynamicKey = false;
  4695. for (let i = 0; i < propsExpression.properties.length; i++) {
  4696. const key = propsExpression.properties[i].key;
  4697. if (isStaticExp(key)) {
  4698. if (key.content === 'class') {
  4699. classKeyIndex = i;
  4700. }
  4701. else if (key.content === 'style') {
  4702. styleKeyIndex = i;
  4703. }
  4704. }
  4705. else if (!key.isHandlerKey) {
  4706. hasDynamicKey = true;
  4707. }
  4708. }
  4709. const classProp = propsExpression.properties[classKeyIndex];
  4710. const styleProp = propsExpression.properties[styleKeyIndex];
  4711. // no dynamic key
  4712. if (!hasDynamicKey) {
  4713. if (classProp && !isStaticExp(classProp.value)) {
  4714. classProp.value = createCallExpression(context.helper(NORMALIZE_CLASS), [classProp.value]);
  4715. }
  4716. if (styleProp &&
  4717. !isStaticExp(styleProp.value) &&
  4718. // the static style is compiled into an object,
  4719. // so use `hasStyleBinding` to ensure that it is a dynamic style binding
  4720. (hasStyleBinding ||
  4721. // v-bind:style and style both exist,
  4722. // v-bind:style with static literal object
  4723. styleProp.value.type === 17 /* JS_ARRAY_EXPRESSION */)) {
  4724. styleProp.value = createCallExpression(context.helper(NORMALIZE_STYLE), [styleProp.value]);
  4725. }
  4726. }
  4727. else {
  4728. // dynamic key binding, wrap with `normalizeProps`
  4729. propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [propsExpression]);
  4730. }
  4731. break;
  4732. case 14 /* JS_CALL_EXPRESSION */:
  4733. // mergeProps call, do nothing
  4734. break;
  4735. default:
  4736. // single v-bind
  4737. propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [
  4738. createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [
  4739. propsExpression
  4740. ])
  4741. ]);
  4742. break;
  4743. }
  4744. }
  4745. return {
  4746. props: propsExpression,
  4747. directives: runtimeDirectives,
  4748. patchFlag,
  4749. dynamicPropNames,
  4750. shouldUseBlock
  4751. };
  4752. }
  4753. // Dedupe props in an object literal.
  4754. // Literal duplicated attributes would have been warned during the parse phase,
  4755. // however, it's possible to encounter duplicated `onXXX` handlers with different
  4756. // modifiers. We also need to merge static and dynamic class / style attributes.
  4757. // - onXXX handlers / style: merge into array
  4758. // - class: merge into single expression with concatenation
  4759. function dedupeProperties(properties) {
  4760. const knownProps = new Map();
  4761. const deduped = [];
  4762. for (let i = 0; i < properties.length; i++) {
  4763. const prop = properties[i];
  4764. // dynamic keys are always allowed
  4765. if (prop.key.type === 8 /* COMPOUND_EXPRESSION */ || !prop.key.isStatic) {
  4766. deduped.push(prop);
  4767. continue;
  4768. }
  4769. const name = prop.key.content;
  4770. const existing = knownProps.get(name);
  4771. if (existing) {
  4772. if (name === 'style' || name === 'class' || isOn(name)) {
  4773. mergeAsArray(existing, prop);
  4774. }
  4775. // unexpected duplicate, should have emitted error during parse
  4776. }
  4777. else {
  4778. knownProps.set(name, prop);
  4779. deduped.push(prop);
  4780. }
  4781. }
  4782. return deduped;
  4783. }
  4784. function mergeAsArray(existing, incoming) {
  4785. if (existing.value.type === 17 /* JS_ARRAY_EXPRESSION */) {
  4786. existing.value.elements.push(incoming.value);
  4787. }
  4788. else {
  4789. existing.value = createArrayExpression([existing.value, incoming.value], existing.loc);
  4790. }
  4791. }
  4792. function buildDirectiveArgs(dir, context) {
  4793. const dirArgs = [];
  4794. const runtime = directiveImportMap.get(dir);
  4795. if (runtime) {
  4796. // built-in directive with runtime
  4797. dirArgs.push(context.helperString(runtime));
  4798. }
  4799. else {
  4800. {
  4801. // inject statement for resolving directive
  4802. context.helper(RESOLVE_DIRECTIVE);
  4803. context.directives.add(dir.name);
  4804. dirArgs.push(toValidAssetId(dir.name, `directive`));
  4805. }
  4806. }
  4807. const { loc } = dir;
  4808. if (dir.exp)
  4809. dirArgs.push(dir.exp);
  4810. if (dir.arg) {
  4811. if (!dir.exp) {
  4812. dirArgs.push(`void 0`);
  4813. }
  4814. dirArgs.push(dir.arg);
  4815. }
  4816. if (Object.keys(dir.modifiers).length) {
  4817. if (!dir.arg) {
  4818. if (!dir.exp) {
  4819. dirArgs.push(`void 0`);
  4820. }
  4821. dirArgs.push(`void 0`);
  4822. }
  4823. const trueExpression = createSimpleExpression(`true`, false, loc);
  4824. dirArgs.push(createObjectExpression(dir.modifiers.map(modifier => createObjectProperty(modifier, trueExpression)), loc));
  4825. }
  4826. return createArrayExpression(dirArgs, dir.loc);
  4827. }
  4828. function stringifyDynamicPropNames(props) {
  4829. let propsNamesString = `[`;
  4830. for (let i = 0, l = props.length; i < l; i++) {
  4831. propsNamesString += JSON.stringify(props[i]);
  4832. if (i < l - 1)
  4833. propsNamesString += ', ';
  4834. }
  4835. return propsNamesString + `]`;
  4836. }
  4837. function isComponentTag(tag) {
  4838. return tag === 'component' || tag === 'Component';
  4839. }
  4840. (process.env.NODE_ENV !== 'production')
  4841. ? Object.freeze({})
  4842. : {};
  4843. (process.env.NODE_ENV !== 'production') ? Object.freeze([]) : [];
  4844. const cacheStringFunction = (fn) => {
  4845. const cache = Object.create(null);
  4846. return ((str) => {
  4847. const hit = cache[str];
  4848. return hit || (cache[str] = fn(str));
  4849. });
  4850. };
  4851. const camelizeRE = /-(\w)/g;
  4852. /**
  4853. * @private
  4854. */
  4855. const camelize = cacheStringFunction((str) => {
  4856. return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));
  4857. });
  4858. const transformSlotOutlet = (node, context) => {
  4859. if (isSlotOutlet(node)) {
  4860. const { children, loc } = node;
  4861. const { slotName, slotProps } = processSlotOutlet(node, context);
  4862. const slotArgs = [
  4863. context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
  4864. slotName,
  4865. '{}',
  4866. 'undefined',
  4867. 'true'
  4868. ];
  4869. let expectedLen = 2;
  4870. if (slotProps) {
  4871. slotArgs[2] = slotProps;
  4872. expectedLen = 3;
  4873. }
  4874. if (children.length) {
  4875. slotArgs[3] = createFunctionExpression([], children, false, false, loc);
  4876. expectedLen = 4;
  4877. }
  4878. if (context.scopeId && !context.slotted) {
  4879. expectedLen = 5;
  4880. }
  4881. slotArgs.splice(expectedLen); // remove unused arguments
  4882. node.codegenNode = createCallExpression(context.helper(RENDER_SLOT), slotArgs, loc);
  4883. }
  4884. };
  4885. function processSlotOutlet(node, context) {
  4886. let slotName = `"default"`;
  4887. let slotProps = undefined;
  4888. const nonNameProps = [];
  4889. for (let i = 0; i < node.props.length; i++) {
  4890. const p = node.props[i];
  4891. if (p.type === 6 /* ATTRIBUTE */) {
  4892. if (p.value) {
  4893. if (p.name === 'name') {
  4894. slotName = JSON.stringify(p.value.content);
  4895. }
  4896. else {
  4897. p.name = camelize(p.name);
  4898. nonNameProps.push(p);
  4899. }
  4900. }
  4901. }
  4902. else {
  4903. if (p.name === 'bind' && isStaticArgOf(p.arg, 'name')) {
  4904. if (p.exp)
  4905. slotName = p.exp;
  4906. }
  4907. else {
  4908. if (p.name === 'bind' && p.arg && isStaticExp(p.arg)) {
  4909. p.arg.content = camelize(p.arg.content);
  4910. }
  4911. nonNameProps.push(p);
  4912. }
  4913. }
  4914. }
  4915. if (nonNameProps.length > 0) {
  4916. const { props, directives } = buildProps(node, context, nonNameProps);
  4917. slotProps = props;
  4918. if (directives.length) {
  4919. context.onError(createCompilerError(36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
  4920. }
  4921. }
  4922. return {
  4923. slotName,
  4924. slotProps
  4925. };
  4926. }
  4927. const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
  4928. const transformOn = (dir, node, context, augmentor) => {
  4929. const { loc, modifiers, arg } = dir;
  4930. if (!dir.exp && !modifiers.length) {
  4931. context.onError(createCompilerError(35 /* X_V_ON_NO_EXPRESSION */, loc));
  4932. }
  4933. let eventName;
  4934. if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
  4935. if (arg.isStatic) {
  4936. let rawName = arg.content;
  4937. // TODO deprecate @vnodeXXX usage
  4938. if (rawName.startsWith('vue:')) {
  4939. rawName = `vnode-${rawName.slice(4)}`;
  4940. }
  4941. // for all event listeners, auto convert it to camelCase. See issue #2249
  4942. eventName = createSimpleExpression(toHandlerKey(camelize$1(rawName)), true, arg.loc);
  4943. }
  4944. else {
  4945. // #2388
  4946. eventName = createCompoundExpression([
  4947. `${context.helperString(TO_HANDLER_KEY)}(`,
  4948. arg,
  4949. `)`
  4950. ]);
  4951. }
  4952. }
  4953. else {
  4954. // already a compound expression.
  4955. eventName = arg;
  4956. eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
  4957. eventName.children.push(`)`);
  4958. }
  4959. // handler processing
  4960. let exp = dir.exp;
  4961. if (exp && !exp.content.trim()) {
  4962. exp = undefined;
  4963. }
  4964. let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
  4965. if (exp) {
  4966. const isMemberExp = isMemberExpression(exp.content);
  4967. const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content));
  4968. const hasMultipleStatements = exp.content.includes(`;`);
  4969. if ((process.env.NODE_ENV !== 'production') && true) {
  4970. validateBrowserExpression(exp, context, false, hasMultipleStatements);
  4971. }
  4972. if (isInlineStatement || (shouldCache && isMemberExp)) {
  4973. // wrap inline statement in a function expression
  4974. exp = createCompoundExpression([
  4975. `${isInlineStatement
  4976. ? `$event`
  4977. : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`,
  4978. exp,
  4979. hasMultipleStatements ? `}` : `)`
  4980. ]);
  4981. }
  4982. }
  4983. let ret = {
  4984. props: [
  4985. createObjectProperty(eventName, exp || createSimpleExpression(`() => {}`, false, loc))
  4986. ]
  4987. };
  4988. // apply extended compiler augmentor
  4989. if (augmentor) {
  4990. ret = augmentor(ret);
  4991. }
  4992. if (shouldCache) {
  4993. // cache handlers so that it's always the same handler being passed down.
  4994. // this avoids unnecessary re-renders when users use inline handlers on
  4995. // components.
  4996. ret.props[0].value = context.cache(ret.props[0].value);
  4997. }
  4998. // mark the key as handler for props normalization check
  4999. ret.props.forEach(p => (p.key.isHandlerKey = true));
  5000. return ret;
  5001. };
  5002. // v-bind without arg is handled directly in ./transformElements.ts due to it affecting
  5003. // codegen for the entire props object. This transform here is only for v-bind
  5004. // *with* args.
  5005. const transformBind = (dir, _node, context) => {
  5006. const { exp, modifiers, loc } = dir;
  5007. const arg = dir.arg;
  5008. if (arg.type !== 4 /* SIMPLE_EXPRESSION */) {
  5009. arg.children.unshift(`(`);
  5010. arg.children.push(`) || ""`);
  5011. }
  5012. else if (!arg.isStatic) {
  5013. arg.content = `${arg.content} || ""`;
  5014. }
  5015. // .sync is replaced by v-model:arg
  5016. if (modifiers.includes('camel')) {
  5017. if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
  5018. if (arg.isStatic) {
  5019. arg.content = camelize$1(arg.content);
  5020. }
  5021. else {
  5022. arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
  5023. }
  5024. }
  5025. else {
  5026. arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
  5027. arg.children.push(`)`);
  5028. }
  5029. }
  5030. if (!context.inSSR) {
  5031. if (modifiers.includes('prop')) {
  5032. injectPrefix(arg, '.');
  5033. }
  5034. if (modifiers.includes('attr')) {
  5035. injectPrefix(arg, '^');
  5036. }
  5037. }
  5038. if (!exp ||
  5039. (exp.type === 4 /* SIMPLE_EXPRESSION */ && !exp.content.trim())) {
  5040. context.onError(createCompilerError(34 /* X_V_BIND_NO_EXPRESSION */, loc));
  5041. return {
  5042. props: [createObjectProperty(arg, createSimpleExpression('', true, loc))]
  5043. };
  5044. }
  5045. return {
  5046. props: [createObjectProperty(arg, exp)]
  5047. };
  5048. };
  5049. const injectPrefix = (arg, prefix) => {
  5050. if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
  5051. if (arg.isStatic) {
  5052. arg.content = prefix + arg.content;
  5053. }
  5054. else {
  5055. arg.content = `\`${prefix}\${${arg.content}}\``;
  5056. }
  5057. }
  5058. else {
  5059. arg.children.unshift(`'${prefix}' + (`);
  5060. arg.children.push(`)`);
  5061. }
  5062. };
  5063. // Merge adjacent text nodes and expressions into a single expression
  5064. // e.g. <div>abc {{ d }} {{ e }}</div> should have a single expression node as child.
  5065. const transformText = (node, context) => {
  5066. if (node.type === 0 /* ROOT */ ||
  5067. node.type === 1 /* ELEMENT */ ||
  5068. node.type === 11 /* FOR */ ||
  5069. node.type === 10 /* IF_BRANCH */) {
  5070. // perform the transform on node exit so that all expressions have already
  5071. // been processed.
  5072. return () => {
  5073. const children = node.children;
  5074. let currentContainer = undefined;
  5075. let hasText = false;
  5076. for (let i = 0; i < children.length; i++) {
  5077. const child = children[i];
  5078. if (isText(child)) {
  5079. hasText = true;
  5080. for (let j = i + 1; j < children.length; j++) {
  5081. const next = children[j];
  5082. if (isText(next)) {
  5083. if (!currentContainer) {
  5084. currentContainer = children[i] = {
  5085. type: 8 /* COMPOUND_EXPRESSION */,
  5086. loc: child.loc,
  5087. children: [child]
  5088. };
  5089. }
  5090. // merge adjacent text node into current
  5091. currentContainer.children.push(` + `, next);
  5092. children.splice(j, 1);
  5093. j--;
  5094. }
  5095. else {
  5096. currentContainer = undefined;
  5097. break;
  5098. }
  5099. }
  5100. }
  5101. }
  5102. if (!hasText ||
  5103. // if this is a plain element with a single text child, leave it
  5104. // as-is since the runtime has dedicated fast path for this by directly
  5105. // setting textContent of the element.
  5106. // for component root it's always normalized anyway.
  5107. (children.length === 1 &&
  5108. (node.type === 0 /* ROOT */ ||
  5109. (node.type === 1 /* ELEMENT */ &&
  5110. node.tagType === 0 /* ELEMENT */ &&
  5111. // #3756
  5112. // custom directives can potentially add DOM elements arbitrarily,
  5113. // we need to avoid setting textContent of the element at runtime
  5114. // to avoid accidentally overwriting the DOM elements added
  5115. // by the user through custom directives.
  5116. !node.props.find(p => p.type === 7 /* DIRECTIVE */ &&
  5117. !context.directiveTransforms[p.name]) &&
  5118. // in compat mode, <template> tags with no special directives
  5119. // will be rendered as a fragment so its children must be
  5120. // converted into vnodes.
  5121. !(node.tag === 'template'))))) {
  5122. return;
  5123. }
  5124. // pre-convert text nodes into createTextVNode(text) calls to avoid
  5125. // runtime normalization.
  5126. for (let i = 0; i < children.length; i++) {
  5127. const child = children[i];
  5128. if (isText(child) || child.type === 8 /* COMPOUND_EXPRESSION */) {
  5129. const callArgs = [];
  5130. // createTextVNode defaults to single whitespace, so if it is a
  5131. // single space the code could be an empty call to save bytes.
  5132. if (child.type !== 2 /* TEXT */ || child.content !== ' ') {
  5133. callArgs.push(child);
  5134. }
  5135. // mark dynamic text with flag so it gets patched inside a block
  5136. if (!context.ssr &&
  5137. getConstantType(child, context) === 0 /* NOT_CONSTANT */) {
  5138. callArgs.push(1 /* TEXT */ +
  5139. ((process.env.NODE_ENV !== 'production') ? ` /* ${PatchFlagNames[1 /* TEXT */]} */` : ``));
  5140. }
  5141. children[i] = {
  5142. type: 12 /* TEXT_CALL */,
  5143. content: child,
  5144. loc: child.loc,
  5145. codegenNode: createCallExpression(context.helper(CREATE_TEXT), callArgs)
  5146. };
  5147. }
  5148. }
  5149. };
  5150. }
  5151. };
  5152. const seen = new WeakSet();
  5153. const transformOnce = (node, context) => {
  5154. if (node.type === 1 /* ELEMENT */ && findDir(node, 'once', true)) {
  5155. if (seen.has(node) || context.inVOnce) {
  5156. return;
  5157. }
  5158. seen.add(node);
  5159. context.inVOnce = true;
  5160. context.helper(SET_BLOCK_TRACKING);
  5161. return () => {
  5162. context.inVOnce = false;
  5163. const cur = context.currentNode;
  5164. if (cur.codegenNode) {
  5165. cur.codegenNode = context.cache(cur.codegenNode, true /* isVNode */);
  5166. }
  5167. };
  5168. }
  5169. };
  5170. const transformModel = (dir, node, context) => {
  5171. const { exp, arg } = dir;
  5172. if (!exp) {
  5173. context.onError(createCompilerError(41 /* X_V_MODEL_NO_EXPRESSION */, dir.loc));
  5174. return createTransformProps();
  5175. }
  5176. const rawExp = exp.loc.source;
  5177. const expString = exp.type === 4 /* SIMPLE_EXPRESSION */ ? exp.content : rawExp;
  5178. const maybeRef = !true /* SETUP_CONST */;
  5179. if (!expString.trim() ||
  5180. (!isMemberExpression(expString) && !maybeRef)) {
  5181. context.onError(createCompilerError(42 /* X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
  5182. return createTransformProps();
  5183. }
  5184. const propName = arg ? arg : createSimpleExpression('modelValue', true);
  5185. const eventName = arg
  5186. ? isStaticExp(arg)
  5187. ? `onUpdate:${arg.content}`
  5188. : createCompoundExpression(['"onUpdate:" + ', arg])
  5189. : `onUpdate:modelValue`;
  5190. let assignmentExp;
  5191. const eventArg = context.isTS ? `($event: any)` : `$event`;
  5192. {
  5193. assignmentExp = createCompoundExpression([
  5194. `${eventArg} => ((`,
  5195. exp,
  5196. `) = $event)`
  5197. ]);
  5198. }
  5199. const props = [
  5200. // modelValue: foo
  5201. createObjectProperty(propName, dir.exp),
  5202. // "onUpdate:modelValue": $event => (foo = $event)
  5203. createObjectProperty(eventName, assignmentExp)
  5204. ];
  5205. // modelModifiers: { foo: true, "bar-baz": true }
  5206. if (dir.modifiers.length && node.tagType === 1 /* COMPONENT */) {
  5207. const modifiers = dir.modifiers
  5208. .map(m => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`)
  5209. .join(`, `);
  5210. const modifiersKey = arg
  5211. ? isStaticExp(arg)
  5212. ? `${arg.content}Modifiers`
  5213. : createCompoundExpression([arg, ' + "Modifiers"'])
  5214. : `modelModifiers`;
  5215. props.push(createObjectProperty(modifiersKey, createSimpleExpression(`{ ${modifiers} }`, false, dir.loc, 2 /* CAN_HOIST */)));
  5216. }
  5217. return createTransformProps(props);
  5218. };
  5219. function createTransformProps(props = []) {
  5220. return { props };
  5221. }
  5222. const validDivisionCharRE = /[\w).+\-_$\]]/;
  5223. const transformFilter = (node, context) => {
  5224. if (!isCompatEnabled("COMPILER_FILTER" /* COMPILER_FILTERS */, context)) {
  5225. return;
  5226. }
  5227. if (node.type === 5 /* INTERPOLATION */) {
  5228. // filter rewrite is applied before expression transform so only
  5229. // simple expressions are possible at this stage
  5230. rewriteFilter(node.content, context);
  5231. }
  5232. if (node.type === 1 /* ELEMENT */) {
  5233. node.props.forEach((prop) => {
  5234. if (prop.type === 7 /* DIRECTIVE */ &&
  5235. prop.name !== 'for' &&
  5236. prop.exp) {
  5237. rewriteFilter(prop.exp, context);
  5238. }
  5239. });
  5240. }
  5241. };
  5242. function rewriteFilter(node, context) {
  5243. if (node.type === 4 /* SIMPLE_EXPRESSION */) {
  5244. parseFilter(node, context);
  5245. }
  5246. else {
  5247. for (let i = 0; i < node.children.length; i++) {
  5248. const child = node.children[i];
  5249. if (typeof child !== 'object')
  5250. continue;
  5251. if (child.type === 4 /* SIMPLE_EXPRESSION */) {
  5252. parseFilter(child, context);
  5253. }
  5254. else if (child.type === 8 /* COMPOUND_EXPRESSION */) {
  5255. rewriteFilter(node, context);
  5256. }
  5257. else if (child.type === 5 /* INTERPOLATION */) {
  5258. rewriteFilter(child.content, context);
  5259. }
  5260. }
  5261. }
  5262. }
  5263. function parseFilter(node, context) {
  5264. const exp = node.content;
  5265. let inSingle = false;
  5266. let inDouble = false;
  5267. let inTemplateString = false;
  5268. let inRegex = false;
  5269. let curly = 0;
  5270. let square = 0;
  5271. let paren = 0;
  5272. let lastFilterIndex = 0;
  5273. let c, prev, i, expression, filters = [];
  5274. for (i = 0; i < exp.length; i++) {
  5275. prev = c;
  5276. c = exp.charCodeAt(i);
  5277. if (inSingle) {
  5278. if (c === 0x27 && prev !== 0x5c)
  5279. inSingle = false;
  5280. }
  5281. else if (inDouble) {
  5282. if (c === 0x22 && prev !== 0x5c)
  5283. inDouble = false;
  5284. }
  5285. else if (inTemplateString) {
  5286. if (c === 0x60 && prev !== 0x5c)
  5287. inTemplateString = false;
  5288. }
  5289. else if (inRegex) {
  5290. if (c === 0x2f && prev !== 0x5c)
  5291. inRegex = false;
  5292. }
  5293. else if (c === 0x7c && // pipe
  5294. exp.charCodeAt(i + 1) !== 0x7c &&
  5295. exp.charCodeAt(i - 1) !== 0x7c &&
  5296. !curly &&
  5297. !square &&
  5298. !paren) {
  5299. if (expression === undefined) {
  5300. // first filter, end of expression
  5301. lastFilterIndex = i + 1;
  5302. expression = exp.slice(0, i).trim();
  5303. }
  5304. else {
  5305. pushFilter();
  5306. }
  5307. }
  5308. else {
  5309. switch (c) {
  5310. case 0x22:
  5311. inDouble = true;
  5312. break; // "
  5313. case 0x27:
  5314. inSingle = true;
  5315. break; // '
  5316. case 0x60:
  5317. inTemplateString = true;
  5318. break; // `
  5319. case 0x28:
  5320. paren++;
  5321. break; // (
  5322. case 0x29:
  5323. paren--;
  5324. break; // )
  5325. case 0x5b:
  5326. square++;
  5327. break; // [
  5328. case 0x5d:
  5329. square--;
  5330. break; // ]
  5331. case 0x7b:
  5332. curly++;
  5333. break; // {
  5334. case 0x7d:
  5335. curly--;
  5336. break; // }
  5337. }
  5338. if (c === 0x2f) {
  5339. // /
  5340. let j = i - 1;
  5341. let p;
  5342. // find first non-whitespace prev char
  5343. for (; j >= 0; j--) {
  5344. p = exp.charAt(j);
  5345. if (p !== ' ')
  5346. break;
  5347. }
  5348. if (!p || !validDivisionCharRE.test(p)) {
  5349. inRegex = true;
  5350. }
  5351. }
  5352. }
  5353. }
  5354. if (expression === undefined) {
  5355. expression = exp.slice(0, i).trim();
  5356. }
  5357. else if (lastFilterIndex !== 0) {
  5358. pushFilter();
  5359. }
  5360. function pushFilter() {
  5361. filters.push(exp.slice(lastFilterIndex, i).trim());
  5362. lastFilterIndex = i + 1;
  5363. }
  5364. if (filters.length) {
  5365. (process.env.NODE_ENV !== 'production') &&
  5366. warnDeprecation("COMPILER_FILTER" /* COMPILER_FILTERS */, context, node.loc);
  5367. for (i = 0; i < filters.length; i++) {
  5368. expression = wrapFilter(expression, filters[i], context);
  5369. }
  5370. node.content = expression;
  5371. }
  5372. }
  5373. function wrapFilter(exp, filter, context) {
  5374. context.helper(RESOLVE_FILTER);
  5375. const i = filter.indexOf('(');
  5376. if (i < 0) {
  5377. context.filters.add(filter);
  5378. return `${toValidAssetId(filter, 'filter')}(${exp})`;
  5379. }
  5380. else {
  5381. const name = filter.slice(0, i);
  5382. const args = filter.slice(i + 1);
  5383. context.filters.add(name);
  5384. return `${toValidAssetId(name, 'filter')}(${exp}${args !== ')' ? ',' + args : args}`;
  5385. }
  5386. }
  5387. const seen$1 = new WeakSet();
  5388. const transformMemo = (node, context) => {
  5389. if (node.type === 1 /* ELEMENT */) {
  5390. const dir = findDir(node, 'memo');
  5391. if (!dir || seen$1.has(node)) {
  5392. return;
  5393. }
  5394. seen$1.add(node);
  5395. return () => {
  5396. const codegenNode = node.codegenNode ||
  5397. context.currentNode.codegenNode;
  5398. if (codegenNode && codegenNode.type === 13 /* VNODE_CALL */) {
  5399. // non-component sub tree should be turned into a block
  5400. if (node.tagType !== 1 /* COMPONENT */) {
  5401. makeBlock(codegenNode, context);
  5402. }
  5403. node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
  5404. dir.exp,
  5405. createFunctionExpression(undefined, codegenNode),
  5406. `_cache`,
  5407. String(context.cached++)
  5408. ]);
  5409. }
  5410. };
  5411. }
  5412. };
  5413. function getBaseTransformPreset(prefixIdentifiers) {
  5414. return [
  5415. [
  5416. transformOnce,
  5417. transformIf,
  5418. transformMemo,
  5419. transformFor,
  5420. ...([transformFilter] ),
  5421. ...((process.env.NODE_ENV !== 'production')
  5422. ? [transformExpression]
  5423. : []),
  5424. transformSlotOutlet,
  5425. transformElement,
  5426. trackSlotScopes,
  5427. transformText
  5428. ],
  5429. {
  5430. on: transformOn,
  5431. bind: transformBind,
  5432. model: transformModel
  5433. }
  5434. ];
  5435. }
  5436. // we name it `baseCompile` so that higher order compilers like
  5437. // @vue/compiler-dom can export `compile` while re-exporting everything else.
  5438. function baseCompile(template, options = {}) {
  5439. const onError = options.onError || defaultOnError;
  5440. const isModuleMode = options.mode === 'module';
  5441. /* istanbul ignore if */
  5442. {
  5443. if (options.prefixIdentifiers === true) {
  5444. onError(createCompilerError(46 /* X_PREFIX_ID_NOT_SUPPORTED */));
  5445. }
  5446. else if (isModuleMode) {
  5447. onError(createCompilerError(47 /* X_MODULE_MODE_NOT_SUPPORTED */));
  5448. }
  5449. }
  5450. const prefixIdentifiers = !true ;
  5451. if (options.cacheHandlers) {
  5452. onError(createCompilerError(48 /* X_CACHE_HANDLER_NOT_SUPPORTED */));
  5453. }
  5454. if (options.scopeId && !isModuleMode) {
  5455. onError(createCompilerError(49 /* X_SCOPE_ID_NOT_SUPPORTED */));
  5456. }
  5457. const ast = isString(template) ? baseParse(template, options) : template;
  5458. const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
  5459. transform(ast, extend({}, options, {
  5460. prefixIdentifiers,
  5461. nodeTransforms: [
  5462. ...nodeTransforms,
  5463. ...(options.nodeTransforms || []) // user transforms
  5464. ],
  5465. directiveTransforms: extend({}, directiveTransforms, options.directiveTransforms || {} // user transforms
  5466. )
  5467. }));
  5468. return generate(ast, extend({}, options, {
  5469. prefixIdentifiers
  5470. }));
  5471. }
  5472. const noopDirectiveTransform = () => ({ props: [] });
  5473. var compilerCore_esmBundler = {
  5474. __proto__: null,
  5475. BASE_TRANSITION: BASE_TRANSITION,
  5476. CAMELIZE: CAMELIZE,
  5477. CAPITALIZE: CAPITALIZE,
  5478. CREATE_BLOCK: CREATE_BLOCK,
  5479. CREATE_COMMENT: CREATE_COMMENT,
  5480. CREATE_ELEMENT_BLOCK: CREATE_ELEMENT_BLOCK,
  5481. CREATE_ELEMENT_VNODE: CREATE_ELEMENT_VNODE,
  5482. CREATE_SLOTS: CREATE_SLOTS,
  5483. CREATE_STATIC: CREATE_STATIC,
  5484. CREATE_TEXT: CREATE_TEXT,
  5485. CREATE_VNODE: CREATE_VNODE,
  5486. FRAGMENT: FRAGMENT,
  5487. GUARD_REACTIVE_PROPS: GUARD_REACTIVE_PROPS,
  5488. IS_MEMO_SAME: IS_MEMO_SAME,
  5489. IS_REF: IS_REF,
  5490. KEEP_ALIVE: KEEP_ALIVE,
  5491. MERGE_PROPS: MERGE_PROPS,
  5492. NORMALIZE_CLASS: NORMALIZE_CLASS,
  5493. NORMALIZE_PROPS: NORMALIZE_PROPS,
  5494. NORMALIZE_STYLE: NORMALIZE_STYLE,
  5495. OPEN_BLOCK: OPEN_BLOCK,
  5496. POP_SCOPE_ID: POP_SCOPE_ID,
  5497. PUSH_SCOPE_ID: PUSH_SCOPE_ID,
  5498. RENDER_LIST: RENDER_LIST,
  5499. RENDER_SLOT: RENDER_SLOT,
  5500. RESOLVE_COMPONENT: RESOLVE_COMPONENT,
  5501. RESOLVE_DIRECTIVE: RESOLVE_DIRECTIVE,
  5502. RESOLVE_DYNAMIC_COMPONENT: RESOLVE_DYNAMIC_COMPONENT,
  5503. RESOLVE_FILTER: RESOLVE_FILTER,
  5504. SET_BLOCK_TRACKING: SET_BLOCK_TRACKING,
  5505. SUSPENSE: SUSPENSE,
  5506. TELEPORT: TELEPORT,
  5507. TO_DISPLAY_STRING: TO_DISPLAY_STRING,
  5508. TO_HANDLERS: TO_HANDLERS,
  5509. TO_HANDLER_KEY: TO_HANDLER_KEY,
  5510. UNREF: UNREF,
  5511. WITH_CTX: WITH_CTX,
  5512. WITH_DIRECTIVES: WITH_DIRECTIVES,
  5513. WITH_MEMO: WITH_MEMO,
  5514. advancePositionWithClone: advancePositionWithClone,
  5515. advancePositionWithMutation: advancePositionWithMutation,
  5516. assert: assert,
  5517. baseCompile: baseCompile,
  5518. baseParse: baseParse,
  5519. buildDirectiveArgs: buildDirectiveArgs,
  5520. buildProps: buildProps,
  5521. buildSlots: buildSlots,
  5522. checkCompatEnabled: checkCompatEnabled,
  5523. createArrayExpression: createArrayExpression,
  5524. createAssignmentExpression: createAssignmentExpression,
  5525. createBlockStatement: createBlockStatement,
  5526. createCacheExpression: createCacheExpression,
  5527. createCallExpression: createCallExpression,
  5528. createCompilerError: createCompilerError,
  5529. createCompoundExpression: createCompoundExpression,
  5530. createConditionalExpression: createConditionalExpression,
  5531. createForLoopParams: createForLoopParams,
  5532. createFunctionExpression: createFunctionExpression,
  5533. createIfStatement: createIfStatement,
  5534. createInterpolation: createInterpolation,
  5535. createObjectExpression: createObjectExpression,
  5536. createObjectProperty: createObjectProperty,
  5537. createReturnStatement: createReturnStatement,
  5538. createRoot: createRoot,
  5539. createSequenceExpression: createSequenceExpression,
  5540. createSimpleExpression: createSimpleExpression,
  5541. createStructuralDirectiveTransform: createStructuralDirectiveTransform,
  5542. createTemplateLiteral: createTemplateLiteral,
  5543. createTransformContext: createTransformContext,
  5544. createVNodeCall: createVNodeCall,
  5545. extractIdentifiers: extractIdentifiers,
  5546. findDir: findDir,
  5547. findProp: findProp,
  5548. generate: generate,
  5549. getBaseTransformPreset: getBaseTransformPreset,
  5550. getInnerRange: getInnerRange,
  5551. getMemoedVNodeCall: getMemoedVNodeCall,
  5552. getVNodeBlockHelper: getVNodeBlockHelper,
  5553. getVNodeHelper: getVNodeHelper,
  5554. hasDynamicKeyVBind: hasDynamicKeyVBind,
  5555. hasScopeRef: hasScopeRef,
  5556. helperNameMap: helperNameMap,
  5557. injectProp: injectProp,
  5558. isBuiltInType: isBuiltInType,
  5559. isCoreComponent: isCoreComponent,
  5560. isFunctionType: isFunctionType,
  5561. isInDestructureAssignment: isInDestructureAssignment,
  5562. isMemberExpression: isMemberExpression,
  5563. isMemberExpressionBrowser: isMemberExpressionBrowser,
  5564. isMemberExpressionNode: isMemberExpressionNode,
  5565. isReferencedIdentifier: isReferencedIdentifier,
  5566. isSimpleIdentifier: isSimpleIdentifier,
  5567. isSlotOutlet: isSlotOutlet,
  5568. isStaticArgOf: isStaticArgOf,
  5569. isStaticExp: isStaticExp,
  5570. isStaticProperty: isStaticProperty,
  5571. isStaticPropertyKey: isStaticPropertyKey,
  5572. isTemplateNode: isTemplateNode,
  5573. isText: isText,
  5574. isVSlot: isVSlot,
  5575. locStub: locStub,
  5576. makeBlock: makeBlock,
  5577. noopDirectiveTransform: noopDirectiveTransform,
  5578. processExpression: processExpression,
  5579. processFor: processFor,
  5580. processIf: processIf,
  5581. processSlotOutlet: processSlotOutlet,
  5582. registerRuntimeHelpers: registerRuntimeHelpers,
  5583. resolveComponentType: resolveComponentType,
  5584. toValidAssetId: toValidAssetId,
  5585. trackSlotScopes: trackSlotScopes,
  5586. trackVForSlotScopes: trackVForSlotScopes,
  5587. transform: transform,
  5588. transformBind: transformBind,
  5589. transformElement: transformElement,
  5590. transformExpression: transformExpression,
  5591. transformModel: transformModel,
  5592. transformOn: transformOn,
  5593. traverseNode: traverseNode,
  5594. walkBlockDeclarations: walkBlockDeclarations,
  5595. walkFunctionParams: walkFunctionParams,
  5596. walkIdentifiers: walkIdentifiers,
  5597. warnDeprecation: warnDeprecation,
  5598. generateCodeFrame: generateCodeFrame
  5599. };
  5600. var require$$0 = /*@__PURE__*/index.getAugmentedNamespace(compilerCore_esmBundler);
  5601. var require$$1 = /*@__PURE__*/index.getAugmentedNamespace(shared_esmBundler);
  5602. (function (exports) {
  5603. Object.defineProperty(exports, '__esModule', { value: true });
  5604. var compilerCore = require$$0;
  5605. var shared = require$$1;
  5606. const V_MODEL_RADIO = Symbol(`vModelRadio` );
  5607. const V_MODEL_CHECKBOX = Symbol(`vModelCheckbox` );
  5608. const V_MODEL_TEXT = Symbol(`vModelText` );
  5609. const V_MODEL_SELECT = Symbol(`vModelSelect` );
  5610. const V_MODEL_DYNAMIC = Symbol(`vModelDynamic` );
  5611. const V_ON_WITH_MODIFIERS = Symbol(`vOnModifiersGuard` );
  5612. const V_ON_WITH_KEYS = Symbol(`vOnKeysGuard` );
  5613. const V_SHOW = Symbol(`vShow` );
  5614. const TRANSITION = Symbol(`Transition` );
  5615. const TRANSITION_GROUP = Symbol(`TransitionGroup` );
  5616. compilerCore.registerRuntimeHelpers({
  5617. [V_MODEL_RADIO]: `vModelRadio`,
  5618. [V_MODEL_CHECKBOX]: `vModelCheckbox`,
  5619. [V_MODEL_TEXT]: `vModelText`,
  5620. [V_MODEL_SELECT]: `vModelSelect`,
  5621. [V_MODEL_DYNAMIC]: `vModelDynamic`,
  5622. [V_ON_WITH_MODIFIERS]: `withModifiers`,
  5623. [V_ON_WITH_KEYS]: `withKeys`,
  5624. [V_SHOW]: `vShow`,
  5625. [TRANSITION]: `Transition`,
  5626. [TRANSITION_GROUP]: `TransitionGroup`
  5627. });
  5628. var namedCharacterReferences = {
  5629. GT: ">",
  5630. gt: ">",
  5631. LT: "<",
  5632. lt: "<",
  5633. "ac;": "∾",
  5634. "af;": "⁡",
  5635. AMP: "&",
  5636. amp: "&",
  5637. "ap;": "≈",
  5638. "DD;": "ⅅ",
  5639. "dd;": "ⅆ",
  5640. deg: "°",
  5641. "ee;": "ⅇ",
  5642. "eg;": "⪚",
  5643. "el;": "⪙",
  5644. ETH: "Ð",
  5645. eth: "ð",
  5646. "gE;": "≧",
  5647. "ge;": "≥",
  5648. "Gg;": "⋙",
  5649. "gg;": "≫",
  5650. "gl;": "≷",
  5651. "GT;": ">",
  5652. "Gt;": "≫",
  5653. "gt;": ">",
  5654. "ic;": "⁣",
  5655. "ii;": "ⅈ",
  5656. "Im;": "ℑ",
  5657. "in;": "∈",
  5658. "it;": "⁢",
  5659. "lE;": "≦",
  5660. "le;": "≤",
  5661. "lg;": "≶",
  5662. "Ll;": "⋘",
  5663. "ll;": "≪",
  5664. "LT;": "<",
  5665. "Lt;": "≪",
  5666. "lt;": "<",
  5667. "mp;": "∓",
  5668. "Mu;": "Μ",
  5669. "mu;": "μ",
  5670. "ne;": "≠",
  5671. "ni;": "∋",
  5672. not: "¬",
  5673. "Nu;": "Ν",
  5674. "nu;": "ν",
  5675. "Or;": "⩔",
  5676. "or;": "∨",
  5677. "oS;": "Ⓢ",
  5678. "Pi;": "Π",
  5679. "pi;": "π",
  5680. "pm;": "±",
  5681. "Pr;": "⪻",
  5682. "pr;": "≺",
  5683. "Re;": "ℜ",
  5684. REG: "®",
  5685. reg: "®",
  5686. "rx;": "℞",
  5687. "Sc;": "⪼",
  5688. "sc;": "≻",
  5689. shy: "­",
  5690. uml: "¨",
  5691. "wp;": "℘",
  5692. "wr;": "≀",
  5693. "Xi;": "Ξ",
  5694. "xi;": "ξ",
  5695. yen: "¥",
  5696. "acd;": "∿",
  5697. "acE;": "∾̳",
  5698. "Acy;": "А",
  5699. "acy;": "а",
  5700. "Afr;": "𝔄",
  5701. "afr;": "𝔞",
  5702. "AMP;": "&",
  5703. "amp;": "&",
  5704. "And;": "⩓",
  5705. "and;": "∧",
  5706. "ang;": "∠",
  5707. "apE;": "⩰",
  5708. "ape;": "≊",
  5709. "ast;": "*",
  5710. Auml: "Ä",
  5711. auml: "ä",
  5712. "Bcy;": "Б",
  5713. "bcy;": "б",
  5714. "Bfr;": "𝔅",
  5715. "bfr;": "𝔟",
  5716. "bne;": "=⃥",
  5717. "bot;": "⊥",
  5718. "Cap;": "⋒",
  5719. "cap;": "∩",
  5720. cent: "¢",
  5721. "Cfr;": "ℭ",
  5722. "cfr;": "𝔠",
  5723. "Chi;": "Χ",
  5724. "chi;": "χ",
  5725. "cir;": "○",
  5726. COPY: "©",
  5727. copy: "©",
  5728. "Cup;": "⋓",
  5729. "cup;": "∪",
  5730. "Dcy;": "Д",
  5731. "dcy;": "д",
  5732. "deg;": "°",
  5733. "Del;": "∇",
  5734. "Dfr;": "𝔇",
  5735. "dfr;": "𝔡",
  5736. "die;": "¨",
  5737. "div;": "÷",
  5738. "Dot;": "¨",
  5739. "dot;": "˙",
  5740. "Ecy;": "Э",
  5741. "ecy;": "э",
  5742. "Efr;": "𝔈",
  5743. "efr;": "𝔢",
  5744. "egs;": "⪖",
  5745. "ell;": "ℓ",
  5746. "els;": "⪕",
  5747. "ENG;": "Ŋ",
  5748. "eng;": "ŋ",
  5749. "Eta;": "Η",
  5750. "eta;": "η",
  5751. "ETH;": "Ð",
  5752. "eth;": "ð",
  5753. Euml: "Ë",
  5754. euml: "ë",
  5755. "Fcy;": "Ф",
  5756. "fcy;": "ф",
  5757. "Ffr;": "𝔉",
  5758. "ffr;": "𝔣",
  5759. "gap;": "⪆",
  5760. "Gcy;": "Г",
  5761. "gcy;": "г",
  5762. "gEl;": "⪌",
  5763. "gel;": "⋛",
  5764. "geq;": "≥",
  5765. "ges;": "⩾",
  5766. "Gfr;": "𝔊",
  5767. "gfr;": "𝔤",
  5768. "ggg;": "⋙",
  5769. "gla;": "⪥",
  5770. "glE;": "⪒",
  5771. "glj;": "⪤",
  5772. "gnE;": "≩",
  5773. "gne;": "⪈",
  5774. "Hat;": "^",
  5775. "Hfr;": "ℌ",
  5776. "hfr;": "𝔥",
  5777. "Icy;": "И",
  5778. "icy;": "и",
  5779. "iff;": "⇔",
  5780. "Ifr;": "ℑ",
  5781. "ifr;": "𝔦",
  5782. "Int;": "∬",
  5783. "int;": "∫",
  5784. Iuml: "Ï",
  5785. iuml: "ï",
  5786. "Jcy;": "Й",
  5787. "jcy;": "й",
  5788. "Jfr;": "𝔍",
  5789. "jfr;": "𝔧",
  5790. "Kcy;": "К",
  5791. "kcy;": "к",
  5792. "Kfr;": "𝔎",
  5793. "kfr;": "𝔨",
  5794. "lap;": "⪅",
  5795. "lat;": "⪫",
  5796. "Lcy;": "Л",
  5797. "lcy;": "л",
  5798. "lEg;": "⪋",
  5799. "leg;": "⋚",
  5800. "leq;": "≤",
  5801. "les;": "⩽",
  5802. "Lfr;": "𝔏",
  5803. "lfr;": "𝔩",
  5804. "lgE;": "⪑",
  5805. "lnE;": "≨",
  5806. "lne;": "⪇",
  5807. "loz;": "◊",
  5808. "lrm;": "‎",
  5809. "Lsh;": "↰",
  5810. "lsh;": "↰",
  5811. macr: "¯",
  5812. "Map;": "⤅",
  5813. "map;": "↦",
  5814. "Mcy;": "М",
  5815. "mcy;": "м",
  5816. "Mfr;": "𝔐",
  5817. "mfr;": "𝔪",
  5818. "mho;": "℧",
  5819. "mid;": "∣",
  5820. "nap;": "≉",
  5821. nbsp: " ",
  5822. "Ncy;": "Н",
  5823. "ncy;": "н",
  5824. "Nfr;": "𝔑",
  5825. "nfr;": "𝔫",
  5826. "ngE;": "≧̸",
  5827. "nge;": "≱",
  5828. "nGg;": "⋙̸",
  5829. "nGt;": "≫⃒",
  5830. "ngt;": "≯",
  5831. "nis;": "⋼",
  5832. "niv;": "∋",
  5833. "nlE;": "≦̸",
  5834. "nle;": "≰",
  5835. "nLl;": "⋘̸",
  5836. "nLt;": "≪⃒",
  5837. "nlt;": "≮",
  5838. "Not;": "⫬",
  5839. "not;": "¬",
  5840. "npr;": "⊀",
  5841. "nsc;": "⊁",
  5842. "num;": "#",
  5843. "Ocy;": "О",
  5844. "ocy;": "о",
  5845. "Ofr;": "𝔒",
  5846. "ofr;": "𝔬",
  5847. "ogt;": "⧁",
  5848. "ohm;": "Ω",
  5849. "olt;": "⧀",
  5850. "ord;": "⩝",
  5851. ordf: "ª",
  5852. ordm: "º",
  5853. "orv;": "⩛",
  5854. Ouml: "Ö",
  5855. ouml: "ö",
  5856. "par;": "∥",
  5857. para: "¶",
  5858. "Pcy;": "П",
  5859. "pcy;": "п",
  5860. "Pfr;": "𝔓",
  5861. "pfr;": "𝔭",
  5862. "Phi;": "Φ",
  5863. "phi;": "φ",
  5864. "piv;": "ϖ",
  5865. "prE;": "⪳",
  5866. "pre;": "⪯",
  5867. "Psi;": "Ψ",
  5868. "psi;": "ψ",
  5869. "Qfr;": "𝔔",
  5870. "qfr;": "𝔮",
  5871. QUOT: "\"",
  5872. quot: "\"",
  5873. "Rcy;": "Р",
  5874. "rcy;": "р",
  5875. "REG;": "®",
  5876. "reg;": "®",
  5877. "Rfr;": "ℜ",
  5878. "rfr;": "𝔯",
  5879. "Rho;": "Ρ",
  5880. "rho;": "ρ",
  5881. "rlm;": "‏",
  5882. "Rsh;": "↱",
  5883. "rsh;": "↱",
  5884. "scE;": "⪴",
  5885. "sce;": "⪰",
  5886. "Scy;": "С",
  5887. "scy;": "с",
  5888. sect: "§",
  5889. "Sfr;": "𝔖",
  5890. "sfr;": "𝔰",
  5891. "shy;": "­",
  5892. "sim;": "∼",
  5893. "smt;": "⪪",
  5894. "sol;": "/",
  5895. "squ;": "□",
  5896. "Sub;": "⋐",
  5897. "sub;": "⊂",
  5898. "Sum;": "∑",
  5899. "sum;": "∑",
  5900. "Sup;": "⋑",
  5901. "sup;": "⊃",
  5902. sup1: "¹",
  5903. sup2: "²",
  5904. sup3: "³",
  5905. "Tab;": "\t",
  5906. "Tau;": "Τ",
  5907. "tau;": "τ",
  5908. "Tcy;": "Т",
  5909. "tcy;": "т",
  5910. "Tfr;": "𝔗",
  5911. "tfr;": "𝔱",
  5912. "top;": "⊤",
  5913. "Ucy;": "У",
  5914. "ucy;": "у",
  5915. "Ufr;": "𝔘",
  5916. "ufr;": "𝔲",
  5917. "uml;": "¨",
  5918. Uuml: "Ü",
  5919. uuml: "ü",
  5920. "Vcy;": "В",
  5921. "vcy;": "в",
  5922. "Vee;": "⋁",
  5923. "vee;": "∨",
  5924. "Vfr;": "𝔙",
  5925. "vfr;": "𝔳",
  5926. "Wfr;": "𝔚",
  5927. "wfr;": "𝔴",
  5928. "Xfr;": "𝔛",
  5929. "xfr;": "𝔵",
  5930. "Ycy;": "Ы",
  5931. "ycy;": "ы",
  5932. "yen;": "¥",
  5933. "Yfr;": "𝔜",
  5934. "yfr;": "𝔶",
  5935. yuml: "ÿ",
  5936. "Zcy;": "З",
  5937. "zcy;": "з",
  5938. "Zfr;": "ℨ",
  5939. "zfr;": "𝔷",
  5940. "zwj;": "‍",
  5941. Acirc: "Â",
  5942. acirc: "â",
  5943. acute: "´",
  5944. AElig: "Æ",
  5945. aelig: "æ",
  5946. "andd;": "⩜",
  5947. "andv;": "⩚",
  5948. "ange;": "⦤",
  5949. "Aopf;": "𝔸",
  5950. "aopf;": "𝕒",
  5951. "apid;": "≋",
  5952. "apos;": "'",
  5953. Aring: "Å",
  5954. aring: "å",
  5955. "Ascr;": "𝒜",
  5956. "ascr;": "𝒶",
  5957. "Auml;": "Ä",
  5958. "auml;": "ä",
  5959. "Barv;": "⫧",
  5960. "bbrk;": "⎵",
  5961. "Beta;": "Β",
  5962. "beta;": "β",
  5963. "beth;": "ℶ",
  5964. "bNot;": "⫭",
  5965. "bnot;": "⌐",
  5966. "Bopf;": "𝔹",
  5967. "bopf;": "𝕓",
  5968. "boxH;": "═",
  5969. "boxh;": "─",
  5970. "boxV;": "║",
  5971. "boxv;": "│",
  5972. "Bscr;": "ℬ",
  5973. "bscr;": "𝒷",
  5974. "bsim;": "∽",
  5975. "bsol;": "\\",
  5976. "bull;": "•",
  5977. "bump;": "≎",
  5978. "caps;": "∩︀",
  5979. "Cdot;": "Ċ",
  5980. "cdot;": "ċ",
  5981. cedil: "¸",
  5982. "cent;": "¢",
  5983. "CHcy;": "Ч",
  5984. "chcy;": "ч",
  5985. "circ;": "ˆ",
  5986. "cirE;": "⧃",
  5987. "cire;": "≗",
  5988. "comp;": "∁",
  5989. "cong;": "≅",
  5990. "Copf;": "ℂ",
  5991. "copf;": "𝕔",
  5992. "COPY;": "©",
  5993. "copy;": "©",
  5994. "Cscr;": "𝒞",
  5995. "cscr;": "𝒸",
  5996. "csub;": "⫏",
  5997. "csup;": "⫐",
  5998. "cups;": "∪︀",
  5999. "Darr;": "↡",
  6000. "dArr;": "⇓",
  6001. "darr;": "↓",
  6002. "dash;": "‐",
  6003. "dHar;": "⥥",
  6004. "diam;": "⋄",
  6005. "DJcy;": "Ђ",
  6006. "djcy;": "ђ",
  6007. "Dopf;": "𝔻",
  6008. "dopf;": "𝕕",
  6009. "Dscr;": "𝒟",
  6010. "dscr;": "𝒹",
  6011. "DScy;": "Ѕ",
  6012. "dscy;": "ѕ",
  6013. "dsol;": "⧶",
  6014. "dtri;": "▿",
  6015. "DZcy;": "Џ",
  6016. "dzcy;": "џ",
  6017. "ecir;": "≖",
  6018. Ecirc: "Ê",
  6019. ecirc: "ê",
  6020. "Edot;": "Ė",
  6021. "eDot;": "≑",
  6022. "edot;": "ė",
  6023. "emsp;": " ",
  6024. "ensp;": " ",
  6025. "Eopf;": "𝔼",
  6026. "eopf;": "𝕖",
  6027. "epar;": "⋕",
  6028. "epsi;": "ε",
  6029. "Escr;": "ℰ",
  6030. "escr;": "ℯ",
  6031. "Esim;": "⩳",
  6032. "esim;": "≂",
  6033. "Euml;": "Ë",
  6034. "euml;": "ë",
  6035. "euro;": "€",
  6036. "excl;": "!",
  6037. "flat;": "♭",
  6038. "fnof;": "ƒ",
  6039. "Fopf;": "𝔽",
  6040. "fopf;": "𝕗",
  6041. "fork;": "⋔",
  6042. "Fscr;": "ℱ",
  6043. "fscr;": "𝒻",
  6044. "Gdot;": "Ġ",
  6045. "gdot;": "ġ",
  6046. "geqq;": "≧",
  6047. "gesl;": "⋛︀",
  6048. "GJcy;": "Ѓ",
  6049. "gjcy;": "ѓ",
  6050. "gnap;": "⪊",
  6051. "gneq;": "⪈",
  6052. "Gopf;": "𝔾",
  6053. "gopf;": "𝕘",
  6054. "Gscr;": "𝒢",
  6055. "gscr;": "ℊ",
  6056. "gsim;": "≳",
  6057. "gtcc;": "⪧",
  6058. "gvnE;": "≩︀",
  6059. "half;": "½",
  6060. "hArr;": "⇔",
  6061. "harr;": "↔",
  6062. "hbar;": "ℏ",
  6063. "Hopf;": "ℍ",
  6064. "hopf;": "𝕙",
  6065. "Hscr;": "ℋ",
  6066. "hscr;": "𝒽",
  6067. Icirc: "Î",
  6068. icirc: "î",
  6069. "Idot;": "İ",
  6070. "IEcy;": "Е",
  6071. "iecy;": "е",
  6072. iexcl: "¡",
  6073. "imof;": "⊷",
  6074. "IOcy;": "Ё",
  6075. "iocy;": "ё",
  6076. "Iopf;": "𝕀",
  6077. "iopf;": "𝕚",
  6078. "Iota;": "Ι",
  6079. "iota;": "ι",
  6080. "Iscr;": "ℐ",
  6081. "iscr;": "𝒾",
  6082. "isin;": "∈",
  6083. "Iuml;": "Ï",
  6084. "iuml;": "ï",
  6085. "Jopf;": "𝕁",
  6086. "jopf;": "𝕛",
  6087. "Jscr;": "𝒥",
  6088. "jscr;": "𝒿",
  6089. "KHcy;": "Х",
  6090. "khcy;": "х",
  6091. "KJcy;": "Ќ",
  6092. "kjcy;": "ќ",
  6093. "Kopf;": "𝕂",
  6094. "kopf;": "𝕜",
  6095. "Kscr;": "𝒦",
  6096. "kscr;": "𝓀",
  6097. "Lang;": "⟪",
  6098. "lang;": "⟨",
  6099. laquo: "«",
  6100. "Larr;": "↞",
  6101. "lArr;": "⇐",
  6102. "larr;": "←",
  6103. "late;": "⪭",
  6104. "lcub;": "{",
  6105. "ldca;": "⤶",
  6106. "ldsh;": "↲",
  6107. "leqq;": "≦",
  6108. "lesg;": "⋚︀",
  6109. "lHar;": "⥢",
  6110. "LJcy;": "Љ",
  6111. "ljcy;": "љ",
  6112. "lnap;": "⪉",
  6113. "lneq;": "⪇",
  6114. "Lopf;": "𝕃",
  6115. "lopf;": "𝕝",
  6116. "lozf;": "⧫",
  6117. "lpar;": "(",
  6118. "Lscr;": "ℒ",
  6119. "lscr;": "𝓁",
  6120. "lsim;": "≲",
  6121. "lsqb;": "[",
  6122. "ltcc;": "⪦",
  6123. "ltri;": "◃",
  6124. "lvnE;": "≨︀",
  6125. "macr;": "¯",
  6126. "male;": "♂",
  6127. "malt;": "✠",
  6128. micro: "µ",
  6129. "mlcp;": "⫛",
  6130. "mldr;": "…",
  6131. "Mopf;": "𝕄",
  6132. "mopf;": "𝕞",
  6133. "Mscr;": "ℳ",
  6134. "mscr;": "𝓂",
  6135. "nang;": "∠⃒",
  6136. "napE;": "⩰̸",
  6137. "nbsp;": " ",
  6138. "ncap;": "⩃",
  6139. "ncup;": "⩂",
  6140. "ngeq;": "≱",
  6141. "nges;": "⩾̸",
  6142. "ngtr;": "≯",
  6143. "nGtv;": "≫̸",
  6144. "nisd;": "⋺",
  6145. "NJcy;": "Њ",
  6146. "njcy;": "њ",
  6147. "nldr;": "‥",
  6148. "nleq;": "≰",
  6149. "nles;": "⩽̸",
  6150. "nLtv;": "≪̸",
  6151. "nmid;": "∤",
  6152. "Nopf;": "ℕ",
  6153. "nopf;": "𝕟",
  6154. "npar;": "∦",
  6155. "npre;": "⪯̸",
  6156. "nsce;": "⪰̸",
  6157. "Nscr;": "𝒩",
  6158. "nscr;": "𝓃",
  6159. "nsim;": "≁",
  6160. "nsub;": "⊄",
  6161. "nsup;": "⊅",
  6162. "ntgl;": "≹",
  6163. "ntlg;": "≸",
  6164. "nvap;": "≍⃒",
  6165. "nvge;": "≥⃒",
  6166. "nvgt;": ">⃒",
  6167. "nvle;": "≤⃒",
  6168. "nvlt;": "<⃒",
  6169. "oast;": "⊛",
  6170. "ocir;": "⊚",
  6171. Ocirc: "Ô",
  6172. ocirc: "ô",
  6173. "odiv;": "⨸",
  6174. "odot;": "⊙",
  6175. "ogon;": "˛",
  6176. "oint;": "∮",
  6177. "omid;": "⦶",
  6178. "Oopf;": "𝕆",
  6179. "oopf;": "𝕠",
  6180. "opar;": "⦷",
  6181. "ordf;": "ª",
  6182. "ordm;": "º",
  6183. "oror;": "⩖",
  6184. "Oscr;": "𝒪",
  6185. "oscr;": "ℴ",
  6186. "osol;": "⊘",
  6187. "Ouml;": "Ö",
  6188. "ouml;": "ö",
  6189. "para;": "¶",
  6190. "part;": "∂",
  6191. "perp;": "⊥",
  6192. "phiv;": "ϕ",
  6193. "plus;": "+",
  6194. "Popf;": "ℙ",
  6195. "popf;": "𝕡",
  6196. pound: "£",
  6197. "prap;": "⪷",
  6198. "prec;": "≺",
  6199. "prnE;": "⪵",
  6200. "prod;": "∏",
  6201. "prop;": "∝",
  6202. "Pscr;": "𝒫",
  6203. "pscr;": "𝓅",
  6204. "qint;": "⨌",
  6205. "Qopf;": "ℚ",
  6206. "qopf;": "𝕢",
  6207. "Qscr;": "𝒬",
  6208. "qscr;": "𝓆",
  6209. "QUOT;": "\"",
  6210. "quot;": "\"",
  6211. "race;": "∽̱",
  6212. "Rang;": "⟫",
  6213. "rang;": "⟩",
  6214. raquo: "»",
  6215. "Rarr;": "↠",
  6216. "rArr;": "⇒",
  6217. "rarr;": "→",
  6218. "rcub;": "}",
  6219. "rdca;": "⤷",
  6220. "rdsh;": "↳",
  6221. "real;": "ℜ",
  6222. "rect;": "▭",
  6223. "rHar;": "⥤",
  6224. "rhov;": "ϱ",
  6225. "ring;": "˚",
  6226. "Ropf;": "ℝ",
  6227. "ropf;": "𝕣",
  6228. "rpar;": ")",
  6229. "Rscr;": "ℛ",
  6230. "rscr;": "𝓇",
  6231. "rsqb;": "]",
  6232. "rtri;": "▹",
  6233. "scap;": "⪸",
  6234. "scnE;": "⪶",
  6235. "sdot;": "⋅",
  6236. "sect;": "§",
  6237. "semi;": ";",
  6238. "sext;": "✶",
  6239. "SHcy;": "Ш",
  6240. "shcy;": "ш",
  6241. "sime;": "≃",
  6242. "simg;": "⪞",
  6243. "siml;": "⪝",
  6244. "smid;": "∣",
  6245. "smte;": "⪬",
  6246. "solb;": "⧄",
  6247. "Sopf;": "𝕊",
  6248. "sopf;": "𝕤",
  6249. "spar;": "∥",
  6250. "Sqrt;": "√",
  6251. "squf;": "▪",
  6252. "Sscr;": "𝒮",
  6253. "sscr;": "𝓈",
  6254. "Star;": "⋆",
  6255. "star;": "☆",
  6256. "subE;": "⫅",
  6257. "sube;": "⊆",
  6258. "succ;": "≻",
  6259. "sung;": "♪",
  6260. "sup1;": "¹",
  6261. "sup2;": "²",
  6262. "sup3;": "³",
  6263. "supE;": "⫆",
  6264. "supe;": "⊇",
  6265. szlig: "ß",
  6266. "tbrk;": "⎴",
  6267. "tdot;": "⃛",
  6268. THORN: "Þ",
  6269. thorn: "þ",
  6270. times: "×",
  6271. "tint;": "∭",
  6272. "toea;": "⤨",
  6273. "Topf;": "𝕋",
  6274. "topf;": "𝕥",
  6275. "tosa;": "⤩",
  6276. "trie;": "≜",
  6277. "Tscr;": "𝒯",
  6278. "tscr;": "𝓉",
  6279. "TScy;": "Ц",
  6280. "tscy;": "ц",
  6281. "Uarr;": "↟",
  6282. "uArr;": "⇑",
  6283. "uarr;": "↑",
  6284. Ucirc: "Û",
  6285. ucirc: "û",
  6286. "uHar;": "⥣",
  6287. "Uopf;": "𝕌",
  6288. "uopf;": "𝕦",
  6289. "Upsi;": "ϒ",
  6290. "upsi;": "υ",
  6291. "Uscr;": "𝒰",
  6292. "uscr;": "𝓊",
  6293. "utri;": "▵",
  6294. "Uuml;": "Ü",
  6295. "uuml;": "ü",
  6296. "vArr;": "⇕",
  6297. "varr;": "↕",
  6298. "Vbar;": "⫫",
  6299. "vBar;": "⫨",
  6300. "Vert;": "‖",
  6301. "vert;": "|",
  6302. "Vopf;": "𝕍",
  6303. "vopf;": "𝕧",
  6304. "Vscr;": "𝒱",
  6305. "vscr;": "𝓋",
  6306. "Wopf;": "𝕎",
  6307. "wopf;": "𝕨",
  6308. "Wscr;": "𝒲",
  6309. "wscr;": "𝓌",
  6310. "xcap;": "⋂",
  6311. "xcup;": "⋃",
  6312. "xmap;": "⟼",
  6313. "xnis;": "⋻",
  6314. "Xopf;": "𝕏",
  6315. "xopf;": "𝕩",
  6316. "Xscr;": "𝒳",
  6317. "xscr;": "𝓍",
  6318. "xvee;": "⋁",
  6319. "YAcy;": "Я",
  6320. "yacy;": "я",
  6321. "YIcy;": "Ї",
  6322. "yicy;": "ї",
  6323. "Yopf;": "𝕐",
  6324. "yopf;": "𝕪",
  6325. "Yscr;": "𝒴",
  6326. "yscr;": "𝓎",
  6327. "YUcy;": "Ю",
  6328. "yucy;": "ю",
  6329. "Yuml;": "Ÿ",
  6330. "yuml;": "ÿ",
  6331. "Zdot;": "Ż",
  6332. "zdot;": "ż",
  6333. "Zeta;": "Ζ",
  6334. "zeta;": "ζ",
  6335. "ZHcy;": "Ж",
  6336. "zhcy;": "ж",
  6337. "Zopf;": "ℤ",
  6338. "zopf;": "𝕫",
  6339. "Zscr;": "𝒵",
  6340. "zscr;": "𝓏",
  6341. "zwnj;": "‌",
  6342. Aacute: "Á",
  6343. aacute: "á",
  6344. "Acirc;": "Â",
  6345. "acirc;": "â",
  6346. "acute;": "´",
  6347. "AElig;": "Æ",
  6348. "aelig;": "æ",
  6349. Agrave: "À",
  6350. agrave: "à",
  6351. "aleph;": "ℵ",
  6352. "Alpha;": "Α",
  6353. "alpha;": "α",
  6354. "Amacr;": "Ā",
  6355. "amacr;": "ā",
  6356. "amalg;": "⨿",
  6357. "angle;": "∠",
  6358. "angrt;": "∟",
  6359. "angst;": "Å",
  6360. "Aogon;": "Ą",
  6361. "aogon;": "ą",
  6362. "Aring;": "Å",
  6363. "aring;": "å",
  6364. "asymp;": "≈",
  6365. Atilde: "Ã",
  6366. atilde: "ã",
  6367. "awint;": "⨑",
  6368. "bcong;": "≌",
  6369. "bdquo;": "„",
  6370. "bepsi;": "϶",
  6371. "blank;": "␣",
  6372. "blk12;": "▒",
  6373. "blk14;": "░",
  6374. "blk34;": "▓",
  6375. "block;": "█",
  6376. "boxDL;": "╗",
  6377. "boxDl;": "╖",
  6378. "boxdL;": "╕",
  6379. "boxdl;": "┐",
  6380. "boxDR;": "╔",
  6381. "boxDr;": "╓",
  6382. "boxdR;": "╒",
  6383. "boxdr;": "┌",
  6384. "boxHD;": "╦",
  6385. "boxHd;": "╤",
  6386. "boxhD;": "╥",
  6387. "boxhd;": "┬",
  6388. "boxHU;": "╩",
  6389. "boxHu;": "╧",
  6390. "boxhU;": "╨",
  6391. "boxhu;": "┴",
  6392. "boxUL;": "╝",
  6393. "boxUl;": "╜",
  6394. "boxuL;": "╛",
  6395. "boxul;": "┘",
  6396. "boxUR;": "╚",
  6397. "boxUr;": "╙",
  6398. "boxuR;": "╘",
  6399. "boxur;": "└",
  6400. "boxVH;": "╬",
  6401. "boxVh;": "╫",
  6402. "boxvH;": "╪",
  6403. "boxvh;": "┼",
  6404. "boxVL;": "╣",
  6405. "boxVl;": "╢",
  6406. "boxvL;": "╡",
  6407. "boxvl;": "┤",
  6408. "boxVR;": "╠",
  6409. "boxVr;": "╟",
  6410. "boxvR;": "╞",
  6411. "boxvr;": "├",
  6412. "Breve;": "˘",
  6413. "breve;": "˘",
  6414. brvbar: "¦",
  6415. "bsemi;": "⁏",
  6416. "bsime;": "⋍",
  6417. "bsolb;": "⧅",
  6418. "bumpE;": "⪮",
  6419. "bumpe;": "≏",
  6420. "caret;": "⁁",
  6421. "caron;": "ˇ",
  6422. "ccaps;": "⩍",
  6423. Ccedil: "Ç",
  6424. ccedil: "ç",
  6425. "Ccirc;": "Ĉ",
  6426. "ccirc;": "ĉ",
  6427. "ccups;": "⩌",
  6428. "cedil;": "¸",
  6429. "check;": "✓",
  6430. "clubs;": "♣",
  6431. "Colon;": "∷",
  6432. "colon;": ":",
  6433. "comma;": ",",
  6434. "crarr;": "↵",
  6435. "Cross;": "⨯",
  6436. "cross;": "✗",
  6437. "csube;": "⫑",
  6438. "csupe;": "⫒",
  6439. "ctdot;": "⋯",
  6440. "cuepr;": "⋞",
  6441. "cuesc;": "⋟",
  6442. "cupor;": "⩅",
  6443. curren: "¤",
  6444. "cuvee;": "⋎",
  6445. "cuwed;": "⋏",
  6446. "cwint;": "∱",
  6447. "Dashv;": "⫤",
  6448. "dashv;": "⊣",
  6449. "dblac;": "˝",
  6450. "ddarr;": "⇊",
  6451. "Delta;": "Δ",
  6452. "delta;": "δ",
  6453. "dharl;": "⇃",
  6454. "dharr;": "⇂",
  6455. "diams;": "♦",
  6456. "disin;": "⋲",
  6457. divide: "÷",
  6458. "doteq;": "≐",
  6459. "dtdot;": "⋱",
  6460. "dtrif;": "▾",
  6461. "duarr;": "⇵",
  6462. "duhar;": "⥯",
  6463. Eacute: "É",
  6464. eacute: "é",
  6465. "Ecirc;": "Ê",
  6466. "ecirc;": "ê",
  6467. "eDDot;": "⩷",
  6468. "efDot;": "≒",
  6469. Egrave: "È",
  6470. egrave: "è",
  6471. "Emacr;": "Ē",
  6472. "emacr;": "ē",
  6473. "empty;": "∅",
  6474. "Eogon;": "Ę",
  6475. "eogon;": "ę",
  6476. "eplus;": "⩱",
  6477. "epsiv;": "ϵ",
  6478. "eqsim;": "≂",
  6479. "Equal;": "⩵",
  6480. "equiv;": "≡",
  6481. "erarr;": "⥱",
  6482. "erDot;": "≓",
  6483. "esdot;": "≐",
  6484. "exist;": "∃",
  6485. "fflig;": "ff",
  6486. "filig;": "fi",
  6487. "fjlig;": "fj",
  6488. "fllig;": "fl",
  6489. "fltns;": "▱",
  6490. "forkv;": "⫙",
  6491. frac12: "½",
  6492. frac14: "¼",
  6493. frac34: "¾",
  6494. "frasl;": "⁄",
  6495. "frown;": "⌢",
  6496. "Gamma;": "Γ",
  6497. "gamma;": "γ",
  6498. "Gcirc;": "Ĝ",
  6499. "gcirc;": "ĝ",
  6500. "gescc;": "⪩",
  6501. "gimel;": "ℷ",
  6502. "gneqq;": "≩",
  6503. "gnsim;": "⋧",
  6504. "grave;": "`",
  6505. "gsime;": "⪎",
  6506. "gsiml;": "⪐",
  6507. "gtcir;": "⩺",
  6508. "gtdot;": "⋗",
  6509. "Hacek;": "ˇ",
  6510. "harrw;": "↭",
  6511. "Hcirc;": "Ĥ",
  6512. "hcirc;": "ĥ",
  6513. "hoarr;": "⇿",
  6514. Iacute: "Í",
  6515. iacute: "í",
  6516. "Icirc;": "Î",
  6517. "icirc;": "î",
  6518. "iexcl;": "¡",
  6519. Igrave: "Ì",
  6520. igrave: "ì",
  6521. "iiint;": "∭",
  6522. "iiota;": "℩",
  6523. "IJlig;": "IJ",
  6524. "ijlig;": "ij",
  6525. "Imacr;": "Ī",
  6526. "imacr;": "ī",
  6527. "image;": "ℑ",
  6528. "imath;": "ı",
  6529. "imped;": "Ƶ",
  6530. "infin;": "∞",
  6531. "Iogon;": "Į",
  6532. "iogon;": "į",
  6533. "iprod;": "⨼",
  6534. iquest: "¿",
  6535. "isinE;": "⋹",
  6536. "isins;": "⋴",
  6537. "isinv;": "∈",
  6538. "Iukcy;": "І",
  6539. "iukcy;": "і",
  6540. "Jcirc;": "Ĵ",
  6541. "jcirc;": "ĵ",
  6542. "jmath;": "ȷ",
  6543. "Jukcy;": "Є",
  6544. "jukcy;": "є",
  6545. "Kappa;": "Κ",
  6546. "kappa;": "κ",
  6547. "lAarr;": "⇚",
  6548. "langd;": "⦑",
  6549. "laquo;": "«",
  6550. "larrb;": "⇤",
  6551. "lates;": "⪭︀",
  6552. "lBarr;": "⤎",
  6553. "lbarr;": "⤌",
  6554. "lbbrk;": "❲",
  6555. "lbrke;": "⦋",
  6556. "lceil;": "⌈",
  6557. "ldquo;": "“",
  6558. "lescc;": "⪨",
  6559. "lhard;": "↽",
  6560. "lharu;": "↼",
  6561. "lhblk;": "▄",
  6562. "llarr;": "⇇",
  6563. "lltri;": "◺",
  6564. "lneqq;": "≨",
  6565. "lnsim;": "⋦",
  6566. "loang;": "⟬",
  6567. "loarr;": "⇽",
  6568. "lobrk;": "⟦",
  6569. "lopar;": "⦅",
  6570. "lrarr;": "⇆",
  6571. "lrhar;": "⇋",
  6572. "lrtri;": "⊿",
  6573. "lsime;": "⪍",
  6574. "lsimg;": "⪏",
  6575. "lsquo;": "‘",
  6576. "ltcir;": "⩹",
  6577. "ltdot;": "⋖",
  6578. "ltrie;": "⊴",
  6579. "ltrif;": "◂",
  6580. "mdash;": "—",
  6581. "mDDot;": "∺",
  6582. "micro;": "µ",
  6583. middot: "·",
  6584. "minus;": "−",
  6585. "mumap;": "⊸",
  6586. "nabla;": "∇",
  6587. "napid;": "≋̸",
  6588. "napos;": "ʼn",
  6589. "natur;": "♮",
  6590. "nbump;": "≎̸",
  6591. "ncong;": "≇",
  6592. "ndash;": "–",
  6593. "neArr;": "⇗",
  6594. "nearr;": "↗",
  6595. "nedot;": "≐̸",
  6596. "nesim;": "≂̸",
  6597. "ngeqq;": "≧̸",
  6598. "ngsim;": "≵",
  6599. "nhArr;": "⇎",
  6600. "nharr;": "↮",
  6601. "nhpar;": "⫲",
  6602. "nlArr;": "⇍",
  6603. "nlarr;": "↚",
  6604. "nleqq;": "≦̸",
  6605. "nless;": "≮",
  6606. "nlsim;": "≴",
  6607. "nltri;": "⋪",
  6608. "notin;": "∉",
  6609. "notni;": "∌",
  6610. "npart;": "∂̸",
  6611. "nprec;": "⊀",
  6612. "nrArr;": "⇏",
  6613. "nrarr;": "↛",
  6614. "nrtri;": "⋫",
  6615. "nsime;": "≄",
  6616. "nsmid;": "∤",
  6617. "nspar;": "∦",
  6618. "nsubE;": "⫅̸",
  6619. "nsube;": "⊈",
  6620. "nsucc;": "⊁",
  6621. "nsupE;": "⫆̸",
  6622. "nsupe;": "⊉",
  6623. Ntilde: "Ñ",
  6624. ntilde: "ñ",
  6625. "numsp;": " ",
  6626. "nvsim;": "∼⃒",
  6627. "nwArr;": "⇖",
  6628. "nwarr;": "↖",
  6629. Oacute: "Ó",
  6630. oacute: "ó",
  6631. "Ocirc;": "Ô",
  6632. "ocirc;": "ô",
  6633. "odash;": "⊝",
  6634. "OElig;": "Œ",
  6635. "oelig;": "œ",
  6636. "ofcir;": "⦿",
  6637. Ograve: "Ò",
  6638. ograve: "ò",
  6639. "ohbar;": "⦵",
  6640. "olarr;": "↺",
  6641. "olcir;": "⦾",
  6642. "oline;": "‾",
  6643. "Omacr;": "Ō",
  6644. "omacr;": "ō",
  6645. "Omega;": "Ω",
  6646. "omega;": "ω",
  6647. "operp;": "⦹",
  6648. "oplus;": "⊕",
  6649. "orarr;": "↻",
  6650. "order;": "ℴ",
  6651. Oslash: "Ø",
  6652. oslash: "ø",
  6653. Otilde: "Õ",
  6654. otilde: "õ",
  6655. "ovbar;": "⌽",
  6656. "parsl;": "⫽",
  6657. "phone;": "☎",
  6658. "plusb;": "⊞",
  6659. "pluse;": "⩲",
  6660. plusmn: "±",
  6661. "pound;": "£",
  6662. "prcue;": "≼",
  6663. "Prime;": "″",
  6664. "prime;": "′",
  6665. "prnap;": "⪹",
  6666. "prsim;": "≾",
  6667. "quest;": "?",
  6668. "rAarr;": "⇛",
  6669. "radic;": "√",
  6670. "rangd;": "⦒",
  6671. "range;": "⦥",
  6672. "raquo;": "»",
  6673. "rarrb;": "⇥",
  6674. "rarrc;": "⤳",
  6675. "rarrw;": "↝",
  6676. "ratio;": "∶",
  6677. "RBarr;": "⤐",
  6678. "rBarr;": "⤏",
  6679. "rbarr;": "⤍",
  6680. "rbbrk;": "❳",
  6681. "rbrke;": "⦌",
  6682. "rceil;": "⌉",
  6683. "rdquo;": "”",
  6684. "reals;": "ℝ",
  6685. "rhard;": "⇁",
  6686. "rharu;": "⇀",
  6687. "rlarr;": "⇄",
  6688. "rlhar;": "⇌",
  6689. "rnmid;": "⫮",
  6690. "roang;": "⟭",
  6691. "roarr;": "⇾",
  6692. "robrk;": "⟧",
  6693. "ropar;": "⦆",
  6694. "rrarr;": "⇉",
  6695. "rsquo;": "’",
  6696. "rtrie;": "⊵",
  6697. "rtrif;": "▸",
  6698. "sbquo;": "‚",
  6699. "sccue;": "≽",
  6700. "Scirc;": "Ŝ",
  6701. "scirc;": "ŝ",
  6702. "scnap;": "⪺",
  6703. "scsim;": "≿",
  6704. "sdotb;": "⊡",
  6705. "sdote;": "⩦",
  6706. "seArr;": "⇘",
  6707. "searr;": "↘",
  6708. "setmn;": "∖",
  6709. "sharp;": "♯",
  6710. "Sigma;": "Σ",
  6711. "sigma;": "σ",
  6712. "simeq;": "≃",
  6713. "simgE;": "⪠",
  6714. "simlE;": "⪟",
  6715. "simne;": "≆",
  6716. "slarr;": "←",
  6717. "smile;": "⌣",
  6718. "smtes;": "⪬︀",
  6719. "sqcap;": "⊓",
  6720. "sqcup;": "⊔",
  6721. "sqsub;": "⊏",
  6722. "sqsup;": "⊐",
  6723. "srarr;": "→",
  6724. "starf;": "★",
  6725. "strns;": "¯",
  6726. "subnE;": "⫋",
  6727. "subne;": "⊊",
  6728. "supnE;": "⫌",
  6729. "supne;": "⊋",
  6730. "swArr;": "⇙",
  6731. "swarr;": "↙",
  6732. "szlig;": "ß",
  6733. "Theta;": "Θ",
  6734. "theta;": "θ",
  6735. "thkap;": "≈",
  6736. "THORN;": "Þ",
  6737. "thorn;": "þ",
  6738. "Tilde;": "∼",
  6739. "tilde;": "˜",
  6740. "times;": "×",
  6741. "TRADE;": "™",
  6742. "trade;": "™",
  6743. "trisb;": "⧍",
  6744. "TSHcy;": "Ћ",
  6745. "tshcy;": "ћ",
  6746. "twixt;": "≬",
  6747. Uacute: "Ú",
  6748. uacute: "ú",
  6749. "Ubrcy;": "Ў",
  6750. "ubrcy;": "ў",
  6751. "Ucirc;": "Û",
  6752. "ucirc;": "û",
  6753. "udarr;": "⇅",
  6754. "udhar;": "⥮",
  6755. Ugrave: "Ù",
  6756. ugrave: "ù",
  6757. "uharl;": "↿",
  6758. "uharr;": "↾",
  6759. "uhblk;": "▀",
  6760. "ultri;": "◸",
  6761. "Umacr;": "Ū",
  6762. "umacr;": "ū",
  6763. "Union;": "⋃",
  6764. "Uogon;": "Ų",
  6765. "uogon;": "ų",
  6766. "uplus;": "⊎",
  6767. "upsih;": "ϒ",
  6768. "UpTee;": "⊥",
  6769. "Uring;": "Ů",
  6770. "uring;": "ů",
  6771. "urtri;": "◹",
  6772. "utdot;": "⋰",
  6773. "utrif;": "▴",
  6774. "uuarr;": "⇈",
  6775. "varpi;": "ϖ",
  6776. "vBarv;": "⫩",
  6777. "VDash;": "⊫",
  6778. "Vdash;": "⊩",
  6779. "vDash;": "⊨",
  6780. "vdash;": "⊢",
  6781. "veeeq;": "≚",
  6782. "vltri;": "⊲",
  6783. "vnsub;": "⊂⃒",
  6784. "vnsup;": "⊃⃒",
  6785. "vprop;": "∝",
  6786. "vrtri;": "⊳",
  6787. "Wcirc;": "Ŵ",
  6788. "wcirc;": "ŵ",
  6789. "Wedge;": "⋀",
  6790. "wedge;": "∧",
  6791. "xcirc;": "◯",
  6792. "xdtri;": "▽",
  6793. "xhArr;": "⟺",
  6794. "xharr;": "⟷",
  6795. "xlArr;": "⟸",
  6796. "xlarr;": "⟵",
  6797. "xodot;": "⨀",
  6798. "xrArr;": "⟹",
  6799. "xrarr;": "⟶",
  6800. "xutri;": "△",
  6801. Yacute: "Ý",
  6802. yacute: "ý",
  6803. "Ycirc;": "Ŷ",
  6804. "ycirc;": "ŷ",
  6805. "Aacute;": "Á",
  6806. "aacute;": "á",
  6807. "Abreve;": "Ă",
  6808. "abreve;": "ă",
  6809. "Agrave;": "À",
  6810. "agrave;": "à",
  6811. "andand;": "⩕",
  6812. "angmsd;": "∡",
  6813. "angsph;": "∢",
  6814. "apacir;": "⩯",
  6815. "approx;": "≈",
  6816. "Assign;": "≔",
  6817. "Atilde;": "Ã",
  6818. "atilde;": "ã",
  6819. "barvee;": "⊽",
  6820. "Barwed;": "⌆",
  6821. "barwed;": "⌅",
  6822. "becaus;": "∵",
  6823. "bernou;": "ℬ",
  6824. "bigcap;": "⋂",
  6825. "bigcup;": "⋃",
  6826. "bigvee;": "⋁",
  6827. "bkarow;": "⤍",
  6828. "bottom;": "⊥",
  6829. "bowtie;": "⋈",
  6830. "boxbox;": "⧉",
  6831. "bprime;": "‵",
  6832. "brvbar;": "¦",
  6833. "bullet;": "•",
  6834. "Bumpeq;": "≎",
  6835. "bumpeq;": "≏",
  6836. "Cacute;": "Ć",
  6837. "cacute;": "ć",
  6838. "capand;": "⩄",
  6839. "capcap;": "⩋",
  6840. "capcup;": "⩇",
  6841. "capdot;": "⩀",
  6842. "Ccaron;": "Č",
  6843. "ccaron;": "č",
  6844. "Ccedil;": "Ç",
  6845. "ccedil;": "ç",
  6846. "circeq;": "≗",
  6847. "cirmid;": "⫯",
  6848. "Colone;": "⩴",
  6849. "colone;": "≔",
  6850. "commat;": "@",
  6851. "compfn;": "∘",
  6852. "Conint;": "∯",
  6853. "conint;": "∮",
  6854. "coprod;": "∐",
  6855. "copysr;": "℗",
  6856. "cularr;": "↶",
  6857. "CupCap;": "≍",
  6858. "cupcap;": "⩆",
  6859. "cupcup;": "⩊",
  6860. "cupdot;": "⊍",
  6861. "curarr;": "↷",
  6862. "curren;": "¤",
  6863. "cylcty;": "⌭",
  6864. "Dagger;": "‡",
  6865. "dagger;": "†",
  6866. "daleth;": "ℸ",
  6867. "Dcaron;": "Ď",
  6868. "dcaron;": "ď",
  6869. "dfisht;": "⥿",
  6870. "divide;": "÷",
  6871. "divonx;": "⋇",
  6872. "dlcorn;": "⌞",
  6873. "dlcrop;": "⌍",
  6874. "dollar;": "$",
  6875. "DotDot;": "⃜",
  6876. "drcorn;": "⌟",
  6877. "drcrop;": "⌌",
  6878. "Dstrok;": "Đ",
  6879. "dstrok;": "đ",
  6880. "Eacute;": "É",
  6881. "eacute;": "é",
  6882. "easter;": "⩮",
  6883. "Ecaron;": "Ě",
  6884. "ecaron;": "ě",
  6885. "ecolon;": "≕",
  6886. "Egrave;": "È",
  6887. "egrave;": "è",
  6888. "egsdot;": "⪘",
  6889. "elsdot;": "⪗",
  6890. "emptyv;": "∅",
  6891. "emsp13;": " ",
  6892. "emsp14;": " ",
  6893. "eparsl;": "⧣",
  6894. "eqcirc;": "≖",
  6895. "equals;": "=",
  6896. "equest;": "≟",
  6897. "Exists;": "∃",
  6898. "female;": "♀",
  6899. "ffilig;": "ffi",
  6900. "ffllig;": "ffl",
  6901. "ForAll;": "∀",
  6902. "forall;": "∀",
  6903. "frac12;": "½",
  6904. "frac13;": "⅓",
  6905. "frac14;": "¼",
  6906. "frac15;": "⅕",
  6907. "frac16;": "⅙",
  6908. "frac18;": "⅛",
  6909. "frac23;": "⅔",
  6910. "frac25;": "⅖",
  6911. "frac34;": "¾",
  6912. "frac35;": "⅗",
  6913. "frac38;": "⅜",
  6914. "frac45;": "⅘",
  6915. "frac56;": "⅚",
  6916. "frac58;": "⅝",
  6917. "frac78;": "⅞",
  6918. "gacute;": "ǵ",
  6919. "Gammad;": "Ϝ",
  6920. "gammad;": "ϝ",
  6921. "Gbreve;": "Ğ",
  6922. "gbreve;": "ğ",
  6923. "Gcedil;": "Ģ",
  6924. "gesdot;": "⪀",
  6925. "gesles;": "⪔",
  6926. "gtlPar;": "⦕",
  6927. "gtrarr;": "⥸",
  6928. "gtrdot;": "⋗",
  6929. "gtrsim;": "≳",
  6930. "hairsp;": " ",
  6931. "hamilt;": "ℋ",
  6932. "HARDcy;": "Ъ",
  6933. "hardcy;": "ъ",
  6934. "hearts;": "♥",
  6935. "hellip;": "…",
  6936. "hercon;": "⊹",
  6937. "homtht;": "∻",
  6938. "horbar;": "―",
  6939. "hslash;": "ℏ",
  6940. "Hstrok;": "Ħ",
  6941. "hstrok;": "ħ",
  6942. "hybull;": "⁃",
  6943. "hyphen;": "‐",
  6944. "Iacute;": "Í",
  6945. "iacute;": "í",
  6946. "Igrave;": "Ì",
  6947. "igrave;": "ì",
  6948. "iiiint;": "⨌",
  6949. "iinfin;": "⧜",
  6950. "incare;": "℅",
  6951. "inodot;": "ı",
  6952. "intcal;": "⊺",
  6953. "iquest;": "¿",
  6954. "isinsv;": "⋳",
  6955. "Itilde;": "Ĩ",
  6956. "itilde;": "ĩ",
  6957. "Jsercy;": "Ј",
  6958. "jsercy;": "ј",
  6959. "kappav;": "ϰ",
  6960. "Kcedil;": "Ķ",
  6961. "kcedil;": "ķ",
  6962. "kgreen;": "ĸ",
  6963. "Lacute;": "Ĺ",
  6964. "lacute;": "ĺ",
  6965. "lagran;": "ℒ",
  6966. "Lambda;": "Λ",
  6967. "lambda;": "λ",
  6968. "langle;": "⟨",
  6969. "larrfs;": "⤝",
  6970. "larrhk;": "↩",
  6971. "larrlp;": "↫",
  6972. "larrpl;": "⤹",
  6973. "larrtl;": "↢",
  6974. "lAtail;": "⤛",
  6975. "latail;": "⤙",
  6976. "lbrace;": "{",
  6977. "lbrack;": "[",
  6978. "Lcaron;": "Ľ",
  6979. "lcaron;": "ľ",
  6980. "Lcedil;": "Ļ",
  6981. "lcedil;": "ļ",
  6982. "ldquor;": "„",
  6983. "lesdot;": "⩿",
  6984. "lesges;": "⪓",
  6985. "lfisht;": "⥼",
  6986. "lfloor;": "⌊",
  6987. "lharul;": "⥪",
  6988. "llhard;": "⥫",
  6989. "Lmidot;": "Ŀ",
  6990. "lmidot;": "ŀ",
  6991. "lmoust;": "⎰",
  6992. "loplus;": "⨭",
  6993. "lowast;": "∗",
  6994. "lowbar;": "_",
  6995. "lparlt;": "⦓",
  6996. "lrhard;": "⥭",
  6997. "lsaquo;": "‹",
  6998. "lsquor;": "‚",
  6999. "Lstrok;": "Ł",
  7000. "lstrok;": "ł",
  7001. "lthree;": "⋋",
  7002. "ltimes;": "⋉",
  7003. "ltlarr;": "⥶",
  7004. "ltrPar;": "⦖",
  7005. "mapsto;": "↦",
  7006. "marker;": "▮",
  7007. "mcomma;": "⨩",
  7008. "midast;": "*",
  7009. "midcir;": "⫰",
  7010. "middot;": "·",
  7011. "minusb;": "⊟",
  7012. "minusd;": "∸",
  7013. "mnplus;": "∓",
  7014. "models;": "⊧",
  7015. "mstpos;": "∾",
  7016. "Nacute;": "Ń",
  7017. "nacute;": "ń",
  7018. "nbumpe;": "≏̸",
  7019. "Ncaron;": "Ň",
  7020. "ncaron;": "ň",
  7021. "Ncedil;": "Ņ",
  7022. "ncedil;": "ņ",
  7023. "nearhk;": "⤤",
  7024. "nequiv;": "≢",
  7025. "nesear;": "⤨",
  7026. "nexist;": "∄",
  7027. "nltrie;": "⋬",
  7028. "notinE;": "⋹̸",
  7029. "nparsl;": "⫽⃥",
  7030. "nprcue;": "⋠",
  7031. "nrarrc;": "⤳̸",
  7032. "nrarrw;": "↝̸",
  7033. "nrtrie;": "⋭",
  7034. "nsccue;": "⋡",
  7035. "nsimeq;": "≄",
  7036. "Ntilde;": "Ñ",
  7037. "ntilde;": "ñ",
  7038. "numero;": "№",
  7039. "nVDash;": "⊯",
  7040. "nVdash;": "⊮",
  7041. "nvDash;": "⊭",
  7042. "nvdash;": "⊬",
  7043. "nvHarr;": "⤄",
  7044. "nvlArr;": "⤂",
  7045. "nvrArr;": "⤃",
  7046. "nwarhk;": "⤣",
  7047. "nwnear;": "⤧",
  7048. "Oacute;": "Ó",
  7049. "oacute;": "ó",
  7050. "Odblac;": "Ő",
  7051. "odblac;": "ő",
  7052. "odsold;": "⦼",
  7053. "Ograve;": "Ò",
  7054. "ograve;": "ò",
  7055. "ominus;": "⊖",
  7056. "origof;": "⊶",
  7057. "Oslash;": "Ø",
  7058. "oslash;": "ø",
  7059. "Otilde;": "Õ",
  7060. "otilde;": "õ",
  7061. "Otimes;": "⨷",
  7062. "otimes;": "⊗",
  7063. "parsim;": "⫳",
  7064. "percnt;": "%",
  7065. "period;": ".",
  7066. "permil;": "‰",
  7067. "phmmat;": "ℳ",
  7068. "planck;": "ℏ",
  7069. "plankv;": "ℏ",
  7070. "plusdo;": "∔",
  7071. "plusdu;": "⨥",
  7072. "plusmn;": "±",
  7073. "preceq;": "⪯",
  7074. "primes;": "ℙ",
  7075. "prnsim;": "⋨",
  7076. "propto;": "∝",
  7077. "prurel;": "⊰",
  7078. "puncsp;": " ",
  7079. "qprime;": "⁗",
  7080. "Racute;": "Ŕ",
  7081. "racute;": "ŕ",
  7082. "rangle;": "⟩",
  7083. "rarrap;": "⥵",
  7084. "rarrfs;": "⤞",
  7085. "rarrhk;": "↪",
  7086. "rarrlp;": "↬",
  7087. "rarrpl;": "⥅",
  7088. "Rarrtl;": "⤖",
  7089. "rarrtl;": "↣",
  7090. "rAtail;": "⤜",
  7091. "ratail;": "⤚",
  7092. "rbrace;": "}",
  7093. "rbrack;": "]",
  7094. "Rcaron;": "Ř",
  7095. "rcaron;": "ř",
  7096. "Rcedil;": "Ŗ",
  7097. "rcedil;": "ŗ",
  7098. "rdquor;": "”",
  7099. "rfisht;": "⥽",
  7100. "rfloor;": "⌋",
  7101. "rharul;": "⥬",
  7102. "rmoust;": "⎱",
  7103. "roplus;": "⨮",
  7104. "rpargt;": "⦔",
  7105. "rsaquo;": "›",
  7106. "rsquor;": "’",
  7107. "rthree;": "⋌",
  7108. "rtimes;": "⋊",
  7109. "Sacute;": "Ś",
  7110. "sacute;": "ś",
  7111. "Scaron;": "Š",
  7112. "scaron;": "š",
  7113. "Scedil;": "Ş",
  7114. "scedil;": "ş",
  7115. "scnsim;": "⋩",
  7116. "searhk;": "⤥",
  7117. "seswar;": "⤩",
  7118. "sfrown;": "⌢",
  7119. "SHCHcy;": "Щ",
  7120. "shchcy;": "щ",
  7121. "sigmaf;": "ς",
  7122. "sigmav;": "ς",
  7123. "simdot;": "⩪",
  7124. "smashp;": "⨳",
  7125. "SOFTcy;": "Ь",
  7126. "softcy;": "ь",
  7127. "solbar;": "⌿",
  7128. "spades;": "♠",
  7129. "sqcaps;": "⊓︀",
  7130. "sqcups;": "⊔︀",
  7131. "sqsube;": "⊑",
  7132. "sqsupe;": "⊒",
  7133. "Square;": "□",
  7134. "square;": "□",
  7135. "squarf;": "▪",
  7136. "ssetmn;": "∖",
  7137. "ssmile;": "⌣",
  7138. "sstarf;": "⋆",
  7139. "subdot;": "⪽",
  7140. "Subset;": "⋐",
  7141. "subset;": "⊂",
  7142. "subsim;": "⫇",
  7143. "subsub;": "⫕",
  7144. "subsup;": "⫓",
  7145. "succeq;": "⪰",
  7146. "supdot;": "⪾",
  7147. "Supset;": "⋑",
  7148. "supset;": "⊃",
  7149. "supsim;": "⫈",
  7150. "supsub;": "⫔",
  7151. "supsup;": "⫖",
  7152. "swarhk;": "⤦",
  7153. "swnwar;": "⤪",
  7154. "target;": "⌖",
  7155. "Tcaron;": "Ť",
  7156. "tcaron;": "ť",
  7157. "Tcedil;": "Ţ",
  7158. "tcedil;": "ţ",
  7159. "telrec;": "⌕",
  7160. "there4;": "∴",
  7161. "thetav;": "ϑ",
  7162. "thinsp;": " ",
  7163. "thksim;": "∼",
  7164. "timesb;": "⊠",
  7165. "timesd;": "⨰",
  7166. "topbot;": "⌶",
  7167. "topcir;": "⫱",
  7168. "tprime;": "‴",
  7169. "tridot;": "◬",
  7170. "Tstrok;": "Ŧ",
  7171. "tstrok;": "ŧ",
  7172. "Uacute;": "Ú",
  7173. "uacute;": "ú",
  7174. "Ubreve;": "Ŭ",
  7175. "ubreve;": "ŭ",
  7176. "Udblac;": "Ű",
  7177. "udblac;": "ű",
  7178. "ufisht;": "⥾",
  7179. "Ugrave;": "Ù",
  7180. "ugrave;": "ù",
  7181. "ulcorn;": "⌜",
  7182. "ulcrop;": "⌏",
  7183. "urcorn;": "⌝",
  7184. "urcrop;": "⌎",
  7185. "Utilde;": "Ũ",
  7186. "utilde;": "ũ",
  7187. "vangrt;": "⦜",
  7188. "varphi;": "ϕ",
  7189. "varrho;": "ϱ",
  7190. "Vdashl;": "⫦",
  7191. "veebar;": "⊻",
  7192. "vellip;": "⋮",
  7193. "Verbar;": "‖",
  7194. "verbar;": "|",
  7195. "vsubnE;": "⫋︀",
  7196. "vsubne;": "⊊︀",
  7197. "vsupnE;": "⫌︀",
  7198. "vsupne;": "⊋︀",
  7199. "Vvdash;": "⊪",
  7200. "wedbar;": "⩟",
  7201. "wedgeq;": "≙",
  7202. "weierp;": "℘",
  7203. "wreath;": "≀",
  7204. "xoplus;": "⨁",
  7205. "xotime;": "⨂",
  7206. "xsqcup;": "⨆",
  7207. "xuplus;": "⨄",
  7208. "xwedge;": "⋀",
  7209. "Yacute;": "Ý",
  7210. "yacute;": "ý",
  7211. "Zacute;": "Ź",
  7212. "zacute;": "ź",
  7213. "Zcaron;": "Ž",
  7214. "zcaron;": "ž",
  7215. "zeetrf;": "ℨ",
  7216. "alefsym;": "ℵ",
  7217. "angrtvb;": "⊾",
  7218. "angzarr;": "⍼",
  7219. "asympeq;": "≍",
  7220. "backsim;": "∽",
  7221. "Because;": "∵",
  7222. "because;": "∵",
  7223. "bemptyv;": "⦰",
  7224. "between;": "≬",
  7225. "bigcirc;": "◯",
  7226. "bigodot;": "⨀",
  7227. "bigstar;": "★",
  7228. "bnequiv;": "≡⃥",
  7229. "boxplus;": "⊞",
  7230. "Cayleys;": "ℭ",
  7231. "Cconint;": "∰",
  7232. "ccupssm;": "⩐",
  7233. "Cedilla;": "¸",
  7234. "cemptyv;": "⦲",
  7235. "cirscir;": "⧂",
  7236. "coloneq;": "≔",
  7237. "congdot;": "⩭",
  7238. "cudarrl;": "⤸",
  7239. "cudarrr;": "⤵",
  7240. "cularrp;": "⤽",
  7241. "curarrm;": "⤼",
  7242. "dbkarow;": "⤏",
  7243. "ddagger;": "‡",
  7244. "ddotseq;": "⩷",
  7245. "demptyv;": "⦱",
  7246. "Diamond;": "⋄",
  7247. "diamond;": "⋄",
  7248. "digamma;": "ϝ",
  7249. "dotplus;": "∔",
  7250. "DownTee;": "⊤",
  7251. "dwangle;": "⦦",
  7252. "Element;": "∈",
  7253. "Epsilon;": "Ε",
  7254. "epsilon;": "ε",
  7255. "eqcolon;": "≕",
  7256. "equivDD;": "⩸",
  7257. "gesdoto;": "⪂",
  7258. "gtquest;": "⩼",
  7259. "gtrless;": "≷",
  7260. "harrcir;": "⥈",
  7261. "Implies;": "⇒",
  7262. "intprod;": "⨼",
  7263. "isindot;": "⋵",
  7264. "larrbfs;": "⤟",
  7265. "larrsim;": "⥳",
  7266. "lbrksld;": "⦏",
  7267. "lbrkslu;": "⦍",
  7268. "ldrdhar;": "⥧",
  7269. "LeftTee;": "⊣",
  7270. "lesdoto;": "⪁",
  7271. "lessdot;": "⋖",
  7272. "lessgtr;": "≶",
  7273. "lesssim;": "≲",
  7274. "lotimes;": "⨴",
  7275. "lozenge;": "◊",
  7276. "ltquest;": "⩻",
  7277. "luruhar;": "⥦",
  7278. "maltese;": "✠",
  7279. "minusdu;": "⨪",
  7280. "napprox;": "≉",
  7281. "natural;": "♮",
  7282. "nearrow;": "↗",
  7283. "NewLine;": "\n",
  7284. "nexists;": "∄",
  7285. "NoBreak;": "⁠",
  7286. "notinva;": "∉",
  7287. "notinvb;": "⋷",
  7288. "notinvc;": "⋶",
  7289. "NotLess;": "≮",
  7290. "notniva;": "∌",
  7291. "notnivb;": "⋾",
  7292. "notnivc;": "⋽",
  7293. "npolint;": "⨔",
  7294. "npreceq;": "⪯̸",
  7295. "nsqsube;": "⋢",
  7296. "nsqsupe;": "⋣",
  7297. "nsubset;": "⊂⃒",
  7298. "nsucceq;": "⪰̸",
  7299. "nsupset;": "⊃⃒",
  7300. "nvinfin;": "⧞",
  7301. "nvltrie;": "⊴⃒",
  7302. "nvrtrie;": "⊵⃒",
  7303. "nwarrow;": "↖",
  7304. "olcross;": "⦻",
  7305. "Omicron;": "Ο",
  7306. "omicron;": "ο",
  7307. "orderof;": "ℴ",
  7308. "orslope;": "⩗",
  7309. "OverBar;": "‾",
  7310. "pertenk;": "‱",
  7311. "planckh;": "ℎ",
  7312. "pluscir;": "⨢",
  7313. "plussim;": "⨦",
  7314. "plustwo;": "⨧",
  7315. "precsim;": "≾",
  7316. "Product;": "∏",
  7317. "quatint;": "⨖",
  7318. "questeq;": "≟",
  7319. "rarrbfs;": "⤠",
  7320. "rarrsim;": "⥴",
  7321. "rbrksld;": "⦎",
  7322. "rbrkslu;": "⦐",
  7323. "rdldhar;": "⥩",
  7324. "realine;": "ℛ",
  7325. "rotimes;": "⨵",
  7326. "ruluhar;": "⥨",
  7327. "searrow;": "↘",
  7328. "simplus;": "⨤",
  7329. "simrarr;": "⥲",
  7330. "subedot;": "⫃",
  7331. "submult;": "⫁",
  7332. "subplus;": "⪿",
  7333. "subrarr;": "⥹",
  7334. "succsim;": "≿",
  7335. "supdsub;": "⫘",
  7336. "supedot;": "⫄",
  7337. "suphsol;": "⟉",
  7338. "suphsub;": "⫗",
  7339. "suplarr;": "⥻",
  7340. "supmult;": "⫂",
  7341. "supplus;": "⫀",
  7342. "swarrow;": "↙",
  7343. "topfork;": "⫚",
  7344. "triplus;": "⨹",
  7345. "tritime;": "⨻",
  7346. "UpArrow;": "↑",
  7347. "Uparrow;": "⇑",
  7348. "uparrow;": "↑",
  7349. "Upsilon;": "Υ",
  7350. "upsilon;": "υ",
  7351. "uwangle;": "⦧",
  7352. "vzigzag;": "⦚",
  7353. "zigrarr;": "⇝",
  7354. "andslope;": "⩘",
  7355. "angmsdaa;": "⦨",
  7356. "angmsdab;": "⦩",
  7357. "angmsdac;": "⦪",
  7358. "angmsdad;": "⦫",
  7359. "angmsdae;": "⦬",
  7360. "angmsdaf;": "⦭",
  7361. "angmsdag;": "⦮",
  7362. "angmsdah;": "⦯",
  7363. "angrtvbd;": "⦝",
  7364. "approxeq;": "≊",
  7365. "awconint;": "∳",
  7366. "backcong;": "≌",
  7367. "barwedge;": "⌅",
  7368. "bbrktbrk;": "⎶",
  7369. "bigoplus;": "⨁",
  7370. "bigsqcup;": "⨆",
  7371. "biguplus;": "⨄",
  7372. "bigwedge;": "⋀",
  7373. "boxminus;": "⊟",
  7374. "boxtimes;": "⊠",
  7375. "bsolhsub;": "⟈",
  7376. "capbrcup;": "⩉",
  7377. "circledR;": "®",
  7378. "circledS;": "Ⓢ",
  7379. "cirfnint;": "⨐",
  7380. "clubsuit;": "♣",
  7381. "cupbrcap;": "⩈",
  7382. "curlyvee;": "⋎",
  7383. "cwconint;": "∲",
  7384. "DDotrahd;": "⤑",
  7385. "doteqdot;": "≑",
  7386. "DotEqual;": "≐",
  7387. "dotminus;": "∸",
  7388. "drbkarow;": "⤐",
  7389. "dzigrarr;": "⟿",
  7390. "elinters;": "⏧",
  7391. "emptyset;": "∅",
  7392. "eqvparsl;": "⧥",
  7393. "fpartint;": "⨍",
  7394. "geqslant;": "⩾",
  7395. "gesdotol;": "⪄",
  7396. "gnapprox;": "⪊",
  7397. "hksearow;": "⤥",
  7398. "hkswarow;": "⤦",
  7399. "imagline;": "ℐ",
  7400. "imagpart;": "ℑ",
  7401. "infintie;": "⧝",
  7402. "integers;": "ℤ",
  7403. "Integral;": "∫",
  7404. "intercal;": "⊺",
  7405. "intlarhk;": "⨗",
  7406. "laemptyv;": "⦴",
  7407. "ldrushar;": "⥋",
  7408. "leqslant;": "⩽",
  7409. "lesdotor;": "⪃",
  7410. "LessLess;": "⪡",
  7411. "llcorner;": "⌞",
  7412. "lnapprox;": "⪉",
  7413. "lrcorner;": "⌟",
  7414. "lurdshar;": "⥊",
  7415. "mapstoup;": "↥",
  7416. "multimap;": "⊸",
  7417. "naturals;": "ℕ",
  7418. "ncongdot;": "⩭̸",
  7419. "NotEqual;": "≠",
  7420. "notindot;": "⋵̸",
  7421. "NotTilde;": "≁",
  7422. "otimesas;": "⨶",
  7423. "parallel;": "∥",
  7424. "PartialD;": "∂",
  7425. "plusacir;": "⨣",
  7426. "pointint;": "⨕",
  7427. "Precedes;": "≺",
  7428. "precneqq;": "⪵",
  7429. "precnsim;": "⋨",
  7430. "profalar;": "⌮",
  7431. "profline;": "⌒",
  7432. "profsurf;": "⌓",
  7433. "raemptyv;": "⦳",
  7434. "realpart;": "ℜ",
  7435. "RightTee;": "⊢",
  7436. "rppolint;": "⨒",
  7437. "rtriltri;": "⧎",
  7438. "scpolint;": "⨓",
  7439. "setminus;": "∖",
  7440. "shortmid;": "∣",
  7441. "smeparsl;": "⧤",
  7442. "sqsubset;": "⊏",
  7443. "sqsupset;": "⊐",
  7444. "subseteq;": "⊆",
  7445. "Succeeds;": "≻",
  7446. "succneqq;": "⪶",
  7447. "succnsim;": "⋩",
  7448. "SuchThat;": "∋",
  7449. "Superset;": "⊃",
  7450. "supseteq;": "⊇",
  7451. "thetasym;": "ϑ",
  7452. "thicksim;": "∼",
  7453. "timesbar;": "⨱",
  7454. "triangle;": "▵",
  7455. "triminus;": "⨺",
  7456. "trpezium;": "⏢",
  7457. "Uarrocir;": "⥉",
  7458. "ulcorner;": "⌜",
  7459. "UnderBar;": "_",
  7460. "urcorner;": "⌝",
  7461. "varkappa;": "ϰ",
  7462. "varsigma;": "ς",
  7463. "vartheta;": "ϑ",
  7464. "backprime;": "‵",
  7465. "backsimeq;": "⋍",
  7466. "Backslash;": "∖",
  7467. "bigotimes;": "⨂",
  7468. "CenterDot;": "·",
  7469. "centerdot;": "·",
  7470. "checkmark;": "✓",
  7471. "CircleDot;": "⊙",
  7472. "complexes;": "ℂ",
  7473. "Congruent;": "≡",
  7474. "Coproduct;": "∐",
  7475. "dotsquare;": "⊡",
  7476. "DoubleDot;": "¨",
  7477. "DownArrow;": "↓",
  7478. "Downarrow;": "⇓",
  7479. "downarrow;": "↓",
  7480. "DownBreve;": "̑",
  7481. "gtrapprox;": "⪆",
  7482. "gtreqless;": "⋛",
  7483. "gvertneqq;": "≩︀",
  7484. "heartsuit;": "♥",
  7485. "HumpEqual;": "≏",
  7486. "LeftArrow;": "←",
  7487. "Leftarrow;": "⇐",
  7488. "leftarrow;": "←",
  7489. "LeftFloor;": "⌊",
  7490. "lesseqgtr;": "⋚",
  7491. "LessTilde;": "≲",
  7492. "lvertneqq;": "≨︀",
  7493. "Mellintrf;": "ℳ",
  7494. "MinusPlus;": "∓",
  7495. "ngeqslant;": "⩾̸",
  7496. "nleqslant;": "⩽̸",
  7497. "NotCupCap;": "≭",
  7498. "NotExists;": "∄",
  7499. "NotSubset;": "⊂⃒",
  7500. "nparallel;": "∦",
  7501. "nshortmid;": "∤",
  7502. "nsubseteq;": "⊈",
  7503. "nsupseteq;": "⊉",
  7504. "OverBrace;": "⏞",
  7505. "pitchfork;": "⋔",
  7506. "PlusMinus;": "±",
  7507. "rationals;": "ℚ",
  7508. "spadesuit;": "♠",
  7509. "subseteqq;": "⫅",
  7510. "subsetneq;": "⊊",
  7511. "supseteqq;": "⫆",
  7512. "supsetneq;": "⊋",
  7513. "Therefore;": "∴",
  7514. "therefore;": "∴",
  7515. "ThinSpace;": " ",
  7516. "triangleq;": "≜",
  7517. "TripleDot;": "⃛",
  7518. "UnionPlus;": "⊎",
  7519. "varpropto;": "∝",
  7520. "Bernoullis;": "ℬ",
  7521. "circledast;": "⊛",
  7522. "CirclePlus;": "⊕",
  7523. "complement;": "∁",
  7524. "curlywedge;": "⋏",
  7525. "eqslantgtr;": "⪖",
  7526. "EqualTilde;": "≂",
  7527. "Fouriertrf;": "ℱ",
  7528. "gtreqqless;": "⪌",
  7529. "ImaginaryI;": "ⅈ",
  7530. "Laplacetrf;": "ℒ",
  7531. "LeftVector;": "↼",
  7532. "lessapprox;": "⪅",
  7533. "lesseqqgtr;": "⪋",
  7534. "Lleftarrow;": "⇚",
  7535. "lmoustache;": "⎰",
  7536. "longmapsto;": "⟼",
  7537. "mapstodown;": "↧",
  7538. "mapstoleft;": "↤",
  7539. "nLeftarrow;": "⇍",
  7540. "nleftarrow;": "↚",
  7541. "NotElement;": "∉",
  7542. "NotGreater;": "≯",
  7543. "nsubseteqq;": "⫅̸",
  7544. "nsupseteqq;": "⫆̸",
  7545. "precapprox;": "⪷",
  7546. "Proportion;": "∷",
  7547. "RightArrow;": "→",
  7548. "Rightarrow;": "⇒",
  7549. "rightarrow;": "→",
  7550. "RightFloor;": "⌋",
  7551. "rmoustache;": "⎱",
  7552. "sqsubseteq;": "⊑",
  7553. "sqsupseteq;": "⊒",
  7554. "subsetneqq;": "⫋",
  7555. "succapprox;": "⪸",
  7556. "supsetneqq;": "⫌",
  7557. "ThickSpace;": "  ",
  7558. "TildeEqual;": "≃",
  7559. "TildeTilde;": "≈",
  7560. "UnderBrace;": "⏟",
  7561. "UpArrowBar;": "⤒",
  7562. "UpTeeArrow;": "↥",
  7563. "upuparrows;": "⇈",
  7564. "varepsilon;": "ϵ",
  7565. "varnothing;": "∅",
  7566. "backepsilon;": "϶",
  7567. "blacksquare;": "▪",
  7568. "circledcirc;": "⊚",
  7569. "circleddash;": "⊝",
  7570. "CircleMinus;": "⊖",
  7571. "CircleTimes;": "⊗",
  7572. "curlyeqprec;": "⋞",
  7573. "curlyeqsucc;": "⋟",
  7574. "diamondsuit;": "♦",
  7575. "eqslantless;": "⪕",
  7576. "Equilibrium;": "⇌",
  7577. "expectation;": "ℰ",
  7578. "GreaterLess;": "≷",
  7579. "LeftCeiling;": "⌈",
  7580. "LessGreater;": "≶",
  7581. "MediumSpace;": " ",
  7582. "NotLessLess;": "≪̸",
  7583. "NotPrecedes;": "⊀",
  7584. "NotSucceeds;": "⊁",
  7585. "NotSuperset;": "⊃⃒",
  7586. "nRightarrow;": "⇏",
  7587. "nrightarrow;": "↛",
  7588. "OverBracket;": "⎴",
  7589. "preccurlyeq;": "≼",
  7590. "precnapprox;": "⪹",
  7591. "quaternions;": "ℍ",
  7592. "RightVector;": "⇀",
  7593. "Rrightarrow;": "⇛",
  7594. "RuleDelayed;": "⧴",
  7595. "SmallCircle;": "∘",
  7596. "SquareUnion;": "⊔",
  7597. "straightphi;": "ϕ",
  7598. "SubsetEqual;": "⊆",
  7599. "succcurlyeq;": "≽",
  7600. "succnapprox;": "⪺",
  7601. "thickapprox;": "≈",
  7602. "UpDownArrow;": "↕",
  7603. "Updownarrow;": "⇕",
  7604. "updownarrow;": "↕",
  7605. "VerticalBar;": "∣",
  7606. "blacklozenge;": "⧫",
  7607. "DownArrowBar;": "⤓",
  7608. "DownTeeArrow;": "↧",
  7609. "ExponentialE;": "ⅇ",
  7610. "exponentiale;": "ⅇ",
  7611. "GreaterEqual;": "≥",
  7612. "GreaterTilde;": "≳",
  7613. "HilbertSpace;": "ℋ",
  7614. "HumpDownHump;": "≎",
  7615. "Intersection;": "⋂",
  7616. "LeftArrowBar;": "⇤",
  7617. "LeftTeeArrow;": "↤",
  7618. "LeftTriangle;": "⊲",
  7619. "LeftUpVector;": "↿",
  7620. "NotCongruent;": "≢",
  7621. "NotHumpEqual;": "≏̸",
  7622. "NotLessEqual;": "≰",
  7623. "NotLessTilde;": "≴",
  7624. "Proportional;": "∝",
  7625. "RightCeiling;": "⌉",
  7626. "risingdotseq;": "≓",
  7627. "RoundImplies;": "⥰",
  7628. "ShortUpArrow;": "↑",
  7629. "SquareSubset;": "⊏",
  7630. "triangledown;": "▿",
  7631. "triangleleft;": "◃",
  7632. "UnderBracket;": "⎵",
  7633. "varsubsetneq;": "⊊︀",
  7634. "varsupsetneq;": "⊋︀",
  7635. "VerticalLine;": "|",
  7636. "ApplyFunction;": "⁡",
  7637. "bigtriangleup;": "△",
  7638. "blacktriangle;": "▴",
  7639. "DifferentialD;": "ⅆ",
  7640. "divideontimes;": "⋇",
  7641. "DoubleLeftTee;": "⫤",
  7642. "DoubleUpArrow;": "⇑",
  7643. "fallingdotseq;": "≒",
  7644. "hookleftarrow;": "↩",
  7645. "leftarrowtail;": "↢",
  7646. "leftharpoonup;": "↼",
  7647. "LeftTeeVector;": "⥚",
  7648. "LeftVectorBar;": "⥒",
  7649. "LessFullEqual;": "≦",
  7650. "LongLeftArrow;": "⟵",
  7651. "Longleftarrow;": "⟸",
  7652. "longleftarrow;": "⟵",
  7653. "looparrowleft;": "↫",
  7654. "measuredangle;": "∡",
  7655. "NotEqualTilde;": "≂̸",
  7656. "NotTildeEqual;": "≄",
  7657. "NotTildeTilde;": "≉",
  7658. "ntriangleleft;": "⋪",
  7659. "Poincareplane;": "ℌ",
  7660. "PrecedesEqual;": "⪯",
  7661. "PrecedesTilde;": "≾",
  7662. "RightArrowBar;": "⇥",
  7663. "RightTeeArrow;": "↦",
  7664. "RightTriangle;": "⊳",
  7665. "RightUpVector;": "↾",
  7666. "shortparallel;": "∥",
  7667. "smallsetminus;": "∖",
  7668. "SucceedsEqual;": "⪰",
  7669. "SucceedsTilde;": "≿",
  7670. "SupersetEqual;": "⊇",
  7671. "triangleright;": "▹",
  7672. "UpEquilibrium;": "⥮",
  7673. "upharpoonleft;": "↿",
  7674. "varsubsetneqq;": "⫋︀",
  7675. "varsupsetneqq;": "⫌︀",
  7676. "VerticalTilde;": "≀",
  7677. "VeryThinSpace;": " ",
  7678. "curvearrowleft;": "↶",
  7679. "DiacriticalDot;": "˙",
  7680. "doublebarwedge;": "⌆",
  7681. "DoubleRightTee;": "⊨",
  7682. "downdownarrows;": "⇊",
  7683. "DownLeftVector;": "↽",
  7684. "GreaterGreater;": "⪢",
  7685. "hookrightarrow;": "↪",
  7686. "HorizontalLine;": "─",
  7687. "InvisibleComma;": "⁣",
  7688. "InvisibleTimes;": "⁢",
  7689. "LeftDownVector;": "⇃",
  7690. "leftleftarrows;": "⇇",
  7691. "LeftRightArrow;": "↔",
  7692. "Leftrightarrow;": "⇔",
  7693. "leftrightarrow;": "↔",
  7694. "leftthreetimes;": "⋋",
  7695. "LessSlantEqual;": "⩽",
  7696. "LongRightArrow;": "⟶",
  7697. "Longrightarrow;": "⟹",
  7698. "longrightarrow;": "⟶",
  7699. "looparrowright;": "↬",
  7700. "LowerLeftArrow;": "↙",
  7701. "NestedLessLess;": "≪",
  7702. "NotGreaterLess;": "≹",
  7703. "NotLessGreater;": "≸",
  7704. "NotSubsetEqual;": "⊈",
  7705. "NotVerticalBar;": "∤",
  7706. "nshortparallel;": "∦",
  7707. "ntriangleright;": "⋫",
  7708. "OpenCurlyQuote;": "‘",
  7709. "ReverseElement;": "∋",
  7710. "rightarrowtail;": "↣",
  7711. "rightharpoonup;": "⇀",
  7712. "RightTeeVector;": "⥛",
  7713. "RightVectorBar;": "⥓",
  7714. "ShortDownArrow;": "↓",
  7715. "ShortLeftArrow;": "←",
  7716. "SquareSuperset;": "⊐",
  7717. "TildeFullEqual;": "≅",
  7718. "trianglelefteq;": "⊴",
  7719. "upharpoonright;": "↾",
  7720. "UpperLeftArrow;": "↖",
  7721. "ZeroWidthSpace;": "​",
  7722. "bigtriangledown;": "▽",
  7723. "circlearrowleft;": "↺",
  7724. "CloseCurlyQuote;": "’",
  7725. "ContourIntegral;": "∮",
  7726. "curvearrowright;": "↷",
  7727. "DoubleDownArrow;": "⇓",
  7728. "DoubleLeftArrow;": "⇐",
  7729. "downharpoonleft;": "⇃",
  7730. "DownRightVector;": "⇁",
  7731. "leftharpoondown;": "↽",
  7732. "leftrightarrows;": "⇆",
  7733. "LeftRightVector;": "⥎",
  7734. "LeftTriangleBar;": "⧏",
  7735. "LeftUpTeeVector;": "⥠",
  7736. "LeftUpVectorBar;": "⥘",
  7737. "LowerRightArrow;": "↘",
  7738. "nLeftrightarrow;": "⇎",
  7739. "nleftrightarrow;": "↮",
  7740. "NotGreaterEqual;": "≱",
  7741. "NotGreaterTilde;": "≵",
  7742. "NotHumpDownHump;": "≎̸",
  7743. "NotLeftTriangle;": "⋪",
  7744. "NotSquareSubset;": "⊏̸",
  7745. "ntrianglelefteq;": "⋬",
  7746. "OverParenthesis;": "⏜",
  7747. "RightDownVector;": "⇂",
  7748. "rightleftarrows;": "⇄",
  7749. "rightsquigarrow;": "↝",
  7750. "rightthreetimes;": "⋌",
  7751. "ShortRightArrow;": "→",
  7752. "straightepsilon;": "ϵ",
  7753. "trianglerighteq;": "⊵",
  7754. "UpperRightArrow;": "↗",
  7755. "vartriangleleft;": "⊲",
  7756. "circlearrowright;": "↻",
  7757. "DiacriticalAcute;": "´",
  7758. "DiacriticalGrave;": "`",
  7759. "DiacriticalTilde;": "˜",
  7760. "DoubleRightArrow;": "⇒",
  7761. "DownArrowUpArrow;": "⇵",
  7762. "downharpoonright;": "⇂",
  7763. "EmptySmallSquare;": "◻",
  7764. "GreaterEqualLess;": "⋛",
  7765. "GreaterFullEqual;": "≧",
  7766. "LeftAngleBracket;": "⟨",
  7767. "LeftUpDownVector;": "⥑",
  7768. "LessEqualGreater;": "⋚",
  7769. "NonBreakingSpace;": " ",
  7770. "NotPrecedesEqual;": "⪯̸",
  7771. "NotRightTriangle;": "⋫",
  7772. "NotSucceedsEqual;": "⪰̸",
  7773. "NotSucceedsTilde;": "≿̸",
  7774. "NotSupersetEqual;": "⊉",
  7775. "ntrianglerighteq;": "⋭",
  7776. "rightharpoondown;": "⇁",
  7777. "rightrightarrows;": "⇉",
  7778. "RightTriangleBar;": "⧐",
  7779. "RightUpTeeVector;": "⥜",
  7780. "RightUpVectorBar;": "⥔",
  7781. "twoheadleftarrow;": "↞",
  7782. "UnderParenthesis;": "⏝",
  7783. "UpArrowDownArrow;": "⇅",
  7784. "vartriangleright;": "⊳",
  7785. "blacktriangledown;": "▾",
  7786. "blacktriangleleft;": "◂",
  7787. "DoubleUpDownArrow;": "⇕",
  7788. "DoubleVerticalBar;": "∥",
  7789. "DownLeftTeeVector;": "⥞",
  7790. "DownLeftVectorBar;": "⥖",
  7791. "FilledSmallSquare;": "◼",
  7792. "GreaterSlantEqual;": "⩾",
  7793. "LeftDoubleBracket;": "⟦",
  7794. "LeftDownTeeVector;": "⥡",
  7795. "LeftDownVectorBar;": "⥙",
  7796. "leftrightharpoons;": "⇋",
  7797. "LeftTriangleEqual;": "⊴",
  7798. "NegativeThinSpace;": "​",
  7799. "NotGreaterGreater;": "≫̸",
  7800. "NotLessSlantEqual;": "⩽̸",
  7801. "NotNestedLessLess;": "⪡̸",
  7802. "NotReverseElement;": "∌",
  7803. "NotSquareSuperset;": "⊐̸",
  7804. "NotTildeFullEqual;": "≇",
  7805. "RightAngleBracket;": "⟩",
  7806. "rightleftharpoons;": "⇌",
  7807. "RightUpDownVector;": "⥏",
  7808. "SquareSubsetEqual;": "⊑",
  7809. "twoheadrightarrow;": "↠",
  7810. "VerticalSeparator;": "❘",
  7811. "blacktriangleright;": "▸",
  7812. "DownRightTeeVector;": "⥟",
  7813. "DownRightVectorBar;": "⥗",
  7814. "LongLeftRightArrow;": "⟷",
  7815. "Longleftrightarrow;": "⟺",
  7816. "longleftrightarrow;": "⟷",
  7817. "NegativeThickSpace;": "​",
  7818. "NotLeftTriangleBar;": "⧏̸",
  7819. "PrecedesSlantEqual;": "≼",
  7820. "ReverseEquilibrium;": "⇋",
  7821. "RightDoubleBracket;": "⟧",
  7822. "RightDownTeeVector;": "⥝",
  7823. "RightDownVectorBar;": "⥕",
  7824. "RightTriangleEqual;": "⊵",
  7825. "SquareIntersection;": "⊓",
  7826. "SucceedsSlantEqual;": "≽",
  7827. "DoubleLongLeftArrow;": "⟸",
  7828. "DownLeftRightVector;": "⥐",
  7829. "LeftArrowRightArrow;": "⇆",
  7830. "leftrightsquigarrow;": "↭",
  7831. "NegativeMediumSpace;": "​",
  7832. "NotGreaterFullEqual;": "≧̸",
  7833. "NotRightTriangleBar;": "⧐̸",
  7834. "RightArrowLeftArrow;": "⇄",
  7835. "SquareSupersetEqual;": "⊒",
  7836. "CapitalDifferentialD;": "ⅅ",
  7837. "DoubleLeftRightArrow;": "⇔",
  7838. "DoubleLongRightArrow;": "⟹",
  7839. "EmptyVerySmallSquare;": "▫",
  7840. "NestedGreaterGreater;": "≫",
  7841. "NotDoubleVerticalBar;": "∦",
  7842. "NotGreaterSlantEqual;": "⩾̸",
  7843. "NotLeftTriangleEqual;": "⋬",
  7844. "NotSquareSubsetEqual;": "⋢",
  7845. "OpenCurlyDoubleQuote;": "“",
  7846. "ReverseUpEquilibrium;": "⥯",
  7847. "CloseCurlyDoubleQuote;": "”",
  7848. "DoubleContourIntegral;": "∯",
  7849. "FilledVerySmallSquare;": "▪",
  7850. "NegativeVeryThinSpace;": "​",
  7851. "NotPrecedesSlantEqual;": "⋠",
  7852. "NotRightTriangleEqual;": "⋭",
  7853. "NotSucceedsSlantEqual;": "⋡",
  7854. "DiacriticalDoubleAcute;": "˝",
  7855. "NotSquareSupersetEqual;": "⋣",
  7856. "NotNestedGreaterGreater;": "⪢̸",
  7857. "ClockwiseContourIntegral;": "∲",
  7858. "DoubleLongLeftRightArrow;": "⟺",
  7859. "CounterClockwiseContourIntegral;": "∳"
  7860. };
  7861. // lazy compute this to make this file tree-shakable for browser
  7862. let maxCRNameLength;
  7863. const decodeHtml = (rawText, asAttr) => {
  7864. let offset = 0;
  7865. const end = rawText.length;
  7866. let decodedText = '';
  7867. function advance(length) {
  7868. offset += length;
  7869. rawText = rawText.slice(length);
  7870. }
  7871. while (offset < end) {
  7872. const head = /&(?:#x?)?/i.exec(rawText);
  7873. if (!head || offset + head.index >= end) {
  7874. const remaining = end - offset;
  7875. decodedText += rawText.slice(0, remaining);
  7876. advance(remaining);
  7877. break;
  7878. }
  7879. // Advance to the "&".
  7880. decodedText += rawText.slice(0, head.index);
  7881. advance(head.index);
  7882. if (head[0] === '&') {
  7883. // Named character reference.
  7884. let name = '';
  7885. let value = undefined;
  7886. if (/[0-9a-z]/i.test(rawText[1])) {
  7887. if (!maxCRNameLength) {
  7888. maxCRNameLength = Object.keys(namedCharacterReferences).reduce((max, name) => Math.max(max, name.length), 0);
  7889. }
  7890. for (let length = maxCRNameLength; !value && length > 0; --length) {
  7891. name = rawText.slice(1, 1 + length);
  7892. value = namedCharacterReferences[name];
  7893. }
  7894. if (value) {
  7895. const semi = name.endsWith(';');
  7896. if (asAttr &&
  7897. !semi &&
  7898. /[=a-z0-9]/i.test(rawText[name.length + 1] || '')) {
  7899. decodedText += '&' + name;
  7900. advance(1 + name.length);
  7901. }
  7902. else {
  7903. decodedText += value;
  7904. advance(1 + name.length);
  7905. }
  7906. }
  7907. else {
  7908. decodedText += '&' + name;
  7909. advance(1 + name.length);
  7910. }
  7911. }
  7912. else {
  7913. decodedText += '&';
  7914. advance(1);
  7915. }
  7916. }
  7917. else {
  7918. // Numeric character reference.
  7919. const hex = head[0] === '&#x';
  7920. const pattern = hex ? /^&#x([0-9a-f]+);?/i : /^&#([0-9]+);?/;
  7921. const body = pattern.exec(rawText);
  7922. if (!body) {
  7923. decodedText += head[0];
  7924. advance(head[0].length);
  7925. }
  7926. else {
  7927. // https://html.spec.whatwg.org/multipage/parsing.html#numeric-character-reference-end-state
  7928. let cp = Number.parseInt(body[1], hex ? 16 : 10);
  7929. if (cp === 0) {
  7930. cp = 0xfffd;
  7931. }
  7932. else if (cp > 0x10ffff) {
  7933. cp = 0xfffd;
  7934. }
  7935. else if (cp >= 0xd800 && cp <= 0xdfff) {
  7936. cp = 0xfffd;
  7937. }
  7938. else if ((cp >= 0xfdd0 && cp <= 0xfdef) || (cp & 0xfffe) === 0xfffe) ;
  7939. else if ((cp >= 0x01 && cp <= 0x08) ||
  7940. cp === 0x0b ||
  7941. (cp >= 0x0d && cp <= 0x1f) ||
  7942. (cp >= 0x7f && cp <= 0x9f)) {
  7943. cp = CCR_REPLACEMENTS[cp] || cp;
  7944. }
  7945. decodedText += String.fromCodePoint(cp);
  7946. advance(body[0].length);
  7947. }
  7948. }
  7949. }
  7950. return decodedText;
  7951. };
  7952. // https://html.spec.whatwg.org/multipage/parsing.html#numeric-character-reference-end-state
  7953. const CCR_REPLACEMENTS = {
  7954. 0x80: 0x20ac,
  7955. 0x82: 0x201a,
  7956. 0x83: 0x0192,
  7957. 0x84: 0x201e,
  7958. 0x85: 0x2026,
  7959. 0x86: 0x2020,
  7960. 0x87: 0x2021,
  7961. 0x88: 0x02c6,
  7962. 0x89: 0x2030,
  7963. 0x8a: 0x0160,
  7964. 0x8b: 0x2039,
  7965. 0x8c: 0x0152,
  7966. 0x8e: 0x017d,
  7967. 0x91: 0x2018,
  7968. 0x92: 0x2019,
  7969. 0x93: 0x201c,
  7970. 0x94: 0x201d,
  7971. 0x95: 0x2022,
  7972. 0x96: 0x2013,
  7973. 0x97: 0x2014,
  7974. 0x98: 0x02dc,
  7975. 0x99: 0x2122,
  7976. 0x9a: 0x0161,
  7977. 0x9b: 0x203a,
  7978. 0x9c: 0x0153,
  7979. 0x9e: 0x017e,
  7980. 0x9f: 0x0178
  7981. };
  7982. const isRawTextContainer = /*#__PURE__*/ shared.makeMap('style,iframe,script,noscript', true);
  7983. const parserOptions = {
  7984. isVoidTag: shared.isVoidTag,
  7985. isNativeTag: tag => shared.isHTMLTag(tag) || shared.isSVGTag(tag),
  7986. isPreTag: tag => tag === 'pre',
  7987. decodeEntities: decodeHtml,
  7988. isBuiltInComponent: (tag) => {
  7989. if (compilerCore.isBuiltInType(tag, `Transition`)) {
  7990. return TRANSITION;
  7991. }
  7992. else if (compilerCore.isBuiltInType(tag, `TransitionGroup`)) {
  7993. return TRANSITION_GROUP;
  7994. }
  7995. },
  7996. // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
  7997. getNamespace(tag, parent) {
  7998. let ns = parent ? parent.ns : 0 /* HTML */;
  7999. if (parent && ns === 2 /* MATH_ML */) {
  8000. if (parent.tag === 'annotation-xml') {
  8001. if (tag === 'svg') {
  8002. return 1 /* SVG */;
  8003. }
  8004. if (parent.props.some(a => a.type === 6 /* ATTRIBUTE */ &&
  8005. a.name === 'encoding' &&
  8006. a.value != null &&
  8007. (a.value.content === 'text/html' ||
  8008. a.value.content === 'application/xhtml+xml'))) {
  8009. ns = 0 /* HTML */;
  8010. }
  8011. }
  8012. else if (/^m(?:[ions]|text)$/.test(parent.tag) &&
  8013. tag !== 'mglyph' &&
  8014. tag !== 'malignmark') {
  8015. ns = 0 /* HTML */;
  8016. }
  8017. }
  8018. else if (parent && ns === 1 /* SVG */) {
  8019. if (parent.tag === 'foreignObject' ||
  8020. parent.tag === 'desc' ||
  8021. parent.tag === 'title') {
  8022. ns = 0 /* HTML */;
  8023. }
  8024. }
  8025. if (ns === 0 /* HTML */) {
  8026. if (tag === 'svg') {
  8027. return 1 /* SVG */;
  8028. }
  8029. if (tag === 'math') {
  8030. return 2 /* MATH_ML */;
  8031. }
  8032. }
  8033. return ns;
  8034. },
  8035. // https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
  8036. getTextMode({ tag, ns }) {
  8037. if (ns === 0 /* HTML */) {
  8038. if (tag === 'textarea' || tag === 'title') {
  8039. return 1 /* RCDATA */;
  8040. }
  8041. if (isRawTextContainer(tag)) {
  8042. return 2 /* RAWTEXT */;
  8043. }
  8044. }
  8045. return 0 /* DATA */;
  8046. }
  8047. };
  8048. // Parse inline CSS strings for static style attributes into an object.
  8049. // This is a NodeTransform since it works on the static `style` attribute and
  8050. // converts it into a dynamic equivalent:
  8051. // style="color: red" -> :style='{ "color": "red" }'
  8052. // It is then processed by `transformElement` and included in the generated
  8053. // props.
  8054. const transformStyle = node => {
  8055. if (node.type === 1 /* ELEMENT */) {
  8056. node.props.forEach((p, i) => {
  8057. if (p.type === 6 /* ATTRIBUTE */ && p.name === 'style' && p.value) {
  8058. // replace p with an expression node
  8059. node.props[i] = {
  8060. type: 7 /* DIRECTIVE */,
  8061. name: `bind`,
  8062. arg: compilerCore.createSimpleExpression(`style`, true, p.loc),
  8063. exp: parseInlineCSS(p.value.content, p.loc),
  8064. modifiers: [],
  8065. loc: p.loc
  8066. };
  8067. }
  8068. });
  8069. }
  8070. };
  8071. const parseInlineCSS = (cssText, loc) => {
  8072. const normalized = shared.parseStringStyle(cssText);
  8073. return compilerCore.createSimpleExpression(JSON.stringify(normalized), false, loc, 3 /* CAN_STRINGIFY */);
  8074. };
  8075. function createDOMCompilerError(code, loc) {
  8076. return compilerCore.createCompilerError(code, loc, DOMErrorMessages );
  8077. }
  8078. const DOMErrorMessages = {
  8079. [50 /* X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
  8080. [51 /* X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
  8081. [52 /* X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
  8082. [53 /* X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
  8083. [54 /* X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
  8084. [55 /* X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
  8085. [56 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
  8086. [57 /* X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
  8087. [58 /* X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
  8088. [59 /* X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
  8089. [60 /* X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
  8090. };
  8091. const transformVHtml = (dir, node, context) => {
  8092. const { exp, loc } = dir;
  8093. if (!exp) {
  8094. context.onError(createDOMCompilerError(50 /* X_V_HTML_NO_EXPRESSION */, loc));
  8095. }
  8096. if (node.children.length) {
  8097. context.onError(createDOMCompilerError(51 /* X_V_HTML_WITH_CHILDREN */, loc));
  8098. node.children.length = 0;
  8099. }
  8100. return {
  8101. props: [
  8102. compilerCore.createObjectProperty(compilerCore.createSimpleExpression(`innerHTML`, true, loc), exp || compilerCore.createSimpleExpression('', true))
  8103. ]
  8104. };
  8105. };
  8106. const transformVText = (dir, node, context) => {
  8107. const { exp, loc } = dir;
  8108. if (!exp) {
  8109. context.onError(createDOMCompilerError(52 /* X_V_TEXT_NO_EXPRESSION */, loc));
  8110. }
  8111. if (node.children.length) {
  8112. context.onError(createDOMCompilerError(53 /* X_V_TEXT_WITH_CHILDREN */, loc));
  8113. node.children.length = 0;
  8114. }
  8115. return {
  8116. props: [
  8117. compilerCore.createObjectProperty(compilerCore.createSimpleExpression(`textContent`, true), exp
  8118. ? compilerCore.createCallExpression(context.helperString(compilerCore.TO_DISPLAY_STRING), [exp], loc)
  8119. : compilerCore.createSimpleExpression('', true))
  8120. ]
  8121. };
  8122. };
  8123. const transformModel = (dir, node, context) => {
  8124. const baseResult = compilerCore.transformModel(dir, node, context);
  8125. // base transform has errors OR component v-model (only need props)
  8126. if (!baseResult.props.length || node.tagType === 1 /* COMPONENT */) {
  8127. return baseResult;
  8128. }
  8129. if (dir.arg) {
  8130. context.onError(createDOMCompilerError(55 /* X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
  8131. }
  8132. function checkDuplicatedValue() {
  8133. const value = compilerCore.findProp(node, 'value');
  8134. if (value) {
  8135. context.onError(createDOMCompilerError(57 /* X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
  8136. }
  8137. }
  8138. const { tag } = node;
  8139. const isCustomElement = context.isCustomElement(tag);
  8140. if (tag === 'input' ||
  8141. tag === 'textarea' ||
  8142. tag === 'select' ||
  8143. isCustomElement) {
  8144. let directiveToUse = V_MODEL_TEXT;
  8145. let isInvalidType = false;
  8146. if (tag === 'input' || isCustomElement) {
  8147. const type = compilerCore.findProp(node, `type`);
  8148. if (type) {
  8149. if (type.type === 7 /* DIRECTIVE */) {
  8150. // :type="foo"
  8151. directiveToUse = V_MODEL_DYNAMIC;
  8152. }
  8153. else if (type.value) {
  8154. switch (type.value.content) {
  8155. case 'radio':
  8156. directiveToUse = V_MODEL_RADIO;
  8157. break;
  8158. case 'checkbox':
  8159. directiveToUse = V_MODEL_CHECKBOX;
  8160. break;
  8161. case 'file':
  8162. isInvalidType = true;
  8163. context.onError(createDOMCompilerError(56 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
  8164. break;
  8165. default:
  8166. // text type
  8167. checkDuplicatedValue();
  8168. break;
  8169. }
  8170. }
  8171. }
  8172. else if (compilerCore.hasDynamicKeyVBind(node)) {
  8173. // element has bindings with dynamic keys, which can possibly contain
  8174. // "type".
  8175. directiveToUse = V_MODEL_DYNAMIC;
  8176. }
  8177. else {
  8178. // text type
  8179. checkDuplicatedValue();
  8180. }
  8181. }
  8182. else if (tag === 'select') {
  8183. directiveToUse = V_MODEL_SELECT;
  8184. }
  8185. else {
  8186. // textarea
  8187. checkDuplicatedValue();
  8188. }
  8189. // inject runtime directive
  8190. // by returning the helper symbol via needRuntime
  8191. // the import will replaced a resolveDirective call.
  8192. if (!isInvalidType) {
  8193. baseResult.needRuntime = context.helper(directiveToUse);
  8194. }
  8195. }
  8196. else {
  8197. context.onError(createDOMCompilerError(54 /* X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
  8198. }
  8199. // native vmodel doesn't need the `modelValue` props since they are also
  8200. // passed to the runtime as `binding.value`. removing it reduces code size.
  8201. baseResult.props = baseResult.props.filter(p => !(p.key.type === 4 /* SIMPLE_EXPRESSION */ &&
  8202. p.key.content === 'modelValue'));
  8203. return baseResult;
  8204. };
  8205. const isEventOptionModifier = /*#__PURE__*/ shared.makeMap(`passive,once,capture`);
  8206. const isNonKeyModifier = /*#__PURE__*/ shared.makeMap(
  8207. // event propagation management
  8208. `stop,prevent,self,` +
  8209. // system modifiers + exact
  8210. `ctrl,shift,alt,meta,exact,` +
  8211. // mouse
  8212. `middle`);
  8213. // left & right could be mouse or key modifiers based on event type
  8214. const maybeKeyModifier = /*#__PURE__*/ shared.makeMap('left,right');
  8215. const isKeyboardEvent = /*#__PURE__*/ shared.makeMap(`onkeyup,onkeydown,onkeypress`, true);
  8216. const resolveModifiers = (key, modifiers, context, loc) => {
  8217. const keyModifiers = [];
  8218. const nonKeyModifiers = [];
  8219. const eventOptionModifiers = [];
  8220. for (let i = 0; i < modifiers.length; i++) {
  8221. const modifier = modifiers[i];
  8222. if (modifier === 'native' &&
  8223. compilerCore.checkCompatEnabled("COMPILER_V_ON_NATIVE" /* COMPILER_V_ON_NATIVE */, context, loc)) {
  8224. eventOptionModifiers.push(modifier);
  8225. }
  8226. else if (isEventOptionModifier(modifier)) {
  8227. // eventOptionModifiers: modifiers for addEventListener() options,
  8228. // e.g. .passive & .capture
  8229. eventOptionModifiers.push(modifier);
  8230. }
  8231. else {
  8232. // runtimeModifiers: modifiers that needs runtime guards
  8233. if (maybeKeyModifier(modifier)) {
  8234. if (compilerCore.isStaticExp(key)) {
  8235. if (isKeyboardEvent(key.content)) {
  8236. keyModifiers.push(modifier);
  8237. }
  8238. else {
  8239. nonKeyModifiers.push(modifier);
  8240. }
  8241. }
  8242. else {
  8243. keyModifiers.push(modifier);
  8244. nonKeyModifiers.push(modifier);
  8245. }
  8246. }
  8247. else {
  8248. if (isNonKeyModifier(modifier)) {
  8249. nonKeyModifiers.push(modifier);
  8250. }
  8251. else {
  8252. keyModifiers.push(modifier);
  8253. }
  8254. }
  8255. }
  8256. }
  8257. return {
  8258. keyModifiers,
  8259. nonKeyModifiers,
  8260. eventOptionModifiers
  8261. };
  8262. };
  8263. const transformClick = (key, event) => {
  8264. const isStaticClick = compilerCore.isStaticExp(key) && key.content.toLowerCase() === 'onclick';
  8265. return isStaticClick
  8266. ? compilerCore.createSimpleExpression(event, true)
  8267. : key.type !== 4 /* SIMPLE_EXPRESSION */
  8268. ? compilerCore.createCompoundExpression([
  8269. `(`,
  8270. key,
  8271. `) === "onClick" ? "${event}" : (`,
  8272. key,
  8273. `)`
  8274. ])
  8275. : key;
  8276. };
  8277. const transformOn = (dir, node, context) => {
  8278. return compilerCore.transformOn(dir, node, context, baseResult => {
  8279. const { modifiers } = dir;
  8280. if (!modifiers.length)
  8281. return baseResult;
  8282. let { key, value: handlerExp } = baseResult.props[0];
  8283. const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
  8284. // normalize click.right and click.middle since they don't actually fire
  8285. if (nonKeyModifiers.includes('right')) {
  8286. key = transformClick(key, `onContextmenu`);
  8287. }
  8288. if (nonKeyModifiers.includes('middle')) {
  8289. key = transformClick(key, `onMouseup`);
  8290. }
  8291. if (nonKeyModifiers.length) {
  8292. handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
  8293. handlerExp,
  8294. JSON.stringify(nonKeyModifiers)
  8295. ]);
  8296. }
  8297. if (keyModifiers.length &&
  8298. // if event name is dynamic, always wrap with keys guard
  8299. (!compilerCore.isStaticExp(key) || isKeyboardEvent(key.content))) {
  8300. handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_KEYS), [
  8301. handlerExp,
  8302. JSON.stringify(keyModifiers)
  8303. ]);
  8304. }
  8305. if (eventOptionModifiers.length) {
  8306. const modifierPostfix = eventOptionModifiers.map(shared.capitalize).join('');
  8307. key = compilerCore.isStaticExp(key)
  8308. ? compilerCore.createSimpleExpression(`${key.content}${modifierPostfix}`, true)
  8309. : compilerCore.createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
  8310. }
  8311. return {
  8312. props: [compilerCore.createObjectProperty(key, handlerExp)]
  8313. };
  8314. });
  8315. };
  8316. const transformShow = (dir, node, context) => {
  8317. const { exp, loc } = dir;
  8318. if (!exp) {
  8319. context.onError(createDOMCompilerError(58 /* X_V_SHOW_NO_EXPRESSION */, loc));
  8320. }
  8321. return {
  8322. props: [],
  8323. needRuntime: context.helper(V_SHOW)
  8324. };
  8325. };
  8326. const warnTransitionChildren = (node, context) => {
  8327. if (node.type === 1 /* ELEMENT */ &&
  8328. node.tagType === 1 /* COMPONENT */) {
  8329. const component = context.isBuiltInComponent(node.tag);
  8330. if (component === TRANSITION) {
  8331. return () => {
  8332. if (node.children.length && hasMultipleChildren(node)) {
  8333. context.onError(createDOMCompilerError(59 /* X_TRANSITION_INVALID_CHILDREN */, {
  8334. start: node.children[0].loc.start,
  8335. end: node.children[node.children.length - 1].loc.end,
  8336. source: ''
  8337. }));
  8338. }
  8339. };
  8340. }
  8341. }
  8342. };
  8343. function hasMultipleChildren(node) {
  8344. // #1352 filter out potential comment nodes.
  8345. const children = (node.children = node.children.filter(c => c.type !== 3 /* COMMENT */ &&
  8346. !(c.type === 2 /* TEXT */ && !c.content.trim())));
  8347. const child = children[0];
  8348. return (children.length !== 1 ||
  8349. child.type === 11 /* FOR */ ||
  8350. (child.type === 9 /* IF */ && child.branches.some(hasMultipleChildren)));
  8351. }
  8352. /**
  8353. * This module is Node-only.
  8354. */
  8355. /**
  8356. * Regex for replacing placeholders for embedded constant variables
  8357. * (e.g. import URL string constants generated by compiler-sfc)
  8358. */
  8359. const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
  8360. /**
  8361. * Turn eligible hoisted static trees into stringified static nodes, e.g.
  8362. *
  8363. * ```js
  8364. * const _hoisted_1 = createStaticVNode(`<div class="foo">bar</div>`)
  8365. * ```
  8366. *
  8367. * A single static vnode can contain stringified content for **multiple**
  8368. * consecutive nodes (element and plain text), called a "chunk".
  8369. * `@vue/runtime-dom` will create the content via innerHTML in a hidden
  8370. * container element and insert all the nodes in place. The call must also
  8371. * provide the number of nodes contained in the chunk so that during hydration
  8372. * we can know how many nodes the static vnode should adopt.
  8373. *
  8374. * The optimization scans a children list that contains hoisted nodes, and
  8375. * tries to find the largest chunk of consecutive hoisted nodes before running
  8376. * into a non-hoisted node or the end of the list. A chunk is then converted
  8377. * into a single static vnode and replaces the hoisted expression of the first
  8378. * node in the chunk. Other nodes in the chunk are considered "merged" and
  8379. * therefore removed from both the hoist list and the children array.
  8380. *
  8381. * This optimization is only performed in Node.js.
  8382. */
  8383. const stringifyStatic = (children, context, parent) => {
  8384. // bail stringification for slot content
  8385. if (context.scopes.vSlot > 0) {
  8386. return;
  8387. }
  8388. let nc = 0; // current node count
  8389. let ec = 0; // current element with binding count
  8390. const currentChunk = [];
  8391. const stringifyCurrentChunk = (currentIndex) => {
  8392. if (nc >= 20 /* NODE_COUNT */ ||
  8393. ec >= 5 /* ELEMENT_WITH_BINDING_COUNT */) {
  8394. // combine all currently eligible nodes into a single static vnode call
  8395. const staticCall = compilerCore.createCallExpression(context.helper(compilerCore.CREATE_STATIC), [
  8396. JSON.stringify(currentChunk.map(node => stringifyNode(node, context)).join('')).replace(expReplaceRE, `" + $1 + "`),
  8397. // the 2nd argument indicates the number of DOM nodes this static vnode
  8398. // will insert / hydrate
  8399. String(currentChunk.length)
  8400. ]);
  8401. // replace the first node's hoisted expression with the static vnode call
  8402. replaceHoist(currentChunk[0], staticCall, context);
  8403. if (currentChunk.length > 1) {
  8404. for (let i = 1; i < currentChunk.length; i++) {
  8405. // for the merged nodes, set their hoisted expression to null
  8406. replaceHoist(currentChunk[i], null, context);
  8407. }
  8408. // also remove merged nodes from children
  8409. const deleteCount = currentChunk.length - 1;
  8410. children.splice(currentIndex - currentChunk.length + 1, deleteCount);
  8411. return deleteCount;
  8412. }
  8413. }
  8414. return 0;
  8415. };
  8416. let i = 0;
  8417. for (; i < children.length; i++) {
  8418. const child = children[i];
  8419. const hoisted = getHoistedNode(child);
  8420. if (hoisted) {
  8421. // presence of hoisted means child must be a stringifiable node
  8422. const node = child;
  8423. const result = analyzeNode(node);
  8424. if (result) {
  8425. // node is stringifiable, record state
  8426. nc += result[0];
  8427. ec += result[1];
  8428. currentChunk.push(node);
  8429. continue;
  8430. }
  8431. }
  8432. // we only reach here if we ran into a node that is not stringifiable
  8433. // check if currently analyzed nodes meet criteria for stringification.
  8434. // adjust iteration index
  8435. i -= stringifyCurrentChunk(i);
  8436. // reset state
  8437. nc = 0;
  8438. ec = 0;
  8439. currentChunk.length = 0;
  8440. }
  8441. // in case the last node was also stringifiable
  8442. stringifyCurrentChunk(i);
  8443. };
  8444. const getHoistedNode = (node) => ((node.type === 1 /* ELEMENT */ && node.tagType === 0 /* ELEMENT */) ||
  8445. node.type == 12 /* TEXT_CALL */) &&
  8446. node.codegenNode &&
  8447. node.codegenNode.type === 4 /* SIMPLE_EXPRESSION */ &&
  8448. node.codegenNode.hoisted;
  8449. const dataAriaRE = /^(data|aria)-/;
  8450. const isStringifiableAttr = (name, ns) => {
  8451. return ((ns === 0 /* HTML */
  8452. ? shared.isKnownHtmlAttr(name)
  8453. : ns === 1 /* SVG */
  8454. ? shared.isKnownSvgAttr(name)
  8455. : false) || dataAriaRE.test(name));
  8456. };
  8457. const replaceHoist = (node, replacement, context) => {
  8458. const hoistToReplace = node.codegenNode.hoisted;
  8459. context.hoists[context.hoists.indexOf(hoistToReplace)] = replacement;
  8460. };
  8461. const isNonStringifiable = /*#__PURE__*/ shared.makeMap(`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`);
  8462. /**
  8463. * for a hoisted node, analyze it and return:
  8464. * - false: bailed (contains non-stringifiable props or runtime constant)
  8465. * - [nc, ec] where
  8466. * - nc is the number of nodes inside
  8467. * - ec is the number of element with bindings inside
  8468. */
  8469. function analyzeNode(node) {
  8470. if (node.type === 1 /* ELEMENT */ && isNonStringifiable(node.tag)) {
  8471. return false;
  8472. }
  8473. if (node.type === 12 /* TEXT_CALL */) {
  8474. return [1, 0];
  8475. }
  8476. let nc = 1; // node count
  8477. let ec = node.props.length > 0 ? 1 : 0; // element w/ binding count
  8478. let bailed = false;
  8479. const bail = () => {
  8480. bailed = true;
  8481. return false;
  8482. };
  8483. // TODO: check for cases where using innerHTML will result in different
  8484. // output compared to imperative node insertions.
  8485. // probably only need to check for most common case
  8486. // i.e. non-phrasing-content tags inside `<p>`
  8487. function walk(node) {
  8488. for (let i = 0; i < node.props.length; i++) {
  8489. const p = node.props[i];
  8490. // bail on non-attr bindings
  8491. if (p.type === 6 /* ATTRIBUTE */ &&
  8492. !isStringifiableAttr(p.name, node.ns)) {
  8493. return bail();
  8494. }
  8495. if (p.type === 7 /* DIRECTIVE */ && p.name === 'bind') {
  8496. // bail on non-attr bindings
  8497. if (p.arg &&
  8498. (p.arg.type === 8 /* COMPOUND_EXPRESSION */ ||
  8499. (p.arg.isStatic && !isStringifiableAttr(p.arg.content, node.ns)))) {
  8500. return bail();
  8501. }
  8502. if (p.exp &&
  8503. (p.exp.type === 8 /* COMPOUND_EXPRESSION */ ||
  8504. p.exp.constType < 3 /* CAN_STRINGIFY */)) {
  8505. return bail();
  8506. }
  8507. }
  8508. }
  8509. for (let i = 0; i < node.children.length; i++) {
  8510. nc++;
  8511. const child = node.children[i];
  8512. if (child.type === 1 /* ELEMENT */) {
  8513. if (child.props.length > 0) {
  8514. ec++;
  8515. }
  8516. walk(child);
  8517. if (bailed) {
  8518. return false;
  8519. }
  8520. }
  8521. }
  8522. return true;
  8523. }
  8524. return walk(node) ? [nc, ec] : false;
  8525. }
  8526. function stringifyNode(node, context) {
  8527. if (shared.isString(node)) {
  8528. return node;
  8529. }
  8530. if (shared.isSymbol(node)) {
  8531. return ``;
  8532. }
  8533. switch (node.type) {
  8534. case 1 /* ELEMENT */:
  8535. return stringifyElement(node, context);
  8536. case 2 /* TEXT */:
  8537. return shared.escapeHtml(node.content);
  8538. case 3 /* COMMENT */:
  8539. return `<!--${shared.escapeHtml(node.content)}-->`;
  8540. case 5 /* INTERPOLATION */:
  8541. return shared.escapeHtml(shared.toDisplayString(evaluateConstant(node.content)));
  8542. case 8 /* COMPOUND_EXPRESSION */:
  8543. return shared.escapeHtml(evaluateConstant(node));
  8544. case 12 /* TEXT_CALL */:
  8545. return stringifyNode(node.content, context);
  8546. default:
  8547. // static trees will not contain if/for nodes
  8548. return '';
  8549. }
  8550. }
  8551. function stringifyElement(node, context) {
  8552. let res = `<${node.tag}`;
  8553. for (let i = 0; i < node.props.length; i++) {
  8554. const p = node.props[i];
  8555. if (p.type === 6 /* ATTRIBUTE */) {
  8556. res += ` ${p.name}`;
  8557. if (p.value) {
  8558. res += `="${shared.escapeHtml(p.value.content)}"`;
  8559. }
  8560. }
  8561. else if (p.type === 7 /* DIRECTIVE */ && p.name === 'bind') {
  8562. const exp = p.exp;
  8563. if (exp.content[0] === '_') {
  8564. // internally generated string constant references
  8565. // e.g. imported URL strings via compiler-sfc transformAssetUrl plugin
  8566. res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
  8567. continue;
  8568. }
  8569. // constant v-bind, e.g. :foo="1"
  8570. let evaluated = evaluateConstant(exp);
  8571. if (evaluated != null) {
  8572. const arg = p.arg && p.arg.content;
  8573. if (arg === 'class') {
  8574. evaluated = shared.normalizeClass(evaluated);
  8575. }
  8576. else if (arg === 'style') {
  8577. evaluated = shared.stringifyStyle(shared.normalizeStyle(evaluated));
  8578. }
  8579. res += ` ${p.arg.content}="${shared.escapeHtml(evaluated)}"`;
  8580. }
  8581. }
  8582. }
  8583. if (context.scopeId) {
  8584. res += ` ${context.scopeId}`;
  8585. }
  8586. res += `>`;
  8587. for (let i = 0; i < node.children.length; i++) {
  8588. res += stringifyNode(node.children[i], context);
  8589. }
  8590. if (!shared.isVoidTag(node.tag)) {
  8591. res += `</${node.tag}>`;
  8592. }
  8593. return res;
  8594. }
  8595. // __UNSAFE__
  8596. // Reason: eval.
  8597. // It's technically safe to eval because only constant expressions are possible
  8598. // here, e.g. `{{ 1 }}` or `{{ 'foo' }}`
  8599. // in addition, constant exps bail on presence of parens so you can't even
  8600. // run JSFuck in here. But we mark it unsafe for security review purposes.
  8601. // (see compiler-core/src/transformExpressions)
  8602. function evaluateConstant(exp) {
  8603. if (exp.type === 4 /* SIMPLE_EXPRESSION */) {
  8604. return new Function(`return ${exp.content}`)();
  8605. }
  8606. else {
  8607. // compound
  8608. let res = ``;
  8609. exp.children.forEach(c => {
  8610. if (shared.isString(c) || shared.isSymbol(c)) {
  8611. return;
  8612. }
  8613. if (c.type === 2 /* TEXT */) {
  8614. res += c.content;
  8615. }
  8616. else if (c.type === 5 /* INTERPOLATION */) {
  8617. res += shared.toDisplayString(evaluateConstant(c.content));
  8618. }
  8619. else {
  8620. res += evaluateConstant(c);
  8621. }
  8622. });
  8623. return res;
  8624. }
  8625. }
  8626. const ignoreSideEffectTags = (node, context) => {
  8627. if (node.type === 1 /* ELEMENT */ &&
  8628. node.tagType === 0 /* ELEMENT */ &&
  8629. (node.tag === 'script' || node.tag === 'style')) {
  8630. context.onError(createDOMCompilerError(60 /* X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
  8631. context.removeNode();
  8632. }
  8633. };
  8634. const DOMNodeTransforms = [
  8635. transformStyle,
  8636. ...([warnTransitionChildren] )
  8637. ];
  8638. const DOMDirectiveTransforms = {
  8639. cloak: compilerCore.noopDirectiveTransform,
  8640. html: transformVHtml,
  8641. text: transformVText,
  8642. model: transformModel,
  8643. on: transformOn,
  8644. show: transformShow
  8645. };
  8646. function compile(template, options = {}) {
  8647. return compilerCore.baseCompile(template, shared.extend({}, parserOptions, options, {
  8648. nodeTransforms: [
  8649. // ignore <script> and <tag>
  8650. // this is not put inside DOMNodeTransforms because that list is used
  8651. // by compiler-ssr to generate vnode fallback branches
  8652. ignoreSideEffectTags,
  8653. ...DOMNodeTransforms,
  8654. ...(options.nodeTransforms || [])
  8655. ],
  8656. directiveTransforms: shared.extend({}, DOMDirectiveTransforms, options.directiveTransforms || {}),
  8657. transformHoist: stringifyStatic
  8658. }));
  8659. }
  8660. function parse(template, options = {}) {
  8661. return compilerCore.baseParse(template, shared.extend({}, parserOptions, options));
  8662. }
  8663. Object.keys(compilerCore).forEach(function (k) {
  8664. if (k !== 'default') exports[k] = compilerCore[k];
  8665. });
  8666. exports.DOMDirectiveTransforms = DOMDirectiveTransforms;
  8667. exports.DOMNodeTransforms = DOMNodeTransforms;
  8668. exports.TRANSITION = TRANSITION;
  8669. exports.TRANSITION_GROUP = TRANSITION_GROUP;
  8670. exports.V_MODEL_CHECKBOX = V_MODEL_CHECKBOX;
  8671. exports.V_MODEL_DYNAMIC = V_MODEL_DYNAMIC;
  8672. exports.V_MODEL_RADIO = V_MODEL_RADIO;
  8673. exports.V_MODEL_SELECT = V_MODEL_SELECT;
  8674. exports.V_MODEL_TEXT = V_MODEL_TEXT;
  8675. exports.V_ON_WITH_KEYS = V_ON_WITH_KEYS;
  8676. exports.V_ON_WITH_MODIFIERS = V_ON_WITH_MODIFIERS;
  8677. exports.V_SHOW = V_SHOW;
  8678. exports.compile = compile;
  8679. exports.createDOMCompilerError = createDOMCompilerError;
  8680. exports.parse = parse;
  8681. exports.parserOptions = parserOptions;
  8682. exports.transformStyle = transformStyle;
  8683. }(compilerDom_cjs$2));
  8684. var compilerDom_cjs = /*@__PURE__*/index.getDefaultExportFromCjs(compilerDom_cjs$2);
  8685. var compilerDom_cjs$1 = /*#__PURE__*/_mergeNamespaces({
  8686. __proto__: null,
  8687. 'default': compilerDom_cjs
  8688. }, [compilerDom_cjs$2]);
  8689. exports.compilerDom_cjs = compilerDom_cjs$1;