compiler-sfc.cjs.js 504 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var CompilerDOM = require('@vue/compiler-dom');
  4. var sourceMap = require('source-map');
  5. var MagicString = require('magic-string');
  6. var parser$2 = require('@babel/parser');
  7. var shared = require('@vue/shared');
  8. var estreeWalker = require('estree-walker');
  9. var path = require('path');
  10. var compilerCore = require('@vue/compiler-core');
  11. var url = require('url');
  12. var CompilerSSR = require('@vue/compiler-ssr');
  13. var fs = require('fs');
  14. var util$2 = require('util');
  15. var reactivityTransform = require('@vue/reactivity-transform');
  16. var _postcss = require('postcss');
  17. function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
  18. function _interopNamespace(e) {
  19. if (e && e.__esModule) return e;
  20. var n = Object.create(null);
  21. if (e) {
  22. Object.keys(e).forEach(function (k) {
  23. n[k] = e[k];
  24. });
  25. }
  26. n['default'] = e;
  27. return Object.freeze(n);
  28. }
  29. var CompilerDOM__namespace = /*#__PURE__*/_interopNamespace(CompilerDOM);
  30. var sourceMap__default = /*#__PURE__*/_interopDefaultLegacy(sourceMap);
  31. var MagicString__default = /*#__PURE__*/_interopDefaultLegacy(MagicString);
  32. var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
  33. var CompilerSSR__namespace = /*#__PURE__*/_interopNamespace(CompilerSSR);
  34. var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
  35. var util__default = /*#__PURE__*/_interopDefaultLegacy(util$2);
  36. var _postcss__default = /*#__PURE__*/_interopDefaultLegacy(_postcss);
  37. function pad (hash, len) {
  38. while (hash.length < len) {
  39. hash = '0' + hash;
  40. }
  41. return hash;
  42. }
  43. function fold (hash, text) {
  44. var i;
  45. var chr;
  46. var len;
  47. if (text.length === 0) {
  48. return hash;
  49. }
  50. for (i = 0, len = text.length; i < len; i++) {
  51. chr = text.charCodeAt(i);
  52. hash = ((hash << 5) - hash) + chr;
  53. hash |= 0;
  54. }
  55. return hash < 0 ? hash * -2 : hash;
  56. }
  57. function foldObject (hash, o, seen) {
  58. return Object.keys(o).sort().reduce(foldKey, hash);
  59. function foldKey (hash, key) {
  60. return foldValue(hash, o[key], key, seen);
  61. }
  62. }
  63. function foldValue (input, value, key, seen) {
  64. var hash = fold(fold(fold(input, key), toString(value)), typeof value);
  65. if (value === null) {
  66. return fold(hash, 'null');
  67. }
  68. if (value === undefined) {
  69. return fold(hash, 'undefined');
  70. }
  71. if (typeof value === 'object' || typeof value === 'function') {
  72. if (seen.indexOf(value) !== -1) {
  73. return fold(hash, '[Circular]' + key);
  74. }
  75. seen.push(value);
  76. var objHash = foldObject(hash, value, seen);
  77. if (!('valueOf' in value) || typeof value.valueOf !== 'function') {
  78. return objHash;
  79. }
  80. try {
  81. return fold(objHash, String(value.valueOf()))
  82. } catch (err) {
  83. return fold(objHash, '[valueOf exception]' + (err.stack || err.message))
  84. }
  85. }
  86. return fold(hash, value.toString());
  87. }
  88. function toString (o) {
  89. return Object.prototype.toString.call(o);
  90. }
  91. function sum (o) {
  92. return pad(foldValue(0, o, '', []).toString(16), 8);
  93. }
  94. var hashSum = sum;
  95. const CSS_VARS_HELPER = `useCssVars`;
  96. function genCssVarsFromList(vars, id, isProd, isSSR = false) {
  97. return `{\n ${vars
  98. .map(key => `"${isSSR ? `--` : ``}${genVarName(id, key, isProd)}": (${key})`)
  99. .join(',\n ')}\n}`;
  100. }
  101. function genVarName(id, raw, isProd) {
  102. if (isProd) {
  103. return hashSum(id + raw);
  104. }
  105. else {
  106. // escape ASCII Punctuation & Symbols
  107. return `${id}-${raw.replace(/[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, s => `\\${s}`)}`;
  108. }
  109. }
  110. function normalizeExpression(exp) {
  111. exp = exp.trim();
  112. if ((exp[0] === `'` && exp[exp.length - 1] === `'`) ||
  113. (exp[0] === `"` && exp[exp.length - 1] === `"`)) {
  114. return exp.slice(1, -1);
  115. }
  116. return exp;
  117. }
  118. const vBindRE = /v-bind\s*\(/g;
  119. function parseCssVars(sfc) {
  120. const vars = [];
  121. sfc.styles.forEach(style => {
  122. let match;
  123. // ignore v-bind() in comments /* ... */
  124. const content = style.content.replace(/\/\*([\s\S]*?)\*\//g, '');
  125. while ((match = vBindRE.exec(content))) {
  126. const start = match.index + match[0].length;
  127. const end = lexBinding(content, start);
  128. if (end !== null) {
  129. const variable = normalizeExpression(content.slice(start, end));
  130. if (!vars.includes(variable)) {
  131. vars.push(variable);
  132. }
  133. }
  134. }
  135. });
  136. return vars;
  137. }
  138. function lexBinding(content, start) {
  139. let state = 0 /* LexerState.inParens */;
  140. let parenDepth = 0;
  141. for (let i = start; i < content.length; i++) {
  142. const char = content.charAt(i);
  143. switch (state) {
  144. case 0 /* LexerState.inParens */:
  145. if (char === `'`) {
  146. state = 1 /* LexerState.inSingleQuoteString */;
  147. }
  148. else if (char === `"`) {
  149. state = 2 /* LexerState.inDoubleQuoteString */;
  150. }
  151. else if (char === `(`) {
  152. parenDepth++;
  153. }
  154. else if (char === `)`) {
  155. if (parenDepth > 0) {
  156. parenDepth--;
  157. }
  158. else {
  159. return i;
  160. }
  161. }
  162. break;
  163. case 1 /* LexerState.inSingleQuoteString */:
  164. if (char === `'`) {
  165. state = 0 /* LexerState.inParens */;
  166. }
  167. break;
  168. case 2 /* LexerState.inDoubleQuoteString */:
  169. if (char === `"`) {
  170. state = 0 /* LexerState.inParens */;
  171. }
  172. break;
  173. }
  174. }
  175. return null;
  176. }
  177. const cssVarsPlugin = opts => {
  178. const { id, isProd } = opts;
  179. return {
  180. postcssPlugin: 'vue-sfc-vars',
  181. Declaration(decl) {
  182. // rewrite CSS variables
  183. const value = decl.value;
  184. if (vBindRE.test(value)) {
  185. vBindRE.lastIndex = 0;
  186. let transformed = '';
  187. let lastIndex = 0;
  188. let match;
  189. while ((match = vBindRE.exec(value))) {
  190. const start = match.index + match[0].length;
  191. const end = lexBinding(value, start);
  192. if (end !== null) {
  193. const variable = normalizeExpression(value.slice(start, end));
  194. transformed +=
  195. value.slice(lastIndex, match.index) +
  196. `var(--${genVarName(id, variable, isProd)})`;
  197. lastIndex = end + 1;
  198. }
  199. }
  200. decl.value = transformed + value.slice(lastIndex);
  201. }
  202. }
  203. };
  204. };
  205. cssVarsPlugin.postcss = true;
  206. function genCssVarsCode(vars, bindings, id, isProd) {
  207. const varsExp = genCssVarsFromList(vars, id, isProd);
  208. const exp = CompilerDOM.createSimpleExpression(varsExp, false);
  209. const context = CompilerDOM.createTransformContext(CompilerDOM.createRoot([]), {
  210. prefixIdentifiers: true,
  211. inline: true,
  212. bindingMetadata: bindings.__isScriptSetup === false ? undefined : bindings
  213. });
  214. const transformed = CompilerDOM.processExpression(exp, context);
  215. const transformedString = transformed.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */
  216. ? transformed.content
  217. : transformed.children
  218. .map(c => {
  219. return typeof c === 'string'
  220. ? c
  221. : c.content;
  222. })
  223. .join('');
  224. return `_${CSS_VARS_HELPER}(_ctx => (${transformedString}))`;
  225. }
  226. // <script setup> already gets the calls injected as part of the transform
  227. // this is only for single normal <script>
  228. function genNormalScriptCssVarsCode(cssVars, bindings, id, isProd) {
  229. return (`\nimport { ${CSS_VARS_HELPER} as _${CSS_VARS_HELPER} } from 'vue'\n` +
  230. `const __injectCSSVars__ = () => {\n${genCssVarsCode(cssVars, bindings, id, isProd)}}\n` +
  231. `const __setup__ = __default__.setup\n` +
  232. `__default__.setup = __setup__\n` +
  233. ` ? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }\n` +
  234. ` : __injectCSSVars__\n`);
  235. }
  236. var iterator = function (Yallist) {
  237. Yallist.prototype[Symbol.iterator] = function* () {
  238. for (let walker = this.head; walker; walker = walker.next) {
  239. yield walker.value;
  240. }
  241. };
  242. };
  243. var yallist = Yallist;
  244. Yallist.Node = Node;
  245. Yallist.create = Yallist;
  246. function Yallist (list) {
  247. var self = this;
  248. if (!(self instanceof Yallist)) {
  249. self = new Yallist();
  250. }
  251. self.tail = null;
  252. self.head = null;
  253. self.length = 0;
  254. if (list && typeof list.forEach === 'function') {
  255. list.forEach(function (item) {
  256. self.push(item);
  257. });
  258. } else if (arguments.length > 0) {
  259. for (var i = 0, l = arguments.length; i < l; i++) {
  260. self.push(arguments[i]);
  261. }
  262. }
  263. return self
  264. }
  265. Yallist.prototype.removeNode = function (node) {
  266. if (node.list !== this) {
  267. throw new Error('removing node which does not belong to this list')
  268. }
  269. var next = node.next;
  270. var prev = node.prev;
  271. if (next) {
  272. next.prev = prev;
  273. }
  274. if (prev) {
  275. prev.next = next;
  276. }
  277. if (node === this.head) {
  278. this.head = next;
  279. }
  280. if (node === this.tail) {
  281. this.tail = prev;
  282. }
  283. node.list.length--;
  284. node.next = null;
  285. node.prev = null;
  286. node.list = null;
  287. return next
  288. };
  289. Yallist.prototype.unshiftNode = function (node) {
  290. if (node === this.head) {
  291. return
  292. }
  293. if (node.list) {
  294. node.list.removeNode(node);
  295. }
  296. var head = this.head;
  297. node.list = this;
  298. node.next = head;
  299. if (head) {
  300. head.prev = node;
  301. }
  302. this.head = node;
  303. if (!this.tail) {
  304. this.tail = node;
  305. }
  306. this.length++;
  307. };
  308. Yallist.prototype.pushNode = function (node) {
  309. if (node === this.tail) {
  310. return
  311. }
  312. if (node.list) {
  313. node.list.removeNode(node);
  314. }
  315. var tail = this.tail;
  316. node.list = this;
  317. node.prev = tail;
  318. if (tail) {
  319. tail.next = node;
  320. }
  321. this.tail = node;
  322. if (!this.head) {
  323. this.head = node;
  324. }
  325. this.length++;
  326. };
  327. Yallist.prototype.push = function () {
  328. for (var i = 0, l = arguments.length; i < l; i++) {
  329. push(this, arguments[i]);
  330. }
  331. return this.length
  332. };
  333. Yallist.prototype.unshift = function () {
  334. for (var i = 0, l = arguments.length; i < l; i++) {
  335. unshift(this, arguments[i]);
  336. }
  337. return this.length
  338. };
  339. Yallist.prototype.pop = function () {
  340. if (!this.tail) {
  341. return undefined
  342. }
  343. var res = this.tail.value;
  344. this.tail = this.tail.prev;
  345. if (this.tail) {
  346. this.tail.next = null;
  347. } else {
  348. this.head = null;
  349. }
  350. this.length--;
  351. return res
  352. };
  353. Yallist.prototype.shift = function () {
  354. if (!this.head) {
  355. return undefined
  356. }
  357. var res = this.head.value;
  358. this.head = this.head.next;
  359. if (this.head) {
  360. this.head.prev = null;
  361. } else {
  362. this.tail = null;
  363. }
  364. this.length--;
  365. return res
  366. };
  367. Yallist.prototype.forEach = function (fn, thisp) {
  368. thisp = thisp || this;
  369. for (var walker = this.head, i = 0; walker !== null; i++) {
  370. fn.call(thisp, walker.value, i, this);
  371. walker = walker.next;
  372. }
  373. };
  374. Yallist.prototype.forEachReverse = function (fn, thisp) {
  375. thisp = thisp || this;
  376. for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
  377. fn.call(thisp, walker.value, i, this);
  378. walker = walker.prev;
  379. }
  380. };
  381. Yallist.prototype.get = function (n) {
  382. for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
  383. // abort out of the list early if we hit a cycle
  384. walker = walker.next;
  385. }
  386. if (i === n && walker !== null) {
  387. return walker.value
  388. }
  389. };
  390. Yallist.prototype.getReverse = function (n) {
  391. for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
  392. // abort out of the list early if we hit a cycle
  393. walker = walker.prev;
  394. }
  395. if (i === n && walker !== null) {
  396. return walker.value
  397. }
  398. };
  399. Yallist.prototype.map = function (fn, thisp) {
  400. thisp = thisp || this;
  401. var res = new Yallist();
  402. for (var walker = this.head; walker !== null;) {
  403. res.push(fn.call(thisp, walker.value, this));
  404. walker = walker.next;
  405. }
  406. return res
  407. };
  408. Yallist.prototype.mapReverse = function (fn, thisp) {
  409. thisp = thisp || this;
  410. var res = new Yallist();
  411. for (var walker = this.tail; walker !== null;) {
  412. res.push(fn.call(thisp, walker.value, this));
  413. walker = walker.prev;
  414. }
  415. return res
  416. };
  417. Yallist.prototype.reduce = function (fn, initial) {
  418. var acc;
  419. var walker = this.head;
  420. if (arguments.length > 1) {
  421. acc = initial;
  422. } else if (this.head) {
  423. walker = this.head.next;
  424. acc = this.head.value;
  425. } else {
  426. throw new TypeError('Reduce of empty list with no initial value')
  427. }
  428. for (var i = 0; walker !== null; i++) {
  429. acc = fn(acc, walker.value, i);
  430. walker = walker.next;
  431. }
  432. return acc
  433. };
  434. Yallist.prototype.reduceReverse = function (fn, initial) {
  435. var acc;
  436. var walker = this.tail;
  437. if (arguments.length > 1) {
  438. acc = initial;
  439. } else if (this.tail) {
  440. walker = this.tail.prev;
  441. acc = this.tail.value;
  442. } else {
  443. throw new TypeError('Reduce of empty list with no initial value')
  444. }
  445. for (var i = this.length - 1; walker !== null; i--) {
  446. acc = fn(acc, walker.value, i);
  447. walker = walker.prev;
  448. }
  449. return acc
  450. };
  451. Yallist.prototype.toArray = function () {
  452. var arr = new Array(this.length);
  453. for (var i = 0, walker = this.head; walker !== null; i++) {
  454. arr[i] = walker.value;
  455. walker = walker.next;
  456. }
  457. return arr
  458. };
  459. Yallist.prototype.toArrayReverse = function () {
  460. var arr = new Array(this.length);
  461. for (var i = 0, walker = this.tail; walker !== null; i++) {
  462. arr[i] = walker.value;
  463. walker = walker.prev;
  464. }
  465. return arr
  466. };
  467. Yallist.prototype.slice = function (from, to) {
  468. to = to || this.length;
  469. if (to < 0) {
  470. to += this.length;
  471. }
  472. from = from || 0;
  473. if (from < 0) {
  474. from += this.length;
  475. }
  476. var ret = new Yallist();
  477. if (to < from || to < 0) {
  478. return ret
  479. }
  480. if (from < 0) {
  481. from = 0;
  482. }
  483. if (to > this.length) {
  484. to = this.length;
  485. }
  486. for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
  487. walker = walker.next;
  488. }
  489. for (; walker !== null && i < to; i++, walker = walker.next) {
  490. ret.push(walker.value);
  491. }
  492. return ret
  493. };
  494. Yallist.prototype.sliceReverse = function (from, to) {
  495. to = to || this.length;
  496. if (to < 0) {
  497. to += this.length;
  498. }
  499. from = from || 0;
  500. if (from < 0) {
  501. from += this.length;
  502. }
  503. var ret = new Yallist();
  504. if (to < from || to < 0) {
  505. return ret
  506. }
  507. if (from < 0) {
  508. from = 0;
  509. }
  510. if (to > this.length) {
  511. to = this.length;
  512. }
  513. for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
  514. walker = walker.prev;
  515. }
  516. for (; walker !== null && i > from; i--, walker = walker.prev) {
  517. ret.push(walker.value);
  518. }
  519. return ret
  520. };
  521. Yallist.prototype.splice = function (start, deleteCount /*, ...nodes */) {
  522. if (start > this.length) {
  523. start = this.length - 1;
  524. }
  525. if (start < 0) {
  526. start = this.length + start;
  527. }
  528. for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
  529. walker = walker.next;
  530. }
  531. var ret = [];
  532. for (var i = 0; walker && i < deleteCount; i++) {
  533. ret.push(walker.value);
  534. walker = this.removeNode(walker);
  535. }
  536. if (walker === null) {
  537. walker = this.tail;
  538. }
  539. if (walker !== this.head && walker !== this.tail) {
  540. walker = walker.prev;
  541. }
  542. for (var i = 2; i < arguments.length; i++) {
  543. walker = insert(this, walker, arguments[i]);
  544. }
  545. return ret;
  546. };
  547. Yallist.prototype.reverse = function () {
  548. var head = this.head;
  549. var tail = this.tail;
  550. for (var walker = head; walker !== null; walker = walker.prev) {
  551. var p = walker.prev;
  552. walker.prev = walker.next;
  553. walker.next = p;
  554. }
  555. this.head = tail;
  556. this.tail = head;
  557. return this
  558. };
  559. function insert (self, node, value) {
  560. var inserted = node === self.head ?
  561. new Node(value, null, node, self) :
  562. new Node(value, node, node.next, self);
  563. if (inserted.next === null) {
  564. self.tail = inserted;
  565. }
  566. if (inserted.prev === null) {
  567. self.head = inserted;
  568. }
  569. self.length++;
  570. return inserted
  571. }
  572. function push (self, item) {
  573. self.tail = new Node(item, self.tail, null, self);
  574. if (!self.head) {
  575. self.head = self.tail;
  576. }
  577. self.length++;
  578. }
  579. function unshift (self, item) {
  580. self.head = new Node(item, null, self.head, self);
  581. if (!self.tail) {
  582. self.tail = self.head;
  583. }
  584. self.length++;
  585. }
  586. function Node (value, prev, next, list) {
  587. if (!(this instanceof Node)) {
  588. return new Node(value, prev, next, list)
  589. }
  590. this.list = list;
  591. this.value = value;
  592. if (prev) {
  593. prev.next = this;
  594. this.prev = prev;
  595. } else {
  596. this.prev = null;
  597. }
  598. if (next) {
  599. next.prev = this;
  600. this.next = next;
  601. } else {
  602. this.next = null;
  603. }
  604. }
  605. try {
  606. // add if support for Symbol.iterator is present
  607. iterator(Yallist);
  608. } catch (er) {}
  609. // A linked list to keep track of recently-used-ness
  610. const MAX = Symbol('max');
  611. const LENGTH = Symbol('length');
  612. const LENGTH_CALCULATOR = Symbol('lengthCalculator');
  613. const ALLOW_STALE = Symbol('allowStale');
  614. const MAX_AGE = Symbol('maxAge');
  615. const DISPOSE = Symbol('dispose');
  616. const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');
  617. const LRU_LIST = Symbol('lruList');
  618. const CACHE = Symbol('cache');
  619. const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');
  620. const naiveLength = () => 1;
  621. // lruList is a yallist where the head is the youngest
  622. // item, and the tail is the oldest. the list contains the Hit
  623. // objects as the entries.
  624. // Each Hit object has a reference to its Yallist.Node. This
  625. // never changes.
  626. //
  627. // cache is a Map (or PseudoMap) that matches the keys to
  628. // the Yallist.Node object.
  629. class LRUCache {
  630. constructor (options) {
  631. if (typeof options === 'number')
  632. options = { max: options };
  633. if (!options)
  634. options = {};
  635. if (options.max && (typeof options.max !== 'number' || options.max < 0))
  636. throw new TypeError('max must be a non-negative number')
  637. // Kind of weird to have a default max of Infinity, but oh well.
  638. this[MAX] = options.max || Infinity;
  639. const lc = options.length || naiveLength;
  640. this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc;
  641. this[ALLOW_STALE] = options.stale || false;
  642. if (options.maxAge && typeof options.maxAge !== 'number')
  643. throw new TypeError('maxAge must be a number')
  644. this[MAX_AGE] = options.maxAge || 0;
  645. this[DISPOSE] = options.dispose;
  646. this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
  647. this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
  648. this.reset();
  649. }
  650. // resize the cache when the max changes.
  651. set max (mL) {
  652. if (typeof mL !== 'number' || mL < 0)
  653. throw new TypeError('max must be a non-negative number')
  654. this[MAX] = mL || Infinity;
  655. trim(this);
  656. }
  657. get max () {
  658. return this[MAX]
  659. }
  660. set allowStale (allowStale) {
  661. this[ALLOW_STALE] = !!allowStale;
  662. }
  663. get allowStale () {
  664. return this[ALLOW_STALE]
  665. }
  666. set maxAge (mA) {
  667. if (typeof mA !== 'number')
  668. throw new TypeError('maxAge must be a non-negative number')
  669. this[MAX_AGE] = mA;
  670. trim(this);
  671. }
  672. get maxAge () {
  673. return this[MAX_AGE]
  674. }
  675. // resize the cache when the lengthCalculator changes.
  676. set lengthCalculator (lC) {
  677. if (typeof lC !== 'function')
  678. lC = naiveLength;
  679. if (lC !== this[LENGTH_CALCULATOR]) {
  680. this[LENGTH_CALCULATOR] = lC;
  681. this[LENGTH] = 0;
  682. this[LRU_LIST].forEach(hit => {
  683. hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
  684. this[LENGTH] += hit.length;
  685. });
  686. }
  687. trim(this);
  688. }
  689. get lengthCalculator () { return this[LENGTH_CALCULATOR] }
  690. get length () { return this[LENGTH] }
  691. get itemCount () { return this[LRU_LIST].length }
  692. rforEach (fn, thisp) {
  693. thisp = thisp || this;
  694. for (let walker = this[LRU_LIST].tail; walker !== null;) {
  695. const prev = walker.prev;
  696. forEachStep(this, fn, walker, thisp);
  697. walker = prev;
  698. }
  699. }
  700. forEach (fn, thisp) {
  701. thisp = thisp || this;
  702. for (let walker = this[LRU_LIST].head; walker !== null;) {
  703. const next = walker.next;
  704. forEachStep(this, fn, walker, thisp);
  705. walker = next;
  706. }
  707. }
  708. keys () {
  709. return this[LRU_LIST].toArray().map(k => k.key)
  710. }
  711. values () {
  712. return this[LRU_LIST].toArray().map(k => k.value)
  713. }
  714. reset () {
  715. if (this[DISPOSE] &&
  716. this[LRU_LIST] &&
  717. this[LRU_LIST].length) {
  718. this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));
  719. }
  720. this[CACHE] = new Map(); // hash of items by key
  721. this[LRU_LIST] = new yallist(); // list of items in order of use recency
  722. this[LENGTH] = 0; // length of items in the list
  723. }
  724. dump () {
  725. return this[LRU_LIST].map(hit =>
  726. isStale(this, hit) ? false : {
  727. k: hit.key,
  728. v: hit.value,
  729. e: hit.now + (hit.maxAge || 0)
  730. }).toArray().filter(h => h)
  731. }
  732. dumpLru () {
  733. return this[LRU_LIST]
  734. }
  735. set (key, value, maxAge) {
  736. maxAge = maxAge || this[MAX_AGE];
  737. if (maxAge && typeof maxAge !== 'number')
  738. throw new TypeError('maxAge must be a number')
  739. const now = maxAge ? Date.now() : 0;
  740. const len = this[LENGTH_CALCULATOR](value, key);
  741. if (this[CACHE].has(key)) {
  742. if (len > this[MAX]) {
  743. del(this, this[CACHE].get(key));
  744. return false
  745. }
  746. const node = this[CACHE].get(key);
  747. const item = node.value;
  748. // dispose of the old one before overwriting
  749. // split out into 2 ifs for better coverage tracking
  750. if (this[DISPOSE]) {
  751. if (!this[NO_DISPOSE_ON_SET])
  752. this[DISPOSE](key, item.value);
  753. }
  754. item.now = now;
  755. item.maxAge = maxAge;
  756. item.value = value;
  757. this[LENGTH] += len - item.length;
  758. item.length = len;
  759. this.get(key);
  760. trim(this);
  761. return true
  762. }
  763. const hit = new Entry(key, value, len, now, maxAge);
  764. // oversized objects fall out of cache automatically.
  765. if (hit.length > this[MAX]) {
  766. if (this[DISPOSE])
  767. this[DISPOSE](key, value);
  768. return false
  769. }
  770. this[LENGTH] += hit.length;
  771. this[LRU_LIST].unshift(hit);
  772. this[CACHE].set(key, this[LRU_LIST].head);
  773. trim(this);
  774. return true
  775. }
  776. has (key) {
  777. if (!this[CACHE].has(key)) return false
  778. const hit = this[CACHE].get(key).value;
  779. return !isStale(this, hit)
  780. }
  781. get (key) {
  782. return get(this, key, true)
  783. }
  784. peek (key) {
  785. return get(this, key, false)
  786. }
  787. pop () {
  788. const node = this[LRU_LIST].tail;
  789. if (!node)
  790. return null
  791. del(this, node);
  792. return node.value
  793. }
  794. del (key) {
  795. del(this, this[CACHE].get(key));
  796. }
  797. load (arr) {
  798. // reset the cache
  799. this.reset();
  800. const now = Date.now();
  801. // A previous serialized cache has the most recent items first
  802. for (let l = arr.length - 1; l >= 0; l--) {
  803. const hit = arr[l];
  804. const expiresAt = hit.e || 0;
  805. if (expiresAt === 0)
  806. // the item was created without expiration in a non aged cache
  807. this.set(hit.k, hit.v);
  808. else {
  809. const maxAge = expiresAt - now;
  810. // dont add already expired items
  811. if (maxAge > 0) {
  812. this.set(hit.k, hit.v, maxAge);
  813. }
  814. }
  815. }
  816. }
  817. prune () {
  818. this[CACHE].forEach((value, key) => get(this, key, false));
  819. }
  820. }
  821. const get = (self, key, doUse) => {
  822. const node = self[CACHE].get(key);
  823. if (node) {
  824. const hit = node.value;
  825. if (isStale(self, hit)) {
  826. del(self, node);
  827. if (!self[ALLOW_STALE])
  828. return undefined
  829. } else {
  830. if (doUse) {
  831. if (self[UPDATE_AGE_ON_GET])
  832. node.value.now = Date.now();
  833. self[LRU_LIST].unshiftNode(node);
  834. }
  835. }
  836. return hit.value
  837. }
  838. };
  839. const isStale = (self, hit) => {
  840. if (!hit || (!hit.maxAge && !self[MAX_AGE]))
  841. return false
  842. const diff = Date.now() - hit.now;
  843. return hit.maxAge ? diff > hit.maxAge
  844. : self[MAX_AGE] && (diff > self[MAX_AGE])
  845. };
  846. const trim = self => {
  847. if (self[LENGTH] > self[MAX]) {
  848. for (let walker = self[LRU_LIST].tail;
  849. self[LENGTH] > self[MAX] && walker !== null;) {
  850. // We know that we're about to delete this one, and also
  851. // what the next least recently used key will be, so just
  852. // go ahead and set it now.
  853. const prev = walker.prev;
  854. del(self, walker);
  855. walker = prev;
  856. }
  857. }
  858. };
  859. const del = (self, node) => {
  860. if (node) {
  861. const hit = node.value;
  862. if (self[DISPOSE])
  863. self[DISPOSE](hit.key, hit.value);
  864. self[LENGTH] -= hit.length;
  865. self[CACHE].delete(hit.key);
  866. self[LRU_LIST].removeNode(node);
  867. }
  868. };
  869. class Entry {
  870. constructor (key, value, length, now, maxAge) {
  871. this.key = key;
  872. this.value = value;
  873. this.length = length;
  874. this.now = now;
  875. this.maxAge = maxAge || 0;
  876. }
  877. }
  878. const forEachStep = (self, fn, node, thisp) => {
  879. let hit = node.value;
  880. if (isStale(self, hit)) {
  881. del(self, node);
  882. if (!self[ALLOW_STALE])
  883. hit = undefined;
  884. }
  885. if (hit)
  886. fn.call(thisp, hit.value, hit.key, self);
  887. };
  888. var lruCache = LRUCache;
  889. function createCache(size = 500) {
  890. return new lruCache(size);
  891. }
  892. function isRelativeUrl(url) {
  893. const firstChar = url.charAt(0);
  894. return firstChar === '.' || firstChar === '~' || firstChar === '@';
  895. }
  896. const externalRE = /^(https?:)?\/\//;
  897. function isExternalUrl(url) {
  898. return externalRE.test(url);
  899. }
  900. const dataUrlRE = /^\s*data:/i;
  901. function isDataUrl(url) {
  902. return dataUrlRE.test(url);
  903. }
  904. /**
  905. * Parses string url into URL object.
  906. */
  907. function parseUrl(url) {
  908. const firstChar = url.charAt(0);
  909. if (firstChar === '~') {
  910. const secondChar = url.charAt(1);
  911. url = url.slice(secondChar === '/' ? 2 : 1);
  912. }
  913. return parseUriParts(url);
  914. }
  915. /**
  916. * vuejs/component-compiler-utils#22 Support uri fragment in transformed require
  917. * @param urlString an url as a string
  918. */
  919. function parseUriParts(urlString) {
  920. // A TypeError is thrown if urlString is not a string
  921. // @see https://nodejs.org/api/url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
  922. return url.parse(shared.isString(urlString) ? urlString : '', false, true);
  923. }
  924. const defaultAssetUrlOptions = {
  925. base: null,
  926. includeAbsolute: false,
  927. tags: {
  928. video: ['src', 'poster'],
  929. source: ['src'],
  930. img: ['src'],
  931. image: ['xlink:href', 'href'],
  932. use: ['xlink:href', 'href']
  933. }
  934. };
  935. const normalizeOptions = (options) => {
  936. if (Object.keys(options).some(key => shared.isArray(options[key]))) {
  937. // legacy option format which directly passes in tags config
  938. return {
  939. ...defaultAssetUrlOptions,
  940. tags: options
  941. };
  942. }
  943. return {
  944. ...defaultAssetUrlOptions,
  945. ...options
  946. };
  947. };
  948. const createAssetUrlTransformWithOptions = (options) => {
  949. return (node, context) => transformAssetUrl(node, context, options);
  950. };
  951. /**
  952. * A `@vue/compiler-core` plugin that transforms relative asset urls into
  953. * either imports or absolute urls.
  954. *
  955. * ``` js
  956. * // Before
  957. * createVNode('img', { src: './logo.png' })
  958. *
  959. * // After
  960. * import _imports_0 from './logo.png'
  961. * createVNode('img', { src: _imports_0 })
  962. * ```
  963. */
  964. const transformAssetUrl = (node, context, options = defaultAssetUrlOptions) => {
  965. if (node.type === 1 /* NodeTypes.ELEMENT */) {
  966. if (!node.props.length) {
  967. return;
  968. }
  969. const tags = options.tags || defaultAssetUrlOptions.tags;
  970. const attrs = tags[node.tag];
  971. const wildCardAttrs = tags['*'];
  972. if (!attrs && !wildCardAttrs) {
  973. return;
  974. }
  975. const assetAttrs = (attrs || []).concat(wildCardAttrs || []);
  976. node.props.forEach((attr, index) => {
  977. if (attr.type !== 6 /* NodeTypes.ATTRIBUTE */ ||
  978. !assetAttrs.includes(attr.name) ||
  979. !attr.value ||
  980. isExternalUrl(attr.value.content) ||
  981. isDataUrl(attr.value.content) ||
  982. attr.value.content[0] === '#' ||
  983. (!options.includeAbsolute && !isRelativeUrl(attr.value.content))) {
  984. return;
  985. }
  986. const url = parseUrl(attr.value.content);
  987. if (options.base && attr.value.content[0] === '.') {
  988. // explicit base - directly rewrite relative urls into absolute url
  989. // to avoid generating extra imports
  990. // Allow for full hostnames provided in options.base
  991. const base = parseUrl(options.base);
  992. const protocol = base.protocol || '';
  993. const host = base.host ? protocol + '//' + base.host : '';
  994. const basePath = base.path || '/';
  995. // when packaged in the browser, path will be using the posix-
  996. // only version provided by rollup-plugin-node-builtins.
  997. attr.value.content =
  998. host +
  999. (path__default.posix || path__default).join(basePath, url.path + (url.hash || ''));
  1000. return;
  1001. }
  1002. // otherwise, transform the url into an import.
  1003. // this assumes a bundler will resolve the import into the correct
  1004. // absolute url (e.g. webpack file-loader)
  1005. const exp = getImportsExpressionExp(url.path, url.hash, attr.loc, context);
  1006. node.props[index] = {
  1007. type: 7 /* NodeTypes.DIRECTIVE */,
  1008. name: 'bind',
  1009. arg: compilerCore.createSimpleExpression(attr.name, true, attr.loc),
  1010. exp,
  1011. modifiers: [],
  1012. loc: attr.loc
  1013. };
  1014. });
  1015. }
  1016. };
  1017. function getImportsExpressionExp(path, hash, loc, context) {
  1018. if (path) {
  1019. let name;
  1020. let exp;
  1021. const existingIndex = context.imports.findIndex(i => i.path === path);
  1022. if (existingIndex > -1) {
  1023. name = `_imports_${existingIndex}`;
  1024. exp = context.imports[existingIndex].exp;
  1025. }
  1026. else {
  1027. name = `_imports_${context.imports.length}`;
  1028. exp = compilerCore.createSimpleExpression(name, false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
  1029. context.imports.push({ exp, path });
  1030. }
  1031. if (!hash) {
  1032. return exp;
  1033. }
  1034. const hashExp = `${name} + '${hash}'`;
  1035. const finalExp = compilerCore.createSimpleExpression(hashExp, false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
  1036. if (!context.hoistStatic) {
  1037. return finalExp;
  1038. }
  1039. const existingHoistIndex = context.hoists.findIndex(h => {
  1040. return (h &&
  1041. h.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
  1042. !h.isStatic &&
  1043. h.content === hashExp);
  1044. });
  1045. if (existingHoistIndex > -1) {
  1046. return compilerCore.createSimpleExpression(`_hoisted_${existingHoistIndex + 1}`, false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
  1047. }
  1048. return context.hoist(finalExp);
  1049. }
  1050. else {
  1051. return compilerCore.createSimpleExpression(`''`, false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
  1052. }
  1053. }
  1054. const srcsetTags = ['img', 'source'];
  1055. // http://w3c.github.io/html/semantics-embedded-content.html#ref-for-image-candidate-string-5
  1056. const escapedSpaceCharacters = /( |\\t|\\n|\\f|\\r)+/g;
  1057. const createSrcsetTransformWithOptions = (options) => {
  1058. return (node, context) => transformSrcset(node, context, options);
  1059. };
  1060. const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
  1061. if (node.type === 1 /* NodeTypes.ELEMENT */) {
  1062. if (srcsetTags.includes(node.tag) && node.props.length) {
  1063. node.props.forEach((attr, index) => {
  1064. if (attr.name === 'srcset' && attr.type === 6 /* NodeTypes.ATTRIBUTE */) {
  1065. if (!attr.value)
  1066. return;
  1067. const value = attr.value.content;
  1068. if (!value)
  1069. return;
  1070. const imageCandidates = value.split(',').map(s => {
  1071. // The attribute value arrives here with all whitespace, except
  1072. // normal spaces, represented by escape sequences
  1073. const [url, descriptor] = s
  1074. .replace(escapedSpaceCharacters, ' ')
  1075. .trim()
  1076. .split(' ', 2);
  1077. return { url, descriptor };
  1078. });
  1079. // data urls contains comma after the encoding so we need to re-merge
  1080. // them
  1081. for (let i = 0; i < imageCandidates.length; i++) {
  1082. const { url } = imageCandidates[i];
  1083. if (isDataUrl(url)) {
  1084. imageCandidates[i + 1].url =
  1085. url + ',' + imageCandidates[i + 1].url;
  1086. imageCandidates.splice(i, 1);
  1087. }
  1088. }
  1089. const shouldProcessUrl = (url) => {
  1090. return (!isExternalUrl(url) &&
  1091. !isDataUrl(url) &&
  1092. (options.includeAbsolute || isRelativeUrl(url)));
  1093. };
  1094. // When srcset does not contain any qualified URLs, skip transforming
  1095. if (!imageCandidates.some(({ url }) => shouldProcessUrl(url))) {
  1096. return;
  1097. }
  1098. if (options.base) {
  1099. const base = options.base;
  1100. const set = [];
  1101. let needImportTransform = false;
  1102. imageCandidates.forEach(candidate => {
  1103. let { url, descriptor } = candidate;
  1104. descriptor = descriptor ? ` ${descriptor}` : ``;
  1105. if (url[0] === '.') {
  1106. candidate.url = (path__default.posix || path__default).join(base, url);
  1107. set.push(candidate.url + descriptor);
  1108. }
  1109. else if (shouldProcessUrl(url)) {
  1110. needImportTransform = true;
  1111. }
  1112. else {
  1113. set.push(url + descriptor);
  1114. }
  1115. });
  1116. if (!needImportTransform) {
  1117. attr.value.content = set.join(', ');
  1118. return;
  1119. }
  1120. }
  1121. const compoundExpression = compilerCore.createCompoundExpression([], attr.loc);
  1122. imageCandidates.forEach(({ url, descriptor }, index) => {
  1123. if (shouldProcessUrl(url)) {
  1124. const { path } = parseUrl(url);
  1125. let exp;
  1126. if (path) {
  1127. const existingImportsIndex = context.imports.findIndex(i => i.path === path);
  1128. if (existingImportsIndex > -1) {
  1129. exp = compilerCore.createSimpleExpression(`_imports_${existingImportsIndex}`, false, attr.loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
  1130. }
  1131. else {
  1132. exp = compilerCore.createSimpleExpression(`_imports_${context.imports.length}`, false, attr.loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
  1133. context.imports.push({ exp, path });
  1134. }
  1135. compoundExpression.children.push(exp);
  1136. }
  1137. }
  1138. else {
  1139. const exp = compilerCore.createSimpleExpression(`"${url}"`, false, attr.loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
  1140. compoundExpression.children.push(exp);
  1141. }
  1142. const isNotLast = imageCandidates.length - 1 > index;
  1143. if (descriptor && isNotLast) {
  1144. compoundExpression.children.push(` + ' ${descriptor}, ' + `);
  1145. }
  1146. else if (descriptor) {
  1147. compoundExpression.children.push(` + ' ${descriptor}'`);
  1148. }
  1149. else if (isNotLast) {
  1150. compoundExpression.children.push(` + ', ' + `);
  1151. }
  1152. });
  1153. let exp = compoundExpression;
  1154. if (context.hoistStatic) {
  1155. exp = context.hoist(compoundExpression);
  1156. exp.constType = 3 /* ConstantTypes.CAN_STRINGIFY */;
  1157. }
  1158. node.props[index] = {
  1159. type: 7 /* NodeTypes.DIRECTIVE */,
  1160. name: 'bind',
  1161. arg: compilerCore.createSimpleExpression('srcset', true, attr.loc),
  1162. exp,
  1163. modifiers: [],
  1164. loc: attr.loc
  1165. };
  1166. }
  1167. });
  1168. }
  1169. }
  1170. };
  1171. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  1172. function getDefaultExportFromCjs (x) {
  1173. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
  1174. }
  1175. function getAugmentedNamespace(n) {
  1176. if (n.__esModule) return n;
  1177. var a = Object.defineProperty({}, '__esModule', {value: true});
  1178. Object.keys(n).forEach(function (k) {
  1179. var d = Object.getOwnPropertyDescriptor(n, k);
  1180. Object.defineProperty(a, k, d.get ? d : {
  1181. enumerable: true,
  1182. get: function () {
  1183. return n[k];
  1184. }
  1185. });
  1186. });
  1187. return a;
  1188. }
  1189. function createCommonjsModule(fn) {
  1190. var module = { exports: {} };
  1191. return fn(module, module.exports), module.exports;
  1192. }
  1193. function commonjsRequire (path) {
  1194. throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
  1195. }
  1196. var consolidate = createCommonjsModule(function (module, exports) {
  1197. /*
  1198. * Engines which do not support caching of their file contents
  1199. * should use the `read()` function defined in consolidate.js
  1200. * On top of this, when an engine compiles to a `Function`,
  1201. * these functions should either be cached within consolidate.js
  1202. * or the engine itself via `options.cache`. This will allow
  1203. * users and frameworks to pass `options.cache = true` for
  1204. * `NODE_ENV=production`, however edit the file(s) without
  1205. * re-loading the application in development.
  1206. */
  1207. /**
  1208. * Module dependencies.
  1209. */
  1210. var path = path__default;
  1211. var join = path.join;
  1212. var resolve = path.resolve;
  1213. var extname = path.extname;
  1214. var dirname = path.dirname;
  1215. var isAbsolute = path.isAbsolute;
  1216. var readCache = {};
  1217. /**
  1218. * Require cache.
  1219. */
  1220. var cacheStore = {};
  1221. /**
  1222. * Require cache.
  1223. */
  1224. var requires = {};
  1225. /**
  1226. * Clear the cache.
  1227. *
  1228. * @api public
  1229. */
  1230. exports.clearCache = function() {
  1231. readCache = {};
  1232. cacheStore = {};
  1233. };
  1234. /**
  1235. * Conditionally cache `compiled` template based
  1236. * on the `options` filename and `.cache` boolean.
  1237. *
  1238. * @param {Object} options
  1239. * @param {Function} compiled
  1240. * @return {Function}
  1241. * @api private
  1242. */
  1243. function cache(options, compiled) {
  1244. // cachable
  1245. if (compiled && options.filename && options.cache) {
  1246. delete readCache[options.filename];
  1247. cacheStore[options.filename] = compiled;
  1248. return compiled;
  1249. }
  1250. // check cache
  1251. if (options.filename && options.cache) {
  1252. return cacheStore[options.filename];
  1253. }
  1254. return compiled;
  1255. }
  1256. /**
  1257. * Read `path` with `options` with
  1258. * callback `(err, str)`. When `options.cache`
  1259. * is true the template string will be cached.
  1260. *
  1261. * @param {String} options
  1262. * @param {Function} cb
  1263. * @api private
  1264. */
  1265. function read(path, options, cb) {
  1266. var str = readCache[path];
  1267. var cached = options.cache && str && typeof str === 'string';
  1268. // cached (only if cached is a string and not a compiled template function)
  1269. if (cached) return cb(null, str);
  1270. // read
  1271. fs__default.readFile(path, 'utf8', function(err, str) {
  1272. if (err) return cb(err);
  1273. // remove extraneous utf8 BOM marker
  1274. str = str.replace(/^\uFEFF/, '');
  1275. if (options.cache) readCache[path] = str;
  1276. cb(null, str);
  1277. });
  1278. }
  1279. /**
  1280. * Read `path` with `options` with
  1281. * callback `(err, str)`. When `options.cache`
  1282. * is true the partial string will be cached.
  1283. *
  1284. * @param {String} options
  1285. * @param {Function} fn
  1286. * @api private
  1287. */
  1288. function readPartials(path, options, cb) {
  1289. if (!options.partials) return cb();
  1290. var keys = Object.keys(options.partials);
  1291. var partials = {};
  1292. function next(index) {
  1293. if (index === keys.length) return cb(null, partials);
  1294. var key = keys[index];
  1295. var partialPath = options.partials[key];
  1296. if (partialPath === undefined || partialPath === null || partialPath === false) {
  1297. return next(++index);
  1298. }
  1299. var file;
  1300. if (isAbsolute(partialPath)) {
  1301. if (extname(partialPath) !== '') {
  1302. file = partialPath;
  1303. } else {
  1304. file = join(partialPath + extname(path));
  1305. }
  1306. } else {
  1307. file = join(dirname(path), partialPath + extname(path));
  1308. }
  1309. read(file, options, function(err, str) {
  1310. if (err) return cb(err);
  1311. partials[key] = str;
  1312. next(++index);
  1313. });
  1314. }
  1315. next(0);
  1316. }
  1317. /**
  1318. * promisify
  1319. */
  1320. function promisify(cb, fn) {
  1321. return new Promise(function(resolve, reject) {
  1322. cb = cb || function(err, html) {
  1323. if (err) {
  1324. return reject(err);
  1325. }
  1326. resolve(html);
  1327. };
  1328. fn(cb);
  1329. });
  1330. }
  1331. /**
  1332. * fromStringRenderer
  1333. */
  1334. function fromStringRenderer(name) {
  1335. return function(path, options, cb) {
  1336. options.filename = path;
  1337. return promisify(cb, function(cb) {
  1338. readPartials(path, options, function(err, partials) {
  1339. var extend = (requires.extend || (requires.extend = util__default._extend));
  1340. var opts = extend({}, options);
  1341. opts.partials = partials;
  1342. if (err) return cb(err);
  1343. if (cache(opts)) {
  1344. exports[name].render('', opts, cb);
  1345. } else {
  1346. read(path, opts, function(err, str) {
  1347. if (err) return cb(err);
  1348. exports[name].render(str, opts, cb);
  1349. });
  1350. }
  1351. });
  1352. });
  1353. };
  1354. }
  1355. /**
  1356. * velocity support.
  1357. */
  1358. exports.velocityjs = fromStringRenderer('velocityjs');
  1359. /**
  1360. * velocity string support.
  1361. */
  1362. exports.velocityjs.render = function(str, options, cb) {
  1363. return promisify(cb, function(cb) {
  1364. var engine = requires.velocityjs || (requires.velocityjs = require('velocityjs'));
  1365. try {
  1366. options.locals = options;
  1367. cb(null, engine.render(str, options).trimLeft());
  1368. } catch (err) {
  1369. cb(err);
  1370. }
  1371. });
  1372. };
  1373. /**
  1374. * Liquid support.
  1375. */
  1376. exports.liquid = fromStringRenderer('liquid');
  1377. /**
  1378. * Liquid string support.
  1379. */
  1380. /**
  1381. * Note that in order to get filters and custom tags we've had to push
  1382. * all user-defined locals down into @locals. However, just to make things
  1383. * backwards-compatible, any property of `options` that is left after
  1384. * processing and removing `locals`, `meta`, `filters`, `customTags` and
  1385. * `includeDir` will also become a local.
  1386. */
  1387. function _renderTinyliquid(engine, str, options, cb) {
  1388. var context = engine.newContext();
  1389. var k;
  1390. /**
  1391. * Note that there's a bug in the library that doesn't allow us to pass
  1392. * the locals to newContext(), hence looping through the keys:
  1393. */
  1394. if (options.locals) {
  1395. for (k in options.locals) {
  1396. context.setLocals(k, options.locals[k]);
  1397. }
  1398. delete options.locals;
  1399. }
  1400. if (options.meta) {
  1401. context.setLocals('page', options.meta);
  1402. delete options.meta;
  1403. }
  1404. /**
  1405. * Add any defined filters:
  1406. */
  1407. if (options.filters) {
  1408. for (k in options.filters) {
  1409. context.setFilter(k, options.filters[k]);
  1410. }
  1411. delete options.filters;
  1412. }
  1413. /**
  1414. * Set up a callback for the include directory:
  1415. */
  1416. var includeDir = options.includeDir || process.cwd();
  1417. context.onInclude(function(name, callback) {
  1418. var extname = path.extname(name) ? '' : '.liquid';
  1419. var filename = path.resolve(includeDir, name + extname);
  1420. fs__default.readFile(filename, {encoding: 'utf8'}, function(err, data) {
  1421. if (err) return callback(err);
  1422. callback(null, engine.parse(data));
  1423. });
  1424. });
  1425. delete options.includeDir;
  1426. /**
  1427. * The custom tag functions need to have their results pushed back
  1428. * through the parser, so set up a shim before calling the provided
  1429. * callback:
  1430. */
  1431. var compileOptions = {
  1432. customTags: {}
  1433. };
  1434. if (options.customTags) {
  1435. var tagFunctions = options.customTags;
  1436. for (k in options.customTags) {
  1437. /*Tell jshint there's no problem with having this function in the loop */
  1438. /*jshint -W083 */
  1439. compileOptions.customTags[k] = function(context, name, body) {
  1440. var tpl = tagFunctions[name](body.trim());
  1441. context.astStack.push(engine.parse(tpl));
  1442. };
  1443. /*jshint +W083 */
  1444. }
  1445. delete options.customTags;
  1446. }
  1447. /**
  1448. * Now anything left in `options` becomes a local:
  1449. */
  1450. for (k in options) {
  1451. context.setLocals(k, options[k]);
  1452. }
  1453. /**
  1454. * Finally, execute the template:
  1455. */
  1456. var tmpl = cache(context) || cache(context, engine.compile(str, compileOptions));
  1457. tmpl(context, cb);
  1458. }
  1459. exports.liquid.render = function(str, options, cb) {
  1460. return promisify(cb, function(cb) {
  1461. var engine = requires.liquid;
  1462. var Liquid;
  1463. try {
  1464. // set up tinyliquid engine
  1465. engine = requires.liquid = require('tinyliquid');
  1466. // use tinyliquid engine
  1467. _renderTinyliquid(engine, str, options, cb);
  1468. return;
  1469. } catch (err) {
  1470. // set up liquid-node engine
  1471. try {
  1472. Liquid = requires.liquid = require('liquid-node');
  1473. engine = new Liquid.Engine();
  1474. } catch (err) {
  1475. throw err;
  1476. }
  1477. }
  1478. // use liquid-node engine
  1479. try {
  1480. var locals = options.locals || {};
  1481. if (options.meta) {
  1482. locals.pages = options.meta;
  1483. delete options.meta;
  1484. }
  1485. /**
  1486. * Add any defined filters:
  1487. */
  1488. if (options.filters) {
  1489. engine.registerFilters(options.filters);
  1490. delete options.filters;
  1491. }
  1492. /**
  1493. * Set up a callback for the include directory:
  1494. */
  1495. var includeDir = options.includeDir || process.cwd();
  1496. engine.fileSystem = new Liquid.LocalFileSystem(includeDir, 'liquid');
  1497. delete options.includeDir;
  1498. /**
  1499. * The custom tag functions need to have their results pushed back
  1500. * through the parser, so set up a shim before calling the provided
  1501. * callback:
  1502. */
  1503. if (options.customTags) {
  1504. var tagFunctions = options.customTags;
  1505. for (k in options.customTags) {
  1506. engine.registerTag(k, tagFunctions[k]);
  1507. }
  1508. delete options.customTags;
  1509. }
  1510. /**
  1511. * Now anything left in `options` becomes a local:
  1512. */
  1513. for (var k in options) {
  1514. locals[k] = options[k];
  1515. }
  1516. /**
  1517. * Finally, execute the template:
  1518. */
  1519. return engine
  1520. .parseAndRender(str, locals)
  1521. .nodeify(function(err, result) {
  1522. if (err) {
  1523. throw new Error(err);
  1524. } else {
  1525. return cb(null, result);
  1526. }
  1527. });
  1528. } catch (err) {
  1529. cb(err);
  1530. }
  1531. });
  1532. };
  1533. /**
  1534. * Jade support.
  1535. */
  1536. exports.jade = function(path, options, cb) {
  1537. return promisify(cb, function(cb) {
  1538. var engine = requires.jade;
  1539. if (!engine) {
  1540. try {
  1541. engine = requires.jade = require('jade');
  1542. } catch (err) {
  1543. try {
  1544. engine = requires.jade = require('then-jade');
  1545. } catch (otherError) {
  1546. throw err;
  1547. }
  1548. }
  1549. }
  1550. try {
  1551. var tmpl = cache(options) || cache(options, engine.compileFile(path, options));
  1552. cb(null, tmpl(options));
  1553. } catch (err) {
  1554. cb(err);
  1555. }
  1556. });
  1557. };
  1558. /**
  1559. * Jade string support.
  1560. */
  1561. exports.jade.render = function(str, options, cb) {
  1562. return promisify(cb, function(cb) {
  1563. var engine = requires.jade;
  1564. if (!engine) {
  1565. try {
  1566. engine = requires.jade = require('jade');
  1567. } catch (err) {
  1568. try {
  1569. engine = requires.jade = require('then-jade');
  1570. } catch (otherError) {
  1571. throw err;
  1572. }
  1573. }
  1574. }
  1575. try {
  1576. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1577. cb(null, tmpl(options));
  1578. } catch (err) {
  1579. cb(err);
  1580. }
  1581. });
  1582. };
  1583. /**
  1584. * Dust support.
  1585. */
  1586. exports.dust = fromStringRenderer('dust');
  1587. /**
  1588. * Dust string support.
  1589. */
  1590. exports.dust.render = function(str, options, cb) {
  1591. return promisify(cb, function(cb) {
  1592. var engine = requires.dust;
  1593. if (!engine) {
  1594. try {
  1595. engine = requires.dust = require('dust');
  1596. } catch (err) {
  1597. try {
  1598. engine = requires.dust = require('dustjs-helpers');
  1599. } catch (err) {
  1600. engine = requires.dust = require('dustjs-linkedin');
  1601. }
  1602. }
  1603. }
  1604. var ext = 'dust';
  1605. var views = '.';
  1606. if (options) {
  1607. if (options.ext) ext = options.ext;
  1608. if (options.views) views = options.views;
  1609. if (options.settings && options.settings.views) views = options.settings.views;
  1610. }
  1611. if (!options || (options && !options.cache)) engine.cache = {};
  1612. engine.onLoad = function(path, callback) {
  1613. if (extname(path) === '') path += '.' + ext;
  1614. if (path[0] !== '/') path = views + '/' + path;
  1615. read(path, options, callback);
  1616. };
  1617. try {
  1618. var templateName;
  1619. if (options.filename) {
  1620. templateName = options.filename.replace(new RegExp('^' + views + '/'), '').replace(new RegExp('\\.' + ext), '');
  1621. }
  1622. var tmpl = cache(options) || cache(options, engine.compileFn(str, templateName));
  1623. tmpl(options, cb);
  1624. } catch (err) {
  1625. cb(err);
  1626. }
  1627. });
  1628. };
  1629. /**
  1630. * Swig support.
  1631. */
  1632. exports.swig = fromStringRenderer('swig');
  1633. /**
  1634. * Swig string support.
  1635. */
  1636. exports.swig.render = function(str, options, cb) {
  1637. return promisify(cb, function(cb) {
  1638. var engine = requires.swig;
  1639. if (!engine) {
  1640. try {
  1641. engine = requires.swig = require('swig');
  1642. } catch (err) {
  1643. try {
  1644. engine = requires.swig = require('swig-templates');
  1645. } catch (otherError) {
  1646. throw err;
  1647. }
  1648. }
  1649. }
  1650. try {
  1651. if (options.cache === true) options.cache = 'memory';
  1652. engine.setDefaults({ cache: options.cache });
  1653. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1654. cb(null, tmpl(options));
  1655. } catch (err) {
  1656. cb(err);
  1657. }
  1658. });
  1659. };
  1660. /**
  1661. * Razor support.
  1662. */
  1663. exports.razor = function(path, options, cb) {
  1664. return promisify(cb, function(cb) {
  1665. var engine = requires.razor;
  1666. if (!engine) {
  1667. try {
  1668. engine = requires.razor = require('razor-tmpl');
  1669. } catch (err) {
  1670. throw err;
  1671. }
  1672. }
  1673. try {
  1674. var tmpl = cache(options) || cache(options, (locals) => {
  1675. console.log('Rendering razor file', path);
  1676. return engine.renderFileSync(path, locals);
  1677. });
  1678. cb(null, tmpl(options));
  1679. } catch (err) {
  1680. cb(err);
  1681. }
  1682. });
  1683. };
  1684. /**
  1685. * razor string support.
  1686. */
  1687. exports.razor.render = function(str, options, cb) {
  1688. return promisify(cb, function(cb) {
  1689. try {
  1690. var engine = requires.razor = require('razor-tmpl');
  1691. } catch (err) {
  1692. throw err;
  1693. }
  1694. try {
  1695. var tf = engine.compile(str);
  1696. var tmpl = cache(options) || cache(options, tf);
  1697. cb(null, tmpl(options));
  1698. } catch (err) {
  1699. cb(err);
  1700. }
  1701. });
  1702. };
  1703. /**
  1704. * Atpl support.
  1705. */
  1706. exports.atpl = fromStringRenderer('atpl');
  1707. /**
  1708. * Atpl string support.
  1709. */
  1710. exports.atpl.render = function(str, options, cb) {
  1711. return promisify(cb, function(cb) {
  1712. var engine = requires.atpl || (requires.atpl = require('atpl'));
  1713. try {
  1714. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1715. cb(null, tmpl(options));
  1716. } catch (err) {
  1717. cb(err);
  1718. }
  1719. });
  1720. };
  1721. /**
  1722. * Liquor support,
  1723. */
  1724. exports.liquor = fromStringRenderer('liquor');
  1725. /**
  1726. * Liquor string support.
  1727. */
  1728. exports.liquor.render = function(str, options, cb) {
  1729. return promisify(cb, function(cb) {
  1730. var engine = requires.liquor || (requires.liquor = require('liquor'));
  1731. try {
  1732. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1733. cb(null, tmpl(options));
  1734. } catch (err) {
  1735. cb(err);
  1736. }
  1737. });
  1738. };
  1739. /**
  1740. * Twig support.
  1741. */
  1742. exports.twig = fromStringRenderer('twig');
  1743. /**
  1744. * Twig string support.
  1745. */
  1746. exports.twig.render = function(str, options, cb) {
  1747. return promisify(cb, function(cb) {
  1748. var engine = requires.twig || (requires.twig = require('twig').twig);
  1749. var templateData = {
  1750. data: str,
  1751. allowInlineIncludes: options.allowInlineIncludes,
  1752. namespaces: options.namespaces,
  1753. path: options.path
  1754. };
  1755. try {
  1756. var tmpl = cache(templateData) || cache(templateData, engine(templateData));
  1757. cb(null, tmpl.render(options));
  1758. } catch (err) {
  1759. cb(err);
  1760. }
  1761. });
  1762. };
  1763. /**
  1764. * EJS support.
  1765. */
  1766. exports.ejs = fromStringRenderer('ejs');
  1767. /**
  1768. * EJS string support.
  1769. */
  1770. exports.ejs.render = function(str, options, cb) {
  1771. return promisify(cb, function(cb) {
  1772. var engine = requires.ejs || (requires.ejs = require('ejs'));
  1773. try {
  1774. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1775. cb(null, tmpl(options));
  1776. } catch (err) {
  1777. cb(err);
  1778. }
  1779. });
  1780. };
  1781. /**
  1782. * Eco support.
  1783. */
  1784. exports.eco = fromStringRenderer('eco');
  1785. /**
  1786. * Eco string support.
  1787. */
  1788. exports.eco.render = function(str, options, cb) {
  1789. return promisify(cb, function(cb) {
  1790. var engine = requires.eco || (requires.eco = require('eco'));
  1791. try {
  1792. cb(null, engine.render(str, options));
  1793. } catch (err) {
  1794. cb(err);
  1795. }
  1796. });
  1797. };
  1798. /**
  1799. * Jazz support.
  1800. */
  1801. exports.jazz = fromStringRenderer('jazz');
  1802. /**
  1803. * Jazz string support.
  1804. */
  1805. exports.jazz.render = function(str, options, cb) {
  1806. return promisify(cb, function(cb) {
  1807. var engine = requires.jazz || (requires.jazz = require('jazz'));
  1808. try {
  1809. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1810. tmpl.eval(options, function(str) {
  1811. cb(null, str);
  1812. });
  1813. } catch (err) {
  1814. cb(err);
  1815. }
  1816. });
  1817. };
  1818. /**
  1819. * JQTPL support.
  1820. */
  1821. exports.jqtpl = fromStringRenderer('jqtpl');
  1822. /**
  1823. * JQTPL string support.
  1824. */
  1825. exports.jqtpl.render = function(str, options, cb) {
  1826. return promisify(cb, function(cb) {
  1827. var engine = requires.jqtpl || (requires.jqtpl = require('jqtpl'));
  1828. try {
  1829. engine.template(str, str);
  1830. cb(null, engine.tmpl(str, options));
  1831. } catch (err) {
  1832. cb(err);
  1833. }
  1834. });
  1835. };
  1836. /**
  1837. * Haml support.
  1838. */
  1839. exports.haml = fromStringRenderer('haml');
  1840. /**
  1841. * Haml string support.
  1842. */
  1843. exports.haml.render = function(str, options, cb) {
  1844. return promisify(cb, function(cb) {
  1845. var engine = requires.haml || (requires.haml = require('hamljs'));
  1846. try {
  1847. options.locals = options;
  1848. cb(null, engine.render(str, options).trimLeft());
  1849. } catch (err) {
  1850. cb(err);
  1851. }
  1852. });
  1853. };
  1854. /**
  1855. * Hamlet support.
  1856. */
  1857. exports.hamlet = fromStringRenderer('hamlet');
  1858. /**
  1859. * Hamlet string support.
  1860. */
  1861. exports.hamlet.render = function(str, options, cb) {
  1862. return promisify(cb, function(cb) {
  1863. var engine = requires.hamlet || (requires.hamlet = require('hamlet'));
  1864. try {
  1865. options.locals = options;
  1866. cb(null, engine.render(str, options).trimLeft());
  1867. } catch (err) {
  1868. cb(err);
  1869. }
  1870. });
  1871. };
  1872. /**
  1873. * Whiskers support.
  1874. */
  1875. exports.whiskers = function(path, options, cb) {
  1876. return promisify(cb, function(cb) {
  1877. var engine = requires.whiskers || (requires.whiskers = require('whiskers'));
  1878. engine.__express(path, options, cb);
  1879. });
  1880. };
  1881. /**
  1882. * Whiskers string support.
  1883. */
  1884. exports.whiskers.render = function(str, options, cb) {
  1885. return promisify(cb, function(cb) {
  1886. var engine = requires.whiskers || (requires.whiskers = require('whiskers'));
  1887. try {
  1888. cb(null, engine.render(str, options));
  1889. } catch (err) {
  1890. cb(err);
  1891. }
  1892. });
  1893. };
  1894. /**
  1895. * Coffee-HAML support.
  1896. */
  1897. exports['haml-coffee'] = fromStringRenderer('haml-coffee');
  1898. /**
  1899. * Coffee-HAML string support.
  1900. */
  1901. exports['haml-coffee'].render = function(str, options, cb) {
  1902. return promisify(cb, function(cb) {
  1903. var engine = requires['haml-coffee'] || (requires['haml-coffee'] = require('haml-coffee'));
  1904. try {
  1905. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1906. cb(null, tmpl(options));
  1907. } catch (err) {
  1908. cb(err);
  1909. }
  1910. });
  1911. };
  1912. /**
  1913. * Hogan support.
  1914. */
  1915. exports.hogan = fromStringRenderer('hogan');
  1916. /**
  1917. * Hogan string support.
  1918. */
  1919. exports.hogan.render = function(str, options, cb) {
  1920. return promisify(cb, function(cb) {
  1921. var engine = requires.hogan || (requires.hogan = require('hogan.js'));
  1922. try {
  1923. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1924. cb(null, tmpl.render(options, options.partials));
  1925. } catch (err) {
  1926. cb(err);
  1927. }
  1928. });
  1929. };
  1930. /**
  1931. * templayed.js support.
  1932. */
  1933. exports.templayed = fromStringRenderer('templayed');
  1934. /**
  1935. * templayed.js string support.
  1936. */
  1937. exports.templayed.render = function(str, options, cb) {
  1938. return promisify(cb, function(cb) {
  1939. var engine = requires.templayed || (requires.templayed = require('templayed'));
  1940. try {
  1941. var tmpl = cache(options) || cache(options, engine(str));
  1942. cb(null, tmpl(options));
  1943. } catch (err) {
  1944. cb(err);
  1945. }
  1946. });
  1947. };
  1948. /**
  1949. * Handlebars support.
  1950. */
  1951. exports.handlebars = fromStringRenderer('handlebars');
  1952. /**
  1953. * Handlebars string support.
  1954. */
  1955. exports.handlebars.render = function(str, options, cb) {
  1956. return promisify(cb, function(cb) {
  1957. var engine = requires.handlebars || (requires.handlebars = require('handlebars'));
  1958. try {
  1959. for (var partial in options.partials) {
  1960. engine.registerPartial(partial, options.partials[partial]);
  1961. }
  1962. for (var helper in options.helpers) {
  1963. engine.registerHelper(helper, options.helpers[helper]);
  1964. }
  1965. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1966. cb(null, tmpl(options));
  1967. } catch (err) {
  1968. cb(err);
  1969. }
  1970. });
  1971. };
  1972. /**
  1973. * Underscore support.
  1974. */
  1975. exports.underscore = fromStringRenderer('underscore');
  1976. /**
  1977. * Underscore string support.
  1978. */
  1979. exports.underscore.render = function(str, options, cb) {
  1980. return promisify(cb, function(cb) {
  1981. var engine = requires.underscore || (requires.underscore = require('underscore'));
  1982. try {
  1983. const partials = {};
  1984. for (var partial in options.partials) {
  1985. partials[partial] = engine.template(options.partials[partial]);
  1986. }
  1987. options.partials = partials;
  1988. var tmpl = cache(options) || cache(options, engine.template(str, null, options));
  1989. cb(null, tmpl(options).replace(/\n$/, ''));
  1990. } catch (err) {
  1991. cb(err);
  1992. }
  1993. });
  1994. };
  1995. /**
  1996. * Lodash support.
  1997. */
  1998. exports.lodash = fromStringRenderer('lodash');
  1999. /**
  2000. * Lodash string support.
  2001. */
  2002. exports.lodash.render = function(str, options, cb) {
  2003. return promisify(cb, function(cb) {
  2004. var engine = requires.lodash || (requires.lodash = require('lodash'));
  2005. try {
  2006. var tmpl = cache(options) || cache(options, engine.template(str, options));
  2007. cb(null, tmpl(options).replace(/\n$/, ''));
  2008. } catch (err) {
  2009. cb(err);
  2010. }
  2011. });
  2012. };
  2013. /**
  2014. * Pug support. (formerly Jade)
  2015. */
  2016. exports.pug = function(path, options, cb) {
  2017. return promisify(cb, function(cb) {
  2018. var engine = requires.pug;
  2019. if (!engine) {
  2020. try {
  2021. engine = requires.pug = require('pug');
  2022. } catch (err) {
  2023. try {
  2024. engine = requires.pug = require('then-pug');
  2025. } catch (otherError) {
  2026. throw err;
  2027. }
  2028. }
  2029. }
  2030. try {
  2031. var tmpl = cache(options) || cache(options, engine.compileFile(path, options));
  2032. cb(null, tmpl(options));
  2033. } catch (err) {
  2034. cb(err);
  2035. }
  2036. });
  2037. };
  2038. /**
  2039. * Pug string support.
  2040. */
  2041. exports.pug.render = function(str, options, cb) {
  2042. return promisify(cb, function(cb) {
  2043. var engine = requires.pug;
  2044. if (!engine) {
  2045. try {
  2046. engine = requires.pug = require('pug');
  2047. } catch (err) {
  2048. try {
  2049. engine = requires.pug = require('then-pug');
  2050. } catch (otherError) {
  2051. throw err;
  2052. }
  2053. }
  2054. }
  2055. try {
  2056. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  2057. cb(null, tmpl(options));
  2058. } catch (err) {
  2059. cb(err);
  2060. }
  2061. });
  2062. };
  2063. /**
  2064. * QEJS support.
  2065. */
  2066. exports.qejs = fromStringRenderer('qejs');
  2067. /**
  2068. * QEJS string support.
  2069. */
  2070. exports.qejs.render = function(str, options, cb) {
  2071. return promisify(cb, function(cb) {
  2072. try {
  2073. var engine = requires.qejs || (requires.qejs = require('qejs'));
  2074. engine.render(str, options).then(function(result) {
  2075. cb(null, result);
  2076. }, function(err) {
  2077. cb(err);
  2078. }).done();
  2079. } catch (err) {
  2080. cb(err);
  2081. }
  2082. });
  2083. };
  2084. /**
  2085. * Walrus support.
  2086. */
  2087. exports.walrus = fromStringRenderer('walrus');
  2088. /**
  2089. * Walrus string support.
  2090. */
  2091. exports.walrus.render = function(str, options, cb) {
  2092. return promisify(cb, function(cb) {
  2093. var engine = requires.walrus || (requires.walrus = require('walrus'));
  2094. try {
  2095. var tmpl = cache(options) || cache(options, engine.parse(str));
  2096. cb(null, tmpl.compile(options));
  2097. } catch (err) {
  2098. cb(err);
  2099. }
  2100. });
  2101. };
  2102. /**
  2103. * Mustache support.
  2104. */
  2105. exports.mustache = fromStringRenderer('mustache');
  2106. /**
  2107. * Mustache string support.
  2108. */
  2109. exports.mustache.render = function(str, options, cb) {
  2110. return promisify(cb, function(cb) {
  2111. var engine = requires.mustache || (requires.mustache = require('mustache'));
  2112. try {
  2113. cb(null, engine.render(str, options, options.partials));
  2114. } catch (err) {
  2115. cb(err);
  2116. }
  2117. });
  2118. };
  2119. /**
  2120. * Just support.
  2121. */
  2122. exports.just = function(path, options, cb) {
  2123. return promisify(cb, function(cb) {
  2124. var engine = requires.just;
  2125. if (!engine) {
  2126. var JUST = require('just');
  2127. engine = requires.just = new JUST();
  2128. }
  2129. engine.configure({ useCache: options.cache });
  2130. engine.render(path, options, cb);
  2131. });
  2132. };
  2133. /**
  2134. * Just string support.
  2135. */
  2136. exports.just.render = function(str, options, cb) {
  2137. return promisify(cb, function(cb) {
  2138. var JUST = require('just');
  2139. var engine = new JUST({ root: { page: str }});
  2140. engine.render('page', options, cb);
  2141. });
  2142. };
  2143. /**
  2144. * ECT support.
  2145. */
  2146. exports.ect = function(path, options, cb) {
  2147. return promisify(cb, function(cb) {
  2148. var engine = requires.ect;
  2149. if (!engine) {
  2150. var ECT = require('ect');
  2151. engine = requires.ect = new ECT(options);
  2152. }
  2153. engine.configure({ cache: options.cache });
  2154. engine.render(path, options, cb);
  2155. });
  2156. };
  2157. /**
  2158. * ECT string support.
  2159. */
  2160. exports.ect.render = function(str, options, cb) {
  2161. return promisify(cb, function(cb) {
  2162. var ECT = require('ect');
  2163. var engine = new ECT({ root: { page: str }});
  2164. engine.render('page', options, cb);
  2165. });
  2166. };
  2167. /**
  2168. * mote support.
  2169. */
  2170. exports.mote = fromStringRenderer('mote');
  2171. /**
  2172. * mote string support.
  2173. */
  2174. exports.mote.render = function(str, options, cb) {
  2175. return promisify(cb, function(cb) {
  2176. var engine = requires.mote || (requires.mote = require('mote'));
  2177. try {
  2178. var tmpl = cache(options) || cache(options, engine.compile(str));
  2179. cb(null, tmpl(options));
  2180. } catch (err) {
  2181. cb(err);
  2182. }
  2183. });
  2184. };
  2185. /**
  2186. * Toffee support.
  2187. */
  2188. exports.toffee = function(path, options, cb) {
  2189. return promisify(cb, function(cb) {
  2190. var toffee = requires.toffee || (requires.toffee = require('toffee'));
  2191. toffee.__consolidate_engine_render(path, options, cb);
  2192. });
  2193. };
  2194. /**
  2195. * Toffee string support.
  2196. */
  2197. exports.toffee.render = function(str, options, cb) {
  2198. return promisify(cb, function(cb) {
  2199. var engine = requires.toffee || (requires.toffee = require('toffee'));
  2200. try {
  2201. engine.str_render(str, options, cb);
  2202. } catch (err) {
  2203. cb(err);
  2204. }
  2205. });
  2206. };
  2207. /**
  2208. * doT support.
  2209. */
  2210. exports.dot = fromStringRenderer('dot');
  2211. /**
  2212. * doT string support.
  2213. */
  2214. exports.dot.render = function(str, options, cb) {
  2215. return promisify(cb, function(cb) {
  2216. var engine = requires.dot || (requires.dot = require('dot'));
  2217. var extend = (requires.extend || (requires.extend = util__default._extend));
  2218. try {
  2219. var settings = {};
  2220. settings = extend(settings, engine.templateSettings);
  2221. settings = extend(settings, options ? options.dot : {});
  2222. var tmpl = cache(options) || cache(options, engine.template(str, settings, options));
  2223. cb(null, tmpl(options));
  2224. } catch (err) {
  2225. cb(err);
  2226. }
  2227. });
  2228. };
  2229. /**
  2230. * bracket support.
  2231. */
  2232. exports.bracket = fromStringRenderer('bracket');
  2233. /**
  2234. * bracket string support.
  2235. */
  2236. exports.bracket.render = function(str, options, cb) {
  2237. return promisify(cb, function(cb) {
  2238. var engine = requires.bracket || (requires.bracket = require('bracket-template'));
  2239. try {
  2240. var tmpl = cache(options) || cache(options, engine.default.compile(str, options));
  2241. cb(null, tmpl(options));
  2242. } catch (err) {
  2243. cb(err);
  2244. }
  2245. });
  2246. };
  2247. /**
  2248. * Ractive support.
  2249. */
  2250. exports.ractive = fromStringRenderer('ractive');
  2251. /**
  2252. * Ractive string support.
  2253. */
  2254. exports.ractive.render = function(str, options, cb) {
  2255. return promisify(cb, function(cb) {
  2256. var Engine = requires.ractive || (requires.ractive = require('ractive'));
  2257. var template = cache(options) || cache(options, Engine.parse(str));
  2258. options.template = template;
  2259. if (options.data === null || options.data === undefined) {
  2260. var extend = (requires.extend || (requires.extend = util__default._extend));
  2261. // Shallow clone the options object
  2262. options.data = extend({}, options);
  2263. // Remove consolidate-specific properties from the clone
  2264. var i;
  2265. var length;
  2266. var properties = ['template', 'filename', 'cache', 'partials'];
  2267. for (i = 0, length = properties.length; i < length; i++) {
  2268. var property = properties[i];
  2269. delete options.data[property];
  2270. }
  2271. }
  2272. try {
  2273. cb(null, new Engine(options).toHTML());
  2274. } catch (err) {
  2275. cb(err);
  2276. }
  2277. });
  2278. };
  2279. /**
  2280. * Nunjucks support.
  2281. */
  2282. exports.nunjucks = fromStringRenderer('nunjucks');
  2283. /**
  2284. * Nunjucks string support.
  2285. */
  2286. exports.nunjucks.render = function(str, options, cb) {
  2287. return promisify(cb, function(cb) {
  2288. try {
  2289. var engine = options.nunjucksEnv || requires.nunjucks || (requires.nunjucks = require('nunjucks'));
  2290. var env = engine;
  2291. // deprecated fallback support for express
  2292. // <https://github.com/tj/consolidate.js/pull/152>
  2293. // <https://github.com/tj/consolidate.js/pull/224>
  2294. if (options.settings && options.settings.views) {
  2295. env = engine.configure(options.settings.views);
  2296. } else if (options.nunjucks && options.nunjucks.configure) {
  2297. env = engine.configure.apply(engine, options.nunjucks.configure);
  2298. }
  2299. //
  2300. // because `renderString` does not initiate loaders
  2301. // we must manually create a loader for it based off
  2302. // either `options.settings.views` or `options.nunjucks` or `options.nunjucks.root`
  2303. //
  2304. // <https://github.com/mozilla/nunjucks/issues/730>
  2305. // <https://github.com/crocodilejs/node-email-templates/issues/182>
  2306. //
  2307. // so instead we simply check if we passed a custom loader
  2308. // otherwise we create a simple file based loader
  2309. if (options.loader) {
  2310. env = new engine.Environment(options.loader);
  2311. } else if (options.settings && options.settings.views) {
  2312. env = new engine.Environment(
  2313. new engine.FileSystemLoader(options.settings.views)
  2314. );
  2315. } else if (options.nunjucks && options.nunjucks.loader) {
  2316. if (typeof options.nunjucks.loader === 'string') {
  2317. env = new engine.Environment(new engine.FileSystemLoader(options.nunjucks.loader));
  2318. } else {
  2319. env = new engine.Environment(
  2320. new engine.FileSystemLoader(
  2321. options.nunjucks.loader[0],
  2322. options.nunjucks.loader[1]
  2323. )
  2324. );
  2325. }
  2326. }
  2327. env.renderString(str, options, cb);
  2328. } catch (err) {
  2329. throw cb(err);
  2330. }
  2331. });
  2332. };
  2333. /**
  2334. * HTMLing support.
  2335. */
  2336. exports.htmling = fromStringRenderer('htmling');
  2337. /**
  2338. * HTMLing string support.
  2339. */
  2340. exports.htmling.render = function(str, options, cb) {
  2341. return promisify(cb, function(cb) {
  2342. var engine = requires.htmling || (requires.htmling = require('htmling'));
  2343. try {
  2344. var tmpl = cache(options) || cache(options, engine.string(str));
  2345. cb(null, tmpl.render(options));
  2346. } catch (err) {
  2347. cb(err);
  2348. }
  2349. });
  2350. };
  2351. /**
  2352. * Rendering function
  2353. */
  2354. function requireReact(module, filename) {
  2355. var babel = requires.babel || (requires.babel = require('babel-core'));
  2356. var compiled = babel.transformFileSync(filename, { presets: [ 'react' ] }).code;
  2357. return module._compile(compiled, filename);
  2358. }
  2359. exports.requireReact = requireReact;
  2360. /**
  2361. * Converting a string into a node module.
  2362. */
  2363. function requireReactString(src, filename) {
  2364. var babel = requires.babel || (requires.babel = require('babel-core'));
  2365. if (!filename) filename = '';
  2366. var m = new module.constructor();
  2367. filename = filename || '';
  2368. // Compile Using React
  2369. var compiled = babel.transform(src, { presets: [ 'react' ] }).code;
  2370. // Compile as a module
  2371. m.paths = module.paths;
  2372. m._compile(compiled, filename);
  2373. return m.exports;
  2374. }
  2375. /**
  2376. * A naive helper to replace {{tags}} with options.tags content
  2377. */
  2378. function reactBaseTmpl(data, options) {
  2379. var exp;
  2380. var regex;
  2381. // Iterates through the keys in file object
  2382. // and interpolate / replace {{key}} with it's value
  2383. for (var k in options) {
  2384. if (options.hasOwnProperty(k)) {
  2385. exp = '{{' + k + '}}';
  2386. regex = new RegExp(exp, 'g');
  2387. if (data.match(regex)) {
  2388. data = data.replace(regex, options[k]);
  2389. }
  2390. }
  2391. }
  2392. return data;
  2393. }
  2394. /**
  2395. * Plates Support.
  2396. */
  2397. exports.plates = fromStringRenderer('plates');
  2398. /**
  2399. * Plates string support.
  2400. */
  2401. exports.plates.render = function(str, options, cb) {
  2402. return promisify(cb, function(cb) {
  2403. var engine = requires.plates || (requires.plates = require('plates'));
  2404. var map = options.map || undefined;
  2405. try {
  2406. var tmpl = engine.bind(str, options, map);
  2407. cb(null, tmpl);
  2408. } catch (err) {
  2409. cb(err);
  2410. }
  2411. });
  2412. };
  2413. /**
  2414. * The main render parser for React bsaed templates
  2415. */
  2416. function reactRenderer(type) {
  2417. if (commonjsRequire.extensions) {
  2418. // Ensure JSX is transformed on require
  2419. if (!commonjsRequire.extensions['.jsx']) {
  2420. commonjsRequire.extensions['.jsx'] = requireReact;
  2421. }
  2422. // Supporting .react extension as well as test cases
  2423. // Using .react extension is not recommended.
  2424. if (!commonjsRequire.extensions['.react']) {
  2425. commonjsRequire.extensions['.react'] = requireReact;
  2426. }
  2427. }
  2428. // Return rendering fx
  2429. return function(str, options, cb) {
  2430. return promisify(cb, function(cb) {
  2431. // React Import
  2432. var ReactDOM = requires.ReactDOM || (requires.ReactDOM = require('react-dom/server'));
  2433. var react = requires.react || (requires.react = require('react'));
  2434. // Assign HTML Base
  2435. var base = options.base;
  2436. delete options.base;
  2437. var enableCache = options.cache;
  2438. delete options.cache;
  2439. var isNonStatic = options.isNonStatic;
  2440. delete options.isNonStatic;
  2441. // Start Conversion
  2442. try {
  2443. var Code;
  2444. var Factory;
  2445. var baseStr;
  2446. var content;
  2447. var parsed;
  2448. if (!cache(options)) {
  2449. // Parsing
  2450. if (type === 'path') {
  2451. var path = resolve(str);
  2452. delete require.cache[path];
  2453. Code = commonjsRequire(path);
  2454. } else {
  2455. Code = requireReactString(str);
  2456. }
  2457. Factory = cache(options, react.createFactory(Code));
  2458. } else {
  2459. Factory = cache(options);
  2460. }
  2461. parsed = new Factory(options);
  2462. content = (isNonStatic) ? ReactDOM.renderToString(parsed) : ReactDOM.renderToStaticMarkup(parsed);
  2463. if (base) {
  2464. baseStr = readCache[str] || fs__default.readFileSync(resolve(base), 'utf8');
  2465. if (enableCache) {
  2466. readCache[str] = baseStr;
  2467. }
  2468. options.content = content;
  2469. content = reactBaseTmpl(baseStr, options);
  2470. }
  2471. cb(null, content);
  2472. } catch (err) {
  2473. cb(err);
  2474. }
  2475. });
  2476. };
  2477. }
  2478. /**
  2479. * React JS Support
  2480. */
  2481. exports.react = reactRenderer('path');
  2482. /**
  2483. * React JS string support.
  2484. */
  2485. exports.react.render = reactRenderer('string');
  2486. /**
  2487. * ARC-templates support.
  2488. */
  2489. exports['arc-templates'] = fromStringRenderer('arc-templates');
  2490. /**
  2491. * ARC-templates string support.
  2492. */
  2493. exports['arc-templates'].render = function(str, options, cb) {
  2494. var readFileWithOptions = util__default.promisify(read);
  2495. var consolidateFileSystem = {};
  2496. consolidateFileSystem.readFile = function(path) {
  2497. return readFileWithOptions(path, options);
  2498. };
  2499. return promisify(cb, function(cb) {
  2500. try {
  2501. var engine = requires['arc-templates'];
  2502. if (!engine) {
  2503. var Engine = require('arc-templates/dist/es5');
  2504. engine = requires['arc-templates'] = new Engine({ filesystem: consolidateFileSystem });
  2505. }
  2506. var compiler = cache(options) || cache(options, engine.compileString(str, options.filename));
  2507. compiler.then(function(func) { return func(options); })
  2508. .then(function(result) { cb(null, result.content); })
  2509. .catch(cb);
  2510. } catch (err) {
  2511. cb(err);
  2512. }
  2513. });
  2514. };
  2515. /**
  2516. * Vash support
  2517. */
  2518. exports.vash = fromStringRenderer('vash');
  2519. /**
  2520. * Vash string support
  2521. */
  2522. exports.vash.render = function(str, options, cb) {
  2523. return promisify(cb, function(cb) {
  2524. var engine = requires.vash || (requires.vash = require('vash'));
  2525. try {
  2526. // helper system : https://github.com/kirbysayshi/vash#helper-system
  2527. if (options.helpers) {
  2528. for (var key in options.helpers) {
  2529. if (!options.helpers.hasOwnProperty(key) || typeof options.helpers[key] !== 'function') {
  2530. continue;
  2531. }
  2532. engine.helpers[key] = options.helpers[key];
  2533. }
  2534. }
  2535. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  2536. tmpl(options, function sealLayout(err, ctx) {
  2537. if (err) cb(err);
  2538. ctx.finishLayout();
  2539. cb(null, ctx.toString().replace(/\n$/, ''));
  2540. });
  2541. } catch (err) {
  2542. cb(err);
  2543. }
  2544. });
  2545. };
  2546. /**
  2547. * Slm support.
  2548. */
  2549. exports.slm = fromStringRenderer('slm');
  2550. /**
  2551. * Slm string support.
  2552. */
  2553. exports.slm.render = function(str, options, cb) {
  2554. return promisify(cb, function(cb) {
  2555. var engine = requires.slm || (requires.slm = require('slm'));
  2556. try {
  2557. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  2558. cb(null, tmpl(options));
  2559. } catch (err) {
  2560. cb(err);
  2561. }
  2562. });
  2563. };
  2564. /**
  2565. * Marko support.
  2566. */
  2567. exports.marko = function(path, options, cb) {
  2568. return promisify(cb, function(cb) {
  2569. var engine = requires.marko || (requires.marko = require('marko'));
  2570. options.writeToDisk = !!options.cache;
  2571. try {
  2572. var tmpl = cache(options) || cache(options, engine.load(path, options));
  2573. tmpl.renderToString(options, cb);
  2574. } catch (err) {
  2575. cb(err);
  2576. }
  2577. });
  2578. };
  2579. /**
  2580. * Marko string support.
  2581. */
  2582. exports.marko.render = function(str, options, cb) {
  2583. return promisify(cb, function(cb) {
  2584. var engine = requires.marko || (requires.marko = require('marko'));
  2585. options.writeToDisk = !!options.cache;
  2586. options.filename = options.filename || 'string.marko';
  2587. try {
  2588. var tmpl = cache(options) || cache(options, engine.load(options.filename, str, options));
  2589. tmpl.renderToString(options, cb);
  2590. } catch (err) {
  2591. cb(err);
  2592. }
  2593. });
  2594. };
  2595. /**
  2596. * Teacup support.
  2597. */
  2598. exports.teacup = function(path, options, cb) {
  2599. return promisify(cb, function(cb) {
  2600. var engine = requires.teacup || (requires.teacup = require('teacup/lib/express'));
  2601. commonjsRequire.extensions['.teacup'] = commonjsRequire.extensions['.coffee'];
  2602. if (path[0] !== '/') {
  2603. path = join(process.cwd(), path);
  2604. }
  2605. if (!options.cache) {
  2606. var callback = cb;
  2607. cb = function() {
  2608. delete require.cache[path];
  2609. callback.apply(this, arguments);
  2610. };
  2611. }
  2612. engine.renderFile(path, options, cb);
  2613. });
  2614. };
  2615. /**
  2616. * Teacup string support.
  2617. */
  2618. exports.teacup.render = function(str, options, cb) {
  2619. var coffee = require('coffee-script');
  2620. var vm = require('vm');
  2621. var sandbox = {
  2622. module: {exports: {}},
  2623. require: commonjsRequire
  2624. };
  2625. return promisify(cb, function(cb) {
  2626. vm.runInNewContext(coffee.compile(str), sandbox);
  2627. var tmpl = sandbox.module.exports;
  2628. cb(null, tmpl(options));
  2629. });
  2630. };
  2631. /**
  2632. * Squirrelly support.
  2633. */
  2634. exports.squirrelly = fromStringRenderer('squirrelly');
  2635. /**
  2636. * Squirrelly string support.
  2637. */
  2638. exports.squirrelly.render = function(str, options, cb) {
  2639. return promisify(cb, function(cb) {
  2640. var engine = requires.squirrelly || (requires.squirrelly = require('squirrelly'));
  2641. try {
  2642. for (var partial in options.partials) {
  2643. engine.definePartial(partial, options.partials[partial]);
  2644. }
  2645. for (var helper in options.helpers) {
  2646. engine.defineHelper(helper, options.helpers[helper]);
  2647. }
  2648. var tmpl = cache(options) || cache(options, engine.Compile(str, options));
  2649. cb(null, tmpl(options, engine));
  2650. } catch (err) {
  2651. cb(err);
  2652. }
  2653. });
  2654. };
  2655. /**
  2656. * Twing support.
  2657. */
  2658. exports.twing = fromStringRenderer('twing');
  2659. /**
  2660. * Twing string support.
  2661. */
  2662. exports.twing.render = function(str, options, cb) {
  2663. return promisify(cb, function(cb) {
  2664. var engine = requires.twing || (requires.twing = require('twing'));
  2665. try {
  2666. new engine.TwingEnvironment(new engine.TwingLoaderNull()).createTemplate(str).then((twingTemplate) => {
  2667. twingTemplate.render(options).then((rendTmpl) => {
  2668. var tmpl = cache(options) || cache(options, rendTmpl);
  2669. cb(null, tmpl);
  2670. });
  2671. });
  2672. } catch (err) {
  2673. cb(err);
  2674. }
  2675. });
  2676. };
  2677. /**
  2678. * expose the instance of the engine
  2679. */
  2680. exports.requires = requires;
  2681. });
  2682. var consolidate$1 = consolidate;
  2683. const hasWarned = {};
  2684. function warnOnce(msg) {
  2685. const isNodeProd = typeof process !== 'undefined' && process.env.NODE_ENV === 'production';
  2686. if (!isNodeProd && !false && !hasWarned[msg]) {
  2687. hasWarned[msg] = true;
  2688. warn(msg);
  2689. }
  2690. }
  2691. function warn(msg) {
  2692. console.warn(`\x1b[1m\x1b[33m[@vue/compiler-sfc]\x1b[0m\x1b[33m ${msg}\x1b[0m\n`);
  2693. }
  2694. function preprocess({ source, filename, preprocessOptions }, preprocessor) {
  2695. // Consolidate exposes a callback based API, but the callback is in fact
  2696. // called synchronously for most templating engines. In our case, we have to
  2697. // expose a synchronous API so that it is usable in Jest transforms (which
  2698. // have to be sync because they are applied via Node.js require hooks)
  2699. let res = '';
  2700. let err = null;
  2701. preprocessor.render(source, { filename, ...preprocessOptions }, (_err, _res) => {
  2702. if (_err)
  2703. err = _err;
  2704. res = _res;
  2705. });
  2706. if (err)
  2707. throw err;
  2708. return res;
  2709. }
  2710. function compileTemplate(options) {
  2711. const { preprocessLang, preprocessCustomRequire } = options;
  2712. const preprocessor = preprocessLang
  2713. ? preprocessCustomRequire
  2714. ? preprocessCustomRequire(preprocessLang)
  2715. : consolidate$1[preprocessLang]
  2716. : false;
  2717. if (preprocessor) {
  2718. try {
  2719. return doCompileTemplate({
  2720. ...options,
  2721. source: preprocess(options, preprocessor)
  2722. });
  2723. }
  2724. catch (e) {
  2725. return {
  2726. code: `export default function render() {}`,
  2727. source: options.source,
  2728. tips: [],
  2729. errors: [e]
  2730. };
  2731. }
  2732. }
  2733. else if (preprocessLang) {
  2734. return {
  2735. code: `export default function render() {}`,
  2736. source: options.source,
  2737. tips: [
  2738. `Component ${options.filename} uses lang ${preprocessLang} for template. Please install the language preprocessor.`
  2739. ],
  2740. errors: [
  2741. `Component ${options.filename} uses lang ${preprocessLang} for template, however it is not installed.`
  2742. ]
  2743. };
  2744. }
  2745. else {
  2746. return doCompileTemplate(options);
  2747. }
  2748. }
  2749. function doCompileTemplate({ filename, id, scoped, slotted, inMap, source, ssr = false, ssrCssVars, isProd = false, compiler = ssr ? CompilerSSR__namespace : CompilerDOM__namespace, compilerOptions = {}, transformAssetUrls }) {
  2750. const errors = [];
  2751. const warnings = [];
  2752. let nodeTransforms = [];
  2753. if (shared.isObject(transformAssetUrls)) {
  2754. const assetOptions = normalizeOptions(transformAssetUrls);
  2755. nodeTransforms = [
  2756. createAssetUrlTransformWithOptions(assetOptions),
  2757. createSrcsetTransformWithOptions(assetOptions)
  2758. ];
  2759. }
  2760. else if (transformAssetUrls !== false) {
  2761. nodeTransforms = [transformAssetUrl, transformSrcset];
  2762. }
  2763. if (ssr && !ssrCssVars) {
  2764. warnOnce(`compileTemplate is called with \`ssr: true\` but no ` +
  2765. `corresponding \`cssVars\` option.\`.`);
  2766. }
  2767. if (!id) {
  2768. warnOnce(`compileTemplate now requires the \`id\` option.\`.`);
  2769. id = '';
  2770. }
  2771. const shortId = id.replace(/^data-v-/, '');
  2772. const longId = `data-v-${shortId}`;
  2773. let { code, ast, preamble, map } = compiler.compile(source, {
  2774. mode: 'module',
  2775. prefixIdentifiers: true,
  2776. hoistStatic: true,
  2777. cacheHandlers: true,
  2778. ssrCssVars: ssr && ssrCssVars && ssrCssVars.length
  2779. ? genCssVarsFromList(ssrCssVars, shortId, isProd, true)
  2780. : '',
  2781. scopeId: scoped ? longId : undefined,
  2782. slotted,
  2783. sourceMap: true,
  2784. ...compilerOptions,
  2785. nodeTransforms: nodeTransforms.concat(compilerOptions.nodeTransforms || []),
  2786. filename,
  2787. onError: e => errors.push(e),
  2788. onWarn: w => warnings.push(w)
  2789. });
  2790. // inMap should be the map produced by ./parse.ts which is a simple line-only
  2791. // mapping. If it is present, we need to adjust the final map and errors to
  2792. // reflect the original line numbers.
  2793. if (inMap) {
  2794. if (map) {
  2795. map = mapLines(inMap, map);
  2796. }
  2797. if (errors.length) {
  2798. patchErrors(errors, source, inMap);
  2799. }
  2800. }
  2801. const tips = warnings.map(w => {
  2802. let msg = w.message;
  2803. if (w.loc) {
  2804. msg += `\n${shared.generateCodeFrame(source, w.loc.start.offset, w.loc.end.offset)}`;
  2805. }
  2806. return msg;
  2807. });
  2808. return { code, ast, preamble, source, errors, tips, map };
  2809. }
  2810. function mapLines(oldMap, newMap) {
  2811. if (!oldMap)
  2812. return newMap;
  2813. if (!newMap)
  2814. return oldMap;
  2815. const oldMapConsumer = new sourceMap.SourceMapConsumer(oldMap);
  2816. const newMapConsumer = new sourceMap.SourceMapConsumer(newMap);
  2817. const mergedMapGenerator = new sourceMap.SourceMapGenerator();
  2818. newMapConsumer.eachMapping(m => {
  2819. if (m.originalLine == null) {
  2820. return;
  2821. }
  2822. const origPosInOldMap = oldMapConsumer.originalPositionFor({
  2823. line: m.originalLine,
  2824. column: m.originalColumn
  2825. });
  2826. if (origPosInOldMap.source == null) {
  2827. return;
  2828. }
  2829. mergedMapGenerator.addMapping({
  2830. generated: {
  2831. line: m.generatedLine,
  2832. column: m.generatedColumn
  2833. },
  2834. original: {
  2835. line: origPosInOldMap.line,
  2836. // use current column, since the oldMap produced by @vue/compiler-sfc
  2837. // does not
  2838. column: m.originalColumn
  2839. },
  2840. source: origPosInOldMap.source,
  2841. name: origPosInOldMap.name
  2842. });
  2843. });
  2844. // source-map's type definition is incomplete
  2845. const generator = mergedMapGenerator;
  2846. oldMapConsumer.sources.forEach((sourceFile) => {
  2847. generator._sources.add(sourceFile);
  2848. const sourceContent = oldMapConsumer.sourceContentFor(sourceFile);
  2849. if (sourceContent != null) {
  2850. mergedMapGenerator.setSourceContent(sourceFile, sourceContent);
  2851. }
  2852. });
  2853. generator._sourceRoot = oldMap.sourceRoot;
  2854. generator._file = oldMap.file;
  2855. return generator.toJSON();
  2856. }
  2857. function patchErrors(errors, source, inMap) {
  2858. const originalSource = inMap.sourcesContent[0];
  2859. const offset = originalSource.indexOf(source);
  2860. const lineOffset = originalSource.slice(0, offset).split(/\r?\n/).length - 1;
  2861. errors.forEach(err => {
  2862. if (err.loc) {
  2863. err.loc.start.line += lineOffset;
  2864. err.loc.start.offset += offset;
  2865. if (err.loc.end !== err.loc.start) {
  2866. err.loc.end.line += lineOffset;
  2867. err.loc.end.offset += offset;
  2868. }
  2869. }
  2870. });
  2871. }
  2872. const defaultExportRE = /((?:^|\n|;)\s*)export(\s*)default/;
  2873. const namedDefaultExportRE = /((?:^|\n|;)\s*)export(.+)(?:as)?(\s*)default/s;
  2874. const exportDefaultClassRE = /((?:^|\n|;)\s*)export\s+default\s+class\s+([\w$]+)/;
  2875. /**
  2876. * Utility for rewriting `export default` in a script block into a variable
  2877. * declaration so that we can inject things into it
  2878. */
  2879. function rewriteDefault(input, as, parserPlugins) {
  2880. if (!hasDefaultExport(input)) {
  2881. return input + `\nconst ${as} = {}`;
  2882. }
  2883. let replaced;
  2884. const classMatch = input.match(exportDefaultClassRE);
  2885. if (classMatch) {
  2886. replaced =
  2887. input.replace(exportDefaultClassRE, '$1class $2') +
  2888. `\nconst ${as} = ${classMatch[2]}`;
  2889. }
  2890. else {
  2891. replaced = input.replace(defaultExportRE, `$1const ${as} =`);
  2892. }
  2893. if (!hasDefaultExport(replaced)) {
  2894. return replaced;
  2895. }
  2896. // if the script somehow still contains `default export`, it probably has
  2897. // multi-line comments or template strings. fallback to a full parse.
  2898. const s = new MagicString__default(input);
  2899. const ast = parser$2.parse(input, {
  2900. sourceType: 'module',
  2901. plugins: parserPlugins
  2902. }).program.body;
  2903. ast.forEach(node => {
  2904. if (node.type === 'ExportDefaultDeclaration') {
  2905. if (node.declaration.type === 'ClassDeclaration') {
  2906. s.overwrite(node.start, node.declaration.id.start, `class `);
  2907. s.append(`\nconst ${as} = ${node.declaration.id.name}`);
  2908. }
  2909. else {
  2910. s.overwrite(node.start, node.declaration.start, `const ${as} = `);
  2911. }
  2912. }
  2913. if (node.type === 'ExportNamedDeclaration') {
  2914. for (const specifier of node.specifiers) {
  2915. if (specifier.type === 'ExportSpecifier' &&
  2916. specifier.exported.type === 'Identifier' &&
  2917. specifier.exported.name === 'default') {
  2918. if (node.source) {
  2919. if (specifier.local.name === 'default') {
  2920. const end = specifierEnd(input, specifier.local.end, node.end);
  2921. s.prepend(`import { default as __VUE_DEFAULT__ } from '${node.source.value}'\n`);
  2922. s.overwrite(specifier.start, end, ``);
  2923. s.append(`\nconst ${as} = __VUE_DEFAULT__`);
  2924. continue;
  2925. }
  2926. else {
  2927. const end = specifierEnd(input, specifier.exported.end, node.end);
  2928. s.prepend(`import { ${input.slice(specifier.local.start, specifier.local.end)} } from '${node.source.value}'\n`);
  2929. s.overwrite(specifier.start, end, ``);
  2930. s.append(`\nconst ${as} = ${specifier.local.name}`);
  2931. continue;
  2932. }
  2933. }
  2934. const end = specifierEnd(input, specifier.end, node.end);
  2935. s.overwrite(specifier.start, end, ``);
  2936. s.append(`\nconst ${as} = ${specifier.local.name}`);
  2937. }
  2938. }
  2939. }
  2940. });
  2941. return s.toString();
  2942. }
  2943. function hasDefaultExport(input) {
  2944. return defaultExportRE.test(input) || namedDefaultExportRE.test(input);
  2945. }
  2946. function specifierEnd(input, end, nodeEnd) {
  2947. // export { default , foo } ...
  2948. let hasCommas = false;
  2949. let oldEnd = end;
  2950. while (end < nodeEnd) {
  2951. if (/\s/.test(input.charAt(end))) {
  2952. end++;
  2953. }
  2954. else if (input.charAt(end) === ',') {
  2955. end++;
  2956. hasCommas = true;
  2957. break;
  2958. }
  2959. else if (input.charAt(end) === '}') {
  2960. break;
  2961. }
  2962. }
  2963. return hasCommas ? end : oldEnd;
  2964. }
  2965. // Special compiler macros
  2966. const DEFINE_PROPS = 'defineProps';
  2967. const DEFINE_EMITS = 'defineEmits';
  2968. const DEFINE_EXPOSE = 'defineExpose';
  2969. const WITH_DEFAULTS = 'withDefaults';
  2970. // constants
  2971. const DEFAULT_VAR = `__default__`;
  2972. const isBuiltInDir = shared.makeMap(`once,memo,if,for,else,else-if,slot,text,html,on,bind,model,show,cloak,is`);
  2973. /**
  2974. * Compile `<script setup>`
  2975. * It requires the whole SFC descriptor because we need to handle and merge
  2976. * normal `<script>` + `<script setup>` if both are present.
  2977. */
  2978. function compileScript(sfc, options) {
  2979. var _a;
  2980. let { script, scriptSetup, source, filename } = sfc;
  2981. // feature flags
  2982. // TODO remove support for deprecated options when out of experimental
  2983. const enableReactivityTransform = !!options.reactivityTransform ||
  2984. !!options.refSugar ||
  2985. !!options.refTransform;
  2986. const enablePropsTransform = !!options.reactivityTransform || !!options.propsDestructureTransform;
  2987. const isProd = !!options.isProd;
  2988. const genSourceMap = options.sourceMap !== false;
  2989. let refBindings;
  2990. if (!options.id) {
  2991. warnOnce(`compileScript now requires passing the \`id\` option.\n` +
  2992. `Upgrade your vite or vue-loader version for compatibility with ` +
  2993. `the latest experimental proposals.`);
  2994. }
  2995. const scopeId = options.id ? options.id.replace(/^data-v-/, '') : '';
  2996. const cssVars = sfc.cssVars;
  2997. const scriptLang = script && script.lang;
  2998. const scriptSetupLang = scriptSetup && scriptSetup.lang;
  2999. const isTS = scriptLang === 'ts' ||
  3000. scriptLang === 'tsx' ||
  3001. scriptSetupLang === 'ts' ||
  3002. scriptSetupLang === 'tsx';
  3003. // resolve parser plugins
  3004. const plugins = [];
  3005. if (!isTS || scriptLang === 'tsx' || scriptSetupLang === 'tsx') {
  3006. plugins.push('jsx');
  3007. }
  3008. else {
  3009. // If don't match the case of adding jsx, should remove the jsx from the babelParserPlugins
  3010. if (options.babelParserPlugins)
  3011. options.babelParserPlugins = options.babelParserPlugins.filter(n => n !== 'jsx');
  3012. }
  3013. if (options.babelParserPlugins)
  3014. plugins.push(...options.babelParserPlugins);
  3015. if (isTS) {
  3016. plugins.push('typescript');
  3017. if (!plugins.includes('decorators')) {
  3018. plugins.push('decorators-legacy');
  3019. }
  3020. }
  3021. if (!scriptSetup) {
  3022. if (!script) {
  3023. throw new Error(`[@vue/compiler-sfc] SFC contains no <script> tags.`);
  3024. }
  3025. if (scriptLang && !isTS && scriptLang !== 'jsx') {
  3026. // do not process non js/ts script blocks
  3027. return script;
  3028. }
  3029. try {
  3030. let content = script.content;
  3031. let map = script.map;
  3032. const scriptAst = parser$2.parse(content, {
  3033. plugins,
  3034. sourceType: 'module'
  3035. }).program;
  3036. const bindings = analyzeScriptBindings(scriptAst.body);
  3037. if (enableReactivityTransform && reactivityTransform.shouldTransform(content)) {
  3038. const s = new MagicString__default(source);
  3039. const startOffset = script.loc.start.offset;
  3040. const endOffset = script.loc.end.offset;
  3041. const { importedHelpers } = reactivityTransform.transformAST(scriptAst, s, startOffset);
  3042. if (importedHelpers.length) {
  3043. s.prepend(`import { ${importedHelpers
  3044. .map(h => `${h} as _${h}`)
  3045. .join(', ')} } from 'vue'\n`);
  3046. }
  3047. s.remove(0, startOffset);
  3048. s.remove(endOffset, source.length);
  3049. content = s.toString();
  3050. if (genSourceMap) {
  3051. map = s.generateMap({
  3052. source: filename,
  3053. hires: true,
  3054. includeContent: true
  3055. });
  3056. }
  3057. }
  3058. if (cssVars.length) {
  3059. content = rewriteDefault(content, DEFAULT_VAR, plugins);
  3060. content += genNormalScriptCssVarsCode(cssVars, bindings, scopeId, isProd);
  3061. content += `\nexport default ${DEFAULT_VAR}`;
  3062. }
  3063. return {
  3064. ...script,
  3065. content,
  3066. map,
  3067. bindings,
  3068. scriptAst: scriptAst.body
  3069. };
  3070. }
  3071. catch (e) {
  3072. // silently fallback if parse fails since user may be using custom
  3073. // babel syntax
  3074. return script;
  3075. }
  3076. }
  3077. if (script && scriptLang !== scriptSetupLang) {
  3078. throw new Error(`[@vue/compiler-sfc] <script> and <script setup> must have the same ` +
  3079. `language type.`);
  3080. }
  3081. if (scriptSetupLang && !isTS && scriptSetupLang !== 'jsx') {
  3082. // do not process non js/ts script blocks
  3083. return scriptSetup;
  3084. }
  3085. // metadata that needs to be returned
  3086. const bindingMetadata = {};
  3087. const helperImports = new Set();
  3088. const userImports = Object.create(null);
  3089. const scriptBindings = Object.create(null);
  3090. const setupBindings = Object.create(null);
  3091. let defaultExport;
  3092. let hasDefinePropsCall = false;
  3093. let hasDefineEmitCall = false;
  3094. let hasDefineExposeCall = false;
  3095. let hasDefaultExportName = false;
  3096. let hasDefaultExportRender = false;
  3097. let propsRuntimeDecl;
  3098. let propsRuntimeDefaults;
  3099. let propsDestructureDecl;
  3100. let propsDestructureRestId;
  3101. let propsTypeDecl;
  3102. let propsTypeDeclRaw;
  3103. let propsIdentifier;
  3104. let emitsRuntimeDecl;
  3105. let emitsTypeDecl;
  3106. let emitsTypeDeclRaw;
  3107. let emitIdentifier;
  3108. let hasAwait = false;
  3109. let hasInlinedSsrRenderFn = false;
  3110. // props/emits declared via types
  3111. const typeDeclaredProps = {};
  3112. const typeDeclaredEmits = new Set();
  3113. // record declared types for runtime props type generation
  3114. const declaredTypes = {};
  3115. // props destructure data
  3116. const propsDestructuredBindings = Object.create(null);
  3117. // magic-string state
  3118. const s = new MagicString__default(source);
  3119. const startOffset = scriptSetup.loc.start.offset;
  3120. const endOffset = scriptSetup.loc.end.offset;
  3121. const scriptStartOffset = script && script.loc.start.offset;
  3122. const scriptEndOffset = script && script.loc.end.offset;
  3123. function helper(key) {
  3124. helperImports.add(key);
  3125. return `_${key}`;
  3126. }
  3127. function parse(input, options, offset) {
  3128. try {
  3129. return parser$2.parse(input, options).program;
  3130. }
  3131. catch (e) {
  3132. e.message = `[@vue/compiler-sfc] ${e.message}\n\n${sfc.filename}\n${shared.generateCodeFrame(source, e.pos + offset, e.pos + offset + 1)}`;
  3133. throw e;
  3134. }
  3135. }
  3136. function error(msg, node, end = node.end + startOffset) {
  3137. throw new Error(`[@vue/compiler-sfc] ${msg}\n\n${sfc.filename}\n${shared.generateCodeFrame(source, node.start + startOffset, end)}`);
  3138. }
  3139. function hoistNode(node) {
  3140. const start = node.start + startOffset;
  3141. let end = node.end + startOffset;
  3142. // locate comment
  3143. if (node.trailingComments && node.trailingComments.length > 0) {
  3144. const lastCommentNode = node.trailingComments[node.trailingComments.length - 1];
  3145. end = lastCommentNode.end + startOffset;
  3146. }
  3147. // locate the end of whitespace between this statement and the next
  3148. while (end <= source.length) {
  3149. if (!/\s/.test(source.charAt(end))) {
  3150. break;
  3151. }
  3152. end++;
  3153. }
  3154. s.move(start, end, 0);
  3155. }
  3156. function registerUserImport(source, local, imported, isType, isFromSetup, needTemplateUsageCheck) {
  3157. // template usage check is only needed in non-inline mode, so we can skip
  3158. // the work if inlineTemplate is true.
  3159. let isUsedInTemplate = needTemplateUsageCheck;
  3160. if (needTemplateUsageCheck &&
  3161. isTS &&
  3162. sfc.template &&
  3163. !sfc.template.src &&
  3164. !sfc.template.lang) {
  3165. isUsedInTemplate = isImportUsed(local, sfc);
  3166. }
  3167. userImports[local] = {
  3168. isType,
  3169. imported: imported || 'default',
  3170. local,
  3171. source,
  3172. isFromSetup,
  3173. isUsedInTemplate
  3174. };
  3175. }
  3176. function processDefineProps(node, declId) {
  3177. if (!isCallOf(node, DEFINE_PROPS)) {
  3178. return false;
  3179. }
  3180. if (hasDefinePropsCall) {
  3181. error(`duplicate ${DEFINE_PROPS}() call`, node);
  3182. }
  3183. hasDefinePropsCall = true;
  3184. propsRuntimeDecl = node.arguments[0];
  3185. // call has type parameters - infer runtime types from it
  3186. if (node.typeParameters) {
  3187. if (propsRuntimeDecl) {
  3188. error(`${DEFINE_PROPS}() cannot accept both type and non-type arguments ` +
  3189. `at the same time. Use one or the other.`, node);
  3190. }
  3191. propsTypeDeclRaw = node.typeParameters.params[0];
  3192. propsTypeDecl = resolveQualifiedType(propsTypeDeclRaw, node => node.type === 'TSTypeLiteral');
  3193. if (!propsTypeDecl) {
  3194. error(`type argument passed to ${DEFINE_PROPS}() must be a literal type, ` +
  3195. `or a reference to an interface or literal type.`, propsTypeDeclRaw);
  3196. }
  3197. }
  3198. if (declId) {
  3199. if (enablePropsTransform && declId.type === 'ObjectPattern') {
  3200. propsDestructureDecl = declId;
  3201. // props destructure - handle compilation sugar
  3202. for (const prop of declId.properties) {
  3203. if (prop.type === 'ObjectProperty') {
  3204. const propKey = resolveObjectKey(prop.key, prop.computed);
  3205. if (!propKey) {
  3206. error(`${DEFINE_PROPS}() destructure cannot use computed key.`, prop.key);
  3207. }
  3208. if (prop.value.type === 'AssignmentPattern') {
  3209. // default value { foo = 123 }
  3210. const { left, right } = prop.value;
  3211. if (left.type !== 'Identifier') {
  3212. error(`${DEFINE_PROPS}() destructure does not support nested patterns.`, left);
  3213. }
  3214. // store default value
  3215. propsDestructuredBindings[propKey] = {
  3216. local: left.name,
  3217. default: right
  3218. };
  3219. }
  3220. else if (prop.value.type === 'Identifier') {
  3221. // simple destructure
  3222. propsDestructuredBindings[propKey] = {
  3223. local: prop.value.name
  3224. };
  3225. }
  3226. else {
  3227. error(`${DEFINE_PROPS}() destructure does not support nested patterns.`, prop.value);
  3228. }
  3229. }
  3230. else {
  3231. // rest spread
  3232. propsDestructureRestId = prop.argument.name;
  3233. }
  3234. }
  3235. }
  3236. else {
  3237. propsIdentifier = scriptSetup.content.slice(declId.start, declId.end);
  3238. }
  3239. }
  3240. return true;
  3241. }
  3242. function processWithDefaults(node, declId) {
  3243. if (!isCallOf(node, WITH_DEFAULTS)) {
  3244. return false;
  3245. }
  3246. if (processDefineProps(node.arguments[0], declId)) {
  3247. if (propsRuntimeDecl) {
  3248. error(`${WITH_DEFAULTS} can only be used with type-based ` +
  3249. `${DEFINE_PROPS} declaration.`, node);
  3250. }
  3251. if (propsDestructureDecl) {
  3252. error(`${WITH_DEFAULTS}() is unnecessary when using destructure with ${DEFINE_PROPS}().\n` +
  3253. `Prefer using destructure default values, e.g. const { foo = 1 } = defineProps(...).`, node.callee);
  3254. }
  3255. propsRuntimeDefaults = node.arguments[1];
  3256. if (!propsRuntimeDefaults ||
  3257. propsRuntimeDefaults.type !== 'ObjectExpression') {
  3258. error(`The 2nd argument of ${WITH_DEFAULTS} must be an object literal.`, propsRuntimeDefaults || node);
  3259. }
  3260. }
  3261. else {
  3262. error(`${WITH_DEFAULTS}' first argument must be a ${DEFINE_PROPS} call.`, node.arguments[0] || node);
  3263. }
  3264. return true;
  3265. }
  3266. function processDefineEmits(node, declId) {
  3267. if (!isCallOf(node, DEFINE_EMITS)) {
  3268. return false;
  3269. }
  3270. if (hasDefineEmitCall) {
  3271. error(`duplicate ${DEFINE_EMITS}() call`, node);
  3272. }
  3273. hasDefineEmitCall = true;
  3274. emitsRuntimeDecl = node.arguments[0];
  3275. if (node.typeParameters) {
  3276. if (emitsRuntimeDecl) {
  3277. error(`${DEFINE_EMITS}() cannot accept both type and non-type arguments ` +
  3278. `at the same time. Use one or the other.`, node);
  3279. }
  3280. emitsTypeDeclRaw = node.typeParameters.params[0];
  3281. emitsTypeDecl = resolveQualifiedType(emitsTypeDeclRaw, node => node.type === 'TSFunctionType' || node.type === 'TSTypeLiteral');
  3282. if (!emitsTypeDecl) {
  3283. error(`type argument passed to ${DEFINE_EMITS}() must be a function type, ` +
  3284. `a literal type with call signatures, or a reference to the above types.`, emitsTypeDeclRaw);
  3285. }
  3286. }
  3287. if (declId) {
  3288. emitIdentifier =
  3289. declId.type === 'Identifier'
  3290. ? declId.name
  3291. : scriptSetup.content.slice(declId.start, declId.end);
  3292. }
  3293. return true;
  3294. }
  3295. function getAstBody() {
  3296. return scriptAst
  3297. ? [...scriptSetupAst.body, ...scriptAst.body]
  3298. : scriptSetupAst.body;
  3299. }
  3300. function resolveExtendsType(node, qualifier, cache = []) {
  3301. if (node.type === 'TSInterfaceDeclaration' && node.extends) {
  3302. node.extends.forEach(extend => {
  3303. if (extend.type === 'TSExpressionWithTypeArguments' &&
  3304. extend.expression.type === 'Identifier') {
  3305. const body = getAstBody();
  3306. for (const node of body) {
  3307. const qualified = isQualifiedType(node, qualifier, extend.expression.name);
  3308. if (qualified) {
  3309. cache.push(qualified);
  3310. resolveExtendsType(node, qualifier, cache);
  3311. return cache;
  3312. }
  3313. }
  3314. }
  3315. });
  3316. }
  3317. return cache;
  3318. }
  3319. function isQualifiedType(node, qualifier, refName) {
  3320. if (node.type === 'TSInterfaceDeclaration' && node.id.name === refName) {
  3321. return node.body;
  3322. }
  3323. else if (node.type === 'TSTypeAliasDeclaration' &&
  3324. node.id.name === refName &&
  3325. qualifier(node.typeAnnotation)) {
  3326. return node.typeAnnotation;
  3327. }
  3328. else if (node.type === 'ExportNamedDeclaration' && node.declaration) {
  3329. return isQualifiedType(node.declaration, qualifier, refName);
  3330. }
  3331. }
  3332. // filter all extends types to keep the override declaration
  3333. function filterExtendsType(extendsTypes, bodies) {
  3334. extendsTypes.forEach(extend => {
  3335. const body = extend.body;
  3336. body.forEach(newBody => {
  3337. if (newBody.type === 'TSPropertySignature' &&
  3338. newBody.key.type === 'Identifier') {
  3339. const name = newBody.key.name;
  3340. const hasOverride = bodies.some(seenBody => seenBody.type === 'TSPropertySignature' &&
  3341. seenBody.key.type === 'Identifier' &&
  3342. seenBody.key.name === name);
  3343. if (!hasOverride)
  3344. bodies.push(newBody);
  3345. }
  3346. });
  3347. });
  3348. }
  3349. function resolveQualifiedType(node, qualifier) {
  3350. if (qualifier(node)) {
  3351. return node;
  3352. }
  3353. if (node.type === 'TSTypeReference' &&
  3354. node.typeName.type === 'Identifier') {
  3355. const refName = node.typeName.name;
  3356. const body = getAstBody();
  3357. for (const node of body) {
  3358. let qualified = isQualifiedType(node, qualifier, refName);
  3359. if (qualified) {
  3360. const extendsTypes = resolveExtendsType(node, qualifier);
  3361. if (extendsTypes.length) {
  3362. const bodies = [...qualified.body];
  3363. filterExtendsType(extendsTypes, bodies);
  3364. qualified.body = bodies;
  3365. }
  3366. return qualified;
  3367. }
  3368. }
  3369. }
  3370. }
  3371. function processDefineExpose(node) {
  3372. if (isCallOf(node, DEFINE_EXPOSE)) {
  3373. if (hasDefineExposeCall) {
  3374. error(`duplicate ${DEFINE_EXPOSE}() call`, node);
  3375. }
  3376. hasDefineExposeCall = true;
  3377. return true;
  3378. }
  3379. return false;
  3380. }
  3381. function checkInvalidScopeReference(node, method) {
  3382. if (!node)
  3383. return;
  3384. CompilerDOM.walkIdentifiers(node, id => {
  3385. if (setupBindings[id.name]) {
  3386. error(`\`${method}()\` in <script setup> cannot reference locally ` +
  3387. `declared variables because it will be hoisted outside of the ` +
  3388. `setup() function. If your component options require initialization ` +
  3389. `in the module scope, use a separate normal <script> to export ` +
  3390. `the options instead.`, id);
  3391. }
  3392. });
  3393. }
  3394. /**
  3395. * await foo()
  3396. * -->
  3397. * ;(
  3398. * ([__temp,__restore] = withAsyncContext(() => foo())),
  3399. * await __temp,
  3400. * __restore()
  3401. * )
  3402. *
  3403. * const a = await foo()
  3404. * -->
  3405. * const a = (
  3406. * ([__temp, __restore] = withAsyncContext(() => foo())),
  3407. * __temp = await __temp,
  3408. * __restore(),
  3409. * __temp
  3410. * )
  3411. */
  3412. function processAwait(node, needSemi, isStatement) {
  3413. const argumentStart = node.argument.extra && node.argument.extra.parenthesized
  3414. ? node.argument.extra.parenStart
  3415. : node.argument.start;
  3416. const argumentStr = source.slice(argumentStart + startOffset, node.argument.end + startOffset);
  3417. const containsNestedAwait = /\bawait\b/.test(argumentStr);
  3418. s.overwrite(node.start + startOffset, argumentStart + startOffset, `${needSemi ? `;` : ``}(\n ([__temp,__restore] = ${helper(`withAsyncContext`)}(${containsNestedAwait ? `async ` : ``}() => `);
  3419. s.appendLeft(node.end + startOffset, `)),\n ${isStatement ? `` : `__temp = `}await __temp,\n __restore()${isStatement ? `` : `,\n __temp`}\n)`);
  3420. }
  3421. /**
  3422. * check defaults. If the default object is an object literal with only
  3423. * static properties, we can directly generate more optimized default
  3424. * declarations. Otherwise we will have to fallback to runtime merging.
  3425. */
  3426. function hasStaticWithDefaults() {
  3427. return (propsRuntimeDefaults &&
  3428. propsRuntimeDefaults.type === 'ObjectExpression' &&
  3429. propsRuntimeDefaults.properties.every(node => (node.type === 'ObjectProperty' &&
  3430. (!node.computed || node.key.type.endsWith('Literal'))) ||
  3431. node.type === 'ObjectMethod'));
  3432. }
  3433. function genRuntimeProps(props) {
  3434. const keys = Object.keys(props);
  3435. if (!keys.length) {
  3436. return ``;
  3437. }
  3438. const hasStaticDefaults = hasStaticWithDefaults();
  3439. const scriptSetupSource = scriptSetup.content;
  3440. let propsDecls = `{
  3441. ${keys
  3442. .map(key => {
  3443. let defaultString;
  3444. const destructured = genDestructuredDefaultValue(key);
  3445. if (destructured) {
  3446. defaultString = `default: ${destructured}`;
  3447. }
  3448. else if (hasStaticDefaults) {
  3449. const prop = propsRuntimeDefaults.properties.find(node => {
  3450. if (node.type === 'SpreadElement')
  3451. return false;
  3452. return resolveObjectKey(node.key, node.computed) === key;
  3453. });
  3454. if (prop) {
  3455. if (prop.type === 'ObjectProperty') {
  3456. // prop has corresponding static default value
  3457. defaultString = `default: ${scriptSetupSource.slice(prop.value.start, prop.value.end)}`;
  3458. }
  3459. else {
  3460. defaultString = `${prop.async ? 'async ' : ''}${prop.kind !== 'method' ? `${prop.kind} ` : ''}default() ${scriptSetupSource.slice(prop.body.start, prop.body.end)}`;
  3461. }
  3462. }
  3463. }
  3464. const { type, required } = props[key];
  3465. if (!isProd) {
  3466. return `${key}: { type: ${toRuntimeTypeString(type)}, required: ${required}${defaultString ? `, ${defaultString}` : ``} }`;
  3467. }
  3468. else if (type.some(el => el === 'Boolean' || (defaultString && el === 'Function'))) {
  3469. // #4783 production: if boolean or defaultString and function exists, should keep the type.
  3470. return `${key}: { type: ${toRuntimeTypeString(type)}${defaultString ? `, ${defaultString}` : ``} }`;
  3471. }
  3472. else {
  3473. // production: checks are useless
  3474. return `${key}: ${defaultString ? `{ ${defaultString} }` : 'null'}`;
  3475. }
  3476. })
  3477. .join(',\n ')}\n }`;
  3478. if (propsRuntimeDefaults && !hasStaticDefaults) {
  3479. propsDecls = `${helper('mergeDefaults')}(${propsDecls}, ${source.slice(propsRuntimeDefaults.start + startOffset, propsRuntimeDefaults.end + startOffset)})`;
  3480. }
  3481. return `\n props: ${propsDecls},`;
  3482. }
  3483. function genDestructuredDefaultValue(key) {
  3484. const destructured = propsDestructuredBindings[key];
  3485. if (destructured && destructured.default) {
  3486. const value = scriptSetup.content.slice(destructured.default.start, destructured.default.end);
  3487. const isLiteral = destructured.default.type.endsWith('Literal');
  3488. return isLiteral ? value : `() => (${value})`;
  3489. }
  3490. }
  3491. function genSetupPropsType(node) {
  3492. const scriptSetupSource = scriptSetup.content;
  3493. if (hasStaticWithDefaults()) {
  3494. // if withDefaults() is used, we need to remove the optional flags
  3495. // on props that have default values
  3496. let res = `{ `;
  3497. const members = node.type === 'TSTypeLiteral' ? node.members : node.body;
  3498. for (const m of members) {
  3499. if ((m.type === 'TSPropertySignature' ||
  3500. m.type === 'TSMethodSignature') &&
  3501. m.typeAnnotation &&
  3502. m.key.type === 'Identifier') {
  3503. if (propsRuntimeDefaults.properties.some(p => {
  3504. if (p.type === 'SpreadElement')
  3505. return false;
  3506. return (resolveObjectKey(p.key, p.computed) ===
  3507. m.key.name);
  3508. })) {
  3509. res +=
  3510. m.key.name +
  3511. (m.type === 'TSMethodSignature' ? '()' : '') +
  3512. scriptSetupSource.slice(m.typeAnnotation.start, m.typeAnnotation.end) +
  3513. ', ';
  3514. }
  3515. else {
  3516. res +=
  3517. scriptSetupSource.slice(m.start, m.typeAnnotation.end) + `, `;
  3518. }
  3519. }
  3520. }
  3521. return (res.length ? res.slice(0, -2) : res) + ` }`;
  3522. }
  3523. else {
  3524. return scriptSetupSource.slice(node.start, node.end);
  3525. }
  3526. }
  3527. // 0. parse both <script> and <script setup> blocks
  3528. const scriptAst = script &&
  3529. parse(script.content, {
  3530. plugins,
  3531. sourceType: 'module'
  3532. }, scriptStartOffset);
  3533. const scriptSetupAst = parse(scriptSetup.content, {
  3534. plugins: [
  3535. ...plugins,
  3536. // allow top level await but only inside <script setup>
  3537. 'topLevelAwait'
  3538. ],
  3539. sourceType: 'module'
  3540. }, startOffset);
  3541. // 1.1 walk import delcarations of <script>
  3542. if (scriptAst) {
  3543. for (const node of scriptAst.body) {
  3544. if (node.type === 'ImportDeclaration') {
  3545. // record imports for dedupe
  3546. for (const specifier of node.specifiers) {
  3547. const imported = specifier.type === 'ImportSpecifier' &&
  3548. specifier.imported.type === 'Identifier' &&
  3549. specifier.imported.name;
  3550. registerUserImport(node.source.value, specifier.local.name, imported, node.importKind === 'type' ||
  3551. (specifier.type === 'ImportSpecifier' &&
  3552. specifier.importKind === 'type'), false, !options.inlineTemplate);
  3553. }
  3554. }
  3555. }
  3556. }
  3557. // 1.2 walk import declarations of <script setup>
  3558. for (const node of scriptSetupAst.body) {
  3559. if (node.type === 'ImportDeclaration') {
  3560. // import declarations are moved to top
  3561. hoistNode(node);
  3562. // dedupe imports
  3563. let removed = 0;
  3564. const removeSpecifier = (i) => {
  3565. const removeLeft = i > removed;
  3566. removed++;
  3567. const current = node.specifiers[i];
  3568. const next = node.specifiers[i + 1];
  3569. s.remove(removeLeft
  3570. ? node.specifiers[i - 1].end + startOffset
  3571. : current.start + startOffset, next && !removeLeft
  3572. ? next.start + startOffset
  3573. : current.end + startOffset);
  3574. };
  3575. for (let i = 0; i < node.specifiers.length; i++) {
  3576. const specifier = node.specifiers[i];
  3577. const local = specifier.local.name;
  3578. let imported = specifier.type === 'ImportSpecifier' &&
  3579. specifier.imported.type === 'Identifier' &&
  3580. specifier.imported.name;
  3581. if (specifier.type === 'ImportNamespaceSpecifier') {
  3582. imported = '*';
  3583. }
  3584. const source = node.source.value;
  3585. const existing = userImports[local];
  3586. if (source === 'vue' &&
  3587. (imported === DEFINE_PROPS ||
  3588. imported === DEFINE_EMITS ||
  3589. imported === DEFINE_EXPOSE)) {
  3590. warnOnce(`\`${imported}\` is a compiler macro and no longer needs to be imported.`);
  3591. removeSpecifier(i);
  3592. }
  3593. else if (existing) {
  3594. if (existing.source === source && existing.imported === imported) {
  3595. // already imported in <script setup>, dedupe
  3596. removeSpecifier(i);
  3597. }
  3598. else {
  3599. error(`different imports aliased to same local name.`, specifier);
  3600. }
  3601. }
  3602. else {
  3603. registerUserImport(source, local, imported, node.importKind === 'type' ||
  3604. (specifier.type === 'ImportSpecifier' &&
  3605. specifier.importKind === 'type'), true, !options.inlineTemplate);
  3606. }
  3607. }
  3608. if (node.specifiers.length && removed === node.specifiers.length) {
  3609. s.remove(node.start + startOffset, node.end + startOffset);
  3610. }
  3611. }
  3612. }
  3613. // 1.3 resolve possible user import alias of `ref` and `reactive`
  3614. const vueImportAliases = {};
  3615. for (const key in userImports) {
  3616. const { source, imported, local } = userImports[key];
  3617. if (source === 'vue')
  3618. vueImportAliases[imported] = local;
  3619. }
  3620. // 2.1 process normal <script> body
  3621. if (script && scriptAst) {
  3622. for (const node of scriptAst.body) {
  3623. if (node.type === 'ExportDefaultDeclaration') {
  3624. // export default
  3625. defaultExport = node;
  3626. // check if user has manually specified `name` or 'render` option in
  3627. // export default
  3628. // if has name, skip name inference
  3629. // if has render and no template, generate return object instead of
  3630. // empty render function (#4980)
  3631. let optionProperties;
  3632. if (defaultExport.declaration.type === 'ObjectExpression') {
  3633. optionProperties = defaultExport.declaration.properties;
  3634. }
  3635. else if (defaultExport.declaration.type === 'CallExpression' &&
  3636. defaultExport.declaration.arguments[0].type === 'ObjectExpression') {
  3637. optionProperties = defaultExport.declaration.arguments[0].properties;
  3638. }
  3639. if (optionProperties) {
  3640. for (const s of optionProperties) {
  3641. if (s.type === 'ObjectProperty' &&
  3642. s.key.type === 'Identifier' &&
  3643. s.key.name === 'name') {
  3644. hasDefaultExportName = true;
  3645. }
  3646. if ((s.type === 'ObjectMethod' || s.type === 'ObjectProperty') &&
  3647. s.key.type === 'Identifier' &&
  3648. s.key.name === 'render') {
  3649. // TODO warn when we provide a better way to do it?
  3650. hasDefaultExportRender = true;
  3651. }
  3652. }
  3653. }
  3654. // export default { ... } --> const __default__ = { ... }
  3655. const start = node.start + scriptStartOffset;
  3656. const end = node.declaration.start + scriptStartOffset;
  3657. s.overwrite(start, end, `const ${DEFAULT_VAR} = `);
  3658. }
  3659. else if (node.type === 'ExportNamedDeclaration') {
  3660. const defaultSpecifier = node.specifiers.find(s => s.exported.type === 'Identifier' && s.exported.name === 'default');
  3661. if (defaultSpecifier) {
  3662. defaultExport = node;
  3663. // 1. remove specifier
  3664. if (node.specifiers.length > 1) {
  3665. s.remove(defaultSpecifier.start + scriptStartOffset, defaultSpecifier.end + scriptStartOffset);
  3666. }
  3667. else {
  3668. s.remove(node.start + scriptStartOffset, node.end + scriptStartOffset);
  3669. }
  3670. if (node.source) {
  3671. // export { x as default } from './x'
  3672. // rewrite to `import { x as __default__ } from './x'` and
  3673. // add to top
  3674. s.prepend(`import { ${defaultSpecifier.local.name} as ${DEFAULT_VAR} } from '${node.source.value}'\n`);
  3675. }
  3676. else {
  3677. // export { x as default }
  3678. // rewrite to `const __default__ = x` and move to end
  3679. s.appendLeft(scriptEndOffset, `\nconst ${DEFAULT_VAR} = ${defaultSpecifier.local.name}\n`);
  3680. }
  3681. }
  3682. if (node.declaration) {
  3683. walkDeclaration(node.declaration, scriptBindings, vueImportAliases);
  3684. }
  3685. }
  3686. else if ((node.type === 'VariableDeclaration' ||
  3687. node.type === 'FunctionDeclaration' ||
  3688. node.type === 'ClassDeclaration' ||
  3689. node.type === 'TSEnumDeclaration') &&
  3690. !node.declare) {
  3691. walkDeclaration(node, scriptBindings, vueImportAliases);
  3692. }
  3693. }
  3694. // apply reactivity transform
  3695. if (enableReactivityTransform && reactivityTransform.shouldTransform(script.content)) {
  3696. const { rootRefs, importedHelpers } = reactivityTransform.transformAST(scriptAst, s, scriptStartOffset);
  3697. refBindings = rootRefs;
  3698. for (const h of importedHelpers) {
  3699. helperImports.add(h);
  3700. }
  3701. }
  3702. // <script> after <script setup>
  3703. // we need to move the block up so that `const __default__` is
  3704. // declared before being used in the actual component definition
  3705. if (scriptStartOffset > startOffset) {
  3706. // if content doesn't end with newline, add one
  3707. if (!/\n$/.test(script.content.trim())) {
  3708. s.appendLeft(scriptEndOffset, `\n`);
  3709. }
  3710. s.move(scriptStartOffset, scriptEndOffset, 0);
  3711. }
  3712. }
  3713. // 2.2 process <script setup> body
  3714. for (const node of scriptSetupAst.body) {
  3715. // (Dropped) `ref: x` bindings
  3716. // TODO remove when out of experimental
  3717. if (node.type === 'LabeledStatement' &&
  3718. node.label.name === 'ref' &&
  3719. node.body.type === 'ExpressionStatement') {
  3720. error(`ref sugar using the label syntax was an experimental proposal and ` +
  3721. `has been dropped based on community feedback. Please check out ` +
  3722. `the new proposal at https://github.com/vuejs/rfcs/discussions/369`, node);
  3723. }
  3724. if (node.type === 'ExpressionStatement') {
  3725. // process `defineProps` and `defineEmit(s)` calls
  3726. if (processDefineProps(node.expression) ||
  3727. processDefineEmits(node.expression) ||
  3728. processWithDefaults(node.expression)) {
  3729. s.remove(node.start + startOffset, node.end + startOffset);
  3730. }
  3731. else if (processDefineExpose(node.expression)) {
  3732. // defineExpose({}) -> expose({})
  3733. const callee = node.expression.callee;
  3734. s.overwrite(callee.start + startOffset, callee.end + startOffset, 'expose');
  3735. }
  3736. }
  3737. if (node.type === 'VariableDeclaration' && !node.declare) {
  3738. const total = node.declarations.length;
  3739. let left = total;
  3740. for (let i = 0; i < total; i++) {
  3741. const decl = node.declarations[i];
  3742. if (decl.init) {
  3743. // defineProps / defineEmits
  3744. const isDefineProps = processDefineProps(decl.init, decl.id) ||
  3745. processWithDefaults(decl.init, decl.id);
  3746. const isDefineEmits = processDefineEmits(decl.init, decl.id);
  3747. if (isDefineProps || isDefineEmits) {
  3748. if (left === 1) {
  3749. s.remove(node.start + startOffset, node.end + startOffset);
  3750. }
  3751. else {
  3752. let start = decl.start + startOffset;
  3753. let end = decl.end + startOffset;
  3754. if (i === 0) {
  3755. // first one, locate the start of the next
  3756. end = node.declarations[i + 1].start + startOffset;
  3757. }
  3758. else {
  3759. // not first one, locate the end of the prev
  3760. start = node.declarations[i - 1].end + startOffset;
  3761. }
  3762. s.remove(start, end);
  3763. left--;
  3764. }
  3765. }
  3766. }
  3767. }
  3768. }
  3769. // walk declarations to record declared bindings
  3770. if ((node.type === 'VariableDeclaration' ||
  3771. node.type === 'FunctionDeclaration' ||
  3772. node.type === 'ClassDeclaration') &&
  3773. !node.declare) {
  3774. walkDeclaration(node, setupBindings, vueImportAliases);
  3775. }
  3776. // walk statements & named exports / variable declarations for top level
  3777. // await
  3778. if ((node.type === 'VariableDeclaration' && !node.declare) ||
  3779. node.type.endsWith('Statement')) {
  3780. const scope = [scriptSetupAst.body];
  3781. estreeWalker.walk(node, {
  3782. enter(child, parent) {
  3783. if (CompilerDOM.isFunctionType(child)) {
  3784. this.skip();
  3785. }
  3786. if (child.type === 'BlockStatement') {
  3787. scope.push(child.body);
  3788. }
  3789. if (child.type === 'AwaitExpression') {
  3790. hasAwait = true;
  3791. // if the await expression is an expression statement and
  3792. // - is in the root scope
  3793. // - or is not the first statement in a nested block scope
  3794. // then it needs a semicolon before the generated code.
  3795. const currentScope = scope[scope.length - 1];
  3796. const needsSemi = currentScope.some((n, i) => {
  3797. return ((scope.length === 1 || i > 0) &&
  3798. n.type === 'ExpressionStatement' &&
  3799. n.start === child.start);
  3800. });
  3801. processAwait(child, needsSemi, parent.type === 'ExpressionStatement');
  3802. }
  3803. },
  3804. exit(node) {
  3805. if (node.type === 'BlockStatement')
  3806. scope.pop();
  3807. }
  3808. });
  3809. }
  3810. if ((node.type === 'ExportNamedDeclaration' && node.exportKind !== 'type') ||
  3811. node.type === 'ExportAllDeclaration' ||
  3812. node.type === 'ExportDefaultDeclaration') {
  3813. error(`<script setup> cannot contain ES module exports. ` +
  3814. `If you are using a previous version of <script setup>, please ` +
  3815. `consult the updated RFC at https://github.com/vuejs/rfcs/pull/227.`, node);
  3816. }
  3817. if (isTS) {
  3818. // runtime enum
  3819. if (node.type === 'TSEnumDeclaration') {
  3820. registerBinding(setupBindings, node.id, "setup-const" /* BindingTypes.SETUP_CONST */);
  3821. }
  3822. // move all Type declarations to outer scope
  3823. if (node.type.startsWith('TS') ||
  3824. (node.type === 'ExportNamedDeclaration' &&
  3825. node.exportKind === 'type') ||
  3826. (node.type === 'VariableDeclaration' && node.declare)) {
  3827. recordType(node, declaredTypes);
  3828. hoistNode(node);
  3829. }
  3830. }
  3831. }
  3832. // 3. Apply reactivity transform
  3833. if ((enableReactivityTransform &&
  3834. // normal <script> had ref bindings that maybe used in <script setup>
  3835. (refBindings || reactivityTransform.shouldTransform(scriptSetup.content))) ||
  3836. propsDestructureDecl) {
  3837. const { rootRefs, importedHelpers } = reactivityTransform.transformAST(scriptSetupAst, s, startOffset, refBindings, propsDestructuredBindings);
  3838. refBindings = refBindings ? [...refBindings, ...rootRefs] : rootRefs;
  3839. for (const h of importedHelpers) {
  3840. helperImports.add(h);
  3841. }
  3842. }
  3843. // 4. extract runtime props/emits code from setup context type
  3844. if (propsTypeDecl) {
  3845. extractRuntimeProps(propsTypeDecl, typeDeclaredProps, declaredTypes);
  3846. }
  3847. if (emitsTypeDecl) {
  3848. extractRuntimeEmits(emitsTypeDecl, typeDeclaredEmits);
  3849. }
  3850. // 5. check useOptions args to make sure it doesn't reference setup scope
  3851. // variables
  3852. checkInvalidScopeReference(propsRuntimeDecl, DEFINE_PROPS);
  3853. checkInvalidScopeReference(propsRuntimeDefaults, DEFINE_PROPS);
  3854. checkInvalidScopeReference(propsDestructureDecl, DEFINE_PROPS);
  3855. checkInvalidScopeReference(emitsRuntimeDecl, DEFINE_EMITS);
  3856. // 6. remove non-script content
  3857. if (script) {
  3858. if (startOffset < scriptStartOffset) {
  3859. // <script setup> before <script>
  3860. s.remove(0, startOffset);
  3861. s.remove(endOffset, scriptStartOffset);
  3862. s.remove(scriptEndOffset, source.length);
  3863. }
  3864. else {
  3865. // <script> before <script setup>
  3866. s.remove(0, scriptStartOffset);
  3867. s.remove(scriptEndOffset, startOffset);
  3868. s.remove(endOffset, source.length);
  3869. }
  3870. }
  3871. else {
  3872. // only <script setup>
  3873. s.remove(0, startOffset);
  3874. s.remove(endOffset, source.length);
  3875. }
  3876. // 7. analyze binding metadata
  3877. if (scriptAst) {
  3878. Object.assign(bindingMetadata, analyzeScriptBindings(scriptAst.body));
  3879. }
  3880. if (propsRuntimeDecl) {
  3881. for (const key of getObjectOrArrayExpressionKeys(propsRuntimeDecl)) {
  3882. bindingMetadata[key] = "props" /* BindingTypes.PROPS */;
  3883. }
  3884. }
  3885. for (const key in typeDeclaredProps) {
  3886. bindingMetadata[key] = "props" /* BindingTypes.PROPS */;
  3887. }
  3888. // props aliases
  3889. if (propsDestructureDecl) {
  3890. if (propsDestructureRestId) {
  3891. bindingMetadata[propsDestructureRestId] =
  3892. "setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */;
  3893. }
  3894. for (const key in propsDestructuredBindings) {
  3895. const { local } = propsDestructuredBindings[key];
  3896. if (local !== key) {
  3897. bindingMetadata[local] = "props-aliased" /* BindingTypes.PROPS_ALIASED */;
  3898. (bindingMetadata.__propsAliases ||
  3899. (bindingMetadata.__propsAliases = {}))[local] = key;
  3900. }
  3901. }
  3902. }
  3903. for (const [key, { isType, imported, source }] of Object.entries(userImports)) {
  3904. if (isType)
  3905. continue;
  3906. bindingMetadata[key] =
  3907. imported === '*' ||
  3908. (imported === 'default' && source.endsWith('.vue')) ||
  3909. source === 'vue'
  3910. ? "setup-const" /* BindingTypes.SETUP_CONST */
  3911. : "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */;
  3912. }
  3913. for (const key in scriptBindings) {
  3914. bindingMetadata[key] = scriptBindings[key];
  3915. }
  3916. for (const key in setupBindings) {
  3917. bindingMetadata[key] = setupBindings[key];
  3918. }
  3919. // known ref bindings
  3920. if (refBindings) {
  3921. for (const key of refBindings) {
  3922. bindingMetadata[key] = "setup-ref" /* BindingTypes.SETUP_REF */;
  3923. }
  3924. }
  3925. // 8. inject `useCssVars` calls
  3926. if (cssVars.length &&
  3927. // no need to do this when targeting SSR
  3928. !(options.inlineTemplate && ((_a = options.templateOptions) === null || _a === void 0 ? void 0 : _a.ssr))) {
  3929. helperImports.add(CSS_VARS_HELPER);
  3930. helperImports.add('unref');
  3931. s.prependRight(startOffset, `\n${genCssVarsCode(cssVars, bindingMetadata, scopeId, isProd)}\n`);
  3932. }
  3933. // 9. finalize setup() argument signature
  3934. let args = `__props`;
  3935. if (propsTypeDecl) {
  3936. // mark as any and only cast on assignment
  3937. // since the user defined complex types may be incompatible with the
  3938. // inferred type from generated runtime declarations
  3939. args += `: any`;
  3940. }
  3941. // inject user assignment of props
  3942. // we use a default __props so that template expressions referencing props
  3943. // can use it directly
  3944. if (propsIdentifier) {
  3945. s.prependLeft(startOffset, `\nconst ${propsIdentifier} = __props${propsTypeDecl ? ` as ${genSetupPropsType(propsTypeDecl)}` : ``};\n`);
  3946. }
  3947. if (propsDestructureRestId) {
  3948. s.prependLeft(startOffset, `\nconst ${propsDestructureRestId} = ${helper(`createPropsRestProxy`)}(__props, ${JSON.stringify(Object.keys(propsDestructuredBindings))});\n`);
  3949. }
  3950. // inject temp variables for async context preservation
  3951. if (hasAwait) {
  3952. const any = isTS ? `: any` : ``;
  3953. s.prependLeft(startOffset, `\nlet __temp${any}, __restore${any}\n`);
  3954. }
  3955. const destructureElements = hasDefineExposeCall || !options.inlineTemplate ? [`expose`] : [];
  3956. if (emitIdentifier) {
  3957. destructureElements.push(emitIdentifier === `emit` ? `emit` : `emit: ${emitIdentifier}`);
  3958. }
  3959. if (destructureElements.length) {
  3960. args += `, { ${destructureElements.join(', ')} }`;
  3961. if (emitsTypeDecl) {
  3962. args += `: { emit: (${scriptSetup.content.slice(emitsTypeDecl.start, emitsTypeDecl.end)}), expose: any, slots: any, attrs: any }`;
  3963. }
  3964. }
  3965. // 10. generate return statement
  3966. let returned;
  3967. if (!options.inlineTemplate || (!sfc.template && hasDefaultExportRender)) {
  3968. // non-inline mode, or has manual render in normal <script>
  3969. // return bindings from script and script setup
  3970. const allBindings = {
  3971. ...scriptBindings,
  3972. ...setupBindings
  3973. };
  3974. for (const key in userImports) {
  3975. if (!userImports[key].isType && userImports[key].isUsedInTemplate) {
  3976. allBindings[key] = true;
  3977. }
  3978. }
  3979. returned = `{ `;
  3980. for (const key in allBindings) {
  3981. if (allBindings[key] === true &&
  3982. userImports[key].source !== 'vue' &&
  3983. !userImports[key].source.endsWith('.vue')) {
  3984. // generate getter for import bindings
  3985. // skip vue imports since we know they will never change
  3986. returned += `get ${key}() { return ${key} }, `;
  3987. }
  3988. else if (bindingMetadata[key] === "setup-let" /* BindingTypes.SETUP_LET */) {
  3989. // local let binding, also add setter
  3990. const setArg = key === 'v' ? `_v` : `v`;
  3991. returned +=
  3992. `get ${key}() { return ${key} }, ` +
  3993. `set ${key}(${setArg}) { ${key} = ${setArg} }, `;
  3994. }
  3995. else {
  3996. returned += `${key}, `;
  3997. }
  3998. }
  3999. returned = returned.replace(/, $/, '') + ` }`;
  4000. }
  4001. else {
  4002. // inline mode
  4003. if (sfc.template && !sfc.template.src) {
  4004. if (options.templateOptions && options.templateOptions.ssr) {
  4005. hasInlinedSsrRenderFn = true;
  4006. }
  4007. // inline render function mode - we are going to compile the template and
  4008. // inline it right here
  4009. const { code, ast, preamble, tips, errors } = compileTemplate({
  4010. filename,
  4011. source: sfc.template.content,
  4012. inMap: sfc.template.map,
  4013. ...options.templateOptions,
  4014. id: scopeId,
  4015. scoped: sfc.styles.some(s => s.scoped),
  4016. isProd: options.isProd,
  4017. ssrCssVars: sfc.cssVars,
  4018. compilerOptions: {
  4019. ...(options.templateOptions &&
  4020. options.templateOptions.compilerOptions),
  4021. inline: true,
  4022. isTS,
  4023. bindingMetadata
  4024. }
  4025. });
  4026. if (tips.length) {
  4027. tips.forEach(warnOnce);
  4028. }
  4029. const err = errors[0];
  4030. if (typeof err === 'string') {
  4031. throw new Error(err);
  4032. }
  4033. else if (err) {
  4034. if (err.loc) {
  4035. err.message +=
  4036. `\n\n` +
  4037. sfc.filename +
  4038. '\n' +
  4039. shared.generateCodeFrame(source, err.loc.start.offset, err.loc.end.offset) +
  4040. `\n`;
  4041. }
  4042. throw err;
  4043. }
  4044. if (preamble) {
  4045. s.prepend(preamble);
  4046. }
  4047. // avoid duplicated unref import
  4048. // as this may get injected by the render function preamble OR the
  4049. // css vars codegen
  4050. if (ast && ast.helpers.includes(CompilerDOM.UNREF)) {
  4051. helperImports.delete('unref');
  4052. }
  4053. returned = code;
  4054. }
  4055. else {
  4056. returned = `() => {}`;
  4057. }
  4058. }
  4059. if (!options.inlineTemplate && !false) {
  4060. // in non-inline mode, the `__isScriptSetup: true` flag is used by
  4061. // componentPublicInstance proxy to allow properties that start with $ or _
  4062. s.appendRight(endOffset, `\nconst __returned__ = ${returned}\n` +
  4063. `Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true })\n` +
  4064. `return __returned__` +
  4065. `\n}\n\n`);
  4066. }
  4067. else {
  4068. s.appendRight(endOffset, `\nreturn ${returned}\n}\n\n`);
  4069. }
  4070. // 11. finalize default export
  4071. let runtimeOptions = ``;
  4072. if (!hasDefaultExportName && filename && filename !== DEFAULT_FILENAME) {
  4073. const match = filename.match(/([^/\\]+)\.\w+$/);
  4074. if (match) {
  4075. runtimeOptions += `\n __name: '${match[1]}',`;
  4076. }
  4077. }
  4078. if (hasInlinedSsrRenderFn) {
  4079. runtimeOptions += `\n __ssrInlineRender: true,`;
  4080. }
  4081. if (propsRuntimeDecl) {
  4082. let declCode = scriptSetup.content
  4083. .slice(propsRuntimeDecl.start, propsRuntimeDecl.end)
  4084. .trim();
  4085. if (propsDestructureDecl) {
  4086. const defaults = [];
  4087. for (const key in propsDestructuredBindings) {
  4088. const d = genDestructuredDefaultValue(key);
  4089. if (d)
  4090. defaults.push(`${key}: ${d}`);
  4091. }
  4092. if (defaults.length) {
  4093. declCode = `${helper(`mergeDefaults`)}(${declCode}, {\n ${defaults.join(',\n ')}\n})`;
  4094. }
  4095. }
  4096. runtimeOptions += `\n props: ${declCode},`;
  4097. }
  4098. else if (propsTypeDecl) {
  4099. runtimeOptions += genRuntimeProps(typeDeclaredProps);
  4100. }
  4101. if (emitsRuntimeDecl) {
  4102. runtimeOptions += `\n emits: ${scriptSetup.content
  4103. .slice(emitsRuntimeDecl.start, emitsRuntimeDecl.end)
  4104. .trim()},`;
  4105. }
  4106. else if (emitsTypeDecl) {
  4107. runtimeOptions += genRuntimeEmits(typeDeclaredEmits);
  4108. }
  4109. // <script setup> components are closed by default. If the user did not
  4110. // explicitly call `defineExpose`, call expose() with no args.
  4111. const exposeCall = hasDefineExposeCall || options.inlineTemplate ? `` : ` expose();\n`;
  4112. // wrap setup code with function.
  4113. if (isTS) {
  4114. // for TS, make sure the exported type is still valid type with
  4115. // correct props information
  4116. // we have to use object spread for types to be merged properly
  4117. // user's TS setting should compile it down to proper targets
  4118. // export default defineComponent({ ...__default__, ... })
  4119. const def = defaultExport ? `\n ...${DEFAULT_VAR},` : ``;
  4120. s.prependLeft(startOffset, `\nexport default /*#__PURE__*/${helper(`defineComponent`)}({${def}${runtimeOptions}\n ${hasAwait ? `async ` : ``}setup(${args}) {\n${exposeCall}`);
  4121. s.appendRight(endOffset, `})`);
  4122. }
  4123. else {
  4124. if (defaultExport) {
  4125. // without TS, can't rely on rest spread, so we use Object.assign
  4126. // export default Object.assign(__default__, { ... })
  4127. s.prependLeft(startOffset, `\nexport default /*#__PURE__*/Object.assign(${DEFAULT_VAR}, {${runtimeOptions}\n ` +
  4128. `${hasAwait ? `async ` : ``}setup(${args}) {\n${exposeCall}`);
  4129. s.appendRight(endOffset, `})`);
  4130. }
  4131. else {
  4132. s.prependLeft(startOffset, `\nexport default {${runtimeOptions}\n ` +
  4133. `${hasAwait ? `async ` : ``}setup(${args}) {\n${exposeCall}`);
  4134. s.appendRight(endOffset, `}`);
  4135. }
  4136. }
  4137. // 12. finalize Vue helper imports
  4138. if (helperImports.size > 0) {
  4139. s.prepend(`import { ${[...helperImports]
  4140. .map(h => `${h} as _${h}`)
  4141. .join(', ')} } from 'vue'\n`);
  4142. }
  4143. s.trim();
  4144. return {
  4145. ...scriptSetup,
  4146. bindings: bindingMetadata,
  4147. imports: userImports,
  4148. content: s.toString(),
  4149. map: genSourceMap
  4150. ? s.generateMap({
  4151. source: filename,
  4152. hires: true,
  4153. includeContent: true
  4154. })
  4155. : undefined,
  4156. scriptAst: scriptAst === null || scriptAst === void 0 ? void 0 : scriptAst.body,
  4157. scriptSetupAst: scriptSetupAst === null || scriptSetupAst === void 0 ? void 0 : scriptSetupAst.body
  4158. };
  4159. }
  4160. function registerBinding(bindings, node, type) {
  4161. bindings[node.name] = type;
  4162. }
  4163. function walkDeclaration(node, bindings, userImportAliases) {
  4164. if (node.type === 'VariableDeclaration') {
  4165. const isConst = node.kind === 'const';
  4166. // export const foo = ...
  4167. for (const { id, init } of node.declarations) {
  4168. const isDefineCall = !!(isConst &&
  4169. isCallOf(init, c => c === DEFINE_PROPS || c === DEFINE_EMITS || c === WITH_DEFAULTS));
  4170. if (id.type === 'Identifier') {
  4171. let bindingType;
  4172. const userReactiveBinding = userImportAliases['reactive'];
  4173. if (isCallOf(init, userReactiveBinding)) {
  4174. // treat reactive() calls as let since it's meant to be mutable
  4175. bindingType = isConst
  4176. ? "setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */
  4177. : "setup-let" /* BindingTypes.SETUP_LET */;
  4178. }
  4179. else if (
  4180. // if a declaration is a const literal, we can mark it so that
  4181. // the generated render fn code doesn't need to unref() it
  4182. isDefineCall ||
  4183. (isConst && canNeverBeRef(init, userReactiveBinding))) {
  4184. bindingType = isCallOf(init, DEFINE_PROPS)
  4185. ? "setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */
  4186. : "setup-const" /* BindingTypes.SETUP_CONST */;
  4187. }
  4188. else if (isConst) {
  4189. if (isCallOf(init, userImportAliases['ref'])) {
  4190. bindingType = "setup-ref" /* BindingTypes.SETUP_REF */;
  4191. }
  4192. else {
  4193. bindingType = "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */;
  4194. }
  4195. }
  4196. else {
  4197. bindingType = "setup-let" /* BindingTypes.SETUP_LET */;
  4198. }
  4199. registerBinding(bindings, id, bindingType);
  4200. }
  4201. else {
  4202. if (isCallOf(init, DEFINE_PROPS)) {
  4203. // skip walking props destructure
  4204. return;
  4205. }
  4206. if (id.type === 'ObjectPattern') {
  4207. walkObjectPattern(id, bindings, isConst, isDefineCall);
  4208. }
  4209. else if (id.type === 'ArrayPattern') {
  4210. walkArrayPattern(id, bindings, isConst, isDefineCall);
  4211. }
  4212. }
  4213. }
  4214. }
  4215. else if (node.type === 'TSEnumDeclaration' ||
  4216. node.type === 'FunctionDeclaration' ||
  4217. node.type === 'ClassDeclaration') {
  4218. // export function foo() {} / export class Foo {}
  4219. // export declarations must be named.
  4220. bindings[node.id.name] = "setup-const" /* BindingTypes.SETUP_CONST */;
  4221. }
  4222. }
  4223. function walkObjectPattern(node, bindings, isConst, isDefineCall = false) {
  4224. for (const p of node.properties) {
  4225. if (p.type === 'ObjectProperty') {
  4226. if (p.key.type === 'Identifier' && p.key === p.value) {
  4227. // shorthand: const { x } = ...
  4228. const type = isDefineCall
  4229. ? "setup-const" /* BindingTypes.SETUP_CONST */
  4230. : isConst
  4231. ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
  4232. : "setup-let" /* BindingTypes.SETUP_LET */;
  4233. registerBinding(bindings, p.key, type);
  4234. }
  4235. else {
  4236. walkPattern(p.value, bindings, isConst, isDefineCall);
  4237. }
  4238. }
  4239. else {
  4240. // ...rest
  4241. // argument can only be identifier when destructuring
  4242. const type = isConst ? "setup-const" /* BindingTypes.SETUP_CONST */ : "setup-let" /* BindingTypes.SETUP_LET */;
  4243. registerBinding(bindings, p.argument, type);
  4244. }
  4245. }
  4246. }
  4247. function walkArrayPattern(node, bindings, isConst, isDefineCall = false) {
  4248. for (const e of node.elements) {
  4249. e && walkPattern(e, bindings, isConst, isDefineCall);
  4250. }
  4251. }
  4252. function walkPattern(node, bindings, isConst, isDefineCall = false) {
  4253. if (node.type === 'Identifier') {
  4254. const type = isDefineCall
  4255. ? "setup-const" /* BindingTypes.SETUP_CONST */
  4256. : isConst
  4257. ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
  4258. : "setup-let" /* BindingTypes.SETUP_LET */;
  4259. registerBinding(bindings, node, type);
  4260. }
  4261. else if (node.type === 'RestElement') {
  4262. // argument can only be identifier when destructuring
  4263. const type = isConst ? "setup-const" /* BindingTypes.SETUP_CONST */ : "setup-let" /* BindingTypes.SETUP_LET */;
  4264. registerBinding(bindings, node.argument, type);
  4265. }
  4266. else if (node.type === 'ObjectPattern') {
  4267. walkObjectPattern(node, bindings, isConst);
  4268. }
  4269. else if (node.type === 'ArrayPattern') {
  4270. walkArrayPattern(node, bindings, isConst);
  4271. }
  4272. else if (node.type === 'AssignmentPattern') {
  4273. if (node.left.type === 'Identifier') {
  4274. const type = isDefineCall
  4275. ? "setup-const" /* BindingTypes.SETUP_CONST */
  4276. : isConst
  4277. ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
  4278. : "setup-let" /* BindingTypes.SETUP_LET */;
  4279. registerBinding(bindings, node.left, type);
  4280. }
  4281. else {
  4282. walkPattern(node.left, bindings, isConst);
  4283. }
  4284. }
  4285. }
  4286. function recordType(node, declaredTypes) {
  4287. if (node.type === 'TSInterfaceDeclaration') {
  4288. declaredTypes[node.id.name] = [`Object`];
  4289. }
  4290. else if (node.type === 'TSTypeAliasDeclaration') {
  4291. declaredTypes[node.id.name] = inferRuntimeType(node.typeAnnotation, declaredTypes);
  4292. }
  4293. else if (node.type === 'ExportNamedDeclaration' && node.declaration) {
  4294. recordType(node.declaration, declaredTypes);
  4295. }
  4296. }
  4297. function extractRuntimeProps(node, props, declaredTypes, isProd) {
  4298. const members = node.type === 'TSTypeLiteral' ? node.members : node.body;
  4299. for (const m of members) {
  4300. if ((m.type === 'TSPropertySignature' || m.type === 'TSMethodSignature') &&
  4301. m.key.type === 'Identifier') {
  4302. let type;
  4303. if (m.type === 'TSMethodSignature') {
  4304. type = ['Function'];
  4305. }
  4306. else if (m.typeAnnotation) {
  4307. type = inferRuntimeType(m.typeAnnotation.typeAnnotation, declaredTypes);
  4308. }
  4309. props[m.key.name] = {
  4310. key: m.key.name,
  4311. required: !m.optional,
  4312. type: type || [`null`]
  4313. };
  4314. }
  4315. }
  4316. }
  4317. function inferRuntimeType(node, declaredTypes) {
  4318. switch (node.type) {
  4319. case 'TSStringKeyword':
  4320. return ['String'];
  4321. case 'TSNumberKeyword':
  4322. return ['Number'];
  4323. case 'TSBooleanKeyword':
  4324. return ['Boolean'];
  4325. case 'TSObjectKeyword':
  4326. return ['Object'];
  4327. case 'TSTypeLiteral':
  4328. // TODO (nice to have) generate runtime property validation
  4329. return ['Object'];
  4330. case 'TSFunctionType':
  4331. return ['Function'];
  4332. case 'TSArrayType':
  4333. case 'TSTupleType':
  4334. // TODO (nice to have) generate runtime element type/length checks
  4335. return ['Array'];
  4336. case 'TSLiteralType':
  4337. switch (node.literal.type) {
  4338. case 'StringLiteral':
  4339. return ['String'];
  4340. case 'BooleanLiteral':
  4341. return ['Boolean'];
  4342. case 'NumericLiteral':
  4343. case 'BigIntLiteral':
  4344. return ['Number'];
  4345. default:
  4346. return [`null`];
  4347. }
  4348. case 'TSTypeReference':
  4349. if (node.typeName.type === 'Identifier') {
  4350. if (declaredTypes[node.typeName.name]) {
  4351. return declaredTypes[node.typeName.name];
  4352. }
  4353. switch (node.typeName.name) {
  4354. case 'Array':
  4355. case 'Function':
  4356. case 'Object':
  4357. case 'Set':
  4358. case 'Map':
  4359. case 'WeakSet':
  4360. case 'WeakMap':
  4361. case 'Date':
  4362. case 'Promise':
  4363. return [node.typeName.name];
  4364. case 'Record':
  4365. case 'Partial':
  4366. case 'Readonly':
  4367. case 'Pick':
  4368. case 'Omit':
  4369. case 'Exclude':
  4370. case 'Extract':
  4371. case 'Required':
  4372. case 'InstanceType':
  4373. return ['Object'];
  4374. }
  4375. }
  4376. return [`null`];
  4377. case 'TSParenthesizedType':
  4378. return inferRuntimeType(node.typeAnnotation, declaredTypes);
  4379. case 'TSUnionType':
  4380. return [
  4381. ...new Set([].concat(...node.types.map(t => inferRuntimeType(t, declaredTypes))))
  4382. ];
  4383. case 'TSIntersectionType':
  4384. return ['Object'];
  4385. case 'TSSymbolKeyword':
  4386. return ['Symbol'];
  4387. default:
  4388. return [`null`]; // no runtime check
  4389. }
  4390. }
  4391. function toRuntimeTypeString(types) {
  4392. return types.length > 1 ? `[${types.join(', ')}]` : types[0];
  4393. }
  4394. function extractRuntimeEmits(node, emits) {
  4395. if (node.type === 'TSTypeLiteral' || node.type === 'TSInterfaceBody') {
  4396. const members = node.type === 'TSTypeLiteral' ? node.members : node.body;
  4397. for (let t of members) {
  4398. if (t.type === 'TSCallSignatureDeclaration') {
  4399. extractEventNames(t.parameters[0], emits);
  4400. }
  4401. }
  4402. return;
  4403. }
  4404. else {
  4405. extractEventNames(node.parameters[0], emits);
  4406. }
  4407. }
  4408. function extractEventNames(eventName, emits) {
  4409. if (eventName.type === 'Identifier' &&
  4410. eventName.typeAnnotation &&
  4411. eventName.typeAnnotation.type === 'TSTypeAnnotation') {
  4412. const typeNode = eventName.typeAnnotation.typeAnnotation;
  4413. if (typeNode.type === 'TSLiteralType') {
  4414. if (typeNode.literal.type !== 'UnaryExpression') {
  4415. emits.add(String(typeNode.literal.value));
  4416. }
  4417. }
  4418. else if (typeNode.type === 'TSUnionType') {
  4419. for (const t of typeNode.types) {
  4420. if (t.type === 'TSLiteralType' &&
  4421. t.literal.type !== 'UnaryExpression') {
  4422. emits.add(String(t.literal.value));
  4423. }
  4424. }
  4425. }
  4426. }
  4427. }
  4428. function genRuntimeEmits(emits) {
  4429. return emits.size
  4430. ? `\n emits: [${Array.from(emits)
  4431. .map(p => JSON.stringify(p))
  4432. .join(', ')}],`
  4433. : ``;
  4434. }
  4435. function isCallOf(node, test) {
  4436. return !!(node &&
  4437. test &&
  4438. node.type === 'CallExpression' &&
  4439. node.callee.type === 'Identifier' &&
  4440. (typeof test === 'string'
  4441. ? node.callee.name === test
  4442. : test(node.callee.name)));
  4443. }
  4444. function canNeverBeRef(node, userReactiveImport) {
  4445. if (isCallOf(node, userReactiveImport)) {
  4446. return true;
  4447. }
  4448. switch (node.type) {
  4449. case 'UnaryExpression':
  4450. case 'BinaryExpression':
  4451. case 'ArrayExpression':
  4452. case 'ObjectExpression':
  4453. case 'FunctionExpression':
  4454. case 'ArrowFunctionExpression':
  4455. case 'UpdateExpression':
  4456. case 'ClassExpression':
  4457. case 'TaggedTemplateExpression':
  4458. return true;
  4459. case 'SequenceExpression':
  4460. return canNeverBeRef(node.expressions[node.expressions.length - 1], userReactiveImport);
  4461. default:
  4462. if (node.type.endsWith('Literal')) {
  4463. return true;
  4464. }
  4465. return false;
  4466. }
  4467. }
  4468. /**
  4469. * Analyze bindings in normal `<script>`
  4470. * Note that `compileScriptSetup` already analyzes bindings as part of its
  4471. * compilation process so this should only be used on single `<script>` SFCs.
  4472. */
  4473. function analyzeScriptBindings(ast) {
  4474. for (const node of ast) {
  4475. if (node.type === 'ExportDefaultDeclaration' &&
  4476. node.declaration.type === 'ObjectExpression') {
  4477. return analyzeBindingsFromOptions(node.declaration);
  4478. }
  4479. }
  4480. return {};
  4481. }
  4482. function analyzeBindingsFromOptions(node) {
  4483. const bindings = {};
  4484. // #3270, #3275
  4485. // mark non-script-setup so we don't resolve components/directives from these
  4486. Object.defineProperty(bindings, '__isScriptSetup', {
  4487. enumerable: false,
  4488. value: false
  4489. });
  4490. for (const property of node.properties) {
  4491. if (property.type === 'ObjectProperty' &&
  4492. !property.computed &&
  4493. property.key.type === 'Identifier') {
  4494. // props
  4495. if (property.key.name === 'props') {
  4496. // props: ['foo']
  4497. // props: { foo: ... }
  4498. for (const key of getObjectOrArrayExpressionKeys(property.value)) {
  4499. bindings[key] = "props" /* BindingTypes.PROPS */;
  4500. }
  4501. }
  4502. // inject
  4503. else if (property.key.name === 'inject') {
  4504. // inject: ['foo']
  4505. // inject: { foo: {} }
  4506. for (const key of getObjectOrArrayExpressionKeys(property.value)) {
  4507. bindings[key] = "options" /* BindingTypes.OPTIONS */;
  4508. }
  4509. }
  4510. // computed & methods
  4511. else if (property.value.type === 'ObjectExpression' &&
  4512. (property.key.name === 'computed' || property.key.name === 'methods')) {
  4513. // methods: { foo() {} }
  4514. // computed: { foo() {} }
  4515. for (const key of getObjectExpressionKeys(property.value)) {
  4516. bindings[key] = "options" /* BindingTypes.OPTIONS */;
  4517. }
  4518. }
  4519. }
  4520. // setup & data
  4521. else if (property.type === 'ObjectMethod' &&
  4522. property.key.type === 'Identifier' &&
  4523. (property.key.name === 'setup' || property.key.name === 'data')) {
  4524. for (const bodyItem of property.body.body) {
  4525. // setup() {
  4526. // return {
  4527. // foo: null
  4528. // }
  4529. // }
  4530. if (bodyItem.type === 'ReturnStatement' &&
  4531. bodyItem.argument &&
  4532. bodyItem.argument.type === 'ObjectExpression') {
  4533. for (const key of getObjectExpressionKeys(bodyItem.argument)) {
  4534. bindings[key] =
  4535. property.key.name === 'setup'
  4536. ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
  4537. : "data" /* BindingTypes.DATA */;
  4538. }
  4539. }
  4540. }
  4541. }
  4542. }
  4543. return bindings;
  4544. }
  4545. function getObjectExpressionKeys(node) {
  4546. const keys = [];
  4547. for (const prop of node.properties) {
  4548. if (prop.type === 'SpreadElement')
  4549. continue;
  4550. const key = resolveObjectKey(prop.key, prop.computed);
  4551. if (key)
  4552. keys.push(String(key));
  4553. }
  4554. return keys;
  4555. }
  4556. function getArrayExpressionKeys(node) {
  4557. const keys = [];
  4558. for (const element of node.elements) {
  4559. if (element && element.type === 'StringLiteral') {
  4560. keys.push(element.value);
  4561. }
  4562. }
  4563. return keys;
  4564. }
  4565. function getObjectOrArrayExpressionKeys(value) {
  4566. if (value.type === 'ArrayExpression') {
  4567. return getArrayExpressionKeys(value);
  4568. }
  4569. if (value.type === 'ObjectExpression') {
  4570. return getObjectExpressionKeys(value);
  4571. }
  4572. return [];
  4573. }
  4574. const templateUsageCheckCache = createCache();
  4575. function resolveTemplateUsageCheckString(sfc) {
  4576. const { content, ast } = sfc.template;
  4577. const cached = templateUsageCheckCache.get(content);
  4578. if (cached) {
  4579. return cached;
  4580. }
  4581. let code = '';
  4582. CompilerDOM.transform(CompilerDOM.createRoot([ast]), {
  4583. nodeTransforms: [
  4584. node => {
  4585. if (node.type === 1 /* NodeTypes.ELEMENT */) {
  4586. if (!CompilerDOM.parserOptions.isNativeTag(node.tag) &&
  4587. !CompilerDOM.parserOptions.isBuiltInComponent(node.tag)) {
  4588. code += `,${shared.camelize(node.tag)},${shared.capitalize(shared.camelize(node.tag))}`;
  4589. }
  4590. for (let i = 0; i < node.props.length; i++) {
  4591. const prop = node.props[i];
  4592. if (prop.type === 7 /* NodeTypes.DIRECTIVE */) {
  4593. if (!isBuiltInDir(prop.name)) {
  4594. code += `,v${shared.capitalize(shared.camelize(prop.name))}`;
  4595. }
  4596. if (prop.exp) {
  4597. code += `,${processExp(prop.exp.content, prop.name)}`;
  4598. }
  4599. }
  4600. }
  4601. }
  4602. else if (node.type === 5 /* NodeTypes.INTERPOLATION */) {
  4603. code += `,${processExp(node.content.content)}`;
  4604. }
  4605. }
  4606. ]
  4607. });
  4608. code += ';';
  4609. templateUsageCheckCache.set(content, code);
  4610. return code;
  4611. }
  4612. const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  4613. function processExp(exp, dir) {
  4614. if (/ as\s+\w|<.*>|:/.test(exp)) {
  4615. if (dir === 'slot') {
  4616. exp = `(${exp})=>{}`;
  4617. }
  4618. else if (dir === 'on') {
  4619. exp = `()=>{return ${exp}}`;
  4620. }
  4621. else if (dir === 'for') {
  4622. const inMatch = exp.match(forAliasRE);
  4623. if (inMatch) {
  4624. const [, LHS, RHS] = inMatch;
  4625. return processExp(`(${LHS})=>{}`) + processExp(RHS);
  4626. }
  4627. }
  4628. let ret = '';
  4629. // has potential type cast or generic arguments that uses types
  4630. const ast = parser$2.parseExpression(exp, { plugins: ['typescript'] });
  4631. CompilerDOM.walkIdentifiers(ast, node => {
  4632. ret += `,` + node.name;
  4633. });
  4634. return ret;
  4635. }
  4636. return stripStrings(exp);
  4637. }
  4638. function stripStrings(exp) {
  4639. return exp
  4640. .replace(/'[^']*'|"[^"]*"/g, '')
  4641. .replace(/`[^`]+`/g, stripTemplateString);
  4642. }
  4643. function stripTemplateString(str) {
  4644. const interpMatch = str.match(/\${[^}]+}/g);
  4645. if (interpMatch) {
  4646. return interpMatch.map(m => m.slice(2, -1)).join(',');
  4647. }
  4648. return '';
  4649. }
  4650. function isImportUsed(local, sfc) {
  4651. return new RegExp(
  4652. // #4274 escape $ since it's a special char in regex
  4653. // (and is the only regex special char that is valid in identifiers)
  4654. `[^\\w$_]${local.replace(/\$/g, '\\$')}[^\\w$_]`).test(resolveTemplateUsageCheckString(sfc));
  4655. }
  4656. /**
  4657. * Note: this comparison assumes the prev/next script are already identical,
  4658. * and only checks the special case where <script setup lang="ts"> unused import
  4659. * pruning result changes due to template changes.
  4660. */
  4661. function hmrShouldReload(prevImports, next) {
  4662. if (!next.scriptSetup ||
  4663. (next.scriptSetup.lang !== 'ts' && next.scriptSetup.lang !== 'tsx')) {
  4664. return false;
  4665. }
  4666. // for each previous import, check if its used status remain the same based on
  4667. // the next descriptor's template
  4668. for (const key in prevImports) {
  4669. // if an import was previous unused, but now is used, we need to force
  4670. // reload so that the script now includes that import.
  4671. if (!prevImports[key].isUsedInTemplate && isImportUsed(key, next)) {
  4672. return true;
  4673. }
  4674. }
  4675. return false;
  4676. }
  4677. function resolveObjectKey(node, computed) {
  4678. switch (node.type) {
  4679. case 'StringLiteral':
  4680. case 'NumericLiteral':
  4681. return node.value;
  4682. case 'Identifier':
  4683. if (!computed)
  4684. return node.name;
  4685. }
  4686. return undefined;
  4687. }
  4688. const DEFAULT_FILENAME = 'anonymous.vue';
  4689. const sourceToSFC = createCache();
  4690. function parse(source, { sourceMap = true, filename = DEFAULT_FILENAME, sourceRoot = '', pad = false, ignoreEmpty = true, compiler = CompilerDOM__namespace } = {}) {
  4691. const sourceKey = source + sourceMap + filename + sourceRoot + pad + compiler.parse;
  4692. const cache = sourceToSFC.get(sourceKey);
  4693. if (cache) {
  4694. return cache;
  4695. }
  4696. const descriptor = {
  4697. filename,
  4698. source,
  4699. template: null,
  4700. script: null,
  4701. scriptSetup: null,
  4702. styles: [],
  4703. customBlocks: [],
  4704. cssVars: [],
  4705. slotted: false,
  4706. shouldForceReload: prevImports => hmrShouldReload(prevImports, descriptor)
  4707. };
  4708. const errors = [];
  4709. const ast = compiler.parse(source, {
  4710. // there are no components at SFC parsing level
  4711. isNativeTag: () => true,
  4712. // preserve all whitespaces
  4713. isPreTag: () => true,
  4714. getTextMode: ({ tag, props }, parent) => {
  4715. // all top level elements except <template> are parsed as raw text
  4716. // containers
  4717. if ((!parent && tag !== 'template') ||
  4718. // <template lang="xxx"> should also be treated as raw text
  4719. (tag === 'template' &&
  4720. props.some(p => p.type === 6 /* NodeTypes.ATTRIBUTE */ &&
  4721. p.name === 'lang' &&
  4722. p.value &&
  4723. p.value.content &&
  4724. p.value.content !== 'html'))) {
  4725. return 2 /* TextModes.RAWTEXT */;
  4726. }
  4727. else {
  4728. return 0 /* TextModes.DATA */;
  4729. }
  4730. },
  4731. onError: e => {
  4732. errors.push(e);
  4733. }
  4734. });
  4735. ast.children.forEach(node => {
  4736. if (node.type !== 1 /* NodeTypes.ELEMENT */) {
  4737. return;
  4738. }
  4739. // we only want to keep the nodes that are not empty (when the tag is not a template)
  4740. if (ignoreEmpty &&
  4741. node.tag !== 'template' &&
  4742. isEmpty(node) &&
  4743. !hasSrc(node)) {
  4744. return;
  4745. }
  4746. switch (node.tag) {
  4747. case 'template':
  4748. if (!descriptor.template) {
  4749. const templateBlock = (descriptor.template = createBlock(node, source, false));
  4750. templateBlock.ast = node;
  4751. // warn against 2.x <template functional>
  4752. if (templateBlock.attrs.functional) {
  4753. const err = new SyntaxError(`<template functional> is no longer supported in Vue 3, since ` +
  4754. `functional components no longer have significant performance ` +
  4755. `difference from stateful ones. Just use a normal <template> ` +
  4756. `instead.`);
  4757. err.loc = node.props.find(p => p.name === 'functional').loc;
  4758. errors.push(err);
  4759. }
  4760. }
  4761. else {
  4762. errors.push(createDuplicateBlockError(node));
  4763. }
  4764. break;
  4765. case 'script':
  4766. const scriptBlock = createBlock(node, source, pad);
  4767. const isSetup = !!scriptBlock.attrs.setup;
  4768. if (isSetup && !descriptor.scriptSetup) {
  4769. descriptor.scriptSetup = scriptBlock;
  4770. break;
  4771. }
  4772. if (!isSetup && !descriptor.script) {
  4773. descriptor.script = scriptBlock;
  4774. break;
  4775. }
  4776. errors.push(createDuplicateBlockError(node, isSetup));
  4777. break;
  4778. case 'style':
  4779. const styleBlock = createBlock(node, source, pad);
  4780. if (styleBlock.attrs.vars) {
  4781. errors.push(new SyntaxError(`<style vars> has been replaced by a new proposal: ` +
  4782. `https://github.com/vuejs/rfcs/pull/231`));
  4783. }
  4784. descriptor.styles.push(styleBlock);
  4785. break;
  4786. default:
  4787. descriptor.customBlocks.push(createBlock(node, source, pad));
  4788. break;
  4789. }
  4790. });
  4791. if (!descriptor.template && !descriptor.script && !descriptor.scriptSetup) {
  4792. errors.push(new SyntaxError(`At least one <template> or <script> is required in a single file component.`));
  4793. }
  4794. if (descriptor.scriptSetup) {
  4795. if (descriptor.scriptSetup.src) {
  4796. errors.push(new SyntaxError(`<script setup> cannot use the "src" attribute because ` +
  4797. `its syntax will be ambiguous outside of the component.`));
  4798. descriptor.scriptSetup = null;
  4799. }
  4800. if (descriptor.script && descriptor.script.src) {
  4801. errors.push(new SyntaxError(`<script> cannot use the "src" attribute when <script setup> is ` +
  4802. `also present because they must be processed together.`));
  4803. descriptor.script = null;
  4804. }
  4805. }
  4806. if (sourceMap) {
  4807. const genMap = (block) => {
  4808. if (block && !block.src) {
  4809. block.map = generateSourceMap(filename, source, block.content, sourceRoot, !pad || block.type === 'template' ? block.loc.start.line - 1 : 0);
  4810. }
  4811. };
  4812. genMap(descriptor.template);
  4813. genMap(descriptor.script);
  4814. descriptor.styles.forEach(genMap);
  4815. descriptor.customBlocks.forEach(genMap);
  4816. }
  4817. // parse CSS vars
  4818. descriptor.cssVars = parseCssVars(descriptor);
  4819. // check if the SFC uses :slotted
  4820. const slottedRE = /(?:::v-|:)slotted\(/;
  4821. descriptor.slotted = descriptor.styles.some(s => s.scoped && slottedRE.test(s.content));
  4822. const result = {
  4823. descriptor,
  4824. errors
  4825. };
  4826. sourceToSFC.set(sourceKey, result);
  4827. return result;
  4828. }
  4829. function createDuplicateBlockError(node, isScriptSetup = false) {
  4830. const err = new SyntaxError(`Single file component can contain only one <${node.tag}${isScriptSetup ? ` setup` : ``}> element`);
  4831. err.loc = node.loc;
  4832. return err;
  4833. }
  4834. function createBlock(node, source, pad) {
  4835. const type = node.tag;
  4836. let { start, end } = node.loc;
  4837. let content = '';
  4838. if (node.children.length) {
  4839. start = node.children[0].loc.start;
  4840. end = node.children[node.children.length - 1].loc.end;
  4841. content = source.slice(start.offset, end.offset);
  4842. }
  4843. else {
  4844. const offset = node.loc.source.indexOf(`</`);
  4845. if (offset > -1) {
  4846. start = {
  4847. line: start.line,
  4848. column: start.column + offset,
  4849. offset: start.offset + offset
  4850. };
  4851. }
  4852. end = { ...start };
  4853. }
  4854. const loc = {
  4855. source: content,
  4856. start,
  4857. end
  4858. };
  4859. const attrs = {};
  4860. const block = {
  4861. type,
  4862. content,
  4863. loc,
  4864. attrs
  4865. };
  4866. if (pad) {
  4867. block.content = padContent(source, block, pad) + block.content;
  4868. }
  4869. node.props.forEach(p => {
  4870. if (p.type === 6 /* NodeTypes.ATTRIBUTE */) {
  4871. attrs[p.name] = p.value ? p.value.content || true : true;
  4872. if (p.name === 'lang') {
  4873. block.lang = p.value && p.value.content;
  4874. }
  4875. else if (p.name === 'src') {
  4876. block.src = p.value && p.value.content;
  4877. }
  4878. else if (type === 'style') {
  4879. if (p.name === 'scoped') {
  4880. block.scoped = true;
  4881. }
  4882. else if (p.name === 'module') {
  4883. block.module = attrs[p.name];
  4884. }
  4885. }
  4886. else if (type === 'script' && p.name === 'setup') {
  4887. block.setup = attrs.setup;
  4888. }
  4889. }
  4890. });
  4891. return block;
  4892. }
  4893. const splitRE = /\r?\n/g;
  4894. const emptyRE = /^(?:\/\/)?\s*$/;
  4895. const replaceRE = /./g;
  4896. function generateSourceMap(filename, source, generated, sourceRoot, lineOffset) {
  4897. const map = new sourceMap.SourceMapGenerator({
  4898. file: filename.replace(/\\/g, '/'),
  4899. sourceRoot: sourceRoot.replace(/\\/g, '/')
  4900. });
  4901. map.setSourceContent(filename, source);
  4902. generated.split(splitRE).forEach((line, index) => {
  4903. if (!emptyRE.test(line)) {
  4904. const originalLine = index + 1 + lineOffset;
  4905. const generatedLine = index + 1;
  4906. for (let i = 0; i < line.length; i++) {
  4907. if (!/\s/.test(line[i])) {
  4908. map.addMapping({
  4909. source: filename,
  4910. original: {
  4911. line: originalLine,
  4912. column: i
  4913. },
  4914. generated: {
  4915. line: generatedLine,
  4916. column: i
  4917. }
  4918. });
  4919. }
  4920. }
  4921. }
  4922. });
  4923. return JSON.parse(map.toString());
  4924. }
  4925. function padContent(content, block, pad) {
  4926. content = content.slice(0, block.loc.start.offset);
  4927. if (pad === 'space') {
  4928. return content.replace(replaceRE, ' ');
  4929. }
  4930. else {
  4931. const offset = content.split(splitRE).length;
  4932. const padChar = block.type === 'script' && !block.lang ? '//\n' : '\n';
  4933. return Array(offset).join(padChar);
  4934. }
  4935. }
  4936. function hasSrc(node) {
  4937. return node.props.some(p => {
  4938. if (p.type !== 6 /* NodeTypes.ATTRIBUTE */) {
  4939. return false;
  4940. }
  4941. return p.name === 'src';
  4942. });
  4943. }
  4944. /**
  4945. * Returns true if the node has no children
  4946. * once the empty text nodes (trimmed content) have been filtered out.
  4947. */
  4948. function isEmpty(node) {
  4949. for (let i = 0; i < node.children.length; i++) {
  4950. const child = node.children[i];
  4951. if (child.type !== 2 /* NodeTypes.TEXT */ || child.content.trim() !== '') {
  4952. return false;
  4953. }
  4954. }
  4955. return true;
  4956. }
  4957. const trimPlugin = () => {
  4958. return {
  4959. postcssPlugin: 'vue-sfc-trim',
  4960. Once(root) {
  4961. root.walk(({ type, raws }) => {
  4962. if (type === 'rule' || type === 'atrule') {
  4963. if (raws.before)
  4964. raws.before = '\n';
  4965. if ('after' in raws && raws.after)
  4966. raws.after = '\n';
  4967. }
  4968. });
  4969. }
  4970. };
  4971. };
  4972. trimPlugin.postcss = true;
  4973. var unesc_1 = createCommonjsModule(function (module, exports) {
  4974. exports.__esModule = true;
  4975. exports["default"] = unesc;
  4976. // Many thanks for this post which made this migration much easier.
  4977. // https://mathiasbynens.be/notes/css-escapes
  4978. /**
  4979. *
  4980. * @param {string} str
  4981. * @returns {[string, number]|undefined}
  4982. */
  4983. function gobbleHex(str) {
  4984. var lower = str.toLowerCase();
  4985. var hex = '';
  4986. var spaceTerminated = false;
  4987. for (var i = 0; i < 6 && lower[i] !== undefined; i++) {
  4988. var code = lower.charCodeAt(i); // check to see if we are dealing with a valid hex char [a-f|0-9]
  4989. var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57; // https://drafts.csswg.org/css-syntax/#consume-escaped-code-point
  4990. spaceTerminated = code === 32;
  4991. if (!valid) {
  4992. break;
  4993. }
  4994. hex += lower[i];
  4995. }
  4996. if (hex.length === 0) {
  4997. return undefined;
  4998. }
  4999. var codePoint = parseInt(hex, 16);
  5000. var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF; // Add special case for
  5001. // "If this number is zero, or is for a surrogate, or is greater than the maximum allowed code point"
  5002. // https://drafts.csswg.org/css-syntax/#maximum-allowed-code-point
  5003. if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10FFFF) {
  5004. return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)];
  5005. }
  5006. return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)];
  5007. }
  5008. var CONTAINS_ESCAPE = /\\/;
  5009. function unesc(str) {
  5010. var needToProcess = CONTAINS_ESCAPE.test(str);
  5011. if (!needToProcess) {
  5012. return str;
  5013. }
  5014. var ret = "";
  5015. for (var i = 0; i < str.length; i++) {
  5016. if (str[i] === "\\") {
  5017. var gobbled = gobbleHex(str.slice(i + 1, i + 7));
  5018. if (gobbled !== undefined) {
  5019. ret += gobbled[0];
  5020. i += gobbled[1];
  5021. continue;
  5022. } // Retain a pair of \\ if double escaped `\\\\`
  5023. // https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e
  5024. if (str[i + 1] === "\\") {
  5025. ret += "\\";
  5026. i++;
  5027. continue;
  5028. } // if \\ is at the end of the string retain it
  5029. // https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb
  5030. if (str.length === i + 1) {
  5031. ret += str[i];
  5032. }
  5033. continue;
  5034. }
  5035. ret += str[i];
  5036. }
  5037. return ret;
  5038. }
  5039. module.exports = exports.default;
  5040. });
  5041. var getProp_1 = createCommonjsModule(function (module, exports) {
  5042. exports.__esModule = true;
  5043. exports["default"] = getProp;
  5044. function getProp(obj) {
  5045. for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  5046. props[_key - 1] = arguments[_key];
  5047. }
  5048. while (props.length > 0) {
  5049. var prop = props.shift();
  5050. if (!obj[prop]) {
  5051. return undefined;
  5052. }
  5053. obj = obj[prop];
  5054. }
  5055. return obj;
  5056. }
  5057. module.exports = exports.default;
  5058. });
  5059. var ensureObject_1 = createCommonjsModule(function (module, exports) {
  5060. exports.__esModule = true;
  5061. exports["default"] = ensureObject;
  5062. function ensureObject(obj) {
  5063. for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  5064. props[_key - 1] = arguments[_key];
  5065. }
  5066. while (props.length > 0) {
  5067. var prop = props.shift();
  5068. if (!obj[prop]) {
  5069. obj[prop] = {};
  5070. }
  5071. obj = obj[prop];
  5072. }
  5073. }
  5074. module.exports = exports.default;
  5075. });
  5076. var stripComments_1 = createCommonjsModule(function (module, exports) {
  5077. exports.__esModule = true;
  5078. exports["default"] = stripComments;
  5079. function stripComments(str) {
  5080. var s = "";
  5081. var commentStart = str.indexOf("/*");
  5082. var lastEnd = 0;
  5083. while (commentStart >= 0) {
  5084. s = s + str.slice(lastEnd, commentStart);
  5085. var commentEnd = str.indexOf("*/", commentStart + 2);
  5086. if (commentEnd < 0) {
  5087. return s;
  5088. }
  5089. lastEnd = commentEnd + 2;
  5090. commentStart = str.indexOf("/*", lastEnd);
  5091. }
  5092. s = s + str.slice(lastEnd);
  5093. return s;
  5094. }
  5095. module.exports = exports.default;
  5096. });
  5097. var util = createCommonjsModule(function (module, exports) {
  5098. exports.__esModule = true;
  5099. exports.stripComments = exports.ensureObject = exports.getProp = exports.unesc = void 0;
  5100. var _unesc = _interopRequireDefault(unesc_1);
  5101. exports.unesc = _unesc["default"];
  5102. var _getProp = _interopRequireDefault(getProp_1);
  5103. exports.getProp = _getProp["default"];
  5104. var _ensureObject = _interopRequireDefault(ensureObject_1);
  5105. exports.ensureObject = _ensureObject["default"];
  5106. var _stripComments = _interopRequireDefault(stripComments_1);
  5107. exports.stripComments = _stripComments["default"];
  5108. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5109. });
  5110. var node = createCommonjsModule(function (module, exports) {
  5111. exports.__esModule = true;
  5112. exports["default"] = void 0;
  5113. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5114. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5115. var cloneNode = function cloneNode(obj, parent) {
  5116. if (typeof obj !== 'object' || obj === null) {
  5117. return obj;
  5118. }
  5119. var cloned = new obj.constructor();
  5120. for (var i in obj) {
  5121. if (!obj.hasOwnProperty(i)) {
  5122. continue;
  5123. }
  5124. var value = obj[i];
  5125. var type = typeof value;
  5126. if (i === 'parent' && type === 'object') {
  5127. if (parent) {
  5128. cloned[i] = parent;
  5129. }
  5130. } else if (value instanceof Array) {
  5131. cloned[i] = value.map(function (j) {
  5132. return cloneNode(j, cloned);
  5133. });
  5134. } else {
  5135. cloned[i] = cloneNode(value, cloned);
  5136. }
  5137. }
  5138. return cloned;
  5139. };
  5140. var Node = /*#__PURE__*/function () {
  5141. function Node(opts) {
  5142. if (opts === void 0) {
  5143. opts = {};
  5144. }
  5145. Object.assign(this, opts);
  5146. this.spaces = this.spaces || {};
  5147. this.spaces.before = this.spaces.before || '';
  5148. this.spaces.after = this.spaces.after || '';
  5149. }
  5150. var _proto = Node.prototype;
  5151. _proto.remove = function remove() {
  5152. if (this.parent) {
  5153. this.parent.removeChild(this);
  5154. }
  5155. this.parent = undefined;
  5156. return this;
  5157. };
  5158. _proto.replaceWith = function replaceWith() {
  5159. if (this.parent) {
  5160. for (var index in arguments) {
  5161. this.parent.insertBefore(this, arguments[index]);
  5162. }
  5163. this.remove();
  5164. }
  5165. return this;
  5166. };
  5167. _proto.next = function next() {
  5168. return this.parent.at(this.parent.index(this) + 1);
  5169. };
  5170. _proto.prev = function prev() {
  5171. return this.parent.at(this.parent.index(this) - 1);
  5172. };
  5173. _proto.clone = function clone(overrides) {
  5174. if (overrides === void 0) {
  5175. overrides = {};
  5176. }
  5177. var cloned = cloneNode(this);
  5178. for (var name in overrides) {
  5179. cloned[name] = overrides[name];
  5180. }
  5181. return cloned;
  5182. }
  5183. /**
  5184. * Some non-standard syntax doesn't follow normal escaping rules for css.
  5185. * This allows non standard syntax to be appended to an existing property
  5186. * by specifying the escaped value. By specifying the escaped value,
  5187. * illegal characters are allowed to be directly inserted into css output.
  5188. * @param {string} name the property to set
  5189. * @param {any} value the unescaped value of the property
  5190. * @param {string} valueEscaped optional. the escaped value of the property.
  5191. */
  5192. ;
  5193. _proto.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) {
  5194. if (!this.raws) {
  5195. this.raws = {};
  5196. }
  5197. var originalValue = this[name];
  5198. var originalEscaped = this.raws[name];
  5199. this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first.
  5200. if (originalEscaped || valueEscaped !== value) {
  5201. this.raws[name] = (originalEscaped || originalValue) + valueEscaped;
  5202. } else {
  5203. delete this.raws[name]; // delete any escaped value that was created by the setter.
  5204. }
  5205. }
  5206. /**
  5207. * Some non-standard syntax doesn't follow normal escaping rules for css.
  5208. * This allows the escaped value to be specified directly, allowing illegal
  5209. * characters to be directly inserted into css output.
  5210. * @param {string} name the property to set
  5211. * @param {any} value the unescaped value of the property
  5212. * @param {string} valueEscaped the escaped value of the property.
  5213. */
  5214. ;
  5215. _proto.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) {
  5216. if (!this.raws) {
  5217. this.raws = {};
  5218. }
  5219. this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
  5220. this.raws[name] = valueEscaped;
  5221. }
  5222. /**
  5223. * When you want a value to passed through to CSS directly. This method
  5224. * deletes the corresponding raw value causing the stringifier to fallback
  5225. * to the unescaped value.
  5226. * @param {string} name the property to set.
  5227. * @param {any} value The value that is both escaped and unescaped.
  5228. */
  5229. ;
  5230. _proto.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) {
  5231. this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
  5232. if (this.raws) {
  5233. delete this.raws[name];
  5234. }
  5235. }
  5236. /**
  5237. *
  5238. * @param {number} line The number (starting with 1)
  5239. * @param {number} column The column number (starting with 1)
  5240. */
  5241. ;
  5242. _proto.isAtPosition = function isAtPosition(line, column) {
  5243. if (this.source && this.source.start && this.source.end) {
  5244. if (this.source.start.line > line) {
  5245. return false;
  5246. }
  5247. if (this.source.end.line < line) {
  5248. return false;
  5249. }
  5250. if (this.source.start.line === line && this.source.start.column > column) {
  5251. return false;
  5252. }
  5253. if (this.source.end.line === line && this.source.end.column < column) {
  5254. return false;
  5255. }
  5256. return true;
  5257. }
  5258. return undefined;
  5259. };
  5260. _proto.stringifyProperty = function stringifyProperty(name) {
  5261. return this.raws && this.raws[name] || this[name];
  5262. };
  5263. _proto.valueToString = function valueToString() {
  5264. return String(this.stringifyProperty("value"));
  5265. };
  5266. _proto.toString = function toString() {
  5267. return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join('');
  5268. };
  5269. _createClass(Node, [{
  5270. key: "rawSpaceBefore",
  5271. get: function get() {
  5272. var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before;
  5273. if (rawSpace === undefined) {
  5274. rawSpace = this.spaces && this.spaces.before;
  5275. }
  5276. return rawSpace || "";
  5277. },
  5278. set: function set(raw) {
  5279. (0, util.ensureObject)(this, "raws", "spaces");
  5280. this.raws.spaces.before = raw;
  5281. }
  5282. }, {
  5283. key: "rawSpaceAfter",
  5284. get: function get() {
  5285. var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after;
  5286. if (rawSpace === undefined) {
  5287. rawSpace = this.spaces.after;
  5288. }
  5289. return rawSpace || "";
  5290. },
  5291. set: function set(raw) {
  5292. (0, util.ensureObject)(this, "raws", "spaces");
  5293. this.raws.spaces.after = raw;
  5294. }
  5295. }]);
  5296. return Node;
  5297. }();
  5298. exports["default"] = Node;
  5299. module.exports = exports.default;
  5300. });
  5301. var types = createCommonjsModule(function (module, exports) {
  5302. exports.__esModule = true;
  5303. exports.UNIVERSAL = exports.ATTRIBUTE = exports.CLASS = exports.COMBINATOR = exports.COMMENT = exports.ID = exports.NESTING = exports.PSEUDO = exports.ROOT = exports.SELECTOR = exports.STRING = exports.TAG = void 0;
  5304. var TAG = 'tag';
  5305. exports.TAG = TAG;
  5306. var STRING = 'string';
  5307. exports.STRING = STRING;
  5308. var SELECTOR = 'selector';
  5309. exports.SELECTOR = SELECTOR;
  5310. var ROOT = 'root';
  5311. exports.ROOT = ROOT;
  5312. var PSEUDO = 'pseudo';
  5313. exports.PSEUDO = PSEUDO;
  5314. var NESTING = 'nesting';
  5315. exports.NESTING = NESTING;
  5316. var ID = 'id';
  5317. exports.ID = ID;
  5318. var COMMENT = 'comment';
  5319. exports.COMMENT = COMMENT;
  5320. var COMBINATOR = 'combinator';
  5321. exports.COMBINATOR = COMBINATOR;
  5322. var CLASS = 'class';
  5323. exports.CLASS = CLASS;
  5324. var ATTRIBUTE = 'attribute';
  5325. exports.ATTRIBUTE = ATTRIBUTE;
  5326. var UNIVERSAL = 'universal';
  5327. exports.UNIVERSAL = UNIVERSAL;
  5328. });
  5329. var container = createCommonjsModule(function (module, exports) {
  5330. exports.__esModule = true;
  5331. exports["default"] = void 0;
  5332. var _node = _interopRequireDefault(node);
  5333. var types$1 = _interopRequireWildcard(types);
  5334. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  5335. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
  5336. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5337. function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } it = o[Symbol.iterator](); return it.next.bind(it); }
  5338. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  5339. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  5340. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5341. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5342. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5343. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5344. var Container = /*#__PURE__*/function (_Node) {
  5345. _inheritsLoose(Container, _Node);
  5346. function Container(opts) {
  5347. var _this;
  5348. _this = _Node.call(this, opts) || this;
  5349. if (!_this.nodes) {
  5350. _this.nodes = [];
  5351. }
  5352. return _this;
  5353. }
  5354. var _proto = Container.prototype;
  5355. _proto.append = function append(selector) {
  5356. selector.parent = this;
  5357. this.nodes.push(selector);
  5358. return this;
  5359. };
  5360. _proto.prepend = function prepend(selector) {
  5361. selector.parent = this;
  5362. this.nodes.unshift(selector);
  5363. return this;
  5364. };
  5365. _proto.at = function at(index) {
  5366. return this.nodes[index];
  5367. };
  5368. _proto.index = function index(child) {
  5369. if (typeof child === 'number') {
  5370. return child;
  5371. }
  5372. return this.nodes.indexOf(child);
  5373. };
  5374. _proto.removeChild = function removeChild(child) {
  5375. child = this.index(child);
  5376. this.at(child).parent = undefined;
  5377. this.nodes.splice(child, 1);
  5378. var index;
  5379. for (var id in this.indexes) {
  5380. index = this.indexes[id];
  5381. if (index >= child) {
  5382. this.indexes[id] = index - 1;
  5383. }
  5384. }
  5385. return this;
  5386. };
  5387. _proto.removeAll = function removeAll() {
  5388. for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done;) {
  5389. var node = _step.value;
  5390. node.parent = undefined;
  5391. }
  5392. this.nodes = [];
  5393. return this;
  5394. };
  5395. _proto.empty = function empty() {
  5396. return this.removeAll();
  5397. };
  5398. _proto.insertAfter = function insertAfter(oldNode, newNode) {
  5399. newNode.parent = this;
  5400. var oldIndex = this.index(oldNode);
  5401. this.nodes.splice(oldIndex + 1, 0, newNode);
  5402. newNode.parent = this;
  5403. var index;
  5404. for (var id in this.indexes) {
  5405. index = this.indexes[id];
  5406. if (oldIndex <= index) {
  5407. this.indexes[id] = index + 1;
  5408. }
  5409. }
  5410. return this;
  5411. };
  5412. _proto.insertBefore = function insertBefore(oldNode, newNode) {
  5413. newNode.parent = this;
  5414. var oldIndex = this.index(oldNode);
  5415. this.nodes.splice(oldIndex, 0, newNode);
  5416. newNode.parent = this;
  5417. var index;
  5418. for (var id in this.indexes) {
  5419. index = this.indexes[id];
  5420. if (index <= oldIndex) {
  5421. this.indexes[id] = index + 1;
  5422. }
  5423. }
  5424. return this;
  5425. };
  5426. _proto._findChildAtPosition = function _findChildAtPosition(line, col) {
  5427. var found = undefined;
  5428. this.each(function (node) {
  5429. if (node.atPosition) {
  5430. var foundChild = node.atPosition(line, col);
  5431. if (foundChild) {
  5432. found = foundChild;
  5433. return false;
  5434. }
  5435. } else if (node.isAtPosition(line, col)) {
  5436. found = node;
  5437. return false;
  5438. }
  5439. });
  5440. return found;
  5441. }
  5442. /**
  5443. * Return the most specific node at the line and column number given.
  5444. * The source location is based on the original parsed location, locations aren't
  5445. * updated as selector nodes are mutated.
  5446. *
  5447. * Note that this location is relative to the location of the first character
  5448. * of the selector, and not the location of the selector in the overall document
  5449. * when used in conjunction with postcss.
  5450. *
  5451. * If not found, returns undefined.
  5452. * @param {number} line The line number of the node to find. (1-based index)
  5453. * @param {number} col The column number of the node to find. (1-based index)
  5454. */
  5455. ;
  5456. _proto.atPosition = function atPosition(line, col) {
  5457. if (this.isAtPosition(line, col)) {
  5458. return this._findChildAtPosition(line, col) || this;
  5459. } else {
  5460. return undefined;
  5461. }
  5462. };
  5463. _proto._inferEndPosition = function _inferEndPosition() {
  5464. if (this.last && this.last.source && this.last.source.end) {
  5465. this.source = this.source || {};
  5466. this.source.end = this.source.end || {};
  5467. Object.assign(this.source.end, this.last.source.end);
  5468. }
  5469. };
  5470. _proto.each = function each(callback) {
  5471. if (!this.lastEach) {
  5472. this.lastEach = 0;
  5473. }
  5474. if (!this.indexes) {
  5475. this.indexes = {};
  5476. }
  5477. this.lastEach++;
  5478. var id = this.lastEach;
  5479. this.indexes[id] = 0;
  5480. if (!this.length) {
  5481. return undefined;
  5482. }
  5483. var index, result;
  5484. while (this.indexes[id] < this.length) {
  5485. index = this.indexes[id];
  5486. result = callback(this.at(index), index);
  5487. if (result === false) {
  5488. break;
  5489. }
  5490. this.indexes[id] += 1;
  5491. }
  5492. delete this.indexes[id];
  5493. if (result === false) {
  5494. return false;
  5495. }
  5496. };
  5497. _proto.walk = function walk(callback) {
  5498. return this.each(function (node, i) {
  5499. var result = callback(node, i);
  5500. if (result !== false && node.length) {
  5501. result = node.walk(callback);
  5502. }
  5503. if (result === false) {
  5504. return false;
  5505. }
  5506. });
  5507. };
  5508. _proto.walkAttributes = function walkAttributes(callback) {
  5509. var _this2 = this;
  5510. return this.walk(function (selector) {
  5511. if (selector.type === types$1.ATTRIBUTE) {
  5512. return callback.call(_this2, selector);
  5513. }
  5514. });
  5515. };
  5516. _proto.walkClasses = function walkClasses(callback) {
  5517. var _this3 = this;
  5518. return this.walk(function (selector) {
  5519. if (selector.type === types$1.CLASS) {
  5520. return callback.call(_this3, selector);
  5521. }
  5522. });
  5523. };
  5524. _proto.walkCombinators = function walkCombinators(callback) {
  5525. var _this4 = this;
  5526. return this.walk(function (selector) {
  5527. if (selector.type === types$1.COMBINATOR) {
  5528. return callback.call(_this4, selector);
  5529. }
  5530. });
  5531. };
  5532. _proto.walkComments = function walkComments(callback) {
  5533. var _this5 = this;
  5534. return this.walk(function (selector) {
  5535. if (selector.type === types$1.COMMENT) {
  5536. return callback.call(_this5, selector);
  5537. }
  5538. });
  5539. };
  5540. _proto.walkIds = function walkIds(callback) {
  5541. var _this6 = this;
  5542. return this.walk(function (selector) {
  5543. if (selector.type === types$1.ID) {
  5544. return callback.call(_this6, selector);
  5545. }
  5546. });
  5547. };
  5548. _proto.walkNesting = function walkNesting(callback) {
  5549. var _this7 = this;
  5550. return this.walk(function (selector) {
  5551. if (selector.type === types$1.NESTING) {
  5552. return callback.call(_this7, selector);
  5553. }
  5554. });
  5555. };
  5556. _proto.walkPseudos = function walkPseudos(callback) {
  5557. var _this8 = this;
  5558. return this.walk(function (selector) {
  5559. if (selector.type === types$1.PSEUDO) {
  5560. return callback.call(_this8, selector);
  5561. }
  5562. });
  5563. };
  5564. _proto.walkTags = function walkTags(callback) {
  5565. var _this9 = this;
  5566. return this.walk(function (selector) {
  5567. if (selector.type === types$1.TAG) {
  5568. return callback.call(_this9, selector);
  5569. }
  5570. });
  5571. };
  5572. _proto.walkUniversals = function walkUniversals(callback) {
  5573. var _this10 = this;
  5574. return this.walk(function (selector) {
  5575. if (selector.type === types$1.UNIVERSAL) {
  5576. return callback.call(_this10, selector);
  5577. }
  5578. });
  5579. };
  5580. _proto.split = function split(callback) {
  5581. var _this11 = this;
  5582. var current = [];
  5583. return this.reduce(function (memo, node, index) {
  5584. var split = callback.call(_this11, node);
  5585. current.push(node);
  5586. if (split) {
  5587. memo.push(current);
  5588. current = [];
  5589. } else if (index === _this11.length - 1) {
  5590. memo.push(current);
  5591. }
  5592. return memo;
  5593. }, []);
  5594. };
  5595. _proto.map = function map(callback) {
  5596. return this.nodes.map(callback);
  5597. };
  5598. _proto.reduce = function reduce(callback, memo) {
  5599. return this.nodes.reduce(callback, memo);
  5600. };
  5601. _proto.every = function every(callback) {
  5602. return this.nodes.every(callback);
  5603. };
  5604. _proto.some = function some(callback) {
  5605. return this.nodes.some(callback);
  5606. };
  5607. _proto.filter = function filter(callback) {
  5608. return this.nodes.filter(callback);
  5609. };
  5610. _proto.sort = function sort(callback) {
  5611. return this.nodes.sort(callback);
  5612. };
  5613. _proto.toString = function toString() {
  5614. return this.map(String).join('');
  5615. };
  5616. _createClass(Container, [{
  5617. key: "first",
  5618. get: function get() {
  5619. return this.at(0);
  5620. }
  5621. }, {
  5622. key: "last",
  5623. get: function get() {
  5624. return this.at(this.length - 1);
  5625. }
  5626. }, {
  5627. key: "length",
  5628. get: function get() {
  5629. return this.nodes.length;
  5630. }
  5631. }]);
  5632. return Container;
  5633. }(_node["default"]);
  5634. exports["default"] = Container;
  5635. module.exports = exports.default;
  5636. });
  5637. var root = createCommonjsModule(function (module, exports) {
  5638. exports.__esModule = true;
  5639. exports["default"] = void 0;
  5640. var _container = _interopRequireDefault(container);
  5641. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5642. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5643. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5644. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5645. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5646. var Root = /*#__PURE__*/function (_Container) {
  5647. _inheritsLoose(Root, _Container);
  5648. function Root(opts) {
  5649. var _this;
  5650. _this = _Container.call(this, opts) || this;
  5651. _this.type = types.ROOT;
  5652. return _this;
  5653. }
  5654. var _proto = Root.prototype;
  5655. _proto.toString = function toString() {
  5656. var str = this.reduce(function (memo, selector) {
  5657. memo.push(String(selector));
  5658. return memo;
  5659. }, []).join(',');
  5660. return this.trailingComma ? str + ',' : str;
  5661. };
  5662. _proto.error = function error(message, options) {
  5663. if (this._error) {
  5664. return this._error(message, options);
  5665. } else {
  5666. return new Error(message);
  5667. }
  5668. };
  5669. _createClass(Root, [{
  5670. key: "errorGenerator",
  5671. set: function set(handler) {
  5672. this._error = handler;
  5673. }
  5674. }]);
  5675. return Root;
  5676. }(_container["default"]);
  5677. exports["default"] = Root;
  5678. module.exports = exports.default;
  5679. });
  5680. var selector = createCommonjsModule(function (module, exports) {
  5681. exports.__esModule = true;
  5682. exports["default"] = void 0;
  5683. var _container = _interopRequireDefault(container);
  5684. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5685. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5686. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5687. var Selector = /*#__PURE__*/function (_Container) {
  5688. _inheritsLoose(Selector, _Container);
  5689. function Selector(opts) {
  5690. var _this;
  5691. _this = _Container.call(this, opts) || this;
  5692. _this.type = types.SELECTOR;
  5693. return _this;
  5694. }
  5695. return Selector;
  5696. }(_container["default"]);
  5697. exports["default"] = Selector;
  5698. module.exports = exports.default;
  5699. });
  5700. /*! https://mths.be/cssesc v3.0.0 by @mathias */
  5701. var object = {};
  5702. var hasOwnProperty = object.hasOwnProperty;
  5703. var merge = function merge(options, defaults) {
  5704. if (!options) {
  5705. return defaults;
  5706. }
  5707. var result = {};
  5708. for (var key in defaults) {
  5709. // `if (defaults.hasOwnProperty(key) { … }` is not needed here, since
  5710. // only recognized option names are used.
  5711. result[key] = hasOwnProperty.call(options, key) ? options[key] : defaults[key];
  5712. }
  5713. return result;
  5714. };
  5715. var regexAnySingleEscape = /[ -,\.\/:-@\[-\^`\{-~]/;
  5716. var regexSingleEscape = /[ -,\.\/:-@\[\]\^`\{-~]/;
  5717. var regexExcessiveSpaces = /(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g;
  5718. // https://mathiasbynens.be/notes/css-escapes#css
  5719. var cssesc = function cssesc(string, options) {
  5720. options = merge(options, cssesc.options);
  5721. if (options.quotes != 'single' && options.quotes != 'double') {
  5722. options.quotes = 'single';
  5723. }
  5724. var quote = options.quotes == 'double' ? '"' : '\'';
  5725. var isIdentifier = options.isIdentifier;
  5726. var firstChar = string.charAt(0);
  5727. var output = '';
  5728. var counter = 0;
  5729. var length = string.length;
  5730. while (counter < length) {
  5731. var character = string.charAt(counter++);
  5732. var codePoint = character.charCodeAt();
  5733. var value = void 0;
  5734. // If it’s not a printable ASCII character…
  5735. if (codePoint < 0x20 || codePoint > 0x7E) {
  5736. if (codePoint >= 0xD800 && codePoint <= 0xDBFF && counter < length) {
  5737. // It’s a high surrogate, and there is a next character.
  5738. var extra = string.charCodeAt(counter++);
  5739. if ((extra & 0xFC00) == 0xDC00) {
  5740. // next character is low surrogate
  5741. codePoint = ((codePoint & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000;
  5742. } else {
  5743. // It’s an unmatched surrogate; only append this code unit, in case
  5744. // the next code unit is the high surrogate of a surrogate pair.
  5745. counter--;
  5746. }
  5747. }
  5748. value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
  5749. } else {
  5750. if (options.escapeEverything) {
  5751. if (regexAnySingleEscape.test(character)) {
  5752. value = '\\' + character;
  5753. } else {
  5754. value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
  5755. }
  5756. } else if (/[\t\n\f\r\x0B]/.test(character)) {
  5757. value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
  5758. } else if (character == '\\' || !isIdentifier && (character == '"' && quote == character || character == '\'' && quote == character) || isIdentifier && regexSingleEscape.test(character)) {
  5759. value = '\\' + character;
  5760. } else {
  5761. value = character;
  5762. }
  5763. }
  5764. output += value;
  5765. }
  5766. if (isIdentifier) {
  5767. if (/^-[-\d]/.test(output)) {
  5768. output = '\\-' + output.slice(1);
  5769. } else if (/\d/.test(firstChar)) {
  5770. output = '\\3' + firstChar + ' ' + output.slice(1);
  5771. }
  5772. }
  5773. // Remove spaces after `\HEX` escapes that are not followed by a hex digit,
  5774. // since they’re redundant. Note that this is only possible if the escape
  5775. // sequence isn’t preceded by an odd number of backslashes.
  5776. output = output.replace(regexExcessiveSpaces, function ($0, $1, $2) {
  5777. if ($1 && $1.length % 2) {
  5778. // It’s not safe to remove the space, so don’t.
  5779. return $0;
  5780. }
  5781. // Strip the space.
  5782. return ($1 || '') + $2;
  5783. });
  5784. if (!isIdentifier && options.wrap) {
  5785. return quote + output + quote;
  5786. }
  5787. return output;
  5788. };
  5789. // Expose default options (so they can be overridden globally).
  5790. cssesc.options = {
  5791. 'escapeEverything': false,
  5792. 'isIdentifier': false,
  5793. 'quotes': 'single',
  5794. 'wrap': false
  5795. };
  5796. cssesc.version = '3.0.0';
  5797. var cssesc_1 = cssesc;
  5798. var className = createCommonjsModule(function (module, exports) {
  5799. exports.__esModule = true;
  5800. exports["default"] = void 0;
  5801. var _cssesc = _interopRequireDefault(cssesc_1);
  5802. var _node = _interopRequireDefault(node);
  5803. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5804. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5805. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5806. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5807. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5808. var ClassName = /*#__PURE__*/function (_Node) {
  5809. _inheritsLoose(ClassName, _Node);
  5810. function ClassName(opts) {
  5811. var _this;
  5812. _this = _Node.call(this, opts) || this;
  5813. _this.type = types.CLASS;
  5814. _this._constructed = true;
  5815. return _this;
  5816. }
  5817. var _proto = ClassName.prototype;
  5818. _proto.valueToString = function valueToString() {
  5819. return '.' + _Node.prototype.valueToString.call(this);
  5820. };
  5821. _createClass(ClassName, [{
  5822. key: "value",
  5823. get: function get() {
  5824. return this._value;
  5825. },
  5826. set: function set(v) {
  5827. if (this._constructed) {
  5828. var escaped = (0, _cssesc["default"])(v, {
  5829. isIdentifier: true
  5830. });
  5831. if (escaped !== v) {
  5832. (0, util.ensureObject)(this, "raws");
  5833. this.raws.value = escaped;
  5834. } else if (this.raws) {
  5835. delete this.raws.value;
  5836. }
  5837. }
  5838. this._value = v;
  5839. }
  5840. }]);
  5841. return ClassName;
  5842. }(_node["default"]);
  5843. exports["default"] = ClassName;
  5844. module.exports = exports.default;
  5845. });
  5846. var comment = createCommonjsModule(function (module, exports) {
  5847. exports.__esModule = true;
  5848. exports["default"] = void 0;
  5849. var _node = _interopRequireDefault(node);
  5850. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5851. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5852. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5853. var Comment = /*#__PURE__*/function (_Node) {
  5854. _inheritsLoose(Comment, _Node);
  5855. function Comment(opts) {
  5856. var _this;
  5857. _this = _Node.call(this, opts) || this;
  5858. _this.type = types.COMMENT;
  5859. return _this;
  5860. }
  5861. return Comment;
  5862. }(_node["default"]);
  5863. exports["default"] = Comment;
  5864. module.exports = exports.default;
  5865. });
  5866. var id = createCommonjsModule(function (module, exports) {
  5867. exports.__esModule = true;
  5868. exports["default"] = void 0;
  5869. var _node = _interopRequireDefault(node);
  5870. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5871. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5872. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5873. var ID = /*#__PURE__*/function (_Node) {
  5874. _inheritsLoose(ID, _Node);
  5875. function ID(opts) {
  5876. var _this;
  5877. _this = _Node.call(this, opts) || this;
  5878. _this.type = types.ID;
  5879. return _this;
  5880. }
  5881. var _proto = ID.prototype;
  5882. _proto.valueToString = function valueToString() {
  5883. return '#' + _Node.prototype.valueToString.call(this);
  5884. };
  5885. return ID;
  5886. }(_node["default"]);
  5887. exports["default"] = ID;
  5888. module.exports = exports.default;
  5889. });
  5890. var namespace = createCommonjsModule(function (module, exports) {
  5891. exports.__esModule = true;
  5892. exports["default"] = void 0;
  5893. var _cssesc = _interopRequireDefault(cssesc_1);
  5894. var _node = _interopRequireDefault(node);
  5895. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5896. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5897. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5898. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5899. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5900. var Namespace = /*#__PURE__*/function (_Node) {
  5901. _inheritsLoose(Namespace, _Node);
  5902. function Namespace() {
  5903. return _Node.apply(this, arguments) || this;
  5904. }
  5905. var _proto = Namespace.prototype;
  5906. _proto.qualifiedName = function qualifiedName(value) {
  5907. if (this.namespace) {
  5908. return this.namespaceString + "|" + value;
  5909. } else {
  5910. return value;
  5911. }
  5912. };
  5913. _proto.valueToString = function valueToString() {
  5914. return this.qualifiedName(_Node.prototype.valueToString.call(this));
  5915. };
  5916. _createClass(Namespace, [{
  5917. key: "namespace",
  5918. get: function get() {
  5919. return this._namespace;
  5920. },
  5921. set: function set(namespace) {
  5922. if (namespace === true || namespace === "*" || namespace === "&") {
  5923. this._namespace = namespace;
  5924. if (this.raws) {
  5925. delete this.raws.namespace;
  5926. }
  5927. return;
  5928. }
  5929. var escaped = (0, _cssesc["default"])(namespace, {
  5930. isIdentifier: true
  5931. });
  5932. this._namespace = namespace;
  5933. if (escaped !== namespace) {
  5934. (0, util.ensureObject)(this, "raws");
  5935. this.raws.namespace = escaped;
  5936. } else if (this.raws) {
  5937. delete this.raws.namespace;
  5938. }
  5939. }
  5940. }, {
  5941. key: "ns",
  5942. get: function get() {
  5943. return this._namespace;
  5944. },
  5945. set: function set(namespace) {
  5946. this.namespace = namespace;
  5947. }
  5948. }, {
  5949. key: "namespaceString",
  5950. get: function get() {
  5951. if (this.namespace) {
  5952. var ns = this.stringifyProperty("namespace");
  5953. if (ns === true) {
  5954. return '';
  5955. } else {
  5956. return ns;
  5957. }
  5958. } else {
  5959. return '';
  5960. }
  5961. }
  5962. }]);
  5963. return Namespace;
  5964. }(_node["default"]);
  5965. exports["default"] = Namespace;
  5966. module.exports = exports.default;
  5967. });
  5968. var tag = createCommonjsModule(function (module, exports) {
  5969. exports.__esModule = true;
  5970. exports["default"] = void 0;
  5971. var _namespace = _interopRequireDefault(namespace);
  5972. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5973. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5974. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5975. var Tag = /*#__PURE__*/function (_Namespace) {
  5976. _inheritsLoose(Tag, _Namespace);
  5977. function Tag(opts) {
  5978. var _this;
  5979. _this = _Namespace.call(this, opts) || this;
  5980. _this.type = types.TAG;
  5981. return _this;
  5982. }
  5983. return Tag;
  5984. }(_namespace["default"]);
  5985. exports["default"] = Tag;
  5986. module.exports = exports.default;
  5987. });
  5988. var string = createCommonjsModule(function (module, exports) {
  5989. exports.__esModule = true;
  5990. exports["default"] = void 0;
  5991. var _node = _interopRequireDefault(node);
  5992. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5993. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5994. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5995. var String = /*#__PURE__*/function (_Node) {
  5996. _inheritsLoose(String, _Node);
  5997. function String(opts) {
  5998. var _this;
  5999. _this = _Node.call(this, opts) || this;
  6000. _this.type = types.STRING;
  6001. return _this;
  6002. }
  6003. return String;
  6004. }(_node["default"]);
  6005. exports["default"] = String;
  6006. module.exports = exports.default;
  6007. });
  6008. var pseudo = createCommonjsModule(function (module, exports) {
  6009. exports.__esModule = true;
  6010. exports["default"] = void 0;
  6011. var _container = _interopRequireDefault(container);
  6012. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6013. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  6014. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  6015. var Pseudo = /*#__PURE__*/function (_Container) {
  6016. _inheritsLoose(Pseudo, _Container);
  6017. function Pseudo(opts) {
  6018. var _this;
  6019. _this = _Container.call(this, opts) || this;
  6020. _this.type = types.PSEUDO;
  6021. return _this;
  6022. }
  6023. var _proto = Pseudo.prototype;
  6024. _proto.toString = function toString() {
  6025. var params = this.length ? '(' + this.map(String).join(',') + ')' : '';
  6026. return [this.rawSpaceBefore, this.stringifyProperty("value"), params, this.rawSpaceAfter].join('');
  6027. };
  6028. return Pseudo;
  6029. }(_container["default"]);
  6030. exports["default"] = Pseudo;
  6031. module.exports = exports.default;
  6032. });
  6033. /**
  6034. * For Node.js, simply re-export the core `util.deprecate` function.
  6035. */
  6036. var node$1 = util__default.deprecate;
  6037. var attribute = createCommonjsModule(function (module, exports) {
  6038. exports.__esModule = true;
  6039. exports.unescapeValue = unescapeValue;
  6040. exports["default"] = void 0;
  6041. var _cssesc = _interopRequireDefault(cssesc_1);
  6042. var _unesc = _interopRequireDefault(unesc_1);
  6043. var _namespace = _interopRequireDefault(namespace);
  6044. var _CSSESC_QUOTE_OPTIONS;
  6045. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6046. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  6047. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6048. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  6049. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  6050. var WRAPPED_IN_QUOTES = /^('|")([^]*)\1$/;
  6051. var warnOfDeprecatedValueAssignment = node$1(function () {}, "Assigning an attribute a value containing characters that might need to be escaped is deprecated. " + "Call attribute.setValue() instead.");
  6052. var warnOfDeprecatedQuotedAssignment = node$1(function () {}, "Assigning attr.quoted is deprecated and has no effect. Assign to attr.quoteMark instead.");
  6053. var warnOfDeprecatedConstructor = node$1(function () {}, "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now.");
  6054. function unescapeValue(value) {
  6055. var deprecatedUsage = false;
  6056. var quoteMark = null;
  6057. var unescaped = value;
  6058. var m = unescaped.match(WRAPPED_IN_QUOTES);
  6059. if (m) {
  6060. quoteMark = m[1];
  6061. unescaped = m[2];
  6062. }
  6063. unescaped = (0, _unesc["default"])(unescaped);
  6064. if (unescaped !== value) {
  6065. deprecatedUsage = true;
  6066. }
  6067. return {
  6068. deprecatedUsage: deprecatedUsage,
  6069. unescaped: unescaped,
  6070. quoteMark: quoteMark
  6071. };
  6072. }
  6073. function handleDeprecatedContructorOpts(opts) {
  6074. if (opts.quoteMark !== undefined) {
  6075. return opts;
  6076. }
  6077. if (opts.value === undefined) {
  6078. return opts;
  6079. }
  6080. warnOfDeprecatedConstructor();
  6081. var _unescapeValue = unescapeValue(opts.value),
  6082. quoteMark = _unescapeValue.quoteMark,
  6083. unescaped = _unescapeValue.unescaped;
  6084. if (!opts.raws) {
  6085. opts.raws = {};
  6086. }
  6087. if (opts.raws.value === undefined) {
  6088. opts.raws.value = opts.value;
  6089. }
  6090. opts.value = unescaped;
  6091. opts.quoteMark = quoteMark;
  6092. return opts;
  6093. }
  6094. var Attribute = /*#__PURE__*/function (_Namespace) {
  6095. _inheritsLoose(Attribute, _Namespace);
  6096. function Attribute(opts) {
  6097. var _this;
  6098. if (opts === void 0) {
  6099. opts = {};
  6100. }
  6101. _this = _Namespace.call(this, handleDeprecatedContructorOpts(opts)) || this;
  6102. _this.type = types.ATTRIBUTE;
  6103. _this.raws = _this.raws || {};
  6104. Object.defineProperty(_this.raws, 'unquoted', {
  6105. get: node$1(function () {
  6106. return _this.value;
  6107. }, "attr.raws.unquoted is deprecated. Call attr.value instead."),
  6108. set: node$1(function () {
  6109. return _this.value;
  6110. }, "Setting attr.raws.unquoted is deprecated and has no effect. attr.value is unescaped by default now.")
  6111. });
  6112. _this._constructed = true;
  6113. return _this;
  6114. }
  6115. /**
  6116. * Returns the Attribute's value quoted such that it would be legal to use
  6117. * in the value of a css file. The original value's quotation setting
  6118. * used for stringification is left unchanged. See `setValue(value, options)`
  6119. * if you want to control the quote settings of a new value for the attribute.
  6120. *
  6121. * You can also change the quotation used for the current value by setting quoteMark.
  6122. *
  6123. * Options:
  6124. * * quoteMark {'"' | "'" | null} - Use this value to quote the value. If this
  6125. * option is not set, the original value for quoteMark will be used. If
  6126. * indeterminate, a double quote is used. The legal values are:
  6127. * * `null` - the value will be unquoted and characters will be escaped as necessary.
  6128. * * `'` - the value will be quoted with a single quote and single quotes are escaped.
  6129. * * `"` - the value will be quoted with a double quote and double quotes are escaped.
  6130. * * preferCurrentQuoteMark {boolean} - if true, prefer the source quote mark
  6131. * over the quoteMark option value.
  6132. * * smart {boolean} - if true, will select a quote mark based on the value
  6133. * and the other options specified here. See the `smartQuoteMark()`
  6134. * method.
  6135. **/
  6136. var _proto = Attribute.prototype;
  6137. _proto.getQuotedValue = function getQuotedValue(options) {
  6138. if (options === void 0) {
  6139. options = {};
  6140. }
  6141. var quoteMark = this._determineQuoteMark(options);
  6142. var cssescopts = CSSESC_QUOTE_OPTIONS[quoteMark];
  6143. var escaped = (0, _cssesc["default"])(this._value, cssescopts);
  6144. return escaped;
  6145. };
  6146. _proto._determineQuoteMark = function _determineQuoteMark(options) {
  6147. return options.smart ? this.smartQuoteMark(options) : this.preferredQuoteMark(options);
  6148. }
  6149. /**
  6150. * Set the unescaped value with the specified quotation options. The value
  6151. * provided must not include any wrapping quote marks -- those quotes will
  6152. * be interpreted as part of the value and escaped accordingly.
  6153. */
  6154. ;
  6155. _proto.setValue = function setValue(value, options) {
  6156. if (options === void 0) {
  6157. options = {};
  6158. }
  6159. this._value = value;
  6160. this._quoteMark = this._determineQuoteMark(options);
  6161. this._syncRawValue();
  6162. }
  6163. /**
  6164. * Intelligently select a quoteMark value based on the value's contents. If
  6165. * the value is a legal CSS ident, it will not be quoted. Otherwise a quote
  6166. * mark will be picked that minimizes the number of escapes.
  6167. *
  6168. * If there's no clear winner, the quote mark from these options is used,
  6169. * then the source quote mark (this is inverted if `preferCurrentQuoteMark` is
  6170. * true). If the quoteMark is unspecified, a double quote is used.
  6171. *
  6172. * @param options This takes the quoteMark and preferCurrentQuoteMark options
  6173. * from the quoteValue method.
  6174. */
  6175. ;
  6176. _proto.smartQuoteMark = function smartQuoteMark(options) {
  6177. var v = this.value;
  6178. var numSingleQuotes = v.replace(/[^']/g, '').length;
  6179. var numDoubleQuotes = v.replace(/[^"]/g, '').length;
  6180. if (numSingleQuotes + numDoubleQuotes === 0) {
  6181. var escaped = (0, _cssesc["default"])(v, {
  6182. isIdentifier: true
  6183. });
  6184. if (escaped === v) {
  6185. return Attribute.NO_QUOTE;
  6186. } else {
  6187. var pref = this.preferredQuoteMark(options);
  6188. if (pref === Attribute.NO_QUOTE) {
  6189. // pick a quote mark that isn't none and see if it's smaller
  6190. var quote = this.quoteMark || options.quoteMark || Attribute.DOUBLE_QUOTE;
  6191. var opts = CSSESC_QUOTE_OPTIONS[quote];
  6192. var quoteValue = (0, _cssesc["default"])(v, opts);
  6193. if (quoteValue.length < escaped.length) {
  6194. return quote;
  6195. }
  6196. }
  6197. return pref;
  6198. }
  6199. } else if (numDoubleQuotes === numSingleQuotes) {
  6200. return this.preferredQuoteMark(options);
  6201. } else if (numDoubleQuotes < numSingleQuotes) {
  6202. return Attribute.DOUBLE_QUOTE;
  6203. } else {
  6204. return Attribute.SINGLE_QUOTE;
  6205. }
  6206. }
  6207. /**
  6208. * Selects the preferred quote mark based on the options and the current quote mark value.
  6209. * If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)`
  6210. * instead.
  6211. */
  6212. ;
  6213. _proto.preferredQuoteMark = function preferredQuoteMark(options) {
  6214. var quoteMark = options.preferCurrentQuoteMark ? this.quoteMark : options.quoteMark;
  6215. if (quoteMark === undefined) {
  6216. quoteMark = options.preferCurrentQuoteMark ? options.quoteMark : this.quoteMark;
  6217. }
  6218. if (quoteMark === undefined) {
  6219. quoteMark = Attribute.DOUBLE_QUOTE;
  6220. }
  6221. return quoteMark;
  6222. };
  6223. _proto._syncRawValue = function _syncRawValue() {
  6224. var rawValue = (0, _cssesc["default"])(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]);
  6225. if (rawValue === this._value) {
  6226. if (this.raws) {
  6227. delete this.raws.value;
  6228. }
  6229. } else {
  6230. this.raws.value = rawValue;
  6231. }
  6232. };
  6233. _proto._handleEscapes = function _handleEscapes(prop, value) {
  6234. if (this._constructed) {
  6235. var escaped = (0, _cssesc["default"])(value, {
  6236. isIdentifier: true
  6237. });
  6238. if (escaped !== value) {
  6239. this.raws[prop] = escaped;
  6240. } else {
  6241. delete this.raws[prop];
  6242. }
  6243. }
  6244. };
  6245. _proto._spacesFor = function _spacesFor(name) {
  6246. var attrSpaces = {
  6247. before: '',
  6248. after: ''
  6249. };
  6250. var spaces = this.spaces[name] || {};
  6251. var rawSpaces = this.raws.spaces && this.raws.spaces[name] || {};
  6252. return Object.assign(attrSpaces, spaces, rawSpaces);
  6253. };
  6254. _proto._stringFor = function _stringFor(name, spaceName, concat) {
  6255. if (spaceName === void 0) {
  6256. spaceName = name;
  6257. }
  6258. if (concat === void 0) {
  6259. concat = defaultAttrConcat;
  6260. }
  6261. var attrSpaces = this._spacesFor(spaceName);
  6262. return concat(this.stringifyProperty(name), attrSpaces);
  6263. }
  6264. /**
  6265. * returns the offset of the attribute part specified relative to the
  6266. * start of the node of the output string.
  6267. *
  6268. * * "ns" - alias for "namespace"
  6269. * * "namespace" - the namespace if it exists.
  6270. * * "attribute" - the attribute name
  6271. * * "attributeNS" - the start of the attribute or its namespace
  6272. * * "operator" - the match operator of the attribute
  6273. * * "value" - The value (string or identifier)
  6274. * * "insensitive" - the case insensitivity flag;
  6275. * @param part One of the possible values inside an attribute.
  6276. * @returns -1 if the name is invalid or the value doesn't exist in this attribute.
  6277. */
  6278. ;
  6279. _proto.offsetOf = function offsetOf(name) {
  6280. var count = 1;
  6281. var attributeSpaces = this._spacesFor("attribute");
  6282. count += attributeSpaces.before.length;
  6283. if (name === "namespace" || name === "ns") {
  6284. return this.namespace ? count : -1;
  6285. }
  6286. if (name === "attributeNS") {
  6287. return count;
  6288. }
  6289. count += this.namespaceString.length;
  6290. if (this.namespace) {
  6291. count += 1;
  6292. }
  6293. if (name === "attribute") {
  6294. return count;
  6295. }
  6296. count += this.stringifyProperty("attribute").length;
  6297. count += attributeSpaces.after.length;
  6298. var operatorSpaces = this._spacesFor("operator");
  6299. count += operatorSpaces.before.length;
  6300. var operator = this.stringifyProperty("operator");
  6301. if (name === "operator") {
  6302. return operator ? count : -1;
  6303. }
  6304. count += operator.length;
  6305. count += operatorSpaces.after.length;
  6306. var valueSpaces = this._spacesFor("value");
  6307. count += valueSpaces.before.length;
  6308. var value = this.stringifyProperty("value");
  6309. if (name === "value") {
  6310. return value ? count : -1;
  6311. }
  6312. count += value.length;
  6313. count += valueSpaces.after.length;
  6314. var insensitiveSpaces = this._spacesFor("insensitive");
  6315. count += insensitiveSpaces.before.length;
  6316. if (name === "insensitive") {
  6317. return this.insensitive ? count : -1;
  6318. }
  6319. return -1;
  6320. };
  6321. _proto.toString = function toString() {
  6322. var _this2 = this;
  6323. var selector = [this.rawSpaceBefore, '['];
  6324. selector.push(this._stringFor('qualifiedAttribute', 'attribute'));
  6325. if (this.operator && (this.value || this.value === '')) {
  6326. selector.push(this._stringFor('operator'));
  6327. selector.push(this._stringFor('value'));
  6328. selector.push(this._stringFor('insensitiveFlag', 'insensitive', function (attrValue, attrSpaces) {
  6329. if (attrValue.length > 0 && !_this2.quoted && attrSpaces.before.length === 0 && !(_this2.spaces.value && _this2.spaces.value.after)) {
  6330. attrSpaces.before = " ";
  6331. }
  6332. return defaultAttrConcat(attrValue, attrSpaces);
  6333. }));
  6334. }
  6335. selector.push(']');
  6336. selector.push(this.rawSpaceAfter);
  6337. return selector.join('');
  6338. };
  6339. _createClass(Attribute, [{
  6340. key: "quoted",
  6341. get: function get() {
  6342. var qm = this.quoteMark;
  6343. return qm === "'" || qm === '"';
  6344. },
  6345. set: function set(value) {
  6346. warnOfDeprecatedQuotedAssignment();
  6347. }
  6348. /**
  6349. * returns a single (`'`) or double (`"`) quote character if the value is quoted.
  6350. * returns `null` if the value is not quoted.
  6351. * returns `undefined` if the quotation state is unknown (this can happen when
  6352. * the attribute is constructed without specifying a quote mark.)
  6353. */
  6354. }, {
  6355. key: "quoteMark",
  6356. get: function get() {
  6357. return this._quoteMark;
  6358. }
  6359. /**
  6360. * Set the quote mark to be used by this attribute's value.
  6361. * If the quote mark changes, the raw (escaped) value at `attr.raws.value` of the attribute
  6362. * value is updated accordingly.
  6363. *
  6364. * @param {"'" | '"' | null} quoteMark The quote mark or `null` if the value should be unquoted.
  6365. */
  6366. ,
  6367. set: function set(quoteMark) {
  6368. if (!this._constructed) {
  6369. this._quoteMark = quoteMark;
  6370. return;
  6371. }
  6372. if (this._quoteMark !== quoteMark) {
  6373. this._quoteMark = quoteMark;
  6374. this._syncRawValue();
  6375. }
  6376. }
  6377. }, {
  6378. key: "qualifiedAttribute",
  6379. get: function get() {
  6380. return this.qualifiedName(this.raws.attribute || this.attribute);
  6381. }
  6382. }, {
  6383. key: "insensitiveFlag",
  6384. get: function get() {
  6385. return this.insensitive ? 'i' : '';
  6386. }
  6387. }, {
  6388. key: "value",
  6389. get: function get() {
  6390. return this._value;
  6391. }
  6392. /**
  6393. * Before 3.0, the value had to be set to an escaped value including any wrapped
  6394. * quote marks. In 3.0, the semantics of `Attribute.value` changed so that the value
  6395. * is unescaped during parsing and any quote marks are removed.
  6396. *
  6397. * Because the ambiguity of this semantic change, if you set `attr.value = newValue`,
  6398. * a deprecation warning is raised when the new value contains any characters that would
  6399. * require escaping (including if it contains wrapped quotes).
  6400. *
  6401. * Instead, you should call `attr.setValue(newValue, opts)` and pass options that describe
  6402. * how the new value is quoted.
  6403. */
  6404. ,
  6405. set: function set(v) {
  6406. if (this._constructed) {
  6407. var _unescapeValue2 = unescapeValue(v),
  6408. deprecatedUsage = _unescapeValue2.deprecatedUsage,
  6409. unescaped = _unescapeValue2.unescaped,
  6410. quoteMark = _unescapeValue2.quoteMark;
  6411. if (deprecatedUsage) {
  6412. warnOfDeprecatedValueAssignment();
  6413. }
  6414. if (unescaped === this._value && quoteMark === this._quoteMark) {
  6415. return;
  6416. }
  6417. this._value = unescaped;
  6418. this._quoteMark = quoteMark;
  6419. this._syncRawValue();
  6420. } else {
  6421. this._value = v;
  6422. }
  6423. }
  6424. }, {
  6425. key: "attribute",
  6426. get: function get() {
  6427. return this._attribute;
  6428. },
  6429. set: function set(name) {
  6430. this._handleEscapes("attribute", name);
  6431. this._attribute = name;
  6432. }
  6433. }]);
  6434. return Attribute;
  6435. }(_namespace["default"]);
  6436. exports["default"] = Attribute;
  6437. Attribute.NO_QUOTE = null;
  6438. Attribute.SINGLE_QUOTE = "'";
  6439. Attribute.DOUBLE_QUOTE = '"';
  6440. var CSSESC_QUOTE_OPTIONS = (_CSSESC_QUOTE_OPTIONS = {
  6441. "'": {
  6442. quotes: 'single',
  6443. wrap: true
  6444. },
  6445. '"': {
  6446. quotes: 'double',
  6447. wrap: true
  6448. }
  6449. }, _CSSESC_QUOTE_OPTIONS[null] = {
  6450. isIdentifier: true
  6451. }, _CSSESC_QUOTE_OPTIONS);
  6452. function defaultAttrConcat(attrValue, attrSpaces) {
  6453. return "" + attrSpaces.before + attrValue + attrSpaces.after;
  6454. }
  6455. });
  6456. var universal = createCommonjsModule(function (module, exports) {
  6457. exports.__esModule = true;
  6458. exports["default"] = void 0;
  6459. var _namespace = _interopRequireDefault(namespace);
  6460. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6461. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  6462. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  6463. var Universal = /*#__PURE__*/function (_Namespace) {
  6464. _inheritsLoose(Universal, _Namespace);
  6465. function Universal(opts) {
  6466. var _this;
  6467. _this = _Namespace.call(this, opts) || this;
  6468. _this.type = types.UNIVERSAL;
  6469. _this.value = '*';
  6470. return _this;
  6471. }
  6472. return Universal;
  6473. }(_namespace["default"]);
  6474. exports["default"] = Universal;
  6475. module.exports = exports.default;
  6476. });
  6477. var combinator = createCommonjsModule(function (module, exports) {
  6478. exports.__esModule = true;
  6479. exports["default"] = void 0;
  6480. var _node = _interopRequireDefault(node);
  6481. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6482. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  6483. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  6484. var Combinator = /*#__PURE__*/function (_Node) {
  6485. _inheritsLoose(Combinator, _Node);
  6486. function Combinator(opts) {
  6487. var _this;
  6488. _this = _Node.call(this, opts) || this;
  6489. _this.type = types.COMBINATOR;
  6490. return _this;
  6491. }
  6492. return Combinator;
  6493. }(_node["default"]);
  6494. exports["default"] = Combinator;
  6495. module.exports = exports.default;
  6496. });
  6497. var nesting = createCommonjsModule(function (module, exports) {
  6498. exports.__esModule = true;
  6499. exports["default"] = void 0;
  6500. var _node = _interopRequireDefault(node);
  6501. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6502. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  6503. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  6504. var Nesting = /*#__PURE__*/function (_Node) {
  6505. _inheritsLoose(Nesting, _Node);
  6506. function Nesting(opts) {
  6507. var _this;
  6508. _this = _Node.call(this, opts) || this;
  6509. _this.type = types.NESTING;
  6510. _this.value = '&';
  6511. return _this;
  6512. }
  6513. return Nesting;
  6514. }(_node["default"]);
  6515. exports["default"] = Nesting;
  6516. module.exports = exports.default;
  6517. });
  6518. var sortAscending_1 = createCommonjsModule(function (module, exports) {
  6519. exports.__esModule = true;
  6520. exports["default"] = sortAscending;
  6521. function sortAscending(list) {
  6522. return list.sort(function (a, b) {
  6523. return a - b;
  6524. });
  6525. }
  6526. module.exports = exports.default;
  6527. });
  6528. var tokenTypes = createCommonjsModule(function (module, exports) {
  6529. exports.__esModule = true;
  6530. exports.combinator = exports.word = exports.comment = exports.str = exports.tab = exports.newline = exports.feed = exports.cr = exports.backslash = exports.bang = exports.slash = exports.doubleQuote = exports.singleQuote = exports.space = exports.greaterThan = exports.pipe = exports.equals = exports.plus = exports.caret = exports.tilde = exports.dollar = exports.closeSquare = exports.openSquare = exports.closeParenthesis = exports.openParenthesis = exports.semicolon = exports.colon = exports.comma = exports.at = exports.asterisk = exports.ampersand = void 0;
  6531. var ampersand = 38; // `&`.charCodeAt(0);
  6532. exports.ampersand = ampersand;
  6533. var asterisk = 42; // `*`.charCodeAt(0);
  6534. exports.asterisk = asterisk;
  6535. var at = 64; // `@`.charCodeAt(0);
  6536. exports.at = at;
  6537. var comma = 44; // `,`.charCodeAt(0);
  6538. exports.comma = comma;
  6539. var colon = 58; // `:`.charCodeAt(0);
  6540. exports.colon = colon;
  6541. var semicolon = 59; // `;`.charCodeAt(0);
  6542. exports.semicolon = semicolon;
  6543. var openParenthesis = 40; // `(`.charCodeAt(0);
  6544. exports.openParenthesis = openParenthesis;
  6545. var closeParenthesis = 41; // `)`.charCodeAt(0);
  6546. exports.closeParenthesis = closeParenthesis;
  6547. var openSquare = 91; // `[`.charCodeAt(0);
  6548. exports.openSquare = openSquare;
  6549. var closeSquare = 93; // `]`.charCodeAt(0);
  6550. exports.closeSquare = closeSquare;
  6551. var dollar = 36; // `$`.charCodeAt(0);
  6552. exports.dollar = dollar;
  6553. var tilde = 126; // `~`.charCodeAt(0);
  6554. exports.tilde = tilde;
  6555. var caret = 94; // `^`.charCodeAt(0);
  6556. exports.caret = caret;
  6557. var plus = 43; // `+`.charCodeAt(0);
  6558. exports.plus = plus;
  6559. var equals = 61; // `=`.charCodeAt(0);
  6560. exports.equals = equals;
  6561. var pipe = 124; // `|`.charCodeAt(0);
  6562. exports.pipe = pipe;
  6563. var greaterThan = 62; // `>`.charCodeAt(0);
  6564. exports.greaterThan = greaterThan;
  6565. var space = 32; // ` `.charCodeAt(0);
  6566. exports.space = space;
  6567. var singleQuote = 39; // `'`.charCodeAt(0);
  6568. exports.singleQuote = singleQuote;
  6569. var doubleQuote = 34; // `"`.charCodeAt(0);
  6570. exports.doubleQuote = doubleQuote;
  6571. var slash = 47; // `/`.charCodeAt(0);
  6572. exports.slash = slash;
  6573. var bang = 33; // `!`.charCodeAt(0);
  6574. exports.bang = bang;
  6575. var backslash = 92; // '\\'.charCodeAt(0);
  6576. exports.backslash = backslash;
  6577. var cr = 13; // '\r'.charCodeAt(0);
  6578. exports.cr = cr;
  6579. var feed = 12; // '\f'.charCodeAt(0);
  6580. exports.feed = feed;
  6581. var newline = 10; // '\n'.charCodeAt(0);
  6582. exports.newline = newline;
  6583. var tab = 9; // '\t'.charCodeAt(0);
  6584. // Expose aliases primarily for readability.
  6585. exports.tab = tab;
  6586. var str = singleQuote; // No good single character representation!
  6587. exports.str = str;
  6588. var comment = -1;
  6589. exports.comment = comment;
  6590. var word = -2;
  6591. exports.word = word;
  6592. var combinator = -3;
  6593. exports.combinator = combinator;
  6594. });
  6595. var tokenize_1 = createCommonjsModule(function (module, exports) {
  6596. exports.__esModule = true;
  6597. exports["default"] = tokenize;
  6598. exports.FIELDS = void 0;
  6599. var t = _interopRequireWildcard(tokenTypes);
  6600. var _unescapable, _wordDelimiters;
  6601. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  6602. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
  6603. var unescapable = (_unescapable = {}, _unescapable[t.tab] = true, _unescapable[t.newline] = true, _unescapable[t.cr] = true, _unescapable[t.feed] = true, _unescapable);
  6604. var wordDelimiters = (_wordDelimiters = {}, _wordDelimiters[t.space] = true, _wordDelimiters[t.tab] = true, _wordDelimiters[t.newline] = true, _wordDelimiters[t.cr] = true, _wordDelimiters[t.feed] = true, _wordDelimiters[t.ampersand] = true, _wordDelimiters[t.asterisk] = true, _wordDelimiters[t.bang] = true, _wordDelimiters[t.comma] = true, _wordDelimiters[t.colon] = true, _wordDelimiters[t.semicolon] = true, _wordDelimiters[t.openParenthesis] = true, _wordDelimiters[t.closeParenthesis] = true, _wordDelimiters[t.openSquare] = true, _wordDelimiters[t.closeSquare] = true, _wordDelimiters[t.singleQuote] = true, _wordDelimiters[t.doubleQuote] = true, _wordDelimiters[t.plus] = true, _wordDelimiters[t.pipe] = true, _wordDelimiters[t.tilde] = true, _wordDelimiters[t.greaterThan] = true, _wordDelimiters[t.equals] = true, _wordDelimiters[t.dollar] = true, _wordDelimiters[t.caret] = true, _wordDelimiters[t.slash] = true, _wordDelimiters);
  6605. var hex = {};
  6606. var hexChars = "0123456789abcdefABCDEF";
  6607. for (var i = 0; i < hexChars.length; i++) {
  6608. hex[hexChars.charCodeAt(i)] = true;
  6609. }
  6610. /**
  6611. * Returns the last index of the bar css word
  6612. * @param {string} css The string in which the word begins
  6613. * @param {number} start The index into the string where word's first letter occurs
  6614. */
  6615. function consumeWord(css, start) {
  6616. var next = start;
  6617. var code;
  6618. do {
  6619. code = css.charCodeAt(next);
  6620. if (wordDelimiters[code]) {
  6621. return next - 1;
  6622. } else if (code === t.backslash) {
  6623. next = consumeEscape(css, next) + 1;
  6624. } else {
  6625. // All other characters are part of the word
  6626. next++;
  6627. }
  6628. } while (next < css.length);
  6629. return next - 1;
  6630. }
  6631. /**
  6632. * Returns the last index of the escape sequence
  6633. * @param {string} css The string in which the sequence begins
  6634. * @param {number} start The index into the string where escape character (`\`) occurs.
  6635. */
  6636. function consumeEscape(css, start) {
  6637. var next = start;
  6638. var code = css.charCodeAt(next + 1);
  6639. if (unescapable[code]) ; else if (hex[code]) {
  6640. var hexDigits = 0; // consume up to 6 hex chars
  6641. do {
  6642. next++;
  6643. hexDigits++;
  6644. code = css.charCodeAt(next + 1);
  6645. } while (hex[code] && hexDigits < 6); // if fewer than 6 hex chars, a trailing space ends the escape
  6646. if (hexDigits < 6 && code === t.space) {
  6647. next++;
  6648. }
  6649. } else {
  6650. // the next char is part of the current word
  6651. next++;
  6652. }
  6653. return next;
  6654. }
  6655. var FIELDS = {
  6656. TYPE: 0,
  6657. START_LINE: 1,
  6658. START_COL: 2,
  6659. END_LINE: 3,
  6660. END_COL: 4,
  6661. START_POS: 5,
  6662. END_POS: 6
  6663. };
  6664. exports.FIELDS = FIELDS;
  6665. function tokenize(input) {
  6666. var tokens = [];
  6667. var css = input.css.valueOf();
  6668. var _css = css,
  6669. length = _css.length;
  6670. var offset = -1;
  6671. var line = 1;
  6672. var start = 0;
  6673. var end = 0;
  6674. var code, content, endColumn, endLine, escaped, escapePos, last, lines, next, nextLine, nextOffset, quote, tokenType;
  6675. function unclosed(what, fix) {
  6676. if (input.safe) {
  6677. // fyi: this is never set to true.
  6678. css += fix;
  6679. next = css.length - 1;
  6680. } else {
  6681. throw input.error('Unclosed ' + what, line, start - offset, start);
  6682. }
  6683. }
  6684. while (start < length) {
  6685. code = css.charCodeAt(start);
  6686. if (code === t.newline) {
  6687. offset = start;
  6688. line += 1;
  6689. }
  6690. switch (code) {
  6691. case t.space:
  6692. case t.tab:
  6693. case t.newline:
  6694. case t.cr:
  6695. case t.feed:
  6696. next = start;
  6697. do {
  6698. next += 1;
  6699. code = css.charCodeAt(next);
  6700. if (code === t.newline) {
  6701. offset = next;
  6702. line += 1;
  6703. }
  6704. } while (code === t.space || code === t.newline || code === t.tab || code === t.cr || code === t.feed);
  6705. tokenType = t.space;
  6706. endLine = line;
  6707. endColumn = next - offset - 1;
  6708. end = next;
  6709. break;
  6710. case t.plus:
  6711. case t.greaterThan:
  6712. case t.tilde:
  6713. case t.pipe:
  6714. next = start;
  6715. do {
  6716. next += 1;
  6717. code = css.charCodeAt(next);
  6718. } while (code === t.plus || code === t.greaterThan || code === t.tilde || code === t.pipe);
  6719. tokenType = t.combinator;
  6720. endLine = line;
  6721. endColumn = start - offset;
  6722. end = next;
  6723. break;
  6724. // Consume these characters as single tokens.
  6725. case t.asterisk:
  6726. case t.ampersand:
  6727. case t.bang:
  6728. case t.comma:
  6729. case t.equals:
  6730. case t.dollar:
  6731. case t.caret:
  6732. case t.openSquare:
  6733. case t.closeSquare:
  6734. case t.colon:
  6735. case t.semicolon:
  6736. case t.openParenthesis:
  6737. case t.closeParenthesis:
  6738. next = start;
  6739. tokenType = code;
  6740. endLine = line;
  6741. endColumn = start - offset;
  6742. end = next + 1;
  6743. break;
  6744. case t.singleQuote:
  6745. case t.doubleQuote:
  6746. quote = code === t.singleQuote ? "'" : '"';
  6747. next = start;
  6748. do {
  6749. escaped = false;
  6750. next = css.indexOf(quote, next + 1);
  6751. if (next === -1) {
  6752. unclosed('quote', quote);
  6753. }
  6754. escapePos = next;
  6755. while (css.charCodeAt(escapePos - 1) === t.backslash) {
  6756. escapePos -= 1;
  6757. escaped = !escaped;
  6758. }
  6759. } while (escaped);
  6760. tokenType = t.str;
  6761. endLine = line;
  6762. endColumn = start - offset;
  6763. end = next + 1;
  6764. break;
  6765. default:
  6766. if (code === t.slash && css.charCodeAt(start + 1) === t.asterisk) {
  6767. next = css.indexOf('*/', start + 2) + 1;
  6768. if (next === 0) {
  6769. unclosed('comment', '*/');
  6770. }
  6771. content = css.slice(start, next + 1);
  6772. lines = content.split('\n');
  6773. last = lines.length - 1;
  6774. if (last > 0) {
  6775. nextLine = line + last;
  6776. nextOffset = next - lines[last].length;
  6777. } else {
  6778. nextLine = line;
  6779. nextOffset = offset;
  6780. }
  6781. tokenType = t.comment;
  6782. line = nextLine;
  6783. endLine = nextLine;
  6784. endColumn = next - nextOffset;
  6785. } else if (code === t.slash) {
  6786. next = start;
  6787. tokenType = code;
  6788. endLine = line;
  6789. endColumn = start - offset;
  6790. end = next + 1;
  6791. } else {
  6792. next = consumeWord(css, start);
  6793. tokenType = t.word;
  6794. endLine = line;
  6795. endColumn = next - offset;
  6796. }
  6797. end = next + 1;
  6798. break;
  6799. } // Ensure that the token structure remains consistent
  6800. tokens.push([tokenType, // [0] Token type
  6801. line, // [1] Starting line
  6802. start - offset, // [2] Starting column
  6803. endLine, // [3] Ending line
  6804. endColumn, // [4] Ending column
  6805. start, // [5] Start position / Source index
  6806. end // [6] End position
  6807. ]); // Reset offset for the next token
  6808. if (nextOffset) {
  6809. offset = nextOffset;
  6810. nextOffset = null;
  6811. }
  6812. start = end;
  6813. }
  6814. return tokens;
  6815. }
  6816. });
  6817. var parser = createCommonjsModule(function (module, exports) {
  6818. exports.__esModule = true;
  6819. exports["default"] = void 0;
  6820. var _root = _interopRequireDefault(root);
  6821. var _selector = _interopRequireDefault(selector);
  6822. var _className = _interopRequireDefault(className);
  6823. var _comment = _interopRequireDefault(comment);
  6824. var _id = _interopRequireDefault(id);
  6825. var _tag = _interopRequireDefault(tag);
  6826. var _string = _interopRequireDefault(string);
  6827. var _pseudo = _interopRequireDefault(pseudo);
  6828. var _attribute = _interopRequireWildcard(attribute);
  6829. var _universal = _interopRequireDefault(universal);
  6830. var _combinator = _interopRequireDefault(combinator);
  6831. var _nesting = _interopRequireDefault(nesting);
  6832. var _sortAscending = _interopRequireDefault(sortAscending_1);
  6833. var _tokenize = _interopRequireWildcard(tokenize_1);
  6834. var tokens = _interopRequireWildcard(tokenTypes);
  6835. var types$1 = _interopRequireWildcard(types);
  6836. var _WHITESPACE_TOKENS, _Object$assign;
  6837. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  6838. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
  6839. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6840. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  6841. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6842. var WHITESPACE_TOKENS = (_WHITESPACE_TOKENS = {}, _WHITESPACE_TOKENS[tokens.space] = true, _WHITESPACE_TOKENS[tokens.cr] = true, _WHITESPACE_TOKENS[tokens.feed] = true, _WHITESPACE_TOKENS[tokens.newline] = true, _WHITESPACE_TOKENS[tokens.tab] = true, _WHITESPACE_TOKENS);
  6843. var WHITESPACE_EQUIV_TOKENS = Object.assign({}, WHITESPACE_TOKENS, (_Object$assign = {}, _Object$assign[tokens.comment] = true, _Object$assign));
  6844. function tokenStart(token) {
  6845. return {
  6846. line: token[_tokenize.FIELDS.START_LINE],
  6847. column: token[_tokenize.FIELDS.START_COL]
  6848. };
  6849. }
  6850. function tokenEnd(token) {
  6851. return {
  6852. line: token[_tokenize.FIELDS.END_LINE],
  6853. column: token[_tokenize.FIELDS.END_COL]
  6854. };
  6855. }
  6856. function getSource(startLine, startColumn, endLine, endColumn) {
  6857. return {
  6858. start: {
  6859. line: startLine,
  6860. column: startColumn
  6861. },
  6862. end: {
  6863. line: endLine,
  6864. column: endColumn
  6865. }
  6866. };
  6867. }
  6868. function getTokenSource(token) {
  6869. return getSource(token[_tokenize.FIELDS.START_LINE], token[_tokenize.FIELDS.START_COL], token[_tokenize.FIELDS.END_LINE], token[_tokenize.FIELDS.END_COL]);
  6870. }
  6871. function getTokenSourceSpan(startToken, endToken) {
  6872. if (!startToken) {
  6873. return undefined;
  6874. }
  6875. return getSource(startToken[_tokenize.FIELDS.START_LINE], startToken[_tokenize.FIELDS.START_COL], endToken[_tokenize.FIELDS.END_LINE], endToken[_tokenize.FIELDS.END_COL]);
  6876. }
  6877. function unescapeProp(node, prop) {
  6878. var value = node[prop];
  6879. if (typeof value !== "string") {
  6880. return;
  6881. }
  6882. if (value.indexOf("\\") !== -1) {
  6883. (0, util.ensureObject)(node, 'raws');
  6884. node[prop] = (0, util.unesc)(value);
  6885. if (node.raws[prop] === undefined) {
  6886. node.raws[prop] = value;
  6887. }
  6888. }
  6889. return node;
  6890. }
  6891. function indexesOf(array, item) {
  6892. var i = -1;
  6893. var indexes = [];
  6894. while ((i = array.indexOf(item, i + 1)) !== -1) {
  6895. indexes.push(i);
  6896. }
  6897. return indexes;
  6898. }
  6899. function uniqs() {
  6900. var list = Array.prototype.concat.apply([], arguments);
  6901. return list.filter(function (item, i) {
  6902. return i === list.indexOf(item);
  6903. });
  6904. }
  6905. var Parser = /*#__PURE__*/function () {
  6906. function Parser(rule, options) {
  6907. if (options === void 0) {
  6908. options = {};
  6909. }
  6910. this.rule = rule;
  6911. this.options = Object.assign({
  6912. lossy: false,
  6913. safe: false
  6914. }, options);
  6915. this.position = 0;
  6916. this.css = typeof this.rule === 'string' ? this.rule : this.rule.selector;
  6917. this.tokens = (0, _tokenize["default"])({
  6918. css: this.css,
  6919. error: this._errorGenerator(),
  6920. safe: this.options.safe
  6921. });
  6922. var rootSource = getTokenSourceSpan(this.tokens[0], this.tokens[this.tokens.length - 1]);
  6923. this.root = new _root["default"]({
  6924. source: rootSource
  6925. });
  6926. this.root.errorGenerator = this._errorGenerator();
  6927. var selector = new _selector["default"]({
  6928. source: {
  6929. start: {
  6930. line: 1,
  6931. column: 1
  6932. }
  6933. }
  6934. });
  6935. this.root.append(selector);
  6936. this.current = selector;
  6937. this.loop();
  6938. }
  6939. var _proto = Parser.prototype;
  6940. _proto._errorGenerator = function _errorGenerator() {
  6941. var _this = this;
  6942. return function (message, errorOptions) {
  6943. if (typeof _this.rule === 'string') {
  6944. return new Error(message);
  6945. }
  6946. return _this.rule.error(message, errorOptions);
  6947. };
  6948. };
  6949. _proto.attribute = function attribute() {
  6950. var attr = [];
  6951. var startingToken = this.currToken;
  6952. this.position++;
  6953. while (this.position < this.tokens.length && this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
  6954. attr.push(this.currToken);
  6955. this.position++;
  6956. }
  6957. if (this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
  6958. return this.expected('closing square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
  6959. }
  6960. var len = attr.length;
  6961. var node = {
  6962. source: getSource(startingToken[1], startingToken[2], this.currToken[3], this.currToken[4]),
  6963. sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
  6964. };
  6965. if (len === 1 && !~[tokens.word].indexOf(attr[0][_tokenize.FIELDS.TYPE])) {
  6966. return this.expected('attribute', attr[0][_tokenize.FIELDS.START_POS]);
  6967. }
  6968. var pos = 0;
  6969. var spaceBefore = '';
  6970. var commentBefore = '';
  6971. var lastAdded = null;
  6972. var spaceAfterMeaningfulToken = false;
  6973. while (pos < len) {
  6974. var token = attr[pos];
  6975. var content = this.content(token);
  6976. var next = attr[pos + 1];
  6977. switch (token[_tokenize.FIELDS.TYPE]) {
  6978. case tokens.space:
  6979. // if (
  6980. // len === 1 ||
  6981. // pos === 0 && this.content(next) === '|'
  6982. // ) {
  6983. // return this.expected('attribute', token[TOKEN.START_POS], content);
  6984. // }
  6985. spaceAfterMeaningfulToken = true;
  6986. if (this.options.lossy) {
  6987. break;
  6988. }
  6989. if (lastAdded) {
  6990. (0, util.ensureObject)(node, 'spaces', lastAdded);
  6991. var prevContent = node.spaces[lastAdded].after || '';
  6992. node.spaces[lastAdded].after = prevContent + content;
  6993. var existingComment = (0, util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || null;
  6994. if (existingComment) {
  6995. node.raws.spaces[lastAdded].after = existingComment + content;
  6996. }
  6997. } else {
  6998. spaceBefore = spaceBefore + content;
  6999. commentBefore = commentBefore + content;
  7000. }
  7001. break;
  7002. case tokens.asterisk:
  7003. if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  7004. node.operator = content;
  7005. lastAdded = 'operator';
  7006. } else if ((!node.namespace || lastAdded === "namespace" && !spaceAfterMeaningfulToken) && next) {
  7007. if (spaceBefore) {
  7008. (0, util.ensureObject)(node, 'spaces', 'attribute');
  7009. node.spaces.attribute.before = spaceBefore;
  7010. spaceBefore = '';
  7011. }
  7012. if (commentBefore) {
  7013. (0, util.ensureObject)(node, 'raws', 'spaces', 'attribute');
  7014. node.raws.spaces.attribute.before = spaceBefore;
  7015. commentBefore = '';
  7016. }
  7017. node.namespace = (node.namespace || "") + content;
  7018. var rawValue = (0, util.getProp)(node, 'raws', 'namespace') || null;
  7019. if (rawValue) {
  7020. node.raws.namespace += content;
  7021. }
  7022. lastAdded = 'namespace';
  7023. }
  7024. spaceAfterMeaningfulToken = false;
  7025. break;
  7026. case tokens.dollar:
  7027. if (lastAdded === "value") {
  7028. var oldRawValue = (0, util.getProp)(node, 'raws', 'value');
  7029. node.value += "$";
  7030. if (oldRawValue) {
  7031. node.raws.value = oldRawValue + "$";
  7032. }
  7033. break;
  7034. }
  7035. // Falls through
  7036. case tokens.caret:
  7037. if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  7038. node.operator = content;
  7039. lastAdded = 'operator';
  7040. }
  7041. spaceAfterMeaningfulToken = false;
  7042. break;
  7043. case tokens.combinator:
  7044. if (content === '~' && next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  7045. node.operator = content;
  7046. lastAdded = 'operator';
  7047. }
  7048. if (content !== '|') {
  7049. spaceAfterMeaningfulToken = false;
  7050. break;
  7051. }
  7052. if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  7053. node.operator = content;
  7054. lastAdded = 'operator';
  7055. } else if (!node.namespace && !node.attribute) {
  7056. node.namespace = true;
  7057. }
  7058. spaceAfterMeaningfulToken = false;
  7059. break;
  7060. case tokens.word:
  7061. if (next && this.content(next) === '|' && attr[pos + 2] && attr[pos + 2][_tokenize.FIELDS.TYPE] !== tokens.equals && // this look-ahead probably fails with comment nodes involved.
  7062. !node.operator && !node.namespace) {
  7063. node.namespace = content;
  7064. lastAdded = 'namespace';
  7065. } else if (!node.attribute || lastAdded === "attribute" && !spaceAfterMeaningfulToken) {
  7066. if (spaceBefore) {
  7067. (0, util.ensureObject)(node, 'spaces', 'attribute');
  7068. node.spaces.attribute.before = spaceBefore;
  7069. spaceBefore = '';
  7070. }
  7071. if (commentBefore) {
  7072. (0, util.ensureObject)(node, 'raws', 'spaces', 'attribute');
  7073. node.raws.spaces.attribute.before = commentBefore;
  7074. commentBefore = '';
  7075. }
  7076. node.attribute = (node.attribute || "") + content;
  7077. var _rawValue = (0, util.getProp)(node, 'raws', 'attribute') || null;
  7078. if (_rawValue) {
  7079. node.raws.attribute += content;
  7080. }
  7081. lastAdded = 'attribute';
  7082. } else if (!node.value && node.value !== "" || lastAdded === "value" && !spaceAfterMeaningfulToken) {
  7083. var _unescaped = (0, util.unesc)(content);
  7084. var _oldRawValue = (0, util.getProp)(node, 'raws', 'value') || '';
  7085. var oldValue = node.value || '';
  7086. node.value = oldValue + _unescaped;
  7087. node.quoteMark = null;
  7088. if (_unescaped !== content || _oldRawValue) {
  7089. (0, util.ensureObject)(node, 'raws');
  7090. node.raws.value = (_oldRawValue || oldValue) + content;
  7091. }
  7092. lastAdded = 'value';
  7093. } else {
  7094. var insensitive = content === 'i' || content === "I";
  7095. if ((node.value || node.value === '') && (node.quoteMark || spaceAfterMeaningfulToken)) {
  7096. node.insensitive = insensitive;
  7097. if (!insensitive || content === "I") {
  7098. (0, util.ensureObject)(node, 'raws');
  7099. node.raws.insensitiveFlag = content;
  7100. }
  7101. lastAdded = 'insensitive';
  7102. if (spaceBefore) {
  7103. (0, util.ensureObject)(node, 'spaces', 'insensitive');
  7104. node.spaces.insensitive.before = spaceBefore;
  7105. spaceBefore = '';
  7106. }
  7107. if (commentBefore) {
  7108. (0, util.ensureObject)(node, 'raws', 'spaces', 'insensitive');
  7109. node.raws.spaces.insensitive.before = commentBefore;
  7110. commentBefore = '';
  7111. }
  7112. } else if (node.value || node.value === '') {
  7113. lastAdded = 'value';
  7114. node.value += content;
  7115. if (node.raws.value) {
  7116. node.raws.value += content;
  7117. }
  7118. }
  7119. }
  7120. spaceAfterMeaningfulToken = false;
  7121. break;
  7122. case tokens.str:
  7123. if (!node.attribute || !node.operator) {
  7124. return this.error("Expected an attribute followed by an operator preceding the string.", {
  7125. index: token[_tokenize.FIELDS.START_POS]
  7126. });
  7127. }
  7128. var _unescapeValue = (0, _attribute.unescapeValue)(content),
  7129. unescaped = _unescapeValue.unescaped,
  7130. quoteMark = _unescapeValue.quoteMark;
  7131. node.value = unescaped;
  7132. node.quoteMark = quoteMark;
  7133. lastAdded = 'value';
  7134. (0, util.ensureObject)(node, 'raws');
  7135. node.raws.value = content;
  7136. spaceAfterMeaningfulToken = false;
  7137. break;
  7138. case tokens.equals:
  7139. if (!node.attribute) {
  7140. return this.expected('attribute', token[_tokenize.FIELDS.START_POS], content);
  7141. }
  7142. if (node.value) {
  7143. return this.error('Unexpected "=" found; an operator was already defined.', {
  7144. index: token[_tokenize.FIELDS.START_POS]
  7145. });
  7146. }
  7147. node.operator = node.operator ? node.operator + content : content;
  7148. lastAdded = 'operator';
  7149. spaceAfterMeaningfulToken = false;
  7150. break;
  7151. case tokens.comment:
  7152. if (lastAdded) {
  7153. if (spaceAfterMeaningfulToken || next && next[_tokenize.FIELDS.TYPE] === tokens.space || lastAdded === 'insensitive') {
  7154. var lastComment = (0, util.getProp)(node, 'spaces', lastAdded, 'after') || '';
  7155. var rawLastComment = (0, util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || lastComment;
  7156. (0, util.ensureObject)(node, 'raws', 'spaces', lastAdded);
  7157. node.raws.spaces[lastAdded].after = rawLastComment + content;
  7158. } else {
  7159. var lastValue = node[lastAdded] || '';
  7160. var rawLastValue = (0, util.getProp)(node, 'raws', lastAdded) || lastValue;
  7161. (0, util.ensureObject)(node, 'raws');
  7162. node.raws[lastAdded] = rawLastValue + content;
  7163. }
  7164. } else {
  7165. commentBefore = commentBefore + content;
  7166. }
  7167. break;
  7168. default:
  7169. return this.error("Unexpected \"" + content + "\" found.", {
  7170. index: token[_tokenize.FIELDS.START_POS]
  7171. });
  7172. }
  7173. pos++;
  7174. }
  7175. unescapeProp(node, "attribute");
  7176. unescapeProp(node, "namespace");
  7177. this.newNode(new _attribute["default"](node));
  7178. this.position++;
  7179. }
  7180. /**
  7181. * return a node containing meaningless garbage up to (but not including) the specified token position.
  7182. * if the token position is negative, all remaining tokens are consumed.
  7183. *
  7184. * This returns an array containing a single string node if all whitespace,
  7185. * otherwise an array of comment nodes with space before and after.
  7186. *
  7187. * These tokens are not added to the current selector, the caller can add them or use them to amend
  7188. * a previous node's space metadata.
  7189. *
  7190. * In lossy mode, this returns only comments.
  7191. */
  7192. ;
  7193. _proto.parseWhitespaceEquivalentTokens = function parseWhitespaceEquivalentTokens(stopPosition) {
  7194. if (stopPosition < 0) {
  7195. stopPosition = this.tokens.length;
  7196. }
  7197. var startPosition = this.position;
  7198. var nodes = [];
  7199. var space = "";
  7200. var lastComment = undefined;
  7201. do {
  7202. if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) {
  7203. if (!this.options.lossy) {
  7204. space += this.content();
  7205. }
  7206. } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.comment) {
  7207. var spaces = {};
  7208. if (space) {
  7209. spaces.before = space;
  7210. space = "";
  7211. }
  7212. lastComment = new _comment["default"]({
  7213. value: this.content(),
  7214. source: getTokenSource(this.currToken),
  7215. sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
  7216. spaces: spaces
  7217. });
  7218. nodes.push(lastComment);
  7219. }
  7220. } while (++this.position < stopPosition);
  7221. if (space) {
  7222. if (lastComment) {
  7223. lastComment.spaces.after = space;
  7224. } else if (!this.options.lossy) {
  7225. var firstToken = this.tokens[startPosition];
  7226. var lastToken = this.tokens[this.position - 1];
  7227. nodes.push(new _string["default"]({
  7228. value: '',
  7229. source: getSource(firstToken[_tokenize.FIELDS.START_LINE], firstToken[_tokenize.FIELDS.START_COL], lastToken[_tokenize.FIELDS.END_LINE], lastToken[_tokenize.FIELDS.END_COL]),
  7230. sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
  7231. spaces: {
  7232. before: space,
  7233. after: ''
  7234. }
  7235. }));
  7236. }
  7237. }
  7238. return nodes;
  7239. }
  7240. /**
  7241. *
  7242. * @param {*} nodes
  7243. */
  7244. ;
  7245. _proto.convertWhitespaceNodesToSpace = function convertWhitespaceNodesToSpace(nodes, requiredSpace) {
  7246. var _this2 = this;
  7247. if (requiredSpace === void 0) {
  7248. requiredSpace = false;
  7249. }
  7250. var space = "";
  7251. var rawSpace = "";
  7252. nodes.forEach(function (n) {
  7253. var spaceBefore = _this2.lossySpace(n.spaces.before, requiredSpace);
  7254. var rawSpaceBefore = _this2.lossySpace(n.rawSpaceBefore, requiredSpace);
  7255. space += spaceBefore + _this2.lossySpace(n.spaces.after, requiredSpace && spaceBefore.length === 0);
  7256. rawSpace += spaceBefore + n.value + _this2.lossySpace(n.rawSpaceAfter, requiredSpace && rawSpaceBefore.length === 0);
  7257. });
  7258. if (rawSpace === space) {
  7259. rawSpace = undefined;
  7260. }
  7261. var result = {
  7262. space: space,
  7263. rawSpace: rawSpace
  7264. };
  7265. return result;
  7266. };
  7267. _proto.isNamedCombinator = function isNamedCombinator(position) {
  7268. if (position === void 0) {
  7269. position = this.position;
  7270. }
  7271. return this.tokens[position + 0] && this.tokens[position + 0][_tokenize.FIELDS.TYPE] === tokens.slash && this.tokens[position + 1] && this.tokens[position + 1][_tokenize.FIELDS.TYPE] === tokens.word && this.tokens[position + 2] && this.tokens[position + 2][_tokenize.FIELDS.TYPE] === tokens.slash;
  7272. };
  7273. _proto.namedCombinator = function namedCombinator() {
  7274. if (this.isNamedCombinator()) {
  7275. var nameRaw = this.content(this.tokens[this.position + 1]);
  7276. var name = (0, util.unesc)(nameRaw).toLowerCase();
  7277. var raws = {};
  7278. if (name !== nameRaw) {
  7279. raws.value = "/" + nameRaw + "/";
  7280. }
  7281. var node = new _combinator["default"]({
  7282. value: "/" + name + "/",
  7283. source: getSource(this.currToken[_tokenize.FIELDS.START_LINE], this.currToken[_tokenize.FIELDS.START_COL], this.tokens[this.position + 2][_tokenize.FIELDS.END_LINE], this.tokens[this.position + 2][_tokenize.FIELDS.END_COL]),
  7284. sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
  7285. raws: raws
  7286. });
  7287. this.position = this.position + 3;
  7288. return node;
  7289. } else {
  7290. this.unexpected();
  7291. }
  7292. };
  7293. _proto.combinator = function combinator() {
  7294. var _this3 = this;
  7295. if (this.content() === '|') {
  7296. return this.namespace();
  7297. } // We need to decide between a space that's a descendant combinator and meaningless whitespace at the end of a selector.
  7298. var nextSigTokenPos = this.locateNextMeaningfulToken(this.position);
  7299. if (nextSigTokenPos < 0 || this.tokens[nextSigTokenPos][_tokenize.FIELDS.TYPE] === tokens.comma) {
  7300. var nodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
  7301. if (nodes.length > 0) {
  7302. var last = this.current.last;
  7303. if (last) {
  7304. var _this$convertWhitespa = this.convertWhitespaceNodesToSpace(nodes),
  7305. space = _this$convertWhitespa.space,
  7306. rawSpace = _this$convertWhitespa.rawSpace;
  7307. if (rawSpace !== undefined) {
  7308. last.rawSpaceAfter += rawSpace;
  7309. }
  7310. last.spaces.after += space;
  7311. } else {
  7312. nodes.forEach(function (n) {
  7313. return _this3.newNode(n);
  7314. });
  7315. }
  7316. }
  7317. return;
  7318. }
  7319. var firstToken = this.currToken;
  7320. var spaceOrDescendantSelectorNodes = undefined;
  7321. if (nextSigTokenPos > this.position) {
  7322. spaceOrDescendantSelectorNodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
  7323. }
  7324. var node;
  7325. if (this.isNamedCombinator()) {
  7326. node = this.namedCombinator();
  7327. } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.combinator) {
  7328. node = new _combinator["default"]({
  7329. value: this.content(),
  7330. source: getTokenSource(this.currToken),
  7331. sourceIndex: this.currToken[_tokenize.FIELDS.START_POS]
  7332. });
  7333. this.position++;
  7334. } else if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) ; else if (!spaceOrDescendantSelectorNodes) {
  7335. this.unexpected();
  7336. }
  7337. if (node) {
  7338. if (spaceOrDescendantSelectorNodes) {
  7339. var _this$convertWhitespa2 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes),
  7340. _space = _this$convertWhitespa2.space,
  7341. _rawSpace = _this$convertWhitespa2.rawSpace;
  7342. node.spaces.before = _space;
  7343. node.rawSpaceBefore = _rawSpace;
  7344. }
  7345. } else {
  7346. // descendant combinator
  7347. var _this$convertWhitespa3 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes, true),
  7348. _space2 = _this$convertWhitespa3.space,
  7349. _rawSpace2 = _this$convertWhitespa3.rawSpace;
  7350. if (!_rawSpace2) {
  7351. _rawSpace2 = _space2;
  7352. }
  7353. var spaces = {};
  7354. var raws = {
  7355. spaces: {}
  7356. };
  7357. if (_space2.endsWith(' ') && _rawSpace2.endsWith(' ')) {
  7358. spaces.before = _space2.slice(0, _space2.length - 1);
  7359. raws.spaces.before = _rawSpace2.slice(0, _rawSpace2.length - 1);
  7360. } else if (_space2.startsWith(' ') && _rawSpace2.startsWith(' ')) {
  7361. spaces.after = _space2.slice(1);
  7362. raws.spaces.after = _rawSpace2.slice(1);
  7363. } else {
  7364. raws.value = _rawSpace2;
  7365. }
  7366. node = new _combinator["default"]({
  7367. value: ' ',
  7368. source: getTokenSourceSpan(firstToken, this.tokens[this.position - 1]),
  7369. sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
  7370. spaces: spaces,
  7371. raws: raws
  7372. });
  7373. }
  7374. if (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.space) {
  7375. node.spaces.after = this.optionalSpace(this.content());
  7376. this.position++;
  7377. }
  7378. return this.newNode(node);
  7379. };
  7380. _proto.comma = function comma() {
  7381. if (this.position === this.tokens.length - 1) {
  7382. this.root.trailingComma = true;
  7383. this.position++;
  7384. return;
  7385. }
  7386. this.current._inferEndPosition();
  7387. var selector = new _selector["default"]({
  7388. source: {
  7389. start: tokenStart(this.tokens[this.position + 1])
  7390. }
  7391. });
  7392. this.current.parent.append(selector);
  7393. this.current = selector;
  7394. this.position++;
  7395. };
  7396. _proto.comment = function comment() {
  7397. var current = this.currToken;
  7398. this.newNode(new _comment["default"]({
  7399. value: this.content(),
  7400. source: getTokenSource(current),
  7401. sourceIndex: current[_tokenize.FIELDS.START_POS]
  7402. }));
  7403. this.position++;
  7404. };
  7405. _proto.error = function error(message, opts) {
  7406. throw this.root.error(message, opts);
  7407. };
  7408. _proto.missingBackslash = function missingBackslash() {
  7409. return this.error('Expected a backslash preceding the semicolon.', {
  7410. index: this.currToken[_tokenize.FIELDS.START_POS]
  7411. });
  7412. };
  7413. _proto.missingParenthesis = function missingParenthesis() {
  7414. return this.expected('opening parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
  7415. };
  7416. _proto.missingSquareBracket = function missingSquareBracket() {
  7417. return this.expected('opening square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
  7418. };
  7419. _proto.unexpected = function unexpected() {
  7420. return this.error("Unexpected '" + this.content() + "'. Escaping special characters with \\ may help.", this.currToken[_tokenize.FIELDS.START_POS]);
  7421. };
  7422. _proto.namespace = function namespace() {
  7423. var before = this.prevToken && this.content(this.prevToken) || true;
  7424. if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.word) {
  7425. this.position++;
  7426. return this.word(before);
  7427. } else if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.asterisk) {
  7428. this.position++;
  7429. return this.universal(before);
  7430. }
  7431. };
  7432. _proto.nesting = function nesting() {
  7433. if (this.nextToken) {
  7434. var nextContent = this.content(this.nextToken);
  7435. if (nextContent === "|") {
  7436. this.position++;
  7437. return;
  7438. }
  7439. }
  7440. var current = this.currToken;
  7441. this.newNode(new _nesting["default"]({
  7442. value: this.content(),
  7443. source: getTokenSource(current),
  7444. sourceIndex: current[_tokenize.FIELDS.START_POS]
  7445. }));
  7446. this.position++;
  7447. };
  7448. _proto.parentheses = function parentheses() {
  7449. var last = this.current.last;
  7450. var unbalanced = 1;
  7451. this.position++;
  7452. if (last && last.type === types$1.PSEUDO) {
  7453. var selector = new _selector["default"]({
  7454. source: {
  7455. start: tokenStart(this.tokens[this.position - 1])
  7456. }
  7457. });
  7458. var cache = this.current;
  7459. last.append(selector);
  7460. this.current = selector;
  7461. while (this.position < this.tokens.length && unbalanced) {
  7462. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
  7463. unbalanced++;
  7464. }
  7465. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
  7466. unbalanced--;
  7467. }
  7468. if (unbalanced) {
  7469. this.parse();
  7470. } else {
  7471. this.current.source.end = tokenEnd(this.currToken);
  7472. this.current.parent.source.end = tokenEnd(this.currToken);
  7473. this.position++;
  7474. }
  7475. }
  7476. this.current = cache;
  7477. } else {
  7478. // I think this case should be an error. It's used to implement a basic parse of media queries
  7479. // but I don't think it's a good idea.
  7480. var parenStart = this.currToken;
  7481. var parenValue = "(";
  7482. var parenEnd;
  7483. while (this.position < this.tokens.length && unbalanced) {
  7484. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
  7485. unbalanced++;
  7486. }
  7487. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
  7488. unbalanced--;
  7489. }
  7490. parenEnd = this.currToken;
  7491. parenValue += this.parseParenthesisToken(this.currToken);
  7492. this.position++;
  7493. }
  7494. if (last) {
  7495. last.appendToPropertyAndEscape("value", parenValue, parenValue);
  7496. } else {
  7497. this.newNode(new _string["default"]({
  7498. value: parenValue,
  7499. source: getSource(parenStart[_tokenize.FIELDS.START_LINE], parenStart[_tokenize.FIELDS.START_COL], parenEnd[_tokenize.FIELDS.END_LINE], parenEnd[_tokenize.FIELDS.END_COL]),
  7500. sourceIndex: parenStart[_tokenize.FIELDS.START_POS]
  7501. }));
  7502. }
  7503. }
  7504. if (unbalanced) {
  7505. return this.expected('closing parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
  7506. }
  7507. };
  7508. _proto.pseudo = function pseudo() {
  7509. var _this4 = this;
  7510. var pseudoStr = '';
  7511. var startingToken = this.currToken;
  7512. while (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.colon) {
  7513. pseudoStr += this.content();
  7514. this.position++;
  7515. }
  7516. if (!this.currToken) {
  7517. return this.expected(['pseudo-class', 'pseudo-element'], this.position - 1);
  7518. }
  7519. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.word) {
  7520. this.splitWord(false, function (first, length) {
  7521. pseudoStr += first;
  7522. _this4.newNode(new _pseudo["default"]({
  7523. value: pseudoStr,
  7524. source: getTokenSourceSpan(startingToken, _this4.currToken),
  7525. sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
  7526. }));
  7527. if (length > 1 && _this4.nextToken && _this4.nextToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
  7528. _this4.error('Misplaced parenthesis.', {
  7529. index: _this4.nextToken[_tokenize.FIELDS.START_POS]
  7530. });
  7531. }
  7532. });
  7533. } else {
  7534. return this.expected(['pseudo-class', 'pseudo-element'], this.currToken[_tokenize.FIELDS.START_POS]);
  7535. }
  7536. };
  7537. _proto.space = function space() {
  7538. var content = this.content(); // Handle space before and after the selector
  7539. if (this.position === 0 || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis || this.current.nodes.every(function (node) {
  7540. return node.type === 'comment';
  7541. })) {
  7542. this.spaces = this.optionalSpace(content);
  7543. this.position++;
  7544. } else if (this.position === this.tokens.length - 1 || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
  7545. this.current.last.spaces.after = this.optionalSpace(content);
  7546. this.position++;
  7547. } else {
  7548. this.combinator();
  7549. }
  7550. };
  7551. _proto.string = function string() {
  7552. var current = this.currToken;
  7553. this.newNode(new _string["default"]({
  7554. value: this.content(),
  7555. source: getTokenSource(current),
  7556. sourceIndex: current[_tokenize.FIELDS.START_POS]
  7557. }));
  7558. this.position++;
  7559. };
  7560. _proto.universal = function universal(namespace) {
  7561. var nextToken = this.nextToken;
  7562. if (nextToken && this.content(nextToken) === '|') {
  7563. this.position++;
  7564. return this.namespace();
  7565. }
  7566. var current = this.currToken;
  7567. this.newNode(new _universal["default"]({
  7568. value: this.content(),
  7569. source: getTokenSource(current),
  7570. sourceIndex: current[_tokenize.FIELDS.START_POS]
  7571. }), namespace);
  7572. this.position++;
  7573. };
  7574. _proto.splitWord = function splitWord(namespace, firstCallback) {
  7575. var _this5 = this;
  7576. var nextToken = this.nextToken;
  7577. var word = this.content();
  7578. while (nextToken && ~[tokens.dollar, tokens.caret, tokens.equals, tokens.word].indexOf(nextToken[_tokenize.FIELDS.TYPE])) {
  7579. this.position++;
  7580. var current = this.content();
  7581. word += current;
  7582. if (current.lastIndexOf('\\') === current.length - 1) {
  7583. var next = this.nextToken;
  7584. if (next && next[_tokenize.FIELDS.TYPE] === tokens.space) {
  7585. word += this.requiredSpace(this.content(next));
  7586. this.position++;
  7587. }
  7588. }
  7589. nextToken = this.nextToken;
  7590. }
  7591. var hasClass = indexesOf(word, '.').filter(function (i) {
  7592. // Allow escaped dot within class name
  7593. var escapedDot = word[i - 1] === '\\'; // Allow decimal numbers percent in @keyframes
  7594. var isKeyframesPercent = /^\d+\.\d+%$/.test(word);
  7595. return !escapedDot && !isKeyframesPercent;
  7596. });
  7597. var hasId = indexesOf(word, '#').filter(function (i) {
  7598. return word[i - 1] !== '\\';
  7599. }); // Eliminate Sass interpolations from the list of id indexes
  7600. var interpolations = indexesOf(word, '#{');
  7601. if (interpolations.length) {
  7602. hasId = hasId.filter(function (hashIndex) {
  7603. return !~interpolations.indexOf(hashIndex);
  7604. });
  7605. }
  7606. var indices = (0, _sortAscending["default"])(uniqs([0].concat(hasClass, hasId)));
  7607. indices.forEach(function (ind, i) {
  7608. var index = indices[i + 1] || word.length;
  7609. var value = word.slice(ind, index);
  7610. if (i === 0 && firstCallback) {
  7611. return firstCallback.call(_this5, value, indices.length);
  7612. }
  7613. var node;
  7614. var current = _this5.currToken;
  7615. var sourceIndex = current[_tokenize.FIELDS.START_POS] + indices[i];
  7616. var source = getSource(current[1], current[2] + ind, current[3], current[2] + (index - 1));
  7617. if (~hasClass.indexOf(ind)) {
  7618. var classNameOpts = {
  7619. value: value.slice(1),
  7620. source: source,
  7621. sourceIndex: sourceIndex
  7622. };
  7623. node = new _className["default"](unescapeProp(classNameOpts, "value"));
  7624. } else if (~hasId.indexOf(ind)) {
  7625. var idOpts = {
  7626. value: value.slice(1),
  7627. source: source,
  7628. sourceIndex: sourceIndex
  7629. };
  7630. node = new _id["default"](unescapeProp(idOpts, "value"));
  7631. } else {
  7632. var tagOpts = {
  7633. value: value,
  7634. source: source,
  7635. sourceIndex: sourceIndex
  7636. };
  7637. unescapeProp(tagOpts, "value");
  7638. node = new _tag["default"](tagOpts);
  7639. }
  7640. _this5.newNode(node, namespace); // Ensure that the namespace is used only once
  7641. namespace = null;
  7642. });
  7643. this.position++;
  7644. };
  7645. _proto.word = function word(namespace) {
  7646. var nextToken = this.nextToken;
  7647. if (nextToken && this.content(nextToken) === '|') {
  7648. this.position++;
  7649. return this.namespace();
  7650. }
  7651. return this.splitWord(namespace);
  7652. };
  7653. _proto.loop = function loop() {
  7654. while (this.position < this.tokens.length) {
  7655. this.parse(true);
  7656. }
  7657. this.current._inferEndPosition();
  7658. return this.root;
  7659. };
  7660. _proto.parse = function parse(throwOnParenthesis) {
  7661. switch (this.currToken[_tokenize.FIELDS.TYPE]) {
  7662. case tokens.space:
  7663. this.space();
  7664. break;
  7665. case tokens.comment:
  7666. this.comment();
  7667. break;
  7668. case tokens.openParenthesis:
  7669. this.parentheses();
  7670. break;
  7671. case tokens.closeParenthesis:
  7672. if (throwOnParenthesis) {
  7673. this.missingParenthesis();
  7674. }
  7675. break;
  7676. case tokens.openSquare:
  7677. this.attribute();
  7678. break;
  7679. case tokens.dollar:
  7680. case tokens.caret:
  7681. case tokens.equals:
  7682. case tokens.word:
  7683. this.word();
  7684. break;
  7685. case tokens.colon:
  7686. this.pseudo();
  7687. break;
  7688. case tokens.comma:
  7689. this.comma();
  7690. break;
  7691. case tokens.asterisk:
  7692. this.universal();
  7693. break;
  7694. case tokens.ampersand:
  7695. this.nesting();
  7696. break;
  7697. case tokens.slash:
  7698. case tokens.combinator:
  7699. this.combinator();
  7700. break;
  7701. case tokens.str:
  7702. this.string();
  7703. break;
  7704. // These cases throw; no break needed.
  7705. case tokens.closeSquare:
  7706. this.missingSquareBracket();
  7707. case tokens.semicolon:
  7708. this.missingBackslash();
  7709. default:
  7710. this.unexpected();
  7711. }
  7712. }
  7713. /**
  7714. * Helpers
  7715. */
  7716. ;
  7717. _proto.expected = function expected(description, index, found) {
  7718. if (Array.isArray(description)) {
  7719. var last = description.pop();
  7720. description = description.join(', ') + " or " + last;
  7721. }
  7722. var an = /^[aeiou]/.test(description[0]) ? 'an' : 'a';
  7723. if (!found) {
  7724. return this.error("Expected " + an + " " + description + ".", {
  7725. index: index
  7726. });
  7727. }
  7728. return this.error("Expected " + an + " " + description + ", found \"" + found + "\" instead.", {
  7729. index: index
  7730. });
  7731. };
  7732. _proto.requiredSpace = function requiredSpace(space) {
  7733. return this.options.lossy ? ' ' : space;
  7734. };
  7735. _proto.optionalSpace = function optionalSpace(space) {
  7736. return this.options.lossy ? '' : space;
  7737. };
  7738. _proto.lossySpace = function lossySpace(space, required) {
  7739. if (this.options.lossy) {
  7740. return required ? ' ' : '';
  7741. } else {
  7742. return space;
  7743. }
  7744. };
  7745. _proto.parseParenthesisToken = function parseParenthesisToken(token) {
  7746. var content = this.content(token);
  7747. if (token[_tokenize.FIELDS.TYPE] === tokens.space) {
  7748. return this.requiredSpace(content);
  7749. } else {
  7750. return content;
  7751. }
  7752. };
  7753. _proto.newNode = function newNode(node, namespace) {
  7754. if (namespace) {
  7755. if (/^ +$/.test(namespace)) {
  7756. if (!this.options.lossy) {
  7757. this.spaces = (this.spaces || '') + namespace;
  7758. }
  7759. namespace = true;
  7760. }
  7761. node.namespace = namespace;
  7762. unescapeProp(node, "namespace");
  7763. }
  7764. if (this.spaces) {
  7765. node.spaces.before = this.spaces;
  7766. this.spaces = '';
  7767. }
  7768. return this.current.append(node);
  7769. };
  7770. _proto.content = function content(token) {
  7771. if (token === void 0) {
  7772. token = this.currToken;
  7773. }
  7774. return this.css.slice(token[_tokenize.FIELDS.START_POS], token[_tokenize.FIELDS.END_POS]);
  7775. };
  7776. /**
  7777. * returns the index of the next non-whitespace, non-comment token.
  7778. * returns -1 if no meaningful token is found.
  7779. */
  7780. _proto.locateNextMeaningfulToken = function locateNextMeaningfulToken(startPosition) {
  7781. if (startPosition === void 0) {
  7782. startPosition = this.position + 1;
  7783. }
  7784. var searchPosition = startPosition;
  7785. while (searchPosition < this.tokens.length) {
  7786. if (WHITESPACE_EQUIV_TOKENS[this.tokens[searchPosition][_tokenize.FIELDS.TYPE]]) {
  7787. searchPosition++;
  7788. continue;
  7789. } else {
  7790. return searchPosition;
  7791. }
  7792. }
  7793. return -1;
  7794. };
  7795. _createClass(Parser, [{
  7796. key: "currToken",
  7797. get: function get() {
  7798. return this.tokens[this.position];
  7799. }
  7800. }, {
  7801. key: "nextToken",
  7802. get: function get() {
  7803. return this.tokens[this.position + 1];
  7804. }
  7805. }, {
  7806. key: "prevToken",
  7807. get: function get() {
  7808. return this.tokens[this.position - 1];
  7809. }
  7810. }]);
  7811. return Parser;
  7812. }();
  7813. exports["default"] = Parser;
  7814. module.exports = exports.default;
  7815. });
  7816. var processor = createCommonjsModule(function (module, exports) {
  7817. exports.__esModule = true;
  7818. exports["default"] = void 0;
  7819. var _parser = _interopRequireDefault(parser);
  7820. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  7821. var Processor = /*#__PURE__*/function () {
  7822. function Processor(func, options) {
  7823. this.func = func || function noop() {};
  7824. this.funcRes = null;
  7825. this.options = options;
  7826. }
  7827. var _proto = Processor.prototype;
  7828. _proto._shouldUpdateSelector = function _shouldUpdateSelector(rule, options) {
  7829. if (options === void 0) {
  7830. options = {};
  7831. }
  7832. var merged = Object.assign({}, this.options, options);
  7833. if (merged.updateSelector === false) {
  7834. return false;
  7835. } else {
  7836. return typeof rule !== "string";
  7837. }
  7838. };
  7839. _proto._isLossy = function _isLossy(options) {
  7840. if (options === void 0) {
  7841. options = {};
  7842. }
  7843. var merged = Object.assign({}, this.options, options);
  7844. if (merged.lossless === false) {
  7845. return true;
  7846. } else {
  7847. return false;
  7848. }
  7849. };
  7850. _proto._root = function _root(rule, options) {
  7851. if (options === void 0) {
  7852. options = {};
  7853. }
  7854. var parser = new _parser["default"](rule, this._parseOptions(options));
  7855. return parser.root;
  7856. };
  7857. _proto._parseOptions = function _parseOptions(options) {
  7858. return {
  7859. lossy: this._isLossy(options)
  7860. };
  7861. };
  7862. _proto._run = function _run(rule, options) {
  7863. var _this = this;
  7864. if (options === void 0) {
  7865. options = {};
  7866. }
  7867. return new Promise(function (resolve, reject) {
  7868. try {
  7869. var root = _this._root(rule, options);
  7870. Promise.resolve(_this.func(root)).then(function (transform) {
  7871. var string = undefined;
  7872. if (_this._shouldUpdateSelector(rule, options)) {
  7873. string = root.toString();
  7874. rule.selector = string;
  7875. }
  7876. return {
  7877. transform: transform,
  7878. root: root,
  7879. string: string
  7880. };
  7881. }).then(resolve, reject);
  7882. } catch (e) {
  7883. reject(e);
  7884. return;
  7885. }
  7886. });
  7887. };
  7888. _proto._runSync = function _runSync(rule, options) {
  7889. if (options === void 0) {
  7890. options = {};
  7891. }
  7892. var root = this._root(rule, options);
  7893. var transform = this.func(root);
  7894. if (transform && typeof transform.then === "function") {
  7895. throw new Error("Selector processor returned a promise to a synchronous call.");
  7896. }
  7897. var string = undefined;
  7898. if (options.updateSelector && typeof rule !== "string") {
  7899. string = root.toString();
  7900. rule.selector = string;
  7901. }
  7902. return {
  7903. transform: transform,
  7904. root: root,
  7905. string: string
  7906. };
  7907. }
  7908. /**
  7909. * Process rule into a selector AST.
  7910. *
  7911. * @param rule {postcss.Rule | string} The css selector to be processed
  7912. * @param options The options for processing
  7913. * @returns {Promise<parser.Root>} The AST of the selector after processing it.
  7914. */
  7915. ;
  7916. _proto.ast = function ast(rule, options) {
  7917. return this._run(rule, options).then(function (result) {
  7918. return result.root;
  7919. });
  7920. }
  7921. /**
  7922. * Process rule into a selector AST synchronously.
  7923. *
  7924. * @param rule {postcss.Rule | string} The css selector to be processed
  7925. * @param options The options for processing
  7926. * @returns {parser.Root} The AST of the selector after processing it.
  7927. */
  7928. ;
  7929. _proto.astSync = function astSync(rule, options) {
  7930. return this._runSync(rule, options).root;
  7931. }
  7932. /**
  7933. * Process a selector into a transformed value asynchronously
  7934. *
  7935. * @param rule {postcss.Rule | string} The css selector to be processed
  7936. * @param options The options for processing
  7937. * @returns {Promise<any>} The value returned by the processor.
  7938. */
  7939. ;
  7940. _proto.transform = function transform(rule, options) {
  7941. return this._run(rule, options).then(function (result) {
  7942. return result.transform;
  7943. });
  7944. }
  7945. /**
  7946. * Process a selector into a transformed value synchronously.
  7947. *
  7948. * @param rule {postcss.Rule | string} The css selector to be processed
  7949. * @param options The options for processing
  7950. * @returns {any} The value returned by the processor.
  7951. */
  7952. ;
  7953. _proto.transformSync = function transformSync(rule, options) {
  7954. return this._runSync(rule, options).transform;
  7955. }
  7956. /**
  7957. * Process a selector into a new selector string asynchronously.
  7958. *
  7959. * @param rule {postcss.Rule | string} The css selector to be processed
  7960. * @param options The options for processing
  7961. * @returns {string} the selector after processing.
  7962. */
  7963. ;
  7964. _proto.process = function process(rule, options) {
  7965. return this._run(rule, options).then(function (result) {
  7966. return result.string || result.root.toString();
  7967. });
  7968. }
  7969. /**
  7970. * Process a selector into a new selector string synchronously.
  7971. *
  7972. * @param rule {postcss.Rule | string} The css selector to be processed
  7973. * @param options The options for processing
  7974. * @returns {string} the selector after processing.
  7975. */
  7976. ;
  7977. _proto.processSync = function processSync(rule, options) {
  7978. var result = this._runSync(rule, options);
  7979. return result.string || result.root.toString();
  7980. };
  7981. return Processor;
  7982. }();
  7983. exports["default"] = Processor;
  7984. module.exports = exports.default;
  7985. });
  7986. var constructors = createCommonjsModule(function (module, exports) {
  7987. exports.__esModule = true;
  7988. exports.universal = exports.tag = exports.string = exports.selector = exports.root = exports.pseudo = exports.nesting = exports.id = exports.comment = exports.combinator = exports.className = exports.attribute = void 0;
  7989. var _attribute = _interopRequireDefault(attribute);
  7990. var _className = _interopRequireDefault(className);
  7991. var _combinator = _interopRequireDefault(combinator);
  7992. var _comment = _interopRequireDefault(comment);
  7993. var _id = _interopRequireDefault(id);
  7994. var _nesting = _interopRequireDefault(nesting);
  7995. var _pseudo = _interopRequireDefault(pseudo);
  7996. var _root = _interopRequireDefault(root);
  7997. var _selector = _interopRequireDefault(selector);
  7998. var _string = _interopRequireDefault(string);
  7999. var _tag = _interopRequireDefault(tag);
  8000. var _universal = _interopRequireDefault(universal);
  8001. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  8002. var attribute$1 = function attribute(opts) {
  8003. return new _attribute["default"](opts);
  8004. };
  8005. exports.attribute = attribute$1;
  8006. var className$1 = function className(opts) {
  8007. return new _className["default"](opts);
  8008. };
  8009. exports.className = className$1;
  8010. var combinator$1 = function combinator(opts) {
  8011. return new _combinator["default"](opts);
  8012. };
  8013. exports.combinator = combinator$1;
  8014. var comment$1 = function comment(opts) {
  8015. return new _comment["default"](opts);
  8016. };
  8017. exports.comment = comment$1;
  8018. var id$1 = function id(opts) {
  8019. return new _id["default"](opts);
  8020. };
  8021. exports.id = id$1;
  8022. var nesting$1 = function nesting(opts) {
  8023. return new _nesting["default"](opts);
  8024. };
  8025. exports.nesting = nesting$1;
  8026. var pseudo$1 = function pseudo(opts) {
  8027. return new _pseudo["default"](opts);
  8028. };
  8029. exports.pseudo = pseudo$1;
  8030. var root$1 = function root(opts) {
  8031. return new _root["default"](opts);
  8032. };
  8033. exports.root = root$1;
  8034. var selector$1 = function selector(opts) {
  8035. return new _selector["default"](opts);
  8036. };
  8037. exports.selector = selector$1;
  8038. var string$1 = function string(opts) {
  8039. return new _string["default"](opts);
  8040. };
  8041. exports.string = string$1;
  8042. var tag$1 = function tag(opts) {
  8043. return new _tag["default"](opts);
  8044. };
  8045. exports.tag = tag$1;
  8046. var universal$1 = function universal(opts) {
  8047. return new _universal["default"](opts);
  8048. };
  8049. exports.universal = universal$1;
  8050. });
  8051. var guards = createCommonjsModule(function (module, exports) {
  8052. exports.__esModule = true;
  8053. exports.isNode = isNode;
  8054. exports.isPseudoElement = isPseudoElement;
  8055. exports.isPseudoClass = isPseudoClass;
  8056. exports.isContainer = isContainer;
  8057. exports.isNamespace = isNamespace;
  8058. exports.isUniversal = exports.isTag = exports.isString = exports.isSelector = exports.isRoot = exports.isPseudo = exports.isNesting = exports.isIdentifier = exports.isComment = exports.isCombinator = exports.isClassName = exports.isAttribute = void 0;
  8059. var _IS_TYPE;
  8060. var IS_TYPE = (_IS_TYPE = {}, _IS_TYPE[types.ATTRIBUTE] = true, _IS_TYPE[types.CLASS] = true, _IS_TYPE[types.COMBINATOR] = true, _IS_TYPE[types.COMMENT] = true, _IS_TYPE[types.ID] = true, _IS_TYPE[types.NESTING] = true, _IS_TYPE[types.PSEUDO] = true, _IS_TYPE[types.ROOT] = true, _IS_TYPE[types.SELECTOR] = true, _IS_TYPE[types.STRING] = true, _IS_TYPE[types.TAG] = true, _IS_TYPE[types.UNIVERSAL] = true, _IS_TYPE);
  8061. function isNode(node) {
  8062. return typeof node === "object" && IS_TYPE[node.type];
  8063. }
  8064. function isNodeType(type, node) {
  8065. return isNode(node) && node.type === type;
  8066. }
  8067. var isAttribute = isNodeType.bind(null, types.ATTRIBUTE);
  8068. exports.isAttribute = isAttribute;
  8069. var isClassName = isNodeType.bind(null, types.CLASS);
  8070. exports.isClassName = isClassName;
  8071. var isCombinator = isNodeType.bind(null, types.COMBINATOR);
  8072. exports.isCombinator = isCombinator;
  8073. var isComment = isNodeType.bind(null, types.COMMENT);
  8074. exports.isComment = isComment;
  8075. var isIdentifier = isNodeType.bind(null, types.ID);
  8076. exports.isIdentifier = isIdentifier;
  8077. var isNesting = isNodeType.bind(null, types.NESTING);
  8078. exports.isNesting = isNesting;
  8079. var isPseudo = isNodeType.bind(null, types.PSEUDO);
  8080. exports.isPseudo = isPseudo;
  8081. var isRoot = isNodeType.bind(null, types.ROOT);
  8082. exports.isRoot = isRoot;
  8083. var isSelector = isNodeType.bind(null, types.SELECTOR);
  8084. exports.isSelector = isSelector;
  8085. var isString = isNodeType.bind(null, types.STRING);
  8086. exports.isString = isString;
  8087. var isTag = isNodeType.bind(null, types.TAG);
  8088. exports.isTag = isTag;
  8089. var isUniversal = isNodeType.bind(null, types.UNIVERSAL);
  8090. exports.isUniversal = isUniversal;
  8091. function isPseudoElement(node) {
  8092. return isPseudo(node) && node.value && (node.value.startsWith("::") || node.value.toLowerCase() === ":before" || node.value.toLowerCase() === ":after");
  8093. }
  8094. function isPseudoClass(node) {
  8095. return isPseudo(node) && !isPseudoElement(node);
  8096. }
  8097. function isContainer(node) {
  8098. return !!(isNode(node) && node.walk);
  8099. }
  8100. function isNamespace(node) {
  8101. return isAttribute(node) || isTag(node);
  8102. }
  8103. });
  8104. var selectors = createCommonjsModule(function (module, exports) {
  8105. exports.__esModule = true;
  8106. Object.keys(types).forEach(function (key) {
  8107. if (key === "default" || key === "__esModule") return;
  8108. if (key in exports && exports[key] === types[key]) return;
  8109. exports[key] = types[key];
  8110. });
  8111. Object.keys(constructors).forEach(function (key) {
  8112. if (key === "default" || key === "__esModule") return;
  8113. if (key in exports && exports[key] === constructors[key]) return;
  8114. exports[key] = constructors[key];
  8115. });
  8116. Object.keys(guards).forEach(function (key) {
  8117. if (key === "default" || key === "__esModule") return;
  8118. if (key in exports && exports[key] === guards[key]) return;
  8119. exports[key] = guards[key];
  8120. });
  8121. });
  8122. var dist = createCommonjsModule(function (module, exports) {
  8123. exports.__esModule = true;
  8124. exports["default"] = void 0;
  8125. var _processor = _interopRequireDefault(processor);
  8126. var selectors$1 = _interopRequireWildcard(selectors);
  8127. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  8128. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
  8129. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  8130. var parser = function parser(processor) {
  8131. return new _processor["default"](processor);
  8132. };
  8133. Object.assign(parser, selectors$1);
  8134. delete parser.__esModule;
  8135. var _default = parser;
  8136. exports["default"] = _default;
  8137. module.exports = exports.default;
  8138. });
  8139. var selectorParser = /*@__PURE__*/getDefaultExportFromCjs(dist);
  8140. const animationNameRE = /^(-\w+-)?animation-name$/;
  8141. const animationRE = /^(-\w+-)?animation$/;
  8142. const scopedPlugin = (id = '') => {
  8143. const keyframes = Object.create(null);
  8144. const shortId = id.replace(/^data-v-/, '');
  8145. return {
  8146. postcssPlugin: 'vue-sfc-scoped',
  8147. Rule(rule) {
  8148. processRule(id, rule);
  8149. },
  8150. AtRule(node) {
  8151. if (/-?keyframes$/.test(node.name) &&
  8152. !node.params.endsWith(`-${shortId}`)) {
  8153. // register keyframes
  8154. keyframes[node.params] = node.params = node.params + '-' + shortId;
  8155. }
  8156. },
  8157. OnceExit(root) {
  8158. if (Object.keys(keyframes).length) {
  8159. // If keyframes are found in this <style>, find and rewrite animation names
  8160. // in declarations.
  8161. // Caveat: this only works for keyframes and animation rules in the same
  8162. // <style> element.
  8163. // individual animation-name declaration
  8164. root.walkDecls(decl => {
  8165. if (animationNameRE.test(decl.prop)) {
  8166. decl.value = decl.value
  8167. .split(',')
  8168. .map(v => keyframes[v.trim()] || v.trim())
  8169. .join(',');
  8170. }
  8171. // shorthand
  8172. if (animationRE.test(decl.prop)) {
  8173. decl.value = decl.value
  8174. .split(',')
  8175. .map(v => {
  8176. const vals = v.trim().split(/\s+/);
  8177. const i = vals.findIndex(val => keyframes[val]);
  8178. if (i !== -1) {
  8179. vals.splice(i, 1, keyframes[vals[i]]);
  8180. return vals.join(' ');
  8181. }
  8182. else {
  8183. return v;
  8184. }
  8185. })
  8186. .join(',');
  8187. }
  8188. });
  8189. }
  8190. }
  8191. };
  8192. };
  8193. const processedRules = new WeakSet();
  8194. function processRule(id, rule) {
  8195. if (processedRules.has(rule) ||
  8196. (rule.parent &&
  8197. rule.parent.type === 'atrule' &&
  8198. /-?keyframes$/.test(rule.parent.name))) {
  8199. return;
  8200. }
  8201. processedRules.add(rule);
  8202. rule.selector = selectorParser(selectorRoot => {
  8203. selectorRoot.each(selector => {
  8204. rewriteSelector(id, selector, selectorRoot);
  8205. });
  8206. }).processSync(rule.selector);
  8207. }
  8208. function rewriteSelector(id, selector, selectorRoot, slotted = false) {
  8209. let node = null;
  8210. let shouldInject = true;
  8211. // find the last child node to insert attribute selector
  8212. selector.each(n => {
  8213. // DEPRECATED ">>>" and "/deep/" combinator
  8214. if (n.type === 'combinator' &&
  8215. (n.value === '>>>' || n.value === '/deep/')) {
  8216. n.value = ' ';
  8217. n.spaces.before = n.spaces.after = '';
  8218. warn(`the >>> and /deep/ combinators have been deprecated. ` +
  8219. `Use :deep() instead.`);
  8220. return false;
  8221. }
  8222. if (n.type === 'pseudo') {
  8223. const { value } = n;
  8224. // deep: inject [id] attribute at the node before the ::v-deep
  8225. // combinator.
  8226. if (value === ':deep' || value === '::v-deep') {
  8227. if (n.nodes.length) {
  8228. // .foo ::v-deep(.bar) -> .foo[xxxxxxx] .bar
  8229. // replace the current node with ::v-deep's inner selector
  8230. let last = n;
  8231. n.nodes[0].each(ss => {
  8232. selector.insertAfter(last, ss);
  8233. last = ss;
  8234. });
  8235. // insert a space combinator before if it doesn't already have one
  8236. const prev = selector.at(selector.index(n) - 1);
  8237. if (!prev || !isSpaceCombinator(prev)) {
  8238. selector.insertAfter(n, selectorParser.combinator({
  8239. value: ' '
  8240. }));
  8241. }
  8242. selector.removeChild(n);
  8243. }
  8244. else {
  8245. // DEPRECATED usage
  8246. // .foo ::v-deep .bar -> .foo[xxxxxxx] .bar
  8247. warn(`::v-deep usage as a combinator has ` +
  8248. `been deprecated. Use :deep(<inner-selector>) instead.`);
  8249. const prev = selector.at(selector.index(n) - 1);
  8250. if (prev && isSpaceCombinator(prev)) {
  8251. selector.removeChild(prev);
  8252. }
  8253. selector.removeChild(n);
  8254. }
  8255. return false;
  8256. }
  8257. // slot: use selector inside `::v-slotted` and inject [id + '-s']
  8258. // instead.
  8259. // ::v-slotted(.foo) -> .foo[xxxxxxx-s]
  8260. if (value === ':slotted' || value === '::v-slotted') {
  8261. rewriteSelector(id, n.nodes[0], selectorRoot, true /* slotted */);
  8262. let last = n;
  8263. n.nodes[0].each(ss => {
  8264. selector.insertAfter(last, ss);
  8265. last = ss;
  8266. });
  8267. // selector.insertAfter(n, n.nodes[0])
  8268. selector.removeChild(n);
  8269. // since slotted attribute already scopes the selector there's no
  8270. // need for the non-slot attribute.
  8271. shouldInject = false;
  8272. return false;
  8273. }
  8274. // global: replace with inner selector and do not inject [id].
  8275. // ::v-global(.foo) -> .foo
  8276. if (value === ':global' || value === '::v-global') {
  8277. selectorRoot.insertAfter(selector, n.nodes[0]);
  8278. selectorRoot.removeChild(selector);
  8279. return false;
  8280. }
  8281. }
  8282. if (n.type !== 'pseudo' && n.type !== 'combinator') {
  8283. node = n;
  8284. }
  8285. });
  8286. if (node) {
  8287. node.spaces.after = '';
  8288. }
  8289. else {
  8290. // For deep selectors & standalone pseudo selectors,
  8291. // the attribute selectors are prepended rather than appended.
  8292. // So all leading spaces must be eliminated to avoid problems.
  8293. selector.first.spaces.before = '';
  8294. }
  8295. if (shouldInject) {
  8296. const idToAdd = slotted ? id + '-s' : id;
  8297. selector.insertAfter(
  8298. // If node is null it means we need to inject [id] at the start
  8299. // insertAfter can handle `null` here
  8300. node, selectorParser.attribute({
  8301. attribute: idToAdd,
  8302. value: idToAdd,
  8303. raws: {},
  8304. quoteMark: `"`
  8305. }));
  8306. }
  8307. }
  8308. function isSpaceCombinator(node) {
  8309. return node.type === 'combinator' && /^\s+$/.test(node.value);
  8310. }
  8311. scopedPlugin.postcss = true;
  8312. var SourceMapConsumer = sourceMap__default.SourceMapConsumer;
  8313. var SourceMapGenerator = sourceMap__default.SourceMapGenerator;
  8314. var mergeSourceMap = merge$1;
  8315. /**
  8316. * Merge old source map and new source map and return merged.
  8317. * If old or new source map value is falsy, return another one as it is.
  8318. *
  8319. * @param {object|string} [oldMap] old source map object
  8320. * @param {object|string} [newmap] new source map object
  8321. * @return {object|undefined} merged source map object, or undefined when both old and new source map are undefined
  8322. */
  8323. function merge$1(oldMap, newMap) {
  8324. if (!oldMap) return newMap
  8325. if (!newMap) return oldMap
  8326. var oldMapConsumer = new SourceMapConsumer(oldMap);
  8327. var newMapConsumer = new SourceMapConsumer(newMap);
  8328. var mergedMapGenerator = new SourceMapGenerator();
  8329. // iterate on new map and overwrite original position of new map with one of old map
  8330. newMapConsumer.eachMapping(function(m) {
  8331. // pass when `originalLine` is null.
  8332. // It occurs in case that the node does not have origin in original code.
  8333. if (m.originalLine == null) return
  8334. var origPosInOldMap = oldMapConsumer.originalPositionFor({
  8335. line: m.originalLine,
  8336. column: m.originalColumn
  8337. });
  8338. if (origPosInOldMap.source == null) return
  8339. mergedMapGenerator.addMapping({
  8340. original: {
  8341. line: origPosInOldMap.line,
  8342. column: origPosInOldMap.column
  8343. },
  8344. generated: {
  8345. line: m.generatedLine,
  8346. column: m.generatedColumn
  8347. },
  8348. source: origPosInOldMap.source,
  8349. name: origPosInOldMap.name
  8350. });
  8351. });
  8352. var consumers = [oldMapConsumer, newMapConsumer];
  8353. consumers.forEach(function(consumer) {
  8354. consumer.sources.forEach(function(sourceFile) {
  8355. mergedMapGenerator._sources.add(sourceFile);
  8356. var sourceContent = consumer.sourceContentFor(sourceFile);
  8357. if (sourceContent != null) {
  8358. mergedMapGenerator.setSourceContent(sourceFile, sourceContent);
  8359. }
  8360. });
  8361. });
  8362. mergedMapGenerator._sourceRoot = oldMap.sourceRoot;
  8363. mergedMapGenerator._file = oldMap.file;
  8364. return JSON.parse(mergedMapGenerator.toString())
  8365. }
  8366. // .scss/.sass processor
  8367. const scss = (source, map, options, load = require) => {
  8368. const nodeSass = load('sass');
  8369. const finalOptions = {
  8370. ...options,
  8371. data: getSource(source, options.filename, options.additionalData),
  8372. file: options.filename,
  8373. outFile: options.filename,
  8374. sourceMap: !!map
  8375. };
  8376. try {
  8377. const result = nodeSass.renderSync(finalOptions);
  8378. const dependencies = result.stats.includedFiles;
  8379. if (map) {
  8380. return {
  8381. code: result.css.toString(),
  8382. map: mergeSourceMap(map, JSON.parse(result.map.toString())),
  8383. errors: [],
  8384. dependencies
  8385. };
  8386. }
  8387. return { code: result.css.toString(), errors: [], dependencies };
  8388. }
  8389. catch (e) {
  8390. return { code: '', errors: [e], dependencies: [] };
  8391. }
  8392. };
  8393. const sass = (source, map, options, load) => scss(source, map, {
  8394. ...options,
  8395. indentedSyntax: true
  8396. }, load);
  8397. // .less
  8398. const less = (source, map, options, load = require) => {
  8399. const nodeLess = load('less');
  8400. let result;
  8401. let error = null;
  8402. nodeLess.render(getSource(source, options.filename, options.additionalData), { ...options, syncImport: true }, (err, output) => {
  8403. error = err;
  8404. result = output;
  8405. });
  8406. if (error)
  8407. return { code: '', errors: [error], dependencies: [] };
  8408. const dependencies = result.imports;
  8409. if (map) {
  8410. return {
  8411. code: result.css.toString(),
  8412. map: mergeSourceMap(map, result.map),
  8413. errors: [],
  8414. dependencies: dependencies
  8415. };
  8416. }
  8417. return {
  8418. code: result.css.toString(),
  8419. errors: [],
  8420. dependencies: dependencies
  8421. };
  8422. };
  8423. // .styl
  8424. const styl = (source, map, options, load = require) => {
  8425. const nodeStylus = load('stylus');
  8426. try {
  8427. const ref = nodeStylus(source);
  8428. Object.keys(options).forEach(key => ref.set(key, options[key]));
  8429. if (map)
  8430. ref.set('sourcemap', { inline: false, comment: false });
  8431. const result = ref.render();
  8432. const dependencies = ref.deps();
  8433. if (map) {
  8434. return {
  8435. code: result,
  8436. map: mergeSourceMap(map, ref.sourcemap),
  8437. errors: [],
  8438. dependencies
  8439. };
  8440. }
  8441. return { code: result, errors: [], dependencies };
  8442. }
  8443. catch (e) {
  8444. return { code: '', errors: [e], dependencies: [] };
  8445. }
  8446. };
  8447. function getSource(source, filename, additionalData) {
  8448. if (!additionalData)
  8449. return source;
  8450. if (shared.isFunction(additionalData)) {
  8451. return additionalData(source, filename);
  8452. }
  8453. return additionalData + source;
  8454. }
  8455. const processors = {
  8456. less,
  8457. sass,
  8458. scss,
  8459. styl,
  8460. stylus: styl
  8461. };
  8462. /**
  8463. * lodash (Custom Build) <https://lodash.com/>
  8464. * Build: `lodash modularize exports="npm" -o ./`
  8465. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  8466. * Released under MIT license <https://lodash.com/license>
  8467. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  8468. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  8469. */
  8470. /** Used as references for various `Number` constants. */
  8471. var INFINITY = 1 / 0;
  8472. /** `Object#toString` result references. */
  8473. var symbolTag = '[object Symbol]';
  8474. /** Used to match words composed of alphanumeric characters. */
  8475. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  8476. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  8477. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  8478. /** Used to compose unicode character classes. */
  8479. var rsAstralRange = '\\ud800-\\udfff',
  8480. rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
  8481. rsComboSymbolsRange = '\\u20d0-\\u20f0',
  8482. rsDingbatRange = '\\u2700-\\u27bf',
  8483. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  8484. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  8485. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  8486. rsPunctuationRange = '\\u2000-\\u206f',
  8487. rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
  8488. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  8489. rsVarRange = '\\ufe0e\\ufe0f',
  8490. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  8491. /** Used to compose unicode capture groups. */
  8492. var rsApos = "['\u2019]",
  8493. rsAstral = '[' + rsAstralRange + ']',
  8494. rsBreak = '[' + rsBreakRange + ']',
  8495. rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
  8496. rsDigits = '\\d+',
  8497. rsDingbat = '[' + rsDingbatRange + ']',
  8498. rsLower = '[' + rsLowerRange + ']',
  8499. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  8500. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  8501. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  8502. rsNonAstral = '[^' + rsAstralRange + ']',
  8503. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  8504. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  8505. rsUpper = '[' + rsUpperRange + ']',
  8506. rsZWJ = '\\u200d';
  8507. /** Used to compose unicode regexes. */
  8508. var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
  8509. rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
  8510. rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  8511. rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  8512. reOptMod = rsModifier + '?',
  8513. rsOptVar = '[' + rsVarRange + ']?',
  8514. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  8515. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  8516. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  8517. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  8518. /** Used to match apostrophes. */
  8519. var reApos = RegExp(rsApos, 'g');
  8520. /**
  8521. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  8522. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  8523. */
  8524. var reComboMark = RegExp(rsCombo, 'g');
  8525. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  8526. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  8527. /** Used to match complex or compound words. */
  8528. var reUnicodeWord = RegExp([
  8529. rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  8530. rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
  8531. rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
  8532. rsUpper + '+' + rsOptUpperContr,
  8533. rsDigits,
  8534. rsEmoji
  8535. ].join('|'), 'g');
  8536. /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
  8537. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
  8538. /** Used to detect strings that need a more robust regexp to match words. */
  8539. var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
  8540. /** Used to map Latin Unicode letters to basic Latin letters. */
  8541. var deburredLetters = {
  8542. // Latin-1 Supplement block.
  8543. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  8544. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  8545. '\xc7': 'C', '\xe7': 'c',
  8546. '\xd0': 'D', '\xf0': 'd',
  8547. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  8548. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  8549. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  8550. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  8551. '\xd1': 'N', '\xf1': 'n',
  8552. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  8553. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  8554. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  8555. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  8556. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  8557. '\xc6': 'Ae', '\xe6': 'ae',
  8558. '\xde': 'Th', '\xfe': 'th',
  8559. '\xdf': 'ss',
  8560. // Latin Extended-A block.
  8561. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  8562. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  8563. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  8564. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  8565. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  8566. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  8567. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  8568. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  8569. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  8570. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  8571. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  8572. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  8573. '\u0134': 'J', '\u0135': 'j',
  8574. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  8575. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  8576. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  8577. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  8578. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  8579. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  8580. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  8581. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  8582. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  8583. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  8584. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  8585. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  8586. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  8587. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  8588. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  8589. '\u0174': 'W', '\u0175': 'w',
  8590. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  8591. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  8592. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  8593. '\u0132': 'IJ', '\u0133': 'ij',
  8594. '\u0152': 'Oe', '\u0153': 'oe',
  8595. '\u0149': "'n", '\u017f': 'ss'
  8596. };
  8597. /** Detect free variable `global` from Node.js. */
  8598. var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
  8599. /** Detect free variable `self`. */
  8600. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  8601. /** Used as a reference to the global object. */
  8602. var root$1 = freeGlobal || freeSelf || Function('return this')();
  8603. /**
  8604. * A specialized version of `_.reduce` for arrays without support for
  8605. * iteratee shorthands.
  8606. *
  8607. * @private
  8608. * @param {Array} [array] The array to iterate over.
  8609. * @param {Function} iteratee The function invoked per iteration.
  8610. * @param {*} [accumulator] The initial value.
  8611. * @param {boolean} [initAccum] Specify using the first element of `array` as
  8612. * the initial value.
  8613. * @returns {*} Returns the accumulated value.
  8614. */
  8615. function arrayReduce(array, iteratee, accumulator, initAccum) {
  8616. var index = -1,
  8617. length = array ? array.length : 0;
  8618. if (initAccum && length) {
  8619. accumulator = array[++index];
  8620. }
  8621. while (++index < length) {
  8622. accumulator = iteratee(accumulator, array[index], index, array);
  8623. }
  8624. return accumulator;
  8625. }
  8626. /**
  8627. * Converts an ASCII `string` to an array.
  8628. *
  8629. * @private
  8630. * @param {string} string The string to convert.
  8631. * @returns {Array} Returns the converted array.
  8632. */
  8633. function asciiToArray(string) {
  8634. return string.split('');
  8635. }
  8636. /**
  8637. * Splits an ASCII `string` into an array of its words.
  8638. *
  8639. * @private
  8640. * @param {string} The string to inspect.
  8641. * @returns {Array} Returns the words of `string`.
  8642. */
  8643. function asciiWords(string) {
  8644. return string.match(reAsciiWord) || [];
  8645. }
  8646. /**
  8647. * The base implementation of `_.propertyOf` without support for deep paths.
  8648. *
  8649. * @private
  8650. * @param {Object} object The object to query.
  8651. * @returns {Function} Returns the new accessor function.
  8652. */
  8653. function basePropertyOf(object) {
  8654. return function(key) {
  8655. return object == null ? undefined : object[key];
  8656. };
  8657. }
  8658. /**
  8659. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  8660. * letters to basic Latin letters.
  8661. *
  8662. * @private
  8663. * @param {string} letter The matched letter to deburr.
  8664. * @returns {string} Returns the deburred letter.
  8665. */
  8666. var deburrLetter = basePropertyOf(deburredLetters);
  8667. /**
  8668. * Checks if `string` contains Unicode symbols.
  8669. *
  8670. * @private
  8671. * @param {string} string The string to inspect.
  8672. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  8673. */
  8674. function hasUnicode(string) {
  8675. return reHasUnicode.test(string);
  8676. }
  8677. /**
  8678. * Checks if `string` contains a word composed of Unicode symbols.
  8679. *
  8680. * @private
  8681. * @param {string} string The string to inspect.
  8682. * @returns {boolean} Returns `true` if a word is found, else `false`.
  8683. */
  8684. function hasUnicodeWord(string) {
  8685. return reHasUnicodeWord.test(string);
  8686. }
  8687. /**
  8688. * Converts `string` to an array.
  8689. *
  8690. * @private
  8691. * @param {string} string The string to convert.
  8692. * @returns {Array} Returns the converted array.
  8693. */
  8694. function stringToArray(string) {
  8695. return hasUnicode(string)
  8696. ? unicodeToArray(string)
  8697. : asciiToArray(string);
  8698. }
  8699. /**
  8700. * Converts a Unicode `string` to an array.
  8701. *
  8702. * @private
  8703. * @param {string} string The string to convert.
  8704. * @returns {Array} Returns the converted array.
  8705. */
  8706. function unicodeToArray(string) {
  8707. return string.match(reUnicode) || [];
  8708. }
  8709. /**
  8710. * Splits a Unicode `string` into an array of its words.
  8711. *
  8712. * @private
  8713. * @param {string} The string to inspect.
  8714. * @returns {Array} Returns the words of `string`.
  8715. */
  8716. function unicodeWords(string) {
  8717. return string.match(reUnicodeWord) || [];
  8718. }
  8719. /** Used for built-in method references. */
  8720. var objectProto = Object.prototype;
  8721. /**
  8722. * Used to resolve the
  8723. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  8724. * of values.
  8725. */
  8726. var objectToString = objectProto.toString;
  8727. /** Built-in value references. */
  8728. var Symbol$1 = root$1.Symbol;
  8729. /** Used to convert symbols to primitives and strings. */
  8730. var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
  8731. symbolToString = symbolProto ? symbolProto.toString : undefined;
  8732. /**
  8733. * The base implementation of `_.slice` without an iteratee call guard.
  8734. *
  8735. * @private
  8736. * @param {Array} array The array to slice.
  8737. * @param {number} [start=0] The start position.
  8738. * @param {number} [end=array.length] The end position.
  8739. * @returns {Array} Returns the slice of `array`.
  8740. */
  8741. function baseSlice(array, start, end) {
  8742. var index = -1,
  8743. length = array.length;
  8744. if (start < 0) {
  8745. start = -start > length ? 0 : (length + start);
  8746. }
  8747. end = end > length ? length : end;
  8748. if (end < 0) {
  8749. end += length;
  8750. }
  8751. length = start > end ? 0 : ((end - start) >>> 0);
  8752. start >>>= 0;
  8753. var result = Array(length);
  8754. while (++index < length) {
  8755. result[index] = array[index + start];
  8756. }
  8757. return result;
  8758. }
  8759. /**
  8760. * The base implementation of `_.toString` which doesn't convert nullish
  8761. * values to empty strings.
  8762. *
  8763. * @private
  8764. * @param {*} value The value to process.
  8765. * @returns {string} Returns the string.
  8766. */
  8767. function baseToString(value) {
  8768. // Exit early for strings to avoid a performance hit in some environments.
  8769. if (typeof value == 'string') {
  8770. return value;
  8771. }
  8772. if (isSymbol(value)) {
  8773. return symbolToString ? symbolToString.call(value) : '';
  8774. }
  8775. var result = (value + '');
  8776. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  8777. }
  8778. /**
  8779. * Casts `array` to a slice if it's needed.
  8780. *
  8781. * @private
  8782. * @param {Array} array The array to inspect.
  8783. * @param {number} start The start position.
  8784. * @param {number} [end=array.length] The end position.
  8785. * @returns {Array} Returns the cast slice.
  8786. */
  8787. function castSlice(array, start, end) {
  8788. var length = array.length;
  8789. end = end === undefined ? length : end;
  8790. return (!start && end >= length) ? array : baseSlice(array, start, end);
  8791. }
  8792. /**
  8793. * Creates a function like `_.lowerFirst`.
  8794. *
  8795. * @private
  8796. * @param {string} methodName The name of the `String` case method to use.
  8797. * @returns {Function} Returns the new case function.
  8798. */
  8799. function createCaseFirst(methodName) {
  8800. return function(string) {
  8801. string = toString$1(string);
  8802. var strSymbols = hasUnicode(string)
  8803. ? stringToArray(string)
  8804. : undefined;
  8805. var chr = strSymbols
  8806. ? strSymbols[0]
  8807. : string.charAt(0);
  8808. var trailing = strSymbols
  8809. ? castSlice(strSymbols, 1).join('')
  8810. : string.slice(1);
  8811. return chr[methodName]() + trailing;
  8812. };
  8813. }
  8814. /**
  8815. * Creates a function like `_.camelCase`.
  8816. *
  8817. * @private
  8818. * @param {Function} callback The function to combine each word.
  8819. * @returns {Function} Returns the new compounder function.
  8820. */
  8821. function createCompounder(callback) {
  8822. return function(string) {
  8823. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  8824. };
  8825. }
  8826. /**
  8827. * Checks if `value` is object-like. A value is object-like if it's not `null`
  8828. * and has a `typeof` result of "object".
  8829. *
  8830. * @static
  8831. * @memberOf _
  8832. * @since 4.0.0
  8833. * @category Lang
  8834. * @param {*} value The value to check.
  8835. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  8836. * @example
  8837. *
  8838. * _.isObjectLike({});
  8839. * // => true
  8840. *
  8841. * _.isObjectLike([1, 2, 3]);
  8842. * // => true
  8843. *
  8844. * _.isObjectLike(_.noop);
  8845. * // => false
  8846. *
  8847. * _.isObjectLike(null);
  8848. * // => false
  8849. */
  8850. function isObjectLike(value) {
  8851. return !!value && typeof value == 'object';
  8852. }
  8853. /**
  8854. * Checks if `value` is classified as a `Symbol` primitive or object.
  8855. *
  8856. * @static
  8857. * @memberOf _
  8858. * @since 4.0.0
  8859. * @category Lang
  8860. * @param {*} value The value to check.
  8861. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  8862. * @example
  8863. *
  8864. * _.isSymbol(Symbol.iterator);
  8865. * // => true
  8866. *
  8867. * _.isSymbol('abc');
  8868. * // => false
  8869. */
  8870. function isSymbol(value) {
  8871. return typeof value == 'symbol' ||
  8872. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  8873. }
  8874. /**
  8875. * Converts `value` to a string. An empty string is returned for `null`
  8876. * and `undefined` values. The sign of `-0` is preserved.
  8877. *
  8878. * @static
  8879. * @memberOf _
  8880. * @since 4.0.0
  8881. * @category Lang
  8882. * @param {*} value The value to process.
  8883. * @returns {string} Returns the string.
  8884. * @example
  8885. *
  8886. * _.toString(null);
  8887. * // => ''
  8888. *
  8889. * _.toString(-0);
  8890. * // => '-0'
  8891. *
  8892. * _.toString([1, 2, 3]);
  8893. * // => '1,2,3'
  8894. */
  8895. function toString$1(value) {
  8896. return value == null ? '' : baseToString(value);
  8897. }
  8898. /**
  8899. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  8900. *
  8901. * @static
  8902. * @memberOf _
  8903. * @since 3.0.0
  8904. * @category String
  8905. * @param {string} [string=''] The string to convert.
  8906. * @returns {string} Returns the camel cased string.
  8907. * @example
  8908. *
  8909. * _.camelCase('Foo Bar');
  8910. * // => 'fooBar'
  8911. *
  8912. * _.camelCase('--foo-bar--');
  8913. * // => 'fooBar'
  8914. *
  8915. * _.camelCase('__FOO_BAR__');
  8916. * // => 'fooBar'
  8917. */
  8918. var camelCase = createCompounder(function(result, word, index) {
  8919. word = word.toLowerCase();
  8920. return result + (index ? capitalize(word) : word);
  8921. });
  8922. /**
  8923. * Converts the first character of `string` to upper case and the remaining
  8924. * to lower case.
  8925. *
  8926. * @static
  8927. * @memberOf _
  8928. * @since 3.0.0
  8929. * @category String
  8930. * @param {string} [string=''] The string to capitalize.
  8931. * @returns {string} Returns the capitalized string.
  8932. * @example
  8933. *
  8934. * _.capitalize('FRED');
  8935. * // => 'Fred'
  8936. */
  8937. function capitalize(string) {
  8938. return upperFirst(toString$1(string).toLowerCase());
  8939. }
  8940. /**
  8941. * Deburrs `string` by converting
  8942. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  8943. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  8944. * letters to basic Latin letters and removing
  8945. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  8946. *
  8947. * @static
  8948. * @memberOf _
  8949. * @since 3.0.0
  8950. * @category String
  8951. * @param {string} [string=''] The string to deburr.
  8952. * @returns {string} Returns the deburred string.
  8953. * @example
  8954. *
  8955. * _.deburr('déjà vu');
  8956. * // => 'deja vu'
  8957. */
  8958. function deburr(string) {
  8959. string = toString$1(string);
  8960. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  8961. }
  8962. /**
  8963. * Converts the first character of `string` to upper case.
  8964. *
  8965. * @static
  8966. * @memberOf _
  8967. * @since 4.0.0
  8968. * @category String
  8969. * @param {string} [string=''] The string to convert.
  8970. * @returns {string} Returns the converted string.
  8971. * @example
  8972. *
  8973. * _.upperFirst('fred');
  8974. * // => 'Fred'
  8975. *
  8976. * _.upperFirst('FRED');
  8977. * // => 'FRED'
  8978. */
  8979. var upperFirst = createCaseFirst('toUpperCase');
  8980. /**
  8981. * Splits `string` into an array of its words.
  8982. *
  8983. * @static
  8984. * @memberOf _
  8985. * @since 3.0.0
  8986. * @category String
  8987. * @param {string} [string=''] The string to inspect.
  8988. * @param {RegExp|string} [pattern] The pattern to match words.
  8989. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8990. * @returns {Array} Returns the words of `string`.
  8991. * @example
  8992. *
  8993. * _.words('fred, barney, & pebbles');
  8994. * // => ['fred', 'barney', 'pebbles']
  8995. *
  8996. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  8997. * // => ['fred', 'barney', '&', 'pebbles']
  8998. */
  8999. function words(string, pattern, guard) {
  9000. string = toString$1(string);
  9001. pattern = guard ? undefined : pattern;
  9002. if (pattern === undefined) {
  9003. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  9004. }
  9005. return string.match(pattern) || [];
  9006. }
  9007. var lodash_camelcase = camelCase;
  9008. var unicode = createCommonjsModule(function (module, exports) {
  9009. Object.defineProperty(exports,"__esModule",{value:true});exports.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/;exports.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/;exports.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
  9010. });
  9011. var isSpaceSeparator_1=isSpaceSeparator;var isIdStartChar_1=isIdStartChar;var isIdContinueChar_1=isIdContinueChar;var isDigit_1=isDigit;var isHexDigit_1=isHexDigit;var unicode$1=_interopRequireWildcard(unicode);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else {var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj}}function isSpaceSeparator(c){return unicode$1.Space_Separator.test(c)}function isIdStartChar(c){return c>='a'&&c<='z'||c>='A'&&c<='Z'||c==='$'||c==='_'||unicode$1.ID_Start.test(c)}function isIdContinueChar(c){return c>='a'&&c<='z'||c>='A'&&c<='Z'||c>='0'&&c<='9'||c==='$'||c==='_'||c==='\u200C'||c==='\u200D'||unicode$1.ID_Continue.test(c)}function isDigit(c){return /[0-9]/.test(c)}function isHexDigit(c){return /[0-9A-Fa-f]/.test(c)}
  9012. var util$1 = /*#__PURE__*/Object.defineProperty({
  9013. isSpaceSeparator: isSpaceSeparator_1,
  9014. isIdStartChar: isIdStartChar_1,
  9015. isIdContinueChar: isIdContinueChar_1,
  9016. isDigit: isDigit_1,
  9017. isHexDigit: isHexDigit_1
  9018. }, '__esModule', {value: true});
  9019. var parse_1 = createCommonjsModule(function (module, exports) {
  9020. Object.defineProperty(exports,'__esModule',{value:true});var _typeof=typeof Symbol==='function'&&typeof Symbol.iterator==='symbol'?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==='function'&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj};exports.default=parse;var util=_interopRequireWildcard(util$1);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else {var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj}}var source=void 0;var parseState=void 0;var stack=void 0;var pos=void 0;var line=void 0;var column=void 0;var token=void 0;var key=void 0;var root=void 0;function parse(text,reviver){source=String(text);parseState='start';stack=[];pos=0;line=1;column=0;token=undefined;key=undefined;root=undefined;do{token=lex();parseStates[parseState]();}while(token.type!=='eof');if(typeof reviver==='function'){return internalize({'':root},'',reviver)}return root}function internalize(holder,name,reviver){var value=holder[name];if(value!=null&&(typeof value==='undefined'?'undefined':_typeof(value))==='object'){for(var _key in value){var replacement=internalize(value,_key,reviver);if(replacement===undefined){delete value[_key];}else {value[_key]=replacement;}}}return reviver.call(holder,name,value)}var lexState=void 0;var buffer=void 0;var doubleQuote=void 0;var _sign=void 0;var c=void 0;function lex(){lexState='default';buffer='';doubleQuote=false;_sign=1;for(;;){c=peek();var _token=lexStates[lexState]();if(_token){return _token}}}function peek(){if(source[pos]){return String.fromCodePoint(source.codePointAt(pos))}}function read(){var c=peek();if(c==='\n'){line++;column=0;}else if(c){column+=c.length;}else {column++;}if(c){pos+=c.length;}return c}var lexStates={default:function _default(){switch(c){case'\t':case'\x0B':case'\f':case' ':case'\xA0':case'\uFEFF':case'\n':case'\r':case'\u2028':case'\u2029':read();return;case'/':read();lexState='comment';return;case undefined:read();return newToken('eof');}if(util.isSpaceSeparator(c)){read();return}return lexStates[parseState]()},comment:function comment(){switch(c){case'*':read();lexState='multiLineComment';return;case'/':read();lexState='singleLineComment';return;}throw invalidChar(read())},multiLineComment:function multiLineComment(){switch(c){case'*':read();lexState='multiLineCommentAsterisk';return;case undefined:throw invalidChar(read());}read();},multiLineCommentAsterisk:function multiLineCommentAsterisk(){switch(c){case'*':read();return;case'/':read();lexState='default';return;case undefined:throw invalidChar(read());}read();lexState='multiLineComment';},singleLineComment:function singleLineComment(){switch(c){case'\n':case'\r':case'\u2028':case'\u2029':read();lexState='default';return;case undefined:read();return newToken('eof');}read();},value:function value(){switch(c){case'{':case'[':return newToken('punctuator',read());case'n':read();literal('ull');return newToken('null',null);case't':read();literal('rue');return newToken('boolean',true);case'f':read();literal('alse');return newToken('boolean',false);case'-':case'+':if(read()==='-'){_sign=-1;}lexState='sign';return;case'.':buffer=read();lexState='decimalPointLeading';return;case'0':buffer=read();lexState='zero';return;case'1':case'2':case'3':case'4':case'5':case'6':case'7':case'8':case'9':buffer=read();lexState='decimalInteger';return;case'I':read();literal('nfinity');return newToken('numeric',Infinity);case'N':read();literal('aN');return newToken('numeric',NaN);case'"':case'\'':doubleQuote=read()==='"';buffer='';lexState='string';return;}throw invalidChar(read())},identifierNameStartEscape:function identifierNameStartEscape(){if(c!=='u'){throw invalidChar(read())}read();var u=unicodeEscape();switch(u){case'$':case'_':break;default:if(!util.isIdStartChar(u)){throw invalidIdentifier()}break;}buffer+=u;lexState='identifierName';},identifierName:function identifierName(){switch(c){case'$':case'_':case'\u200C':case'\u200D':buffer+=read();return;case'\\':read();lexState='identifierNameEscape';return;}if(util.isIdContinueChar(c)){buffer+=read();return}return newToken('identifier',buffer)},identifierNameEscape:function identifierNameEscape(){if(c!=='u'){throw invalidChar(read())}read();var u=unicodeEscape();switch(u){case'$':case'_':case'\u200C':case'\u200D':break;default:if(!util.isIdContinueChar(u)){throw invalidIdentifier()}break;}buffer+=u;lexState='identifierName';},sign:function sign(){switch(c){case'.':buffer=read();lexState='decimalPointLeading';return;case'0':buffer=read();lexState='zero';return;case'1':case'2':case'3':case'4':case'5':case'6':case'7':case'8':case'9':buffer=read();lexState='decimalInteger';return;case'I':read();literal('nfinity');return newToken('numeric',_sign*Infinity);case'N':read();literal('aN');return newToken('numeric',NaN);}throw invalidChar(read())},zero:function zero(){switch(c){case'.':buffer+=read();lexState='decimalPoint';return;case'e':case'E':buffer+=read();lexState='decimalExponent';return;case'x':case'X':buffer+=read();lexState='hexadecimal';return;}return newToken('numeric',_sign*0)},decimalInteger:function decimalInteger(){switch(c){case'.':buffer+=read();lexState='decimalPoint';return;case'e':case'E':buffer+=read();lexState='decimalExponent';return;}if(util.isDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},decimalPointLeading:function decimalPointLeading(){if(util.isDigit(c)){buffer+=read();lexState='decimalFraction';return}throw invalidChar(read())},decimalPoint:function decimalPoint(){switch(c){case'e':case'E':buffer+=read();lexState='decimalExponent';return;}if(util.isDigit(c)){buffer+=read();lexState='decimalFraction';return}return newToken('numeric',_sign*Number(buffer))},decimalFraction:function decimalFraction(){switch(c){case'e':case'E':buffer+=read();lexState='decimalExponent';return;}if(util.isDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},decimalExponent:function decimalExponent(){switch(c){case'+':case'-':buffer+=read();lexState='decimalExponentSign';return;}if(util.isDigit(c)){buffer+=read();lexState='decimalExponentInteger';return}throw invalidChar(read())},decimalExponentSign:function decimalExponentSign(){if(util.isDigit(c)){buffer+=read();lexState='decimalExponentInteger';return}throw invalidChar(read())},decimalExponentInteger:function decimalExponentInteger(){if(util.isDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},hexadecimal:function hexadecimal(){if(util.isHexDigit(c)){buffer+=read();lexState='hexadecimalInteger';return}throw invalidChar(read())},hexadecimalInteger:function hexadecimalInteger(){if(util.isHexDigit(c)){buffer+=read();return}return newToken('numeric',_sign*Number(buffer))},string:function string(){switch(c){case'\\':read();buffer+=escape();return;case'"':if(doubleQuote){read();return newToken('string',buffer)}buffer+=read();return;case'\'':if(!doubleQuote){read();return newToken('string',buffer)}buffer+=read();return;case'\n':case'\r':throw invalidChar(read());case'\u2028':case'\u2029':separatorChar(c);break;case undefined:throw invalidChar(read());}buffer+=read();},start:function start(){switch(c){case'{':case'[':return newToken('punctuator',read());}lexState='value';},beforePropertyName:function beforePropertyName(){switch(c){case'$':case'_':buffer=read();lexState='identifierName';return;case'\\':read();lexState='identifierNameStartEscape';return;case'}':return newToken('punctuator',read());case'"':case'\'':doubleQuote=read()==='"';lexState='string';return;}if(util.isIdStartChar(c)){buffer+=read();lexState='identifierName';return}throw invalidChar(read())},afterPropertyName:function afterPropertyName(){if(c===':'){return newToken('punctuator',read())}throw invalidChar(read())},beforePropertyValue:function beforePropertyValue(){lexState='value';},afterPropertyValue:function afterPropertyValue(){switch(c){case',':case'}':return newToken('punctuator',read());}throw invalidChar(read())},beforeArrayValue:function beforeArrayValue(){if(c===']'){return newToken('punctuator',read())}lexState='value';},afterArrayValue:function afterArrayValue(){switch(c){case',':case']':return newToken('punctuator',read());}throw invalidChar(read())},end:function end(){throw invalidChar(read())}};function newToken(type,value){return {type:type,value:value,line:line,column:column}}function literal(s){var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=s[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var _c=_step.value;var p=peek();if(p!==_c){throw invalidChar(read())}read();}}catch(err){_didIteratorError=true;_iteratorError=err;}finally{try{if(!_iteratorNormalCompletion&&_iterator.return){_iterator.return();}}finally{if(_didIteratorError){throw _iteratorError}}}}function escape(){var c=peek();switch(c){case'b':read();return '\b';case'f':read();return '\f';case'n':read();return '\n';case'r':read();return '\r';case't':read();return '\t';case'v':read();return '\x0B';case'0':read();if(util.isDigit(peek())){throw invalidChar(read())}return '\0';case'x':read();return hexEscape();case'u':read();return unicodeEscape();case'\n':case'\u2028':case'\u2029':read();return '';case'\r':read();if(peek()==='\n'){read();}return '';case'1':case'2':case'3':case'4':case'5':case'6':case'7':case'8':case'9':throw invalidChar(read());case undefined:throw invalidChar(read());}return read()}function hexEscape(){var buffer='';var c=peek();if(!util.isHexDigit(c)){throw invalidChar(read())}buffer+=read();c=peek();if(!util.isHexDigit(c)){throw invalidChar(read())}buffer+=read();return String.fromCodePoint(parseInt(buffer,16))}function unicodeEscape(){var buffer='';var count=4;while(count-->0){var _c2=peek();if(!util.isHexDigit(_c2)){throw invalidChar(read())}buffer+=read();}return String.fromCodePoint(parseInt(buffer,16))}var parseStates={start:function start(){if(token.type==='eof'){throw invalidEOF()}push();},beforePropertyName:function beforePropertyName(){switch(token.type){case'identifier':case'string':key=token.value;parseState='afterPropertyName';return;case'punctuator':pop();return;case'eof':throw invalidEOF();}},afterPropertyName:function afterPropertyName(){if(token.type==='eof'){throw invalidEOF()}parseState='beforePropertyValue';},beforePropertyValue:function beforePropertyValue(){if(token.type==='eof'){throw invalidEOF()}push();},beforeArrayValue:function beforeArrayValue(){if(token.type==='eof'){throw invalidEOF()}if(token.type==='punctuator'&&token.value===']'){pop();return}push();},afterPropertyValue:function afterPropertyValue(){if(token.type==='eof'){throw invalidEOF()}switch(token.value){case',':parseState='beforePropertyName';return;case'}':pop();}},afterArrayValue:function afterArrayValue(){if(token.type==='eof'){throw invalidEOF()}switch(token.value){case',':parseState='beforeArrayValue';return;case']':pop();}},end:function end(){}};function push(){var value=void 0;switch(token.type){case'punctuator':switch(token.value){case'{':value={};break;case'[':value=[];break;}break;case'null':case'boolean':case'numeric':case'string':value=token.value;break;}if(root===undefined){root=value;}else {var parent=stack[stack.length-1];if(Array.isArray(parent)){parent.push(value);}else {parent[key]=value;}}if(value!==null&&(typeof value==='undefined'?'undefined':_typeof(value))==='object'){stack.push(value);if(Array.isArray(value)){parseState='beforeArrayValue';}else {parseState='beforePropertyName';}}else {var current=stack[stack.length-1];if(current==null){parseState='end';}else if(Array.isArray(current)){parseState='afterArrayValue';}else {parseState='afterPropertyValue';}}}function pop(){stack.pop();var current=stack[stack.length-1];if(current==null){parseState='end';}else if(Array.isArray(current)){parseState='afterArrayValue';}else {parseState='afterPropertyValue';}}function invalidChar(c){if(c===undefined){return syntaxError('JSON5: invalid end of input at '+line+':'+column)}return syntaxError('JSON5: invalid character \''+formatChar(c)+'\' at '+line+':'+column)}function invalidEOF(){return syntaxError('JSON5: invalid end of input at '+line+':'+column)}function invalidIdentifier(){column-=5;return syntaxError('JSON5: invalid identifier character at '+line+':'+column)}function separatorChar(c){console.warn('JSON5: \''+c+'\' is not valid ECMAScript; consider escaping');}function formatChar(c){var replacements={'\'':'\\\'','"':'\\"','\\':'\\\\','\b':'\\b','\f':'\\f','\n':'\\n','\r':'\\r','\t':'\\t','\x0B':'\\v','\0':'\\0','\u2028':'\\u2028','\u2029':'\\u2029'};if(replacements[c]){return replacements[c]}if(c<' '){var hexString=c.charCodeAt(0).toString(16);return '\\x'+('00'+hexString).substring(hexString.length)}return c}function syntaxError(message){var err=new SyntaxError(message);err.lineNumber=line;err.columnNumber=column;return err}module.exports=exports['default'];
  9021. });
  9022. var stringify_1 = createCommonjsModule(function (module, exports) {
  9023. Object.defineProperty(exports,'__esModule',{value:true});var _typeof=typeof Symbol==='function'&&typeof Symbol.iterator==='symbol'?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==='function'&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj};exports.default=stringify;var util=_interopRequireWildcard(util$1);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else {var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj}}function stringify(value,replacer,space){var stack=[];var indent='';var propertyList=void 0;var replacerFunc=void 0;var gap='';var quote=void 0;if(replacer!=null&&(typeof replacer==='undefined'?'undefined':_typeof(replacer))==='object'&&!Array.isArray(replacer)){space=replacer.space;quote=replacer.quote;replacer=replacer.replacer;}if(typeof replacer==='function'){replacerFunc=replacer;}else if(Array.isArray(replacer)){propertyList=[];var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=replacer[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var v=_step.value;var item=void 0;if(typeof v==='string'){item=v;}else if(typeof v==='number'||v instanceof String||v instanceof Number){item=String(v);}if(item!==undefined&&propertyList.indexOf(item)<0){propertyList.push(item);}}}catch(err){_didIteratorError=true;_iteratorError=err;}finally{try{if(!_iteratorNormalCompletion&&_iterator.return){_iterator.return();}}finally{if(_didIteratorError){throw _iteratorError}}}}if(space instanceof Number){space=Number(space);}else if(space instanceof String){space=String(space);}if(typeof space==='number'){if(space>0){space=Math.min(10,Math.floor(space));gap=' '.substr(0,space);}}else if(typeof space==='string'){gap=space.substr(0,10);}return serializeProperty('',{'':value});function serializeProperty(key,holder){var value=holder[key];if(value!=null){if(typeof value.toJSON5==='function'){value=value.toJSON5(key);}else if(typeof value.toJSON==='function'){value=value.toJSON(key);}}if(replacerFunc){value=replacerFunc.call(holder,key,value);}if(value instanceof Number){value=Number(value);}else if(value instanceof String){value=String(value);}else if(value instanceof Boolean){value=value.valueOf();}switch(value){case null:return 'null';case true:return 'true';case false:return 'false';}if(typeof value==='string'){return quoteString(value)}if(typeof value==='number'){return String(value)}if((typeof value==='undefined'?'undefined':_typeof(value))==='object'){return Array.isArray(value)?serializeArray(value):serializeObject(value)}return undefined}function quoteString(value){var quotes={'\'':0.1,'"':0.2};var replacements={'\'':'\\\'','"':'\\"','\\':'\\\\','\b':'\\b','\f':'\\f','\n':'\\n','\r':'\\r','\t':'\\t','\x0B':'\\v','\0':'\\0','\u2028':'\\u2028','\u2029':'\\u2029'};var product='';var _iteratorNormalCompletion2=true;var _didIteratorError2=false;var _iteratorError2=undefined;try{for(var _iterator2=value[Symbol.iterator](),_step2;!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=true){var c=_step2.value;switch(c){case'\'':case'"':quotes[c]++;product+=c;continue;}if(replacements[c]){product+=replacements[c];continue}if(c<' '){var hexString=c.charCodeAt(0).toString(16);product+='\\x'+('00'+hexString).substring(hexString.length);continue}product+=c;}}catch(err){_didIteratorError2=true;_iteratorError2=err;}finally{try{if(!_iteratorNormalCompletion2&&_iterator2.return){_iterator2.return();}}finally{if(_didIteratorError2){throw _iteratorError2}}}var quoteChar=quote||Object.keys(quotes).reduce(function(a,b){return quotes[a]<quotes[b]?a:b});product=product.replace(new RegExp(quoteChar,'g'),replacements[quoteChar]);return quoteChar+product+quoteChar}function serializeObject(value){if(stack.indexOf(value)>=0){throw TypeError('Converting circular structure to JSON5')}stack.push(value);var stepback=indent;indent=indent+gap;var keys=propertyList||Object.keys(value);var partial=[];var _iteratorNormalCompletion3=true;var _didIteratorError3=false;var _iteratorError3=undefined;try{for(var _iterator3=keys[Symbol.iterator](),_step3;!(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done);_iteratorNormalCompletion3=true){var key=_step3.value;var propertyString=serializeProperty(key,value);if(propertyString!==undefined){var member=serializeKey(key)+':';if(gap!==''){member+=' ';}member+=propertyString;partial.push(member);}}}catch(err){_didIteratorError3=true;_iteratorError3=err;}finally{try{if(!_iteratorNormalCompletion3&&_iterator3.return){_iterator3.return();}}finally{if(_didIteratorError3){throw _iteratorError3}}}var final=void 0;if(partial.length===0){final='{}';}else {var properties=void 0;if(gap===''){properties=partial.join(',');final='{'+properties+'}';}else {var separator=',\n'+indent;properties=partial.join(separator);final='{\n'+indent+properties+',\n'+stepback+'}';}}stack.pop();indent=stepback;return final}function serializeKey(key){if(key.length===0){return quoteString(key)}var firstChar=String.fromCodePoint(key.codePointAt(0));if(!util.isIdStartChar(firstChar)){return quoteString(key)}for(var i=firstChar.length;i<key.length;i++){if(!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))){return quoteString(key)}}return key}function serializeArray(value){if(stack.indexOf(value)>=0){throw TypeError('Converting circular structure to JSON5')}stack.push(value);var stepback=indent;indent=indent+gap;var partial=[];for(var i=0;i<value.length;i++){var propertyString=serializeProperty(String(i),value);partial.push(propertyString!==undefined?propertyString:'null');}var final=void 0;if(partial.length===0){final='[]';}else {if(gap===''){var properties=partial.join(',');final='['+properties+']';}else {var separator=',\n'+indent;var _properties=partial.join(separator);final='[\n'+indent+_properties+',\n'+stepback+']';}}stack.pop();indent=stepback;return final}}module.exports=exports['default'];
  9024. });
  9025. var lib = createCommonjsModule(function (module, exports) {
  9026. Object.defineProperty(exports,'__esModule',{value:true});var _parse2=_interopRequireDefault(parse_1);var _stringify2=_interopRequireDefault(stringify_1);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={parse:_parse2.default,stringify:_stringify2.default};module.exports=exports['default'];
  9027. });
  9028. const specialValues = {
  9029. null: null,
  9030. true: true,
  9031. false: false,
  9032. };
  9033. function parseQuery(query) {
  9034. if (query.substr(0, 1) !== '?') {
  9035. throw new Error(
  9036. "A valid query string passed to parseQuery should begin with '?'"
  9037. );
  9038. }
  9039. query = query.substr(1);
  9040. if (!query) {
  9041. return {};
  9042. }
  9043. if (query.substr(0, 1) === '{' && query.substr(-1) === '}') {
  9044. return lib.parse(query);
  9045. }
  9046. const queryArgs = query.split(/[,&]/g);
  9047. const result = {};
  9048. queryArgs.forEach((arg) => {
  9049. const idx = arg.indexOf('=');
  9050. if (idx >= 0) {
  9051. let name = arg.substr(0, idx);
  9052. let value = decodeURIComponent(arg.substr(idx + 1));
  9053. if (specialValues.hasOwnProperty(value)) {
  9054. value = specialValues[value];
  9055. }
  9056. if (name.substr(-2) === '[]') {
  9057. name = decodeURIComponent(name.substr(0, name.length - 2));
  9058. if (!Array.isArray(result[name])) {
  9059. result[name] = [];
  9060. }
  9061. result[name].push(value);
  9062. } else {
  9063. name = decodeURIComponent(name);
  9064. result[name] = value;
  9065. }
  9066. } else {
  9067. if (arg.substr(0, 1) === '-') {
  9068. result[decodeURIComponent(arg.substr(1))] = false;
  9069. } else if (arg.substr(0, 1) === '+') {
  9070. result[decodeURIComponent(arg.substr(1))] = true;
  9071. } else {
  9072. result[decodeURIComponent(arg)] = true;
  9073. }
  9074. }
  9075. });
  9076. return result;
  9077. }
  9078. var parseQuery_1 = parseQuery;
  9079. function getOptions(loaderContext) {
  9080. const query = loaderContext.query;
  9081. if (typeof query === 'string' && query !== '') {
  9082. return parseQuery_1(loaderContext.query);
  9083. }
  9084. if (!query || typeof query !== 'object') {
  9085. // Not object-like queries are not supported.
  9086. return null;
  9087. }
  9088. return query;
  9089. }
  9090. var getOptions_1 = getOptions;
  9091. const matchRelativePath = /^\.\.?[/\\]/;
  9092. function isAbsolutePath(str) {
  9093. return path__default.posix.isAbsolute(str) || path__default.win32.isAbsolute(str);
  9094. }
  9095. function isRelativePath(str) {
  9096. return matchRelativePath.test(str);
  9097. }
  9098. function stringifyRequest(loaderContext, request) {
  9099. const splitted = request.split('!');
  9100. const context =
  9101. loaderContext.context ||
  9102. (loaderContext.options && loaderContext.options.context);
  9103. return JSON.stringify(
  9104. splitted
  9105. .map((part) => {
  9106. // First, separate singlePath from query, because the query might contain paths again
  9107. const splittedPart = part.match(/^(.*?)(\?.*)/);
  9108. const query = splittedPart ? splittedPart[2] : '';
  9109. let singlePath = splittedPart ? splittedPart[1] : part;
  9110. if (isAbsolutePath(singlePath) && context) {
  9111. singlePath = path__default.relative(context, singlePath);
  9112. if (isAbsolutePath(singlePath)) {
  9113. // If singlePath still matches an absolute path, singlePath was on a different drive than context.
  9114. // In this case, we leave the path platform-specific without replacing any separators.
  9115. // @see https://github.com/webpack/loader-utils/pull/14
  9116. return singlePath + query;
  9117. }
  9118. if (isRelativePath(singlePath) === false) {
  9119. // Ensure that the relative path starts at least with ./ otherwise it would be a request into the modules directory (like node_modules).
  9120. singlePath = './' + singlePath;
  9121. }
  9122. }
  9123. return singlePath.replace(/\\/g, '/') + query;
  9124. })
  9125. .join('!')
  9126. );
  9127. }
  9128. var stringifyRequest_1 = stringifyRequest;
  9129. function getRemainingRequest(loaderContext) {
  9130. if (loaderContext.remainingRequest) {
  9131. return loaderContext.remainingRequest;
  9132. }
  9133. const request = loaderContext.loaders
  9134. .slice(loaderContext.loaderIndex + 1)
  9135. .map((obj) => obj.request)
  9136. .concat([loaderContext.resource]);
  9137. return request.join('!');
  9138. }
  9139. var getRemainingRequest_1 = getRemainingRequest;
  9140. function getCurrentRequest(loaderContext) {
  9141. if (loaderContext.currentRequest) {
  9142. return loaderContext.currentRequest;
  9143. }
  9144. const request = loaderContext.loaders
  9145. .slice(loaderContext.loaderIndex)
  9146. .map((obj) => obj.request)
  9147. .concat([loaderContext.resource]);
  9148. return request.join('!');
  9149. }
  9150. var getCurrentRequest_1 = getCurrentRequest;
  9151. function isUrlRequest(url, root) {
  9152. // An URL is not an request if
  9153. // 1. It's an absolute url and it is not `windows` path like `C:\dir\file`
  9154. if (/^[a-z][a-z0-9+.-]*:/i.test(url) && !path__default.win32.isAbsolute(url)) {
  9155. return false;
  9156. }
  9157. // 2. It's a protocol-relative
  9158. if (/^\/\//.test(url)) {
  9159. return false;
  9160. }
  9161. // 3. It's some kind of url for a template
  9162. if (/^[{}[\]#*;,'§$%&(=?`´^°<>]/.test(url)) {
  9163. return false;
  9164. }
  9165. // 4. It's also not an request if root isn't set and it's a root-relative url
  9166. if ((root === undefined || root === false) && /^\//.test(url)) {
  9167. return false;
  9168. }
  9169. return true;
  9170. }
  9171. var isUrlRequest_1 = isUrlRequest;
  9172. // we can't use path.win32.isAbsolute because it also matches paths starting with a forward slash
  9173. const matchNativeWin32Path = /^[A-Z]:[/\\]|^\\\\/i;
  9174. function urlToRequest(url, root) {
  9175. // Do not rewrite an empty url
  9176. if (url === '') {
  9177. return '';
  9178. }
  9179. const moduleRequestRegex = /^[^?]*~/;
  9180. let request;
  9181. if (matchNativeWin32Path.test(url)) {
  9182. // absolute windows path, keep it
  9183. request = url;
  9184. } else if (root !== undefined && root !== false && /^\//.test(url)) {
  9185. // if root is set and the url is root-relative
  9186. switch (typeof root) {
  9187. // 1. root is a string: root is prefixed to the url
  9188. case 'string':
  9189. // special case: `~` roots convert to module request
  9190. if (moduleRequestRegex.test(root)) {
  9191. request = root.replace(/([^~/])$/, '$1/') + url.slice(1);
  9192. } else {
  9193. request = root + url;
  9194. }
  9195. break;
  9196. // 2. root is `true`: absolute paths are allowed
  9197. // *nix only, windows-style absolute paths are always allowed as they doesn't start with a `/`
  9198. case 'boolean':
  9199. request = url;
  9200. break;
  9201. default:
  9202. throw new Error(
  9203. "Unexpected parameters to loader-utils 'urlToRequest': url = " +
  9204. url +
  9205. ', root = ' +
  9206. root +
  9207. '.'
  9208. );
  9209. }
  9210. } else if (/^\.\.?\//.test(url)) {
  9211. // A relative url stays
  9212. request = url;
  9213. } else {
  9214. // every other url is threaded like a relative url
  9215. request = './' + url;
  9216. }
  9217. // A `~` makes the url an module
  9218. if (moduleRequestRegex.test(request)) {
  9219. request = request.replace(moduleRequestRegex, '');
  9220. }
  9221. return request;
  9222. }
  9223. var urlToRequest_1 = urlToRequest;
  9224. function parseString(str) {
  9225. try {
  9226. if (str[0] === '"') {
  9227. return JSON.parse(str);
  9228. }
  9229. if (str[0] === "'" && str.substr(str.length - 1) === "'") {
  9230. return parseString(
  9231. str
  9232. .replace(/\\.|"/g, (x) => (x === '"' ? '\\"' : x))
  9233. .replace(/^'|'$/g, '"')
  9234. );
  9235. }
  9236. return JSON.parse('"' + str + '"');
  9237. } catch (e) {
  9238. return str;
  9239. }
  9240. }
  9241. var parseString_1 = parseString;
  9242. /*
  9243. * big.js v5.2.2
  9244. * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
  9245. * Copyright (c) 2018 Michael Mclaughlin <M8ch88l@gmail.com>
  9246. * https://github.com/MikeMcl/big.js/LICENCE
  9247. */
  9248. /************************************** EDITABLE DEFAULTS *****************************************/
  9249. // The default values below must be integers within the stated ranges.
  9250. /*
  9251. * The maximum number of decimal places (DP) of the results of operations involving division:
  9252. * div and sqrt, and pow with negative exponents.
  9253. */
  9254. var DP = 20, // 0 to MAX_DP
  9255. /*
  9256. * The rounding mode (RM) used when rounding to the above decimal places.
  9257. *
  9258. * 0 Towards zero (i.e. truncate, no rounding). (ROUND_DOWN)
  9259. * 1 To nearest neighbour. If equidistant, round up. (ROUND_HALF_UP)
  9260. * 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN)
  9261. * 3 Away from zero. (ROUND_UP)
  9262. */
  9263. RM = 1, // 0, 1, 2 or 3
  9264. // The maximum value of DP and Big.DP.
  9265. MAX_DP = 1E6, // 0 to 1000000
  9266. // The maximum magnitude of the exponent argument to the pow method.
  9267. MAX_POWER = 1E6, // 1 to 1000000
  9268. /*
  9269. * The negative exponent (NE) at and beneath which toString returns exponential notation.
  9270. * (JavaScript numbers: -7)
  9271. * -1000000 is the minimum recommended exponent value of a Big.
  9272. */
  9273. NE = -7, // 0 to -1000000
  9274. /*
  9275. * The positive exponent (PE) at and above which toString returns exponential notation.
  9276. * (JavaScript numbers: 21)
  9277. * 1000000 is the maximum recommended exponent value of a Big.
  9278. * (This limit is not enforced or checked.)
  9279. */
  9280. PE = 21, // 0 to 1000000
  9281. /**************************************************************************************************/
  9282. // Error messages.
  9283. NAME = '[big.js] ',
  9284. INVALID = NAME + 'Invalid ',
  9285. INVALID_DP = INVALID + 'decimal places',
  9286. INVALID_RM = INVALID + 'rounding mode',
  9287. DIV_BY_ZERO = NAME + 'Division by zero',
  9288. // The shared prototype object.
  9289. P = {},
  9290. UNDEFINED = void 0,
  9291. NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
  9292. /*
  9293. * Create and return a Big constructor.
  9294. *
  9295. */
  9296. function _Big_() {
  9297. /*
  9298. * The Big constructor and exported function.
  9299. * Create and return a new instance of a Big number object.
  9300. *
  9301. * n {number|string|Big} A numeric value.
  9302. */
  9303. function Big(n) {
  9304. var x = this;
  9305. // Enable constructor usage without new.
  9306. if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n);
  9307. // Duplicate.
  9308. if (n instanceof Big) {
  9309. x.s = n.s;
  9310. x.e = n.e;
  9311. x.c = n.c.slice();
  9312. } else {
  9313. parse$1(x, n);
  9314. }
  9315. /*
  9316. * Retain a reference to this Big constructor, and shadow Big.prototype.constructor which
  9317. * points to Object.
  9318. */
  9319. x.constructor = Big;
  9320. }
  9321. Big.prototype = P;
  9322. Big.DP = DP;
  9323. Big.RM = RM;
  9324. Big.NE = NE;
  9325. Big.PE = PE;
  9326. Big.version = '5.2.2';
  9327. return Big;
  9328. }
  9329. /*
  9330. * Parse the number or string value passed to a Big constructor.
  9331. *
  9332. * x {Big} A Big number instance.
  9333. * n {number|string} A numeric value.
  9334. */
  9335. function parse$1(x, n) {
  9336. var e, i, nl;
  9337. // Minus zero?
  9338. if (n === 0 && 1 / n < 0) n = '-0';
  9339. else if (!NUMERIC.test(n += '')) throw Error(INVALID + 'number');
  9340. // Determine sign.
  9341. x.s = n.charAt(0) == '-' ? (n = n.slice(1), -1) : 1;
  9342. // Decimal point?
  9343. if ((e = n.indexOf('.')) > -1) n = n.replace('.', '');
  9344. // Exponential form?
  9345. if ((i = n.search(/e/i)) > 0) {
  9346. // Determine exponent.
  9347. if (e < 0) e = i;
  9348. e += +n.slice(i + 1);
  9349. n = n.substring(0, i);
  9350. } else if (e < 0) {
  9351. // Integer.
  9352. e = n.length;
  9353. }
  9354. nl = n.length;
  9355. // Determine leading zeros.
  9356. for (i = 0; i < nl && n.charAt(i) == '0';) ++i;
  9357. if (i == nl) {
  9358. // Zero.
  9359. x.c = [x.e = 0];
  9360. } else {
  9361. // Determine trailing zeros.
  9362. for (; nl > 0 && n.charAt(--nl) == '0';);
  9363. x.e = e - i - 1;
  9364. x.c = [];
  9365. // Convert string to array of digits without leading/trailing zeros.
  9366. for (e = 0; i <= nl;) x.c[e++] = +n.charAt(i++);
  9367. }
  9368. return x;
  9369. }
  9370. /*
  9371. * Round Big x to a maximum of dp decimal places using rounding mode rm.
  9372. * Called by stringify, P.div, P.round and P.sqrt.
  9373. *
  9374. * x {Big} The Big to round.
  9375. * dp {number} Integer, 0 to MAX_DP inclusive.
  9376. * rm {number} 0, 1, 2 or 3 (DOWN, HALF_UP, HALF_EVEN, UP)
  9377. * [more] {boolean} Whether the result of division was truncated.
  9378. */
  9379. function round(x, dp, rm, more) {
  9380. var xc = x.c,
  9381. i = x.e + dp + 1;
  9382. if (i < xc.length) {
  9383. if (rm === 1) {
  9384. // xc[i] is the digit after the digit that may be rounded up.
  9385. more = xc[i] >= 5;
  9386. } else if (rm === 2) {
  9387. more = xc[i] > 5 || xc[i] == 5 &&
  9388. (more || i < 0 || xc[i + 1] !== UNDEFINED || xc[i - 1] & 1);
  9389. } else if (rm === 3) {
  9390. more = more || !!xc[0];
  9391. } else {
  9392. more = false;
  9393. if (rm !== 0) throw Error(INVALID_RM);
  9394. }
  9395. if (i < 1) {
  9396. xc.length = 1;
  9397. if (more) {
  9398. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  9399. x.e = -dp;
  9400. xc[0] = 1;
  9401. } else {
  9402. // Zero.
  9403. xc[0] = x.e = 0;
  9404. }
  9405. } else {
  9406. // Remove any digits after the required decimal places.
  9407. xc.length = i--;
  9408. // Round up?
  9409. if (more) {
  9410. // Rounding up may mean the previous digit has to be rounded up.
  9411. for (; ++xc[i] > 9;) {
  9412. xc[i] = 0;
  9413. if (!i--) {
  9414. ++x.e;
  9415. xc.unshift(1);
  9416. }
  9417. }
  9418. }
  9419. // Remove trailing zeros.
  9420. for (i = xc.length; !xc[--i];) xc.pop();
  9421. }
  9422. } else if (rm < 0 || rm > 3 || rm !== ~~rm) {
  9423. throw Error(INVALID_RM);
  9424. }
  9425. return x;
  9426. }
  9427. /*
  9428. * Return a string representing the value of Big x in normal or exponential notation.
  9429. * Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
  9430. *
  9431. * x {Big}
  9432. * id? {number} Caller id.
  9433. * 1 toExponential
  9434. * 2 toFixed
  9435. * 3 toPrecision
  9436. * 4 valueOf
  9437. * n? {number|undefined} Caller's argument.
  9438. * k? {number|undefined}
  9439. */
  9440. function stringify(x, id, n, k) {
  9441. var e, s,
  9442. Big = x.constructor,
  9443. z = !x.c[0];
  9444. if (n !== UNDEFINED) {
  9445. if (n !== ~~n || n < (id == 3) || n > MAX_DP) {
  9446. throw Error(id == 3 ? INVALID + 'precision' : INVALID_DP);
  9447. }
  9448. x = new Big(x);
  9449. // The index of the digit that may be rounded up.
  9450. n = k - x.e;
  9451. // Round?
  9452. if (x.c.length > ++k) round(x, n, Big.RM);
  9453. // toFixed: recalculate k as x.e may have changed if value rounded up.
  9454. if (id == 2) k = x.e + n + 1;
  9455. // Append zeros?
  9456. for (; x.c.length < k;) x.c.push(0);
  9457. }
  9458. e = x.e;
  9459. s = x.c.join('');
  9460. n = s.length;
  9461. // Exponential notation?
  9462. if (id != 2 && (id == 1 || id == 3 && k <= e || e <= Big.NE || e >= Big.PE)) {
  9463. s = s.charAt(0) + (n > 1 ? '.' + s.slice(1) : '') + (e < 0 ? 'e' : 'e+') + e;
  9464. // Normal notation.
  9465. } else if (e < 0) {
  9466. for (; ++e;) s = '0' + s;
  9467. s = '0.' + s;
  9468. } else if (e > 0) {
  9469. if (++e > n) for (e -= n; e--;) s += '0';
  9470. else if (e < n) s = s.slice(0, e) + '.' + s.slice(e);
  9471. } else if (n > 1) {
  9472. s = s.charAt(0) + '.' + s.slice(1);
  9473. }
  9474. return x.s < 0 && (!z || id == 4) ? '-' + s : s;
  9475. }
  9476. // Prototype/instance methods
  9477. /*
  9478. * Return a new Big whose value is the absolute value of this Big.
  9479. */
  9480. P.abs = function () {
  9481. var x = new this.constructor(this);
  9482. x.s = 1;
  9483. return x;
  9484. };
  9485. /*
  9486. * Return 1 if the value of this Big is greater than the value of Big y,
  9487. * -1 if the value of this Big is less than the value of Big y, or
  9488. * 0 if they have the same value.
  9489. */
  9490. P.cmp = function (y) {
  9491. var isneg,
  9492. x = this,
  9493. xc = x.c,
  9494. yc = (y = new x.constructor(y)).c,
  9495. i = x.s,
  9496. j = y.s,
  9497. k = x.e,
  9498. l = y.e;
  9499. // Either zero?
  9500. if (!xc[0] || !yc[0]) return !xc[0] ? !yc[0] ? 0 : -j : i;
  9501. // Signs differ?
  9502. if (i != j) return i;
  9503. isneg = i < 0;
  9504. // Compare exponents.
  9505. if (k != l) return k > l ^ isneg ? 1 : -1;
  9506. j = (k = xc.length) < (l = yc.length) ? k : l;
  9507. // Compare digit by digit.
  9508. for (i = -1; ++i < j;) {
  9509. if (xc[i] != yc[i]) return xc[i] > yc[i] ^ isneg ? 1 : -1;
  9510. }
  9511. // Compare lengths.
  9512. return k == l ? 0 : k > l ^ isneg ? 1 : -1;
  9513. };
  9514. /*
  9515. * Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,
  9516. * if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
  9517. */
  9518. P.div = function (y) {
  9519. var x = this,
  9520. Big = x.constructor,
  9521. a = x.c, // dividend
  9522. b = (y = new Big(y)).c, // divisor
  9523. k = x.s == y.s ? 1 : -1,
  9524. dp = Big.DP;
  9525. if (dp !== ~~dp || dp < 0 || dp > MAX_DP) throw Error(INVALID_DP);
  9526. // Divisor is zero?
  9527. if (!b[0]) throw Error(DIV_BY_ZERO);
  9528. // Dividend is 0? Return +-0.
  9529. if (!a[0]) return new Big(k * 0);
  9530. var bl, bt, n, cmp, ri,
  9531. bz = b.slice(),
  9532. ai = bl = b.length,
  9533. al = a.length,
  9534. r = a.slice(0, bl), // remainder
  9535. rl = r.length,
  9536. q = y, // quotient
  9537. qc = q.c = [],
  9538. qi = 0,
  9539. d = dp + (q.e = x.e - y.e) + 1; // number of digits of the result
  9540. q.s = k;
  9541. k = d < 0 ? 0 : d;
  9542. // Create version of divisor with leading zero.
  9543. bz.unshift(0);
  9544. // Add zeros to make remainder as long as divisor.
  9545. for (; rl++ < bl;) r.push(0);
  9546. do {
  9547. // n is how many times the divisor goes into current remainder.
  9548. for (n = 0; n < 10; n++) {
  9549. // Compare divisor and remainder.
  9550. if (bl != (rl = r.length)) {
  9551. cmp = bl > rl ? 1 : -1;
  9552. } else {
  9553. for (ri = -1, cmp = 0; ++ri < bl;) {
  9554. if (b[ri] != r[ri]) {
  9555. cmp = b[ri] > r[ri] ? 1 : -1;
  9556. break;
  9557. }
  9558. }
  9559. }
  9560. // If divisor < remainder, subtract divisor from remainder.
  9561. if (cmp < 0) {
  9562. // Remainder can't be more than 1 digit longer than divisor.
  9563. // Equalise lengths using divisor with extra leading zero?
  9564. for (bt = rl == bl ? b : bz; rl;) {
  9565. if (r[--rl] < bt[rl]) {
  9566. ri = rl;
  9567. for (; ri && !r[--ri];) r[ri] = 9;
  9568. --r[ri];
  9569. r[rl] += 10;
  9570. }
  9571. r[rl] -= bt[rl];
  9572. }
  9573. for (; !r[0];) r.shift();
  9574. } else {
  9575. break;
  9576. }
  9577. }
  9578. // Add the digit n to the result array.
  9579. qc[qi++] = cmp ? n : ++n;
  9580. // Update the remainder.
  9581. if (r[0] && cmp) r[rl] = a[ai] || 0;
  9582. else r = [a[ai]];
  9583. } while ((ai++ < al || r[0] !== UNDEFINED) && k--);
  9584. // Leading zero? Do not remove if result is simply zero (qi == 1).
  9585. if (!qc[0] && qi != 1) {
  9586. // There can't be more than one zero.
  9587. qc.shift();
  9588. q.e--;
  9589. }
  9590. // Round?
  9591. if (qi > d) round(q, dp, Big.RM, r[0] !== UNDEFINED);
  9592. return q;
  9593. };
  9594. /*
  9595. * Return true if the value of this Big is equal to the value of Big y, otherwise return false.
  9596. */
  9597. P.eq = function (y) {
  9598. return !this.cmp(y);
  9599. };
  9600. /*
  9601. * Return true if the value of this Big is greater than the value of Big y, otherwise return
  9602. * false.
  9603. */
  9604. P.gt = function (y) {
  9605. return this.cmp(y) > 0;
  9606. };
  9607. /*
  9608. * Return true if the value of this Big is greater than or equal to the value of Big y, otherwise
  9609. * return false.
  9610. */
  9611. P.gte = function (y) {
  9612. return this.cmp(y) > -1;
  9613. };
  9614. /*
  9615. * Return true if the value of this Big is less than the value of Big y, otherwise return false.
  9616. */
  9617. P.lt = function (y) {
  9618. return this.cmp(y) < 0;
  9619. };
  9620. /*
  9621. * Return true if the value of this Big is less than or equal to the value of Big y, otherwise
  9622. * return false.
  9623. */
  9624. P.lte = function (y) {
  9625. return this.cmp(y) < 1;
  9626. };
  9627. /*
  9628. * Return a new Big whose value is the value of this Big minus the value of Big y.
  9629. */
  9630. P.minus = P.sub = function (y) {
  9631. var i, j, t, xlty,
  9632. x = this,
  9633. Big = x.constructor,
  9634. a = x.s,
  9635. b = (y = new Big(y)).s;
  9636. // Signs differ?
  9637. if (a != b) {
  9638. y.s = -b;
  9639. return x.plus(y);
  9640. }
  9641. var xc = x.c.slice(),
  9642. xe = x.e,
  9643. yc = y.c,
  9644. ye = y.e;
  9645. // Either zero?
  9646. if (!xc[0] || !yc[0]) {
  9647. // y is non-zero? x is non-zero? Or both are zero.
  9648. return yc[0] ? (y.s = -b, y) : new Big(xc[0] ? x : 0);
  9649. }
  9650. // Determine which is the bigger number. Prepend zeros to equalise exponents.
  9651. if (a = xe - ye) {
  9652. if (xlty = a < 0) {
  9653. a = -a;
  9654. t = xc;
  9655. } else {
  9656. ye = xe;
  9657. t = yc;
  9658. }
  9659. t.reverse();
  9660. for (b = a; b--;) t.push(0);
  9661. t.reverse();
  9662. } else {
  9663. // Exponents equal. Check digit by digit.
  9664. j = ((xlty = xc.length < yc.length) ? xc : yc).length;
  9665. for (a = b = 0; b < j; b++) {
  9666. if (xc[b] != yc[b]) {
  9667. xlty = xc[b] < yc[b];
  9668. break;
  9669. }
  9670. }
  9671. }
  9672. // x < y? Point xc to the array of the bigger number.
  9673. if (xlty) {
  9674. t = xc;
  9675. xc = yc;
  9676. yc = t;
  9677. y.s = -y.s;
  9678. }
  9679. /*
  9680. * Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only
  9681. * needs to start at yc.length.
  9682. */
  9683. if ((b = (j = yc.length) - (i = xc.length)) > 0) for (; b--;) xc[i++] = 0;
  9684. // Subtract yc from xc.
  9685. for (b = i; j > a;) {
  9686. if (xc[--j] < yc[j]) {
  9687. for (i = j; i && !xc[--i];) xc[i] = 9;
  9688. --xc[i];
  9689. xc[j] += 10;
  9690. }
  9691. xc[j] -= yc[j];
  9692. }
  9693. // Remove trailing zeros.
  9694. for (; xc[--b] === 0;) xc.pop();
  9695. // Remove leading zeros and adjust exponent accordingly.
  9696. for (; xc[0] === 0;) {
  9697. xc.shift();
  9698. --ye;
  9699. }
  9700. if (!xc[0]) {
  9701. // n - n = +0
  9702. y.s = 1;
  9703. // Result must be zero.
  9704. xc = [ye = 0];
  9705. }
  9706. y.c = xc;
  9707. y.e = ye;
  9708. return y;
  9709. };
  9710. /*
  9711. * Return a new Big whose value is the value of this Big modulo the value of Big y.
  9712. */
  9713. P.mod = function (y) {
  9714. var ygtx,
  9715. x = this,
  9716. Big = x.constructor,
  9717. a = x.s,
  9718. b = (y = new Big(y)).s;
  9719. if (!y.c[0]) throw Error(DIV_BY_ZERO);
  9720. x.s = y.s = 1;
  9721. ygtx = y.cmp(x) == 1;
  9722. x.s = a;
  9723. y.s = b;
  9724. if (ygtx) return new Big(x);
  9725. a = Big.DP;
  9726. b = Big.RM;
  9727. Big.DP = Big.RM = 0;
  9728. x = x.div(y);
  9729. Big.DP = a;
  9730. Big.RM = b;
  9731. return this.minus(x.times(y));
  9732. };
  9733. /*
  9734. * Return a new Big whose value is the value of this Big plus the value of Big y.
  9735. */
  9736. P.plus = P.add = function (y) {
  9737. var t,
  9738. x = this,
  9739. Big = x.constructor,
  9740. a = x.s,
  9741. b = (y = new Big(y)).s;
  9742. // Signs differ?
  9743. if (a != b) {
  9744. y.s = -b;
  9745. return x.minus(y);
  9746. }
  9747. var xe = x.e,
  9748. xc = x.c,
  9749. ye = y.e,
  9750. yc = y.c;
  9751. // Either zero? y is non-zero? x is non-zero? Or both are zero.
  9752. if (!xc[0] || !yc[0]) return yc[0] ? y : new Big(xc[0] ? x : a * 0);
  9753. xc = xc.slice();
  9754. // Prepend zeros to equalise exponents.
  9755. // Note: reverse faster than unshifts.
  9756. if (a = xe - ye) {
  9757. if (a > 0) {
  9758. ye = xe;
  9759. t = yc;
  9760. } else {
  9761. a = -a;
  9762. t = xc;
  9763. }
  9764. t.reverse();
  9765. for (; a--;) t.push(0);
  9766. t.reverse();
  9767. }
  9768. // Point xc to the longer array.
  9769. if (xc.length - yc.length < 0) {
  9770. t = yc;
  9771. yc = xc;
  9772. xc = t;
  9773. }
  9774. a = yc.length;
  9775. // Only start adding at yc.length - 1 as the further digits of xc can be left as they are.
  9776. for (b = 0; a; xc[a] %= 10) b = (xc[--a] = xc[a] + yc[a] + b) / 10 | 0;
  9777. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  9778. if (b) {
  9779. xc.unshift(b);
  9780. ++ye;
  9781. }
  9782. // Remove trailing zeros.
  9783. for (a = xc.length; xc[--a] === 0;) xc.pop();
  9784. y.c = xc;
  9785. y.e = ye;
  9786. return y;
  9787. };
  9788. /*
  9789. * Return a Big whose value is the value of this Big raised to the power n.
  9790. * If n is negative, round to a maximum of Big.DP decimal places using rounding
  9791. * mode Big.RM.
  9792. *
  9793. * n {number} Integer, -MAX_POWER to MAX_POWER inclusive.
  9794. */
  9795. P.pow = function (n) {
  9796. var x = this,
  9797. one = new x.constructor(1),
  9798. y = one,
  9799. isneg = n < 0;
  9800. if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) throw Error(INVALID + 'exponent');
  9801. if (isneg) n = -n;
  9802. for (;;) {
  9803. if (n & 1) y = y.times(x);
  9804. n >>= 1;
  9805. if (!n) break;
  9806. x = x.times(x);
  9807. }
  9808. return isneg ? one.div(y) : y;
  9809. };
  9810. /*
  9811. * Return a new Big whose value is the value of this Big rounded using rounding mode rm
  9812. * to a maximum of dp decimal places, or, if dp is negative, to an integer which is a
  9813. * multiple of 10**-dp.
  9814. * If dp is not specified, round to 0 decimal places.
  9815. * If rm is not specified, use Big.RM.
  9816. *
  9817. * dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
  9818. * rm? 0, 1, 2 or 3 (ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP)
  9819. */
  9820. P.round = function (dp, rm) {
  9821. var Big = this.constructor;
  9822. if (dp === UNDEFINED) dp = 0;
  9823. else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) throw Error(INVALID_DP);
  9824. return round(new Big(this), dp, rm === UNDEFINED ? Big.RM : rm);
  9825. };
  9826. /*
  9827. * Return a new Big whose value is the square root of the value of this Big, rounded, if
  9828. * necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
  9829. */
  9830. P.sqrt = function () {
  9831. var r, c, t,
  9832. x = this,
  9833. Big = x.constructor,
  9834. s = x.s,
  9835. e = x.e,
  9836. half = new Big(0.5);
  9837. // Zero?
  9838. if (!x.c[0]) return new Big(x);
  9839. // Negative?
  9840. if (s < 0) throw Error(NAME + 'No square root');
  9841. // Estimate.
  9842. s = Math.sqrt(x + '');
  9843. // Math.sqrt underflow/overflow?
  9844. // Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
  9845. if (s === 0 || s === 1 / 0) {
  9846. c = x.c.join('');
  9847. if (!(c.length + e & 1)) c += '0';
  9848. s = Math.sqrt(c);
  9849. e = ((e + 1) / 2 | 0) - (e < 0 || e & 1);
  9850. r = new Big((s == 1 / 0 ? '1e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e);
  9851. } else {
  9852. r = new Big(s);
  9853. }
  9854. e = r.e + (Big.DP += 4);
  9855. // Newton-Raphson iteration.
  9856. do {
  9857. t = r;
  9858. r = half.times(t.plus(x.div(t)));
  9859. } while (t.c.slice(0, e).join('') !== r.c.slice(0, e).join(''));
  9860. return round(r, Big.DP -= 4, Big.RM);
  9861. };
  9862. /*
  9863. * Return a new Big whose value is the value of this Big times the value of Big y.
  9864. */
  9865. P.times = P.mul = function (y) {
  9866. var c,
  9867. x = this,
  9868. Big = x.constructor,
  9869. xc = x.c,
  9870. yc = (y = new Big(y)).c,
  9871. a = xc.length,
  9872. b = yc.length,
  9873. i = x.e,
  9874. j = y.e;
  9875. // Determine sign of result.
  9876. y.s = x.s == y.s ? 1 : -1;
  9877. // Return signed 0 if either 0.
  9878. if (!xc[0] || !yc[0]) return new Big(y.s * 0);
  9879. // Initialise exponent of result as x.e + y.e.
  9880. y.e = i + j;
  9881. // If array xc has fewer digits than yc, swap xc and yc, and lengths.
  9882. if (a < b) {
  9883. c = xc;
  9884. xc = yc;
  9885. yc = c;
  9886. j = a;
  9887. a = b;
  9888. b = j;
  9889. }
  9890. // Initialise coefficient array of result with zeros.
  9891. for (c = new Array(j = a + b); j--;) c[j] = 0;
  9892. // Multiply.
  9893. // i is initially xc.length.
  9894. for (i = b; i--;) {
  9895. b = 0;
  9896. // a is yc.length.
  9897. for (j = a + i; j > i;) {
  9898. // Current sum of products at this digit position, plus carry.
  9899. b = c[j] + yc[i] * xc[j - i - 1] + b;
  9900. c[j--] = b % 10;
  9901. // carry
  9902. b = b / 10 | 0;
  9903. }
  9904. c[j] = (c[j] + b) % 10;
  9905. }
  9906. // Increment result exponent if there is a final carry, otherwise remove leading zero.
  9907. if (b) ++y.e;
  9908. else c.shift();
  9909. // Remove trailing zeros.
  9910. for (i = c.length; !c[--i];) c.pop();
  9911. y.c = c;
  9912. return y;
  9913. };
  9914. /*
  9915. * Return a string representing the value of this Big in exponential notation to dp fixed decimal
  9916. * places and rounded using Big.RM.
  9917. *
  9918. * dp? {number} Integer, 0 to MAX_DP inclusive.
  9919. */
  9920. P.toExponential = function (dp) {
  9921. return stringify(this, 1, dp, dp);
  9922. };
  9923. /*
  9924. * Return a string representing the value of this Big in normal notation to dp fixed decimal
  9925. * places and rounded using Big.RM.
  9926. *
  9927. * dp? {number} Integer, 0 to MAX_DP inclusive.
  9928. *
  9929. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  9930. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  9931. */
  9932. P.toFixed = function (dp) {
  9933. return stringify(this, 2, dp, this.e + dp);
  9934. };
  9935. /*
  9936. * Return a string representing the value of this Big rounded to sd significant digits using
  9937. * Big.RM. Use exponential notation if sd is less than the number of digits necessary to represent
  9938. * the integer part of the value in normal notation.
  9939. *
  9940. * sd {number} Integer, 1 to MAX_DP inclusive.
  9941. */
  9942. P.toPrecision = function (sd) {
  9943. return stringify(this, 3, sd, sd - 1);
  9944. };
  9945. /*
  9946. * Return a string representing the value of this Big.
  9947. * Return exponential notation if this Big has a positive exponent equal to or greater than
  9948. * Big.PE, or a negative exponent equal to or less than Big.NE.
  9949. * Omit the sign for negative zero.
  9950. */
  9951. P.toString = function () {
  9952. return stringify(this);
  9953. };
  9954. /*
  9955. * Return a string representing the value of this Big.
  9956. * Return exponential notation if this Big has a positive exponent equal to or greater than
  9957. * Big.PE, or a negative exponent equal to or less than Big.NE.
  9958. * Include the sign for negative zero.
  9959. */
  9960. P.valueOf = P.toJSON = function () {
  9961. return stringify(this, 4);
  9962. };
  9963. // Export
  9964. var Big = _Big_();
  9965. var big = /*#__PURE__*/Object.freeze({
  9966. __proto__: null,
  9967. Big: Big,
  9968. 'default': Big
  9969. });
  9970. var require$$0 = /*@__PURE__*/getAugmentedNamespace(big);
  9971. const baseEncodeTables = {
  9972. 26: 'abcdefghijklmnopqrstuvwxyz',
  9973. 32: '123456789abcdefghjkmnpqrstuvwxyz', // no 0lio
  9974. 36: '0123456789abcdefghijklmnopqrstuvwxyz',
  9975. 49: 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no lIO
  9976. 52: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
  9977. 58: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no 0lIO
  9978. 62: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
  9979. 64: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_',
  9980. };
  9981. function encodeBufferToBase(buffer, base) {
  9982. const encodeTable = baseEncodeTables[base];
  9983. if (!encodeTable) {
  9984. throw new Error('Unknown encoding base' + base);
  9985. }
  9986. const readLength = buffer.length;
  9987. const Big = require$$0;
  9988. Big.RM = Big.DP = 0;
  9989. let b = new Big(0);
  9990. for (let i = readLength - 1; i >= 0; i--) {
  9991. b = b.times(256).plus(buffer[i]);
  9992. }
  9993. let output = '';
  9994. while (b.gt(0)) {
  9995. output = encodeTable[b.mod(base)] + output;
  9996. b = b.div(base);
  9997. }
  9998. Big.DP = 20;
  9999. Big.RM = 1;
  10000. return output;
  10001. }
  10002. function getHashDigest(buffer, hashType, digestType, maxLength) {
  10003. hashType = hashType || 'md5';
  10004. maxLength = maxLength || 9999;
  10005. const hash = require('crypto').createHash(hashType);
  10006. hash.update(buffer);
  10007. if (
  10008. digestType === 'base26' ||
  10009. digestType === 'base32' ||
  10010. digestType === 'base36' ||
  10011. digestType === 'base49' ||
  10012. digestType === 'base52' ||
  10013. digestType === 'base58' ||
  10014. digestType === 'base62' ||
  10015. digestType === 'base64'
  10016. ) {
  10017. return encodeBufferToBase(hash.digest(), digestType.substr(4)).substr(
  10018. 0,
  10019. maxLength
  10020. );
  10021. } else {
  10022. return hash.digest(digestType || 'hex').substr(0, maxLength);
  10023. }
  10024. }
  10025. var getHashDigest_1 = getHashDigest;
  10026. var emojisList = [
  10027. "🀄️",
  10028. "🃏",
  10029. "🅰️",
  10030. "🅱️",
  10031. "🅾️",
  10032. "🅿️",
  10033. "🆎",
  10034. "🆑",
  10035. "🆒",
  10036. "🆓",
  10037. "🆔",
  10038. "🆕",
  10039. "🆖",
  10040. "🆗",
  10041. "🆘",
  10042. "🆙",
  10043. "🆚",
  10044. "🇦🇨",
  10045. "🇦🇩",
  10046. "🇦🇪",
  10047. "🇦🇫",
  10048. "🇦🇬",
  10049. "🇦🇮",
  10050. "🇦🇱",
  10051. "🇦🇲",
  10052. "🇦🇴",
  10053. "🇦🇶",
  10054. "🇦🇷",
  10055. "🇦🇸",
  10056. "🇦🇹",
  10057. "🇦🇺",
  10058. "🇦🇼",
  10059. "🇦🇽",
  10060. "🇦🇿",
  10061. "🇦",
  10062. "🇧🇦",
  10063. "🇧🇧",
  10064. "🇧🇩",
  10065. "🇧🇪",
  10066. "🇧🇫",
  10067. "🇧🇬",
  10068. "🇧🇭",
  10069. "🇧🇮",
  10070. "🇧🇯",
  10071. "🇧🇱",
  10072. "🇧🇲",
  10073. "🇧🇳",
  10074. "🇧🇴",
  10075. "🇧🇶",
  10076. "🇧🇷",
  10077. "🇧🇸",
  10078. "🇧🇹",
  10079. "🇧🇻",
  10080. "🇧🇼",
  10081. "🇧🇾",
  10082. "🇧🇿",
  10083. "🇧",
  10084. "🇨🇦",
  10085. "🇨🇨",
  10086. "🇨🇩",
  10087. "🇨🇫",
  10088. "🇨🇬",
  10089. "🇨🇭",
  10090. "🇨🇮",
  10091. "🇨🇰",
  10092. "🇨🇱",
  10093. "🇨🇲",
  10094. "🇨🇳",
  10095. "🇨🇴",
  10096. "🇨🇵",
  10097. "🇨🇷",
  10098. "🇨🇺",
  10099. "🇨🇻",
  10100. "🇨🇼",
  10101. "🇨🇽",
  10102. "🇨🇾",
  10103. "🇨🇿",
  10104. "🇨",
  10105. "🇩🇪",
  10106. "🇩🇬",
  10107. "🇩🇯",
  10108. "🇩🇰",
  10109. "🇩🇲",
  10110. "🇩🇴",
  10111. "🇩🇿",
  10112. "🇩",
  10113. "🇪🇦",
  10114. "🇪🇨",
  10115. "🇪🇪",
  10116. "🇪🇬",
  10117. "🇪🇭",
  10118. "🇪🇷",
  10119. "🇪🇸",
  10120. "🇪🇹",
  10121. "🇪🇺",
  10122. "🇪",
  10123. "🇫🇮",
  10124. "🇫🇯",
  10125. "🇫🇰",
  10126. "🇫🇲",
  10127. "🇫🇴",
  10128. "🇫🇷",
  10129. "🇫",
  10130. "🇬🇦",
  10131. "🇬🇧",
  10132. "🇬🇩",
  10133. "🇬🇪",
  10134. "🇬🇫",
  10135. "🇬🇬",
  10136. "🇬🇭",
  10137. "🇬🇮",
  10138. "🇬🇱",
  10139. "🇬🇲",
  10140. "🇬🇳",
  10141. "🇬🇵",
  10142. "🇬🇶",
  10143. "🇬🇷",
  10144. "🇬🇸",
  10145. "🇬🇹",
  10146. "🇬🇺",
  10147. "🇬🇼",
  10148. "🇬🇾",
  10149. "🇬",
  10150. "🇭🇰",
  10151. "🇭🇲",
  10152. "🇭🇳",
  10153. "🇭🇷",
  10154. "🇭🇹",
  10155. "🇭🇺",
  10156. "🇭",
  10157. "🇮🇨",
  10158. "🇮🇩",
  10159. "🇮🇪",
  10160. "🇮🇱",
  10161. "🇮🇲",
  10162. "🇮🇳",
  10163. "🇮🇴",
  10164. "🇮🇶",
  10165. "🇮🇷",
  10166. "🇮🇸",
  10167. "🇮🇹",
  10168. "🇮",
  10169. "🇯🇪",
  10170. "🇯🇲",
  10171. "🇯🇴",
  10172. "🇯🇵",
  10173. "🇯",
  10174. "🇰🇪",
  10175. "🇰🇬",
  10176. "🇰🇭",
  10177. "🇰🇮",
  10178. "🇰🇲",
  10179. "🇰🇳",
  10180. "🇰🇵",
  10181. "🇰🇷",
  10182. "🇰🇼",
  10183. "🇰🇾",
  10184. "🇰🇿",
  10185. "🇰",
  10186. "🇱🇦",
  10187. "🇱🇧",
  10188. "🇱🇨",
  10189. "🇱🇮",
  10190. "🇱🇰",
  10191. "🇱🇷",
  10192. "🇱🇸",
  10193. "🇱🇹",
  10194. "🇱🇺",
  10195. "🇱🇻",
  10196. "🇱🇾",
  10197. "🇱",
  10198. "🇲🇦",
  10199. "🇲🇨",
  10200. "🇲🇩",
  10201. "🇲🇪",
  10202. "🇲🇫",
  10203. "🇲🇬",
  10204. "🇲🇭",
  10205. "🇲🇰",
  10206. "🇲🇱",
  10207. "🇲🇲",
  10208. "🇲🇳",
  10209. "🇲🇴",
  10210. "🇲🇵",
  10211. "🇲🇶",
  10212. "🇲🇷",
  10213. "🇲🇸",
  10214. "🇲🇹",
  10215. "🇲🇺",
  10216. "🇲🇻",
  10217. "🇲🇼",
  10218. "🇲🇽",
  10219. "🇲🇾",
  10220. "🇲🇿",
  10221. "🇲",
  10222. "🇳🇦",
  10223. "🇳🇨",
  10224. "🇳🇪",
  10225. "🇳🇫",
  10226. "🇳🇬",
  10227. "🇳🇮",
  10228. "🇳🇱",
  10229. "🇳🇴",
  10230. "🇳🇵",
  10231. "🇳🇷",
  10232. "🇳🇺",
  10233. "🇳🇿",
  10234. "🇳",
  10235. "🇴🇲",
  10236. "🇴",
  10237. "🇵🇦",
  10238. "🇵🇪",
  10239. "🇵🇫",
  10240. "🇵🇬",
  10241. "🇵🇭",
  10242. "🇵🇰",
  10243. "🇵🇱",
  10244. "🇵🇲",
  10245. "🇵🇳",
  10246. "🇵🇷",
  10247. "🇵🇸",
  10248. "🇵🇹",
  10249. "🇵🇼",
  10250. "🇵🇾",
  10251. "🇵",
  10252. "🇶🇦",
  10253. "🇶",
  10254. "🇷🇪",
  10255. "🇷🇴",
  10256. "🇷🇸",
  10257. "🇷🇺",
  10258. "🇷🇼",
  10259. "🇷",
  10260. "🇸🇦",
  10261. "🇸🇧",
  10262. "🇸🇨",
  10263. "🇸🇩",
  10264. "🇸🇪",
  10265. "🇸🇬",
  10266. "🇸🇭",
  10267. "🇸🇮",
  10268. "🇸🇯",
  10269. "🇸🇰",
  10270. "🇸🇱",
  10271. "🇸🇲",
  10272. "🇸🇳",
  10273. "🇸🇴",
  10274. "🇸🇷",
  10275. "🇸🇸",
  10276. "🇸🇹",
  10277. "🇸🇻",
  10278. "🇸🇽",
  10279. "🇸🇾",
  10280. "🇸🇿",
  10281. "🇸",
  10282. "🇹🇦",
  10283. "🇹🇨",
  10284. "🇹🇩",
  10285. "🇹🇫",
  10286. "🇹🇬",
  10287. "🇹🇭",
  10288. "🇹🇯",
  10289. "🇹🇰",
  10290. "🇹🇱",
  10291. "🇹🇲",
  10292. "🇹🇳",
  10293. "🇹🇴",
  10294. "🇹🇷",
  10295. "🇹🇹",
  10296. "🇹🇻",
  10297. "🇹🇼",
  10298. "🇹🇿",
  10299. "🇹",
  10300. "🇺🇦",
  10301. "🇺🇬",
  10302. "🇺🇲",
  10303. "🇺🇳",
  10304. "🇺🇸",
  10305. "🇺🇾",
  10306. "🇺🇿",
  10307. "🇺",
  10308. "🇻🇦",
  10309. "🇻🇨",
  10310. "🇻🇪",
  10311. "🇻🇬",
  10312. "🇻🇮",
  10313. "🇻🇳",
  10314. "🇻🇺",
  10315. "🇻",
  10316. "🇼🇫",
  10317. "🇼🇸",
  10318. "🇼",
  10319. "🇽🇰",
  10320. "🇽",
  10321. "🇾🇪",
  10322. "🇾🇹",
  10323. "🇾",
  10324. "🇿🇦",
  10325. "🇿🇲",
  10326. "🇿🇼",
  10327. "🇿",
  10328. "🈁",
  10329. "🈂️",
  10330. "🈚️",
  10331. "🈯️",
  10332. "🈲",
  10333. "🈳",
  10334. "🈴",
  10335. "🈵",
  10336. "🈶",
  10337. "🈷️",
  10338. "🈸",
  10339. "🈹",
  10340. "🈺",
  10341. "🉐",
  10342. "🉑",
  10343. "🌀",
  10344. "🌁",
  10345. "🌂",
  10346. "🌃",
  10347. "🌄",
  10348. "🌅",
  10349. "🌆",
  10350. "🌇",
  10351. "🌈",
  10352. "🌉",
  10353. "🌊",
  10354. "🌋",
  10355. "🌌",
  10356. "🌍",
  10357. "🌎",
  10358. "🌏",
  10359. "🌐",
  10360. "🌑",
  10361. "🌒",
  10362. "🌓",
  10363. "🌔",
  10364. "🌕",
  10365. "🌖",
  10366. "🌗",
  10367. "🌘",
  10368. "🌙",
  10369. "🌚",
  10370. "🌛",
  10371. "🌜",
  10372. "🌝",
  10373. "🌞",
  10374. "🌟",
  10375. "🌠",
  10376. "🌡️",
  10377. "🌤️",
  10378. "🌥️",
  10379. "🌦️",
  10380. "🌧️",
  10381. "🌨️",
  10382. "🌩️",
  10383. "🌪️",
  10384. "🌫️",
  10385. "🌬️",
  10386. "🌭",
  10387. "🌮",
  10388. "🌯",
  10389. "🌰",
  10390. "🌱",
  10391. "🌲",
  10392. "🌳",
  10393. "🌴",
  10394. "🌵",
  10395. "🌶️",
  10396. "🌷",
  10397. "🌸",
  10398. "🌹",
  10399. "🌺",
  10400. "🌻",
  10401. "🌼",
  10402. "🌽",
  10403. "🌾",
  10404. "🌿",
  10405. "🍀",
  10406. "🍁",
  10407. "🍂",
  10408. "🍃",
  10409. "🍄",
  10410. "🍅",
  10411. "🍆",
  10412. "🍇",
  10413. "🍈",
  10414. "🍉",
  10415. "🍊",
  10416. "🍋",
  10417. "🍌",
  10418. "🍍",
  10419. "🍎",
  10420. "🍏",
  10421. "🍐",
  10422. "🍑",
  10423. "🍒",
  10424. "🍓",
  10425. "🍔",
  10426. "🍕",
  10427. "🍖",
  10428. "🍗",
  10429. "🍘",
  10430. "🍙",
  10431. "🍚",
  10432. "🍛",
  10433. "🍜",
  10434. "🍝",
  10435. "🍞",
  10436. "🍟",
  10437. "🍠",
  10438. "🍡",
  10439. "🍢",
  10440. "🍣",
  10441. "🍤",
  10442. "🍥",
  10443. "🍦",
  10444. "🍧",
  10445. "🍨",
  10446. "🍩",
  10447. "🍪",
  10448. "🍫",
  10449. "🍬",
  10450. "🍭",
  10451. "🍮",
  10452. "🍯",
  10453. "🍰",
  10454. "🍱",
  10455. "🍲",
  10456. "🍳",
  10457. "🍴",
  10458. "🍵",
  10459. "🍶",
  10460. "🍷",
  10461. "🍸",
  10462. "🍹",
  10463. "🍺",
  10464. "🍻",
  10465. "🍼",
  10466. "🍽️",
  10467. "🍾",
  10468. "🍿",
  10469. "🎀",
  10470. "🎁",
  10471. "🎂",
  10472. "🎃",
  10473. "🎄",
  10474. "🎅🏻",
  10475. "🎅🏼",
  10476. "🎅🏽",
  10477. "🎅🏾",
  10478. "🎅🏿",
  10479. "🎅",
  10480. "🎆",
  10481. "🎇",
  10482. "🎈",
  10483. "🎉",
  10484. "🎊",
  10485. "🎋",
  10486. "🎌",
  10487. "🎍",
  10488. "🎎",
  10489. "🎏",
  10490. "🎐",
  10491. "🎑",
  10492. "🎒",
  10493. "🎓",
  10494. "🎖️",
  10495. "🎗️",
  10496. "🎙️",
  10497. "🎚️",
  10498. "🎛️",
  10499. "🎞️",
  10500. "🎟️",
  10501. "🎠",
  10502. "🎡",
  10503. "🎢",
  10504. "🎣",
  10505. "🎤",
  10506. "🎥",
  10507. "🎦",
  10508. "🎧",
  10509. "🎨",
  10510. "🎩",
  10511. "🎪",
  10512. "🎫",
  10513. "🎬",
  10514. "🎭",
  10515. "🎮",
  10516. "🎯",
  10517. "🎰",
  10518. "🎱",
  10519. "🎲",
  10520. "🎳",
  10521. "🎴",
  10522. "🎵",
  10523. "🎶",
  10524. "🎷",
  10525. "🎸",
  10526. "🎹",
  10527. "🎺",
  10528. "🎻",
  10529. "🎼",
  10530. "🎽",
  10531. "🎾",
  10532. "🎿",
  10533. "🏀",
  10534. "🏁",
  10535. "🏂🏻",
  10536. "🏂🏼",
  10537. "🏂🏽",
  10538. "🏂🏾",
  10539. "🏂🏿",
  10540. "🏂",
  10541. "🏃🏻‍♀️",
  10542. "🏃🏻‍♂️",
  10543. "🏃🏻",
  10544. "🏃🏼‍♀️",
  10545. "🏃🏼‍♂️",
  10546. "🏃🏼",
  10547. "🏃🏽‍♀️",
  10548. "🏃🏽‍♂️",
  10549. "🏃🏽",
  10550. "🏃🏾‍♀️",
  10551. "🏃🏾‍♂️",
  10552. "🏃🏾",
  10553. "🏃🏿‍♀️",
  10554. "🏃🏿‍♂️",
  10555. "🏃🏿",
  10556. "🏃‍♀️",
  10557. "🏃‍♂️",
  10558. "🏃",
  10559. "🏄🏻‍♀️",
  10560. "🏄🏻‍♂️",
  10561. "🏄🏻",
  10562. "🏄🏼‍♀️",
  10563. "🏄🏼‍♂️",
  10564. "🏄🏼",
  10565. "🏄🏽‍♀️",
  10566. "🏄🏽‍♂️",
  10567. "🏄🏽",
  10568. "🏄🏾‍♀️",
  10569. "🏄🏾‍♂️",
  10570. "🏄🏾",
  10571. "🏄🏿‍♀️",
  10572. "🏄🏿‍♂️",
  10573. "🏄🏿",
  10574. "🏄‍♀️",
  10575. "🏄‍♂️",
  10576. "🏄",
  10577. "🏅",
  10578. "🏆",
  10579. "🏇🏻",
  10580. "🏇🏼",
  10581. "🏇🏽",
  10582. "🏇🏾",
  10583. "🏇🏿",
  10584. "🏇",
  10585. "🏈",
  10586. "🏉",
  10587. "🏊🏻‍♀️",
  10588. "🏊🏻‍♂️",
  10589. "🏊🏻",
  10590. "🏊🏼‍♀️",
  10591. "🏊🏼‍♂️",
  10592. "🏊🏼",
  10593. "🏊🏽‍♀️",
  10594. "🏊🏽‍♂️",
  10595. "🏊🏽",
  10596. "🏊🏾‍♀️",
  10597. "🏊🏾‍♂️",
  10598. "🏊🏾",
  10599. "🏊🏿‍♀️",
  10600. "🏊🏿‍♂️",
  10601. "🏊🏿",
  10602. "🏊‍♀️",
  10603. "🏊‍♂️",
  10604. "🏊",
  10605. "🏋🏻‍♀️",
  10606. "🏋🏻‍♂️",
  10607. "🏋🏻",
  10608. "🏋🏼‍♀️",
  10609. "🏋🏼‍♂️",
  10610. "🏋🏼",
  10611. "🏋🏽‍♀️",
  10612. "🏋🏽‍♂️",
  10613. "🏋🏽",
  10614. "🏋🏾‍♀️",
  10615. "🏋🏾‍♂️",
  10616. "🏋🏾",
  10617. "🏋🏿‍♀️",
  10618. "🏋🏿‍♂️",
  10619. "🏋🏿",
  10620. "🏋️‍♀️",
  10621. "🏋️‍♂️",
  10622. "🏋️",
  10623. "🏌🏻‍♀️",
  10624. "🏌🏻‍♂️",
  10625. "🏌🏻",
  10626. "🏌🏼‍♀️",
  10627. "🏌🏼‍♂️",
  10628. "🏌🏼",
  10629. "🏌🏽‍♀️",
  10630. "🏌🏽‍♂️",
  10631. "🏌🏽",
  10632. "🏌🏾‍♀️",
  10633. "🏌🏾‍♂️",
  10634. "🏌🏾",
  10635. "🏌🏿‍♀️",
  10636. "🏌🏿‍♂️",
  10637. "🏌🏿",
  10638. "🏌️‍♀️",
  10639. "🏌️‍♂️",
  10640. "🏌️",
  10641. "🏍️",
  10642. "🏎️",
  10643. "🏏",
  10644. "🏐",
  10645. "🏑",
  10646. "🏒",
  10647. "🏓",
  10648. "🏔️",
  10649. "🏕️",
  10650. "🏖️",
  10651. "🏗️",
  10652. "🏘️",
  10653. "🏙️",
  10654. "🏚️",
  10655. "🏛️",
  10656. "🏜️",
  10657. "🏝️",
  10658. "🏞️",
  10659. "🏟️",
  10660. "🏠",
  10661. "🏡",
  10662. "🏢",
  10663. "🏣",
  10664. "🏤",
  10665. "🏥",
  10666. "🏦",
  10667. "🏧",
  10668. "🏨",
  10669. "🏩",
  10670. "🏪",
  10671. "🏫",
  10672. "🏬",
  10673. "🏭",
  10674. "🏮",
  10675. "🏯",
  10676. "🏰",
  10677. "🏳️‍🌈",
  10678. "🏳️",
  10679. "🏴‍☠️",
  10680. "🏴󠁧󠁢󠁥󠁮󠁧󠁿",
  10681. "🏴󠁧󠁢󠁳󠁣󠁴󠁿",
  10682. "🏴󠁧󠁢󠁷󠁬󠁳󠁿",
  10683. "🏴",
  10684. "🏵️",
  10685. "🏷️",
  10686. "🏸",
  10687. "🏹",
  10688. "🏺",
  10689. "🏻",
  10690. "🏼",
  10691. "🏽",
  10692. "🏾",
  10693. "🏿",
  10694. "🐀",
  10695. "🐁",
  10696. "🐂",
  10697. "🐃",
  10698. "🐄",
  10699. "🐅",
  10700. "🐆",
  10701. "🐇",
  10702. "🐈",
  10703. "🐉",
  10704. "🐊",
  10705. "🐋",
  10706. "🐌",
  10707. "🐍",
  10708. "🐎",
  10709. "🐏",
  10710. "🐐",
  10711. "🐑",
  10712. "🐒",
  10713. "🐓",
  10714. "🐔",
  10715. "🐕‍🦺",
  10716. "🐕",
  10717. "🐖",
  10718. "🐗",
  10719. "🐘",
  10720. "🐙",
  10721. "🐚",
  10722. "🐛",
  10723. "🐜",
  10724. "🐝",
  10725. "🐞",
  10726. "🐟",
  10727. "🐠",
  10728. "🐡",
  10729. "🐢",
  10730. "🐣",
  10731. "🐤",
  10732. "🐥",
  10733. "🐦",
  10734. "🐧",
  10735. "🐨",
  10736. "🐩",
  10737. "🐪",
  10738. "🐫",
  10739. "🐬",
  10740. "🐭",
  10741. "🐮",
  10742. "🐯",
  10743. "🐰",
  10744. "🐱",
  10745. "🐲",
  10746. "🐳",
  10747. "🐴",
  10748. "🐵",
  10749. "🐶",
  10750. "🐷",
  10751. "🐸",
  10752. "🐹",
  10753. "🐺",
  10754. "🐻",
  10755. "🐼",
  10756. "🐽",
  10757. "🐾",
  10758. "🐿️",
  10759. "👀",
  10760. "👁‍🗨",
  10761. "👁️",
  10762. "👂🏻",
  10763. "👂🏼",
  10764. "👂🏽",
  10765. "👂🏾",
  10766. "👂🏿",
  10767. "👂",
  10768. "👃🏻",
  10769. "👃🏼",
  10770. "👃🏽",
  10771. "👃🏾",
  10772. "👃🏿",
  10773. "👃",
  10774. "👄",
  10775. "👅",
  10776. "👆🏻",
  10777. "👆🏼",
  10778. "👆🏽",
  10779. "👆🏾",
  10780. "👆🏿",
  10781. "👆",
  10782. "👇🏻",
  10783. "👇🏼",
  10784. "👇🏽",
  10785. "👇🏾",
  10786. "👇🏿",
  10787. "👇",
  10788. "👈🏻",
  10789. "👈🏼",
  10790. "👈🏽",
  10791. "👈🏾",
  10792. "👈🏿",
  10793. "👈",
  10794. "👉🏻",
  10795. "👉🏼",
  10796. "👉🏽",
  10797. "👉🏾",
  10798. "👉🏿",
  10799. "👉",
  10800. "👊🏻",
  10801. "👊🏼",
  10802. "👊🏽",
  10803. "👊🏾",
  10804. "👊🏿",
  10805. "👊",
  10806. "👋🏻",
  10807. "👋🏼",
  10808. "👋🏽",
  10809. "👋🏾",
  10810. "👋🏿",
  10811. "👋",
  10812. "👌🏻",
  10813. "👌🏼",
  10814. "👌🏽",
  10815. "👌🏾",
  10816. "👌🏿",
  10817. "👌",
  10818. "👍🏻",
  10819. "👍🏼",
  10820. "👍🏽",
  10821. "👍🏾",
  10822. "👍🏿",
  10823. "👍",
  10824. "👎🏻",
  10825. "👎🏼",
  10826. "👎🏽",
  10827. "👎🏾",
  10828. "👎🏿",
  10829. "👎",
  10830. "👏🏻",
  10831. "👏🏼",
  10832. "👏🏽",
  10833. "👏🏾",
  10834. "👏🏿",
  10835. "👏",
  10836. "👐🏻",
  10837. "👐🏼",
  10838. "👐🏽",
  10839. "👐🏾",
  10840. "👐🏿",
  10841. "👐",
  10842. "👑",
  10843. "👒",
  10844. "👓",
  10845. "👔",
  10846. "👕",
  10847. "👖",
  10848. "👗",
  10849. "👘",
  10850. "👙",
  10851. "👚",
  10852. "👛",
  10853. "👜",
  10854. "👝",
  10855. "👞",
  10856. "👟",
  10857. "👠",
  10858. "👡",
  10859. "👢",
  10860. "👣",
  10861. "👤",
  10862. "👥",
  10863. "👦🏻",
  10864. "👦🏼",
  10865. "👦🏽",
  10866. "👦🏾",
  10867. "👦🏿",
  10868. "👦",
  10869. "👧🏻",
  10870. "👧🏼",
  10871. "👧🏽",
  10872. "👧🏾",
  10873. "👧🏿",
  10874. "👧",
  10875. "👨🏻‍🌾",
  10876. "👨🏻‍🍳",
  10877. "👨🏻‍🎓",
  10878. "👨🏻‍🎤",
  10879. "👨🏻‍🎨",
  10880. "👨🏻‍🏫",
  10881. "👨🏻‍🏭",
  10882. "👨🏻‍💻",
  10883. "👨🏻‍💼",
  10884. "👨🏻‍🔧",
  10885. "👨🏻‍🔬",
  10886. "👨🏻‍🚀",
  10887. "👨🏻‍🚒",
  10888. "👨🏻‍🦯",
  10889. "👨🏻‍🦰",
  10890. "👨🏻‍🦱",
  10891. "👨🏻‍🦲",
  10892. "👨🏻‍🦳",
  10893. "👨🏻‍🦼",
  10894. "👨🏻‍🦽",
  10895. "👨🏻‍⚕️",
  10896. "👨🏻‍⚖️",
  10897. "👨🏻‍✈️",
  10898. "👨🏻",
  10899. "👨🏼‍🌾",
  10900. "👨🏼‍🍳",
  10901. "👨🏼‍🎓",
  10902. "👨🏼‍🎤",
  10903. "👨🏼‍🎨",
  10904. "👨🏼‍🏫",
  10905. "👨🏼‍🏭",
  10906. "👨🏼‍💻",
  10907. "👨🏼‍💼",
  10908. "👨🏼‍🔧",
  10909. "👨🏼‍🔬",
  10910. "👨🏼‍🚀",
  10911. "👨🏼‍🚒",
  10912. "👨🏼‍🤝‍👨🏻",
  10913. "👨🏼‍🦯",
  10914. "👨🏼‍🦰",
  10915. "👨🏼‍🦱",
  10916. "👨🏼‍🦲",
  10917. "👨🏼‍🦳",
  10918. "👨🏼‍🦼",
  10919. "👨🏼‍🦽",
  10920. "👨🏼‍⚕️",
  10921. "👨🏼‍⚖️",
  10922. "👨🏼‍✈️",
  10923. "👨🏼",
  10924. "👨🏽‍🌾",
  10925. "👨🏽‍🍳",
  10926. "👨🏽‍🎓",
  10927. "👨🏽‍🎤",
  10928. "👨🏽‍🎨",
  10929. "👨🏽‍🏫",
  10930. "👨🏽‍🏭",
  10931. "👨🏽‍💻",
  10932. "👨🏽‍💼",
  10933. "👨🏽‍🔧",
  10934. "👨🏽‍🔬",
  10935. "👨🏽‍🚀",
  10936. "👨🏽‍🚒",
  10937. "👨🏽‍🤝‍👨🏻",
  10938. "👨🏽‍🤝‍👨🏼",
  10939. "👨🏽‍🦯",
  10940. "👨🏽‍🦰",
  10941. "👨🏽‍🦱",
  10942. "👨🏽‍🦲",
  10943. "👨🏽‍🦳",
  10944. "👨🏽‍🦼",
  10945. "👨🏽‍🦽",
  10946. "👨🏽‍⚕️",
  10947. "👨🏽‍⚖️",
  10948. "👨🏽‍✈️",
  10949. "👨🏽",
  10950. "👨🏾‍🌾",
  10951. "👨🏾‍🍳",
  10952. "👨🏾‍🎓",
  10953. "👨🏾‍🎤",
  10954. "👨🏾‍🎨",
  10955. "👨🏾‍🏫",
  10956. "👨🏾‍🏭",
  10957. "👨🏾‍💻",
  10958. "👨🏾‍💼",
  10959. "👨🏾‍🔧",
  10960. "👨🏾‍🔬",
  10961. "👨🏾‍🚀",
  10962. "👨🏾‍🚒",
  10963. "👨🏾‍🤝‍👨🏻",
  10964. "👨🏾‍🤝‍👨🏼",
  10965. "👨🏾‍🤝‍👨🏽",
  10966. "👨🏾‍🦯",
  10967. "👨🏾‍🦰",
  10968. "👨🏾‍🦱",
  10969. "👨🏾‍🦲",
  10970. "👨🏾‍🦳",
  10971. "👨🏾‍🦼",
  10972. "👨🏾‍🦽",
  10973. "👨🏾‍⚕️",
  10974. "👨🏾‍⚖️",
  10975. "👨🏾‍✈️",
  10976. "👨🏾",
  10977. "👨🏿‍🌾",
  10978. "👨🏿‍🍳",
  10979. "👨🏿‍🎓",
  10980. "👨🏿‍🎤",
  10981. "👨🏿‍🎨",
  10982. "👨🏿‍🏫",
  10983. "👨🏿‍🏭",
  10984. "👨🏿‍💻",
  10985. "👨🏿‍💼",
  10986. "👨🏿‍🔧",
  10987. "👨🏿‍🔬",
  10988. "👨🏿‍🚀",
  10989. "👨🏿‍🚒",
  10990. "👨🏿‍🤝‍👨🏻",
  10991. "👨🏿‍🤝‍👨🏼",
  10992. "👨🏿‍🤝‍👨🏽",
  10993. "👨🏿‍🤝‍👨🏾",
  10994. "👨🏿‍🦯",
  10995. "👨🏿‍🦰",
  10996. "👨🏿‍🦱",
  10997. "👨🏿‍🦲",
  10998. "👨🏿‍🦳",
  10999. "👨🏿‍🦼",
  11000. "👨🏿‍🦽",
  11001. "👨🏿‍⚕️",
  11002. "👨🏿‍⚖️",
  11003. "👨🏿‍✈️",
  11004. "👨🏿",
  11005. "👨‍🌾",
  11006. "👨‍🍳",
  11007. "👨‍🎓",
  11008. "👨‍🎤",
  11009. "👨‍🎨",
  11010. "👨‍🏫",
  11011. "👨‍🏭",
  11012. "👨‍👦‍👦",
  11013. "👨‍👦",
  11014. "👨‍👧‍👦",
  11015. "👨‍👧‍👧",
  11016. "👨‍👧",
  11017. "👨‍👨‍👦‍👦",
  11018. "👨‍👨‍👦",
  11019. "👨‍👨‍👧‍👦",
  11020. "👨‍👨‍👧‍👧",
  11021. "👨‍👨‍👧",
  11022. "👨‍👩‍👦‍👦",
  11023. "👨‍👩‍👦",
  11024. "👨‍👩‍👧‍👦",
  11025. "👨‍👩‍👧‍👧",
  11026. "👨‍👩‍👧",
  11027. "👨‍💻",
  11028. "👨‍💼",
  11029. "👨‍🔧",
  11030. "👨‍🔬",
  11031. "👨‍🚀",
  11032. "👨‍🚒",
  11033. "👨‍🦯",
  11034. "👨‍🦰",
  11035. "👨‍🦱",
  11036. "👨‍🦲",
  11037. "👨‍🦳",
  11038. "👨‍🦼",
  11039. "👨‍🦽",
  11040. "👨‍⚕️",
  11041. "👨‍⚖️",
  11042. "👨‍✈️",
  11043. "👨‍❤️‍👨",
  11044. "👨‍❤️‍💋‍👨",
  11045. "👨",
  11046. "👩🏻‍🌾",
  11047. "👩🏻‍🍳",
  11048. "👩🏻‍🎓",
  11049. "👩🏻‍🎤",
  11050. "👩🏻‍🎨",
  11051. "👩🏻‍🏫",
  11052. "👩🏻‍🏭",
  11053. "👩🏻‍💻",
  11054. "👩🏻‍💼",
  11055. "👩🏻‍🔧",
  11056. "👩🏻‍🔬",
  11057. "👩🏻‍🚀",
  11058. "👩🏻‍🚒",
  11059. "👩🏻‍🤝‍👨🏼",
  11060. "👩🏻‍🤝‍👨🏽",
  11061. "👩🏻‍🤝‍👨🏾",
  11062. "👩🏻‍🤝‍👨🏿",
  11063. "👩🏻‍🦯",
  11064. "👩🏻‍🦰",
  11065. "👩🏻‍🦱",
  11066. "👩🏻‍🦲",
  11067. "👩🏻‍🦳",
  11068. "👩🏻‍🦼",
  11069. "👩🏻‍🦽",
  11070. "👩🏻‍⚕️",
  11071. "👩🏻‍⚖️",
  11072. "👩🏻‍✈️",
  11073. "👩🏻",
  11074. "👩🏼‍🌾",
  11075. "👩🏼‍🍳",
  11076. "👩🏼‍🎓",
  11077. "👩🏼‍🎤",
  11078. "👩🏼‍🎨",
  11079. "👩🏼‍🏫",
  11080. "👩🏼‍🏭",
  11081. "👩🏼‍💻",
  11082. "👩🏼‍💼",
  11083. "👩🏼‍🔧",
  11084. "👩🏼‍🔬",
  11085. "👩🏼‍🚀",
  11086. "👩🏼‍🚒",
  11087. "👩🏼‍🤝‍👨🏻",
  11088. "👩🏼‍🤝‍👨🏽",
  11089. "👩🏼‍🤝‍👨🏾",
  11090. "👩🏼‍🤝‍👨🏿",
  11091. "👩🏼‍🤝‍👩🏻",
  11092. "👩🏼‍🦯",
  11093. "👩🏼‍🦰",
  11094. "👩🏼‍🦱",
  11095. "👩🏼‍🦲",
  11096. "👩🏼‍🦳",
  11097. "👩🏼‍🦼",
  11098. "👩🏼‍🦽",
  11099. "👩🏼‍⚕️",
  11100. "👩🏼‍⚖️",
  11101. "👩🏼‍✈️",
  11102. "👩🏼",
  11103. "👩🏽‍🌾",
  11104. "👩🏽‍🍳",
  11105. "👩🏽‍🎓",
  11106. "👩🏽‍🎤",
  11107. "👩🏽‍🎨",
  11108. "👩🏽‍🏫",
  11109. "👩🏽‍🏭",
  11110. "👩🏽‍💻",
  11111. "👩🏽‍💼",
  11112. "👩🏽‍🔧",
  11113. "👩🏽‍🔬",
  11114. "👩🏽‍🚀",
  11115. "👩🏽‍🚒",
  11116. "👩🏽‍🤝‍👨🏻",
  11117. "👩🏽‍🤝‍👨🏼",
  11118. "👩🏽‍🤝‍👨🏾",
  11119. "👩🏽‍🤝‍👨🏿",
  11120. "👩🏽‍🤝‍👩🏻",
  11121. "👩🏽‍🤝‍👩🏼",
  11122. "👩🏽‍🦯",
  11123. "👩🏽‍🦰",
  11124. "👩🏽‍🦱",
  11125. "👩🏽‍🦲",
  11126. "👩🏽‍🦳",
  11127. "👩🏽‍🦼",
  11128. "👩🏽‍🦽",
  11129. "👩🏽‍⚕️",
  11130. "👩🏽‍⚖️",
  11131. "👩🏽‍✈️",
  11132. "👩🏽",
  11133. "👩🏾‍🌾",
  11134. "👩🏾‍🍳",
  11135. "👩🏾‍🎓",
  11136. "👩🏾‍🎤",
  11137. "👩🏾‍🎨",
  11138. "👩🏾‍🏫",
  11139. "👩🏾‍🏭",
  11140. "👩🏾‍💻",
  11141. "👩🏾‍💼",
  11142. "👩🏾‍🔧",
  11143. "👩🏾‍🔬",
  11144. "👩🏾‍🚀",
  11145. "👩🏾‍🚒",
  11146. "👩🏾‍🤝‍👨🏻",
  11147. "👩🏾‍🤝‍👨🏼",
  11148. "👩🏾‍🤝‍👨🏽",
  11149. "👩🏾‍🤝‍👨🏿",
  11150. "👩🏾‍🤝‍👩🏻",
  11151. "👩🏾‍🤝‍👩🏼",
  11152. "👩🏾‍🤝‍👩🏽",
  11153. "👩🏾‍🦯",
  11154. "👩🏾‍🦰",
  11155. "👩🏾‍🦱",
  11156. "👩🏾‍🦲",
  11157. "👩🏾‍🦳",
  11158. "👩🏾‍🦼",
  11159. "👩🏾‍🦽",
  11160. "👩🏾‍⚕️",
  11161. "👩🏾‍⚖️",
  11162. "👩🏾‍✈️",
  11163. "👩🏾",
  11164. "👩🏿‍🌾",
  11165. "👩🏿‍🍳",
  11166. "👩🏿‍🎓",
  11167. "👩🏿‍🎤",
  11168. "👩🏿‍🎨",
  11169. "👩🏿‍🏫",
  11170. "👩🏿‍🏭",
  11171. "👩🏿‍💻",
  11172. "👩🏿‍💼",
  11173. "👩🏿‍🔧",
  11174. "👩🏿‍🔬",
  11175. "👩🏿‍🚀",
  11176. "👩🏿‍🚒",
  11177. "👩🏿‍🤝‍👨🏻",
  11178. "👩🏿‍🤝‍👨🏼",
  11179. "👩🏿‍🤝‍👨🏽",
  11180. "👩🏿‍🤝‍👨🏾",
  11181. "👩🏿‍🤝‍👩🏻",
  11182. "👩🏿‍🤝‍👩🏼",
  11183. "👩🏿‍🤝‍👩🏽",
  11184. "👩🏿‍🤝‍👩🏾",
  11185. "👩🏿‍🦯",
  11186. "👩🏿‍🦰",
  11187. "👩🏿‍🦱",
  11188. "👩🏿‍🦲",
  11189. "👩🏿‍🦳",
  11190. "👩🏿‍🦼",
  11191. "👩🏿‍🦽",
  11192. "👩🏿‍⚕️",
  11193. "👩🏿‍⚖️",
  11194. "👩🏿‍✈️",
  11195. "👩🏿",
  11196. "👩‍🌾",
  11197. "👩‍🍳",
  11198. "👩‍🎓",
  11199. "👩‍🎤",
  11200. "👩‍🎨",
  11201. "👩‍🏫",
  11202. "👩‍🏭",
  11203. "👩‍👦‍👦",
  11204. "👩‍👦",
  11205. "👩‍👧‍👦",
  11206. "👩‍👧‍👧",
  11207. "👩‍👧",
  11208. "👩‍👩‍👦‍👦",
  11209. "👩‍👩‍👦",
  11210. "👩‍👩‍👧‍👦",
  11211. "👩‍👩‍👧‍👧",
  11212. "👩‍👩‍👧",
  11213. "👩‍💻",
  11214. "👩‍💼",
  11215. "👩‍🔧",
  11216. "👩‍🔬",
  11217. "👩‍🚀",
  11218. "👩‍🚒",
  11219. "👩‍🦯",
  11220. "👩‍🦰",
  11221. "👩‍🦱",
  11222. "👩‍🦲",
  11223. "👩‍🦳",
  11224. "👩‍🦼",
  11225. "👩‍🦽",
  11226. "👩‍⚕️",
  11227. "👩‍⚖️",
  11228. "👩‍✈️",
  11229. "👩‍❤️‍👨",
  11230. "👩‍❤️‍👩",
  11231. "👩‍❤️‍💋‍👨",
  11232. "👩‍❤️‍💋‍👩",
  11233. "👩",
  11234. "👪",
  11235. "👫🏻",
  11236. "👫🏼",
  11237. "👫🏽",
  11238. "👫🏾",
  11239. "👫🏿",
  11240. "👫",
  11241. "👬🏻",
  11242. "👬🏼",
  11243. "👬🏽",
  11244. "👬🏾",
  11245. "👬🏿",
  11246. "👬",
  11247. "👭🏻",
  11248. "👭🏼",
  11249. "👭🏽",
  11250. "👭🏾",
  11251. "👭🏿",
  11252. "👭",
  11253. "👮🏻‍♀️",
  11254. "👮🏻‍♂️",
  11255. "👮🏻",
  11256. "👮🏼‍♀️",
  11257. "👮🏼‍♂️",
  11258. "👮🏼",
  11259. "👮🏽‍♀️",
  11260. "👮🏽‍♂️",
  11261. "👮🏽",
  11262. "👮🏾‍♀️",
  11263. "👮🏾‍♂️",
  11264. "👮🏾",
  11265. "👮🏿‍♀️",
  11266. "👮🏿‍♂️",
  11267. "👮🏿",
  11268. "👮‍♀️",
  11269. "👮‍♂️",
  11270. "👮",
  11271. "👯‍♀️",
  11272. "👯‍♂️",
  11273. "👯",
  11274. "👰🏻",
  11275. "👰🏼",
  11276. "👰🏽",
  11277. "👰🏾",
  11278. "👰🏿",
  11279. "👰",
  11280. "👱🏻‍♀️",
  11281. "👱🏻‍♂️",
  11282. "👱🏻",
  11283. "👱🏼‍♀️",
  11284. "👱🏼‍♂️",
  11285. "👱🏼",
  11286. "👱🏽‍♀️",
  11287. "👱🏽‍♂️",
  11288. "👱🏽",
  11289. "👱🏾‍♀️",
  11290. "👱🏾‍♂️",
  11291. "👱🏾",
  11292. "👱🏿‍♀️",
  11293. "👱🏿‍♂️",
  11294. "👱🏿",
  11295. "👱‍♀️",
  11296. "👱‍♂️",
  11297. "👱",
  11298. "👲🏻",
  11299. "👲🏼",
  11300. "👲🏽",
  11301. "👲🏾",
  11302. "👲🏿",
  11303. "👲",
  11304. "👳🏻‍♀️",
  11305. "👳🏻‍♂️",
  11306. "👳🏻",
  11307. "👳🏼‍♀️",
  11308. "👳🏼‍♂️",
  11309. "👳🏼",
  11310. "👳🏽‍♀️",
  11311. "👳🏽‍♂️",
  11312. "👳🏽",
  11313. "👳🏾‍♀️",
  11314. "👳🏾‍♂️",
  11315. "👳🏾",
  11316. "👳🏿‍♀️",
  11317. "👳🏿‍♂️",
  11318. "👳🏿",
  11319. "👳‍♀️",
  11320. "👳‍♂️",
  11321. "👳",
  11322. "👴🏻",
  11323. "👴🏼",
  11324. "👴🏽",
  11325. "👴🏾",
  11326. "👴🏿",
  11327. "👴",
  11328. "👵🏻",
  11329. "👵🏼",
  11330. "👵🏽",
  11331. "👵🏾",
  11332. "👵🏿",
  11333. "👵",
  11334. "👶🏻",
  11335. "👶🏼",
  11336. "👶🏽",
  11337. "👶🏾",
  11338. "👶🏿",
  11339. "👶",
  11340. "👷🏻‍♀️",
  11341. "👷🏻‍♂️",
  11342. "👷🏻",
  11343. "👷🏼‍♀️",
  11344. "👷🏼‍♂️",
  11345. "👷🏼",
  11346. "👷🏽‍♀️",
  11347. "👷🏽‍♂️",
  11348. "👷🏽",
  11349. "👷🏾‍♀️",
  11350. "👷🏾‍♂️",
  11351. "👷🏾",
  11352. "👷🏿‍♀️",
  11353. "👷🏿‍♂️",
  11354. "👷🏿",
  11355. "👷‍♀️",
  11356. "👷‍♂️",
  11357. "👷",
  11358. "👸🏻",
  11359. "👸🏼",
  11360. "👸🏽",
  11361. "👸🏾",
  11362. "👸🏿",
  11363. "👸",
  11364. "👹",
  11365. "👺",
  11366. "👻",
  11367. "👼🏻",
  11368. "👼🏼",
  11369. "👼🏽",
  11370. "👼🏾",
  11371. "👼🏿",
  11372. "👼",
  11373. "👽",
  11374. "👾",
  11375. "👿",
  11376. "💀",
  11377. "💁🏻‍♀️",
  11378. "💁🏻‍♂️",
  11379. "💁🏻",
  11380. "💁🏼‍♀️",
  11381. "💁🏼‍♂️",
  11382. "💁🏼",
  11383. "💁🏽‍♀️",
  11384. "💁🏽‍♂️",
  11385. "💁🏽",
  11386. "💁🏾‍♀️",
  11387. "💁🏾‍♂️",
  11388. "💁🏾",
  11389. "💁🏿‍♀️",
  11390. "💁🏿‍♂️",
  11391. "💁🏿",
  11392. "💁‍♀️",
  11393. "💁‍♂️",
  11394. "💁",
  11395. "💂🏻‍♀️",
  11396. "💂🏻‍♂️",
  11397. "💂🏻",
  11398. "💂🏼‍♀️",
  11399. "💂🏼‍♂️",
  11400. "💂🏼",
  11401. "💂🏽‍♀️",
  11402. "💂🏽‍♂️",
  11403. "💂🏽",
  11404. "💂🏾‍♀️",
  11405. "💂🏾‍♂️",
  11406. "💂🏾",
  11407. "💂🏿‍♀️",
  11408. "💂🏿‍♂️",
  11409. "💂🏿",
  11410. "💂‍♀️",
  11411. "💂‍♂️",
  11412. "💂",
  11413. "💃🏻",
  11414. "💃🏼",
  11415. "💃🏽",
  11416. "💃🏾",
  11417. "💃🏿",
  11418. "💃",
  11419. "💄",
  11420. "💅🏻",
  11421. "💅🏼",
  11422. "💅🏽",
  11423. "💅🏾",
  11424. "💅🏿",
  11425. "💅",
  11426. "💆🏻‍♀️",
  11427. "💆🏻‍♂️",
  11428. "💆🏻",
  11429. "💆🏼‍♀️",
  11430. "💆🏼‍♂️",
  11431. "💆🏼",
  11432. "💆🏽‍♀️",
  11433. "💆🏽‍♂️",
  11434. "💆🏽",
  11435. "💆🏾‍♀️",
  11436. "💆🏾‍♂️",
  11437. "💆🏾",
  11438. "💆🏿‍♀️",
  11439. "💆🏿‍♂️",
  11440. "💆🏿",
  11441. "💆‍♀️",
  11442. "💆‍♂️",
  11443. "💆",
  11444. "💇🏻‍♀️",
  11445. "💇🏻‍♂️",
  11446. "💇🏻",
  11447. "💇🏼‍♀️",
  11448. "💇🏼‍♂️",
  11449. "💇🏼",
  11450. "💇🏽‍♀️",
  11451. "💇🏽‍♂️",
  11452. "💇🏽",
  11453. "💇🏾‍♀️",
  11454. "💇🏾‍♂️",
  11455. "💇🏾",
  11456. "💇🏿‍♀️",
  11457. "💇🏿‍♂️",
  11458. "💇🏿",
  11459. "💇‍♀️",
  11460. "💇‍♂️",
  11461. "💇",
  11462. "💈",
  11463. "💉",
  11464. "💊",
  11465. "💋",
  11466. "💌",
  11467. "💍",
  11468. "💎",
  11469. "💏",
  11470. "💐",
  11471. "💑",
  11472. "💒",
  11473. "💓",
  11474. "💔",
  11475. "💕",
  11476. "💖",
  11477. "💗",
  11478. "💘",
  11479. "💙",
  11480. "💚",
  11481. "💛",
  11482. "💜",
  11483. "💝",
  11484. "💞",
  11485. "💟",
  11486. "💠",
  11487. "💡",
  11488. "💢",
  11489. "💣",
  11490. "💤",
  11491. "💥",
  11492. "💦",
  11493. "💧",
  11494. "💨",
  11495. "💩",
  11496. "💪🏻",
  11497. "💪🏼",
  11498. "💪🏽",
  11499. "💪🏾",
  11500. "💪🏿",
  11501. "💪",
  11502. "💫",
  11503. "💬",
  11504. "💭",
  11505. "💮",
  11506. "💯",
  11507. "💰",
  11508. "💱",
  11509. "💲",
  11510. "💳",
  11511. "💴",
  11512. "💵",
  11513. "💶",
  11514. "💷",
  11515. "💸",
  11516. "💹",
  11517. "💺",
  11518. "💻",
  11519. "💼",
  11520. "💽",
  11521. "💾",
  11522. "💿",
  11523. "📀",
  11524. "📁",
  11525. "📂",
  11526. "📃",
  11527. "📄",
  11528. "📅",
  11529. "📆",
  11530. "📇",
  11531. "📈",
  11532. "📉",
  11533. "📊",
  11534. "📋",
  11535. "📌",
  11536. "📍",
  11537. "📎",
  11538. "📏",
  11539. "📐",
  11540. "📑",
  11541. "📒",
  11542. "📓",
  11543. "📔",
  11544. "📕",
  11545. "📖",
  11546. "📗",
  11547. "📘",
  11548. "📙",
  11549. "📚",
  11550. "📛",
  11551. "📜",
  11552. "📝",
  11553. "📞",
  11554. "📟",
  11555. "📠",
  11556. "📡",
  11557. "📢",
  11558. "📣",
  11559. "📤",
  11560. "📥",
  11561. "📦",
  11562. "📧",
  11563. "📨",
  11564. "📩",
  11565. "📪",
  11566. "📫",
  11567. "📬",
  11568. "📭",
  11569. "📮",
  11570. "📯",
  11571. "📰",
  11572. "📱",
  11573. "📲",
  11574. "📳",
  11575. "📴",
  11576. "📵",
  11577. "📶",
  11578. "📷",
  11579. "📸",
  11580. "📹",
  11581. "📺",
  11582. "📻",
  11583. "📼",
  11584. "📽️",
  11585. "📿",
  11586. "🔀",
  11587. "🔁",
  11588. "🔂",
  11589. "🔃",
  11590. "🔄",
  11591. "🔅",
  11592. "🔆",
  11593. "🔇",
  11594. "🔈",
  11595. "🔉",
  11596. "🔊",
  11597. "🔋",
  11598. "🔌",
  11599. "🔍",
  11600. "🔎",
  11601. "🔏",
  11602. "🔐",
  11603. "🔑",
  11604. "🔒",
  11605. "🔓",
  11606. "🔔",
  11607. "🔕",
  11608. "🔖",
  11609. "🔗",
  11610. "🔘",
  11611. "🔙",
  11612. "🔚",
  11613. "🔛",
  11614. "🔜",
  11615. "🔝",
  11616. "🔞",
  11617. "🔟",
  11618. "🔠",
  11619. "🔡",
  11620. "🔢",
  11621. "🔣",
  11622. "🔤",
  11623. "🔥",
  11624. "🔦",
  11625. "🔧",
  11626. "🔨",
  11627. "🔩",
  11628. "🔪",
  11629. "🔫",
  11630. "🔬",
  11631. "🔭",
  11632. "🔮",
  11633. "🔯",
  11634. "🔰",
  11635. "🔱",
  11636. "🔲",
  11637. "🔳",
  11638. "🔴",
  11639. "🔵",
  11640. "🔶",
  11641. "🔷",
  11642. "🔸",
  11643. "🔹",
  11644. "🔺",
  11645. "🔻",
  11646. "🔼",
  11647. "🔽",
  11648. "🕉️",
  11649. "🕊️",
  11650. "🕋",
  11651. "🕌",
  11652. "🕍",
  11653. "🕎",
  11654. "🕐",
  11655. "🕑",
  11656. "🕒",
  11657. "🕓",
  11658. "🕔",
  11659. "🕕",
  11660. "🕖",
  11661. "🕗",
  11662. "🕘",
  11663. "🕙",
  11664. "🕚",
  11665. "🕛",
  11666. "🕜",
  11667. "🕝",
  11668. "🕞",
  11669. "🕟",
  11670. "🕠",
  11671. "🕡",
  11672. "🕢",
  11673. "🕣",
  11674. "🕤",
  11675. "🕥",
  11676. "🕦",
  11677. "🕧",
  11678. "🕯️",
  11679. "🕰️",
  11680. "🕳️",
  11681. "🕴🏻‍♀️",
  11682. "🕴🏻‍♂️",
  11683. "🕴🏻",
  11684. "🕴🏼‍♀️",
  11685. "🕴🏼‍♂️",
  11686. "🕴🏼",
  11687. "🕴🏽‍♀️",
  11688. "🕴🏽‍♂️",
  11689. "🕴🏽",
  11690. "🕴🏾‍♀️",
  11691. "🕴🏾‍♂️",
  11692. "🕴🏾",
  11693. "🕴🏿‍♀️",
  11694. "🕴🏿‍♂️",
  11695. "🕴🏿",
  11696. "🕴️‍♀️",
  11697. "🕴️‍♂️",
  11698. "🕴️",
  11699. "🕵🏻‍♀️",
  11700. "🕵🏻‍♂️",
  11701. "🕵🏻",
  11702. "🕵🏼‍♀️",
  11703. "🕵🏼‍♂️",
  11704. "🕵🏼",
  11705. "🕵🏽‍♀️",
  11706. "🕵🏽‍♂️",
  11707. "🕵🏽",
  11708. "🕵🏾‍♀️",
  11709. "🕵🏾‍♂️",
  11710. "🕵🏾",
  11711. "🕵🏿‍♀️",
  11712. "🕵🏿‍♂️",
  11713. "🕵🏿",
  11714. "🕵️‍♀️",
  11715. "🕵️‍♂️",
  11716. "🕵️",
  11717. "🕶️",
  11718. "🕷️",
  11719. "🕸️",
  11720. "🕹️",
  11721. "🕺🏻",
  11722. "🕺🏼",
  11723. "🕺🏽",
  11724. "🕺🏾",
  11725. "🕺🏿",
  11726. "🕺",
  11727. "🖇️",
  11728. "🖊️",
  11729. "🖋️",
  11730. "🖌️",
  11731. "🖍️",
  11732. "🖐🏻",
  11733. "🖐🏼",
  11734. "🖐🏽",
  11735. "🖐🏾",
  11736. "🖐🏿",
  11737. "🖐️",
  11738. "🖕🏻",
  11739. "🖕🏼",
  11740. "🖕🏽",
  11741. "🖕🏾",
  11742. "🖕🏿",
  11743. "🖕",
  11744. "🖖🏻",
  11745. "🖖🏼",
  11746. "🖖🏽",
  11747. "🖖🏾",
  11748. "🖖🏿",
  11749. "🖖",
  11750. "🖤",
  11751. "🖥️",
  11752. "🖨️",
  11753. "🖱️",
  11754. "🖲️",
  11755. "🖼️",
  11756. "🗂️",
  11757. "🗃️",
  11758. "🗄️",
  11759. "🗑️",
  11760. "🗒️",
  11761. "🗓️",
  11762. "🗜️",
  11763. "🗝️",
  11764. "🗞️",
  11765. "🗡️",
  11766. "🗣️",
  11767. "🗨️",
  11768. "🗯️",
  11769. "🗳️",
  11770. "🗺️",
  11771. "🗻",
  11772. "🗼",
  11773. "🗽",
  11774. "🗾",
  11775. "🗿",
  11776. "😀",
  11777. "😁",
  11778. "😂",
  11779. "😃",
  11780. "😄",
  11781. "😅",
  11782. "😆",
  11783. "😇",
  11784. "😈",
  11785. "😉",
  11786. "😊",
  11787. "😋",
  11788. "😌",
  11789. "😍",
  11790. "😎",
  11791. "😏",
  11792. "😐",
  11793. "😑",
  11794. "😒",
  11795. "😓",
  11796. "😔",
  11797. "😕",
  11798. "😖",
  11799. "😗",
  11800. "😘",
  11801. "😙",
  11802. "😚",
  11803. "😛",
  11804. "😜",
  11805. "😝",
  11806. "😞",
  11807. "😟",
  11808. "😠",
  11809. "😡",
  11810. "😢",
  11811. "😣",
  11812. "😤",
  11813. "😥",
  11814. "😦",
  11815. "😧",
  11816. "😨",
  11817. "😩",
  11818. "😪",
  11819. "😫",
  11820. "😬",
  11821. "😭",
  11822. "😮",
  11823. "😯",
  11824. "😰",
  11825. "😱",
  11826. "😲",
  11827. "😳",
  11828. "😴",
  11829. "😵",
  11830. "😶",
  11831. "😷",
  11832. "😸",
  11833. "😹",
  11834. "😺",
  11835. "😻",
  11836. "😼",
  11837. "😽",
  11838. "😾",
  11839. "😿",
  11840. "🙀",
  11841. "🙁",
  11842. "🙂",
  11843. "🙃",
  11844. "🙄",
  11845. "🙅🏻‍♀️",
  11846. "🙅🏻‍♂️",
  11847. "🙅🏻",
  11848. "🙅🏼‍♀️",
  11849. "🙅🏼‍♂️",
  11850. "🙅🏼",
  11851. "🙅🏽‍♀️",
  11852. "🙅🏽‍♂️",
  11853. "🙅🏽",
  11854. "🙅🏾‍♀️",
  11855. "🙅🏾‍♂️",
  11856. "🙅🏾",
  11857. "🙅🏿‍♀️",
  11858. "🙅🏿‍♂️",
  11859. "🙅🏿",
  11860. "🙅‍♀️",
  11861. "🙅‍♂️",
  11862. "🙅",
  11863. "🙆🏻‍♀️",
  11864. "🙆🏻‍♂️",
  11865. "🙆🏻",
  11866. "🙆🏼‍♀️",
  11867. "🙆🏼‍♂️",
  11868. "🙆🏼",
  11869. "🙆🏽‍♀️",
  11870. "🙆🏽‍♂️",
  11871. "🙆🏽",
  11872. "🙆🏾‍♀️",
  11873. "🙆🏾‍♂️",
  11874. "🙆🏾",
  11875. "🙆🏿‍♀️",
  11876. "🙆🏿‍♂️",
  11877. "🙆🏿",
  11878. "🙆‍♀️",
  11879. "🙆‍♂️",
  11880. "🙆",
  11881. "🙇🏻‍♀️",
  11882. "🙇🏻‍♂️",
  11883. "🙇🏻",
  11884. "🙇🏼‍♀️",
  11885. "🙇🏼‍♂️",
  11886. "🙇🏼",
  11887. "🙇🏽‍♀️",
  11888. "🙇🏽‍♂️",
  11889. "🙇🏽",
  11890. "🙇🏾‍♀️",
  11891. "🙇🏾‍♂️",
  11892. "🙇🏾",
  11893. "🙇🏿‍♀️",
  11894. "🙇🏿‍♂️",
  11895. "🙇🏿",
  11896. "🙇‍♀️",
  11897. "🙇‍♂️",
  11898. "🙇",
  11899. "🙈",
  11900. "🙉",
  11901. "🙊",
  11902. "🙋🏻‍♀️",
  11903. "🙋🏻‍♂️",
  11904. "🙋🏻",
  11905. "🙋🏼‍♀️",
  11906. "🙋🏼‍♂️",
  11907. "🙋🏼",
  11908. "🙋🏽‍♀️",
  11909. "🙋🏽‍♂️",
  11910. "🙋🏽",
  11911. "🙋🏾‍♀️",
  11912. "🙋🏾‍♂️",
  11913. "🙋🏾",
  11914. "🙋🏿‍♀️",
  11915. "🙋🏿‍♂️",
  11916. "🙋🏿",
  11917. "🙋‍♀️",
  11918. "🙋‍♂️",
  11919. "🙋",
  11920. "🙌🏻",
  11921. "🙌🏼",
  11922. "🙌🏽",
  11923. "🙌🏾",
  11924. "🙌🏿",
  11925. "🙌",
  11926. "🙍🏻‍♀️",
  11927. "🙍🏻‍♂️",
  11928. "🙍🏻",
  11929. "🙍🏼‍♀️",
  11930. "🙍🏼‍♂️",
  11931. "🙍🏼",
  11932. "🙍🏽‍♀️",
  11933. "🙍🏽‍♂️",
  11934. "🙍🏽",
  11935. "🙍🏾‍♀️",
  11936. "🙍🏾‍♂️",
  11937. "🙍🏾",
  11938. "🙍🏿‍♀️",
  11939. "🙍🏿‍♂️",
  11940. "🙍🏿",
  11941. "🙍‍♀️",
  11942. "🙍‍♂️",
  11943. "🙍",
  11944. "🙎🏻‍♀️",
  11945. "🙎🏻‍♂️",
  11946. "🙎🏻",
  11947. "🙎🏼‍♀️",
  11948. "🙎🏼‍♂️",
  11949. "🙎🏼",
  11950. "🙎🏽‍♀️",
  11951. "🙎🏽‍♂️",
  11952. "🙎🏽",
  11953. "🙎🏾‍♀️",
  11954. "🙎🏾‍♂️",
  11955. "🙎🏾",
  11956. "🙎🏿‍♀️",
  11957. "🙎🏿‍♂️",
  11958. "🙎🏿",
  11959. "🙎‍♀️",
  11960. "🙎‍♂️",
  11961. "🙎",
  11962. "🙏🏻",
  11963. "🙏🏼",
  11964. "🙏🏽",
  11965. "🙏🏾",
  11966. "🙏🏿",
  11967. "🙏",
  11968. "🚀",
  11969. "🚁",
  11970. "🚂",
  11971. "🚃",
  11972. "🚄",
  11973. "🚅",
  11974. "🚆",
  11975. "🚇",
  11976. "🚈",
  11977. "🚉",
  11978. "🚊",
  11979. "🚋",
  11980. "🚌",
  11981. "🚍",
  11982. "🚎",
  11983. "🚏",
  11984. "🚐",
  11985. "🚑",
  11986. "🚒",
  11987. "🚓",
  11988. "🚔",
  11989. "🚕",
  11990. "🚖",
  11991. "🚗",
  11992. "🚘",
  11993. "🚙",
  11994. "🚚",
  11995. "🚛",
  11996. "🚜",
  11997. "🚝",
  11998. "🚞",
  11999. "🚟",
  12000. "🚠",
  12001. "🚡",
  12002. "🚢",
  12003. "🚣🏻‍♀️",
  12004. "🚣🏻‍♂️",
  12005. "🚣🏻",
  12006. "🚣🏼‍♀️",
  12007. "🚣🏼‍♂️",
  12008. "🚣🏼",
  12009. "🚣🏽‍♀️",
  12010. "🚣🏽‍♂️",
  12011. "🚣🏽",
  12012. "🚣🏾‍♀️",
  12013. "🚣🏾‍♂️",
  12014. "🚣🏾",
  12015. "🚣🏿‍♀️",
  12016. "🚣🏿‍♂️",
  12017. "🚣🏿",
  12018. "🚣‍♀️",
  12019. "🚣‍♂️",
  12020. "🚣",
  12021. "🚤",
  12022. "🚥",
  12023. "🚦",
  12024. "🚧",
  12025. "🚨",
  12026. "🚩",
  12027. "🚪",
  12028. "🚫",
  12029. "🚬",
  12030. "🚭",
  12031. "🚮",
  12032. "🚯",
  12033. "🚰",
  12034. "🚱",
  12035. "🚲",
  12036. "🚳",
  12037. "🚴🏻‍♀️",
  12038. "🚴🏻‍♂️",
  12039. "🚴🏻",
  12040. "🚴🏼‍♀️",
  12041. "🚴🏼‍♂️",
  12042. "🚴🏼",
  12043. "🚴🏽‍♀️",
  12044. "🚴🏽‍♂️",
  12045. "🚴🏽",
  12046. "🚴🏾‍♀️",
  12047. "🚴🏾‍♂️",
  12048. "🚴🏾",
  12049. "🚴🏿‍♀️",
  12050. "🚴🏿‍♂️",
  12051. "🚴🏿",
  12052. "🚴‍♀️",
  12053. "🚴‍♂️",
  12054. "🚴",
  12055. "🚵🏻‍♀️",
  12056. "🚵🏻‍♂️",
  12057. "🚵🏻",
  12058. "🚵🏼‍♀️",
  12059. "🚵🏼‍♂️",
  12060. "🚵🏼",
  12061. "🚵🏽‍♀️",
  12062. "🚵🏽‍♂️",
  12063. "🚵🏽",
  12064. "🚵🏾‍♀️",
  12065. "🚵🏾‍♂️",
  12066. "🚵🏾",
  12067. "🚵🏿‍♀️",
  12068. "🚵🏿‍♂️",
  12069. "🚵🏿",
  12070. "🚵‍♀️",
  12071. "🚵‍♂️",
  12072. "🚵",
  12073. "🚶🏻‍♀️",
  12074. "🚶🏻‍♂️",
  12075. "🚶🏻",
  12076. "🚶🏼‍♀️",
  12077. "🚶🏼‍♂️",
  12078. "🚶🏼",
  12079. "🚶🏽‍♀️",
  12080. "🚶🏽‍♂️",
  12081. "🚶🏽",
  12082. "🚶🏾‍♀️",
  12083. "🚶🏾‍♂️",
  12084. "🚶🏾",
  12085. "🚶🏿‍♀️",
  12086. "🚶🏿‍♂️",
  12087. "🚶🏿",
  12088. "🚶‍♀️",
  12089. "🚶‍♂️",
  12090. "🚶",
  12091. "🚷",
  12092. "🚸",
  12093. "🚹",
  12094. "🚺",
  12095. "🚻",
  12096. "🚼",
  12097. "🚽",
  12098. "🚾",
  12099. "🚿",
  12100. "🛀🏻",
  12101. "🛀🏼",
  12102. "🛀🏽",
  12103. "🛀🏾",
  12104. "🛀🏿",
  12105. "🛀",
  12106. "🛁",
  12107. "🛂",
  12108. "🛃",
  12109. "🛄",
  12110. "🛅",
  12111. "🛋️",
  12112. "🛌🏻",
  12113. "🛌🏼",
  12114. "🛌🏽",
  12115. "🛌🏾",
  12116. "🛌🏿",
  12117. "🛌",
  12118. "🛍️",
  12119. "🛎️",
  12120. "🛏️",
  12121. "🛐",
  12122. "🛑",
  12123. "🛒",
  12124. "🛕",
  12125. "🛠️",
  12126. "🛡️",
  12127. "🛢️",
  12128. "🛣️",
  12129. "🛤️",
  12130. "🛥️",
  12131. "🛩️",
  12132. "🛫",
  12133. "🛬",
  12134. "🛰️",
  12135. "🛳️",
  12136. "🛴",
  12137. "🛵",
  12138. "🛶",
  12139. "🛷",
  12140. "🛸",
  12141. "🛹",
  12142. "🛺",
  12143. "🟠",
  12144. "🟡",
  12145. "🟢",
  12146. "🟣",
  12147. "🟤",
  12148. "🟥",
  12149. "🟦",
  12150. "🟧",
  12151. "🟨",
  12152. "🟩",
  12153. "🟪",
  12154. "🟫",
  12155. "🤍",
  12156. "🤎",
  12157. "🤏🏻",
  12158. "🤏🏼",
  12159. "🤏🏽",
  12160. "🤏🏾",
  12161. "🤏🏿",
  12162. "🤏",
  12163. "🤐",
  12164. "🤑",
  12165. "🤒",
  12166. "🤓",
  12167. "🤔",
  12168. "🤕",
  12169. "🤖",
  12170. "🤗",
  12171. "🤘🏻",
  12172. "🤘🏼",
  12173. "🤘🏽",
  12174. "🤘🏾",
  12175. "🤘🏿",
  12176. "🤘",
  12177. "🤙🏻",
  12178. "🤙🏼",
  12179. "🤙🏽",
  12180. "🤙🏾",
  12181. "🤙🏿",
  12182. "🤙",
  12183. "🤚🏻",
  12184. "🤚🏼",
  12185. "🤚🏽",
  12186. "🤚🏾",
  12187. "🤚🏿",
  12188. "🤚",
  12189. "🤛🏻",
  12190. "🤛🏼",
  12191. "🤛🏽",
  12192. "🤛🏾",
  12193. "🤛🏿",
  12194. "🤛",
  12195. "🤜🏻",
  12196. "🤜🏼",
  12197. "🤜🏽",
  12198. "🤜🏾",
  12199. "🤜🏿",
  12200. "🤜",
  12201. "🤝",
  12202. "🤞🏻",
  12203. "🤞🏼",
  12204. "🤞🏽",
  12205. "🤞🏾",
  12206. "🤞🏿",
  12207. "🤞",
  12208. "🤟🏻",
  12209. "🤟🏼",
  12210. "🤟🏽",
  12211. "🤟🏾",
  12212. "🤟🏿",
  12213. "🤟",
  12214. "🤠",
  12215. "🤡",
  12216. "🤢",
  12217. "🤣",
  12218. "🤤",
  12219. "🤥",
  12220. "🤦🏻‍♀️",
  12221. "🤦🏻‍♂️",
  12222. "🤦🏻",
  12223. "🤦🏼‍♀️",
  12224. "🤦🏼‍♂️",
  12225. "🤦🏼",
  12226. "🤦🏽‍♀️",
  12227. "🤦🏽‍♂️",
  12228. "🤦🏽",
  12229. "🤦🏾‍♀️",
  12230. "🤦🏾‍♂️",
  12231. "🤦🏾",
  12232. "🤦🏿‍♀️",
  12233. "🤦🏿‍♂️",
  12234. "🤦🏿",
  12235. "🤦‍♀️",
  12236. "🤦‍♂️",
  12237. "🤦",
  12238. "🤧",
  12239. "🤨",
  12240. "🤩",
  12241. "🤪",
  12242. "🤫",
  12243. "🤬",
  12244. "🤭",
  12245. "🤮",
  12246. "🤯",
  12247. "🤰🏻",
  12248. "🤰🏼",
  12249. "🤰🏽",
  12250. "🤰🏾",
  12251. "🤰🏿",
  12252. "🤰",
  12253. "🤱🏻",
  12254. "🤱🏼",
  12255. "🤱🏽",
  12256. "🤱🏾",
  12257. "🤱🏿",
  12258. "🤱",
  12259. "🤲🏻",
  12260. "🤲🏼",
  12261. "🤲🏽",
  12262. "🤲🏾",
  12263. "🤲🏿",
  12264. "🤲",
  12265. "🤳🏻",
  12266. "🤳🏼",
  12267. "🤳🏽",
  12268. "🤳🏾",
  12269. "🤳🏿",
  12270. "🤳",
  12271. "🤴🏻",
  12272. "🤴🏼",
  12273. "🤴🏽",
  12274. "🤴🏾",
  12275. "🤴🏿",
  12276. "🤴",
  12277. "🤵🏻‍♀️",
  12278. "🤵🏻‍♂️",
  12279. "🤵🏻",
  12280. "🤵🏼‍♀️",
  12281. "🤵🏼‍♂️",
  12282. "🤵🏼",
  12283. "🤵🏽‍♀️",
  12284. "🤵🏽‍♂️",
  12285. "🤵🏽",
  12286. "🤵🏾‍♀️",
  12287. "🤵🏾‍♂️",
  12288. "🤵🏾",
  12289. "🤵🏿‍♀️",
  12290. "🤵🏿‍♂️",
  12291. "🤵🏿",
  12292. "🤵‍♀️",
  12293. "🤵‍♂️",
  12294. "🤵",
  12295. "🤶🏻",
  12296. "🤶🏼",
  12297. "🤶🏽",
  12298. "🤶🏾",
  12299. "🤶🏿",
  12300. "🤶",
  12301. "🤷🏻‍♀️",
  12302. "🤷🏻‍♂️",
  12303. "🤷🏻",
  12304. "🤷🏼‍♀️",
  12305. "🤷🏼‍♂️",
  12306. "🤷🏼",
  12307. "🤷🏽‍♀️",
  12308. "🤷🏽‍♂️",
  12309. "🤷🏽",
  12310. "🤷🏾‍♀️",
  12311. "🤷🏾‍♂️",
  12312. "🤷🏾",
  12313. "🤷🏿‍♀️",
  12314. "🤷🏿‍♂️",
  12315. "🤷🏿",
  12316. "🤷‍♀️",
  12317. "🤷‍♂️",
  12318. "🤷",
  12319. "🤸🏻‍♀️",
  12320. "🤸🏻‍♂️",
  12321. "🤸🏻",
  12322. "🤸🏼‍♀️",
  12323. "🤸🏼‍♂️",
  12324. "🤸🏼",
  12325. "🤸🏽‍♀️",
  12326. "🤸🏽‍♂️",
  12327. "🤸🏽",
  12328. "🤸🏾‍♀️",
  12329. "🤸🏾‍♂️",
  12330. "🤸🏾",
  12331. "🤸🏿‍♀️",
  12332. "🤸🏿‍♂️",
  12333. "🤸🏿",
  12334. "🤸‍♀️",
  12335. "🤸‍♂️",
  12336. "🤸",
  12337. "🤹🏻‍♀️",
  12338. "🤹🏻‍♂️",
  12339. "🤹🏻",
  12340. "🤹🏼‍♀️",
  12341. "🤹🏼‍♂️",
  12342. "🤹🏼",
  12343. "🤹🏽‍♀️",
  12344. "🤹🏽‍♂️",
  12345. "🤹🏽",
  12346. "🤹🏾‍♀️",
  12347. "🤹🏾‍♂️",
  12348. "🤹🏾",
  12349. "🤹🏿‍♀️",
  12350. "🤹🏿‍♂️",
  12351. "🤹🏿",
  12352. "🤹‍♀️",
  12353. "🤹‍♂️",
  12354. "🤹",
  12355. "🤺",
  12356. "🤼‍♀️",
  12357. "🤼‍♂️",
  12358. "🤼",
  12359. "🤽🏻‍♀️",
  12360. "🤽🏻‍♂️",
  12361. "🤽🏻",
  12362. "🤽🏼‍♀️",
  12363. "🤽🏼‍♂️",
  12364. "🤽🏼",
  12365. "🤽🏽‍♀️",
  12366. "🤽🏽‍♂️",
  12367. "🤽🏽",
  12368. "🤽🏾‍♀️",
  12369. "🤽🏾‍♂️",
  12370. "🤽🏾",
  12371. "🤽🏿‍♀️",
  12372. "🤽🏿‍♂️",
  12373. "🤽🏿",
  12374. "🤽‍♀️",
  12375. "🤽‍♂️",
  12376. "🤽",
  12377. "🤾🏻‍♀️",
  12378. "🤾🏻‍♂️",
  12379. "🤾🏻",
  12380. "🤾🏼‍♀️",
  12381. "🤾🏼‍♂️",
  12382. "🤾🏼",
  12383. "🤾🏽‍♀️",
  12384. "🤾🏽‍♂️",
  12385. "🤾🏽",
  12386. "🤾🏾‍♀️",
  12387. "🤾🏾‍♂️",
  12388. "🤾🏾",
  12389. "🤾🏿‍♀️",
  12390. "🤾🏿‍♂️",
  12391. "🤾🏿",
  12392. "🤾‍♀️",
  12393. "🤾‍♂️",
  12394. "🤾",
  12395. "🤿",
  12396. "🥀",
  12397. "🥁",
  12398. "🥂",
  12399. "🥃",
  12400. "🥄",
  12401. "🥅",
  12402. "🥇",
  12403. "🥈",
  12404. "🥉",
  12405. "🥊",
  12406. "🥋",
  12407. "🥌",
  12408. "🥍",
  12409. "🥎",
  12410. "🥏",
  12411. "🥐",
  12412. "🥑",
  12413. "🥒",
  12414. "🥓",
  12415. "🥔",
  12416. "🥕",
  12417. "🥖",
  12418. "🥗",
  12419. "🥘",
  12420. "🥙",
  12421. "🥚",
  12422. "🥛",
  12423. "🥜",
  12424. "🥝",
  12425. "🥞",
  12426. "🥟",
  12427. "🥠",
  12428. "🥡",
  12429. "🥢",
  12430. "🥣",
  12431. "🥤",
  12432. "🥥",
  12433. "🥦",
  12434. "🥧",
  12435. "🥨",
  12436. "🥩",
  12437. "🥪",
  12438. "🥫",
  12439. "🥬",
  12440. "🥭",
  12441. "🥮",
  12442. "🥯",
  12443. "🥰",
  12444. "🥱",
  12445. "🥳",
  12446. "🥴",
  12447. "🥵",
  12448. "🥶",
  12449. "🥺",
  12450. "🥻",
  12451. "🥼",
  12452. "🥽",
  12453. "🥾",
  12454. "🥿",
  12455. "🦀",
  12456. "🦁",
  12457. "🦂",
  12458. "🦃",
  12459. "🦄",
  12460. "🦅",
  12461. "🦆",
  12462. "🦇",
  12463. "🦈",
  12464. "🦉",
  12465. "🦊",
  12466. "🦋",
  12467. "🦌",
  12468. "🦍",
  12469. "🦎",
  12470. "🦏",
  12471. "🦐",
  12472. "🦑",
  12473. "🦒",
  12474. "🦓",
  12475. "🦔",
  12476. "🦕",
  12477. "🦖",
  12478. "🦗",
  12479. "🦘",
  12480. "🦙",
  12481. "🦚",
  12482. "🦛",
  12483. "🦜",
  12484. "🦝",
  12485. "🦞",
  12486. "🦟",
  12487. "🦠",
  12488. "🦡",
  12489. "🦢",
  12490. "🦥",
  12491. "🦦",
  12492. "🦧",
  12493. "🦨",
  12494. "🦩",
  12495. "🦪",
  12496. "🦮",
  12497. "🦯",
  12498. "🦰",
  12499. "🦱",
  12500. "🦲",
  12501. "🦳",
  12502. "🦴",
  12503. "🦵🏻",
  12504. "🦵🏼",
  12505. "🦵🏽",
  12506. "🦵🏾",
  12507. "🦵🏿",
  12508. "🦵",
  12509. "🦶🏻",
  12510. "🦶🏼",
  12511. "🦶🏽",
  12512. "🦶🏾",
  12513. "🦶🏿",
  12514. "🦶",
  12515. "🦷",
  12516. "🦸🏻‍♀️",
  12517. "🦸🏻‍♂️",
  12518. "🦸🏻",
  12519. "🦸🏼‍♀️",
  12520. "🦸🏼‍♂️",
  12521. "🦸🏼",
  12522. "🦸🏽‍♀️",
  12523. "🦸🏽‍♂️",
  12524. "🦸🏽",
  12525. "🦸🏾‍♀️",
  12526. "🦸🏾‍♂️",
  12527. "🦸🏾",
  12528. "🦸🏿‍♀️",
  12529. "🦸🏿‍♂️",
  12530. "🦸🏿",
  12531. "🦸‍♀️",
  12532. "🦸‍♂️",
  12533. "🦸",
  12534. "🦹🏻‍♀️",
  12535. "🦹🏻‍♂️",
  12536. "🦹🏻",
  12537. "🦹🏼‍♀️",
  12538. "🦹🏼‍♂️",
  12539. "🦹🏼",
  12540. "🦹🏽‍♀️",
  12541. "🦹🏽‍♂️",
  12542. "🦹🏽",
  12543. "🦹🏾‍♀️",
  12544. "🦹🏾‍♂️",
  12545. "🦹🏾",
  12546. "🦹🏿‍♀️",
  12547. "🦹🏿‍♂️",
  12548. "🦹🏿",
  12549. "🦹‍♀️",
  12550. "🦹‍♂️",
  12551. "🦹",
  12552. "🦺",
  12553. "🦻🏻",
  12554. "🦻🏼",
  12555. "🦻🏽",
  12556. "🦻🏾",
  12557. "🦻🏿",
  12558. "🦻",
  12559. "🦼",
  12560. "🦽",
  12561. "🦾",
  12562. "🦿",
  12563. "🧀",
  12564. "🧁",
  12565. "🧂",
  12566. "🧃",
  12567. "🧄",
  12568. "🧅",
  12569. "🧆",
  12570. "🧇",
  12571. "🧈",
  12572. "🧉",
  12573. "🧊",
  12574. "🧍🏻‍♀️",
  12575. "🧍🏻‍♂️",
  12576. "🧍🏻",
  12577. "🧍🏼‍♀️",
  12578. "🧍🏼‍♂️",
  12579. "🧍🏼",
  12580. "🧍🏽‍♀️",
  12581. "🧍🏽‍♂️",
  12582. "🧍🏽",
  12583. "🧍🏾‍♀️",
  12584. "🧍🏾‍♂️",
  12585. "🧍🏾",
  12586. "🧍🏿‍♀️",
  12587. "🧍🏿‍♂️",
  12588. "🧍🏿",
  12589. "🧍‍♀️",
  12590. "🧍‍♂️",
  12591. "🧍",
  12592. "🧎🏻‍♀️",
  12593. "🧎🏻‍♂️",
  12594. "🧎🏻",
  12595. "🧎🏼‍♀️",
  12596. "🧎🏼‍♂️",
  12597. "🧎🏼",
  12598. "🧎🏽‍♀️",
  12599. "🧎🏽‍♂️",
  12600. "🧎🏽",
  12601. "🧎🏾‍♀️",
  12602. "🧎🏾‍♂️",
  12603. "🧎🏾",
  12604. "🧎🏿‍♀️",
  12605. "🧎🏿‍♂️",
  12606. "🧎🏿",
  12607. "🧎‍♀️",
  12608. "🧎‍♂️",
  12609. "🧎",
  12610. "🧏🏻‍♀️",
  12611. "🧏🏻‍♂️",
  12612. "🧏🏻",
  12613. "🧏🏼‍♀️",
  12614. "🧏🏼‍♂️",
  12615. "🧏🏼",
  12616. "🧏🏽‍♀️",
  12617. "🧏🏽‍♂️",
  12618. "🧏🏽",
  12619. "🧏🏾‍♀️",
  12620. "🧏🏾‍♂️",
  12621. "🧏🏾",
  12622. "🧏🏿‍♀️",
  12623. "🧏🏿‍♂️",
  12624. "🧏🏿",
  12625. "🧏‍♀️",
  12626. "🧏‍♂️",
  12627. "🧏",
  12628. "🧐",
  12629. "🧑🏻‍🤝‍🧑🏻",
  12630. "🧑🏻",
  12631. "🧑🏼‍🤝‍🧑🏻",
  12632. "🧑🏼‍🤝‍🧑🏼",
  12633. "🧑🏼",
  12634. "🧑🏽‍🤝‍🧑🏻",
  12635. "🧑🏽‍🤝‍🧑🏼",
  12636. "🧑🏽‍🤝‍🧑🏽",
  12637. "🧑🏽",
  12638. "🧑🏾‍🤝‍🧑🏻",
  12639. "🧑🏾‍🤝‍🧑🏼",
  12640. "🧑🏾‍🤝‍🧑🏽",
  12641. "🧑🏾‍🤝‍🧑🏾",
  12642. "🧑🏾",
  12643. "🧑🏿‍🤝‍🧑🏻",
  12644. "🧑🏿‍🤝‍🧑🏼",
  12645. "🧑🏿‍🤝‍🧑🏽",
  12646. "🧑🏿‍🤝‍🧑🏾",
  12647. "🧑🏿‍🤝‍🧑🏿",
  12648. "🧑🏿",
  12649. "🧑‍🤝‍🧑",
  12650. "🧑",
  12651. "🧒🏻",
  12652. "🧒🏼",
  12653. "🧒🏽",
  12654. "🧒🏾",
  12655. "🧒🏿",
  12656. "🧒",
  12657. "🧓🏻",
  12658. "🧓🏼",
  12659. "🧓🏽",
  12660. "🧓🏾",
  12661. "🧓🏿",
  12662. "🧓",
  12663. "🧔🏻",
  12664. "🧔🏼",
  12665. "🧔🏽",
  12666. "🧔🏾",
  12667. "🧔🏿",
  12668. "🧔",
  12669. "🧕🏻",
  12670. "🧕🏼",
  12671. "🧕🏽",
  12672. "🧕🏾",
  12673. "🧕🏿",
  12674. "🧕",
  12675. "🧖🏻‍♀️",
  12676. "🧖🏻‍♂️",
  12677. "🧖🏻",
  12678. "🧖🏼‍♀️",
  12679. "🧖🏼‍♂️",
  12680. "🧖🏼",
  12681. "🧖🏽‍♀️",
  12682. "🧖🏽‍♂️",
  12683. "🧖🏽",
  12684. "🧖🏾‍♀️",
  12685. "🧖🏾‍♂️",
  12686. "🧖🏾",
  12687. "🧖🏿‍♀️",
  12688. "🧖🏿‍♂️",
  12689. "🧖🏿",
  12690. "🧖‍♀️",
  12691. "🧖‍♂️",
  12692. "🧖",
  12693. "🧗🏻‍♀️",
  12694. "🧗🏻‍♂️",
  12695. "🧗🏻",
  12696. "🧗🏼‍♀️",
  12697. "🧗🏼‍♂️",
  12698. "🧗🏼",
  12699. "🧗🏽‍♀️",
  12700. "🧗🏽‍♂️",
  12701. "🧗🏽",
  12702. "🧗🏾‍♀️",
  12703. "🧗🏾‍♂️",
  12704. "🧗🏾",
  12705. "🧗🏿‍♀️",
  12706. "🧗🏿‍♂️",
  12707. "🧗🏿",
  12708. "🧗‍♀️",
  12709. "🧗‍♂️",
  12710. "🧗",
  12711. "🧘🏻‍♀️",
  12712. "🧘🏻‍♂️",
  12713. "🧘🏻",
  12714. "🧘🏼‍♀️",
  12715. "🧘🏼‍♂️",
  12716. "🧘🏼",
  12717. "🧘🏽‍♀️",
  12718. "🧘🏽‍♂️",
  12719. "🧘🏽",
  12720. "🧘🏾‍♀️",
  12721. "🧘🏾‍♂️",
  12722. "🧘🏾",
  12723. "🧘🏿‍♀️",
  12724. "🧘🏿‍♂️",
  12725. "🧘🏿",
  12726. "🧘‍♀️",
  12727. "🧘‍♂️",
  12728. "🧘",
  12729. "🧙🏻‍♀️",
  12730. "🧙🏻‍♂️",
  12731. "🧙🏻",
  12732. "🧙🏼‍♀️",
  12733. "🧙🏼‍♂️",
  12734. "🧙🏼",
  12735. "🧙🏽‍♀️",
  12736. "🧙🏽‍♂️",
  12737. "🧙🏽",
  12738. "🧙🏾‍♀️",
  12739. "🧙🏾‍♂️",
  12740. "🧙🏾",
  12741. "🧙🏿‍♀️",
  12742. "🧙🏿‍♂️",
  12743. "🧙🏿",
  12744. "🧙‍♀️",
  12745. "🧙‍♂️",
  12746. "🧙",
  12747. "🧚🏻‍♀️",
  12748. "🧚🏻‍♂️",
  12749. "🧚🏻",
  12750. "🧚🏼‍♀️",
  12751. "🧚🏼‍♂️",
  12752. "🧚🏼",
  12753. "🧚🏽‍♀️",
  12754. "🧚🏽‍♂️",
  12755. "🧚🏽",
  12756. "🧚🏾‍♀️",
  12757. "🧚🏾‍♂️",
  12758. "🧚🏾",
  12759. "🧚🏿‍♀️",
  12760. "🧚🏿‍♂️",
  12761. "🧚🏿",
  12762. "🧚‍♀️",
  12763. "🧚‍♂️",
  12764. "🧚",
  12765. "🧛🏻‍♀️",
  12766. "🧛🏻‍♂️",
  12767. "🧛🏻",
  12768. "🧛🏼‍♀️",
  12769. "🧛🏼‍♂️",
  12770. "🧛🏼",
  12771. "🧛🏽‍♀️",
  12772. "🧛🏽‍♂️",
  12773. "🧛🏽",
  12774. "🧛🏾‍♀️",
  12775. "🧛🏾‍♂️",
  12776. "🧛🏾",
  12777. "🧛🏿‍♀️",
  12778. "🧛🏿‍♂️",
  12779. "🧛🏿",
  12780. "🧛‍♀️",
  12781. "🧛‍♂️",
  12782. "🧛",
  12783. "🧜🏻‍♀️",
  12784. "🧜🏻‍♂️",
  12785. "🧜🏻",
  12786. "🧜🏼‍♀️",
  12787. "🧜🏼‍♂️",
  12788. "🧜🏼",
  12789. "🧜🏽‍♀️",
  12790. "🧜🏽‍♂️",
  12791. "🧜🏽",
  12792. "🧜🏾‍♀️",
  12793. "🧜🏾‍♂️",
  12794. "🧜🏾",
  12795. "🧜🏿‍♀️",
  12796. "🧜🏿‍♂️",
  12797. "🧜🏿",
  12798. "🧜‍♀️",
  12799. "🧜‍♂️",
  12800. "🧜",
  12801. "🧝🏻‍♀️",
  12802. "🧝🏻‍♂️",
  12803. "🧝🏻",
  12804. "🧝🏼‍♀️",
  12805. "🧝🏼‍♂️",
  12806. "🧝🏼",
  12807. "🧝🏽‍♀️",
  12808. "🧝🏽‍♂️",
  12809. "🧝🏽",
  12810. "🧝🏾‍♀️",
  12811. "🧝🏾‍♂️",
  12812. "🧝🏾",
  12813. "🧝🏿‍♀️",
  12814. "🧝🏿‍♂️",
  12815. "🧝🏿",
  12816. "🧝‍♀️",
  12817. "🧝‍♂️",
  12818. "🧝",
  12819. "🧞‍♀️",
  12820. "🧞‍♂️",
  12821. "🧞",
  12822. "🧟‍♀️",
  12823. "🧟‍♂️",
  12824. "🧟",
  12825. "🧠",
  12826. "🧡",
  12827. "🧢",
  12828. "🧣",
  12829. "🧤",
  12830. "🧥",
  12831. "🧦",
  12832. "🧧",
  12833. "🧨",
  12834. "🧩",
  12835. "🧪",
  12836. "🧫",
  12837. "🧬",
  12838. "🧭",
  12839. "🧮",
  12840. "🧯",
  12841. "🧰",
  12842. "🧱",
  12843. "🧲",
  12844. "🧳",
  12845. "🧴",
  12846. "🧵",
  12847. "🧶",
  12848. "🧷",
  12849. "🧸",
  12850. "🧹",
  12851. "🧺",
  12852. "🧻",
  12853. "🧼",
  12854. "🧽",
  12855. "🧾",
  12856. "🧿",
  12857. "🩰",
  12858. "🩱",
  12859. "🩲",
  12860. "🩳",
  12861. "🩸",
  12862. "🩹",
  12863. "🩺",
  12864. "🪀",
  12865. "🪁",
  12866. "🪂",
  12867. "🪐",
  12868. "🪑",
  12869. "🪒",
  12870. "🪓",
  12871. "🪔",
  12872. "🪕",
  12873. "‼️",
  12874. "⁉️",
  12875. "™️",
  12876. "ℹ️",
  12877. "↔️",
  12878. "↕️",
  12879. "↖️",
  12880. "↗️",
  12881. "↘️",
  12882. "↙️",
  12883. "↩️",
  12884. "↪️",
  12885. "#⃣",
  12886. "⌚️",
  12887. "⌛️",
  12888. "⌨️",
  12889. "⏏️",
  12890. "⏩",
  12891. "⏪",
  12892. "⏫",
  12893. "⏬",
  12894. "⏭️",
  12895. "⏮️",
  12896. "⏯️",
  12897. "⏰",
  12898. "⏱️",
  12899. "⏲️",
  12900. "⏳",
  12901. "⏸️",
  12902. "⏹️",
  12903. "⏺️",
  12904. "Ⓜ️",
  12905. "▪️",
  12906. "▫️",
  12907. "▶️",
  12908. "◀️",
  12909. "◻️",
  12910. "◼️",
  12911. "◽️",
  12912. "◾️",
  12913. "☀️",
  12914. "☁️",
  12915. "☂️",
  12916. "☃️",
  12917. "☄️",
  12918. "☎️",
  12919. "☑️",
  12920. "☔️",
  12921. "☕️",
  12922. "☘️",
  12923. "☝🏻",
  12924. "☝🏼",
  12925. "☝🏽",
  12926. "☝🏾",
  12927. "☝🏿",
  12928. "☝️",
  12929. "☠️",
  12930. "☢️",
  12931. "☣️",
  12932. "☦️",
  12933. "☪️",
  12934. "☮️",
  12935. "☯️",
  12936. "☸️",
  12937. "☹️",
  12938. "☺️",
  12939. "♀️",
  12940. "♂️",
  12941. "♈️",
  12942. "♉️",
  12943. "♊️",
  12944. "♋️",
  12945. "♌️",
  12946. "♍️",
  12947. "♎️",
  12948. "♏️",
  12949. "♐️",
  12950. "♑️",
  12951. "♒️",
  12952. "♓️",
  12953. "♟️",
  12954. "♠️",
  12955. "♣️",
  12956. "♥️",
  12957. "♦️",
  12958. "♨️",
  12959. "♻️",
  12960. "♾",
  12961. "♿️",
  12962. "⚒️",
  12963. "⚓️",
  12964. "⚔️",
  12965. "⚕️",
  12966. "⚖️",
  12967. "⚗️",
  12968. "⚙️",
  12969. "⚛️",
  12970. "⚜️",
  12971. "⚠️",
  12972. "⚡️",
  12973. "⚪️",
  12974. "⚫️",
  12975. "⚰️",
  12976. "⚱️",
  12977. "⚽️",
  12978. "⚾️",
  12979. "⛄️",
  12980. "⛅️",
  12981. "⛈️",
  12982. "⛎",
  12983. "⛏️",
  12984. "⛑️",
  12985. "⛓️",
  12986. "⛔️",
  12987. "⛩️",
  12988. "⛪️",
  12989. "⛰️",
  12990. "⛱️",
  12991. "⛲️",
  12992. "⛳️",
  12993. "⛴️",
  12994. "⛵️",
  12995. "⛷🏻",
  12996. "⛷🏼",
  12997. "⛷🏽",
  12998. "⛷🏾",
  12999. "⛷🏿",
  13000. "⛷️",
  13001. "⛸️",
  13002. "⛹🏻‍♀️",
  13003. "⛹🏻‍♂️",
  13004. "⛹🏻",
  13005. "⛹🏼‍♀️",
  13006. "⛹🏼‍♂️",
  13007. "⛹🏼",
  13008. "⛹🏽‍♀️",
  13009. "⛹🏽‍♂️",
  13010. "⛹🏽",
  13011. "⛹🏾‍♀️",
  13012. "⛹🏾‍♂️",
  13013. "⛹🏾",
  13014. "⛹🏿‍♀️",
  13015. "⛹🏿‍♂️",
  13016. "⛹🏿",
  13017. "⛹️‍♀️",
  13018. "⛹️‍♂️",
  13019. "⛹️",
  13020. "⛺️",
  13021. "⛽️",
  13022. "✂️",
  13023. "✅",
  13024. "✈️",
  13025. "✉️",
  13026. "✊🏻",
  13027. "✊🏼",
  13028. "✊🏽",
  13029. "✊🏾",
  13030. "✊🏿",
  13031. "✊",
  13032. "✋🏻",
  13033. "✋🏼",
  13034. "✋🏽",
  13035. "✋🏾",
  13036. "✋🏿",
  13037. "✋",
  13038. "✌🏻",
  13039. "✌🏼",
  13040. "✌🏽",
  13041. "✌🏾",
  13042. "✌🏿",
  13043. "✌️",
  13044. "✍🏻",
  13045. "✍🏼",
  13046. "✍🏽",
  13047. "✍🏾",
  13048. "✍🏿",
  13049. "✍️",
  13050. "✏️",
  13051. "✒️",
  13052. "✔️",
  13053. "✖️",
  13054. "✝️",
  13055. "✡️",
  13056. "✨",
  13057. "✳️",
  13058. "✴️",
  13059. "❄️",
  13060. "❇️",
  13061. "❌",
  13062. "❎",
  13063. "❓",
  13064. "❔",
  13065. "❕",
  13066. "❗️",
  13067. "❣️",
  13068. "❤️",
  13069. "➕",
  13070. "➖",
  13071. "➗",
  13072. "➡️",
  13073. "➰",
  13074. "➿",
  13075. "⤴️",
  13076. "⤵️",
  13077. "*⃣",
  13078. "⬅️",
  13079. "⬆️",
  13080. "⬇️",
  13081. "⬛️",
  13082. "⬜️",
  13083. "⭐️",
  13084. "⭕️",
  13085. "0⃣",
  13086. "〰️",
  13087. "〽️",
  13088. "1⃣",
  13089. "2⃣",
  13090. "㊗️",
  13091. "㊙️",
  13092. "3⃣",
  13093. "4⃣",
  13094. "5⃣",
  13095. "6⃣",
  13096. "7⃣",
  13097. "8⃣",
  13098. "9⃣",
  13099. "©️",
  13100. "®️",
  13101. ""
  13102. ];
  13103. const emojiRegex = /[\uD800-\uDFFF]./;
  13104. const emojiList = emojisList.filter((emoji) => emojiRegex.test(emoji));
  13105. const emojiCache = {};
  13106. function encodeStringToEmoji(content, length) {
  13107. if (emojiCache[content]) {
  13108. return emojiCache[content];
  13109. }
  13110. length = length || 1;
  13111. const emojis = [];
  13112. do {
  13113. if (!emojiList.length) {
  13114. throw new Error('Ran out of emoji');
  13115. }
  13116. const index = Math.floor(Math.random() * emojiList.length);
  13117. emojis.push(emojiList[index]);
  13118. emojiList.splice(index, 1);
  13119. } while (--length > 0);
  13120. const emojiEncoding = emojis.join('');
  13121. emojiCache[content] = emojiEncoding;
  13122. return emojiEncoding;
  13123. }
  13124. function interpolateName(loaderContext, name, options) {
  13125. let filename;
  13126. const hasQuery =
  13127. loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1;
  13128. if (typeof name === 'function') {
  13129. filename = name(
  13130. loaderContext.resourcePath,
  13131. hasQuery ? loaderContext.resourceQuery : undefined
  13132. );
  13133. } else {
  13134. filename = name || '[hash].[ext]';
  13135. }
  13136. const context = options.context;
  13137. const content = options.content;
  13138. const regExp = options.regExp;
  13139. let ext = 'bin';
  13140. let basename = 'file';
  13141. let directory = '';
  13142. let folder = '';
  13143. let query = '';
  13144. if (loaderContext.resourcePath) {
  13145. const parsed = path__default.parse(loaderContext.resourcePath);
  13146. let resourcePath = loaderContext.resourcePath;
  13147. if (parsed.ext) {
  13148. ext = parsed.ext.substr(1);
  13149. }
  13150. if (parsed.dir) {
  13151. basename = parsed.name;
  13152. resourcePath = parsed.dir + path__default.sep;
  13153. }
  13154. if (typeof context !== 'undefined') {
  13155. directory = path__default
  13156. .relative(context, resourcePath + '_')
  13157. .replace(/\\/g, '/')
  13158. .replace(/\.\.(\/)?/g, '_$1');
  13159. directory = directory.substr(0, directory.length - 1);
  13160. } else {
  13161. directory = resourcePath.replace(/\\/g, '/').replace(/\.\.(\/)?/g, '_$1');
  13162. }
  13163. if (directory.length === 1) {
  13164. directory = '';
  13165. } else if (directory.length > 1) {
  13166. folder = path__default.basename(directory);
  13167. }
  13168. }
  13169. if (loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1) {
  13170. query = loaderContext.resourceQuery;
  13171. const hashIdx = query.indexOf('#');
  13172. if (hashIdx >= 0) {
  13173. query = query.substr(0, hashIdx);
  13174. }
  13175. }
  13176. let url = filename;
  13177. if (content) {
  13178. // Match hash template
  13179. url = url
  13180. // `hash` and `contenthash` are same in `loader-utils` context
  13181. // let's keep `hash` for backward compatibility
  13182. .replace(
  13183. /\[(?:([^:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi,
  13184. (all, hashType, digestType, maxLength) =>
  13185. getHashDigest_1(content, hashType, digestType, parseInt(maxLength, 10))
  13186. )
  13187. .replace(/\[emoji(?::(\d+))?\]/gi, (all, length) =>
  13188. encodeStringToEmoji(content, parseInt(length, 10))
  13189. );
  13190. }
  13191. url = url
  13192. .replace(/\[ext\]/gi, () => ext)
  13193. .replace(/\[name\]/gi, () => basename)
  13194. .replace(/\[path\]/gi, () => directory)
  13195. .replace(/\[folder\]/gi, () => folder)
  13196. .replace(/\[query\]/gi, () => query);
  13197. if (regExp && loaderContext.resourcePath) {
  13198. const match = loaderContext.resourcePath.match(new RegExp(regExp));
  13199. match &&
  13200. match.forEach((matched, i) => {
  13201. url = url.replace(new RegExp('\\[' + i + '\\]', 'ig'), matched);
  13202. });
  13203. }
  13204. if (
  13205. typeof loaderContext.options === 'object' &&
  13206. typeof loaderContext.options.customInterpolateName === 'function'
  13207. ) {
  13208. url = loaderContext.options.customInterpolateName.call(
  13209. loaderContext,
  13210. url,
  13211. name,
  13212. options
  13213. );
  13214. }
  13215. return url;
  13216. }
  13217. var interpolateName_1 = interpolateName;
  13218. var getOptions_1$1 = getOptions_1;
  13219. var parseQuery_1$1 = parseQuery_1;
  13220. var stringifyRequest_1$1 = stringifyRequest_1;
  13221. var getRemainingRequest_1$1 = getRemainingRequest_1;
  13222. var getCurrentRequest_1$1 = getCurrentRequest_1;
  13223. var isUrlRequest_1$1 = isUrlRequest_1;
  13224. var urlToRequest_1$1 = urlToRequest_1;
  13225. var parseString_1$1 = parseString_1;
  13226. var getHashDigest_1$1 = getHashDigest_1;
  13227. var interpolateName_1$1 = interpolateName_1;
  13228. var lib$1 = {
  13229. getOptions: getOptions_1$1,
  13230. parseQuery: parseQuery_1$1,
  13231. stringifyRequest: stringifyRequest_1$1,
  13232. getRemainingRequest: getRemainingRequest_1$1,
  13233. getCurrentRequest: getCurrentRequest_1$1,
  13234. isUrlRequest: isUrlRequest_1$1,
  13235. urlToRequest: urlToRequest_1$1,
  13236. parseString: parseString_1$1,
  13237. getHashDigest: getHashDigest_1$1,
  13238. interpolateName: interpolateName_1$1
  13239. };
  13240. var interpolateName$1 = lib$1.interpolateName;
  13241. /**
  13242. * @param {string} pattern
  13243. * @param {object} options
  13244. * @param {string} options.context
  13245. * @param {string} options.hashPrefix
  13246. * @return {function}
  13247. */
  13248. var genericNames = function createGenerator(pattern, options) {
  13249. options = options || {};
  13250. var context =
  13251. options && typeof options.context === "string"
  13252. ? options.context
  13253. : process.cwd();
  13254. var hashPrefix =
  13255. options && typeof options.hashPrefix === "string" ? options.hashPrefix : "";
  13256. /**
  13257. * @param {string} localName Usually a class name
  13258. * @param {string} filepath Absolute path
  13259. * @return {string}
  13260. */
  13261. return function generate(localName, filepath) {
  13262. var name = pattern.replace(/\[local\]/gi, localName);
  13263. var loaderContext = {
  13264. resourcePath: filepath
  13265. };
  13266. var loaderOptions = {
  13267. content:
  13268. hashPrefix +
  13269. path__default.relative(context, filepath).replace(/\\/g, "/") +
  13270. "+" +
  13271. localName,
  13272. context: context
  13273. };
  13274. var genericName = interpolateName$1(loaderContext, name, loaderOptions);
  13275. return genericName
  13276. .replace(new RegExp("[^a-zA-Z0-9\\-_\u00A0-\uFFFF]", "g"), "-")
  13277. .replace(/^((-?[0-9])|--)/, "_$1");
  13278. };
  13279. };
  13280. var _default = unquote;
  13281. // copied from https://github.com/lakenen/node-unquote
  13282. var reg = /['"]/;
  13283. function unquote(str) {
  13284. if (!str) {
  13285. return "";
  13286. }
  13287. if (reg.test(str.charAt(0))) {
  13288. str = str.substr(1);
  13289. }
  13290. if (reg.test(str.charAt(str.length - 1))) {
  13291. str = str.substr(0, str.length - 1);
  13292. }
  13293. return str;
  13294. }
  13295. var unquote_1 = /*#__PURE__*/Object.defineProperty({
  13296. default: _default
  13297. }, '__esModule', {value: true});
  13298. var replaceAll_1 = replaceAll;
  13299. var matchConstName = /[$#]?[\w-\.]+/g;
  13300. function replaceAll(replacements, text) {
  13301. var matches = void 0;
  13302. while (matches = matchConstName.exec(text)) {
  13303. var replacement = replacements[matches[0]];
  13304. if (replacement) {
  13305. text = text.slice(0, matches.index) + replacement + text.slice(matchConstName.lastIndex);
  13306. matchConstName.lastIndex -= matches[0].length - replacement.length;
  13307. }
  13308. }
  13309. return text;
  13310. }
  13311. var _default$1 = function (css, translations) {
  13312. css.walkDecls(function (decl) {
  13313. return decl.value = replaceAll(translations, decl.value);
  13314. });
  13315. css.walkAtRules('media', function (atRule) {
  13316. return atRule.params = replaceAll(translations, atRule.params);
  13317. });
  13318. };
  13319. var lib$2 = /*#__PURE__*/Object.defineProperty({
  13320. replaceAll: replaceAll_1,
  13321. default: _default$1
  13322. }, '__esModule', {value: true});
  13323. var _icssReplaceSymbols2 = _interopRequireDefault(lib$2);
  13324. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13325. // Copied from https://github.com/css-modules/css-modules-loader-core
  13326. const importRegexp = /^:import\((.+)\)$/;
  13327. class Parser {
  13328. constructor(pathFetcher, trace) {
  13329. this.pathFetcher = pathFetcher;
  13330. this.plugin = this.plugin.bind(this);
  13331. this.exportTokens = {};
  13332. this.translations = {};
  13333. this.trace = trace;
  13334. }
  13335. plugin() {
  13336. const parser = this;
  13337. return {
  13338. postcssPlugin: "css-modules-parser",
  13339. OnceExit(css) {
  13340. return Promise.all(parser.fetchAllImports(css)).then(() => parser.linkImportedSymbols(css)).then(() => parser.extractExports(css));
  13341. }
  13342. };
  13343. }
  13344. fetchAllImports(css) {
  13345. let imports = [];
  13346. css.each(node => {
  13347. if (node.type == "rule" && node.selector.match(importRegexp)) {
  13348. imports.push(this.fetchImport(node, css.source.input.from, imports.length));
  13349. }
  13350. });
  13351. return imports;
  13352. }
  13353. linkImportedSymbols(css) {
  13354. (0, _icssReplaceSymbols2.default)(css, this.translations);
  13355. }
  13356. extractExports(css) {
  13357. css.each(node => {
  13358. if (node.type == "rule" && node.selector == ":export") this.handleExport(node);
  13359. });
  13360. }
  13361. handleExport(exportNode) {
  13362. exportNode.each(decl => {
  13363. if (decl.type == "decl") {
  13364. Object.keys(this.translations).forEach(translation => {
  13365. decl.value = decl.value.replace(translation, this.translations[translation]);
  13366. });
  13367. this.exportTokens[decl.prop] = decl.value;
  13368. }
  13369. });
  13370. exportNode.remove();
  13371. }
  13372. fetchImport(importNode, relativeTo, depNr) {
  13373. let file = importNode.selector.match(importRegexp)[1],
  13374. depTrace = this.trace + String.fromCharCode(depNr);
  13375. return this.pathFetcher(file, relativeTo, depTrace).then(exports => {
  13376. importNode.each(decl => {
  13377. if (decl.type == "decl") {
  13378. this.translations[decl.prop] = exports[decl.value];
  13379. }
  13380. });
  13381. importNode.remove();
  13382. }, err => console.log(err));
  13383. }
  13384. }
  13385. var _default$2 = Parser;
  13386. var parser$1 = /*#__PURE__*/Object.defineProperty({
  13387. default: _default$2
  13388. }, '__esModule', {value: true});
  13389. var _postcss2 = _interopRequireDefault$1(_postcss__default);
  13390. var _fs2 = _interopRequireDefault$1(fs__default);
  13391. var _path2 = _interopRequireDefault$1(path__default);
  13392. var _parser2 = _interopRequireDefault$1(parser$1);
  13393. function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13394. // Copied from https://github.com/css-modules/css-modules-loader-core
  13395. class Core {
  13396. constructor(plugins) {
  13397. this.plugins = plugins || Core.defaultPlugins;
  13398. }
  13399. load(sourceString, sourcePath, trace, pathFetcher) {
  13400. let parser = new _parser2.default(pathFetcher, trace);
  13401. return (0, _postcss2.default)(this.plugins.concat([parser.plugin()])).process(sourceString, { from: "/" + sourcePath }).then(result => {
  13402. return {
  13403. injectableSource: result.css,
  13404. exportTokens: parser.exportTokens
  13405. };
  13406. });
  13407. }
  13408. }
  13409. // Sorts dependencies in the following way:
  13410. // AAA comes before AA and A
  13411. // AB comes after AA and before A
  13412. // All Bs come after all As
  13413. // This ensures that the files are always returned in the following order:
  13414. // - In the order they were required, except
  13415. // - After all their dependencies
  13416. const traceKeySorter = (a, b) => {
  13417. if (a.length < b.length) {
  13418. return a < b.substring(0, a.length) ? -1 : 1;
  13419. } else if (a.length > b.length) {
  13420. return a.substring(0, b.length) <= b ? -1 : 1;
  13421. } else {
  13422. return a < b ? -1 : 1;
  13423. }
  13424. };
  13425. class FileSystemLoader {
  13426. constructor(root, plugins) {
  13427. this.root = root;
  13428. this.sources = {};
  13429. this.traces = {};
  13430. this.importNr = 0;
  13431. this.core = new Core(plugins);
  13432. this.tokensByFile = {};
  13433. }
  13434. fetch(_newPath, relativeTo, _trace) {
  13435. let newPath = _newPath.replace(/^["']|["']$/g, ""),
  13436. trace = _trace || String.fromCharCode(this.importNr++);
  13437. return new Promise((resolve, reject) => {
  13438. let relativeDir = _path2.default.dirname(relativeTo),
  13439. rootRelativePath = _path2.default.resolve(relativeDir, newPath),
  13440. fileRelativePath = _path2.default.resolve(_path2.default.join(this.root, relativeDir), newPath);
  13441. // if the path is not relative or absolute, try to resolve it in node_modules
  13442. if (newPath[0] !== "." && newPath[0] !== "/") {
  13443. try {
  13444. fileRelativePath = require.resolve(newPath);
  13445. } catch (e) {
  13446. // noop
  13447. }
  13448. }
  13449. const tokens = this.tokensByFile[fileRelativePath];
  13450. if (tokens) {
  13451. return resolve(tokens);
  13452. }
  13453. _fs2.default.readFile(fileRelativePath, "utf-8", (err, source) => {
  13454. if (err) reject(err);
  13455. this.core.load(source, rootRelativePath, trace, this.fetch.bind(this)).then(({ injectableSource, exportTokens }) => {
  13456. this.sources[fileRelativePath] = injectableSource;
  13457. this.traces[trace] = fileRelativePath;
  13458. this.tokensByFile[fileRelativePath] = exportTokens;
  13459. resolve(exportTokens);
  13460. }, reject);
  13461. });
  13462. });
  13463. }
  13464. get finalSource() {
  13465. const traces = this.traces;
  13466. const sources = this.sources;
  13467. let written = new Set();
  13468. return Object.keys(traces).sort(traceKeySorter).map(key => {
  13469. const filename = traces[key];
  13470. if (written.has(filename)) {
  13471. return null;
  13472. }
  13473. written.add(filename);
  13474. return sources[filename];
  13475. }).join("");
  13476. }
  13477. }
  13478. var _default$3 = FileSystemLoader;
  13479. var loader = /*#__PURE__*/Object.defineProperty({
  13480. default: _default$3
  13481. }, '__esModule', {value: true});
  13482. function hash(str) {
  13483. var hash = 5381,
  13484. i = str.length;
  13485. while(i) {
  13486. hash = (hash * 33) ^ str.charCodeAt(--i);
  13487. }
  13488. /* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
  13489. * integers. Since we want the results to be always positive, convert the
  13490. * signed int to an unsigned by doing an unsigned bitshift. */
  13491. return hash >>> 0;
  13492. }
  13493. var stringHash = hash;
  13494. var _default$4 = generateScopedName;
  13495. var _stringHash2 = _interopRequireDefault$2(stringHash);
  13496. function _interopRequireDefault$2(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13497. function generateScopedName(name, filename, css) {
  13498. const i = css.indexOf(`.${name}`);
  13499. const lineNumber = css.substr(0, i).split(/[\r\n]/).length;
  13500. const hash = (0, _stringHash2.default)(css).toString(36).substr(0, 5);
  13501. return `_${name}_${hash}_${lineNumber}`;
  13502. }
  13503. var generateScopedName_1 = /*#__PURE__*/Object.defineProperty({
  13504. default: _default$4
  13505. }, '__esModule', {value: true});
  13506. var _default$5 = saveJSON;
  13507. function saveJSON(cssFile, json) {
  13508. return new Promise((resolve, reject) => {
  13509. (0, fs__default.writeFile)(`${cssFile}.json`, JSON.stringify(json), e => e ? reject(e) : resolve(json));
  13510. });
  13511. }
  13512. var saveJSON_1 = /*#__PURE__*/Object.defineProperty({
  13513. default: _default$5
  13514. }, '__esModule', {value: true});
  13515. var openParentheses = "(".charCodeAt(0);
  13516. var closeParentheses = ")".charCodeAt(0);
  13517. var singleQuote = "'".charCodeAt(0);
  13518. var doubleQuote = '"'.charCodeAt(0);
  13519. var backslash = "\\".charCodeAt(0);
  13520. var slash = "/".charCodeAt(0);
  13521. var comma = ",".charCodeAt(0);
  13522. var colon = ":".charCodeAt(0);
  13523. var star = "*".charCodeAt(0);
  13524. var uLower = "u".charCodeAt(0);
  13525. var uUpper = "U".charCodeAt(0);
  13526. var plus = "+".charCodeAt(0);
  13527. var isUnicodeRange = /^[a-f0-9?-]+$/i;
  13528. var parse$2 = function(input) {
  13529. var tokens = [];
  13530. var value = input;
  13531. var next,
  13532. quote,
  13533. prev,
  13534. token,
  13535. escape,
  13536. escapePos,
  13537. whitespacePos,
  13538. parenthesesOpenPos;
  13539. var pos = 0;
  13540. var code = value.charCodeAt(pos);
  13541. var max = value.length;
  13542. var stack = [{ nodes: tokens }];
  13543. var balanced = 0;
  13544. var parent;
  13545. var name = "";
  13546. var before = "";
  13547. var after = "";
  13548. while (pos < max) {
  13549. // Whitespaces
  13550. if (code <= 32) {
  13551. next = pos;
  13552. do {
  13553. next += 1;
  13554. code = value.charCodeAt(next);
  13555. } while (code <= 32);
  13556. token = value.slice(pos, next);
  13557. prev = tokens[tokens.length - 1];
  13558. if (code === closeParentheses && balanced) {
  13559. after = token;
  13560. } else if (prev && prev.type === "div") {
  13561. prev.after = token;
  13562. prev.sourceEndIndex += token.length;
  13563. } else if (
  13564. code === comma ||
  13565. code === colon ||
  13566. (code === slash &&
  13567. value.charCodeAt(next + 1) !== star &&
  13568. (!parent ||
  13569. (parent && parent.type === "function" && parent.value !== "calc")))
  13570. ) {
  13571. before = token;
  13572. } else {
  13573. tokens.push({
  13574. type: "space",
  13575. sourceIndex: pos,
  13576. sourceEndIndex: next,
  13577. value: token
  13578. });
  13579. }
  13580. pos = next;
  13581. // Quotes
  13582. } else if (code === singleQuote || code === doubleQuote) {
  13583. next = pos;
  13584. quote = code === singleQuote ? "'" : '"';
  13585. token = {
  13586. type: "string",
  13587. sourceIndex: pos,
  13588. quote: quote
  13589. };
  13590. do {
  13591. escape = false;
  13592. next = value.indexOf(quote, next + 1);
  13593. if (~next) {
  13594. escapePos = next;
  13595. while (value.charCodeAt(escapePos - 1) === backslash) {
  13596. escapePos -= 1;
  13597. escape = !escape;
  13598. }
  13599. } else {
  13600. value += quote;
  13601. next = value.length - 1;
  13602. token.unclosed = true;
  13603. }
  13604. } while (escape);
  13605. token.value = value.slice(pos + 1, next);
  13606. token.sourceEndIndex = token.unclosed ? next : next + 1;
  13607. tokens.push(token);
  13608. pos = next + 1;
  13609. code = value.charCodeAt(pos);
  13610. // Comments
  13611. } else if (code === slash && value.charCodeAt(pos + 1) === star) {
  13612. next = value.indexOf("*/", pos);
  13613. token = {
  13614. type: "comment",
  13615. sourceIndex: pos,
  13616. sourceEndIndex: next + 2
  13617. };
  13618. if (next === -1) {
  13619. token.unclosed = true;
  13620. next = value.length;
  13621. token.sourceEndIndex = next;
  13622. }
  13623. token.value = value.slice(pos + 2, next);
  13624. tokens.push(token);
  13625. pos = next + 2;
  13626. code = value.charCodeAt(pos);
  13627. // Operation within calc
  13628. } else if (
  13629. (code === slash || code === star) &&
  13630. parent &&
  13631. parent.type === "function" &&
  13632. parent.value === "calc"
  13633. ) {
  13634. token = value[pos];
  13635. tokens.push({
  13636. type: "word",
  13637. sourceIndex: pos - before.length,
  13638. sourceEndIndex: pos + token.length,
  13639. value: token
  13640. });
  13641. pos += 1;
  13642. code = value.charCodeAt(pos);
  13643. // Dividers
  13644. } else if (code === slash || code === comma || code === colon) {
  13645. token = value[pos];
  13646. tokens.push({
  13647. type: "div",
  13648. sourceIndex: pos - before.length,
  13649. sourceEndIndex: pos + token.length,
  13650. value: token,
  13651. before: before,
  13652. after: ""
  13653. });
  13654. before = "";
  13655. pos += 1;
  13656. code = value.charCodeAt(pos);
  13657. // Open parentheses
  13658. } else if (openParentheses === code) {
  13659. // Whitespaces after open parentheses
  13660. next = pos;
  13661. do {
  13662. next += 1;
  13663. code = value.charCodeAt(next);
  13664. } while (code <= 32);
  13665. parenthesesOpenPos = pos;
  13666. token = {
  13667. type: "function",
  13668. sourceIndex: pos - name.length,
  13669. value: name,
  13670. before: value.slice(parenthesesOpenPos + 1, next)
  13671. };
  13672. pos = next;
  13673. if (name === "url" && code !== singleQuote && code !== doubleQuote) {
  13674. next -= 1;
  13675. do {
  13676. escape = false;
  13677. next = value.indexOf(")", next + 1);
  13678. if (~next) {
  13679. escapePos = next;
  13680. while (value.charCodeAt(escapePos - 1) === backslash) {
  13681. escapePos -= 1;
  13682. escape = !escape;
  13683. }
  13684. } else {
  13685. value += ")";
  13686. next = value.length - 1;
  13687. token.unclosed = true;
  13688. }
  13689. } while (escape);
  13690. // Whitespaces before closed
  13691. whitespacePos = next;
  13692. do {
  13693. whitespacePos -= 1;
  13694. code = value.charCodeAt(whitespacePos);
  13695. } while (code <= 32);
  13696. if (parenthesesOpenPos < whitespacePos) {
  13697. if (pos !== whitespacePos + 1) {
  13698. token.nodes = [
  13699. {
  13700. type: "word",
  13701. sourceIndex: pos,
  13702. sourceEndIndex: whitespacePos + 1,
  13703. value: value.slice(pos, whitespacePos + 1)
  13704. }
  13705. ];
  13706. } else {
  13707. token.nodes = [];
  13708. }
  13709. if (token.unclosed && whitespacePos + 1 !== next) {
  13710. token.after = "";
  13711. token.nodes.push({
  13712. type: "space",
  13713. sourceIndex: whitespacePos + 1,
  13714. sourceEndIndex: next,
  13715. value: value.slice(whitespacePos + 1, next)
  13716. });
  13717. } else {
  13718. token.after = value.slice(whitespacePos + 1, next);
  13719. token.sourceEndIndex = next;
  13720. }
  13721. } else {
  13722. token.after = "";
  13723. token.nodes = [];
  13724. }
  13725. pos = next + 1;
  13726. token.sourceEndIndex = token.unclosed ? next : pos;
  13727. code = value.charCodeAt(pos);
  13728. tokens.push(token);
  13729. } else {
  13730. balanced += 1;
  13731. token.after = "";
  13732. token.sourceEndIndex = pos + 1;
  13733. tokens.push(token);
  13734. stack.push(token);
  13735. tokens = token.nodes = [];
  13736. parent = token;
  13737. }
  13738. name = "";
  13739. // Close parentheses
  13740. } else if (closeParentheses === code && balanced) {
  13741. pos += 1;
  13742. code = value.charCodeAt(pos);
  13743. parent.after = after;
  13744. parent.sourceEndIndex += after.length;
  13745. after = "";
  13746. balanced -= 1;
  13747. stack[stack.length - 1].sourceEndIndex = pos;
  13748. stack.pop();
  13749. parent = stack[balanced];
  13750. tokens = parent.nodes;
  13751. // Words
  13752. } else {
  13753. next = pos;
  13754. do {
  13755. if (code === backslash) {
  13756. next += 1;
  13757. }
  13758. next += 1;
  13759. code = value.charCodeAt(next);
  13760. } while (
  13761. next < max &&
  13762. !(
  13763. code <= 32 ||
  13764. code === singleQuote ||
  13765. code === doubleQuote ||
  13766. code === comma ||
  13767. code === colon ||
  13768. code === slash ||
  13769. code === openParentheses ||
  13770. (code === star &&
  13771. parent &&
  13772. parent.type === "function" &&
  13773. parent.value === "calc") ||
  13774. (code === slash &&
  13775. parent.type === "function" &&
  13776. parent.value === "calc") ||
  13777. (code === closeParentheses && balanced)
  13778. )
  13779. );
  13780. token = value.slice(pos, next);
  13781. if (openParentheses === code) {
  13782. name = token;
  13783. } else if (
  13784. (uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) &&
  13785. plus === token.charCodeAt(1) &&
  13786. isUnicodeRange.test(token.slice(2))
  13787. ) {
  13788. tokens.push({
  13789. type: "unicode-range",
  13790. sourceIndex: pos,
  13791. sourceEndIndex: next,
  13792. value: token
  13793. });
  13794. } else {
  13795. tokens.push({
  13796. type: "word",
  13797. sourceIndex: pos,
  13798. sourceEndIndex: next,
  13799. value: token
  13800. });
  13801. }
  13802. pos = next;
  13803. }
  13804. }
  13805. for (pos = stack.length - 1; pos; pos -= 1) {
  13806. stack[pos].unclosed = true;
  13807. stack[pos].sourceEndIndex = value.length;
  13808. }
  13809. return stack[0].nodes;
  13810. };
  13811. var walk = function walk(nodes, cb, bubble) {
  13812. var i, max, node, result;
  13813. for (i = 0, max = nodes.length; i < max; i += 1) {
  13814. node = nodes[i];
  13815. if (!bubble) {
  13816. result = cb(node, i, nodes);
  13817. }
  13818. if (
  13819. result !== false &&
  13820. node.type === "function" &&
  13821. Array.isArray(node.nodes)
  13822. ) {
  13823. walk(node.nodes, cb, bubble);
  13824. }
  13825. if (bubble) {
  13826. cb(node, i, nodes);
  13827. }
  13828. }
  13829. };
  13830. function stringifyNode(node, custom) {
  13831. var type = node.type;
  13832. var value = node.value;
  13833. var buf;
  13834. var customResult;
  13835. if (custom && (customResult = custom(node)) !== undefined) {
  13836. return customResult;
  13837. } else if (type === "word" || type === "space") {
  13838. return value;
  13839. } else if (type === "string") {
  13840. buf = node.quote || "";
  13841. return buf + value + (node.unclosed ? "" : buf);
  13842. } else if (type === "comment") {
  13843. return "/*" + value + (node.unclosed ? "" : "*/");
  13844. } else if (type === "div") {
  13845. return (node.before || "") + value + (node.after || "");
  13846. } else if (Array.isArray(node.nodes)) {
  13847. buf = stringify$1(node.nodes, custom);
  13848. if (type !== "function") {
  13849. return buf;
  13850. }
  13851. return (
  13852. value +
  13853. "(" +
  13854. (node.before || "") +
  13855. buf +
  13856. (node.after || "") +
  13857. (node.unclosed ? "" : ")")
  13858. );
  13859. }
  13860. return value;
  13861. }
  13862. function stringify$1(nodes, custom) {
  13863. var result, i;
  13864. if (Array.isArray(nodes)) {
  13865. result = "";
  13866. for (i = nodes.length - 1; ~i; i -= 1) {
  13867. result = stringifyNode(nodes[i], custom) + result;
  13868. }
  13869. return result;
  13870. }
  13871. return stringifyNode(nodes, custom);
  13872. }
  13873. var stringify_1$1 = stringify$1;
  13874. var minus = "-".charCodeAt(0);
  13875. var plus$1 = "+".charCodeAt(0);
  13876. var dot = ".".charCodeAt(0);
  13877. var exp = "e".charCodeAt(0);
  13878. var EXP = "E".charCodeAt(0);
  13879. // Check if three code points would start a number
  13880. // https://www.w3.org/TR/css-syntax-3/#starts-with-a-number
  13881. function likeNumber(value) {
  13882. var code = value.charCodeAt(0);
  13883. var nextCode;
  13884. if (code === plus$1 || code === minus) {
  13885. nextCode = value.charCodeAt(1);
  13886. if (nextCode >= 48 && nextCode <= 57) {
  13887. return true;
  13888. }
  13889. var nextNextCode = value.charCodeAt(2);
  13890. if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) {
  13891. return true;
  13892. }
  13893. return false;
  13894. }
  13895. if (code === dot) {
  13896. nextCode = value.charCodeAt(1);
  13897. if (nextCode >= 48 && nextCode <= 57) {
  13898. return true;
  13899. }
  13900. return false;
  13901. }
  13902. if (code >= 48 && code <= 57) {
  13903. return true;
  13904. }
  13905. return false;
  13906. }
  13907. // Consume a number
  13908. // https://www.w3.org/TR/css-syntax-3/#consume-number
  13909. var unit = function(value) {
  13910. var pos = 0;
  13911. var length = value.length;
  13912. var code;
  13913. var nextCode;
  13914. var nextNextCode;
  13915. if (length === 0 || !likeNumber(value)) {
  13916. return false;
  13917. }
  13918. code = value.charCodeAt(pos);
  13919. if (code === plus$1 || code === minus) {
  13920. pos++;
  13921. }
  13922. while (pos < length) {
  13923. code = value.charCodeAt(pos);
  13924. if (code < 48 || code > 57) {
  13925. break;
  13926. }
  13927. pos += 1;
  13928. }
  13929. code = value.charCodeAt(pos);
  13930. nextCode = value.charCodeAt(pos + 1);
  13931. if (code === dot && nextCode >= 48 && nextCode <= 57) {
  13932. pos += 2;
  13933. while (pos < length) {
  13934. code = value.charCodeAt(pos);
  13935. if (code < 48 || code > 57) {
  13936. break;
  13937. }
  13938. pos += 1;
  13939. }
  13940. }
  13941. code = value.charCodeAt(pos);
  13942. nextCode = value.charCodeAt(pos + 1);
  13943. nextNextCode = value.charCodeAt(pos + 2);
  13944. if (
  13945. (code === exp || code === EXP) &&
  13946. ((nextCode >= 48 && nextCode <= 57) ||
  13947. ((nextCode === plus$1 || nextCode === minus) &&
  13948. nextNextCode >= 48 &&
  13949. nextNextCode <= 57))
  13950. ) {
  13951. pos += nextCode === plus$1 || nextCode === minus ? 3 : 2;
  13952. while (pos < length) {
  13953. code = value.charCodeAt(pos);
  13954. if (code < 48 || code > 57) {
  13955. break;
  13956. }
  13957. pos += 1;
  13958. }
  13959. }
  13960. return {
  13961. number: value.slice(0, pos),
  13962. unit: value.slice(pos)
  13963. };
  13964. };
  13965. function ValueParser(value) {
  13966. if (this instanceof ValueParser) {
  13967. this.nodes = parse$2(value);
  13968. return this;
  13969. }
  13970. return new ValueParser(value);
  13971. }
  13972. ValueParser.prototype.toString = function() {
  13973. return Array.isArray(this.nodes) ? stringify_1$1(this.nodes) : "";
  13974. };
  13975. ValueParser.prototype.walk = function(cb, bubble) {
  13976. walk(this.nodes, cb, bubble);
  13977. return this;
  13978. };
  13979. ValueParser.unit = unit;
  13980. ValueParser.walk = walk;
  13981. ValueParser.stringify = stringify_1$1;
  13982. var lib$3 = ValueParser;
  13983. const matchValueName = /[$]?[\w-]+/g;
  13984. const replaceValueSymbols = (value, replacements) => {
  13985. let matches;
  13986. while ((matches = matchValueName.exec(value))) {
  13987. const replacement = replacements[matches[0]];
  13988. if (replacement) {
  13989. value =
  13990. value.slice(0, matches.index) +
  13991. replacement +
  13992. value.slice(matchValueName.lastIndex);
  13993. matchValueName.lastIndex -= matches[0].length - replacement.length;
  13994. }
  13995. }
  13996. return value;
  13997. };
  13998. var replaceValueSymbols_1 = replaceValueSymbols;
  13999. const replaceSymbols = (css, replacements) => {
  14000. css.walk((node) => {
  14001. if (node.type === "decl" && node.value) {
  14002. node.value = replaceValueSymbols_1(node.value.toString(), replacements);
  14003. } else if (node.type === "rule" && node.selector) {
  14004. node.selector = replaceValueSymbols_1(
  14005. node.selector.toString(),
  14006. replacements
  14007. );
  14008. } else if (node.type === "atrule" && node.params) {
  14009. node.params = replaceValueSymbols_1(node.params.toString(), replacements);
  14010. }
  14011. });
  14012. };
  14013. var replaceSymbols_1 = replaceSymbols;
  14014. const importPattern = /^:import\(("[^"]*"|'[^']*'|[^"']+)\)$/;
  14015. const balancedQuotes = /^("[^"]*"|'[^']*'|[^"']+)$/;
  14016. const getDeclsObject = (rule) => {
  14017. const object = {};
  14018. rule.walkDecls((decl) => {
  14019. const before = decl.raws.before ? decl.raws.before.trim() : "";
  14020. object[before + decl.prop] = decl.value;
  14021. });
  14022. return object;
  14023. };
  14024. /**
  14025. *
  14026. * @param {string} css
  14027. * @param {boolean} removeRules
  14028. * @param {'auto' | 'rule' | 'at-rule'} mode
  14029. */
  14030. const extractICSS = (css, removeRules = true, mode = "auto") => {
  14031. const icssImports = {};
  14032. const icssExports = {};
  14033. function addImports(node, path) {
  14034. const unquoted = path.replace(/'|"/g, "");
  14035. icssImports[unquoted] = Object.assign(
  14036. icssImports[unquoted] || {},
  14037. getDeclsObject(node)
  14038. );
  14039. if (removeRules) {
  14040. node.remove();
  14041. }
  14042. }
  14043. function addExports(node) {
  14044. Object.assign(icssExports, getDeclsObject(node));
  14045. if (removeRules) {
  14046. node.remove();
  14047. }
  14048. }
  14049. css.each((node) => {
  14050. if (node.type === "rule" && mode !== "at-rule") {
  14051. if (node.selector.slice(0, 7) === ":import") {
  14052. const matches = importPattern.exec(node.selector);
  14053. if (matches) {
  14054. addImports(node, matches[1]);
  14055. }
  14056. }
  14057. if (node.selector === ":export") {
  14058. addExports(node);
  14059. }
  14060. }
  14061. if (node.type === "atrule" && mode !== "rule") {
  14062. if (node.name === "icss-import") {
  14063. const matches = balancedQuotes.exec(node.params);
  14064. if (matches) {
  14065. addImports(node, matches[1]);
  14066. }
  14067. }
  14068. if (node.name === "icss-export") {
  14069. addExports(node);
  14070. }
  14071. }
  14072. });
  14073. return { icssImports, icssExports };
  14074. };
  14075. var extractICSS_1 = extractICSS;
  14076. const createImports = (imports, postcss, mode = "rule") => {
  14077. return Object.keys(imports).map((path) => {
  14078. const aliases = imports[path];
  14079. const declarations = Object.keys(aliases).map((key) =>
  14080. postcss.decl({
  14081. prop: key,
  14082. value: aliases[key],
  14083. raws: { before: "\n " },
  14084. })
  14085. );
  14086. const hasDeclarations = declarations.length > 0;
  14087. const rule =
  14088. mode === "rule"
  14089. ? postcss.rule({
  14090. selector: `:import('${path}')`,
  14091. raws: { after: hasDeclarations ? "\n" : "" },
  14092. })
  14093. : postcss.atRule({
  14094. name: "icss-import",
  14095. params: `'${path}'`,
  14096. raws: { after: hasDeclarations ? "\n" : "" },
  14097. });
  14098. if (hasDeclarations) {
  14099. rule.append(declarations);
  14100. }
  14101. return rule;
  14102. });
  14103. };
  14104. const createExports = (exports, postcss, mode = "rule") => {
  14105. const declarations = Object.keys(exports).map((key) =>
  14106. postcss.decl({
  14107. prop: key,
  14108. value: exports[key],
  14109. raws: { before: "\n " },
  14110. })
  14111. );
  14112. if (declarations.length === 0) {
  14113. return [];
  14114. }
  14115. const rule =
  14116. mode === "rule"
  14117. ? postcss.rule({
  14118. selector: `:export`,
  14119. raws: { after: "\n" },
  14120. })
  14121. : postcss.atRule({
  14122. name: "icss-export",
  14123. raws: { after: "\n" },
  14124. });
  14125. rule.append(declarations);
  14126. return [rule];
  14127. };
  14128. const createICSSRules = (imports, exports, postcss, mode) => [
  14129. ...createImports(imports, postcss, mode),
  14130. ...createExports(exports, postcss, mode),
  14131. ];
  14132. var createICSSRules_1 = createICSSRules;
  14133. var src = {
  14134. replaceValueSymbols: replaceValueSymbols_1,
  14135. replaceSymbols: replaceSymbols_1,
  14136. extractICSS: extractICSS_1,
  14137. createICSSRules: createICSSRules_1,
  14138. };
  14139. const { extractICSS: extractICSS$1 } = src;
  14140. const isSpacing = (node) => node.type === "combinator" && node.value === " ";
  14141. function normalizeNodeArray(nodes) {
  14142. const array = [];
  14143. nodes.forEach((x) => {
  14144. if (Array.isArray(x)) {
  14145. normalizeNodeArray(x).forEach((item) => {
  14146. array.push(item);
  14147. });
  14148. } else if (x) {
  14149. array.push(x);
  14150. }
  14151. });
  14152. if (array.length > 0 && isSpacing(array[array.length - 1])) {
  14153. array.pop();
  14154. }
  14155. return array;
  14156. }
  14157. function localizeNode(rule, mode, localAliasMap) {
  14158. const transform = (node, context) => {
  14159. if (context.ignoreNextSpacing && !isSpacing(node)) {
  14160. throw new Error("Missing whitespace after " + context.ignoreNextSpacing);
  14161. }
  14162. if (context.enforceNoSpacing && isSpacing(node)) {
  14163. throw new Error("Missing whitespace before " + context.enforceNoSpacing);
  14164. }
  14165. let newNodes;
  14166. switch (node.type) {
  14167. case "root": {
  14168. let resultingGlobal;
  14169. context.hasPureGlobals = false;
  14170. newNodes = node.nodes.map((n) => {
  14171. const nContext = {
  14172. global: context.global,
  14173. lastWasSpacing: true,
  14174. hasLocals: false,
  14175. explicit: false,
  14176. };
  14177. n = transform(n, nContext);
  14178. if (typeof resultingGlobal === "undefined") {
  14179. resultingGlobal = nContext.global;
  14180. } else if (resultingGlobal !== nContext.global) {
  14181. throw new Error(
  14182. 'Inconsistent rule global/local result in rule "' +
  14183. node +
  14184. '" (multiple selectors must result in the same mode for the rule)'
  14185. );
  14186. }
  14187. if (!nContext.hasLocals) {
  14188. context.hasPureGlobals = true;
  14189. }
  14190. return n;
  14191. });
  14192. context.global = resultingGlobal;
  14193. node.nodes = normalizeNodeArray(newNodes);
  14194. break;
  14195. }
  14196. case "selector": {
  14197. newNodes = node.map((childNode) => transform(childNode, context));
  14198. node = node.clone();
  14199. node.nodes = normalizeNodeArray(newNodes);
  14200. break;
  14201. }
  14202. case "combinator": {
  14203. if (isSpacing(node)) {
  14204. if (context.ignoreNextSpacing) {
  14205. context.ignoreNextSpacing = false;
  14206. context.lastWasSpacing = false;
  14207. context.enforceNoSpacing = false;
  14208. return null;
  14209. }
  14210. context.lastWasSpacing = true;
  14211. return node;
  14212. }
  14213. break;
  14214. }
  14215. case "pseudo": {
  14216. let childContext;
  14217. const isNested = !!node.length;
  14218. const isScoped = node.value === ":local" || node.value === ":global";
  14219. const isImportExport =
  14220. node.value === ":import" || node.value === ":export";
  14221. if (isImportExport) {
  14222. context.hasLocals = true;
  14223. // :local(.foo)
  14224. } else if (isNested) {
  14225. if (isScoped) {
  14226. if (node.nodes.length === 0) {
  14227. throw new Error(`${node.value}() can't be empty`);
  14228. }
  14229. if (context.inside) {
  14230. throw new Error(
  14231. `A ${node.value} is not allowed inside of a ${context.inside}(...)`
  14232. );
  14233. }
  14234. childContext = {
  14235. global: node.value === ":global",
  14236. inside: node.value,
  14237. hasLocals: false,
  14238. explicit: true,
  14239. };
  14240. newNodes = node
  14241. .map((childNode) => transform(childNode, childContext))
  14242. .reduce((acc, next) => acc.concat(next.nodes), []);
  14243. if (newNodes.length) {
  14244. const { before, after } = node.spaces;
  14245. const first = newNodes[0];
  14246. const last = newNodes[newNodes.length - 1];
  14247. first.spaces = { before, after: first.spaces.after };
  14248. last.spaces = { before: last.spaces.before, after };
  14249. }
  14250. node = newNodes;
  14251. break;
  14252. } else {
  14253. childContext = {
  14254. global: context.global,
  14255. inside: context.inside,
  14256. lastWasSpacing: true,
  14257. hasLocals: false,
  14258. explicit: context.explicit,
  14259. };
  14260. newNodes = node.map((childNode) =>
  14261. transform(childNode, childContext)
  14262. );
  14263. node = node.clone();
  14264. node.nodes = normalizeNodeArray(newNodes);
  14265. if (childContext.hasLocals) {
  14266. context.hasLocals = true;
  14267. }
  14268. }
  14269. break;
  14270. //:local .foo .bar
  14271. } else if (isScoped) {
  14272. if (context.inside) {
  14273. throw new Error(
  14274. `A ${node.value} is not allowed inside of a ${context.inside}(...)`
  14275. );
  14276. }
  14277. const addBackSpacing = !!node.spaces.before;
  14278. context.ignoreNextSpacing = context.lastWasSpacing
  14279. ? node.value
  14280. : false;
  14281. context.enforceNoSpacing = context.lastWasSpacing
  14282. ? false
  14283. : node.value;
  14284. context.global = node.value === ":global";
  14285. context.explicit = true;
  14286. // because this node has spacing that is lost when we remove it
  14287. // we make up for it by adding an extra combinator in since adding
  14288. // spacing on the parent selector doesn't work
  14289. return addBackSpacing
  14290. ? dist.combinator({ value: " " })
  14291. : null;
  14292. }
  14293. break;
  14294. }
  14295. case "id":
  14296. case "class": {
  14297. if (!node.value) {
  14298. throw new Error("Invalid class or id selector syntax");
  14299. }
  14300. if (context.global) {
  14301. break;
  14302. }
  14303. const isImportedValue = localAliasMap.has(node.value);
  14304. const isImportedWithExplicitScope = isImportedValue && context.explicit;
  14305. if (!isImportedValue || isImportedWithExplicitScope) {
  14306. const innerNode = node.clone();
  14307. innerNode.spaces = { before: "", after: "" };
  14308. node = dist.pseudo({
  14309. value: ":local",
  14310. nodes: [innerNode],
  14311. spaces: node.spaces,
  14312. });
  14313. context.hasLocals = true;
  14314. }
  14315. break;
  14316. }
  14317. }
  14318. context.lastWasSpacing = false;
  14319. context.ignoreNextSpacing = false;
  14320. context.enforceNoSpacing = false;
  14321. return node;
  14322. };
  14323. const rootContext = {
  14324. global: mode === "global",
  14325. hasPureGlobals: false,
  14326. };
  14327. rootContext.selector = dist((root) => {
  14328. transform(root, rootContext);
  14329. }).processSync(rule, { updateSelector: false, lossless: true });
  14330. return rootContext;
  14331. }
  14332. function localizeDeclNode(node, context) {
  14333. switch (node.type) {
  14334. case "word":
  14335. if (context.localizeNextItem) {
  14336. if (!context.localAliasMap.has(node.value)) {
  14337. node.value = ":local(" + node.value + ")";
  14338. context.localizeNextItem = false;
  14339. }
  14340. }
  14341. break;
  14342. case "function":
  14343. if (
  14344. context.options &&
  14345. context.options.rewriteUrl &&
  14346. node.value.toLowerCase() === "url"
  14347. ) {
  14348. node.nodes.map((nestedNode) => {
  14349. if (nestedNode.type !== "string" && nestedNode.type !== "word") {
  14350. return;
  14351. }
  14352. let newUrl = context.options.rewriteUrl(
  14353. context.global,
  14354. nestedNode.value
  14355. );
  14356. switch (nestedNode.type) {
  14357. case "string":
  14358. if (nestedNode.quote === "'") {
  14359. newUrl = newUrl.replace(/(\\)/g, "\\$1").replace(/'/g, "\\'");
  14360. }
  14361. if (nestedNode.quote === '"') {
  14362. newUrl = newUrl.replace(/(\\)/g, "\\$1").replace(/"/g, '\\"');
  14363. }
  14364. break;
  14365. case "word":
  14366. newUrl = newUrl.replace(/("|'|\)|\\)/g, "\\$1");
  14367. break;
  14368. }
  14369. nestedNode.value = newUrl;
  14370. });
  14371. }
  14372. break;
  14373. }
  14374. return node;
  14375. }
  14376. function isWordAFunctionArgument(wordNode, functionNode) {
  14377. return functionNode
  14378. ? functionNode.nodes.some(
  14379. (functionNodeChild) =>
  14380. functionNodeChild.sourceIndex === wordNode.sourceIndex
  14381. )
  14382. : false;
  14383. }
  14384. function localizeDeclarationValues(localize, declaration, context) {
  14385. const valueNodes = lib$3(declaration.value);
  14386. valueNodes.walk((node, index, nodes) => {
  14387. const subContext = {
  14388. options: context.options,
  14389. global: context.global,
  14390. localizeNextItem: localize && !context.global,
  14391. localAliasMap: context.localAliasMap,
  14392. };
  14393. nodes[index] = localizeDeclNode(node, subContext);
  14394. });
  14395. declaration.value = valueNodes.toString();
  14396. }
  14397. function localizeDeclaration(declaration, context) {
  14398. const isAnimation = /animation$/i.test(declaration.prop);
  14399. if (isAnimation) {
  14400. const validIdent = /^-?[_a-z][_a-z0-9-]*$/i;
  14401. /*
  14402. The spec defines some keywords that you can use to describe properties such as the timing
  14403. function. These are still valid animation names, so as long as there is a property that accepts
  14404. a keyword, it is given priority. Only when all the properties that can take a keyword are
  14405. exhausted can the animation name be set to the keyword. I.e.
  14406. animation: infinite infinite;
  14407. The animation will repeat an infinite number of times from the first argument, and will have an
  14408. animation name of infinite from the second.
  14409. */
  14410. const animationKeywords = {
  14411. $alternate: 1,
  14412. "$alternate-reverse": 1,
  14413. $backwards: 1,
  14414. $both: 1,
  14415. $ease: 1,
  14416. "$ease-in": 1,
  14417. "$ease-in-out": 1,
  14418. "$ease-out": 1,
  14419. $forwards: 1,
  14420. $infinite: 1,
  14421. $linear: 1,
  14422. $none: Infinity, // No matter how many times you write none, it will never be an animation name
  14423. $normal: 1,
  14424. $paused: 1,
  14425. $reverse: 1,
  14426. $running: 1,
  14427. "$step-end": 1,
  14428. "$step-start": 1,
  14429. $initial: Infinity,
  14430. $inherit: Infinity,
  14431. $unset: Infinity,
  14432. };
  14433. let parsedAnimationKeywords = {};
  14434. let stepsFunctionNode = null;
  14435. const valueNodes = lib$3(declaration.value).walk((node) => {
  14436. /* If div-token appeared (represents as comma ','), a possibility of an animation-keywords should be reflesh. */
  14437. if (node.type === "div") {
  14438. parsedAnimationKeywords = {};
  14439. }
  14440. if (node.type === "function" && node.value.toLowerCase() === "steps") {
  14441. stepsFunctionNode = node;
  14442. }
  14443. const value =
  14444. node.type === "word" &&
  14445. !isWordAFunctionArgument(node, stepsFunctionNode)
  14446. ? node.value.toLowerCase()
  14447. : null;
  14448. let shouldParseAnimationName = false;
  14449. if (value && validIdent.test(value)) {
  14450. if ("$" + value in animationKeywords) {
  14451. parsedAnimationKeywords["$" + value] =
  14452. "$" + value in parsedAnimationKeywords
  14453. ? parsedAnimationKeywords["$" + value] + 1
  14454. : 0;
  14455. shouldParseAnimationName =
  14456. parsedAnimationKeywords["$" + value] >=
  14457. animationKeywords["$" + value];
  14458. } else {
  14459. shouldParseAnimationName = true;
  14460. }
  14461. }
  14462. const subContext = {
  14463. options: context.options,
  14464. global: context.global,
  14465. localizeNextItem: shouldParseAnimationName && !context.global,
  14466. localAliasMap: context.localAliasMap,
  14467. };
  14468. return localizeDeclNode(node, subContext);
  14469. });
  14470. declaration.value = valueNodes.toString();
  14471. return;
  14472. }
  14473. const isAnimationName = /animation(-name)?$/i.test(declaration.prop);
  14474. if (isAnimationName) {
  14475. return localizeDeclarationValues(true, declaration, context);
  14476. }
  14477. const hasUrl = /url\(/i.test(declaration.value);
  14478. if (hasUrl) {
  14479. return localizeDeclarationValues(false, declaration, context);
  14480. }
  14481. }
  14482. var src$1 = (options = {}) => {
  14483. if (
  14484. options &&
  14485. options.mode &&
  14486. options.mode !== "global" &&
  14487. options.mode !== "local" &&
  14488. options.mode !== "pure"
  14489. ) {
  14490. throw new Error(
  14491. 'options.mode must be either "global", "local" or "pure" (default "local")'
  14492. );
  14493. }
  14494. const pureMode = options && options.mode === "pure";
  14495. const globalMode = options && options.mode === "global";
  14496. return {
  14497. postcssPlugin: "postcss-modules-local-by-default",
  14498. prepare() {
  14499. const localAliasMap = new Map();
  14500. return {
  14501. Once(root) {
  14502. const { icssImports } = extractICSS$1(root, false);
  14503. Object.keys(icssImports).forEach((key) => {
  14504. Object.keys(icssImports[key]).forEach((prop) => {
  14505. localAliasMap.set(prop, icssImports[key][prop]);
  14506. });
  14507. });
  14508. root.walkAtRules((atRule) => {
  14509. if (/keyframes$/i.test(atRule.name)) {
  14510. const globalMatch = /^\s*:global\s*\((.+)\)\s*$/.exec(
  14511. atRule.params
  14512. );
  14513. const localMatch = /^\s*:local\s*\((.+)\)\s*$/.exec(
  14514. atRule.params
  14515. );
  14516. let globalKeyframes = globalMode;
  14517. if (globalMatch) {
  14518. if (pureMode) {
  14519. throw atRule.error(
  14520. "@keyframes :global(...) is not allowed in pure mode"
  14521. );
  14522. }
  14523. atRule.params = globalMatch[1];
  14524. globalKeyframes = true;
  14525. } else if (localMatch) {
  14526. atRule.params = localMatch[0];
  14527. globalKeyframes = false;
  14528. } else if (!globalMode) {
  14529. if (atRule.params && !localAliasMap.has(atRule.params)) {
  14530. atRule.params = ":local(" + atRule.params + ")";
  14531. }
  14532. }
  14533. atRule.walkDecls((declaration) => {
  14534. localizeDeclaration(declaration, {
  14535. localAliasMap,
  14536. options: options,
  14537. global: globalKeyframes,
  14538. });
  14539. });
  14540. } else if (atRule.nodes) {
  14541. atRule.nodes.forEach((declaration) => {
  14542. if (declaration.type === "decl") {
  14543. localizeDeclaration(declaration, {
  14544. localAliasMap,
  14545. options: options,
  14546. global: globalMode,
  14547. });
  14548. }
  14549. });
  14550. }
  14551. });
  14552. root.walkRules((rule) => {
  14553. if (
  14554. rule.parent &&
  14555. rule.parent.type === "atrule" &&
  14556. /keyframes$/i.test(rule.parent.name)
  14557. ) {
  14558. // ignore keyframe rules
  14559. return;
  14560. }
  14561. const context = localizeNode(rule, options.mode, localAliasMap);
  14562. context.options = options;
  14563. context.localAliasMap = localAliasMap;
  14564. if (pureMode && context.hasPureGlobals) {
  14565. throw rule.error(
  14566. 'Selector "' +
  14567. rule.selector +
  14568. '" is not pure ' +
  14569. "(pure selectors must contain at least one local class or id)"
  14570. );
  14571. }
  14572. rule.selector = context.selector;
  14573. // Less-syntax mixins parse as rules with no nodes
  14574. if (rule.nodes) {
  14575. rule.nodes.forEach((declaration) =>
  14576. localizeDeclaration(declaration, context)
  14577. );
  14578. }
  14579. });
  14580. },
  14581. };
  14582. },
  14583. };
  14584. };
  14585. var postcss = true;
  14586. src$1.postcss = postcss;
  14587. const PERMANENT_MARKER = 2;
  14588. const TEMPORARY_MARKER = 1;
  14589. function createError(node, graph) {
  14590. const er = new Error("Nondeterministic import's order");
  14591. const related = graph[node];
  14592. const relatedNode = related.find(
  14593. (relatedNode) => graph[relatedNode].indexOf(node) > -1
  14594. );
  14595. er.nodes = [node, relatedNode];
  14596. return er;
  14597. }
  14598. function walkGraph(node, graph, state, result, strict) {
  14599. if (state[node] === PERMANENT_MARKER) {
  14600. return;
  14601. }
  14602. if (state[node] === TEMPORARY_MARKER) {
  14603. if (strict) {
  14604. return createError(node, graph);
  14605. }
  14606. return;
  14607. }
  14608. state[node] = TEMPORARY_MARKER;
  14609. const children = graph[node];
  14610. const length = children.length;
  14611. for (let i = 0; i < length; ++i) {
  14612. const error = walkGraph(children[i], graph, state, result, strict);
  14613. if (error instanceof Error) {
  14614. return error;
  14615. }
  14616. }
  14617. state[node] = PERMANENT_MARKER;
  14618. result.push(node);
  14619. }
  14620. function topologicalSort(graph, strict) {
  14621. const result = [];
  14622. const state = {};
  14623. const nodes = Object.keys(graph);
  14624. const length = nodes.length;
  14625. for (let i = 0; i < length; ++i) {
  14626. const er = walkGraph(nodes[i], graph, state, result, strict);
  14627. if (er instanceof Error) {
  14628. return er;
  14629. }
  14630. }
  14631. return result;
  14632. }
  14633. var topologicalSort_1 = topologicalSort;
  14634. const matchImports = /^(.+?)\s+from\s+(?:"([^"]+)"|'([^']+)'|(global))$/;
  14635. const icssImport = /^:import\((?:"([^"]+)"|'([^']+)')\)/;
  14636. const VISITED_MARKER = 1;
  14637. /**
  14638. * :import('G') {}
  14639. *
  14640. * Rule
  14641. * composes: ... from 'A'
  14642. * composes: ... from 'B'
  14643. * Rule
  14644. * composes: ... from 'A'
  14645. * composes: ... from 'A'
  14646. * composes: ... from 'C'
  14647. *
  14648. * Results in:
  14649. *
  14650. * graph: {
  14651. * G: [],
  14652. * A: [],
  14653. * B: ['A'],
  14654. * C: ['A'],
  14655. * }
  14656. */
  14657. function addImportToGraph(importId, parentId, graph, visited) {
  14658. const siblingsId = parentId + "_" + "siblings";
  14659. const visitedId = parentId + "_" + importId;
  14660. if (visited[visitedId] !== VISITED_MARKER) {
  14661. if (!Array.isArray(visited[siblingsId])) {
  14662. visited[siblingsId] = [];
  14663. }
  14664. const siblings = visited[siblingsId];
  14665. if (Array.isArray(graph[importId])) {
  14666. graph[importId] = graph[importId].concat(siblings);
  14667. } else {
  14668. graph[importId] = siblings.slice();
  14669. }
  14670. visited[visitedId] = VISITED_MARKER;
  14671. siblings.push(importId);
  14672. }
  14673. }
  14674. var src$2 = (options = {}) => {
  14675. let importIndex = 0;
  14676. const createImportedName =
  14677. typeof options.createImportedName !== "function"
  14678. ? (importName /*, path*/) =>
  14679. `i__imported_${importName.replace(/\W/g, "_")}_${importIndex++}`
  14680. : options.createImportedName;
  14681. const failOnWrongOrder = options.failOnWrongOrder;
  14682. return {
  14683. postcssPlugin: "postcss-modules-extract-imports",
  14684. prepare() {
  14685. const graph = {};
  14686. const visited = {};
  14687. const existingImports = {};
  14688. const importDecls = {};
  14689. const imports = {};
  14690. return {
  14691. Once(root, postcss) {
  14692. // Check the existing imports order and save refs
  14693. root.walkRules((rule) => {
  14694. const matches = icssImport.exec(rule.selector);
  14695. if (matches) {
  14696. const [, /*match*/ doubleQuotePath, singleQuotePath] = matches;
  14697. const importPath = doubleQuotePath || singleQuotePath;
  14698. addImportToGraph(importPath, "root", graph, visited);
  14699. existingImports[importPath] = rule;
  14700. }
  14701. });
  14702. root.walkDecls(/^composes$/, (declaration) => {
  14703. const matches = declaration.value.match(matchImports);
  14704. if (!matches) {
  14705. return;
  14706. }
  14707. let tmpSymbols;
  14708. let [
  14709. ,
  14710. /*match*/ symbols,
  14711. doubleQuotePath,
  14712. singleQuotePath,
  14713. global,
  14714. ] = matches;
  14715. if (global) {
  14716. // Composing globals simply means changing these classes to wrap them in global(name)
  14717. tmpSymbols = symbols.split(/\s+/).map((s) => `global(${s})`);
  14718. } else {
  14719. const importPath = doubleQuotePath || singleQuotePath;
  14720. let parent = declaration.parent;
  14721. let parentIndexes = "";
  14722. while (parent.type !== "root") {
  14723. parentIndexes =
  14724. parent.parent.index(parent) + "_" + parentIndexes;
  14725. parent = parent.parent;
  14726. }
  14727. const { selector } = declaration.parent;
  14728. const parentRule = `_${parentIndexes}${selector}`;
  14729. addImportToGraph(importPath, parentRule, graph, visited);
  14730. importDecls[importPath] = declaration;
  14731. imports[importPath] = imports[importPath] || {};
  14732. tmpSymbols = symbols.split(/\s+/).map((s) => {
  14733. if (!imports[importPath][s]) {
  14734. imports[importPath][s] = createImportedName(s, importPath);
  14735. }
  14736. return imports[importPath][s];
  14737. });
  14738. }
  14739. declaration.value = tmpSymbols.join(" ");
  14740. });
  14741. const importsOrder = topologicalSort_1(graph, failOnWrongOrder);
  14742. if (importsOrder instanceof Error) {
  14743. const importPath = importsOrder.nodes.find((importPath) =>
  14744. // eslint-disable-next-line no-prototype-builtins
  14745. importDecls.hasOwnProperty(importPath)
  14746. );
  14747. const decl = importDecls[importPath];
  14748. throw decl.error(
  14749. "Failed to resolve order of composed modules " +
  14750. importsOrder.nodes
  14751. .map((importPath) => "`" + importPath + "`")
  14752. .join(", ") +
  14753. ".",
  14754. {
  14755. plugin: "postcss-modules-extract-imports",
  14756. word: "composes",
  14757. }
  14758. );
  14759. }
  14760. let lastImportRule;
  14761. importsOrder.forEach((path) => {
  14762. const importedSymbols = imports[path];
  14763. let rule = existingImports[path];
  14764. if (!rule && importedSymbols) {
  14765. rule = postcss.rule({
  14766. selector: `:import("${path}")`,
  14767. raws: { after: "\n" },
  14768. });
  14769. if (lastImportRule) {
  14770. root.insertAfter(lastImportRule, rule);
  14771. } else {
  14772. root.prepend(rule);
  14773. }
  14774. }
  14775. lastImportRule = rule;
  14776. if (!importedSymbols) {
  14777. return;
  14778. }
  14779. Object.keys(importedSymbols).forEach((importedSymbol) => {
  14780. rule.append(
  14781. postcss.decl({
  14782. value: importedSymbol,
  14783. prop: importedSymbols[importedSymbol],
  14784. raws: { before: "\n " },
  14785. })
  14786. );
  14787. });
  14788. });
  14789. },
  14790. };
  14791. },
  14792. };
  14793. };
  14794. var postcss$1 = true;
  14795. src$2.postcss = postcss$1;
  14796. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  14797. function getSingleLocalNamesForComposes(root) {
  14798. return root.nodes.map((node) => {
  14799. if (node.type !== "selector" || node.nodes.length !== 1) {
  14800. throw new Error(
  14801. `composition is only allowed when selector is single :local class name not in "${root}"`
  14802. );
  14803. }
  14804. node = node.nodes[0];
  14805. if (
  14806. node.type !== "pseudo" ||
  14807. node.value !== ":local" ||
  14808. node.nodes.length !== 1
  14809. ) {
  14810. throw new Error(
  14811. 'composition is only allowed when selector is single :local class name not in "' +
  14812. root +
  14813. '", "' +
  14814. node +
  14815. '" is weird'
  14816. );
  14817. }
  14818. node = node.first;
  14819. if (node.type !== "selector" || node.length !== 1) {
  14820. throw new Error(
  14821. 'composition is only allowed when selector is single :local class name not in "' +
  14822. root +
  14823. '", "' +
  14824. node +
  14825. '" is weird'
  14826. );
  14827. }
  14828. node = node.first;
  14829. if (node.type !== "class") {
  14830. // 'id' is not possible, because you can't compose ids
  14831. throw new Error(
  14832. 'composition is only allowed when selector is single :local class name not in "' +
  14833. root +
  14834. '", "' +
  14835. node +
  14836. '" is weird'
  14837. );
  14838. }
  14839. return node.value;
  14840. });
  14841. }
  14842. const whitespace = "[\\x20\\t\\r\\n\\f]";
  14843. const unescapeRegExp = new RegExp(
  14844. "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)",
  14845. "ig"
  14846. );
  14847. function unescape(str) {
  14848. return str.replace(unescapeRegExp, (_, escaped, escapedWhitespace) => {
  14849. const high = "0x" + escaped - 0x10000;
  14850. // NaN means non-codepoint
  14851. // Workaround erroneous numeric interpretation of +"0x"
  14852. return high !== high || escapedWhitespace
  14853. ? escaped
  14854. : high < 0
  14855. ? // BMP codepoint
  14856. String.fromCharCode(high + 0x10000)
  14857. : // Supplemental Plane codepoint (surrogate pair)
  14858. String.fromCharCode((high >> 10) | 0xd800, (high & 0x3ff) | 0xdc00);
  14859. });
  14860. }
  14861. const plugin = (options = {}) => {
  14862. const generateScopedName =
  14863. (options && options.generateScopedName) || plugin.generateScopedName;
  14864. const generateExportEntry =
  14865. (options && options.generateExportEntry) || plugin.generateExportEntry;
  14866. const exportGlobals = options && options.exportGlobals;
  14867. return {
  14868. postcssPlugin: "postcss-modules-scope",
  14869. Once(root, { rule }) {
  14870. const exports = Object.create(null);
  14871. function exportScopedName(name, rawName) {
  14872. const scopedName = generateScopedName(
  14873. rawName ? rawName : name,
  14874. root.source.input.from,
  14875. root.source.input.css
  14876. );
  14877. const exportEntry = generateExportEntry(
  14878. rawName ? rawName : name,
  14879. scopedName,
  14880. root.source.input.from,
  14881. root.source.input.css
  14882. );
  14883. const { key, value } = exportEntry;
  14884. exports[key] = exports[key] || [];
  14885. if (exports[key].indexOf(value) < 0) {
  14886. exports[key].push(value);
  14887. }
  14888. return scopedName;
  14889. }
  14890. function localizeNode(node) {
  14891. switch (node.type) {
  14892. case "selector":
  14893. node.nodes = node.map(localizeNode);
  14894. return node;
  14895. case "class":
  14896. return dist.className({
  14897. value: exportScopedName(
  14898. node.value,
  14899. node.raws && node.raws.value ? node.raws.value : null
  14900. ),
  14901. });
  14902. case "id": {
  14903. return dist.id({
  14904. value: exportScopedName(
  14905. node.value,
  14906. node.raws && node.raws.value ? node.raws.value : null
  14907. ),
  14908. });
  14909. }
  14910. }
  14911. throw new Error(
  14912. `${node.type} ("${node}") is not allowed in a :local block`
  14913. );
  14914. }
  14915. function traverseNode(node) {
  14916. switch (node.type) {
  14917. case "pseudo":
  14918. if (node.value === ":local") {
  14919. if (node.nodes.length !== 1) {
  14920. throw new Error('Unexpected comma (",") in :local block');
  14921. }
  14922. const selector = localizeNode(node.first, node.spaces);
  14923. // move the spaces that were around the psuedo selector to the first
  14924. // non-container node
  14925. selector.first.spaces = node.spaces;
  14926. const nextNode = node.next();
  14927. if (
  14928. nextNode &&
  14929. nextNode.type === "combinator" &&
  14930. nextNode.value === " " &&
  14931. /\\[A-F0-9]{1,6}$/.test(selector.last.value)
  14932. ) {
  14933. selector.last.spaces.after = " ";
  14934. }
  14935. node.replaceWith(selector);
  14936. return;
  14937. }
  14938. /* falls through */
  14939. case "root":
  14940. case "selector": {
  14941. node.each(traverseNode);
  14942. break;
  14943. }
  14944. case "id":
  14945. case "class":
  14946. if (exportGlobals) {
  14947. exports[node.value] = [node.value];
  14948. }
  14949. break;
  14950. }
  14951. return node;
  14952. }
  14953. // Find any :import and remember imported names
  14954. const importedNames = {};
  14955. root.walkRules(/^:import\(.+\)$/, (rule) => {
  14956. rule.walkDecls((decl) => {
  14957. importedNames[decl.prop] = true;
  14958. });
  14959. });
  14960. // Find any :local selectors
  14961. root.walkRules((rule) => {
  14962. let parsedSelector = dist().astSync(rule);
  14963. rule.selector = traverseNode(parsedSelector.clone()).toString();
  14964. rule.walkDecls(/composes|compose-with/i, (decl) => {
  14965. const localNames = getSingleLocalNamesForComposes(parsedSelector);
  14966. const classes = decl.value.split(/\s+/);
  14967. classes.forEach((className) => {
  14968. const global = /^global\(([^)]+)\)$/.exec(className);
  14969. if (global) {
  14970. localNames.forEach((exportedName) => {
  14971. exports[exportedName].push(global[1]);
  14972. });
  14973. } else if (hasOwnProperty$1.call(importedNames, className)) {
  14974. localNames.forEach((exportedName) => {
  14975. exports[exportedName].push(className);
  14976. });
  14977. } else if (hasOwnProperty$1.call(exports, className)) {
  14978. localNames.forEach((exportedName) => {
  14979. exports[className].forEach((item) => {
  14980. exports[exportedName].push(item);
  14981. });
  14982. });
  14983. } else {
  14984. throw decl.error(
  14985. `referenced class name "${className}" in ${decl.prop} not found`
  14986. );
  14987. }
  14988. });
  14989. decl.remove();
  14990. });
  14991. // Find any :local values
  14992. rule.walkDecls((decl) => {
  14993. if (!/:local\s*\((.+?)\)/.test(decl.value)) {
  14994. return;
  14995. }
  14996. let tokens = decl.value.split(/(,|'[^']*'|"[^"]*")/);
  14997. tokens = tokens.map((token, idx) => {
  14998. if (idx === 0 || tokens[idx - 1] === ",") {
  14999. let result = token;
  15000. const localMatch = /:local\s*\((.+?)\)/.exec(token);
  15001. if (localMatch) {
  15002. const input = localMatch.input;
  15003. const matchPattern = localMatch[0];
  15004. const matchVal = localMatch[1];
  15005. const newVal = exportScopedName(matchVal);
  15006. result = input.replace(matchPattern, newVal);
  15007. } else {
  15008. return token;
  15009. }
  15010. return result;
  15011. } else {
  15012. return token;
  15013. }
  15014. });
  15015. decl.value = tokens.join("");
  15016. });
  15017. });
  15018. // Find any :local keyframes
  15019. root.walkAtRules(/keyframes$/i, (atRule) => {
  15020. const localMatch = /^\s*:local\s*\((.+?)\)\s*$/.exec(atRule.params);
  15021. if (!localMatch) {
  15022. return;
  15023. }
  15024. atRule.params = exportScopedName(localMatch[1]);
  15025. });
  15026. // If we found any :locals, insert an :export rule
  15027. const exportedNames = Object.keys(exports);
  15028. if (exportedNames.length > 0) {
  15029. const exportRule = rule({ selector: ":export" });
  15030. exportedNames.forEach((exportedName) =>
  15031. exportRule.append({
  15032. prop: exportedName,
  15033. value: exports[exportedName].join(" "),
  15034. raws: { before: "\n " },
  15035. })
  15036. );
  15037. root.append(exportRule);
  15038. }
  15039. },
  15040. };
  15041. };
  15042. plugin.postcss = true;
  15043. plugin.generateScopedName = function (name, path) {
  15044. const sanitisedPath = path
  15045. .replace(/\.[^./\\]+$/, "")
  15046. .replace(/[\W_]+/g, "_")
  15047. .replace(/^_|_$/g, "");
  15048. return `_${sanitisedPath}__${name}`.trim();
  15049. };
  15050. plugin.generateExportEntry = function (name, scopedName) {
  15051. return {
  15052. key: unescape(name),
  15053. value: unescape(scopedName),
  15054. };
  15055. };
  15056. var src$3 = plugin;
  15057. const matchImports$1 = /^(.+?|\([\s\S]+?\))\s+from\s+("[^"]*"|'[^']*'|[\w-]+)$/;
  15058. const matchValueDefinition = /(?:\s+|^)([\w-]+):?(.*?)$/;
  15059. const matchImport = /^([\w-]+)(?:\s+as\s+([\w-]+))?/;
  15060. var src$4 = (options) => {
  15061. let importIndex = 0;
  15062. const createImportedName =
  15063. (options && options.createImportedName) ||
  15064. ((importName /*, path*/) =>
  15065. `i__const_${importName.replace(/\W/g, "_")}_${importIndex++}`);
  15066. return {
  15067. postcssPlugin: "postcss-modules-values",
  15068. prepare(result) {
  15069. const importAliases = [];
  15070. const definitions = {};
  15071. return {
  15072. Once(root, postcss) {
  15073. root.walkAtRules(/value/i, (atRule) => {
  15074. const matches = atRule.params.match(matchImports$1);
  15075. if (matches) {
  15076. let [, /*match*/ aliases, path] = matches;
  15077. // We can use constants for path names
  15078. if (definitions[path]) {
  15079. path = definitions[path];
  15080. }
  15081. const imports = aliases
  15082. .replace(/^\(\s*([\s\S]+)\s*\)$/, "$1")
  15083. .split(/\s*,\s*/)
  15084. .map((alias) => {
  15085. const tokens = matchImport.exec(alias);
  15086. if (tokens) {
  15087. const [, /*match*/ theirName, myName = theirName] = tokens;
  15088. const importedName = createImportedName(myName);
  15089. definitions[myName] = importedName;
  15090. return { theirName, importedName };
  15091. } else {
  15092. throw new Error(`@import statement "${alias}" is invalid!`);
  15093. }
  15094. });
  15095. importAliases.push({ path, imports });
  15096. atRule.remove();
  15097. return;
  15098. }
  15099. if (atRule.params.indexOf("@value") !== -1) {
  15100. result.warn("Invalid value definition: " + atRule.params);
  15101. }
  15102. let [, key, value] = `${atRule.params}${atRule.raws.between}`.match(
  15103. matchValueDefinition
  15104. );
  15105. const normalizedValue = value.replace(/\/\*((?!\*\/).*?)\*\//g, "");
  15106. if (normalizedValue.length === 0) {
  15107. result.warn("Invalid value definition: " + atRule.params);
  15108. atRule.remove();
  15109. return;
  15110. }
  15111. let isOnlySpace = /^\s+$/.test(normalizedValue);
  15112. if (!isOnlySpace) {
  15113. value = value.trim();
  15114. }
  15115. // Add to the definitions, knowing that values can refer to each other
  15116. definitions[key] = src.replaceValueSymbols(
  15117. value,
  15118. definitions
  15119. );
  15120. atRule.remove();
  15121. });
  15122. /* If we have no definitions, don't continue */
  15123. if (!Object.keys(definitions).length) {
  15124. return;
  15125. }
  15126. /* Perform replacements */
  15127. src.replaceSymbols(root, definitions);
  15128. /* We want to export anything defined by now, but don't add it to the CSS yet or it well get picked up by the replacement stuff */
  15129. const exportDeclarations = Object.keys(definitions).map((key) =>
  15130. postcss.decl({
  15131. value: definitions[key],
  15132. prop: key,
  15133. raws: { before: "\n " },
  15134. })
  15135. );
  15136. /* Add export rules if any */
  15137. if (exportDeclarations.length > 0) {
  15138. const exportRule = postcss.rule({
  15139. selector: ":export",
  15140. raws: { after: "\n" },
  15141. });
  15142. exportRule.append(exportDeclarations);
  15143. root.prepend(exportRule);
  15144. }
  15145. /* Add import rules */
  15146. importAliases.reverse().forEach(({ path, imports }) => {
  15147. const importRule = postcss.rule({
  15148. selector: `:import(${path})`,
  15149. raws: { after: "\n" },
  15150. });
  15151. imports.forEach(({ theirName, importedName }) => {
  15152. importRule.append({
  15153. value: theirName,
  15154. prop: importedName,
  15155. raws: { before: "\n " },
  15156. });
  15157. });
  15158. root.prepend(importRule);
  15159. });
  15160. },
  15161. };
  15162. },
  15163. };
  15164. };
  15165. var postcss$2 = true;
  15166. src$4.postcss = postcss$2;
  15167. var behaviours_1 = createCommonjsModule(function (module, exports) {
  15168. Object.defineProperty(exports, "__esModule", {
  15169. value: true
  15170. });
  15171. exports.behaviours = undefined;
  15172. exports.getDefaultPlugins = getDefaultPlugins;
  15173. exports.isValidBehaviour = isValidBehaviour;
  15174. var _postcssModulesLocalByDefault2 = _interopRequireDefault(src$1);
  15175. var _postcssModulesExtractImports2 = _interopRequireDefault(src$2);
  15176. var _postcssModulesScope2 = _interopRequireDefault(src$3);
  15177. var _postcssModulesValues2 = _interopRequireDefault(src$4);
  15178. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15179. const behaviours = exports.behaviours = {
  15180. LOCAL: "local",
  15181. GLOBAL: "global"
  15182. };
  15183. function getDefaultPlugins({
  15184. behaviour,
  15185. generateScopedName,
  15186. exportGlobals
  15187. }) {
  15188. const scope = (0, _postcssModulesScope2.default)({ generateScopedName, exportGlobals });
  15189. const plugins = {
  15190. [behaviours.LOCAL]: [_postcssModulesValues2.default, _postcssModulesLocalByDefault2.default, _postcssModulesExtractImports2.default, scope],
  15191. [behaviours.GLOBAL]: [_postcssModulesValues2.default, _postcssModulesExtractImports2.default, scope]
  15192. };
  15193. return plugins[behaviour];
  15194. }
  15195. function isValidBehaviour(behaviour) {
  15196. return Object.keys(behaviours).map(key => behaviours[key]).indexOf(behaviour) > -1;
  15197. }
  15198. });
  15199. var _postcss2$1 = _interopRequireDefault$3(_postcss__default);
  15200. var _lodash2 = _interopRequireDefault$3(lodash_camelcase);
  15201. var _genericNames2 = _interopRequireDefault$3(genericNames);
  15202. var _unquote2 = _interopRequireDefault$3(unquote_1);
  15203. var _parser2$1 = _interopRequireDefault$3(parser$1);
  15204. var _loader2 = _interopRequireDefault$3(loader);
  15205. var _generateScopedName2 = _interopRequireDefault$3(generateScopedName_1);
  15206. var _saveJSON2 = _interopRequireDefault$3(saveJSON_1);
  15207. function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15208. function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
  15209. const PLUGIN_NAME = "postcss-modules";
  15210. function getDefaultScopeBehaviour(opts) {
  15211. if (opts.scopeBehaviour && (0, behaviours_1.isValidBehaviour)(opts.scopeBehaviour)) {
  15212. return opts.scopeBehaviour;
  15213. }
  15214. return behaviours_1.behaviours.LOCAL;
  15215. }
  15216. function getScopedNameGenerator(opts) {
  15217. const scopedNameGenerator = opts.generateScopedName || _generateScopedName2.default;
  15218. if (typeof scopedNameGenerator === "function") return scopedNameGenerator;
  15219. return (0, _genericNames2.default)(scopedNameGenerator, {
  15220. context: process.cwd(),
  15221. hashPrefix: opts.hashPrefix
  15222. });
  15223. }
  15224. function getLoader(opts, plugins) {
  15225. const root = typeof opts.root === "undefined" ? "/" : opts.root;
  15226. return typeof opts.Loader === "function" ? new opts.Loader(root, plugins) : new _loader2.default(root, plugins);
  15227. }
  15228. function isGlobalModule(globalModules, inputFile) {
  15229. return globalModules.some(regex => inputFile.match(regex));
  15230. }
  15231. function getDefaultPluginsList(opts, inputFile) {
  15232. const globalModulesList = opts.globalModulePaths || null;
  15233. const exportGlobals = opts.exportGlobals || false;
  15234. const defaultBehaviour = getDefaultScopeBehaviour(opts);
  15235. const generateScopedName = getScopedNameGenerator(opts);
  15236. if (globalModulesList && isGlobalModule(globalModulesList, inputFile)) {
  15237. return (0, behaviours_1.getDefaultPlugins)({
  15238. behaviour: behaviours_1.behaviours.GLOBAL,
  15239. generateScopedName,
  15240. exportGlobals
  15241. });
  15242. }
  15243. return (0, behaviours_1.getDefaultPlugins)({
  15244. behaviour: defaultBehaviour,
  15245. generateScopedName,
  15246. exportGlobals
  15247. });
  15248. }
  15249. function isOurPlugin(plugin) {
  15250. return plugin.postcssPlugin === PLUGIN_NAME;
  15251. }
  15252. function dashesCamelCase(string) {
  15253. return string.replace(/-+(\w)/g, (_, firstLetter) => firstLetter.toUpperCase());
  15254. }
  15255. var build = (opts = {}) => {
  15256. return {
  15257. postcssPlugin: PLUGIN_NAME,
  15258. OnceExit(css, { result }) {
  15259. return _asyncToGenerator(function* () {
  15260. const getJSON = opts.getJSON || _saveJSON2.default;
  15261. const inputFile = css.source.input.file;
  15262. const pluginList = getDefaultPluginsList(opts, inputFile);
  15263. const resultPluginIndex = result.processor.plugins.findIndex(function (plugin) {
  15264. return isOurPlugin(plugin);
  15265. });
  15266. if (resultPluginIndex === -1) {
  15267. throw new Error('Plugin missing from options.');
  15268. }
  15269. const earlierPlugins = result.processor.plugins.slice(0, resultPluginIndex);
  15270. const loaderPlugins = [...earlierPlugins, ...pluginList];
  15271. const loader = getLoader(opts, loaderPlugins);
  15272. const fetcher = function fetcher(file, relativeTo, depTrace) {
  15273. const unquoteFile = (0, _unquote2.default)(file);
  15274. const resolvedResult = typeof opts.resolve === 'function' && opts.resolve(unquoteFile);
  15275. const resolvedFile = resolvedResult instanceof Promise ? resolvedResult : Promise.resolve(resolvedResult);
  15276. return resolvedFile.then(function (f) {
  15277. return loader.fetch.call(loader, `"${f || unquoteFile}"`, relativeTo, depTrace);
  15278. });
  15279. };
  15280. const parser = new _parser2$1.default(fetcher);
  15281. yield (0, _postcss2$1.default)([...pluginList, parser.plugin()]).process(css, {
  15282. from: inputFile
  15283. });
  15284. const out = loader.finalSource;
  15285. if (out) css.prepend(out);
  15286. if (opts.localsConvention) {
  15287. const isFunc = typeof opts.localsConvention === "function";
  15288. parser.exportTokens = Object.entries(parser.exportTokens).reduce(function (tokens, [className, value]) {
  15289. if (isFunc) {
  15290. tokens[opts.localsConvention(className, value, inputFile)] = value;
  15291. return tokens;
  15292. }
  15293. switch (opts.localsConvention) {
  15294. case "camelCase":
  15295. tokens[className] = value;
  15296. tokens[(0, _lodash2.default)(className)] = value;
  15297. break;
  15298. case "camelCaseOnly":
  15299. tokens[(0, _lodash2.default)(className)] = value;
  15300. break;
  15301. case "dashes":
  15302. tokens[className] = value;
  15303. tokens[dashesCamelCase(className)] = value;
  15304. break;
  15305. case "dashesOnly":
  15306. tokens[dashesCamelCase(className)] = value;
  15307. break;
  15308. }
  15309. return tokens;
  15310. }, {});
  15311. }
  15312. result.messages.push({
  15313. type: "export",
  15314. plugin: "postcss-modules",
  15315. exportTokens: parser.exportTokens
  15316. });
  15317. // getJSON may return a promise
  15318. return getJSON(css.source.input.file, parser.exportTokens, result.opts.to);
  15319. })();
  15320. }
  15321. };
  15322. };
  15323. var postcss$3 = true;
  15324. build.postcss = postcss$3;
  15325. function compileStyle(options) {
  15326. return doCompileStyle({
  15327. ...options,
  15328. isAsync: false
  15329. });
  15330. }
  15331. function compileStyleAsync(options) {
  15332. return doCompileStyle({
  15333. ...options,
  15334. isAsync: true
  15335. });
  15336. }
  15337. function doCompileStyle(options) {
  15338. const { filename, id, scoped = false, trim = true, isProd = false, modules = false, modulesOptions = {}, preprocessLang, postcssOptions, postcssPlugins } = options;
  15339. const preprocessor = preprocessLang && processors[preprocessLang];
  15340. const preProcessedSource = preprocessor && preprocess$1(options, preprocessor);
  15341. const map = preProcessedSource
  15342. ? preProcessedSource.map
  15343. : options.inMap || options.map;
  15344. const source = preProcessedSource ? preProcessedSource.code : options.source;
  15345. const shortId = id.replace(/^data-v-/, '');
  15346. const longId = `data-v-${shortId}`;
  15347. const plugins = (postcssPlugins || []).slice();
  15348. plugins.unshift(cssVarsPlugin({ id: shortId, isProd }));
  15349. if (trim) {
  15350. plugins.push(trimPlugin());
  15351. }
  15352. if (scoped) {
  15353. plugins.push(scopedPlugin(longId));
  15354. }
  15355. let cssModules;
  15356. if (modules) {
  15357. if (!options.isAsync) {
  15358. throw new Error('[@vue/compiler-sfc] `modules` option can only be used with compileStyleAsync().');
  15359. }
  15360. plugins.push(build({
  15361. ...modulesOptions,
  15362. getJSON: (_cssFileName, json) => {
  15363. cssModules = json;
  15364. }
  15365. }));
  15366. }
  15367. const postCSSOptions = {
  15368. ...postcssOptions,
  15369. to: filename,
  15370. from: filename
  15371. };
  15372. if (map) {
  15373. postCSSOptions.map = {
  15374. inline: false,
  15375. annotation: false,
  15376. prev: map
  15377. };
  15378. }
  15379. let result;
  15380. let code;
  15381. let outMap;
  15382. // stylus output include plain css. so need remove the repeat item
  15383. const dependencies = new Set(preProcessedSource ? preProcessedSource.dependencies : []);
  15384. // sass has filename self when provided filename option
  15385. dependencies.delete(filename);
  15386. const errors = [];
  15387. if (preProcessedSource && preProcessedSource.errors.length) {
  15388. errors.push(...preProcessedSource.errors);
  15389. }
  15390. const recordPlainCssDependencies = (messages) => {
  15391. messages.forEach(msg => {
  15392. if (msg.type === 'dependency') {
  15393. // postcss output path is absolute position path
  15394. dependencies.add(msg.file);
  15395. }
  15396. });
  15397. return dependencies;
  15398. };
  15399. try {
  15400. result = _postcss__default(plugins).process(source, postCSSOptions);
  15401. // In async mode, return a promise.
  15402. if (options.isAsync) {
  15403. return result
  15404. .then(result => ({
  15405. code: result.css || '',
  15406. map: result.map && result.map.toJSON(),
  15407. errors,
  15408. modules: cssModules,
  15409. rawResult: result,
  15410. dependencies: recordPlainCssDependencies(result.messages)
  15411. }))
  15412. .catch(error => ({
  15413. code: '',
  15414. map: undefined,
  15415. errors: [...errors, error],
  15416. rawResult: undefined,
  15417. dependencies
  15418. }));
  15419. }
  15420. recordPlainCssDependencies(result.messages);
  15421. // force synchronous transform (we know we only have sync plugins)
  15422. code = result.css;
  15423. outMap = result.map;
  15424. }
  15425. catch (e) {
  15426. errors.push(e);
  15427. }
  15428. return {
  15429. code: code || ``,
  15430. map: outMap && outMap.toJSON(),
  15431. errors,
  15432. rawResult: result,
  15433. dependencies
  15434. };
  15435. }
  15436. function preprocess$1(options, preprocessor) {
  15437. return preprocessor(options.source, options.inMap || options.map, {
  15438. filename: options.filename,
  15439. ...options.preprocessOptions
  15440. }, options.preprocessCustomRequire);
  15441. }
  15442. // API
  15443. const walk$1 = estreeWalker.walk;
  15444. exports.MagicString = MagicString__default;
  15445. exports.babelParse = parser$2.parse;
  15446. exports.extractIdentifiers = compilerCore.extractIdentifiers;
  15447. exports.generateCodeFrame = compilerCore.generateCodeFrame;
  15448. exports.isInDestructureAssignment = compilerCore.isInDestructureAssignment;
  15449. exports.isStaticProperty = compilerCore.isStaticProperty;
  15450. exports.walkIdentifiers = compilerCore.walkIdentifiers;
  15451. exports.shouldTransformRef = reactivityTransform.shouldTransform;
  15452. exports.transformRef = reactivityTransform.transform;
  15453. exports.transformRefAST = reactivityTransform.transformAST;
  15454. exports.compileScript = compileScript;
  15455. exports.compileStyle = compileStyle;
  15456. exports.compileStyleAsync = compileStyleAsync;
  15457. exports.compileTemplate = compileTemplate;
  15458. exports.parse = parse;
  15459. exports.rewriteDefault = rewriteDefault;
  15460. exports.walk = walk$1;