compiler-sfc.cjs.js 489 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289
  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. const cssVarRE = /\bv-bind\(\s*(?:'([^']+)'|"([^"]+)"|([^'"][^)]*))\s*\)/g;
  97. function genCssVarsFromList(vars, id, isProd) {
  98. return `{\n ${vars
  99. .map(key => `"${genVarName(id, key, isProd)}": (${key})`)
  100. .join(',\n ')}\n}`;
  101. }
  102. function genVarName(id, raw, isProd) {
  103. if (isProd) {
  104. return hashSum(id + raw);
  105. }
  106. else {
  107. return `${id}-${raw.replace(/([^\w-])/g, '_')}`;
  108. }
  109. }
  110. function parseCssVars(sfc) {
  111. const vars = [];
  112. sfc.styles.forEach(style => {
  113. let match;
  114. // ignore v-bind() in comments /* ... */
  115. const content = style.content.replace(/\/\*([\s\S]*?)\*\//g, '');
  116. while ((match = cssVarRE.exec(content))) {
  117. const variable = match[1] || match[2] || match[3];
  118. if (!vars.includes(variable)) {
  119. vars.push(variable);
  120. }
  121. }
  122. });
  123. return vars;
  124. }
  125. const cssVarsPlugin = opts => {
  126. const { id, isProd } = opts;
  127. return {
  128. postcssPlugin: 'vue-sfc-vars',
  129. Declaration(decl) {
  130. // rewrite CSS variables
  131. if (cssVarRE.test(decl.value)) {
  132. decl.value = decl.value.replace(cssVarRE, (_, $1, $2, $3) => {
  133. return `var(--${genVarName(id, $1 || $2 || $3, isProd)})`;
  134. });
  135. }
  136. }
  137. };
  138. };
  139. cssVarsPlugin.postcss = true;
  140. function genCssVarsCode(vars, bindings, id, isProd) {
  141. const varsExp = genCssVarsFromList(vars, id, isProd);
  142. const exp = CompilerDOM.createSimpleExpression(varsExp, false);
  143. const context = CompilerDOM.createTransformContext(CompilerDOM.createRoot([]), {
  144. prefixIdentifiers: true,
  145. inline: true,
  146. bindingMetadata: bindings.__isScriptSetup === false ? undefined : bindings
  147. });
  148. const transformed = CompilerDOM.processExpression(exp, context);
  149. const transformedString = transformed.type === 4 /* SIMPLE_EXPRESSION */
  150. ? transformed.content
  151. : transformed.children
  152. .map(c => {
  153. return typeof c === 'string'
  154. ? c
  155. : c.content;
  156. })
  157. .join('');
  158. return `_${CSS_VARS_HELPER}(_ctx => (${transformedString}))`;
  159. }
  160. // <script setup> already gets the calls injected as part of the transform
  161. // this is only for single normal <script>
  162. function genNormalScriptCssVarsCode(cssVars, bindings, id, isProd) {
  163. return (`\nimport { ${CSS_VARS_HELPER} as _${CSS_VARS_HELPER} } from 'vue'\n` +
  164. `const __injectCSSVars__ = () => {\n${genCssVarsCode(cssVars, bindings, id, isProd)}}\n` +
  165. `const __setup__ = __default__.setup\n` +
  166. `__default__.setup = __setup__\n` +
  167. ` ? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }\n` +
  168. ` : __injectCSSVars__\n`);
  169. }
  170. var iterator = function (Yallist) {
  171. Yallist.prototype[Symbol.iterator] = function* () {
  172. for (let walker = this.head; walker; walker = walker.next) {
  173. yield walker.value;
  174. }
  175. };
  176. };
  177. var yallist = Yallist;
  178. Yallist.Node = Node;
  179. Yallist.create = Yallist;
  180. function Yallist (list) {
  181. var self = this;
  182. if (!(self instanceof Yallist)) {
  183. self = new Yallist();
  184. }
  185. self.tail = null;
  186. self.head = null;
  187. self.length = 0;
  188. if (list && typeof list.forEach === 'function') {
  189. list.forEach(function (item) {
  190. self.push(item);
  191. });
  192. } else if (arguments.length > 0) {
  193. for (var i = 0, l = arguments.length; i < l; i++) {
  194. self.push(arguments[i]);
  195. }
  196. }
  197. return self
  198. }
  199. Yallist.prototype.removeNode = function (node) {
  200. if (node.list !== this) {
  201. throw new Error('removing node which does not belong to this list')
  202. }
  203. var next = node.next;
  204. var prev = node.prev;
  205. if (next) {
  206. next.prev = prev;
  207. }
  208. if (prev) {
  209. prev.next = next;
  210. }
  211. if (node === this.head) {
  212. this.head = next;
  213. }
  214. if (node === this.tail) {
  215. this.tail = prev;
  216. }
  217. node.list.length--;
  218. node.next = null;
  219. node.prev = null;
  220. node.list = null;
  221. return next
  222. };
  223. Yallist.prototype.unshiftNode = function (node) {
  224. if (node === this.head) {
  225. return
  226. }
  227. if (node.list) {
  228. node.list.removeNode(node);
  229. }
  230. var head = this.head;
  231. node.list = this;
  232. node.next = head;
  233. if (head) {
  234. head.prev = node;
  235. }
  236. this.head = node;
  237. if (!this.tail) {
  238. this.tail = node;
  239. }
  240. this.length++;
  241. };
  242. Yallist.prototype.pushNode = function (node) {
  243. if (node === this.tail) {
  244. return
  245. }
  246. if (node.list) {
  247. node.list.removeNode(node);
  248. }
  249. var tail = this.tail;
  250. node.list = this;
  251. node.prev = tail;
  252. if (tail) {
  253. tail.next = node;
  254. }
  255. this.tail = node;
  256. if (!this.head) {
  257. this.head = node;
  258. }
  259. this.length++;
  260. };
  261. Yallist.prototype.push = function () {
  262. for (var i = 0, l = arguments.length; i < l; i++) {
  263. push(this, arguments[i]);
  264. }
  265. return this.length
  266. };
  267. Yallist.prototype.unshift = function () {
  268. for (var i = 0, l = arguments.length; i < l; i++) {
  269. unshift(this, arguments[i]);
  270. }
  271. return this.length
  272. };
  273. Yallist.prototype.pop = function () {
  274. if (!this.tail) {
  275. return undefined
  276. }
  277. var res = this.tail.value;
  278. this.tail = this.tail.prev;
  279. if (this.tail) {
  280. this.tail.next = null;
  281. } else {
  282. this.head = null;
  283. }
  284. this.length--;
  285. return res
  286. };
  287. Yallist.prototype.shift = function () {
  288. if (!this.head) {
  289. return undefined
  290. }
  291. var res = this.head.value;
  292. this.head = this.head.next;
  293. if (this.head) {
  294. this.head.prev = null;
  295. } else {
  296. this.tail = null;
  297. }
  298. this.length--;
  299. return res
  300. };
  301. Yallist.prototype.forEach = function (fn, thisp) {
  302. thisp = thisp || this;
  303. for (var walker = this.head, i = 0; walker !== null; i++) {
  304. fn.call(thisp, walker.value, i, this);
  305. walker = walker.next;
  306. }
  307. };
  308. Yallist.prototype.forEachReverse = function (fn, thisp) {
  309. thisp = thisp || this;
  310. for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
  311. fn.call(thisp, walker.value, i, this);
  312. walker = walker.prev;
  313. }
  314. };
  315. Yallist.prototype.get = function (n) {
  316. for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
  317. // abort out of the list early if we hit a cycle
  318. walker = walker.next;
  319. }
  320. if (i === n && walker !== null) {
  321. return walker.value
  322. }
  323. };
  324. Yallist.prototype.getReverse = function (n) {
  325. for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
  326. // abort out of the list early if we hit a cycle
  327. walker = walker.prev;
  328. }
  329. if (i === n && walker !== null) {
  330. return walker.value
  331. }
  332. };
  333. Yallist.prototype.map = function (fn, thisp) {
  334. thisp = thisp || this;
  335. var res = new Yallist();
  336. for (var walker = this.head; walker !== null;) {
  337. res.push(fn.call(thisp, walker.value, this));
  338. walker = walker.next;
  339. }
  340. return res
  341. };
  342. Yallist.prototype.mapReverse = function (fn, thisp) {
  343. thisp = thisp || this;
  344. var res = new Yallist();
  345. for (var walker = this.tail; walker !== null;) {
  346. res.push(fn.call(thisp, walker.value, this));
  347. walker = walker.prev;
  348. }
  349. return res
  350. };
  351. Yallist.prototype.reduce = function (fn, initial) {
  352. var acc;
  353. var walker = this.head;
  354. if (arguments.length > 1) {
  355. acc = initial;
  356. } else if (this.head) {
  357. walker = this.head.next;
  358. acc = this.head.value;
  359. } else {
  360. throw new TypeError('Reduce of empty list with no initial value')
  361. }
  362. for (var i = 0; walker !== null; i++) {
  363. acc = fn(acc, walker.value, i);
  364. walker = walker.next;
  365. }
  366. return acc
  367. };
  368. Yallist.prototype.reduceReverse = function (fn, initial) {
  369. var acc;
  370. var walker = this.tail;
  371. if (arguments.length > 1) {
  372. acc = initial;
  373. } else if (this.tail) {
  374. walker = this.tail.prev;
  375. acc = this.tail.value;
  376. } else {
  377. throw new TypeError('Reduce of empty list with no initial value')
  378. }
  379. for (var i = this.length - 1; walker !== null; i--) {
  380. acc = fn(acc, walker.value, i);
  381. walker = walker.prev;
  382. }
  383. return acc
  384. };
  385. Yallist.prototype.toArray = function () {
  386. var arr = new Array(this.length);
  387. for (var i = 0, walker = this.head; walker !== null; i++) {
  388. arr[i] = walker.value;
  389. walker = walker.next;
  390. }
  391. return arr
  392. };
  393. Yallist.prototype.toArrayReverse = function () {
  394. var arr = new Array(this.length);
  395. for (var i = 0, walker = this.tail; walker !== null; i++) {
  396. arr[i] = walker.value;
  397. walker = walker.prev;
  398. }
  399. return arr
  400. };
  401. Yallist.prototype.slice = function (from, to) {
  402. to = to || this.length;
  403. if (to < 0) {
  404. to += this.length;
  405. }
  406. from = from || 0;
  407. if (from < 0) {
  408. from += this.length;
  409. }
  410. var ret = new Yallist();
  411. if (to < from || to < 0) {
  412. return ret
  413. }
  414. if (from < 0) {
  415. from = 0;
  416. }
  417. if (to > this.length) {
  418. to = this.length;
  419. }
  420. for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
  421. walker = walker.next;
  422. }
  423. for (; walker !== null && i < to; i++, walker = walker.next) {
  424. ret.push(walker.value);
  425. }
  426. return ret
  427. };
  428. Yallist.prototype.sliceReverse = function (from, to) {
  429. to = to || this.length;
  430. if (to < 0) {
  431. to += this.length;
  432. }
  433. from = from || 0;
  434. if (from < 0) {
  435. from += this.length;
  436. }
  437. var ret = new Yallist();
  438. if (to < from || to < 0) {
  439. return ret
  440. }
  441. if (from < 0) {
  442. from = 0;
  443. }
  444. if (to > this.length) {
  445. to = this.length;
  446. }
  447. for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
  448. walker = walker.prev;
  449. }
  450. for (; walker !== null && i > from; i--, walker = walker.prev) {
  451. ret.push(walker.value);
  452. }
  453. return ret
  454. };
  455. Yallist.prototype.splice = function (start, deleteCount /*, ...nodes */) {
  456. if (start > this.length) {
  457. start = this.length - 1;
  458. }
  459. if (start < 0) {
  460. start = this.length + start;
  461. }
  462. for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
  463. walker = walker.next;
  464. }
  465. var ret = [];
  466. for (var i = 0; walker && i < deleteCount; i++) {
  467. ret.push(walker.value);
  468. walker = this.removeNode(walker);
  469. }
  470. if (walker === null) {
  471. walker = this.tail;
  472. }
  473. if (walker !== this.head && walker !== this.tail) {
  474. walker = walker.prev;
  475. }
  476. for (var i = 2; i < arguments.length; i++) {
  477. walker = insert(this, walker, arguments[i]);
  478. }
  479. return ret;
  480. };
  481. Yallist.prototype.reverse = function () {
  482. var head = this.head;
  483. var tail = this.tail;
  484. for (var walker = head; walker !== null; walker = walker.prev) {
  485. var p = walker.prev;
  486. walker.prev = walker.next;
  487. walker.next = p;
  488. }
  489. this.head = tail;
  490. this.tail = head;
  491. return this
  492. };
  493. function insert (self, node, value) {
  494. var inserted = node === self.head ?
  495. new Node(value, null, node, self) :
  496. new Node(value, node, node.next, self);
  497. if (inserted.next === null) {
  498. self.tail = inserted;
  499. }
  500. if (inserted.prev === null) {
  501. self.head = inserted;
  502. }
  503. self.length++;
  504. return inserted
  505. }
  506. function push (self, item) {
  507. self.tail = new Node(item, self.tail, null, self);
  508. if (!self.head) {
  509. self.head = self.tail;
  510. }
  511. self.length++;
  512. }
  513. function unshift (self, item) {
  514. self.head = new Node(item, null, self.head, self);
  515. if (!self.tail) {
  516. self.tail = self.head;
  517. }
  518. self.length++;
  519. }
  520. function Node (value, prev, next, list) {
  521. if (!(this instanceof Node)) {
  522. return new Node(value, prev, next, list)
  523. }
  524. this.list = list;
  525. this.value = value;
  526. if (prev) {
  527. prev.next = this;
  528. this.prev = prev;
  529. } else {
  530. this.prev = null;
  531. }
  532. if (next) {
  533. next.prev = this;
  534. this.next = next;
  535. } else {
  536. this.next = null;
  537. }
  538. }
  539. try {
  540. // add if support for Symbol.iterator is present
  541. iterator(Yallist);
  542. } catch (er) {}
  543. // A linked list to keep track of recently-used-ness
  544. const MAX = Symbol('max');
  545. const LENGTH = Symbol('length');
  546. const LENGTH_CALCULATOR = Symbol('lengthCalculator');
  547. const ALLOW_STALE = Symbol('allowStale');
  548. const MAX_AGE = Symbol('maxAge');
  549. const DISPOSE = Symbol('dispose');
  550. const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');
  551. const LRU_LIST = Symbol('lruList');
  552. const CACHE = Symbol('cache');
  553. const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');
  554. const naiveLength = () => 1;
  555. // lruList is a yallist where the head is the youngest
  556. // item, and the tail is the oldest. the list contains the Hit
  557. // objects as the entries.
  558. // Each Hit object has a reference to its Yallist.Node. This
  559. // never changes.
  560. //
  561. // cache is a Map (or PseudoMap) that matches the keys to
  562. // the Yallist.Node object.
  563. class LRUCache {
  564. constructor (options) {
  565. if (typeof options === 'number')
  566. options = { max: options };
  567. if (!options)
  568. options = {};
  569. if (options.max && (typeof options.max !== 'number' || options.max < 0))
  570. throw new TypeError('max must be a non-negative number')
  571. // Kind of weird to have a default max of Infinity, but oh well.
  572. this[MAX] = options.max || Infinity;
  573. const lc = options.length || naiveLength;
  574. this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc;
  575. this[ALLOW_STALE] = options.stale || false;
  576. if (options.maxAge && typeof options.maxAge !== 'number')
  577. throw new TypeError('maxAge must be a number')
  578. this[MAX_AGE] = options.maxAge || 0;
  579. this[DISPOSE] = options.dispose;
  580. this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
  581. this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
  582. this.reset();
  583. }
  584. // resize the cache when the max changes.
  585. set max (mL) {
  586. if (typeof mL !== 'number' || mL < 0)
  587. throw new TypeError('max must be a non-negative number')
  588. this[MAX] = mL || Infinity;
  589. trim(this);
  590. }
  591. get max () {
  592. return this[MAX]
  593. }
  594. set allowStale (allowStale) {
  595. this[ALLOW_STALE] = !!allowStale;
  596. }
  597. get allowStale () {
  598. return this[ALLOW_STALE]
  599. }
  600. set maxAge (mA) {
  601. if (typeof mA !== 'number')
  602. throw new TypeError('maxAge must be a non-negative number')
  603. this[MAX_AGE] = mA;
  604. trim(this);
  605. }
  606. get maxAge () {
  607. return this[MAX_AGE]
  608. }
  609. // resize the cache when the lengthCalculator changes.
  610. set lengthCalculator (lC) {
  611. if (typeof lC !== 'function')
  612. lC = naiveLength;
  613. if (lC !== this[LENGTH_CALCULATOR]) {
  614. this[LENGTH_CALCULATOR] = lC;
  615. this[LENGTH] = 0;
  616. this[LRU_LIST].forEach(hit => {
  617. hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
  618. this[LENGTH] += hit.length;
  619. });
  620. }
  621. trim(this);
  622. }
  623. get lengthCalculator () { return this[LENGTH_CALCULATOR] }
  624. get length () { return this[LENGTH] }
  625. get itemCount () { return this[LRU_LIST].length }
  626. rforEach (fn, thisp) {
  627. thisp = thisp || this;
  628. for (let walker = this[LRU_LIST].tail; walker !== null;) {
  629. const prev = walker.prev;
  630. forEachStep(this, fn, walker, thisp);
  631. walker = prev;
  632. }
  633. }
  634. forEach (fn, thisp) {
  635. thisp = thisp || this;
  636. for (let walker = this[LRU_LIST].head; walker !== null;) {
  637. const next = walker.next;
  638. forEachStep(this, fn, walker, thisp);
  639. walker = next;
  640. }
  641. }
  642. keys () {
  643. return this[LRU_LIST].toArray().map(k => k.key)
  644. }
  645. values () {
  646. return this[LRU_LIST].toArray().map(k => k.value)
  647. }
  648. reset () {
  649. if (this[DISPOSE] &&
  650. this[LRU_LIST] &&
  651. this[LRU_LIST].length) {
  652. this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));
  653. }
  654. this[CACHE] = new Map(); // hash of items by key
  655. this[LRU_LIST] = new yallist(); // list of items in order of use recency
  656. this[LENGTH] = 0; // length of items in the list
  657. }
  658. dump () {
  659. return this[LRU_LIST].map(hit =>
  660. isStale(this, hit) ? false : {
  661. k: hit.key,
  662. v: hit.value,
  663. e: hit.now + (hit.maxAge || 0)
  664. }).toArray().filter(h => h)
  665. }
  666. dumpLru () {
  667. return this[LRU_LIST]
  668. }
  669. set (key, value, maxAge) {
  670. maxAge = maxAge || this[MAX_AGE];
  671. if (maxAge && typeof maxAge !== 'number')
  672. throw new TypeError('maxAge must be a number')
  673. const now = maxAge ? Date.now() : 0;
  674. const len = this[LENGTH_CALCULATOR](value, key);
  675. if (this[CACHE].has(key)) {
  676. if (len > this[MAX]) {
  677. del(this, this[CACHE].get(key));
  678. return false
  679. }
  680. const node = this[CACHE].get(key);
  681. const item = node.value;
  682. // dispose of the old one before overwriting
  683. // split out into 2 ifs for better coverage tracking
  684. if (this[DISPOSE]) {
  685. if (!this[NO_DISPOSE_ON_SET])
  686. this[DISPOSE](key, item.value);
  687. }
  688. item.now = now;
  689. item.maxAge = maxAge;
  690. item.value = value;
  691. this[LENGTH] += len - item.length;
  692. item.length = len;
  693. this.get(key);
  694. trim(this);
  695. return true
  696. }
  697. const hit = new Entry(key, value, len, now, maxAge);
  698. // oversized objects fall out of cache automatically.
  699. if (hit.length > this[MAX]) {
  700. if (this[DISPOSE])
  701. this[DISPOSE](key, value);
  702. return false
  703. }
  704. this[LENGTH] += hit.length;
  705. this[LRU_LIST].unshift(hit);
  706. this[CACHE].set(key, this[LRU_LIST].head);
  707. trim(this);
  708. return true
  709. }
  710. has (key) {
  711. if (!this[CACHE].has(key)) return false
  712. const hit = this[CACHE].get(key).value;
  713. return !isStale(this, hit)
  714. }
  715. get (key) {
  716. return get(this, key, true)
  717. }
  718. peek (key) {
  719. return get(this, key, false)
  720. }
  721. pop () {
  722. const node = this[LRU_LIST].tail;
  723. if (!node)
  724. return null
  725. del(this, node);
  726. return node.value
  727. }
  728. del (key) {
  729. del(this, this[CACHE].get(key));
  730. }
  731. load (arr) {
  732. // reset the cache
  733. this.reset();
  734. const now = Date.now();
  735. // A previous serialized cache has the most recent items first
  736. for (let l = arr.length - 1; l >= 0; l--) {
  737. const hit = arr[l];
  738. const expiresAt = hit.e || 0;
  739. if (expiresAt === 0)
  740. // the item was created without expiration in a non aged cache
  741. this.set(hit.k, hit.v);
  742. else {
  743. const maxAge = expiresAt - now;
  744. // dont add already expired items
  745. if (maxAge > 0) {
  746. this.set(hit.k, hit.v, maxAge);
  747. }
  748. }
  749. }
  750. }
  751. prune () {
  752. this[CACHE].forEach((value, key) => get(this, key, false));
  753. }
  754. }
  755. const get = (self, key, doUse) => {
  756. const node = self[CACHE].get(key);
  757. if (node) {
  758. const hit = node.value;
  759. if (isStale(self, hit)) {
  760. del(self, node);
  761. if (!self[ALLOW_STALE])
  762. return undefined
  763. } else {
  764. if (doUse) {
  765. if (self[UPDATE_AGE_ON_GET])
  766. node.value.now = Date.now();
  767. self[LRU_LIST].unshiftNode(node);
  768. }
  769. }
  770. return hit.value
  771. }
  772. };
  773. const isStale = (self, hit) => {
  774. if (!hit || (!hit.maxAge && !self[MAX_AGE]))
  775. return false
  776. const diff = Date.now() - hit.now;
  777. return hit.maxAge ? diff > hit.maxAge
  778. : self[MAX_AGE] && (diff > self[MAX_AGE])
  779. };
  780. const trim = self => {
  781. if (self[LENGTH] > self[MAX]) {
  782. for (let walker = self[LRU_LIST].tail;
  783. self[LENGTH] > self[MAX] && walker !== null;) {
  784. // We know that we're about to delete this one, and also
  785. // what the next least recently used key will be, so just
  786. // go ahead and set it now.
  787. const prev = walker.prev;
  788. del(self, walker);
  789. walker = prev;
  790. }
  791. }
  792. };
  793. const del = (self, node) => {
  794. if (node) {
  795. const hit = node.value;
  796. if (self[DISPOSE])
  797. self[DISPOSE](hit.key, hit.value);
  798. self[LENGTH] -= hit.length;
  799. self[CACHE].delete(hit.key);
  800. self[LRU_LIST].removeNode(node);
  801. }
  802. };
  803. class Entry {
  804. constructor (key, value, length, now, maxAge) {
  805. this.key = key;
  806. this.value = value;
  807. this.length = length;
  808. this.now = now;
  809. this.maxAge = maxAge || 0;
  810. }
  811. }
  812. const forEachStep = (self, fn, node, thisp) => {
  813. let hit = node.value;
  814. if (isStale(self, hit)) {
  815. del(self, node);
  816. if (!self[ALLOW_STALE])
  817. hit = undefined;
  818. }
  819. if (hit)
  820. fn.call(thisp, hit.value, hit.key, self);
  821. };
  822. var lruCache = LRUCache;
  823. function createCache(size = 500) {
  824. return new lruCache(size);
  825. }
  826. function isRelativeUrl(url) {
  827. const firstChar = url.charAt(0);
  828. return firstChar === '.' || firstChar === '~' || firstChar === '@';
  829. }
  830. const externalRE = /^(https?:)?\/\//;
  831. function isExternalUrl(url) {
  832. return externalRE.test(url);
  833. }
  834. const dataUrlRE = /^\s*data:/i;
  835. function isDataUrl(url) {
  836. return dataUrlRE.test(url);
  837. }
  838. /**
  839. * Parses string url into URL object.
  840. */
  841. function parseUrl(url) {
  842. const firstChar = url.charAt(0);
  843. if (firstChar === '~') {
  844. const secondChar = url.charAt(1);
  845. url = url.slice(secondChar === '/' ? 2 : 1);
  846. }
  847. return parseUriParts(url);
  848. }
  849. /**
  850. * vuejs/component-compiler-utils#22 Support uri fragment in transformed require
  851. * @param urlString an url as a string
  852. */
  853. function parseUriParts(urlString) {
  854. // A TypeError is thrown if urlString is not a string
  855. // @see https://nodejs.org/api/url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
  856. return url.parse(shared.isString(urlString) ? urlString : '', false, true);
  857. }
  858. const defaultAssetUrlOptions = {
  859. base: null,
  860. includeAbsolute: false,
  861. tags: {
  862. video: ['src', 'poster'],
  863. source: ['src'],
  864. img: ['src'],
  865. image: ['xlink:href', 'href'],
  866. use: ['xlink:href', 'href']
  867. }
  868. };
  869. const normalizeOptions = (options) => {
  870. if (Object.keys(options).some(key => shared.isArray(options[key]))) {
  871. // legacy option format which directly passes in tags config
  872. return Object.assign(Object.assign({}, defaultAssetUrlOptions), { tags: options });
  873. }
  874. return Object.assign(Object.assign({}, defaultAssetUrlOptions), options);
  875. };
  876. const createAssetUrlTransformWithOptions = (options) => {
  877. return (node, context) => transformAssetUrl(node, context, options);
  878. };
  879. /**
  880. * A `@vue/compiler-core` plugin that transforms relative asset urls into
  881. * either imports or absolute urls.
  882. *
  883. * ``` js
  884. * // Before
  885. * createVNode('img', { src: './logo.png' })
  886. *
  887. * // After
  888. * import _imports_0 from './logo.png'
  889. * createVNode('img', { src: _imports_0 })
  890. * ```
  891. */
  892. const transformAssetUrl = (node, context, options = defaultAssetUrlOptions) => {
  893. if (node.type === 1 /* ELEMENT */) {
  894. if (!node.props.length) {
  895. return;
  896. }
  897. const tags = options.tags || defaultAssetUrlOptions.tags;
  898. const attrs = tags[node.tag];
  899. const wildCardAttrs = tags['*'];
  900. if (!attrs && !wildCardAttrs) {
  901. return;
  902. }
  903. const assetAttrs = (attrs || []).concat(wildCardAttrs || []);
  904. node.props.forEach((attr, index) => {
  905. if (attr.type !== 6 /* ATTRIBUTE */ ||
  906. !assetAttrs.includes(attr.name) ||
  907. !attr.value ||
  908. isExternalUrl(attr.value.content) ||
  909. isDataUrl(attr.value.content) ||
  910. attr.value.content[0] === '#' ||
  911. (!options.includeAbsolute && !isRelativeUrl(attr.value.content))) {
  912. return;
  913. }
  914. const url = parseUrl(attr.value.content);
  915. if (options.base && attr.value.content[0] === '.') {
  916. // explicit base - directly rewrite relative urls into absolute url
  917. // to avoid generating extra imports
  918. // Allow for full hostnames provided in options.base
  919. const base = parseUrl(options.base);
  920. const protocol = base.protocol || '';
  921. const host = base.host ? protocol + '//' + base.host : '';
  922. const basePath = base.path || '/';
  923. // when packaged in the browser, path will be using the posix-
  924. // only version provided by rollup-plugin-node-builtins.
  925. attr.value.content =
  926. host +
  927. (path__default.posix || path__default).join(basePath, url.path + (url.hash || ''));
  928. return;
  929. }
  930. // otherwise, transform the url into an import.
  931. // this assumes a bundler will resolve the import into the correct
  932. // absolute url (e.g. webpack file-loader)
  933. const exp = getImportsExpressionExp(url.path, url.hash, attr.loc, context);
  934. node.props[index] = {
  935. type: 7 /* DIRECTIVE */,
  936. name: 'bind',
  937. arg: compilerCore.createSimpleExpression(attr.name, true, attr.loc),
  938. exp,
  939. modifiers: [],
  940. loc: attr.loc
  941. };
  942. });
  943. }
  944. };
  945. function getImportsExpressionExp(path, hash, loc, context) {
  946. if (path) {
  947. let name;
  948. let exp;
  949. const existingIndex = context.imports.findIndex(i => i.path === path);
  950. if (existingIndex > -1) {
  951. name = `_imports_${existingIndex}`;
  952. exp = context.imports[existingIndex].exp;
  953. }
  954. else {
  955. name = `_imports_${context.imports.length}`;
  956. exp = compilerCore.createSimpleExpression(name, false, loc, 3 /* CAN_STRINGIFY */);
  957. context.imports.push({ exp, path });
  958. }
  959. if (!hash) {
  960. return exp;
  961. }
  962. const hashExp = `${name} + '${hash}'`;
  963. const existingHoistIndex = context.hoists.findIndex(h => {
  964. return (h &&
  965. h.type === 4 /* SIMPLE_EXPRESSION */ &&
  966. !h.isStatic &&
  967. h.content === hashExp);
  968. });
  969. if (existingHoistIndex > -1) {
  970. return compilerCore.createSimpleExpression(`_hoisted_${existingHoistIndex + 1}`, false, loc, 3 /* CAN_STRINGIFY */);
  971. }
  972. return context.hoist(compilerCore.createSimpleExpression(hashExp, false, loc, 3 /* CAN_STRINGIFY */));
  973. }
  974. else {
  975. return compilerCore.createSimpleExpression(`''`, false, loc, 3 /* CAN_STRINGIFY */);
  976. }
  977. }
  978. const srcsetTags = ['img', 'source'];
  979. // http://w3c.github.io/html/semantics-embedded-content.html#ref-for-image-candidate-string-5
  980. const escapedSpaceCharacters = /( |\\t|\\n|\\f|\\r)+/g;
  981. const createSrcsetTransformWithOptions = (options) => {
  982. return (node, context) => transformSrcset(node, context, options);
  983. };
  984. const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
  985. if (node.type === 1 /* ELEMENT */) {
  986. if (srcsetTags.includes(node.tag) && node.props.length) {
  987. node.props.forEach((attr, index) => {
  988. if (attr.name === 'srcset' && attr.type === 6 /* ATTRIBUTE */) {
  989. if (!attr.value)
  990. return;
  991. const value = attr.value.content;
  992. if (!value)
  993. return;
  994. const imageCandidates = value.split(',').map(s => {
  995. // The attribute value arrives here with all whitespace, except
  996. // normal spaces, represented by escape sequences
  997. const [url, descriptor] = s
  998. .replace(escapedSpaceCharacters, ' ')
  999. .trim()
  1000. .split(' ', 2);
  1001. return { url, descriptor };
  1002. });
  1003. // data urls contains comma after the encoding so we need to re-merge
  1004. // them
  1005. for (let i = 0; i < imageCandidates.length; i++) {
  1006. const { url } = imageCandidates[i];
  1007. if (isDataUrl(url)) {
  1008. imageCandidates[i + 1].url =
  1009. url + ',' + imageCandidates[i + 1].url;
  1010. imageCandidates.splice(i, 1);
  1011. }
  1012. }
  1013. const hasQualifiedUrl = imageCandidates.some(({ url }) => {
  1014. return (!isExternalUrl(url) &&
  1015. !isDataUrl(url) &&
  1016. (options.includeAbsolute || isRelativeUrl(url)));
  1017. });
  1018. // When srcset does not contain any qualified URLs, skip transforming
  1019. if (!hasQualifiedUrl) {
  1020. return;
  1021. }
  1022. if (options.base) {
  1023. const base = options.base;
  1024. const set = [];
  1025. imageCandidates.forEach(({ url, descriptor }) => {
  1026. descriptor = descriptor ? ` ${descriptor}` : ``;
  1027. if (isRelativeUrl(url)) {
  1028. set.push((path__default.posix || path__default).join(base, url) + descriptor);
  1029. }
  1030. else {
  1031. set.push(url + descriptor);
  1032. }
  1033. });
  1034. attr.value.content = set.join(', ');
  1035. return;
  1036. }
  1037. const compoundExpression = compilerCore.createCompoundExpression([], attr.loc);
  1038. imageCandidates.forEach(({ url, descriptor }, index) => {
  1039. if (!isExternalUrl(url) &&
  1040. !isDataUrl(url) &&
  1041. (options.includeAbsolute || isRelativeUrl(url))) {
  1042. const { path } = parseUrl(url);
  1043. let exp;
  1044. if (path) {
  1045. const existingImportsIndex = context.imports.findIndex(i => i.path === path);
  1046. if (existingImportsIndex > -1) {
  1047. exp = compilerCore.createSimpleExpression(`_imports_${existingImportsIndex}`, false, attr.loc, 3 /* CAN_STRINGIFY */);
  1048. }
  1049. else {
  1050. exp = compilerCore.createSimpleExpression(`_imports_${context.imports.length}`, false, attr.loc, 3 /* CAN_STRINGIFY */);
  1051. context.imports.push({ exp, path });
  1052. }
  1053. compoundExpression.children.push(exp);
  1054. }
  1055. }
  1056. else {
  1057. const exp = compilerCore.createSimpleExpression(`"${url}"`, false, attr.loc, 3 /* CAN_STRINGIFY */);
  1058. compoundExpression.children.push(exp);
  1059. }
  1060. const isNotLast = imageCandidates.length - 1 > index;
  1061. if (descriptor && isNotLast) {
  1062. compoundExpression.children.push(` + ' ${descriptor}, ' + `);
  1063. }
  1064. else if (descriptor) {
  1065. compoundExpression.children.push(` + ' ${descriptor}'`);
  1066. }
  1067. else if (isNotLast) {
  1068. compoundExpression.children.push(` + ', ' + `);
  1069. }
  1070. });
  1071. const hoisted = context.hoist(compoundExpression);
  1072. hoisted.constType = 3 /* CAN_STRINGIFY */;
  1073. node.props[index] = {
  1074. type: 7 /* DIRECTIVE */,
  1075. name: 'bind',
  1076. arg: compilerCore.createSimpleExpression('srcset', true, attr.loc),
  1077. exp: hoisted,
  1078. modifiers: [],
  1079. loc: attr.loc
  1080. };
  1081. }
  1082. });
  1083. }
  1084. }
  1085. };
  1086. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  1087. function getDefaultExportFromCjs (x) {
  1088. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
  1089. }
  1090. function getAugmentedNamespace(n) {
  1091. if (n.__esModule) return n;
  1092. var a = Object.defineProperty({}, '__esModule', {value: true});
  1093. Object.keys(n).forEach(function (k) {
  1094. var d = Object.getOwnPropertyDescriptor(n, k);
  1095. Object.defineProperty(a, k, d.get ? d : {
  1096. enumerable: true,
  1097. get: function () {
  1098. return n[k];
  1099. }
  1100. });
  1101. });
  1102. return a;
  1103. }
  1104. function createCommonjsModule(fn) {
  1105. var module = { exports: {} };
  1106. return fn(module, module.exports), module.exports;
  1107. }
  1108. function commonjsRequire (path) {
  1109. 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.');
  1110. }
  1111. var consolidate = createCommonjsModule(function (module, exports) {
  1112. /*
  1113. * Engines which do not support caching of their file contents
  1114. * should use the `read()` function defined in consolidate.js
  1115. * On top of this, when an engine compiles to a `Function`,
  1116. * these functions should either be cached within consolidate.js
  1117. * or the engine itself via `options.cache`. This will allow
  1118. * users and frameworks to pass `options.cache = true` for
  1119. * `NODE_ENV=production`, however edit the file(s) without
  1120. * re-loading the application in development.
  1121. */
  1122. /**
  1123. * Module dependencies.
  1124. */
  1125. var path = path__default;
  1126. var join = path.join;
  1127. var resolve = path.resolve;
  1128. var extname = path.extname;
  1129. var dirname = path.dirname;
  1130. var isAbsolute = path.isAbsolute;
  1131. var readCache = {};
  1132. /**
  1133. * Require cache.
  1134. */
  1135. var cacheStore = {};
  1136. /**
  1137. * Require cache.
  1138. */
  1139. var requires = {};
  1140. /**
  1141. * Clear the cache.
  1142. *
  1143. * @api public
  1144. */
  1145. exports.clearCache = function() {
  1146. readCache = {};
  1147. cacheStore = {};
  1148. };
  1149. /**
  1150. * Conditionally cache `compiled` template based
  1151. * on the `options` filename and `.cache` boolean.
  1152. *
  1153. * @param {Object} options
  1154. * @param {Function} compiled
  1155. * @return {Function}
  1156. * @api private
  1157. */
  1158. function cache(options, compiled) {
  1159. // cachable
  1160. if (compiled && options.filename && options.cache) {
  1161. delete readCache[options.filename];
  1162. cacheStore[options.filename] = compiled;
  1163. return compiled;
  1164. }
  1165. // check cache
  1166. if (options.filename && options.cache) {
  1167. return cacheStore[options.filename];
  1168. }
  1169. return compiled;
  1170. }
  1171. /**
  1172. * Read `path` with `options` with
  1173. * callback `(err, str)`. When `options.cache`
  1174. * is true the template string will be cached.
  1175. *
  1176. * @param {String} options
  1177. * @param {Function} cb
  1178. * @api private
  1179. */
  1180. function read(path, options, cb) {
  1181. var str = readCache[path];
  1182. var cached = options.cache && str && typeof str === 'string';
  1183. // cached (only if cached is a string and not a compiled template function)
  1184. if (cached) return cb(null, str);
  1185. // read
  1186. fs__default.readFile(path, 'utf8', function(err, str) {
  1187. if (err) return cb(err);
  1188. // remove extraneous utf8 BOM marker
  1189. str = str.replace(/^\uFEFF/, '');
  1190. if (options.cache) readCache[path] = str;
  1191. cb(null, str);
  1192. });
  1193. }
  1194. /**
  1195. * Read `path` with `options` with
  1196. * callback `(err, str)`. When `options.cache`
  1197. * is true the partial string will be cached.
  1198. *
  1199. * @param {String} options
  1200. * @param {Function} fn
  1201. * @api private
  1202. */
  1203. function readPartials(path, options, cb) {
  1204. if (!options.partials) return cb();
  1205. var keys = Object.keys(options.partials);
  1206. var partials = {};
  1207. function next(index) {
  1208. if (index === keys.length) return cb(null, partials);
  1209. var key = keys[index];
  1210. var partialPath = options.partials[key];
  1211. if (partialPath === undefined || partialPath === null || partialPath === false) {
  1212. return next(++index);
  1213. }
  1214. var file;
  1215. if (isAbsolute(partialPath)) {
  1216. if (extname(partialPath) !== '') {
  1217. file = partialPath;
  1218. } else {
  1219. file = join(partialPath + extname(path));
  1220. }
  1221. } else {
  1222. file = join(dirname(path), partialPath + extname(path));
  1223. }
  1224. read(file, options, function(err, str) {
  1225. if (err) return cb(err);
  1226. partials[key] = str;
  1227. next(++index);
  1228. });
  1229. }
  1230. next(0);
  1231. }
  1232. /**
  1233. * promisify
  1234. */
  1235. function promisify(cb, fn) {
  1236. return new Promise(function(resolve, reject) {
  1237. cb = cb || function(err, html) {
  1238. if (err) {
  1239. return reject(err);
  1240. }
  1241. resolve(html);
  1242. };
  1243. fn(cb);
  1244. });
  1245. }
  1246. /**
  1247. * fromStringRenderer
  1248. */
  1249. function fromStringRenderer(name) {
  1250. return function(path, options, cb) {
  1251. options.filename = path;
  1252. return promisify(cb, function(cb) {
  1253. readPartials(path, options, function(err, partials) {
  1254. var extend = (requires.extend || (requires.extend = util__default._extend));
  1255. var opts = extend({}, options);
  1256. opts.partials = partials;
  1257. if (err) return cb(err);
  1258. if (cache(opts)) {
  1259. exports[name].render('', opts, cb);
  1260. } else {
  1261. read(path, opts, function(err, str) {
  1262. if (err) return cb(err);
  1263. exports[name].render(str, opts, cb);
  1264. });
  1265. }
  1266. });
  1267. });
  1268. };
  1269. }
  1270. /**
  1271. * velocity support.
  1272. */
  1273. exports.velocityjs = fromStringRenderer('velocityjs');
  1274. /**
  1275. * velocity string support.
  1276. */
  1277. exports.velocityjs.render = function(str, options, cb) {
  1278. return promisify(cb, function(cb) {
  1279. var engine = requires.velocityjs || (requires.velocityjs = require('velocityjs'));
  1280. try {
  1281. options.locals = options;
  1282. cb(null, engine.render(str, options).trimLeft());
  1283. } catch (err) {
  1284. cb(err);
  1285. }
  1286. });
  1287. };
  1288. /**
  1289. * Liquid support.
  1290. */
  1291. exports.liquid = fromStringRenderer('liquid');
  1292. /**
  1293. * Liquid string support.
  1294. */
  1295. /**
  1296. * Note that in order to get filters and custom tags we've had to push
  1297. * all user-defined locals down into @locals. However, just to make things
  1298. * backwards-compatible, any property of `options` that is left after
  1299. * processing and removing `locals`, `meta`, `filters`, `customTags` and
  1300. * `includeDir` will also become a local.
  1301. */
  1302. function _renderTinyliquid(engine, str, options, cb) {
  1303. var context = engine.newContext();
  1304. var k;
  1305. /**
  1306. * Note that there's a bug in the library that doesn't allow us to pass
  1307. * the locals to newContext(), hence looping through the keys:
  1308. */
  1309. if (options.locals) {
  1310. for (k in options.locals) {
  1311. context.setLocals(k, options.locals[k]);
  1312. }
  1313. delete options.locals;
  1314. }
  1315. if (options.meta) {
  1316. context.setLocals('page', options.meta);
  1317. delete options.meta;
  1318. }
  1319. /**
  1320. * Add any defined filters:
  1321. */
  1322. if (options.filters) {
  1323. for (k in options.filters) {
  1324. context.setFilter(k, options.filters[k]);
  1325. }
  1326. delete options.filters;
  1327. }
  1328. /**
  1329. * Set up a callback for the include directory:
  1330. */
  1331. var includeDir = options.includeDir || process.cwd();
  1332. context.onInclude(function(name, callback) {
  1333. var extname = path.extname(name) ? '' : '.liquid';
  1334. var filename = path.resolve(includeDir, name + extname);
  1335. fs__default.readFile(filename, {encoding: 'utf8'}, function(err, data) {
  1336. if (err) return callback(err);
  1337. callback(null, engine.parse(data));
  1338. });
  1339. });
  1340. delete options.includeDir;
  1341. /**
  1342. * The custom tag functions need to have their results pushed back
  1343. * through the parser, so set up a shim before calling the provided
  1344. * callback:
  1345. */
  1346. var compileOptions = {
  1347. customTags: {}
  1348. };
  1349. if (options.customTags) {
  1350. var tagFunctions = options.customTags;
  1351. for (k in options.customTags) {
  1352. /*Tell jshint there's no problem with having this function in the loop */
  1353. /*jshint -W083 */
  1354. compileOptions.customTags[k] = function(context, name, body) {
  1355. var tpl = tagFunctions[name](body.trim());
  1356. context.astStack.push(engine.parse(tpl));
  1357. };
  1358. /*jshint +W083 */
  1359. }
  1360. delete options.customTags;
  1361. }
  1362. /**
  1363. * Now anything left in `options` becomes a local:
  1364. */
  1365. for (k in options) {
  1366. context.setLocals(k, options[k]);
  1367. }
  1368. /**
  1369. * Finally, execute the template:
  1370. */
  1371. var tmpl = cache(context) || cache(context, engine.compile(str, compileOptions));
  1372. tmpl(context, cb);
  1373. }
  1374. exports.liquid.render = function(str, options, cb) {
  1375. return promisify(cb, function(cb) {
  1376. var engine = requires.liquid;
  1377. var Liquid;
  1378. try {
  1379. // set up tinyliquid engine
  1380. engine = requires.liquid = require('tinyliquid');
  1381. // use tinyliquid engine
  1382. _renderTinyliquid(engine, str, options, cb);
  1383. return;
  1384. } catch (err) {
  1385. // set up liquid-node engine
  1386. try {
  1387. Liquid = requires.liquid = require('liquid-node');
  1388. engine = new Liquid.Engine();
  1389. } catch (err) {
  1390. throw err;
  1391. }
  1392. }
  1393. // use liquid-node engine
  1394. try {
  1395. var locals = options.locals || {};
  1396. if (options.meta) {
  1397. locals.pages = options.meta;
  1398. delete options.meta;
  1399. }
  1400. /**
  1401. * Add any defined filters:
  1402. */
  1403. if (options.filters) {
  1404. engine.registerFilters(options.filters);
  1405. delete options.filters;
  1406. }
  1407. /**
  1408. * Set up a callback for the include directory:
  1409. */
  1410. var includeDir = options.includeDir || process.cwd();
  1411. engine.fileSystem = new Liquid.LocalFileSystem(includeDir, 'liquid');
  1412. delete options.includeDir;
  1413. /**
  1414. * The custom tag functions need to have their results pushed back
  1415. * through the parser, so set up a shim before calling the provided
  1416. * callback:
  1417. */
  1418. if (options.customTags) {
  1419. var tagFunctions = options.customTags;
  1420. for (k in options.customTags) {
  1421. engine.registerTag(k, tagFunctions[k]);
  1422. }
  1423. delete options.customTags;
  1424. }
  1425. /**
  1426. * Now anything left in `options` becomes a local:
  1427. */
  1428. for (var k in options) {
  1429. locals[k] = options[k];
  1430. }
  1431. /**
  1432. * Finally, execute the template:
  1433. */
  1434. return engine
  1435. .parseAndRender(str, locals)
  1436. .nodeify(function(err, result) {
  1437. if (err) {
  1438. throw new Error(err);
  1439. } else {
  1440. return cb(null, result);
  1441. }
  1442. });
  1443. } catch (err) {
  1444. cb(err);
  1445. }
  1446. });
  1447. };
  1448. /**
  1449. * Jade support.
  1450. */
  1451. exports.jade = function(path, options, cb) {
  1452. return promisify(cb, function(cb) {
  1453. var engine = requires.jade;
  1454. if (!engine) {
  1455. try {
  1456. engine = requires.jade = require('jade');
  1457. } catch (err) {
  1458. try {
  1459. engine = requires.jade = require('then-jade');
  1460. } catch (otherError) {
  1461. throw err;
  1462. }
  1463. }
  1464. }
  1465. try {
  1466. var tmpl = cache(options) || cache(options, engine.compileFile(path, options));
  1467. cb(null, tmpl(options));
  1468. } catch (err) {
  1469. cb(err);
  1470. }
  1471. });
  1472. };
  1473. /**
  1474. * Jade string support.
  1475. */
  1476. exports.jade.render = function(str, options, cb) {
  1477. return promisify(cb, function(cb) {
  1478. var engine = requires.jade;
  1479. if (!engine) {
  1480. try {
  1481. engine = requires.jade = require('jade');
  1482. } catch (err) {
  1483. try {
  1484. engine = requires.jade = require('then-jade');
  1485. } catch (otherError) {
  1486. throw err;
  1487. }
  1488. }
  1489. }
  1490. try {
  1491. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1492. cb(null, tmpl(options));
  1493. } catch (err) {
  1494. cb(err);
  1495. }
  1496. });
  1497. };
  1498. /**
  1499. * Dust support.
  1500. */
  1501. exports.dust = fromStringRenderer('dust');
  1502. /**
  1503. * Dust string support.
  1504. */
  1505. exports.dust.render = function(str, options, cb) {
  1506. return promisify(cb, function(cb) {
  1507. var engine = requires.dust;
  1508. if (!engine) {
  1509. try {
  1510. engine = requires.dust = require('dust');
  1511. } catch (err) {
  1512. try {
  1513. engine = requires.dust = require('dustjs-helpers');
  1514. } catch (err) {
  1515. engine = requires.dust = require('dustjs-linkedin');
  1516. }
  1517. }
  1518. }
  1519. var ext = 'dust';
  1520. var views = '.';
  1521. if (options) {
  1522. if (options.ext) ext = options.ext;
  1523. if (options.views) views = options.views;
  1524. if (options.settings && options.settings.views) views = options.settings.views;
  1525. }
  1526. if (!options || (options && !options.cache)) engine.cache = {};
  1527. engine.onLoad = function(path, callback) {
  1528. if (extname(path) === '') path += '.' + ext;
  1529. if (path[0] !== '/') path = views + '/' + path;
  1530. read(path, options, callback);
  1531. };
  1532. try {
  1533. var templateName;
  1534. if (options.filename) {
  1535. templateName = options.filename.replace(new RegExp('^' + views + '/'), '').replace(new RegExp('\\.' + ext), '');
  1536. }
  1537. var tmpl = cache(options) || cache(options, engine.compileFn(str, templateName));
  1538. tmpl(options, cb);
  1539. } catch (err) {
  1540. cb(err);
  1541. }
  1542. });
  1543. };
  1544. /**
  1545. * Swig support.
  1546. */
  1547. exports.swig = fromStringRenderer('swig');
  1548. /**
  1549. * Swig string support.
  1550. */
  1551. exports.swig.render = function(str, options, cb) {
  1552. return promisify(cb, function(cb) {
  1553. var engine = requires.swig;
  1554. if (!engine) {
  1555. try {
  1556. engine = requires.swig = require('swig');
  1557. } catch (err) {
  1558. try {
  1559. engine = requires.swig = require('swig-templates');
  1560. } catch (otherError) {
  1561. throw err;
  1562. }
  1563. }
  1564. }
  1565. try {
  1566. if (options.cache === true) options.cache = 'memory';
  1567. engine.setDefaults({ cache: options.cache });
  1568. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1569. cb(null, tmpl(options));
  1570. } catch (err) {
  1571. cb(err);
  1572. }
  1573. });
  1574. };
  1575. /**
  1576. * Razor support.
  1577. */
  1578. exports.razor = function(path, options, cb) {
  1579. return promisify(cb, function(cb) {
  1580. var engine = requires.razor;
  1581. if (!engine) {
  1582. try {
  1583. engine = requires.razor = require('razor-tmpl');
  1584. } catch (err) {
  1585. throw err;
  1586. }
  1587. }
  1588. try {
  1589. var tmpl = cache(options) || cache(options, (locals) => {
  1590. console.log('Rendering razor file', path);
  1591. return engine.renderFileSync(path, locals);
  1592. });
  1593. cb(null, tmpl(options));
  1594. } catch (err) {
  1595. cb(err);
  1596. }
  1597. });
  1598. };
  1599. /**
  1600. * razor string support.
  1601. */
  1602. exports.razor.render = function(str, options, cb) {
  1603. return promisify(cb, function(cb) {
  1604. try {
  1605. var engine = requires.razor = require('razor-tmpl');
  1606. } catch (err) {
  1607. throw err;
  1608. }
  1609. try {
  1610. var tf = engine.compile(str);
  1611. var tmpl = cache(options) || cache(options, tf);
  1612. cb(null, tmpl(options));
  1613. } catch (err) {
  1614. cb(err);
  1615. }
  1616. });
  1617. };
  1618. /**
  1619. * Atpl support.
  1620. */
  1621. exports.atpl = fromStringRenderer('atpl');
  1622. /**
  1623. * Atpl string support.
  1624. */
  1625. exports.atpl.render = function(str, options, cb) {
  1626. return promisify(cb, function(cb) {
  1627. var engine = requires.atpl || (requires.atpl = require('atpl'));
  1628. try {
  1629. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1630. cb(null, tmpl(options));
  1631. } catch (err) {
  1632. cb(err);
  1633. }
  1634. });
  1635. };
  1636. /**
  1637. * Liquor support,
  1638. */
  1639. exports.liquor = fromStringRenderer('liquor');
  1640. /**
  1641. * Liquor string support.
  1642. */
  1643. exports.liquor.render = function(str, options, cb) {
  1644. return promisify(cb, function(cb) {
  1645. var engine = requires.liquor || (requires.liquor = require('liquor'));
  1646. try {
  1647. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1648. cb(null, tmpl(options));
  1649. } catch (err) {
  1650. cb(err);
  1651. }
  1652. });
  1653. };
  1654. /**
  1655. * Twig support.
  1656. */
  1657. exports.twig = fromStringRenderer('twig');
  1658. /**
  1659. * Twig string support.
  1660. */
  1661. exports.twig.render = function(str, options, cb) {
  1662. return promisify(cb, function(cb) {
  1663. var engine = requires.twig || (requires.twig = require('twig').twig);
  1664. var templateData = {
  1665. data: str,
  1666. allowInlineIncludes: options.allowInlineIncludes,
  1667. namespaces: options.namespaces,
  1668. path: options.path
  1669. };
  1670. try {
  1671. var tmpl = cache(templateData) || cache(templateData, engine(templateData));
  1672. cb(null, tmpl.render(options));
  1673. } catch (err) {
  1674. cb(err);
  1675. }
  1676. });
  1677. };
  1678. /**
  1679. * EJS support.
  1680. */
  1681. exports.ejs = fromStringRenderer('ejs');
  1682. /**
  1683. * EJS string support.
  1684. */
  1685. exports.ejs.render = function(str, options, cb) {
  1686. return promisify(cb, function(cb) {
  1687. var engine = requires.ejs || (requires.ejs = require('ejs'));
  1688. try {
  1689. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1690. cb(null, tmpl(options));
  1691. } catch (err) {
  1692. cb(err);
  1693. }
  1694. });
  1695. };
  1696. /**
  1697. * Eco support.
  1698. */
  1699. exports.eco = fromStringRenderer('eco');
  1700. /**
  1701. * Eco string support.
  1702. */
  1703. exports.eco.render = function(str, options, cb) {
  1704. return promisify(cb, function(cb) {
  1705. var engine = requires.eco || (requires.eco = require('eco'));
  1706. try {
  1707. cb(null, engine.render(str, options));
  1708. } catch (err) {
  1709. cb(err);
  1710. }
  1711. });
  1712. };
  1713. /**
  1714. * Jazz support.
  1715. */
  1716. exports.jazz = fromStringRenderer('jazz');
  1717. /**
  1718. * Jazz string support.
  1719. */
  1720. exports.jazz.render = function(str, options, cb) {
  1721. return promisify(cb, function(cb) {
  1722. var engine = requires.jazz || (requires.jazz = require('jazz'));
  1723. try {
  1724. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1725. tmpl.eval(options, function(str) {
  1726. cb(null, str);
  1727. });
  1728. } catch (err) {
  1729. cb(err);
  1730. }
  1731. });
  1732. };
  1733. /**
  1734. * JQTPL support.
  1735. */
  1736. exports.jqtpl = fromStringRenderer('jqtpl');
  1737. /**
  1738. * JQTPL string support.
  1739. */
  1740. exports.jqtpl.render = function(str, options, cb) {
  1741. return promisify(cb, function(cb) {
  1742. var engine = requires.jqtpl || (requires.jqtpl = require('jqtpl'));
  1743. try {
  1744. engine.template(str, str);
  1745. cb(null, engine.tmpl(str, options));
  1746. } catch (err) {
  1747. cb(err);
  1748. }
  1749. });
  1750. };
  1751. /**
  1752. * Haml support.
  1753. */
  1754. exports.haml = fromStringRenderer('haml');
  1755. /**
  1756. * Haml string support.
  1757. */
  1758. exports.haml.render = function(str, options, cb) {
  1759. return promisify(cb, function(cb) {
  1760. var engine = requires.haml || (requires.haml = require('hamljs'));
  1761. try {
  1762. options.locals = options;
  1763. cb(null, engine.render(str, options).trimLeft());
  1764. } catch (err) {
  1765. cb(err);
  1766. }
  1767. });
  1768. };
  1769. /**
  1770. * Hamlet support.
  1771. */
  1772. exports.hamlet = fromStringRenderer('hamlet');
  1773. /**
  1774. * Hamlet string support.
  1775. */
  1776. exports.hamlet.render = function(str, options, cb) {
  1777. return promisify(cb, function(cb) {
  1778. var engine = requires.hamlet || (requires.hamlet = require('hamlet'));
  1779. try {
  1780. options.locals = options;
  1781. cb(null, engine.render(str, options).trimLeft());
  1782. } catch (err) {
  1783. cb(err);
  1784. }
  1785. });
  1786. };
  1787. /**
  1788. * Whiskers support.
  1789. */
  1790. exports.whiskers = function(path, options, cb) {
  1791. return promisify(cb, function(cb) {
  1792. var engine = requires.whiskers || (requires.whiskers = require('whiskers'));
  1793. engine.__express(path, options, cb);
  1794. });
  1795. };
  1796. /**
  1797. * Whiskers string support.
  1798. */
  1799. exports.whiskers.render = function(str, options, cb) {
  1800. return promisify(cb, function(cb) {
  1801. var engine = requires.whiskers || (requires.whiskers = require('whiskers'));
  1802. try {
  1803. cb(null, engine.render(str, options));
  1804. } catch (err) {
  1805. cb(err);
  1806. }
  1807. });
  1808. };
  1809. /**
  1810. * Coffee-HAML support.
  1811. */
  1812. exports['haml-coffee'] = fromStringRenderer('haml-coffee');
  1813. /**
  1814. * Coffee-HAML string support.
  1815. */
  1816. exports['haml-coffee'].render = function(str, options, cb) {
  1817. return promisify(cb, function(cb) {
  1818. var engine = requires['haml-coffee'] || (requires['haml-coffee'] = require('haml-coffee'));
  1819. try {
  1820. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1821. cb(null, tmpl(options));
  1822. } catch (err) {
  1823. cb(err);
  1824. }
  1825. });
  1826. };
  1827. /**
  1828. * Hogan support.
  1829. */
  1830. exports.hogan = fromStringRenderer('hogan');
  1831. /**
  1832. * Hogan string support.
  1833. */
  1834. exports.hogan.render = function(str, options, cb) {
  1835. return promisify(cb, function(cb) {
  1836. var engine = requires.hogan || (requires.hogan = require('hogan.js'));
  1837. try {
  1838. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1839. cb(null, tmpl.render(options, options.partials));
  1840. } catch (err) {
  1841. cb(err);
  1842. }
  1843. });
  1844. };
  1845. /**
  1846. * templayed.js support.
  1847. */
  1848. exports.templayed = fromStringRenderer('templayed');
  1849. /**
  1850. * templayed.js string support.
  1851. */
  1852. exports.templayed.render = function(str, options, cb) {
  1853. return promisify(cb, function(cb) {
  1854. var engine = requires.templayed || (requires.templayed = require('templayed'));
  1855. try {
  1856. var tmpl = cache(options) || cache(options, engine(str));
  1857. cb(null, tmpl(options));
  1858. } catch (err) {
  1859. cb(err);
  1860. }
  1861. });
  1862. };
  1863. /**
  1864. * Handlebars support.
  1865. */
  1866. exports.handlebars = fromStringRenderer('handlebars');
  1867. /**
  1868. * Handlebars string support.
  1869. */
  1870. exports.handlebars.render = function(str, options, cb) {
  1871. return promisify(cb, function(cb) {
  1872. var engine = requires.handlebars || (requires.handlebars = require('handlebars'));
  1873. try {
  1874. for (var partial in options.partials) {
  1875. engine.registerPartial(partial, options.partials[partial]);
  1876. }
  1877. for (var helper in options.helpers) {
  1878. engine.registerHelper(helper, options.helpers[helper]);
  1879. }
  1880. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1881. cb(null, tmpl(options));
  1882. } catch (err) {
  1883. cb(err);
  1884. }
  1885. });
  1886. };
  1887. /**
  1888. * Underscore support.
  1889. */
  1890. exports.underscore = fromStringRenderer('underscore');
  1891. /**
  1892. * Underscore string support.
  1893. */
  1894. exports.underscore.render = function(str, options, cb) {
  1895. return promisify(cb, function(cb) {
  1896. var engine = requires.underscore || (requires.underscore = require('underscore'));
  1897. try {
  1898. const partials = {};
  1899. for (var partial in options.partials) {
  1900. partials[partial] = engine.template(options.partials[partial]);
  1901. }
  1902. options.partials = partials;
  1903. var tmpl = cache(options) || cache(options, engine.template(str, null, options));
  1904. cb(null, tmpl(options).replace(/\n$/, ''));
  1905. } catch (err) {
  1906. cb(err);
  1907. }
  1908. });
  1909. };
  1910. /**
  1911. * Lodash support.
  1912. */
  1913. exports.lodash = fromStringRenderer('lodash');
  1914. /**
  1915. * Lodash string support.
  1916. */
  1917. exports.lodash.render = function(str, options, cb) {
  1918. return promisify(cb, function(cb) {
  1919. var engine = requires.lodash || (requires.lodash = require('lodash'));
  1920. try {
  1921. var tmpl = cache(options) || cache(options, engine.template(str, options));
  1922. cb(null, tmpl(options).replace(/\n$/, ''));
  1923. } catch (err) {
  1924. cb(err);
  1925. }
  1926. });
  1927. };
  1928. /**
  1929. * Pug support. (formerly Jade)
  1930. */
  1931. exports.pug = function(path, options, cb) {
  1932. return promisify(cb, function(cb) {
  1933. var engine = requires.pug;
  1934. if (!engine) {
  1935. try {
  1936. engine = requires.pug = require('pug');
  1937. } catch (err) {
  1938. try {
  1939. engine = requires.pug = require('then-pug');
  1940. } catch (otherError) {
  1941. throw err;
  1942. }
  1943. }
  1944. }
  1945. try {
  1946. var tmpl = cache(options) || cache(options, engine.compileFile(path, options));
  1947. cb(null, tmpl(options));
  1948. } catch (err) {
  1949. cb(err);
  1950. }
  1951. });
  1952. };
  1953. /**
  1954. * Pug string support.
  1955. */
  1956. exports.pug.render = function(str, options, cb) {
  1957. return promisify(cb, function(cb) {
  1958. var engine = requires.pug;
  1959. if (!engine) {
  1960. try {
  1961. engine = requires.pug = require('pug');
  1962. } catch (err) {
  1963. try {
  1964. engine = requires.pug = require('then-pug');
  1965. } catch (otherError) {
  1966. throw err;
  1967. }
  1968. }
  1969. }
  1970. try {
  1971. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1972. cb(null, tmpl(options));
  1973. } catch (err) {
  1974. cb(err);
  1975. }
  1976. });
  1977. };
  1978. /**
  1979. * QEJS support.
  1980. */
  1981. exports.qejs = fromStringRenderer('qejs');
  1982. /**
  1983. * QEJS string support.
  1984. */
  1985. exports.qejs.render = function(str, options, cb) {
  1986. return promisify(cb, function(cb) {
  1987. try {
  1988. var engine = requires.qejs || (requires.qejs = require('qejs'));
  1989. engine.render(str, options).then(function(result) {
  1990. cb(null, result);
  1991. }, function(err) {
  1992. cb(err);
  1993. }).done();
  1994. } catch (err) {
  1995. cb(err);
  1996. }
  1997. });
  1998. };
  1999. /**
  2000. * Walrus support.
  2001. */
  2002. exports.walrus = fromStringRenderer('walrus');
  2003. /**
  2004. * Walrus string support.
  2005. */
  2006. exports.walrus.render = function(str, options, cb) {
  2007. return promisify(cb, function(cb) {
  2008. var engine = requires.walrus || (requires.walrus = require('walrus'));
  2009. try {
  2010. var tmpl = cache(options) || cache(options, engine.parse(str));
  2011. cb(null, tmpl.compile(options));
  2012. } catch (err) {
  2013. cb(err);
  2014. }
  2015. });
  2016. };
  2017. /**
  2018. * Mustache support.
  2019. */
  2020. exports.mustache = fromStringRenderer('mustache');
  2021. /**
  2022. * Mustache string support.
  2023. */
  2024. exports.mustache.render = function(str, options, cb) {
  2025. return promisify(cb, function(cb) {
  2026. var engine = requires.mustache || (requires.mustache = require('mustache'));
  2027. try {
  2028. cb(null, engine.render(str, options, options.partials));
  2029. } catch (err) {
  2030. cb(err);
  2031. }
  2032. });
  2033. };
  2034. /**
  2035. * Just support.
  2036. */
  2037. exports.just = function(path, options, cb) {
  2038. return promisify(cb, function(cb) {
  2039. var engine = requires.just;
  2040. if (!engine) {
  2041. var JUST = require('just');
  2042. engine = requires.just = new JUST();
  2043. }
  2044. engine.configure({ useCache: options.cache });
  2045. engine.render(path, options, cb);
  2046. });
  2047. };
  2048. /**
  2049. * Just string support.
  2050. */
  2051. exports.just.render = function(str, options, cb) {
  2052. return promisify(cb, function(cb) {
  2053. var JUST = require('just');
  2054. var engine = new JUST({ root: { page: str }});
  2055. engine.render('page', options, cb);
  2056. });
  2057. };
  2058. /**
  2059. * ECT support.
  2060. */
  2061. exports.ect = function(path, options, cb) {
  2062. return promisify(cb, function(cb) {
  2063. var engine = requires.ect;
  2064. if (!engine) {
  2065. var ECT = require('ect');
  2066. engine = requires.ect = new ECT(options);
  2067. }
  2068. engine.configure({ cache: options.cache });
  2069. engine.render(path, options, cb);
  2070. });
  2071. };
  2072. /**
  2073. * ECT string support.
  2074. */
  2075. exports.ect.render = function(str, options, cb) {
  2076. return promisify(cb, function(cb) {
  2077. var ECT = require('ect');
  2078. var engine = new ECT({ root: { page: str }});
  2079. engine.render('page', options, cb);
  2080. });
  2081. };
  2082. /**
  2083. * mote support.
  2084. */
  2085. exports.mote = fromStringRenderer('mote');
  2086. /**
  2087. * mote string support.
  2088. */
  2089. exports.mote.render = function(str, options, cb) {
  2090. return promisify(cb, function(cb) {
  2091. var engine = requires.mote || (requires.mote = require('mote'));
  2092. try {
  2093. var tmpl = cache(options) || cache(options, engine.compile(str));
  2094. cb(null, tmpl(options));
  2095. } catch (err) {
  2096. cb(err);
  2097. }
  2098. });
  2099. };
  2100. /**
  2101. * Toffee support.
  2102. */
  2103. exports.toffee = function(path, options, cb) {
  2104. return promisify(cb, function(cb) {
  2105. var toffee = requires.toffee || (requires.toffee = require('toffee'));
  2106. toffee.__consolidate_engine_render(path, options, cb);
  2107. });
  2108. };
  2109. /**
  2110. * Toffee string support.
  2111. */
  2112. exports.toffee.render = function(str, options, cb) {
  2113. return promisify(cb, function(cb) {
  2114. var engine = requires.toffee || (requires.toffee = require('toffee'));
  2115. try {
  2116. engine.str_render(str, options, cb);
  2117. } catch (err) {
  2118. cb(err);
  2119. }
  2120. });
  2121. };
  2122. /**
  2123. * doT support.
  2124. */
  2125. exports.dot = fromStringRenderer('dot');
  2126. /**
  2127. * doT string support.
  2128. */
  2129. exports.dot.render = function(str, options, cb) {
  2130. return promisify(cb, function(cb) {
  2131. var engine = requires.dot || (requires.dot = require('dot'));
  2132. var extend = (requires.extend || (requires.extend = util__default._extend));
  2133. try {
  2134. var settings = {};
  2135. settings = extend(settings, engine.templateSettings);
  2136. settings = extend(settings, options ? options.dot : {});
  2137. var tmpl = cache(options) || cache(options, engine.template(str, settings, options));
  2138. cb(null, tmpl(options));
  2139. } catch (err) {
  2140. cb(err);
  2141. }
  2142. });
  2143. };
  2144. /**
  2145. * bracket support.
  2146. */
  2147. exports.bracket = fromStringRenderer('bracket');
  2148. /**
  2149. * bracket string support.
  2150. */
  2151. exports.bracket.render = function(str, options, cb) {
  2152. return promisify(cb, function(cb) {
  2153. var engine = requires.bracket || (requires.bracket = require('bracket-template'));
  2154. try {
  2155. var tmpl = cache(options) || cache(options, engine.default.compile(str, options));
  2156. cb(null, tmpl(options));
  2157. } catch (err) {
  2158. cb(err);
  2159. }
  2160. });
  2161. };
  2162. /**
  2163. * Ractive support.
  2164. */
  2165. exports.ractive = fromStringRenderer('ractive');
  2166. /**
  2167. * Ractive string support.
  2168. */
  2169. exports.ractive.render = function(str, options, cb) {
  2170. return promisify(cb, function(cb) {
  2171. var Engine = requires.ractive || (requires.ractive = require('ractive'));
  2172. var template = cache(options) || cache(options, Engine.parse(str));
  2173. options.template = template;
  2174. if (options.data === null || options.data === undefined) {
  2175. var extend = (requires.extend || (requires.extend = util__default._extend));
  2176. // Shallow clone the options object
  2177. options.data = extend({}, options);
  2178. // Remove consolidate-specific properties from the clone
  2179. var i;
  2180. var length;
  2181. var properties = ['template', 'filename', 'cache', 'partials'];
  2182. for (i = 0, length = properties.length; i < length; i++) {
  2183. var property = properties[i];
  2184. delete options.data[property];
  2185. }
  2186. }
  2187. try {
  2188. cb(null, new Engine(options).toHTML());
  2189. } catch (err) {
  2190. cb(err);
  2191. }
  2192. });
  2193. };
  2194. /**
  2195. * Nunjucks support.
  2196. */
  2197. exports.nunjucks = fromStringRenderer('nunjucks');
  2198. /**
  2199. * Nunjucks string support.
  2200. */
  2201. exports.nunjucks.render = function(str, options, cb) {
  2202. return promisify(cb, function(cb) {
  2203. try {
  2204. var engine = options.nunjucksEnv || requires.nunjucks || (requires.nunjucks = require('nunjucks'));
  2205. var env = engine;
  2206. // deprecated fallback support for express
  2207. // <https://github.com/tj/consolidate.js/pull/152>
  2208. // <https://github.com/tj/consolidate.js/pull/224>
  2209. if (options.settings && options.settings.views) {
  2210. env = engine.configure(options.settings.views);
  2211. } else if (options.nunjucks && options.nunjucks.configure) {
  2212. env = engine.configure.apply(engine, options.nunjucks.configure);
  2213. }
  2214. //
  2215. // because `renderString` does not initiate loaders
  2216. // we must manually create a loader for it based off
  2217. // either `options.settings.views` or `options.nunjucks` or `options.nunjucks.root`
  2218. //
  2219. // <https://github.com/mozilla/nunjucks/issues/730>
  2220. // <https://github.com/crocodilejs/node-email-templates/issues/182>
  2221. //
  2222. // so instead we simply check if we passed a custom loader
  2223. // otherwise we create a simple file based loader
  2224. if (options.loader) {
  2225. env = new engine.Environment(options.loader);
  2226. } else if (options.settings && options.settings.views) {
  2227. env = new engine.Environment(
  2228. new engine.FileSystemLoader(options.settings.views)
  2229. );
  2230. } else if (options.nunjucks && options.nunjucks.loader) {
  2231. if (typeof options.nunjucks.loader === 'string') {
  2232. env = new engine.Environment(new engine.FileSystemLoader(options.nunjucks.loader));
  2233. } else {
  2234. env = new engine.Environment(
  2235. new engine.FileSystemLoader(
  2236. options.nunjucks.loader[0],
  2237. options.nunjucks.loader[1]
  2238. )
  2239. );
  2240. }
  2241. }
  2242. env.renderString(str, options, cb);
  2243. } catch (err) {
  2244. throw cb(err);
  2245. }
  2246. });
  2247. };
  2248. /**
  2249. * HTMLing support.
  2250. */
  2251. exports.htmling = fromStringRenderer('htmling');
  2252. /**
  2253. * HTMLing string support.
  2254. */
  2255. exports.htmling.render = function(str, options, cb) {
  2256. return promisify(cb, function(cb) {
  2257. var engine = requires.htmling || (requires.htmling = require('htmling'));
  2258. try {
  2259. var tmpl = cache(options) || cache(options, engine.string(str));
  2260. cb(null, tmpl.render(options));
  2261. } catch (err) {
  2262. cb(err);
  2263. }
  2264. });
  2265. };
  2266. /**
  2267. * Rendering function
  2268. */
  2269. function requireReact(module, filename) {
  2270. var babel = requires.babel || (requires.babel = require('babel-core'));
  2271. var compiled = babel.transformFileSync(filename, { presets: [ 'react' ] }).code;
  2272. return module._compile(compiled, filename);
  2273. }
  2274. exports.requireReact = requireReact;
  2275. /**
  2276. * Converting a string into a node module.
  2277. */
  2278. function requireReactString(src, filename) {
  2279. var babel = requires.babel || (requires.babel = require('babel-core'));
  2280. if (!filename) filename = '';
  2281. var m = new module.constructor();
  2282. filename = filename || '';
  2283. // Compile Using React
  2284. var compiled = babel.transform(src, { presets: [ 'react' ] }).code;
  2285. // Compile as a module
  2286. m.paths = module.paths;
  2287. m._compile(compiled, filename);
  2288. return m.exports;
  2289. }
  2290. /**
  2291. * A naive helper to replace {{tags}} with options.tags content
  2292. */
  2293. function reactBaseTmpl(data, options) {
  2294. var exp;
  2295. var regex;
  2296. // Iterates through the keys in file object
  2297. // and interpolate / replace {{key}} with it's value
  2298. for (var k in options) {
  2299. if (options.hasOwnProperty(k)) {
  2300. exp = '{{' + k + '}}';
  2301. regex = new RegExp(exp, 'g');
  2302. if (data.match(regex)) {
  2303. data = data.replace(regex, options[k]);
  2304. }
  2305. }
  2306. }
  2307. return data;
  2308. }
  2309. /**
  2310. * Plates Support.
  2311. */
  2312. exports.plates = fromStringRenderer('plates');
  2313. /**
  2314. * Plates string support.
  2315. */
  2316. exports.plates.render = function(str, options, cb) {
  2317. return promisify(cb, function(cb) {
  2318. var engine = requires.plates || (requires.plates = require('plates'));
  2319. var map = options.map || undefined;
  2320. try {
  2321. var tmpl = engine.bind(str, options, map);
  2322. cb(null, tmpl);
  2323. } catch (err) {
  2324. cb(err);
  2325. }
  2326. });
  2327. };
  2328. /**
  2329. * The main render parser for React bsaed templates
  2330. */
  2331. function reactRenderer(type) {
  2332. if (commonjsRequire.extensions) {
  2333. // Ensure JSX is transformed on require
  2334. if (!commonjsRequire.extensions['.jsx']) {
  2335. commonjsRequire.extensions['.jsx'] = requireReact;
  2336. }
  2337. // Supporting .react extension as well as test cases
  2338. // Using .react extension is not recommended.
  2339. if (!commonjsRequire.extensions['.react']) {
  2340. commonjsRequire.extensions['.react'] = requireReact;
  2341. }
  2342. }
  2343. // Return rendering fx
  2344. return function(str, options, cb) {
  2345. return promisify(cb, function(cb) {
  2346. // React Import
  2347. var ReactDOM = requires.ReactDOM || (requires.ReactDOM = require('react-dom/server'));
  2348. var react = requires.react || (requires.react = require('react'));
  2349. // Assign HTML Base
  2350. var base = options.base;
  2351. delete options.base;
  2352. var enableCache = options.cache;
  2353. delete options.cache;
  2354. var isNonStatic = options.isNonStatic;
  2355. delete options.isNonStatic;
  2356. // Start Conversion
  2357. try {
  2358. var Code;
  2359. var Factory;
  2360. var baseStr;
  2361. var content;
  2362. var parsed;
  2363. if (!cache(options)) {
  2364. // Parsing
  2365. if (type === 'path') {
  2366. var path = resolve(str);
  2367. delete require.cache[path];
  2368. Code = commonjsRequire(path);
  2369. } else {
  2370. Code = requireReactString(str);
  2371. }
  2372. Factory = cache(options, react.createFactory(Code));
  2373. } else {
  2374. Factory = cache(options);
  2375. }
  2376. parsed = new Factory(options);
  2377. content = (isNonStatic) ? ReactDOM.renderToString(parsed) : ReactDOM.renderToStaticMarkup(parsed);
  2378. if (base) {
  2379. baseStr = readCache[str] || fs__default.readFileSync(resolve(base), 'utf8');
  2380. if (enableCache) {
  2381. readCache[str] = baseStr;
  2382. }
  2383. options.content = content;
  2384. content = reactBaseTmpl(baseStr, options);
  2385. }
  2386. cb(null, content);
  2387. } catch (err) {
  2388. cb(err);
  2389. }
  2390. });
  2391. };
  2392. }
  2393. /**
  2394. * React JS Support
  2395. */
  2396. exports.react = reactRenderer('path');
  2397. /**
  2398. * React JS string support.
  2399. */
  2400. exports.react.render = reactRenderer('string');
  2401. /**
  2402. * ARC-templates support.
  2403. */
  2404. exports['arc-templates'] = fromStringRenderer('arc-templates');
  2405. /**
  2406. * ARC-templates string support.
  2407. */
  2408. exports['arc-templates'].render = function(str, options, cb) {
  2409. var readFileWithOptions = util__default.promisify(read);
  2410. var consolidateFileSystem = {};
  2411. consolidateFileSystem.readFile = function(path) {
  2412. return readFileWithOptions(path, options);
  2413. };
  2414. return promisify(cb, function(cb) {
  2415. try {
  2416. var engine = requires['arc-templates'];
  2417. if (!engine) {
  2418. var Engine = require('arc-templates/dist/es5');
  2419. engine = requires['arc-templates'] = new Engine({ filesystem: consolidateFileSystem });
  2420. }
  2421. var compiler = cache(options) || cache(options, engine.compileString(str, options.filename));
  2422. compiler.then(function(func) { return func(options); })
  2423. .then(function(result) { cb(null, result.content); })
  2424. .catch(cb);
  2425. } catch (err) {
  2426. cb(err);
  2427. }
  2428. });
  2429. };
  2430. /**
  2431. * Vash support
  2432. */
  2433. exports.vash = fromStringRenderer('vash');
  2434. /**
  2435. * Vash string support
  2436. */
  2437. exports.vash.render = function(str, options, cb) {
  2438. return promisify(cb, function(cb) {
  2439. var engine = requires.vash || (requires.vash = require('vash'));
  2440. try {
  2441. // helper system : https://github.com/kirbysayshi/vash#helper-system
  2442. if (options.helpers) {
  2443. for (var key in options.helpers) {
  2444. if (!options.helpers.hasOwnProperty(key) || typeof options.helpers[key] !== 'function') {
  2445. continue;
  2446. }
  2447. engine.helpers[key] = options.helpers[key];
  2448. }
  2449. }
  2450. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  2451. tmpl(options, function sealLayout(err, ctx) {
  2452. if (err) cb(err);
  2453. ctx.finishLayout();
  2454. cb(null, ctx.toString().replace(/\n$/, ''));
  2455. });
  2456. } catch (err) {
  2457. cb(err);
  2458. }
  2459. });
  2460. };
  2461. /**
  2462. * Slm support.
  2463. */
  2464. exports.slm = fromStringRenderer('slm');
  2465. /**
  2466. * Slm string support.
  2467. */
  2468. exports.slm.render = function(str, options, cb) {
  2469. return promisify(cb, function(cb) {
  2470. var engine = requires.slm || (requires.slm = require('slm'));
  2471. try {
  2472. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  2473. cb(null, tmpl(options));
  2474. } catch (err) {
  2475. cb(err);
  2476. }
  2477. });
  2478. };
  2479. /**
  2480. * Marko support.
  2481. */
  2482. exports.marko = function(path, options, cb) {
  2483. return promisify(cb, function(cb) {
  2484. var engine = requires.marko || (requires.marko = require('marko'));
  2485. options.writeToDisk = !!options.cache;
  2486. try {
  2487. var tmpl = cache(options) || cache(options, engine.load(path, options));
  2488. tmpl.renderToString(options, cb);
  2489. } catch (err) {
  2490. cb(err);
  2491. }
  2492. });
  2493. };
  2494. /**
  2495. * Marko string support.
  2496. */
  2497. exports.marko.render = function(str, options, cb) {
  2498. return promisify(cb, function(cb) {
  2499. var engine = requires.marko || (requires.marko = require('marko'));
  2500. options.writeToDisk = !!options.cache;
  2501. options.filename = options.filename || 'string.marko';
  2502. try {
  2503. var tmpl = cache(options) || cache(options, engine.load(options.filename, str, options));
  2504. tmpl.renderToString(options, cb);
  2505. } catch (err) {
  2506. cb(err);
  2507. }
  2508. });
  2509. };
  2510. /**
  2511. * Teacup support.
  2512. */
  2513. exports.teacup = function(path, options, cb) {
  2514. return promisify(cb, function(cb) {
  2515. var engine = requires.teacup || (requires.teacup = require('teacup/lib/express'));
  2516. commonjsRequire.extensions['.teacup'] = commonjsRequire.extensions['.coffee'];
  2517. if (path[0] !== '/') {
  2518. path = join(process.cwd(), path);
  2519. }
  2520. if (!options.cache) {
  2521. var callback = cb;
  2522. cb = function() {
  2523. delete require.cache[path];
  2524. callback.apply(this, arguments);
  2525. };
  2526. }
  2527. engine.renderFile(path, options, cb);
  2528. });
  2529. };
  2530. /**
  2531. * Teacup string support.
  2532. */
  2533. exports.teacup.render = function(str, options, cb) {
  2534. var coffee = require('coffee-script');
  2535. var vm = require('vm');
  2536. var sandbox = {
  2537. module: {exports: {}},
  2538. require: commonjsRequire
  2539. };
  2540. return promisify(cb, function(cb) {
  2541. vm.runInNewContext(coffee.compile(str), sandbox);
  2542. var tmpl = sandbox.module.exports;
  2543. cb(null, tmpl(options));
  2544. });
  2545. };
  2546. /**
  2547. * Squirrelly support.
  2548. */
  2549. exports.squirrelly = fromStringRenderer('squirrelly');
  2550. /**
  2551. * Squirrelly string support.
  2552. */
  2553. exports.squirrelly.render = function(str, options, cb) {
  2554. return promisify(cb, function(cb) {
  2555. var engine = requires.squirrelly || (requires.squirrelly = require('squirrelly'));
  2556. try {
  2557. for (var partial in options.partials) {
  2558. engine.definePartial(partial, options.partials[partial]);
  2559. }
  2560. for (var helper in options.helpers) {
  2561. engine.defineHelper(helper, options.helpers[helper]);
  2562. }
  2563. var tmpl = cache(options) || cache(options, engine.Compile(str, options));
  2564. cb(null, tmpl(options, engine));
  2565. } catch (err) {
  2566. cb(err);
  2567. }
  2568. });
  2569. };
  2570. /**
  2571. * Twing support.
  2572. */
  2573. exports.twing = fromStringRenderer('twing');
  2574. /**
  2575. * Twing string support.
  2576. */
  2577. exports.twing.render = function(str, options, cb) {
  2578. return promisify(cb, function(cb) {
  2579. var engine = requires.twing || (requires.twing = require('twing'));
  2580. try {
  2581. new engine.TwingEnvironment(new engine.TwingLoaderNull()).createTemplate(str).then((twingTemplate) => {
  2582. twingTemplate.render(options).then((rendTmpl) => {
  2583. var tmpl = cache(options) || cache(options, rendTmpl);
  2584. cb(null, tmpl);
  2585. });
  2586. });
  2587. } catch (err) {
  2588. cb(err);
  2589. }
  2590. });
  2591. };
  2592. /**
  2593. * expose the instance of the engine
  2594. */
  2595. exports.requires = requires;
  2596. });
  2597. var consolidate$1 = consolidate;
  2598. const hasWarned = {};
  2599. function warnOnce(msg) {
  2600. const isNodeProd = typeof process !== 'undefined' && process.env.NODE_ENV === 'production';
  2601. if (!isNodeProd && !false && !hasWarned[msg]) {
  2602. hasWarned[msg] = true;
  2603. warn(msg);
  2604. }
  2605. }
  2606. function warn(msg) {
  2607. console.warn(`\x1b[1m\x1b[33m[@vue/compiler-sfc]\x1b[0m\x1b[33m ${msg}\x1b[0m\n`);
  2608. }
  2609. function preprocess({ source, filename, preprocessOptions }, preprocessor) {
  2610. // Consolidate exposes a callback based API, but the callback is in fact
  2611. // called synchronously for most templating engines. In our case, we have to
  2612. // expose a synchronous API so that it is usable in Jest transforms (which
  2613. // have to be sync because they are applied via Node.js require hooks)
  2614. let res = '';
  2615. let err = null;
  2616. preprocessor.render(source, Object.assign({ filename }, preprocessOptions), (_err, _res) => {
  2617. if (_err)
  2618. err = _err;
  2619. res = _res;
  2620. });
  2621. if (err)
  2622. throw err;
  2623. return res;
  2624. }
  2625. function compileTemplate(options) {
  2626. const { preprocessLang, preprocessCustomRequire } = options;
  2627. const preprocessor = preprocessLang
  2628. ? preprocessCustomRequire
  2629. ? preprocessCustomRequire(preprocessLang)
  2630. : consolidate$1[preprocessLang]
  2631. : false;
  2632. if (preprocessor) {
  2633. try {
  2634. return doCompileTemplate(Object.assign(Object.assign({}, options), { source: preprocess(options, preprocessor) }));
  2635. }
  2636. catch (e) {
  2637. return {
  2638. code: `export default function render() {}`,
  2639. source: options.source,
  2640. tips: [],
  2641. errors: [e]
  2642. };
  2643. }
  2644. }
  2645. else if (preprocessLang) {
  2646. return {
  2647. code: `export default function render() {}`,
  2648. source: options.source,
  2649. tips: [
  2650. `Component ${options.filename} uses lang ${preprocessLang} for template. Please install the language preprocessor.`
  2651. ],
  2652. errors: [
  2653. `Component ${options.filename} uses lang ${preprocessLang} for template, however it is not installed.`
  2654. ]
  2655. };
  2656. }
  2657. else {
  2658. return doCompileTemplate(options);
  2659. }
  2660. }
  2661. function doCompileTemplate({ filename, id, scoped, slotted, inMap, source, ssr = false, ssrCssVars, isProd = false, compiler = ssr ? CompilerSSR__namespace : CompilerDOM__namespace, compilerOptions = {}, transformAssetUrls }) {
  2662. const errors = [];
  2663. const warnings = [];
  2664. let nodeTransforms = [];
  2665. if (shared.isObject(transformAssetUrls)) {
  2666. const assetOptions = normalizeOptions(transformAssetUrls);
  2667. nodeTransforms = [
  2668. createAssetUrlTransformWithOptions(assetOptions),
  2669. createSrcsetTransformWithOptions(assetOptions)
  2670. ];
  2671. }
  2672. else if (transformAssetUrls !== false) {
  2673. nodeTransforms = [transformAssetUrl, transformSrcset];
  2674. }
  2675. if (ssr && !ssrCssVars) {
  2676. warnOnce(`compileTemplate is called with \`ssr: true\` but no ` +
  2677. `corresponding \`cssVars\` option.\`.`);
  2678. }
  2679. if (!id) {
  2680. warnOnce(`compileTemplate now requires the \`id\` option.\`.`);
  2681. id = '';
  2682. }
  2683. const shortId = id.replace(/^data-v-/, '');
  2684. const longId = `data-v-${shortId}`;
  2685. let { code, ast, preamble, map } = compiler.compile(source, Object.assign(Object.assign({ mode: 'module', prefixIdentifiers: true, hoistStatic: true, cacheHandlers: true, ssrCssVars: ssr && ssrCssVars && ssrCssVars.length
  2686. ? genCssVarsFromList(ssrCssVars, shortId, isProd)
  2687. : '', scopeId: scoped ? longId : undefined, slotted, sourceMap: true }, compilerOptions), { nodeTransforms: nodeTransforms.concat(compilerOptions.nodeTransforms || []), filename, onError: e => errors.push(e), onWarn: w => warnings.push(w) }));
  2688. // inMap should be the map produced by ./parse.ts which is a simple line-only
  2689. // mapping. If it is present, we need to adjust the final map and errors to
  2690. // reflect the original line numbers.
  2691. if (inMap) {
  2692. if (map) {
  2693. map = mapLines(inMap, map);
  2694. }
  2695. if (errors.length) {
  2696. patchErrors(errors, source, inMap);
  2697. }
  2698. }
  2699. const tips = warnings.map(w => {
  2700. let msg = w.message;
  2701. if (w.loc) {
  2702. msg += `\n${shared.generateCodeFrame(source, w.loc.start.offset, w.loc.end.offset)}`;
  2703. }
  2704. return msg;
  2705. });
  2706. return { code, ast, preamble, source, errors, tips, map };
  2707. }
  2708. function mapLines(oldMap, newMap) {
  2709. if (!oldMap)
  2710. return newMap;
  2711. if (!newMap)
  2712. return oldMap;
  2713. const oldMapConsumer = new sourceMap.SourceMapConsumer(oldMap);
  2714. const newMapConsumer = new sourceMap.SourceMapConsumer(newMap);
  2715. const mergedMapGenerator = new sourceMap.SourceMapGenerator();
  2716. newMapConsumer.eachMapping(m => {
  2717. if (m.originalLine == null) {
  2718. return;
  2719. }
  2720. const origPosInOldMap = oldMapConsumer.originalPositionFor({
  2721. line: m.originalLine,
  2722. column: m.originalColumn
  2723. });
  2724. if (origPosInOldMap.source == null) {
  2725. return;
  2726. }
  2727. mergedMapGenerator.addMapping({
  2728. generated: {
  2729. line: m.generatedLine,
  2730. column: m.generatedColumn
  2731. },
  2732. original: {
  2733. line: origPosInOldMap.line,
  2734. // use current column, since the oldMap produced by @vue/compiler-sfc
  2735. // does not
  2736. column: m.originalColumn
  2737. },
  2738. source: origPosInOldMap.source,
  2739. name: origPosInOldMap.name
  2740. });
  2741. });
  2742. // source-map's type definition is incomplete
  2743. const generator = mergedMapGenerator;
  2744. oldMapConsumer.sources.forEach((sourceFile) => {
  2745. generator._sources.add(sourceFile);
  2746. const sourceContent = oldMapConsumer.sourceContentFor(sourceFile);
  2747. if (sourceContent != null) {
  2748. mergedMapGenerator.setSourceContent(sourceFile, sourceContent);
  2749. }
  2750. });
  2751. generator._sourceRoot = oldMap.sourceRoot;
  2752. generator._file = oldMap.file;
  2753. return generator.toJSON();
  2754. }
  2755. function patchErrors(errors, source, inMap) {
  2756. const originalSource = inMap.sourcesContent[0];
  2757. const offset = originalSource.indexOf(source);
  2758. const lineOffset = originalSource.slice(0, offset).split(/\r?\n/).length - 1;
  2759. errors.forEach(err => {
  2760. if (err.loc) {
  2761. err.loc.start.line += lineOffset;
  2762. err.loc.start.offset += offset;
  2763. if (err.loc.end !== err.loc.start) {
  2764. err.loc.end.line += lineOffset;
  2765. err.loc.end.offset += offset;
  2766. }
  2767. }
  2768. });
  2769. }
  2770. const defaultExportRE = /((?:^|\n|;)\s*)export(\s*)default/;
  2771. const namedDefaultExportRE = /((?:^|\n|;)\s*)export(.+)as(\s*)default/s;
  2772. const exportDefaultClassRE = /((?:^|\n|;)\s*)export\s+default\s+class\s+([\w$]+)/;
  2773. /**
  2774. * Utility for rewriting `export default` in a script block into a variable
  2775. * declaration so that we can inject things into it
  2776. */
  2777. function rewriteDefault(input, as, parserPlugins) {
  2778. if (!hasDefaultExport(input)) {
  2779. return input + `\nconst ${as} = {}`;
  2780. }
  2781. let replaced;
  2782. const classMatch = input.match(exportDefaultClassRE);
  2783. if (classMatch) {
  2784. replaced =
  2785. input.replace(exportDefaultClassRE, '$1class $2') +
  2786. `\nconst ${as} = ${classMatch[2]}`;
  2787. }
  2788. else {
  2789. replaced = input.replace(defaultExportRE, `$1const ${as} =`);
  2790. }
  2791. if (!hasDefaultExport(replaced)) {
  2792. return replaced;
  2793. }
  2794. // if the script somehow still contains `default export`, it probably has
  2795. // multi-line comments or template strings. fallback to a full parse.
  2796. const s = new MagicString__default(input);
  2797. const ast = parser$2.parse(input, {
  2798. sourceType: 'module',
  2799. plugins: parserPlugins
  2800. }).program.body;
  2801. ast.forEach(node => {
  2802. if (node.type === 'ExportDefaultDeclaration') {
  2803. s.overwrite(node.start, node.declaration.start, `const ${as} = `);
  2804. }
  2805. if (node.type === 'ExportNamedDeclaration') {
  2806. node.specifiers.forEach(specifier => {
  2807. if (specifier.type === 'ExportSpecifier' &&
  2808. specifier.exported.type === 'Identifier' &&
  2809. specifier.exported.name === 'default') {
  2810. const end = specifier.end;
  2811. s.overwrite(specifier.start, input.charAt(end) === ',' ? end + 1 : end, ``);
  2812. s.append(`\nconst ${as} = ${specifier.local.name}`);
  2813. }
  2814. });
  2815. }
  2816. });
  2817. return s.toString();
  2818. }
  2819. function hasDefaultExport(input) {
  2820. return defaultExportRE.test(input) || namedDefaultExportRE.test(input);
  2821. }
  2822. // Special compiler macros
  2823. const DEFINE_PROPS = 'defineProps';
  2824. const DEFINE_EMITS = 'defineEmits';
  2825. const DEFINE_EXPOSE = 'defineExpose';
  2826. const WITH_DEFAULTS = 'withDefaults';
  2827. // constants
  2828. const DEFAULT_VAR = `__default__`;
  2829. const isBuiltInDir = shared.makeMap(`once,memo,if,else,else-if,slot,text,html,on,bind,model,show,cloak,is`);
  2830. /**
  2831. * Compile `<script setup>`
  2832. * It requires the whole SFC descriptor because we need to handle and merge
  2833. * normal `<script>` + `<script setup>` if both are present.
  2834. */
  2835. function compileScript(sfc, options) {
  2836. let { script, scriptSetup, source, filename } = sfc;
  2837. // feature flags
  2838. // TODO remove support for deprecated options when out of experimental
  2839. const enableRefTransform = !!options.reactivityTransform ||
  2840. !!options.refSugar ||
  2841. !!options.refTransform;
  2842. const enablePropsTransform = !!options.reactivityTransform || !!options.propsDestructureTransform;
  2843. const isProd = !!options.isProd;
  2844. const genSourceMap = options.sourceMap !== false;
  2845. let refBindings;
  2846. if (!options.id) {
  2847. warnOnce(`compileScript now requires passing the \`id\` option.\n` +
  2848. `Upgrade your vite or vue-loader version for compatibility with ` +
  2849. `the latest experimental proposals.`);
  2850. }
  2851. const scopeId = options.id ? options.id.replace(/^data-v-/, '') : '';
  2852. const cssVars = sfc.cssVars;
  2853. const scriptLang = script && script.lang;
  2854. const scriptSetupLang = scriptSetup && scriptSetup.lang;
  2855. const isTS = scriptLang === 'ts' ||
  2856. scriptLang === 'tsx' ||
  2857. scriptSetupLang === 'ts' ||
  2858. scriptSetupLang === 'tsx';
  2859. const plugins = [];
  2860. if (!isTS || scriptLang === 'tsx' || scriptSetupLang === 'tsx') {
  2861. plugins.push('jsx');
  2862. }
  2863. if (options.babelParserPlugins)
  2864. plugins.push(...options.babelParserPlugins);
  2865. if (isTS)
  2866. plugins.push('typescript', 'decorators-legacy');
  2867. if (!scriptSetup) {
  2868. if (!script) {
  2869. throw new Error(`[@vue/compiler-sfc] SFC contains no <script> tags.`);
  2870. }
  2871. if (scriptLang && !isTS && scriptLang !== 'jsx') {
  2872. // do not process non js/ts script blocks
  2873. return script;
  2874. }
  2875. try {
  2876. let content = script.content;
  2877. let map = script.map;
  2878. const scriptAst = parser$2.parse(content, {
  2879. plugins,
  2880. sourceType: 'module'
  2881. }).program;
  2882. const bindings = analyzeScriptBindings(scriptAst.body);
  2883. if (enableRefTransform && reactivityTransform.shouldTransform(content)) {
  2884. const s = new MagicString__default(source);
  2885. const startOffset = script.loc.start.offset;
  2886. const endOffset = script.loc.end.offset;
  2887. const { importedHelpers } = reactivityTransform.transformAST(scriptAst, s, startOffset);
  2888. if (importedHelpers.length) {
  2889. s.prepend(`import { ${importedHelpers
  2890. .map(h => `${h} as _${h}`)
  2891. .join(', ')} } from 'vue'\n`);
  2892. }
  2893. s.remove(0, startOffset);
  2894. s.remove(endOffset, source.length);
  2895. content = s.toString();
  2896. if (genSourceMap) {
  2897. map = s.generateMap({
  2898. source: filename,
  2899. hires: true,
  2900. includeContent: true
  2901. });
  2902. }
  2903. }
  2904. if (cssVars.length) {
  2905. content = rewriteDefault(content, DEFAULT_VAR, plugins);
  2906. content += genNormalScriptCssVarsCode(cssVars, bindings, scopeId, isProd);
  2907. content += `\nexport default ${DEFAULT_VAR}`;
  2908. }
  2909. return Object.assign(Object.assign({}, script), { content,
  2910. map,
  2911. bindings, scriptAst: scriptAst.body });
  2912. }
  2913. catch (e) {
  2914. // silently fallback if parse fails since user may be using custom
  2915. // babel syntax
  2916. return script;
  2917. }
  2918. }
  2919. if (script && scriptLang !== scriptSetupLang) {
  2920. throw new Error(`[@vue/compiler-sfc] <script> and <script setup> must have the same ` +
  2921. `language type.`);
  2922. }
  2923. if (scriptSetupLang && !isTS && scriptSetupLang !== 'jsx') {
  2924. // do not process non js/ts script blocks
  2925. return scriptSetup;
  2926. }
  2927. // metadata that needs to be returned
  2928. const bindingMetadata = {};
  2929. const helperImports = new Set();
  2930. const userImports = Object.create(null);
  2931. const userImportAlias = Object.create(null);
  2932. const scriptBindings = Object.create(null);
  2933. const setupBindings = Object.create(null);
  2934. let defaultExport;
  2935. let hasDefinePropsCall = false;
  2936. let hasDefineEmitCall = false;
  2937. let hasDefineExposeCall = false;
  2938. let propsRuntimeDecl;
  2939. let propsRuntimeDefaults;
  2940. let propsDestructureDecl;
  2941. let propsDestructureRestId;
  2942. let propsTypeDecl;
  2943. let propsTypeDeclRaw;
  2944. let propsIdentifier;
  2945. let emitsRuntimeDecl;
  2946. let emitsTypeDecl;
  2947. let emitsTypeDeclRaw;
  2948. let emitIdentifier;
  2949. let hasAwait = false;
  2950. let hasInlinedSsrRenderFn = false;
  2951. // props/emits declared via types
  2952. const typeDeclaredProps = {};
  2953. const typeDeclaredEmits = new Set();
  2954. // record declared types for runtime props type generation
  2955. const declaredTypes = {};
  2956. // props destructure data
  2957. const propsDestructuredBindings = Object.create(null);
  2958. // magic-string state
  2959. const s = new MagicString__default(source);
  2960. const startOffset = scriptSetup.loc.start.offset;
  2961. const endOffset = scriptSetup.loc.end.offset;
  2962. const scriptStartOffset = script && script.loc.start.offset;
  2963. const scriptEndOffset = script && script.loc.end.offset;
  2964. function helper(key) {
  2965. helperImports.add(key);
  2966. return `_${key}`;
  2967. }
  2968. function parse(input, options, offset) {
  2969. try {
  2970. return parser$2.parse(input, options).program;
  2971. }
  2972. catch (e) {
  2973. e.message = `[@vue/compiler-sfc] ${e.message}\n\n${sfc.filename}\n${shared.generateCodeFrame(source, e.pos + offset, e.pos + offset + 1)}`;
  2974. throw e;
  2975. }
  2976. }
  2977. function error(msg, node, end = node.end + startOffset) {
  2978. throw new Error(`[@vue/compiler-sfc] ${msg}\n\n${sfc.filename}\n${shared.generateCodeFrame(source, node.start + startOffset, end)}`);
  2979. }
  2980. function registerUserImport(source, local, imported, isType, isFromSetup) {
  2981. if (source === 'vue' && imported) {
  2982. userImportAlias[imported] = local;
  2983. }
  2984. let isUsedInTemplate = true;
  2985. if (isTS && sfc.template && !sfc.template.src && !sfc.template.lang) {
  2986. isUsedInTemplate = isImportUsed(local, sfc);
  2987. }
  2988. userImports[local] = {
  2989. isType,
  2990. imported: imported || 'default',
  2991. source,
  2992. isFromSetup,
  2993. isUsedInTemplate
  2994. };
  2995. }
  2996. function processDefineProps(node, declId) {
  2997. if (!isCallOf(node, DEFINE_PROPS)) {
  2998. return false;
  2999. }
  3000. if (hasDefinePropsCall) {
  3001. error(`duplicate ${DEFINE_PROPS}() call`, node);
  3002. }
  3003. hasDefinePropsCall = true;
  3004. propsRuntimeDecl = node.arguments[0];
  3005. // call has type parameters - infer runtime types from it
  3006. if (node.typeParameters) {
  3007. if (propsRuntimeDecl) {
  3008. error(`${DEFINE_PROPS}() cannot accept both type and non-type arguments ` +
  3009. `at the same time. Use one or the other.`, node);
  3010. }
  3011. propsTypeDeclRaw = node.typeParameters.params[0];
  3012. propsTypeDecl = resolveQualifiedType(propsTypeDeclRaw, node => node.type === 'TSTypeLiteral');
  3013. if (!propsTypeDecl) {
  3014. error(`type argument passed to ${DEFINE_PROPS}() must be a literal type, ` +
  3015. `or a reference to an interface or literal type.`, propsTypeDeclRaw);
  3016. }
  3017. }
  3018. if (declId) {
  3019. if (enablePropsTransform && declId.type === 'ObjectPattern') {
  3020. propsDestructureDecl = declId;
  3021. // props destructure - handle compilation sugar
  3022. for (const prop of declId.properties) {
  3023. if (prop.type === 'ObjectProperty') {
  3024. if (prop.computed) {
  3025. error(`${DEFINE_PROPS}() destructure cannot use computed key.`, prop.key);
  3026. }
  3027. const propKey = prop.key.name;
  3028. if (prop.value.type === 'AssignmentPattern') {
  3029. // default value { foo = 123 }
  3030. const { left, right } = prop.value;
  3031. if (left.type !== 'Identifier') {
  3032. error(`${DEFINE_PROPS}() destructure does not support nested patterns.`, left);
  3033. }
  3034. // store default value
  3035. propsDestructuredBindings[propKey] = {
  3036. local: left.name,
  3037. default: right
  3038. };
  3039. }
  3040. else if (prop.value.type === 'Identifier') {
  3041. // simple destructure
  3042. propsDestructuredBindings[propKey] = {
  3043. local: prop.value.name
  3044. };
  3045. }
  3046. else {
  3047. error(`${DEFINE_PROPS}() destructure does not support nested patterns.`, prop.value);
  3048. }
  3049. }
  3050. else {
  3051. // rest spread
  3052. propsDestructureRestId = prop.argument.name;
  3053. }
  3054. }
  3055. }
  3056. else {
  3057. propsIdentifier = scriptSetup.content.slice(declId.start, declId.end);
  3058. }
  3059. }
  3060. return true;
  3061. }
  3062. function processWithDefaults(node, declId) {
  3063. if (!isCallOf(node, WITH_DEFAULTS)) {
  3064. return false;
  3065. }
  3066. if (processDefineProps(node.arguments[0], declId)) {
  3067. if (propsRuntimeDecl) {
  3068. error(`${WITH_DEFAULTS} can only be used with type-based ` +
  3069. `${DEFINE_PROPS} declaration.`, node);
  3070. }
  3071. if (propsDestructureDecl) {
  3072. error(`${WITH_DEFAULTS}() is unnecessary when using destructure with ${DEFINE_PROPS}().\n` +
  3073. `Prefer using destructure default values, e.g. const { foo = 1 } = defineProps(...).`, node.callee);
  3074. }
  3075. propsRuntimeDefaults = node.arguments[1];
  3076. if (!propsRuntimeDefaults ||
  3077. propsRuntimeDefaults.type !== 'ObjectExpression') {
  3078. error(`The 2nd argument of ${WITH_DEFAULTS} must be an object literal.`, propsRuntimeDefaults || node);
  3079. }
  3080. }
  3081. else {
  3082. error(`${WITH_DEFAULTS}' first argument must be a ${DEFINE_PROPS} call.`, node.arguments[0] || node);
  3083. }
  3084. return true;
  3085. }
  3086. function processDefineEmits(node, declId) {
  3087. if (!isCallOf(node, DEFINE_EMITS)) {
  3088. return false;
  3089. }
  3090. if (hasDefineEmitCall) {
  3091. error(`duplicate ${DEFINE_EMITS}() call`, node);
  3092. }
  3093. hasDefineEmitCall = true;
  3094. emitsRuntimeDecl = node.arguments[0];
  3095. if (node.typeParameters) {
  3096. if (emitsRuntimeDecl) {
  3097. error(`${DEFINE_EMITS}() cannot accept both type and non-type arguments ` +
  3098. `at the same time. Use one or the other.`, node);
  3099. }
  3100. emitsTypeDeclRaw = node.typeParameters.params[0];
  3101. emitsTypeDecl = resolveQualifiedType(emitsTypeDeclRaw, node => node.type === 'TSFunctionType' || node.type === 'TSTypeLiteral');
  3102. if (!emitsTypeDecl) {
  3103. error(`type argument passed to ${DEFINE_EMITS}() must be a function type, ` +
  3104. `a literal type with call signatures, or a reference to the above types.`, emitsTypeDeclRaw);
  3105. }
  3106. }
  3107. if (declId) {
  3108. emitIdentifier = scriptSetup.content.slice(declId.start, declId.end);
  3109. }
  3110. return true;
  3111. }
  3112. function resolveQualifiedType(node, qualifier) {
  3113. if (qualifier(node)) {
  3114. return node;
  3115. }
  3116. if (node.type === 'TSTypeReference' &&
  3117. node.typeName.type === 'Identifier') {
  3118. const refName = node.typeName.name;
  3119. const isQualifiedType = (node) => {
  3120. if (node.type === 'TSInterfaceDeclaration' &&
  3121. node.id.name === refName) {
  3122. return node.body;
  3123. }
  3124. else if (node.type === 'TSTypeAliasDeclaration' &&
  3125. node.id.name === refName &&
  3126. qualifier(node.typeAnnotation)) {
  3127. return node.typeAnnotation;
  3128. }
  3129. else if (node.type === 'ExportNamedDeclaration' && node.declaration) {
  3130. return isQualifiedType(node.declaration);
  3131. }
  3132. };
  3133. const body = scriptAst
  3134. ? [...scriptSetupAst.body, ...scriptAst.body]
  3135. : scriptSetupAst.body;
  3136. for (const node of body) {
  3137. const qualified = isQualifiedType(node);
  3138. if (qualified) {
  3139. return qualified;
  3140. }
  3141. }
  3142. }
  3143. }
  3144. function processDefineExpose(node) {
  3145. if (isCallOf(node, DEFINE_EXPOSE)) {
  3146. if (hasDefineExposeCall) {
  3147. error(`duplicate ${DEFINE_EXPOSE}() call`, node);
  3148. }
  3149. hasDefineExposeCall = true;
  3150. return true;
  3151. }
  3152. return false;
  3153. }
  3154. function checkInvalidScopeReference(node, method) {
  3155. if (!node)
  3156. return;
  3157. CompilerDOM.walkIdentifiers(node, id => {
  3158. if (setupBindings[id.name]) {
  3159. error(`\`${method}()\` in <script setup> cannot reference locally ` +
  3160. `declared variables because it will be hoisted outside of the ` +
  3161. `setup() function. If your component options require initialization ` +
  3162. `in the module scope, use a separate normal <script> to export ` +
  3163. `the options instead.`, id);
  3164. }
  3165. });
  3166. }
  3167. /**
  3168. * await foo()
  3169. * -->
  3170. * ;(
  3171. * ([__temp,__restore] = withAsyncContext(() => foo())),
  3172. * await __temp,
  3173. * __restore()
  3174. * )
  3175. *
  3176. * const a = await foo()
  3177. * -->
  3178. * const a = (
  3179. * ([__temp, __restore] = withAsyncContext(() => foo())),
  3180. * __temp = await __temp,
  3181. * __restore(),
  3182. * __temp
  3183. * )
  3184. */
  3185. function processAwait(node, needSemi, isStatement) {
  3186. const argumentStart = node.argument.extra && node.argument.extra.parenthesized
  3187. ? node.argument.extra.parenStart
  3188. : node.argument.start;
  3189. const argumentStr = source.slice(argumentStart + startOffset, node.argument.end + startOffset);
  3190. const containsNestedAwait = /\bawait\b/.test(argumentStr);
  3191. s.overwrite(node.start + startOffset, argumentStart + startOffset, `${needSemi ? `;` : ``}(\n ([__temp,__restore] = ${helper(`withAsyncContext`)}(${containsNestedAwait ? `async ` : ``}() => `);
  3192. s.appendLeft(node.end + startOffset, `)),\n ${isStatement ? `` : `__temp = `}await __temp,\n __restore()${isStatement ? `` : `,\n __temp`}\n)`);
  3193. }
  3194. /**
  3195. * check defaults. If the default object is an object literal with only
  3196. * static properties, we can directly generate more optimized default
  3197. * declarations. Otherwise we will have to fallback to runtime merging.
  3198. */
  3199. function hasStaticWithDefaults() {
  3200. return (propsRuntimeDefaults &&
  3201. propsRuntimeDefaults.type === 'ObjectExpression' &&
  3202. propsRuntimeDefaults.properties.every(node => (node.type === 'ObjectProperty' && !node.computed) ||
  3203. node.type === 'ObjectMethod'));
  3204. }
  3205. function genRuntimeProps(props) {
  3206. const keys = Object.keys(props);
  3207. if (!keys.length) {
  3208. return ``;
  3209. }
  3210. const hasStaticDefaults = hasStaticWithDefaults();
  3211. const scriptSetupSource = scriptSetup.content;
  3212. let propsDecls = `{
  3213. ${keys
  3214. .map(key => {
  3215. let defaultString;
  3216. const destructured = genDestructuredDefaultValue(key);
  3217. if (destructured) {
  3218. defaultString = `default: ${destructured}`;
  3219. }
  3220. else if (hasStaticDefaults) {
  3221. const prop = propsRuntimeDefaults.properties.find((node) => node.key.name === key);
  3222. if (prop) {
  3223. if (prop.type === 'ObjectProperty') {
  3224. // prop has corresponding static default value
  3225. defaultString = `default: ${scriptSetupSource.slice(prop.value.start, prop.value.end)}`;
  3226. }
  3227. else {
  3228. defaultString = `default() ${scriptSetupSource.slice(prop.body.start, prop.body.end)}`;
  3229. }
  3230. }
  3231. }
  3232. const { type, required } = props[key];
  3233. if (!isProd) {
  3234. return `${key}: { type: ${toRuntimeTypeString(type)}, required: ${required}${defaultString ? `, ${defaultString}` : ``} }`;
  3235. }
  3236. else if (type.some(el => el === 'Boolean' || (defaultString && el === 'Function'))) {
  3237. // #4783 production: if boolean or defaultString and function exists, should keep the type.
  3238. return `${key}: { type: ${toRuntimeTypeString(type)}${defaultString ? `, ${defaultString}` : ``} }`;
  3239. }
  3240. else {
  3241. // production: checks are useless
  3242. return `${key}: ${defaultString ? `{ ${defaultString} }` : 'null'}`;
  3243. }
  3244. })
  3245. .join(',\n ')}\n }`;
  3246. if (propsRuntimeDefaults && !hasStaticDefaults) {
  3247. propsDecls = `${helper('mergeDefaults')}(${propsDecls}, ${source.slice(propsRuntimeDefaults.start + startOffset, propsRuntimeDefaults.end + startOffset)})`;
  3248. }
  3249. return `\n props: ${propsDecls},`;
  3250. }
  3251. function genDestructuredDefaultValue(key) {
  3252. const destructured = propsDestructuredBindings[key];
  3253. if (destructured && destructured.default) {
  3254. const value = scriptSetup.content.slice(destructured.default.start, destructured.default.end);
  3255. const isLiteral = destructured.default.type.endsWith('Literal');
  3256. return isLiteral ? value : `() => ${value}`;
  3257. }
  3258. }
  3259. function genSetupPropsType(node) {
  3260. const scriptSetupSource = scriptSetup.content;
  3261. if (hasStaticWithDefaults()) {
  3262. // if withDefaults() is used, we need to remove the optional flags
  3263. // on props that have default values
  3264. let res = `{ `;
  3265. const members = node.type === 'TSTypeLiteral' ? node.members : node.body;
  3266. for (const m of members) {
  3267. if ((m.type === 'TSPropertySignature' ||
  3268. m.type === 'TSMethodSignature') &&
  3269. m.typeAnnotation &&
  3270. m.key.type === 'Identifier') {
  3271. if (propsRuntimeDefaults.properties.some((p) => p.key.name === m.key.name)) {
  3272. res +=
  3273. m.key.name +
  3274. (m.type === 'TSMethodSignature' ? '()' : '') +
  3275. scriptSetupSource.slice(m.typeAnnotation.start, m.typeAnnotation.end) +
  3276. ', ';
  3277. }
  3278. else {
  3279. res +=
  3280. scriptSetupSource.slice(m.start, m.typeAnnotation.end) + `, `;
  3281. }
  3282. }
  3283. }
  3284. return (res.length ? res.slice(0, -2) : res) + ` }`;
  3285. }
  3286. else {
  3287. return scriptSetupSource.slice(node.start, node.end);
  3288. }
  3289. }
  3290. // 1. process normal <script> first if it exists
  3291. let scriptAst;
  3292. if (script) {
  3293. scriptAst = parse(script.content, {
  3294. plugins,
  3295. sourceType: 'module'
  3296. }, scriptStartOffset);
  3297. for (const node of scriptAst.body) {
  3298. if (node.type === 'ImportDeclaration') {
  3299. // record imports for dedupe
  3300. for (const specifier of node.specifiers) {
  3301. const imported = specifier.type === 'ImportSpecifier' &&
  3302. specifier.imported.type === 'Identifier' &&
  3303. specifier.imported.name;
  3304. registerUserImport(node.source.value, specifier.local.name, imported, node.importKind === 'type', false);
  3305. }
  3306. }
  3307. else if (node.type === 'ExportDefaultDeclaration') {
  3308. // export default
  3309. defaultExport = node;
  3310. // export default { ... } --> const __default__ = { ... }
  3311. const start = node.start + scriptStartOffset;
  3312. const end = node.declaration.start + scriptStartOffset;
  3313. s.overwrite(start, end, `const ${DEFAULT_VAR} = `);
  3314. }
  3315. else if (node.type === 'ExportNamedDeclaration') {
  3316. const defaultSpecifier = node.specifiers.find(s => s.exported.type === 'Identifier' && s.exported.name === 'default');
  3317. if (defaultSpecifier) {
  3318. defaultExport = node;
  3319. // 1. remove specifier
  3320. if (node.specifiers.length > 1) {
  3321. s.remove(defaultSpecifier.start + scriptStartOffset, defaultSpecifier.end + scriptStartOffset);
  3322. }
  3323. else {
  3324. s.remove(node.start + scriptStartOffset, node.end + scriptStartOffset);
  3325. }
  3326. if (node.source) {
  3327. // export { x as default } from './x'
  3328. // rewrite to `import { x as __default__ } from './x'` and
  3329. // add to top
  3330. s.prepend(`import { ${defaultSpecifier.local.name} as ${DEFAULT_VAR} } from '${node.source.value}'\n`);
  3331. }
  3332. else {
  3333. // export { x as default }
  3334. // rewrite to `const __default__ = x` and move to end
  3335. s.appendLeft(scriptEndOffset, `\nconst ${DEFAULT_VAR} = ${defaultSpecifier.local.name}\n`);
  3336. }
  3337. }
  3338. if (node.declaration) {
  3339. walkDeclaration(node.declaration, scriptBindings, userImportAlias);
  3340. }
  3341. }
  3342. else if ((node.type === 'VariableDeclaration' ||
  3343. node.type === 'FunctionDeclaration' ||
  3344. node.type === 'ClassDeclaration' ||
  3345. node.type === 'TSEnumDeclaration') &&
  3346. !node.declare) {
  3347. walkDeclaration(node, scriptBindings, userImportAlias);
  3348. }
  3349. }
  3350. // apply ref transform
  3351. if (enableRefTransform && reactivityTransform.shouldTransform(script.content)) {
  3352. const { rootRefs: rootVars, importedHelpers } = reactivityTransform.transformAST(scriptAst, s, scriptStartOffset);
  3353. refBindings = rootVars;
  3354. for (const h of importedHelpers) {
  3355. helperImports.add(h);
  3356. }
  3357. }
  3358. // <script> after <script setup>
  3359. // we need to move the block up so that `const __default__` is
  3360. // declared before being used in the actual component definition
  3361. if (scriptStartOffset > startOffset) {
  3362. s.move(scriptStartOffset, scriptEndOffset, 0);
  3363. }
  3364. }
  3365. // 2. parse <script setup> and walk over top level statements
  3366. const scriptSetupAst = parse(scriptSetup.content, {
  3367. plugins: [
  3368. ...plugins,
  3369. // allow top level await but only inside <script setup>
  3370. 'topLevelAwait'
  3371. ],
  3372. sourceType: 'module'
  3373. }, startOffset);
  3374. for (const node of scriptSetupAst.body) {
  3375. const start = node.start + startOffset;
  3376. let end = node.end + startOffset;
  3377. // locate comment
  3378. if (node.trailingComments && node.trailingComments.length > 0) {
  3379. const lastCommentNode = node.trailingComments[node.trailingComments.length - 1];
  3380. end = lastCommentNode.end + startOffset;
  3381. }
  3382. // locate the end of whitespace between this statement and the next
  3383. while (end <= source.length) {
  3384. if (!/\s/.test(source.charAt(end))) {
  3385. break;
  3386. }
  3387. end++;
  3388. }
  3389. // (Dropped) `ref: x` bindings
  3390. if (node.type === 'LabeledStatement' &&
  3391. node.label.name === 'ref' &&
  3392. node.body.type === 'ExpressionStatement') {
  3393. error(`ref sugar using the label syntax was an experimental proposal and ` +
  3394. `has been dropped based on community feedback. Please check out ` +
  3395. `the new proposal at https://github.com/vuejs/rfcs/discussions/369`, node);
  3396. }
  3397. if (node.type === 'ImportDeclaration') {
  3398. // import declarations are moved to top
  3399. s.move(start, end, 0);
  3400. // dedupe imports
  3401. let removed = 0;
  3402. const removeSpecifier = (i) => {
  3403. const removeLeft = i > removed;
  3404. removed++;
  3405. const current = node.specifiers[i];
  3406. const next = node.specifiers[i + 1];
  3407. s.remove(removeLeft
  3408. ? node.specifiers[i - 1].end + startOffset
  3409. : current.start + startOffset, next && !removeLeft
  3410. ? next.start + startOffset
  3411. : current.end + startOffset);
  3412. };
  3413. for (let i = 0; i < node.specifiers.length; i++) {
  3414. const specifier = node.specifiers[i];
  3415. const local = specifier.local.name;
  3416. const imported = specifier.type === 'ImportSpecifier' &&
  3417. specifier.imported.type === 'Identifier' &&
  3418. specifier.imported.name;
  3419. const source = node.source.value;
  3420. const existing = userImports[local];
  3421. if (source === 'vue' &&
  3422. (imported === DEFINE_PROPS ||
  3423. imported === DEFINE_EMITS ||
  3424. imported === DEFINE_EXPOSE)) {
  3425. warnOnce(`\`${imported}\` is a compiler macro and no longer needs to be imported.`);
  3426. removeSpecifier(i);
  3427. }
  3428. else if (existing) {
  3429. if (existing.source === source && existing.imported === imported) {
  3430. // already imported in <script setup>, dedupe
  3431. removeSpecifier(i);
  3432. }
  3433. else {
  3434. error(`different imports aliased to same local name.`, specifier);
  3435. }
  3436. }
  3437. else {
  3438. registerUserImport(source, local, imported, node.importKind === 'type', true);
  3439. }
  3440. }
  3441. if (node.specifiers.length && removed === node.specifiers.length) {
  3442. s.remove(node.start + startOffset, node.end + startOffset);
  3443. }
  3444. }
  3445. if (node.type === 'ExpressionStatement') {
  3446. // process `defineProps` and `defineEmit(s)` calls
  3447. if (processDefineProps(node.expression) ||
  3448. processDefineEmits(node.expression) ||
  3449. processWithDefaults(node.expression)) {
  3450. s.remove(node.start + startOffset, node.end + startOffset);
  3451. }
  3452. else if (processDefineExpose(node.expression)) {
  3453. // defineExpose({}) -> expose({})
  3454. const callee = node.expression.callee;
  3455. s.overwrite(callee.start + startOffset, callee.end + startOffset, 'expose');
  3456. }
  3457. }
  3458. if (node.type === 'VariableDeclaration' && !node.declare) {
  3459. const total = node.declarations.length;
  3460. let left = total;
  3461. for (let i = 0; i < total; i++) {
  3462. const decl = node.declarations[i];
  3463. if (decl.init) {
  3464. // defineProps / defineEmits
  3465. const isDefineProps = processDefineProps(decl.init, decl.id) ||
  3466. processWithDefaults(decl.init, decl.id);
  3467. const isDefineEmits = processDefineEmits(decl.init, decl.id);
  3468. if (isDefineProps || isDefineEmits) {
  3469. if (left === 1) {
  3470. s.remove(node.start + startOffset, node.end + startOffset);
  3471. }
  3472. else {
  3473. let start = decl.start + startOffset;
  3474. let end = decl.end + startOffset;
  3475. if (i < total - 1) {
  3476. // not the last one, locate the start of the next
  3477. end = node.declarations[i + 1].start + startOffset;
  3478. }
  3479. else {
  3480. // last one, locate the end of the prev
  3481. start = node.declarations[i - 1].end + startOffset;
  3482. }
  3483. s.remove(start, end);
  3484. left--;
  3485. }
  3486. }
  3487. }
  3488. }
  3489. }
  3490. // walk declarations to record declared bindings
  3491. if ((node.type === 'VariableDeclaration' ||
  3492. node.type === 'FunctionDeclaration' ||
  3493. node.type === 'ClassDeclaration') &&
  3494. !node.declare) {
  3495. walkDeclaration(node, setupBindings, userImportAlias);
  3496. }
  3497. // walk statements & named exports / variable declarations for top level
  3498. // await
  3499. if ((node.type === 'VariableDeclaration' && !node.declare) ||
  3500. node.type.endsWith('Statement')) {
  3501. estreeWalker.walk(node, {
  3502. enter(child, parent) {
  3503. if (CompilerDOM.isFunctionType(child)) {
  3504. this.skip();
  3505. }
  3506. if (child.type === 'AwaitExpression') {
  3507. hasAwait = true;
  3508. const needsSemi = scriptSetupAst.body.some(n => {
  3509. return n.type === 'ExpressionStatement' && n.start === child.start;
  3510. });
  3511. processAwait(child, needsSemi, parent.type === 'ExpressionStatement');
  3512. }
  3513. }
  3514. });
  3515. }
  3516. if ((node.type === 'ExportNamedDeclaration' && node.exportKind !== 'type') ||
  3517. node.type === 'ExportAllDeclaration' ||
  3518. node.type === 'ExportDefaultDeclaration') {
  3519. error(`<script setup> cannot contain ES module exports. ` +
  3520. `If you are using a previous version of <script setup>, please ` +
  3521. `consult the updated RFC at https://github.com/vuejs/rfcs/pull/227.`, node);
  3522. }
  3523. if (isTS) {
  3524. // runtime enum
  3525. if (node.type === 'TSEnumDeclaration') {
  3526. registerBinding(setupBindings, node.id, "setup-const" /* SETUP_CONST */);
  3527. }
  3528. // move all Type declarations to outer scope
  3529. if (node.type.startsWith('TS') ||
  3530. (node.type === 'ExportNamedDeclaration' &&
  3531. node.exportKind === 'type') ||
  3532. (node.type === 'VariableDeclaration' && node.declare)) {
  3533. recordType(node, declaredTypes);
  3534. s.move(start, end, 0);
  3535. }
  3536. }
  3537. }
  3538. // 3. Apply ref sugar transform
  3539. if ((enableRefTransform && reactivityTransform.shouldTransform(scriptSetup.content)) ||
  3540. propsDestructureDecl) {
  3541. const { rootRefs, importedHelpers } = reactivityTransform.transformAST(scriptSetupAst, s, startOffset, refBindings, propsDestructuredBindings);
  3542. refBindings = refBindings ? [...refBindings, ...rootRefs] : rootRefs;
  3543. for (const h of importedHelpers) {
  3544. helperImports.add(h);
  3545. }
  3546. }
  3547. // 4. extract runtime props/emits code from setup context type
  3548. if (propsTypeDecl) {
  3549. extractRuntimeProps(propsTypeDecl, typeDeclaredProps, declaredTypes);
  3550. }
  3551. if (emitsTypeDecl) {
  3552. extractRuntimeEmits(emitsTypeDecl, typeDeclaredEmits);
  3553. }
  3554. // 5. check useOptions args to make sure it doesn't reference setup scope
  3555. // variables
  3556. checkInvalidScopeReference(propsRuntimeDecl, DEFINE_PROPS);
  3557. checkInvalidScopeReference(propsRuntimeDefaults, DEFINE_PROPS);
  3558. checkInvalidScopeReference(propsDestructureDecl, DEFINE_PROPS);
  3559. checkInvalidScopeReference(emitsRuntimeDecl, DEFINE_PROPS);
  3560. // 6. remove non-script content
  3561. if (script) {
  3562. if (startOffset < scriptStartOffset) {
  3563. // <script setup> before <script>
  3564. s.remove(0, startOffset);
  3565. s.remove(endOffset, scriptStartOffset);
  3566. s.remove(scriptEndOffset, source.length);
  3567. }
  3568. else {
  3569. // <script> before <script setup>
  3570. s.remove(0, scriptStartOffset);
  3571. s.remove(scriptEndOffset, startOffset);
  3572. s.remove(endOffset, source.length);
  3573. }
  3574. }
  3575. else {
  3576. // only <script setup>
  3577. s.remove(0, startOffset);
  3578. s.remove(endOffset, source.length);
  3579. }
  3580. // 7. analyze binding metadata
  3581. if (scriptAst) {
  3582. Object.assign(bindingMetadata, analyzeScriptBindings(scriptAst.body));
  3583. }
  3584. if (propsRuntimeDecl) {
  3585. for (const key of getObjectOrArrayExpressionKeys(propsRuntimeDecl)) {
  3586. bindingMetadata[key] = "props" /* PROPS */;
  3587. }
  3588. }
  3589. for (const key in typeDeclaredProps) {
  3590. bindingMetadata[key] = "props" /* PROPS */;
  3591. }
  3592. // props aliases
  3593. if (propsDestructureDecl) {
  3594. if (propsDestructureRestId) {
  3595. bindingMetadata[propsDestructureRestId] = "setup-const" /* SETUP_CONST */;
  3596. }
  3597. for (const key in propsDestructuredBindings) {
  3598. const { local } = propsDestructuredBindings[key];
  3599. if (local !== key) {
  3600. bindingMetadata[local] = "props-aliased" /* PROPS_ALIASED */;
  3601. (bindingMetadata.__propsAliases ||
  3602. (bindingMetadata.__propsAliases = {}))[local] = key;
  3603. }
  3604. }
  3605. }
  3606. for (const [key, { isType, imported, source }] of Object.entries(userImports)) {
  3607. if (isType)
  3608. continue;
  3609. bindingMetadata[key] =
  3610. (imported === 'default' && source.endsWith('.vue')) || source === 'vue'
  3611. ? "setup-const" /* SETUP_CONST */
  3612. : "setup-maybe-ref" /* SETUP_MAYBE_REF */;
  3613. }
  3614. for (const key in scriptBindings) {
  3615. bindingMetadata[key] = scriptBindings[key];
  3616. }
  3617. for (const key in setupBindings) {
  3618. bindingMetadata[key] = setupBindings[key];
  3619. }
  3620. // known ref bindings
  3621. if (refBindings) {
  3622. for (const key of refBindings) {
  3623. bindingMetadata[key] = "setup-ref" /* SETUP_REF */;
  3624. }
  3625. }
  3626. // 8. inject `useCssVars` calls
  3627. if (cssVars.length) {
  3628. helperImports.add(CSS_VARS_HELPER);
  3629. helperImports.add('unref');
  3630. s.prependRight(startOffset, `\n${genCssVarsCode(cssVars, bindingMetadata, scopeId, isProd)}\n`);
  3631. }
  3632. // 9. finalize setup() argument signature
  3633. let args = `__props`;
  3634. if (propsTypeDecl) {
  3635. // mark as any and only cast on assignment
  3636. // since the user defined complex types may be incompatible with the
  3637. // inferred type from generated runtime declarations
  3638. args += `: any`;
  3639. }
  3640. // inject user assignment of props
  3641. // we use a default __props so that template expressions referencing props
  3642. // can use it directly
  3643. if (propsIdentifier) {
  3644. s.prependLeft(startOffset, `\nconst ${propsIdentifier} = __props${propsTypeDecl ? ` as ${genSetupPropsType(propsTypeDecl)}` : ``}\n`);
  3645. }
  3646. if (propsDestructureRestId) {
  3647. s.prependLeft(startOffset, `\nconst ${propsDestructureRestId} = ${helper(`createPropsRestProxy`)}(__props, ${JSON.stringify(Object.keys(propsDestructuredBindings))})\n`);
  3648. }
  3649. // inject temp variables for async context preservation
  3650. if (hasAwait) {
  3651. const any = isTS ? `: any` : ``;
  3652. s.prependLeft(startOffset, `\nlet __temp${any}, __restore${any}\n`);
  3653. }
  3654. const destructureElements = hasDefineExposeCall || !options.inlineTemplate ? [`expose`] : [];
  3655. if (emitIdentifier) {
  3656. destructureElements.push(emitIdentifier === `emit` ? `emit` : `emit: ${emitIdentifier}`);
  3657. }
  3658. if (destructureElements.length) {
  3659. args += `, { ${destructureElements.join(', ')} }`;
  3660. if (emitsTypeDecl) {
  3661. args += `: { emit: (${scriptSetup.content.slice(emitsTypeDecl.start, emitsTypeDecl.end)}), expose: any, slots: any, attrs: any }`;
  3662. }
  3663. }
  3664. // 10. generate return statement
  3665. let returned;
  3666. if (options.inlineTemplate) {
  3667. if (sfc.template && !sfc.template.src) {
  3668. if (options.templateOptions && options.templateOptions.ssr) {
  3669. hasInlinedSsrRenderFn = true;
  3670. }
  3671. // inline render function mode - we are going to compile the template and
  3672. // inline it right here
  3673. const { code, ast, preamble, tips, errors } = compileTemplate(Object.assign(Object.assign({ filename, source: sfc.template.content, inMap: sfc.template.map }, options.templateOptions), { id: scopeId, scoped: sfc.styles.some(s => s.scoped), isProd: options.isProd, ssrCssVars: sfc.cssVars, compilerOptions: Object.assign(Object.assign({}, (options.templateOptions &&
  3674. options.templateOptions.compilerOptions)), { inline: true, isTS,
  3675. bindingMetadata }) }));
  3676. if (tips.length) {
  3677. tips.forEach(warnOnce);
  3678. }
  3679. const err = errors[0];
  3680. if (typeof err === 'string') {
  3681. throw new Error(err);
  3682. }
  3683. else if (err) {
  3684. if (err.loc) {
  3685. err.message +=
  3686. `\n\n` +
  3687. sfc.filename +
  3688. '\n' +
  3689. shared.generateCodeFrame(source, err.loc.start.offset, err.loc.end.offset) +
  3690. `\n`;
  3691. }
  3692. throw err;
  3693. }
  3694. if (preamble) {
  3695. s.prepend(preamble);
  3696. }
  3697. // avoid duplicated unref import
  3698. // as this may get injected by the render function preamble OR the
  3699. // css vars codegen
  3700. if (ast && ast.helpers.includes(CompilerDOM.UNREF)) {
  3701. helperImports.delete('unref');
  3702. }
  3703. returned = code;
  3704. }
  3705. else {
  3706. returned = `() => {}`;
  3707. }
  3708. }
  3709. else {
  3710. // return bindings from script and script setup
  3711. const allBindings = Object.assign(Object.assign({}, scriptBindings), setupBindings);
  3712. for (const key in userImports) {
  3713. if (!userImports[key].isType && userImports[key].isUsedInTemplate) {
  3714. allBindings[key] = true;
  3715. }
  3716. }
  3717. returned = `{ ${Object.keys(allBindings).join(', ')} }`;
  3718. }
  3719. if (!options.inlineTemplate && !false) {
  3720. // in non-inline mode, the `__isScriptSetup: true` flag is used by
  3721. // componentPublicInstance proxy to allow properties that start with $ or _
  3722. s.appendRight(endOffset, `\nconst __returned__ = ${returned}\n` +
  3723. `Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true })\n` +
  3724. `return __returned__` +
  3725. `\n}\n\n`);
  3726. }
  3727. else {
  3728. s.appendRight(endOffset, `\nreturn ${returned}\n}\n\n`);
  3729. }
  3730. // 11. finalize default export
  3731. let runtimeOptions = ``;
  3732. if (hasInlinedSsrRenderFn) {
  3733. runtimeOptions += `\n __ssrInlineRender: true,`;
  3734. }
  3735. if (propsRuntimeDecl) {
  3736. let declCode = scriptSetup.content
  3737. .slice(propsRuntimeDecl.start, propsRuntimeDecl.end)
  3738. .trim();
  3739. if (propsDestructureDecl) {
  3740. const defaults = [];
  3741. for (const key in propsDestructuredBindings) {
  3742. const d = genDestructuredDefaultValue(key);
  3743. if (d)
  3744. defaults.push(`${key}: ${d}`);
  3745. }
  3746. if (defaults.length) {
  3747. declCode = `${helper(`mergeDefaults`)}(${declCode}, {\n ${defaults.join(',\n ')}\n})`;
  3748. }
  3749. }
  3750. runtimeOptions += `\n props: ${declCode},`;
  3751. }
  3752. else if (propsTypeDecl) {
  3753. runtimeOptions += genRuntimeProps(typeDeclaredProps);
  3754. }
  3755. if (emitsRuntimeDecl) {
  3756. runtimeOptions += `\n emits: ${scriptSetup.content
  3757. .slice(emitsRuntimeDecl.start, emitsRuntimeDecl.end)
  3758. .trim()},`;
  3759. }
  3760. else if (emitsTypeDecl) {
  3761. runtimeOptions += genRuntimeEmits(typeDeclaredEmits);
  3762. }
  3763. // <script setup> components are closed by default. If the user did not
  3764. // explicitly call `defineExpose`, call expose() with no args.
  3765. const exposeCall = hasDefineExposeCall || options.inlineTemplate ? `` : ` expose();\n`;
  3766. // wrap setup code with function.
  3767. if (isTS) {
  3768. // for TS, make sure the exported type is still valid type with
  3769. // correct props information
  3770. // we have to use object spread for types to be merged properly
  3771. // user's TS setting should compile it down to proper targets
  3772. // export default defineComponent({ ...__default__, ... })
  3773. const def = defaultExport ? `\n ...${DEFAULT_VAR},` : ``;
  3774. s.prependLeft(startOffset, `\nexport default /*#__PURE__*/${helper(`defineComponent`)}({${def}${runtimeOptions}\n ${hasAwait ? `async ` : ``}setup(${args}) {\n${exposeCall}`);
  3775. s.appendRight(endOffset, `})`);
  3776. }
  3777. else {
  3778. if (defaultExport) {
  3779. // without TS, can't rely on rest spread, so we use Object.assign
  3780. // export default Object.assign(__default__, { ... })
  3781. s.prependLeft(startOffset, `\nexport default /*#__PURE__*/Object.assign(${DEFAULT_VAR}, {${runtimeOptions}\n ` +
  3782. `${hasAwait ? `async ` : ``}setup(${args}) {\n${exposeCall}`);
  3783. s.appendRight(endOffset, `})`);
  3784. }
  3785. else {
  3786. s.prependLeft(startOffset, `\nexport default {${runtimeOptions}\n ` +
  3787. `${hasAwait ? `async ` : ``}setup(${args}) {\n${exposeCall}`);
  3788. s.appendRight(endOffset, `}`);
  3789. }
  3790. }
  3791. // 12. finalize Vue helper imports
  3792. if (helperImports.size > 0) {
  3793. s.prepend(`import { ${[...helperImports]
  3794. .map(h => `${h} as _${h}`)
  3795. .join(', ')} } from 'vue'\n`);
  3796. }
  3797. s.trim();
  3798. return Object.assign(Object.assign({}, scriptSetup), { bindings: bindingMetadata, imports: userImports, content: s.toString(), map: genSourceMap
  3799. ? s.generateMap({
  3800. source: filename,
  3801. hires: true,
  3802. includeContent: true
  3803. })
  3804. : undefined, scriptAst: scriptAst === null || scriptAst === void 0 ? void 0 : scriptAst.body, scriptSetupAst: scriptSetupAst === null || scriptSetupAst === void 0 ? void 0 : scriptSetupAst.body });
  3805. }
  3806. function registerBinding(bindings, node, type) {
  3807. bindings[node.name] = type;
  3808. }
  3809. function walkDeclaration(node, bindings, userImportAlias) {
  3810. if (node.type === 'VariableDeclaration') {
  3811. const isConst = node.kind === 'const';
  3812. // export const foo = ...
  3813. for (const { id, init } of node.declarations) {
  3814. const isDefineCall = !!(isConst &&
  3815. isCallOf(init, c => c === DEFINE_PROPS || c === DEFINE_EMITS || c === WITH_DEFAULTS));
  3816. if (id.type === 'Identifier') {
  3817. let bindingType;
  3818. const userReactiveBinding = userImportAlias['reactive'] || 'reactive';
  3819. if (isCallOf(init, userReactiveBinding)) {
  3820. // treat reactive() calls as let since it's meant to be mutable
  3821. bindingType = "setup-let" /* SETUP_LET */;
  3822. }
  3823. else if (
  3824. // if a declaration is a const literal, we can mark it so that
  3825. // the generated render fn code doesn't need to unref() it
  3826. isDefineCall ||
  3827. (isConst && canNeverBeRef(init, userReactiveBinding))) {
  3828. bindingType = "setup-const" /* SETUP_CONST */;
  3829. }
  3830. else if (isConst) {
  3831. if (isCallOf(init, userImportAlias['ref'] || 'ref')) {
  3832. bindingType = "setup-ref" /* SETUP_REF */;
  3833. }
  3834. else {
  3835. bindingType = "setup-maybe-ref" /* SETUP_MAYBE_REF */;
  3836. }
  3837. }
  3838. else {
  3839. bindingType = "setup-let" /* SETUP_LET */;
  3840. }
  3841. registerBinding(bindings, id, bindingType);
  3842. }
  3843. else {
  3844. if (isCallOf(init, DEFINE_PROPS)) {
  3845. // skip walking props destructure
  3846. return;
  3847. }
  3848. if (id.type === 'ObjectPattern') {
  3849. walkObjectPattern(id, bindings, isConst, isDefineCall);
  3850. }
  3851. else if (id.type === 'ArrayPattern') {
  3852. walkArrayPattern(id, bindings, isConst, isDefineCall);
  3853. }
  3854. }
  3855. }
  3856. }
  3857. else if (node.type === 'TSEnumDeclaration' ||
  3858. node.type === 'FunctionDeclaration' ||
  3859. node.type === 'ClassDeclaration') {
  3860. // export function foo() {} / export class Foo {}
  3861. // export declarations must be named.
  3862. bindings[node.id.name] = "setup-const" /* SETUP_CONST */;
  3863. }
  3864. }
  3865. function walkObjectPattern(node, bindings, isConst, isDefineCall = false) {
  3866. for (const p of node.properties) {
  3867. if (p.type === 'ObjectProperty') {
  3868. if (p.key.type === 'Identifier' && p.key === p.value) {
  3869. // shorthand: const { x } = ...
  3870. const type = isDefineCall
  3871. ? "setup-const" /* SETUP_CONST */
  3872. : isConst
  3873. ? "setup-maybe-ref" /* SETUP_MAYBE_REF */
  3874. : "setup-let" /* SETUP_LET */;
  3875. registerBinding(bindings, p.key, type);
  3876. }
  3877. else {
  3878. walkPattern(p.value, bindings, isConst, isDefineCall);
  3879. }
  3880. }
  3881. else {
  3882. // ...rest
  3883. // argument can only be identifier when destructuring
  3884. const type = isConst ? "setup-const" /* SETUP_CONST */ : "setup-let" /* SETUP_LET */;
  3885. registerBinding(bindings, p.argument, type);
  3886. }
  3887. }
  3888. }
  3889. function walkArrayPattern(node, bindings, isConst, isDefineCall = false) {
  3890. for (const e of node.elements) {
  3891. e && walkPattern(e, bindings, isConst, isDefineCall);
  3892. }
  3893. }
  3894. function walkPattern(node, bindings, isConst, isDefineCall = false) {
  3895. if (node.type === 'Identifier') {
  3896. const type = isDefineCall
  3897. ? "setup-const" /* SETUP_CONST */
  3898. : isConst
  3899. ? "setup-maybe-ref" /* SETUP_MAYBE_REF */
  3900. : "setup-let" /* SETUP_LET */;
  3901. registerBinding(bindings, node, type);
  3902. }
  3903. else if (node.type === 'RestElement') {
  3904. // argument can only be identifier when destructuring
  3905. const type = isConst ? "setup-const" /* SETUP_CONST */ : "setup-let" /* SETUP_LET */;
  3906. registerBinding(bindings, node.argument, type);
  3907. }
  3908. else if (node.type === 'ObjectPattern') {
  3909. walkObjectPattern(node, bindings, isConst);
  3910. }
  3911. else if (node.type === 'ArrayPattern') {
  3912. walkArrayPattern(node, bindings, isConst);
  3913. }
  3914. else if (node.type === 'AssignmentPattern') {
  3915. if (node.left.type === 'Identifier') {
  3916. const type = isDefineCall
  3917. ? "setup-const" /* SETUP_CONST */
  3918. : isConst
  3919. ? "setup-maybe-ref" /* SETUP_MAYBE_REF */
  3920. : "setup-let" /* SETUP_LET */;
  3921. registerBinding(bindings, node.left, type);
  3922. }
  3923. else {
  3924. walkPattern(node.left, bindings, isConst);
  3925. }
  3926. }
  3927. }
  3928. function recordType(node, declaredTypes) {
  3929. if (node.type === 'TSInterfaceDeclaration') {
  3930. declaredTypes[node.id.name] = [`Object`];
  3931. }
  3932. else if (node.type === 'TSTypeAliasDeclaration') {
  3933. declaredTypes[node.id.name] = inferRuntimeType(node.typeAnnotation, declaredTypes);
  3934. }
  3935. else if (node.type === 'ExportNamedDeclaration' && node.declaration) {
  3936. recordType(node.declaration, declaredTypes);
  3937. }
  3938. }
  3939. function extractRuntimeProps(node, props, declaredTypes, isProd) {
  3940. const members = node.type === 'TSTypeLiteral' ? node.members : node.body;
  3941. for (const m of members) {
  3942. if ((m.type === 'TSPropertySignature' || m.type === 'TSMethodSignature') &&
  3943. m.key.type === 'Identifier') {
  3944. let type;
  3945. if (m.type === 'TSMethodSignature') {
  3946. type = ['Function'];
  3947. }
  3948. else if (m.typeAnnotation) {
  3949. type = inferRuntimeType(m.typeAnnotation.typeAnnotation, declaredTypes);
  3950. }
  3951. props[m.key.name] = {
  3952. key: m.key.name,
  3953. required: !m.optional,
  3954. type: type || [`null`]
  3955. };
  3956. }
  3957. }
  3958. }
  3959. function inferRuntimeType(node, declaredTypes) {
  3960. switch (node.type) {
  3961. case 'TSStringKeyword':
  3962. return ['String'];
  3963. case 'TSNumberKeyword':
  3964. return ['Number'];
  3965. case 'TSBooleanKeyword':
  3966. return ['Boolean'];
  3967. case 'TSObjectKeyword':
  3968. return ['Object'];
  3969. case 'TSTypeLiteral':
  3970. // TODO (nice to have) generate runtime property validation
  3971. return ['Object'];
  3972. case 'TSFunctionType':
  3973. return ['Function'];
  3974. case 'TSArrayType':
  3975. case 'TSTupleType':
  3976. // TODO (nice to have) generate runtime element type/length checks
  3977. return ['Array'];
  3978. case 'TSLiteralType':
  3979. switch (node.literal.type) {
  3980. case 'StringLiteral':
  3981. return ['String'];
  3982. case 'BooleanLiteral':
  3983. return ['Boolean'];
  3984. case 'NumericLiteral':
  3985. case 'BigIntLiteral':
  3986. return ['Number'];
  3987. default:
  3988. return [`null`];
  3989. }
  3990. case 'TSTypeReference':
  3991. if (node.typeName.type === 'Identifier') {
  3992. if (declaredTypes[node.typeName.name]) {
  3993. return declaredTypes[node.typeName.name];
  3994. }
  3995. switch (node.typeName.name) {
  3996. case 'Array':
  3997. case 'Function':
  3998. case 'Object':
  3999. case 'Set':
  4000. case 'Map':
  4001. case 'WeakSet':
  4002. case 'WeakMap':
  4003. case 'Date':
  4004. return [node.typeName.name];
  4005. case 'Record':
  4006. case 'Partial':
  4007. case 'Readonly':
  4008. case 'Pick':
  4009. case 'Omit':
  4010. case 'Exclude':
  4011. case 'Extract':
  4012. case 'Required':
  4013. case 'InstanceType':
  4014. return ['Object'];
  4015. }
  4016. }
  4017. return [`null`];
  4018. case 'TSParenthesizedType':
  4019. return inferRuntimeType(node.typeAnnotation, declaredTypes);
  4020. case 'TSUnionType':
  4021. return [
  4022. ...new Set([].concat(...node.types.map(t => inferRuntimeType(t, declaredTypes))))
  4023. ];
  4024. case 'TSIntersectionType':
  4025. return ['Object'];
  4026. case 'TSSymbolKeyword':
  4027. return ['Symbol'];
  4028. default:
  4029. return [`null`]; // no runtime check
  4030. }
  4031. }
  4032. function toRuntimeTypeString(types) {
  4033. return types.length > 1 ? `[${types.join(', ')}]` : types[0];
  4034. }
  4035. function extractRuntimeEmits(node, emits) {
  4036. if (node.type === 'TSTypeLiteral' || node.type === 'TSInterfaceBody') {
  4037. const members = node.type === 'TSTypeLiteral' ? node.members : node.body;
  4038. for (let t of members) {
  4039. if (t.type === 'TSCallSignatureDeclaration') {
  4040. extractEventNames(t.parameters[0], emits);
  4041. }
  4042. }
  4043. return;
  4044. }
  4045. else {
  4046. extractEventNames(node.parameters[0], emits);
  4047. }
  4048. }
  4049. function extractEventNames(eventName, emits) {
  4050. if (eventName.type === 'Identifier' &&
  4051. eventName.typeAnnotation &&
  4052. eventName.typeAnnotation.type === 'TSTypeAnnotation') {
  4053. const typeNode = eventName.typeAnnotation.typeAnnotation;
  4054. if (typeNode.type === 'TSLiteralType') {
  4055. if (typeNode.literal.type !== 'UnaryExpression') {
  4056. emits.add(String(typeNode.literal.value));
  4057. }
  4058. }
  4059. else if (typeNode.type === 'TSUnionType') {
  4060. for (const t of typeNode.types) {
  4061. if (t.type === 'TSLiteralType' &&
  4062. t.literal.type !== 'UnaryExpression') {
  4063. emits.add(String(t.literal.value));
  4064. }
  4065. }
  4066. }
  4067. }
  4068. }
  4069. function genRuntimeEmits(emits) {
  4070. return emits.size
  4071. ? `\n emits: [${Array.from(emits)
  4072. .map(p => JSON.stringify(p))
  4073. .join(', ')}],`
  4074. : ``;
  4075. }
  4076. function isCallOf(node, test) {
  4077. return !!(node &&
  4078. node.type === 'CallExpression' &&
  4079. node.callee.type === 'Identifier' &&
  4080. (typeof test === 'string'
  4081. ? node.callee.name === test
  4082. : test(node.callee.name)));
  4083. }
  4084. function canNeverBeRef(node, userReactiveImport) {
  4085. if (isCallOf(node, userReactiveImport)) {
  4086. return true;
  4087. }
  4088. switch (node.type) {
  4089. case 'UnaryExpression':
  4090. case 'BinaryExpression':
  4091. case 'ArrayExpression':
  4092. case 'ObjectExpression':
  4093. case 'FunctionExpression':
  4094. case 'ArrowFunctionExpression':
  4095. case 'UpdateExpression':
  4096. case 'ClassExpression':
  4097. case 'TaggedTemplateExpression':
  4098. return true;
  4099. case 'SequenceExpression':
  4100. return canNeverBeRef(node.expressions[node.expressions.length - 1], userReactiveImport);
  4101. default:
  4102. if (node.type.endsWith('Literal')) {
  4103. return true;
  4104. }
  4105. return false;
  4106. }
  4107. }
  4108. /**
  4109. * Analyze bindings in normal `<script>`
  4110. * Note that `compileScriptSetup` already analyzes bindings as part of its
  4111. * compilation process so this should only be used on single `<script>` SFCs.
  4112. */
  4113. function analyzeScriptBindings(ast) {
  4114. for (const node of ast) {
  4115. if (node.type === 'ExportDefaultDeclaration' &&
  4116. node.declaration.type === 'ObjectExpression') {
  4117. return analyzeBindingsFromOptions(node.declaration);
  4118. }
  4119. }
  4120. return {};
  4121. }
  4122. function analyzeBindingsFromOptions(node) {
  4123. const bindings = {};
  4124. // #3270, #3275
  4125. // mark non-script-setup so we don't resolve components/directives from these
  4126. Object.defineProperty(bindings, '__isScriptSetup', {
  4127. enumerable: false,
  4128. value: false
  4129. });
  4130. for (const property of node.properties) {
  4131. if (property.type === 'ObjectProperty' &&
  4132. !property.computed &&
  4133. property.key.type === 'Identifier') {
  4134. // props
  4135. if (property.key.name === 'props') {
  4136. // props: ['foo']
  4137. // props: { foo: ... }
  4138. for (const key of getObjectOrArrayExpressionKeys(property.value)) {
  4139. bindings[key] = "props" /* PROPS */;
  4140. }
  4141. }
  4142. // inject
  4143. else if (property.key.name === 'inject') {
  4144. // inject: ['foo']
  4145. // inject: { foo: {} }
  4146. for (const key of getObjectOrArrayExpressionKeys(property.value)) {
  4147. bindings[key] = "options" /* OPTIONS */;
  4148. }
  4149. }
  4150. // computed & methods
  4151. else if (property.value.type === 'ObjectExpression' &&
  4152. (property.key.name === 'computed' || property.key.name === 'methods')) {
  4153. // methods: { foo() {} }
  4154. // computed: { foo() {} }
  4155. for (const key of getObjectExpressionKeys(property.value)) {
  4156. bindings[key] = "options" /* OPTIONS */;
  4157. }
  4158. }
  4159. }
  4160. // setup & data
  4161. else if (property.type === 'ObjectMethod' &&
  4162. property.key.type === 'Identifier' &&
  4163. (property.key.name === 'setup' || property.key.name === 'data')) {
  4164. for (const bodyItem of property.body.body) {
  4165. // setup() {
  4166. // return {
  4167. // foo: null
  4168. // }
  4169. // }
  4170. if (bodyItem.type === 'ReturnStatement' &&
  4171. bodyItem.argument &&
  4172. bodyItem.argument.type === 'ObjectExpression') {
  4173. for (const key of getObjectExpressionKeys(bodyItem.argument)) {
  4174. bindings[key] =
  4175. property.key.name === 'setup'
  4176. ? "setup-maybe-ref" /* SETUP_MAYBE_REF */
  4177. : "data" /* DATA */;
  4178. }
  4179. }
  4180. }
  4181. }
  4182. }
  4183. return bindings;
  4184. }
  4185. function getObjectExpressionKeys(node) {
  4186. const keys = [];
  4187. for (const prop of node.properties) {
  4188. if ((prop.type === 'ObjectProperty' || prop.type === 'ObjectMethod') &&
  4189. !prop.computed) {
  4190. if (prop.key.type === 'Identifier') {
  4191. keys.push(prop.key.name);
  4192. }
  4193. else if (prop.key.type === 'StringLiteral') {
  4194. keys.push(prop.key.value);
  4195. }
  4196. }
  4197. }
  4198. return keys;
  4199. }
  4200. function getArrayExpressionKeys(node) {
  4201. const keys = [];
  4202. for (const element of node.elements) {
  4203. if (element && element.type === 'StringLiteral') {
  4204. keys.push(element.value);
  4205. }
  4206. }
  4207. return keys;
  4208. }
  4209. function getObjectOrArrayExpressionKeys(value) {
  4210. if (value.type === 'ArrayExpression') {
  4211. return getArrayExpressionKeys(value);
  4212. }
  4213. if (value.type === 'ObjectExpression') {
  4214. return getObjectExpressionKeys(value);
  4215. }
  4216. return [];
  4217. }
  4218. const templateUsageCheckCache = createCache();
  4219. function resolveTemplateUsageCheckString(sfc) {
  4220. const { content, ast } = sfc.template;
  4221. const cached = templateUsageCheckCache.get(content);
  4222. if (cached) {
  4223. return cached;
  4224. }
  4225. let code = '';
  4226. CompilerDOM.transform(CompilerDOM.createRoot([ast]), {
  4227. nodeTransforms: [
  4228. node => {
  4229. if (node.type === 1 /* ELEMENT */) {
  4230. if (!CompilerDOM.parserOptions.isNativeTag(node.tag) &&
  4231. !CompilerDOM.parserOptions.isBuiltInComponent(node.tag)) {
  4232. code += `,${shared.camelize(node.tag)},${shared.capitalize(shared.camelize(node.tag))}`;
  4233. }
  4234. for (let i = 0; i < node.props.length; i++) {
  4235. const prop = node.props[i];
  4236. if (prop.type === 7 /* DIRECTIVE */) {
  4237. if (!isBuiltInDir(prop.name)) {
  4238. code += `,v${shared.capitalize(shared.camelize(prop.name))}`;
  4239. }
  4240. if (prop.exp) {
  4241. code += `,${stripStrings(prop.exp.content)}`;
  4242. }
  4243. }
  4244. }
  4245. }
  4246. else if (node.type === 5 /* INTERPOLATION */) {
  4247. code += `,${stripStrings(node.content.content)}`;
  4248. }
  4249. }
  4250. ]
  4251. });
  4252. code += ';';
  4253. templateUsageCheckCache.set(content, code);
  4254. return code;
  4255. }
  4256. function stripStrings(exp) {
  4257. return exp
  4258. .replace(/'[^']*'|"[^"]*"/g, '')
  4259. .replace(/`[^`]+`/g, stripTemplateString);
  4260. }
  4261. function stripTemplateString(str) {
  4262. const interpMatch = str.match(/\${[^}]+}/g);
  4263. if (interpMatch) {
  4264. return interpMatch.map(m => m.slice(2, -1)).join(',');
  4265. }
  4266. return '';
  4267. }
  4268. function isImportUsed(local, sfc) {
  4269. return new RegExp(
  4270. // #4274 escape $ since it's a special char in regex
  4271. // (and is the only regex special char that is valid in identifiers)
  4272. `[^\\w$_]${local.replace(/\$/g, '\\$')}[^\\w$_]`).test(resolveTemplateUsageCheckString(sfc));
  4273. }
  4274. /**
  4275. * Note: this comparison assumes the prev/next script are already identical,
  4276. * and only checks the special case where <script setup lang="ts"> unused import
  4277. * pruning result changes due to template changes.
  4278. */
  4279. function hmrShouldReload(prevImports, next) {
  4280. if (!next.scriptSetup ||
  4281. (next.scriptSetup.lang !== 'ts' && next.scriptSetup.lang !== 'tsx')) {
  4282. return false;
  4283. }
  4284. // for each previous import, check if its used status remain the same based on
  4285. // the next descriptor's template
  4286. for (const key in prevImports) {
  4287. // if an import was previous unused, but now is used, we need to force
  4288. // reload so that the script now includes that import.
  4289. if (!prevImports[key].isUsedInTemplate && isImportUsed(key, next)) {
  4290. return true;
  4291. }
  4292. }
  4293. return false;
  4294. }
  4295. const sourceToSFC = createCache();
  4296. function parse(source, { sourceMap = true, filename = 'anonymous.vue', sourceRoot = '', pad = false, ignoreEmpty = true, compiler = CompilerDOM__namespace } = {}) {
  4297. const sourceKey = source + sourceMap + filename + sourceRoot + pad + compiler.parse;
  4298. const cache = sourceToSFC.get(sourceKey);
  4299. if (cache) {
  4300. return cache;
  4301. }
  4302. const descriptor = {
  4303. filename,
  4304. source,
  4305. template: null,
  4306. script: null,
  4307. scriptSetup: null,
  4308. styles: [],
  4309. customBlocks: [],
  4310. cssVars: [],
  4311. slotted: false,
  4312. shouldForceReload: prevImports => hmrShouldReload(prevImports, descriptor)
  4313. };
  4314. const errors = [];
  4315. const ast = compiler.parse(source, {
  4316. // there are no components at SFC parsing level
  4317. isNativeTag: () => true,
  4318. // preserve all whitespaces
  4319. isPreTag: () => true,
  4320. getTextMode: ({ tag, props }, parent) => {
  4321. // all top level elements except <template> are parsed as raw text
  4322. // containers
  4323. if ((!parent && tag !== 'template') ||
  4324. // <template lang="xxx"> should also be treated as raw text
  4325. (tag === 'template' &&
  4326. props.some(p => p.type === 6 /* ATTRIBUTE */ &&
  4327. p.name === 'lang' &&
  4328. p.value &&
  4329. p.value.content &&
  4330. p.value.content !== 'html'))) {
  4331. return 2 /* RAWTEXT */;
  4332. }
  4333. else {
  4334. return 0 /* DATA */;
  4335. }
  4336. },
  4337. onError: e => {
  4338. errors.push(e);
  4339. }
  4340. });
  4341. ast.children.forEach(node => {
  4342. if (node.type !== 1 /* ELEMENT */) {
  4343. return;
  4344. }
  4345. // we only want to keep the nodes that are not empty (when the tag is not a template)
  4346. if (ignoreEmpty &&
  4347. node.tag !== 'template' &&
  4348. isEmpty(node) &&
  4349. !hasSrc(node)) {
  4350. return;
  4351. }
  4352. switch (node.tag) {
  4353. case 'template':
  4354. if (!descriptor.template) {
  4355. const templateBlock = (descriptor.template = createBlock(node, source, false));
  4356. templateBlock.ast = node;
  4357. // warn against 2.x <template functional>
  4358. if (templateBlock.attrs.functional) {
  4359. const err = new SyntaxError(`<template functional> is no longer supported in Vue 3, since ` +
  4360. `functional components no longer have significant performance ` +
  4361. `difference from stateful ones. Just use a normal <template> ` +
  4362. `instead.`);
  4363. err.loc = node.props.find(p => p.name === 'functional').loc;
  4364. errors.push(err);
  4365. }
  4366. }
  4367. else {
  4368. errors.push(createDuplicateBlockError(node));
  4369. }
  4370. break;
  4371. case 'script':
  4372. const scriptBlock = createBlock(node, source, pad);
  4373. const isSetup = !!scriptBlock.attrs.setup;
  4374. if (isSetup && !descriptor.scriptSetup) {
  4375. descriptor.scriptSetup = scriptBlock;
  4376. break;
  4377. }
  4378. if (!isSetup && !descriptor.script) {
  4379. descriptor.script = scriptBlock;
  4380. break;
  4381. }
  4382. errors.push(createDuplicateBlockError(node, isSetup));
  4383. break;
  4384. case 'style':
  4385. const styleBlock = createBlock(node, source, pad);
  4386. if (styleBlock.attrs.vars) {
  4387. errors.push(new SyntaxError(`<style vars> has been replaced by a new proposal: ` +
  4388. `https://github.com/vuejs/rfcs/pull/231`));
  4389. }
  4390. descriptor.styles.push(styleBlock);
  4391. break;
  4392. default:
  4393. descriptor.customBlocks.push(createBlock(node, source, pad));
  4394. break;
  4395. }
  4396. });
  4397. if (descriptor.scriptSetup) {
  4398. if (descriptor.scriptSetup.src) {
  4399. errors.push(new SyntaxError(`<script setup> cannot use the "src" attribute because ` +
  4400. `its syntax will be ambiguous outside of the component.`));
  4401. descriptor.scriptSetup = null;
  4402. }
  4403. if (descriptor.script && descriptor.script.src) {
  4404. errors.push(new SyntaxError(`<script> cannot use the "src" attribute when <script setup> is ` +
  4405. `also present because they must be processed together.`));
  4406. descriptor.script = null;
  4407. }
  4408. }
  4409. if (sourceMap) {
  4410. const genMap = (block) => {
  4411. if (block && !block.src) {
  4412. block.map = generateSourceMap(filename, source, block.content, sourceRoot, !pad || block.type === 'template' ? block.loc.start.line - 1 : 0);
  4413. }
  4414. };
  4415. genMap(descriptor.template);
  4416. genMap(descriptor.script);
  4417. descriptor.styles.forEach(genMap);
  4418. descriptor.customBlocks.forEach(genMap);
  4419. }
  4420. // parse CSS vars
  4421. descriptor.cssVars = parseCssVars(descriptor);
  4422. // check if the SFC uses :slotted
  4423. const slottedRE = /(?:::v-|:)slotted\(/;
  4424. descriptor.slotted = descriptor.styles.some(s => s.scoped && slottedRE.test(s.content));
  4425. const result = {
  4426. descriptor,
  4427. errors
  4428. };
  4429. sourceToSFC.set(sourceKey, result);
  4430. return result;
  4431. }
  4432. function createDuplicateBlockError(node, isScriptSetup = false) {
  4433. const err = new SyntaxError(`Single file component can contain only one <${node.tag}${isScriptSetup ? ` setup` : ``}> element`);
  4434. err.loc = node.loc;
  4435. return err;
  4436. }
  4437. function createBlock(node, source, pad) {
  4438. const type = node.tag;
  4439. let { start, end } = node.loc;
  4440. let content = '';
  4441. if (node.children.length) {
  4442. start = node.children[0].loc.start;
  4443. end = node.children[node.children.length - 1].loc.end;
  4444. content = source.slice(start.offset, end.offset);
  4445. }
  4446. else {
  4447. const offset = node.loc.source.indexOf(`</`);
  4448. if (offset > -1) {
  4449. start = {
  4450. line: start.line,
  4451. column: start.column + offset,
  4452. offset: start.offset + offset
  4453. };
  4454. }
  4455. end = Object.assign({}, start);
  4456. }
  4457. const loc = {
  4458. source: content,
  4459. start,
  4460. end
  4461. };
  4462. const attrs = {};
  4463. const block = {
  4464. type,
  4465. content,
  4466. loc,
  4467. attrs
  4468. };
  4469. if (pad) {
  4470. block.content = padContent(source, block, pad) + block.content;
  4471. }
  4472. node.props.forEach(p => {
  4473. if (p.type === 6 /* ATTRIBUTE */) {
  4474. attrs[p.name] = p.value ? p.value.content || true : true;
  4475. if (p.name === 'lang') {
  4476. block.lang = p.value && p.value.content;
  4477. }
  4478. else if (p.name === 'src') {
  4479. block.src = p.value && p.value.content;
  4480. }
  4481. else if (type === 'style') {
  4482. if (p.name === 'scoped') {
  4483. block.scoped = true;
  4484. }
  4485. else if (p.name === 'module') {
  4486. block.module = attrs[p.name];
  4487. }
  4488. }
  4489. else if (type === 'script' && p.name === 'setup') {
  4490. block.setup = attrs.setup;
  4491. }
  4492. }
  4493. });
  4494. return block;
  4495. }
  4496. const splitRE = /\r?\n/g;
  4497. const emptyRE = /^(?:\/\/)?\s*$/;
  4498. const replaceRE = /./g;
  4499. function generateSourceMap(filename, source, generated, sourceRoot, lineOffset) {
  4500. const map = new sourceMap.SourceMapGenerator({
  4501. file: filename.replace(/\\/g, '/'),
  4502. sourceRoot: sourceRoot.replace(/\\/g, '/')
  4503. });
  4504. map.setSourceContent(filename, source);
  4505. generated.split(splitRE).forEach((line, index) => {
  4506. if (!emptyRE.test(line)) {
  4507. const originalLine = index + 1 + lineOffset;
  4508. const generatedLine = index + 1;
  4509. for (let i = 0; i < line.length; i++) {
  4510. if (!/\s/.test(line[i])) {
  4511. map.addMapping({
  4512. source: filename,
  4513. original: {
  4514. line: originalLine,
  4515. column: i
  4516. },
  4517. generated: {
  4518. line: generatedLine,
  4519. column: i
  4520. }
  4521. });
  4522. }
  4523. }
  4524. }
  4525. });
  4526. return JSON.parse(map.toString());
  4527. }
  4528. function padContent(content, block, pad) {
  4529. content = content.slice(0, block.loc.start.offset);
  4530. if (pad === 'space') {
  4531. return content.replace(replaceRE, ' ');
  4532. }
  4533. else {
  4534. const offset = content.split(splitRE).length;
  4535. const padChar = block.type === 'script' && !block.lang ? '//\n' : '\n';
  4536. return Array(offset).join(padChar);
  4537. }
  4538. }
  4539. function hasSrc(node) {
  4540. return node.props.some(p => {
  4541. if (p.type !== 6 /* ATTRIBUTE */) {
  4542. return false;
  4543. }
  4544. return p.name === 'src';
  4545. });
  4546. }
  4547. /**
  4548. * Returns true if the node has no children
  4549. * once the empty text nodes (trimmed content) have been filtered out.
  4550. */
  4551. function isEmpty(node) {
  4552. for (let i = 0; i < node.children.length; i++) {
  4553. const child = node.children[i];
  4554. if (child.type !== 2 /* TEXT */ || child.content.trim() !== '') {
  4555. return false;
  4556. }
  4557. }
  4558. return true;
  4559. }
  4560. const trimPlugin = () => {
  4561. return {
  4562. postcssPlugin: 'vue-sfc-trim',
  4563. Once(root) {
  4564. root.walk(({ type, raws }) => {
  4565. if (type === 'rule' || type === 'atrule') {
  4566. if (raws.before)
  4567. raws.before = '\n';
  4568. if ('after' in raws && raws.after)
  4569. raws.after = '\n';
  4570. }
  4571. });
  4572. }
  4573. };
  4574. };
  4575. trimPlugin.postcss = true;
  4576. var unesc_1 = createCommonjsModule(function (module, exports) {
  4577. exports.__esModule = true;
  4578. exports["default"] = unesc;
  4579. // Many thanks for this post which made this migration much easier.
  4580. // https://mathiasbynens.be/notes/css-escapes
  4581. /**
  4582. *
  4583. * @param {string} str
  4584. * @returns {[string, number]|undefined}
  4585. */
  4586. function gobbleHex(str) {
  4587. var lower = str.toLowerCase();
  4588. var hex = '';
  4589. var spaceTerminated = false;
  4590. for (var i = 0; i < 6 && lower[i] !== undefined; i++) {
  4591. var code = lower.charCodeAt(i); // check to see if we are dealing with a valid hex char [a-f|0-9]
  4592. var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57; // https://drafts.csswg.org/css-syntax/#consume-escaped-code-point
  4593. spaceTerminated = code === 32;
  4594. if (!valid) {
  4595. break;
  4596. }
  4597. hex += lower[i];
  4598. }
  4599. if (hex.length === 0) {
  4600. return undefined;
  4601. }
  4602. var codePoint = parseInt(hex, 16);
  4603. var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF; // Add special case for
  4604. // "If this number is zero, or is for a surrogate, or is greater than the maximum allowed code point"
  4605. // https://drafts.csswg.org/css-syntax/#maximum-allowed-code-point
  4606. if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10FFFF) {
  4607. return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)];
  4608. }
  4609. return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)];
  4610. }
  4611. var CONTAINS_ESCAPE = /\\/;
  4612. function unesc(str) {
  4613. var needToProcess = CONTAINS_ESCAPE.test(str);
  4614. if (!needToProcess) {
  4615. return str;
  4616. }
  4617. var ret = "";
  4618. for (var i = 0; i < str.length; i++) {
  4619. if (str[i] === "\\") {
  4620. var gobbled = gobbleHex(str.slice(i + 1, i + 7));
  4621. if (gobbled !== undefined) {
  4622. ret += gobbled[0];
  4623. i += gobbled[1];
  4624. continue;
  4625. } // Retain a pair of \\ if double escaped `\\\\`
  4626. // https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e
  4627. if (str[i + 1] === "\\") {
  4628. ret += "\\";
  4629. i++;
  4630. continue;
  4631. } // if \\ is at the end of the string retain it
  4632. // https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb
  4633. if (str.length === i + 1) {
  4634. ret += str[i];
  4635. }
  4636. continue;
  4637. }
  4638. ret += str[i];
  4639. }
  4640. return ret;
  4641. }
  4642. module.exports = exports.default;
  4643. });
  4644. var getProp_1 = createCommonjsModule(function (module, exports) {
  4645. exports.__esModule = true;
  4646. exports["default"] = getProp;
  4647. function getProp(obj) {
  4648. for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  4649. props[_key - 1] = arguments[_key];
  4650. }
  4651. while (props.length > 0) {
  4652. var prop = props.shift();
  4653. if (!obj[prop]) {
  4654. return undefined;
  4655. }
  4656. obj = obj[prop];
  4657. }
  4658. return obj;
  4659. }
  4660. module.exports = exports.default;
  4661. });
  4662. var ensureObject_1 = createCommonjsModule(function (module, exports) {
  4663. exports.__esModule = true;
  4664. exports["default"] = ensureObject;
  4665. function ensureObject(obj) {
  4666. for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  4667. props[_key - 1] = arguments[_key];
  4668. }
  4669. while (props.length > 0) {
  4670. var prop = props.shift();
  4671. if (!obj[prop]) {
  4672. obj[prop] = {};
  4673. }
  4674. obj = obj[prop];
  4675. }
  4676. }
  4677. module.exports = exports.default;
  4678. });
  4679. var stripComments_1 = createCommonjsModule(function (module, exports) {
  4680. exports.__esModule = true;
  4681. exports["default"] = stripComments;
  4682. function stripComments(str) {
  4683. var s = "";
  4684. var commentStart = str.indexOf("/*");
  4685. var lastEnd = 0;
  4686. while (commentStart >= 0) {
  4687. s = s + str.slice(lastEnd, commentStart);
  4688. var commentEnd = str.indexOf("*/", commentStart + 2);
  4689. if (commentEnd < 0) {
  4690. return s;
  4691. }
  4692. lastEnd = commentEnd + 2;
  4693. commentStart = str.indexOf("/*", lastEnd);
  4694. }
  4695. s = s + str.slice(lastEnd);
  4696. return s;
  4697. }
  4698. module.exports = exports.default;
  4699. });
  4700. var util = createCommonjsModule(function (module, exports) {
  4701. exports.__esModule = true;
  4702. exports.stripComments = exports.ensureObject = exports.getProp = exports.unesc = void 0;
  4703. var _unesc = _interopRequireDefault(unesc_1);
  4704. exports.unesc = _unesc["default"];
  4705. var _getProp = _interopRequireDefault(getProp_1);
  4706. exports.getProp = _getProp["default"];
  4707. var _ensureObject = _interopRequireDefault(ensureObject_1);
  4708. exports.ensureObject = _ensureObject["default"];
  4709. var _stripComments = _interopRequireDefault(stripComments_1);
  4710. exports.stripComments = _stripComments["default"];
  4711. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  4712. });
  4713. var node = createCommonjsModule(function (module, exports) {
  4714. exports.__esModule = true;
  4715. exports["default"] = void 0;
  4716. 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); } }
  4717. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4718. var cloneNode = function cloneNode(obj, parent) {
  4719. if (typeof obj !== 'object' || obj === null) {
  4720. return obj;
  4721. }
  4722. var cloned = new obj.constructor();
  4723. for (var i in obj) {
  4724. if (!obj.hasOwnProperty(i)) {
  4725. continue;
  4726. }
  4727. var value = obj[i];
  4728. var type = typeof value;
  4729. if (i === 'parent' && type === 'object') {
  4730. if (parent) {
  4731. cloned[i] = parent;
  4732. }
  4733. } else if (value instanceof Array) {
  4734. cloned[i] = value.map(function (j) {
  4735. return cloneNode(j, cloned);
  4736. });
  4737. } else {
  4738. cloned[i] = cloneNode(value, cloned);
  4739. }
  4740. }
  4741. return cloned;
  4742. };
  4743. var Node = /*#__PURE__*/function () {
  4744. function Node(opts) {
  4745. if (opts === void 0) {
  4746. opts = {};
  4747. }
  4748. Object.assign(this, opts);
  4749. this.spaces = this.spaces || {};
  4750. this.spaces.before = this.spaces.before || '';
  4751. this.spaces.after = this.spaces.after || '';
  4752. }
  4753. var _proto = Node.prototype;
  4754. _proto.remove = function remove() {
  4755. if (this.parent) {
  4756. this.parent.removeChild(this);
  4757. }
  4758. this.parent = undefined;
  4759. return this;
  4760. };
  4761. _proto.replaceWith = function replaceWith() {
  4762. if (this.parent) {
  4763. for (var index in arguments) {
  4764. this.parent.insertBefore(this, arguments[index]);
  4765. }
  4766. this.remove();
  4767. }
  4768. return this;
  4769. };
  4770. _proto.next = function next() {
  4771. return this.parent.at(this.parent.index(this) + 1);
  4772. };
  4773. _proto.prev = function prev() {
  4774. return this.parent.at(this.parent.index(this) - 1);
  4775. };
  4776. _proto.clone = function clone(overrides) {
  4777. if (overrides === void 0) {
  4778. overrides = {};
  4779. }
  4780. var cloned = cloneNode(this);
  4781. for (var name in overrides) {
  4782. cloned[name] = overrides[name];
  4783. }
  4784. return cloned;
  4785. }
  4786. /**
  4787. * Some non-standard syntax doesn't follow normal escaping rules for css.
  4788. * This allows non standard syntax to be appended to an existing property
  4789. * by specifying the escaped value. By specifying the escaped value,
  4790. * illegal characters are allowed to be directly inserted into css output.
  4791. * @param {string} name the property to set
  4792. * @param {any} value the unescaped value of the property
  4793. * @param {string} valueEscaped optional. the escaped value of the property.
  4794. */
  4795. ;
  4796. _proto.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) {
  4797. if (!this.raws) {
  4798. this.raws = {};
  4799. }
  4800. var originalValue = this[name];
  4801. var originalEscaped = this.raws[name];
  4802. this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first.
  4803. if (originalEscaped || valueEscaped !== value) {
  4804. this.raws[name] = (originalEscaped || originalValue) + valueEscaped;
  4805. } else {
  4806. delete this.raws[name]; // delete any escaped value that was created by the setter.
  4807. }
  4808. }
  4809. /**
  4810. * Some non-standard syntax doesn't follow normal escaping rules for css.
  4811. * This allows the escaped value to be specified directly, allowing illegal
  4812. * characters to be directly inserted into css output.
  4813. * @param {string} name the property to set
  4814. * @param {any} value the unescaped value of the property
  4815. * @param {string} valueEscaped the escaped value of the property.
  4816. */
  4817. ;
  4818. _proto.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) {
  4819. if (!this.raws) {
  4820. this.raws = {};
  4821. }
  4822. this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
  4823. this.raws[name] = valueEscaped;
  4824. }
  4825. /**
  4826. * When you want a value to passed through to CSS directly. This method
  4827. * deletes the corresponding raw value causing the stringifier to fallback
  4828. * to the unescaped value.
  4829. * @param {string} name the property to set.
  4830. * @param {any} value The value that is both escaped and unescaped.
  4831. */
  4832. ;
  4833. _proto.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) {
  4834. this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
  4835. if (this.raws) {
  4836. delete this.raws[name];
  4837. }
  4838. }
  4839. /**
  4840. *
  4841. * @param {number} line The number (starting with 1)
  4842. * @param {number} column The column number (starting with 1)
  4843. */
  4844. ;
  4845. _proto.isAtPosition = function isAtPosition(line, column) {
  4846. if (this.source && this.source.start && this.source.end) {
  4847. if (this.source.start.line > line) {
  4848. return false;
  4849. }
  4850. if (this.source.end.line < line) {
  4851. return false;
  4852. }
  4853. if (this.source.start.line === line && this.source.start.column > column) {
  4854. return false;
  4855. }
  4856. if (this.source.end.line === line && this.source.end.column < column) {
  4857. return false;
  4858. }
  4859. return true;
  4860. }
  4861. return undefined;
  4862. };
  4863. _proto.stringifyProperty = function stringifyProperty(name) {
  4864. return this.raws && this.raws[name] || this[name];
  4865. };
  4866. _proto.valueToString = function valueToString() {
  4867. return String(this.stringifyProperty("value"));
  4868. };
  4869. _proto.toString = function toString() {
  4870. return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join('');
  4871. };
  4872. _createClass(Node, [{
  4873. key: "rawSpaceBefore",
  4874. get: function get() {
  4875. var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before;
  4876. if (rawSpace === undefined) {
  4877. rawSpace = this.spaces && this.spaces.before;
  4878. }
  4879. return rawSpace || "";
  4880. },
  4881. set: function set(raw) {
  4882. (0, util.ensureObject)(this, "raws", "spaces");
  4883. this.raws.spaces.before = raw;
  4884. }
  4885. }, {
  4886. key: "rawSpaceAfter",
  4887. get: function get() {
  4888. var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after;
  4889. if (rawSpace === undefined) {
  4890. rawSpace = this.spaces.after;
  4891. }
  4892. return rawSpace || "";
  4893. },
  4894. set: function set(raw) {
  4895. (0, util.ensureObject)(this, "raws", "spaces");
  4896. this.raws.spaces.after = raw;
  4897. }
  4898. }]);
  4899. return Node;
  4900. }();
  4901. exports["default"] = Node;
  4902. module.exports = exports.default;
  4903. });
  4904. var types = createCommonjsModule(function (module, exports) {
  4905. exports.__esModule = true;
  4906. 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;
  4907. var TAG = 'tag';
  4908. exports.TAG = TAG;
  4909. var STRING = 'string';
  4910. exports.STRING = STRING;
  4911. var SELECTOR = 'selector';
  4912. exports.SELECTOR = SELECTOR;
  4913. var ROOT = 'root';
  4914. exports.ROOT = ROOT;
  4915. var PSEUDO = 'pseudo';
  4916. exports.PSEUDO = PSEUDO;
  4917. var NESTING = 'nesting';
  4918. exports.NESTING = NESTING;
  4919. var ID = 'id';
  4920. exports.ID = ID;
  4921. var COMMENT = 'comment';
  4922. exports.COMMENT = COMMENT;
  4923. var COMBINATOR = 'combinator';
  4924. exports.COMBINATOR = COMBINATOR;
  4925. var CLASS = 'class';
  4926. exports.CLASS = CLASS;
  4927. var ATTRIBUTE = 'attribute';
  4928. exports.ATTRIBUTE = ATTRIBUTE;
  4929. var UNIVERSAL = 'universal';
  4930. exports.UNIVERSAL = UNIVERSAL;
  4931. });
  4932. var container = createCommonjsModule(function (module, exports) {
  4933. exports.__esModule = true;
  4934. exports["default"] = void 0;
  4935. var _node = _interopRequireDefault(node);
  4936. var types$1 = _interopRequireWildcard(types);
  4937. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  4938. 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; }
  4939. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  4940. 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); }
  4941. 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); }
  4942. 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; }
  4943. 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); } }
  4944. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4945. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  4946. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4947. var Container = /*#__PURE__*/function (_Node) {
  4948. _inheritsLoose(Container, _Node);
  4949. function Container(opts) {
  4950. var _this;
  4951. _this = _Node.call(this, opts) || this;
  4952. if (!_this.nodes) {
  4953. _this.nodes = [];
  4954. }
  4955. return _this;
  4956. }
  4957. var _proto = Container.prototype;
  4958. _proto.append = function append(selector) {
  4959. selector.parent = this;
  4960. this.nodes.push(selector);
  4961. return this;
  4962. };
  4963. _proto.prepend = function prepend(selector) {
  4964. selector.parent = this;
  4965. this.nodes.unshift(selector);
  4966. return this;
  4967. };
  4968. _proto.at = function at(index) {
  4969. return this.nodes[index];
  4970. };
  4971. _proto.index = function index(child) {
  4972. if (typeof child === 'number') {
  4973. return child;
  4974. }
  4975. return this.nodes.indexOf(child);
  4976. };
  4977. _proto.removeChild = function removeChild(child) {
  4978. child = this.index(child);
  4979. this.at(child).parent = undefined;
  4980. this.nodes.splice(child, 1);
  4981. var index;
  4982. for (var id in this.indexes) {
  4983. index = this.indexes[id];
  4984. if (index >= child) {
  4985. this.indexes[id] = index - 1;
  4986. }
  4987. }
  4988. return this;
  4989. };
  4990. _proto.removeAll = function removeAll() {
  4991. for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done;) {
  4992. var node = _step.value;
  4993. node.parent = undefined;
  4994. }
  4995. this.nodes = [];
  4996. return this;
  4997. };
  4998. _proto.empty = function empty() {
  4999. return this.removeAll();
  5000. };
  5001. _proto.insertAfter = function insertAfter(oldNode, newNode) {
  5002. newNode.parent = this;
  5003. var oldIndex = this.index(oldNode);
  5004. this.nodes.splice(oldIndex + 1, 0, newNode);
  5005. newNode.parent = this;
  5006. var index;
  5007. for (var id in this.indexes) {
  5008. index = this.indexes[id];
  5009. if (oldIndex <= index) {
  5010. this.indexes[id] = index + 1;
  5011. }
  5012. }
  5013. return this;
  5014. };
  5015. _proto.insertBefore = function insertBefore(oldNode, newNode) {
  5016. newNode.parent = this;
  5017. var oldIndex = this.index(oldNode);
  5018. this.nodes.splice(oldIndex, 0, newNode);
  5019. newNode.parent = this;
  5020. var index;
  5021. for (var id in this.indexes) {
  5022. index = this.indexes[id];
  5023. if (index <= oldIndex) {
  5024. this.indexes[id] = index + 1;
  5025. }
  5026. }
  5027. return this;
  5028. };
  5029. _proto._findChildAtPosition = function _findChildAtPosition(line, col) {
  5030. var found = undefined;
  5031. this.each(function (node) {
  5032. if (node.atPosition) {
  5033. var foundChild = node.atPosition(line, col);
  5034. if (foundChild) {
  5035. found = foundChild;
  5036. return false;
  5037. }
  5038. } else if (node.isAtPosition(line, col)) {
  5039. found = node;
  5040. return false;
  5041. }
  5042. });
  5043. return found;
  5044. }
  5045. /**
  5046. * Return the most specific node at the line and column number given.
  5047. * The source location is based on the original parsed location, locations aren't
  5048. * updated as selector nodes are mutated.
  5049. *
  5050. * Note that this location is relative to the location of the first character
  5051. * of the selector, and not the location of the selector in the overall document
  5052. * when used in conjunction with postcss.
  5053. *
  5054. * If not found, returns undefined.
  5055. * @param {number} line The line number of the node to find. (1-based index)
  5056. * @param {number} col The column number of the node to find. (1-based index)
  5057. */
  5058. ;
  5059. _proto.atPosition = function atPosition(line, col) {
  5060. if (this.isAtPosition(line, col)) {
  5061. return this._findChildAtPosition(line, col) || this;
  5062. } else {
  5063. return undefined;
  5064. }
  5065. };
  5066. _proto._inferEndPosition = function _inferEndPosition() {
  5067. if (this.last && this.last.source && this.last.source.end) {
  5068. this.source = this.source || {};
  5069. this.source.end = this.source.end || {};
  5070. Object.assign(this.source.end, this.last.source.end);
  5071. }
  5072. };
  5073. _proto.each = function each(callback) {
  5074. if (!this.lastEach) {
  5075. this.lastEach = 0;
  5076. }
  5077. if (!this.indexes) {
  5078. this.indexes = {};
  5079. }
  5080. this.lastEach++;
  5081. var id = this.lastEach;
  5082. this.indexes[id] = 0;
  5083. if (!this.length) {
  5084. return undefined;
  5085. }
  5086. var index, result;
  5087. while (this.indexes[id] < this.length) {
  5088. index = this.indexes[id];
  5089. result = callback(this.at(index), index);
  5090. if (result === false) {
  5091. break;
  5092. }
  5093. this.indexes[id] += 1;
  5094. }
  5095. delete this.indexes[id];
  5096. if (result === false) {
  5097. return false;
  5098. }
  5099. };
  5100. _proto.walk = function walk(callback) {
  5101. return this.each(function (node, i) {
  5102. var result = callback(node, i);
  5103. if (result !== false && node.length) {
  5104. result = node.walk(callback);
  5105. }
  5106. if (result === false) {
  5107. return false;
  5108. }
  5109. });
  5110. };
  5111. _proto.walkAttributes = function walkAttributes(callback) {
  5112. var _this2 = this;
  5113. return this.walk(function (selector) {
  5114. if (selector.type === types$1.ATTRIBUTE) {
  5115. return callback.call(_this2, selector);
  5116. }
  5117. });
  5118. };
  5119. _proto.walkClasses = function walkClasses(callback) {
  5120. var _this3 = this;
  5121. return this.walk(function (selector) {
  5122. if (selector.type === types$1.CLASS) {
  5123. return callback.call(_this3, selector);
  5124. }
  5125. });
  5126. };
  5127. _proto.walkCombinators = function walkCombinators(callback) {
  5128. var _this4 = this;
  5129. return this.walk(function (selector) {
  5130. if (selector.type === types$1.COMBINATOR) {
  5131. return callback.call(_this4, selector);
  5132. }
  5133. });
  5134. };
  5135. _proto.walkComments = function walkComments(callback) {
  5136. var _this5 = this;
  5137. return this.walk(function (selector) {
  5138. if (selector.type === types$1.COMMENT) {
  5139. return callback.call(_this5, selector);
  5140. }
  5141. });
  5142. };
  5143. _proto.walkIds = function walkIds(callback) {
  5144. var _this6 = this;
  5145. return this.walk(function (selector) {
  5146. if (selector.type === types$1.ID) {
  5147. return callback.call(_this6, selector);
  5148. }
  5149. });
  5150. };
  5151. _proto.walkNesting = function walkNesting(callback) {
  5152. var _this7 = this;
  5153. return this.walk(function (selector) {
  5154. if (selector.type === types$1.NESTING) {
  5155. return callback.call(_this7, selector);
  5156. }
  5157. });
  5158. };
  5159. _proto.walkPseudos = function walkPseudos(callback) {
  5160. var _this8 = this;
  5161. return this.walk(function (selector) {
  5162. if (selector.type === types$1.PSEUDO) {
  5163. return callback.call(_this8, selector);
  5164. }
  5165. });
  5166. };
  5167. _proto.walkTags = function walkTags(callback) {
  5168. var _this9 = this;
  5169. return this.walk(function (selector) {
  5170. if (selector.type === types$1.TAG) {
  5171. return callback.call(_this9, selector);
  5172. }
  5173. });
  5174. };
  5175. _proto.walkUniversals = function walkUniversals(callback) {
  5176. var _this10 = this;
  5177. return this.walk(function (selector) {
  5178. if (selector.type === types$1.UNIVERSAL) {
  5179. return callback.call(_this10, selector);
  5180. }
  5181. });
  5182. };
  5183. _proto.split = function split(callback) {
  5184. var _this11 = this;
  5185. var current = [];
  5186. return this.reduce(function (memo, node, index) {
  5187. var split = callback.call(_this11, node);
  5188. current.push(node);
  5189. if (split) {
  5190. memo.push(current);
  5191. current = [];
  5192. } else if (index === _this11.length - 1) {
  5193. memo.push(current);
  5194. }
  5195. return memo;
  5196. }, []);
  5197. };
  5198. _proto.map = function map(callback) {
  5199. return this.nodes.map(callback);
  5200. };
  5201. _proto.reduce = function reduce(callback, memo) {
  5202. return this.nodes.reduce(callback, memo);
  5203. };
  5204. _proto.every = function every(callback) {
  5205. return this.nodes.every(callback);
  5206. };
  5207. _proto.some = function some(callback) {
  5208. return this.nodes.some(callback);
  5209. };
  5210. _proto.filter = function filter(callback) {
  5211. return this.nodes.filter(callback);
  5212. };
  5213. _proto.sort = function sort(callback) {
  5214. return this.nodes.sort(callback);
  5215. };
  5216. _proto.toString = function toString() {
  5217. return this.map(String).join('');
  5218. };
  5219. _createClass(Container, [{
  5220. key: "first",
  5221. get: function get() {
  5222. return this.at(0);
  5223. }
  5224. }, {
  5225. key: "last",
  5226. get: function get() {
  5227. return this.at(this.length - 1);
  5228. }
  5229. }, {
  5230. key: "length",
  5231. get: function get() {
  5232. return this.nodes.length;
  5233. }
  5234. }]);
  5235. return Container;
  5236. }(_node["default"]);
  5237. exports["default"] = Container;
  5238. module.exports = exports.default;
  5239. });
  5240. var root = createCommonjsModule(function (module, exports) {
  5241. exports.__esModule = true;
  5242. exports["default"] = void 0;
  5243. var _container = _interopRequireDefault(container);
  5244. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5245. 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); } }
  5246. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5247. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5248. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5249. var Root = /*#__PURE__*/function (_Container) {
  5250. _inheritsLoose(Root, _Container);
  5251. function Root(opts) {
  5252. var _this;
  5253. _this = _Container.call(this, opts) || this;
  5254. _this.type = types.ROOT;
  5255. return _this;
  5256. }
  5257. var _proto = Root.prototype;
  5258. _proto.toString = function toString() {
  5259. var str = this.reduce(function (memo, selector) {
  5260. memo.push(String(selector));
  5261. return memo;
  5262. }, []).join(',');
  5263. return this.trailingComma ? str + ',' : str;
  5264. };
  5265. _proto.error = function error(message, options) {
  5266. if (this._error) {
  5267. return this._error(message, options);
  5268. } else {
  5269. return new Error(message);
  5270. }
  5271. };
  5272. _createClass(Root, [{
  5273. key: "errorGenerator",
  5274. set: function set(handler) {
  5275. this._error = handler;
  5276. }
  5277. }]);
  5278. return Root;
  5279. }(_container["default"]);
  5280. exports["default"] = Root;
  5281. module.exports = exports.default;
  5282. });
  5283. var selector = createCommonjsModule(function (module, exports) {
  5284. exports.__esModule = true;
  5285. exports["default"] = void 0;
  5286. var _container = _interopRequireDefault(container);
  5287. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5288. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5289. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5290. var Selector = /*#__PURE__*/function (_Container) {
  5291. _inheritsLoose(Selector, _Container);
  5292. function Selector(opts) {
  5293. var _this;
  5294. _this = _Container.call(this, opts) || this;
  5295. _this.type = types.SELECTOR;
  5296. return _this;
  5297. }
  5298. return Selector;
  5299. }(_container["default"]);
  5300. exports["default"] = Selector;
  5301. module.exports = exports.default;
  5302. });
  5303. /*! https://mths.be/cssesc v3.0.0 by @mathias */
  5304. var object = {};
  5305. var hasOwnProperty = object.hasOwnProperty;
  5306. var merge = function merge(options, defaults) {
  5307. if (!options) {
  5308. return defaults;
  5309. }
  5310. var result = {};
  5311. for (var key in defaults) {
  5312. // `if (defaults.hasOwnProperty(key) { … }` is not needed here, since
  5313. // only recognized option names are used.
  5314. result[key] = hasOwnProperty.call(options, key) ? options[key] : defaults[key];
  5315. }
  5316. return result;
  5317. };
  5318. var regexAnySingleEscape = /[ -,\.\/:-@\[-\^`\{-~]/;
  5319. var regexSingleEscape = /[ -,\.\/:-@\[\]\^`\{-~]/;
  5320. var regexExcessiveSpaces = /(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g;
  5321. // https://mathiasbynens.be/notes/css-escapes#css
  5322. var cssesc = function cssesc(string, options) {
  5323. options = merge(options, cssesc.options);
  5324. if (options.quotes != 'single' && options.quotes != 'double') {
  5325. options.quotes = 'single';
  5326. }
  5327. var quote = options.quotes == 'double' ? '"' : '\'';
  5328. var isIdentifier = options.isIdentifier;
  5329. var firstChar = string.charAt(0);
  5330. var output = '';
  5331. var counter = 0;
  5332. var length = string.length;
  5333. while (counter < length) {
  5334. var character = string.charAt(counter++);
  5335. var codePoint = character.charCodeAt();
  5336. var value = void 0;
  5337. // If it’s not a printable ASCII character…
  5338. if (codePoint < 0x20 || codePoint > 0x7E) {
  5339. if (codePoint >= 0xD800 && codePoint <= 0xDBFF && counter < length) {
  5340. // It’s a high surrogate, and there is a next character.
  5341. var extra = string.charCodeAt(counter++);
  5342. if ((extra & 0xFC00) == 0xDC00) {
  5343. // next character is low surrogate
  5344. codePoint = ((codePoint & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000;
  5345. } else {
  5346. // It’s an unmatched surrogate; only append this code unit, in case
  5347. // the next code unit is the high surrogate of a surrogate pair.
  5348. counter--;
  5349. }
  5350. }
  5351. value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
  5352. } else {
  5353. if (options.escapeEverything) {
  5354. if (regexAnySingleEscape.test(character)) {
  5355. value = '\\' + character;
  5356. } else {
  5357. value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
  5358. }
  5359. } else if (/[\t\n\f\r\x0B]/.test(character)) {
  5360. value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
  5361. } else if (character == '\\' || !isIdentifier && (character == '"' && quote == character || character == '\'' && quote == character) || isIdentifier && regexSingleEscape.test(character)) {
  5362. value = '\\' + character;
  5363. } else {
  5364. value = character;
  5365. }
  5366. }
  5367. output += value;
  5368. }
  5369. if (isIdentifier) {
  5370. if (/^-[-\d]/.test(output)) {
  5371. output = '\\-' + output.slice(1);
  5372. } else if (/\d/.test(firstChar)) {
  5373. output = '\\3' + firstChar + ' ' + output.slice(1);
  5374. }
  5375. }
  5376. // Remove spaces after `\HEX` escapes that are not followed by a hex digit,
  5377. // since they’re redundant. Note that this is only possible if the escape
  5378. // sequence isn’t preceded by an odd number of backslashes.
  5379. output = output.replace(regexExcessiveSpaces, function ($0, $1, $2) {
  5380. if ($1 && $1.length % 2) {
  5381. // It’s not safe to remove the space, so don’t.
  5382. return $0;
  5383. }
  5384. // Strip the space.
  5385. return ($1 || '') + $2;
  5386. });
  5387. if (!isIdentifier && options.wrap) {
  5388. return quote + output + quote;
  5389. }
  5390. return output;
  5391. };
  5392. // Expose default options (so they can be overridden globally).
  5393. cssesc.options = {
  5394. 'escapeEverything': false,
  5395. 'isIdentifier': false,
  5396. 'quotes': 'single',
  5397. 'wrap': false
  5398. };
  5399. cssesc.version = '3.0.0';
  5400. var cssesc_1 = cssesc;
  5401. var className = createCommonjsModule(function (module, exports) {
  5402. exports.__esModule = true;
  5403. exports["default"] = void 0;
  5404. var _cssesc = _interopRequireDefault(cssesc_1);
  5405. var _node = _interopRequireDefault(node);
  5406. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5407. 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); } }
  5408. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5409. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5410. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5411. var ClassName = /*#__PURE__*/function (_Node) {
  5412. _inheritsLoose(ClassName, _Node);
  5413. function ClassName(opts) {
  5414. var _this;
  5415. _this = _Node.call(this, opts) || this;
  5416. _this.type = types.CLASS;
  5417. _this._constructed = true;
  5418. return _this;
  5419. }
  5420. var _proto = ClassName.prototype;
  5421. _proto.valueToString = function valueToString() {
  5422. return '.' + _Node.prototype.valueToString.call(this);
  5423. };
  5424. _createClass(ClassName, [{
  5425. key: "value",
  5426. get: function get() {
  5427. return this._value;
  5428. },
  5429. set: function set(v) {
  5430. if (this._constructed) {
  5431. var escaped = (0, _cssesc["default"])(v, {
  5432. isIdentifier: true
  5433. });
  5434. if (escaped !== v) {
  5435. (0, util.ensureObject)(this, "raws");
  5436. this.raws.value = escaped;
  5437. } else if (this.raws) {
  5438. delete this.raws.value;
  5439. }
  5440. }
  5441. this._value = v;
  5442. }
  5443. }]);
  5444. return ClassName;
  5445. }(_node["default"]);
  5446. exports["default"] = ClassName;
  5447. module.exports = exports.default;
  5448. });
  5449. var comment = createCommonjsModule(function (module, exports) {
  5450. exports.__esModule = true;
  5451. exports["default"] = void 0;
  5452. var _node = _interopRequireDefault(node);
  5453. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5454. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5455. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5456. var Comment = /*#__PURE__*/function (_Node) {
  5457. _inheritsLoose(Comment, _Node);
  5458. function Comment(opts) {
  5459. var _this;
  5460. _this = _Node.call(this, opts) || this;
  5461. _this.type = types.COMMENT;
  5462. return _this;
  5463. }
  5464. return Comment;
  5465. }(_node["default"]);
  5466. exports["default"] = Comment;
  5467. module.exports = exports.default;
  5468. });
  5469. var id = createCommonjsModule(function (module, exports) {
  5470. exports.__esModule = true;
  5471. exports["default"] = void 0;
  5472. var _node = _interopRequireDefault(node);
  5473. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5474. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5475. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5476. var ID = /*#__PURE__*/function (_Node) {
  5477. _inheritsLoose(ID, _Node);
  5478. function ID(opts) {
  5479. var _this;
  5480. _this = _Node.call(this, opts) || this;
  5481. _this.type = types.ID;
  5482. return _this;
  5483. }
  5484. var _proto = ID.prototype;
  5485. _proto.valueToString = function valueToString() {
  5486. return '#' + _Node.prototype.valueToString.call(this);
  5487. };
  5488. return ID;
  5489. }(_node["default"]);
  5490. exports["default"] = ID;
  5491. module.exports = exports.default;
  5492. });
  5493. var namespace = createCommonjsModule(function (module, exports) {
  5494. exports.__esModule = true;
  5495. exports["default"] = void 0;
  5496. var _cssesc = _interopRequireDefault(cssesc_1);
  5497. var _node = _interopRequireDefault(node);
  5498. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5499. 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); } }
  5500. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5501. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5502. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5503. var Namespace = /*#__PURE__*/function (_Node) {
  5504. _inheritsLoose(Namespace, _Node);
  5505. function Namespace() {
  5506. return _Node.apply(this, arguments) || this;
  5507. }
  5508. var _proto = Namespace.prototype;
  5509. _proto.qualifiedName = function qualifiedName(value) {
  5510. if (this.namespace) {
  5511. return this.namespaceString + "|" + value;
  5512. } else {
  5513. return value;
  5514. }
  5515. };
  5516. _proto.valueToString = function valueToString() {
  5517. return this.qualifiedName(_Node.prototype.valueToString.call(this));
  5518. };
  5519. _createClass(Namespace, [{
  5520. key: "namespace",
  5521. get: function get() {
  5522. return this._namespace;
  5523. },
  5524. set: function set(namespace) {
  5525. if (namespace === true || namespace === "*" || namespace === "&") {
  5526. this._namespace = namespace;
  5527. if (this.raws) {
  5528. delete this.raws.namespace;
  5529. }
  5530. return;
  5531. }
  5532. var escaped = (0, _cssesc["default"])(namespace, {
  5533. isIdentifier: true
  5534. });
  5535. this._namespace = namespace;
  5536. if (escaped !== namespace) {
  5537. (0, util.ensureObject)(this, "raws");
  5538. this.raws.namespace = escaped;
  5539. } else if (this.raws) {
  5540. delete this.raws.namespace;
  5541. }
  5542. }
  5543. }, {
  5544. key: "ns",
  5545. get: function get() {
  5546. return this._namespace;
  5547. },
  5548. set: function set(namespace) {
  5549. this.namespace = namespace;
  5550. }
  5551. }, {
  5552. key: "namespaceString",
  5553. get: function get() {
  5554. if (this.namespace) {
  5555. var ns = this.stringifyProperty("namespace");
  5556. if (ns === true) {
  5557. return '';
  5558. } else {
  5559. return ns;
  5560. }
  5561. } else {
  5562. return '';
  5563. }
  5564. }
  5565. }]);
  5566. return Namespace;
  5567. }(_node["default"]);
  5568. exports["default"] = Namespace;
  5569. module.exports = exports.default;
  5570. });
  5571. var tag = createCommonjsModule(function (module, exports) {
  5572. exports.__esModule = true;
  5573. exports["default"] = void 0;
  5574. var _namespace = _interopRequireDefault(namespace);
  5575. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5576. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5577. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5578. var Tag = /*#__PURE__*/function (_Namespace) {
  5579. _inheritsLoose(Tag, _Namespace);
  5580. function Tag(opts) {
  5581. var _this;
  5582. _this = _Namespace.call(this, opts) || this;
  5583. _this.type = types.TAG;
  5584. return _this;
  5585. }
  5586. return Tag;
  5587. }(_namespace["default"]);
  5588. exports["default"] = Tag;
  5589. module.exports = exports.default;
  5590. });
  5591. var string = createCommonjsModule(function (module, exports) {
  5592. exports.__esModule = true;
  5593. exports["default"] = void 0;
  5594. var _node = _interopRequireDefault(node);
  5595. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5596. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5597. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5598. var String = /*#__PURE__*/function (_Node) {
  5599. _inheritsLoose(String, _Node);
  5600. function String(opts) {
  5601. var _this;
  5602. _this = _Node.call(this, opts) || this;
  5603. _this.type = types.STRING;
  5604. return _this;
  5605. }
  5606. return String;
  5607. }(_node["default"]);
  5608. exports["default"] = String;
  5609. module.exports = exports.default;
  5610. });
  5611. var pseudo = createCommonjsModule(function (module, exports) {
  5612. exports.__esModule = true;
  5613. exports["default"] = void 0;
  5614. var _container = _interopRequireDefault(container);
  5615. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5616. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5617. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5618. var Pseudo = /*#__PURE__*/function (_Container) {
  5619. _inheritsLoose(Pseudo, _Container);
  5620. function Pseudo(opts) {
  5621. var _this;
  5622. _this = _Container.call(this, opts) || this;
  5623. _this.type = types.PSEUDO;
  5624. return _this;
  5625. }
  5626. var _proto = Pseudo.prototype;
  5627. _proto.toString = function toString() {
  5628. var params = this.length ? '(' + this.map(String).join(',') + ')' : '';
  5629. return [this.rawSpaceBefore, this.stringifyProperty("value"), params, this.rawSpaceAfter].join('');
  5630. };
  5631. return Pseudo;
  5632. }(_container["default"]);
  5633. exports["default"] = Pseudo;
  5634. module.exports = exports.default;
  5635. });
  5636. /**
  5637. * For Node.js, simply re-export the core `util.deprecate` function.
  5638. */
  5639. var node$1 = util__default.deprecate;
  5640. var attribute = createCommonjsModule(function (module, exports) {
  5641. exports.__esModule = true;
  5642. exports.unescapeValue = unescapeValue;
  5643. exports["default"] = void 0;
  5644. var _cssesc = _interopRequireDefault(cssesc_1);
  5645. var _unesc = _interopRequireDefault(unesc_1);
  5646. var _namespace = _interopRequireDefault(namespace);
  5647. var _CSSESC_QUOTE_OPTIONS;
  5648. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5649. 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); } }
  5650. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5651. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5652. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5653. var WRAPPED_IN_QUOTES = /^('|")([^]*)\1$/;
  5654. var warnOfDeprecatedValueAssignment = node$1(function () {}, "Assigning an attribute a value containing characters that might need to be escaped is deprecated. " + "Call attribute.setValue() instead.");
  5655. var warnOfDeprecatedQuotedAssignment = node$1(function () {}, "Assigning attr.quoted is deprecated and has no effect. Assign to attr.quoteMark instead.");
  5656. var warnOfDeprecatedConstructor = node$1(function () {}, "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now.");
  5657. function unescapeValue(value) {
  5658. var deprecatedUsage = false;
  5659. var quoteMark = null;
  5660. var unescaped = value;
  5661. var m = unescaped.match(WRAPPED_IN_QUOTES);
  5662. if (m) {
  5663. quoteMark = m[1];
  5664. unescaped = m[2];
  5665. }
  5666. unescaped = (0, _unesc["default"])(unescaped);
  5667. if (unescaped !== value) {
  5668. deprecatedUsage = true;
  5669. }
  5670. return {
  5671. deprecatedUsage: deprecatedUsage,
  5672. unescaped: unescaped,
  5673. quoteMark: quoteMark
  5674. };
  5675. }
  5676. function handleDeprecatedContructorOpts(opts) {
  5677. if (opts.quoteMark !== undefined) {
  5678. return opts;
  5679. }
  5680. if (opts.value === undefined) {
  5681. return opts;
  5682. }
  5683. warnOfDeprecatedConstructor();
  5684. var _unescapeValue = unescapeValue(opts.value),
  5685. quoteMark = _unescapeValue.quoteMark,
  5686. unescaped = _unescapeValue.unescaped;
  5687. if (!opts.raws) {
  5688. opts.raws = {};
  5689. }
  5690. if (opts.raws.value === undefined) {
  5691. opts.raws.value = opts.value;
  5692. }
  5693. opts.value = unescaped;
  5694. opts.quoteMark = quoteMark;
  5695. return opts;
  5696. }
  5697. var Attribute = /*#__PURE__*/function (_Namespace) {
  5698. _inheritsLoose(Attribute, _Namespace);
  5699. function Attribute(opts) {
  5700. var _this;
  5701. if (opts === void 0) {
  5702. opts = {};
  5703. }
  5704. _this = _Namespace.call(this, handleDeprecatedContructorOpts(opts)) || this;
  5705. _this.type = types.ATTRIBUTE;
  5706. _this.raws = _this.raws || {};
  5707. Object.defineProperty(_this.raws, 'unquoted', {
  5708. get: node$1(function () {
  5709. return _this.value;
  5710. }, "attr.raws.unquoted is deprecated. Call attr.value instead."),
  5711. set: node$1(function () {
  5712. return _this.value;
  5713. }, "Setting attr.raws.unquoted is deprecated and has no effect. attr.value is unescaped by default now.")
  5714. });
  5715. _this._constructed = true;
  5716. return _this;
  5717. }
  5718. /**
  5719. * Returns the Attribute's value quoted such that it would be legal to use
  5720. * in the value of a css file. The original value's quotation setting
  5721. * used for stringification is left unchanged. See `setValue(value, options)`
  5722. * if you want to control the quote settings of a new value for the attribute.
  5723. *
  5724. * You can also change the quotation used for the current value by setting quoteMark.
  5725. *
  5726. * Options:
  5727. * * quoteMark {'"' | "'" | null} - Use this value to quote the value. If this
  5728. * option is not set, the original value for quoteMark will be used. If
  5729. * indeterminate, a double quote is used. The legal values are:
  5730. * * `null` - the value will be unquoted and characters will be escaped as necessary.
  5731. * * `'` - the value will be quoted with a single quote and single quotes are escaped.
  5732. * * `"` - the value will be quoted with a double quote and double quotes are escaped.
  5733. * * preferCurrentQuoteMark {boolean} - if true, prefer the source quote mark
  5734. * over the quoteMark option value.
  5735. * * smart {boolean} - if true, will select a quote mark based on the value
  5736. * and the other options specified here. See the `smartQuoteMark()`
  5737. * method.
  5738. **/
  5739. var _proto = Attribute.prototype;
  5740. _proto.getQuotedValue = function getQuotedValue(options) {
  5741. if (options === void 0) {
  5742. options = {};
  5743. }
  5744. var quoteMark = this._determineQuoteMark(options);
  5745. var cssescopts = CSSESC_QUOTE_OPTIONS[quoteMark];
  5746. var escaped = (0, _cssesc["default"])(this._value, cssescopts);
  5747. return escaped;
  5748. };
  5749. _proto._determineQuoteMark = function _determineQuoteMark(options) {
  5750. return options.smart ? this.smartQuoteMark(options) : this.preferredQuoteMark(options);
  5751. }
  5752. /**
  5753. * Set the unescaped value with the specified quotation options. The value
  5754. * provided must not include any wrapping quote marks -- those quotes will
  5755. * be interpreted as part of the value and escaped accordingly.
  5756. */
  5757. ;
  5758. _proto.setValue = function setValue(value, options) {
  5759. if (options === void 0) {
  5760. options = {};
  5761. }
  5762. this._value = value;
  5763. this._quoteMark = this._determineQuoteMark(options);
  5764. this._syncRawValue();
  5765. }
  5766. /**
  5767. * Intelligently select a quoteMark value based on the value's contents. If
  5768. * the value is a legal CSS ident, it will not be quoted. Otherwise a quote
  5769. * mark will be picked that minimizes the number of escapes.
  5770. *
  5771. * If there's no clear winner, the quote mark from these options is used,
  5772. * then the source quote mark (this is inverted if `preferCurrentQuoteMark` is
  5773. * true). If the quoteMark is unspecified, a double quote is used.
  5774. *
  5775. * @param options This takes the quoteMark and preferCurrentQuoteMark options
  5776. * from the quoteValue method.
  5777. */
  5778. ;
  5779. _proto.smartQuoteMark = function smartQuoteMark(options) {
  5780. var v = this.value;
  5781. var numSingleQuotes = v.replace(/[^']/g, '').length;
  5782. var numDoubleQuotes = v.replace(/[^"]/g, '').length;
  5783. if (numSingleQuotes + numDoubleQuotes === 0) {
  5784. var escaped = (0, _cssesc["default"])(v, {
  5785. isIdentifier: true
  5786. });
  5787. if (escaped === v) {
  5788. return Attribute.NO_QUOTE;
  5789. } else {
  5790. var pref = this.preferredQuoteMark(options);
  5791. if (pref === Attribute.NO_QUOTE) {
  5792. // pick a quote mark that isn't none and see if it's smaller
  5793. var quote = this.quoteMark || options.quoteMark || Attribute.DOUBLE_QUOTE;
  5794. var opts = CSSESC_QUOTE_OPTIONS[quote];
  5795. var quoteValue = (0, _cssesc["default"])(v, opts);
  5796. if (quoteValue.length < escaped.length) {
  5797. return quote;
  5798. }
  5799. }
  5800. return pref;
  5801. }
  5802. } else if (numDoubleQuotes === numSingleQuotes) {
  5803. return this.preferredQuoteMark(options);
  5804. } else if (numDoubleQuotes < numSingleQuotes) {
  5805. return Attribute.DOUBLE_QUOTE;
  5806. } else {
  5807. return Attribute.SINGLE_QUOTE;
  5808. }
  5809. }
  5810. /**
  5811. * Selects the preferred quote mark based on the options and the current quote mark value.
  5812. * If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)`
  5813. * instead.
  5814. */
  5815. ;
  5816. _proto.preferredQuoteMark = function preferredQuoteMark(options) {
  5817. var quoteMark = options.preferCurrentQuoteMark ? this.quoteMark : options.quoteMark;
  5818. if (quoteMark === undefined) {
  5819. quoteMark = options.preferCurrentQuoteMark ? options.quoteMark : this.quoteMark;
  5820. }
  5821. if (quoteMark === undefined) {
  5822. quoteMark = Attribute.DOUBLE_QUOTE;
  5823. }
  5824. return quoteMark;
  5825. };
  5826. _proto._syncRawValue = function _syncRawValue() {
  5827. var rawValue = (0, _cssesc["default"])(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]);
  5828. if (rawValue === this._value) {
  5829. if (this.raws) {
  5830. delete this.raws.value;
  5831. }
  5832. } else {
  5833. this.raws.value = rawValue;
  5834. }
  5835. };
  5836. _proto._handleEscapes = function _handleEscapes(prop, value) {
  5837. if (this._constructed) {
  5838. var escaped = (0, _cssesc["default"])(value, {
  5839. isIdentifier: true
  5840. });
  5841. if (escaped !== value) {
  5842. this.raws[prop] = escaped;
  5843. } else {
  5844. delete this.raws[prop];
  5845. }
  5846. }
  5847. };
  5848. _proto._spacesFor = function _spacesFor(name) {
  5849. var attrSpaces = {
  5850. before: '',
  5851. after: ''
  5852. };
  5853. var spaces = this.spaces[name] || {};
  5854. var rawSpaces = this.raws.spaces && this.raws.spaces[name] || {};
  5855. return Object.assign(attrSpaces, spaces, rawSpaces);
  5856. };
  5857. _proto._stringFor = function _stringFor(name, spaceName, concat) {
  5858. if (spaceName === void 0) {
  5859. spaceName = name;
  5860. }
  5861. if (concat === void 0) {
  5862. concat = defaultAttrConcat;
  5863. }
  5864. var attrSpaces = this._spacesFor(spaceName);
  5865. return concat(this.stringifyProperty(name), attrSpaces);
  5866. }
  5867. /**
  5868. * returns the offset of the attribute part specified relative to the
  5869. * start of the node of the output string.
  5870. *
  5871. * * "ns" - alias for "namespace"
  5872. * * "namespace" - the namespace if it exists.
  5873. * * "attribute" - the attribute name
  5874. * * "attributeNS" - the start of the attribute or its namespace
  5875. * * "operator" - the match operator of the attribute
  5876. * * "value" - The value (string or identifier)
  5877. * * "insensitive" - the case insensitivity flag;
  5878. * @param part One of the possible values inside an attribute.
  5879. * @returns -1 if the name is invalid or the value doesn't exist in this attribute.
  5880. */
  5881. ;
  5882. _proto.offsetOf = function offsetOf(name) {
  5883. var count = 1;
  5884. var attributeSpaces = this._spacesFor("attribute");
  5885. count += attributeSpaces.before.length;
  5886. if (name === "namespace" || name === "ns") {
  5887. return this.namespace ? count : -1;
  5888. }
  5889. if (name === "attributeNS") {
  5890. return count;
  5891. }
  5892. count += this.namespaceString.length;
  5893. if (this.namespace) {
  5894. count += 1;
  5895. }
  5896. if (name === "attribute") {
  5897. return count;
  5898. }
  5899. count += this.stringifyProperty("attribute").length;
  5900. count += attributeSpaces.after.length;
  5901. var operatorSpaces = this._spacesFor("operator");
  5902. count += operatorSpaces.before.length;
  5903. var operator = this.stringifyProperty("operator");
  5904. if (name === "operator") {
  5905. return operator ? count : -1;
  5906. }
  5907. count += operator.length;
  5908. count += operatorSpaces.after.length;
  5909. var valueSpaces = this._spacesFor("value");
  5910. count += valueSpaces.before.length;
  5911. var value = this.stringifyProperty("value");
  5912. if (name === "value") {
  5913. return value ? count : -1;
  5914. }
  5915. count += value.length;
  5916. count += valueSpaces.after.length;
  5917. var insensitiveSpaces = this._spacesFor("insensitive");
  5918. count += insensitiveSpaces.before.length;
  5919. if (name === "insensitive") {
  5920. return this.insensitive ? count : -1;
  5921. }
  5922. return -1;
  5923. };
  5924. _proto.toString = function toString() {
  5925. var _this2 = this;
  5926. var selector = [this.rawSpaceBefore, '['];
  5927. selector.push(this._stringFor('qualifiedAttribute', 'attribute'));
  5928. if (this.operator && (this.value || this.value === '')) {
  5929. selector.push(this._stringFor('operator'));
  5930. selector.push(this._stringFor('value'));
  5931. selector.push(this._stringFor('insensitiveFlag', 'insensitive', function (attrValue, attrSpaces) {
  5932. if (attrValue.length > 0 && !_this2.quoted && attrSpaces.before.length === 0 && !(_this2.spaces.value && _this2.spaces.value.after)) {
  5933. attrSpaces.before = " ";
  5934. }
  5935. return defaultAttrConcat(attrValue, attrSpaces);
  5936. }));
  5937. }
  5938. selector.push(']');
  5939. selector.push(this.rawSpaceAfter);
  5940. return selector.join('');
  5941. };
  5942. _createClass(Attribute, [{
  5943. key: "quoted",
  5944. get: function get() {
  5945. var qm = this.quoteMark;
  5946. return qm === "'" || qm === '"';
  5947. },
  5948. set: function set(value) {
  5949. warnOfDeprecatedQuotedAssignment();
  5950. }
  5951. /**
  5952. * returns a single (`'`) or double (`"`) quote character if the value is quoted.
  5953. * returns `null` if the value is not quoted.
  5954. * returns `undefined` if the quotation state is unknown (this can happen when
  5955. * the attribute is constructed without specifying a quote mark.)
  5956. */
  5957. }, {
  5958. key: "quoteMark",
  5959. get: function get() {
  5960. return this._quoteMark;
  5961. }
  5962. /**
  5963. * Set the quote mark to be used by this attribute's value.
  5964. * If the quote mark changes, the raw (escaped) value at `attr.raws.value` of the attribute
  5965. * value is updated accordingly.
  5966. *
  5967. * @param {"'" | '"' | null} quoteMark The quote mark or `null` if the value should be unquoted.
  5968. */
  5969. ,
  5970. set: function set(quoteMark) {
  5971. if (!this._constructed) {
  5972. this._quoteMark = quoteMark;
  5973. return;
  5974. }
  5975. if (this._quoteMark !== quoteMark) {
  5976. this._quoteMark = quoteMark;
  5977. this._syncRawValue();
  5978. }
  5979. }
  5980. }, {
  5981. key: "qualifiedAttribute",
  5982. get: function get() {
  5983. return this.qualifiedName(this.raws.attribute || this.attribute);
  5984. }
  5985. }, {
  5986. key: "insensitiveFlag",
  5987. get: function get() {
  5988. return this.insensitive ? 'i' : '';
  5989. }
  5990. }, {
  5991. key: "value",
  5992. get: function get() {
  5993. return this._value;
  5994. }
  5995. /**
  5996. * Before 3.0, the value had to be set to an escaped value including any wrapped
  5997. * quote marks. In 3.0, the semantics of `Attribute.value` changed so that the value
  5998. * is unescaped during parsing and any quote marks are removed.
  5999. *
  6000. * Because the ambiguity of this semantic change, if you set `attr.value = newValue`,
  6001. * a deprecation warning is raised when the new value contains any characters that would
  6002. * require escaping (including if it contains wrapped quotes).
  6003. *
  6004. * Instead, you should call `attr.setValue(newValue, opts)` and pass options that describe
  6005. * how the new value is quoted.
  6006. */
  6007. ,
  6008. set: function set(v) {
  6009. if (this._constructed) {
  6010. var _unescapeValue2 = unescapeValue(v),
  6011. deprecatedUsage = _unescapeValue2.deprecatedUsage,
  6012. unescaped = _unescapeValue2.unescaped,
  6013. quoteMark = _unescapeValue2.quoteMark;
  6014. if (deprecatedUsage) {
  6015. warnOfDeprecatedValueAssignment();
  6016. }
  6017. if (unescaped === this._value && quoteMark === this._quoteMark) {
  6018. return;
  6019. }
  6020. this._value = unescaped;
  6021. this._quoteMark = quoteMark;
  6022. this._syncRawValue();
  6023. } else {
  6024. this._value = v;
  6025. }
  6026. }
  6027. }, {
  6028. key: "attribute",
  6029. get: function get() {
  6030. return this._attribute;
  6031. },
  6032. set: function set(name) {
  6033. this._handleEscapes("attribute", name);
  6034. this._attribute = name;
  6035. }
  6036. }]);
  6037. return Attribute;
  6038. }(_namespace["default"]);
  6039. exports["default"] = Attribute;
  6040. Attribute.NO_QUOTE = null;
  6041. Attribute.SINGLE_QUOTE = "'";
  6042. Attribute.DOUBLE_QUOTE = '"';
  6043. var CSSESC_QUOTE_OPTIONS = (_CSSESC_QUOTE_OPTIONS = {
  6044. "'": {
  6045. quotes: 'single',
  6046. wrap: true
  6047. },
  6048. '"': {
  6049. quotes: 'double',
  6050. wrap: true
  6051. }
  6052. }, _CSSESC_QUOTE_OPTIONS[null] = {
  6053. isIdentifier: true
  6054. }, _CSSESC_QUOTE_OPTIONS);
  6055. function defaultAttrConcat(attrValue, attrSpaces) {
  6056. return "" + attrSpaces.before + attrValue + attrSpaces.after;
  6057. }
  6058. });
  6059. var universal = createCommonjsModule(function (module, exports) {
  6060. exports.__esModule = true;
  6061. exports["default"] = void 0;
  6062. var _namespace = _interopRequireDefault(namespace);
  6063. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6064. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  6065. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  6066. var Universal = /*#__PURE__*/function (_Namespace) {
  6067. _inheritsLoose(Universal, _Namespace);
  6068. function Universal(opts) {
  6069. var _this;
  6070. _this = _Namespace.call(this, opts) || this;
  6071. _this.type = types.UNIVERSAL;
  6072. _this.value = '*';
  6073. return _this;
  6074. }
  6075. return Universal;
  6076. }(_namespace["default"]);
  6077. exports["default"] = Universal;
  6078. module.exports = exports.default;
  6079. });
  6080. var combinator = createCommonjsModule(function (module, exports) {
  6081. exports.__esModule = true;
  6082. exports["default"] = void 0;
  6083. var _node = _interopRequireDefault(node);
  6084. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6085. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  6086. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  6087. var Combinator = /*#__PURE__*/function (_Node) {
  6088. _inheritsLoose(Combinator, _Node);
  6089. function Combinator(opts) {
  6090. var _this;
  6091. _this = _Node.call(this, opts) || this;
  6092. _this.type = types.COMBINATOR;
  6093. return _this;
  6094. }
  6095. return Combinator;
  6096. }(_node["default"]);
  6097. exports["default"] = Combinator;
  6098. module.exports = exports.default;
  6099. });
  6100. var nesting = createCommonjsModule(function (module, exports) {
  6101. exports.__esModule = true;
  6102. exports["default"] = void 0;
  6103. var _node = _interopRequireDefault(node);
  6104. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6105. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  6106. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  6107. var Nesting = /*#__PURE__*/function (_Node) {
  6108. _inheritsLoose(Nesting, _Node);
  6109. function Nesting(opts) {
  6110. var _this;
  6111. _this = _Node.call(this, opts) || this;
  6112. _this.type = types.NESTING;
  6113. _this.value = '&';
  6114. return _this;
  6115. }
  6116. return Nesting;
  6117. }(_node["default"]);
  6118. exports["default"] = Nesting;
  6119. module.exports = exports.default;
  6120. });
  6121. var sortAscending_1 = createCommonjsModule(function (module, exports) {
  6122. exports.__esModule = true;
  6123. exports["default"] = sortAscending;
  6124. function sortAscending(list) {
  6125. return list.sort(function (a, b) {
  6126. return a - b;
  6127. });
  6128. }
  6129. module.exports = exports.default;
  6130. });
  6131. var tokenTypes = createCommonjsModule(function (module, exports) {
  6132. exports.__esModule = true;
  6133. 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;
  6134. var ampersand = 38; // `&`.charCodeAt(0);
  6135. exports.ampersand = ampersand;
  6136. var asterisk = 42; // `*`.charCodeAt(0);
  6137. exports.asterisk = asterisk;
  6138. var at = 64; // `@`.charCodeAt(0);
  6139. exports.at = at;
  6140. var comma = 44; // `,`.charCodeAt(0);
  6141. exports.comma = comma;
  6142. var colon = 58; // `:`.charCodeAt(0);
  6143. exports.colon = colon;
  6144. var semicolon = 59; // `;`.charCodeAt(0);
  6145. exports.semicolon = semicolon;
  6146. var openParenthesis = 40; // `(`.charCodeAt(0);
  6147. exports.openParenthesis = openParenthesis;
  6148. var closeParenthesis = 41; // `)`.charCodeAt(0);
  6149. exports.closeParenthesis = closeParenthesis;
  6150. var openSquare = 91; // `[`.charCodeAt(0);
  6151. exports.openSquare = openSquare;
  6152. var closeSquare = 93; // `]`.charCodeAt(0);
  6153. exports.closeSquare = closeSquare;
  6154. var dollar = 36; // `$`.charCodeAt(0);
  6155. exports.dollar = dollar;
  6156. var tilde = 126; // `~`.charCodeAt(0);
  6157. exports.tilde = tilde;
  6158. var caret = 94; // `^`.charCodeAt(0);
  6159. exports.caret = caret;
  6160. var plus = 43; // `+`.charCodeAt(0);
  6161. exports.plus = plus;
  6162. var equals = 61; // `=`.charCodeAt(0);
  6163. exports.equals = equals;
  6164. var pipe = 124; // `|`.charCodeAt(0);
  6165. exports.pipe = pipe;
  6166. var greaterThan = 62; // `>`.charCodeAt(0);
  6167. exports.greaterThan = greaterThan;
  6168. var space = 32; // ` `.charCodeAt(0);
  6169. exports.space = space;
  6170. var singleQuote = 39; // `'`.charCodeAt(0);
  6171. exports.singleQuote = singleQuote;
  6172. var doubleQuote = 34; // `"`.charCodeAt(0);
  6173. exports.doubleQuote = doubleQuote;
  6174. var slash = 47; // `/`.charCodeAt(0);
  6175. exports.slash = slash;
  6176. var bang = 33; // `!`.charCodeAt(0);
  6177. exports.bang = bang;
  6178. var backslash = 92; // '\\'.charCodeAt(0);
  6179. exports.backslash = backslash;
  6180. var cr = 13; // '\r'.charCodeAt(0);
  6181. exports.cr = cr;
  6182. var feed = 12; // '\f'.charCodeAt(0);
  6183. exports.feed = feed;
  6184. var newline = 10; // '\n'.charCodeAt(0);
  6185. exports.newline = newline;
  6186. var tab = 9; // '\t'.charCodeAt(0);
  6187. // Expose aliases primarily for readability.
  6188. exports.tab = tab;
  6189. var str = singleQuote; // No good single character representation!
  6190. exports.str = str;
  6191. var comment = -1;
  6192. exports.comment = comment;
  6193. var word = -2;
  6194. exports.word = word;
  6195. var combinator = -3;
  6196. exports.combinator = combinator;
  6197. });
  6198. var tokenize_1 = createCommonjsModule(function (module, exports) {
  6199. exports.__esModule = true;
  6200. exports["default"] = tokenize;
  6201. exports.FIELDS = void 0;
  6202. var t = _interopRequireWildcard(tokenTypes);
  6203. var _unescapable, _wordDelimiters;
  6204. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  6205. 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; }
  6206. var unescapable = (_unescapable = {}, _unescapable[t.tab] = true, _unescapable[t.newline] = true, _unescapable[t.cr] = true, _unescapable[t.feed] = true, _unescapable);
  6207. 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);
  6208. var hex = {};
  6209. var hexChars = "0123456789abcdefABCDEF";
  6210. for (var i = 0; i < hexChars.length; i++) {
  6211. hex[hexChars.charCodeAt(i)] = true;
  6212. }
  6213. /**
  6214. * Returns the last index of the bar css word
  6215. * @param {string} css The string in which the word begins
  6216. * @param {number} start The index into the string where word's first letter occurs
  6217. */
  6218. function consumeWord(css, start) {
  6219. var next = start;
  6220. var code;
  6221. do {
  6222. code = css.charCodeAt(next);
  6223. if (wordDelimiters[code]) {
  6224. return next - 1;
  6225. } else if (code === t.backslash) {
  6226. next = consumeEscape(css, next) + 1;
  6227. } else {
  6228. // All other characters are part of the word
  6229. next++;
  6230. }
  6231. } while (next < css.length);
  6232. return next - 1;
  6233. }
  6234. /**
  6235. * Returns the last index of the escape sequence
  6236. * @param {string} css The string in which the sequence begins
  6237. * @param {number} start The index into the string where escape character (`\`) occurs.
  6238. */
  6239. function consumeEscape(css, start) {
  6240. var next = start;
  6241. var code = css.charCodeAt(next + 1);
  6242. if (unescapable[code]) ; else if (hex[code]) {
  6243. var hexDigits = 0; // consume up to 6 hex chars
  6244. do {
  6245. next++;
  6246. hexDigits++;
  6247. code = css.charCodeAt(next + 1);
  6248. } while (hex[code] && hexDigits < 6); // if fewer than 6 hex chars, a trailing space ends the escape
  6249. if (hexDigits < 6 && code === t.space) {
  6250. next++;
  6251. }
  6252. } else {
  6253. // the next char is part of the current word
  6254. next++;
  6255. }
  6256. return next;
  6257. }
  6258. var FIELDS = {
  6259. TYPE: 0,
  6260. START_LINE: 1,
  6261. START_COL: 2,
  6262. END_LINE: 3,
  6263. END_COL: 4,
  6264. START_POS: 5,
  6265. END_POS: 6
  6266. };
  6267. exports.FIELDS = FIELDS;
  6268. function tokenize(input) {
  6269. var tokens = [];
  6270. var css = input.css.valueOf();
  6271. var _css = css,
  6272. length = _css.length;
  6273. var offset = -1;
  6274. var line = 1;
  6275. var start = 0;
  6276. var end = 0;
  6277. var code, content, endColumn, endLine, escaped, escapePos, last, lines, next, nextLine, nextOffset, quote, tokenType;
  6278. function unclosed(what, fix) {
  6279. if (input.safe) {
  6280. // fyi: this is never set to true.
  6281. css += fix;
  6282. next = css.length - 1;
  6283. } else {
  6284. throw input.error('Unclosed ' + what, line, start - offset, start);
  6285. }
  6286. }
  6287. while (start < length) {
  6288. code = css.charCodeAt(start);
  6289. if (code === t.newline) {
  6290. offset = start;
  6291. line += 1;
  6292. }
  6293. switch (code) {
  6294. case t.space:
  6295. case t.tab:
  6296. case t.newline:
  6297. case t.cr:
  6298. case t.feed:
  6299. next = start;
  6300. do {
  6301. next += 1;
  6302. code = css.charCodeAt(next);
  6303. if (code === t.newline) {
  6304. offset = next;
  6305. line += 1;
  6306. }
  6307. } while (code === t.space || code === t.newline || code === t.tab || code === t.cr || code === t.feed);
  6308. tokenType = t.space;
  6309. endLine = line;
  6310. endColumn = next - offset - 1;
  6311. end = next;
  6312. break;
  6313. case t.plus:
  6314. case t.greaterThan:
  6315. case t.tilde:
  6316. case t.pipe:
  6317. next = start;
  6318. do {
  6319. next += 1;
  6320. code = css.charCodeAt(next);
  6321. } while (code === t.plus || code === t.greaterThan || code === t.tilde || code === t.pipe);
  6322. tokenType = t.combinator;
  6323. endLine = line;
  6324. endColumn = start - offset;
  6325. end = next;
  6326. break;
  6327. // Consume these characters as single tokens.
  6328. case t.asterisk:
  6329. case t.ampersand:
  6330. case t.bang:
  6331. case t.comma:
  6332. case t.equals:
  6333. case t.dollar:
  6334. case t.caret:
  6335. case t.openSquare:
  6336. case t.closeSquare:
  6337. case t.colon:
  6338. case t.semicolon:
  6339. case t.openParenthesis:
  6340. case t.closeParenthesis:
  6341. next = start;
  6342. tokenType = code;
  6343. endLine = line;
  6344. endColumn = start - offset;
  6345. end = next + 1;
  6346. break;
  6347. case t.singleQuote:
  6348. case t.doubleQuote:
  6349. quote = code === t.singleQuote ? "'" : '"';
  6350. next = start;
  6351. do {
  6352. escaped = false;
  6353. next = css.indexOf(quote, next + 1);
  6354. if (next === -1) {
  6355. unclosed('quote', quote);
  6356. }
  6357. escapePos = next;
  6358. while (css.charCodeAt(escapePos - 1) === t.backslash) {
  6359. escapePos -= 1;
  6360. escaped = !escaped;
  6361. }
  6362. } while (escaped);
  6363. tokenType = t.str;
  6364. endLine = line;
  6365. endColumn = start - offset;
  6366. end = next + 1;
  6367. break;
  6368. default:
  6369. if (code === t.slash && css.charCodeAt(start + 1) === t.asterisk) {
  6370. next = css.indexOf('*/', start + 2) + 1;
  6371. if (next === 0) {
  6372. unclosed('comment', '*/');
  6373. }
  6374. content = css.slice(start, next + 1);
  6375. lines = content.split('\n');
  6376. last = lines.length - 1;
  6377. if (last > 0) {
  6378. nextLine = line + last;
  6379. nextOffset = next - lines[last].length;
  6380. } else {
  6381. nextLine = line;
  6382. nextOffset = offset;
  6383. }
  6384. tokenType = t.comment;
  6385. line = nextLine;
  6386. endLine = nextLine;
  6387. endColumn = next - nextOffset;
  6388. } else if (code === t.slash) {
  6389. next = start;
  6390. tokenType = code;
  6391. endLine = line;
  6392. endColumn = start - offset;
  6393. end = next + 1;
  6394. } else {
  6395. next = consumeWord(css, start);
  6396. tokenType = t.word;
  6397. endLine = line;
  6398. endColumn = next - offset;
  6399. }
  6400. end = next + 1;
  6401. break;
  6402. } // Ensure that the token structure remains consistent
  6403. tokens.push([tokenType, // [0] Token type
  6404. line, // [1] Starting line
  6405. start - offset, // [2] Starting column
  6406. endLine, // [3] Ending line
  6407. endColumn, // [4] Ending column
  6408. start, // [5] Start position / Source index
  6409. end // [6] End position
  6410. ]); // Reset offset for the next token
  6411. if (nextOffset) {
  6412. offset = nextOffset;
  6413. nextOffset = null;
  6414. }
  6415. start = end;
  6416. }
  6417. return tokens;
  6418. }
  6419. });
  6420. var parser = createCommonjsModule(function (module, exports) {
  6421. exports.__esModule = true;
  6422. exports["default"] = void 0;
  6423. var _root = _interopRequireDefault(root);
  6424. var _selector = _interopRequireDefault(selector);
  6425. var _className = _interopRequireDefault(className);
  6426. var _comment = _interopRequireDefault(comment);
  6427. var _id = _interopRequireDefault(id);
  6428. var _tag = _interopRequireDefault(tag);
  6429. var _string = _interopRequireDefault(string);
  6430. var _pseudo = _interopRequireDefault(pseudo);
  6431. var _attribute = _interopRequireWildcard(attribute);
  6432. var _universal = _interopRequireDefault(universal);
  6433. var _combinator = _interopRequireDefault(combinator);
  6434. var _nesting = _interopRequireDefault(nesting);
  6435. var _sortAscending = _interopRequireDefault(sortAscending_1);
  6436. var _tokenize = _interopRequireWildcard(tokenize_1);
  6437. var tokens = _interopRequireWildcard(tokenTypes);
  6438. var types$1 = _interopRequireWildcard(types);
  6439. var _WHITESPACE_TOKENS, _Object$assign;
  6440. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  6441. 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; }
  6442. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6443. 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); } }
  6444. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6445. 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);
  6446. var WHITESPACE_EQUIV_TOKENS = Object.assign({}, WHITESPACE_TOKENS, (_Object$assign = {}, _Object$assign[tokens.comment] = true, _Object$assign));
  6447. function tokenStart(token) {
  6448. return {
  6449. line: token[_tokenize.FIELDS.START_LINE],
  6450. column: token[_tokenize.FIELDS.START_COL]
  6451. };
  6452. }
  6453. function tokenEnd(token) {
  6454. return {
  6455. line: token[_tokenize.FIELDS.END_LINE],
  6456. column: token[_tokenize.FIELDS.END_COL]
  6457. };
  6458. }
  6459. function getSource(startLine, startColumn, endLine, endColumn) {
  6460. return {
  6461. start: {
  6462. line: startLine,
  6463. column: startColumn
  6464. },
  6465. end: {
  6466. line: endLine,
  6467. column: endColumn
  6468. }
  6469. };
  6470. }
  6471. function getTokenSource(token) {
  6472. return getSource(token[_tokenize.FIELDS.START_LINE], token[_tokenize.FIELDS.START_COL], token[_tokenize.FIELDS.END_LINE], token[_tokenize.FIELDS.END_COL]);
  6473. }
  6474. function getTokenSourceSpan(startToken, endToken) {
  6475. if (!startToken) {
  6476. return undefined;
  6477. }
  6478. return getSource(startToken[_tokenize.FIELDS.START_LINE], startToken[_tokenize.FIELDS.START_COL], endToken[_tokenize.FIELDS.END_LINE], endToken[_tokenize.FIELDS.END_COL]);
  6479. }
  6480. function unescapeProp(node, prop) {
  6481. var value = node[prop];
  6482. if (typeof value !== "string") {
  6483. return;
  6484. }
  6485. if (value.indexOf("\\") !== -1) {
  6486. (0, util.ensureObject)(node, 'raws');
  6487. node[prop] = (0, util.unesc)(value);
  6488. if (node.raws[prop] === undefined) {
  6489. node.raws[prop] = value;
  6490. }
  6491. }
  6492. return node;
  6493. }
  6494. function indexesOf(array, item) {
  6495. var i = -1;
  6496. var indexes = [];
  6497. while ((i = array.indexOf(item, i + 1)) !== -1) {
  6498. indexes.push(i);
  6499. }
  6500. return indexes;
  6501. }
  6502. function uniqs() {
  6503. var list = Array.prototype.concat.apply([], arguments);
  6504. return list.filter(function (item, i) {
  6505. return i === list.indexOf(item);
  6506. });
  6507. }
  6508. var Parser = /*#__PURE__*/function () {
  6509. function Parser(rule, options) {
  6510. if (options === void 0) {
  6511. options = {};
  6512. }
  6513. this.rule = rule;
  6514. this.options = Object.assign({
  6515. lossy: false,
  6516. safe: false
  6517. }, options);
  6518. this.position = 0;
  6519. this.css = typeof this.rule === 'string' ? this.rule : this.rule.selector;
  6520. this.tokens = (0, _tokenize["default"])({
  6521. css: this.css,
  6522. error: this._errorGenerator(),
  6523. safe: this.options.safe
  6524. });
  6525. var rootSource = getTokenSourceSpan(this.tokens[0], this.tokens[this.tokens.length - 1]);
  6526. this.root = new _root["default"]({
  6527. source: rootSource
  6528. });
  6529. this.root.errorGenerator = this._errorGenerator();
  6530. var selector = new _selector["default"]({
  6531. source: {
  6532. start: {
  6533. line: 1,
  6534. column: 1
  6535. }
  6536. }
  6537. });
  6538. this.root.append(selector);
  6539. this.current = selector;
  6540. this.loop();
  6541. }
  6542. var _proto = Parser.prototype;
  6543. _proto._errorGenerator = function _errorGenerator() {
  6544. var _this = this;
  6545. return function (message, errorOptions) {
  6546. if (typeof _this.rule === 'string') {
  6547. return new Error(message);
  6548. }
  6549. return _this.rule.error(message, errorOptions);
  6550. };
  6551. };
  6552. _proto.attribute = function attribute() {
  6553. var attr = [];
  6554. var startingToken = this.currToken;
  6555. this.position++;
  6556. while (this.position < this.tokens.length && this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
  6557. attr.push(this.currToken);
  6558. this.position++;
  6559. }
  6560. if (this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
  6561. return this.expected('closing square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
  6562. }
  6563. var len = attr.length;
  6564. var node = {
  6565. source: getSource(startingToken[1], startingToken[2], this.currToken[3], this.currToken[4]),
  6566. sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
  6567. };
  6568. if (len === 1 && !~[tokens.word].indexOf(attr[0][_tokenize.FIELDS.TYPE])) {
  6569. return this.expected('attribute', attr[0][_tokenize.FIELDS.START_POS]);
  6570. }
  6571. var pos = 0;
  6572. var spaceBefore = '';
  6573. var commentBefore = '';
  6574. var lastAdded = null;
  6575. var spaceAfterMeaningfulToken = false;
  6576. while (pos < len) {
  6577. var token = attr[pos];
  6578. var content = this.content(token);
  6579. var next = attr[pos + 1];
  6580. switch (token[_tokenize.FIELDS.TYPE]) {
  6581. case tokens.space:
  6582. // if (
  6583. // len === 1 ||
  6584. // pos === 0 && this.content(next) === '|'
  6585. // ) {
  6586. // return this.expected('attribute', token[TOKEN.START_POS], content);
  6587. // }
  6588. spaceAfterMeaningfulToken = true;
  6589. if (this.options.lossy) {
  6590. break;
  6591. }
  6592. if (lastAdded) {
  6593. (0, util.ensureObject)(node, 'spaces', lastAdded);
  6594. var prevContent = node.spaces[lastAdded].after || '';
  6595. node.spaces[lastAdded].after = prevContent + content;
  6596. var existingComment = (0, util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || null;
  6597. if (existingComment) {
  6598. node.raws.spaces[lastAdded].after = existingComment + content;
  6599. }
  6600. } else {
  6601. spaceBefore = spaceBefore + content;
  6602. commentBefore = commentBefore + content;
  6603. }
  6604. break;
  6605. case tokens.asterisk:
  6606. if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  6607. node.operator = content;
  6608. lastAdded = 'operator';
  6609. } else if ((!node.namespace || lastAdded === "namespace" && !spaceAfterMeaningfulToken) && next) {
  6610. if (spaceBefore) {
  6611. (0, util.ensureObject)(node, 'spaces', 'attribute');
  6612. node.spaces.attribute.before = spaceBefore;
  6613. spaceBefore = '';
  6614. }
  6615. if (commentBefore) {
  6616. (0, util.ensureObject)(node, 'raws', 'spaces', 'attribute');
  6617. node.raws.spaces.attribute.before = spaceBefore;
  6618. commentBefore = '';
  6619. }
  6620. node.namespace = (node.namespace || "") + content;
  6621. var rawValue = (0, util.getProp)(node, 'raws', 'namespace') || null;
  6622. if (rawValue) {
  6623. node.raws.namespace += content;
  6624. }
  6625. lastAdded = 'namespace';
  6626. }
  6627. spaceAfterMeaningfulToken = false;
  6628. break;
  6629. case tokens.dollar:
  6630. if (lastAdded === "value") {
  6631. var oldRawValue = (0, util.getProp)(node, 'raws', 'value');
  6632. node.value += "$";
  6633. if (oldRawValue) {
  6634. node.raws.value = oldRawValue + "$";
  6635. }
  6636. break;
  6637. }
  6638. // Falls through
  6639. case tokens.caret:
  6640. if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  6641. node.operator = content;
  6642. lastAdded = 'operator';
  6643. }
  6644. spaceAfterMeaningfulToken = false;
  6645. break;
  6646. case tokens.combinator:
  6647. if (content === '~' && next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  6648. node.operator = content;
  6649. lastAdded = 'operator';
  6650. }
  6651. if (content !== '|') {
  6652. spaceAfterMeaningfulToken = false;
  6653. break;
  6654. }
  6655. if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  6656. node.operator = content;
  6657. lastAdded = 'operator';
  6658. } else if (!node.namespace && !node.attribute) {
  6659. node.namespace = true;
  6660. }
  6661. spaceAfterMeaningfulToken = false;
  6662. break;
  6663. case tokens.word:
  6664. 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.
  6665. !node.operator && !node.namespace) {
  6666. node.namespace = content;
  6667. lastAdded = 'namespace';
  6668. } else if (!node.attribute || lastAdded === "attribute" && !spaceAfterMeaningfulToken) {
  6669. if (spaceBefore) {
  6670. (0, util.ensureObject)(node, 'spaces', 'attribute');
  6671. node.spaces.attribute.before = spaceBefore;
  6672. spaceBefore = '';
  6673. }
  6674. if (commentBefore) {
  6675. (0, util.ensureObject)(node, 'raws', 'spaces', 'attribute');
  6676. node.raws.spaces.attribute.before = commentBefore;
  6677. commentBefore = '';
  6678. }
  6679. node.attribute = (node.attribute || "") + content;
  6680. var _rawValue = (0, util.getProp)(node, 'raws', 'attribute') || null;
  6681. if (_rawValue) {
  6682. node.raws.attribute += content;
  6683. }
  6684. lastAdded = 'attribute';
  6685. } else if (!node.value && node.value !== "" || lastAdded === "value" && !spaceAfterMeaningfulToken) {
  6686. var _unescaped = (0, util.unesc)(content);
  6687. var _oldRawValue = (0, util.getProp)(node, 'raws', 'value') || '';
  6688. var oldValue = node.value || '';
  6689. node.value = oldValue + _unescaped;
  6690. node.quoteMark = null;
  6691. if (_unescaped !== content || _oldRawValue) {
  6692. (0, util.ensureObject)(node, 'raws');
  6693. node.raws.value = (_oldRawValue || oldValue) + content;
  6694. }
  6695. lastAdded = 'value';
  6696. } else {
  6697. var insensitive = content === 'i' || content === "I";
  6698. if ((node.value || node.value === '') && (node.quoteMark || spaceAfterMeaningfulToken)) {
  6699. node.insensitive = insensitive;
  6700. if (!insensitive || content === "I") {
  6701. (0, util.ensureObject)(node, 'raws');
  6702. node.raws.insensitiveFlag = content;
  6703. }
  6704. lastAdded = 'insensitive';
  6705. if (spaceBefore) {
  6706. (0, util.ensureObject)(node, 'spaces', 'insensitive');
  6707. node.spaces.insensitive.before = spaceBefore;
  6708. spaceBefore = '';
  6709. }
  6710. if (commentBefore) {
  6711. (0, util.ensureObject)(node, 'raws', 'spaces', 'insensitive');
  6712. node.raws.spaces.insensitive.before = commentBefore;
  6713. commentBefore = '';
  6714. }
  6715. } else if (node.value || node.value === '') {
  6716. lastAdded = 'value';
  6717. node.value += content;
  6718. if (node.raws.value) {
  6719. node.raws.value += content;
  6720. }
  6721. }
  6722. }
  6723. spaceAfterMeaningfulToken = false;
  6724. break;
  6725. case tokens.str:
  6726. if (!node.attribute || !node.operator) {
  6727. return this.error("Expected an attribute followed by an operator preceding the string.", {
  6728. index: token[_tokenize.FIELDS.START_POS]
  6729. });
  6730. }
  6731. var _unescapeValue = (0, _attribute.unescapeValue)(content),
  6732. unescaped = _unescapeValue.unescaped,
  6733. quoteMark = _unescapeValue.quoteMark;
  6734. node.value = unescaped;
  6735. node.quoteMark = quoteMark;
  6736. lastAdded = 'value';
  6737. (0, util.ensureObject)(node, 'raws');
  6738. node.raws.value = content;
  6739. spaceAfterMeaningfulToken = false;
  6740. break;
  6741. case tokens.equals:
  6742. if (!node.attribute) {
  6743. return this.expected('attribute', token[_tokenize.FIELDS.START_POS], content);
  6744. }
  6745. if (node.value) {
  6746. return this.error('Unexpected "=" found; an operator was already defined.', {
  6747. index: token[_tokenize.FIELDS.START_POS]
  6748. });
  6749. }
  6750. node.operator = node.operator ? node.operator + content : content;
  6751. lastAdded = 'operator';
  6752. spaceAfterMeaningfulToken = false;
  6753. break;
  6754. case tokens.comment:
  6755. if (lastAdded) {
  6756. if (spaceAfterMeaningfulToken || next && next[_tokenize.FIELDS.TYPE] === tokens.space || lastAdded === 'insensitive') {
  6757. var lastComment = (0, util.getProp)(node, 'spaces', lastAdded, 'after') || '';
  6758. var rawLastComment = (0, util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || lastComment;
  6759. (0, util.ensureObject)(node, 'raws', 'spaces', lastAdded);
  6760. node.raws.spaces[lastAdded].after = rawLastComment + content;
  6761. } else {
  6762. var lastValue = node[lastAdded] || '';
  6763. var rawLastValue = (0, util.getProp)(node, 'raws', lastAdded) || lastValue;
  6764. (0, util.ensureObject)(node, 'raws');
  6765. node.raws[lastAdded] = rawLastValue + content;
  6766. }
  6767. } else {
  6768. commentBefore = commentBefore + content;
  6769. }
  6770. break;
  6771. default:
  6772. return this.error("Unexpected \"" + content + "\" found.", {
  6773. index: token[_tokenize.FIELDS.START_POS]
  6774. });
  6775. }
  6776. pos++;
  6777. }
  6778. unescapeProp(node, "attribute");
  6779. unescapeProp(node, "namespace");
  6780. this.newNode(new _attribute["default"](node));
  6781. this.position++;
  6782. }
  6783. /**
  6784. * return a node containing meaningless garbage up to (but not including) the specified token position.
  6785. * if the token position is negative, all remaining tokens are consumed.
  6786. *
  6787. * This returns an array containing a single string node if all whitespace,
  6788. * otherwise an array of comment nodes with space before and after.
  6789. *
  6790. * These tokens are not added to the current selector, the caller can add them or use them to amend
  6791. * a previous node's space metadata.
  6792. *
  6793. * In lossy mode, this returns only comments.
  6794. */
  6795. ;
  6796. _proto.parseWhitespaceEquivalentTokens = function parseWhitespaceEquivalentTokens(stopPosition) {
  6797. if (stopPosition < 0) {
  6798. stopPosition = this.tokens.length;
  6799. }
  6800. var startPosition = this.position;
  6801. var nodes = [];
  6802. var space = "";
  6803. var lastComment = undefined;
  6804. do {
  6805. if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) {
  6806. if (!this.options.lossy) {
  6807. space += this.content();
  6808. }
  6809. } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.comment) {
  6810. var spaces = {};
  6811. if (space) {
  6812. spaces.before = space;
  6813. space = "";
  6814. }
  6815. lastComment = new _comment["default"]({
  6816. value: this.content(),
  6817. source: getTokenSource(this.currToken),
  6818. sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
  6819. spaces: spaces
  6820. });
  6821. nodes.push(lastComment);
  6822. }
  6823. } while (++this.position < stopPosition);
  6824. if (space) {
  6825. if (lastComment) {
  6826. lastComment.spaces.after = space;
  6827. } else if (!this.options.lossy) {
  6828. var firstToken = this.tokens[startPosition];
  6829. var lastToken = this.tokens[this.position - 1];
  6830. nodes.push(new _string["default"]({
  6831. value: '',
  6832. source: getSource(firstToken[_tokenize.FIELDS.START_LINE], firstToken[_tokenize.FIELDS.START_COL], lastToken[_tokenize.FIELDS.END_LINE], lastToken[_tokenize.FIELDS.END_COL]),
  6833. sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
  6834. spaces: {
  6835. before: space,
  6836. after: ''
  6837. }
  6838. }));
  6839. }
  6840. }
  6841. return nodes;
  6842. }
  6843. /**
  6844. *
  6845. * @param {*} nodes
  6846. */
  6847. ;
  6848. _proto.convertWhitespaceNodesToSpace = function convertWhitespaceNodesToSpace(nodes, requiredSpace) {
  6849. var _this2 = this;
  6850. if (requiredSpace === void 0) {
  6851. requiredSpace = false;
  6852. }
  6853. var space = "";
  6854. var rawSpace = "";
  6855. nodes.forEach(function (n) {
  6856. var spaceBefore = _this2.lossySpace(n.spaces.before, requiredSpace);
  6857. var rawSpaceBefore = _this2.lossySpace(n.rawSpaceBefore, requiredSpace);
  6858. space += spaceBefore + _this2.lossySpace(n.spaces.after, requiredSpace && spaceBefore.length === 0);
  6859. rawSpace += spaceBefore + n.value + _this2.lossySpace(n.rawSpaceAfter, requiredSpace && rawSpaceBefore.length === 0);
  6860. });
  6861. if (rawSpace === space) {
  6862. rawSpace = undefined;
  6863. }
  6864. var result = {
  6865. space: space,
  6866. rawSpace: rawSpace
  6867. };
  6868. return result;
  6869. };
  6870. _proto.isNamedCombinator = function isNamedCombinator(position) {
  6871. if (position === void 0) {
  6872. position = this.position;
  6873. }
  6874. 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;
  6875. };
  6876. _proto.namedCombinator = function namedCombinator() {
  6877. if (this.isNamedCombinator()) {
  6878. var nameRaw = this.content(this.tokens[this.position + 1]);
  6879. var name = (0, util.unesc)(nameRaw).toLowerCase();
  6880. var raws = {};
  6881. if (name !== nameRaw) {
  6882. raws.value = "/" + nameRaw + "/";
  6883. }
  6884. var node = new _combinator["default"]({
  6885. value: "/" + name + "/",
  6886. 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]),
  6887. sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
  6888. raws: raws
  6889. });
  6890. this.position = this.position + 3;
  6891. return node;
  6892. } else {
  6893. this.unexpected();
  6894. }
  6895. };
  6896. _proto.combinator = function combinator() {
  6897. var _this3 = this;
  6898. if (this.content() === '|') {
  6899. return this.namespace();
  6900. } // We need to decide between a space that's a descendant combinator and meaningless whitespace at the end of a selector.
  6901. var nextSigTokenPos = this.locateNextMeaningfulToken(this.position);
  6902. if (nextSigTokenPos < 0 || this.tokens[nextSigTokenPos][_tokenize.FIELDS.TYPE] === tokens.comma) {
  6903. var nodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
  6904. if (nodes.length > 0) {
  6905. var last = this.current.last;
  6906. if (last) {
  6907. var _this$convertWhitespa = this.convertWhitespaceNodesToSpace(nodes),
  6908. space = _this$convertWhitespa.space,
  6909. rawSpace = _this$convertWhitespa.rawSpace;
  6910. if (rawSpace !== undefined) {
  6911. last.rawSpaceAfter += rawSpace;
  6912. }
  6913. last.spaces.after += space;
  6914. } else {
  6915. nodes.forEach(function (n) {
  6916. return _this3.newNode(n);
  6917. });
  6918. }
  6919. }
  6920. return;
  6921. }
  6922. var firstToken = this.currToken;
  6923. var spaceOrDescendantSelectorNodes = undefined;
  6924. if (nextSigTokenPos > this.position) {
  6925. spaceOrDescendantSelectorNodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
  6926. }
  6927. var node;
  6928. if (this.isNamedCombinator()) {
  6929. node = this.namedCombinator();
  6930. } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.combinator) {
  6931. node = new _combinator["default"]({
  6932. value: this.content(),
  6933. source: getTokenSource(this.currToken),
  6934. sourceIndex: this.currToken[_tokenize.FIELDS.START_POS]
  6935. });
  6936. this.position++;
  6937. } else if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) ; else if (!spaceOrDescendantSelectorNodes) {
  6938. this.unexpected();
  6939. }
  6940. if (node) {
  6941. if (spaceOrDescendantSelectorNodes) {
  6942. var _this$convertWhitespa2 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes),
  6943. _space = _this$convertWhitespa2.space,
  6944. _rawSpace = _this$convertWhitespa2.rawSpace;
  6945. node.spaces.before = _space;
  6946. node.rawSpaceBefore = _rawSpace;
  6947. }
  6948. } else {
  6949. // descendant combinator
  6950. var _this$convertWhitespa3 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes, true),
  6951. _space2 = _this$convertWhitespa3.space,
  6952. _rawSpace2 = _this$convertWhitespa3.rawSpace;
  6953. if (!_rawSpace2) {
  6954. _rawSpace2 = _space2;
  6955. }
  6956. var spaces = {};
  6957. var raws = {
  6958. spaces: {}
  6959. };
  6960. if (_space2.endsWith(' ') && _rawSpace2.endsWith(' ')) {
  6961. spaces.before = _space2.slice(0, _space2.length - 1);
  6962. raws.spaces.before = _rawSpace2.slice(0, _rawSpace2.length - 1);
  6963. } else if (_space2.startsWith(' ') && _rawSpace2.startsWith(' ')) {
  6964. spaces.after = _space2.slice(1);
  6965. raws.spaces.after = _rawSpace2.slice(1);
  6966. } else {
  6967. raws.value = _rawSpace2;
  6968. }
  6969. node = new _combinator["default"]({
  6970. value: ' ',
  6971. source: getTokenSourceSpan(firstToken, this.tokens[this.position - 1]),
  6972. sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
  6973. spaces: spaces,
  6974. raws: raws
  6975. });
  6976. }
  6977. if (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.space) {
  6978. node.spaces.after = this.optionalSpace(this.content());
  6979. this.position++;
  6980. }
  6981. return this.newNode(node);
  6982. };
  6983. _proto.comma = function comma() {
  6984. if (this.position === this.tokens.length - 1) {
  6985. this.root.trailingComma = true;
  6986. this.position++;
  6987. return;
  6988. }
  6989. this.current._inferEndPosition();
  6990. var selector = new _selector["default"]({
  6991. source: {
  6992. start: tokenStart(this.tokens[this.position + 1])
  6993. }
  6994. });
  6995. this.current.parent.append(selector);
  6996. this.current = selector;
  6997. this.position++;
  6998. };
  6999. _proto.comment = function comment() {
  7000. var current = this.currToken;
  7001. this.newNode(new _comment["default"]({
  7002. value: this.content(),
  7003. source: getTokenSource(current),
  7004. sourceIndex: current[_tokenize.FIELDS.START_POS]
  7005. }));
  7006. this.position++;
  7007. };
  7008. _proto.error = function error(message, opts) {
  7009. throw this.root.error(message, opts);
  7010. };
  7011. _proto.missingBackslash = function missingBackslash() {
  7012. return this.error('Expected a backslash preceding the semicolon.', {
  7013. index: this.currToken[_tokenize.FIELDS.START_POS]
  7014. });
  7015. };
  7016. _proto.missingParenthesis = function missingParenthesis() {
  7017. return this.expected('opening parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
  7018. };
  7019. _proto.missingSquareBracket = function missingSquareBracket() {
  7020. return this.expected('opening square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
  7021. };
  7022. _proto.unexpected = function unexpected() {
  7023. return this.error("Unexpected '" + this.content() + "'. Escaping special characters with \\ may help.", this.currToken[_tokenize.FIELDS.START_POS]);
  7024. };
  7025. _proto.namespace = function namespace() {
  7026. var before = this.prevToken && this.content(this.prevToken) || true;
  7027. if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.word) {
  7028. this.position++;
  7029. return this.word(before);
  7030. } else if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.asterisk) {
  7031. this.position++;
  7032. return this.universal(before);
  7033. }
  7034. };
  7035. _proto.nesting = function nesting() {
  7036. if (this.nextToken) {
  7037. var nextContent = this.content(this.nextToken);
  7038. if (nextContent === "|") {
  7039. this.position++;
  7040. return;
  7041. }
  7042. }
  7043. var current = this.currToken;
  7044. this.newNode(new _nesting["default"]({
  7045. value: this.content(),
  7046. source: getTokenSource(current),
  7047. sourceIndex: current[_tokenize.FIELDS.START_POS]
  7048. }));
  7049. this.position++;
  7050. };
  7051. _proto.parentheses = function parentheses() {
  7052. var last = this.current.last;
  7053. var unbalanced = 1;
  7054. this.position++;
  7055. if (last && last.type === types$1.PSEUDO) {
  7056. var selector = new _selector["default"]({
  7057. source: {
  7058. start: tokenStart(this.tokens[this.position - 1])
  7059. }
  7060. });
  7061. var cache = this.current;
  7062. last.append(selector);
  7063. this.current = selector;
  7064. while (this.position < this.tokens.length && unbalanced) {
  7065. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
  7066. unbalanced++;
  7067. }
  7068. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
  7069. unbalanced--;
  7070. }
  7071. if (unbalanced) {
  7072. this.parse();
  7073. } else {
  7074. this.current.source.end = tokenEnd(this.currToken);
  7075. this.current.parent.source.end = tokenEnd(this.currToken);
  7076. this.position++;
  7077. }
  7078. }
  7079. this.current = cache;
  7080. } else {
  7081. // I think this case should be an error. It's used to implement a basic parse of media queries
  7082. // but I don't think it's a good idea.
  7083. var parenStart = this.currToken;
  7084. var parenValue = "(";
  7085. var parenEnd;
  7086. while (this.position < this.tokens.length && unbalanced) {
  7087. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
  7088. unbalanced++;
  7089. }
  7090. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
  7091. unbalanced--;
  7092. }
  7093. parenEnd = this.currToken;
  7094. parenValue += this.parseParenthesisToken(this.currToken);
  7095. this.position++;
  7096. }
  7097. if (last) {
  7098. last.appendToPropertyAndEscape("value", parenValue, parenValue);
  7099. } else {
  7100. this.newNode(new _string["default"]({
  7101. value: parenValue,
  7102. source: getSource(parenStart[_tokenize.FIELDS.START_LINE], parenStart[_tokenize.FIELDS.START_COL], parenEnd[_tokenize.FIELDS.END_LINE], parenEnd[_tokenize.FIELDS.END_COL]),
  7103. sourceIndex: parenStart[_tokenize.FIELDS.START_POS]
  7104. }));
  7105. }
  7106. }
  7107. if (unbalanced) {
  7108. return this.expected('closing parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
  7109. }
  7110. };
  7111. _proto.pseudo = function pseudo() {
  7112. var _this4 = this;
  7113. var pseudoStr = '';
  7114. var startingToken = this.currToken;
  7115. while (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.colon) {
  7116. pseudoStr += this.content();
  7117. this.position++;
  7118. }
  7119. if (!this.currToken) {
  7120. return this.expected(['pseudo-class', 'pseudo-element'], this.position - 1);
  7121. }
  7122. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.word) {
  7123. this.splitWord(false, function (first, length) {
  7124. pseudoStr += first;
  7125. _this4.newNode(new _pseudo["default"]({
  7126. value: pseudoStr,
  7127. source: getTokenSourceSpan(startingToken, _this4.currToken),
  7128. sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
  7129. }));
  7130. if (length > 1 && _this4.nextToken && _this4.nextToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
  7131. _this4.error('Misplaced parenthesis.', {
  7132. index: _this4.nextToken[_tokenize.FIELDS.START_POS]
  7133. });
  7134. }
  7135. });
  7136. } else {
  7137. return this.expected(['pseudo-class', 'pseudo-element'], this.currToken[_tokenize.FIELDS.START_POS]);
  7138. }
  7139. };
  7140. _proto.space = function space() {
  7141. var content = this.content(); // Handle space before and after the selector
  7142. if (this.position === 0 || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis || this.current.nodes.every(function (node) {
  7143. return node.type === 'comment';
  7144. })) {
  7145. this.spaces = this.optionalSpace(content);
  7146. this.position++;
  7147. } else if (this.position === this.tokens.length - 1 || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
  7148. this.current.last.spaces.after = this.optionalSpace(content);
  7149. this.position++;
  7150. } else {
  7151. this.combinator();
  7152. }
  7153. };
  7154. _proto.string = function string() {
  7155. var current = this.currToken;
  7156. this.newNode(new _string["default"]({
  7157. value: this.content(),
  7158. source: getTokenSource(current),
  7159. sourceIndex: current[_tokenize.FIELDS.START_POS]
  7160. }));
  7161. this.position++;
  7162. };
  7163. _proto.universal = function universal(namespace) {
  7164. var nextToken = this.nextToken;
  7165. if (nextToken && this.content(nextToken) === '|') {
  7166. this.position++;
  7167. return this.namespace();
  7168. }
  7169. var current = this.currToken;
  7170. this.newNode(new _universal["default"]({
  7171. value: this.content(),
  7172. source: getTokenSource(current),
  7173. sourceIndex: current[_tokenize.FIELDS.START_POS]
  7174. }), namespace);
  7175. this.position++;
  7176. };
  7177. _proto.splitWord = function splitWord(namespace, firstCallback) {
  7178. var _this5 = this;
  7179. var nextToken = this.nextToken;
  7180. var word = this.content();
  7181. while (nextToken && ~[tokens.dollar, tokens.caret, tokens.equals, tokens.word].indexOf(nextToken[_tokenize.FIELDS.TYPE])) {
  7182. this.position++;
  7183. var current = this.content();
  7184. word += current;
  7185. if (current.lastIndexOf('\\') === current.length - 1) {
  7186. var next = this.nextToken;
  7187. if (next && next[_tokenize.FIELDS.TYPE] === tokens.space) {
  7188. word += this.requiredSpace(this.content(next));
  7189. this.position++;
  7190. }
  7191. }
  7192. nextToken = this.nextToken;
  7193. }
  7194. var hasClass = indexesOf(word, '.').filter(function (i) {
  7195. // Allow escaped dot within class name
  7196. var escapedDot = word[i - 1] === '\\'; // Allow decimal numbers percent in @keyframes
  7197. var isKeyframesPercent = /^\d+\.\d+%$/.test(word);
  7198. return !escapedDot && !isKeyframesPercent;
  7199. });
  7200. var hasId = indexesOf(word, '#').filter(function (i) {
  7201. return word[i - 1] !== '\\';
  7202. }); // Eliminate Sass interpolations from the list of id indexes
  7203. var interpolations = indexesOf(word, '#{');
  7204. if (interpolations.length) {
  7205. hasId = hasId.filter(function (hashIndex) {
  7206. return !~interpolations.indexOf(hashIndex);
  7207. });
  7208. }
  7209. var indices = (0, _sortAscending["default"])(uniqs([0].concat(hasClass, hasId)));
  7210. indices.forEach(function (ind, i) {
  7211. var index = indices[i + 1] || word.length;
  7212. var value = word.slice(ind, index);
  7213. if (i === 0 && firstCallback) {
  7214. return firstCallback.call(_this5, value, indices.length);
  7215. }
  7216. var node;
  7217. var current = _this5.currToken;
  7218. var sourceIndex = current[_tokenize.FIELDS.START_POS] + indices[i];
  7219. var source = getSource(current[1], current[2] + ind, current[3], current[2] + (index - 1));
  7220. if (~hasClass.indexOf(ind)) {
  7221. var classNameOpts = {
  7222. value: value.slice(1),
  7223. source: source,
  7224. sourceIndex: sourceIndex
  7225. };
  7226. node = new _className["default"](unescapeProp(classNameOpts, "value"));
  7227. } else if (~hasId.indexOf(ind)) {
  7228. var idOpts = {
  7229. value: value.slice(1),
  7230. source: source,
  7231. sourceIndex: sourceIndex
  7232. };
  7233. node = new _id["default"](unescapeProp(idOpts, "value"));
  7234. } else {
  7235. var tagOpts = {
  7236. value: value,
  7237. source: source,
  7238. sourceIndex: sourceIndex
  7239. };
  7240. unescapeProp(tagOpts, "value");
  7241. node = new _tag["default"](tagOpts);
  7242. }
  7243. _this5.newNode(node, namespace); // Ensure that the namespace is used only once
  7244. namespace = null;
  7245. });
  7246. this.position++;
  7247. };
  7248. _proto.word = function word(namespace) {
  7249. var nextToken = this.nextToken;
  7250. if (nextToken && this.content(nextToken) === '|') {
  7251. this.position++;
  7252. return this.namespace();
  7253. }
  7254. return this.splitWord(namespace);
  7255. };
  7256. _proto.loop = function loop() {
  7257. while (this.position < this.tokens.length) {
  7258. this.parse(true);
  7259. }
  7260. this.current._inferEndPosition();
  7261. return this.root;
  7262. };
  7263. _proto.parse = function parse(throwOnParenthesis) {
  7264. switch (this.currToken[_tokenize.FIELDS.TYPE]) {
  7265. case tokens.space:
  7266. this.space();
  7267. break;
  7268. case tokens.comment:
  7269. this.comment();
  7270. break;
  7271. case tokens.openParenthesis:
  7272. this.parentheses();
  7273. break;
  7274. case tokens.closeParenthesis:
  7275. if (throwOnParenthesis) {
  7276. this.missingParenthesis();
  7277. }
  7278. break;
  7279. case tokens.openSquare:
  7280. this.attribute();
  7281. break;
  7282. case tokens.dollar:
  7283. case tokens.caret:
  7284. case tokens.equals:
  7285. case tokens.word:
  7286. this.word();
  7287. break;
  7288. case tokens.colon:
  7289. this.pseudo();
  7290. break;
  7291. case tokens.comma:
  7292. this.comma();
  7293. break;
  7294. case tokens.asterisk:
  7295. this.universal();
  7296. break;
  7297. case tokens.ampersand:
  7298. this.nesting();
  7299. break;
  7300. case tokens.slash:
  7301. case tokens.combinator:
  7302. this.combinator();
  7303. break;
  7304. case tokens.str:
  7305. this.string();
  7306. break;
  7307. // These cases throw; no break needed.
  7308. case tokens.closeSquare:
  7309. this.missingSquareBracket();
  7310. case tokens.semicolon:
  7311. this.missingBackslash();
  7312. default:
  7313. this.unexpected();
  7314. }
  7315. }
  7316. /**
  7317. * Helpers
  7318. */
  7319. ;
  7320. _proto.expected = function expected(description, index, found) {
  7321. if (Array.isArray(description)) {
  7322. var last = description.pop();
  7323. description = description.join(', ') + " or " + last;
  7324. }
  7325. var an = /^[aeiou]/.test(description[0]) ? 'an' : 'a';
  7326. if (!found) {
  7327. return this.error("Expected " + an + " " + description + ".", {
  7328. index: index
  7329. });
  7330. }
  7331. return this.error("Expected " + an + " " + description + ", found \"" + found + "\" instead.", {
  7332. index: index
  7333. });
  7334. };
  7335. _proto.requiredSpace = function requiredSpace(space) {
  7336. return this.options.lossy ? ' ' : space;
  7337. };
  7338. _proto.optionalSpace = function optionalSpace(space) {
  7339. return this.options.lossy ? '' : space;
  7340. };
  7341. _proto.lossySpace = function lossySpace(space, required) {
  7342. if (this.options.lossy) {
  7343. return required ? ' ' : '';
  7344. } else {
  7345. return space;
  7346. }
  7347. };
  7348. _proto.parseParenthesisToken = function parseParenthesisToken(token) {
  7349. var content = this.content(token);
  7350. if (token[_tokenize.FIELDS.TYPE] === tokens.space) {
  7351. return this.requiredSpace(content);
  7352. } else {
  7353. return content;
  7354. }
  7355. };
  7356. _proto.newNode = function newNode(node, namespace) {
  7357. if (namespace) {
  7358. if (/^ +$/.test(namespace)) {
  7359. if (!this.options.lossy) {
  7360. this.spaces = (this.spaces || '') + namespace;
  7361. }
  7362. namespace = true;
  7363. }
  7364. node.namespace = namespace;
  7365. unescapeProp(node, "namespace");
  7366. }
  7367. if (this.spaces) {
  7368. node.spaces.before = this.spaces;
  7369. this.spaces = '';
  7370. }
  7371. return this.current.append(node);
  7372. };
  7373. _proto.content = function content(token) {
  7374. if (token === void 0) {
  7375. token = this.currToken;
  7376. }
  7377. return this.css.slice(token[_tokenize.FIELDS.START_POS], token[_tokenize.FIELDS.END_POS]);
  7378. };
  7379. /**
  7380. * returns the index of the next non-whitespace, non-comment token.
  7381. * returns -1 if no meaningful token is found.
  7382. */
  7383. _proto.locateNextMeaningfulToken = function locateNextMeaningfulToken(startPosition) {
  7384. if (startPosition === void 0) {
  7385. startPosition = this.position + 1;
  7386. }
  7387. var searchPosition = startPosition;
  7388. while (searchPosition < this.tokens.length) {
  7389. if (WHITESPACE_EQUIV_TOKENS[this.tokens[searchPosition][_tokenize.FIELDS.TYPE]]) {
  7390. searchPosition++;
  7391. continue;
  7392. } else {
  7393. return searchPosition;
  7394. }
  7395. }
  7396. return -1;
  7397. };
  7398. _createClass(Parser, [{
  7399. key: "currToken",
  7400. get: function get() {
  7401. return this.tokens[this.position];
  7402. }
  7403. }, {
  7404. key: "nextToken",
  7405. get: function get() {
  7406. return this.tokens[this.position + 1];
  7407. }
  7408. }, {
  7409. key: "prevToken",
  7410. get: function get() {
  7411. return this.tokens[this.position - 1];
  7412. }
  7413. }]);
  7414. return Parser;
  7415. }();
  7416. exports["default"] = Parser;
  7417. module.exports = exports.default;
  7418. });
  7419. var processor = createCommonjsModule(function (module, exports) {
  7420. exports.__esModule = true;
  7421. exports["default"] = void 0;
  7422. var _parser = _interopRequireDefault(parser);
  7423. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  7424. var Processor = /*#__PURE__*/function () {
  7425. function Processor(func, options) {
  7426. this.func = func || function noop() {};
  7427. this.funcRes = null;
  7428. this.options = options;
  7429. }
  7430. var _proto = Processor.prototype;
  7431. _proto._shouldUpdateSelector = function _shouldUpdateSelector(rule, options) {
  7432. if (options === void 0) {
  7433. options = {};
  7434. }
  7435. var merged = Object.assign({}, this.options, options);
  7436. if (merged.updateSelector === false) {
  7437. return false;
  7438. } else {
  7439. return typeof rule !== "string";
  7440. }
  7441. };
  7442. _proto._isLossy = function _isLossy(options) {
  7443. if (options === void 0) {
  7444. options = {};
  7445. }
  7446. var merged = Object.assign({}, this.options, options);
  7447. if (merged.lossless === false) {
  7448. return true;
  7449. } else {
  7450. return false;
  7451. }
  7452. };
  7453. _proto._root = function _root(rule, options) {
  7454. if (options === void 0) {
  7455. options = {};
  7456. }
  7457. var parser = new _parser["default"](rule, this._parseOptions(options));
  7458. return parser.root;
  7459. };
  7460. _proto._parseOptions = function _parseOptions(options) {
  7461. return {
  7462. lossy: this._isLossy(options)
  7463. };
  7464. };
  7465. _proto._run = function _run(rule, options) {
  7466. var _this = this;
  7467. if (options === void 0) {
  7468. options = {};
  7469. }
  7470. return new Promise(function (resolve, reject) {
  7471. try {
  7472. var root = _this._root(rule, options);
  7473. Promise.resolve(_this.func(root)).then(function (transform) {
  7474. var string = undefined;
  7475. if (_this._shouldUpdateSelector(rule, options)) {
  7476. string = root.toString();
  7477. rule.selector = string;
  7478. }
  7479. return {
  7480. transform: transform,
  7481. root: root,
  7482. string: string
  7483. };
  7484. }).then(resolve, reject);
  7485. } catch (e) {
  7486. reject(e);
  7487. return;
  7488. }
  7489. });
  7490. };
  7491. _proto._runSync = function _runSync(rule, options) {
  7492. if (options === void 0) {
  7493. options = {};
  7494. }
  7495. var root = this._root(rule, options);
  7496. var transform = this.func(root);
  7497. if (transform && typeof transform.then === "function") {
  7498. throw new Error("Selector processor returned a promise to a synchronous call.");
  7499. }
  7500. var string = undefined;
  7501. if (options.updateSelector && typeof rule !== "string") {
  7502. string = root.toString();
  7503. rule.selector = string;
  7504. }
  7505. return {
  7506. transform: transform,
  7507. root: root,
  7508. string: string
  7509. };
  7510. }
  7511. /**
  7512. * Process rule into a selector AST.
  7513. *
  7514. * @param rule {postcss.Rule | string} The css selector to be processed
  7515. * @param options The options for processing
  7516. * @returns {Promise<parser.Root>} The AST of the selector after processing it.
  7517. */
  7518. ;
  7519. _proto.ast = function ast(rule, options) {
  7520. return this._run(rule, options).then(function (result) {
  7521. return result.root;
  7522. });
  7523. }
  7524. /**
  7525. * Process rule into a selector AST synchronously.
  7526. *
  7527. * @param rule {postcss.Rule | string} The css selector to be processed
  7528. * @param options The options for processing
  7529. * @returns {parser.Root} The AST of the selector after processing it.
  7530. */
  7531. ;
  7532. _proto.astSync = function astSync(rule, options) {
  7533. return this._runSync(rule, options).root;
  7534. }
  7535. /**
  7536. * Process a selector into a transformed value asynchronously
  7537. *
  7538. * @param rule {postcss.Rule | string} The css selector to be processed
  7539. * @param options The options for processing
  7540. * @returns {Promise<any>} The value returned by the processor.
  7541. */
  7542. ;
  7543. _proto.transform = function transform(rule, options) {
  7544. return this._run(rule, options).then(function (result) {
  7545. return result.transform;
  7546. });
  7547. }
  7548. /**
  7549. * Process a selector into a transformed value synchronously.
  7550. *
  7551. * @param rule {postcss.Rule | string} The css selector to be processed
  7552. * @param options The options for processing
  7553. * @returns {any} The value returned by the processor.
  7554. */
  7555. ;
  7556. _proto.transformSync = function transformSync(rule, options) {
  7557. return this._runSync(rule, options).transform;
  7558. }
  7559. /**
  7560. * Process a selector into a new selector string asynchronously.
  7561. *
  7562. * @param rule {postcss.Rule | string} The css selector to be processed
  7563. * @param options The options for processing
  7564. * @returns {string} the selector after processing.
  7565. */
  7566. ;
  7567. _proto.process = function process(rule, options) {
  7568. return this._run(rule, options).then(function (result) {
  7569. return result.string || result.root.toString();
  7570. });
  7571. }
  7572. /**
  7573. * Process a selector into a new selector string synchronously.
  7574. *
  7575. * @param rule {postcss.Rule | string} The css selector to be processed
  7576. * @param options The options for processing
  7577. * @returns {string} the selector after processing.
  7578. */
  7579. ;
  7580. _proto.processSync = function processSync(rule, options) {
  7581. var result = this._runSync(rule, options);
  7582. return result.string || result.root.toString();
  7583. };
  7584. return Processor;
  7585. }();
  7586. exports["default"] = Processor;
  7587. module.exports = exports.default;
  7588. });
  7589. var constructors = createCommonjsModule(function (module, exports) {
  7590. exports.__esModule = true;
  7591. 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;
  7592. var _attribute = _interopRequireDefault(attribute);
  7593. var _className = _interopRequireDefault(className);
  7594. var _combinator = _interopRequireDefault(combinator);
  7595. var _comment = _interopRequireDefault(comment);
  7596. var _id = _interopRequireDefault(id);
  7597. var _nesting = _interopRequireDefault(nesting);
  7598. var _pseudo = _interopRequireDefault(pseudo);
  7599. var _root = _interopRequireDefault(root);
  7600. var _selector = _interopRequireDefault(selector);
  7601. var _string = _interopRequireDefault(string);
  7602. var _tag = _interopRequireDefault(tag);
  7603. var _universal = _interopRequireDefault(universal);
  7604. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  7605. var attribute$1 = function attribute(opts) {
  7606. return new _attribute["default"](opts);
  7607. };
  7608. exports.attribute = attribute$1;
  7609. var className$1 = function className(opts) {
  7610. return new _className["default"](opts);
  7611. };
  7612. exports.className = className$1;
  7613. var combinator$1 = function combinator(opts) {
  7614. return new _combinator["default"](opts);
  7615. };
  7616. exports.combinator = combinator$1;
  7617. var comment$1 = function comment(opts) {
  7618. return new _comment["default"](opts);
  7619. };
  7620. exports.comment = comment$1;
  7621. var id$1 = function id(opts) {
  7622. return new _id["default"](opts);
  7623. };
  7624. exports.id = id$1;
  7625. var nesting$1 = function nesting(opts) {
  7626. return new _nesting["default"](opts);
  7627. };
  7628. exports.nesting = nesting$1;
  7629. var pseudo$1 = function pseudo(opts) {
  7630. return new _pseudo["default"](opts);
  7631. };
  7632. exports.pseudo = pseudo$1;
  7633. var root$1 = function root(opts) {
  7634. return new _root["default"](opts);
  7635. };
  7636. exports.root = root$1;
  7637. var selector$1 = function selector(opts) {
  7638. return new _selector["default"](opts);
  7639. };
  7640. exports.selector = selector$1;
  7641. var string$1 = function string(opts) {
  7642. return new _string["default"](opts);
  7643. };
  7644. exports.string = string$1;
  7645. var tag$1 = function tag(opts) {
  7646. return new _tag["default"](opts);
  7647. };
  7648. exports.tag = tag$1;
  7649. var universal$1 = function universal(opts) {
  7650. return new _universal["default"](opts);
  7651. };
  7652. exports.universal = universal$1;
  7653. });
  7654. var guards = createCommonjsModule(function (module, exports) {
  7655. exports.__esModule = true;
  7656. exports.isNode = isNode;
  7657. exports.isPseudoElement = isPseudoElement;
  7658. exports.isPseudoClass = isPseudoClass;
  7659. exports.isContainer = isContainer;
  7660. exports.isNamespace = isNamespace;
  7661. 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;
  7662. var _IS_TYPE;
  7663. 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);
  7664. function isNode(node) {
  7665. return typeof node === "object" && IS_TYPE[node.type];
  7666. }
  7667. function isNodeType(type, node) {
  7668. return isNode(node) && node.type === type;
  7669. }
  7670. var isAttribute = isNodeType.bind(null, types.ATTRIBUTE);
  7671. exports.isAttribute = isAttribute;
  7672. var isClassName = isNodeType.bind(null, types.CLASS);
  7673. exports.isClassName = isClassName;
  7674. var isCombinator = isNodeType.bind(null, types.COMBINATOR);
  7675. exports.isCombinator = isCombinator;
  7676. var isComment = isNodeType.bind(null, types.COMMENT);
  7677. exports.isComment = isComment;
  7678. var isIdentifier = isNodeType.bind(null, types.ID);
  7679. exports.isIdentifier = isIdentifier;
  7680. var isNesting = isNodeType.bind(null, types.NESTING);
  7681. exports.isNesting = isNesting;
  7682. var isPseudo = isNodeType.bind(null, types.PSEUDO);
  7683. exports.isPseudo = isPseudo;
  7684. var isRoot = isNodeType.bind(null, types.ROOT);
  7685. exports.isRoot = isRoot;
  7686. var isSelector = isNodeType.bind(null, types.SELECTOR);
  7687. exports.isSelector = isSelector;
  7688. var isString = isNodeType.bind(null, types.STRING);
  7689. exports.isString = isString;
  7690. var isTag = isNodeType.bind(null, types.TAG);
  7691. exports.isTag = isTag;
  7692. var isUniversal = isNodeType.bind(null, types.UNIVERSAL);
  7693. exports.isUniversal = isUniversal;
  7694. function isPseudoElement(node) {
  7695. return isPseudo(node) && node.value && (node.value.startsWith("::") || node.value.toLowerCase() === ":before" || node.value.toLowerCase() === ":after");
  7696. }
  7697. function isPseudoClass(node) {
  7698. return isPseudo(node) && !isPseudoElement(node);
  7699. }
  7700. function isContainer(node) {
  7701. return !!(isNode(node) && node.walk);
  7702. }
  7703. function isNamespace(node) {
  7704. return isAttribute(node) || isTag(node);
  7705. }
  7706. });
  7707. var selectors = createCommonjsModule(function (module, exports) {
  7708. exports.__esModule = true;
  7709. Object.keys(types).forEach(function (key) {
  7710. if (key === "default" || key === "__esModule") return;
  7711. if (key in exports && exports[key] === types[key]) return;
  7712. exports[key] = types[key];
  7713. });
  7714. Object.keys(constructors).forEach(function (key) {
  7715. if (key === "default" || key === "__esModule") return;
  7716. if (key in exports && exports[key] === constructors[key]) return;
  7717. exports[key] = constructors[key];
  7718. });
  7719. Object.keys(guards).forEach(function (key) {
  7720. if (key === "default" || key === "__esModule") return;
  7721. if (key in exports && exports[key] === guards[key]) return;
  7722. exports[key] = guards[key];
  7723. });
  7724. });
  7725. var dist = createCommonjsModule(function (module, exports) {
  7726. exports.__esModule = true;
  7727. exports["default"] = void 0;
  7728. var _processor = _interopRequireDefault(processor);
  7729. var selectors$1 = _interopRequireWildcard(selectors);
  7730. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  7731. 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; }
  7732. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  7733. var parser = function parser(processor) {
  7734. return new _processor["default"](processor);
  7735. };
  7736. Object.assign(parser, selectors$1);
  7737. delete parser.__esModule;
  7738. var _default = parser;
  7739. exports["default"] = _default;
  7740. module.exports = exports.default;
  7741. });
  7742. var selectorParser = /*@__PURE__*/getDefaultExportFromCjs(dist);
  7743. const animationNameRE = /^(-\w+-)?animation-name$/;
  7744. const animationRE = /^(-\w+-)?animation$/;
  7745. const scopedPlugin = (id = '') => {
  7746. const keyframes = Object.create(null);
  7747. const shortId = id.replace(/^data-v-/, '');
  7748. return {
  7749. postcssPlugin: 'vue-sfc-scoped',
  7750. Rule(rule) {
  7751. processRule(id, rule);
  7752. },
  7753. AtRule(node) {
  7754. if (/-?keyframes$/.test(node.name) &&
  7755. !node.params.endsWith(`-${shortId}`)) {
  7756. // register keyframes
  7757. keyframes[node.params] = node.params = node.params + '-' + shortId;
  7758. }
  7759. },
  7760. OnceExit(root) {
  7761. if (Object.keys(keyframes).length) {
  7762. // If keyframes are found in this <style>, find and rewrite animation names
  7763. // in declarations.
  7764. // Caveat: this only works for keyframes and animation rules in the same
  7765. // <style> element.
  7766. // individual animation-name declaration
  7767. root.walkDecls(decl => {
  7768. if (animationNameRE.test(decl.prop)) {
  7769. decl.value = decl.value
  7770. .split(',')
  7771. .map(v => keyframes[v.trim()] || v.trim())
  7772. .join(',');
  7773. }
  7774. // shorthand
  7775. if (animationRE.test(decl.prop)) {
  7776. decl.value = decl.value
  7777. .split(',')
  7778. .map(v => {
  7779. const vals = v.trim().split(/\s+/);
  7780. const i = vals.findIndex(val => keyframes[val]);
  7781. if (i !== -1) {
  7782. vals.splice(i, 1, keyframes[vals[i]]);
  7783. return vals.join(' ');
  7784. }
  7785. else {
  7786. return v;
  7787. }
  7788. })
  7789. .join(',');
  7790. }
  7791. });
  7792. }
  7793. }
  7794. };
  7795. };
  7796. const processedRules = new WeakSet();
  7797. function processRule(id, rule) {
  7798. if (processedRules.has(rule) ||
  7799. (rule.parent &&
  7800. rule.parent.type === 'atrule' &&
  7801. /-?keyframes$/.test(rule.parent.name))) {
  7802. return;
  7803. }
  7804. processedRules.add(rule);
  7805. rule.selector = selectorParser(selectorRoot => {
  7806. selectorRoot.each(selector => {
  7807. rewriteSelector(id, selector, selectorRoot);
  7808. });
  7809. }).processSync(rule.selector);
  7810. }
  7811. function rewriteSelector(id, selector, selectorRoot, slotted = false) {
  7812. let node = null;
  7813. let shouldInject = true;
  7814. // find the last child node to insert attribute selector
  7815. selector.each(n => {
  7816. // DEPRECATED ">>>" and "/deep/" combinator
  7817. if (n.type === 'combinator' &&
  7818. (n.value === '>>>' || n.value === '/deep/')) {
  7819. n.value = ' ';
  7820. n.spaces.before = n.spaces.after = '';
  7821. warn(`the >>> and /deep/ combinators have been deprecated. ` +
  7822. `Use :deep() instead.`);
  7823. return false;
  7824. }
  7825. if (n.type === 'pseudo') {
  7826. const { value } = n;
  7827. // deep: inject [id] attribute at the node before the ::v-deep
  7828. // combinator.
  7829. if (value === ':deep' || value === '::v-deep') {
  7830. if (n.nodes.length) {
  7831. // .foo ::v-deep(.bar) -> .foo[xxxxxxx] .bar
  7832. // replace the current node with ::v-deep's inner selector
  7833. let last = n;
  7834. n.nodes[0].each(ss => {
  7835. selector.insertAfter(last, ss);
  7836. last = ss;
  7837. });
  7838. // insert a space combinator before if it doesn't already have one
  7839. const prev = selector.at(selector.index(n) - 1);
  7840. if (!prev || !isSpaceCombinator(prev)) {
  7841. selector.insertAfter(n, selectorParser.combinator({
  7842. value: ' '
  7843. }));
  7844. }
  7845. selector.removeChild(n);
  7846. }
  7847. else {
  7848. // DEPRECATED usage
  7849. // .foo ::v-deep .bar -> .foo[xxxxxxx] .bar
  7850. warn(`::v-deep usage as a combinator has ` +
  7851. `been deprecated. Use :deep(<inner-selector>) instead.`);
  7852. const prev = selector.at(selector.index(n) - 1);
  7853. if (prev && isSpaceCombinator(prev)) {
  7854. selector.removeChild(prev);
  7855. }
  7856. selector.removeChild(n);
  7857. }
  7858. return false;
  7859. }
  7860. // slot: use selector inside `::v-slotted` and inject [id + '-s']
  7861. // instead.
  7862. // ::v-slotted(.foo) -> .foo[xxxxxxx-s]
  7863. if (value === ':slotted' || value === '::v-slotted') {
  7864. rewriteSelector(id, n.nodes[0], selectorRoot, true /* slotted */);
  7865. let last = n;
  7866. n.nodes[0].each(ss => {
  7867. selector.insertAfter(last, ss);
  7868. last = ss;
  7869. });
  7870. // selector.insertAfter(n, n.nodes[0])
  7871. selector.removeChild(n);
  7872. // since slotted attribute already scopes the selector there's no
  7873. // need for the non-slot attribute.
  7874. shouldInject = false;
  7875. return false;
  7876. }
  7877. // global: replace with inner selector and do not inject [id].
  7878. // ::v-global(.foo) -> .foo
  7879. if (value === ':global' || value === '::v-global') {
  7880. selectorRoot.insertAfter(selector, n.nodes[0]);
  7881. selectorRoot.removeChild(selector);
  7882. return false;
  7883. }
  7884. }
  7885. if (n.type !== 'pseudo' && n.type !== 'combinator') {
  7886. node = n;
  7887. }
  7888. });
  7889. if (node) {
  7890. node.spaces.after = '';
  7891. }
  7892. else {
  7893. // For deep selectors & standalone pseudo selectors,
  7894. // the attribute selectors are prepended rather than appended.
  7895. // So all leading spaces must be eliminated to avoid problems.
  7896. selector.first.spaces.before = '';
  7897. }
  7898. if (shouldInject) {
  7899. const idToAdd = slotted ? id + '-s' : id;
  7900. selector.insertAfter(
  7901. // If node is null it means we need to inject [id] at the start
  7902. // insertAfter can handle `null` here
  7903. node, selectorParser.attribute({
  7904. attribute: idToAdd,
  7905. value: idToAdd,
  7906. raws: {},
  7907. quoteMark: `"`
  7908. }));
  7909. }
  7910. }
  7911. function isSpaceCombinator(node) {
  7912. return node.type === 'combinator' && /^\s+$/.test(node.value);
  7913. }
  7914. scopedPlugin.postcss = true;
  7915. var SourceMapConsumer = sourceMap__default.SourceMapConsumer;
  7916. var SourceMapGenerator = sourceMap__default.SourceMapGenerator;
  7917. var mergeSourceMap = merge$1;
  7918. /**
  7919. * Merge old source map and new source map and return merged.
  7920. * If old or new source map value is falsy, return another one as it is.
  7921. *
  7922. * @param {object|string} [oldMap] old source map object
  7923. * @param {object|string} [newmap] new source map object
  7924. * @return {object|undefined} merged source map object, or undefined when both old and new source map are undefined
  7925. */
  7926. function merge$1(oldMap, newMap) {
  7927. if (!oldMap) return newMap
  7928. if (!newMap) return oldMap
  7929. var oldMapConsumer = new SourceMapConsumer(oldMap);
  7930. var newMapConsumer = new SourceMapConsumer(newMap);
  7931. var mergedMapGenerator = new SourceMapGenerator();
  7932. // iterate on new map and overwrite original position of new map with one of old map
  7933. newMapConsumer.eachMapping(function(m) {
  7934. // pass when `originalLine` is null.
  7935. // It occurs in case that the node does not have origin in original code.
  7936. if (m.originalLine == null) return
  7937. var origPosInOldMap = oldMapConsumer.originalPositionFor({
  7938. line: m.originalLine,
  7939. column: m.originalColumn
  7940. });
  7941. if (origPosInOldMap.source == null) return
  7942. mergedMapGenerator.addMapping({
  7943. original: {
  7944. line: origPosInOldMap.line,
  7945. column: origPosInOldMap.column
  7946. },
  7947. generated: {
  7948. line: m.generatedLine,
  7949. column: m.generatedColumn
  7950. },
  7951. source: origPosInOldMap.source,
  7952. name: origPosInOldMap.name
  7953. });
  7954. });
  7955. var consumers = [oldMapConsumer, newMapConsumer];
  7956. consumers.forEach(function(consumer) {
  7957. consumer.sources.forEach(function(sourceFile) {
  7958. mergedMapGenerator._sources.add(sourceFile);
  7959. var sourceContent = consumer.sourceContentFor(sourceFile);
  7960. if (sourceContent != null) {
  7961. mergedMapGenerator.setSourceContent(sourceFile, sourceContent);
  7962. }
  7963. });
  7964. });
  7965. mergedMapGenerator._sourceRoot = oldMap.sourceRoot;
  7966. mergedMapGenerator._file = oldMap.file;
  7967. return JSON.parse(mergedMapGenerator.toString())
  7968. }
  7969. // .scss/.sass processor
  7970. const scss = (source, map, options, load = require) => {
  7971. const nodeSass = load('sass');
  7972. const finalOptions = Object.assign(Object.assign({}, options), { data: getSource(source, options.filename, options.additionalData), file: options.filename, outFile: options.filename, sourceMap: !!map });
  7973. try {
  7974. const result = nodeSass.renderSync(finalOptions);
  7975. const dependencies = result.stats.includedFiles;
  7976. if (map) {
  7977. return {
  7978. code: result.css.toString(),
  7979. map: mergeSourceMap(map, JSON.parse(result.map.toString())),
  7980. errors: [],
  7981. dependencies
  7982. };
  7983. }
  7984. return { code: result.css.toString(), errors: [], dependencies };
  7985. }
  7986. catch (e) {
  7987. return { code: '', errors: [e], dependencies: [] };
  7988. }
  7989. };
  7990. const sass = (source, map, options, load) => scss(source, map, Object.assign(Object.assign({}, options), { indentedSyntax: true }), load);
  7991. // .less
  7992. const less = (source, map, options, load = require) => {
  7993. const nodeLess = load('less');
  7994. let result;
  7995. let error = null;
  7996. nodeLess.render(getSource(source, options.filename, options.additionalData), Object.assign(Object.assign({}, options), { syncImport: true }), (err, output) => {
  7997. error = err;
  7998. result = output;
  7999. });
  8000. if (error)
  8001. return { code: '', errors: [error], dependencies: [] };
  8002. const dependencies = result.imports;
  8003. if (map) {
  8004. return {
  8005. code: result.css.toString(),
  8006. map: mergeSourceMap(map, result.map),
  8007. errors: [],
  8008. dependencies: dependencies
  8009. };
  8010. }
  8011. return {
  8012. code: result.css.toString(),
  8013. errors: [],
  8014. dependencies: dependencies
  8015. };
  8016. };
  8017. // .styl
  8018. const styl = (source, map, options, load = require) => {
  8019. const nodeStylus = load('stylus');
  8020. try {
  8021. const ref = nodeStylus(source);
  8022. Object.keys(options).forEach(key => ref.set(key, options[key]));
  8023. if (map)
  8024. ref.set('sourcemap', { inline: false, comment: false });
  8025. const result = ref.render();
  8026. const dependencies = ref.deps();
  8027. if (map) {
  8028. return {
  8029. code: result,
  8030. map: mergeSourceMap(map, ref.sourcemap),
  8031. errors: [],
  8032. dependencies
  8033. };
  8034. }
  8035. return { code: result, errors: [], dependencies };
  8036. }
  8037. catch (e) {
  8038. return { code: '', errors: [e], dependencies: [] };
  8039. }
  8040. };
  8041. function getSource(source, filename, additionalData) {
  8042. if (!additionalData)
  8043. return source;
  8044. if (shared.isFunction(additionalData)) {
  8045. return additionalData(source, filename);
  8046. }
  8047. return additionalData + source;
  8048. }
  8049. const processors = {
  8050. less,
  8051. sass,
  8052. scss,
  8053. styl,
  8054. stylus: styl
  8055. };
  8056. /**
  8057. * lodash (Custom Build) <https://lodash.com/>
  8058. * Build: `lodash modularize exports="npm" -o ./`
  8059. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  8060. * Released under MIT license <https://lodash.com/license>
  8061. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  8062. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  8063. */
  8064. /** Used as references for various `Number` constants. */
  8065. var INFINITY = 1 / 0;
  8066. /** `Object#toString` result references. */
  8067. var symbolTag = '[object Symbol]';
  8068. /** Used to match words composed of alphanumeric characters. */
  8069. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  8070. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  8071. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  8072. /** Used to compose unicode character classes. */
  8073. var rsAstralRange = '\\ud800-\\udfff',
  8074. rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
  8075. rsComboSymbolsRange = '\\u20d0-\\u20f0',
  8076. rsDingbatRange = '\\u2700-\\u27bf',
  8077. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  8078. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  8079. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  8080. rsPunctuationRange = '\\u2000-\\u206f',
  8081. 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',
  8082. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  8083. rsVarRange = '\\ufe0e\\ufe0f',
  8084. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  8085. /** Used to compose unicode capture groups. */
  8086. var rsApos = "['\u2019]",
  8087. rsAstral = '[' + rsAstralRange + ']',
  8088. rsBreak = '[' + rsBreakRange + ']',
  8089. rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
  8090. rsDigits = '\\d+',
  8091. rsDingbat = '[' + rsDingbatRange + ']',
  8092. rsLower = '[' + rsLowerRange + ']',
  8093. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  8094. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  8095. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  8096. rsNonAstral = '[^' + rsAstralRange + ']',
  8097. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  8098. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  8099. rsUpper = '[' + rsUpperRange + ']',
  8100. rsZWJ = '\\u200d';
  8101. /** Used to compose unicode regexes. */
  8102. var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
  8103. rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
  8104. rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  8105. rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  8106. reOptMod = rsModifier + '?',
  8107. rsOptVar = '[' + rsVarRange + ']?',
  8108. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  8109. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  8110. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  8111. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  8112. /** Used to match apostrophes. */
  8113. var reApos = RegExp(rsApos, 'g');
  8114. /**
  8115. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  8116. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  8117. */
  8118. var reComboMark = RegExp(rsCombo, 'g');
  8119. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  8120. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  8121. /** Used to match complex or compound words. */
  8122. var reUnicodeWord = RegExp([
  8123. rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  8124. rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
  8125. rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
  8126. rsUpper + '+' + rsOptUpperContr,
  8127. rsDigits,
  8128. rsEmoji
  8129. ].join('|'), 'g');
  8130. /** 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/). */
  8131. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
  8132. /** Used to detect strings that need a more robust regexp to match words. */
  8133. 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 ]/;
  8134. /** Used to map Latin Unicode letters to basic Latin letters. */
  8135. var deburredLetters = {
  8136. // Latin-1 Supplement block.
  8137. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  8138. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  8139. '\xc7': 'C', '\xe7': 'c',
  8140. '\xd0': 'D', '\xf0': 'd',
  8141. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  8142. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  8143. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  8144. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  8145. '\xd1': 'N', '\xf1': 'n',
  8146. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  8147. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  8148. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  8149. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  8150. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  8151. '\xc6': 'Ae', '\xe6': 'ae',
  8152. '\xde': 'Th', '\xfe': 'th',
  8153. '\xdf': 'ss',
  8154. // Latin Extended-A block.
  8155. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  8156. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  8157. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  8158. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  8159. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  8160. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  8161. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  8162. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  8163. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  8164. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  8165. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  8166. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  8167. '\u0134': 'J', '\u0135': 'j',
  8168. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  8169. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  8170. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  8171. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  8172. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  8173. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  8174. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  8175. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  8176. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  8177. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  8178. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  8179. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  8180. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  8181. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  8182. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  8183. '\u0174': 'W', '\u0175': 'w',
  8184. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  8185. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  8186. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  8187. '\u0132': 'IJ', '\u0133': 'ij',
  8188. '\u0152': 'Oe', '\u0153': 'oe',
  8189. '\u0149': "'n", '\u017f': 'ss'
  8190. };
  8191. /** Detect free variable `global` from Node.js. */
  8192. var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
  8193. /** Detect free variable `self`. */
  8194. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  8195. /** Used as a reference to the global object. */
  8196. var root$1 = freeGlobal || freeSelf || Function('return this')();
  8197. /**
  8198. * A specialized version of `_.reduce` for arrays without support for
  8199. * iteratee shorthands.
  8200. *
  8201. * @private
  8202. * @param {Array} [array] The array to iterate over.
  8203. * @param {Function} iteratee The function invoked per iteration.
  8204. * @param {*} [accumulator] The initial value.
  8205. * @param {boolean} [initAccum] Specify using the first element of `array` as
  8206. * the initial value.
  8207. * @returns {*} Returns the accumulated value.
  8208. */
  8209. function arrayReduce(array, iteratee, accumulator, initAccum) {
  8210. var index = -1,
  8211. length = array ? array.length : 0;
  8212. if (initAccum && length) {
  8213. accumulator = array[++index];
  8214. }
  8215. while (++index < length) {
  8216. accumulator = iteratee(accumulator, array[index], index, array);
  8217. }
  8218. return accumulator;
  8219. }
  8220. /**
  8221. * Converts an ASCII `string` to an array.
  8222. *
  8223. * @private
  8224. * @param {string} string The string to convert.
  8225. * @returns {Array} Returns the converted array.
  8226. */
  8227. function asciiToArray(string) {
  8228. return string.split('');
  8229. }
  8230. /**
  8231. * Splits an ASCII `string` into an array of its words.
  8232. *
  8233. * @private
  8234. * @param {string} The string to inspect.
  8235. * @returns {Array} Returns the words of `string`.
  8236. */
  8237. function asciiWords(string) {
  8238. return string.match(reAsciiWord) || [];
  8239. }
  8240. /**
  8241. * The base implementation of `_.propertyOf` without support for deep paths.
  8242. *
  8243. * @private
  8244. * @param {Object} object The object to query.
  8245. * @returns {Function} Returns the new accessor function.
  8246. */
  8247. function basePropertyOf(object) {
  8248. return function(key) {
  8249. return object == null ? undefined : object[key];
  8250. };
  8251. }
  8252. /**
  8253. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  8254. * letters to basic Latin letters.
  8255. *
  8256. * @private
  8257. * @param {string} letter The matched letter to deburr.
  8258. * @returns {string} Returns the deburred letter.
  8259. */
  8260. var deburrLetter = basePropertyOf(deburredLetters);
  8261. /**
  8262. * Checks if `string` contains Unicode symbols.
  8263. *
  8264. * @private
  8265. * @param {string} string The string to inspect.
  8266. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  8267. */
  8268. function hasUnicode(string) {
  8269. return reHasUnicode.test(string);
  8270. }
  8271. /**
  8272. * Checks if `string` contains a word composed of Unicode symbols.
  8273. *
  8274. * @private
  8275. * @param {string} string The string to inspect.
  8276. * @returns {boolean} Returns `true` if a word is found, else `false`.
  8277. */
  8278. function hasUnicodeWord(string) {
  8279. return reHasUnicodeWord.test(string);
  8280. }
  8281. /**
  8282. * Converts `string` to an array.
  8283. *
  8284. * @private
  8285. * @param {string} string The string to convert.
  8286. * @returns {Array} Returns the converted array.
  8287. */
  8288. function stringToArray(string) {
  8289. return hasUnicode(string)
  8290. ? unicodeToArray(string)
  8291. : asciiToArray(string);
  8292. }
  8293. /**
  8294. * Converts a Unicode `string` to an array.
  8295. *
  8296. * @private
  8297. * @param {string} string The string to convert.
  8298. * @returns {Array} Returns the converted array.
  8299. */
  8300. function unicodeToArray(string) {
  8301. return string.match(reUnicode) || [];
  8302. }
  8303. /**
  8304. * Splits a Unicode `string` into an array of its words.
  8305. *
  8306. * @private
  8307. * @param {string} The string to inspect.
  8308. * @returns {Array} Returns the words of `string`.
  8309. */
  8310. function unicodeWords(string) {
  8311. return string.match(reUnicodeWord) || [];
  8312. }
  8313. /** Used for built-in method references. */
  8314. var objectProto = Object.prototype;
  8315. /**
  8316. * Used to resolve the
  8317. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  8318. * of values.
  8319. */
  8320. var objectToString = objectProto.toString;
  8321. /** Built-in value references. */
  8322. var Symbol$1 = root$1.Symbol;
  8323. /** Used to convert symbols to primitives and strings. */
  8324. var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
  8325. symbolToString = symbolProto ? symbolProto.toString : undefined;
  8326. /**
  8327. * The base implementation of `_.slice` without an iteratee call guard.
  8328. *
  8329. * @private
  8330. * @param {Array} array The array to slice.
  8331. * @param {number} [start=0] The start position.
  8332. * @param {number} [end=array.length] The end position.
  8333. * @returns {Array} Returns the slice of `array`.
  8334. */
  8335. function baseSlice(array, start, end) {
  8336. var index = -1,
  8337. length = array.length;
  8338. if (start < 0) {
  8339. start = -start > length ? 0 : (length + start);
  8340. }
  8341. end = end > length ? length : end;
  8342. if (end < 0) {
  8343. end += length;
  8344. }
  8345. length = start > end ? 0 : ((end - start) >>> 0);
  8346. start >>>= 0;
  8347. var result = Array(length);
  8348. while (++index < length) {
  8349. result[index] = array[index + start];
  8350. }
  8351. return result;
  8352. }
  8353. /**
  8354. * The base implementation of `_.toString` which doesn't convert nullish
  8355. * values to empty strings.
  8356. *
  8357. * @private
  8358. * @param {*} value The value to process.
  8359. * @returns {string} Returns the string.
  8360. */
  8361. function baseToString(value) {
  8362. // Exit early for strings to avoid a performance hit in some environments.
  8363. if (typeof value == 'string') {
  8364. return value;
  8365. }
  8366. if (isSymbol(value)) {
  8367. return symbolToString ? symbolToString.call(value) : '';
  8368. }
  8369. var result = (value + '');
  8370. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  8371. }
  8372. /**
  8373. * Casts `array` to a slice if it's needed.
  8374. *
  8375. * @private
  8376. * @param {Array} array The array to inspect.
  8377. * @param {number} start The start position.
  8378. * @param {number} [end=array.length] The end position.
  8379. * @returns {Array} Returns the cast slice.
  8380. */
  8381. function castSlice(array, start, end) {
  8382. var length = array.length;
  8383. end = end === undefined ? length : end;
  8384. return (!start && end >= length) ? array : baseSlice(array, start, end);
  8385. }
  8386. /**
  8387. * Creates a function like `_.lowerFirst`.
  8388. *
  8389. * @private
  8390. * @param {string} methodName The name of the `String` case method to use.
  8391. * @returns {Function} Returns the new case function.
  8392. */
  8393. function createCaseFirst(methodName) {
  8394. return function(string) {
  8395. string = toString$1(string);
  8396. var strSymbols = hasUnicode(string)
  8397. ? stringToArray(string)
  8398. : undefined;
  8399. var chr = strSymbols
  8400. ? strSymbols[0]
  8401. : string.charAt(0);
  8402. var trailing = strSymbols
  8403. ? castSlice(strSymbols, 1).join('')
  8404. : string.slice(1);
  8405. return chr[methodName]() + trailing;
  8406. };
  8407. }
  8408. /**
  8409. * Creates a function like `_.camelCase`.
  8410. *
  8411. * @private
  8412. * @param {Function} callback The function to combine each word.
  8413. * @returns {Function} Returns the new compounder function.
  8414. */
  8415. function createCompounder(callback) {
  8416. return function(string) {
  8417. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  8418. };
  8419. }
  8420. /**
  8421. * Checks if `value` is object-like. A value is object-like if it's not `null`
  8422. * and has a `typeof` result of "object".
  8423. *
  8424. * @static
  8425. * @memberOf _
  8426. * @since 4.0.0
  8427. * @category Lang
  8428. * @param {*} value The value to check.
  8429. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  8430. * @example
  8431. *
  8432. * _.isObjectLike({});
  8433. * // => true
  8434. *
  8435. * _.isObjectLike([1, 2, 3]);
  8436. * // => true
  8437. *
  8438. * _.isObjectLike(_.noop);
  8439. * // => false
  8440. *
  8441. * _.isObjectLike(null);
  8442. * // => false
  8443. */
  8444. function isObjectLike(value) {
  8445. return !!value && typeof value == 'object';
  8446. }
  8447. /**
  8448. * Checks if `value` is classified as a `Symbol` primitive or object.
  8449. *
  8450. * @static
  8451. * @memberOf _
  8452. * @since 4.0.0
  8453. * @category Lang
  8454. * @param {*} value The value to check.
  8455. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  8456. * @example
  8457. *
  8458. * _.isSymbol(Symbol.iterator);
  8459. * // => true
  8460. *
  8461. * _.isSymbol('abc');
  8462. * // => false
  8463. */
  8464. function isSymbol(value) {
  8465. return typeof value == 'symbol' ||
  8466. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  8467. }
  8468. /**
  8469. * Converts `value` to a string. An empty string is returned for `null`
  8470. * and `undefined` values. The sign of `-0` is preserved.
  8471. *
  8472. * @static
  8473. * @memberOf _
  8474. * @since 4.0.0
  8475. * @category Lang
  8476. * @param {*} value The value to process.
  8477. * @returns {string} Returns the string.
  8478. * @example
  8479. *
  8480. * _.toString(null);
  8481. * // => ''
  8482. *
  8483. * _.toString(-0);
  8484. * // => '-0'
  8485. *
  8486. * _.toString([1, 2, 3]);
  8487. * // => '1,2,3'
  8488. */
  8489. function toString$1(value) {
  8490. return value == null ? '' : baseToString(value);
  8491. }
  8492. /**
  8493. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  8494. *
  8495. * @static
  8496. * @memberOf _
  8497. * @since 3.0.0
  8498. * @category String
  8499. * @param {string} [string=''] The string to convert.
  8500. * @returns {string} Returns the camel cased string.
  8501. * @example
  8502. *
  8503. * _.camelCase('Foo Bar');
  8504. * // => 'fooBar'
  8505. *
  8506. * _.camelCase('--foo-bar--');
  8507. * // => 'fooBar'
  8508. *
  8509. * _.camelCase('__FOO_BAR__');
  8510. * // => 'fooBar'
  8511. */
  8512. var camelCase = createCompounder(function(result, word, index) {
  8513. word = word.toLowerCase();
  8514. return result + (index ? capitalize(word) : word);
  8515. });
  8516. /**
  8517. * Converts the first character of `string` to upper case and the remaining
  8518. * to lower case.
  8519. *
  8520. * @static
  8521. * @memberOf _
  8522. * @since 3.0.0
  8523. * @category String
  8524. * @param {string} [string=''] The string to capitalize.
  8525. * @returns {string} Returns the capitalized string.
  8526. * @example
  8527. *
  8528. * _.capitalize('FRED');
  8529. * // => 'Fred'
  8530. */
  8531. function capitalize(string) {
  8532. return upperFirst(toString$1(string).toLowerCase());
  8533. }
  8534. /**
  8535. * Deburrs `string` by converting
  8536. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  8537. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  8538. * letters to basic Latin letters and removing
  8539. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  8540. *
  8541. * @static
  8542. * @memberOf _
  8543. * @since 3.0.0
  8544. * @category String
  8545. * @param {string} [string=''] The string to deburr.
  8546. * @returns {string} Returns the deburred string.
  8547. * @example
  8548. *
  8549. * _.deburr('déjà vu');
  8550. * // => 'deja vu'
  8551. */
  8552. function deburr(string) {
  8553. string = toString$1(string);
  8554. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  8555. }
  8556. /**
  8557. * Converts the first character of `string` to upper case.
  8558. *
  8559. * @static
  8560. * @memberOf _
  8561. * @since 4.0.0
  8562. * @category String
  8563. * @param {string} [string=''] The string to convert.
  8564. * @returns {string} Returns the converted string.
  8565. * @example
  8566. *
  8567. * _.upperFirst('fred');
  8568. * // => 'Fred'
  8569. *
  8570. * _.upperFirst('FRED');
  8571. * // => 'FRED'
  8572. */
  8573. var upperFirst = createCaseFirst('toUpperCase');
  8574. /**
  8575. * Splits `string` into an array of its words.
  8576. *
  8577. * @static
  8578. * @memberOf _
  8579. * @since 3.0.0
  8580. * @category String
  8581. * @param {string} [string=''] The string to inspect.
  8582. * @param {RegExp|string} [pattern] The pattern to match words.
  8583. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8584. * @returns {Array} Returns the words of `string`.
  8585. * @example
  8586. *
  8587. * _.words('fred, barney, & pebbles');
  8588. * // => ['fred', 'barney', 'pebbles']
  8589. *
  8590. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  8591. * // => ['fred', 'barney', '&', 'pebbles']
  8592. */
  8593. function words(string, pattern, guard) {
  8594. string = toString$1(string);
  8595. pattern = guard ? undefined : pattern;
  8596. if (pattern === undefined) {
  8597. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  8598. }
  8599. return string.match(pattern) || [];
  8600. }
  8601. var lodash_camelcase = camelCase;
  8602. var unicode = createCommonjsModule(function (module, exports) {
  8603. 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]/;
  8604. });
  8605. 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)}
  8606. var util$1 = /*#__PURE__*/Object.defineProperty({
  8607. isSpaceSeparator: isSpaceSeparator_1,
  8608. isIdStartChar: isIdStartChar_1,
  8609. isIdContinueChar: isIdContinueChar_1,
  8610. isDigit: isDigit_1,
  8611. isHexDigit: isHexDigit_1
  8612. }, '__esModule', {value: true});
  8613. var parse_1 = createCommonjsModule(function (module, exports) {
  8614. 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'];
  8615. });
  8616. var stringify_1 = createCommonjsModule(function (module, exports) {
  8617. 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'];
  8618. });
  8619. var lib = createCommonjsModule(function (module, exports) {
  8620. 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'];
  8621. });
  8622. const specialValues = {
  8623. null: null,
  8624. true: true,
  8625. false: false,
  8626. };
  8627. function parseQuery(query) {
  8628. if (query.substr(0, 1) !== '?') {
  8629. throw new Error(
  8630. "A valid query string passed to parseQuery should begin with '?'"
  8631. );
  8632. }
  8633. query = query.substr(1);
  8634. if (!query) {
  8635. return {};
  8636. }
  8637. if (query.substr(0, 1) === '{' && query.substr(-1) === '}') {
  8638. return lib.parse(query);
  8639. }
  8640. const queryArgs = query.split(/[,&]/g);
  8641. const result = {};
  8642. queryArgs.forEach((arg) => {
  8643. const idx = arg.indexOf('=');
  8644. if (idx >= 0) {
  8645. let name = arg.substr(0, idx);
  8646. let value = decodeURIComponent(arg.substr(idx + 1));
  8647. if (specialValues.hasOwnProperty(value)) {
  8648. value = specialValues[value];
  8649. }
  8650. if (name.substr(-2) === '[]') {
  8651. name = decodeURIComponent(name.substr(0, name.length - 2));
  8652. if (!Array.isArray(result[name])) {
  8653. result[name] = [];
  8654. }
  8655. result[name].push(value);
  8656. } else {
  8657. name = decodeURIComponent(name);
  8658. result[name] = value;
  8659. }
  8660. } else {
  8661. if (arg.substr(0, 1) === '-') {
  8662. result[decodeURIComponent(arg.substr(1))] = false;
  8663. } else if (arg.substr(0, 1) === '+') {
  8664. result[decodeURIComponent(arg.substr(1))] = true;
  8665. } else {
  8666. result[decodeURIComponent(arg)] = true;
  8667. }
  8668. }
  8669. });
  8670. return result;
  8671. }
  8672. var parseQuery_1 = parseQuery;
  8673. function getOptions(loaderContext) {
  8674. const query = loaderContext.query;
  8675. if (typeof query === 'string' && query !== '') {
  8676. return parseQuery_1(loaderContext.query);
  8677. }
  8678. if (!query || typeof query !== 'object') {
  8679. // Not object-like queries are not supported.
  8680. return null;
  8681. }
  8682. return query;
  8683. }
  8684. var getOptions_1 = getOptions;
  8685. const matchRelativePath = /^\.\.?[/\\]/;
  8686. function isAbsolutePath(str) {
  8687. return path__default.posix.isAbsolute(str) || path__default.win32.isAbsolute(str);
  8688. }
  8689. function isRelativePath(str) {
  8690. return matchRelativePath.test(str);
  8691. }
  8692. function stringifyRequest(loaderContext, request) {
  8693. const splitted = request.split('!');
  8694. const context =
  8695. loaderContext.context ||
  8696. (loaderContext.options && loaderContext.options.context);
  8697. return JSON.stringify(
  8698. splitted
  8699. .map((part) => {
  8700. // First, separate singlePath from query, because the query might contain paths again
  8701. const splittedPart = part.match(/^(.*?)(\?.*)/);
  8702. const query = splittedPart ? splittedPart[2] : '';
  8703. let singlePath = splittedPart ? splittedPart[1] : part;
  8704. if (isAbsolutePath(singlePath) && context) {
  8705. singlePath = path__default.relative(context, singlePath);
  8706. if (isAbsolutePath(singlePath)) {
  8707. // If singlePath still matches an absolute path, singlePath was on a different drive than context.
  8708. // In this case, we leave the path platform-specific without replacing any separators.
  8709. // @see https://github.com/webpack/loader-utils/pull/14
  8710. return singlePath + query;
  8711. }
  8712. if (isRelativePath(singlePath) === false) {
  8713. // Ensure that the relative path starts at least with ./ otherwise it would be a request into the modules directory (like node_modules).
  8714. singlePath = './' + singlePath;
  8715. }
  8716. }
  8717. return singlePath.replace(/\\/g, '/') + query;
  8718. })
  8719. .join('!')
  8720. );
  8721. }
  8722. var stringifyRequest_1 = stringifyRequest;
  8723. function getRemainingRequest(loaderContext) {
  8724. if (loaderContext.remainingRequest) {
  8725. return loaderContext.remainingRequest;
  8726. }
  8727. const request = loaderContext.loaders
  8728. .slice(loaderContext.loaderIndex + 1)
  8729. .map((obj) => obj.request)
  8730. .concat([loaderContext.resource]);
  8731. return request.join('!');
  8732. }
  8733. var getRemainingRequest_1 = getRemainingRequest;
  8734. function getCurrentRequest(loaderContext) {
  8735. if (loaderContext.currentRequest) {
  8736. return loaderContext.currentRequest;
  8737. }
  8738. const request = loaderContext.loaders
  8739. .slice(loaderContext.loaderIndex)
  8740. .map((obj) => obj.request)
  8741. .concat([loaderContext.resource]);
  8742. return request.join('!');
  8743. }
  8744. var getCurrentRequest_1 = getCurrentRequest;
  8745. function isUrlRequest(url, root) {
  8746. // An URL is not an request if
  8747. // 1. It's an absolute url and it is not `windows` path like `C:\dir\file`
  8748. if (/^[a-z][a-z0-9+.-]*:/i.test(url) && !path__default.win32.isAbsolute(url)) {
  8749. return false;
  8750. }
  8751. // 2. It's a protocol-relative
  8752. if (/^\/\//.test(url)) {
  8753. return false;
  8754. }
  8755. // 3. It's some kind of url for a template
  8756. if (/^[{}[\]#*;,'§$%&(=?`´^°<>]/.test(url)) {
  8757. return false;
  8758. }
  8759. // 4. It's also not an request if root isn't set and it's a root-relative url
  8760. if ((root === undefined || root === false) && /^\//.test(url)) {
  8761. return false;
  8762. }
  8763. return true;
  8764. }
  8765. var isUrlRequest_1 = isUrlRequest;
  8766. // we can't use path.win32.isAbsolute because it also matches paths starting with a forward slash
  8767. const matchNativeWin32Path = /^[A-Z]:[/\\]|^\\\\/i;
  8768. function urlToRequest(url, root) {
  8769. // Do not rewrite an empty url
  8770. if (url === '') {
  8771. return '';
  8772. }
  8773. const moduleRequestRegex = /^[^?]*~/;
  8774. let request;
  8775. if (matchNativeWin32Path.test(url)) {
  8776. // absolute windows path, keep it
  8777. request = url;
  8778. } else if (root !== undefined && root !== false && /^\//.test(url)) {
  8779. // if root is set and the url is root-relative
  8780. switch (typeof root) {
  8781. // 1. root is a string: root is prefixed to the url
  8782. case 'string':
  8783. // special case: `~` roots convert to module request
  8784. if (moduleRequestRegex.test(root)) {
  8785. request = root.replace(/([^~/])$/, '$1/') + url.slice(1);
  8786. } else {
  8787. request = root + url;
  8788. }
  8789. break;
  8790. // 2. root is `true`: absolute paths are allowed
  8791. // *nix only, windows-style absolute paths are always allowed as they doesn't start with a `/`
  8792. case 'boolean':
  8793. request = url;
  8794. break;
  8795. default:
  8796. throw new Error(
  8797. "Unexpected parameters to loader-utils 'urlToRequest': url = " +
  8798. url +
  8799. ', root = ' +
  8800. root +
  8801. '.'
  8802. );
  8803. }
  8804. } else if (/^\.\.?\//.test(url)) {
  8805. // A relative url stays
  8806. request = url;
  8807. } else {
  8808. // every other url is threaded like a relative url
  8809. request = './' + url;
  8810. }
  8811. // A `~` makes the url an module
  8812. if (moduleRequestRegex.test(request)) {
  8813. request = request.replace(moduleRequestRegex, '');
  8814. }
  8815. return request;
  8816. }
  8817. var urlToRequest_1 = urlToRequest;
  8818. function parseString(str) {
  8819. try {
  8820. if (str[0] === '"') {
  8821. return JSON.parse(str);
  8822. }
  8823. if (str[0] === "'" && str.substr(str.length - 1) === "'") {
  8824. return parseString(
  8825. str
  8826. .replace(/\\.|"/g, (x) => (x === '"' ? '\\"' : x))
  8827. .replace(/^'|'$/g, '"')
  8828. );
  8829. }
  8830. return JSON.parse('"' + str + '"');
  8831. } catch (e) {
  8832. return str;
  8833. }
  8834. }
  8835. var parseString_1 = parseString;
  8836. /*
  8837. * big.js v5.2.2
  8838. * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
  8839. * Copyright (c) 2018 Michael Mclaughlin <M8ch88l@gmail.com>
  8840. * https://github.com/MikeMcl/big.js/LICENCE
  8841. */
  8842. /************************************** EDITABLE DEFAULTS *****************************************/
  8843. // The default values below must be integers within the stated ranges.
  8844. /*
  8845. * The maximum number of decimal places (DP) of the results of operations involving division:
  8846. * div and sqrt, and pow with negative exponents.
  8847. */
  8848. var DP = 20, // 0 to MAX_DP
  8849. /*
  8850. * The rounding mode (RM) used when rounding to the above decimal places.
  8851. *
  8852. * 0 Towards zero (i.e. truncate, no rounding). (ROUND_DOWN)
  8853. * 1 To nearest neighbour. If equidistant, round up. (ROUND_HALF_UP)
  8854. * 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN)
  8855. * 3 Away from zero. (ROUND_UP)
  8856. */
  8857. RM = 1, // 0, 1, 2 or 3
  8858. // The maximum value of DP and Big.DP.
  8859. MAX_DP = 1E6, // 0 to 1000000
  8860. // The maximum magnitude of the exponent argument to the pow method.
  8861. MAX_POWER = 1E6, // 1 to 1000000
  8862. /*
  8863. * The negative exponent (NE) at and beneath which toString returns exponential notation.
  8864. * (JavaScript numbers: -7)
  8865. * -1000000 is the minimum recommended exponent value of a Big.
  8866. */
  8867. NE = -7, // 0 to -1000000
  8868. /*
  8869. * The positive exponent (PE) at and above which toString returns exponential notation.
  8870. * (JavaScript numbers: 21)
  8871. * 1000000 is the maximum recommended exponent value of a Big.
  8872. * (This limit is not enforced or checked.)
  8873. */
  8874. PE = 21, // 0 to 1000000
  8875. /**************************************************************************************************/
  8876. // Error messages.
  8877. NAME = '[big.js] ',
  8878. INVALID = NAME + 'Invalid ',
  8879. INVALID_DP = INVALID + 'decimal places',
  8880. INVALID_RM = INVALID + 'rounding mode',
  8881. DIV_BY_ZERO = NAME + 'Division by zero',
  8882. // The shared prototype object.
  8883. P = {},
  8884. UNDEFINED = void 0,
  8885. NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
  8886. /*
  8887. * Create and return a Big constructor.
  8888. *
  8889. */
  8890. function _Big_() {
  8891. /*
  8892. * The Big constructor and exported function.
  8893. * Create and return a new instance of a Big number object.
  8894. *
  8895. * n {number|string|Big} A numeric value.
  8896. */
  8897. function Big(n) {
  8898. var x = this;
  8899. // Enable constructor usage without new.
  8900. if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n);
  8901. // Duplicate.
  8902. if (n instanceof Big) {
  8903. x.s = n.s;
  8904. x.e = n.e;
  8905. x.c = n.c.slice();
  8906. } else {
  8907. parse$1(x, n);
  8908. }
  8909. /*
  8910. * Retain a reference to this Big constructor, and shadow Big.prototype.constructor which
  8911. * points to Object.
  8912. */
  8913. x.constructor = Big;
  8914. }
  8915. Big.prototype = P;
  8916. Big.DP = DP;
  8917. Big.RM = RM;
  8918. Big.NE = NE;
  8919. Big.PE = PE;
  8920. Big.version = '5.2.2';
  8921. return Big;
  8922. }
  8923. /*
  8924. * Parse the number or string value passed to a Big constructor.
  8925. *
  8926. * x {Big} A Big number instance.
  8927. * n {number|string} A numeric value.
  8928. */
  8929. function parse$1(x, n) {
  8930. var e, i, nl;
  8931. // Minus zero?
  8932. if (n === 0 && 1 / n < 0) n = '-0';
  8933. else if (!NUMERIC.test(n += '')) throw Error(INVALID + 'number');
  8934. // Determine sign.
  8935. x.s = n.charAt(0) == '-' ? (n = n.slice(1), -1) : 1;
  8936. // Decimal point?
  8937. if ((e = n.indexOf('.')) > -1) n = n.replace('.', '');
  8938. // Exponential form?
  8939. if ((i = n.search(/e/i)) > 0) {
  8940. // Determine exponent.
  8941. if (e < 0) e = i;
  8942. e += +n.slice(i + 1);
  8943. n = n.substring(0, i);
  8944. } else if (e < 0) {
  8945. // Integer.
  8946. e = n.length;
  8947. }
  8948. nl = n.length;
  8949. // Determine leading zeros.
  8950. for (i = 0; i < nl && n.charAt(i) == '0';) ++i;
  8951. if (i == nl) {
  8952. // Zero.
  8953. x.c = [x.e = 0];
  8954. } else {
  8955. // Determine trailing zeros.
  8956. for (; nl > 0 && n.charAt(--nl) == '0';);
  8957. x.e = e - i - 1;
  8958. x.c = [];
  8959. // Convert string to array of digits without leading/trailing zeros.
  8960. for (e = 0; i <= nl;) x.c[e++] = +n.charAt(i++);
  8961. }
  8962. return x;
  8963. }
  8964. /*
  8965. * Round Big x to a maximum of dp decimal places using rounding mode rm.
  8966. * Called by stringify, P.div, P.round and P.sqrt.
  8967. *
  8968. * x {Big} The Big to round.
  8969. * dp {number} Integer, 0 to MAX_DP inclusive.
  8970. * rm {number} 0, 1, 2 or 3 (DOWN, HALF_UP, HALF_EVEN, UP)
  8971. * [more] {boolean} Whether the result of division was truncated.
  8972. */
  8973. function round(x, dp, rm, more) {
  8974. var xc = x.c,
  8975. i = x.e + dp + 1;
  8976. if (i < xc.length) {
  8977. if (rm === 1) {
  8978. // xc[i] is the digit after the digit that may be rounded up.
  8979. more = xc[i] >= 5;
  8980. } else if (rm === 2) {
  8981. more = xc[i] > 5 || xc[i] == 5 &&
  8982. (more || i < 0 || xc[i + 1] !== UNDEFINED || xc[i - 1] & 1);
  8983. } else if (rm === 3) {
  8984. more = more || !!xc[0];
  8985. } else {
  8986. more = false;
  8987. if (rm !== 0) throw Error(INVALID_RM);
  8988. }
  8989. if (i < 1) {
  8990. xc.length = 1;
  8991. if (more) {
  8992. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  8993. x.e = -dp;
  8994. xc[0] = 1;
  8995. } else {
  8996. // Zero.
  8997. xc[0] = x.e = 0;
  8998. }
  8999. } else {
  9000. // Remove any digits after the required decimal places.
  9001. xc.length = i--;
  9002. // Round up?
  9003. if (more) {
  9004. // Rounding up may mean the previous digit has to be rounded up.
  9005. for (; ++xc[i] > 9;) {
  9006. xc[i] = 0;
  9007. if (!i--) {
  9008. ++x.e;
  9009. xc.unshift(1);
  9010. }
  9011. }
  9012. }
  9013. // Remove trailing zeros.
  9014. for (i = xc.length; !xc[--i];) xc.pop();
  9015. }
  9016. } else if (rm < 0 || rm > 3 || rm !== ~~rm) {
  9017. throw Error(INVALID_RM);
  9018. }
  9019. return x;
  9020. }
  9021. /*
  9022. * Return a string representing the value of Big x in normal or exponential notation.
  9023. * Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
  9024. *
  9025. * x {Big}
  9026. * id? {number} Caller id.
  9027. * 1 toExponential
  9028. * 2 toFixed
  9029. * 3 toPrecision
  9030. * 4 valueOf
  9031. * n? {number|undefined} Caller's argument.
  9032. * k? {number|undefined}
  9033. */
  9034. function stringify(x, id, n, k) {
  9035. var e, s,
  9036. Big = x.constructor,
  9037. z = !x.c[0];
  9038. if (n !== UNDEFINED) {
  9039. if (n !== ~~n || n < (id == 3) || n > MAX_DP) {
  9040. throw Error(id == 3 ? INVALID + 'precision' : INVALID_DP);
  9041. }
  9042. x = new Big(x);
  9043. // The index of the digit that may be rounded up.
  9044. n = k - x.e;
  9045. // Round?
  9046. if (x.c.length > ++k) round(x, n, Big.RM);
  9047. // toFixed: recalculate k as x.e may have changed if value rounded up.
  9048. if (id == 2) k = x.e + n + 1;
  9049. // Append zeros?
  9050. for (; x.c.length < k;) x.c.push(0);
  9051. }
  9052. e = x.e;
  9053. s = x.c.join('');
  9054. n = s.length;
  9055. // Exponential notation?
  9056. if (id != 2 && (id == 1 || id == 3 && k <= e || e <= Big.NE || e >= Big.PE)) {
  9057. s = s.charAt(0) + (n > 1 ? '.' + s.slice(1) : '') + (e < 0 ? 'e' : 'e+') + e;
  9058. // Normal notation.
  9059. } else if (e < 0) {
  9060. for (; ++e;) s = '0' + s;
  9061. s = '0.' + s;
  9062. } else if (e > 0) {
  9063. if (++e > n) for (e -= n; e--;) s += '0';
  9064. else if (e < n) s = s.slice(0, e) + '.' + s.slice(e);
  9065. } else if (n > 1) {
  9066. s = s.charAt(0) + '.' + s.slice(1);
  9067. }
  9068. return x.s < 0 && (!z || id == 4) ? '-' + s : s;
  9069. }
  9070. // Prototype/instance methods
  9071. /*
  9072. * Return a new Big whose value is the absolute value of this Big.
  9073. */
  9074. P.abs = function () {
  9075. var x = new this.constructor(this);
  9076. x.s = 1;
  9077. return x;
  9078. };
  9079. /*
  9080. * Return 1 if the value of this Big is greater than the value of Big y,
  9081. * -1 if the value of this Big is less than the value of Big y, or
  9082. * 0 if they have the same value.
  9083. */
  9084. P.cmp = function (y) {
  9085. var isneg,
  9086. x = this,
  9087. xc = x.c,
  9088. yc = (y = new x.constructor(y)).c,
  9089. i = x.s,
  9090. j = y.s,
  9091. k = x.e,
  9092. l = y.e;
  9093. // Either zero?
  9094. if (!xc[0] || !yc[0]) return !xc[0] ? !yc[0] ? 0 : -j : i;
  9095. // Signs differ?
  9096. if (i != j) return i;
  9097. isneg = i < 0;
  9098. // Compare exponents.
  9099. if (k != l) return k > l ^ isneg ? 1 : -1;
  9100. j = (k = xc.length) < (l = yc.length) ? k : l;
  9101. // Compare digit by digit.
  9102. for (i = -1; ++i < j;) {
  9103. if (xc[i] != yc[i]) return xc[i] > yc[i] ^ isneg ? 1 : -1;
  9104. }
  9105. // Compare lengths.
  9106. return k == l ? 0 : k > l ^ isneg ? 1 : -1;
  9107. };
  9108. /*
  9109. * Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,
  9110. * if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
  9111. */
  9112. P.div = function (y) {
  9113. var x = this,
  9114. Big = x.constructor,
  9115. a = x.c, // dividend
  9116. b = (y = new Big(y)).c, // divisor
  9117. k = x.s == y.s ? 1 : -1,
  9118. dp = Big.DP;
  9119. if (dp !== ~~dp || dp < 0 || dp > MAX_DP) throw Error(INVALID_DP);
  9120. // Divisor is zero?
  9121. if (!b[0]) throw Error(DIV_BY_ZERO);
  9122. // Dividend is 0? Return +-0.
  9123. if (!a[0]) return new Big(k * 0);
  9124. var bl, bt, n, cmp, ri,
  9125. bz = b.slice(),
  9126. ai = bl = b.length,
  9127. al = a.length,
  9128. r = a.slice(0, bl), // remainder
  9129. rl = r.length,
  9130. q = y, // quotient
  9131. qc = q.c = [],
  9132. qi = 0,
  9133. d = dp + (q.e = x.e - y.e) + 1; // number of digits of the result
  9134. q.s = k;
  9135. k = d < 0 ? 0 : d;
  9136. // Create version of divisor with leading zero.
  9137. bz.unshift(0);
  9138. // Add zeros to make remainder as long as divisor.
  9139. for (; rl++ < bl;) r.push(0);
  9140. do {
  9141. // n is how many times the divisor goes into current remainder.
  9142. for (n = 0; n < 10; n++) {
  9143. // Compare divisor and remainder.
  9144. if (bl != (rl = r.length)) {
  9145. cmp = bl > rl ? 1 : -1;
  9146. } else {
  9147. for (ri = -1, cmp = 0; ++ri < bl;) {
  9148. if (b[ri] != r[ri]) {
  9149. cmp = b[ri] > r[ri] ? 1 : -1;
  9150. break;
  9151. }
  9152. }
  9153. }
  9154. // If divisor < remainder, subtract divisor from remainder.
  9155. if (cmp < 0) {
  9156. // Remainder can't be more than 1 digit longer than divisor.
  9157. // Equalise lengths using divisor with extra leading zero?
  9158. for (bt = rl == bl ? b : bz; rl;) {
  9159. if (r[--rl] < bt[rl]) {
  9160. ri = rl;
  9161. for (; ri && !r[--ri];) r[ri] = 9;
  9162. --r[ri];
  9163. r[rl] += 10;
  9164. }
  9165. r[rl] -= bt[rl];
  9166. }
  9167. for (; !r[0];) r.shift();
  9168. } else {
  9169. break;
  9170. }
  9171. }
  9172. // Add the digit n to the result array.
  9173. qc[qi++] = cmp ? n : ++n;
  9174. // Update the remainder.
  9175. if (r[0] && cmp) r[rl] = a[ai] || 0;
  9176. else r = [a[ai]];
  9177. } while ((ai++ < al || r[0] !== UNDEFINED) && k--);
  9178. // Leading zero? Do not remove if result is simply zero (qi == 1).
  9179. if (!qc[0] && qi != 1) {
  9180. // There can't be more than one zero.
  9181. qc.shift();
  9182. q.e--;
  9183. }
  9184. // Round?
  9185. if (qi > d) round(q, dp, Big.RM, r[0] !== UNDEFINED);
  9186. return q;
  9187. };
  9188. /*
  9189. * Return true if the value of this Big is equal to the value of Big y, otherwise return false.
  9190. */
  9191. P.eq = function (y) {
  9192. return !this.cmp(y);
  9193. };
  9194. /*
  9195. * Return true if the value of this Big is greater than the value of Big y, otherwise return
  9196. * false.
  9197. */
  9198. P.gt = function (y) {
  9199. return this.cmp(y) > 0;
  9200. };
  9201. /*
  9202. * Return true if the value of this Big is greater than or equal to the value of Big y, otherwise
  9203. * return false.
  9204. */
  9205. P.gte = function (y) {
  9206. return this.cmp(y) > -1;
  9207. };
  9208. /*
  9209. * Return true if the value of this Big is less than the value of Big y, otherwise return false.
  9210. */
  9211. P.lt = function (y) {
  9212. return this.cmp(y) < 0;
  9213. };
  9214. /*
  9215. * Return true if the value of this Big is less than or equal to the value of Big y, otherwise
  9216. * return false.
  9217. */
  9218. P.lte = function (y) {
  9219. return this.cmp(y) < 1;
  9220. };
  9221. /*
  9222. * Return a new Big whose value is the value of this Big minus the value of Big y.
  9223. */
  9224. P.minus = P.sub = function (y) {
  9225. var i, j, t, xlty,
  9226. x = this,
  9227. Big = x.constructor,
  9228. a = x.s,
  9229. b = (y = new Big(y)).s;
  9230. // Signs differ?
  9231. if (a != b) {
  9232. y.s = -b;
  9233. return x.plus(y);
  9234. }
  9235. var xc = x.c.slice(),
  9236. xe = x.e,
  9237. yc = y.c,
  9238. ye = y.e;
  9239. // Either zero?
  9240. if (!xc[0] || !yc[0]) {
  9241. // y is non-zero? x is non-zero? Or both are zero.
  9242. return yc[0] ? (y.s = -b, y) : new Big(xc[0] ? x : 0);
  9243. }
  9244. // Determine which is the bigger number. Prepend zeros to equalise exponents.
  9245. if (a = xe - ye) {
  9246. if (xlty = a < 0) {
  9247. a = -a;
  9248. t = xc;
  9249. } else {
  9250. ye = xe;
  9251. t = yc;
  9252. }
  9253. t.reverse();
  9254. for (b = a; b--;) t.push(0);
  9255. t.reverse();
  9256. } else {
  9257. // Exponents equal. Check digit by digit.
  9258. j = ((xlty = xc.length < yc.length) ? xc : yc).length;
  9259. for (a = b = 0; b < j; b++) {
  9260. if (xc[b] != yc[b]) {
  9261. xlty = xc[b] < yc[b];
  9262. break;
  9263. }
  9264. }
  9265. }
  9266. // x < y? Point xc to the array of the bigger number.
  9267. if (xlty) {
  9268. t = xc;
  9269. xc = yc;
  9270. yc = t;
  9271. y.s = -y.s;
  9272. }
  9273. /*
  9274. * Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only
  9275. * needs to start at yc.length.
  9276. */
  9277. if ((b = (j = yc.length) - (i = xc.length)) > 0) for (; b--;) xc[i++] = 0;
  9278. // Subtract yc from xc.
  9279. for (b = i; j > a;) {
  9280. if (xc[--j] < yc[j]) {
  9281. for (i = j; i && !xc[--i];) xc[i] = 9;
  9282. --xc[i];
  9283. xc[j] += 10;
  9284. }
  9285. xc[j] -= yc[j];
  9286. }
  9287. // Remove trailing zeros.
  9288. for (; xc[--b] === 0;) xc.pop();
  9289. // Remove leading zeros and adjust exponent accordingly.
  9290. for (; xc[0] === 0;) {
  9291. xc.shift();
  9292. --ye;
  9293. }
  9294. if (!xc[0]) {
  9295. // n - n = +0
  9296. y.s = 1;
  9297. // Result must be zero.
  9298. xc = [ye = 0];
  9299. }
  9300. y.c = xc;
  9301. y.e = ye;
  9302. return y;
  9303. };
  9304. /*
  9305. * Return a new Big whose value is the value of this Big modulo the value of Big y.
  9306. */
  9307. P.mod = function (y) {
  9308. var ygtx,
  9309. x = this,
  9310. Big = x.constructor,
  9311. a = x.s,
  9312. b = (y = new Big(y)).s;
  9313. if (!y.c[0]) throw Error(DIV_BY_ZERO);
  9314. x.s = y.s = 1;
  9315. ygtx = y.cmp(x) == 1;
  9316. x.s = a;
  9317. y.s = b;
  9318. if (ygtx) return new Big(x);
  9319. a = Big.DP;
  9320. b = Big.RM;
  9321. Big.DP = Big.RM = 0;
  9322. x = x.div(y);
  9323. Big.DP = a;
  9324. Big.RM = b;
  9325. return this.minus(x.times(y));
  9326. };
  9327. /*
  9328. * Return a new Big whose value is the value of this Big plus the value of Big y.
  9329. */
  9330. P.plus = P.add = function (y) {
  9331. var t,
  9332. x = this,
  9333. Big = x.constructor,
  9334. a = x.s,
  9335. b = (y = new Big(y)).s;
  9336. // Signs differ?
  9337. if (a != b) {
  9338. y.s = -b;
  9339. return x.minus(y);
  9340. }
  9341. var xe = x.e,
  9342. xc = x.c,
  9343. ye = y.e,
  9344. yc = y.c;
  9345. // Either zero? y is non-zero? x is non-zero? Or both are zero.
  9346. if (!xc[0] || !yc[0]) return yc[0] ? y : new Big(xc[0] ? x : a * 0);
  9347. xc = xc.slice();
  9348. // Prepend zeros to equalise exponents.
  9349. // Note: reverse faster than unshifts.
  9350. if (a = xe - ye) {
  9351. if (a > 0) {
  9352. ye = xe;
  9353. t = yc;
  9354. } else {
  9355. a = -a;
  9356. t = xc;
  9357. }
  9358. t.reverse();
  9359. for (; a--;) t.push(0);
  9360. t.reverse();
  9361. }
  9362. // Point xc to the longer array.
  9363. if (xc.length - yc.length < 0) {
  9364. t = yc;
  9365. yc = xc;
  9366. xc = t;
  9367. }
  9368. a = yc.length;
  9369. // Only start adding at yc.length - 1 as the further digits of xc can be left as they are.
  9370. for (b = 0; a; xc[a] %= 10) b = (xc[--a] = xc[a] + yc[a] + b) / 10 | 0;
  9371. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  9372. if (b) {
  9373. xc.unshift(b);
  9374. ++ye;
  9375. }
  9376. // Remove trailing zeros.
  9377. for (a = xc.length; xc[--a] === 0;) xc.pop();
  9378. y.c = xc;
  9379. y.e = ye;
  9380. return y;
  9381. };
  9382. /*
  9383. * Return a Big whose value is the value of this Big raised to the power n.
  9384. * If n is negative, round to a maximum of Big.DP decimal places using rounding
  9385. * mode Big.RM.
  9386. *
  9387. * n {number} Integer, -MAX_POWER to MAX_POWER inclusive.
  9388. */
  9389. P.pow = function (n) {
  9390. var x = this,
  9391. one = new x.constructor(1),
  9392. y = one,
  9393. isneg = n < 0;
  9394. if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) throw Error(INVALID + 'exponent');
  9395. if (isneg) n = -n;
  9396. for (;;) {
  9397. if (n & 1) y = y.times(x);
  9398. n >>= 1;
  9399. if (!n) break;
  9400. x = x.times(x);
  9401. }
  9402. return isneg ? one.div(y) : y;
  9403. };
  9404. /*
  9405. * Return a new Big whose value is the value of this Big rounded using rounding mode rm
  9406. * to a maximum of dp decimal places, or, if dp is negative, to an integer which is a
  9407. * multiple of 10**-dp.
  9408. * If dp is not specified, round to 0 decimal places.
  9409. * If rm is not specified, use Big.RM.
  9410. *
  9411. * dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
  9412. * rm? 0, 1, 2 or 3 (ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP)
  9413. */
  9414. P.round = function (dp, rm) {
  9415. var Big = this.constructor;
  9416. if (dp === UNDEFINED) dp = 0;
  9417. else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) throw Error(INVALID_DP);
  9418. return round(new Big(this), dp, rm === UNDEFINED ? Big.RM : rm);
  9419. };
  9420. /*
  9421. * Return a new Big whose value is the square root of the value of this Big, rounded, if
  9422. * necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
  9423. */
  9424. P.sqrt = function () {
  9425. var r, c, t,
  9426. x = this,
  9427. Big = x.constructor,
  9428. s = x.s,
  9429. e = x.e,
  9430. half = new Big(0.5);
  9431. // Zero?
  9432. if (!x.c[0]) return new Big(x);
  9433. // Negative?
  9434. if (s < 0) throw Error(NAME + 'No square root');
  9435. // Estimate.
  9436. s = Math.sqrt(x + '');
  9437. // Math.sqrt underflow/overflow?
  9438. // Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
  9439. if (s === 0 || s === 1 / 0) {
  9440. c = x.c.join('');
  9441. if (!(c.length + e & 1)) c += '0';
  9442. s = Math.sqrt(c);
  9443. e = ((e + 1) / 2 | 0) - (e < 0 || e & 1);
  9444. r = new Big((s == 1 / 0 ? '1e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e);
  9445. } else {
  9446. r = new Big(s);
  9447. }
  9448. e = r.e + (Big.DP += 4);
  9449. // Newton-Raphson iteration.
  9450. do {
  9451. t = r;
  9452. r = half.times(t.plus(x.div(t)));
  9453. } while (t.c.slice(0, e).join('') !== r.c.slice(0, e).join(''));
  9454. return round(r, Big.DP -= 4, Big.RM);
  9455. };
  9456. /*
  9457. * Return a new Big whose value is the value of this Big times the value of Big y.
  9458. */
  9459. P.times = P.mul = function (y) {
  9460. var c,
  9461. x = this,
  9462. Big = x.constructor,
  9463. xc = x.c,
  9464. yc = (y = new Big(y)).c,
  9465. a = xc.length,
  9466. b = yc.length,
  9467. i = x.e,
  9468. j = y.e;
  9469. // Determine sign of result.
  9470. y.s = x.s == y.s ? 1 : -1;
  9471. // Return signed 0 if either 0.
  9472. if (!xc[0] || !yc[0]) return new Big(y.s * 0);
  9473. // Initialise exponent of result as x.e + y.e.
  9474. y.e = i + j;
  9475. // If array xc has fewer digits than yc, swap xc and yc, and lengths.
  9476. if (a < b) {
  9477. c = xc;
  9478. xc = yc;
  9479. yc = c;
  9480. j = a;
  9481. a = b;
  9482. b = j;
  9483. }
  9484. // Initialise coefficient array of result with zeros.
  9485. for (c = new Array(j = a + b); j--;) c[j] = 0;
  9486. // Multiply.
  9487. // i is initially xc.length.
  9488. for (i = b; i--;) {
  9489. b = 0;
  9490. // a is yc.length.
  9491. for (j = a + i; j > i;) {
  9492. // Current sum of products at this digit position, plus carry.
  9493. b = c[j] + yc[i] * xc[j - i - 1] + b;
  9494. c[j--] = b % 10;
  9495. // carry
  9496. b = b / 10 | 0;
  9497. }
  9498. c[j] = (c[j] + b) % 10;
  9499. }
  9500. // Increment result exponent if there is a final carry, otherwise remove leading zero.
  9501. if (b) ++y.e;
  9502. else c.shift();
  9503. // Remove trailing zeros.
  9504. for (i = c.length; !c[--i];) c.pop();
  9505. y.c = c;
  9506. return y;
  9507. };
  9508. /*
  9509. * Return a string representing the value of this Big in exponential notation to dp fixed decimal
  9510. * places and rounded using Big.RM.
  9511. *
  9512. * dp? {number} Integer, 0 to MAX_DP inclusive.
  9513. */
  9514. P.toExponential = function (dp) {
  9515. return stringify(this, 1, dp, dp);
  9516. };
  9517. /*
  9518. * Return a string representing the value of this Big in normal notation to dp fixed decimal
  9519. * places and rounded using Big.RM.
  9520. *
  9521. * dp? {number} Integer, 0 to MAX_DP inclusive.
  9522. *
  9523. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  9524. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  9525. */
  9526. P.toFixed = function (dp) {
  9527. return stringify(this, 2, dp, this.e + dp);
  9528. };
  9529. /*
  9530. * Return a string representing the value of this Big rounded to sd significant digits using
  9531. * Big.RM. Use exponential notation if sd is less than the number of digits necessary to represent
  9532. * the integer part of the value in normal notation.
  9533. *
  9534. * sd {number} Integer, 1 to MAX_DP inclusive.
  9535. */
  9536. P.toPrecision = function (sd) {
  9537. return stringify(this, 3, sd, sd - 1);
  9538. };
  9539. /*
  9540. * Return a string representing the value of this Big.
  9541. * Return exponential notation if this Big has a positive exponent equal to or greater than
  9542. * Big.PE, or a negative exponent equal to or less than Big.NE.
  9543. * Omit the sign for negative zero.
  9544. */
  9545. P.toString = function () {
  9546. return stringify(this);
  9547. };
  9548. /*
  9549. * Return a string representing the value of this Big.
  9550. * Return exponential notation if this Big has a positive exponent equal to or greater than
  9551. * Big.PE, or a negative exponent equal to or less than Big.NE.
  9552. * Include the sign for negative zero.
  9553. */
  9554. P.valueOf = P.toJSON = function () {
  9555. return stringify(this, 4);
  9556. };
  9557. // Export
  9558. var Big = _Big_();
  9559. var big = /*#__PURE__*/Object.freeze({
  9560. __proto__: null,
  9561. Big: Big,
  9562. 'default': Big
  9563. });
  9564. var require$$0 = /*@__PURE__*/getAugmentedNamespace(big);
  9565. const baseEncodeTables = {
  9566. 26: 'abcdefghijklmnopqrstuvwxyz',
  9567. 32: '123456789abcdefghjkmnpqrstuvwxyz', // no 0lio
  9568. 36: '0123456789abcdefghijklmnopqrstuvwxyz',
  9569. 49: 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no lIO
  9570. 52: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
  9571. 58: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no 0lIO
  9572. 62: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
  9573. 64: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_',
  9574. };
  9575. function encodeBufferToBase(buffer, base) {
  9576. const encodeTable = baseEncodeTables[base];
  9577. if (!encodeTable) {
  9578. throw new Error('Unknown encoding base' + base);
  9579. }
  9580. const readLength = buffer.length;
  9581. const Big = require$$0;
  9582. Big.RM = Big.DP = 0;
  9583. let b = new Big(0);
  9584. for (let i = readLength - 1; i >= 0; i--) {
  9585. b = b.times(256).plus(buffer[i]);
  9586. }
  9587. let output = '';
  9588. while (b.gt(0)) {
  9589. output = encodeTable[b.mod(base)] + output;
  9590. b = b.div(base);
  9591. }
  9592. Big.DP = 20;
  9593. Big.RM = 1;
  9594. return output;
  9595. }
  9596. function getHashDigest(buffer, hashType, digestType, maxLength) {
  9597. hashType = hashType || 'md5';
  9598. maxLength = maxLength || 9999;
  9599. const hash = require('crypto').createHash(hashType);
  9600. hash.update(buffer);
  9601. if (
  9602. digestType === 'base26' ||
  9603. digestType === 'base32' ||
  9604. digestType === 'base36' ||
  9605. digestType === 'base49' ||
  9606. digestType === 'base52' ||
  9607. digestType === 'base58' ||
  9608. digestType === 'base62' ||
  9609. digestType === 'base64'
  9610. ) {
  9611. return encodeBufferToBase(hash.digest(), digestType.substr(4)).substr(
  9612. 0,
  9613. maxLength
  9614. );
  9615. } else {
  9616. return hash.digest(digestType || 'hex').substr(0, maxLength);
  9617. }
  9618. }
  9619. var getHashDigest_1 = getHashDigest;
  9620. var emojisList = [
  9621. "🀄️",
  9622. "🃏",
  9623. "🅰️",
  9624. "🅱️",
  9625. "🅾️",
  9626. "🅿️",
  9627. "🆎",
  9628. "🆑",
  9629. "🆒",
  9630. "🆓",
  9631. "🆔",
  9632. "🆕",
  9633. "🆖",
  9634. "🆗",
  9635. "🆘",
  9636. "🆙",
  9637. "🆚",
  9638. "🇦🇨",
  9639. "🇦🇩",
  9640. "🇦🇪",
  9641. "🇦🇫",
  9642. "🇦🇬",
  9643. "🇦🇮",
  9644. "🇦🇱",
  9645. "🇦🇲",
  9646. "🇦🇴",
  9647. "🇦🇶",
  9648. "🇦🇷",
  9649. "🇦🇸",
  9650. "🇦🇹",
  9651. "🇦🇺",
  9652. "🇦🇼",
  9653. "🇦🇽",
  9654. "🇦🇿",
  9655. "🇦",
  9656. "🇧🇦",
  9657. "🇧🇧",
  9658. "🇧🇩",
  9659. "🇧🇪",
  9660. "🇧🇫",
  9661. "🇧🇬",
  9662. "🇧🇭",
  9663. "🇧🇮",
  9664. "🇧🇯",
  9665. "🇧🇱",
  9666. "🇧🇲",
  9667. "🇧🇳",
  9668. "🇧🇴",
  9669. "🇧🇶",
  9670. "🇧🇷",
  9671. "🇧🇸",
  9672. "🇧🇹",
  9673. "🇧🇻",
  9674. "🇧🇼",
  9675. "🇧🇾",
  9676. "🇧🇿",
  9677. "🇧",
  9678. "🇨🇦",
  9679. "🇨🇨",
  9680. "🇨🇩",
  9681. "🇨🇫",
  9682. "🇨🇬",
  9683. "🇨🇭",
  9684. "🇨🇮",
  9685. "🇨🇰",
  9686. "🇨🇱",
  9687. "🇨🇲",
  9688. "🇨🇳",
  9689. "🇨🇴",
  9690. "🇨🇵",
  9691. "🇨🇷",
  9692. "🇨🇺",
  9693. "🇨🇻",
  9694. "🇨🇼",
  9695. "🇨🇽",
  9696. "🇨🇾",
  9697. "🇨🇿",
  9698. "🇨",
  9699. "🇩🇪",
  9700. "🇩🇬",
  9701. "🇩🇯",
  9702. "🇩🇰",
  9703. "🇩🇲",
  9704. "🇩🇴",
  9705. "🇩🇿",
  9706. "🇩",
  9707. "🇪🇦",
  9708. "🇪🇨",
  9709. "🇪🇪",
  9710. "🇪🇬",
  9711. "🇪🇭",
  9712. "🇪🇷",
  9713. "🇪🇸",
  9714. "🇪🇹",
  9715. "🇪🇺",
  9716. "🇪",
  9717. "🇫🇮",
  9718. "🇫🇯",
  9719. "🇫🇰",
  9720. "🇫🇲",
  9721. "🇫🇴",
  9722. "🇫🇷",
  9723. "🇫",
  9724. "🇬🇦",
  9725. "🇬🇧",
  9726. "🇬🇩",
  9727. "🇬🇪",
  9728. "🇬🇫",
  9729. "🇬🇬",
  9730. "🇬🇭",
  9731. "🇬🇮",
  9732. "🇬🇱",
  9733. "🇬🇲",
  9734. "🇬🇳",
  9735. "🇬🇵",
  9736. "🇬🇶",
  9737. "🇬🇷",
  9738. "🇬🇸",
  9739. "🇬🇹",
  9740. "🇬🇺",
  9741. "🇬🇼",
  9742. "🇬🇾",
  9743. "🇬",
  9744. "🇭🇰",
  9745. "🇭🇲",
  9746. "🇭🇳",
  9747. "🇭🇷",
  9748. "🇭🇹",
  9749. "🇭🇺",
  9750. "🇭",
  9751. "🇮🇨",
  9752. "🇮🇩",
  9753. "🇮🇪",
  9754. "🇮🇱",
  9755. "🇮🇲",
  9756. "🇮🇳",
  9757. "🇮🇴",
  9758. "🇮🇶",
  9759. "🇮🇷",
  9760. "🇮🇸",
  9761. "🇮🇹",
  9762. "🇮",
  9763. "🇯🇪",
  9764. "🇯🇲",
  9765. "🇯🇴",
  9766. "🇯🇵",
  9767. "🇯",
  9768. "🇰🇪",
  9769. "🇰🇬",
  9770. "🇰🇭",
  9771. "🇰🇮",
  9772. "🇰🇲",
  9773. "🇰🇳",
  9774. "🇰🇵",
  9775. "🇰🇷",
  9776. "🇰🇼",
  9777. "🇰🇾",
  9778. "🇰🇿",
  9779. "🇰",
  9780. "🇱🇦",
  9781. "🇱🇧",
  9782. "🇱🇨",
  9783. "🇱🇮",
  9784. "🇱🇰",
  9785. "🇱🇷",
  9786. "🇱🇸",
  9787. "🇱🇹",
  9788. "🇱🇺",
  9789. "🇱🇻",
  9790. "🇱🇾",
  9791. "🇱",
  9792. "🇲🇦",
  9793. "🇲🇨",
  9794. "🇲🇩",
  9795. "🇲🇪",
  9796. "🇲🇫",
  9797. "🇲🇬",
  9798. "🇲🇭",
  9799. "🇲🇰",
  9800. "🇲🇱",
  9801. "🇲🇲",
  9802. "🇲🇳",
  9803. "🇲🇴",
  9804. "🇲🇵",
  9805. "🇲🇶",
  9806. "🇲🇷",
  9807. "🇲🇸",
  9808. "🇲🇹",
  9809. "🇲🇺",
  9810. "🇲🇻",
  9811. "🇲🇼",
  9812. "🇲🇽",
  9813. "🇲🇾",
  9814. "🇲🇿",
  9815. "🇲",
  9816. "🇳🇦",
  9817. "🇳🇨",
  9818. "🇳🇪",
  9819. "🇳🇫",
  9820. "🇳🇬",
  9821. "🇳🇮",
  9822. "🇳🇱",
  9823. "🇳🇴",
  9824. "🇳🇵",
  9825. "🇳🇷",
  9826. "🇳🇺",
  9827. "🇳🇿",
  9828. "🇳",
  9829. "🇴🇲",
  9830. "🇴",
  9831. "🇵🇦",
  9832. "🇵🇪",
  9833. "🇵🇫",
  9834. "🇵🇬",
  9835. "🇵🇭",
  9836. "🇵🇰",
  9837. "🇵🇱",
  9838. "🇵🇲",
  9839. "🇵🇳",
  9840. "🇵🇷",
  9841. "🇵🇸",
  9842. "🇵🇹",
  9843. "🇵🇼",
  9844. "🇵🇾",
  9845. "🇵",
  9846. "🇶🇦",
  9847. "🇶",
  9848. "🇷🇪",
  9849. "🇷🇴",
  9850. "🇷🇸",
  9851. "🇷🇺",
  9852. "🇷🇼",
  9853. "🇷",
  9854. "🇸🇦",
  9855. "🇸🇧",
  9856. "🇸🇨",
  9857. "🇸🇩",
  9858. "🇸🇪",
  9859. "🇸🇬",
  9860. "🇸🇭",
  9861. "🇸🇮",
  9862. "🇸🇯",
  9863. "🇸🇰",
  9864. "🇸🇱",
  9865. "🇸🇲",
  9866. "🇸🇳",
  9867. "🇸🇴",
  9868. "🇸🇷",
  9869. "🇸🇸",
  9870. "🇸🇹",
  9871. "🇸🇻",
  9872. "🇸🇽",
  9873. "🇸🇾",
  9874. "🇸🇿",
  9875. "🇸",
  9876. "🇹🇦",
  9877. "🇹🇨",
  9878. "🇹🇩",
  9879. "🇹🇫",
  9880. "🇹🇬",
  9881. "🇹🇭",
  9882. "🇹🇯",
  9883. "🇹🇰",
  9884. "🇹🇱",
  9885. "🇹🇲",
  9886. "🇹🇳",
  9887. "🇹🇴",
  9888. "🇹🇷",
  9889. "🇹🇹",
  9890. "🇹🇻",
  9891. "🇹🇼",
  9892. "🇹🇿",
  9893. "🇹",
  9894. "🇺🇦",
  9895. "🇺🇬",
  9896. "🇺🇲",
  9897. "🇺🇳",
  9898. "🇺🇸",
  9899. "🇺🇾",
  9900. "🇺🇿",
  9901. "🇺",
  9902. "🇻🇦",
  9903. "🇻🇨",
  9904. "🇻🇪",
  9905. "🇻🇬",
  9906. "🇻🇮",
  9907. "🇻🇳",
  9908. "🇻🇺",
  9909. "🇻",
  9910. "🇼🇫",
  9911. "🇼🇸",
  9912. "🇼",
  9913. "🇽🇰",
  9914. "🇽",
  9915. "🇾🇪",
  9916. "🇾🇹",
  9917. "🇾",
  9918. "🇿🇦",
  9919. "🇿🇲",
  9920. "🇿🇼",
  9921. "🇿",
  9922. "🈁",
  9923. "🈂️",
  9924. "🈚️",
  9925. "🈯️",
  9926. "🈲",
  9927. "🈳",
  9928. "🈴",
  9929. "🈵",
  9930. "🈶",
  9931. "🈷️",
  9932. "🈸",
  9933. "🈹",
  9934. "🈺",
  9935. "🉐",
  9936. "🉑",
  9937. "🌀",
  9938. "🌁",
  9939. "🌂",
  9940. "🌃",
  9941. "🌄",
  9942. "🌅",
  9943. "🌆",
  9944. "🌇",
  9945. "🌈",
  9946. "🌉",
  9947. "🌊",
  9948. "🌋",
  9949. "🌌",
  9950. "🌍",
  9951. "🌎",
  9952. "🌏",
  9953. "🌐",
  9954. "🌑",
  9955. "🌒",
  9956. "🌓",
  9957. "🌔",
  9958. "🌕",
  9959. "🌖",
  9960. "🌗",
  9961. "🌘",
  9962. "🌙",
  9963. "🌚",
  9964. "🌛",
  9965. "🌜",
  9966. "🌝",
  9967. "🌞",
  9968. "🌟",
  9969. "🌠",
  9970. "🌡️",
  9971. "🌤️",
  9972. "🌥️",
  9973. "🌦️",
  9974. "🌧️",
  9975. "🌨️",
  9976. "🌩️",
  9977. "🌪️",
  9978. "🌫️",
  9979. "🌬️",
  9980. "🌭",
  9981. "🌮",
  9982. "🌯",
  9983. "🌰",
  9984. "🌱",
  9985. "🌲",
  9986. "🌳",
  9987. "🌴",
  9988. "🌵",
  9989. "🌶️",
  9990. "🌷",
  9991. "🌸",
  9992. "🌹",
  9993. "🌺",
  9994. "🌻",
  9995. "🌼",
  9996. "🌽",
  9997. "🌾",
  9998. "🌿",
  9999. "🍀",
  10000. "🍁",
  10001. "🍂",
  10002. "🍃",
  10003. "🍄",
  10004. "🍅",
  10005. "🍆",
  10006. "🍇",
  10007. "🍈",
  10008. "🍉",
  10009. "🍊",
  10010. "🍋",
  10011. "🍌",
  10012. "🍍",
  10013. "🍎",
  10014. "🍏",
  10015. "🍐",
  10016. "🍑",
  10017. "🍒",
  10018. "🍓",
  10019. "🍔",
  10020. "🍕",
  10021. "🍖",
  10022. "🍗",
  10023. "🍘",
  10024. "🍙",
  10025. "🍚",
  10026. "🍛",
  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. "0⃣",
  12680. "〰️",
  12681. "〽️",
  12682. "1⃣",
  12683. "2⃣",
  12684. "㊗️",
  12685. "㊙️",
  12686. "3⃣",
  12687. "4⃣",
  12688. "5⃣",
  12689. "6⃣",
  12690. "7⃣",
  12691. "8⃣",
  12692. "9⃣",
  12693. "©️",
  12694. "®️",
  12695. ""
  12696. ];
  12697. const emojiRegex = /[\uD800-\uDFFF]./;
  12698. const emojiList = emojisList.filter((emoji) => emojiRegex.test(emoji));
  12699. const emojiCache = {};
  12700. function encodeStringToEmoji(content, length) {
  12701. if (emojiCache[content]) {
  12702. return emojiCache[content];
  12703. }
  12704. length = length || 1;
  12705. const emojis = [];
  12706. do {
  12707. if (!emojiList.length) {
  12708. throw new Error('Ran out of emoji');
  12709. }
  12710. const index = Math.floor(Math.random() * emojiList.length);
  12711. emojis.push(emojiList[index]);
  12712. emojiList.splice(index, 1);
  12713. } while (--length > 0);
  12714. const emojiEncoding = emojis.join('');
  12715. emojiCache[content] = emojiEncoding;
  12716. return emojiEncoding;
  12717. }
  12718. function interpolateName(loaderContext, name, options) {
  12719. let filename;
  12720. const hasQuery =
  12721. loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1;
  12722. if (typeof name === 'function') {
  12723. filename = name(
  12724. loaderContext.resourcePath,
  12725. hasQuery ? loaderContext.resourceQuery : undefined
  12726. );
  12727. } else {
  12728. filename = name || '[hash].[ext]';
  12729. }
  12730. const context = options.context;
  12731. const content = options.content;
  12732. const regExp = options.regExp;
  12733. let ext = 'bin';
  12734. let basename = 'file';
  12735. let directory = '';
  12736. let folder = '';
  12737. let query = '';
  12738. if (loaderContext.resourcePath) {
  12739. const parsed = path__default.parse(loaderContext.resourcePath);
  12740. let resourcePath = loaderContext.resourcePath;
  12741. if (parsed.ext) {
  12742. ext = parsed.ext.substr(1);
  12743. }
  12744. if (parsed.dir) {
  12745. basename = parsed.name;
  12746. resourcePath = parsed.dir + path__default.sep;
  12747. }
  12748. if (typeof context !== 'undefined') {
  12749. directory = path__default
  12750. .relative(context, resourcePath + '_')
  12751. .replace(/\\/g, '/')
  12752. .replace(/\.\.(\/)?/g, '_$1');
  12753. directory = directory.substr(0, directory.length - 1);
  12754. } else {
  12755. directory = resourcePath.replace(/\\/g, '/').replace(/\.\.(\/)?/g, '_$1');
  12756. }
  12757. if (directory.length === 1) {
  12758. directory = '';
  12759. } else if (directory.length > 1) {
  12760. folder = path__default.basename(directory);
  12761. }
  12762. }
  12763. if (loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1) {
  12764. query = loaderContext.resourceQuery;
  12765. const hashIdx = query.indexOf('#');
  12766. if (hashIdx >= 0) {
  12767. query = query.substr(0, hashIdx);
  12768. }
  12769. }
  12770. let url = filename;
  12771. if (content) {
  12772. // Match hash template
  12773. url = url
  12774. // `hash` and `contenthash` are same in `loader-utils` context
  12775. // let's keep `hash` for backward compatibility
  12776. .replace(
  12777. /\[(?:([^:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi,
  12778. (all, hashType, digestType, maxLength) =>
  12779. getHashDigest_1(content, hashType, digestType, parseInt(maxLength, 10))
  12780. )
  12781. .replace(/\[emoji(?::(\d+))?\]/gi, (all, length) =>
  12782. encodeStringToEmoji(content, parseInt(length, 10))
  12783. );
  12784. }
  12785. url = url
  12786. .replace(/\[ext\]/gi, () => ext)
  12787. .replace(/\[name\]/gi, () => basename)
  12788. .replace(/\[path\]/gi, () => directory)
  12789. .replace(/\[folder\]/gi, () => folder)
  12790. .replace(/\[query\]/gi, () => query);
  12791. if (regExp && loaderContext.resourcePath) {
  12792. const match = loaderContext.resourcePath.match(new RegExp(regExp));
  12793. match &&
  12794. match.forEach((matched, i) => {
  12795. url = url.replace(new RegExp('\\[' + i + '\\]', 'ig'), matched);
  12796. });
  12797. }
  12798. if (
  12799. typeof loaderContext.options === 'object' &&
  12800. typeof loaderContext.options.customInterpolateName === 'function'
  12801. ) {
  12802. url = loaderContext.options.customInterpolateName.call(
  12803. loaderContext,
  12804. url,
  12805. name,
  12806. options
  12807. );
  12808. }
  12809. return url;
  12810. }
  12811. var interpolateName_1 = interpolateName;
  12812. var getOptions_1$1 = getOptions_1;
  12813. var parseQuery_1$1 = parseQuery_1;
  12814. var stringifyRequest_1$1 = stringifyRequest_1;
  12815. var getRemainingRequest_1$1 = getRemainingRequest_1;
  12816. var getCurrentRequest_1$1 = getCurrentRequest_1;
  12817. var isUrlRequest_1$1 = isUrlRequest_1;
  12818. var urlToRequest_1$1 = urlToRequest_1;
  12819. var parseString_1$1 = parseString_1;
  12820. var getHashDigest_1$1 = getHashDigest_1;
  12821. var interpolateName_1$1 = interpolateName_1;
  12822. var lib$1 = {
  12823. getOptions: getOptions_1$1,
  12824. parseQuery: parseQuery_1$1,
  12825. stringifyRequest: stringifyRequest_1$1,
  12826. getRemainingRequest: getRemainingRequest_1$1,
  12827. getCurrentRequest: getCurrentRequest_1$1,
  12828. isUrlRequest: isUrlRequest_1$1,
  12829. urlToRequest: urlToRequest_1$1,
  12830. parseString: parseString_1$1,
  12831. getHashDigest: getHashDigest_1$1,
  12832. interpolateName: interpolateName_1$1
  12833. };
  12834. var interpolateName$1 = lib$1.interpolateName;
  12835. /**
  12836. * @param {string} pattern
  12837. * @param {object} options
  12838. * @param {string} options.context
  12839. * @param {string} options.hashPrefix
  12840. * @return {function}
  12841. */
  12842. var genericNames = function createGenerator(pattern, options) {
  12843. options = options || {};
  12844. var context =
  12845. options && typeof options.context === "string"
  12846. ? options.context
  12847. : process.cwd();
  12848. var hashPrefix =
  12849. options && typeof options.hashPrefix === "string" ? options.hashPrefix : "";
  12850. /**
  12851. * @param {string} localName Usually a class name
  12852. * @param {string} filepath Absolute path
  12853. * @return {string}
  12854. */
  12855. return function generate(localName, filepath) {
  12856. var name = pattern.replace(/\[local\]/gi, localName);
  12857. var loaderContext = {
  12858. resourcePath: filepath
  12859. };
  12860. var loaderOptions = {
  12861. content:
  12862. hashPrefix +
  12863. path__default.relative(context, filepath).replace(/\\/g, "/") +
  12864. "+" +
  12865. localName,
  12866. context: context
  12867. };
  12868. var genericName = interpolateName$1(loaderContext, name, loaderOptions);
  12869. return genericName
  12870. .replace(new RegExp("[^a-zA-Z0-9\\-_\u00A0-\uFFFF]", "g"), "-")
  12871. .replace(/^((-?[0-9])|--)/, "_$1");
  12872. };
  12873. };
  12874. var _default = unquote;
  12875. // copied from https://github.com/lakenen/node-unquote
  12876. var reg = /['"]/;
  12877. function unquote(str) {
  12878. if (!str) {
  12879. return "";
  12880. }
  12881. if (reg.test(str.charAt(0))) {
  12882. str = str.substr(1);
  12883. }
  12884. if (reg.test(str.charAt(str.length - 1))) {
  12885. str = str.substr(0, str.length - 1);
  12886. }
  12887. return str;
  12888. }
  12889. var unquote_1 = /*#__PURE__*/Object.defineProperty({
  12890. default: _default
  12891. }, '__esModule', {value: true});
  12892. var replaceAll_1 = replaceAll;
  12893. var matchConstName = /[$#]?[\w-\.]+/g;
  12894. function replaceAll(replacements, text) {
  12895. var matches = void 0;
  12896. while (matches = matchConstName.exec(text)) {
  12897. var replacement = replacements[matches[0]];
  12898. if (replacement) {
  12899. text = text.slice(0, matches.index) + replacement + text.slice(matchConstName.lastIndex);
  12900. matchConstName.lastIndex -= matches[0].length - replacement.length;
  12901. }
  12902. }
  12903. return text;
  12904. }
  12905. var _default$1 = function (css, translations) {
  12906. css.walkDecls(function (decl) {
  12907. return decl.value = replaceAll(translations, decl.value);
  12908. });
  12909. css.walkAtRules('media', function (atRule) {
  12910. return atRule.params = replaceAll(translations, atRule.params);
  12911. });
  12912. };
  12913. var lib$2 = /*#__PURE__*/Object.defineProperty({
  12914. replaceAll: replaceAll_1,
  12915. default: _default$1
  12916. }, '__esModule', {value: true});
  12917. var _icssReplaceSymbols2 = _interopRequireDefault(lib$2);
  12918. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12919. // Copied from https://github.com/css-modules/css-modules-loader-core
  12920. const importRegexp = /^:import\((.+)\)$/;
  12921. class Parser {
  12922. constructor(pathFetcher, trace) {
  12923. this.pathFetcher = pathFetcher;
  12924. this.plugin = this.plugin.bind(this);
  12925. this.exportTokens = {};
  12926. this.translations = {};
  12927. this.trace = trace;
  12928. }
  12929. plugin() {
  12930. const parser = this;
  12931. return {
  12932. postcssPlugin: "css-modules-parser",
  12933. OnceExit(css) {
  12934. return Promise.all(parser.fetchAllImports(css)).then(() => parser.linkImportedSymbols(css)).then(() => parser.extractExports(css));
  12935. }
  12936. };
  12937. }
  12938. fetchAllImports(css) {
  12939. let imports = [];
  12940. css.each(node => {
  12941. if (node.type == "rule" && node.selector.match(importRegexp)) {
  12942. imports.push(this.fetchImport(node, css.source.input.from, imports.length));
  12943. }
  12944. });
  12945. return imports;
  12946. }
  12947. linkImportedSymbols(css) {
  12948. (0, _icssReplaceSymbols2.default)(css, this.translations);
  12949. }
  12950. extractExports(css) {
  12951. css.each(node => {
  12952. if (node.type == "rule" && node.selector == ":export") this.handleExport(node);
  12953. });
  12954. }
  12955. handleExport(exportNode) {
  12956. exportNode.each(decl => {
  12957. if (decl.type == "decl") {
  12958. Object.keys(this.translations).forEach(translation => {
  12959. decl.value = decl.value.replace(translation, this.translations[translation]);
  12960. });
  12961. this.exportTokens[decl.prop] = decl.value;
  12962. }
  12963. });
  12964. exportNode.remove();
  12965. }
  12966. fetchImport(importNode, relativeTo, depNr) {
  12967. let file = importNode.selector.match(importRegexp)[1],
  12968. depTrace = this.trace + String.fromCharCode(depNr);
  12969. return this.pathFetcher(file, relativeTo, depTrace).then(exports => {
  12970. importNode.each(decl => {
  12971. if (decl.type == "decl") {
  12972. this.translations[decl.prop] = exports[decl.value];
  12973. }
  12974. });
  12975. importNode.remove();
  12976. }, err => console.log(err));
  12977. }
  12978. }
  12979. var _default$2 = Parser;
  12980. var parser$1 = /*#__PURE__*/Object.defineProperty({
  12981. default: _default$2
  12982. }, '__esModule', {value: true});
  12983. var _postcss2 = _interopRequireDefault$1(_postcss__default);
  12984. var _fs2 = _interopRequireDefault$1(fs__default);
  12985. var _path2 = _interopRequireDefault$1(path__default);
  12986. var _parser2 = _interopRequireDefault$1(parser$1);
  12987. function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12988. // Copied from https://github.com/css-modules/css-modules-loader-core
  12989. class Core {
  12990. constructor(plugins) {
  12991. this.plugins = plugins || Core.defaultPlugins;
  12992. }
  12993. load(sourceString, sourcePath, trace, pathFetcher) {
  12994. let parser = new _parser2.default(pathFetcher, trace);
  12995. return (0, _postcss2.default)(this.plugins.concat([parser.plugin()])).process(sourceString, { from: "/" + sourcePath }).then(result => {
  12996. return {
  12997. injectableSource: result.css,
  12998. exportTokens: parser.exportTokens
  12999. };
  13000. });
  13001. }
  13002. }
  13003. // Sorts dependencies in the following way:
  13004. // AAA comes before AA and A
  13005. // AB comes after AA and before A
  13006. // All Bs come after all As
  13007. // This ensures that the files are always returned in the following order:
  13008. // - In the order they were required, except
  13009. // - After all their dependencies
  13010. const traceKeySorter = (a, b) => {
  13011. if (a.length < b.length) {
  13012. return a < b.substring(0, a.length) ? -1 : 1;
  13013. } else if (a.length > b.length) {
  13014. return a.substring(0, b.length) <= b ? -1 : 1;
  13015. } else {
  13016. return a < b ? -1 : 1;
  13017. }
  13018. };
  13019. class FileSystemLoader {
  13020. constructor(root, plugins) {
  13021. this.root = root;
  13022. this.sources = {};
  13023. this.traces = {};
  13024. this.importNr = 0;
  13025. this.core = new Core(plugins);
  13026. this.tokensByFile = {};
  13027. }
  13028. fetch(_newPath, relativeTo, _trace) {
  13029. let newPath = _newPath.replace(/^["']|["']$/g, ""),
  13030. trace = _trace || String.fromCharCode(this.importNr++);
  13031. return new Promise((resolve, reject) => {
  13032. let relativeDir = _path2.default.dirname(relativeTo),
  13033. rootRelativePath = _path2.default.resolve(relativeDir, newPath),
  13034. fileRelativePath = _path2.default.resolve(_path2.default.join(this.root, relativeDir), newPath);
  13035. // if the path is not relative or absolute, try to resolve it in node_modules
  13036. if (newPath[0] !== "." && newPath[0] !== "/") {
  13037. try {
  13038. fileRelativePath = require.resolve(newPath);
  13039. } catch (e) {
  13040. // noop
  13041. }
  13042. }
  13043. const tokens = this.tokensByFile[fileRelativePath];
  13044. if (tokens) {
  13045. return resolve(tokens);
  13046. }
  13047. _fs2.default.readFile(fileRelativePath, "utf-8", (err, source) => {
  13048. if (err) reject(err);
  13049. this.core.load(source, rootRelativePath, trace, this.fetch.bind(this)).then(({ injectableSource, exportTokens }) => {
  13050. this.sources[fileRelativePath] = injectableSource;
  13051. this.traces[trace] = fileRelativePath;
  13052. this.tokensByFile[fileRelativePath] = exportTokens;
  13053. resolve(exportTokens);
  13054. }, reject);
  13055. });
  13056. });
  13057. }
  13058. get finalSource() {
  13059. const traces = this.traces;
  13060. const sources = this.sources;
  13061. let written = new Set();
  13062. return Object.keys(traces).sort(traceKeySorter).map(key => {
  13063. const filename = traces[key];
  13064. if (written.has(filename)) {
  13065. return null;
  13066. }
  13067. written.add(filename);
  13068. return sources[filename];
  13069. }).join("");
  13070. }
  13071. }
  13072. var _default$3 = FileSystemLoader;
  13073. var loader = /*#__PURE__*/Object.defineProperty({
  13074. default: _default$3
  13075. }, '__esModule', {value: true});
  13076. function hash(str) {
  13077. var hash = 5381,
  13078. i = str.length;
  13079. while(i) {
  13080. hash = (hash * 33) ^ str.charCodeAt(--i);
  13081. }
  13082. /* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
  13083. * integers. Since we want the results to be always positive, convert the
  13084. * signed int to an unsigned by doing an unsigned bitshift. */
  13085. return hash >>> 0;
  13086. }
  13087. var stringHash = hash;
  13088. var _default$4 = generateScopedName;
  13089. var _stringHash2 = _interopRequireDefault$2(stringHash);
  13090. function _interopRequireDefault$2(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13091. function generateScopedName(name, filename, css) {
  13092. const i = css.indexOf(`.${name}`);
  13093. const lineNumber = css.substr(0, i).split(/[\r\n]/).length;
  13094. const hash = (0, _stringHash2.default)(css).toString(36).substr(0, 5);
  13095. return `_${name}_${hash}_${lineNumber}`;
  13096. }
  13097. var generateScopedName_1 = /*#__PURE__*/Object.defineProperty({
  13098. default: _default$4
  13099. }, '__esModule', {value: true});
  13100. var _default$5 = saveJSON;
  13101. function saveJSON(cssFile, json) {
  13102. return new Promise((resolve, reject) => {
  13103. (0, fs__default.writeFile)(`${cssFile}.json`, JSON.stringify(json), e => e ? reject(e) : resolve(json));
  13104. });
  13105. }
  13106. var saveJSON_1 = /*#__PURE__*/Object.defineProperty({
  13107. default: _default$5
  13108. }, '__esModule', {value: true});
  13109. var openParentheses = "(".charCodeAt(0);
  13110. var closeParentheses = ")".charCodeAt(0);
  13111. var singleQuote = "'".charCodeAt(0);
  13112. var doubleQuote = '"'.charCodeAt(0);
  13113. var backslash = "\\".charCodeAt(0);
  13114. var slash = "/".charCodeAt(0);
  13115. var comma = ",".charCodeAt(0);
  13116. var colon = ":".charCodeAt(0);
  13117. var star = "*".charCodeAt(0);
  13118. var uLower = "u".charCodeAt(0);
  13119. var uUpper = "U".charCodeAt(0);
  13120. var plus = "+".charCodeAt(0);
  13121. var isUnicodeRange = /^[a-f0-9?-]+$/i;
  13122. var parse$2 = function(input) {
  13123. var tokens = [];
  13124. var value = input;
  13125. var next,
  13126. quote,
  13127. prev,
  13128. token,
  13129. escape,
  13130. escapePos,
  13131. whitespacePos,
  13132. parenthesesOpenPos;
  13133. var pos = 0;
  13134. var code = value.charCodeAt(pos);
  13135. var max = value.length;
  13136. var stack = [{ nodes: tokens }];
  13137. var balanced = 0;
  13138. var parent;
  13139. var name = "";
  13140. var before = "";
  13141. var after = "";
  13142. while (pos < max) {
  13143. // Whitespaces
  13144. if (code <= 32) {
  13145. next = pos;
  13146. do {
  13147. next += 1;
  13148. code = value.charCodeAt(next);
  13149. } while (code <= 32);
  13150. token = value.slice(pos, next);
  13151. prev = tokens[tokens.length - 1];
  13152. if (code === closeParentheses && balanced) {
  13153. after = token;
  13154. } else if (prev && prev.type === "div") {
  13155. prev.after = token;
  13156. prev.sourceEndIndex += token.length;
  13157. } else if (
  13158. code === comma ||
  13159. code === colon ||
  13160. (code === slash &&
  13161. value.charCodeAt(next + 1) !== star &&
  13162. (!parent ||
  13163. (parent && parent.type === "function" && parent.value !== "calc")))
  13164. ) {
  13165. before = token;
  13166. } else {
  13167. tokens.push({
  13168. type: "space",
  13169. sourceIndex: pos,
  13170. sourceEndIndex: next,
  13171. value: token
  13172. });
  13173. }
  13174. pos = next;
  13175. // Quotes
  13176. } else if (code === singleQuote || code === doubleQuote) {
  13177. next = pos;
  13178. quote = code === singleQuote ? "'" : '"';
  13179. token = {
  13180. type: "string",
  13181. sourceIndex: pos,
  13182. quote: quote
  13183. };
  13184. do {
  13185. escape = false;
  13186. next = value.indexOf(quote, next + 1);
  13187. if (~next) {
  13188. escapePos = next;
  13189. while (value.charCodeAt(escapePos - 1) === backslash) {
  13190. escapePos -= 1;
  13191. escape = !escape;
  13192. }
  13193. } else {
  13194. value += quote;
  13195. next = value.length - 1;
  13196. token.unclosed = true;
  13197. }
  13198. } while (escape);
  13199. token.value = value.slice(pos + 1, next);
  13200. token.sourceEndIndex = token.unclosed ? next : next + 1;
  13201. tokens.push(token);
  13202. pos = next + 1;
  13203. code = value.charCodeAt(pos);
  13204. // Comments
  13205. } else if (code === slash && value.charCodeAt(pos + 1) === star) {
  13206. next = value.indexOf("*/", pos);
  13207. token = {
  13208. type: "comment",
  13209. sourceIndex: pos,
  13210. sourceEndIndex: next + 2
  13211. };
  13212. if (next === -1) {
  13213. token.unclosed = true;
  13214. next = value.length;
  13215. token.sourceEndIndex = next;
  13216. }
  13217. token.value = value.slice(pos + 2, next);
  13218. tokens.push(token);
  13219. pos = next + 2;
  13220. code = value.charCodeAt(pos);
  13221. // Operation within calc
  13222. } else if (
  13223. (code === slash || code === star) &&
  13224. parent &&
  13225. parent.type === "function" &&
  13226. parent.value === "calc"
  13227. ) {
  13228. token = value[pos];
  13229. tokens.push({
  13230. type: "word",
  13231. sourceIndex: pos - before.length,
  13232. sourceEndIndex: pos + token.length,
  13233. value: token
  13234. });
  13235. pos += 1;
  13236. code = value.charCodeAt(pos);
  13237. // Dividers
  13238. } else if (code === slash || code === comma || code === colon) {
  13239. token = value[pos];
  13240. tokens.push({
  13241. type: "div",
  13242. sourceIndex: pos - before.length,
  13243. sourceEndIndex: pos + token.length,
  13244. value: token,
  13245. before: before,
  13246. after: ""
  13247. });
  13248. before = "";
  13249. pos += 1;
  13250. code = value.charCodeAt(pos);
  13251. // Open parentheses
  13252. } else if (openParentheses === code) {
  13253. // Whitespaces after open parentheses
  13254. next = pos;
  13255. do {
  13256. next += 1;
  13257. code = value.charCodeAt(next);
  13258. } while (code <= 32);
  13259. parenthesesOpenPos = pos;
  13260. token = {
  13261. type: "function",
  13262. sourceIndex: pos - name.length,
  13263. value: name,
  13264. before: value.slice(parenthesesOpenPos + 1, next)
  13265. };
  13266. pos = next;
  13267. if (name === "url" && code !== singleQuote && code !== doubleQuote) {
  13268. next -= 1;
  13269. do {
  13270. escape = false;
  13271. next = value.indexOf(")", next + 1);
  13272. if (~next) {
  13273. escapePos = next;
  13274. while (value.charCodeAt(escapePos - 1) === backslash) {
  13275. escapePos -= 1;
  13276. escape = !escape;
  13277. }
  13278. } else {
  13279. value += ")";
  13280. next = value.length - 1;
  13281. token.unclosed = true;
  13282. }
  13283. } while (escape);
  13284. // Whitespaces before closed
  13285. whitespacePos = next;
  13286. do {
  13287. whitespacePos -= 1;
  13288. code = value.charCodeAt(whitespacePos);
  13289. } while (code <= 32);
  13290. if (parenthesesOpenPos < whitespacePos) {
  13291. if (pos !== whitespacePos + 1) {
  13292. token.nodes = [
  13293. {
  13294. type: "word",
  13295. sourceIndex: pos,
  13296. sourceEndIndex: whitespacePos + 1,
  13297. value: value.slice(pos, whitespacePos + 1)
  13298. }
  13299. ];
  13300. } else {
  13301. token.nodes = [];
  13302. }
  13303. if (token.unclosed && whitespacePos + 1 !== next) {
  13304. token.after = "";
  13305. token.nodes.push({
  13306. type: "space",
  13307. sourceIndex: whitespacePos + 1,
  13308. sourceEndIndex: next,
  13309. value: value.slice(whitespacePos + 1, next)
  13310. });
  13311. } else {
  13312. token.after = value.slice(whitespacePos + 1, next);
  13313. token.sourceEndIndex = next;
  13314. }
  13315. } else {
  13316. token.after = "";
  13317. token.nodes = [];
  13318. }
  13319. pos = next + 1;
  13320. token.sourceEndIndex = token.unclosed ? next : pos;
  13321. code = value.charCodeAt(pos);
  13322. tokens.push(token);
  13323. } else {
  13324. balanced += 1;
  13325. token.after = "";
  13326. token.sourceEndIndex = pos + 1;
  13327. tokens.push(token);
  13328. stack.push(token);
  13329. tokens = token.nodes = [];
  13330. parent = token;
  13331. }
  13332. name = "";
  13333. // Close parentheses
  13334. } else if (closeParentheses === code && balanced) {
  13335. pos += 1;
  13336. code = value.charCodeAt(pos);
  13337. parent.after = after;
  13338. parent.sourceEndIndex += after.length;
  13339. after = "";
  13340. balanced -= 1;
  13341. stack[stack.length - 1].sourceEndIndex = pos;
  13342. stack.pop();
  13343. parent = stack[balanced];
  13344. tokens = parent.nodes;
  13345. // Words
  13346. } else {
  13347. next = pos;
  13348. do {
  13349. if (code === backslash) {
  13350. next += 1;
  13351. }
  13352. next += 1;
  13353. code = value.charCodeAt(next);
  13354. } while (
  13355. next < max &&
  13356. !(
  13357. code <= 32 ||
  13358. code === singleQuote ||
  13359. code === doubleQuote ||
  13360. code === comma ||
  13361. code === colon ||
  13362. code === slash ||
  13363. code === openParentheses ||
  13364. (code === star &&
  13365. parent &&
  13366. parent.type === "function" &&
  13367. parent.value === "calc") ||
  13368. (code === slash &&
  13369. parent.type === "function" &&
  13370. parent.value === "calc") ||
  13371. (code === closeParentheses && balanced)
  13372. )
  13373. );
  13374. token = value.slice(pos, next);
  13375. if (openParentheses === code) {
  13376. name = token;
  13377. } else if (
  13378. (uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) &&
  13379. plus === token.charCodeAt(1) &&
  13380. isUnicodeRange.test(token.slice(2))
  13381. ) {
  13382. tokens.push({
  13383. type: "unicode-range",
  13384. sourceIndex: pos,
  13385. sourceEndIndex: next,
  13386. value: token
  13387. });
  13388. } else {
  13389. tokens.push({
  13390. type: "word",
  13391. sourceIndex: pos,
  13392. sourceEndIndex: next,
  13393. value: token
  13394. });
  13395. }
  13396. pos = next;
  13397. }
  13398. }
  13399. for (pos = stack.length - 1; pos; pos -= 1) {
  13400. stack[pos].unclosed = true;
  13401. stack[pos].sourceEndIndex = value.length;
  13402. }
  13403. return stack[0].nodes;
  13404. };
  13405. var walk = function walk(nodes, cb, bubble) {
  13406. var i, max, node, result;
  13407. for (i = 0, max = nodes.length; i < max; i += 1) {
  13408. node = nodes[i];
  13409. if (!bubble) {
  13410. result = cb(node, i, nodes);
  13411. }
  13412. if (
  13413. result !== false &&
  13414. node.type === "function" &&
  13415. Array.isArray(node.nodes)
  13416. ) {
  13417. walk(node.nodes, cb, bubble);
  13418. }
  13419. if (bubble) {
  13420. cb(node, i, nodes);
  13421. }
  13422. }
  13423. };
  13424. function stringifyNode(node, custom) {
  13425. var type = node.type;
  13426. var value = node.value;
  13427. var buf;
  13428. var customResult;
  13429. if (custom && (customResult = custom(node)) !== undefined) {
  13430. return customResult;
  13431. } else if (type === "word" || type === "space") {
  13432. return value;
  13433. } else if (type === "string") {
  13434. buf = node.quote || "";
  13435. return buf + value + (node.unclosed ? "" : buf);
  13436. } else if (type === "comment") {
  13437. return "/*" + value + (node.unclosed ? "" : "*/");
  13438. } else if (type === "div") {
  13439. return (node.before || "") + value + (node.after || "");
  13440. } else if (Array.isArray(node.nodes)) {
  13441. buf = stringify$1(node.nodes, custom);
  13442. if (type !== "function") {
  13443. return buf;
  13444. }
  13445. return (
  13446. value +
  13447. "(" +
  13448. (node.before || "") +
  13449. buf +
  13450. (node.after || "") +
  13451. (node.unclosed ? "" : ")")
  13452. );
  13453. }
  13454. return value;
  13455. }
  13456. function stringify$1(nodes, custom) {
  13457. var result, i;
  13458. if (Array.isArray(nodes)) {
  13459. result = "";
  13460. for (i = nodes.length - 1; ~i; i -= 1) {
  13461. result = stringifyNode(nodes[i], custom) + result;
  13462. }
  13463. return result;
  13464. }
  13465. return stringifyNode(nodes, custom);
  13466. }
  13467. var stringify_1$1 = stringify$1;
  13468. var minus = "-".charCodeAt(0);
  13469. var plus$1 = "+".charCodeAt(0);
  13470. var dot = ".".charCodeAt(0);
  13471. var exp = "e".charCodeAt(0);
  13472. var EXP = "E".charCodeAt(0);
  13473. // Check if three code points would start a number
  13474. // https://www.w3.org/TR/css-syntax-3/#starts-with-a-number
  13475. function likeNumber(value) {
  13476. var code = value.charCodeAt(0);
  13477. var nextCode;
  13478. if (code === plus$1 || code === minus) {
  13479. nextCode = value.charCodeAt(1);
  13480. if (nextCode >= 48 && nextCode <= 57) {
  13481. return true;
  13482. }
  13483. var nextNextCode = value.charCodeAt(2);
  13484. if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) {
  13485. return true;
  13486. }
  13487. return false;
  13488. }
  13489. if (code === dot) {
  13490. nextCode = value.charCodeAt(1);
  13491. if (nextCode >= 48 && nextCode <= 57) {
  13492. return true;
  13493. }
  13494. return false;
  13495. }
  13496. if (code >= 48 && code <= 57) {
  13497. return true;
  13498. }
  13499. return false;
  13500. }
  13501. // Consume a number
  13502. // https://www.w3.org/TR/css-syntax-3/#consume-number
  13503. var unit = function(value) {
  13504. var pos = 0;
  13505. var length = value.length;
  13506. var code;
  13507. var nextCode;
  13508. var nextNextCode;
  13509. if (length === 0 || !likeNumber(value)) {
  13510. return false;
  13511. }
  13512. code = value.charCodeAt(pos);
  13513. if (code === plus$1 || code === minus) {
  13514. pos++;
  13515. }
  13516. while (pos < length) {
  13517. code = value.charCodeAt(pos);
  13518. if (code < 48 || code > 57) {
  13519. break;
  13520. }
  13521. pos += 1;
  13522. }
  13523. code = value.charCodeAt(pos);
  13524. nextCode = value.charCodeAt(pos + 1);
  13525. if (code === dot && nextCode >= 48 && nextCode <= 57) {
  13526. pos += 2;
  13527. while (pos < length) {
  13528. code = value.charCodeAt(pos);
  13529. if (code < 48 || code > 57) {
  13530. break;
  13531. }
  13532. pos += 1;
  13533. }
  13534. }
  13535. code = value.charCodeAt(pos);
  13536. nextCode = value.charCodeAt(pos + 1);
  13537. nextNextCode = value.charCodeAt(pos + 2);
  13538. if (
  13539. (code === exp || code === EXP) &&
  13540. ((nextCode >= 48 && nextCode <= 57) ||
  13541. ((nextCode === plus$1 || nextCode === minus) &&
  13542. nextNextCode >= 48 &&
  13543. nextNextCode <= 57))
  13544. ) {
  13545. pos += nextCode === plus$1 || nextCode === minus ? 3 : 2;
  13546. while (pos < length) {
  13547. code = value.charCodeAt(pos);
  13548. if (code < 48 || code > 57) {
  13549. break;
  13550. }
  13551. pos += 1;
  13552. }
  13553. }
  13554. return {
  13555. number: value.slice(0, pos),
  13556. unit: value.slice(pos)
  13557. };
  13558. };
  13559. function ValueParser(value) {
  13560. if (this instanceof ValueParser) {
  13561. this.nodes = parse$2(value);
  13562. return this;
  13563. }
  13564. return new ValueParser(value);
  13565. }
  13566. ValueParser.prototype.toString = function() {
  13567. return Array.isArray(this.nodes) ? stringify_1$1(this.nodes) : "";
  13568. };
  13569. ValueParser.prototype.walk = function(cb, bubble) {
  13570. walk(this.nodes, cb, bubble);
  13571. return this;
  13572. };
  13573. ValueParser.unit = unit;
  13574. ValueParser.walk = walk;
  13575. ValueParser.stringify = stringify_1$1;
  13576. var lib$3 = ValueParser;
  13577. const matchValueName = /[$]?[\w-]+/g;
  13578. const replaceValueSymbols = (value, replacements) => {
  13579. let matches;
  13580. while ((matches = matchValueName.exec(value))) {
  13581. const replacement = replacements[matches[0]];
  13582. if (replacement) {
  13583. value =
  13584. value.slice(0, matches.index) +
  13585. replacement +
  13586. value.slice(matchValueName.lastIndex);
  13587. matchValueName.lastIndex -= matches[0].length - replacement.length;
  13588. }
  13589. }
  13590. return value;
  13591. };
  13592. var replaceValueSymbols_1 = replaceValueSymbols;
  13593. const replaceSymbols = (css, replacements) => {
  13594. css.walk((node) => {
  13595. if (node.type === "decl" && node.value) {
  13596. node.value = replaceValueSymbols_1(node.value.toString(), replacements);
  13597. } else if (node.type === "rule" && node.selector) {
  13598. node.selector = replaceValueSymbols_1(
  13599. node.selector.toString(),
  13600. replacements
  13601. );
  13602. } else if (node.type === "atrule" && node.params) {
  13603. node.params = replaceValueSymbols_1(node.params.toString(), replacements);
  13604. }
  13605. });
  13606. };
  13607. var replaceSymbols_1 = replaceSymbols;
  13608. const importPattern = /^:import\(("[^"]*"|'[^']*'|[^"']+)\)$/;
  13609. const balancedQuotes = /^("[^"]*"|'[^']*'|[^"']+)$/;
  13610. const getDeclsObject = (rule) => {
  13611. const object = {};
  13612. rule.walkDecls((decl) => {
  13613. const before = decl.raws.before ? decl.raws.before.trim() : "";
  13614. object[before + decl.prop] = decl.value;
  13615. });
  13616. return object;
  13617. };
  13618. /**
  13619. *
  13620. * @param {string} css
  13621. * @param {boolean} removeRules
  13622. * @param {'auto' | 'rule' | 'at-rule'} mode
  13623. */
  13624. const extractICSS = (css, removeRules = true, mode = "auto") => {
  13625. const icssImports = {};
  13626. const icssExports = {};
  13627. function addImports(node, path) {
  13628. const unquoted = path.replace(/'|"/g, "");
  13629. icssImports[unquoted] = Object.assign(
  13630. icssImports[unquoted] || {},
  13631. getDeclsObject(node)
  13632. );
  13633. if (removeRules) {
  13634. node.remove();
  13635. }
  13636. }
  13637. function addExports(node) {
  13638. Object.assign(icssExports, getDeclsObject(node));
  13639. if (removeRules) {
  13640. node.remove();
  13641. }
  13642. }
  13643. css.each((node) => {
  13644. if (node.type === "rule" && mode !== "at-rule") {
  13645. if (node.selector.slice(0, 7) === ":import") {
  13646. const matches = importPattern.exec(node.selector);
  13647. if (matches) {
  13648. addImports(node, matches[1]);
  13649. }
  13650. }
  13651. if (node.selector === ":export") {
  13652. addExports(node);
  13653. }
  13654. }
  13655. if (node.type === "atrule" && mode !== "rule") {
  13656. if (node.name === "icss-import") {
  13657. const matches = balancedQuotes.exec(node.params);
  13658. if (matches) {
  13659. addImports(node, matches[1]);
  13660. }
  13661. }
  13662. if (node.name === "icss-export") {
  13663. addExports(node);
  13664. }
  13665. }
  13666. });
  13667. return { icssImports, icssExports };
  13668. };
  13669. var extractICSS_1 = extractICSS;
  13670. const createImports = (imports, postcss, mode = "rule") => {
  13671. return Object.keys(imports).map((path) => {
  13672. const aliases = imports[path];
  13673. const declarations = Object.keys(aliases).map((key) =>
  13674. postcss.decl({
  13675. prop: key,
  13676. value: aliases[key],
  13677. raws: { before: "\n " },
  13678. })
  13679. );
  13680. const hasDeclarations = declarations.length > 0;
  13681. const rule =
  13682. mode === "rule"
  13683. ? postcss.rule({
  13684. selector: `:import('${path}')`,
  13685. raws: { after: hasDeclarations ? "\n" : "" },
  13686. })
  13687. : postcss.atRule({
  13688. name: "icss-import",
  13689. params: `'${path}'`,
  13690. raws: { after: hasDeclarations ? "\n" : "" },
  13691. });
  13692. if (hasDeclarations) {
  13693. rule.append(declarations);
  13694. }
  13695. return rule;
  13696. });
  13697. };
  13698. const createExports = (exports, postcss, mode = "rule") => {
  13699. const declarations = Object.keys(exports).map((key) =>
  13700. postcss.decl({
  13701. prop: key,
  13702. value: exports[key],
  13703. raws: { before: "\n " },
  13704. })
  13705. );
  13706. if (declarations.length === 0) {
  13707. return [];
  13708. }
  13709. const rule =
  13710. mode === "rule"
  13711. ? postcss.rule({
  13712. selector: `:export`,
  13713. raws: { after: "\n" },
  13714. })
  13715. : postcss.atRule({
  13716. name: "icss-export",
  13717. raws: { after: "\n" },
  13718. });
  13719. rule.append(declarations);
  13720. return [rule];
  13721. };
  13722. const createICSSRules = (imports, exports, postcss, mode) => [
  13723. ...createImports(imports, postcss, mode),
  13724. ...createExports(exports, postcss, mode),
  13725. ];
  13726. var createICSSRules_1 = createICSSRules;
  13727. var src = {
  13728. replaceValueSymbols: replaceValueSymbols_1,
  13729. replaceSymbols: replaceSymbols_1,
  13730. extractICSS: extractICSS_1,
  13731. createICSSRules: createICSSRules_1,
  13732. };
  13733. const { extractICSS: extractICSS$1 } = src;
  13734. const isSpacing = (node) => node.type === "combinator" && node.value === " ";
  13735. function normalizeNodeArray(nodes) {
  13736. const array = [];
  13737. nodes.forEach((x) => {
  13738. if (Array.isArray(x)) {
  13739. normalizeNodeArray(x).forEach((item) => {
  13740. array.push(item);
  13741. });
  13742. } else if (x) {
  13743. array.push(x);
  13744. }
  13745. });
  13746. if (array.length > 0 && isSpacing(array[array.length - 1])) {
  13747. array.pop();
  13748. }
  13749. return array;
  13750. }
  13751. function localizeNode(rule, mode, localAliasMap) {
  13752. const transform = (node, context) => {
  13753. if (context.ignoreNextSpacing && !isSpacing(node)) {
  13754. throw new Error("Missing whitespace after " + context.ignoreNextSpacing);
  13755. }
  13756. if (context.enforceNoSpacing && isSpacing(node)) {
  13757. throw new Error("Missing whitespace before " + context.enforceNoSpacing);
  13758. }
  13759. let newNodes;
  13760. switch (node.type) {
  13761. case "root": {
  13762. let resultingGlobal;
  13763. context.hasPureGlobals = false;
  13764. newNodes = node.nodes.map((n) => {
  13765. const nContext = {
  13766. global: context.global,
  13767. lastWasSpacing: true,
  13768. hasLocals: false,
  13769. explicit: false,
  13770. };
  13771. n = transform(n, nContext);
  13772. if (typeof resultingGlobal === "undefined") {
  13773. resultingGlobal = nContext.global;
  13774. } else if (resultingGlobal !== nContext.global) {
  13775. throw new Error(
  13776. 'Inconsistent rule global/local result in rule "' +
  13777. node +
  13778. '" (multiple selectors must result in the same mode for the rule)'
  13779. );
  13780. }
  13781. if (!nContext.hasLocals) {
  13782. context.hasPureGlobals = true;
  13783. }
  13784. return n;
  13785. });
  13786. context.global = resultingGlobal;
  13787. node.nodes = normalizeNodeArray(newNodes);
  13788. break;
  13789. }
  13790. case "selector": {
  13791. newNodes = node.map((childNode) => transform(childNode, context));
  13792. node = node.clone();
  13793. node.nodes = normalizeNodeArray(newNodes);
  13794. break;
  13795. }
  13796. case "combinator": {
  13797. if (isSpacing(node)) {
  13798. if (context.ignoreNextSpacing) {
  13799. context.ignoreNextSpacing = false;
  13800. context.lastWasSpacing = false;
  13801. context.enforceNoSpacing = false;
  13802. return null;
  13803. }
  13804. context.lastWasSpacing = true;
  13805. return node;
  13806. }
  13807. break;
  13808. }
  13809. case "pseudo": {
  13810. let childContext;
  13811. const isNested = !!node.length;
  13812. const isScoped = node.value === ":local" || node.value === ":global";
  13813. const isImportExport =
  13814. node.value === ":import" || node.value === ":export";
  13815. if (isImportExport) {
  13816. context.hasLocals = true;
  13817. // :local(.foo)
  13818. } else if (isNested) {
  13819. if (isScoped) {
  13820. if (node.nodes.length === 0) {
  13821. throw new Error(`${node.value}() can't be empty`);
  13822. }
  13823. if (context.inside) {
  13824. throw new Error(
  13825. `A ${node.value} is not allowed inside of a ${context.inside}(...)`
  13826. );
  13827. }
  13828. childContext = {
  13829. global: node.value === ":global",
  13830. inside: node.value,
  13831. hasLocals: false,
  13832. explicit: true,
  13833. };
  13834. newNodes = node
  13835. .map((childNode) => transform(childNode, childContext))
  13836. .reduce((acc, next) => acc.concat(next.nodes), []);
  13837. if (newNodes.length) {
  13838. const { before, after } = node.spaces;
  13839. const first = newNodes[0];
  13840. const last = newNodes[newNodes.length - 1];
  13841. first.spaces = { before, after: first.spaces.after };
  13842. last.spaces = { before: last.spaces.before, after };
  13843. }
  13844. node = newNodes;
  13845. break;
  13846. } else {
  13847. childContext = {
  13848. global: context.global,
  13849. inside: context.inside,
  13850. lastWasSpacing: true,
  13851. hasLocals: false,
  13852. explicit: context.explicit,
  13853. };
  13854. newNodes = node.map((childNode) =>
  13855. transform(childNode, childContext)
  13856. );
  13857. node = node.clone();
  13858. node.nodes = normalizeNodeArray(newNodes);
  13859. if (childContext.hasLocals) {
  13860. context.hasLocals = true;
  13861. }
  13862. }
  13863. break;
  13864. //:local .foo .bar
  13865. } else if (isScoped) {
  13866. if (context.inside) {
  13867. throw new Error(
  13868. `A ${node.value} is not allowed inside of a ${context.inside}(...)`
  13869. );
  13870. }
  13871. const addBackSpacing = !!node.spaces.before;
  13872. context.ignoreNextSpacing = context.lastWasSpacing
  13873. ? node.value
  13874. : false;
  13875. context.enforceNoSpacing = context.lastWasSpacing
  13876. ? false
  13877. : node.value;
  13878. context.global = node.value === ":global";
  13879. context.explicit = true;
  13880. // because this node has spacing that is lost when we remove it
  13881. // we make up for it by adding an extra combinator in since adding
  13882. // spacing on the parent selector doesn't work
  13883. return addBackSpacing
  13884. ? dist.combinator({ value: " " })
  13885. : null;
  13886. }
  13887. break;
  13888. }
  13889. case "id":
  13890. case "class": {
  13891. if (!node.value) {
  13892. throw new Error("Invalid class or id selector syntax");
  13893. }
  13894. if (context.global) {
  13895. break;
  13896. }
  13897. const isImportedValue = localAliasMap.has(node.value);
  13898. const isImportedWithExplicitScope = isImportedValue && context.explicit;
  13899. if (!isImportedValue || isImportedWithExplicitScope) {
  13900. const innerNode = node.clone();
  13901. innerNode.spaces = { before: "", after: "" };
  13902. node = dist.pseudo({
  13903. value: ":local",
  13904. nodes: [innerNode],
  13905. spaces: node.spaces,
  13906. });
  13907. context.hasLocals = true;
  13908. }
  13909. break;
  13910. }
  13911. }
  13912. context.lastWasSpacing = false;
  13913. context.ignoreNextSpacing = false;
  13914. context.enforceNoSpacing = false;
  13915. return node;
  13916. };
  13917. const rootContext = {
  13918. global: mode === "global",
  13919. hasPureGlobals: false,
  13920. };
  13921. rootContext.selector = dist((root) => {
  13922. transform(root, rootContext);
  13923. }).processSync(rule, { updateSelector: false, lossless: true });
  13924. return rootContext;
  13925. }
  13926. function localizeDeclNode(node, context) {
  13927. switch (node.type) {
  13928. case "word":
  13929. if (context.localizeNextItem) {
  13930. if (!context.localAliasMap.has(node.value)) {
  13931. node.value = ":local(" + node.value + ")";
  13932. context.localizeNextItem = false;
  13933. }
  13934. }
  13935. break;
  13936. case "function":
  13937. if (
  13938. context.options &&
  13939. context.options.rewriteUrl &&
  13940. node.value.toLowerCase() === "url"
  13941. ) {
  13942. node.nodes.map((nestedNode) => {
  13943. if (nestedNode.type !== "string" && nestedNode.type !== "word") {
  13944. return;
  13945. }
  13946. let newUrl = context.options.rewriteUrl(
  13947. context.global,
  13948. nestedNode.value
  13949. );
  13950. switch (nestedNode.type) {
  13951. case "string":
  13952. if (nestedNode.quote === "'") {
  13953. newUrl = newUrl.replace(/(\\)/g, "\\$1").replace(/'/g, "\\'");
  13954. }
  13955. if (nestedNode.quote === '"') {
  13956. newUrl = newUrl.replace(/(\\)/g, "\\$1").replace(/"/g, '\\"');
  13957. }
  13958. break;
  13959. case "word":
  13960. newUrl = newUrl.replace(/("|'|\)|\\)/g, "\\$1");
  13961. break;
  13962. }
  13963. nestedNode.value = newUrl;
  13964. });
  13965. }
  13966. break;
  13967. }
  13968. return node;
  13969. }
  13970. function isWordAFunctionArgument(wordNode, functionNode) {
  13971. return functionNode
  13972. ? functionNode.nodes.some(
  13973. (functionNodeChild) =>
  13974. functionNodeChild.sourceIndex === wordNode.sourceIndex
  13975. )
  13976. : false;
  13977. }
  13978. function localizeDeclarationValues(localize, declaration, context) {
  13979. const valueNodes = lib$3(declaration.value);
  13980. valueNodes.walk((node, index, nodes) => {
  13981. const subContext = {
  13982. options: context.options,
  13983. global: context.global,
  13984. localizeNextItem: localize && !context.global,
  13985. localAliasMap: context.localAliasMap,
  13986. };
  13987. nodes[index] = localizeDeclNode(node, subContext);
  13988. });
  13989. declaration.value = valueNodes.toString();
  13990. }
  13991. function localizeDeclaration(declaration, context) {
  13992. const isAnimation = /animation$/i.test(declaration.prop);
  13993. if (isAnimation) {
  13994. const validIdent = /^-?[_a-z][_a-z0-9-]*$/i;
  13995. /*
  13996. The spec defines some keywords that you can use to describe properties such as the timing
  13997. function. These are still valid animation names, so as long as there is a property that accepts
  13998. a keyword, it is given priority. Only when all the properties that can take a keyword are
  13999. exhausted can the animation name be set to the keyword. I.e.
  14000. animation: infinite infinite;
  14001. The animation will repeat an infinite number of times from the first argument, and will have an
  14002. animation name of infinite from the second.
  14003. */
  14004. const animationKeywords = {
  14005. $alternate: 1,
  14006. "$alternate-reverse": 1,
  14007. $backwards: 1,
  14008. $both: 1,
  14009. $ease: 1,
  14010. "$ease-in": 1,
  14011. "$ease-in-out": 1,
  14012. "$ease-out": 1,
  14013. $forwards: 1,
  14014. $infinite: 1,
  14015. $linear: 1,
  14016. $none: Infinity, // No matter how many times you write none, it will never be an animation name
  14017. $normal: 1,
  14018. $paused: 1,
  14019. $reverse: 1,
  14020. $running: 1,
  14021. "$step-end": 1,
  14022. "$step-start": 1,
  14023. $initial: Infinity,
  14024. $inherit: Infinity,
  14025. $unset: Infinity,
  14026. };
  14027. let parsedAnimationKeywords = {};
  14028. let stepsFunctionNode = null;
  14029. const valueNodes = lib$3(declaration.value).walk((node) => {
  14030. /* If div-token appeared (represents as comma ','), a possibility of an animation-keywords should be reflesh. */
  14031. if (node.type === "div") {
  14032. parsedAnimationKeywords = {};
  14033. }
  14034. if (node.type === "function" && node.value.toLowerCase() === "steps") {
  14035. stepsFunctionNode = node;
  14036. }
  14037. const value =
  14038. node.type === "word" &&
  14039. !isWordAFunctionArgument(node, stepsFunctionNode)
  14040. ? node.value.toLowerCase()
  14041. : null;
  14042. let shouldParseAnimationName = false;
  14043. if (value && validIdent.test(value)) {
  14044. if ("$" + value in animationKeywords) {
  14045. parsedAnimationKeywords["$" + value] =
  14046. "$" + value in parsedAnimationKeywords
  14047. ? parsedAnimationKeywords["$" + value] + 1
  14048. : 0;
  14049. shouldParseAnimationName =
  14050. parsedAnimationKeywords["$" + value] >=
  14051. animationKeywords["$" + value];
  14052. } else {
  14053. shouldParseAnimationName = true;
  14054. }
  14055. }
  14056. const subContext = {
  14057. options: context.options,
  14058. global: context.global,
  14059. localizeNextItem: shouldParseAnimationName && !context.global,
  14060. localAliasMap: context.localAliasMap,
  14061. };
  14062. return localizeDeclNode(node, subContext);
  14063. });
  14064. declaration.value = valueNodes.toString();
  14065. return;
  14066. }
  14067. const isAnimationName = /animation(-name)?$/i.test(declaration.prop);
  14068. if (isAnimationName) {
  14069. return localizeDeclarationValues(true, declaration, context);
  14070. }
  14071. const hasUrl = /url\(/i.test(declaration.value);
  14072. if (hasUrl) {
  14073. return localizeDeclarationValues(false, declaration, context);
  14074. }
  14075. }
  14076. var src$1 = (options = {}) => {
  14077. if (
  14078. options &&
  14079. options.mode &&
  14080. options.mode !== "global" &&
  14081. options.mode !== "local" &&
  14082. options.mode !== "pure"
  14083. ) {
  14084. throw new Error(
  14085. 'options.mode must be either "global", "local" or "pure" (default "local")'
  14086. );
  14087. }
  14088. const pureMode = options && options.mode === "pure";
  14089. const globalMode = options && options.mode === "global";
  14090. return {
  14091. postcssPlugin: "postcss-modules-local-by-default",
  14092. prepare() {
  14093. const localAliasMap = new Map();
  14094. return {
  14095. Once(root) {
  14096. const { icssImports } = extractICSS$1(root, false);
  14097. Object.keys(icssImports).forEach((key) => {
  14098. Object.keys(icssImports[key]).forEach((prop) => {
  14099. localAliasMap.set(prop, icssImports[key][prop]);
  14100. });
  14101. });
  14102. root.walkAtRules((atRule) => {
  14103. if (/keyframes$/i.test(atRule.name)) {
  14104. const globalMatch = /^\s*:global\s*\((.+)\)\s*$/.exec(
  14105. atRule.params
  14106. );
  14107. const localMatch = /^\s*:local\s*\((.+)\)\s*$/.exec(
  14108. atRule.params
  14109. );
  14110. let globalKeyframes = globalMode;
  14111. if (globalMatch) {
  14112. if (pureMode) {
  14113. throw atRule.error(
  14114. "@keyframes :global(...) is not allowed in pure mode"
  14115. );
  14116. }
  14117. atRule.params = globalMatch[1];
  14118. globalKeyframes = true;
  14119. } else if (localMatch) {
  14120. atRule.params = localMatch[0];
  14121. globalKeyframes = false;
  14122. } else if (!globalMode) {
  14123. if (atRule.params && !localAliasMap.has(atRule.params)) {
  14124. atRule.params = ":local(" + atRule.params + ")";
  14125. }
  14126. }
  14127. atRule.walkDecls((declaration) => {
  14128. localizeDeclaration(declaration, {
  14129. localAliasMap,
  14130. options: options,
  14131. global: globalKeyframes,
  14132. });
  14133. });
  14134. } else if (atRule.nodes) {
  14135. atRule.nodes.forEach((declaration) => {
  14136. if (declaration.type === "decl") {
  14137. localizeDeclaration(declaration, {
  14138. localAliasMap,
  14139. options: options,
  14140. global: globalMode,
  14141. });
  14142. }
  14143. });
  14144. }
  14145. });
  14146. root.walkRules((rule) => {
  14147. if (
  14148. rule.parent &&
  14149. rule.parent.type === "atrule" &&
  14150. /keyframes$/i.test(rule.parent.name)
  14151. ) {
  14152. // ignore keyframe rules
  14153. return;
  14154. }
  14155. const context = localizeNode(rule, options.mode, localAliasMap);
  14156. context.options = options;
  14157. context.localAliasMap = localAliasMap;
  14158. if (pureMode && context.hasPureGlobals) {
  14159. throw rule.error(
  14160. 'Selector "' +
  14161. rule.selector +
  14162. '" is not pure ' +
  14163. "(pure selectors must contain at least one local class or id)"
  14164. );
  14165. }
  14166. rule.selector = context.selector;
  14167. // Less-syntax mixins parse as rules with no nodes
  14168. if (rule.nodes) {
  14169. rule.nodes.forEach((declaration) =>
  14170. localizeDeclaration(declaration, context)
  14171. );
  14172. }
  14173. });
  14174. },
  14175. };
  14176. },
  14177. };
  14178. };
  14179. var postcss = true;
  14180. src$1.postcss = postcss;
  14181. const PERMANENT_MARKER = 2;
  14182. const TEMPORARY_MARKER = 1;
  14183. function createError(node, graph) {
  14184. const er = new Error("Nondeterministic import's order");
  14185. const related = graph[node];
  14186. const relatedNode = related.find(
  14187. (relatedNode) => graph[relatedNode].indexOf(node) > -1
  14188. );
  14189. er.nodes = [node, relatedNode];
  14190. return er;
  14191. }
  14192. function walkGraph(node, graph, state, result, strict) {
  14193. if (state[node] === PERMANENT_MARKER) {
  14194. return;
  14195. }
  14196. if (state[node] === TEMPORARY_MARKER) {
  14197. if (strict) {
  14198. return createError(node, graph);
  14199. }
  14200. return;
  14201. }
  14202. state[node] = TEMPORARY_MARKER;
  14203. const children = graph[node];
  14204. const length = children.length;
  14205. for (let i = 0; i < length; ++i) {
  14206. const error = walkGraph(children[i], graph, state, result, strict);
  14207. if (error instanceof Error) {
  14208. return error;
  14209. }
  14210. }
  14211. state[node] = PERMANENT_MARKER;
  14212. result.push(node);
  14213. }
  14214. function topologicalSort(graph, strict) {
  14215. const result = [];
  14216. const state = {};
  14217. const nodes = Object.keys(graph);
  14218. const length = nodes.length;
  14219. for (let i = 0; i < length; ++i) {
  14220. const er = walkGraph(nodes[i], graph, state, result, strict);
  14221. if (er instanceof Error) {
  14222. return er;
  14223. }
  14224. }
  14225. return result;
  14226. }
  14227. var topologicalSort_1 = topologicalSort;
  14228. const matchImports = /^(.+?)\s+from\s+(?:"([^"]+)"|'([^']+)'|(global))$/;
  14229. const icssImport = /^:import\((?:"([^"]+)"|'([^']+)')\)/;
  14230. const VISITED_MARKER = 1;
  14231. /**
  14232. * :import('G') {}
  14233. *
  14234. * Rule
  14235. * composes: ... from 'A'
  14236. * composes: ... from 'B'
  14237. * Rule
  14238. * composes: ... from 'A'
  14239. * composes: ... from 'A'
  14240. * composes: ... from 'C'
  14241. *
  14242. * Results in:
  14243. *
  14244. * graph: {
  14245. * G: [],
  14246. * A: [],
  14247. * B: ['A'],
  14248. * C: ['A'],
  14249. * }
  14250. */
  14251. function addImportToGraph(importId, parentId, graph, visited) {
  14252. const siblingsId = parentId + "_" + "siblings";
  14253. const visitedId = parentId + "_" + importId;
  14254. if (visited[visitedId] !== VISITED_MARKER) {
  14255. if (!Array.isArray(visited[siblingsId])) {
  14256. visited[siblingsId] = [];
  14257. }
  14258. const siblings = visited[siblingsId];
  14259. if (Array.isArray(graph[importId])) {
  14260. graph[importId] = graph[importId].concat(siblings);
  14261. } else {
  14262. graph[importId] = siblings.slice();
  14263. }
  14264. visited[visitedId] = VISITED_MARKER;
  14265. siblings.push(importId);
  14266. }
  14267. }
  14268. var src$2 = (options = {}) => {
  14269. let importIndex = 0;
  14270. const createImportedName =
  14271. typeof options.createImportedName !== "function"
  14272. ? (importName /*, path*/) =>
  14273. `i__imported_${importName.replace(/\W/g, "_")}_${importIndex++}`
  14274. : options.createImportedName;
  14275. const failOnWrongOrder = options.failOnWrongOrder;
  14276. return {
  14277. postcssPlugin: "postcss-modules-extract-imports",
  14278. prepare() {
  14279. const graph = {};
  14280. const visited = {};
  14281. const existingImports = {};
  14282. const importDecls = {};
  14283. const imports = {};
  14284. return {
  14285. Once(root, postcss) {
  14286. // Check the existing imports order and save refs
  14287. root.walkRules((rule) => {
  14288. const matches = icssImport.exec(rule.selector);
  14289. if (matches) {
  14290. const [, /*match*/ doubleQuotePath, singleQuotePath] = matches;
  14291. const importPath = doubleQuotePath || singleQuotePath;
  14292. addImportToGraph(importPath, "root", graph, visited);
  14293. existingImports[importPath] = rule;
  14294. }
  14295. });
  14296. root.walkDecls(/^composes$/, (declaration) => {
  14297. const matches = declaration.value.match(matchImports);
  14298. if (!matches) {
  14299. return;
  14300. }
  14301. let tmpSymbols;
  14302. let [
  14303. ,
  14304. /*match*/ symbols,
  14305. doubleQuotePath,
  14306. singleQuotePath,
  14307. global,
  14308. ] = matches;
  14309. if (global) {
  14310. // Composing globals simply means changing these classes to wrap them in global(name)
  14311. tmpSymbols = symbols.split(/\s+/).map((s) => `global(${s})`);
  14312. } else {
  14313. const importPath = doubleQuotePath || singleQuotePath;
  14314. let parent = declaration.parent;
  14315. let parentIndexes = "";
  14316. while (parent.type !== "root") {
  14317. parentIndexes =
  14318. parent.parent.index(parent) + "_" + parentIndexes;
  14319. parent = parent.parent;
  14320. }
  14321. const { selector } = declaration.parent;
  14322. const parentRule = `_${parentIndexes}${selector}`;
  14323. addImportToGraph(importPath, parentRule, graph, visited);
  14324. importDecls[importPath] = declaration;
  14325. imports[importPath] = imports[importPath] || {};
  14326. tmpSymbols = symbols.split(/\s+/).map((s) => {
  14327. if (!imports[importPath][s]) {
  14328. imports[importPath][s] = createImportedName(s, importPath);
  14329. }
  14330. return imports[importPath][s];
  14331. });
  14332. }
  14333. declaration.value = tmpSymbols.join(" ");
  14334. });
  14335. const importsOrder = topologicalSort_1(graph, failOnWrongOrder);
  14336. if (importsOrder instanceof Error) {
  14337. const importPath = importsOrder.nodes.find((importPath) =>
  14338. // eslint-disable-next-line no-prototype-builtins
  14339. importDecls.hasOwnProperty(importPath)
  14340. );
  14341. const decl = importDecls[importPath];
  14342. throw decl.error(
  14343. "Failed to resolve order of composed modules " +
  14344. importsOrder.nodes
  14345. .map((importPath) => "`" + importPath + "`")
  14346. .join(", ") +
  14347. ".",
  14348. {
  14349. plugin: "postcss-modules-extract-imports",
  14350. word: "composes",
  14351. }
  14352. );
  14353. }
  14354. let lastImportRule;
  14355. importsOrder.forEach((path) => {
  14356. const importedSymbols = imports[path];
  14357. let rule = existingImports[path];
  14358. if (!rule && importedSymbols) {
  14359. rule = postcss.rule({
  14360. selector: `:import("${path}")`,
  14361. raws: { after: "\n" },
  14362. });
  14363. if (lastImportRule) {
  14364. root.insertAfter(lastImportRule, rule);
  14365. } else {
  14366. root.prepend(rule);
  14367. }
  14368. }
  14369. lastImportRule = rule;
  14370. if (!importedSymbols) {
  14371. return;
  14372. }
  14373. Object.keys(importedSymbols).forEach((importedSymbol) => {
  14374. rule.append(
  14375. postcss.decl({
  14376. value: importedSymbol,
  14377. prop: importedSymbols[importedSymbol],
  14378. raws: { before: "\n " },
  14379. })
  14380. );
  14381. });
  14382. });
  14383. },
  14384. };
  14385. },
  14386. };
  14387. };
  14388. var postcss$1 = true;
  14389. src$2.postcss = postcss$1;
  14390. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  14391. function getSingleLocalNamesForComposes(root) {
  14392. return root.nodes.map((node) => {
  14393. if (node.type !== "selector" || node.nodes.length !== 1) {
  14394. throw new Error(
  14395. `composition is only allowed when selector is single :local class name not in "${root}"`
  14396. );
  14397. }
  14398. node = node.nodes[0];
  14399. if (
  14400. node.type !== "pseudo" ||
  14401. node.value !== ":local" ||
  14402. node.nodes.length !== 1
  14403. ) {
  14404. throw new Error(
  14405. 'composition is only allowed when selector is single :local class name not in "' +
  14406. root +
  14407. '", "' +
  14408. node +
  14409. '" is weird'
  14410. );
  14411. }
  14412. node = node.first;
  14413. if (node.type !== "selector" || node.length !== 1) {
  14414. throw new Error(
  14415. 'composition is only allowed when selector is single :local class name not in "' +
  14416. root +
  14417. '", "' +
  14418. node +
  14419. '" is weird'
  14420. );
  14421. }
  14422. node = node.first;
  14423. if (node.type !== "class") {
  14424. // 'id' is not possible, because you can't compose ids
  14425. throw new Error(
  14426. 'composition is only allowed when selector is single :local class name not in "' +
  14427. root +
  14428. '", "' +
  14429. node +
  14430. '" is weird'
  14431. );
  14432. }
  14433. return node.value;
  14434. });
  14435. }
  14436. const whitespace = "[\\x20\\t\\r\\n\\f]";
  14437. const unescapeRegExp = new RegExp(
  14438. "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)",
  14439. "ig"
  14440. );
  14441. function unescape(str) {
  14442. return str.replace(unescapeRegExp, (_, escaped, escapedWhitespace) => {
  14443. const high = "0x" + escaped - 0x10000;
  14444. // NaN means non-codepoint
  14445. // Workaround erroneous numeric interpretation of +"0x"
  14446. return high !== high || escapedWhitespace
  14447. ? escaped
  14448. : high < 0
  14449. ? // BMP codepoint
  14450. String.fromCharCode(high + 0x10000)
  14451. : // Supplemental Plane codepoint (surrogate pair)
  14452. String.fromCharCode((high >> 10) | 0xd800, (high & 0x3ff) | 0xdc00);
  14453. });
  14454. }
  14455. const plugin = (options = {}) => {
  14456. const generateScopedName =
  14457. (options && options.generateScopedName) || plugin.generateScopedName;
  14458. const generateExportEntry =
  14459. (options && options.generateExportEntry) || plugin.generateExportEntry;
  14460. const exportGlobals = options && options.exportGlobals;
  14461. return {
  14462. postcssPlugin: "postcss-modules-scope",
  14463. Once(root, { rule }) {
  14464. const exports = Object.create(null);
  14465. function exportScopedName(name, rawName) {
  14466. const scopedName = generateScopedName(
  14467. rawName ? rawName : name,
  14468. root.source.input.from,
  14469. root.source.input.css
  14470. );
  14471. const exportEntry = generateExportEntry(
  14472. rawName ? rawName : name,
  14473. scopedName,
  14474. root.source.input.from,
  14475. root.source.input.css
  14476. );
  14477. const { key, value } = exportEntry;
  14478. exports[key] = exports[key] || [];
  14479. if (exports[key].indexOf(value) < 0) {
  14480. exports[key].push(value);
  14481. }
  14482. return scopedName;
  14483. }
  14484. function localizeNode(node) {
  14485. switch (node.type) {
  14486. case "selector":
  14487. node.nodes = node.map(localizeNode);
  14488. return node;
  14489. case "class":
  14490. return dist.className({
  14491. value: exportScopedName(
  14492. node.value,
  14493. node.raws && node.raws.value ? node.raws.value : null
  14494. ),
  14495. });
  14496. case "id": {
  14497. return dist.id({
  14498. value: exportScopedName(
  14499. node.value,
  14500. node.raws && node.raws.value ? node.raws.value : null
  14501. ),
  14502. });
  14503. }
  14504. }
  14505. throw new Error(
  14506. `${node.type} ("${node}") is not allowed in a :local block`
  14507. );
  14508. }
  14509. function traverseNode(node) {
  14510. switch (node.type) {
  14511. case "pseudo":
  14512. if (node.value === ":local") {
  14513. if (node.nodes.length !== 1) {
  14514. throw new Error('Unexpected comma (",") in :local block');
  14515. }
  14516. const selector = localizeNode(node.first, node.spaces);
  14517. // move the spaces that were around the psuedo selector to the first
  14518. // non-container node
  14519. selector.first.spaces = node.spaces;
  14520. const nextNode = node.next();
  14521. if (
  14522. nextNode &&
  14523. nextNode.type === "combinator" &&
  14524. nextNode.value === " " &&
  14525. /\\[A-F0-9]{1,6}$/.test(selector.last.value)
  14526. ) {
  14527. selector.last.spaces.after = " ";
  14528. }
  14529. node.replaceWith(selector);
  14530. return;
  14531. }
  14532. /* falls through */
  14533. case "root":
  14534. case "selector": {
  14535. node.each(traverseNode);
  14536. break;
  14537. }
  14538. case "id":
  14539. case "class":
  14540. if (exportGlobals) {
  14541. exports[node.value] = [node.value];
  14542. }
  14543. break;
  14544. }
  14545. return node;
  14546. }
  14547. // Find any :import and remember imported names
  14548. const importedNames = {};
  14549. root.walkRules(/^:import\(.+\)$/, (rule) => {
  14550. rule.walkDecls((decl) => {
  14551. importedNames[decl.prop] = true;
  14552. });
  14553. });
  14554. // Find any :local selectors
  14555. root.walkRules((rule) => {
  14556. let parsedSelector = dist().astSync(rule);
  14557. rule.selector = traverseNode(parsedSelector.clone()).toString();
  14558. rule.walkDecls(/composes|compose-with/i, (decl) => {
  14559. const localNames = getSingleLocalNamesForComposes(parsedSelector);
  14560. const classes = decl.value.split(/\s+/);
  14561. classes.forEach((className) => {
  14562. const global = /^global\(([^)]+)\)$/.exec(className);
  14563. if (global) {
  14564. localNames.forEach((exportedName) => {
  14565. exports[exportedName].push(global[1]);
  14566. });
  14567. } else if (hasOwnProperty$1.call(importedNames, className)) {
  14568. localNames.forEach((exportedName) => {
  14569. exports[exportedName].push(className);
  14570. });
  14571. } else if (hasOwnProperty$1.call(exports, className)) {
  14572. localNames.forEach((exportedName) => {
  14573. exports[className].forEach((item) => {
  14574. exports[exportedName].push(item);
  14575. });
  14576. });
  14577. } else {
  14578. throw decl.error(
  14579. `referenced class name "${className}" in ${decl.prop} not found`
  14580. );
  14581. }
  14582. });
  14583. decl.remove();
  14584. });
  14585. // Find any :local values
  14586. rule.walkDecls((decl) => {
  14587. if (!/:local\s*\((.+?)\)/.test(decl.value)) {
  14588. return;
  14589. }
  14590. let tokens = decl.value.split(/(,|'[^']*'|"[^"]*")/);
  14591. tokens = tokens.map((token, idx) => {
  14592. if (idx === 0 || tokens[idx - 1] === ",") {
  14593. let result = token;
  14594. const localMatch = /:local\s*\((.+?)\)/.exec(token);
  14595. if (localMatch) {
  14596. const input = localMatch.input;
  14597. const matchPattern = localMatch[0];
  14598. const matchVal = localMatch[1];
  14599. const newVal = exportScopedName(matchVal);
  14600. result = input.replace(matchPattern, newVal);
  14601. } else {
  14602. return token;
  14603. }
  14604. return result;
  14605. } else {
  14606. return token;
  14607. }
  14608. });
  14609. decl.value = tokens.join("");
  14610. });
  14611. });
  14612. // Find any :local keyframes
  14613. root.walkAtRules(/keyframes$/i, (atRule) => {
  14614. const localMatch = /^\s*:local\s*\((.+?)\)\s*$/.exec(atRule.params);
  14615. if (!localMatch) {
  14616. return;
  14617. }
  14618. atRule.params = exportScopedName(localMatch[1]);
  14619. });
  14620. // If we found any :locals, insert an :export rule
  14621. const exportedNames = Object.keys(exports);
  14622. if (exportedNames.length > 0) {
  14623. const exportRule = rule({ selector: ":export" });
  14624. exportedNames.forEach((exportedName) =>
  14625. exportRule.append({
  14626. prop: exportedName,
  14627. value: exports[exportedName].join(" "),
  14628. raws: { before: "\n " },
  14629. })
  14630. );
  14631. root.append(exportRule);
  14632. }
  14633. },
  14634. };
  14635. };
  14636. plugin.postcss = true;
  14637. plugin.generateScopedName = function (name, path) {
  14638. const sanitisedPath = path
  14639. .replace(/\.[^./\\]+$/, "")
  14640. .replace(/[\W_]+/g, "_")
  14641. .replace(/^_|_$/g, "");
  14642. return `_${sanitisedPath}__${name}`.trim();
  14643. };
  14644. plugin.generateExportEntry = function (name, scopedName) {
  14645. return {
  14646. key: unescape(name),
  14647. value: unescape(scopedName),
  14648. };
  14649. };
  14650. var src$3 = plugin;
  14651. const matchImports$1 = /^(.+?|\([\s\S]+?\))\s+from\s+("[^"]*"|'[^']*'|[\w-]+)$/;
  14652. const matchValueDefinition = /(?:\s+|^)([\w-]+):?(.*?)$/;
  14653. const matchImport = /^([\w-]+)(?:\s+as\s+([\w-]+))?/;
  14654. var src$4 = (options) => {
  14655. let importIndex = 0;
  14656. const createImportedName =
  14657. (options && options.createImportedName) ||
  14658. ((importName /*, path*/) =>
  14659. `i__const_${importName.replace(/\W/g, "_")}_${importIndex++}`);
  14660. return {
  14661. postcssPlugin: "postcss-modules-values",
  14662. prepare(result) {
  14663. const importAliases = [];
  14664. const definitions = {};
  14665. return {
  14666. Once(root, postcss) {
  14667. root.walkAtRules(/value/i, (atRule) => {
  14668. const matches = atRule.params.match(matchImports$1);
  14669. if (matches) {
  14670. let [, /*match*/ aliases, path] = matches;
  14671. // We can use constants for path names
  14672. if (definitions[path]) {
  14673. path = definitions[path];
  14674. }
  14675. const imports = aliases
  14676. .replace(/^\(\s*([\s\S]+)\s*\)$/, "$1")
  14677. .split(/\s*,\s*/)
  14678. .map((alias) => {
  14679. const tokens = matchImport.exec(alias);
  14680. if (tokens) {
  14681. const [, /*match*/ theirName, myName = theirName] = tokens;
  14682. const importedName = createImportedName(myName);
  14683. definitions[myName] = importedName;
  14684. return { theirName, importedName };
  14685. } else {
  14686. throw new Error(`@import statement "${alias}" is invalid!`);
  14687. }
  14688. });
  14689. importAliases.push({ path, imports });
  14690. atRule.remove();
  14691. return;
  14692. }
  14693. if (atRule.params.indexOf("@value") !== -1) {
  14694. result.warn("Invalid value definition: " + atRule.params);
  14695. }
  14696. let [, key, value] = `${atRule.params}${atRule.raws.between}`.match(
  14697. matchValueDefinition
  14698. );
  14699. const normalizedValue = value.replace(/\/\*((?!\*\/).*?)\*\//g, "");
  14700. if (normalizedValue.length === 0) {
  14701. result.warn("Invalid value definition: " + atRule.params);
  14702. atRule.remove();
  14703. return;
  14704. }
  14705. let isOnlySpace = /^\s+$/.test(normalizedValue);
  14706. if (!isOnlySpace) {
  14707. value = value.trim();
  14708. }
  14709. // Add to the definitions, knowing that values can refer to each other
  14710. definitions[key] = src.replaceValueSymbols(
  14711. value,
  14712. definitions
  14713. );
  14714. atRule.remove();
  14715. });
  14716. /* If we have no definitions, don't continue */
  14717. if (!Object.keys(definitions).length) {
  14718. return;
  14719. }
  14720. /* Perform replacements */
  14721. src.replaceSymbols(root, definitions);
  14722. /* 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 */
  14723. const exportDeclarations = Object.keys(definitions).map((key) =>
  14724. postcss.decl({
  14725. value: definitions[key],
  14726. prop: key,
  14727. raws: { before: "\n " },
  14728. })
  14729. );
  14730. /* Add export rules if any */
  14731. if (exportDeclarations.length > 0) {
  14732. const exportRule = postcss.rule({
  14733. selector: ":export",
  14734. raws: { after: "\n" },
  14735. });
  14736. exportRule.append(exportDeclarations);
  14737. root.prepend(exportRule);
  14738. }
  14739. /* Add import rules */
  14740. importAliases.reverse().forEach(({ path, imports }) => {
  14741. const importRule = postcss.rule({
  14742. selector: `:import(${path})`,
  14743. raws: { after: "\n" },
  14744. });
  14745. imports.forEach(({ theirName, importedName }) => {
  14746. importRule.append({
  14747. value: theirName,
  14748. prop: importedName,
  14749. raws: { before: "\n " },
  14750. });
  14751. });
  14752. root.prepend(importRule);
  14753. });
  14754. },
  14755. };
  14756. },
  14757. };
  14758. };
  14759. var postcss$2 = true;
  14760. src$4.postcss = postcss$2;
  14761. var behaviours_1 = createCommonjsModule(function (module, exports) {
  14762. Object.defineProperty(exports, "__esModule", {
  14763. value: true
  14764. });
  14765. exports.behaviours = undefined;
  14766. exports.getDefaultPlugins = getDefaultPlugins;
  14767. exports.isValidBehaviour = isValidBehaviour;
  14768. var _postcssModulesLocalByDefault2 = _interopRequireDefault(src$1);
  14769. var _postcssModulesExtractImports2 = _interopRequireDefault(src$2);
  14770. var _postcssModulesScope2 = _interopRequireDefault(src$3);
  14771. var _postcssModulesValues2 = _interopRequireDefault(src$4);
  14772. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14773. const behaviours = exports.behaviours = {
  14774. LOCAL: "local",
  14775. GLOBAL: "global"
  14776. };
  14777. function getDefaultPlugins({
  14778. behaviour,
  14779. generateScopedName,
  14780. exportGlobals
  14781. }) {
  14782. const scope = (0, _postcssModulesScope2.default)({ generateScopedName, exportGlobals });
  14783. const plugins = {
  14784. [behaviours.LOCAL]: [_postcssModulesValues2.default, _postcssModulesLocalByDefault2.default, _postcssModulesExtractImports2.default, scope],
  14785. [behaviours.GLOBAL]: [_postcssModulesValues2.default, _postcssModulesExtractImports2.default, scope]
  14786. };
  14787. return plugins[behaviour];
  14788. }
  14789. function isValidBehaviour(behaviour) {
  14790. return Object.keys(behaviours).map(key => behaviours[key]).indexOf(behaviour) > -1;
  14791. }
  14792. });
  14793. var _postcss2$1 = _interopRequireDefault$3(_postcss__default);
  14794. var _lodash2 = _interopRequireDefault$3(lodash_camelcase);
  14795. var _genericNames2 = _interopRequireDefault$3(genericNames);
  14796. var _unquote2 = _interopRequireDefault$3(unquote_1);
  14797. var _parser2$1 = _interopRequireDefault$3(parser$1);
  14798. var _loader2 = _interopRequireDefault$3(loader);
  14799. var _generateScopedName2 = _interopRequireDefault$3(generateScopedName_1);
  14800. var _saveJSON2 = _interopRequireDefault$3(saveJSON_1);
  14801. function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14802. 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"); }); }; }
  14803. const PLUGIN_NAME = "postcss-modules";
  14804. function getDefaultScopeBehaviour(opts) {
  14805. if (opts.scopeBehaviour && (0, behaviours_1.isValidBehaviour)(opts.scopeBehaviour)) {
  14806. return opts.scopeBehaviour;
  14807. }
  14808. return behaviours_1.behaviours.LOCAL;
  14809. }
  14810. function getScopedNameGenerator(opts) {
  14811. const scopedNameGenerator = opts.generateScopedName || _generateScopedName2.default;
  14812. if (typeof scopedNameGenerator === "function") return scopedNameGenerator;
  14813. return (0, _genericNames2.default)(scopedNameGenerator, {
  14814. context: process.cwd(),
  14815. hashPrefix: opts.hashPrefix
  14816. });
  14817. }
  14818. function getLoader(opts, plugins) {
  14819. const root = typeof opts.root === "undefined" ? "/" : opts.root;
  14820. return typeof opts.Loader === "function" ? new opts.Loader(root, plugins) : new _loader2.default(root, plugins);
  14821. }
  14822. function isGlobalModule(globalModules, inputFile) {
  14823. return globalModules.some(regex => inputFile.match(regex));
  14824. }
  14825. function getDefaultPluginsList(opts, inputFile) {
  14826. const globalModulesList = opts.globalModulePaths || null;
  14827. const exportGlobals = opts.exportGlobals || false;
  14828. const defaultBehaviour = getDefaultScopeBehaviour(opts);
  14829. const generateScopedName = getScopedNameGenerator(opts);
  14830. if (globalModulesList && isGlobalModule(globalModulesList, inputFile)) {
  14831. return (0, behaviours_1.getDefaultPlugins)({
  14832. behaviour: behaviours_1.behaviours.GLOBAL,
  14833. generateScopedName,
  14834. exportGlobals
  14835. });
  14836. }
  14837. return (0, behaviours_1.getDefaultPlugins)({
  14838. behaviour: defaultBehaviour,
  14839. generateScopedName,
  14840. exportGlobals
  14841. });
  14842. }
  14843. function isOurPlugin(plugin) {
  14844. return plugin.postcssPlugin === PLUGIN_NAME;
  14845. }
  14846. function dashesCamelCase(string) {
  14847. return string.replace(/-+(\w)/g, (_, firstLetter) => firstLetter.toUpperCase());
  14848. }
  14849. var build = (opts = {}) => {
  14850. return {
  14851. postcssPlugin: PLUGIN_NAME,
  14852. OnceExit(css, { result }) {
  14853. return _asyncToGenerator(function* () {
  14854. const getJSON = opts.getJSON || _saveJSON2.default;
  14855. const inputFile = css.source.input.file;
  14856. const pluginList = getDefaultPluginsList(opts, inputFile);
  14857. const resultPluginIndex = result.processor.plugins.findIndex(function (plugin) {
  14858. return isOurPlugin(plugin);
  14859. });
  14860. if (resultPluginIndex === -1) {
  14861. throw new Error('Plugin missing from options.');
  14862. }
  14863. const earlierPlugins = result.processor.plugins.slice(0, resultPluginIndex);
  14864. const loaderPlugins = [...earlierPlugins, ...pluginList];
  14865. const loader = getLoader(opts, loaderPlugins);
  14866. const fetcher = function fetcher(file, relativeTo, depTrace) {
  14867. const unquoteFile = (0, _unquote2.default)(file);
  14868. const resolvedResult = typeof opts.resolve === 'function' && opts.resolve(unquoteFile);
  14869. const resolvedFile = resolvedResult instanceof Promise ? resolvedResult : Promise.resolve(resolvedResult);
  14870. return resolvedFile.then(function (f) {
  14871. return loader.fetch.call(loader, `"${f || unquoteFile}"`, relativeTo, depTrace);
  14872. });
  14873. };
  14874. const parser = new _parser2$1.default(fetcher);
  14875. yield (0, _postcss2$1.default)([...pluginList, parser.plugin()]).process(css, {
  14876. from: inputFile
  14877. });
  14878. const out = loader.finalSource;
  14879. if (out) css.prepend(out);
  14880. if (opts.localsConvention) {
  14881. const isFunc = typeof opts.localsConvention === "function";
  14882. parser.exportTokens = Object.entries(parser.exportTokens).reduce(function (tokens, [className, value]) {
  14883. if (isFunc) {
  14884. tokens[opts.localsConvention(className, value, inputFile)] = value;
  14885. return tokens;
  14886. }
  14887. switch (opts.localsConvention) {
  14888. case "camelCase":
  14889. tokens[className] = value;
  14890. tokens[(0, _lodash2.default)(className)] = value;
  14891. break;
  14892. case "camelCaseOnly":
  14893. tokens[(0, _lodash2.default)(className)] = value;
  14894. break;
  14895. case "dashes":
  14896. tokens[className] = value;
  14897. tokens[dashesCamelCase(className)] = value;
  14898. break;
  14899. case "dashesOnly":
  14900. tokens[dashesCamelCase(className)] = value;
  14901. break;
  14902. }
  14903. return tokens;
  14904. }, {});
  14905. }
  14906. result.messages.push({
  14907. type: "export",
  14908. plugin: "postcss-modules",
  14909. exportTokens: parser.exportTokens
  14910. });
  14911. // getJSON may return a promise
  14912. return getJSON(css.source.input.file, parser.exportTokens, result.opts.to);
  14913. })();
  14914. }
  14915. };
  14916. };
  14917. var postcss$3 = true;
  14918. build.postcss = postcss$3;
  14919. function compileStyle(options) {
  14920. return doCompileStyle(Object.assign(Object.assign({}, options), { isAsync: false }));
  14921. }
  14922. function compileStyleAsync(options) {
  14923. return doCompileStyle(Object.assign(Object.assign({}, options), { isAsync: true }));
  14924. }
  14925. function doCompileStyle(options) {
  14926. const { filename, id, scoped = false, trim = true, isProd = false, modules = false, modulesOptions = {}, preprocessLang, postcssOptions, postcssPlugins } = options;
  14927. const preprocessor = preprocessLang && processors[preprocessLang];
  14928. const preProcessedSource = preprocessor && preprocess$1(options, preprocessor);
  14929. const map = preProcessedSource
  14930. ? preProcessedSource.map
  14931. : options.inMap || options.map;
  14932. const source = preProcessedSource ? preProcessedSource.code : options.source;
  14933. const shortId = id.replace(/^data-v-/, '');
  14934. const longId = `data-v-${shortId}`;
  14935. const plugins = (postcssPlugins || []).slice();
  14936. plugins.unshift(cssVarsPlugin({ id: shortId, isProd }));
  14937. if (trim) {
  14938. plugins.push(trimPlugin());
  14939. }
  14940. if (scoped) {
  14941. plugins.push(scopedPlugin(longId));
  14942. }
  14943. let cssModules;
  14944. if (modules) {
  14945. if (!options.isAsync) {
  14946. throw new Error('[@vue/compiler-sfc] `modules` option can only be used with compileStyleAsync().');
  14947. }
  14948. plugins.push(build(Object.assign(Object.assign({}, modulesOptions), { getJSON: (_cssFileName, json) => {
  14949. cssModules = json;
  14950. } })));
  14951. }
  14952. const postCSSOptions = Object.assign(Object.assign({}, postcssOptions), { to: filename, from: filename });
  14953. if (map) {
  14954. postCSSOptions.map = {
  14955. inline: false,
  14956. annotation: false,
  14957. prev: map
  14958. };
  14959. }
  14960. let result;
  14961. let code;
  14962. let outMap;
  14963. // stylus output include plain css. so need remove the repeat item
  14964. const dependencies = new Set(preProcessedSource ? preProcessedSource.dependencies : []);
  14965. // sass has filename self when provided filename option
  14966. dependencies.delete(filename);
  14967. const errors = [];
  14968. if (preProcessedSource && preProcessedSource.errors.length) {
  14969. errors.push(...preProcessedSource.errors);
  14970. }
  14971. const recordPlainCssDependencies = (messages) => {
  14972. messages.forEach(msg => {
  14973. if (msg.type === 'dependency') {
  14974. // postcss output path is absolute position path
  14975. dependencies.add(msg.file);
  14976. }
  14977. });
  14978. return dependencies;
  14979. };
  14980. try {
  14981. result = _postcss__default(plugins).process(source, postCSSOptions);
  14982. // In async mode, return a promise.
  14983. if (options.isAsync) {
  14984. return result
  14985. .then(result => ({
  14986. code: result.css || '',
  14987. map: result.map && result.map.toJSON(),
  14988. errors,
  14989. modules: cssModules,
  14990. rawResult: result,
  14991. dependencies: recordPlainCssDependencies(result.messages)
  14992. }))
  14993. .catch(error => ({
  14994. code: '',
  14995. map: undefined,
  14996. errors: [...errors, error],
  14997. rawResult: undefined,
  14998. dependencies
  14999. }));
  15000. }
  15001. recordPlainCssDependencies(result.messages);
  15002. // force synchronous transform (we know we only have sync plugins)
  15003. code = result.css;
  15004. outMap = result.map;
  15005. }
  15006. catch (e) {
  15007. errors.push(e);
  15008. }
  15009. return {
  15010. code: code || ``,
  15011. map: outMap && outMap.toJSON(),
  15012. errors,
  15013. rawResult: result,
  15014. dependencies
  15015. };
  15016. }
  15017. function preprocess$1(options, preprocessor) {
  15018. return preprocessor(options.source, options.inMap || options.map, Object.assign({ filename: options.filename }, options.preprocessOptions), options.preprocessCustomRequire);
  15019. }
  15020. // API
  15021. const walk$1 = estreeWalker.walk;
  15022. exports.MagicString = MagicString__default;
  15023. exports.babelParse = parser$2.parse;
  15024. exports.extractIdentifiers = compilerCore.extractIdentifiers;
  15025. exports.generateCodeFrame = compilerCore.generateCodeFrame;
  15026. exports.isInDestructureAssignment = compilerCore.isInDestructureAssignment;
  15027. exports.isStaticProperty = compilerCore.isStaticProperty;
  15028. exports.walkIdentifiers = compilerCore.walkIdentifiers;
  15029. exports.shouldTransformRef = reactivityTransform.shouldTransform;
  15030. exports.transformRef = reactivityTransform.transform;
  15031. exports.transformRefAST = reactivityTransform.transformAST;
  15032. exports.compileScript = compileScript;
  15033. exports.compileStyle = compileStyle;
  15034. exports.compileStyleAsync = compileStyleAsync;
  15035. exports.compileTemplate = compileTemplate;
  15036. exports.parse = parse;
  15037. exports.rewriteDefault = rewriteDefault;
  15038. exports.walk = walk$1;