compiler-sfc.cjs.js 489 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305
  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. // match v-bind() with max 2-levels of nested parens.
  97. const cssVarRE = /v-bind\s*\(((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*)\)/g;
  98. function genCssVarsFromList(vars, id, isProd) {
  99. return `{\n ${vars
  100. .map(key => `"${genVarName(id, key, isProd)}": (${key})`)
  101. .join(',\n ')}\n}`;
  102. }
  103. function genVarName(id, raw, isProd) {
  104. if (isProd) {
  105. return hashSum(id + raw);
  106. }
  107. else {
  108. return `${id}-${raw.replace(/([^\w-])/g, '_')}`;
  109. }
  110. }
  111. function noramlizeExpression(exp) {
  112. exp = exp.trim();
  113. if ((exp[0] === `'` && exp[exp.length - 1] === `'`) ||
  114. (exp[0] === `"` && exp[exp.length - 1] === `"`)) {
  115. return exp.slice(1, -1);
  116. }
  117. return exp;
  118. }
  119. function parseCssVars(sfc) {
  120. const vars = [];
  121. sfc.styles.forEach(style => {
  122. let match;
  123. // ignore v-bind() in comments /* ... */
  124. const content = style.content.replace(/\/\*([\s\S]*?)\*\//g, '');
  125. while ((match = cssVarRE.exec(content))) {
  126. const variable = noramlizeExpression(match[1]);
  127. if (!vars.includes(variable)) {
  128. vars.push(variable);
  129. }
  130. }
  131. });
  132. return vars;
  133. }
  134. const cssVarsPlugin = opts => {
  135. const { id, isProd } = opts;
  136. return {
  137. postcssPlugin: 'vue-sfc-vars',
  138. Declaration(decl) {
  139. // rewrite CSS variables
  140. if (cssVarRE.test(decl.value)) {
  141. decl.value = decl.value.replace(cssVarRE, (_, $1) => {
  142. return `var(--${genVarName(id, noramlizeExpression($1), isProd)})`;
  143. });
  144. }
  145. }
  146. };
  147. };
  148. cssVarsPlugin.postcss = true;
  149. function genCssVarsCode(vars, bindings, id, isProd) {
  150. const varsExp = genCssVarsFromList(vars, id, isProd);
  151. const exp = CompilerDOM.createSimpleExpression(varsExp, false);
  152. const context = CompilerDOM.createTransformContext(CompilerDOM.createRoot([]), {
  153. prefixIdentifiers: true,
  154. inline: true,
  155. bindingMetadata: bindings.__isScriptSetup === false ? undefined : bindings
  156. });
  157. const transformed = CompilerDOM.processExpression(exp, context);
  158. const transformedString = transformed.type === 4 /* SIMPLE_EXPRESSION */
  159. ? transformed.content
  160. : transformed.children
  161. .map(c => {
  162. return typeof c === 'string'
  163. ? c
  164. : c.content;
  165. })
  166. .join('');
  167. return `_${CSS_VARS_HELPER}(_ctx => (${transformedString}))`;
  168. }
  169. // <script setup> already gets the calls injected as part of the transform
  170. // this is only for single normal <script>
  171. function genNormalScriptCssVarsCode(cssVars, bindings, id, isProd) {
  172. return (`\nimport { ${CSS_VARS_HELPER} as _${CSS_VARS_HELPER} } from 'vue'\n` +
  173. `const __injectCSSVars__ = () => {\n${genCssVarsCode(cssVars, bindings, id, isProd)}}\n` +
  174. `const __setup__ = __default__.setup\n` +
  175. `__default__.setup = __setup__\n` +
  176. ` ? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }\n` +
  177. ` : __injectCSSVars__\n`);
  178. }
  179. var iterator = function (Yallist) {
  180. Yallist.prototype[Symbol.iterator] = function* () {
  181. for (let walker = this.head; walker; walker = walker.next) {
  182. yield walker.value;
  183. }
  184. };
  185. };
  186. var yallist = Yallist;
  187. Yallist.Node = Node;
  188. Yallist.create = Yallist;
  189. function Yallist (list) {
  190. var self = this;
  191. if (!(self instanceof Yallist)) {
  192. self = new Yallist();
  193. }
  194. self.tail = null;
  195. self.head = null;
  196. self.length = 0;
  197. if (list && typeof list.forEach === 'function') {
  198. list.forEach(function (item) {
  199. self.push(item);
  200. });
  201. } else if (arguments.length > 0) {
  202. for (var i = 0, l = arguments.length; i < l; i++) {
  203. self.push(arguments[i]);
  204. }
  205. }
  206. return self
  207. }
  208. Yallist.prototype.removeNode = function (node) {
  209. if (node.list !== this) {
  210. throw new Error('removing node which does not belong to this list')
  211. }
  212. var next = node.next;
  213. var prev = node.prev;
  214. if (next) {
  215. next.prev = prev;
  216. }
  217. if (prev) {
  218. prev.next = next;
  219. }
  220. if (node === this.head) {
  221. this.head = next;
  222. }
  223. if (node === this.tail) {
  224. this.tail = prev;
  225. }
  226. node.list.length--;
  227. node.next = null;
  228. node.prev = null;
  229. node.list = null;
  230. return next
  231. };
  232. Yallist.prototype.unshiftNode = function (node) {
  233. if (node === this.head) {
  234. return
  235. }
  236. if (node.list) {
  237. node.list.removeNode(node);
  238. }
  239. var head = this.head;
  240. node.list = this;
  241. node.next = head;
  242. if (head) {
  243. head.prev = node;
  244. }
  245. this.head = node;
  246. if (!this.tail) {
  247. this.tail = node;
  248. }
  249. this.length++;
  250. };
  251. Yallist.prototype.pushNode = function (node) {
  252. if (node === this.tail) {
  253. return
  254. }
  255. if (node.list) {
  256. node.list.removeNode(node);
  257. }
  258. var tail = this.tail;
  259. node.list = this;
  260. node.prev = tail;
  261. if (tail) {
  262. tail.next = node;
  263. }
  264. this.tail = node;
  265. if (!this.head) {
  266. this.head = node;
  267. }
  268. this.length++;
  269. };
  270. Yallist.prototype.push = function () {
  271. for (var i = 0, l = arguments.length; i < l; i++) {
  272. push(this, arguments[i]);
  273. }
  274. return this.length
  275. };
  276. Yallist.prototype.unshift = function () {
  277. for (var i = 0, l = arguments.length; i < l; i++) {
  278. unshift(this, arguments[i]);
  279. }
  280. return this.length
  281. };
  282. Yallist.prototype.pop = function () {
  283. if (!this.tail) {
  284. return undefined
  285. }
  286. var res = this.tail.value;
  287. this.tail = this.tail.prev;
  288. if (this.tail) {
  289. this.tail.next = null;
  290. } else {
  291. this.head = null;
  292. }
  293. this.length--;
  294. return res
  295. };
  296. Yallist.prototype.shift = function () {
  297. if (!this.head) {
  298. return undefined
  299. }
  300. var res = this.head.value;
  301. this.head = this.head.next;
  302. if (this.head) {
  303. this.head.prev = null;
  304. } else {
  305. this.tail = null;
  306. }
  307. this.length--;
  308. return res
  309. };
  310. Yallist.prototype.forEach = function (fn, thisp) {
  311. thisp = thisp || this;
  312. for (var walker = this.head, i = 0; walker !== null; i++) {
  313. fn.call(thisp, walker.value, i, this);
  314. walker = walker.next;
  315. }
  316. };
  317. Yallist.prototype.forEachReverse = function (fn, thisp) {
  318. thisp = thisp || this;
  319. for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
  320. fn.call(thisp, walker.value, i, this);
  321. walker = walker.prev;
  322. }
  323. };
  324. Yallist.prototype.get = function (n) {
  325. for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
  326. // abort out of the list early if we hit a cycle
  327. walker = walker.next;
  328. }
  329. if (i === n && walker !== null) {
  330. return walker.value
  331. }
  332. };
  333. Yallist.prototype.getReverse = function (n) {
  334. for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
  335. // abort out of the list early if we hit a cycle
  336. walker = walker.prev;
  337. }
  338. if (i === n && walker !== null) {
  339. return walker.value
  340. }
  341. };
  342. Yallist.prototype.map = function (fn, thisp) {
  343. thisp = thisp || this;
  344. var res = new Yallist();
  345. for (var walker = this.head; walker !== null;) {
  346. res.push(fn.call(thisp, walker.value, this));
  347. walker = walker.next;
  348. }
  349. return res
  350. };
  351. Yallist.prototype.mapReverse = function (fn, thisp) {
  352. thisp = thisp || this;
  353. var res = new Yallist();
  354. for (var walker = this.tail; walker !== null;) {
  355. res.push(fn.call(thisp, walker.value, this));
  356. walker = walker.prev;
  357. }
  358. return res
  359. };
  360. Yallist.prototype.reduce = function (fn, initial) {
  361. var acc;
  362. var walker = this.head;
  363. if (arguments.length > 1) {
  364. acc = initial;
  365. } else if (this.head) {
  366. walker = this.head.next;
  367. acc = this.head.value;
  368. } else {
  369. throw new TypeError('Reduce of empty list with no initial value')
  370. }
  371. for (var i = 0; walker !== null; i++) {
  372. acc = fn(acc, walker.value, i);
  373. walker = walker.next;
  374. }
  375. return acc
  376. };
  377. Yallist.prototype.reduceReverse = function (fn, initial) {
  378. var acc;
  379. var walker = this.tail;
  380. if (arguments.length > 1) {
  381. acc = initial;
  382. } else if (this.tail) {
  383. walker = this.tail.prev;
  384. acc = this.tail.value;
  385. } else {
  386. throw new TypeError('Reduce of empty list with no initial value')
  387. }
  388. for (var i = this.length - 1; walker !== null; i--) {
  389. acc = fn(acc, walker.value, i);
  390. walker = walker.prev;
  391. }
  392. return acc
  393. };
  394. Yallist.prototype.toArray = function () {
  395. var arr = new Array(this.length);
  396. for (var i = 0, walker = this.head; walker !== null; i++) {
  397. arr[i] = walker.value;
  398. walker = walker.next;
  399. }
  400. return arr
  401. };
  402. Yallist.prototype.toArrayReverse = function () {
  403. var arr = new Array(this.length);
  404. for (var i = 0, walker = this.tail; walker !== null; i++) {
  405. arr[i] = walker.value;
  406. walker = walker.prev;
  407. }
  408. return arr
  409. };
  410. Yallist.prototype.slice = function (from, to) {
  411. to = to || this.length;
  412. if (to < 0) {
  413. to += this.length;
  414. }
  415. from = from || 0;
  416. if (from < 0) {
  417. from += this.length;
  418. }
  419. var ret = new Yallist();
  420. if (to < from || to < 0) {
  421. return ret
  422. }
  423. if (from < 0) {
  424. from = 0;
  425. }
  426. if (to > this.length) {
  427. to = this.length;
  428. }
  429. for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
  430. walker = walker.next;
  431. }
  432. for (; walker !== null && i < to; i++, walker = walker.next) {
  433. ret.push(walker.value);
  434. }
  435. return ret
  436. };
  437. Yallist.prototype.sliceReverse = function (from, to) {
  438. to = to || this.length;
  439. if (to < 0) {
  440. to += this.length;
  441. }
  442. from = from || 0;
  443. if (from < 0) {
  444. from += this.length;
  445. }
  446. var ret = new Yallist();
  447. if (to < from || to < 0) {
  448. return ret
  449. }
  450. if (from < 0) {
  451. from = 0;
  452. }
  453. if (to > this.length) {
  454. to = this.length;
  455. }
  456. for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
  457. walker = walker.prev;
  458. }
  459. for (; walker !== null && i > from; i--, walker = walker.prev) {
  460. ret.push(walker.value);
  461. }
  462. return ret
  463. };
  464. Yallist.prototype.splice = function (start, deleteCount /*, ...nodes */) {
  465. if (start > this.length) {
  466. start = this.length - 1;
  467. }
  468. if (start < 0) {
  469. start = this.length + start;
  470. }
  471. for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
  472. walker = walker.next;
  473. }
  474. var ret = [];
  475. for (var i = 0; walker && i < deleteCount; i++) {
  476. ret.push(walker.value);
  477. walker = this.removeNode(walker);
  478. }
  479. if (walker === null) {
  480. walker = this.tail;
  481. }
  482. if (walker !== this.head && walker !== this.tail) {
  483. walker = walker.prev;
  484. }
  485. for (var i = 2; i < arguments.length; i++) {
  486. walker = insert(this, walker, arguments[i]);
  487. }
  488. return ret;
  489. };
  490. Yallist.prototype.reverse = function () {
  491. var head = this.head;
  492. var tail = this.tail;
  493. for (var walker = head; walker !== null; walker = walker.prev) {
  494. var p = walker.prev;
  495. walker.prev = walker.next;
  496. walker.next = p;
  497. }
  498. this.head = tail;
  499. this.tail = head;
  500. return this
  501. };
  502. function insert (self, node, value) {
  503. var inserted = node === self.head ?
  504. new Node(value, null, node, self) :
  505. new Node(value, node, node.next, self);
  506. if (inserted.next === null) {
  507. self.tail = inserted;
  508. }
  509. if (inserted.prev === null) {
  510. self.head = inserted;
  511. }
  512. self.length++;
  513. return inserted
  514. }
  515. function push (self, item) {
  516. self.tail = new Node(item, self.tail, null, self);
  517. if (!self.head) {
  518. self.head = self.tail;
  519. }
  520. self.length++;
  521. }
  522. function unshift (self, item) {
  523. self.head = new Node(item, null, self.head, self);
  524. if (!self.tail) {
  525. self.tail = self.head;
  526. }
  527. self.length++;
  528. }
  529. function Node (value, prev, next, list) {
  530. if (!(this instanceof Node)) {
  531. return new Node(value, prev, next, list)
  532. }
  533. this.list = list;
  534. this.value = value;
  535. if (prev) {
  536. prev.next = this;
  537. this.prev = prev;
  538. } else {
  539. this.prev = null;
  540. }
  541. if (next) {
  542. next.prev = this;
  543. this.next = next;
  544. } else {
  545. this.next = null;
  546. }
  547. }
  548. try {
  549. // add if support for Symbol.iterator is present
  550. iterator(Yallist);
  551. } catch (er) {}
  552. // A linked list to keep track of recently-used-ness
  553. const MAX = Symbol('max');
  554. const LENGTH = Symbol('length');
  555. const LENGTH_CALCULATOR = Symbol('lengthCalculator');
  556. const ALLOW_STALE = Symbol('allowStale');
  557. const MAX_AGE = Symbol('maxAge');
  558. const DISPOSE = Symbol('dispose');
  559. const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');
  560. const LRU_LIST = Symbol('lruList');
  561. const CACHE = Symbol('cache');
  562. const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');
  563. const naiveLength = () => 1;
  564. // lruList is a yallist where the head is the youngest
  565. // item, and the tail is the oldest. the list contains the Hit
  566. // objects as the entries.
  567. // Each Hit object has a reference to its Yallist.Node. This
  568. // never changes.
  569. //
  570. // cache is a Map (or PseudoMap) that matches the keys to
  571. // the Yallist.Node object.
  572. class LRUCache {
  573. constructor (options) {
  574. if (typeof options === 'number')
  575. options = { max: options };
  576. if (!options)
  577. options = {};
  578. if (options.max && (typeof options.max !== 'number' || options.max < 0))
  579. throw new TypeError('max must be a non-negative number')
  580. // Kind of weird to have a default max of Infinity, but oh well.
  581. this[MAX] = options.max || Infinity;
  582. const lc = options.length || naiveLength;
  583. this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc;
  584. this[ALLOW_STALE] = options.stale || false;
  585. if (options.maxAge && typeof options.maxAge !== 'number')
  586. throw new TypeError('maxAge must be a number')
  587. this[MAX_AGE] = options.maxAge || 0;
  588. this[DISPOSE] = options.dispose;
  589. this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
  590. this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
  591. this.reset();
  592. }
  593. // resize the cache when the max changes.
  594. set max (mL) {
  595. if (typeof mL !== 'number' || mL < 0)
  596. throw new TypeError('max must be a non-negative number')
  597. this[MAX] = mL || Infinity;
  598. trim(this);
  599. }
  600. get max () {
  601. return this[MAX]
  602. }
  603. set allowStale (allowStale) {
  604. this[ALLOW_STALE] = !!allowStale;
  605. }
  606. get allowStale () {
  607. return this[ALLOW_STALE]
  608. }
  609. set maxAge (mA) {
  610. if (typeof mA !== 'number')
  611. throw new TypeError('maxAge must be a non-negative number')
  612. this[MAX_AGE] = mA;
  613. trim(this);
  614. }
  615. get maxAge () {
  616. return this[MAX_AGE]
  617. }
  618. // resize the cache when the lengthCalculator changes.
  619. set lengthCalculator (lC) {
  620. if (typeof lC !== 'function')
  621. lC = naiveLength;
  622. if (lC !== this[LENGTH_CALCULATOR]) {
  623. this[LENGTH_CALCULATOR] = lC;
  624. this[LENGTH] = 0;
  625. this[LRU_LIST].forEach(hit => {
  626. hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
  627. this[LENGTH] += hit.length;
  628. });
  629. }
  630. trim(this);
  631. }
  632. get lengthCalculator () { return this[LENGTH_CALCULATOR] }
  633. get length () { return this[LENGTH] }
  634. get itemCount () { return this[LRU_LIST].length }
  635. rforEach (fn, thisp) {
  636. thisp = thisp || this;
  637. for (let walker = this[LRU_LIST].tail; walker !== null;) {
  638. const prev = walker.prev;
  639. forEachStep(this, fn, walker, thisp);
  640. walker = prev;
  641. }
  642. }
  643. forEach (fn, thisp) {
  644. thisp = thisp || this;
  645. for (let walker = this[LRU_LIST].head; walker !== null;) {
  646. const next = walker.next;
  647. forEachStep(this, fn, walker, thisp);
  648. walker = next;
  649. }
  650. }
  651. keys () {
  652. return this[LRU_LIST].toArray().map(k => k.key)
  653. }
  654. values () {
  655. return this[LRU_LIST].toArray().map(k => k.value)
  656. }
  657. reset () {
  658. if (this[DISPOSE] &&
  659. this[LRU_LIST] &&
  660. this[LRU_LIST].length) {
  661. this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));
  662. }
  663. this[CACHE] = new Map(); // hash of items by key
  664. this[LRU_LIST] = new yallist(); // list of items in order of use recency
  665. this[LENGTH] = 0; // length of items in the list
  666. }
  667. dump () {
  668. return this[LRU_LIST].map(hit =>
  669. isStale(this, hit) ? false : {
  670. k: hit.key,
  671. v: hit.value,
  672. e: hit.now + (hit.maxAge || 0)
  673. }).toArray().filter(h => h)
  674. }
  675. dumpLru () {
  676. return this[LRU_LIST]
  677. }
  678. set (key, value, maxAge) {
  679. maxAge = maxAge || this[MAX_AGE];
  680. if (maxAge && typeof maxAge !== 'number')
  681. throw new TypeError('maxAge must be a number')
  682. const now = maxAge ? Date.now() : 0;
  683. const len = this[LENGTH_CALCULATOR](value, key);
  684. if (this[CACHE].has(key)) {
  685. if (len > this[MAX]) {
  686. del(this, this[CACHE].get(key));
  687. return false
  688. }
  689. const node = this[CACHE].get(key);
  690. const item = node.value;
  691. // dispose of the old one before overwriting
  692. // split out into 2 ifs for better coverage tracking
  693. if (this[DISPOSE]) {
  694. if (!this[NO_DISPOSE_ON_SET])
  695. this[DISPOSE](key, item.value);
  696. }
  697. item.now = now;
  698. item.maxAge = maxAge;
  699. item.value = value;
  700. this[LENGTH] += len - item.length;
  701. item.length = len;
  702. this.get(key);
  703. trim(this);
  704. return true
  705. }
  706. const hit = new Entry(key, value, len, now, maxAge);
  707. // oversized objects fall out of cache automatically.
  708. if (hit.length > this[MAX]) {
  709. if (this[DISPOSE])
  710. this[DISPOSE](key, value);
  711. return false
  712. }
  713. this[LENGTH] += hit.length;
  714. this[LRU_LIST].unshift(hit);
  715. this[CACHE].set(key, this[LRU_LIST].head);
  716. trim(this);
  717. return true
  718. }
  719. has (key) {
  720. if (!this[CACHE].has(key)) return false
  721. const hit = this[CACHE].get(key).value;
  722. return !isStale(this, hit)
  723. }
  724. get (key) {
  725. return get(this, key, true)
  726. }
  727. peek (key) {
  728. return get(this, key, false)
  729. }
  730. pop () {
  731. const node = this[LRU_LIST].tail;
  732. if (!node)
  733. return null
  734. del(this, node);
  735. return node.value
  736. }
  737. del (key) {
  738. del(this, this[CACHE].get(key));
  739. }
  740. load (arr) {
  741. // reset the cache
  742. this.reset();
  743. const now = Date.now();
  744. // A previous serialized cache has the most recent items first
  745. for (let l = arr.length - 1; l >= 0; l--) {
  746. const hit = arr[l];
  747. const expiresAt = hit.e || 0;
  748. if (expiresAt === 0)
  749. // the item was created without expiration in a non aged cache
  750. this.set(hit.k, hit.v);
  751. else {
  752. const maxAge = expiresAt - now;
  753. // dont add already expired items
  754. if (maxAge > 0) {
  755. this.set(hit.k, hit.v, maxAge);
  756. }
  757. }
  758. }
  759. }
  760. prune () {
  761. this[CACHE].forEach((value, key) => get(this, key, false));
  762. }
  763. }
  764. const get = (self, key, doUse) => {
  765. const node = self[CACHE].get(key);
  766. if (node) {
  767. const hit = node.value;
  768. if (isStale(self, hit)) {
  769. del(self, node);
  770. if (!self[ALLOW_STALE])
  771. return undefined
  772. } else {
  773. if (doUse) {
  774. if (self[UPDATE_AGE_ON_GET])
  775. node.value.now = Date.now();
  776. self[LRU_LIST].unshiftNode(node);
  777. }
  778. }
  779. return hit.value
  780. }
  781. };
  782. const isStale = (self, hit) => {
  783. if (!hit || (!hit.maxAge && !self[MAX_AGE]))
  784. return false
  785. const diff = Date.now() - hit.now;
  786. return hit.maxAge ? diff > hit.maxAge
  787. : self[MAX_AGE] && (diff > self[MAX_AGE])
  788. };
  789. const trim = self => {
  790. if (self[LENGTH] > self[MAX]) {
  791. for (let walker = self[LRU_LIST].tail;
  792. self[LENGTH] > self[MAX] && walker !== null;) {
  793. // We know that we're about to delete this one, and also
  794. // what the next least recently used key will be, so just
  795. // go ahead and set it now.
  796. const prev = walker.prev;
  797. del(self, walker);
  798. walker = prev;
  799. }
  800. }
  801. };
  802. const del = (self, node) => {
  803. if (node) {
  804. const hit = node.value;
  805. if (self[DISPOSE])
  806. self[DISPOSE](hit.key, hit.value);
  807. self[LENGTH] -= hit.length;
  808. self[CACHE].delete(hit.key);
  809. self[LRU_LIST].removeNode(node);
  810. }
  811. };
  812. class Entry {
  813. constructor (key, value, length, now, maxAge) {
  814. this.key = key;
  815. this.value = value;
  816. this.length = length;
  817. this.now = now;
  818. this.maxAge = maxAge || 0;
  819. }
  820. }
  821. const forEachStep = (self, fn, node, thisp) => {
  822. let hit = node.value;
  823. if (isStale(self, hit)) {
  824. del(self, node);
  825. if (!self[ALLOW_STALE])
  826. hit = undefined;
  827. }
  828. if (hit)
  829. fn.call(thisp, hit.value, hit.key, self);
  830. };
  831. var lruCache = LRUCache;
  832. function createCache(size = 500) {
  833. return new lruCache(size);
  834. }
  835. function isRelativeUrl(url) {
  836. const firstChar = url.charAt(0);
  837. return firstChar === '.' || firstChar === '~' || firstChar === '@';
  838. }
  839. const externalRE = /^(https?:)?\/\//;
  840. function isExternalUrl(url) {
  841. return externalRE.test(url);
  842. }
  843. const dataUrlRE = /^\s*data:/i;
  844. function isDataUrl(url) {
  845. return dataUrlRE.test(url);
  846. }
  847. /**
  848. * Parses string url into URL object.
  849. */
  850. function parseUrl(url) {
  851. const firstChar = url.charAt(0);
  852. if (firstChar === '~') {
  853. const secondChar = url.charAt(1);
  854. url = url.slice(secondChar === '/' ? 2 : 1);
  855. }
  856. return parseUriParts(url);
  857. }
  858. /**
  859. * vuejs/component-compiler-utils#22 Support uri fragment in transformed require
  860. * @param urlString an url as a string
  861. */
  862. function parseUriParts(urlString) {
  863. // A TypeError is thrown if urlString is not a string
  864. // @see https://nodejs.org/api/url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
  865. return url.parse(shared.isString(urlString) ? urlString : '', false, true);
  866. }
  867. const defaultAssetUrlOptions = {
  868. base: null,
  869. includeAbsolute: false,
  870. tags: {
  871. video: ['src', 'poster'],
  872. source: ['src'],
  873. img: ['src'],
  874. image: ['xlink:href', 'href'],
  875. use: ['xlink:href', 'href']
  876. }
  877. };
  878. const normalizeOptions = (options) => {
  879. if (Object.keys(options).some(key => shared.isArray(options[key]))) {
  880. // legacy option format which directly passes in tags config
  881. return Object.assign(Object.assign({}, defaultAssetUrlOptions), { tags: options });
  882. }
  883. return Object.assign(Object.assign({}, defaultAssetUrlOptions), options);
  884. };
  885. const createAssetUrlTransformWithOptions = (options) => {
  886. return (node, context) => transformAssetUrl(node, context, options);
  887. };
  888. /**
  889. * A `@vue/compiler-core` plugin that transforms relative asset urls into
  890. * either imports or absolute urls.
  891. *
  892. * ``` js
  893. * // Before
  894. * createVNode('img', { src: './logo.png' })
  895. *
  896. * // After
  897. * import _imports_0 from './logo.png'
  898. * createVNode('img', { src: _imports_0 })
  899. * ```
  900. */
  901. const transformAssetUrl = (node, context, options = defaultAssetUrlOptions) => {
  902. if (node.type === 1 /* ELEMENT */) {
  903. if (!node.props.length) {
  904. return;
  905. }
  906. const tags = options.tags || defaultAssetUrlOptions.tags;
  907. const attrs = tags[node.tag];
  908. const wildCardAttrs = tags['*'];
  909. if (!attrs && !wildCardAttrs) {
  910. return;
  911. }
  912. const assetAttrs = (attrs || []).concat(wildCardAttrs || []);
  913. node.props.forEach((attr, index) => {
  914. if (attr.type !== 6 /* ATTRIBUTE */ ||
  915. !assetAttrs.includes(attr.name) ||
  916. !attr.value ||
  917. isExternalUrl(attr.value.content) ||
  918. isDataUrl(attr.value.content) ||
  919. attr.value.content[0] === '#' ||
  920. (!options.includeAbsolute && !isRelativeUrl(attr.value.content))) {
  921. return;
  922. }
  923. const url = parseUrl(attr.value.content);
  924. if (options.base && attr.value.content[0] === '.') {
  925. // explicit base - directly rewrite relative urls into absolute url
  926. // to avoid generating extra imports
  927. // Allow for full hostnames provided in options.base
  928. const base = parseUrl(options.base);
  929. const protocol = base.protocol || '';
  930. const host = base.host ? protocol + '//' + base.host : '';
  931. const basePath = base.path || '/';
  932. // when packaged in the browser, path will be using the posix-
  933. // only version provided by rollup-plugin-node-builtins.
  934. attr.value.content =
  935. host +
  936. (path__default.posix || path__default).join(basePath, url.path + (url.hash || ''));
  937. return;
  938. }
  939. // otherwise, transform the url into an import.
  940. // this assumes a bundler will resolve the import into the correct
  941. // absolute url (e.g. webpack file-loader)
  942. const exp = getImportsExpressionExp(url.path, url.hash, attr.loc, context);
  943. node.props[index] = {
  944. type: 7 /* DIRECTIVE */,
  945. name: 'bind',
  946. arg: compilerCore.createSimpleExpression(attr.name, true, attr.loc),
  947. exp,
  948. modifiers: [],
  949. loc: attr.loc
  950. };
  951. });
  952. }
  953. };
  954. function getImportsExpressionExp(path, hash, loc, context) {
  955. if (path) {
  956. let name;
  957. let exp;
  958. const existingIndex = context.imports.findIndex(i => i.path === path);
  959. if (existingIndex > -1) {
  960. name = `_imports_${existingIndex}`;
  961. exp = context.imports[existingIndex].exp;
  962. }
  963. else {
  964. name = `_imports_${context.imports.length}`;
  965. exp = compilerCore.createSimpleExpression(name, false, loc, 3 /* CAN_STRINGIFY */);
  966. context.imports.push({ exp, path });
  967. }
  968. if (!hash) {
  969. return exp;
  970. }
  971. const hashExp = `${name} + '${hash}'`;
  972. const existingHoistIndex = context.hoists.findIndex(h => {
  973. return (h &&
  974. h.type === 4 /* SIMPLE_EXPRESSION */ &&
  975. !h.isStatic &&
  976. h.content === hashExp);
  977. });
  978. if (existingHoistIndex > -1) {
  979. return compilerCore.createSimpleExpression(`_hoisted_${existingHoistIndex + 1}`, false, loc, 3 /* CAN_STRINGIFY */);
  980. }
  981. return context.hoist(compilerCore.createSimpleExpression(hashExp, false, loc, 3 /* CAN_STRINGIFY */));
  982. }
  983. else {
  984. return compilerCore.createSimpleExpression(`''`, false, loc, 3 /* CAN_STRINGIFY */);
  985. }
  986. }
  987. const srcsetTags = ['img', 'source'];
  988. // http://w3c.github.io/html/semantics-embedded-content.html#ref-for-image-candidate-string-5
  989. const escapedSpaceCharacters = /( |\\t|\\n|\\f|\\r)+/g;
  990. const createSrcsetTransformWithOptions = (options) => {
  991. return (node, context) => transformSrcset(node, context, options);
  992. };
  993. const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
  994. if (node.type === 1 /* ELEMENT */) {
  995. if (srcsetTags.includes(node.tag) && node.props.length) {
  996. node.props.forEach((attr, index) => {
  997. if (attr.name === 'srcset' && attr.type === 6 /* ATTRIBUTE */) {
  998. if (!attr.value)
  999. return;
  1000. const value = attr.value.content;
  1001. if (!value)
  1002. return;
  1003. const imageCandidates = value.split(',').map(s => {
  1004. // The attribute value arrives here with all whitespace, except
  1005. // normal spaces, represented by escape sequences
  1006. const [url, descriptor] = s
  1007. .replace(escapedSpaceCharacters, ' ')
  1008. .trim()
  1009. .split(' ', 2);
  1010. return { url, descriptor };
  1011. });
  1012. // data urls contains comma after the encoding so we need to re-merge
  1013. // them
  1014. for (let i = 0; i < imageCandidates.length; i++) {
  1015. const { url } = imageCandidates[i];
  1016. if (isDataUrl(url)) {
  1017. imageCandidates[i + 1].url =
  1018. url + ',' + imageCandidates[i + 1].url;
  1019. imageCandidates.splice(i, 1);
  1020. }
  1021. }
  1022. const hasQualifiedUrl = imageCandidates.some(({ url }) => {
  1023. return (!isExternalUrl(url) &&
  1024. !isDataUrl(url) &&
  1025. (options.includeAbsolute || isRelativeUrl(url)));
  1026. });
  1027. // When srcset does not contain any qualified URLs, skip transforming
  1028. if (!hasQualifiedUrl) {
  1029. return;
  1030. }
  1031. if (options.base) {
  1032. const base = options.base;
  1033. const set = [];
  1034. imageCandidates.forEach(({ url, descriptor }) => {
  1035. descriptor = descriptor ? ` ${descriptor}` : ``;
  1036. if (isRelativeUrl(url)) {
  1037. set.push((path__default.posix || path__default).join(base, url) + descriptor);
  1038. }
  1039. else {
  1040. set.push(url + descriptor);
  1041. }
  1042. });
  1043. attr.value.content = set.join(', ');
  1044. return;
  1045. }
  1046. const compoundExpression = compilerCore.createCompoundExpression([], attr.loc);
  1047. imageCandidates.forEach(({ url, descriptor }, index) => {
  1048. if (!isExternalUrl(url) &&
  1049. !isDataUrl(url) &&
  1050. (options.includeAbsolute || isRelativeUrl(url))) {
  1051. const { path } = parseUrl(url);
  1052. let exp;
  1053. if (path) {
  1054. const existingImportsIndex = context.imports.findIndex(i => i.path === path);
  1055. if (existingImportsIndex > -1) {
  1056. exp = compilerCore.createSimpleExpression(`_imports_${existingImportsIndex}`, false, attr.loc, 3 /* CAN_STRINGIFY */);
  1057. }
  1058. else {
  1059. exp = compilerCore.createSimpleExpression(`_imports_${context.imports.length}`, false, attr.loc, 3 /* CAN_STRINGIFY */);
  1060. context.imports.push({ exp, path });
  1061. }
  1062. compoundExpression.children.push(exp);
  1063. }
  1064. }
  1065. else {
  1066. const exp = compilerCore.createSimpleExpression(`"${url}"`, false, attr.loc, 3 /* CAN_STRINGIFY */);
  1067. compoundExpression.children.push(exp);
  1068. }
  1069. const isNotLast = imageCandidates.length - 1 > index;
  1070. if (descriptor && isNotLast) {
  1071. compoundExpression.children.push(` + ' ${descriptor}, ' + `);
  1072. }
  1073. else if (descriptor) {
  1074. compoundExpression.children.push(` + ' ${descriptor}'`);
  1075. }
  1076. else if (isNotLast) {
  1077. compoundExpression.children.push(` + ', ' + `);
  1078. }
  1079. });
  1080. const hoisted = context.hoist(compoundExpression);
  1081. hoisted.constType = 3 /* CAN_STRINGIFY */;
  1082. node.props[index] = {
  1083. type: 7 /* DIRECTIVE */,
  1084. name: 'bind',
  1085. arg: compilerCore.createSimpleExpression('srcset', true, attr.loc),
  1086. exp: hoisted,
  1087. modifiers: [],
  1088. loc: attr.loc
  1089. };
  1090. }
  1091. });
  1092. }
  1093. }
  1094. };
  1095. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  1096. function getDefaultExportFromCjs (x) {
  1097. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
  1098. }
  1099. function getAugmentedNamespace(n) {
  1100. if (n.__esModule) return n;
  1101. var a = Object.defineProperty({}, '__esModule', {value: true});
  1102. Object.keys(n).forEach(function (k) {
  1103. var d = Object.getOwnPropertyDescriptor(n, k);
  1104. Object.defineProperty(a, k, d.get ? d : {
  1105. enumerable: true,
  1106. get: function () {
  1107. return n[k];
  1108. }
  1109. });
  1110. });
  1111. return a;
  1112. }
  1113. function createCommonjsModule(fn) {
  1114. var module = { exports: {} };
  1115. return fn(module, module.exports), module.exports;
  1116. }
  1117. function commonjsRequire (path) {
  1118. 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.');
  1119. }
  1120. var consolidate = createCommonjsModule(function (module, exports) {
  1121. /*
  1122. * Engines which do not support caching of their file contents
  1123. * should use the `read()` function defined in consolidate.js
  1124. * On top of this, when an engine compiles to a `Function`,
  1125. * these functions should either be cached within consolidate.js
  1126. * or the engine itself via `options.cache`. This will allow
  1127. * users and frameworks to pass `options.cache = true` for
  1128. * `NODE_ENV=production`, however edit the file(s) without
  1129. * re-loading the application in development.
  1130. */
  1131. /**
  1132. * Module dependencies.
  1133. */
  1134. var path = path__default;
  1135. var join = path.join;
  1136. var resolve = path.resolve;
  1137. var extname = path.extname;
  1138. var dirname = path.dirname;
  1139. var isAbsolute = path.isAbsolute;
  1140. var readCache = {};
  1141. /**
  1142. * Require cache.
  1143. */
  1144. var cacheStore = {};
  1145. /**
  1146. * Require cache.
  1147. */
  1148. var requires = {};
  1149. /**
  1150. * Clear the cache.
  1151. *
  1152. * @api public
  1153. */
  1154. exports.clearCache = function() {
  1155. readCache = {};
  1156. cacheStore = {};
  1157. };
  1158. /**
  1159. * Conditionally cache `compiled` template based
  1160. * on the `options` filename and `.cache` boolean.
  1161. *
  1162. * @param {Object} options
  1163. * @param {Function} compiled
  1164. * @return {Function}
  1165. * @api private
  1166. */
  1167. function cache(options, compiled) {
  1168. // cachable
  1169. if (compiled && options.filename && options.cache) {
  1170. delete readCache[options.filename];
  1171. cacheStore[options.filename] = compiled;
  1172. return compiled;
  1173. }
  1174. // check cache
  1175. if (options.filename && options.cache) {
  1176. return cacheStore[options.filename];
  1177. }
  1178. return compiled;
  1179. }
  1180. /**
  1181. * Read `path` with `options` with
  1182. * callback `(err, str)`. When `options.cache`
  1183. * is true the template string will be cached.
  1184. *
  1185. * @param {String} options
  1186. * @param {Function} cb
  1187. * @api private
  1188. */
  1189. function read(path, options, cb) {
  1190. var str = readCache[path];
  1191. var cached = options.cache && str && typeof str === 'string';
  1192. // cached (only if cached is a string and not a compiled template function)
  1193. if (cached) return cb(null, str);
  1194. // read
  1195. fs__default.readFile(path, 'utf8', function(err, str) {
  1196. if (err) return cb(err);
  1197. // remove extraneous utf8 BOM marker
  1198. str = str.replace(/^\uFEFF/, '');
  1199. if (options.cache) readCache[path] = str;
  1200. cb(null, str);
  1201. });
  1202. }
  1203. /**
  1204. * Read `path` with `options` with
  1205. * callback `(err, str)`. When `options.cache`
  1206. * is true the partial string will be cached.
  1207. *
  1208. * @param {String} options
  1209. * @param {Function} fn
  1210. * @api private
  1211. */
  1212. function readPartials(path, options, cb) {
  1213. if (!options.partials) return cb();
  1214. var keys = Object.keys(options.partials);
  1215. var partials = {};
  1216. function next(index) {
  1217. if (index === keys.length) return cb(null, partials);
  1218. var key = keys[index];
  1219. var partialPath = options.partials[key];
  1220. if (partialPath === undefined || partialPath === null || partialPath === false) {
  1221. return next(++index);
  1222. }
  1223. var file;
  1224. if (isAbsolute(partialPath)) {
  1225. if (extname(partialPath) !== '') {
  1226. file = partialPath;
  1227. } else {
  1228. file = join(partialPath + extname(path));
  1229. }
  1230. } else {
  1231. file = join(dirname(path), partialPath + extname(path));
  1232. }
  1233. read(file, options, function(err, str) {
  1234. if (err) return cb(err);
  1235. partials[key] = str;
  1236. next(++index);
  1237. });
  1238. }
  1239. next(0);
  1240. }
  1241. /**
  1242. * promisify
  1243. */
  1244. function promisify(cb, fn) {
  1245. return new Promise(function(resolve, reject) {
  1246. cb = cb || function(err, html) {
  1247. if (err) {
  1248. return reject(err);
  1249. }
  1250. resolve(html);
  1251. };
  1252. fn(cb);
  1253. });
  1254. }
  1255. /**
  1256. * fromStringRenderer
  1257. */
  1258. function fromStringRenderer(name) {
  1259. return function(path, options, cb) {
  1260. options.filename = path;
  1261. return promisify(cb, function(cb) {
  1262. readPartials(path, options, function(err, partials) {
  1263. var extend = (requires.extend || (requires.extend = util__default._extend));
  1264. var opts = extend({}, options);
  1265. opts.partials = partials;
  1266. if (err) return cb(err);
  1267. if (cache(opts)) {
  1268. exports[name].render('', opts, cb);
  1269. } else {
  1270. read(path, opts, function(err, str) {
  1271. if (err) return cb(err);
  1272. exports[name].render(str, opts, cb);
  1273. });
  1274. }
  1275. });
  1276. });
  1277. };
  1278. }
  1279. /**
  1280. * velocity support.
  1281. */
  1282. exports.velocityjs = fromStringRenderer('velocityjs');
  1283. /**
  1284. * velocity string support.
  1285. */
  1286. exports.velocityjs.render = function(str, options, cb) {
  1287. return promisify(cb, function(cb) {
  1288. var engine = requires.velocityjs || (requires.velocityjs = require('velocityjs'));
  1289. try {
  1290. options.locals = options;
  1291. cb(null, engine.render(str, options).trimLeft());
  1292. } catch (err) {
  1293. cb(err);
  1294. }
  1295. });
  1296. };
  1297. /**
  1298. * Liquid support.
  1299. */
  1300. exports.liquid = fromStringRenderer('liquid');
  1301. /**
  1302. * Liquid string support.
  1303. */
  1304. /**
  1305. * Note that in order to get filters and custom tags we've had to push
  1306. * all user-defined locals down into @locals. However, just to make things
  1307. * backwards-compatible, any property of `options` that is left after
  1308. * processing and removing `locals`, `meta`, `filters`, `customTags` and
  1309. * `includeDir` will also become a local.
  1310. */
  1311. function _renderTinyliquid(engine, str, options, cb) {
  1312. var context = engine.newContext();
  1313. var k;
  1314. /**
  1315. * Note that there's a bug in the library that doesn't allow us to pass
  1316. * the locals to newContext(), hence looping through the keys:
  1317. */
  1318. if (options.locals) {
  1319. for (k in options.locals) {
  1320. context.setLocals(k, options.locals[k]);
  1321. }
  1322. delete options.locals;
  1323. }
  1324. if (options.meta) {
  1325. context.setLocals('page', options.meta);
  1326. delete options.meta;
  1327. }
  1328. /**
  1329. * Add any defined filters:
  1330. */
  1331. if (options.filters) {
  1332. for (k in options.filters) {
  1333. context.setFilter(k, options.filters[k]);
  1334. }
  1335. delete options.filters;
  1336. }
  1337. /**
  1338. * Set up a callback for the include directory:
  1339. */
  1340. var includeDir = options.includeDir || process.cwd();
  1341. context.onInclude(function(name, callback) {
  1342. var extname = path.extname(name) ? '' : '.liquid';
  1343. var filename = path.resolve(includeDir, name + extname);
  1344. fs__default.readFile(filename, {encoding: 'utf8'}, function(err, data) {
  1345. if (err) return callback(err);
  1346. callback(null, engine.parse(data));
  1347. });
  1348. });
  1349. delete options.includeDir;
  1350. /**
  1351. * The custom tag functions need to have their results pushed back
  1352. * through the parser, so set up a shim before calling the provided
  1353. * callback:
  1354. */
  1355. var compileOptions = {
  1356. customTags: {}
  1357. };
  1358. if (options.customTags) {
  1359. var tagFunctions = options.customTags;
  1360. for (k in options.customTags) {
  1361. /*Tell jshint there's no problem with having this function in the loop */
  1362. /*jshint -W083 */
  1363. compileOptions.customTags[k] = function(context, name, body) {
  1364. var tpl = tagFunctions[name](body.trim());
  1365. context.astStack.push(engine.parse(tpl));
  1366. };
  1367. /*jshint +W083 */
  1368. }
  1369. delete options.customTags;
  1370. }
  1371. /**
  1372. * Now anything left in `options` becomes a local:
  1373. */
  1374. for (k in options) {
  1375. context.setLocals(k, options[k]);
  1376. }
  1377. /**
  1378. * Finally, execute the template:
  1379. */
  1380. var tmpl = cache(context) || cache(context, engine.compile(str, compileOptions));
  1381. tmpl(context, cb);
  1382. }
  1383. exports.liquid.render = function(str, options, cb) {
  1384. return promisify(cb, function(cb) {
  1385. var engine = requires.liquid;
  1386. var Liquid;
  1387. try {
  1388. // set up tinyliquid engine
  1389. engine = requires.liquid = require('tinyliquid');
  1390. // use tinyliquid engine
  1391. _renderTinyliquid(engine, str, options, cb);
  1392. return;
  1393. } catch (err) {
  1394. // set up liquid-node engine
  1395. try {
  1396. Liquid = requires.liquid = require('liquid-node');
  1397. engine = new Liquid.Engine();
  1398. } catch (err) {
  1399. throw err;
  1400. }
  1401. }
  1402. // use liquid-node engine
  1403. try {
  1404. var locals = options.locals || {};
  1405. if (options.meta) {
  1406. locals.pages = options.meta;
  1407. delete options.meta;
  1408. }
  1409. /**
  1410. * Add any defined filters:
  1411. */
  1412. if (options.filters) {
  1413. engine.registerFilters(options.filters);
  1414. delete options.filters;
  1415. }
  1416. /**
  1417. * Set up a callback for the include directory:
  1418. */
  1419. var includeDir = options.includeDir || process.cwd();
  1420. engine.fileSystem = new Liquid.LocalFileSystem(includeDir, 'liquid');
  1421. delete options.includeDir;
  1422. /**
  1423. * The custom tag functions need to have their results pushed back
  1424. * through the parser, so set up a shim before calling the provided
  1425. * callback:
  1426. */
  1427. if (options.customTags) {
  1428. var tagFunctions = options.customTags;
  1429. for (k in options.customTags) {
  1430. engine.registerTag(k, tagFunctions[k]);
  1431. }
  1432. delete options.customTags;
  1433. }
  1434. /**
  1435. * Now anything left in `options` becomes a local:
  1436. */
  1437. for (var k in options) {
  1438. locals[k] = options[k];
  1439. }
  1440. /**
  1441. * Finally, execute the template:
  1442. */
  1443. return engine
  1444. .parseAndRender(str, locals)
  1445. .nodeify(function(err, result) {
  1446. if (err) {
  1447. throw new Error(err);
  1448. } else {
  1449. return cb(null, result);
  1450. }
  1451. });
  1452. } catch (err) {
  1453. cb(err);
  1454. }
  1455. });
  1456. };
  1457. /**
  1458. * Jade support.
  1459. */
  1460. exports.jade = function(path, options, cb) {
  1461. return promisify(cb, function(cb) {
  1462. var engine = requires.jade;
  1463. if (!engine) {
  1464. try {
  1465. engine = requires.jade = require('jade');
  1466. } catch (err) {
  1467. try {
  1468. engine = requires.jade = require('then-jade');
  1469. } catch (otherError) {
  1470. throw err;
  1471. }
  1472. }
  1473. }
  1474. try {
  1475. var tmpl = cache(options) || cache(options, engine.compileFile(path, options));
  1476. cb(null, tmpl(options));
  1477. } catch (err) {
  1478. cb(err);
  1479. }
  1480. });
  1481. };
  1482. /**
  1483. * Jade string support.
  1484. */
  1485. exports.jade.render = function(str, options, cb) {
  1486. return promisify(cb, function(cb) {
  1487. var engine = requires.jade;
  1488. if (!engine) {
  1489. try {
  1490. engine = requires.jade = require('jade');
  1491. } catch (err) {
  1492. try {
  1493. engine = requires.jade = require('then-jade');
  1494. } catch (otherError) {
  1495. throw err;
  1496. }
  1497. }
  1498. }
  1499. try {
  1500. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1501. cb(null, tmpl(options));
  1502. } catch (err) {
  1503. cb(err);
  1504. }
  1505. });
  1506. };
  1507. /**
  1508. * Dust support.
  1509. */
  1510. exports.dust = fromStringRenderer('dust');
  1511. /**
  1512. * Dust string support.
  1513. */
  1514. exports.dust.render = function(str, options, cb) {
  1515. return promisify(cb, function(cb) {
  1516. var engine = requires.dust;
  1517. if (!engine) {
  1518. try {
  1519. engine = requires.dust = require('dust');
  1520. } catch (err) {
  1521. try {
  1522. engine = requires.dust = require('dustjs-helpers');
  1523. } catch (err) {
  1524. engine = requires.dust = require('dustjs-linkedin');
  1525. }
  1526. }
  1527. }
  1528. var ext = 'dust';
  1529. var views = '.';
  1530. if (options) {
  1531. if (options.ext) ext = options.ext;
  1532. if (options.views) views = options.views;
  1533. if (options.settings && options.settings.views) views = options.settings.views;
  1534. }
  1535. if (!options || (options && !options.cache)) engine.cache = {};
  1536. engine.onLoad = function(path, callback) {
  1537. if (extname(path) === '') path += '.' + ext;
  1538. if (path[0] !== '/') path = views + '/' + path;
  1539. read(path, options, callback);
  1540. };
  1541. try {
  1542. var templateName;
  1543. if (options.filename) {
  1544. templateName = options.filename.replace(new RegExp('^' + views + '/'), '').replace(new RegExp('\\.' + ext), '');
  1545. }
  1546. var tmpl = cache(options) || cache(options, engine.compileFn(str, templateName));
  1547. tmpl(options, cb);
  1548. } catch (err) {
  1549. cb(err);
  1550. }
  1551. });
  1552. };
  1553. /**
  1554. * Swig support.
  1555. */
  1556. exports.swig = fromStringRenderer('swig');
  1557. /**
  1558. * Swig string support.
  1559. */
  1560. exports.swig.render = function(str, options, cb) {
  1561. return promisify(cb, function(cb) {
  1562. var engine = requires.swig;
  1563. if (!engine) {
  1564. try {
  1565. engine = requires.swig = require('swig');
  1566. } catch (err) {
  1567. try {
  1568. engine = requires.swig = require('swig-templates');
  1569. } catch (otherError) {
  1570. throw err;
  1571. }
  1572. }
  1573. }
  1574. try {
  1575. if (options.cache === true) options.cache = 'memory';
  1576. engine.setDefaults({ cache: options.cache });
  1577. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1578. cb(null, tmpl(options));
  1579. } catch (err) {
  1580. cb(err);
  1581. }
  1582. });
  1583. };
  1584. /**
  1585. * Razor support.
  1586. */
  1587. exports.razor = function(path, options, cb) {
  1588. return promisify(cb, function(cb) {
  1589. var engine = requires.razor;
  1590. if (!engine) {
  1591. try {
  1592. engine = requires.razor = require('razor-tmpl');
  1593. } catch (err) {
  1594. throw err;
  1595. }
  1596. }
  1597. try {
  1598. var tmpl = cache(options) || cache(options, (locals) => {
  1599. console.log('Rendering razor file', path);
  1600. return engine.renderFileSync(path, locals);
  1601. });
  1602. cb(null, tmpl(options));
  1603. } catch (err) {
  1604. cb(err);
  1605. }
  1606. });
  1607. };
  1608. /**
  1609. * razor string support.
  1610. */
  1611. exports.razor.render = function(str, options, cb) {
  1612. return promisify(cb, function(cb) {
  1613. try {
  1614. var engine = requires.razor = require('razor-tmpl');
  1615. } catch (err) {
  1616. throw err;
  1617. }
  1618. try {
  1619. var tf = engine.compile(str);
  1620. var tmpl = cache(options) || cache(options, tf);
  1621. cb(null, tmpl(options));
  1622. } catch (err) {
  1623. cb(err);
  1624. }
  1625. });
  1626. };
  1627. /**
  1628. * Atpl support.
  1629. */
  1630. exports.atpl = fromStringRenderer('atpl');
  1631. /**
  1632. * Atpl string support.
  1633. */
  1634. exports.atpl.render = function(str, options, cb) {
  1635. return promisify(cb, function(cb) {
  1636. var engine = requires.atpl || (requires.atpl = require('atpl'));
  1637. try {
  1638. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1639. cb(null, tmpl(options));
  1640. } catch (err) {
  1641. cb(err);
  1642. }
  1643. });
  1644. };
  1645. /**
  1646. * Liquor support,
  1647. */
  1648. exports.liquor = fromStringRenderer('liquor');
  1649. /**
  1650. * Liquor string support.
  1651. */
  1652. exports.liquor.render = function(str, options, cb) {
  1653. return promisify(cb, function(cb) {
  1654. var engine = requires.liquor || (requires.liquor = require('liquor'));
  1655. try {
  1656. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1657. cb(null, tmpl(options));
  1658. } catch (err) {
  1659. cb(err);
  1660. }
  1661. });
  1662. };
  1663. /**
  1664. * Twig support.
  1665. */
  1666. exports.twig = fromStringRenderer('twig');
  1667. /**
  1668. * Twig string support.
  1669. */
  1670. exports.twig.render = function(str, options, cb) {
  1671. return promisify(cb, function(cb) {
  1672. var engine = requires.twig || (requires.twig = require('twig').twig);
  1673. var templateData = {
  1674. data: str,
  1675. allowInlineIncludes: options.allowInlineIncludes,
  1676. namespaces: options.namespaces,
  1677. path: options.path
  1678. };
  1679. try {
  1680. var tmpl = cache(templateData) || cache(templateData, engine(templateData));
  1681. cb(null, tmpl.render(options));
  1682. } catch (err) {
  1683. cb(err);
  1684. }
  1685. });
  1686. };
  1687. /**
  1688. * EJS support.
  1689. */
  1690. exports.ejs = fromStringRenderer('ejs');
  1691. /**
  1692. * EJS string support.
  1693. */
  1694. exports.ejs.render = function(str, options, cb) {
  1695. return promisify(cb, function(cb) {
  1696. var engine = requires.ejs || (requires.ejs = require('ejs'));
  1697. try {
  1698. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1699. cb(null, tmpl(options));
  1700. } catch (err) {
  1701. cb(err);
  1702. }
  1703. });
  1704. };
  1705. /**
  1706. * Eco support.
  1707. */
  1708. exports.eco = fromStringRenderer('eco');
  1709. /**
  1710. * Eco string support.
  1711. */
  1712. exports.eco.render = function(str, options, cb) {
  1713. return promisify(cb, function(cb) {
  1714. var engine = requires.eco || (requires.eco = require('eco'));
  1715. try {
  1716. cb(null, engine.render(str, options));
  1717. } catch (err) {
  1718. cb(err);
  1719. }
  1720. });
  1721. };
  1722. /**
  1723. * Jazz support.
  1724. */
  1725. exports.jazz = fromStringRenderer('jazz');
  1726. /**
  1727. * Jazz string support.
  1728. */
  1729. exports.jazz.render = function(str, options, cb) {
  1730. return promisify(cb, function(cb) {
  1731. var engine = requires.jazz || (requires.jazz = require('jazz'));
  1732. try {
  1733. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1734. tmpl.eval(options, function(str) {
  1735. cb(null, str);
  1736. });
  1737. } catch (err) {
  1738. cb(err);
  1739. }
  1740. });
  1741. };
  1742. /**
  1743. * JQTPL support.
  1744. */
  1745. exports.jqtpl = fromStringRenderer('jqtpl');
  1746. /**
  1747. * JQTPL string support.
  1748. */
  1749. exports.jqtpl.render = function(str, options, cb) {
  1750. return promisify(cb, function(cb) {
  1751. var engine = requires.jqtpl || (requires.jqtpl = require('jqtpl'));
  1752. try {
  1753. engine.template(str, str);
  1754. cb(null, engine.tmpl(str, options));
  1755. } catch (err) {
  1756. cb(err);
  1757. }
  1758. });
  1759. };
  1760. /**
  1761. * Haml support.
  1762. */
  1763. exports.haml = fromStringRenderer('haml');
  1764. /**
  1765. * Haml string support.
  1766. */
  1767. exports.haml.render = function(str, options, cb) {
  1768. return promisify(cb, function(cb) {
  1769. var engine = requires.haml || (requires.haml = require('hamljs'));
  1770. try {
  1771. options.locals = options;
  1772. cb(null, engine.render(str, options).trimLeft());
  1773. } catch (err) {
  1774. cb(err);
  1775. }
  1776. });
  1777. };
  1778. /**
  1779. * Hamlet support.
  1780. */
  1781. exports.hamlet = fromStringRenderer('hamlet');
  1782. /**
  1783. * Hamlet string support.
  1784. */
  1785. exports.hamlet.render = function(str, options, cb) {
  1786. return promisify(cb, function(cb) {
  1787. var engine = requires.hamlet || (requires.hamlet = require('hamlet'));
  1788. try {
  1789. options.locals = options;
  1790. cb(null, engine.render(str, options).trimLeft());
  1791. } catch (err) {
  1792. cb(err);
  1793. }
  1794. });
  1795. };
  1796. /**
  1797. * Whiskers support.
  1798. */
  1799. exports.whiskers = function(path, options, cb) {
  1800. return promisify(cb, function(cb) {
  1801. var engine = requires.whiskers || (requires.whiskers = require('whiskers'));
  1802. engine.__express(path, options, cb);
  1803. });
  1804. };
  1805. /**
  1806. * Whiskers string support.
  1807. */
  1808. exports.whiskers.render = function(str, options, cb) {
  1809. return promisify(cb, function(cb) {
  1810. var engine = requires.whiskers || (requires.whiskers = require('whiskers'));
  1811. try {
  1812. cb(null, engine.render(str, options));
  1813. } catch (err) {
  1814. cb(err);
  1815. }
  1816. });
  1817. };
  1818. /**
  1819. * Coffee-HAML support.
  1820. */
  1821. exports['haml-coffee'] = fromStringRenderer('haml-coffee');
  1822. /**
  1823. * Coffee-HAML string support.
  1824. */
  1825. exports['haml-coffee'].render = function(str, options, cb) {
  1826. return promisify(cb, function(cb) {
  1827. var engine = requires['haml-coffee'] || (requires['haml-coffee'] = require('haml-coffee'));
  1828. try {
  1829. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1830. cb(null, tmpl(options));
  1831. } catch (err) {
  1832. cb(err);
  1833. }
  1834. });
  1835. };
  1836. /**
  1837. * Hogan support.
  1838. */
  1839. exports.hogan = fromStringRenderer('hogan');
  1840. /**
  1841. * Hogan string support.
  1842. */
  1843. exports.hogan.render = function(str, options, cb) {
  1844. return promisify(cb, function(cb) {
  1845. var engine = requires.hogan || (requires.hogan = require('hogan.js'));
  1846. try {
  1847. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1848. cb(null, tmpl.render(options, options.partials));
  1849. } catch (err) {
  1850. cb(err);
  1851. }
  1852. });
  1853. };
  1854. /**
  1855. * templayed.js support.
  1856. */
  1857. exports.templayed = fromStringRenderer('templayed');
  1858. /**
  1859. * templayed.js string support.
  1860. */
  1861. exports.templayed.render = function(str, options, cb) {
  1862. return promisify(cb, function(cb) {
  1863. var engine = requires.templayed || (requires.templayed = require('templayed'));
  1864. try {
  1865. var tmpl = cache(options) || cache(options, engine(str));
  1866. cb(null, tmpl(options));
  1867. } catch (err) {
  1868. cb(err);
  1869. }
  1870. });
  1871. };
  1872. /**
  1873. * Handlebars support.
  1874. */
  1875. exports.handlebars = fromStringRenderer('handlebars');
  1876. /**
  1877. * Handlebars string support.
  1878. */
  1879. exports.handlebars.render = function(str, options, cb) {
  1880. return promisify(cb, function(cb) {
  1881. var engine = requires.handlebars || (requires.handlebars = require('handlebars'));
  1882. try {
  1883. for (var partial in options.partials) {
  1884. engine.registerPartial(partial, options.partials[partial]);
  1885. }
  1886. for (var helper in options.helpers) {
  1887. engine.registerHelper(helper, options.helpers[helper]);
  1888. }
  1889. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1890. cb(null, tmpl(options));
  1891. } catch (err) {
  1892. cb(err);
  1893. }
  1894. });
  1895. };
  1896. /**
  1897. * Underscore support.
  1898. */
  1899. exports.underscore = fromStringRenderer('underscore');
  1900. /**
  1901. * Underscore string support.
  1902. */
  1903. exports.underscore.render = function(str, options, cb) {
  1904. return promisify(cb, function(cb) {
  1905. var engine = requires.underscore || (requires.underscore = require('underscore'));
  1906. try {
  1907. const partials = {};
  1908. for (var partial in options.partials) {
  1909. partials[partial] = engine.template(options.partials[partial]);
  1910. }
  1911. options.partials = partials;
  1912. var tmpl = cache(options) || cache(options, engine.template(str, null, options));
  1913. cb(null, tmpl(options).replace(/\n$/, ''));
  1914. } catch (err) {
  1915. cb(err);
  1916. }
  1917. });
  1918. };
  1919. /**
  1920. * Lodash support.
  1921. */
  1922. exports.lodash = fromStringRenderer('lodash');
  1923. /**
  1924. * Lodash string support.
  1925. */
  1926. exports.lodash.render = function(str, options, cb) {
  1927. return promisify(cb, function(cb) {
  1928. var engine = requires.lodash || (requires.lodash = require('lodash'));
  1929. try {
  1930. var tmpl = cache(options) || cache(options, engine.template(str, options));
  1931. cb(null, tmpl(options).replace(/\n$/, ''));
  1932. } catch (err) {
  1933. cb(err);
  1934. }
  1935. });
  1936. };
  1937. /**
  1938. * Pug support. (formerly Jade)
  1939. */
  1940. exports.pug = function(path, options, cb) {
  1941. return promisify(cb, function(cb) {
  1942. var engine = requires.pug;
  1943. if (!engine) {
  1944. try {
  1945. engine = requires.pug = require('pug');
  1946. } catch (err) {
  1947. try {
  1948. engine = requires.pug = require('then-pug');
  1949. } catch (otherError) {
  1950. throw err;
  1951. }
  1952. }
  1953. }
  1954. try {
  1955. var tmpl = cache(options) || cache(options, engine.compileFile(path, options));
  1956. cb(null, tmpl(options));
  1957. } catch (err) {
  1958. cb(err);
  1959. }
  1960. });
  1961. };
  1962. /**
  1963. * Pug string support.
  1964. */
  1965. exports.pug.render = function(str, options, cb) {
  1966. return promisify(cb, function(cb) {
  1967. var engine = requires.pug;
  1968. if (!engine) {
  1969. try {
  1970. engine = requires.pug = require('pug');
  1971. } catch (err) {
  1972. try {
  1973. engine = requires.pug = require('then-pug');
  1974. } catch (otherError) {
  1975. throw err;
  1976. }
  1977. }
  1978. }
  1979. try {
  1980. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  1981. cb(null, tmpl(options));
  1982. } catch (err) {
  1983. cb(err);
  1984. }
  1985. });
  1986. };
  1987. /**
  1988. * QEJS support.
  1989. */
  1990. exports.qejs = fromStringRenderer('qejs');
  1991. /**
  1992. * QEJS string support.
  1993. */
  1994. exports.qejs.render = function(str, options, cb) {
  1995. return promisify(cb, function(cb) {
  1996. try {
  1997. var engine = requires.qejs || (requires.qejs = require('qejs'));
  1998. engine.render(str, options).then(function(result) {
  1999. cb(null, result);
  2000. }, function(err) {
  2001. cb(err);
  2002. }).done();
  2003. } catch (err) {
  2004. cb(err);
  2005. }
  2006. });
  2007. };
  2008. /**
  2009. * Walrus support.
  2010. */
  2011. exports.walrus = fromStringRenderer('walrus');
  2012. /**
  2013. * Walrus string support.
  2014. */
  2015. exports.walrus.render = function(str, options, cb) {
  2016. return promisify(cb, function(cb) {
  2017. var engine = requires.walrus || (requires.walrus = require('walrus'));
  2018. try {
  2019. var tmpl = cache(options) || cache(options, engine.parse(str));
  2020. cb(null, tmpl.compile(options));
  2021. } catch (err) {
  2022. cb(err);
  2023. }
  2024. });
  2025. };
  2026. /**
  2027. * Mustache support.
  2028. */
  2029. exports.mustache = fromStringRenderer('mustache');
  2030. /**
  2031. * Mustache string support.
  2032. */
  2033. exports.mustache.render = function(str, options, cb) {
  2034. return promisify(cb, function(cb) {
  2035. var engine = requires.mustache || (requires.mustache = require('mustache'));
  2036. try {
  2037. cb(null, engine.render(str, options, options.partials));
  2038. } catch (err) {
  2039. cb(err);
  2040. }
  2041. });
  2042. };
  2043. /**
  2044. * Just support.
  2045. */
  2046. exports.just = function(path, options, cb) {
  2047. return promisify(cb, function(cb) {
  2048. var engine = requires.just;
  2049. if (!engine) {
  2050. var JUST = require('just');
  2051. engine = requires.just = new JUST();
  2052. }
  2053. engine.configure({ useCache: options.cache });
  2054. engine.render(path, options, cb);
  2055. });
  2056. };
  2057. /**
  2058. * Just string support.
  2059. */
  2060. exports.just.render = function(str, options, cb) {
  2061. return promisify(cb, function(cb) {
  2062. var JUST = require('just');
  2063. var engine = new JUST({ root: { page: str }});
  2064. engine.render('page', options, cb);
  2065. });
  2066. };
  2067. /**
  2068. * ECT support.
  2069. */
  2070. exports.ect = function(path, options, cb) {
  2071. return promisify(cb, function(cb) {
  2072. var engine = requires.ect;
  2073. if (!engine) {
  2074. var ECT = require('ect');
  2075. engine = requires.ect = new ECT(options);
  2076. }
  2077. engine.configure({ cache: options.cache });
  2078. engine.render(path, options, cb);
  2079. });
  2080. };
  2081. /**
  2082. * ECT string support.
  2083. */
  2084. exports.ect.render = function(str, options, cb) {
  2085. return promisify(cb, function(cb) {
  2086. var ECT = require('ect');
  2087. var engine = new ECT({ root: { page: str }});
  2088. engine.render('page', options, cb);
  2089. });
  2090. };
  2091. /**
  2092. * mote support.
  2093. */
  2094. exports.mote = fromStringRenderer('mote');
  2095. /**
  2096. * mote string support.
  2097. */
  2098. exports.mote.render = function(str, options, cb) {
  2099. return promisify(cb, function(cb) {
  2100. var engine = requires.mote || (requires.mote = require('mote'));
  2101. try {
  2102. var tmpl = cache(options) || cache(options, engine.compile(str));
  2103. cb(null, tmpl(options));
  2104. } catch (err) {
  2105. cb(err);
  2106. }
  2107. });
  2108. };
  2109. /**
  2110. * Toffee support.
  2111. */
  2112. exports.toffee = function(path, options, cb) {
  2113. return promisify(cb, function(cb) {
  2114. var toffee = requires.toffee || (requires.toffee = require('toffee'));
  2115. toffee.__consolidate_engine_render(path, options, cb);
  2116. });
  2117. };
  2118. /**
  2119. * Toffee string support.
  2120. */
  2121. exports.toffee.render = function(str, options, cb) {
  2122. return promisify(cb, function(cb) {
  2123. var engine = requires.toffee || (requires.toffee = require('toffee'));
  2124. try {
  2125. engine.str_render(str, options, cb);
  2126. } catch (err) {
  2127. cb(err);
  2128. }
  2129. });
  2130. };
  2131. /**
  2132. * doT support.
  2133. */
  2134. exports.dot = fromStringRenderer('dot');
  2135. /**
  2136. * doT string support.
  2137. */
  2138. exports.dot.render = function(str, options, cb) {
  2139. return promisify(cb, function(cb) {
  2140. var engine = requires.dot || (requires.dot = require('dot'));
  2141. var extend = (requires.extend || (requires.extend = util__default._extend));
  2142. try {
  2143. var settings = {};
  2144. settings = extend(settings, engine.templateSettings);
  2145. settings = extend(settings, options ? options.dot : {});
  2146. var tmpl = cache(options) || cache(options, engine.template(str, settings, options));
  2147. cb(null, tmpl(options));
  2148. } catch (err) {
  2149. cb(err);
  2150. }
  2151. });
  2152. };
  2153. /**
  2154. * bracket support.
  2155. */
  2156. exports.bracket = fromStringRenderer('bracket');
  2157. /**
  2158. * bracket string support.
  2159. */
  2160. exports.bracket.render = function(str, options, cb) {
  2161. return promisify(cb, function(cb) {
  2162. var engine = requires.bracket || (requires.bracket = require('bracket-template'));
  2163. try {
  2164. var tmpl = cache(options) || cache(options, engine.default.compile(str, options));
  2165. cb(null, tmpl(options));
  2166. } catch (err) {
  2167. cb(err);
  2168. }
  2169. });
  2170. };
  2171. /**
  2172. * Ractive support.
  2173. */
  2174. exports.ractive = fromStringRenderer('ractive');
  2175. /**
  2176. * Ractive string support.
  2177. */
  2178. exports.ractive.render = function(str, options, cb) {
  2179. return promisify(cb, function(cb) {
  2180. var Engine = requires.ractive || (requires.ractive = require('ractive'));
  2181. var template = cache(options) || cache(options, Engine.parse(str));
  2182. options.template = template;
  2183. if (options.data === null || options.data === undefined) {
  2184. var extend = (requires.extend || (requires.extend = util__default._extend));
  2185. // Shallow clone the options object
  2186. options.data = extend({}, options);
  2187. // Remove consolidate-specific properties from the clone
  2188. var i;
  2189. var length;
  2190. var properties = ['template', 'filename', 'cache', 'partials'];
  2191. for (i = 0, length = properties.length; i < length; i++) {
  2192. var property = properties[i];
  2193. delete options.data[property];
  2194. }
  2195. }
  2196. try {
  2197. cb(null, new Engine(options).toHTML());
  2198. } catch (err) {
  2199. cb(err);
  2200. }
  2201. });
  2202. };
  2203. /**
  2204. * Nunjucks support.
  2205. */
  2206. exports.nunjucks = fromStringRenderer('nunjucks');
  2207. /**
  2208. * Nunjucks string support.
  2209. */
  2210. exports.nunjucks.render = function(str, options, cb) {
  2211. return promisify(cb, function(cb) {
  2212. try {
  2213. var engine = options.nunjucksEnv || requires.nunjucks || (requires.nunjucks = require('nunjucks'));
  2214. var env = engine;
  2215. // deprecated fallback support for express
  2216. // <https://github.com/tj/consolidate.js/pull/152>
  2217. // <https://github.com/tj/consolidate.js/pull/224>
  2218. if (options.settings && options.settings.views) {
  2219. env = engine.configure(options.settings.views);
  2220. } else if (options.nunjucks && options.nunjucks.configure) {
  2221. env = engine.configure.apply(engine, options.nunjucks.configure);
  2222. }
  2223. //
  2224. // because `renderString` does not initiate loaders
  2225. // we must manually create a loader for it based off
  2226. // either `options.settings.views` or `options.nunjucks` or `options.nunjucks.root`
  2227. //
  2228. // <https://github.com/mozilla/nunjucks/issues/730>
  2229. // <https://github.com/crocodilejs/node-email-templates/issues/182>
  2230. //
  2231. // so instead we simply check if we passed a custom loader
  2232. // otherwise we create a simple file based loader
  2233. if (options.loader) {
  2234. env = new engine.Environment(options.loader);
  2235. } else if (options.settings && options.settings.views) {
  2236. env = new engine.Environment(
  2237. new engine.FileSystemLoader(options.settings.views)
  2238. );
  2239. } else if (options.nunjucks && options.nunjucks.loader) {
  2240. if (typeof options.nunjucks.loader === 'string') {
  2241. env = new engine.Environment(new engine.FileSystemLoader(options.nunjucks.loader));
  2242. } else {
  2243. env = new engine.Environment(
  2244. new engine.FileSystemLoader(
  2245. options.nunjucks.loader[0],
  2246. options.nunjucks.loader[1]
  2247. )
  2248. );
  2249. }
  2250. }
  2251. env.renderString(str, options, cb);
  2252. } catch (err) {
  2253. throw cb(err);
  2254. }
  2255. });
  2256. };
  2257. /**
  2258. * HTMLing support.
  2259. */
  2260. exports.htmling = fromStringRenderer('htmling');
  2261. /**
  2262. * HTMLing string support.
  2263. */
  2264. exports.htmling.render = function(str, options, cb) {
  2265. return promisify(cb, function(cb) {
  2266. var engine = requires.htmling || (requires.htmling = require('htmling'));
  2267. try {
  2268. var tmpl = cache(options) || cache(options, engine.string(str));
  2269. cb(null, tmpl.render(options));
  2270. } catch (err) {
  2271. cb(err);
  2272. }
  2273. });
  2274. };
  2275. /**
  2276. * Rendering function
  2277. */
  2278. function requireReact(module, filename) {
  2279. var babel = requires.babel || (requires.babel = require('babel-core'));
  2280. var compiled = babel.transformFileSync(filename, { presets: [ 'react' ] }).code;
  2281. return module._compile(compiled, filename);
  2282. }
  2283. exports.requireReact = requireReact;
  2284. /**
  2285. * Converting a string into a node module.
  2286. */
  2287. function requireReactString(src, filename) {
  2288. var babel = requires.babel || (requires.babel = require('babel-core'));
  2289. if (!filename) filename = '';
  2290. var m = new module.constructor();
  2291. filename = filename || '';
  2292. // Compile Using React
  2293. var compiled = babel.transform(src, { presets: [ 'react' ] }).code;
  2294. // Compile as a module
  2295. m.paths = module.paths;
  2296. m._compile(compiled, filename);
  2297. return m.exports;
  2298. }
  2299. /**
  2300. * A naive helper to replace {{tags}} with options.tags content
  2301. */
  2302. function reactBaseTmpl(data, options) {
  2303. var exp;
  2304. var regex;
  2305. // Iterates through the keys in file object
  2306. // and interpolate / replace {{key}} with it's value
  2307. for (var k in options) {
  2308. if (options.hasOwnProperty(k)) {
  2309. exp = '{{' + k + '}}';
  2310. regex = new RegExp(exp, 'g');
  2311. if (data.match(regex)) {
  2312. data = data.replace(regex, options[k]);
  2313. }
  2314. }
  2315. }
  2316. return data;
  2317. }
  2318. /**
  2319. * Plates Support.
  2320. */
  2321. exports.plates = fromStringRenderer('plates');
  2322. /**
  2323. * Plates string support.
  2324. */
  2325. exports.plates.render = function(str, options, cb) {
  2326. return promisify(cb, function(cb) {
  2327. var engine = requires.plates || (requires.plates = require('plates'));
  2328. var map = options.map || undefined;
  2329. try {
  2330. var tmpl = engine.bind(str, options, map);
  2331. cb(null, tmpl);
  2332. } catch (err) {
  2333. cb(err);
  2334. }
  2335. });
  2336. };
  2337. /**
  2338. * The main render parser for React bsaed templates
  2339. */
  2340. function reactRenderer(type) {
  2341. if (commonjsRequire.extensions) {
  2342. // Ensure JSX is transformed on require
  2343. if (!commonjsRequire.extensions['.jsx']) {
  2344. commonjsRequire.extensions['.jsx'] = requireReact;
  2345. }
  2346. // Supporting .react extension as well as test cases
  2347. // Using .react extension is not recommended.
  2348. if (!commonjsRequire.extensions['.react']) {
  2349. commonjsRequire.extensions['.react'] = requireReact;
  2350. }
  2351. }
  2352. // Return rendering fx
  2353. return function(str, options, cb) {
  2354. return promisify(cb, function(cb) {
  2355. // React Import
  2356. var ReactDOM = requires.ReactDOM || (requires.ReactDOM = require('react-dom/server'));
  2357. var react = requires.react || (requires.react = require('react'));
  2358. // Assign HTML Base
  2359. var base = options.base;
  2360. delete options.base;
  2361. var enableCache = options.cache;
  2362. delete options.cache;
  2363. var isNonStatic = options.isNonStatic;
  2364. delete options.isNonStatic;
  2365. // Start Conversion
  2366. try {
  2367. var Code;
  2368. var Factory;
  2369. var baseStr;
  2370. var content;
  2371. var parsed;
  2372. if (!cache(options)) {
  2373. // Parsing
  2374. if (type === 'path') {
  2375. var path = resolve(str);
  2376. delete require.cache[path];
  2377. Code = commonjsRequire(path);
  2378. } else {
  2379. Code = requireReactString(str);
  2380. }
  2381. Factory = cache(options, react.createFactory(Code));
  2382. } else {
  2383. Factory = cache(options);
  2384. }
  2385. parsed = new Factory(options);
  2386. content = (isNonStatic) ? ReactDOM.renderToString(parsed) : ReactDOM.renderToStaticMarkup(parsed);
  2387. if (base) {
  2388. baseStr = readCache[str] || fs__default.readFileSync(resolve(base), 'utf8');
  2389. if (enableCache) {
  2390. readCache[str] = baseStr;
  2391. }
  2392. options.content = content;
  2393. content = reactBaseTmpl(baseStr, options);
  2394. }
  2395. cb(null, content);
  2396. } catch (err) {
  2397. cb(err);
  2398. }
  2399. });
  2400. };
  2401. }
  2402. /**
  2403. * React JS Support
  2404. */
  2405. exports.react = reactRenderer('path');
  2406. /**
  2407. * React JS string support.
  2408. */
  2409. exports.react.render = reactRenderer('string');
  2410. /**
  2411. * ARC-templates support.
  2412. */
  2413. exports['arc-templates'] = fromStringRenderer('arc-templates');
  2414. /**
  2415. * ARC-templates string support.
  2416. */
  2417. exports['arc-templates'].render = function(str, options, cb) {
  2418. var readFileWithOptions = util__default.promisify(read);
  2419. var consolidateFileSystem = {};
  2420. consolidateFileSystem.readFile = function(path) {
  2421. return readFileWithOptions(path, options);
  2422. };
  2423. return promisify(cb, function(cb) {
  2424. try {
  2425. var engine = requires['arc-templates'];
  2426. if (!engine) {
  2427. var Engine = require('arc-templates/dist/es5');
  2428. engine = requires['arc-templates'] = new Engine({ filesystem: consolidateFileSystem });
  2429. }
  2430. var compiler = cache(options) || cache(options, engine.compileString(str, options.filename));
  2431. compiler.then(function(func) { return func(options); })
  2432. .then(function(result) { cb(null, result.content); })
  2433. .catch(cb);
  2434. } catch (err) {
  2435. cb(err);
  2436. }
  2437. });
  2438. };
  2439. /**
  2440. * Vash support
  2441. */
  2442. exports.vash = fromStringRenderer('vash');
  2443. /**
  2444. * Vash string support
  2445. */
  2446. exports.vash.render = function(str, options, cb) {
  2447. return promisify(cb, function(cb) {
  2448. var engine = requires.vash || (requires.vash = require('vash'));
  2449. try {
  2450. // helper system : https://github.com/kirbysayshi/vash#helper-system
  2451. if (options.helpers) {
  2452. for (var key in options.helpers) {
  2453. if (!options.helpers.hasOwnProperty(key) || typeof options.helpers[key] !== 'function') {
  2454. continue;
  2455. }
  2456. engine.helpers[key] = options.helpers[key];
  2457. }
  2458. }
  2459. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  2460. tmpl(options, function sealLayout(err, ctx) {
  2461. if (err) cb(err);
  2462. ctx.finishLayout();
  2463. cb(null, ctx.toString().replace(/\n$/, ''));
  2464. });
  2465. } catch (err) {
  2466. cb(err);
  2467. }
  2468. });
  2469. };
  2470. /**
  2471. * Slm support.
  2472. */
  2473. exports.slm = fromStringRenderer('slm');
  2474. /**
  2475. * Slm string support.
  2476. */
  2477. exports.slm.render = function(str, options, cb) {
  2478. return promisify(cb, function(cb) {
  2479. var engine = requires.slm || (requires.slm = require('slm'));
  2480. try {
  2481. var tmpl = cache(options) || cache(options, engine.compile(str, options));
  2482. cb(null, tmpl(options));
  2483. } catch (err) {
  2484. cb(err);
  2485. }
  2486. });
  2487. };
  2488. /**
  2489. * Marko support.
  2490. */
  2491. exports.marko = function(path, options, cb) {
  2492. return promisify(cb, function(cb) {
  2493. var engine = requires.marko || (requires.marko = require('marko'));
  2494. options.writeToDisk = !!options.cache;
  2495. try {
  2496. var tmpl = cache(options) || cache(options, engine.load(path, options));
  2497. tmpl.renderToString(options, cb);
  2498. } catch (err) {
  2499. cb(err);
  2500. }
  2501. });
  2502. };
  2503. /**
  2504. * Marko string support.
  2505. */
  2506. exports.marko.render = function(str, options, cb) {
  2507. return promisify(cb, function(cb) {
  2508. var engine = requires.marko || (requires.marko = require('marko'));
  2509. options.writeToDisk = !!options.cache;
  2510. options.filename = options.filename || 'string.marko';
  2511. try {
  2512. var tmpl = cache(options) || cache(options, engine.load(options.filename, str, options));
  2513. tmpl.renderToString(options, cb);
  2514. } catch (err) {
  2515. cb(err);
  2516. }
  2517. });
  2518. };
  2519. /**
  2520. * Teacup support.
  2521. */
  2522. exports.teacup = function(path, options, cb) {
  2523. return promisify(cb, function(cb) {
  2524. var engine = requires.teacup || (requires.teacup = require('teacup/lib/express'));
  2525. commonjsRequire.extensions['.teacup'] = commonjsRequire.extensions['.coffee'];
  2526. if (path[0] !== '/') {
  2527. path = join(process.cwd(), path);
  2528. }
  2529. if (!options.cache) {
  2530. var callback = cb;
  2531. cb = function() {
  2532. delete require.cache[path];
  2533. callback.apply(this, arguments);
  2534. };
  2535. }
  2536. engine.renderFile(path, options, cb);
  2537. });
  2538. };
  2539. /**
  2540. * Teacup string support.
  2541. */
  2542. exports.teacup.render = function(str, options, cb) {
  2543. var coffee = require('coffee-script');
  2544. var vm = require('vm');
  2545. var sandbox = {
  2546. module: {exports: {}},
  2547. require: commonjsRequire
  2548. };
  2549. return promisify(cb, function(cb) {
  2550. vm.runInNewContext(coffee.compile(str), sandbox);
  2551. var tmpl = sandbox.module.exports;
  2552. cb(null, tmpl(options));
  2553. });
  2554. };
  2555. /**
  2556. * Squirrelly support.
  2557. */
  2558. exports.squirrelly = fromStringRenderer('squirrelly');
  2559. /**
  2560. * Squirrelly string support.
  2561. */
  2562. exports.squirrelly.render = function(str, options, cb) {
  2563. return promisify(cb, function(cb) {
  2564. var engine = requires.squirrelly || (requires.squirrelly = require('squirrelly'));
  2565. try {
  2566. for (var partial in options.partials) {
  2567. engine.definePartial(partial, options.partials[partial]);
  2568. }
  2569. for (var helper in options.helpers) {
  2570. engine.defineHelper(helper, options.helpers[helper]);
  2571. }
  2572. var tmpl = cache(options) || cache(options, engine.Compile(str, options));
  2573. cb(null, tmpl(options, engine));
  2574. } catch (err) {
  2575. cb(err);
  2576. }
  2577. });
  2578. };
  2579. /**
  2580. * Twing support.
  2581. */
  2582. exports.twing = fromStringRenderer('twing');
  2583. /**
  2584. * Twing string support.
  2585. */
  2586. exports.twing.render = function(str, options, cb) {
  2587. return promisify(cb, function(cb) {
  2588. var engine = requires.twing || (requires.twing = require('twing'));
  2589. try {
  2590. new engine.TwingEnvironment(new engine.TwingLoaderNull()).createTemplate(str).then((twingTemplate) => {
  2591. twingTemplate.render(options).then((rendTmpl) => {
  2592. var tmpl = cache(options) || cache(options, rendTmpl);
  2593. cb(null, tmpl);
  2594. });
  2595. });
  2596. } catch (err) {
  2597. cb(err);
  2598. }
  2599. });
  2600. };
  2601. /**
  2602. * expose the instance of the engine
  2603. */
  2604. exports.requires = requires;
  2605. });
  2606. var consolidate$1 = consolidate;
  2607. const hasWarned = {};
  2608. function warnOnce(msg) {
  2609. const isNodeProd = typeof process !== 'undefined' && process.env.NODE_ENV === 'production';
  2610. if (!isNodeProd && !false && !hasWarned[msg]) {
  2611. hasWarned[msg] = true;
  2612. warn(msg);
  2613. }
  2614. }
  2615. function warn(msg) {
  2616. console.warn(`\x1b[1m\x1b[33m[@vue/compiler-sfc]\x1b[0m\x1b[33m ${msg}\x1b[0m\n`);
  2617. }
  2618. function preprocess({ source, filename, preprocessOptions }, preprocessor) {
  2619. // Consolidate exposes a callback based API, but the callback is in fact
  2620. // called synchronously for most templating engines. In our case, we have to
  2621. // expose a synchronous API so that it is usable in Jest transforms (which
  2622. // have to be sync because they are applied via Node.js require hooks)
  2623. let res = '';
  2624. let err = null;
  2625. preprocessor.render(source, Object.assign({ filename }, preprocessOptions), (_err, _res) => {
  2626. if (_err)
  2627. err = _err;
  2628. res = _res;
  2629. });
  2630. if (err)
  2631. throw err;
  2632. return res;
  2633. }
  2634. function compileTemplate(options) {
  2635. const { preprocessLang, preprocessCustomRequire } = options;
  2636. const preprocessor = preprocessLang
  2637. ? preprocessCustomRequire
  2638. ? preprocessCustomRequire(preprocessLang)
  2639. : consolidate$1[preprocessLang]
  2640. : false;
  2641. if (preprocessor) {
  2642. try {
  2643. return doCompileTemplate(Object.assign(Object.assign({}, options), { source: preprocess(options, preprocessor) }));
  2644. }
  2645. catch (e) {
  2646. return {
  2647. code: `export default function render() {}`,
  2648. source: options.source,
  2649. tips: [],
  2650. errors: [e]
  2651. };
  2652. }
  2653. }
  2654. else if (preprocessLang) {
  2655. return {
  2656. code: `export default function render() {}`,
  2657. source: options.source,
  2658. tips: [
  2659. `Component ${options.filename} uses lang ${preprocessLang} for template. Please install the language preprocessor.`
  2660. ],
  2661. errors: [
  2662. `Component ${options.filename} uses lang ${preprocessLang} for template, however it is not installed.`
  2663. ]
  2664. };
  2665. }
  2666. else {
  2667. return doCompileTemplate(options);
  2668. }
  2669. }
  2670. function doCompileTemplate({ filename, id, scoped, slotted, inMap, source, ssr = false, ssrCssVars, isProd = false, compiler = ssr ? CompilerSSR__namespace : CompilerDOM__namespace, compilerOptions = {}, transformAssetUrls }) {
  2671. const errors = [];
  2672. const warnings = [];
  2673. let nodeTransforms = [];
  2674. if (shared.isObject(transformAssetUrls)) {
  2675. const assetOptions = normalizeOptions(transformAssetUrls);
  2676. nodeTransforms = [
  2677. createAssetUrlTransformWithOptions(assetOptions),
  2678. createSrcsetTransformWithOptions(assetOptions)
  2679. ];
  2680. }
  2681. else if (transformAssetUrls !== false) {
  2682. nodeTransforms = [transformAssetUrl, transformSrcset];
  2683. }
  2684. if (ssr && !ssrCssVars) {
  2685. warnOnce(`compileTemplate is called with \`ssr: true\` but no ` +
  2686. `corresponding \`cssVars\` option.\`.`);
  2687. }
  2688. if (!id) {
  2689. warnOnce(`compileTemplate now requires the \`id\` option.\`.`);
  2690. id = '';
  2691. }
  2692. const shortId = id.replace(/^data-v-/, '');
  2693. const longId = `data-v-${shortId}`;
  2694. 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
  2695. ? genCssVarsFromList(ssrCssVars, shortId, isProd)
  2696. : '', scopeId: scoped ? longId : undefined, slotted, sourceMap: true }, compilerOptions), { nodeTransforms: nodeTransforms.concat(compilerOptions.nodeTransforms || []), filename, onError: e => errors.push(e), onWarn: w => warnings.push(w) }));
  2697. // inMap should be the map produced by ./parse.ts which is a simple line-only
  2698. // mapping. If it is present, we need to adjust the final map and errors to
  2699. // reflect the original line numbers.
  2700. if (inMap) {
  2701. if (map) {
  2702. map = mapLines(inMap, map);
  2703. }
  2704. if (errors.length) {
  2705. patchErrors(errors, source, inMap);
  2706. }
  2707. }
  2708. const tips = warnings.map(w => {
  2709. let msg = w.message;
  2710. if (w.loc) {
  2711. msg += `\n${shared.generateCodeFrame(source, w.loc.start.offset, w.loc.end.offset)}`;
  2712. }
  2713. return msg;
  2714. });
  2715. return { code, ast, preamble, source, errors, tips, map };
  2716. }
  2717. function mapLines(oldMap, newMap) {
  2718. if (!oldMap)
  2719. return newMap;
  2720. if (!newMap)
  2721. return oldMap;
  2722. const oldMapConsumer = new sourceMap.SourceMapConsumer(oldMap);
  2723. const newMapConsumer = new sourceMap.SourceMapConsumer(newMap);
  2724. const mergedMapGenerator = new sourceMap.SourceMapGenerator();
  2725. newMapConsumer.eachMapping(m => {
  2726. if (m.originalLine == null) {
  2727. return;
  2728. }
  2729. const origPosInOldMap = oldMapConsumer.originalPositionFor({
  2730. line: m.originalLine,
  2731. column: m.originalColumn
  2732. });
  2733. if (origPosInOldMap.source == null) {
  2734. return;
  2735. }
  2736. mergedMapGenerator.addMapping({
  2737. generated: {
  2738. line: m.generatedLine,
  2739. column: m.generatedColumn
  2740. },
  2741. original: {
  2742. line: origPosInOldMap.line,
  2743. // use current column, since the oldMap produced by @vue/compiler-sfc
  2744. // does not
  2745. column: m.originalColumn
  2746. },
  2747. source: origPosInOldMap.source,
  2748. name: origPosInOldMap.name
  2749. });
  2750. });
  2751. // source-map's type definition is incomplete
  2752. const generator = mergedMapGenerator;
  2753. oldMapConsumer.sources.forEach((sourceFile) => {
  2754. generator._sources.add(sourceFile);
  2755. const sourceContent = oldMapConsumer.sourceContentFor(sourceFile);
  2756. if (sourceContent != null) {
  2757. mergedMapGenerator.setSourceContent(sourceFile, sourceContent);
  2758. }
  2759. });
  2760. generator._sourceRoot = oldMap.sourceRoot;
  2761. generator._file = oldMap.file;
  2762. return generator.toJSON();
  2763. }
  2764. function patchErrors(errors, source, inMap) {
  2765. const originalSource = inMap.sourcesContent[0];
  2766. const offset = originalSource.indexOf(source);
  2767. const lineOffset = originalSource.slice(0, offset).split(/\r?\n/).length - 1;
  2768. errors.forEach(err => {
  2769. if (err.loc) {
  2770. err.loc.start.line += lineOffset;
  2771. err.loc.start.offset += offset;
  2772. if (err.loc.end !== err.loc.start) {
  2773. err.loc.end.line += lineOffset;
  2774. err.loc.end.offset += offset;
  2775. }
  2776. }
  2777. });
  2778. }
  2779. const defaultExportRE = /((?:^|\n|;)\s*)export(\s*)default/;
  2780. const namedDefaultExportRE = /((?:^|\n|;)\s*)export(.+)as(\s*)default/s;
  2781. const exportDefaultClassRE = /((?:^|\n|;)\s*)export\s+default\s+class\s+([\w$]+)/;
  2782. /**
  2783. * Utility for rewriting `export default` in a script block into a variable
  2784. * declaration so that we can inject things into it
  2785. */
  2786. function rewriteDefault(input, as, parserPlugins) {
  2787. if (!hasDefaultExport(input)) {
  2788. return input + `\nconst ${as} = {}`;
  2789. }
  2790. let replaced;
  2791. const classMatch = input.match(exportDefaultClassRE);
  2792. if (classMatch) {
  2793. replaced =
  2794. input.replace(exportDefaultClassRE, '$1class $2') +
  2795. `\nconst ${as} = ${classMatch[2]}`;
  2796. }
  2797. else {
  2798. replaced = input.replace(defaultExportRE, `$1const ${as} =`);
  2799. }
  2800. if (!hasDefaultExport(replaced)) {
  2801. return replaced;
  2802. }
  2803. // if the script somehow still contains `default export`, it probably has
  2804. // multi-line comments or template strings. fallback to a full parse.
  2805. const s = new MagicString__default(input);
  2806. const ast = parser$2.parse(input, {
  2807. sourceType: 'module',
  2808. plugins: parserPlugins
  2809. }).program.body;
  2810. ast.forEach(node => {
  2811. if (node.type === 'ExportDefaultDeclaration') {
  2812. s.overwrite(node.start, node.declaration.start, `const ${as} = `);
  2813. }
  2814. if (node.type === 'ExportNamedDeclaration') {
  2815. node.specifiers.forEach(specifier => {
  2816. if (specifier.type === 'ExportSpecifier' &&
  2817. specifier.exported.type === 'Identifier' &&
  2818. specifier.exported.name === 'default') {
  2819. const end = specifier.end;
  2820. s.overwrite(specifier.start, input.charAt(end) === ',' ? end + 1 : end, ``);
  2821. s.append(`\nconst ${as} = ${specifier.local.name}`);
  2822. }
  2823. });
  2824. }
  2825. });
  2826. return s.toString();
  2827. }
  2828. function hasDefaultExport(input) {
  2829. return defaultExportRE.test(input) || namedDefaultExportRE.test(input);
  2830. }
  2831. // Special compiler macros
  2832. const DEFINE_PROPS = 'defineProps';
  2833. const DEFINE_EMITS = 'defineEmits';
  2834. const DEFINE_EXPOSE = 'defineExpose';
  2835. const WITH_DEFAULTS = 'withDefaults';
  2836. // constants
  2837. const DEFAULT_VAR = `__default__`;
  2838. const isBuiltInDir = shared.makeMap(`once,memo,if,else,else-if,slot,text,html,on,bind,model,show,cloak,is`);
  2839. /**
  2840. * Compile `<script setup>`
  2841. * It requires the whole SFC descriptor because we need to handle and merge
  2842. * normal `<script>` + `<script setup>` if both are present.
  2843. */
  2844. function compileScript(sfc, options) {
  2845. let { script, scriptSetup, source, filename } = sfc;
  2846. // feature flags
  2847. // TODO remove support for deprecated options when out of experimental
  2848. const enableReactivityTransform = !!options.reactivityTransform ||
  2849. !!options.refSugar ||
  2850. !!options.refTransform;
  2851. const enablePropsTransform = !!options.reactivityTransform || !!options.propsDestructureTransform;
  2852. const isProd = !!options.isProd;
  2853. const genSourceMap = options.sourceMap !== false;
  2854. let refBindings;
  2855. if (!options.id) {
  2856. warnOnce(`compileScript now requires passing the \`id\` option.\n` +
  2857. `Upgrade your vite or vue-loader version for compatibility with ` +
  2858. `the latest experimental proposals.`);
  2859. }
  2860. const scopeId = options.id ? options.id.replace(/^data-v-/, '') : '';
  2861. const cssVars = sfc.cssVars;
  2862. const scriptLang = script && script.lang;
  2863. const scriptSetupLang = scriptSetup && scriptSetup.lang;
  2864. const isTS = scriptLang === 'ts' ||
  2865. scriptLang === 'tsx' ||
  2866. scriptSetupLang === 'ts' ||
  2867. scriptSetupLang === 'tsx';
  2868. // resolve parser plugins
  2869. const plugins = [];
  2870. if (!isTS || scriptLang === 'tsx' || scriptSetupLang === 'tsx') {
  2871. plugins.push('jsx');
  2872. }
  2873. if (options.babelParserPlugins)
  2874. plugins.push(...options.babelParserPlugins);
  2875. if (isTS)
  2876. plugins.push('typescript', 'decorators-legacy');
  2877. if (!scriptSetup) {
  2878. if (!script) {
  2879. throw new Error(`[@vue/compiler-sfc] SFC contains no <script> tags.`);
  2880. }
  2881. if (scriptLang && !isTS && scriptLang !== 'jsx') {
  2882. // do not process non js/ts script blocks
  2883. return script;
  2884. }
  2885. try {
  2886. let content = script.content;
  2887. let map = script.map;
  2888. const scriptAst = parser$2.parse(content, {
  2889. plugins,
  2890. sourceType: 'module'
  2891. }).program;
  2892. const bindings = analyzeScriptBindings(scriptAst.body);
  2893. if (enableReactivityTransform && reactivityTransform.shouldTransform(content)) {
  2894. const s = new MagicString__default(source);
  2895. const startOffset = script.loc.start.offset;
  2896. const endOffset = script.loc.end.offset;
  2897. const { importedHelpers } = reactivityTransform.transformAST(scriptAst, s, startOffset);
  2898. if (importedHelpers.length) {
  2899. s.prepend(`import { ${importedHelpers
  2900. .map(h => `${h} as _${h}`)
  2901. .join(', ')} } from 'vue'\n`);
  2902. }
  2903. s.remove(0, startOffset);
  2904. s.remove(endOffset, source.length);
  2905. content = s.toString();
  2906. if (genSourceMap) {
  2907. map = s.generateMap({
  2908. source: filename,
  2909. hires: true,
  2910. includeContent: true
  2911. });
  2912. }
  2913. }
  2914. if (cssVars.length) {
  2915. content = rewriteDefault(content, DEFAULT_VAR, plugins);
  2916. content += genNormalScriptCssVarsCode(cssVars, bindings, scopeId, isProd);
  2917. content += `\nexport default ${DEFAULT_VAR}`;
  2918. }
  2919. return Object.assign(Object.assign({}, script), { content,
  2920. map,
  2921. bindings, scriptAst: scriptAst.body });
  2922. }
  2923. catch (e) {
  2924. // silently fallback if parse fails since user may be using custom
  2925. // babel syntax
  2926. return script;
  2927. }
  2928. }
  2929. if (script && scriptLang !== scriptSetupLang) {
  2930. throw new Error(`[@vue/compiler-sfc] <script> and <script setup> must have the same ` +
  2931. `language type.`);
  2932. }
  2933. if (scriptSetupLang && !isTS && scriptSetupLang !== 'jsx') {
  2934. // do not process non js/ts script blocks
  2935. return scriptSetup;
  2936. }
  2937. // metadata that needs to be returned
  2938. const bindingMetadata = {};
  2939. const helperImports = new Set();
  2940. const userImports = Object.create(null);
  2941. const userImportAlias = Object.create(null);
  2942. const scriptBindings = Object.create(null);
  2943. const setupBindings = Object.create(null);
  2944. let defaultExport;
  2945. let hasDefinePropsCall = false;
  2946. let hasDefineEmitCall = false;
  2947. let hasDefineExposeCall = false;
  2948. let propsRuntimeDecl;
  2949. let propsRuntimeDefaults;
  2950. let propsDestructureDecl;
  2951. let propsDestructureRestId;
  2952. let propsTypeDecl;
  2953. let propsTypeDeclRaw;
  2954. let propsIdentifier;
  2955. let emitsRuntimeDecl;
  2956. let emitsTypeDecl;
  2957. let emitsTypeDeclRaw;
  2958. let emitIdentifier;
  2959. let hasAwait = false;
  2960. let hasInlinedSsrRenderFn = false;
  2961. // props/emits declared via types
  2962. const typeDeclaredProps = {};
  2963. const typeDeclaredEmits = new Set();
  2964. // record declared types for runtime props type generation
  2965. const declaredTypes = {};
  2966. // props destructure data
  2967. const propsDestructuredBindings = Object.create(null);
  2968. // magic-string state
  2969. const s = new MagicString__default(source);
  2970. const startOffset = scriptSetup.loc.start.offset;
  2971. const endOffset = scriptSetup.loc.end.offset;
  2972. const scriptStartOffset = script && script.loc.start.offset;
  2973. const scriptEndOffset = script && script.loc.end.offset;
  2974. function helper(key) {
  2975. helperImports.add(key);
  2976. return `_${key}`;
  2977. }
  2978. function parse(input, options, offset) {
  2979. try {
  2980. return parser$2.parse(input, options).program;
  2981. }
  2982. catch (e) {
  2983. e.message = `[@vue/compiler-sfc] ${e.message}\n\n${sfc.filename}\n${shared.generateCodeFrame(source, e.pos + offset, e.pos + offset + 1)}`;
  2984. throw e;
  2985. }
  2986. }
  2987. function error(msg, node, end = node.end + startOffset) {
  2988. throw new Error(`[@vue/compiler-sfc] ${msg}\n\n${sfc.filename}\n${shared.generateCodeFrame(source, node.start + startOffset, end)}`);
  2989. }
  2990. function registerUserImport(source, local, imported, isType, isFromSetup) {
  2991. if (source === 'vue' && imported) {
  2992. userImportAlias[imported] = local;
  2993. }
  2994. let isUsedInTemplate = true;
  2995. if (isTS && sfc.template && !sfc.template.src && !sfc.template.lang) {
  2996. isUsedInTemplate = isImportUsed(local, sfc);
  2997. }
  2998. userImports[local] = {
  2999. isType,
  3000. imported: imported || 'default',
  3001. source,
  3002. isFromSetup,
  3003. isUsedInTemplate
  3004. };
  3005. }
  3006. function processDefineProps(node, declId) {
  3007. if (!isCallOf(node, DEFINE_PROPS)) {
  3008. return false;
  3009. }
  3010. if (hasDefinePropsCall) {
  3011. error(`duplicate ${DEFINE_PROPS}() call`, node);
  3012. }
  3013. hasDefinePropsCall = true;
  3014. propsRuntimeDecl = node.arguments[0];
  3015. // call has type parameters - infer runtime types from it
  3016. if (node.typeParameters) {
  3017. if (propsRuntimeDecl) {
  3018. error(`${DEFINE_PROPS}() cannot accept both type and non-type arguments ` +
  3019. `at the same time. Use one or the other.`, node);
  3020. }
  3021. propsTypeDeclRaw = node.typeParameters.params[0];
  3022. propsTypeDecl = resolveQualifiedType(propsTypeDeclRaw, node => node.type === 'TSTypeLiteral');
  3023. if (!propsTypeDecl) {
  3024. error(`type argument passed to ${DEFINE_PROPS}() must be a literal type, ` +
  3025. `or a reference to an interface or literal type.`, propsTypeDeclRaw);
  3026. }
  3027. }
  3028. if (declId) {
  3029. if (enablePropsTransform && declId.type === 'ObjectPattern') {
  3030. propsDestructureDecl = declId;
  3031. // props destructure - handle compilation sugar
  3032. for (const prop of declId.properties) {
  3033. if (prop.type === 'ObjectProperty') {
  3034. if (prop.computed) {
  3035. error(`${DEFINE_PROPS}() destructure cannot use computed key.`, prop.key);
  3036. }
  3037. const propKey = prop.key.name;
  3038. if (prop.value.type === 'AssignmentPattern') {
  3039. // default value { foo = 123 }
  3040. const { left, right } = prop.value;
  3041. if (left.type !== 'Identifier') {
  3042. error(`${DEFINE_PROPS}() destructure does not support nested patterns.`, left);
  3043. }
  3044. // store default value
  3045. propsDestructuredBindings[propKey] = {
  3046. local: left.name,
  3047. default: right
  3048. };
  3049. }
  3050. else if (prop.value.type === 'Identifier') {
  3051. // simple destructure
  3052. propsDestructuredBindings[propKey] = {
  3053. local: prop.value.name
  3054. };
  3055. }
  3056. else {
  3057. error(`${DEFINE_PROPS}() destructure does not support nested patterns.`, prop.value);
  3058. }
  3059. }
  3060. else {
  3061. // rest spread
  3062. propsDestructureRestId = prop.argument.name;
  3063. }
  3064. }
  3065. }
  3066. else {
  3067. propsIdentifier = scriptSetup.content.slice(declId.start, declId.end);
  3068. }
  3069. }
  3070. return true;
  3071. }
  3072. function processWithDefaults(node, declId) {
  3073. if (!isCallOf(node, WITH_DEFAULTS)) {
  3074. return false;
  3075. }
  3076. if (processDefineProps(node.arguments[0], declId)) {
  3077. if (propsRuntimeDecl) {
  3078. error(`${WITH_DEFAULTS} can only be used with type-based ` +
  3079. `${DEFINE_PROPS} declaration.`, node);
  3080. }
  3081. if (propsDestructureDecl) {
  3082. error(`${WITH_DEFAULTS}() is unnecessary when using destructure with ${DEFINE_PROPS}().\n` +
  3083. `Prefer using destructure default values, e.g. const { foo = 1 } = defineProps(...).`, node.callee);
  3084. }
  3085. propsRuntimeDefaults = node.arguments[1];
  3086. if (!propsRuntimeDefaults ||
  3087. propsRuntimeDefaults.type !== 'ObjectExpression') {
  3088. error(`The 2nd argument of ${WITH_DEFAULTS} must be an object literal.`, propsRuntimeDefaults || node);
  3089. }
  3090. }
  3091. else {
  3092. error(`${WITH_DEFAULTS}' first argument must be a ${DEFINE_PROPS} call.`, node.arguments[0] || node);
  3093. }
  3094. return true;
  3095. }
  3096. function processDefineEmits(node, declId) {
  3097. if (!isCallOf(node, DEFINE_EMITS)) {
  3098. return false;
  3099. }
  3100. if (hasDefineEmitCall) {
  3101. error(`duplicate ${DEFINE_EMITS}() call`, node);
  3102. }
  3103. hasDefineEmitCall = true;
  3104. emitsRuntimeDecl = node.arguments[0];
  3105. if (node.typeParameters) {
  3106. if (emitsRuntimeDecl) {
  3107. error(`${DEFINE_EMITS}() cannot accept both type and non-type arguments ` +
  3108. `at the same time. Use one or the other.`, node);
  3109. }
  3110. emitsTypeDeclRaw = node.typeParameters.params[0];
  3111. emitsTypeDecl = resolveQualifiedType(emitsTypeDeclRaw, node => node.type === 'TSFunctionType' || node.type === 'TSTypeLiteral');
  3112. if (!emitsTypeDecl) {
  3113. error(`type argument passed to ${DEFINE_EMITS}() must be a function type, ` +
  3114. `a literal type with call signatures, or a reference to the above types.`, emitsTypeDeclRaw);
  3115. }
  3116. }
  3117. if (declId) {
  3118. emitIdentifier = scriptSetup.content.slice(declId.start, declId.end);
  3119. }
  3120. return true;
  3121. }
  3122. function resolveQualifiedType(node, qualifier) {
  3123. if (qualifier(node)) {
  3124. return node;
  3125. }
  3126. if (node.type === 'TSTypeReference' &&
  3127. node.typeName.type === 'Identifier') {
  3128. const refName = node.typeName.name;
  3129. const isQualifiedType = (node) => {
  3130. if (node.type === 'TSInterfaceDeclaration' &&
  3131. node.id.name === refName) {
  3132. return node.body;
  3133. }
  3134. else if (node.type === 'TSTypeAliasDeclaration' &&
  3135. node.id.name === refName &&
  3136. qualifier(node.typeAnnotation)) {
  3137. return node.typeAnnotation;
  3138. }
  3139. else if (node.type === 'ExportNamedDeclaration' && node.declaration) {
  3140. return isQualifiedType(node.declaration);
  3141. }
  3142. };
  3143. const body = scriptAst
  3144. ? [...scriptSetupAst.body, ...scriptAst.body]
  3145. : scriptSetupAst.body;
  3146. for (const node of body) {
  3147. const qualified = isQualifiedType(node);
  3148. if (qualified) {
  3149. return qualified;
  3150. }
  3151. }
  3152. }
  3153. }
  3154. function processDefineExpose(node) {
  3155. if (isCallOf(node, DEFINE_EXPOSE)) {
  3156. if (hasDefineExposeCall) {
  3157. error(`duplicate ${DEFINE_EXPOSE}() call`, node);
  3158. }
  3159. hasDefineExposeCall = true;
  3160. return true;
  3161. }
  3162. return false;
  3163. }
  3164. function checkInvalidScopeReference(node, method) {
  3165. if (!node)
  3166. return;
  3167. CompilerDOM.walkIdentifiers(node, id => {
  3168. if (setupBindings[id.name]) {
  3169. error(`\`${method}()\` in <script setup> cannot reference locally ` +
  3170. `declared variables because it will be hoisted outside of the ` +
  3171. `setup() function. If your component options require initialization ` +
  3172. `in the module scope, use a separate normal <script> to export ` +
  3173. `the options instead.`, id);
  3174. }
  3175. });
  3176. }
  3177. /**
  3178. * await foo()
  3179. * -->
  3180. * ;(
  3181. * ([__temp,__restore] = withAsyncContext(() => foo())),
  3182. * await __temp,
  3183. * __restore()
  3184. * )
  3185. *
  3186. * const a = await foo()
  3187. * -->
  3188. * const a = (
  3189. * ([__temp, __restore] = withAsyncContext(() => foo())),
  3190. * __temp = await __temp,
  3191. * __restore(),
  3192. * __temp
  3193. * )
  3194. */
  3195. function processAwait(node, needSemi, isStatement) {
  3196. const argumentStart = node.argument.extra && node.argument.extra.parenthesized
  3197. ? node.argument.extra.parenStart
  3198. : node.argument.start;
  3199. const argumentStr = source.slice(argumentStart + startOffset, node.argument.end + startOffset);
  3200. const containsNestedAwait = /\bawait\b/.test(argumentStr);
  3201. s.overwrite(node.start + startOffset, argumentStart + startOffset, `${needSemi ? `;` : ``}(\n ([__temp,__restore] = ${helper(`withAsyncContext`)}(${containsNestedAwait ? `async ` : ``}() => `);
  3202. s.appendLeft(node.end + startOffset, `)),\n ${isStatement ? `` : `__temp = `}await __temp,\n __restore()${isStatement ? `` : `,\n __temp`}\n)`);
  3203. }
  3204. /**
  3205. * check defaults. If the default object is an object literal with only
  3206. * static properties, we can directly generate more optimized default
  3207. * declarations. Otherwise we will have to fallback to runtime merging.
  3208. */
  3209. function hasStaticWithDefaults() {
  3210. return (propsRuntimeDefaults &&
  3211. propsRuntimeDefaults.type === 'ObjectExpression' &&
  3212. propsRuntimeDefaults.properties.every(node => (node.type === 'ObjectProperty' && !node.computed) ||
  3213. node.type === 'ObjectMethod'));
  3214. }
  3215. function genRuntimeProps(props) {
  3216. const keys = Object.keys(props);
  3217. if (!keys.length) {
  3218. return ``;
  3219. }
  3220. const hasStaticDefaults = hasStaticWithDefaults();
  3221. const scriptSetupSource = scriptSetup.content;
  3222. let propsDecls = `{
  3223. ${keys
  3224. .map(key => {
  3225. let defaultString;
  3226. const destructured = genDestructuredDefaultValue(key);
  3227. if (destructured) {
  3228. defaultString = `default: ${destructured}`;
  3229. }
  3230. else if (hasStaticDefaults) {
  3231. const prop = propsRuntimeDefaults.properties.find((node) => node.key.name === key);
  3232. if (prop) {
  3233. if (prop.type === 'ObjectProperty') {
  3234. // prop has corresponding static default value
  3235. defaultString = `default: ${scriptSetupSource.slice(prop.value.start, prop.value.end)}`;
  3236. }
  3237. else {
  3238. defaultString = `default() ${scriptSetupSource.slice(prop.body.start, prop.body.end)}`;
  3239. }
  3240. }
  3241. }
  3242. const { type, required } = props[key];
  3243. if (!isProd) {
  3244. return `${key}: { type: ${toRuntimeTypeString(type)}, required: ${required}${defaultString ? `, ${defaultString}` : ``} }`;
  3245. }
  3246. else if (type.some(el => el === 'Boolean' || (defaultString && el === 'Function'))) {
  3247. // #4783 production: if boolean or defaultString and function exists, should keep the type.
  3248. return `${key}: { type: ${toRuntimeTypeString(type)}${defaultString ? `, ${defaultString}` : ``} }`;
  3249. }
  3250. else {
  3251. // production: checks are useless
  3252. return `${key}: ${defaultString ? `{ ${defaultString} }` : 'null'}`;
  3253. }
  3254. })
  3255. .join(',\n ')}\n }`;
  3256. if (propsRuntimeDefaults && !hasStaticDefaults) {
  3257. propsDecls = `${helper('mergeDefaults')}(${propsDecls}, ${source.slice(propsRuntimeDefaults.start + startOffset, propsRuntimeDefaults.end + startOffset)})`;
  3258. }
  3259. return `\n props: ${propsDecls},`;
  3260. }
  3261. function genDestructuredDefaultValue(key) {
  3262. const destructured = propsDestructuredBindings[key];
  3263. if (destructured && destructured.default) {
  3264. const value = scriptSetup.content.slice(destructured.default.start, destructured.default.end);
  3265. const isLiteral = destructured.default.type.endsWith('Literal');
  3266. return isLiteral ? value : `() => ${value}`;
  3267. }
  3268. }
  3269. function genSetupPropsType(node) {
  3270. const scriptSetupSource = scriptSetup.content;
  3271. if (hasStaticWithDefaults()) {
  3272. // if withDefaults() is used, we need to remove the optional flags
  3273. // on props that have default values
  3274. let res = `{ `;
  3275. const members = node.type === 'TSTypeLiteral' ? node.members : node.body;
  3276. for (const m of members) {
  3277. if ((m.type === 'TSPropertySignature' ||
  3278. m.type === 'TSMethodSignature') &&
  3279. m.typeAnnotation &&
  3280. m.key.type === 'Identifier') {
  3281. if (propsRuntimeDefaults.properties.some((p) => p.key.name === m.key.name)) {
  3282. res +=
  3283. m.key.name +
  3284. (m.type === 'TSMethodSignature' ? '()' : '') +
  3285. scriptSetupSource.slice(m.typeAnnotation.start, m.typeAnnotation.end) +
  3286. ', ';
  3287. }
  3288. else {
  3289. res +=
  3290. scriptSetupSource.slice(m.start, m.typeAnnotation.end) + `, `;
  3291. }
  3292. }
  3293. }
  3294. return (res.length ? res.slice(0, -2) : res) + ` }`;
  3295. }
  3296. else {
  3297. return scriptSetupSource.slice(node.start, node.end);
  3298. }
  3299. }
  3300. // 1. process normal <script> first if it exists
  3301. let scriptAst;
  3302. if (script) {
  3303. scriptAst = parse(script.content, {
  3304. plugins,
  3305. sourceType: 'module'
  3306. }, scriptStartOffset);
  3307. for (const node of scriptAst.body) {
  3308. if (node.type === 'ImportDeclaration') {
  3309. // record imports for dedupe
  3310. for (const specifier of node.specifiers) {
  3311. const imported = specifier.type === 'ImportSpecifier' &&
  3312. specifier.imported.type === 'Identifier' &&
  3313. specifier.imported.name;
  3314. registerUserImport(node.source.value, specifier.local.name, imported, node.importKind === 'type' ||
  3315. (specifier.type === 'ImportSpecifier' &&
  3316. specifier.importKind === 'type'), false);
  3317. }
  3318. }
  3319. else if (node.type === 'ExportDefaultDeclaration') {
  3320. // export default
  3321. defaultExport = node;
  3322. // export default { ... } --> const __default__ = { ... }
  3323. const start = node.start + scriptStartOffset;
  3324. const end = node.declaration.start + scriptStartOffset;
  3325. s.overwrite(start, end, `const ${DEFAULT_VAR} = `);
  3326. }
  3327. else if (node.type === 'ExportNamedDeclaration') {
  3328. const defaultSpecifier = node.specifiers.find(s => s.exported.type === 'Identifier' && s.exported.name === 'default');
  3329. if (defaultSpecifier) {
  3330. defaultExport = node;
  3331. // 1. remove specifier
  3332. if (node.specifiers.length > 1) {
  3333. s.remove(defaultSpecifier.start + scriptStartOffset, defaultSpecifier.end + scriptStartOffset);
  3334. }
  3335. else {
  3336. s.remove(node.start + scriptStartOffset, node.end + scriptStartOffset);
  3337. }
  3338. if (node.source) {
  3339. // export { x as default } from './x'
  3340. // rewrite to `import { x as __default__ } from './x'` and
  3341. // add to top
  3342. s.prepend(`import { ${defaultSpecifier.local.name} as ${DEFAULT_VAR} } from '${node.source.value}'\n`);
  3343. }
  3344. else {
  3345. // export { x as default }
  3346. // rewrite to `const __default__ = x` and move to end
  3347. s.appendLeft(scriptEndOffset, `\nconst ${DEFAULT_VAR} = ${defaultSpecifier.local.name}\n`);
  3348. }
  3349. }
  3350. if (node.declaration) {
  3351. walkDeclaration(node.declaration, scriptBindings, userImportAlias);
  3352. }
  3353. }
  3354. else if ((node.type === 'VariableDeclaration' ||
  3355. node.type === 'FunctionDeclaration' ||
  3356. node.type === 'ClassDeclaration' ||
  3357. node.type === 'TSEnumDeclaration') &&
  3358. !node.declare) {
  3359. walkDeclaration(node, scriptBindings, userImportAlias);
  3360. }
  3361. }
  3362. // apply reactivity transform
  3363. if (enableReactivityTransform && reactivityTransform.shouldTransform(script.content)) {
  3364. const { rootRefs, importedHelpers } = reactivityTransform.transformAST(scriptAst, s, scriptStartOffset);
  3365. refBindings = rootRefs;
  3366. for (const h of importedHelpers) {
  3367. helperImports.add(h);
  3368. }
  3369. }
  3370. // <script> after <script setup>
  3371. // we need to move the block up so that `const __default__` is
  3372. // declared before being used in the actual component definition
  3373. if (scriptStartOffset > startOffset) {
  3374. s.move(scriptStartOffset, scriptEndOffset, 0);
  3375. }
  3376. }
  3377. // 2. parse <script setup> and walk over top level statements
  3378. const scriptSetupAst = parse(scriptSetup.content, {
  3379. plugins: [
  3380. ...plugins,
  3381. // allow top level await but only inside <script setup>
  3382. 'topLevelAwait'
  3383. ],
  3384. sourceType: 'module'
  3385. }, startOffset);
  3386. for (const node of scriptSetupAst.body) {
  3387. const start = node.start + startOffset;
  3388. let end = node.end + startOffset;
  3389. // locate comment
  3390. if (node.trailingComments && node.trailingComments.length > 0) {
  3391. const lastCommentNode = node.trailingComments[node.trailingComments.length - 1];
  3392. end = lastCommentNode.end + startOffset;
  3393. }
  3394. // locate the end of whitespace between this statement and the next
  3395. while (end <= source.length) {
  3396. if (!/\s/.test(source.charAt(end))) {
  3397. break;
  3398. }
  3399. end++;
  3400. }
  3401. // (Dropped) `ref: x` bindings
  3402. if (node.type === 'LabeledStatement' &&
  3403. node.label.name === 'ref' &&
  3404. node.body.type === 'ExpressionStatement') {
  3405. error(`ref sugar using the label syntax was an experimental proposal and ` +
  3406. `has been dropped based on community feedback. Please check out ` +
  3407. `the new proposal at https://github.com/vuejs/rfcs/discussions/369`, node);
  3408. }
  3409. if (node.type === 'ImportDeclaration') {
  3410. // import declarations are moved to top
  3411. s.move(start, end, 0);
  3412. // dedupe imports
  3413. let removed = 0;
  3414. const removeSpecifier = (i) => {
  3415. const removeLeft = i > removed;
  3416. removed++;
  3417. const current = node.specifiers[i];
  3418. const next = node.specifiers[i + 1];
  3419. s.remove(removeLeft
  3420. ? node.specifiers[i - 1].end + startOffset
  3421. : current.start + startOffset, next && !removeLeft
  3422. ? next.start + startOffset
  3423. : current.end + startOffset);
  3424. };
  3425. for (let i = 0; i < node.specifiers.length; i++) {
  3426. const specifier = node.specifiers[i];
  3427. const local = specifier.local.name;
  3428. const imported = specifier.type === 'ImportSpecifier' &&
  3429. specifier.imported.type === 'Identifier' &&
  3430. specifier.imported.name;
  3431. const source = node.source.value;
  3432. const existing = userImports[local];
  3433. if (source === 'vue' &&
  3434. (imported === DEFINE_PROPS ||
  3435. imported === DEFINE_EMITS ||
  3436. imported === DEFINE_EXPOSE)) {
  3437. warnOnce(`\`${imported}\` is a compiler macro and no longer needs to be imported.`);
  3438. removeSpecifier(i);
  3439. }
  3440. else if (existing) {
  3441. if (existing.source === source && existing.imported === imported) {
  3442. // already imported in <script setup>, dedupe
  3443. removeSpecifier(i);
  3444. }
  3445. else {
  3446. error(`different imports aliased to same local name.`, specifier);
  3447. }
  3448. }
  3449. else {
  3450. registerUserImport(source, local, imported, node.importKind === 'type' ||
  3451. (specifier.type === 'ImportSpecifier' &&
  3452. specifier.importKind === 'type'), true);
  3453. }
  3454. }
  3455. if (node.specifiers.length && removed === node.specifiers.length) {
  3456. s.remove(node.start + startOffset, node.end + startOffset);
  3457. }
  3458. }
  3459. if (node.type === 'ExpressionStatement') {
  3460. // process `defineProps` and `defineEmit(s)` calls
  3461. if (processDefineProps(node.expression) ||
  3462. processDefineEmits(node.expression) ||
  3463. processWithDefaults(node.expression)) {
  3464. s.remove(node.start + startOffset, node.end + startOffset);
  3465. }
  3466. else if (processDefineExpose(node.expression)) {
  3467. // defineExpose({}) -> expose({})
  3468. const callee = node.expression.callee;
  3469. s.overwrite(callee.start + startOffset, callee.end + startOffset, 'expose');
  3470. }
  3471. }
  3472. if (node.type === 'VariableDeclaration' && !node.declare) {
  3473. const total = node.declarations.length;
  3474. let left = total;
  3475. for (let i = 0; i < total; i++) {
  3476. const decl = node.declarations[i];
  3477. if (decl.init) {
  3478. // defineProps / defineEmits
  3479. const isDefineProps = processDefineProps(decl.init, decl.id) ||
  3480. processWithDefaults(decl.init, decl.id);
  3481. const isDefineEmits = processDefineEmits(decl.init, decl.id);
  3482. if (isDefineProps || isDefineEmits) {
  3483. if (left === 1) {
  3484. s.remove(node.start + startOffset, node.end + startOffset);
  3485. }
  3486. else {
  3487. let start = decl.start + startOffset;
  3488. let end = decl.end + startOffset;
  3489. if (i < total - 1) {
  3490. // not the last one, locate the start of the next
  3491. end = node.declarations[i + 1].start + startOffset;
  3492. }
  3493. else {
  3494. // last one, locate the end of the prev
  3495. start = node.declarations[i - 1].end + startOffset;
  3496. }
  3497. s.remove(start, end);
  3498. left--;
  3499. }
  3500. }
  3501. }
  3502. }
  3503. }
  3504. // walk declarations to record declared bindings
  3505. if ((node.type === 'VariableDeclaration' ||
  3506. node.type === 'FunctionDeclaration' ||
  3507. node.type === 'ClassDeclaration') &&
  3508. !node.declare) {
  3509. walkDeclaration(node, setupBindings, userImportAlias);
  3510. }
  3511. // walk statements & named exports / variable declarations for top level
  3512. // await
  3513. if ((node.type === 'VariableDeclaration' && !node.declare) ||
  3514. node.type.endsWith('Statement')) {
  3515. estreeWalker.walk(node, {
  3516. enter(child, parent) {
  3517. if (CompilerDOM.isFunctionType(child)) {
  3518. this.skip();
  3519. }
  3520. if (child.type === 'AwaitExpression') {
  3521. hasAwait = true;
  3522. const needsSemi = scriptSetupAst.body.some(n => {
  3523. return n.type === 'ExpressionStatement' && n.start === child.start;
  3524. });
  3525. processAwait(child, needsSemi, parent.type === 'ExpressionStatement');
  3526. }
  3527. }
  3528. });
  3529. }
  3530. if ((node.type === 'ExportNamedDeclaration' && node.exportKind !== 'type') ||
  3531. node.type === 'ExportAllDeclaration' ||
  3532. node.type === 'ExportDefaultDeclaration') {
  3533. error(`<script setup> cannot contain ES module exports. ` +
  3534. `If you are using a previous version of <script setup>, please ` +
  3535. `consult the updated RFC at https://github.com/vuejs/rfcs/pull/227.`, node);
  3536. }
  3537. if (isTS) {
  3538. // runtime enum
  3539. if (node.type === 'TSEnumDeclaration') {
  3540. registerBinding(setupBindings, node.id, "setup-const" /* SETUP_CONST */);
  3541. }
  3542. // move all Type declarations to outer scope
  3543. if (node.type.startsWith('TS') ||
  3544. (node.type === 'ExportNamedDeclaration' &&
  3545. node.exportKind === 'type') ||
  3546. (node.type === 'VariableDeclaration' && node.declare)) {
  3547. recordType(node, declaredTypes);
  3548. s.move(start, end, 0);
  3549. }
  3550. }
  3551. }
  3552. // 3. Apply reactivity transform
  3553. if ((enableReactivityTransform &&
  3554. // normal <script> had ref bindings that maybe used in <script setup>
  3555. (refBindings || reactivityTransform.shouldTransform(scriptSetup.content))) ||
  3556. propsDestructureDecl) {
  3557. const { rootRefs, importedHelpers } = reactivityTransform.transformAST(scriptSetupAst, s, startOffset, refBindings, propsDestructuredBindings);
  3558. refBindings = refBindings ? [...refBindings, ...rootRefs] : rootRefs;
  3559. for (const h of importedHelpers) {
  3560. helperImports.add(h);
  3561. }
  3562. }
  3563. // 4. extract runtime props/emits code from setup context type
  3564. if (propsTypeDecl) {
  3565. extractRuntimeProps(propsTypeDecl, typeDeclaredProps, declaredTypes);
  3566. }
  3567. if (emitsTypeDecl) {
  3568. extractRuntimeEmits(emitsTypeDecl, typeDeclaredEmits);
  3569. }
  3570. // 5. check useOptions args to make sure it doesn't reference setup scope
  3571. // variables
  3572. checkInvalidScopeReference(propsRuntimeDecl, DEFINE_PROPS);
  3573. checkInvalidScopeReference(propsRuntimeDefaults, DEFINE_PROPS);
  3574. checkInvalidScopeReference(propsDestructureDecl, DEFINE_PROPS);
  3575. checkInvalidScopeReference(emitsRuntimeDecl, DEFINE_PROPS);
  3576. // 6. remove non-script content
  3577. if (script) {
  3578. if (startOffset < scriptStartOffset) {
  3579. // <script setup> before <script>
  3580. s.remove(0, startOffset);
  3581. s.remove(endOffset, scriptStartOffset);
  3582. s.remove(scriptEndOffset, source.length);
  3583. }
  3584. else {
  3585. // <script> before <script setup>
  3586. s.remove(0, scriptStartOffset);
  3587. s.remove(scriptEndOffset, startOffset);
  3588. s.remove(endOffset, source.length);
  3589. }
  3590. }
  3591. else {
  3592. // only <script setup>
  3593. s.remove(0, startOffset);
  3594. s.remove(endOffset, source.length);
  3595. }
  3596. // 7. analyze binding metadata
  3597. if (scriptAst) {
  3598. Object.assign(bindingMetadata, analyzeScriptBindings(scriptAst.body));
  3599. }
  3600. if (propsRuntimeDecl) {
  3601. for (const key of getObjectOrArrayExpressionKeys(propsRuntimeDecl)) {
  3602. bindingMetadata[key] = "props" /* PROPS */;
  3603. }
  3604. }
  3605. for (const key in typeDeclaredProps) {
  3606. bindingMetadata[key] = "props" /* PROPS */;
  3607. }
  3608. // props aliases
  3609. if (propsDestructureDecl) {
  3610. if (propsDestructureRestId) {
  3611. bindingMetadata[propsDestructureRestId] = "setup-const" /* SETUP_CONST */;
  3612. }
  3613. for (const key in propsDestructuredBindings) {
  3614. const { local } = propsDestructuredBindings[key];
  3615. if (local !== key) {
  3616. bindingMetadata[local] = "props-aliased" /* PROPS_ALIASED */;
  3617. (bindingMetadata.__propsAliases ||
  3618. (bindingMetadata.__propsAliases = {}))[local] = key;
  3619. }
  3620. }
  3621. }
  3622. for (const [key, { isType, imported, source }] of Object.entries(userImports)) {
  3623. if (isType)
  3624. continue;
  3625. bindingMetadata[key] =
  3626. (imported === 'default' && source.endsWith('.vue')) || source === 'vue'
  3627. ? "setup-const" /* SETUP_CONST */
  3628. : "setup-maybe-ref" /* SETUP_MAYBE_REF */;
  3629. }
  3630. for (const key in scriptBindings) {
  3631. bindingMetadata[key] = scriptBindings[key];
  3632. }
  3633. for (const key in setupBindings) {
  3634. bindingMetadata[key] = setupBindings[key];
  3635. }
  3636. // known ref bindings
  3637. if (refBindings) {
  3638. for (const key of refBindings) {
  3639. bindingMetadata[key] = "setup-ref" /* SETUP_REF */;
  3640. }
  3641. }
  3642. // 8. inject `useCssVars` calls
  3643. if (cssVars.length) {
  3644. helperImports.add(CSS_VARS_HELPER);
  3645. helperImports.add('unref');
  3646. s.prependRight(startOffset, `\n${genCssVarsCode(cssVars, bindingMetadata, scopeId, isProd)}\n`);
  3647. }
  3648. // 9. finalize setup() argument signature
  3649. let args = `__props`;
  3650. if (propsTypeDecl) {
  3651. // mark as any and only cast on assignment
  3652. // since the user defined complex types may be incompatible with the
  3653. // inferred type from generated runtime declarations
  3654. args += `: any`;
  3655. }
  3656. // inject user assignment of props
  3657. // we use a default __props so that template expressions referencing props
  3658. // can use it directly
  3659. if (propsIdentifier) {
  3660. s.prependLeft(startOffset, `\nconst ${propsIdentifier} = __props${propsTypeDecl ? ` as ${genSetupPropsType(propsTypeDecl)}` : ``}\n`);
  3661. }
  3662. if (propsDestructureRestId) {
  3663. s.prependLeft(startOffset, `\nconst ${propsDestructureRestId} = ${helper(`createPropsRestProxy`)}(__props, ${JSON.stringify(Object.keys(propsDestructuredBindings))})\n`);
  3664. }
  3665. // inject temp variables for async context preservation
  3666. if (hasAwait) {
  3667. const any = isTS ? `: any` : ``;
  3668. s.prependLeft(startOffset, `\nlet __temp${any}, __restore${any}\n`);
  3669. }
  3670. const destructureElements = hasDefineExposeCall || !options.inlineTemplate ? [`expose`] : [];
  3671. if (emitIdentifier) {
  3672. destructureElements.push(emitIdentifier === `emit` ? `emit` : `emit: ${emitIdentifier}`);
  3673. }
  3674. if (destructureElements.length) {
  3675. args += `, { ${destructureElements.join(', ')} }`;
  3676. if (emitsTypeDecl) {
  3677. args += `: { emit: (${scriptSetup.content.slice(emitsTypeDecl.start, emitsTypeDecl.end)}), expose: any, slots: any, attrs: any }`;
  3678. }
  3679. }
  3680. // 10. generate return statement
  3681. let returned;
  3682. if (options.inlineTemplate) {
  3683. if (sfc.template && !sfc.template.src) {
  3684. if (options.templateOptions && options.templateOptions.ssr) {
  3685. hasInlinedSsrRenderFn = true;
  3686. }
  3687. // inline render function mode - we are going to compile the template and
  3688. // inline it right here
  3689. 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 &&
  3690. options.templateOptions.compilerOptions)), { inline: true, isTS,
  3691. bindingMetadata }) }));
  3692. if (tips.length) {
  3693. tips.forEach(warnOnce);
  3694. }
  3695. const err = errors[0];
  3696. if (typeof err === 'string') {
  3697. throw new Error(err);
  3698. }
  3699. else if (err) {
  3700. if (err.loc) {
  3701. err.message +=
  3702. `\n\n` +
  3703. sfc.filename +
  3704. '\n' +
  3705. shared.generateCodeFrame(source, err.loc.start.offset, err.loc.end.offset) +
  3706. `\n`;
  3707. }
  3708. throw err;
  3709. }
  3710. if (preamble) {
  3711. s.prepend(preamble);
  3712. }
  3713. // avoid duplicated unref import
  3714. // as this may get injected by the render function preamble OR the
  3715. // css vars codegen
  3716. if (ast && ast.helpers.includes(CompilerDOM.UNREF)) {
  3717. helperImports.delete('unref');
  3718. }
  3719. returned = code;
  3720. }
  3721. else {
  3722. returned = `() => {}`;
  3723. }
  3724. }
  3725. else {
  3726. // return bindings from script and script setup
  3727. const allBindings = Object.assign(Object.assign({}, scriptBindings), setupBindings);
  3728. for (const key in userImports) {
  3729. if (!userImports[key].isType && userImports[key].isUsedInTemplate) {
  3730. allBindings[key] = true;
  3731. }
  3732. }
  3733. returned = `{ ${Object.keys(allBindings).join(', ')} }`;
  3734. }
  3735. if (!options.inlineTemplate && !false) {
  3736. // in non-inline mode, the `__isScriptSetup: true` flag is used by
  3737. // componentPublicInstance proxy to allow properties that start with $ or _
  3738. s.appendRight(endOffset, `\nconst __returned__ = ${returned}\n` +
  3739. `Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true })\n` +
  3740. `return __returned__` +
  3741. `\n}\n\n`);
  3742. }
  3743. else {
  3744. s.appendRight(endOffset, `\nreturn ${returned}\n}\n\n`);
  3745. }
  3746. // 11. finalize default export
  3747. let runtimeOptions = ``;
  3748. if (hasInlinedSsrRenderFn) {
  3749. runtimeOptions += `\n __ssrInlineRender: true,`;
  3750. }
  3751. if (propsRuntimeDecl) {
  3752. let declCode = scriptSetup.content
  3753. .slice(propsRuntimeDecl.start, propsRuntimeDecl.end)
  3754. .trim();
  3755. if (propsDestructureDecl) {
  3756. const defaults = [];
  3757. for (const key in propsDestructuredBindings) {
  3758. const d = genDestructuredDefaultValue(key);
  3759. if (d)
  3760. defaults.push(`${key}: ${d}`);
  3761. }
  3762. if (defaults.length) {
  3763. declCode = `${helper(`mergeDefaults`)}(${declCode}, {\n ${defaults.join(',\n ')}\n})`;
  3764. }
  3765. }
  3766. runtimeOptions += `\n props: ${declCode},`;
  3767. }
  3768. else if (propsTypeDecl) {
  3769. runtimeOptions += genRuntimeProps(typeDeclaredProps);
  3770. }
  3771. if (emitsRuntimeDecl) {
  3772. runtimeOptions += `\n emits: ${scriptSetup.content
  3773. .slice(emitsRuntimeDecl.start, emitsRuntimeDecl.end)
  3774. .trim()},`;
  3775. }
  3776. else if (emitsTypeDecl) {
  3777. runtimeOptions += genRuntimeEmits(typeDeclaredEmits);
  3778. }
  3779. // <script setup> components are closed by default. If the user did not
  3780. // explicitly call `defineExpose`, call expose() with no args.
  3781. const exposeCall = hasDefineExposeCall || options.inlineTemplate ? `` : ` expose();\n`;
  3782. // wrap setup code with function.
  3783. if (isTS) {
  3784. // for TS, make sure the exported type is still valid type with
  3785. // correct props information
  3786. // we have to use object spread for types to be merged properly
  3787. // user's TS setting should compile it down to proper targets
  3788. // export default defineComponent({ ...__default__, ... })
  3789. const def = defaultExport ? `\n ...${DEFAULT_VAR},` : ``;
  3790. s.prependLeft(startOffset, `\nexport default /*#__PURE__*/${helper(`defineComponent`)}({${def}${runtimeOptions}\n ${hasAwait ? `async ` : ``}setup(${args}) {\n${exposeCall}`);
  3791. s.appendRight(endOffset, `})`);
  3792. }
  3793. else {
  3794. if (defaultExport) {
  3795. // without TS, can't rely on rest spread, so we use Object.assign
  3796. // export default Object.assign(__default__, { ... })
  3797. s.prependLeft(startOffset, `\nexport default /*#__PURE__*/Object.assign(${DEFAULT_VAR}, {${runtimeOptions}\n ` +
  3798. `${hasAwait ? `async ` : ``}setup(${args}) {\n${exposeCall}`);
  3799. s.appendRight(endOffset, `})`);
  3800. }
  3801. else {
  3802. s.prependLeft(startOffset, `\nexport default {${runtimeOptions}\n ` +
  3803. `${hasAwait ? `async ` : ``}setup(${args}) {\n${exposeCall}`);
  3804. s.appendRight(endOffset, `}`);
  3805. }
  3806. }
  3807. // 12. finalize Vue helper imports
  3808. if (helperImports.size > 0) {
  3809. s.prepend(`import { ${[...helperImports]
  3810. .map(h => `${h} as _${h}`)
  3811. .join(', ')} } from 'vue'\n`);
  3812. }
  3813. s.trim();
  3814. return Object.assign(Object.assign({}, scriptSetup), { bindings: bindingMetadata, imports: userImports, content: s.toString(), map: genSourceMap
  3815. ? s.generateMap({
  3816. source: filename,
  3817. hires: true,
  3818. includeContent: true
  3819. })
  3820. : undefined, scriptAst: scriptAst === null || scriptAst === void 0 ? void 0 : scriptAst.body, scriptSetupAst: scriptSetupAst === null || scriptSetupAst === void 0 ? void 0 : scriptSetupAst.body });
  3821. }
  3822. function registerBinding(bindings, node, type) {
  3823. bindings[node.name] = type;
  3824. }
  3825. function walkDeclaration(node, bindings, userImportAlias) {
  3826. if (node.type === 'VariableDeclaration') {
  3827. const isConst = node.kind === 'const';
  3828. // export const foo = ...
  3829. for (const { id, init } of node.declarations) {
  3830. const isDefineCall = !!(isConst &&
  3831. isCallOf(init, c => c === DEFINE_PROPS || c === DEFINE_EMITS || c === WITH_DEFAULTS));
  3832. if (id.type === 'Identifier') {
  3833. let bindingType;
  3834. const userReactiveBinding = userImportAlias['reactive'] || 'reactive';
  3835. if (isCallOf(init, userReactiveBinding)) {
  3836. // treat reactive() calls as let since it's meant to be mutable
  3837. bindingType = "setup-let" /* SETUP_LET */;
  3838. }
  3839. else if (
  3840. // if a declaration is a const literal, we can mark it so that
  3841. // the generated render fn code doesn't need to unref() it
  3842. isDefineCall ||
  3843. (isConst && canNeverBeRef(init, userReactiveBinding))) {
  3844. bindingType = "setup-const" /* SETUP_CONST */;
  3845. }
  3846. else if (isConst) {
  3847. if (isCallOf(init, userImportAlias['ref'] || 'ref')) {
  3848. bindingType = "setup-ref" /* SETUP_REF */;
  3849. }
  3850. else {
  3851. bindingType = "setup-maybe-ref" /* SETUP_MAYBE_REF */;
  3852. }
  3853. }
  3854. else {
  3855. bindingType = "setup-let" /* SETUP_LET */;
  3856. }
  3857. registerBinding(bindings, id, bindingType);
  3858. }
  3859. else {
  3860. if (isCallOf(init, DEFINE_PROPS)) {
  3861. // skip walking props destructure
  3862. return;
  3863. }
  3864. if (id.type === 'ObjectPattern') {
  3865. walkObjectPattern(id, bindings, isConst, isDefineCall);
  3866. }
  3867. else if (id.type === 'ArrayPattern') {
  3868. walkArrayPattern(id, bindings, isConst, isDefineCall);
  3869. }
  3870. }
  3871. }
  3872. }
  3873. else if (node.type === 'TSEnumDeclaration' ||
  3874. node.type === 'FunctionDeclaration' ||
  3875. node.type === 'ClassDeclaration') {
  3876. // export function foo() {} / export class Foo {}
  3877. // export declarations must be named.
  3878. bindings[node.id.name] = "setup-const" /* SETUP_CONST */;
  3879. }
  3880. }
  3881. function walkObjectPattern(node, bindings, isConst, isDefineCall = false) {
  3882. for (const p of node.properties) {
  3883. if (p.type === 'ObjectProperty') {
  3884. if (p.key.type === 'Identifier' && p.key === p.value) {
  3885. // shorthand: const { x } = ...
  3886. const type = isDefineCall
  3887. ? "setup-const" /* SETUP_CONST */
  3888. : isConst
  3889. ? "setup-maybe-ref" /* SETUP_MAYBE_REF */
  3890. : "setup-let" /* SETUP_LET */;
  3891. registerBinding(bindings, p.key, type);
  3892. }
  3893. else {
  3894. walkPattern(p.value, bindings, isConst, isDefineCall);
  3895. }
  3896. }
  3897. else {
  3898. // ...rest
  3899. // argument can only be identifier when destructuring
  3900. const type = isConst ? "setup-const" /* SETUP_CONST */ : "setup-let" /* SETUP_LET */;
  3901. registerBinding(bindings, p.argument, type);
  3902. }
  3903. }
  3904. }
  3905. function walkArrayPattern(node, bindings, isConst, isDefineCall = false) {
  3906. for (const e of node.elements) {
  3907. e && walkPattern(e, bindings, isConst, isDefineCall);
  3908. }
  3909. }
  3910. function walkPattern(node, bindings, isConst, isDefineCall = false) {
  3911. if (node.type === 'Identifier') {
  3912. const type = isDefineCall
  3913. ? "setup-const" /* SETUP_CONST */
  3914. : isConst
  3915. ? "setup-maybe-ref" /* SETUP_MAYBE_REF */
  3916. : "setup-let" /* SETUP_LET */;
  3917. registerBinding(bindings, node, type);
  3918. }
  3919. else if (node.type === 'RestElement') {
  3920. // argument can only be identifier when destructuring
  3921. const type = isConst ? "setup-const" /* SETUP_CONST */ : "setup-let" /* SETUP_LET */;
  3922. registerBinding(bindings, node.argument, type);
  3923. }
  3924. else if (node.type === 'ObjectPattern') {
  3925. walkObjectPattern(node, bindings, isConst);
  3926. }
  3927. else if (node.type === 'ArrayPattern') {
  3928. walkArrayPattern(node, bindings, isConst);
  3929. }
  3930. else if (node.type === 'AssignmentPattern') {
  3931. if (node.left.type === 'Identifier') {
  3932. const type = isDefineCall
  3933. ? "setup-const" /* SETUP_CONST */
  3934. : isConst
  3935. ? "setup-maybe-ref" /* SETUP_MAYBE_REF */
  3936. : "setup-let" /* SETUP_LET */;
  3937. registerBinding(bindings, node.left, type);
  3938. }
  3939. else {
  3940. walkPattern(node.left, bindings, isConst);
  3941. }
  3942. }
  3943. }
  3944. function recordType(node, declaredTypes) {
  3945. if (node.type === 'TSInterfaceDeclaration') {
  3946. declaredTypes[node.id.name] = [`Object`];
  3947. }
  3948. else if (node.type === 'TSTypeAliasDeclaration') {
  3949. declaredTypes[node.id.name] = inferRuntimeType(node.typeAnnotation, declaredTypes);
  3950. }
  3951. else if (node.type === 'ExportNamedDeclaration' && node.declaration) {
  3952. recordType(node.declaration, declaredTypes);
  3953. }
  3954. }
  3955. function extractRuntimeProps(node, props, declaredTypes, isProd) {
  3956. const members = node.type === 'TSTypeLiteral' ? node.members : node.body;
  3957. for (const m of members) {
  3958. if ((m.type === 'TSPropertySignature' || m.type === 'TSMethodSignature') &&
  3959. m.key.type === 'Identifier') {
  3960. let type;
  3961. if (m.type === 'TSMethodSignature') {
  3962. type = ['Function'];
  3963. }
  3964. else if (m.typeAnnotation) {
  3965. type = inferRuntimeType(m.typeAnnotation.typeAnnotation, declaredTypes);
  3966. }
  3967. props[m.key.name] = {
  3968. key: m.key.name,
  3969. required: !m.optional,
  3970. type: type || [`null`]
  3971. };
  3972. }
  3973. }
  3974. }
  3975. function inferRuntimeType(node, declaredTypes) {
  3976. switch (node.type) {
  3977. case 'TSStringKeyword':
  3978. return ['String'];
  3979. case 'TSNumberKeyword':
  3980. return ['Number'];
  3981. case 'TSBooleanKeyword':
  3982. return ['Boolean'];
  3983. case 'TSObjectKeyword':
  3984. return ['Object'];
  3985. case 'TSTypeLiteral':
  3986. // TODO (nice to have) generate runtime property validation
  3987. return ['Object'];
  3988. case 'TSFunctionType':
  3989. return ['Function'];
  3990. case 'TSArrayType':
  3991. case 'TSTupleType':
  3992. // TODO (nice to have) generate runtime element type/length checks
  3993. return ['Array'];
  3994. case 'TSLiteralType':
  3995. switch (node.literal.type) {
  3996. case 'StringLiteral':
  3997. return ['String'];
  3998. case 'BooleanLiteral':
  3999. return ['Boolean'];
  4000. case 'NumericLiteral':
  4001. case 'BigIntLiteral':
  4002. return ['Number'];
  4003. default:
  4004. return [`null`];
  4005. }
  4006. case 'TSTypeReference':
  4007. if (node.typeName.type === 'Identifier') {
  4008. if (declaredTypes[node.typeName.name]) {
  4009. return declaredTypes[node.typeName.name];
  4010. }
  4011. switch (node.typeName.name) {
  4012. case 'Array':
  4013. case 'Function':
  4014. case 'Object':
  4015. case 'Set':
  4016. case 'Map':
  4017. case 'WeakSet':
  4018. case 'WeakMap':
  4019. case 'Date':
  4020. return [node.typeName.name];
  4021. case 'Record':
  4022. case 'Partial':
  4023. case 'Readonly':
  4024. case 'Pick':
  4025. case 'Omit':
  4026. case 'Exclude':
  4027. case 'Extract':
  4028. case 'Required':
  4029. case 'InstanceType':
  4030. return ['Object'];
  4031. }
  4032. }
  4033. return [`null`];
  4034. case 'TSParenthesizedType':
  4035. return inferRuntimeType(node.typeAnnotation, declaredTypes);
  4036. case 'TSUnionType':
  4037. return [
  4038. ...new Set([].concat(...node.types.map(t => inferRuntimeType(t, declaredTypes))))
  4039. ];
  4040. case 'TSIntersectionType':
  4041. return ['Object'];
  4042. case 'TSSymbolKeyword':
  4043. return ['Symbol'];
  4044. default:
  4045. return [`null`]; // no runtime check
  4046. }
  4047. }
  4048. function toRuntimeTypeString(types) {
  4049. return types.length > 1 ? `[${types.join(', ')}]` : types[0];
  4050. }
  4051. function extractRuntimeEmits(node, emits) {
  4052. if (node.type === 'TSTypeLiteral' || node.type === 'TSInterfaceBody') {
  4053. const members = node.type === 'TSTypeLiteral' ? node.members : node.body;
  4054. for (let t of members) {
  4055. if (t.type === 'TSCallSignatureDeclaration') {
  4056. extractEventNames(t.parameters[0], emits);
  4057. }
  4058. }
  4059. return;
  4060. }
  4061. else {
  4062. extractEventNames(node.parameters[0], emits);
  4063. }
  4064. }
  4065. function extractEventNames(eventName, emits) {
  4066. if (eventName.type === 'Identifier' &&
  4067. eventName.typeAnnotation &&
  4068. eventName.typeAnnotation.type === 'TSTypeAnnotation') {
  4069. const typeNode = eventName.typeAnnotation.typeAnnotation;
  4070. if (typeNode.type === 'TSLiteralType') {
  4071. if (typeNode.literal.type !== 'UnaryExpression') {
  4072. emits.add(String(typeNode.literal.value));
  4073. }
  4074. }
  4075. else if (typeNode.type === 'TSUnionType') {
  4076. for (const t of typeNode.types) {
  4077. if (t.type === 'TSLiteralType' &&
  4078. t.literal.type !== 'UnaryExpression') {
  4079. emits.add(String(t.literal.value));
  4080. }
  4081. }
  4082. }
  4083. }
  4084. }
  4085. function genRuntimeEmits(emits) {
  4086. return emits.size
  4087. ? `\n emits: [${Array.from(emits)
  4088. .map(p => JSON.stringify(p))
  4089. .join(', ')}],`
  4090. : ``;
  4091. }
  4092. function isCallOf(node, test) {
  4093. return !!(node &&
  4094. node.type === 'CallExpression' &&
  4095. node.callee.type === 'Identifier' &&
  4096. (typeof test === 'string'
  4097. ? node.callee.name === test
  4098. : test(node.callee.name)));
  4099. }
  4100. function canNeverBeRef(node, userReactiveImport) {
  4101. if (isCallOf(node, userReactiveImport)) {
  4102. return true;
  4103. }
  4104. switch (node.type) {
  4105. case 'UnaryExpression':
  4106. case 'BinaryExpression':
  4107. case 'ArrayExpression':
  4108. case 'ObjectExpression':
  4109. case 'FunctionExpression':
  4110. case 'ArrowFunctionExpression':
  4111. case 'UpdateExpression':
  4112. case 'ClassExpression':
  4113. case 'TaggedTemplateExpression':
  4114. return true;
  4115. case 'SequenceExpression':
  4116. return canNeverBeRef(node.expressions[node.expressions.length - 1], userReactiveImport);
  4117. default:
  4118. if (node.type.endsWith('Literal')) {
  4119. return true;
  4120. }
  4121. return false;
  4122. }
  4123. }
  4124. /**
  4125. * Analyze bindings in normal `<script>`
  4126. * Note that `compileScriptSetup` already analyzes bindings as part of its
  4127. * compilation process so this should only be used on single `<script>` SFCs.
  4128. */
  4129. function analyzeScriptBindings(ast) {
  4130. for (const node of ast) {
  4131. if (node.type === 'ExportDefaultDeclaration' &&
  4132. node.declaration.type === 'ObjectExpression') {
  4133. return analyzeBindingsFromOptions(node.declaration);
  4134. }
  4135. }
  4136. return {};
  4137. }
  4138. function analyzeBindingsFromOptions(node) {
  4139. const bindings = {};
  4140. // #3270, #3275
  4141. // mark non-script-setup so we don't resolve components/directives from these
  4142. Object.defineProperty(bindings, '__isScriptSetup', {
  4143. enumerable: false,
  4144. value: false
  4145. });
  4146. for (const property of node.properties) {
  4147. if (property.type === 'ObjectProperty' &&
  4148. !property.computed &&
  4149. property.key.type === 'Identifier') {
  4150. // props
  4151. if (property.key.name === 'props') {
  4152. // props: ['foo']
  4153. // props: { foo: ... }
  4154. for (const key of getObjectOrArrayExpressionKeys(property.value)) {
  4155. bindings[key] = "props" /* PROPS */;
  4156. }
  4157. }
  4158. // inject
  4159. else if (property.key.name === 'inject') {
  4160. // inject: ['foo']
  4161. // inject: { foo: {} }
  4162. for (const key of getObjectOrArrayExpressionKeys(property.value)) {
  4163. bindings[key] = "options" /* OPTIONS */;
  4164. }
  4165. }
  4166. // computed & methods
  4167. else if (property.value.type === 'ObjectExpression' &&
  4168. (property.key.name === 'computed' || property.key.name === 'methods')) {
  4169. // methods: { foo() {} }
  4170. // computed: { foo() {} }
  4171. for (const key of getObjectExpressionKeys(property.value)) {
  4172. bindings[key] = "options" /* OPTIONS */;
  4173. }
  4174. }
  4175. }
  4176. // setup & data
  4177. else if (property.type === 'ObjectMethod' &&
  4178. property.key.type === 'Identifier' &&
  4179. (property.key.name === 'setup' || property.key.name === 'data')) {
  4180. for (const bodyItem of property.body.body) {
  4181. // setup() {
  4182. // return {
  4183. // foo: null
  4184. // }
  4185. // }
  4186. if (bodyItem.type === 'ReturnStatement' &&
  4187. bodyItem.argument &&
  4188. bodyItem.argument.type === 'ObjectExpression') {
  4189. for (const key of getObjectExpressionKeys(bodyItem.argument)) {
  4190. bindings[key] =
  4191. property.key.name === 'setup'
  4192. ? "setup-maybe-ref" /* SETUP_MAYBE_REF */
  4193. : "data" /* DATA */;
  4194. }
  4195. }
  4196. }
  4197. }
  4198. }
  4199. return bindings;
  4200. }
  4201. function getObjectExpressionKeys(node) {
  4202. const keys = [];
  4203. for (const prop of node.properties) {
  4204. if ((prop.type === 'ObjectProperty' || prop.type === 'ObjectMethod') &&
  4205. !prop.computed) {
  4206. if (prop.key.type === 'Identifier') {
  4207. keys.push(prop.key.name);
  4208. }
  4209. else if (prop.key.type === 'StringLiteral') {
  4210. keys.push(prop.key.value);
  4211. }
  4212. }
  4213. }
  4214. return keys;
  4215. }
  4216. function getArrayExpressionKeys(node) {
  4217. const keys = [];
  4218. for (const element of node.elements) {
  4219. if (element && element.type === 'StringLiteral') {
  4220. keys.push(element.value);
  4221. }
  4222. }
  4223. return keys;
  4224. }
  4225. function getObjectOrArrayExpressionKeys(value) {
  4226. if (value.type === 'ArrayExpression') {
  4227. return getArrayExpressionKeys(value);
  4228. }
  4229. if (value.type === 'ObjectExpression') {
  4230. return getObjectExpressionKeys(value);
  4231. }
  4232. return [];
  4233. }
  4234. const templateUsageCheckCache = createCache();
  4235. function resolveTemplateUsageCheckString(sfc) {
  4236. const { content, ast } = sfc.template;
  4237. const cached = templateUsageCheckCache.get(content);
  4238. if (cached) {
  4239. return cached;
  4240. }
  4241. let code = '';
  4242. CompilerDOM.transform(CompilerDOM.createRoot([ast]), {
  4243. nodeTransforms: [
  4244. node => {
  4245. if (node.type === 1 /* ELEMENT */) {
  4246. if (!CompilerDOM.parserOptions.isNativeTag(node.tag) &&
  4247. !CompilerDOM.parserOptions.isBuiltInComponent(node.tag)) {
  4248. code += `,${shared.camelize(node.tag)},${shared.capitalize(shared.camelize(node.tag))}`;
  4249. }
  4250. for (let i = 0; i < node.props.length; i++) {
  4251. const prop = node.props[i];
  4252. if (prop.type === 7 /* DIRECTIVE */) {
  4253. if (!isBuiltInDir(prop.name)) {
  4254. code += `,v${shared.capitalize(shared.camelize(prop.name))}`;
  4255. }
  4256. if (prop.exp) {
  4257. code += `,${stripStrings(prop.exp.content)}`;
  4258. }
  4259. }
  4260. }
  4261. }
  4262. else if (node.type === 5 /* INTERPOLATION */) {
  4263. code += `,${stripStrings(node.content.content)}`;
  4264. }
  4265. }
  4266. ]
  4267. });
  4268. code += ';';
  4269. templateUsageCheckCache.set(content, code);
  4270. return code;
  4271. }
  4272. function stripStrings(exp) {
  4273. return exp
  4274. .replace(/'[^']*'|"[^"]*"/g, '')
  4275. .replace(/`[^`]+`/g, stripTemplateString);
  4276. }
  4277. function stripTemplateString(str) {
  4278. const interpMatch = str.match(/\${[^}]+}/g);
  4279. if (interpMatch) {
  4280. return interpMatch.map(m => m.slice(2, -1)).join(',');
  4281. }
  4282. return '';
  4283. }
  4284. function isImportUsed(local, sfc) {
  4285. return new RegExp(
  4286. // #4274 escape $ since it's a special char in regex
  4287. // (and is the only regex special char that is valid in identifiers)
  4288. `[^\\w$_]${local.replace(/\$/g, '\\$')}[^\\w$_]`).test(resolveTemplateUsageCheckString(sfc));
  4289. }
  4290. /**
  4291. * Note: this comparison assumes the prev/next script are already identical,
  4292. * and only checks the special case where <script setup lang="ts"> unused import
  4293. * pruning result changes due to template changes.
  4294. */
  4295. function hmrShouldReload(prevImports, next) {
  4296. if (!next.scriptSetup ||
  4297. (next.scriptSetup.lang !== 'ts' && next.scriptSetup.lang !== 'tsx')) {
  4298. return false;
  4299. }
  4300. // for each previous import, check if its used status remain the same based on
  4301. // the next descriptor's template
  4302. for (const key in prevImports) {
  4303. // if an import was previous unused, but now is used, we need to force
  4304. // reload so that the script now includes that import.
  4305. if (!prevImports[key].isUsedInTemplate && isImportUsed(key, next)) {
  4306. return true;
  4307. }
  4308. }
  4309. return false;
  4310. }
  4311. const sourceToSFC = createCache();
  4312. function parse(source, { sourceMap = true, filename = 'anonymous.vue', sourceRoot = '', pad = false, ignoreEmpty = true, compiler = CompilerDOM__namespace } = {}) {
  4313. const sourceKey = source + sourceMap + filename + sourceRoot + pad + compiler.parse;
  4314. const cache = sourceToSFC.get(sourceKey);
  4315. if (cache) {
  4316. return cache;
  4317. }
  4318. const descriptor = {
  4319. filename,
  4320. source,
  4321. template: null,
  4322. script: null,
  4323. scriptSetup: null,
  4324. styles: [],
  4325. customBlocks: [],
  4326. cssVars: [],
  4327. slotted: false,
  4328. shouldForceReload: prevImports => hmrShouldReload(prevImports, descriptor)
  4329. };
  4330. const errors = [];
  4331. const ast = compiler.parse(source, {
  4332. // there are no components at SFC parsing level
  4333. isNativeTag: () => true,
  4334. // preserve all whitespaces
  4335. isPreTag: () => true,
  4336. getTextMode: ({ tag, props }, parent) => {
  4337. // all top level elements except <template> are parsed as raw text
  4338. // containers
  4339. if ((!parent && tag !== 'template') ||
  4340. // <template lang="xxx"> should also be treated as raw text
  4341. (tag === 'template' &&
  4342. props.some(p => p.type === 6 /* ATTRIBUTE */ &&
  4343. p.name === 'lang' &&
  4344. p.value &&
  4345. p.value.content &&
  4346. p.value.content !== 'html'))) {
  4347. return 2 /* RAWTEXT */;
  4348. }
  4349. else {
  4350. return 0 /* DATA */;
  4351. }
  4352. },
  4353. onError: e => {
  4354. errors.push(e);
  4355. }
  4356. });
  4357. ast.children.forEach(node => {
  4358. if (node.type !== 1 /* ELEMENT */) {
  4359. return;
  4360. }
  4361. // we only want to keep the nodes that are not empty (when the tag is not a template)
  4362. if (ignoreEmpty &&
  4363. node.tag !== 'template' &&
  4364. isEmpty(node) &&
  4365. !hasSrc(node)) {
  4366. return;
  4367. }
  4368. switch (node.tag) {
  4369. case 'template':
  4370. if (!descriptor.template) {
  4371. const templateBlock = (descriptor.template = createBlock(node, source, false));
  4372. templateBlock.ast = node;
  4373. // warn against 2.x <template functional>
  4374. if (templateBlock.attrs.functional) {
  4375. const err = new SyntaxError(`<template functional> is no longer supported in Vue 3, since ` +
  4376. `functional components no longer have significant performance ` +
  4377. `difference from stateful ones. Just use a normal <template> ` +
  4378. `instead.`);
  4379. err.loc = node.props.find(p => p.name === 'functional').loc;
  4380. errors.push(err);
  4381. }
  4382. }
  4383. else {
  4384. errors.push(createDuplicateBlockError(node));
  4385. }
  4386. break;
  4387. case 'script':
  4388. const scriptBlock = createBlock(node, source, pad);
  4389. const isSetup = !!scriptBlock.attrs.setup;
  4390. if (isSetup && !descriptor.scriptSetup) {
  4391. descriptor.scriptSetup = scriptBlock;
  4392. break;
  4393. }
  4394. if (!isSetup && !descriptor.script) {
  4395. descriptor.script = scriptBlock;
  4396. break;
  4397. }
  4398. errors.push(createDuplicateBlockError(node, isSetup));
  4399. break;
  4400. case 'style':
  4401. const styleBlock = createBlock(node, source, pad);
  4402. if (styleBlock.attrs.vars) {
  4403. errors.push(new SyntaxError(`<style vars> has been replaced by a new proposal: ` +
  4404. `https://github.com/vuejs/rfcs/pull/231`));
  4405. }
  4406. descriptor.styles.push(styleBlock);
  4407. break;
  4408. default:
  4409. descriptor.customBlocks.push(createBlock(node, source, pad));
  4410. break;
  4411. }
  4412. });
  4413. if (descriptor.scriptSetup) {
  4414. if (descriptor.scriptSetup.src) {
  4415. errors.push(new SyntaxError(`<script setup> cannot use the "src" attribute because ` +
  4416. `its syntax will be ambiguous outside of the component.`));
  4417. descriptor.scriptSetup = null;
  4418. }
  4419. if (descriptor.script && descriptor.script.src) {
  4420. errors.push(new SyntaxError(`<script> cannot use the "src" attribute when <script setup> is ` +
  4421. `also present because they must be processed together.`));
  4422. descriptor.script = null;
  4423. }
  4424. }
  4425. if (sourceMap) {
  4426. const genMap = (block) => {
  4427. if (block && !block.src) {
  4428. block.map = generateSourceMap(filename, source, block.content, sourceRoot, !pad || block.type === 'template' ? block.loc.start.line - 1 : 0);
  4429. }
  4430. };
  4431. genMap(descriptor.template);
  4432. genMap(descriptor.script);
  4433. descriptor.styles.forEach(genMap);
  4434. descriptor.customBlocks.forEach(genMap);
  4435. }
  4436. // parse CSS vars
  4437. descriptor.cssVars = parseCssVars(descriptor);
  4438. // check if the SFC uses :slotted
  4439. const slottedRE = /(?:::v-|:)slotted\(/;
  4440. descriptor.slotted = descriptor.styles.some(s => s.scoped && slottedRE.test(s.content));
  4441. const result = {
  4442. descriptor,
  4443. errors
  4444. };
  4445. sourceToSFC.set(sourceKey, result);
  4446. return result;
  4447. }
  4448. function createDuplicateBlockError(node, isScriptSetup = false) {
  4449. const err = new SyntaxError(`Single file component can contain only one <${node.tag}${isScriptSetup ? ` setup` : ``}> element`);
  4450. err.loc = node.loc;
  4451. return err;
  4452. }
  4453. function createBlock(node, source, pad) {
  4454. const type = node.tag;
  4455. let { start, end } = node.loc;
  4456. let content = '';
  4457. if (node.children.length) {
  4458. start = node.children[0].loc.start;
  4459. end = node.children[node.children.length - 1].loc.end;
  4460. content = source.slice(start.offset, end.offset);
  4461. }
  4462. else {
  4463. const offset = node.loc.source.indexOf(`</`);
  4464. if (offset > -1) {
  4465. start = {
  4466. line: start.line,
  4467. column: start.column + offset,
  4468. offset: start.offset + offset
  4469. };
  4470. }
  4471. end = Object.assign({}, start);
  4472. }
  4473. const loc = {
  4474. source: content,
  4475. start,
  4476. end
  4477. };
  4478. const attrs = {};
  4479. const block = {
  4480. type,
  4481. content,
  4482. loc,
  4483. attrs
  4484. };
  4485. if (pad) {
  4486. block.content = padContent(source, block, pad) + block.content;
  4487. }
  4488. node.props.forEach(p => {
  4489. if (p.type === 6 /* ATTRIBUTE */) {
  4490. attrs[p.name] = p.value ? p.value.content || true : true;
  4491. if (p.name === 'lang') {
  4492. block.lang = p.value && p.value.content;
  4493. }
  4494. else if (p.name === 'src') {
  4495. block.src = p.value && p.value.content;
  4496. }
  4497. else if (type === 'style') {
  4498. if (p.name === 'scoped') {
  4499. block.scoped = true;
  4500. }
  4501. else if (p.name === 'module') {
  4502. block.module = attrs[p.name];
  4503. }
  4504. }
  4505. else if (type === 'script' && p.name === 'setup') {
  4506. block.setup = attrs.setup;
  4507. }
  4508. }
  4509. });
  4510. return block;
  4511. }
  4512. const splitRE = /\r?\n/g;
  4513. const emptyRE = /^(?:\/\/)?\s*$/;
  4514. const replaceRE = /./g;
  4515. function generateSourceMap(filename, source, generated, sourceRoot, lineOffset) {
  4516. const map = new sourceMap.SourceMapGenerator({
  4517. file: filename.replace(/\\/g, '/'),
  4518. sourceRoot: sourceRoot.replace(/\\/g, '/')
  4519. });
  4520. map.setSourceContent(filename, source);
  4521. generated.split(splitRE).forEach((line, index) => {
  4522. if (!emptyRE.test(line)) {
  4523. const originalLine = index + 1 + lineOffset;
  4524. const generatedLine = index + 1;
  4525. for (let i = 0; i < line.length; i++) {
  4526. if (!/\s/.test(line[i])) {
  4527. map.addMapping({
  4528. source: filename,
  4529. original: {
  4530. line: originalLine,
  4531. column: i
  4532. },
  4533. generated: {
  4534. line: generatedLine,
  4535. column: i
  4536. }
  4537. });
  4538. }
  4539. }
  4540. }
  4541. });
  4542. return JSON.parse(map.toString());
  4543. }
  4544. function padContent(content, block, pad) {
  4545. content = content.slice(0, block.loc.start.offset);
  4546. if (pad === 'space') {
  4547. return content.replace(replaceRE, ' ');
  4548. }
  4549. else {
  4550. const offset = content.split(splitRE).length;
  4551. const padChar = block.type === 'script' && !block.lang ? '//\n' : '\n';
  4552. return Array(offset).join(padChar);
  4553. }
  4554. }
  4555. function hasSrc(node) {
  4556. return node.props.some(p => {
  4557. if (p.type !== 6 /* ATTRIBUTE */) {
  4558. return false;
  4559. }
  4560. return p.name === 'src';
  4561. });
  4562. }
  4563. /**
  4564. * Returns true if the node has no children
  4565. * once the empty text nodes (trimmed content) have been filtered out.
  4566. */
  4567. function isEmpty(node) {
  4568. for (let i = 0; i < node.children.length; i++) {
  4569. const child = node.children[i];
  4570. if (child.type !== 2 /* TEXT */ || child.content.trim() !== '') {
  4571. return false;
  4572. }
  4573. }
  4574. return true;
  4575. }
  4576. const trimPlugin = () => {
  4577. return {
  4578. postcssPlugin: 'vue-sfc-trim',
  4579. Once(root) {
  4580. root.walk(({ type, raws }) => {
  4581. if (type === 'rule' || type === 'atrule') {
  4582. if (raws.before)
  4583. raws.before = '\n';
  4584. if ('after' in raws && raws.after)
  4585. raws.after = '\n';
  4586. }
  4587. });
  4588. }
  4589. };
  4590. };
  4591. trimPlugin.postcss = true;
  4592. var unesc_1 = createCommonjsModule(function (module, exports) {
  4593. exports.__esModule = true;
  4594. exports["default"] = unesc;
  4595. // Many thanks for this post which made this migration much easier.
  4596. // https://mathiasbynens.be/notes/css-escapes
  4597. /**
  4598. *
  4599. * @param {string} str
  4600. * @returns {[string, number]|undefined}
  4601. */
  4602. function gobbleHex(str) {
  4603. var lower = str.toLowerCase();
  4604. var hex = '';
  4605. var spaceTerminated = false;
  4606. for (var i = 0; i < 6 && lower[i] !== undefined; i++) {
  4607. var code = lower.charCodeAt(i); // check to see if we are dealing with a valid hex char [a-f|0-9]
  4608. var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57; // https://drafts.csswg.org/css-syntax/#consume-escaped-code-point
  4609. spaceTerminated = code === 32;
  4610. if (!valid) {
  4611. break;
  4612. }
  4613. hex += lower[i];
  4614. }
  4615. if (hex.length === 0) {
  4616. return undefined;
  4617. }
  4618. var codePoint = parseInt(hex, 16);
  4619. var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF; // Add special case for
  4620. // "If this number is zero, or is for a surrogate, or is greater than the maximum allowed code point"
  4621. // https://drafts.csswg.org/css-syntax/#maximum-allowed-code-point
  4622. if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10FFFF) {
  4623. return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)];
  4624. }
  4625. return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)];
  4626. }
  4627. var CONTAINS_ESCAPE = /\\/;
  4628. function unesc(str) {
  4629. var needToProcess = CONTAINS_ESCAPE.test(str);
  4630. if (!needToProcess) {
  4631. return str;
  4632. }
  4633. var ret = "";
  4634. for (var i = 0; i < str.length; i++) {
  4635. if (str[i] === "\\") {
  4636. var gobbled = gobbleHex(str.slice(i + 1, i + 7));
  4637. if (gobbled !== undefined) {
  4638. ret += gobbled[0];
  4639. i += gobbled[1];
  4640. continue;
  4641. } // Retain a pair of \\ if double escaped `\\\\`
  4642. // https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e
  4643. if (str[i + 1] === "\\") {
  4644. ret += "\\";
  4645. i++;
  4646. continue;
  4647. } // if \\ is at the end of the string retain it
  4648. // https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb
  4649. if (str.length === i + 1) {
  4650. ret += str[i];
  4651. }
  4652. continue;
  4653. }
  4654. ret += str[i];
  4655. }
  4656. return ret;
  4657. }
  4658. module.exports = exports.default;
  4659. });
  4660. var getProp_1 = createCommonjsModule(function (module, exports) {
  4661. exports.__esModule = true;
  4662. exports["default"] = getProp;
  4663. function getProp(obj) {
  4664. for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  4665. props[_key - 1] = arguments[_key];
  4666. }
  4667. while (props.length > 0) {
  4668. var prop = props.shift();
  4669. if (!obj[prop]) {
  4670. return undefined;
  4671. }
  4672. obj = obj[prop];
  4673. }
  4674. return obj;
  4675. }
  4676. module.exports = exports.default;
  4677. });
  4678. var ensureObject_1 = createCommonjsModule(function (module, exports) {
  4679. exports.__esModule = true;
  4680. exports["default"] = ensureObject;
  4681. function ensureObject(obj) {
  4682. for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  4683. props[_key - 1] = arguments[_key];
  4684. }
  4685. while (props.length > 0) {
  4686. var prop = props.shift();
  4687. if (!obj[prop]) {
  4688. obj[prop] = {};
  4689. }
  4690. obj = obj[prop];
  4691. }
  4692. }
  4693. module.exports = exports.default;
  4694. });
  4695. var stripComments_1 = createCommonjsModule(function (module, exports) {
  4696. exports.__esModule = true;
  4697. exports["default"] = stripComments;
  4698. function stripComments(str) {
  4699. var s = "";
  4700. var commentStart = str.indexOf("/*");
  4701. var lastEnd = 0;
  4702. while (commentStart >= 0) {
  4703. s = s + str.slice(lastEnd, commentStart);
  4704. var commentEnd = str.indexOf("*/", commentStart + 2);
  4705. if (commentEnd < 0) {
  4706. return s;
  4707. }
  4708. lastEnd = commentEnd + 2;
  4709. commentStart = str.indexOf("/*", lastEnd);
  4710. }
  4711. s = s + str.slice(lastEnd);
  4712. return s;
  4713. }
  4714. module.exports = exports.default;
  4715. });
  4716. var util = createCommonjsModule(function (module, exports) {
  4717. exports.__esModule = true;
  4718. exports.stripComments = exports.ensureObject = exports.getProp = exports.unesc = void 0;
  4719. var _unesc = _interopRequireDefault(unesc_1);
  4720. exports.unesc = _unesc["default"];
  4721. var _getProp = _interopRequireDefault(getProp_1);
  4722. exports.getProp = _getProp["default"];
  4723. var _ensureObject = _interopRequireDefault(ensureObject_1);
  4724. exports.ensureObject = _ensureObject["default"];
  4725. var _stripComments = _interopRequireDefault(stripComments_1);
  4726. exports.stripComments = _stripComments["default"];
  4727. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  4728. });
  4729. var node = createCommonjsModule(function (module, exports) {
  4730. exports.__esModule = true;
  4731. exports["default"] = void 0;
  4732. 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); } }
  4733. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4734. var cloneNode = function cloneNode(obj, parent) {
  4735. if (typeof obj !== 'object' || obj === null) {
  4736. return obj;
  4737. }
  4738. var cloned = new obj.constructor();
  4739. for (var i in obj) {
  4740. if (!obj.hasOwnProperty(i)) {
  4741. continue;
  4742. }
  4743. var value = obj[i];
  4744. var type = typeof value;
  4745. if (i === 'parent' && type === 'object') {
  4746. if (parent) {
  4747. cloned[i] = parent;
  4748. }
  4749. } else if (value instanceof Array) {
  4750. cloned[i] = value.map(function (j) {
  4751. return cloneNode(j, cloned);
  4752. });
  4753. } else {
  4754. cloned[i] = cloneNode(value, cloned);
  4755. }
  4756. }
  4757. return cloned;
  4758. };
  4759. var Node = /*#__PURE__*/function () {
  4760. function Node(opts) {
  4761. if (opts === void 0) {
  4762. opts = {};
  4763. }
  4764. Object.assign(this, opts);
  4765. this.spaces = this.spaces || {};
  4766. this.spaces.before = this.spaces.before || '';
  4767. this.spaces.after = this.spaces.after || '';
  4768. }
  4769. var _proto = Node.prototype;
  4770. _proto.remove = function remove() {
  4771. if (this.parent) {
  4772. this.parent.removeChild(this);
  4773. }
  4774. this.parent = undefined;
  4775. return this;
  4776. };
  4777. _proto.replaceWith = function replaceWith() {
  4778. if (this.parent) {
  4779. for (var index in arguments) {
  4780. this.parent.insertBefore(this, arguments[index]);
  4781. }
  4782. this.remove();
  4783. }
  4784. return this;
  4785. };
  4786. _proto.next = function next() {
  4787. return this.parent.at(this.parent.index(this) + 1);
  4788. };
  4789. _proto.prev = function prev() {
  4790. return this.parent.at(this.parent.index(this) - 1);
  4791. };
  4792. _proto.clone = function clone(overrides) {
  4793. if (overrides === void 0) {
  4794. overrides = {};
  4795. }
  4796. var cloned = cloneNode(this);
  4797. for (var name in overrides) {
  4798. cloned[name] = overrides[name];
  4799. }
  4800. return cloned;
  4801. }
  4802. /**
  4803. * Some non-standard syntax doesn't follow normal escaping rules for css.
  4804. * This allows non standard syntax to be appended to an existing property
  4805. * by specifying the escaped value. By specifying the escaped value,
  4806. * illegal characters are allowed to be directly inserted into css output.
  4807. * @param {string} name the property to set
  4808. * @param {any} value the unescaped value of the property
  4809. * @param {string} valueEscaped optional. the escaped value of the property.
  4810. */
  4811. ;
  4812. _proto.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) {
  4813. if (!this.raws) {
  4814. this.raws = {};
  4815. }
  4816. var originalValue = this[name];
  4817. var originalEscaped = this.raws[name];
  4818. this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first.
  4819. if (originalEscaped || valueEscaped !== value) {
  4820. this.raws[name] = (originalEscaped || originalValue) + valueEscaped;
  4821. } else {
  4822. delete this.raws[name]; // delete any escaped value that was created by the setter.
  4823. }
  4824. }
  4825. /**
  4826. * Some non-standard syntax doesn't follow normal escaping rules for css.
  4827. * This allows the escaped value to be specified directly, allowing illegal
  4828. * characters to be directly inserted into css output.
  4829. * @param {string} name the property to set
  4830. * @param {any} value the unescaped value of the property
  4831. * @param {string} valueEscaped the escaped value of the property.
  4832. */
  4833. ;
  4834. _proto.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) {
  4835. if (!this.raws) {
  4836. this.raws = {};
  4837. }
  4838. this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
  4839. this.raws[name] = valueEscaped;
  4840. }
  4841. /**
  4842. * When you want a value to passed through to CSS directly. This method
  4843. * deletes the corresponding raw value causing the stringifier to fallback
  4844. * to the unescaped value.
  4845. * @param {string} name the property to set.
  4846. * @param {any} value The value that is both escaped and unescaped.
  4847. */
  4848. ;
  4849. _proto.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) {
  4850. this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
  4851. if (this.raws) {
  4852. delete this.raws[name];
  4853. }
  4854. }
  4855. /**
  4856. *
  4857. * @param {number} line The number (starting with 1)
  4858. * @param {number} column The column number (starting with 1)
  4859. */
  4860. ;
  4861. _proto.isAtPosition = function isAtPosition(line, column) {
  4862. if (this.source && this.source.start && this.source.end) {
  4863. if (this.source.start.line > line) {
  4864. return false;
  4865. }
  4866. if (this.source.end.line < line) {
  4867. return false;
  4868. }
  4869. if (this.source.start.line === line && this.source.start.column > column) {
  4870. return false;
  4871. }
  4872. if (this.source.end.line === line && this.source.end.column < column) {
  4873. return false;
  4874. }
  4875. return true;
  4876. }
  4877. return undefined;
  4878. };
  4879. _proto.stringifyProperty = function stringifyProperty(name) {
  4880. return this.raws && this.raws[name] || this[name];
  4881. };
  4882. _proto.valueToString = function valueToString() {
  4883. return String(this.stringifyProperty("value"));
  4884. };
  4885. _proto.toString = function toString() {
  4886. return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join('');
  4887. };
  4888. _createClass(Node, [{
  4889. key: "rawSpaceBefore",
  4890. get: function get() {
  4891. var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before;
  4892. if (rawSpace === undefined) {
  4893. rawSpace = this.spaces && this.spaces.before;
  4894. }
  4895. return rawSpace || "";
  4896. },
  4897. set: function set(raw) {
  4898. (0, util.ensureObject)(this, "raws", "spaces");
  4899. this.raws.spaces.before = raw;
  4900. }
  4901. }, {
  4902. key: "rawSpaceAfter",
  4903. get: function get() {
  4904. var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after;
  4905. if (rawSpace === undefined) {
  4906. rawSpace = this.spaces.after;
  4907. }
  4908. return rawSpace || "";
  4909. },
  4910. set: function set(raw) {
  4911. (0, util.ensureObject)(this, "raws", "spaces");
  4912. this.raws.spaces.after = raw;
  4913. }
  4914. }]);
  4915. return Node;
  4916. }();
  4917. exports["default"] = Node;
  4918. module.exports = exports.default;
  4919. });
  4920. var types = createCommonjsModule(function (module, exports) {
  4921. exports.__esModule = true;
  4922. 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;
  4923. var TAG = 'tag';
  4924. exports.TAG = TAG;
  4925. var STRING = 'string';
  4926. exports.STRING = STRING;
  4927. var SELECTOR = 'selector';
  4928. exports.SELECTOR = SELECTOR;
  4929. var ROOT = 'root';
  4930. exports.ROOT = ROOT;
  4931. var PSEUDO = 'pseudo';
  4932. exports.PSEUDO = PSEUDO;
  4933. var NESTING = 'nesting';
  4934. exports.NESTING = NESTING;
  4935. var ID = 'id';
  4936. exports.ID = ID;
  4937. var COMMENT = 'comment';
  4938. exports.COMMENT = COMMENT;
  4939. var COMBINATOR = 'combinator';
  4940. exports.COMBINATOR = COMBINATOR;
  4941. var CLASS = 'class';
  4942. exports.CLASS = CLASS;
  4943. var ATTRIBUTE = 'attribute';
  4944. exports.ATTRIBUTE = ATTRIBUTE;
  4945. var UNIVERSAL = 'universal';
  4946. exports.UNIVERSAL = UNIVERSAL;
  4947. });
  4948. var container = createCommonjsModule(function (module, exports) {
  4949. exports.__esModule = true;
  4950. exports["default"] = void 0;
  4951. var _node = _interopRequireDefault(node);
  4952. var types$1 = _interopRequireWildcard(types);
  4953. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  4954. 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; }
  4955. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  4956. 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); }
  4957. 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); }
  4958. 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; }
  4959. 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); } }
  4960. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4961. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  4962. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4963. var Container = /*#__PURE__*/function (_Node) {
  4964. _inheritsLoose(Container, _Node);
  4965. function Container(opts) {
  4966. var _this;
  4967. _this = _Node.call(this, opts) || this;
  4968. if (!_this.nodes) {
  4969. _this.nodes = [];
  4970. }
  4971. return _this;
  4972. }
  4973. var _proto = Container.prototype;
  4974. _proto.append = function append(selector) {
  4975. selector.parent = this;
  4976. this.nodes.push(selector);
  4977. return this;
  4978. };
  4979. _proto.prepend = function prepend(selector) {
  4980. selector.parent = this;
  4981. this.nodes.unshift(selector);
  4982. return this;
  4983. };
  4984. _proto.at = function at(index) {
  4985. return this.nodes[index];
  4986. };
  4987. _proto.index = function index(child) {
  4988. if (typeof child === 'number') {
  4989. return child;
  4990. }
  4991. return this.nodes.indexOf(child);
  4992. };
  4993. _proto.removeChild = function removeChild(child) {
  4994. child = this.index(child);
  4995. this.at(child).parent = undefined;
  4996. this.nodes.splice(child, 1);
  4997. var index;
  4998. for (var id in this.indexes) {
  4999. index = this.indexes[id];
  5000. if (index >= child) {
  5001. this.indexes[id] = index - 1;
  5002. }
  5003. }
  5004. return this;
  5005. };
  5006. _proto.removeAll = function removeAll() {
  5007. for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done;) {
  5008. var node = _step.value;
  5009. node.parent = undefined;
  5010. }
  5011. this.nodes = [];
  5012. return this;
  5013. };
  5014. _proto.empty = function empty() {
  5015. return this.removeAll();
  5016. };
  5017. _proto.insertAfter = function insertAfter(oldNode, newNode) {
  5018. newNode.parent = this;
  5019. var oldIndex = this.index(oldNode);
  5020. this.nodes.splice(oldIndex + 1, 0, newNode);
  5021. newNode.parent = this;
  5022. var index;
  5023. for (var id in this.indexes) {
  5024. index = this.indexes[id];
  5025. if (oldIndex <= index) {
  5026. this.indexes[id] = index + 1;
  5027. }
  5028. }
  5029. return this;
  5030. };
  5031. _proto.insertBefore = function insertBefore(oldNode, newNode) {
  5032. newNode.parent = this;
  5033. var oldIndex = this.index(oldNode);
  5034. this.nodes.splice(oldIndex, 0, newNode);
  5035. newNode.parent = this;
  5036. var index;
  5037. for (var id in this.indexes) {
  5038. index = this.indexes[id];
  5039. if (index <= oldIndex) {
  5040. this.indexes[id] = index + 1;
  5041. }
  5042. }
  5043. return this;
  5044. };
  5045. _proto._findChildAtPosition = function _findChildAtPosition(line, col) {
  5046. var found = undefined;
  5047. this.each(function (node) {
  5048. if (node.atPosition) {
  5049. var foundChild = node.atPosition(line, col);
  5050. if (foundChild) {
  5051. found = foundChild;
  5052. return false;
  5053. }
  5054. } else if (node.isAtPosition(line, col)) {
  5055. found = node;
  5056. return false;
  5057. }
  5058. });
  5059. return found;
  5060. }
  5061. /**
  5062. * Return the most specific node at the line and column number given.
  5063. * The source location is based on the original parsed location, locations aren't
  5064. * updated as selector nodes are mutated.
  5065. *
  5066. * Note that this location is relative to the location of the first character
  5067. * of the selector, and not the location of the selector in the overall document
  5068. * when used in conjunction with postcss.
  5069. *
  5070. * If not found, returns undefined.
  5071. * @param {number} line The line number of the node to find. (1-based index)
  5072. * @param {number} col The column number of the node to find. (1-based index)
  5073. */
  5074. ;
  5075. _proto.atPosition = function atPosition(line, col) {
  5076. if (this.isAtPosition(line, col)) {
  5077. return this._findChildAtPosition(line, col) || this;
  5078. } else {
  5079. return undefined;
  5080. }
  5081. };
  5082. _proto._inferEndPosition = function _inferEndPosition() {
  5083. if (this.last && this.last.source && this.last.source.end) {
  5084. this.source = this.source || {};
  5085. this.source.end = this.source.end || {};
  5086. Object.assign(this.source.end, this.last.source.end);
  5087. }
  5088. };
  5089. _proto.each = function each(callback) {
  5090. if (!this.lastEach) {
  5091. this.lastEach = 0;
  5092. }
  5093. if (!this.indexes) {
  5094. this.indexes = {};
  5095. }
  5096. this.lastEach++;
  5097. var id = this.lastEach;
  5098. this.indexes[id] = 0;
  5099. if (!this.length) {
  5100. return undefined;
  5101. }
  5102. var index, result;
  5103. while (this.indexes[id] < this.length) {
  5104. index = this.indexes[id];
  5105. result = callback(this.at(index), index);
  5106. if (result === false) {
  5107. break;
  5108. }
  5109. this.indexes[id] += 1;
  5110. }
  5111. delete this.indexes[id];
  5112. if (result === false) {
  5113. return false;
  5114. }
  5115. };
  5116. _proto.walk = function walk(callback) {
  5117. return this.each(function (node, i) {
  5118. var result = callback(node, i);
  5119. if (result !== false && node.length) {
  5120. result = node.walk(callback);
  5121. }
  5122. if (result === false) {
  5123. return false;
  5124. }
  5125. });
  5126. };
  5127. _proto.walkAttributes = function walkAttributes(callback) {
  5128. var _this2 = this;
  5129. return this.walk(function (selector) {
  5130. if (selector.type === types$1.ATTRIBUTE) {
  5131. return callback.call(_this2, selector);
  5132. }
  5133. });
  5134. };
  5135. _proto.walkClasses = function walkClasses(callback) {
  5136. var _this3 = this;
  5137. return this.walk(function (selector) {
  5138. if (selector.type === types$1.CLASS) {
  5139. return callback.call(_this3, selector);
  5140. }
  5141. });
  5142. };
  5143. _proto.walkCombinators = function walkCombinators(callback) {
  5144. var _this4 = this;
  5145. return this.walk(function (selector) {
  5146. if (selector.type === types$1.COMBINATOR) {
  5147. return callback.call(_this4, selector);
  5148. }
  5149. });
  5150. };
  5151. _proto.walkComments = function walkComments(callback) {
  5152. var _this5 = this;
  5153. return this.walk(function (selector) {
  5154. if (selector.type === types$1.COMMENT) {
  5155. return callback.call(_this5, selector);
  5156. }
  5157. });
  5158. };
  5159. _proto.walkIds = function walkIds(callback) {
  5160. var _this6 = this;
  5161. return this.walk(function (selector) {
  5162. if (selector.type === types$1.ID) {
  5163. return callback.call(_this6, selector);
  5164. }
  5165. });
  5166. };
  5167. _proto.walkNesting = function walkNesting(callback) {
  5168. var _this7 = this;
  5169. return this.walk(function (selector) {
  5170. if (selector.type === types$1.NESTING) {
  5171. return callback.call(_this7, selector);
  5172. }
  5173. });
  5174. };
  5175. _proto.walkPseudos = function walkPseudos(callback) {
  5176. var _this8 = this;
  5177. return this.walk(function (selector) {
  5178. if (selector.type === types$1.PSEUDO) {
  5179. return callback.call(_this8, selector);
  5180. }
  5181. });
  5182. };
  5183. _proto.walkTags = function walkTags(callback) {
  5184. var _this9 = this;
  5185. return this.walk(function (selector) {
  5186. if (selector.type === types$1.TAG) {
  5187. return callback.call(_this9, selector);
  5188. }
  5189. });
  5190. };
  5191. _proto.walkUniversals = function walkUniversals(callback) {
  5192. var _this10 = this;
  5193. return this.walk(function (selector) {
  5194. if (selector.type === types$1.UNIVERSAL) {
  5195. return callback.call(_this10, selector);
  5196. }
  5197. });
  5198. };
  5199. _proto.split = function split(callback) {
  5200. var _this11 = this;
  5201. var current = [];
  5202. return this.reduce(function (memo, node, index) {
  5203. var split = callback.call(_this11, node);
  5204. current.push(node);
  5205. if (split) {
  5206. memo.push(current);
  5207. current = [];
  5208. } else if (index === _this11.length - 1) {
  5209. memo.push(current);
  5210. }
  5211. return memo;
  5212. }, []);
  5213. };
  5214. _proto.map = function map(callback) {
  5215. return this.nodes.map(callback);
  5216. };
  5217. _proto.reduce = function reduce(callback, memo) {
  5218. return this.nodes.reduce(callback, memo);
  5219. };
  5220. _proto.every = function every(callback) {
  5221. return this.nodes.every(callback);
  5222. };
  5223. _proto.some = function some(callback) {
  5224. return this.nodes.some(callback);
  5225. };
  5226. _proto.filter = function filter(callback) {
  5227. return this.nodes.filter(callback);
  5228. };
  5229. _proto.sort = function sort(callback) {
  5230. return this.nodes.sort(callback);
  5231. };
  5232. _proto.toString = function toString() {
  5233. return this.map(String).join('');
  5234. };
  5235. _createClass(Container, [{
  5236. key: "first",
  5237. get: function get() {
  5238. return this.at(0);
  5239. }
  5240. }, {
  5241. key: "last",
  5242. get: function get() {
  5243. return this.at(this.length - 1);
  5244. }
  5245. }, {
  5246. key: "length",
  5247. get: function get() {
  5248. return this.nodes.length;
  5249. }
  5250. }]);
  5251. return Container;
  5252. }(_node["default"]);
  5253. exports["default"] = Container;
  5254. module.exports = exports.default;
  5255. });
  5256. var root = createCommonjsModule(function (module, exports) {
  5257. exports.__esModule = true;
  5258. exports["default"] = void 0;
  5259. var _container = _interopRequireDefault(container);
  5260. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5261. 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); } }
  5262. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5263. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5264. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5265. var Root = /*#__PURE__*/function (_Container) {
  5266. _inheritsLoose(Root, _Container);
  5267. function Root(opts) {
  5268. var _this;
  5269. _this = _Container.call(this, opts) || this;
  5270. _this.type = types.ROOT;
  5271. return _this;
  5272. }
  5273. var _proto = Root.prototype;
  5274. _proto.toString = function toString() {
  5275. var str = this.reduce(function (memo, selector) {
  5276. memo.push(String(selector));
  5277. return memo;
  5278. }, []).join(',');
  5279. return this.trailingComma ? str + ',' : str;
  5280. };
  5281. _proto.error = function error(message, options) {
  5282. if (this._error) {
  5283. return this._error(message, options);
  5284. } else {
  5285. return new Error(message);
  5286. }
  5287. };
  5288. _createClass(Root, [{
  5289. key: "errorGenerator",
  5290. set: function set(handler) {
  5291. this._error = handler;
  5292. }
  5293. }]);
  5294. return Root;
  5295. }(_container["default"]);
  5296. exports["default"] = Root;
  5297. module.exports = exports.default;
  5298. });
  5299. var selector = createCommonjsModule(function (module, exports) {
  5300. exports.__esModule = true;
  5301. exports["default"] = void 0;
  5302. var _container = _interopRequireDefault(container);
  5303. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5304. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5305. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5306. var Selector = /*#__PURE__*/function (_Container) {
  5307. _inheritsLoose(Selector, _Container);
  5308. function Selector(opts) {
  5309. var _this;
  5310. _this = _Container.call(this, opts) || this;
  5311. _this.type = types.SELECTOR;
  5312. return _this;
  5313. }
  5314. return Selector;
  5315. }(_container["default"]);
  5316. exports["default"] = Selector;
  5317. module.exports = exports.default;
  5318. });
  5319. /*! https://mths.be/cssesc v3.0.0 by @mathias */
  5320. var object = {};
  5321. var hasOwnProperty = object.hasOwnProperty;
  5322. var merge = function merge(options, defaults) {
  5323. if (!options) {
  5324. return defaults;
  5325. }
  5326. var result = {};
  5327. for (var key in defaults) {
  5328. // `if (defaults.hasOwnProperty(key) { … }` is not needed here, since
  5329. // only recognized option names are used.
  5330. result[key] = hasOwnProperty.call(options, key) ? options[key] : defaults[key];
  5331. }
  5332. return result;
  5333. };
  5334. var regexAnySingleEscape = /[ -,\.\/:-@\[-\^`\{-~]/;
  5335. var regexSingleEscape = /[ -,\.\/:-@\[\]\^`\{-~]/;
  5336. var regexExcessiveSpaces = /(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g;
  5337. // https://mathiasbynens.be/notes/css-escapes#css
  5338. var cssesc = function cssesc(string, options) {
  5339. options = merge(options, cssesc.options);
  5340. if (options.quotes != 'single' && options.quotes != 'double') {
  5341. options.quotes = 'single';
  5342. }
  5343. var quote = options.quotes == 'double' ? '"' : '\'';
  5344. var isIdentifier = options.isIdentifier;
  5345. var firstChar = string.charAt(0);
  5346. var output = '';
  5347. var counter = 0;
  5348. var length = string.length;
  5349. while (counter < length) {
  5350. var character = string.charAt(counter++);
  5351. var codePoint = character.charCodeAt();
  5352. var value = void 0;
  5353. // If it’s not a printable ASCII character…
  5354. if (codePoint < 0x20 || codePoint > 0x7E) {
  5355. if (codePoint >= 0xD800 && codePoint <= 0xDBFF && counter < length) {
  5356. // It’s a high surrogate, and there is a next character.
  5357. var extra = string.charCodeAt(counter++);
  5358. if ((extra & 0xFC00) == 0xDC00) {
  5359. // next character is low surrogate
  5360. codePoint = ((codePoint & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000;
  5361. } else {
  5362. // It’s an unmatched surrogate; only append this code unit, in case
  5363. // the next code unit is the high surrogate of a surrogate pair.
  5364. counter--;
  5365. }
  5366. }
  5367. value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
  5368. } else {
  5369. if (options.escapeEverything) {
  5370. if (regexAnySingleEscape.test(character)) {
  5371. value = '\\' + character;
  5372. } else {
  5373. value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
  5374. }
  5375. } else if (/[\t\n\f\r\x0B]/.test(character)) {
  5376. value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
  5377. } else if (character == '\\' || !isIdentifier && (character == '"' && quote == character || character == '\'' && quote == character) || isIdentifier && regexSingleEscape.test(character)) {
  5378. value = '\\' + character;
  5379. } else {
  5380. value = character;
  5381. }
  5382. }
  5383. output += value;
  5384. }
  5385. if (isIdentifier) {
  5386. if (/^-[-\d]/.test(output)) {
  5387. output = '\\-' + output.slice(1);
  5388. } else if (/\d/.test(firstChar)) {
  5389. output = '\\3' + firstChar + ' ' + output.slice(1);
  5390. }
  5391. }
  5392. // Remove spaces after `\HEX` escapes that are not followed by a hex digit,
  5393. // since they’re redundant. Note that this is only possible if the escape
  5394. // sequence isn’t preceded by an odd number of backslashes.
  5395. output = output.replace(regexExcessiveSpaces, function ($0, $1, $2) {
  5396. if ($1 && $1.length % 2) {
  5397. // It’s not safe to remove the space, so don’t.
  5398. return $0;
  5399. }
  5400. // Strip the space.
  5401. return ($1 || '') + $2;
  5402. });
  5403. if (!isIdentifier && options.wrap) {
  5404. return quote + output + quote;
  5405. }
  5406. return output;
  5407. };
  5408. // Expose default options (so they can be overridden globally).
  5409. cssesc.options = {
  5410. 'escapeEverything': false,
  5411. 'isIdentifier': false,
  5412. 'quotes': 'single',
  5413. 'wrap': false
  5414. };
  5415. cssesc.version = '3.0.0';
  5416. var cssesc_1 = cssesc;
  5417. var className = createCommonjsModule(function (module, exports) {
  5418. exports.__esModule = true;
  5419. exports["default"] = void 0;
  5420. var _cssesc = _interopRequireDefault(cssesc_1);
  5421. var _node = _interopRequireDefault(node);
  5422. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5423. 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); } }
  5424. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5425. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5426. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5427. var ClassName = /*#__PURE__*/function (_Node) {
  5428. _inheritsLoose(ClassName, _Node);
  5429. function ClassName(opts) {
  5430. var _this;
  5431. _this = _Node.call(this, opts) || this;
  5432. _this.type = types.CLASS;
  5433. _this._constructed = true;
  5434. return _this;
  5435. }
  5436. var _proto = ClassName.prototype;
  5437. _proto.valueToString = function valueToString() {
  5438. return '.' + _Node.prototype.valueToString.call(this);
  5439. };
  5440. _createClass(ClassName, [{
  5441. key: "value",
  5442. get: function get() {
  5443. return this._value;
  5444. },
  5445. set: function set(v) {
  5446. if (this._constructed) {
  5447. var escaped = (0, _cssesc["default"])(v, {
  5448. isIdentifier: true
  5449. });
  5450. if (escaped !== v) {
  5451. (0, util.ensureObject)(this, "raws");
  5452. this.raws.value = escaped;
  5453. } else if (this.raws) {
  5454. delete this.raws.value;
  5455. }
  5456. }
  5457. this._value = v;
  5458. }
  5459. }]);
  5460. return ClassName;
  5461. }(_node["default"]);
  5462. exports["default"] = ClassName;
  5463. module.exports = exports.default;
  5464. });
  5465. var comment = createCommonjsModule(function (module, exports) {
  5466. exports.__esModule = true;
  5467. exports["default"] = void 0;
  5468. var _node = _interopRequireDefault(node);
  5469. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5470. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5471. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5472. var Comment = /*#__PURE__*/function (_Node) {
  5473. _inheritsLoose(Comment, _Node);
  5474. function Comment(opts) {
  5475. var _this;
  5476. _this = _Node.call(this, opts) || this;
  5477. _this.type = types.COMMENT;
  5478. return _this;
  5479. }
  5480. return Comment;
  5481. }(_node["default"]);
  5482. exports["default"] = Comment;
  5483. module.exports = exports.default;
  5484. });
  5485. var id = createCommonjsModule(function (module, exports) {
  5486. exports.__esModule = true;
  5487. exports["default"] = void 0;
  5488. var _node = _interopRequireDefault(node);
  5489. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5490. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5491. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5492. var ID = /*#__PURE__*/function (_Node) {
  5493. _inheritsLoose(ID, _Node);
  5494. function ID(opts) {
  5495. var _this;
  5496. _this = _Node.call(this, opts) || this;
  5497. _this.type = types.ID;
  5498. return _this;
  5499. }
  5500. var _proto = ID.prototype;
  5501. _proto.valueToString = function valueToString() {
  5502. return '#' + _Node.prototype.valueToString.call(this);
  5503. };
  5504. return ID;
  5505. }(_node["default"]);
  5506. exports["default"] = ID;
  5507. module.exports = exports.default;
  5508. });
  5509. var namespace = createCommonjsModule(function (module, exports) {
  5510. exports.__esModule = true;
  5511. exports["default"] = void 0;
  5512. var _cssesc = _interopRequireDefault(cssesc_1);
  5513. var _node = _interopRequireDefault(node);
  5514. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5515. 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); } }
  5516. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5517. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5518. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5519. var Namespace = /*#__PURE__*/function (_Node) {
  5520. _inheritsLoose(Namespace, _Node);
  5521. function Namespace() {
  5522. return _Node.apply(this, arguments) || this;
  5523. }
  5524. var _proto = Namespace.prototype;
  5525. _proto.qualifiedName = function qualifiedName(value) {
  5526. if (this.namespace) {
  5527. return this.namespaceString + "|" + value;
  5528. } else {
  5529. return value;
  5530. }
  5531. };
  5532. _proto.valueToString = function valueToString() {
  5533. return this.qualifiedName(_Node.prototype.valueToString.call(this));
  5534. };
  5535. _createClass(Namespace, [{
  5536. key: "namespace",
  5537. get: function get() {
  5538. return this._namespace;
  5539. },
  5540. set: function set(namespace) {
  5541. if (namespace === true || namespace === "*" || namespace === "&") {
  5542. this._namespace = namespace;
  5543. if (this.raws) {
  5544. delete this.raws.namespace;
  5545. }
  5546. return;
  5547. }
  5548. var escaped = (0, _cssesc["default"])(namespace, {
  5549. isIdentifier: true
  5550. });
  5551. this._namespace = namespace;
  5552. if (escaped !== namespace) {
  5553. (0, util.ensureObject)(this, "raws");
  5554. this.raws.namespace = escaped;
  5555. } else if (this.raws) {
  5556. delete this.raws.namespace;
  5557. }
  5558. }
  5559. }, {
  5560. key: "ns",
  5561. get: function get() {
  5562. return this._namespace;
  5563. },
  5564. set: function set(namespace) {
  5565. this.namespace = namespace;
  5566. }
  5567. }, {
  5568. key: "namespaceString",
  5569. get: function get() {
  5570. if (this.namespace) {
  5571. var ns = this.stringifyProperty("namespace");
  5572. if (ns === true) {
  5573. return '';
  5574. } else {
  5575. return ns;
  5576. }
  5577. } else {
  5578. return '';
  5579. }
  5580. }
  5581. }]);
  5582. return Namespace;
  5583. }(_node["default"]);
  5584. exports["default"] = Namespace;
  5585. module.exports = exports.default;
  5586. });
  5587. var tag = createCommonjsModule(function (module, exports) {
  5588. exports.__esModule = true;
  5589. exports["default"] = void 0;
  5590. var _namespace = _interopRequireDefault(namespace);
  5591. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5592. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5593. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5594. var Tag = /*#__PURE__*/function (_Namespace) {
  5595. _inheritsLoose(Tag, _Namespace);
  5596. function Tag(opts) {
  5597. var _this;
  5598. _this = _Namespace.call(this, opts) || this;
  5599. _this.type = types.TAG;
  5600. return _this;
  5601. }
  5602. return Tag;
  5603. }(_namespace["default"]);
  5604. exports["default"] = Tag;
  5605. module.exports = exports.default;
  5606. });
  5607. var string = createCommonjsModule(function (module, exports) {
  5608. exports.__esModule = true;
  5609. exports["default"] = void 0;
  5610. var _node = _interopRequireDefault(node);
  5611. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5612. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5613. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5614. var String = /*#__PURE__*/function (_Node) {
  5615. _inheritsLoose(String, _Node);
  5616. function String(opts) {
  5617. var _this;
  5618. _this = _Node.call(this, opts) || this;
  5619. _this.type = types.STRING;
  5620. return _this;
  5621. }
  5622. return String;
  5623. }(_node["default"]);
  5624. exports["default"] = String;
  5625. module.exports = exports.default;
  5626. });
  5627. var pseudo = createCommonjsModule(function (module, exports) {
  5628. exports.__esModule = true;
  5629. exports["default"] = void 0;
  5630. var _container = _interopRequireDefault(container);
  5631. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5632. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5633. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5634. var Pseudo = /*#__PURE__*/function (_Container) {
  5635. _inheritsLoose(Pseudo, _Container);
  5636. function Pseudo(opts) {
  5637. var _this;
  5638. _this = _Container.call(this, opts) || this;
  5639. _this.type = types.PSEUDO;
  5640. return _this;
  5641. }
  5642. var _proto = Pseudo.prototype;
  5643. _proto.toString = function toString() {
  5644. var params = this.length ? '(' + this.map(String).join(',') + ')' : '';
  5645. return [this.rawSpaceBefore, this.stringifyProperty("value"), params, this.rawSpaceAfter].join('');
  5646. };
  5647. return Pseudo;
  5648. }(_container["default"]);
  5649. exports["default"] = Pseudo;
  5650. module.exports = exports.default;
  5651. });
  5652. /**
  5653. * For Node.js, simply re-export the core `util.deprecate` function.
  5654. */
  5655. var node$1 = util__default.deprecate;
  5656. var attribute = createCommonjsModule(function (module, exports) {
  5657. exports.__esModule = true;
  5658. exports.unescapeValue = unescapeValue;
  5659. exports["default"] = void 0;
  5660. var _cssesc = _interopRequireDefault(cssesc_1);
  5661. var _unesc = _interopRequireDefault(unesc_1);
  5662. var _namespace = _interopRequireDefault(namespace);
  5663. var _CSSESC_QUOTE_OPTIONS;
  5664. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5665. 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); } }
  5666. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5667. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  5668. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5669. var WRAPPED_IN_QUOTES = /^('|")([^]*)\1$/;
  5670. var warnOfDeprecatedValueAssignment = node$1(function () {}, "Assigning an attribute a value containing characters that might need to be escaped is deprecated. " + "Call attribute.setValue() instead.");
  5671. var warnOfDeprecatedQuotedAssignment = node$1(function () {}, "Assigning attr.quoted is deprecated and has no effect. Assign to attr.quoteMark instead.");
  5672. var warnOfDeprecatedConstructor = node$1(function () {}, "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now.");
  5673. function unescapeValue(value) {
  5674. var deprecatedUsage = false;
  5675. var quoteMark = null;
  5676. var unescaped = value;
  5677. var m = unescaped.match(WRAPPED_IN_QUOTES);
  5678. if (m) {
  5679. quoteMark = m[1];
  5680. unescaped = m[2];
  5681. }
  5682. unescaped = (0, _unesc["default"])(unescaped);
  5683. if (unescaped !== value) {
  5684. deprecatedUsage = true;
  5685. }
  5686. return {
  5687. deprecatedUsage: deprecatedUsage,
  5688. unescaped: unescaped,
  5689. quoteMark: quoteMark
  5690. };
  5691. }
  5692. function handleDeprecatedContructorOpts(opts) {
  5693. if (opts.quoteMark !== undefined) {
  5694. return opts;
  5695. }
  5696. if (opts.value === undefined) {
  5697. return opts;
  5698. }
  5699. warnOfDeprecatedConstructor();
  5700. var _unescapeValue = unescapeValue(opts.value),
  5701. quoteMark = _unescapeValue.quoteMark,
  5702. unescaped = _unescapeValue.unescaped;
  5703. if (!opts.raws) {
  5704. opts.raws = {};
  5705. }
  5706. if (opts.raws.value === undefined) {
  5707. opts.raws.value = opts.value;
  5708. }
  5709. opts.value = unescaped;
  5710. opts.quoteMark = quoteMark;
  5711. return opts;
  5712. }
  5713. var Attribute = /*#__PURE__*/function (_Namespace) {
  5714. _inheritsLoose(Attribute, _Namespace);
  5715. function Attribute(opts) {
  5716. var _this;
  5717. if (opts === void 0) {
  5718. opts = {};
  5719. }
  5720. _this = _Namespace.call(this, handleDeprecatedContructorOpts(opts)) || this;
  5721. _this.type = types.ATTRIBUTE;
  5722. _this.raws = _this.raws || {};
  5723. Object.defineProperty(_this.raws, 'unquoted', {
  5724. get: node$1(function () {
  5725. return _this.value;
  5726. }, "attr.raws.unquoted is deprecated. Call attr.value instead."),
  5727. set: node$1(function () {
  5728. return _this.value;
  5729. }, "Setting attr.raws.unquoted is deprecated and has no effect. attr.value is unescaped by default now.")
  5730. });
  5731. _this._constructed = true;
  5732. return _this;
  5733. }
  5734. /**
  5735. * Returns the Attribute's value quoted such that it would be legal to use
  5736. * in the value of a css file. The original value's quotation setting
  5737. * used for stringification is left unchanged. See `setValue(value, options)`
  5738. * if you want to control the quote settings of a new value for the attribute.
  5739. *
  5740. * You can also change the quotation used for the current value by setting quoteMark.
  5741. *
  5742. * Options:
  5743. * * quoteMark {'"' | "'" | null} - Use this value to quote the value. If this
  5744. * option is not set, the original value for quoteMark will be used. If
  5745. * indeterminate, a double quote is used. The legal values are:
  5746. * * `null` - the value will be unquoted and characters will be escaped as necessary.
  5747. * * `'` - the value will be quoted with a single quote and single quotes are escaped.
  5748. * * `"` - the value will be quoted with a double quote and double quotes are escaped.
  5749. * * preferCurrentQuoteMark {boolean} - if true, prefer the source quote mark
  5750. * over the quoteMark option value.
  5751. * * smart {boolean} - if true, will select a quote mark based on the value
  5752. * and the other options specified here. See the `smartQuoteMark()`
  5753. * method.
  5754. **/
  5755. var _proto = Attribute.prototype;
  5756. _proto.getQuotedValue = function getQuotedValue(options) {
  5757. if (options === void 0) {
  5758. options = {};
  5759. }
  5760. var quoteMark = this._determineQuoteMark(options);
  5761. var cssescopts = CSSESC_QUOTE_OPTIONS[quoteMark];
  5762. var escaped = (0, _cssesc["default"])(this._value, cssescopts);
  5763. return escaped;
  5764. };
  5765. _proto._determineQuoteMark = function _determineQuoteMark(options) {
  5766. return options.smart ? this.smartQuoteMark(options) : this.preferredQuoteMark(options);
  5767. }
  5768. /**
  5769. * Set the unescaped value with the specified quotation options. The value
  5770. * provided must not include any wrapping quote marks -- those quotes will
  5771. * be interpreted as part of the value and escaped accordingly.
  5772. */
  5773. ;
  5774. _proto.setValue = function setValue(value, options) {
  5775. if (options === void 0) {
  5776. options = {};
  5777. }
  5778. this._value = value;
  5779. this._quoteMark = this._determineQuoteMark(options);
  5780. this._syncRawValue();
  5781. }
  5782. /**
  5783. * Intelligently select a quoteMark value based on the value's contents. If
  5784. * the value is a legal CSS ident, it will not be quoted. Otherwise a quote
  5785. * mark will be picked that minimizes the number of escapes.
  5786. *
  5787. * If there's no clear winner, the quote mark from these options is used,
  5788. * then the source quote mark (this is inverted if `preferCurrentQuoteMark` is
  5789. * true). If the quoteMark is unspecified, a double quote is used.
  5790. *
  5791. * @param options This takes the quoteMark and preferCurrentQuoteMark options
  5792. * from the quoteValue method.
  5793. */
  5794. ;
  5795. _proto.smartQuoteMark = function smartQuoteMark(options) {
  5796. var v = this.value;
  5797. var numSingleQuotes = v.replace(/[^']/g, '').length;
  5798. var numDoubleQuotes = v.replace(/[^"]/g, '').length;
  5799. if (numSingleQuotes + numDoubleQuotes === 0) {
  5800. var escaped = (0, _cssesc["default"])(v, {
  5801. isIdentifier: true
  5802. });
  5803. if (escaped === v) {
  5804. return Attribute.NO_QUOTE;
  5805. } else {
  5806. var pref = this.preferredQuoteMark(options);
  5807. if (pref === Attribute.NO_QUOTE) {
  5808. // pick a quote mark that isn't none and see if it's smaller
  5809. var quote = this.quoteMark || options.quoteMark || Attribute.DOUBLE_QUOTE;
  5810. var opts = CSSESC_QUOTE_OPTIONS[quote];
  5811. var quoteValue = (0, _cssesc["default"])(v, opts);
  5812. if (quoteValue.length < escaped.length) {
  5813. return quote;
  5814. }
  5815. }
  5816. return pref;
  5817. }
  5818. } else if (numDoubleQuotes === numSingleQuotes) {
  5819. return this.preferredQuoteMark(options);
  5820. } else if (numDoubleQuotes < numSingleQuotes) {
  5821. return Attribute.DOUBLE_QUOTE;
  5822. } else {
  5823. return Attribute.SINGLE_QUOTE;
  5824. }
  5825. }
  5826. /**
  5827. * Selects the preferred quote mark based on the options and the current quote mark value.
  5828. * If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)`
  5829. * instead.
  5830. */
  5831. ;
  5832. _proto.preferredQuoteMark = function preferredQuoteMark(options) {
  5833. var quoteMark = options.preferCurrentQuoteMark ? this.quoteMark : options.quoteMark;
  5834. if (quoteMark === undefined) {
  5835. quoteMark = options.preferCurrentQuoteMark ? options.quoteMark : this.quoteMark;
  5836. }
  5837. if (quoteMark === undefined) {
  5838. quoteMark = Attribute.DOUBLE_QUOTE;
  5839. }
  5840. return quoteMark;
  5841. };
  5842. _proto._syncRawValue = function _syncRawValue() {
  5843. var rawValue = (0, _cssesc["default"])(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]);
  5844. if (rawValue === this._value) {
  5845. if (this.raws) {
  5846. delete this.raws.value;
  5847. }
  5848. } else {
  5849. this.raws.value = rawValue;
  5850. }
  5851. };
  5852. _proto._handleEscapes = function _handleEscapes(prop, value) {
  5853. if (this._constructed) {
  5854. var escaped = (0, _cssesc["default"])(value, {
  5855. isIdentifier: true
  5856. });
  5857. if (escaped !== value) {
  5858. this.raws[prop] = escaped;
  5859. } else {
  5860. delete this.raws[prop];
  5861. }
  5862. }
  5863. };
  5864. _proto._spacesFor = function _spacesFor(name) {
  5865. var attrSpaces = {
  5866. before: '',
  5867. after: ''
  5868. };
  5869. var spaces = this.spaces[name] || {};
  5870. var rawSpaces = this.raws.spaces && this.raws.spaces[name] || {};
  5871. return Object.assign(attrSpaces, spaces, rawSpaces);
  5872. };
  5873. _proto._stringFor = function _stringFor(name, spaceName, concat) {
  5874. if (spaceName === void 0) {
  5875. spaceName = name;
  5876. }
  5877. if (concat === void 0) {
  5878. concat = defaultAttrConcat;
  5879. }
  5880. var attrSpaces = this._spacesFor(spaceName);
  5881. return concat(this.stringifyProperty(name), attrSpaces);
  5882. }
  5883. /**
  5884. * returns the offset of the attribute part specified relative to the
  5885. * start of the node of the output string.
  5886. *
  5887. * * "ns" - alias for "namespace"
  5888. * * "namespace" - the namespace if it exists.
  5889. * * "attribute" - the attribute name
  5890. * * "attributeNS" - the start of the attribute or its namespace
  5891. * * "operator" - the match operator of the attribute
  5892. * * "value" - The value (string or identifier)
  5893. * * "insensitive" - the case insensitivity flag;
  5894. * @param part One of the possible values inside an attribute.
  5895. * @returns -1 if the name is invalid or the value doesn't exist in this attribute.
  5896. */
  5897. ;
  5898. _proto.offsetOf = function offsetOf(name) {
  5899. var count = 1;
  5900. var attributeSpaces = this._spacesFor("attribute");
  5901. count += attributeSpaces.before.length;
  5902. if (name === "namespace" || name === "ns") {
  5903. return this.namespace ? count : -1;
  5904. }
  5905. if (name === "attributeNS") {
  5906. return count;
  5907. }
  5908. count += this.namespaceString.length;
  5909. if (this.namespace) {
  5910. count += 1;
  5911. }
  5912. if (name === "attribute") {
  5913. return count;
  5914. }
  5915. count += this.stringifyProperty("attribute").length;
  5916. count += attributeSpaces.after.length;
  5917. var operatorSpaces = this._spacesFor("operator");
  5918. count += operatorSpaces.before.length;
  5919. var operator = this.stringifyProperty("operator");
  5920. if (name === "operator") {
  5921. return operator ? count : -1;
  5922. }
  5923. count += operator.length;
  5924. count += operatorSpaces.after.length;
  5925. var valueSpaces = this._spacesFor("value");
  5926. count += valueSpaces.before.length;
  5927. var value = this.stringifyProperty("value");
  5928. if (name === "value") {
  5929. return value ? count : -1;
  5930. }
  5931. count += value.length;
  5932. count += valueSpaces.after.length;
  5933. var insensitiveSpaces = this._spacesFor("insensitive");
  5934. count += insensitiveSpaces.before.length;
  5935. if (name === "insensitive") {
  5936. return this.insensitive ? count : -1;
  5937. }
  5938. return -1;
  5939. };
  5940. _proto.toString = function toString() {
  5941. var _this2 = this;
  5942. var selector = [this.rawSpaceBefore, '['];
  5943. selector.push(this._stringFor('qualifiedAttribute', 'attribute'));
  5944. if (this.operator && (this.value || this.value === '')) {
  5945. selector.push(this._stringFor('operator'));
  5946. selector.push(this._stringFor('value'));
  5947. selector.push(this._stringFor('insensitiveFlag', 'insensitive', function (attrValue, attrSpaces) {
  5948. if (attrValue.length > 0 && !_this2.quoted && attrSpaces.before.length === 0 && !(_this2.spaces.value && _this2.spaces.value.after)) {
  5949. attrSpaces.before = " ";
  5950. }
  5951. return defaultAttrConcat(attrValue, attrSpaces);
  5952. }));
  5953. }
  5954. selector.push(']');
  5955. selector.push(this.rawSpaceAfter);
  5956. return selector.join('');
  5957. };
  5958. _createClass(Attribute, [{
  5959. key: "quoted",
  5960. get: function get() {
  5961. var qm = this.quoteMark;
  5962. return qm === "'" || qm === '"';
  5963. },
  5964. set: function set(value) {
  5965. warnOfDeprecatedQuotedAssignment();
  5966. }
  5967. /**
  5968. * returns a single (`'`) or double (`"`) quote character if the value is quoted.
  5969. * returns `null` if the value is not quoted.
  5970. * returns `undefined` if the quotation state is unknown (this can happen when
  5971. * the attribute is constructed without specifying a quote mark.)
  5972. */
  5973. }, {
  5974. key: "quoteMark",
  5975. get: function get() {
  5976. return this._quoteMark;
  5977. }
  5978. /**
  5979. * Set the quote mark to be used by this attribute's value.
  5980. * If the quote mark changes, the raw (escaped) value at `attr.raws.value` of the attribute
  5981. * value is updated accordingly.
  5982. *
  5983. * @param {"'" | '"' | null} quoteMark The quote mark or `null` if the value should be unquoted.
  5984. */
  5985. ,
  5986. set: function set(quoteMark) {
  5987. if (!this._constructed) {
  5988. this._quoteMark = quoteMark;
  5989. return;
  5990. }
  5991. if (this._quoteMark !== quoteMark) {
  5992. this._quoteMark = quoteMark;
  5993. this._syncRawValue();
  5994. }
  5995. }
  5996. }, {
  5997. key: "qualifiedAttribute",
  5998. get: function get() {
  5999. return this.qualifiedName(this.raws.attribute || this.attribute);
  6000. }
  6001. }, {
  6002. key: "insensitiveFlag",
  6003. get: function get() {
  6004. return this.insensitive ? 'i' : '';
  6005. }
  6006. }, {
  6007. key: "value",
  6008. get: function get() {
  6009. return this._value;
  6010. }
  6011. /**
  6012. * Before 3.0, the value had to be set to an escaped value including any wrapped
  6013. * quote marks. In 3.0, the semantics of `Attribute.value` changed so that the value
  6014. * is unescaped during parsing and any quote marks are removed.
  6015. *
  6016. * Because the ambiguity of this semantic change, if you set `attr.value = newValue`,
  6017. * a deprecation warning is raised when the new value contains any characters that would
  6018. * require escaping (including if it contains wrapped quotes).
  6019. *
  6020. * Instead, you should call `attr.setValue(newValue, opts)` and pass options that describe
  6021. * how the new value is quoted.
  6022. */
  6023. ,
  6024. set: function set(v) {
  6025. if (this._constructed) {
  6026. var _unescapeValue2 = unescapeValue(v),
  6027. deprecatedUsage = _unescapeValue2.deprecatedUsage,
  6028. unescaped = _unescapeValue2.unescaped,
  6029. quoteMark = _unescapeValue2.quoteMark;
  6030. if (deprecatedUsage) {
  6031. warnOfDeprecatedValueAssignment();
  6032. }
  6033. if (unescaped === this._value && quoteMark === this._quoteMark) {
  6034. return;
  6035. }
  6036. this._value = unescaped;
  6037. this._quoteMark = quoteMark;
  6038. this._syncRawValue();
  6039. } else {
  6040. this._value = v;
  6041. }
  6042. }
  6043. }, {
  6044. key: "attribute",
  6045. get: function get() {
  6046. return this._attribute;
  6047. },
  6048. set: function set(name) {
  6049. this._handleEscapes("attribute", name);
  6050. this._attribute = name;
  6051. }
  6052. }]);
  6053. return Attribute;
  6054. }(_namespace["default"]);
  6055. exports["default"] = Attribute;
  6056. Attribute.NO_QUOTE = null;
  6057. Attribute.SINGLE_QUOTE = "'";
  6058. Attribute.DOUBLE_QUOTE = '"';
  6059. var CSSESC_QUOTE_OPTIONS = (_CSSESC_QUOTE_OPTIONS = {
  6060. "'": {
  6061. quotes: 'single',
  6062. wrap: true
  6063. },
  6064. '"': {
  6065. quotes: 'double',
  6066. wrap: true
  6067. }
  6068. }, _CSSESC_QUOTE_OPTIONS[null] = {
  6069. isIdentifier: true
  6070. }, _CSSESC_QUOTE_OPTIONS);
  6071. function defaultAttrConcat(attrValue, attrSpaces) {
  6072. return "" + attrSpaces.before + attrValue + attrSpaces.after;
  6073. }
  6074. });
  6075. var universal = createCommonjsModule(function (module, exports) {
  6076. exports.__esModule = true;
  6077. exports["default"] = void 0;
  6078. var _namespace = _interopRequireDefault(namespace);
  6079. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6080. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  6081. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  6082. var Universal = /*#__PURE__*/function (_Namespace) {
  6083. _inheritsLoose(Universal, _Namespace);
  6084. function Universal(opts) {
  6085. var _this;
  6086. _this = _Namespace.call(this, opts) || this;
  6087. _this.type = types.UNIVERSAL;
  6088. _this.value = '*';
  6089. return _this;
  6090. }
  6091. return Universal;
  6092. }(_namespace["default"]);
  6093. exports["default"] = Universal;
  6094. module.exports = exports.default;
  6095. });
  6096. var combinator = createCommonjsModule(function (module, exports) {
  6097. exports.__esModule = true;
  6098. exports["default"] = void 0;
  6099. var _node = _interopRequireDefault(node);
  6100. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6101. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  6102. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  6103. var Combinator = /*#__PURE__*/function (_Node) {
  6104. _inheritsLoose(Combinator, _Node);
  6105. function Combinator(opts) {
  6106. var _this;
  6107. _this = _Node.call(this, opts) || this;
  6108. _this.type = types.COMBINATOR;
  6109. return _this;
  6110. }
  6111. return Combinator;
  6112. }(_node["default"]);
  6113. exports["default"] = Combinator;
  6114. module.exports = exports.default;
  6115. });
  6116. var nesting = createCommonjsModule(function (module, exports) {
  6117. exports.__esModule = true;
  6118. exports["default"] = void 0;
  6119. var _node = _interopRequireDefault(node);
  6120. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6121. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  6122. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  6123. var Nesting = /*#__PURE__*/function (_Node) {
  6124. _inheritsLoose(Nesting, _Node);
  6125. function Nesting(opts) {
  6126. var _this;
  6127. _this = _Node.call(this, opts) || this;
  6128. _this.type = types.NESTING;
  6129. _this.value = '&';
  6130. return _this;
  6131. }
  6132. return Nesting;
  6133. }(_node["default"]);
  6134. exports["default"] = Nesting;
  6135. module.exports = exports.default;
  6136. });
  6137. var sortAscending_1 = createCommonjsModule(function (module, exports) {
  6138. exports.__esModule = true;
  6139. exports["default"] = sortAscending;
  6140. function sortAscending(list) {
  6141. return list.sort(function (a, b) {
  6142. return a - b;
  6143. });
  6144. }
  6145. module.exports = exports.default;
  6146. });
  6147. var tokenTypes = createCommonjsModule(function (module, exports) {
  6148. exports.__esModule = true;
  6149. 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;
  6150. var ampersand = 38; // `&`.charCodeAt(0);
  6151. exports.ampersand = ampersand;
  6152. var asterisk = 42; // `*`.charCodeAt(0);
  6153. exports.asterisk = asterisk;
  6154. var at = 64; // `@`.charCodeAt(0);
  6155. exports.at = at;
  6156. var comma = 44; // `,`.charCodeAt(0);
  6157. exports.comma = comma;
  6158. var colon = 58; // `:`.charCodeAt(0);
  6159. exports.colon = colon;
  6160. var semicolon = 59; // `;`.charCodeAt(0);
  6161. exports.semicolon = semicolon;
  6162. var openParenthesis = 40; // `(`.charCodeAt(0);
  6163. exports.openParenthesis = openParenthesis;
  6164. var closeParenthesis = 41; // `)`.charCodeAt(0);
  6165. exports.closeParenthesis = closeParenthesis;
  6166. var openSquare = 91; // `[`.charCodeAt(0);
  6167. exports.openSquare = openSquare;
  6168. var closeSquare = 93; // `]`.charCodeAt(0);
  6169. exports.closeSquare = closeSquare;
  6170. var dollar = 36; // `$`.charCodeAt(0);
  6171. exports.dollar = dollar;
  6172. var tilde = 126; // `~`.charCodeAt(0);
  6173. exports.tilde = tilde;
  6174. var caret = 94; // `^`.charCodeAt(0);
  6175. exports.caret = caret;
  6176. var plus = 43; // `+`.charCodeAt(0);
  6177. exports.plus = plus;
  6178. var equals = 61; // `=`.charCodeAt(0);
  6179. exports.equals = equals;
  6180. var pipe = 124; // `|`.charCodeAt(0);
  6181. exports.pipe = pipe;
  6182. var greaterThan = 62; // `>`.charCodeAt(0);
  6183. exports.greaterThan = greaterThan;
  6184. var space = 32; // ` `.charCodeAt(0);
  6185. exports.space = space;
  6186. var singleQuote = 39; // `'`.charCodeAt(0);
  6187. exports.singleQuote = singleQuote;
  6188. var doubleQuote = 34; // `"`.charCodeAt(0);
  6189. exports.doubleQuote = doubleQuote;
  6190. var slash = 47; // `/`.charCodeAt(0);
  6191. exports.slash = slash;
  6192. var bang = 33; // `!`.charCodeAt(0);
  6193. exports.bang = bang;
  6194. var backslash = 92; // '\\'.charCodeAt(0);
  6195. exports.backslash = backslash;
  6196. var cr = 13; // '\r'.charCodeAt(0);
  6197. exports.cr = cr;
  6198. var feed = 12; // '\f'.charCodeAt(0);
  6199. exports.feed = feed;
  6200. var newline = 10; // '\n'.charCodeAt(0);
  6201. exports.newline = newline;
  6202. var tab = 9; // '\t'.charCodeAt(0);
  6203. // Expose aliases primarily for readability.
  6204. exports.tab = tab;
  6205. var str = singleQuote; // No good single character representation!
  6206. exports.str = str;
  6207. var comment = -1;
  6208. exports.comment = comment;
  6209. var word = -2;
  6210. exports.word = word;
  6211. var combinator = -3;
  6212. exports.combinator = combinator;
  6213. });
  6214. var tokenize_1 = createCommonjsModule(function (module, exports) {
  6215. exports.__esModule = true;
  6216. exports["default"] = tokenize;
  6217. exports.FIELDS = void 0;
  6218. var t = _interopRequireWildcard(tokenTypes);
  6219. var _unescapable, _wordDelimiters;
  6220. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  6221. 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; }
  6222. var unescapable = (_unescapable = {}, _unescapable[t.tab] = true, _unescapable[t.newline] = true, _unescapable[t.cr] = true, _unescapable[t.feed] = true, _unescapable);
  6223. 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);
  6224. var hex = {};
  6225. var hexChars = "0123456789abcdefABCDEF";
  6226. for (var i = 0; i < hexChars.length; i++) {
  6227. hex[hexChars.charCodeAt(i)] = true;
  6228. }
  6229. /**
  6230. * Returns the last index of the bar css word
  6231. * @param {string} css The string in which the word begins
  6232. * @param {number} start The index into the string where word's first letter occurs
  6233. */
  6234. function consumeWord(css, start) {
  6235. var next = start;
  6236. var code;
  6237. do {
  6238. code = css.charCodeAt(next);
  6239. if (wordDelimiters[code]) {
  6240. return next - 1;
  6241. } else if (code === t.backslash) {
  6242. next = consumeEscape(css, next) + 1;
  6243. } else {
  6244. // All other characters are part of the word
  6245. next++;
  6246. }
  6247. } while (next < css.length);
  6248. return next - 1;
  6249. }
  6250. /**
  6251. * Returns the last index of the escape sequence
  6252. * @param {string} css The string in which the sequence begins
  6253. * @param {number} start The index into the string where escape character (`\`) occurs.
  6254. */
  6255. function consumeEscape(css, start) {
  6256. var next = start;
  6257. var code = css.charCodeAt(next + 1);
  6258. if (unescapable[code]) ; else if (hex[code]) {
  6259. var hexDigits = 0; // consume up to 6 hex chars
  6260. do {
  6261. next++;
  6262. hexDigits++;
  6263. code = css.charCodeAt(next + 1);
  6264. } while (hex[code] && hexDigits < 6); // if fewer than 6 hex chars, a trailing space ends the escape
  6265. if (hexDigits < 6 && code === t.space) {
  6266. next++;
  6267. }
  6268. } else {
  6269. // the next char is part of the current word
  6270. next++;
  6271. }
  6272. return next;
  6273. }
  6274. var FIELDS = {
  6275. TYPE: 0,
  6276. START_LINE: 1,
  6277. START_COL: 2,
  6278. END_LINE: 3,
  6279. END_COL: 4,
  6280. START_POS: 5,
  6281. END_POS: 6
  6282. };
  6283. exports.FIELDS = FIELDS;
  6284. function tokenize(input) {
  6285. var tokens = [];
  6286. var css = input.css.valueOf();
  6287. var _css = css,
  6288. length = _css.length;
  6289. var offset = -1;
  6290. var line = 1;
  6291. var start = 0;
  6292. var end = 0;
  6293. var code, content, endColumn, endLine, escaped, escapePos, last, lines, next, nextLine, nextOffset, quote, tokenType;
  6294. function unclosed(what, fix) {
  6295. if (input.safe) {
  6296. // fyi: this is never set to true.
  6297. css += fix;
  6298. next = css.length - 1;
  6299. } else {
  6300. throw input.error('Unclosed ' + what, line, start - offset, start);
  6301. }
  6302. }
  6303. while (start < length) {
  6304. code = css.charCodeAt(start);
  6305. if (code === t.newline) {
  6306. offset = start;
  6307. line += 1;
  6308. }
  6309. switch (code) {
  6310. case t.space:
  6311. case t.tab:
  6312. case t.newline:
  6313. case t.cr:
  6314. case t.feed:
  6315. next = start;
  6316. do {
  6317. next += 1;
  6318. code = css.charCodeAt(next);
  6319. if (code === t.newline) {
  6320. offset = next;
  6321. line += 1;
  6322. }
  6323. } while (code === t.space || code === t.newline || code === t.tab || code === t.cr || code === t.feed);
  6324. tokenType = t.space;
  6325. endLine = line;
  6326. endColumn = next - offset - 1;
  6327. end = next;
  6328. break;
  6329. case t.plus:
  6330. case t.greaterThan:
  6331. case t.tilde:
  6332. case t.pipe:
  6333. next = start;
  6334. do {
  6335. next += 1;
  6336. code = css.charCodeAt(next);
  6337. } while (code === t.plus || code === t.greaterThan || code === t.tilde || code === t.pipe);
  6338. tokenType = t.combinator;
  6339. endLine = line;
  6340. endColumn = start - offset;
  6341. end = next;
  6342. break;
  6343. // Consume these characters as single tokens.
  6344. case t.asterisk:
  6345. case t.ampersand:
  6346. case t.bang:
  6347. case t.comma:
  6348. case t.equals:
  6349. case t.dollar:
  6350. case t.caret:
  6351. case t.openSquare:
  6352. case t.closeSquare:
  6353. case t.colon:
  6354. case t.semicolon:
  6355. case t.openParenthesis:
  6356. case t.closeParenthesis:
  6357. next = start;
  6358. tokenType = code;
  6359. endLine = line;
  6360. endColumn = start - offset;
  6361. end = next + 1;
  6362. break;
  6363. case t.singleQuote:
  6364. case t.doubleQuote:
  6365. quote = code === t.singleQuote ? "'" : '"';
  6366. next = start;
  6367. do {
  6368. escaped = false;
  6369. next = css.indexOf(quote, next + 1);
  6370. if (next === -1) {
  6371. unclosed('quote', quote);
  6372. }
  6373. escapePos = next;
  6374. while (css.charCodeAt(escapePos - 1) === t.backslash) {
  6375. escapePos -= 1;
  6376. escaped = !escaped;
  6377. }
  6378. } while (escaped);
  6379. tokenType = t.str;
  6380. endLine = line;
  6381. endColumn = start - offset;
  6382. end = next + 1;
  6383. break;
  6384. default:
  6385. if (code === t.slash && css.charCodeAt(start + 1) === t.asterisk) {
  6386. next = css.indexOf('*/', start + 2) + 1;
  6387. if (next === 0) {
  6388. unclosed('comment', '*/');
  6389. }
  6390. content = css.slice(start, next + 1);
  6391. lines = content.split('\n');
  6392. last = lines.length - 1;
  6393. if (last > 0) {
  6394. nextLine = line + last;
  6395. nextOffset = next - lines[last].length;
  6396. } else {
  6397. nextLine = line;
  6398. nextOffset = offset;
  6399. }
  6400. tokenType = t.comment;
  6401. line = nextLine;
  6402. endLine = nextLine;
  6403. endColumn = next - nextOffset;
  6404. } else if (code === t.slash) {
  6405. next = start;
  6406. tokenType = code;
  6407. endLine = line;
  6408. endColumn = start - offset;
  6409. end = next + 1;
  6410. } else {
  6411. next = consumeWord(css, start);
  6412. tokenType = t.word;
  6413. endLine = line;
  6414. endColumn = next - offset;
  6415. }
  6416. end = next + 1;
  6417. break;
  6418. } // Ensure that the token structure remains consistent
  6419. tokens.push([tokenType, // [0] Token type
  6420. line, // [1] Starting line
  6421. start - offset, // [2] Starting column
  6422. endLine, // [3] Ending line
  6423. endColumn, // [4] Ending column
  6424. start, // [5] Start position / Source index
  6425. end // [6] End position
  6426. ]); // Reset offset for the next token
  6427. if (nextOffset) {
  6428. offset = nextOffset;
  6429. nextOffset = null;
  6430. }
  6431. start = end;
  6432. }
  6433. return tokens;
  6434. }
  6435. });
  6436. var parser = createCommonjsModule(function (module, exports) {
  6437. exports.__esModule = true;
  6438. exports["default"] = void 0;
  6439. var _root = _interopRequireDefault(root);
  6440. var _selector = _interopRequireDefault(selector);
  6441. var _className = _interopRequireDefault(className);
  6442. var _comment = _interopRequireDefault(comment);
  6443. var _id = _interopRequireDefault(id);
  6444. var _tag = _interopRequireDefault(tag);
  6445. var _string = _interopRequireDefault(string);
  6446. var _pseudo = _interopRequireDefault(pseudo);
  6447. var _attribute = _interopRequireWildcard(attribute);
  6448. var _universal = _interopRequireDefault(universal);
  6449. var _combinator = _interopRequireDefault(combinator);
  6450. var _nesting = _interopRequireDefault(nesting);
  6451. var _sortAscending = _interopRequireDefault(sortAscending_1);
  6452. var _tokenize = _interopRequireWildcard(tokenize_1);
  6453. var tokens = _interopRequireWildcard(tokenTypes);
  6454. var types$1 = _interopRequireWildcard(types);
  6455. var _WHITESPACE_TOKENS, _Object$assign;
  6456. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  6457. 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; }
  6458. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6459. 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); } }
  6460. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6461. 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);
  6462. var WHITESPACE_EQUIV_TOKENS = Object.assign({}, WHITESPACE_TOKENS, (_Object$assign = {}, _Object$assign[tokens.comment] = true, _Object$assign));
  6463. function tokenStart(token) {
  6464. return {
  6465. line: token[_tokenize.FIELDS.START_LINE],
  6466. column: token[_tokenize.FIELDS.START_COL]
  6467. };
  6468. }
  6469. function tokenEnd(token) {
  6470. return {
  6471. line: token[_tokenize.FIELDS.END_LINE],
  6472. column: token[_tokenize.FIELDS.END_COL]
  6473. };
  6474. }
  6475. function getSource(startLine, startColumn, endLine, endColumn) {
  6476. return {
  6477. start: {
  6478. line: startLine,
  6479. column: startColumn
  6480. },
  6481. end: {
  6482. line: endLine,
  6483. column: endColumn
  6484. }
  6485. };
  6486. }
  6487. function getTokenSource(token) {
  6488. return getSource(token[_tokenize.FIELDS.START_LINE], token[_tokenize.FIELDS.START_COL], token[_tokenize.FIELDS.END_LINE], token[_tokenize.FIELDS.END_COL]);
  6489. }
  6490. function getTokenSourceSpan(startToken, endToken) {
  6491. if (!startToken) {
  6492. return undefined;
  6493. }
  6494. return getSource(startToken[_tokenize.FIELDS.START_LINE], startToken[_tokenize.FIELDS.START_COL], endToken[_tokenize.FIELDS.END_LINE], endToken[_tokenize.FIELDS.END_COL]);
  6495. }
  6496. function unescapeProp(node, prop) {
  6497. var value = node[prop];
  6498. if (typeof value !== "string") {
  6499. return;
  6500. }
  6501. if (value.indexOf("\\") !== -1) {
  6502. (0, util.ensureObject)(node, 'raws');
  6503. node[prop] = (0, util.unesc)(value);
  6504. if (node.raws[prop] === undefined) {
  6505. node.raws[prop] = value;
  6506. }
  6507. }
  6508. return node;
  6509. }
  6510. function indexesOf(array, item) {
  6511. var i = -1;
  6512. var indexes = [];
  6513. while ((i = array.indexOf(item, i + 1)) !== -1) {
  6514. indexes.push(i);
  6515. }
  6516. return indexes;
  6517. }
  6518. function uniqs() {
  6519. var list = Array.prototype.concat.apply([], arguments);
  6520. return list.filter(function (item, i) {
  6521. return i === list.indexOf(item);
  6522. });
  6523. }
  6524. var Parser = /*#__PURE__*/function () {
  6525. function Parser(rule, options) {
  6526. if (options === void 0) {
  6527. options = {};
  6528. }
  6529. this.rule = rule;
  6530. this.options = Object.assign({
  6531. lossy: false,
  6532. safe: false
  6533. }, options);
  6534. this.position = 0;
  6535. this.css = typeof this.rule === 'string' ? this.rule : this.rule.selector;
  6536. this.tokens = (0, _tokenize["default"])({
  6537. css: this.css,
  6538. error: this._errorGenerator(),
  6539. safe: this.options.safe
  6540. });
  6541. var rootSource = getTokenSourceSpan(this.tokens[0], this.tokens[this.tokens.length - 1]);
  6542. this.root = new _root["default"]({
  6543. source: rootSource
  6544. });
  6545. this.root.errorGenerator = this._errorGenerator();
  6546. var selector = new _selector["default"]({
  6547. source: {
  6548. start: {
  6549. line: 1,
  6550. column: 1
  6551. }
  6552. }
  6553. });
  6554. this.root.append(selector);
  6555. this.current = selector;
  6556. this.loop();
  6557. }
  6558. var _proto = Parser.prototype;
  6559. _proto._errorGenerator = function _errorGenerator() {
  6560. var _this = this;
  6561. return function (message, errorOptions) {
  6562. if (typeof _this.rule === 'string') {
  6563. return new Error(message);
  6564. }
  6565. return _this.rule.error(message, errorOptions);
  6566. };
  6567. };
  6568. _proto.attribute = function attribute() {
  6569. var attr = [];
  6570. var startingToken = this.currToken;
  6571. this.position++;
  6572. while (this.position < this.tokens.length && this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
  6573. attr.push(this.currToken);
  6574. this.position++;
  6575. }
  6576. if (this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
  6577. return this.expected('closing square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
  6578. }
  6579. var len = attr.length;
  6580. var node = {
  6581. source: getSource(startingToken[1], startingToken[2], this.currToken[3], this.currToken[4]),
  6582. sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
  6583. };
  6584. if (len === 1 && !~[tokens.word].indexOf(attr[0][_tokenize.FIELDS.TYPE])) {
  6585. return this.expected('attribute', attr[0][_tokenize.FIELDS.START_POS]);
  6586. }
  6587. var pos = 0;
  6588. var spaceBefore = '';
  6589. var commentBefore = '';
  6590. var lastAdded = null;
  6591. var spaceAfterMeaningfulToken = false;
  6592. while (pos < len) {
  6593. var token = attr[pos];
  6594. var content = this.content(token);
  6595. var next = attr[pos + 1];
  6596. switch (token[_tokenize.FIELDS.TYPE]) {
  6597. case tokens.space:
  6598. // if (
  6599. // len === 1 ||
  6600. // pos === 0 && this.content(next) === '|'
  6601. // ) {
  6602. // return this.expected('attribute', token[TOKEN.START_POS], content);
  6603. // }
  6604. spaceAfterMeaningfulToken = true;
  6605. if (this.options.lossy) {
  6606. break;
  6607. }
  6608. if (lastAdded) {
  6609. (0, util.ensureObject)(node, 'spaces', lastAdded);
  6610. var prevContent = node.spaces[lastAdded].after || '';
  6611. node.spaces[lastAdded].after = prevContent + content;
  6612. var existingComment = (0, util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || null;
  6613. if (existingComment) {
  6614. node.raws.spaces[lastAdded].after = existingComment + content;
  6615. }
  6616. } else {
  6617. spaceBefore = spaceBefore + content;
  6618. commentBefore = commentBefore + content;
  6619. }
  6620. break;
  6621. case tokens.asterisk:
  6622. if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  6623. node.operator = content;
  6624. lastAdded = 'operator';
  6625. } else if ((!node.namespace || lastAdded === "namespace" && !spaceAfterMeaningfulToken) && next) {
  6626. if (spaceBefore) {
  6627. (0, util.ensureObject)(node, 'spaces', 'attribute');
  6628. node.spaces.attribute.before = spaceBefore;
  6629. spaceBefore = '';
  6630. }
  6631. if (commentBefore) {
  6632. (0, util.ensureObject)(node, 'raws', 'spaces', 'attribute');
  6633. node.raws.spaces.attribute.before = spaceBefore;
  6634. commentBefore = '';
  6635. }
  6636. node.namespace = (node.namespace || "") + content;
  6637. var rawValue = (0, util.getProp)(node, 'raws', 'namespace') || null;
  6638. if (rawValue) {
  6639. node.raws.namespace += content;
  6640. }
  6641. lastAdded = 'namespace';
  6642. }
  6643. spaceAfterMeaningfulToken = false;
  6644. break;
  6645. case tokens.dollar:
  6646. if (lastAdded === "value") {
  6647. var oldRawValue = (0, util.getProp)(node, 'raws', 'value');
  6648. node.value += "$";
  6649. if (oldRawValue) {
  6650. node.raws.value = oldRawValue + "$";
  6651. }
  6652. break;
  6653. }
  6654. // Falls through
  6655. case tokens.caret:
  6656. if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  6657. node.operator = content;
  6658. lastAdded = 'operator';
  6659. }
  6660. spaceAfterMeaningfulToken = false;
  6661. break;
  6662. case tokens.combinator:
  6663. if (content === '~' && next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  6664. node.operator = content;
  6665. lastAdded = 'operator';
  6666. }
  6667. if (content !== '|') {
  6668. spaceAfterMeaningfulToken = false;
  6669. break;
  6670. }
  6671. if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
  6672. node.operator = content;
  6673. lastAdded = 'operator';
  6674. } else if (!node.namespace && !node.attribute) {
  6675. node.namespace = true;
  6676. }
  6677. spaceAfterMeaningfulToken = false;
  6678. break;
  6679. case tokens.word:
  6680. 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.
  6681. !node.operator && !node.namespace) {
  6682. node.namespace = content;
  6683. lastAdded = 'namespace';
  6684. } else if (!node.attribute || lastAdded === "attribute" && !spaceAfterMeaningfulToken) {
  6685. if (spaceBefore) {
  6686. (0, util.ensureObject)(node, 'spaces', 'attribute');
  6687. node.spaces.attribute.before = spaceBefore;
  6688. spaceBefore = '';
  6689. }
  6690. if (commentBefore) {
  6691. (0, util.ensureObject)(node, 'raws', 'spaces', 'attribute');
  6692. node.raws.spaces.attribute.before = commentBefore;
  6693. commentBefore = '';
  6694. }
  6695. node.attribute = (node.attribute || "") + content;
  6696. var _rawValue = (0, util.getProp)(node, 'raws', 'attribute') || null;
  6697. if (_rawValue) {
  6698. node.raws.attribute += content;
  6699. }
  6700. lastAdded = 'attribute';
  6701. } else if (!node.value && node.value !== "" || lastAdded === "value" && !spaceAfterMeaningfulToken) {
  6702. var _unescaped = (0, util.unesc)(content);
  6703. var _oldRawValue = (0, util.getProp)(node, 'raws', 'value') || '';
  6704. var oldValue = node.value || '';
  6705. node.value = oldValue + _unescaped;
  6706. node.quoteMark = null;
  6707. if (_unescaped !== content || _oldRawValue) {
  6708. (0, util.ensureObject)(node, 'raws');
  6709. node.raws.value = (_oldRawValue || oldValue) + content;
  6710. }
  6711. lastAdded = 'value';
  6712. } else {
  6713. var insensitive = content === 'i' || content === "I";
  6714. if ((node.value || node.value === '') && (node.quoteMark || spaceAfterMeaningfulToken)) {
  6715. node.insensitive = insensitive;
  6716. if (!insensitive || content === "I") {
  6717. (0, util.ensureObject)(node, 'raws');
  6718. node.raws.insensitiveFlag = content;
  6719. }
  6720. lastAdded = 'insensitive';
  6721. if (spaceBefore) {
  6722. (0, util.ensureObject)(node, 'spaces', 'insensitive');
  6723. node.spaces.insensitive.before = spaceBefore;
  6724. spaceBefore = '';
  6725. }
  6726. if (commentBefore) {
  6727. (0, util.ensureObject)(node, 'raws', 'spaces', 'insensitive');
  6728. node.raws.spaces.insensitive.before = commentBefore;
  6729. commentBefore = '';
  6730. }
  6731. } else if (node.value || node.value === '') {
  6732. lastAdded = 'value';
  6733. node.value += content;
  6734. if (node.raws.value) {
  6735. node.raws.value += content;
  6736. }
  6737. }
  6738. }
  6739. spaceAfterMeaningfulToken = false;
  6740. break;
  6741. case tokens.str:
  6742. if (!node.attribute || !node.operator) {
  6743. return this.error("Expected an attribute followed by an operator preceding the string.", {
  6744. index: token[_tokenize.FIELDS.START_POS]
  6745. });
  6746. }
  6747. var _unescapeValue = (0, _attribute.unescapeValue)(content),
  6748. unescaped = _unescapeValue.unescaped,
  6749. quoteMark = _unescapeValue.quoteMark;
  6750. node.value = unescaped;
  6751. node.quoteMark = quoteMark;
  6752. lastAdded = 'value';
  6753. (0, util.ensureObject)(node, 'raws');
  6754. node.raws.value = content;
  6755. spaceAfterMeaningfulToken = false;
  6756. break;
  6757. case tokens.equals:
  6758. if (!node.attribute) {
  6759. return this.expected('attribute', token[_tokenize.FIELDS.START_POS], content);
  6760. }
  6761. if (node.value) {
  6762. return this.error('Unexpected "=" found; an operator was already defined.', {
  6763. index: token[_tokenize.FIELDS.START_POS]
  6764. });
  6765. }
  6766. node.operator = node.operator ? node.operator + content : content;
  6767. lastAdded = 'operator';
  6768. spaceAfterMeaningfulToken = false;
  6769. break;
  6770. case tokens.comment:
  6771. if (lastAdded) {
  6772. if (spaceAfterMeaningfulToken || next && next[_tokenize.FIELDS.TYPE] === tokens.space || lastAdded === 'insensitive') {
  6773. var lastComment = (0, util.getProp)(node, 'spaces', lastAdded, 'after') || '';
  6774. var rawLastComment = (0, util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || lastComment;
  6775. (0, util.ensureObject)(node, 'raws', 'spaces', lastAdded);
  6776. node.raws.spaces[lastAdded].after = rawLastComment + content;
  6777. } else {
  6778. var lastValue = node[lastAdded] || '';
  6779. var rawLastValue = (0, util.getProp)(node, 'raws', lastAdded) || lastValue;
  6780. (0, util.ensureObject)(node, 'raws');
  6781. node.raws[lastAdded] = rawLastValue + content;
  6782. }
  6783. } else {
  6784. commentBefore = commentBefore + content;
  6785. }
  6786. break;
  6787. default:
  6788. return this.error("Unexpected \"" + content + "\" found.", {
  6789. index: token[_tokenize.FIELDS.START_POS]
  6790. });
  6791. }
  6792. pos++;
  6793. }
  6794. unescapeProp(node, "attribute");
  6795. unescapeProp(node, "namespace");
  6796. this.newNode(new _attribute["default"](node));
  6797. this.position++;
  6798. }
  6799. /**
  6800. * return a node containing meaningless garbage up to (but not including) the specified token position.
  6801. * if the token position is negative, all remaining tokens are consumed.
  6802. *
  6803. * This returns an array containing a single string node if all whitespace,
  6804. * otherwise an array of comment nodes with space before and after.
  6805. *
  6806. * These tokens are not added to the current selector, the caller can add them or use them to amend
  6807. * a previous node's space metadata.
  6808. *
  6809. * In lossy mode, this returns only comments.
  6810. */
  6811. ;
  6812. _proto.parseWhitespaceEquivalentTokens = function parseWhitespaceEquivalentTokens(stopPosition) {
  6813. if (stopPosition < 0) {
  6814. stopPosition = this.tokens.length;
  6815. }
  6816. var startPosition = this.position;
  6817. var nodes = [];
  6818. var space = "";
  6819. var lastComment = undefined;
  6820. do {
  6821. if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) {
  6822. if (!this.options.lossy) {
  6823. space += this.content();
  6824. }
  6825. } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.comment) {
  6826. var spaces = {};
  6827. if (space) {
  6828. spaces.before = space;
  6829. space = "";
  6830. }
  6831. lastComment = new _comment["default"]({
  6832. value: this.content(),
  6833. source: getTokenSource(this.currToken),
  6834. sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
  6835. spaces: spaces
  6836. });
  6837. nodes.push(lastComment);
  6838. }
  6839. } while (++this.position < stopPosition);
  6840. if (space) {
  6841. if (lastComment) {
  6842. lastComment.spaces.after = space;
  6843. } else if (!this.options.lossy) {
  6844. var firstToken = this.tokens[startPosition];
  6845. var lastToken = this.tokens[this.position - 1];
  6846. nodes.push(new _string["default"]({
  6847. value: '',
  6848. source: getSource(firstToken[_tokenize.FIELDS.START_LINE], firstToken[_tokenize.FIELDS.START_COL], lastToken[_tokenize.FIELDS.END_LINE], lastToken[_tokenize.FIELDS.END_COL]),
  6849. sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
  6850. spaces: {
  6851. before: space,
  6852. after: ''
  6853. }
  6854. }));
  6855. }
  6856. }
  6857. return nodes;
  6858. }
  6859. /**
  6860. *
  6861. * @param {*} nodes
  6862. */
  6863. ;
  6864. _proto.convertWhitespaceNodesToSpace = function convertWhitespaceNodesToSpace(nodes, requiredSpace) {
  6865. var _this2 = this;
  6866. if (requiredSpace === void 0) {
  6867. requiredSpace = false;
  6868. }
  6869. var space = "";
  6870. var rawSpace = "";
  6871. nodes.forEach(function (n) {
  6872. var spaceBefore = _this2.lossySpace(n.spaces.before, requiredSpace);
  6873. var rawSpaceBefore = _this2.lossySpace(n.rawSpaceBefore, requiredSpace);
  6874. space += spaceBefore + _this2.lossySpace(n.spaces.after, requiredSpace && spaceBefore.length === 0);
  6875. rawSpace += spaceBefore + n.value + _this2.lossySpace(n.rawSpaceAfter, requiredSpace && rawSpaceBefore.length === 0);
  6876. });
  6877. if (rawSpace === space) {
  6878. rawSpace = undefined;
  6879. }
  6880. var result = {
  6881. space: space,
  6882. rawSpace: rawSpace
  6883. };
  6884. return result;
  6885. };
  6886. _proto.isNamedCombinator = function isNamedCombinator(position) {
  6887. if (position === void 0) {
  6888. position = this.position;
  6889. }
  6890. 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;
  6891. };
  6892. _proto.namedCombinator = function namedCombinator() {
  6893. if (this.isNamedCombinator()) {
  6894. var nameRaw = this.content(this.tokens[this.position + 1]);
  6895. var name = (0, util.unesc)(nameRaw).toLowerCase();
  6896. var raws = {};
  6897. if (name !== nameRaw) {
  6898. raws.value = "/" + nameRaw + "/";
  6899. }
  6900. var node = new _combinator["default"]({
  6901. value: "/" + name + "/",
  6902. 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]),
  6903. sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
  6904. raws: raws
  6905. });
  6906. this.position = this.position + 3;
  6907. return node;
  6908. } else {
  6909. this.unexpected();
  6910. }
  6911. };
  6912. _proto.combinator = function combinator() {
  6913. var _this3 = this;
  6914. if (this.content() === '|') {
  6915. return this.namespace();
  6916. } // We need to decide between a space that's a descendant combinator and meaningless whitespace at the end of a selector.
  6917. var nextSigTokenPos = this.locateNextMeaningfulToken(this.position);
  6918. if (nextSigTokenPos < 0 || this.tokens[nextSigTokenPos][_tokenize.FIELDS.TYPE] === tokens.comma) {
  6919. var nodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
  6920. if (nodes.length > 0) {
  6921. var last = this.current.last;
  6922. if (last) {
  6923. var _this$convertWhitespa = this.convertWhitespaceNodesToSpace(nodes),
  6924. space = _this$convertWhitespa.space,
  6925. rawSpace = _this$convertWhitespa.rawSpace;
  6926. if (rawSpace !== undefined) {
  6927. last.rawSpaceAfter += rawSpace;
  6928. }
  6929. last.spaces.after += space;
  6930. } else {
  6931. nodes.forEach(function (n) {
  6932. return _this3.newNode(n);
  6933. });
  6934. }
  6935. }
  6936. return;
  6937. }
  6938. var firstToken = this.currToken;
  6939. var spaceOrDescendantSelectorNodes = undefined;
  6940. if (nextSigTokenPos > this.position) {
  6941. spaceOrDescendantSelectorNodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
  6942. }
  6943. var node;
  6944. if (this.isNamedCombinator()) {
  6945. node = this.namedCombinator();
  6946. } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.combinator) {
  6947. node = new _combinator["default"]({
  6948. value: this.content(),
  6949. source: getTokenSource(this.currToken),
  6950. sourceIndex: this.currToken[_tokenize.FIELDS.START_POS]
  6951. });
  6952. this.position++;
  6953. } else if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) ; else if (!spaceOrDescendantSelectorNodes) {
  6954. this.unexpected();
  6955. }
  6956. if (node) {
  6957. if (spaceOrDescendantSelectorNodes) {
  6958. var _this$convertWhitespa2 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes),
  6959. _space = _this$convertWhitespa2.space,
  6960. _rawSpace = _this$convertWhitespa2.rawSpace;
  6961. node.spaces.before = _space;
  6962. node.rawSpaceBefore = _rawSpace;
  6963. }
  6964. } else {
  6965. // descendant combinator
  6966. var _this$convertWhitespa3 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes, true),
  6967. _space2 = _this$convertWhitespa3.space,
  6968. _rawSpace2 = _this$convertWhitespa3.rawSpace;
  6969. if (!_rawSpace2) {
  6970. _rawSpace2 = _space2;
  6971. }
  6972. var spaces = {};
  6973. var raws = {
  6974. spaces: {}
  6975. };
  6976. if (_space2.endsWith(' ') && _rawSpace2.endsWith(' ')) {
  6977. spaces.before = _space2.slice(0, _space2.length - 1);
  6978. raws.spaces.before = _rawSpace2.slice(0, _rawSpace2.length - 1);
  6979. } else if (_space2.startsWith(' ') && _rawSpace2.startsWith(' ')) {
  6980. spaces.after = _space2.slice(1);
  6981. raws.spaces.after = _rawSpace2.slice(1);
  6982. } else {
  6983. raws.value = _rawSpace2;
  6984. }
  6985. node = new _combinator["default"]({
  6986. value: ' ',
  6987. source: getTokenSourceSpan(firstToken, this.tokens[this.position - 1]),
  6988. sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
  6989. spaces: spaces,
  6990. raws: raws
  6991. });
  6992. }
  6993. if (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.space) {
  6994. node.spaces.after = this.optionalSpace(this.content());
  6995. this.position++;
  6996. }
  6997. return this.newNode(node);
  6998. };
  6999. _proto.comma = function comma() {
  7000. if (this.position === this.tokens.length - 1) {
  7001. this.root.trailingComma = true;
  7002. this.position++;
  7003. return;
  7004. }
  7005. this.current._inferEndPosition();
  7006. var selector = new _selector["default"]({
  7007. source: {
  7008. start: tokenStart(this.tokens[this.position + 1])
  7009. }
  7010. });
  7011. this.current.parent.append(selector);
  7012. this.current = selector;
  7013. this.position++;
  7014. };
  7015. _proto.comment = function comment() {
  7016. var current = this.currToken;
  7017. this.newNode(new _comment["default"]({
  7018. value: this.content(),
  7019. source: getTokenSource(current),
  7020. sourceIndex: current[_tokenize.FIELDS.START_POS]
  7021. }));
  7022. this.position++;
  7023. };
  7024. _proto.error = function error(message, opts) {
  7025. throw this.root.error(message, opts);
  7026. };
  7027. _proto.missingBackslash = function missingBackslash() {
  7028. return this.error('Expected a backslash preceding the semicolon.', {
  7029. index: this.currToken[_tokenize.FIELDS.START_POS]
  7030. });
  7031. };
  7032. _proto.missingParenthesis = function missingParenthesis() {
  7033. return this.expected('opening parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
  7034. };
  7035. _proto.missingSquareBracket = function missingSquareBracket() {
  7036. return this.expected('opening square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
  7037. };
  7038. _proto.unexpected = function unexpected() {
  7039. return this.error("Unexpected '" + this.content() + "'. Escaping special characters with \\ may help.", this.currToken[_tokenize.FIELDS.START_POS]);
  7040. };
  7041. _proto.namespace = function namespace() {
  7042. var before = this.prevToken && this.content(this.prevToken) || true;
  7043. if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.word) {
  7044. this.position++;
  7045. return this.word(before);
  7046. } else if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.asterisk) {
  7047. this.position++;
  7048. return this.universal(before);
  7049. }
  7050. };
  7051. _proto.nesting = function nesting() {
  7052. if (this.nextToken) {
  7053. var nextContent = this.content(this.nextToken);
  7054. if (nextContent === "|") {
  7055. this.position++;
  7056. return;
  7057. }
  7058. }
  7059. var current = this.currToken;
  7060. this.newNode(new _nesting["default"]({
  7061. value: this.content(),
  7062. source: getTokenSource(current),
  7063. sourceIndex: current[_tokenize.FIELDS.START_POS]
  7064. }));
  7065. this.position++;
  7066. };
  7067. _proto.parentheses = function parentheses() {
  7068. var last = this.current.last;
  7069. var unbalanced = 1;
  7070. this.position++;
  7071. if (last && last.type === types$1.PSEUDO) {
  7072. var selector = new _selector["default"]({
  7073. source: {
  7074. start: tokenStart(this.tokens[this.position - 1])
  7075. }
  7076. });
  7077. var cache = this.current;
  7078. last.append(selector);
  7079. this.current = selector;
  7080. while (this.position < this.tokens.length && unbalanced) {
  7081. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
  7082. unbalanced++;
  7083. }
  7084. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
  7085. unbalanced--;
  7086. }
  7087. if (unbalanced) {
  7088. this.parse();
  7089. } else {
  7090. this.current.source.end = tokenEnd(this.currToken);
  7091. this.current.parent.source.end = tokenEnd(this.currToken);
  7092. this.position++;
  7093. }
  7094. }
  7095. this.current = cache;
  7096. } else {
  7097. // I think this case should be an error. It's used to implement a basic parse of media queries
  7098. // but I don't think it's a good idea.
  7099. var parenStart = this.currToken;
  7100. var parenValue = "(";
  7101. var parenEnd;
  7102. while (this.position < this.tokens.length && unbalanced) {
  7103. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
  7104. unbalanced++;
  7105. }
  7106. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
  7107. unbalanced--;
  7108. }
  7109. parenEnd = this.currToken;
  7110. parenValue += this.parseParenthesisToken(this.currToken);
  7111. this.position++;
  7112. }
  7113. if (last) {
  7114. last.appendToPropertyAndEscape("value", parenValue, parenValue);
  7115. } else {
  7116. this.newNode(new _string["default"]({
  7117. value: parenValue,
  7118. source: getSource(parenStart[_tokenize.FIELDS.START_LINE], parenStart[_tokenize.FIELDS.START_COL], parenEnd[_tokenize.FIELDS.END_LINE], parenEnd[_tokenize.FIELDS.END_COL]),
  7119. sourceIndex: parenStart[_tokenize.FIELDS.START_POS]
  7120. }));
  7121. }
  7122. }
  7123. if (unbalanced) {
  7124. return this.expected('closing parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
  7125. }
  7126. };
  7127. _proto.pseudo = function pseudo() {
  7128. var _this4 = this;
  7129. var pseudoStr = '';
  7130. var startingToken = this.currToken;
  7131. while (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.colon) {
  7132. pseudoStr += this.content();
  7133. this.position++;
  7134. }
  7135. if (!this.currToken) {
  7136. return this.expected(['pseudo-class', 'pseudo-element'], this.position - 1);
  7137. }
  7138. if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.word) {
  7139. this.splitWord(false, function (first, length) {
  7140. pseudoStr += first;
  7141. _this4.newNode(new _pseudo["default"]({
  7142. value: pseudoStr,
  7143. source: getTokenSourceSpan(startingToken, _this4.currToken),
  7144. sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
  7145. }));
  7146. if (length > 1 && _this4.nextToken && _this4.nextToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
  7147. _this4.error('Misplaced parenthesis.', {
  7148. index: _this4.nextToken[_tokenize.FIELDS.START_POS]
  7149. });
  7150. }
  7151. });
  7152. } else {
  7153. return this.expected(['pseudo-class', 'pseudo-element'], this.currToken[_tokenize.FIELDS.START_POS]);
  7154. }
  7155. };
  7156. _proto.space = function space() {
  7157. var content = this.content(); // Handle space before and after the selector
  7158. if (this.position === 0 || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis || this.current.nodes.every(function (node) {
  7159. return node.type === 'comment';
  7160. })) {
  7161. this.spaces = this.optionalSpace(content);
  7162. this.position++;
  7163. } else if (this.position === this.tokens.length - 1 || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
  7164. this.current.last.spaces.after = this.optionalSpace(content);
  7165. this.position++;
  7166. } else {
  7167. this.combinator();
  7168. }
  7169. };
  7170. _proto.string = function string() {
  7171. var current = this.currToken;
  7172. this.newNode(new _string["default"]({
  7173. value: this.content(),
  7174. source: getTokenSource(current),
  7175. sourceIndex: current[_tokenize.FIELDS.START_POS]
  7176. }));
  7177. this.position++;
  7178. };
  7179. _proto.universal = function universal(namespace) {
  7180. var nextToken = this.nextToken;
  7181. if (nextToken && this.content(nextToken) === '|') {
  7182. this.position++;
  7183. return this.namespace();
  7184. }
  7185. var current = this.currToken;
  7186. this.newNode(new _universal["default"]({
  7187. value: this.content(),
  7188. source: getTokenSource(current),
  7189. sourceIndex: current[_tokenize.FIELDS.START_POS]
  7190. }), namespace);
  7191. this.position++;
  7192. };
  7193. _proto.splitWord = function splitWord(namespace, firstCallback) {
  7194. var _this5 = this;
  7195. var nextToken = this.nextToken;
  7196. var word = this.content();
  7197. while (nextToken && ~[tokens.dollar, tokens.caret, tokens.equals, tokens.word].indexOf(nextToken[_tokenize.FIELDS.TYPE])) {
  7198. this.position++;
  7199. var current = this.content();
  7200. word += current;
  7201. if (current.lastIndexOf('\\') === current.length - 1) {
  7202. var next = this.nextToken;
  7203. if (next && next[_tokenize.FIELDS.TYPE] === tokens.space) {
  7204. word += this.requiredSpace(this.content(next));
  7205. this.position++;
  7206. }
  7207. }
  7208. nextToken = this.nextToken;
  7209. }
  7210. var hasClass = indexesOf(word, '.').filter(function (i) {
  7211. // Allow escaped dot within class name
  7212. var escapedDot = word[i - 1] === '\\'; // Allow decimal numbers percent in @keyframes
  7213. var isKeyframesPercent = /^\d+\.\d+%$/.test(word);
  7214. return !escapedDot && !isKeyframesPercent;
  7215. });
  7216. var hasId = indexesOf(word, '#').filter(function (i) {
  7217. return word[i - 1] !== '\\';
  7218. }); // Eliminate Sass interpolations from the list of id indexes
  7219. var interpolations = indexesOf(word, '#{');
  7220. if (interpolations.length) {
  7221. hasId = hasId.filter(function (hashIndex) {
  7222. return !~interpolations.indexOf(hashIndex);
  7223. });
  7224. }
  7225. var indices = (0, _sortAscending["default"])(uniqs([0].concat(hasClass, hasId)));
  7226. indices.forEach(function (ind, i) {
  7227. var index = indices[i + 1] || word.length;
  7228. var value = word.slice(ind, index);
  7229. if (i === 0 && firstCallback) {
  7230. return firstCallback.call(_this5, value, indices.length);
  7231. }
  7232. var node;
  7233. var current = _this5.currToken;
  7234. var sourceIndex = current[_tokenize.FIELDS.START_POS] + indices[i];
  7235. var source = getSource(current[1], current[2] + ind, current[3], current[2] + (index - 1));
  7236. if (~hasClass.indexOf(ind)) {
  7237. var classNameOpts = {
  7238. value: value.slice(1),
  7239. source: source,
  7240. sourceIndex: sourceIndex
  7241. };
  7242. node = new _className["default"](unescapeProp(classNameOpts, "value"));
  7243. } else if (~hasId.indexOf(ind)) {
  7244. var idOpts = {
  7245. value: value.slice(1),
  7246. source: source,
  7247. sourceIndex: sourceIndex
  7248. };
  7249. node = new _id["default"](unescapeProp(idOpts, "value"));
  7250. } else {
  7251. var tagOpts = {
  7252. value: value,
  7253. source: source,
  7254. sourceIndex: sourceIndex
  7255. };
  7256. unescapeProp(tagOpts, "value");
  7257. node = new _tag["default"](tagOpts);
  7258. }
  7259. _this5.newNode(node, namespace); // Ensure that the namespace is used only once
  7260. namespace = null;
  7261. });
  7262. this.position++;
  7263. };
  7264. _proto.word = function word(namespace) {
  7265. var nextToken = this.nextToken;
  7266. if (nextToken && this.content(nextToken) === '|') {
  7267. this.position++;
  7268. return this.namespace();
  7269. }
  7270. return this.splitWord(namespace);
  7271. };
  7272. _proto.loop = function loop() {
  7273. while (this.position < this.tokens.length) {
  7274. this.parse(true);
  7275. }
  7276. this.current._inferEndPosition();
  7277. return this.root;
  7278. };
  7279. _proto.parse = function parse(throwOnParenthesis) {
  7280. switch (this.currToken[_tokenize.FIELDS.TYPE]) {
  7281. case tokens.space:
  7282. this.space();
  7283. break;
  7284. case tokens.comment:
  7285. this.comment();
  7286. break;
  7287. case tokens.openParenthesis:
  7288. this.parentheses();
  7289. break;
  7290. case tokens.closeParenthesis:
  7291. if (throwOnParenthesis) {
  7292. this.missingParenthesis();
  7293. }
  7294. break;
  7295. case tokens.openSquare:
  7296. this.attribute();
  7297. break;
  7298. case tokens.dollar:
  7299. case tokens.caret:
  7300. case tokens.equals:
  7301. case tokens.word:
  7302. this.word();
  7303. break;
  7304. case tokens.colon:
  7305. this.pseudo();
  7306. break;
  7307. case tokens.comma:
  7308. this.comma();
  7309. break;
  7310. case tokens.asterisk:
  7311. this.universal();
  7312. break;
  7313. case tokens.ampersand:
  7314. this.nesting();
  7315. break;
  7316. case tokens.slash:
  7317. case tokens.combinator:
  7318. this.combinator();
  7319. break;
  7320. case tokens.str:
  7321. this.string();
  7322. break;
  7323. // These cases throw; no break needed.
  7324. case tokens.closeSquare:
  7325. this.missingSquareBracket();
  7326. case tokens.semicolon:
  7327. this.missingBackslash();
  7328. default:
  7329. this.unexpected();
  7330. }
  7331. }
  7332. /**
  7333. * Helpers
  7334. */
  7335. ;
  7336. _proto.expected = function expected(description, index, found) {
  7337. if (Array.isArray(description)) {
  7338. var last = description.pop();
  7339. description = description.join(', ') + " or " + last;
  7340. }
  7341. var an = /^[aeiou]/.test(description[0]) ? 'an' : 'a';
  7342. if (!found) {
  7343. return this.error("Expected " + an + " " + description + ".", {
  7344. index: index
  7345. });
  7346. }
  7347. return this.error("Expected " + an + " " + description + ", found \"" + found + "\" instead.", {
  7348. index: index
  7349. });
  7350. };
  7351. _proto.requiredSpace = function requiredSpace(space) {
  7352. return this.options.lossy ? ' ' : space;
  7353. };
  7354. _proto.optionalSpace = function optionalSpace(space) {
  7355. return this.options.lossy ? '' : space;
  7356. };
  7357. _proto.lossySpace = function lossySpace(space, required) {
  7358. if (this.options.lossy) {
  7359. return required ? ' ' : '';
  7360. } else {
  7361. return space;
  7362. }
  7363. };
  7364. _proto.parseParenthesisToken = function parseParenthesisToken(token) {
  7365. var content = this.content(token);
  7366. if (token[_tokenize.FIELDS.TYPE] === tokens.space) {
  7367. return this.requiredSpace(content);
  7368. } else {
  7369. return content;
  7370. }
  7371. };
  7372. _proto.newNode = function newNode(node, namespace) {
  7373. if (namespace) {
  7374. if (/^ +$/.test(namespace)) {
  7375. if (!this.options.lossy) {
  7376. this.spaces = (this.spaces || '') + namespace;
  7377. }
  7378. namespace = true;
  7379. }
  7380. node.namespace = namespace;
  7381. unescapeProp(node, "namespace");
  7382. }
  7383. if (this.spaces) {
  7384. node.spaces.before = this.spaces;
  7385. this.spaces = '';
  7386. }
  7387. return this.current.append(node);
  7388. };
  7389. _proto.content = function content(token) {
  7390. if (token === void 0) {
  7391. token = this.currToken;
  7392. }
  7393. return this.css.slice(token[_tokenize.FIELDS.START_POS], token[_tokenize.FIELDS.END_POS]);
  7394. };
  7395. /**
  7396. * returns the index of the next non-whitespace, non-comment token.
  7397. * returns -1 if no meaningful token is found.
  7398. */
  7399. _proto.locateNextMeaningfulToken = function locateNextMeaningfulToken(startPosition) {
  7400. if (startPosition === void 0) {
  7401. startPosition = this.position + 1;
  7402. }
  7403. var searchPosition = startPosition;
  7404. while (searchPosition < this.tokens.length) {
  7405. if (WHITESPACE_EQUIV_TOKENS[this.tokens[searchPosition][_tokenize.FIELDS.TYPE]]) {
  7406. searchPosition++;
  7407. continue;
  7408. } else {
  7409. return searchPosition;
  7410. }
  7411. }
  7412. return -1;
  7413. };
  7414. _createClass(Parser, [{
  7415. key: "currToken",
  7416. get: function get() {
  7417. return this.tokens[this.position];
  7418. }
  7419. }, {
  7420. key: "nextToken",
  7421. get: function get() {
  7422. return this.tokens[this.position + 1];
  7423. }
  7424. }, {
  7425. key: "prevToken",
  7426. get: function get() {
  7427. return this.tokens[this.position - 1];
  7428. }
  7429. }]);
  7430. return Parser;
  7431. }();
  7432. exports["default"] = Parser;
  7433. module.exports = exports.default;
  7434. });
  7435. var processor = createCommonjsModule(function (module, exports) {
  7436. exports.__esModule = true;
  7437. exports["default"] = void 0;
  7438. var _parser = _interopRequireDefault(parser);
  7439. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  7440. var Processor = /*#__PURE__*/function () {
  7441. function Processor(func, options) {
  7442. this.func = func || function noop() {};
  7443. this.funcRes = null;
  7444. this.options = options;
  7445. }
  7446. var _proto = Processor.prototype;
  7447. _proto._shouldUpdateSelector = function _shouldUpdateSelector(rule, options) {
  7448. if (options === void 0) {
  7449. options = {};
  7450. }
  7451. var merged = Object.assign({}, this.options, options);
  7452. if (merged.updateSelector === false) {
  7453. return false;
  7454. } else {
  7455. return typeof rule !== "string";
  7456. }
  7457. };
  7458. _proto._isLossy = function _isLossy(options) {
  7459. if (options === void 0) {
  7460. options = {};
  7461. }
  7462. var merged = Object.assign({}, this.options, options);
  7463. if (merged.lossless === false) {
  7464. return true;
  7465. } else {
  7466. return false;
  7467. }
  7468. };
  7469. _proto._root = function _root(rule, options) {
  7470. if (options === void 0) {
  7471. options = {};
  7472. }
  7473. var parser = new _parser["default"](rule, this._parseOptions(options));
  7474. return parser.root;
  7475. };
  7476. _proto._parseOptions = function _parseOptions(options) {
  7477. return {
  7478. lossy: this._isLossy(options)
  7479. };
  7480. };
  7481. _proto._run = function _run(rule, options) {
  7482. var _this = this;
  7483. if (options === void 0) {
  7484. options = {};
  7485. }
  7486. return new Promise(function (resolve, reject) {
  7487. try {
  7488. var root = _this._root(rule, options);
  7489. Promise.resolve(_this.func(root)).then(function (transform) {
  7490. var string = undefined;
  7491. if (_this._shouldUpdateSelector(rule, options)) {
  7492. string = root.toString();
  7493. rule.selector = string;
  7494. }
  7495. return {
  7496. transform: transform,
  7497. root: root,
  7498. string: string
  7499. };
  7500. }).then(resolve, reject);
  7501. } catch (e) {
  7502. reject(e);
  7503. return;
  7504. }
  7505. });
  7506. };
  7507. _proto._runSync = function _runSync(rule, options) {
  7508. if (options === void 0) {
  7509. options = {};
  7510. }
  7511. var root = this._root(rule, options);
  7512. var transform = this.func(root);
  7513. if (transform && typeof transform.then === "function") {
  7514. throw new Error("Selector processor returned a promise to a synchronous call.");
  7515. }
  7516. var string = undefined;
  7517. if (options.updateSelector && typeof rule !== "string") {
  7518. string = root.toString();
  7519. rule.selector = string;
  7520. }
  7521. return {
  7522. transform: transform,
  7523. root: root,
  7524. string: string
  7525. };
  7526. }
  7527. /**
  7528. * Process rule into a selector AST.
  7529. *
  7530. * @param rule {postcss.Rule | string} The css selector to be processed
  7531. * @param options The options for processing
  7532. * @returns {Promise<parser.Root>} The AST of the selector after processing it.
  7533. */
  7534. ;
  7535. _proto.ast = function ast(rule, options) {
  7536. return this._run(rule, options).then(function (result) {
  7537. return result.root;
  7538. });
  7539. }
  7540. /**
  7541. * Process rule into a selector AST synchronously.
  7542. *
  7543. * @param rule {postcss.Rule | string} The css selector to be processed
  7544. * @param options The options for processing
  7545. * @returns {parser.Root} The AST of the selector after processing it.
  7546. */
  7547. ;
  7548. _proto.astSync = function astSync(rule, options) {
  7549. return this._runSync(rule, options).root;
  7550. }
  7551. /**
  7552. * Process a selector into a transformed value asynchronously
  7553. *
  7554. * @param rule {postcss.Rule | string} The css selector to be processed
  7555. * @param options The options for processing
  7556. * @returns {Promise<any>} The value returned by the processor.
  7557. */
  7558. ;
  7559. _proto.transform = function transform(rule, options) {
  7560. return this._run(rule, options).then(function (result) {
  7561. return result.transform;
  7562. });
  7563. }
  7564. /**
  7565. * Process a selector into a transformed value synchronously.
  7566. *
  7567. * @param rule {postcss.Rule | string} The css selector to be processed
  7568. * @param options The options for processing
  7569. * @returns {any} The value returned by the processor.
  7570. */
  7571. ;
  7572. _proto.transformSync = function transformSync(rule, options) {
  7573. return this._runSync(rule, options).transform;
  7574. }
  7575. /**
  7576. * Process a selector into a new selector string asynchronously.
  7577. *
  7578. * @param rule {postcss.Rule | string} The css selector to be processed
  7579. * @param options The options for processing
  7580. * @returns {string} the selector after processing.
  7581. */
  7582. ;
  7583. _proto.process = function process(rule, options) {
  7584. return this._run(rule, options).then(function (result) {
  7585. return result.string || result.root.toString();
  7586. });
  7587. }
  7588. /**
  7589. * Process a selector into a new selector string synchronously.
  7590. *
  7591. * @param rule {postcss.Rule | string} The css selector to be processed
  7592. * @param options The options for processing
  7593. * @returns {string} the selector after processing.
  7594. */
  7595. ;
  7596. _proto.processSync = function processSync(rule, options) {
  7597. var result = this._runSync(rule, options);
  7598. return result.string || result.root.toString();
  7599. };
  7600. return Processor;
  7601. }();
  7602. exports["default"] = Processor;
  7603. module.exports = exports.default;
  7604. });
  7605. var constructors = createCommonjsModule(function (module, exports) {
  7606. exports.__esModule = true;
  7607. 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;
  7608. var _attribute = _interopRequireDefault(attribute);
  7609. var _className = _interopRequireDefault(className);
  7610. var _combinator = _interopRequireDefault(combinator);
  7611. var _comment = _interopRequireDefault(comment);
  7612. var _id = _interopRequireDefault(id);
  7613. var _nesting = _interopRequireDefault(nesting);
  7614. var _pseudo = _interopRequireDefault(pseudo);
  7615. var _root = _interopRequireDefault(root);
  7616. var _selector = _interopRequireDefault(selector);
  7617. var _string = _interopRequireDefault(string);
  7618. var _tag = _interopRequireDefault(tag);
  7619. var _universal = _interopRequireDefault(universal);
  7620. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  7621. var attribute$1 = function attribute(opts) {
  7622. return new _attribute["default"](opts);
  7623. };
  7624. exports.attribute = attribute$1;
  7625. var className$1 = function className(opts) {
  7626. return new _className["default"](opts);
  7627. };
  7628. exports.className = className$1;
  7629. var combinator$1 = function combinator(opts) {
  7630. return new _combinator["default"](opts);
  7631. };
  7632. exports.combinator = combinator$1;
  7633. var comment$1 = function comment(opts) {
  7634. return new _comment["default"](opts);
  7635. };
  7636. exports.comment = comment$1;
  7637. var id$1 = function id(opts) {
  7638. return new _id["default"](opts);
  7639. };
  7640. exports.id = id$1;
  7641. var nesting$1 = function nesting(opts) {
  7642. return new _nesting["default"](opts);
  7643. };
  7644. exports.nesting = nesting$1;
  7645. var pseudo$1 = function pseudo(opts) {
  7646. return new _pseudo["default"](opts);
  7647. };
  7648. exports.pseudo = pseudo$1;
  7649. var root$1 = function root(opts) {
  7650. return new _root["default"](opts);
  7651. };
  7652. exports.root = root$1;
  7653. var selector$1 = function selector(opts) {
  7654. return new _selector["default"](opts);
  7655. };
  7656. exports.selector = selector$1;
  7657. var string$1 = function string(opts) {
  7658. return new _string["default"](opts);
  7659. };
  7660. exports.string = string$1;
  7661. var tag$1 = function tag(opts) {
  7662. return new _tag["default"](opts);
  7663. };
  7664. exports.tag = tag$1;
  7665. var universal$1 = function universal(opts) {
  7666. return new _universal["default"](opts);
  7667. };
  7668. exports.universal = universal$1;
  7669. });
  7670. var guards = createCommonjsModule(function (module, exports) {
  7671. exports.__esModule = true;
  7672. exports.isNode = isNode;
  7673. exports.isPseudoElement = isPseudoElement;
  7674. exports.isPseudoClass = isPseudoClass;
  7675. exports.isContainer = isContainer;
  7676. exports.isNamespace = isNamespace;
  7677. 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;
  7678. var _IS_TYPE;
  7679. 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);
  7680. function isNode(node) {
  7681. return typeof node === "object" && IS_TYPE[node.type];
  7682. }
  7683. function isNodeType(type, node) {
  7684. return isNode(node) && node.type === type;
  7685. }
  7686. var isAttribute = isNodeType.bind(null, types.ATTRIBUTE);
  7687. exports.isAttribute = isAttribute;
  7688. var isClassName = isNodeType.bind(null, types.CLASS);
  7689. exports.isClassName = isClassName;
  7690. var isCombinator = isNodeType.bind(null, types.COMBINATOR);
  7691. exports.isCombinator = isCombinator;
  7692. var isComment = isNodeType.bind(null, types.COMMENT);
  7693. exports.isComment = isComment;
  7694. var isIdentifier = isNodeType.bind(null, types.ID);
  7695. exports.isIdentifier = isIdentifier;
  7696. var isNesting = isNodeType.bind(null, types.NESTING);
  7697. exports.isNesting = isNesting;
  7698. var isPseudo = isNodeType.bind(null, types.PSEUDO);
  7699. exports.isPseudo = isPseudo;
  7700. var isRoot = isNodeType.bind(null, types.ROOT);
  7701. exports.isRoot = isRoot;
  7702. var isSelector = isNodeType.bind(null, types.SELECTOR);
  7703. exports.isSelector = isSelector;
  7704. var isString = isNodeType.bind(null, types.STRING);
  7705. exports.isString = isString;
  7706. var isTag = isNodeType.bind(null, types.TAG);
  7707. exports.isTag = isTag;
  7708. var isUniversal = isNodeType.bind(null, types.UNIVERSAL);
  7709. exports.isUniversal = isUniversal;
  7710. function isPseudoElement(node) {
  7711. return isPseudo(node) && node.value && (node.value.startsWith("::") || node.value.toLowerCase() === ":before" || node.value.toLowerCase() === ":after");
  7712. }
  7713. function isPseudoClass(node) {
  7714. return isPseudo(node) && !isPseudoElement(node);
  7715. }
  7716. function isContainer(node) {
  7717. return !!(isNode(node) && node.walk);
  7718. }
  7719. function isNamespace(node) {
  7720. return isAttribute(node) || isTag(node);
  7721. }
  7722. });
  7723. var selectors = createCommonjsModule(function (module, exports) {
  7724. exports.__esModule = true;
  7725. Object.keys(types).forEach(function (key) {
  7726. if (key === "default" || key === "__esModule") return;
  7727. if (key in exports && exports[key] === types[key]) return;
  7728. exports[key] = types[key];
  7729. });
  7730. Object.keys(constructors).forEach(function (key) {
  7731. if (key === "default" || key === "__esModule") return;
  7732. if (key in exports && exports[key] === constructors[key]) return;
  7733. exports[key] = constructors[key];
  7734. });
  7735. Object.keys(guards).forEach(function (key) {
  7736. if (key === "default" || key === "__esModule") return;
  7737. if (key in exports && exports[key] === guards[key]) return;
  7738. exports[key] = guards[key];
  7739. });
  7740. });
  7741. var dist = createCommonjsModule(function (module, exports) {
  7742. exports.__esModule = true;
  7743. exports["default"] = void 0;
  7744. var _processor = _interopRequireDefault(processor);
  7745. var selectors$1 = _interopRequireWildcard(selectors);
  7746. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
  7747. 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; }
  7748. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  7749. var parser = function parser(processor) {
  7750. return new _processor["default"](processor);
  7751. };
  7752. Object.assign(parser, selectors$1);
  7753. delete parser.__esModule;
  7754. var _default = parser;
  7755. exports["default"] = _default;
  7756. module.exports = exports.default;
  7757. });
  7758. var selectorParser = /*@__PURE__*/getDefaultExportFromCjs(dist);
  7759. const animationNameRE = /^(-\w+-)?animation-name$/;
  7760. const animationRE = /^(-\w+-)?animation$/;
  7761. const scopedPlugin = (id = '') => {
  7762. const keyframes = Object.create(null);
  7763. const shortId = id.replace(/^data-v-/, '');
  7764. return {
  7765. postcssPlugin: 'vue-sfc-scoped',
  7766. Rule(rule) {
  7767. processRule(id, rule);
  7768. },
  7769. AtRule(node) {
  7770. if (/-?keyframes$/.test(node.name) &&
  7771. !node.params.endsWith(`-${shortId}`)) {
  7772. // register keyframes
  7773. keyframes[node.params] = node.params = node.params + '-' + shortId;
  7774. }
  7775. },
  7776. OnceExit(root) {
  7777. if (Object.keys(keyframes).length) {
  7778. // If keyframes are found in this <style>, find and rewrite animation names
  7779. // in declarations.
  7780. // Caveat: this only works for keyframes and animation rules in the same
  7781. // <style> element.
  7782. // individual animation-name declaration
  7783. root.walkDecls(decl => {
  7784. if (animationNameRE.test(decl.prop)) {
  7785. decl.value = decl.value
  7786. .split(',')
  7787. .map(v => keyframes[v.trim()] || v.trim())
  7788. .join(',');
  7789. }
  7790. // shorthand
  7791. if (animationRE.test(decl.prop)) {
  7792. decl.value = decl.value
  7793. .split(',')
  7794. .map(v => {
  7795. const vals = v.trim().split(/\s+/);
  7796. const i = vals.findIndex(val => keyframes[val]);
  7797. if (i !== -1) {
  7798. vals.splice(i, 1, keyframes[vals[i]]);
  7799. return vals.join(' ');
  7800. }
  7801. else {
  7802. return v;
  7803. }
  7804. })
  7805. .join(',');
  7806. }
  7807. });
  7808. }
  7809. }
  7810. };
  7811. };
  7812. const processedRules = new WeakSet();
  7813. function processRule(id, rule) {
  7814. if (processedRules.has(rule) ||
  7815. (rule.parent &&
  7816. rule.parent.type === 'atrule' &&
  7817. /-?keyframes$/.test(rule.parent.name))) {
  7818. return;
  7819. }
  7820. processedRules.add(rule);
  7821. rule.selector = selectorParser(selectorRoot => {
  7822. selectorRoot.each(selector => {
  7823. rewriteSelector(id, selector, selectorRoot);
  7824. });
  7825. }).processSync(rule.selector);
  7826. }
  7827. function rewriteSelector(id, selector, selectorRoot, slotted = false) {
  7828. let node = null;
  7829. let shouldInject = true;
  7830. // find the last child node to insert attribute selector
  7831. selector.each(n => {
  7832. // DEPRECATED ">>>" and "/deep/" combinator
  7833. if (n.type === 'combinator' &&
  7834. (n.value === '>>>' || n.value === '/deep/')) {
  7835. n.value = ' ';
  7836. n.spaces.before = n.spaces.after = '';
  7837. warn(`the >>> and /deep/ combinators have been deprecated. ` +
  7838. `Use :deep() instead.`);
  7839. return false;
  7840. }
  7841. if (n.type === 'pseudo') {
  7842. const { value } = n;
  7843. // deep: inject [id] attribute at the node before the ::v-deep
  7844. // combinator.
  7845. if (value === ':deep' || value === '::v-deep') {
  7846. if (n.nodes.length) {
  7847. // .foo ::v-deep(.bar) -> .foo[xxxxxxx] .bar
  7848. // replace the current node with ::v-deep's inner selector
  7849. let last = n;
  7850. n.nodes[0].each(ss => {
  7851. selector.insertAfter(last, ss);
  7852. last = ss;
  7853. });
  7854. // insert a space combinator before if it doesn't already have one
  7855. const prev = selector.at(selector.index(n) - 1);
  7856. if (!prev || !isSpaceCombinator(prev)) {
  7857. selector.insertAfter(n, selectorParser.combinator({
  7858. value: ' '
  7859. }));
  7860. }
  7861. selector.removeChild(n);
  7862. }
  7863. else {
  7864. // DEPRECATED usage
  7865. // .foo ::v-deep .bar -> .foo[xxxxxxx] .bar
  7866. warn(`::v-deep usage as a combinator has ` +
  7867. `been deprecated. Use :deep(<inner-selector>) instead.`);
  7868. const prev = selector.at(selector.index(n) - 1);
  7869. if (prev && isSpaceCombinator(prev)) {
  7870. selector.removeChild(prev);
  7871. }
  7872. selector.removeChild(n);
  7873. }
  7874. return false;
  7875. }
  7876. // slot: use selector inside `::v-slotted` and inject [id + '-s']
  7877. // instead.
  7878. // ::v-slotted(.foo) -> .foo[xxxxxxx-s]
  7879. if (value === ':slotted' || value === '::v-slotted') {
  7880. rewriteSelector(id, n.nodes[0], selectorRoot, true /* slotted */);
  7881. let last = n;
  7882. n.nodes[0].each(ss => {
  7883. selector.insertAfter(last, ss);
  7884. last = ss;
  7885. });
  7886. // selector.insertAfter(n, n.nodes[0])
  7887. selector.removeChild(n);
  7888. // since slotted attribute already scopes the selector there's no
  7889. // need for the non-slot attribute.
  7890. shouldInject = false;
  7891. return false;
  7892. }
  7893. // global: replace with inner selector and do not inject [id].
  7894. // ::v-global(.foo) -> .foo
  7895. if (value === ':global' || value === '::v-global') {
  7896. selectorRoot.insertAfter(selector, n.nodes[0]);
  7897. selectorRoot.removeChild(selector);
  7898. return false;
  7899. }
  7900. }
  7901. if (n.type !== 'pseudo' && n.type !== 'combinator') {
  7902. node = n;
  7903. }
  7904. });
  7905. if (node) {
  7906. node.spaces.after = '';
  7907. }
  7908. else {
  7909. // For deep selectors & standalone pseudo selectors,
  7910. // the attribute selectors are prepended rather than appended.
  7911. // So all leading spaces must be eliminated to avoid problems.
  7912. selector.first.spaces.before = '';
  7913. }
  7914. if (shouldInject) {
  7915. const idToAdd = slotted ? id + '-s' : id;
  7916. selector.insertAfter(
  7917. // If node is null it means we need to inject [id] at the start
  7918. // insertAfter can handle `null` here
  7919. node, selectorParser.attribute({
  7920. attribute: idToAdd,
  7921. value: idToAdd,
  7922. raws: {},
  7923. quoteMark: `"`
  7924. }));
  7925. }
  7926. }
  7927. function isSpaceCombinator(node) {
  7928. return node.type === 'combinator' && /^\s+$/.test(node.value);
  7929. }
  7930. scopedPlugin.postcss = true;
  7931. var SourceMapConsumer = sourceMap__default.SourceMapConsumer;
  7932. var SourceMapGenerator = sourceMap__default.SourceMapGenerator;
  7933. var mergeSourceMap = merge$1;
  7934. /**
  7935. * Merge old source map and new source map and return merged.
  7936. * If old or new source map value is falsy, return another one as it is.
  7937. *
  7938. * @param {object|string} [oldMap] old source map object
  7939. * @param {object|string} [newmap] new source map object
  7940. * @return {object|undefined} merged source map object, or undefined when both old and new source map are undefined
  7941. */
  7942. function merge$1(oldMap, newMap) {
  7943. if (!oldMap) return newMap
  7944. if (!newMap) return oldMap
  7945. var oldMapConsumer = new SourceMapConsumer(oldMap);
  7946. var newMapConsumer = new SourceMapConsumer(newMap);
  7947. var mergedMapGenerator = new SourceMapGenerator();
  7948. // iterate on new map and overwrite original position of new map with one of old map
  7949. newMapConsumer.eachMapping(function(m) {
  7950. // pass when `originalLine` is null.
  7951. // It occurs in case that the node does not have origin in original code.
  7952. if (m.originalLine == null) return
  7953. var origPosInOldMap = oldMapConsumer.originalPositionFor({
  7954. line: m.originalLine,
  7955. column: m.originalColumn
  7956. });
  7957. if (origPosInOldMap.source == null) return
  7958. mergedMapGenerator.addMapping({
  7959. original: {
  7960. line: origPosInOldMap.line,
  7961. column: origPosInOldMap.column
  7962. },
  7963. generated: {
  7964. line: m.generatedLine,
  7965. column: m.generatedColumn
  7966. },
  7967. source: origPosInOldMap.source,
  7968. name: origPosInOldMap.name
  7969. });
  7970. });
  7971. var consumers = [oldMapConsumer, newMapConsumer];
  7972. consumers.forEach(function(consumer) {
  7973. consumer.sources.forEach(function(sourceFile) {
  7974. mergedMapGenerator._sources.add(sourceFile);
  7975. var sourceContent = consumer.sourceContentFor(sourceFile);
  7976. if (sourceContent != null) {
  7977. mergedMapGenerator.setSourceContent(sourceFile, sourceContent);
  7978. }
  7979. });
  7980. });
  7981. mergedMapGenerator._sourceRoot = oldMap.sourceRoot;
  7982. mergedMapGenerator._file = oldMap.file;
  7983. return JSON.parse(mergedMapGenerator.toString())
  7984. }
  7985. // .scss/.sass processor
  7986. const scss = (source, map, options, load = require) => {
  7987. const nodeSass = load('sass');
  7988. const finalOptions = Object.assign(Object.assign({}, options), { data: getSource(source, options.filename, options.additionalData), file: options.filename, outFile: options.filename, sourceMap: !!map });
  7989. try {
  7990. const result = nodeSass.renderSync(finalOptions);
  7991. const dependencies = result.stats.includedFiles;
  7992. if (map) {
  7993. return {
  7994. code: result.css.toString(),
  7995. map: mergeSourceMap(map, JSON.parse(result.map.toString())),
  7996. errors: [],
  7997. dependencies
  7998. };
  7999. }
  8000. return { code: result.css.toString(), errors: [], dependencies };
  8001. }
  8002. catch (e) {
  8003. return { code: '', errors: [e], dependencies: [] };
  8004. }
  8005. };
  8006. const sass = (source, map, options, load) => scss(source, map, Object.assign(Object.assign({}, options), { indentedSyntax: true }), load);
  8007. // .less
  8008. const less = (source, map, options, load = require) => {
  8009. const nodeLess = load('less');
  8010. let result;
  8011. let error = null;
  8012. nodeLess.render(getSource(source, options.filename, options.additionalData), Object.assign(Object.assign({}, options), { syncImport: true }), (err, output) => {
  8013. error = err;
  8014. result = output;
  8015. });
  8016. if (error)
  8017. return { code: '', errors: [error], dependencies: [] };
  8018. const dependencies = result.imports;
  8019. if (map) {
  8020. return {
  8021. code: result.css.toString(),
  8022. map: mergeSourceMap(map, result.map),
  8023. errors: [],
  8024. dependencies: dependencies
  8025. };
  8026. }
  8027. return {
  8028. code: result.css.toString(),
  8029. errors: [],
  8030. dependencies: dependencies
  8031. };
  8032. };
  8033. // .styl
  8034. const styl = (source, map, options, load = require) => {
  8035. const nodeStylus = load('stylus');
  8036. try {
  8037. const ref = nodeStylus(source);
  8038. Object.keys(options).forEach(key => ref.set(key, options[key]));
  8039. if (map)
  8040. ref.set('sourcemap', { inline: false, comment: false });
  8041. const result = ref.render();
  8042. const dependencies = ref.deps();
  8043. if (map) {
  8044. return {
  8045. code: result,
  8046. map: mergeSourceMap(map, ref.sourcemap),
  8047. errors: [],
  8048. dependencies
  8049. };
  8050. }
  8051. return { code: result, errors: [], dependencies };
  8052. }
  8053. catch (e) {
  8054. return { code: '', errors: [e], dependencies: [] };
  8055. }
  8056. };
  8057. function getSource(source, filename, additionalData) {
  8058. if (!additionalData)
  8059. return source;
  8060. if (shared.isFunction(additionalData)) {
  8061. return additionalData(source, filename);
  8062. }
  8063. return additionalData + source;
  8064. }
  8065. const processors = {
  8066. less,
  8067. sass,
  8068. scss,
  8069. styl,
  8070. stylus: styl
  8071. };
  8072. /**
  8073. * lodash (Custom Build) <https://lodash.com/>
  8074. * Build: `lodash modularize exports="npm" -o ./`
  8075. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  8076. * Released under MIT license <https://lodash.com/license>
  8077. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  8078. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  8079. */
  8080. /** Used as references for various `Number` constants. */
  8081. var INFINITY = 1 / 0;
  8082. /** `Object#toString` result references. */
  8083. var symbolTag = '[object Symbol]';
  8084. /** Used to match words composed of alphanumeric characters. */
  8085. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  8086. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  8087. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  8088. /** Used to compose unicode character classes. */
  8089. var rsAstralRange = '\\ud800-\\udfff',
  8090. rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
  8091. rsComboSymbolsRange = '\\u20d0-\\u20f0',
  8092. rsDingbatRange = '\\u2700-\\u27bf',
  8093. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  8094. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  8095. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  8096. rsPunctuationRange = '\\u2000-\\u206f',
  8097. 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',
  8098. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  8099. rsVarRange = '\\ufe0e\\ufe0f',
  8100. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  8101. /** Used to compose unicode capture groups. */
  8102. var rsApos = "['\u2019]",
  8103. rsAstral = '[' + rsAstralRange + ']',
  8104. rsBreak = '[' + rsBreakRange + ']',
  8105. rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
  8106. rsDigits = '\\d+',
  8107. rsDingbat = '[' + rsDingbatRange + ']',
  8108. rsLower = '[' + rsLowerRange + ']',
  8109. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  8110. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  8111. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  8112. rsNonAstral = '[^' + rsAstralRange + ']',
  8113. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  8114. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  8115. rsUpper = '[' + rsUpperRange + ']',
  8116. rsZWJ = '\\u200d';
  8117. /** Used to compose unicode regexes. */
  8118. var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
  8119. rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
  8120. rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  8121. rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  8122. reOptMod = rsModifier + '?',
  8123. rsOptVar = '[' + rsVarRange + ']?',
  8124. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  8125. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  8126. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  8127. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  8128. /** Used to match apostrophes. */
  8129. var reApos = RegExp(rsApos, 'g');
  8130. /**
  8131. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  8132. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  8133. */
  8134. var reComboMark = RegExp(rsCombo, 'g');
  8135. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  8136. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  8137. /** Used to match complex or compound words. */
  8138. var reUnicodeWord = RegExp([
  8139. rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  8140. rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
  8141. rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
  8142. rsUpper + '+' + rsOptUpperContr,
  8143. rsDigits,
  8144. rsEmoji
  8145. ].join('|'), 'g');
  8146. /** 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/). */
  8147. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
  8148. /** Used to detect strings that need a more robust regexp to match words. */
  8149. 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 ]/;
  8150. /** Used to map Latin Unicode letters to basic Latin letters. */
  8151. var deburredLetters = {
  8152. // Latin-1 Supplement block.
  8153. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  8154. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  8155. '\xc7': 'C', '\xe7': 'c',
  8156. '\xd0': 'D', '\xf0': 'd',
  8157. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  8158. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  8159. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  8160. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  8161. '\xd1': 'N', '\xf1': 'n',
  8162. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  8163. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  8164. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  8165. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  8166. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  8167. '\xc6': 'Ae', '\xe6': 'ae',
  8168. '\xde': 'Th', '\xfe': 'th',
  8169. '\xdf': 'ss',
  8170. // Latin Extended-A block.
  8171. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  8172. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  8173. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  8174. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  8175. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  8176. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  8177. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  8178. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  8179. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  8180. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  8181. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  8182. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  8183. '\u0134': 'J', '\u0135': 'j',
  8184. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  8185. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  8186. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  8187. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  8188. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  8189. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  8190. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  8191. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  8192. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  8193. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  8194. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  8195. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  8196. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  8197. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  8198. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  8199. '\u0174': 'W', '\u0175': 'w',
  8200. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  8201. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  8202. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  8203. '\u0132': 'IJ', '\u0133': 'ij',
  8204. '\u0152': 'Oe', '\u0153': 'oe',
  8205. '\u0149': "'n", '\u017f': 'ss'
  8206. };
  8207. /** Detect free variable `global` from Node.js. */
  8208. var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
  8209. /** Detect free variable `self`. */
  8210. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  8211. /** Used as a reference to the global object. */
  8212. var root$1 = freeGlobal || freeSelf || Function('return this')();
  8213. /**
  8214. * A specialized version of `_.reduce` for arrays without support for
  8215. * iteratee shorthands.
  8216. *
  8217. * @private
  8218. * @param {Array} [array] The array to iterate over.
  8219. * @param {Function} iteratee The function invoked per iteration.
  8220. * @param {*} [accumulator] The initial value.
  8221. * @param {boolean} [initAccum] Specify using the first element of `array` as
  8222. * the initial value.
  8223. * @returns {*} Returns the accumulated value.
  8224. */
  8225. function arrayReduce(array, iteratee, accumulator, initAccum) {
  8226. var index = -1,
  8227. length = array ? array.length : 0;
  8228. if (initAccum && length) {
  8229. accumulator = array[++index];
  8230. }
  8231. while (++index < length) {
  8232. accumulator = iteratee(accumulator, array[index], index, array);
  8233. }
  8234. return accumulator;
  8235. }
  8236. /**
  8237. * Converts an ASCII `string` to an array.
  8238. *
  8239. * @private
  8240. * @param {string} string The string to convert.
  8241. * @returns {Array} Returns the converted array.
  8242. */
  8243. function asciiToArray(string) {
  8244. return string.split('');
  8245. }
  8246. /**
  8247. * Splits an ASCII `string` into an array of its words.
  8248. *
  8249. * @private
  8250. * @param {string} The string to inspect.
  8251. * @returns {Array} Returns the words of `string`.
  8252. */
  8253. function asciiWords(string) {
  8254. return string.match(reAsciiWord) || [];
  8255. }
  8256. /**
  8257. * The base implementation of `_.propertyOf` without support for deep paths.
  8258. *
  8259. * @private
  8260. * @param {Object} object The object to query.
  8261. * @returns {Function} Returns the new accessor function.
  8262. */
  8263. function basePropertyOf(object) {
  8264. return function(key) {
  8265. return object == null ? undefined : object[key];
  8266. };
  8267. }
  8268. /**
  8269. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  8270. * letters to basic Latin letters.
  8271. *
  8272. * @private
  8273. * @param {string} letter The matched letter to deburr.
  8274. * @returns {string} Returns the deburred letter.
  8275. */
  8276. var deburrLetter = basePropertyOf(deburredLetters);
  8277. /**
  8278. * Checks if `string` contains Unicode symbols.
  8279. *
  8280. * @private
  8281. * @param {string} string The string to inspect.
  8282. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  8283. */
  8284. function hasUnicode(string) {
  8285. return reHasUnicode.test(string);
  8286. }
  8287. /**
  8288. * Checks if `string` contains a word composed of Unicode symbols.
  8289. *
  8290. * @private
  8291. * @param {string} string The string to inspect.
  8292. * @returns {boolean} Returns `true` if a word is found, else `false`.
  8293. */
  8294. function hasUnicodeWord(string) {
  8295. return reHasUnicodeWord.test(string);
  8296. }
  8297. /**
  8298. * Converts `string` to an array.
  8299. *
  8300. * @private
  8301. * @param {string} string The string to convert.
  8302. * @returns {Array} Returns the converted array.
  8303. */
  8304. function stringToArray(string) {
  8305. return hasUnicode(string)
  8306. ? unicodeToArray(string)
  8307. : asciiToArray(string);
  8308. }
  8309. /**
  8310. * Converts a Unicode `string` to an array.
  8311. *
  8312. * @private
  8313. * @param {string} string The string to convert.
  8314. * @returns {Array} Returns the converted array.
  8315. */
  8316. function unicodeToArray(string) {
  8317. return string.match(reUnicode) || [];
  8318. }
  8319. /**
  8320. * Splits a Unicode `string` into an array of its words.
  8321. *
  8322. * @private
  8323. * @param {string} The string to inspect.
  8324. * @returns {Array} Returns the words of `string`.
  8325. */
  8326. function unicodeWords(string) {
  8327. return string.match(reUnicodeWord) || [];
  8328. }
  8329. /** Used for built-in method references. */
  8330. var objectProto = Object.prototype;
  8331. /**
  8332. * Used to resolve the
  8333. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  8334. * of values.
  8335. */
  8336. var objectToString = objectProto.toString;
  8337. /** Built-in value references. */
  8338. var Symbol$1 = root$1.Symbol;
  8339. /** Used to convert symbols to primitives and strings. */
  8340. var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
  8341. symbolToString = symbolProto ? symbolProto.toString : undefined;
  8342. /**
  8343. * The base implementation of `_.slice` without an iteratee call guard.
  8344. *
  8345. * @private
  8346. * @param {Array} array The array to slice.
  8347. * @param {number} [start=0] The start position.
  8348. * @param {number} [end=array.length] The end position.
  8349. * @returns {Array} Returns the slice of `array`.
  8350. */
  8351. function baseSlice(array, start, end) {
  8352. var index = -1,
  8353. length = array.length;
  8354. if (start < 0) {
  8355. start = -start > length ? 0 : (length + start);
  8356. }
  8357. end = end > length ? length : end;
  8358. if (end < 0) {
  8359. end += length;
  8360. }
  8361. length = start > end ? 0 : ((end - start) >>> 0);
  8362. start >>>= 0;
  8363. var result = Array(length);
  8364. while (++index < length) {
  8365. result[index] = array[index + start];
  8366. }
  8367. return result;
  8368. }
  8369. /**
  8370. * The base implementation of `_.toString` which doesn't convert nullish
  8371. * values to empty strings.
  8372. *
  8373. * @private
  8374. * @param {*} value The value to process.
  8375. * @returns {string} Returns the string.
  8376. */
  8377. function baseToString(value) {
  8378. // Exit early for strings to avoid a performance hit in some environments.
  8379. if (typeof value == 'string') {
  8380. return value;
  8381. }
  8382. if (isSymbol(value)) {
  8383. return symbolToString ? symbolToString.call(value) : '';
  8384. }
  8385. var result = (value + '');
  8386. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  8387. }
  8388. /**
  8389. * Casts `array` to a slice if it's needed.
  8390. *
  8391. * @private
  8392. * @param {Array} array The array to inspect.
  8393. * @param {number} start The start position.
  8394. * @param {number} [end=array.length] The end position.
  8395. * @returns {Array} Returns the cast slice.
  8396. */
  8397. function castSlice(array, start, end) {
  8398. var length = array.length;
  8399. end = end === undefined ? length : end;
  8400. return (!start && end >= length) ? array : baseSlice(array, start, end);
  8401. }
  8402. /**
  8403. * Creates a function like `_.lowerFirst`.
  8404. *
  8405. * @private
  8406. * @param {string} methodName The name of the `String` case method to use.
  8407. * @returns {Function} Returns the new case function.
  8408. */
  8409. function createCaseFirst(methodName) {
  8410. return function(string) {
  8411. string = toString$1(string);
  8412. var strSymbols = hasUnicode(string)
  8413. ? stringToArray(string)
  8414. : undefined;
  8415. var chr = strSymbols
  8416. ? strSymbols[0]
  8417. : string.charAt(0);
  8418. var trailing = strSymbols
  8419. ? castSlice(strSymbols, 1).join('')
  8420. : string.slice(1);
  8421. return chr[methodName]() + trailing;
  8422. };
  8423. }
  8424. /**
  8425. * Creates a function like `_.camelCase`.
  8426. *
  8427. * @private
  8428. * @param {Function} callback The function to combine each word.
  8429. * @returns {Function} Returns the new compounder function.
  8430. */
  8431. function createCompounder(callback) {
  8432. return function(string) {
  8433. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  8434. };
  8435. }
  8436. /**
  8437. * Checks if `value` is object-like. A value is object-like if it's not `null`
  8438. * and has a `typeof` result of "object".
  8439. *
  8440. * @static
  8441. * @memberOf _
  8442. * @since 4.0.0
  8443. * @category Lang
  8444. * @param {*} value The value to check.
  8445. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  8446. * @example
  8447. *
  8448. * _.isObjectLike({});
  8449. * // => true
  8450. *
  8451. * _.isObjectLike([1, 2, 3]);
  8452. * // => true
  8453. *
  8454. * _.isObjectLike(_.noop);
  8455. * // => false
  8456. *
  8457. * _.isObjectLike(null);
  8458. * // => false
  8459. */
  8460. function isObjectLike(value) {
  8461. return !!value && typeof value == 'object';
  8462. }
  8463. /**
  8464. * Checks if `value` is classified as a `Symbol` primitive or object.
  8465. *
  8466. * @static
  8467. * @memberOf _
  8468. * @since 4.0.0
  8469. * @category Lang
  8470. * @param {*} value The value to check.
  8471. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  8472. * @example
  8473. *
  8474. * _.isSymbol(Symbol.iterator);
  8475. * // => true
  8476. *
  8477. * _.isSymbol('abc');
  8478. * // => false
  8479. */
  8480. function isSymbol(value) {
  8481. return typeof value == 'symbol' ||
  8482. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  8483. }
  8484. /**
  8485. * Converts `value` to a string. An empty string is returned for `null`
  8486. * and `undefined` values. The sign of `-0` is preserved.
  8487. *
  8488. * @static
  8489. * @memberOf _
  8490. * @since 4.0.0
  8491. * @category Lang
  8492. * @param {*} value The value to process.
  8493. * @returns {string} Returns the string.
  8494. * @example
  8495. *
  8496. * _.toString(null);
  8497. * // => ''
  8498. *
  8499. * _.toString(-0);
  8500. * // => '-0'
  8501. *
  8502. * _.toString([1, 2, 3]);
  8503. * // => '1,2,3'
  8504. */
  8505. function toString$1(value) {
  8506. return value == null ? '' : baseToString(value);
  8507. }
  8508. /**
  8509. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  8510. *
  8511. * @static
  8512. * @memberOf _
  8513. * @since 3.0.0
  8514. * @category String
  8515. * @param {string} [string=''] The string to convert.
  8516. * @returns {string} Returns the camel cased string.
  8517. * @example
  8518. *
  8519. * _.camelCase('Foo Bar');
  8520. * // => 'fooBar'
  8521. *
  8522. * _.camelCase('--foo-bar--');
  8523. * // => 'fooBar'
  8524. *
  8525. * _.camelCase('__FOO_BAR__');
  8526. * // => 'fooBar'
  8527. */
  8528. var camelCase = createCompounder(function(result, word, index) {
  8529. word = word.toLowerCase();
  8530. return result + (index ? capitalize(word) : word);
  8531. });
  8532. /**
  8533. * Converts the first character of `string` to upper case and the remaining
  8534. * to lower case.
  8535. *
  8536. * @static
  8537. * @memberOf _
  8538. * @since 3.0.0
  8539. * @category String
  8540. * @param {string} [string=''] The string to capitalize.
  8541. * @returns {string} Returns the capitalized string.
  8542. * @example
  8543. *
  8544. * _.capitalize('FRED');
  8545. * // => 'Fred'
  8546. */
  8547. function capitalize(string) {
  8548. return upperFirst(toString$1(string).toLowerCase());
  8549. }
  8550. /**
  8551. * Deburrs `string` by converting
  8552. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  8553. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  8554. * letters to basic Latin letters and removing
  8555. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  8556. *
  8557. * @static
  8558. * @memberOf _
  8559. * @since 3.0.0
  8560. * @category String
  8561. * @param {string} [string=''] The string to deburr.
  8562. * @returns {string} Returns the deburred string.
  8563. * @example
  8564. *
  8565. * _.deburr('déjà vu');
  8566. * // => 'deja vu'
  8567. */
  8568. function deburr(string) {
  8569. string = toString$1(string);
  8570. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  8571. }
  8572. /**
  8573. * Converts the first character of `string` to upper case.
  8574. *
  8575. * @static
  8576. * @memberOf _
  8577. * @since 4.0.0
  8578. * @category String
  8579. * @param {string} [string=''] The string to convert.
  8580. * @returns {string} Returns the converted string.
  8581. * @example
  8582. *
  8583. * _.upperFirst('fred');
  8584. * // => 'Fred'
  8585. *
  8586. * _.upperFirst('FRED');
  8587. * // => 'FRED'
  8588. */
  8589. var upperFirst = createCaseFirst('toUpperCase');
  8590. /**
  8591. * Splits `string` into an array of its words.
  8592. *
  8593. * @static
  8594. * @memberOf _
  8595. * @since 3.0.0
  8596. * @category String
  8597. * @param {string} [string=''] The string to inspect.
  8598. * @param {RegExp|string} [pattern] The pattern to match words.
  8599. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  8600. * @returns {Array} Returns the words of `string`.
  8601. * @example
  8602. *
  8603. * _.words('fred, barney, & pebbles');
  8604. * // => ['fred', 'barney', 'pebbles']
  8605. *
  8606. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  8607. * // => ['fred', 'barney', '&', 'pebbles']
  8608. */
  8609. function words(string, pattern, guard) {
  8610. string = toString$1(string);
  8611. pattern = guard ? undefined : pattern;
  8612. if (pattern === undefined) {
  8613. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  8614. }
  8615. return string.match(pattern) || [];
  8616. }
  8617. var lodash_camelcase = camelCase;
  8618. var unicode = createCommonjsModule(function (module, exports) {
  8619. 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]/;
  8620. });
  8621. 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)}
  8622. var util$1 = /*#__PURE__*/Object.defineProperty({
  8623. isSpaceSeparator: isSpaceSeparator_1,
  8624. isIdStartChar: isIdStartChar_1,
  8625. isIdContinueChar: isIdContinueChar_1,
  8626. isDigit: isDigit_1,
  8627. isHexDigit: isHexDigit_1
  8628. }, '__esModule', {value: true});
  8629. var parse_1 = createCommonjsModule(function (module, exports) {
  8630. 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'];
  8631. });
  8632. var stringify_1 = createCommonjsModule(function (module, exports) {
  8633. 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'];
  8634. });
  8635. var lib = createCommonjsModule(function (module, exports) {
  8636. 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'];
  8637. });
  8638. const specialValues = {
  8639. null: null,
  8640. true: true,
  8641. false: false,
  8642. };
  8643. function parseQuery(query) {
  8644. if (query.substr(0, 1) !== '?') {
  8645. throw new Error(
  8646. "A valid query string passed to parseQuery should begin with '?'"
  8647. );
  8648. }
  8649. query = query.substr(1);
  8650. if (!query) {
  8651. return {};
  8652. }
  8653. if (query.substr(0, 1) === '{' && query.substr(-1) === '}') {
  8654. return lib.parse(query);
  8655. }
  8656. const queryArgs = query.split(/[,&]/g);
  8657. const result = {};
  8658. queryArgs.forEach((arg) => {
  8659. const idx = arg.indexOf('=');
  8660. if (idx >= 0) {
  8661. let name = arg.substr(0, idx);
  8662. let value = decodeURIComponent(arg.substr(idx + 1));
  8663. if (specialValues.hasOwnProperty(value)) {
  8664. value = specialValues[value];
  8665. }
  8666. if (name.substr(-2) === '[]') {
  8667. name = decodeURIComponent(name.substr(0, name.length - 2));
  8668. if (!Array.isArray(result[name])) {
  8669. result[name] = [];
  8670. }
  8671. result[name].push(value);
  8672. } else {
  8673. name = decodeURIComponent(name);
  8674. result[name] = value;
  8675. }
  8676. } else {
  8677. if (arg.substr(0, 1) === '-') {
  8678. result[decodeURIComponent(arg.substr(1))] = false;
  8679. } else if (arg.substr(0, 1) === '+') {
  8680. result[decodeURIComponent(arg.substr(1))] = true;
  8681. } else {
  8682. result[decodeURIComponent(arg)] = true;
  8683. }
  8684. }
  8685. });
  8686. return result;
  8687. }
  8688. var parseQuery_1 = parseQuery;
  8689. function getOptions(loaderContext) {
  8690. const query = loaderContext.query;
  8691. if (typeof query === 'string' && query !== '') {
  8692. return parseQuery_1(loaderContext.query);
  8693. }
  8694. if (!query || typeof query !== 'object') {
  8695. // Not object-like queries are not supported.
  8696. return null;
  8697. }
  8698. return query;
  8699. }
  8700. var getOptions_1 = getOptions;
  8701. const matchRelativePath = /^\.\.?[/\\]/;
  8702. function isAbsolutePath(str) {
  8703. return path__default.posix.isAbsolute(str) || path__default.win32.isAbsolute(str);
  8704. }
  8705. function isRelativePath(str) {
  8706. return matchRelativePath.test(str);
  8707. }
  8708. function stringifyRequest(loaderContext, request) {
  8709. const splitted = request.split('!');
  8710. const context =
  8711. loaderContext.context ||
  8712. (loaderContext.options && loaderContext.options.context);
  8713. return JSON.stringify(
  8714. splitted
  8715. .map((part) => {
  8716. // First, separate singlePath from query, because the query might contain paths again
  8717. const splittedPart = part.match(/^(.*?)(\?.*)/);
  8718. const query = splittedPart ? splittedPart[2] : '';
  8719. let singlePath = splittedPart ? splittedPart[1] : part;
  8720. if (isAbsolutePath(singlePath) && context) {
  8721. singlePath = path__default.relative(context, singlePath);
  8722. if (isAbsolutePath(singlePath)) {
  8723. // If singlePath still matches an absolute path, singlePath was on a different drive than context.
  8724. // In this case, we leave the path platform-specific without replacing any separators.
  8725. // @see https://github.com/webpack/loader-utils/pull/14
  8726. return singlePath + query;
  8727. }
  8728. if (isRelativePath(singlePath) === false) {
  8729. // Ensure that the relative path starts at least with ./ otherwise it would be a request into the modules directory (like node_modules).
  8730. singlePath = './' + singlePath;
  8731. }
  8732. }
  8733. return singlePath.replace(/\\/g, '/') + query;
  8734. })
  8735. .join('!')
  8736. );
  8737. }
  8738. var stringifyRequest_1 = stringifyRequest;
  8739. function getRemainingRequest(loaderContext) {
  8740. if (loaderContext.remainingRequest) {
  8741. return loaderContext.remainingRequest;
  8742. }
  8743. const request = loaderContext.loaders
  8744. .slice(loaderContext.loaderIndex + 1)
  8745. .map((obj) => obj.request)
  8746. .concat([loaderContext.resource]);
  8747. return request.join('!');
  8748. }
  8749. var getRemainingRequest_1 = getRemainingRequest;
  8750. function getCurrentRequest(loaderContext) {
  8751. if (loaderContext.currentRequest) {
  8752. return loaderContext.currentRequest;
  8753. }
  8754. const request = loaderContext.loaders
  8755. .slice(loaderContext.loaderIndex)
  8756. .map((obj) => obj.request)
  8757. .concat([loaderContext.resource]);
  8758. return request.join('!');
  8759. }
  8760. var getCurrentRequest_1 = getCurrentRequest;
  8761. function isUrlRequest(url, root) {
  8762. // An URL is not an request if
  8763. // 1. It's an absolute url and it is not `windows` path like `C:\dir\file`
  8764. if (/^[a-z][a-z0-9+.-]*:/i.test(url) && !path__default.win32.isAbsolute(url)) {
  8765. return false;
  8766. }
  8767. // 2. It's a protocol-relative
  8768. if (/^\/\//.test(url)) {
  8769. return false;
  8770. }
  8771. // 3. It's some kind of url for a template
  8772. if (/^[{}[\]#*;,'§$%&(=?`´^°<>]/.test(url)) {
  8773. return false;
  8774. }
  8775. // 4. It's also not an request if root isn't set and it's a root-relative url
  8776. if ((root === undefined || root === false) && /^\//.test(url)) {
  8777. return false;
  8778. }
  8779. return true;
  8780. }
  8781. var isUrlRequest_1 = isUrlRequest;
  8782. // we can't use path.win32.isAbsolute because it also matches paths starting with a forward slash
  8783. const matchNativeWin32Path = /^[A-Z]:[/\\]|^\\\\/i;
  8784. function urlToRequest(url, root) {
  8785. // Do not rewrite an empty url
  8786. if (url === '') {
  8787. return '';
  8788. }
  8789. const moduleRequestRegex = /^[^?]*~/;
  8790. let request;
  8791. if (matchNativeWin32Path.test(url)) {
  8792. // absolute windows path, keep it
  8793. request = url;
  8794. } else if (root !== undefined && root !== false && /^\//.test(url)) {
  8795. // if root is set and the url is root-relative
  8796. switch (typeof root) {
  8797. // 1. root is a string: root is prefixed to the url
  8798. case 'string':
  8799. // special case: `~` roots convert to module request
  8800. if (moduleRequestRegex.test(root)) {
  8801. request = root.replace(/([^~/])$/, '$1/') + url.slice(1);
  8802. } else {
  8803. request = root + url;
  8804. }
  8805. break;
  8806. // 2. root is `true`: absolute paths are allowed
  8807. // *nix only, windows-style absolute paths are always allowed as they doesn't start with a `/`
  8808. case 'boolean':
  8809. request = url;
  8810. break;
  8811. default:
  8812. throw new Error(
  8813. "Unexpected parameters to loader-utils 'urlToRequest': url = " +
  8814. url +
  8815. ', root = ' +
  8816. root +
  8817. '.'
  8818. );
  8819. }
  8820. } else if (/^\.\.?\//.test(url)) {
  8821. // A relative url stays
  8822. request = url;
  8823. } else {
  8824. // every other url is threaded like a relative url
  8825. request = './' + url;
  8826. }
  8827. // A `~` makes the url an module
  8828. if (moduleRequestRegex.test(request)) {
  8829. request = request.replace(moduleRequestRegex, '');
  8830. }
  8831. return request;
  8832. }
  8833. var urlToRequest_1 = urlToRequest;
  8834. function parseString(str) {
  8835. try {
  8836. if (str[0] === '"') {
  8837. return JSON.parse(str);
  8838. }
  8839. if (str[0] === "'" && str.substr(str.length - 1) === "'") {
  8840. return parseString(
  8841. str
  8842. .replace(/\\.|"/g, (x) => (x === '"' ? '\\"' : x))
  8843. .replace(/^'|'$/g, '"')
  8844. );
  8845. }
  8846. return JSON.parse('"' + str + '"');
  8847. } catch (e) {
  8848. return str;
  8849. }
  8850. }
  8851. var parseString_1 = parseString;
  8852. /*
  8853. * big.js v5.2.2
  8854. * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
  8855. * Copyright (c) 2018 Michael Mclaughlin <M8ch88l@gmail.com>
  8856. * https://github.com/MikeMcl/big.js/LICENCE
  8857. */
  8858. /************************************** EDITABLE DEFAULTS *****************************************/
  8859. // The default values below must be integers within the stated ranges.
  8860. /*
  8861. * The maximum number of decimal places (DP) of the results of operations involving division:
  8862. * div and sqrt, and pow with negative exponents.
  8863. */
  8864. var DP = 20, // 0 to MAX_DP
  8865. /*
  8866. * The rounding mode (RM) used when rounding to the above decimal places.
  8867. *
  8868. * 0 Towards zero (i.e. truncate, no rounding). (ROUND_DOWN)
  8869. * 1 To nearest neighbour. If equidistant, round up. (ROUND_HALF_UP)
  8870. * 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN)
  8871. * 3 Away from zero. (ROUND_UP)
  8872. */
  8873. RM = 1, // 0, 1, 2 or 3
  8874. // The maximum value of DP and Big.DP.
  8875. MAX_DP = 1E6, // 0 to 1000000
  8876. // The maximum magnitude of the exponent argument to the pow method.
  8877. MAX_POWER = 1E6, // 1 to 1000000
  8878. /*
  8879. * The negative exponent (NE) at and beneath which toString returns exponential notation.
  8880. * (JavaScript numbers: -7)
  8881. * -1000000 is the minimum recommended exponent value of a Big.
  8882. */
  8883. NE = -7, // 0 to -1000000
  8884. /*
  8885. * The positive exponent (PE) at and above which toString returns exponential notation.
  8886. * (JavaScript numbers: 21)
  8887. * 1000000 is the maximum recommended exponent value of a Big.
  8888. * (This limit is not enforced or checked.)
  8889. */
  8890. PE = 21, // 0 to 1000000
  8891. /**************************************************************************************************/
  8892. // Error messages.
  8893. NAME = '[big.js] ',
  8894. INVALID = NAME + 'Invalid ',
  8895. INVALID_DP = INVALID + 'decimal places',
  8896. INVALID_RM = INVALID + 'rounding mode',
  8897. DIV_BY_ZERO = NAME + 'Division by zero',
  8898. // The shared prototype object.
  8899. P = {},
  8900. UNDEFINED = void 0,
  8901. NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
  8902. /*
  8903. * Create and return a Big constructor.
  8904. *
  8905. */
  8906. function _Big_() {
  8907. /*
  8908. * The Big constructor and exported function.
  8909. * Create and return a new instance of a Big number object.
  8910. *
  8911. * n {number|string|Big} A numeric value.
  8912. */
  8913. function Big(n) {
  8914. var x = this;
  8915. // Enable constructor usage without new.
  8916. if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n);
  8917. // Duplicate.
  8918. if (n instanceof Big) {
  8919. x.s = n.s;
  8920. x.e = n.e;
  8921. x.c = n.c.slice();
  8922. } else {
  8923. parse$1(x, n);
  8924. }
  8925. /*
  8926. * Retain a reference to this Big constructor, and shadow Big.prototype.constructor which
  8927. * points to Object.
  8928. */
  8929. x.constructor = Big;
  8930. }
  8931. Big.prototype = P;
  8932. Big.DP = DP;
  8933. Big.RM = RM;
  8934. Big.NE = NE;
  8935. Big.PE = PE;
  8936. Big.version = '5.2.2';
  8937. return Big;
  8938. }
  8939. /*
  8940. * Parse the number or string value passed to a Big constructor.
  8941. *
  8942. * x {Big} A Big number instance.
  8943. * n {number|string} A numeric value.
  8944. */
  8945. function parse$1(x, n) {
  8946. var e, i, nl;
  8947. // Minus zero?
  8948. if (n === 0 && 1 / n < 0) n = '-0';
  8949. else if (!NUMERIC.test(n += '')) throw Error(INVALID + 'number');
  8950. // Determine sign.
  8951. x.s = n.charAt(0) == '-' ? (n = n.slice(1), -1) : 1;
  8952. // Decimal point?
  8953. if ((e = n.indexOf('.')) > -1) n = n.replace('.', '');
  8954. // Exponential form?
  8955. if ((i = n.search(/e/i)) > 0) {
  8956. // Determine exponent.
  8957. if (e < 0) e = i;
  8958. e += +n.slice(i + 1);
  8959. n = n.substring(0, i);
  8960. } else if (e < 0) {
  8961. // Integer.
  8962. e = n.length;
  8963. }
  8964. nl = n.length;
  8965. // Determine leading zeros.
  8966. for (i = 0; i < nl && n.charAt(i) == '0';) ++i;
  8967. if (i == nl) {
  8968. // Zero.
  8969. x.c = [x.e = 0];
  8970. } else {
  8971. // Determine trailing zeros.
  8972. for (; nl > 0 && n.charAt(--nl) == '0';);
  8973. x.e = e - i - 1;
  8974. x.c = [];
  8975. // Convert string to array of digits without leading/trailing zeros.
  8976. for (e = 0; i <= nl;) x.c[e++] = +n.charAt(i++);
  8977. }
  8978. return x;
  8979. }
  8980. /*
  8981. * Round Big x to a maximum of dp decimal places using rounding mode rm.
  8982. * Called by stringify, P.div, P.round and P.sqrt.
  8983. *
  8984. * x {Big} The Big to round.
  8985. * dp {number} Integer, 0 to MAX_DP inclusive.
  8986. * rm {number} 0, 1, 2 or 3 (DOWN, HALF_UP, HALF_EVEN, UP)
  8987. * [more] {boolean} Whether the result of division was truncated.
  8988. */
  8989. function round(x, dp, rm, more) {
  8990. var xc = x.c,
  8991. i = x.e + dp + 1;
  8992. if (i < xc.length) {
  8993. if (rm === 1) {
  8994. // xc[i] is the digit after the digit that may be rounded up.
  8995. more = xc[i] >= 5;
  8996. } else if (rm === 2) {
  8997. more = xc[i] > 5 || xc[i] == 5 &&
  8998. (more || i < 0 || xc[i + 1] !== UNDEFINED || xc[i - 1] & 1);
  8999. } else if (rm === 3) {
  9000. more = more || !!xc[0];
  9001. } else {
  9002. more = false;
  9003. if (rm !== 0) throw Error(INVALID_RM);
  9004. }
  9005. if (i < 1) {
  9006. xc.length = 1;
  9007. if (more) {
  9008. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  9009. x.e = -dp;
  9010. xc[0] = 1;
  9011. } else {
  9012. // Zero.
  9013. xc[0] = x.e = 0;
  9014. }
  9015. } else {
  9016. // Remove any digits after the required decimal places.
  9017. xc.length = i--;
  9018. // Round up?
  9019. if (more) {
  9020. // Rounding up may mean the previous digit has to be rounded up.
  9021. for (; ++xc[i] > 9;) {
  9022. xc[i] = 0;
  9023. if (!i--) {
  9024. ++x.e;
  9025. xc.unshift(1);
  9026. }
  9027. }
  9028. }
  9029. // Remove trailing zeros.
  9030. for (i = xc.length; !xc[--i];) xc.pop();
  9031. }
  9032. } else if (rm < 0 || rm > 3 || rm !== ~~rm) {
  9033. throw Error(INVALID_RM);
  9034. }
  9035. return x;
  9036. }
  9037. /*
  9038. * Return a string representing the value of Big x in normal or exponential notation.
  9039. * Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
  9040. *
  9041. * x {Big}
  9042. * id? {number} Caller id.
  9043. * 1 toExponential
  9044. * 2 toFixed
  9045. * 3 toPrecision
  9046. * 4 valueOf
  9047. * n? {number|undefined} Caller's argument.
  9048. * k? {number|undefined}
  9049. */
  9050. function stringify(x, id, n, k) {
  9051. var e, s,
  9052. Big = x.constructor,
  9053. z = !x.c[0];
  9054. if (n !== UNDEFINED) {
  9055. if (n !== ~~n || n < (id == 3) || n > MAX_DP) {
  9056. throw Error(id == 3 ? INVALID + 'precision' : INVALID_DP);
  9057. }
  9058. x = new Big(x);
  9059. // The index of the digit that may be rounded up.
  9060. n = k - x.e;
  9061. // Round?
  9062. if (x.c.length > ++k) round(x, n, Big.RM);
  9063. // toFixed: recalculate k as x.e may have changed if value rounded up.
  9064. if (id == 2) k = x.e + n + 1;
  9065. // Append zeros?
  9066. for (; x.c.length < k;) x.c.push(0);
  9067. }
  9068. e = x.e;
  9069. s = x.c.join('');
  9070. n = s.length;
  9071. // Exponential notation?
  9072. if (id != 2 && (id == 1 || id == 3 && k <= e || e <= Big.NE || e >= Big.PE)) {
  9073. s = s.charAt(0) + (n > 1 ? '.' + s.slice(1) : '') + (e < 0 ? 'e' : 'e+') + e;
  9074. // Normal notation.
  9075. } else if (e < 0) {
  9076. for (; ++e;) s = '0' + s;
  9077. s = '0.' + s;
  9078. } else if (e > 0) {
  9079. if (++e > n) for (e -= n; e--;) s += '0';
  9080. else if (e < n) s = s.slice(0, e) + '.' + s.slice(e);
  9081. } else if (n > 1) {
  9082. s = s.charAt(0) + '.' + s.slice(1);
  9083. }
  9084. return x.s < 0 && (!z || id == 4) ? '-' + s : s;
  9085. }
  9086. // Prototype/instance methods
  9087. /*
  9088. * Return a new Big whose value is the absolute value of this Big.
  9089. */
  9090. P.abs = function () {
  9091. var x = new this.constructor(this);
  9092. x.s = 1;
  9093. return x;
  9094. };
  9095. /*
  9096. * Return 1 if the value of this Big is greater than the value of Big y,
  9097. * -1 if the value of this Big is less than the value of Big y, or
  9098. * 0 if they have the same value.
  9099. */
  9100. P.cmp = function (y) {
  9101. var isneg,
  9102. x = this,
  9103. xc = x.c,
  9104. yc = (y = new x.constructor(y)).c,
  9105. i = x.s,
  9106. j = y.s,
  9107. k = x.e,
  9108. l = y.e;
  9109. // Either zero?
  9110. if (!xc[0] || !yc[0]) return !xc[0] ? !yc[0] ? 0 : -j : i;
  9111. // Signs differ?
  9112. if (i != j) return i;
  9113. isneg = i < 0;
  9114. // Compare exponents.
  9115. if (k != l) return k > l ^ isneg ? 1 : -1;
  9116. j = (k = xc.length) < (l = yc.length) ? k : l;
  9117. // Compare digit by digit.
  9118. for (i = -1; ++i < j;) {
  9119. if (xc[i] != yc[i]) return xc[i] > yc[i] ^ isneg ? 1 : -1;
  9120. }
  9121. // Compare lengths.
  9122. return k == l ? 0 : k > l ^ isneg ? 1 : -1;
  9123. };
  9124. /*
  9125. * Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,
  9126. * if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
  9127. */
  9128. P.div = function (y) {
  9129. var x = this,
  9130. Big = x.constructor,
  9131. a = x.c, // dividend
  9132. b = (y = new Big(y)).c, // divisor
  9133. k = x.s == y.s ? 1 : -1,
  9134. dp = Big.DP;
  9135. if (dp !== ~~dp || dp < 0 || dp > MAX_DP) throw Error(INVALID_DP);
  9136. // Divisor is zero?
  9137. if (!b[0]) throw Error(DIV_BY_ZERO);
  9138. // Dividend is 0? Return +-0.
  9139. if (!a[0]) return new Big(k * 0);
  9140. var bl, bt, n, cmp, ri,
  9141. bz = b.slice(),
  9142. ai = bl = b.length,
  9143. al = a.length,
  9144. r = a.slice(0, bl), // remainder
  9145. rl = r.length,
  9146. q = y, // quotient
  9147. qc = q.c = [],
  9148. qi = 0,
  9149. d = dp + (q.e = x.e - y.e) + 1; // number of digits of the result
  9150. q.s = k;
  9151. k = d < 0 ? 0 : d;
  9152. // Create version of divisor with leading zero.
  9153. bz.unshift(0);
  9154. // Add zeros to make remainder as long as divisor.
  9155. for (; rl++ < bl;) r.push(0);
  9156. do {
  9157. // n is how many times the divisor goes into current remainder.
  9158. for (n = 0; n < 10; n++) {
  9159. // Compare divisor and remainder.
  9160. if (bl != (rl = r.length)) {
  9161. cmp = bl > rl ? 1 : -1;
  9162. } else {
  9163. for (ri = -1, cmp = 0; ++ri < bl;) {
  9164. if (b[ri] != r[ri]) {
  9165. cmp = b[ri] > r[ri] ? 1 : -1;
  9166. break;
  9167. }
  9168. }
  9169. }
  9170. // If divisor < remainder, subtract divisor from remainder.
  9171. if (cmp < 0) {
  9172. // Remainder can't be more than 1 digit longer than divisor.
  9173. // Equalise lengths using divisor with extra leading zero?
  9174. for (bt = rl == bl ? b : bz; rl;) {
  9175. if (r[--rl] < bt[rl]) {
  9176. ri = rl;
  9177. for (; ri && !r[--ri];) r[ri] = 9;
  9178. --r[ri];
  9179. r[rl] += 10;
  9180. }
  9181. r[rl] -= bt[rl];
  9182. }
  9183. for (; !r[0];) r.shift();
  9184. } else {
  9185. break;
  9186. }
  9187. }
  9188. // Add the digit n to the result array.
  9189. qc[qi++] = cmp ? n : ++n;
  9190. // Update the remainder.
  9191. if (r[0] && cmp) r[rl] = a[ai] || 0;
  9192. else r = [a[ai]];
  9193. } while ((ai++ < al || r[0] !== UNDEFINED) && k--);
  9194. // Leading zero? Do not remove if result is simply zero (qi == 1).
  9195. if (!qc[0] && qi != 1) {
  9196. // There can't be more than one zero.
  9197. qc.shift();
  9198. q.e--;
  9199. }
  9200. // Round?
  9201. if (qi > d) round(q, dp, Big.RM, r[0] !== UNDEFINED);
  9202. return q;
  9203. };
  9204. /*
  9205. * Return true if the value of this Big is equal to the value of Big y, otherwise return false.
  9206. */
  9207. P.eq = function (y) {
  9208. return !this.cmp(y);
  9209. };
  9210. /*
  9211. * Return true if the value of this Big is greater than the value of Big y, otherwise return
  9212. * false.
  9213. */
  9214. P.gt = function (y) {
  9215. return this.cmp(y) > 0;
  9216. };
  9217. /*
  9218. * Return true if the value of this Big is greater than or equal to the value of Big y, otherwise
  9219. * return false.
  9220. */
  9221. P.gte = function (y) {
  9222. return this.cmp(y) > -1;
  9223. };
  9224. /*
  9225. * Return true if the value of this Big is less than the value of Big y, otherwise return false.
  9226. */
  9227. P.lt = function (y) {
  9228. return this.cmp(y) < 0;
  9229. };
  9230. /*
  9231. * Return true if the value of this Big is less than or equal to the value of Big y, otherwise
  9232. * return false.
  9233. */
  9234. P.lte = function (y) {
  9235. return this.cmp(y) < 1;
  9236. };
  9237. /*
  9238. * Return a new Big whose value is the value of this Big minus the value of Big y.
  9239. */
  9240. P.minus = P.sub = function (y) {
  9241. var i, j, t, xlty,
  9242. x = this,
  9243. Big = x.constructor,
  9244. a = x.s,
  9245. b = (y = new Big(y)).s;
  9246. // Signs differ?
  9247. if (a != b) {
  9248. y.s = -b;
  9249. return x.plus(y);
  9250. }
  9251. var xc = x.c.slice(),
  9252. xe = x.e,
  9253. yc = y.c,
  9254. ye = y.e;
  9255. // Either zero?
  9256. if (!xc[0] || !yc[0]) {
  9257. // y is non-zero? x is non-zero? Or both are zero.
  9258. return yc[0] ? (y.s = -b, y) : new Big(xc[0] ? x : 0);
  9259. }
  9260. // Determine which is the bigger number. Prepend zeros to equalise exponents.
  9261. if (a = xe - ye) {
  9262. if (xlty = a < 0) {
  9263. a = -a;
  9264. t = xc;
  9265. } else {
  9266. ye = xe;
  9267. t = yc;
  9268. }
  9269. t.reverse();
  9270. for (b = a; b--;) t.push(0);
  9271. t.reverse();
  9272. } else {
  9273. // Exponents equal. Check digit by digit.
  9274. j = ((xlty = xc.length < yc.length) ? xc : yc).length;
  9275. for (a = b = 0; b < j; b++) {
  9276. if (xc[b] != yc[b]) {
  9277. xlty = xc[b] < yc[b];
  9278. break;
  9279. }
  9280. }
  9281. }
  9282. // x < y? Point xc to the array of the bigger number.
  9283. if (xlty) {
  9284. t = xc;
  9285. xc = yc;
  9286. yc = t;
  9287. y.s = -y.s;
  9288. }
  9289. /*
  9290. * Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only
  9291. * needs to start at yc.length.
  9292. */
  9293. if ((b = (j = yc.length) - (i = xc.length)) > 0) for (; b--;) xc[i++] = 0;
  9294. // Subtract yc from xc.
  9295. for (b = i; j > a;) {
  9296. if (xc[--j] < yc[j]) {
  9297. for (i = j; i && !xc[--i];) xc[i] = 9;
  9298. --xc[i];
  9299. xc[j] += 10;
  9300. }
  9301. xc[j] -= yc[j];
  9302. }
  9303. // Remove trailing zeros.
  9304. for (; xc[--b] === 0;) xc.pop();
  9305. // Remove leading zeros and adjust exponent accordingly.
  9306. for (; xc[0] === 0;) {
  9307. xc.shift();
  9308. --ye;
  9309. }
  9310. if (!xc[0]) {
  9311. // n - n = +0
  9312. y.s = 1;
  9313. // Result must be zero.
  9314. xc = [ye = 0];
  9315. }
  9316. y.c = xc;
  9317. y.e = ye;
  9318. return y;
  9319. };
  9320. /*
  9321. * Return a new Big whose value is the value of this Big modulo the value of Big y.
  9322. */
  9323. P.mod = function (y) {
  9324. var ygtx,
  9325. x = this,
  9326. Big = x.constructor,
  9327. a = x.s,
  9328. b = (y = new Big(y)).s;
  9329. if (!y.c[0]) throw Error(DIV_BY_ZERO);
  9330. x.s = y.s = 1;
  9331. ygtx = y.cmp(x) == 1;
  9332. x.s = a;
  9333. y.s = b;
  9334. if (ygtx) return new Big(x);
  9335. a = Big.DP;
  9336. b = Big.RM;
  9337. Big.DP = Big.RM = 0;
  9338. x = x.div(y);
  9339. Big.DP = a;
  9340. Big.RM = b;
  9341. return this.minus(x.times(y));
  9342. };
  9343. /*
  9344. * Return a new Big whose value is the value of this Big plus the value of Big y.
  9345. */
  9346. P.plus = P.add = function (y) {
  9347. var t,
  9348. x = this,
  9349. Big = x.constructor,
  9350. a = x.s,
  9351. b = (y = new Big(y)).s;
  9352. // Signs differ?
  9353. if (a != b) {
  9354. y.s = -b;
  9355. return x.minus(y);
  9356. }
  9357. var xe = x.e,
  9358. xc = x.c,
  9359. ye = y.e,
  9360. yc = y.c;
  9361. // Either zero? y is non-zero? x is non-zero? Or both are zero.
  9362. if (!xc[0] || !yc[0]) return yc[0] ? y : new Big(xc[0] ? x : a * 0);
  9363. xc = xc.slice();
  9364. // Prepend zeros to equalise exponents.
  9365. // Note: reverse faster than unshifts.
  9366. if (a = xe - ye) {
  9367. if (a > 0) {
  9368. ye = xe;
  9369. t = yc;
  9370. } else {
  9371. a = -a;
  9372. t = xc;
  9373. }
  9374. t.reverse();
  9375. for (; a--;) t.push(0);
  9376. t.reverse();
  9377. }
  9378. // Point xc to the longer array.
  9379. if (xc.length - yc.length < 0) {
  9380. t = yc;
  9381. yc = xc;
  9382. xc = t;
  9383. }
  9384. a = yc.length;
  9385. // Only start adding at yc.length - 1 as the further digits of xc can be left as they are.
  9386. for (b = 0; a; xc[a] %= 10) b = (xc[--a] = xc[a] + yc[a] + b) / 10 | 0;
  9387. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  9388. if (b) {
  9389. xc.unshift(b);
  9390. ++ye;
  9391. }
  9392. // Remove trailing zeros.
  9393. for (a = xc.length; xc[--a] === 0;) xc.pop();
  9394. y.c = xc;
  9395. y.e = ye;
  9396. return y;
  9397. };
  9398. /*
  9399. * Return a Big whose value is the value of this Big raised to the power n.
  9400. * If n is negative, round to a maximum of Big.DP decimal places using rounding
  9401. * mode Big.RM.
  9402. *
  9403. * n {number} Integer, -MAX_POWER to MAX_POWER inclusive.
  9404. */
  9405. P.pow = function (n) {
  9406. var x = this,
  9407. one = new x.constructor(1),
  9408. y = one,
  9409. isneg = n < 0;
  9410. if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) throw Error(INVALID + 'exponent');
  9411. if (isneg) n = -n;
  9412. for (;;) {
  9413. if (n & 1) y = y.times(x);
  9414. n >>= 1;
  9415. if (!n) break;
  9416. x = x.times(x);
  9417. }
  9418. return isneg ? one.div(y) : y;
  9419. };
  9420. /*
  9421. * Return a new Big whose value is the value of this Big rounded using rounding mode rm
  9422. * to a maximum of dp decimal places, or, if dp is negative, to an integer which is a
  9423. * multiple of 10**-dp.
  9424. * If dp is not specified, round to 0 decimal places.
  9425. * If rm is not specified, use Big.RM.
  9426. *
  9427. * dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
  9428. * rm? 0, 1, 2 or 3 (ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP)
  9429. */
  9430. P.round = function (dp, rm) {
  9431. var Big = this.constructor;
  9432. if (dp === UNDEFINED) dp = 0;
  9433. else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) throw Error(INVALID_DP);
  9434. return round(new Big(this), dp, rm === UNDEFINED ? Big.RM : rm);
  9435. };
  9436. /*
  9437. * Return a new Big whose value is the square root of the value of this Big, rounded, if
  9438. * necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
  9439. */
  9440. P.sqrt = function () {
  9441. var r, c, t,
  9442. x = this,
  9443. Big = x.constructor,
  9444. s = x.s,
  9445. e = x.e,
  9446. half = new Big(0.5);
  9447. // Zero?
  9448. if (!x.c[0]) return new Big(x);
  9449. // Negative?
  9450. if (s < 0) throw Error(NAME + 'No square root');
  9451. // Estimate.
  9452. s = Math.sqrt(x + '');
  9453. // Math.sqrt underflow/overflow?
  9454. // Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
  9455. if (s === 0 || s === 1 / 0) {
  9456. c = x.c.join('');
  9457. if (!(c.length + e & 1)) c += '0';
  9458. s = Math.sqrt(c);
  9459. e = ((e + 1) / 2 | 0) - (e < 0 || e & 1);
  9460. r = new Big((s == 1 / 0 ? '1e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e);
  9461. } else {
  9462. r = new Big(s);
  9463. }
  9464. e = r.e + (Big.DP += 4);
  9465. // Newton-Raphson iteration.
  9466. do {
  9467. t = r;
  9468. r = half.times(t.plus(x.div(t)));
  9469. } while (t.c.slice(0, e).join('') !== r.c.slice(0, e).join(''));
  9470. return round(r, Big.DP -= 4, Big.RM);
  9471. };
  9472. /*
  9473. * Return a new Big whose value is the value of this Big times the value of Big y.
  9474. */
  9475. P.times = P.mul = function (y) {
  9476. var c,
  9477. x = this,
  9478. Big = x.constructor,
  9479. xc = x.c,
  9480. yc = (y = new Big(y)).c,
  9481. a = xc.length,
  9482. b = yc.length,
  9483. i = x.e,
  9484. j = y.e;
  9485. // Determine sign of result.
  9486. y.s = x.s == y.s ? 1 : -1;
  9487. // Return signed 0 if either 0.
  9488. if (!xc[0] || !yc[0]) return new Big(y.s * 0);
  9489. // Initialise exponent of result as x.e + y.e.
  9490. y.e = i + j;
  9491. // If array xc has fewer digits than yc, swap xc and yc, and lengths.
  9492. if (a < b) {
  9493. c = xc;
  9494. xc = yc;
  9495. yc = c;
  9496. j = a;
  9497. a = b;
  9498. b = j;
  9499. }
  9500. // Initialise coefficient array of result with zeros.
  9501. for (c = new Array(j = a + b); j--;) c[j] = 0;
  9502. // Multiply.
  9503. // i is initially xc.length.
  9504. for (i = b; i--;) {
  9505. b = 0;
  9506. // a is yc.length.
  9507. for (j = a + i; j > i;) {
  9508. // Current sum of products at this digit position, plus carry.
  9509. b = c[j] + yc[i] * xc[j - i - 1] + b;
  9510. c[j--] = b % 10;
  9511. // carry
  9512. b = b / 10 | 0;
  9513. }
  9514. c[j] = (c[j] + b) % 10;
  9515. }
  9516. // Increment result exponent if there is a final carry, otherwise remove leading zero.
  9517. if (b) ++y.e;
  9518. else c.shift();
  9519. // Remove trailing zeros.
  9520. for (i = c.length; !c[--i];) c.pop();
  9521. y.c = c;
  9522. return y;
  9523. };
  9524. /*
  9525. * Return a string representing the value of this Big in exponential notation to dp fixed decimal
  9526. * places and rounded using Big.RM.
  9527. *
  9528. * dp? {number} Integer, 0 to MAX_DP inclusive.
  9529. */
  9530. P.toExponential = function (dp) {
  9531. return stringify(this, 1, dp, dp);
  9532. };
  9533. /*
  9534. * Return a string representing the value of this Big in normal notation to dp fixed decimal
  9535. * places and rounded using Big.RM.
  9536. *
  9537. * dp? {number} Integer, 0 to MAX_DP inclusive.
  9538. *
  9539. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  9540. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  9541. */
  9542. P.toFixed = function (dp) {
  9543. return stringify(this, 2, dp, this.e + dp);
  9544. };
  9545. /*
  9546. * Return a string representing the value of this Big rounded to sd significant digits using
  9547. * Big.RM. Use exponential notation if sd is less than the number of digits necessary to represent
  9548. * the integer part of the value in normal notation.
  9549. *
  9550. * sd {number} Integer, 1 to MAX_DP inclusive.
  9551. */
  9552. P.toPrecision = function (sd) {
  9553. return stringify(this, 3, sd, sd - 1);
  9554. };
  9555. /*
  9556. * Return a string representing the value of this Big.
  9557. * Return exponential notation if this Big has a positive exponent equal to or greater than
  9558. * Big.PE, or a negative exponent equal to or less than Big.NE.
  9559. * Omit the sign for negative zero.
  9560. */
  9561. P.toString = function () {
  9562. return stringify(this);
  9563. };
  9564. /*
  9565. * Return a string representing the value of this Big.
  9566. * Return exponential notation if this Big has a positive exponent equal to or greater than
  9567. * Big.PE, or a negative exponent equal to or less than Big.NE.
  9568. * Include the sign for negative zero.
  9569. */
  9570. P.valueOf = P.toJSON = function () {
  9571. return stringify(this, 4);
  9572. };
  9573. // Export
  9574. var Big = _Big_();
  9575. var big = /*#__PURE__*/Object.freeze({
  9576. __proto__: null,
  9577. Big: Big,
  9578. 'default': Big
  9579. });
  9580. var require$$0 = /*@__PURE__*/getAugmentedNamespace(big);
  9581. const baseEncodeTables = {
  9582. 26: 'abcdefghijklmnopqrstuvwxyz',
  9583. 32: '123456789abcdefghjkmnpqrstuvwxyz', // no 0lio
  9584. 36: '0123456789abcdefghijklmnopqrstuvwxyz',
  9585. 49: 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no lIO
  9586. 52: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
  9587. 58: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no 0lIO
  9588. 62: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
  9589. 64: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_',
  9590. };
  9591. function encodeBufferToBase(buffer, base) {
  9592. const encodeTable = baseEncodeTables[base];
  9593. if (!encodeTable) {
  9594. throw new Error('Unknown encoding base' + base);
  9595. }
  9596. const readLength = buffer.length;
  9597. const Big = require$$0;
  9598. Big.RM = Big.DP = 0;
  9599. let b = new Big(0);
  9600. for (let i = readLength - 1; i >= 0; i--) {
  9601. b = b.times(256).plus(buffer[i]);
  9602. }
  9603. let output = '';
  9604. while (b.gt(0)) {
  9605. output = encodeTable[b.mod(base)] + output;
  9606. b = b.div(base);
  9607. }
  9608. Big.DP = 20;
  9609. Big.RM = 1;
  9610. return output;
  9611. }
  9612. function getHashDigest(buffer, hashType, digestType, maxLength) {
  9613. hashType = hashType || 'md5';
  9614. maxLength = maxLength || 9999;
  9615. const hash = require('crypto').createHash(hashType);
  9616. hash.update(buffer);
  9617. if (
  9618. digestType === 'base26' ||
  9619. digestType === 'base32' ||
  9620. digestType === 'base36' ||
  9621. digestType === 'base49' ||
  9622. digestType === 'base52' ||
  9623. digestType === 'base58' ||
  9624. digestType === 'base62' ||
  9625. digestType === 'base64'
  9626. ) {
  9627. return encodeBufferToBase(hash.digest(), digestType.substr(4)).substr(
  9628. 0,
  9629. maxLength
  9630. );
  9631. } else {
  9632. return hash.digest(digestType || 'hex').substr(0, maxLength);
  9633. }
  9634. }
  9635. var getHashDigest_1 = getHashDigest;
  9636. var emojisList = [
  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. "➕",
  12680. "➖",
  12681. "➗",
  12682. "➡️",
  12683. "➰",
  12684. "➿",
  12685. "⤴️",
  12686. "⤵️",
  12687. "*⃣",
  12688. "⬅️",
  12689. "⬆️",
  12690. "⬇️",
  12691. "⬛️",
  12692. "⬜️",
  12693. "⭐️",
  12694. "⭕️",
  12695. "0⃣",
  12696. "〰️",
  12697. "〽️",
  12698. "1⃣",
  12699. "2⃣",
  12700. "㊗️",
  12701. "㊙️",
  12702. "3⃣",
  12703. "4⃣",
  12704. "5⃣",
  12705. "6⃣",
  12706. "7⃣",
  12707. "8⃣",
  12708. "9⃣",
  12709. "©️",
  12710. "®️",
  12711. ""
  12712. ];
  12713. const emojiRegex = /[\uD800-\uDFFF]./;
  12714. const emojiList = emojisList.filter((emoji) => emojiRegex.test(emoji));
  12715. const emojiCache = {};
  12716. function encodeStringToEmoji(content, length) {
  12717. if (emojiCache[content]) {
  12718. return emojiCache[content];
  12719. }
  12720. length = length || 1;
  12721. const emojis = [];
  12722. do {
  12723. if (!emojiList.length) {
  12724. throw new Error('Ran out of emoji');
  12725. }
  12726. const index = Math.floor(Math.random() * emojiList.length);
  12727. emojis.push(emojiList[index]);
  12728. emojiList.splice(index, 1);
  12729. } while (--length > 0);
  12730. const emojiEncoding = emojis.join('');
  12731. emojiCache[content] = emojiEncoding;
  12732. return emojiEncoding;
  12733. }
  12734. function interpolateName(loaderContext, name, options) {
  12735. let filename;
  12736. const hasQuery =
  12737. loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1;
  12738. if (typeof name === 'function') {
  12739. filename = name(
  12740. loaderContext.resourcePath,
  12741. hasQuery ? loaderContext.resourceQuery : undefined
  12742. );
  12743. } else {
  12744. filename = name || '[hash].[ext]';
  12745. }
  12746. const context = options.context;
  12747. const content = options.content;
  12748. const regExp = options.regExp;
  12749. let ext = 'bin';
  12750. let basename = 'file';
  12751. let directory = '';
  12752. let folder = '';
  12753. let query = '';
  12754. if (loaderContext.resourcePath) {
  12755. const parsed = path__default.parse(loaderContext.resourcePath);
  12756. let resourcePath = loaderContext.resourcePath;
  12757. if (parsed.ext) {
  12758. ext = parsed.ext.substr(1);
  12759. }
  12760. if (parsed.dir) {
  12761. basename = parsed.name;
  12762. resourcePath = parsed.dir + path__default.sep;
  12763. }
  12764. if (typeof context !== 'undefined') {
  12765. directory = path__default
  12766. .relative(context, resourcePath + '_')
  12767. .replace(/\\/g, '/')
  12768. .replace(/\.\.(\/)?/g, '_$1');
  12769. directory = directory.substr(0, directory.length - 1);
  12770. } else {
  12771. directory = resourcePath.replace(/\\/g, '/').replace(/\.\.(\/)?/g, '_$1');
  12772. }
  12773. if (directory.length === 1) {
  12774. directory = '';
  12775. } else if (directory.length > 1) {
  12776. folder = path__default.basename(directory);
  12777. }
  12778. }
  12779. if (loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1) {
  12780. query = loaderContext.resourceQuery;
  12781. const hashIdx = query.indexOf('#');
  12782. if (hashIdx >= 0) {
  12783. query = query.substr(0, hashIdx);
  12784. }
  12785. }
  12786. let url = filename;
  12787. if (content) {
  12788. // Match hash template
  12789. url = url
  12790. // `hash` and `contenthash` are same in `loader-utils` context
  12791. // let's keep `hash` for backward compatibility
  12792. .replace(
  12793. /\[(?:([^:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi,
  12794. (all, hashType, digestType, maxLength) =>
  12795. getHashDigest_1(content, hashType, digestType, parseInt(maxLength, 10))
  12796. )
  12797. .replace(/\[emoji(?::(\d+))?\]/gi, (all, length) =>
  12798. encodeStringToEmoji(content, parseInt(length, 10))
  12799. );
  12800. }
  12801. url = url
  12802. .replace(/\[ext\]/gi, () => ext)
  12803. .replace(/\[name\]/gi, () => basename)
  12804. .replace(/\[path\]/gi, () => directory)
  12805. .replace(/\[folder\]/gi, () => folder)
  12806. .replace(/\[query\]/gi, () => query);
  12807. if (regExp && loaderContext.resourcePath) {
  12808. const match = loaderContext.resourcePath.match(new RegExp(regExp));
  12809. match &&
  12810. match.forEach((matched, i) => {
  12811. url = url.replace(new RegExp('\\[' + i + '\\]', 'ig'), matched);
  12812. });
  12813. }
  12814. if (
  12815. typeof loaderContext.options === 'object' &&
  12816. typeof loaderContext.options.customInterpolateName === 'function'
  12817. ) {
  12818. url = loaderContext.options.customInterpolateName.call(
  12819. loaderContext,
  12820. url,
  12821. name,
  12822. options
  12823. );
  12824. }
  12825. return url;
  12826. }
  12827. var interpolateName_1 = interpolateName;
  12828. var getOptions_1$1 = getOptions_1;
  12829. var parseQuery_1$1 = parseQuery_1;
  12830. var stringifyRequest_1$1 = stringifyRequest_1;
  12831. var getRemainingRequest_1$1 = getRemainingRequest_1;
  12832. var getCurrentRequest_1$1 = getCurrentRequest_1;
  12833. var isUrlRequest_1$1 = isUrlRequest_1;
  12834. var urlToRequest_1$1 = urlToRequest_1;
  12835. var parseString_1$1 = parseString_1;
  12836. var getHashDigest_1$1 = getHashDigest_1;
  12837. var interpolateName_1$1 = interpolateName_1;
  12838. var lib$1 = {
  12839. getOptions: getOptions_1$1,
  12840. parseQuery: parseQuery_1$1,
  12841. stringifyRequest: stringifyRequest_1$1,
  12842. getRemainingRequest: getRemainingRequest_1$1,
  12843. getCurrentRequest: getCurrentRequest_1$1,
  12844. isUrlRequest: isUrlRequest_1$1,
  12845. urlToRequest: urlToRequest_1$1,
  12846. parseString: parseString_1$1,
  12847. getHashDigest: getHashDigest_1$1,
  12848. interpolateName: interpolateName_1$1
  12849. };
  12850. var interpolateName$1 = lib$1.interpolateName;
  12851. /**
  12852. * @param {string} pattern
  12853. * @param {object} options
  12854. * @param {string} options.context
  12855. * @param {string} options.hashPrefix
  12856. * @return {function}
  12857. */
  12858. var genericNames = function createGenerator(pattern, options) {
  12859. options = options || {};
  12860. var context =
  12861. options && typeof options.context === "string"
  12862. ? options.context
  12863. : process.cwd();
  12864. var hashPrefix =
  12865. options && typeof options.hashPrefix === "string" ? options.hashPrefix : "";
  12866. /**
  12867. * @param {string} localName Usually a class name
  12868. * @param {string} filepath Absolute path
  12869. * @return {string}
  12870. */
  12871. return function generate(localName, filepath) {
  12872. var name = pattern.replace(/\[local\]/gi, localName);
  12873. var loaderContext = {
  12874. resourcePath: filepath
  12875. };
  12876. var loaderOptions = {
  12877. content:
  12878. hashPrefix +
  12879. path__default.relative(context, filepath).replace(/\\/g, "/") +
  12880. "+" +
  12881. localName,
  12882. context: context
  12883. };
  12884. var genericName = interpolateName$1(loaderContext, name, loaderOptions);
  12885. return genericName
  12886. .replace(new RegExp("[^a-zA-Z0-9\\-_\u00A0-\uFFFF]", "g"), "-")
  12887. .replace(/^((-?[0-9])|--)/, "_$1");
  12888. };
  12889. };
  12890. var _default = unquote;
  12891. // copied from https://github.com/lakenen/node-unquote
  12892. var reg = /['"]/;
  12893. function unquote(str) {
  12894. if (!str) {
  12895. return "";
  12896. }
  12897. if (reg.test(str.charAt(0))) {
  12898. str = str.substr(1);
  12899. }
  12900. if (reg.test(str.charAt(str.length - 1))) {
  12901. str = str.substr(0, str.length - 1);
  12902. }
  12903. return str;
  12904. }
  12905. var unquote_1 = /*#__PURE__*/Object.defineProperty({
  12906. default: _default
  12907. }, '__esModule', {value: true});
  12908. var replaceAll_1 = replaceAll;
  12909. var matchConstName = /[$#]?[\w-\.]+/g;
  12910. function replaceAll(replacements, text) {
  12911. var matches = void 0;
  12912. while (matches = matchConstName.exec(text)) {
  12913. var replacement = replacements[matches[0]];
  12914. if (replacement) {
  12915. text = text.slice(0, matches.index) + replacement + text.slice(matchConstName.lastIndex);
  12916. matchConstName.lastIndex -= matches[0].length - replacement.length;
  12917. }
  12918. }
  12919. return text;
  12920. }
  12921. var _default$1 = function (css, translations) {
  12922. css.walkDecls(function (decl) {
  12923. return decl.value = replaceAll(translations, decl.value);
  12924. });
  12925. css.walkAtRules('media', function (atRule) {
  12926. return atRule.params = replaceAll(translations, atRule.params);
  12927. });
  12928. };
  12929. var lib$2 = /*#__PURE__*/Object.defineProperty({
  12930. replaceAll: replaceAll_1,
  12931. default: _default$1
  12932. }, '__esModule', {value: true});
  12933. var _icssReplaceSymbols2 = _interopRequireDefault(lib$2);
  12934. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12935. // Copied from https://github.com/css-modules/css-modules-loader-core
  12936. const importRegexp = /^:import\((.+)\)$/;
  12937. class Parser {
  12938. constructor(pathFetcher, trace) {
  12939. this.pathFetcher = pathFetcher;
  12940. this.plugin = this.plugin.bind(this);
  12941. this.exportTokens = {};
  12942. this.translations = {};
  12943. this.trace = trace;
  12944. }
  12945. plugin() {
  12946. const parser = this;
  12947. return {
  12948. postcssPlugin: "css-modules-parser",
  12949. OnceExit(css) {
  12950. return Promise.all(parser.fetchAllImports(css)).then(() => parser.linkImportedSymbols(css)).then(() => parser.extractExports(css));
  12951. }
  12952. };
  12953. }
  12954. fetchAllImports(css) {
  12955. let imports = [];
  12956. css.each(node => {
  12957. if (node.type == "rule" && node.selector.match(importRegexp)) {
  12958. imports.push(this.fetchImport(node, css.source.input.from, imports.length));
  12959. }
  12960. });
  12961. return imports;
  12962. }
  12963. linkImportedSymbols(css) {
  12964. (0, _icssReplaceSymbols2.default)(css, this.translations);
  12965. }
  12966. extractExports(css) {
  12967. css.each(node => {
  12968. if (node.type == "rule" && node.selector == ":export") this.handleExport(node);
  12969. });
  12970. }
  12971. handleExport(exportNode) {
  12972. exportNode.each(decl => {
  12973. if (decl.type == "decl") {
  12974. Object.keys(this.translations).forEach(translation => {
  12975. decl.value = decl.value.replace(translation, this.translations[translation]);
  12976. });
  12977. this.exportTokens[decl.prop] = decl.value;
  12978. }
  12979. });
  12980. exportNode.remove();
  12981. }
  12982. fetchImport(importNode, relativeTo, depNr) {
  12983. let file = importNode.selector.match(importRegexp)[1],
  12984. depTrace = this.trace + String.fromCharCode(depNr);
  12985. return this.pathFetcher(file, relativeTo, depTrace).then(exports => {
  12986. importNode.each(decl => {
  12987. if (decl.type == "decl") {
  12988. this.translations[decl.prop] = exports[decl.value];
  12989. }
  12990. });
  12991. importNode.remove();
  12992. }, err => console.log(err));
  12993. }
  12994. }
  12995. var _default$2 = Parser;
  12996. var parser$1 = /*#__PURE__*/Object.defineProperty({
  12997. default: _default$2
  12998. }, '__esModule', {value: true});
  12999. var _postcss2 = _interopRequireDefault$1(_postcss__default);
  13000. var _fs2 = _interopRequireDefault$1(fs__default);
  13001. var _path2 = _interopRequireDefault$1(path__default);
  13002. var _parser2 = _interopRequireDefault$1(parser$1);
  13003. function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13004. // Copied from https://github.com/css-modules/css-modules-loader-core
  13005. class Core {
  13006. constructor(plugins) {
  13007. this.plugins = plugins || Core.defaultPlugins;
  13008. }
  13009. load(sourceString, sourcePath, trace, pathFetcher) {
  13010. let parser = new _parser2.default(pathFetcher, trace);
  13011. return (0, _postcss2.default)(this.plugins.concat([parser.plugin()])).process(sourceString, { from: "/" + sourcePath }).then(result => {
  13012. return {
  13013. injectableSource: result.css,
  13014. exportTokens: parser.exportTokens
  13015. };
  13016. });
  13017. }
  13018. }
  13019. // Sorts dependencies in the following way:
  13020. // AAA comes before AA and A
  13021. // AB comes after AA and before A
  13022. // All Bs come after all As
  13023. // This ensures that the files are always returned in the following order:
  13024. // - In the order they were required, except
  13025. // - After all their dependencies
  13026. const traceKeySorter = (a, b) => {
  13027. if (a.length < b.length) {
  13028. return a < b.substring(0, a.length) ? -1 : 1;
  13029. } else if (a.length > b.length) {
  13030. return a.substring(0, b.length) <= b ? -1 : 1;
  13031. } else {
  13032. return a < b ? -1 : 1;
  13033. }
  13034. };
  13035. class FileSystemLoader {
  13036. constructor(root, plugins) {
  13037. this.root = root;
  13038. this.sources = {};
  13039. this.traces = {};
  13040. this.importNr = 0;
  13041. this.core = new Core(plugins);
  13042. this.tokensByFile = {};
  13043. }
  13044. fetch(_newPath, relativeTo, _trace) {
  13045. let newPath = _newPath.replace(/^["']|["']$/g, ""),
  13046. trace = _trace || String.fromCharCode(this.importNr++);
  13047. return new Promise((resolve, reject) => {
  13048. let relativeDir = _path2.default.dirname(relativeTo),
  13049. rootRelativePath = _path2.default.resolve(relativeDir, newPath),
  13050. fileRelativePath = _path2.default.resolve(_path2.default.join(this.root, relativeDir), newPath);
  13051. // if the path is not relative or absolute, try to resolve it in node_modules
  13052. if (newPath[0] !== "." && newPath[0] !== "/") {
  13053. try {
  13054. fileRelativePath = require.resolve(newPath);
  13055. } catch (e) {
  13056. // noop
  13057. }
  13058. }
  13059. const tokens = this.tokensByFile[fileRelativePath];
  13060. if (tokens) {
  13061. return resolve(tokens);
  13062. }
  13063. _fs2.default.readFile(fileRelativePath, "utf-8", (err, source) => {
  13064. if (err) reject(err);
  13065. this.core.load(source, rootRelativePath, trace, this.fetch.bind(this)).then(({ injectableSource, exportTokens }) => {
  13066. this.sources[fileRelativePath] = injectableSource;
  13067. this.traces[trace] = fileRelativePath;
  13068. this.tokensByFile[fileRelativePath] = exportTokens;
  13069. resolve(exportTokens);
  13070. }, reject);
  13071. });
  13072. });
  13073. }
  13074. get finalSource() {
  13075. const traces = this.traces;
  13076. const sources = this.sources;
  13077. let written = new Set();
  13078. return Object.keys(traces).sort(traceKeySorter).map(key => {
  13079. const filename = traces[key];
  13080. if (written.has(filename)) {
  13081. return null;
  13082. }
  13083. written.add(filename);
  13084. return sources[filename];
  13085. }).join("");
  13086. }
  13087. }
  13088. var _default$3 = FileSystemLoader;
  13089. var loader = /*#__PURE__*/Object.defineProperty({
  13090. default: _default$3
  13091. }, '__esModule', {value: true});
  13092. function hash(str) {
  13093. var hash = 5381,
  13094. i = str.length;
  13095. while(i) {
  13096. hash = (hash * 33) ^ str.charCodeAt(--i);
  13097. }
  13098. /* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
  13099. * integers. Since we want the results to be always positive, convert the
  13100. * signed int to an unsigned by doing an unsigned bitshift. */
  13101. return hash >>> 0;
  13102. }
  13103. var stringHash = hash;
  13104. var _default$4 = generateScopedName;
  13105. var _stringHash2 = _interopRequireDefault$2(stringHash);
  13106. function _interopRequireDefault$2(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13107. function generateScopedName(name, filename, css) {
  13108. const i = css.indexOf(`.${name}`);
  13109. const lineNumber = css.substr(0, i).split(/[\r\n]/).length;
  13110. const hash = (0, _stringHash2.default)(css).toString(36).substr(0, 5);
  13111. return `_${name}_${hash}_${lineNumber}`;
  13112. }
  13113. var generateScopedName_1 = /*#__PURE__*/Object.defineProperty({
  13114. default: _default$4
  13115. }, '__esModule', {value: true});
  13116. var _default$5 = saveJSON;
  13117. function saveJSON(cssFile, json) {
  13118. return new Promise((resolve, reject) => {
  13119. (0, fs__default.writeFile)(`${cssFile}.json`, JSON.stringify(json), e => e ? reject(e) : resolve(json));
  13120. });
  13121. }
  13122. var saveJSON_1 = /*#__PURE__*/Object.defineProperty({
  13123. default: _default$5
  13124. }, '__esModule', {value: true});
  13125. var openParentheses = "(".charCodeAt(0);
  13126. var closeParentheses = ")".charCodeAt(0);
  13127. var singleQuote = "'".charCodeAt(0);
  13128. var doubleQuote = '"'.charCodeAt(0);
  13129. var backslash = "\\".charCodeAt(0);
  13130. var slash = "/".charCodeAt(0);
  13131. var comma = ",".charCodeAt(0);
  13132. var colon = ":".charCodeAt(0);
  13133. var star = "*".charCodeAt(0);
  13134. var uLower = "u".charCodeAt(0);
  13135. var uUpper = "U".charCodeAt(0);
  13136. var plus = "+".charCodeAt(0);
  13137. var isUnicodeRange = /^[a-f0-9?-]+$/i;
  13138. var parse$2 = function(input) {
  13139. var tokens = [];
  13140. var value = input;
  13141. var next,
  13142. quote,
  13143. prev,
  13144. token,
  13145. escape,
  13146. escapePos,
  13147. whitespacePos,
  13148. parenthesesOpenPos;
  13149. var pos = 0;
  13150. var code = value.charCodeAt(pos);
  13151. var max = value.length;
  13152. var stack = [{ nodes: tokens }];
  13153. var balanced = 0;
  13154. var parent;
  13155. var name = "";
  13156. var before = "";
  13157. var after = "";
  13158. while (pos < max) {
  13159. // Whitespaces
  13160. if (code <= 32) {
  13161. next = pos;
  13162. do {
  13163. next += 1;
  13164. code = value.charCodeAt(next);
  13165. } while (code <= 32);
  13166. token = value.slice(pos, next);
  13167. prev = tokens[tokens.length - 1];
  13168. if (code === closeParentheses && balanced) {
  13169. after = token;
  13170. } else if (prev && prev.type === "div") {
  13171. prev.after = token;
  13172. prev.sourceEndIndex += token.length;
  13173. } else if (
  13174. code === comma ||
  13175. code === colon ||
  13176. (code === slash &&
  13177. value.charCodeAt(next + 1) !== star &&
  13178. (!parent ||
  13179. (parent && parent.type === "function" && parent.value !== "calc")))
  13180. ) {
  13181. before = token;
  13182. } else {
  13183. tokens.push({
  13184. type: "space",
  13185. sourceIndex: pos,
  13186. sourceEndIndex: next,
  13187. value: token
  13188. });
  13189. }
  13190. pos = next;
  13191. // Quotes
  13192. } else if (code === singleQuote || code === doubleQuote) {
  13193. next = pos;
  13194. quote = code === singleQuote ? "'" : '"';
  13195. token = {
  13196. type: "string",
  13197. sourceIndex: pos,
  13198. quote: quote
  13199. };
  13200. do {
  13201. escape = false;
  13202. next = value.indexOf(quote, next + 1);
  13203. if (~next) {
  13204. escapePos = next;
  13205. while (value.charCodeAt(escapePos - 1) === backslash) {
  13206. escapePos -= 1;
  13207. escape = !escape;
  13208. }
  13209. } else {
  13210. value += quote;
  13211. next = value.length - 1;
  13212. token.unclosed = true;
  13213. }
  13214. } while (escape);
  13215. token.value = value.slice(pos + 1, next);
  13216. token.sourceEndIndex = token.unclosed ? next : next + 1;
  13217. tokens.push(token);
  13218. pos = next + 1;
  13219. code = value.charCodeAt(pos);
  13220. // Comments
  13221. } else if (code === slash && value.charCodeAt(pos + 1) === star) {
  13222. next = value.indexOf("*/", pos);
  13223. token = {
  13224. type: "comment",
  13225. sourceIndex: pos,
  13226. sourceEndIndex: next + 2
  13227. };
  13228. if (next === -1) {
  13229. token.unclosed = true;
  13230. next = value.length;
  13231. token.sourceEndIndex = next;
  13232. }
  13233. token.value = value.slice(pos + 2, next);
  13234. tokens.push(token);
  13235. pos = next + 2;
  13236. code = value.charCodeAt(pos);
  13237. // Operation within calc
  13238. } else if (
  13239. (code === slash || code === star) &&
  13240. parent &&
  13241. parent.type === "function" &&
  13242. parent.value === "calc"
  13243. ) {
  13244. token = value[pos];
  13245. tokens.push({
  13246. type: "word",
  13247. sourceIndex: pos - before.length,
  13248. sourceEndIndex: pos + token.length,
  13249. value: token
  13250. });
  13251. pos += 1;
  13252. code = value.charCodeAt(pos);
  13253. // Dividers
  13254. } else if (code === slash || code === comma || code === colon) {
  13255. token = value[pos];
  13256. tokens.push({
  13257. type: "div",
  13258. sourceIndex: pos - before.length,
  13259. sourceEndIndex: pos + token.length,
  13260. value: token,
  13261. before: before,
  13262. after: ""
  13263. });
  13264. before = "";
  13265. pos += 1;
  13266. code = value.charCodeAt(pos);
  13267. // Open parentheses
  13268. } else if (openParentheses === code) {
  13269. // Whitespaces after open parentheses
  13270. next = pos;
  13271. do {
  13272. next += 1;
  13273. code = value.charCodeAt(next);
  13274. } while (code <= 32);
  13275. parenthesesOpenPos = pos;
  13276. token = {
  13277. type: "function",
  13278. sourceIndex: pos - name.length,
  13279. value: name,
  13280. before: value.slice(parenthesesOpenPos + 1, next)
  13281. };
  13282. pos = next;
  13283. if (name === "url" && code !== singleQuote && code !== doubleQuote) {
  13284. next -= 1;
  13285. do {
  13286. escape = false;
  13287. next = value.indexOf(")", next + 1);
  13288. if (~next) {
  13289. escapePos = next;
  13290. while (value.charCodeAt(escapePos - 1) === backslash) {
  13291. escapePos -= 1;
  13292. escape = !escape;
  13293. }
  13294. } else {
  13295. value += ")";
  13296. next = value.length - 1;
  13297. token.unclosed = true;
  13298. }
  13299. } while (escape);
  13300. // Whitespaces before closed
  13301. whitespacePos = next;
  13302. do {
  13303. whitespacePos -= 1;
  13304. code = value.charCodeAt(whitespacePos);
  13305. } while (code <= 32);
  13306. if (parenthesesOpenPos < whitespacePos) {
  13307. if (pos !== whitespacePos + 1) {
  13308. token.nodes = [
  13309. {
  13310. type: "word",
  13311. sourceIndex: pos,
  13312. sourceEndIndex: whitespacePos + 1,
  13313. value: value.slice(pos, whitespacePos + 1)
  13314. }
  13315. ];
  13316. } else {
  13317. token.nodes = [];
  13318. }
  13319. if (token.unclosed && whitespacePos + 1 !== next) {
  13320. token.after = "";
  13321. token.nodes.push({
  13322. type: "space",
  13323. sourceIndex: whitespacePos + 1,
  13324. sourceEndIndex: next,
  13325. value: value.slice(whitespacePos + 1, next)
  13326. });
  13327. } else {
  13328. token.after = value.slice(whitespacePos + 1, next);
  13329. token.sourceEndIndex = next;
  13330. }
  13331. } else {
  13332. token.after = "";
  13333. token.nodes = [];
  13334. }
  13335. pos = next + 1;
  13336. token.sourceEndIndex = token.unclosed ? next : pos;
  13337. code = value.charCodeAt(pos);
  13338. tokens.push(token);
  13339. } else {
  13340. balanced += 1;
  13341. token.after = "";
  13342. token.sourceEndIndex = pos + 1;
  13343. tokens.push(token);
  13344. stack.push(token);
  13345. tokens = token.nodes = [];
  13346. parent = token;
  13347. }
  13348. name = "";
  13349. // Close parentheses
  13350. } else if (closeParentheses === code && balanced) {
  13351. pos += 1;
  13352. code = value.charCodeAt(pos);
  13353. parent.after = after;
  13354. parent.sourceEndIndex += after.length;
  13355. after = "";
  13356. balanced -= 1;
  13357. stack[stack.length - 1].sourceEndIndex = pos;
  13358. stack.pop();
  13359. parent = stack[balanced];
  13360. tokens = parent.nodes;
  13361. // Words
  13362. } else {
  13363. next = pos;
  13364. do {
  13365. if (code === backslash) {
  13366. next += 1;
  13367. }
  13368. next += 1;
  13369. code = value.charCodeAt(next);
  13370. } while (
  13371. next < max &&
  13372. !(
  13373. code <= 32 ||
  13374. code === singleQuote ||
  13375. code === doubleQuote ||
  13376. code === comma ||
  13377. code === colon ||
  13378. code === slash ||
  13379. code === openParentheses ||
  13380. (code === star &&
  13381. parent &&
  13382. parent.type === "function" &&
  13383. parent.value === "calc") ||
  13384. (code === slash &&
  13385. parent.type === "function" &&
  13386. parent.value === "calc") ||
  13387. (code === closeParentheses && balanced)
  13388. )
  13389. );
  13390. token = value.slice(pos, next);
  13391. if (openParentheses === code) {
  13392. name = token;
  13393. } else if (
  13394. (uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) &&
  13395. plus === token.charCodeAt(1) &&
  13396. isUnicodeRange.test(token.slice(2))
  13397. ) {
  13398. tokens.push({
  13399. type: "unicode-range",
  13400. sourceIndex: pos,
  13401. sourceEndIndex: next,
  13402. value: token
  13403. });
  13404. } else {
  13405. tokens.push({
  13406. type: "word",
  13407. sourceIndex: pos,
  13408. sourceEndIndex: next,
  13409. value: token
  13410. });
  13411. }
  13412. pos = next;
  13413. }
  13414. }
  13415. for (pos = stack.length - 1; pos; pos -= 1) {
  13416. stack[pos].unclosed = true;
  13417. stack[pos].sourceEndIndex = value.length;
  13418. }
  13419. return stack[0].nodes;
  13420. };
  13421. var walk = function walk(nodes, cb, bubble) {
  13422. var i, max, node, result;
  13423. for (i = 0, max = nodes.length; i < max; i += 1) {
  13424. node = nodes[i];
  13425. if (!bubble) {
  13426. result = cb(node, i, nodes);
  13427. }
  13428. if (
  13429. result !== false &&
  13430. node.type === "function" &&
  13431. Array.isArray(node.nodes)
  13432. ) {
  13433. walk(node.nodes, cb, bubble);
  13434. }
  13435. if (bubble) {
  13436. cb(node, i, nodes);
  13437. }
  13438. }
  13439. };
  13440. function stringifyNode(node, custom) {
  13441. var type = node.type;
  13442. var value = node.value;
  13443. var buf;
  13444. var customResult;
  13445. if (custom && (customResult = custom(node)) !== undefined) {
  13446. return customResult;
  13447. } else if (type === "word" || type === "space") {
  13448. return value;
  13449. } else if (type === "string") {
  13450. buf = node.quote || "";
  13451. return buf + value + (node.unclosed ? "" : buf);
  13452. } else if (type === "comment") {
  13453. return "/*" + value + (node.unclosed ? "" : "*/");
  13454. } else if (type === "div") {
  13455. return (node.before || "") + value + (node.after || "");
  13456. } else if (Array.isArray(node.nodes)) {
  13457. buf = stringify$1(node.nodes, custom);
  13458. if (type !== "function") {
  13459. return buf;
  13460. }
  13461. return (
  13462. value +
  13463. "(" +
  13464. (node.before || "") +
  13465. buf +
  13466. (node.after || "") +
  13467. (node.unclosed ? "" : ")")
  13468. );
  13469. }
  13470. return value;
  13471. }
  13472. function stringify$1(nodes, custom) {
  13473. var result, i;
  13474. if (Array.isArray(nodes)) {
  13475. result = "";
  13476. for (i = nodes.length - 1; ~i; i -= 1) {
  13477. result = stringifyNode(nodes[i], custom) + result;
  13478. }
  13479. return result;
  13480. }
  13481. return stringifyNode(nodes, custom);
  13482. }
  13483. var stringify_1$1 = stringify$1;
  13484. var minus = "-".charCodeAt(0);
  13485. var plus$1 = "+".charCodeAt(0);
  13486. var dot = ".".charCodeAt(0);
  13487. var exp = "e".charCodeAt(0);
  13488. var EXP = "E".charCodeAt(0);
  13489. // Check if three code points would start a number
  13490. // https://www.w3.org/TR/css-syntax-3/#starts-with-a-number
  13491. function likeNumber(value) {
  13492. var code = value.charCodeAt(0);
  13493. var nextCode;
  13494. if (code === plus$1 || code === minus) {
  13495. nextCode = value.charCodeAt(1);
  13496. if (nextCode >= 48 && nextCode <= 57) {
  13497. return true;
  13498. }
  13499. var nextNextCode = value.charCodeAt(2);
  13500. if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) {
  13501. return true;
  13502. }
  13503. return false;
  13504. }
  13505. if (code === dot) {
  13506. nextCode = value.charCodeAt(1);
  13507. if (nextCode >= 48 && nextCode <= 57) {
  13508. return true;
  13509. }
  13510. return false;
  13511. }
  13512. if (code >= 48 && code <= 57) {
  13513. return true;
  13514. }
  13515. return false;
  13516. }
  13517. // Consume a number
  13518. // https://www.w3.org/TR/css-syntax-3/#consume-number
  13519. var unit = function(value) {
  13520. var pos = 0;
  13521. var length = value.length;
  13522. var code;
  13523. var nextCode;
  13524. var nextNextCode;
  13525. if (length === 0 || !likeNumber(value)) {
  13526. return false;
  13527. }
  13528. code = value.charCodeAt(pos);
  13529. if (code === plus$1 || code === minus) {
  13530. pos++;
  13531. }
  13532. while (pos < length) {
  13533. code = value.charCodeAt(pos);
  13534. if (code < 48 || code > 57) {
  13535. break;
  13536. }
  13537. pos += 1;
  13538. }
  13539. code = value.charCodeAt(pos);
  13540. nextCode = value.charCodeAt(pos + 1);
  13541. if (code === dot && nextCode >= 48 && nextCode <= 57) {
  13542. pos += 2;
  13543. while (pos < length) {
  13544. code = value.charCodeAt(pos);
  13545. if (code < 48 || code > 57) {
  13546. break;
  13547. }
  13548. pos += 1;
  13549. }
  13550. }
  13551. code = value.charCodeAt(pos);
  13552. nextCode = value.charCodeAt(pos + 1);
  13553. nextNextCode = value.charCodeAt(pos + 2);
  13554. if (
  13555. (code === exp || code === EXP) &&
  13556. ((nextCode >= 48 && nextCode <= 57) ||
  13557. ((nextCode === plus$1 || nextCode === minus) &&
  13558. nextNextCode >= 48 &&
  13559. nextNextCode <= 57))
  13560. ) {
  13561. pos += nextCode === plus$1 || nextCode === minus ? 3 : 2;
  13562. while (pos < length) {
  13563. code = value.charCodeAt(pos);
  13564. if (code < 48 || code > 57) {
  13565. break;
  13566. }
  13567. pos += 1;
  13568. }
  13569. }
  13570. return {
  13571. number: value.slice(0, pos),
  13572. unit: value.slice(pos)
  13573. };
  13574. };
  13575. function ValueParser(value) {
  13576. if (this instanceof ValueParser) {
  13577. this.nodes = parse$2(value);
  13578. return this;
  13579. }
  13580. return new ValueParser(value);
  13581. }
  13582. ValueParser.prototype.toString = function() {
  13583. return Array.isArray(this.nodes) ? stringify_1$1(this.nodes) : "";
  13584. };
  13585. ValueParser.prototype.walk = function(cb, bubble) {
  13586. walk(this.nodes, cb, bubble);
  13587. return this;
  13588. };
  13589. ValueParser.unit = unit;
  13590. ValueParser.walk = walk;
  13591. ValueParser.stringify = stringify_1$1;
  13592. var lib$3 = ValueParser;
  13593. const matchValueName = /[$]?[\w-]+/g;
  13594. const replaceValueSymbols = (value, replacements) => {
  13595. let matches;
  13596. while ((matches = matchValueName.exec(value))) {
  13597. const replacement = replacements[matches[0]];
  13598. if (replacement) {
  13599. value =
  13600. value.slice(0, matches.index) +
  13601. replacement +
  13602. value.slice(matchValueName.lastIndex);
  13603. matchValueName.lastIndex -= matches[0].length - replacement.length;
  13604. }
  13605. }
  13606. return value;
  13607. };
  13608. var replaceValueSymbols_1 = replaceValueSymbols;
  13609. const replaceSymbols = (css, replacements) => {
  13610. css.walk((node) => {
  13611. if (node.type === "decl" && node.value) {
  13612. node.value = replaceValueSymbols_1(node.value.toString(), replacements);
  13613. } else if (node.type === "rule" && node.selector) {
  13614. node.selector = replaceValueSymbols_1(
  13615. node.selector.toString(),
  13616. replacements
  13617. );
  13618. } else if (node.type === "atrule" && node.params) {
  13619. node.params = replaceValueSymbols_1(node.params.toString(), replacements);
  13620. }
  13621. });
  13622. };
  13623. var replaceSymbols_1 = replaceSymbols;
  13624. const importPattern = /^:import\(("[^"]*"|'[^']*'|[^"']+)\)$/;
  13625. const balancedQuotes = /^("[^"]*"|'[^']*'|[^"']+)$/;
  13626. const getDeclsObject = (rule) => {
  13627. const object = {};
  13628. rule.walkDecls((decl) => {
  13629. const before = decl.raws.before ? decl.raws.before.trim() : "";
  13630. object[before + decl.prop] = decl.value;
  13631. });
  13632. return object;
  13633. };
  13634. /**
  13635. *
  13636. * @param {string} css
  13637. * @param {boolean} removeRules
  13638. * @param {'auto' | 'rule' | 'at-rule'} mode
  13639. */
  13640. const extractICSS = (css, removeRules = true, mode = "auto") => {
  13641. const icssImports = {};
  13642. const icssExports = {};
  13643. function addImports(node, path) {
  13644. const unquoted = path.replace(/'|"/g, "");
  13645. icssImports[unquoted] = Object.assign(
  13646. icssImports[unquoted] || {},
  13647. getDeclsObject(node)
  13648. );
  13649. if (removeRules) {
  13650. node.remove();
  13651. }
  13652. }
  13653. function addExports(node) {
  13654. Object.assign(icssExports, getDeclsObject(node));
  13655. if (removeRules) {
  13656. node.remove();
  13657. }
  13658. }
  13659. css.each((node) => {
  13660. if (node.type === "rule" && mode !== "at-rule") {
  13661. if (node.selector.slice(0, 7) === ":import") {
  13662. const matches = importPattern.exec(node.selector);
  13663. if (matches) {
  13664. addImports(node, matches[1]);
  13665. }
  13666. }
  13667. if (node.selector === ":export") {
  13668. addExports(node);
  13669. }
  13670. }
  13671. if (node.type === "atrule" && mode !== "rule") {
  13672. if (node.name === "icss-import") {
  13673. const matches = balancedQuotes.exec(node.params);
  13674. if (matches) {
  13675. addImports(node, matches[1]);
  13676. }
  13677. }
  13678. if (node.name === "icss-export") {
  13679. addExports(node);
  13680. }
  13681. }
  13682. });
  13683. return { icssImports, icssExports };
  13684. };
  13685. var extractICSS_1 = extractICSS;
  13686. const createImports = (imports, postcss, mode = "rule") => {
  13687. return Object.keys(imports).map((path) => {
  13688. const aliases = imports[path];
  13689. const declarations = Object.keys(aliases).map((key) =>
  13690. postcss.decl({
  13691. prop: key,
  13692. value: aliases[key],
  13693. raws: { before: "\n " },
  13694. })
  13695. );
  13696. const hasDeclarations = declarations.length > 0;
  13697. const rule =
  13698. mode === "rule"
  13699. ? postcss.rule({
  13700. selector: `:import('${path}')`,
  13701. raws: { after: hasDeclarations ? "\n" : "" },
  13702. })
  13703. : postcss.atRule({
  13704. name: "icss-import",
  13705. params: `'${path}'`,
  13706. raws: { after: hasDeclarations ? "\n" : "" },
  13707. });
  13708. if (hasDeclarations) {
  13709. rule.append(declarations);
  13710. }
  13711. return rule;
  13712. });
  13713. };
  13714. const createExports = (exports, postcss, mode = "rule") => {
  13715. const declarations = Object.keys(exports).map((key) =>
  13716. postcss.decl({
  13717. prop: key,
  13718. value: exports[key],
  13719. raws: { before: "\n " },
  13720. })
  13721. );
  13722. if (declarations.length === 0) {
  13723. return [];
  13724. }
  13725. const rule =
  13726. mode === "rule"
  13727. ? postcss.rule({
  13728. selector: `:export`,
  13729. raws: { after: "\n" },
  13730. })
  13731. : postcss.atRule({
  13732. name: "icss-export",
  13733. raws: { after: "\n" },
  13734. });
  13735. rule.append(declarations);
  13736. return [rule];
  13737. };
  13738. const createICSSRules = (imports, exports, postcss, mode) => [
  13739. ...createImports(imports, postcss, mode),
  13740. ...createExports(exports, postcss, mode),
  13741. ];
  13742. var createICSSRules_1 = createICSSRules;
  13743. var src = {
  13744. replaceValueSymbols: replaceValueSymbols_1,
  13745. replaceSymbols: replaceSymbols_1,
  13746. extractICSS: extractICSS_1,
  13747. createICSSRules: createICSSRules_1,
  13748. };
  13749. const { extractICSS: extractICSS$1 } = src;
  13750. const isSpacing = (node) => node.type === "combinator" && node.value === " ";
  13751. function normalizeNodeArray(nodes) {
  13752. const array = [];
  13753. nodes.forEach((x) => {
  13754. if (Array.isArray(x)) {
  13755. normalizeNodeArray(x).forEach((item) => {
  13756. array.push(item);
  13757. });
  13758. } else if (x) {
  13759. array.push(x);
  13760. }
  13761. });
  13762. if (array.length > 0 && isSpacing(array[array.length - 1])) {
  13763. array.pop();
  13764. }
  13765. return array;
  13766. }
  13767. function localizeNode(rule, mode, localAliasMap) {
  13768. const transform = (node, context) => {
  13769. if (context.ignoreNextSpacing && !isSpacing(node)) {
  13770. throw new Error("Missing whitespace after " + context.ignoreNextSpacing);
  13771. }
  13772. if (context.enforceNoSpacing && isSpacing(node)) {
  13773. throw new Error("Missing whitespace before " + context.enforceNoSpacing);
  13774. }
  13775. let newNodes;
  13776. switch (node.type) {
  13777. case "root": {
  13778. let resultingGlobal;
  13779. context.hasPureGlobals = false;
  13780. newNodes = node.nodes.map((n) => {
  13781. const nContext = {
  13782. global: context.global,
  13783. lastWasSpacing: true,
  13784. hasLocals: false,
  13785. explicit: false,
  13786. };
  13787. n = transform(n, nContext);
  13788. if (typeof resultingGlobal === "undefined") {
  13789. resultingGlobal = nContext.global;
  13790. } else if (resultingGlobal !== nContext.global) {
  13791. throw new Error(
  13792. 'Inconsistent rule global/local result in rule "' +
  13793. node +
  13794. '" (multiple selectors must result in the same mode for the rule)'
  13795. );
  13796. }
  13797. if (!nContext.hasLocals) {
  13798. context.hasPureGlobals = true;
  13799. }
  13800. return n;
  13801. });
  13802. context.global = resultingGlobal;
  13803. node.nodes = normalizeNodeArray(newNodes);
  13804. break;
  13805. }
  13806. case "selector": {
  13807. newNodes = node.map((childNode) => transform(childNode, context));
  13808. node = node.clone();
  13809. node.nodes = normalizeNodeArray(newNodes);
  13810. break;
  13811. }
  13812. case "combinator": {
  13813. if (isSpacing(node)) {
  13814. if (context.ignoreNextSpacing) {
  13815. context.ignoreNextSpacing = false;
  13816. context.lastWasSpacing = false;
  13817. context.enforceNoSpacing = false;
  13818. return null;
  13819. }
  13820. context.lastWasSpacing = true;
  13821. return node;
  13822. }
  13823. break;
  13824. }
  13825. case "pseudo": {
  13826. let childContext;
  13827. const isNested = !!node.length;
  13828. const isScoped = node.value === ":local" || node.value === ":global";
  13829. const isImportExport =
  13830. node.value === ":import" || node.value === ":export";
  13831. if (isImportExport) {
  13832. context.hasLocals = true;
  13833. // :local(.foo)
  13834. } else if (isNested) {
  13835. if (isScoped) {
  13836. if (node.nodes.length === 0) {
  13837. throw new Error(`${node.value}() can't be empty`);
  13838. }
  13839. if (context.inside) {
  13840. throw new Error(
  13841. `A ${node.value} is not allowed inside of a ${context.inside}(...)`
  13842. );
  13843. }
  13844. childContext = {
  13845. global: node.value === ":global",
  13846. inside: node.value,
  13847. hasLocals: false,
  13848. explicit: true,
  13849. };
  13850. newNodes = node
  13851. .map((childNode) => transform(childNode, childContext))
  13852. .reduce((acc, next) => acc.concat(next.nodes), []);
  13853. if (newNodes.length) {
  13854. const { before, after } = node.spaces;
  13855. const first = newNodes[0];
  13856. const last = newNodes[newNodes.length - 1];
  13857. first.spaces = { before, after: first.spaces.after };
  13858. last.spaces = { before: last.spaces.before, after };
  13859. }
  13860. node = newNodes;
  13861. break;
  13862. } else {
  13863. childContext = {
  13864. global: context.global,
  13865. inside: context.inside,
  13866. lastWasSpacing: true,
  13867. hasLocals: false,
  13868. explicit: context.explicit,
  13869. };
  13870. newNodes = node.map((childNode) =>
  13871. transform(childNode, childContext)
  13872. );
  13873. node = node.clone();
  13874. node.nodes = normalizeNodeArray(newNodes);
  13875. if (childContext.hasLocals) {
  13876. context.hasLocals = true;
  13877. }
  13878. }
  13879. break;
  13880. //:local .foo .bar
  13881. } else if (isScoped) {
  13882. if (context.inside) {
  13883. throw new Error(
  13884. `A ${node.value} is not allowed inside of a ${context.inside}(...)`
  13885. );
  13886. }
  13887. const addBackSpacing = !!node.spaces.before;
  13888. context.ignoreNextSpacing = context.lastWasSpacing
  13889. ? node.value
  13890. : false;
  13891. context.enforceNoSpacing = context.lastWasSpacing
  13892. ? false
  13893. : node.value;
  13894. context.global = node.value === ":global";
  13895. context.explicit = true;
  13896. // because this node has spacing that is lost when we remove it
  13897. // we make up for it by adding an extra combinator in since adding
  13898. // spacing on the parent selector doesn't work
  13899. return addBackSpacing
  13900. ? dist.combinator({ value: " " })
  13901. : null;
  13902. }
  13903. break;
  13904. }
  13905. case "id":
  13906. case "class": {
  13907. if (!node.value) {
  13908. throw new Error("Invalid class or id selector syntax");
  13909. }
  13910. if (context.global) {
  13911. break;
  13912. }
  13913. const isImportedValue = localAliasMap.has(node.value);
  13914. const isImportedWithExplicitScope = isImportedValue && context.explicit;
  13915. if (!isImportedValue || isImportedWithExplicitScope) {
  13916. const innerNode = node.clone();
  13917. innerNode.spaces = { before: "", after: "" };
  13918. node = dist.pseudo({
  13919. value: ":local",
  13920. nodes: [innerNode],
  13921. spaces: node.spaces,
  13922. });
  13923. context.hasLocals = true;
  13924. }
  13925. break;
  13926. }
  13927. }
  13928. context.lastWasSpacing = false;
  13929. context.ignoreNextSpacing = false;
  13930. context.enforceNoSpacing = false;
  13931. return node;
  13932. };
  13933. const rootContext = {
  13934. global: mode === "global",
  13935. hasPureGlobals: false,
  13936. };
  13937. rootContext.selector = dist((root) => {
  13938. transform(root, rootContext);
  13939. }).processSync(rule, { updateSelector: false, lossless: true });
  13940. return rootContext;
  13941. }
  13942. function localizeDeclNode(node, context) {
  13943. switch (node.type) {
  13944. case "word":
  13945. if (context.localizeNextItem) {
  13946. if (!context.localAliasMap.has(node.value)) {
  13947. node.value = ":local(" + node.value + ")";
  13948. context.localizeNextItem = false;
  13949. }
  13950. }
  13951. break;
  13952. case "function":
  13953. if (
  13954. context.options &&
  13955. context.options.rewriteUrl &&
  13956. node.value.toLowerCase() === "url"
  13957. ) {
  13958. node.nodes.map((nestedNode) => {
  13959. if (nestedNode.type !== "string" && nestedNode.type !== "word") {
  13960. return;
  13961. }
  13962. let newUrl = context.options.rewriteUrl(
  13963. context.global,
  13964. nestedNode.value
  13965. );
  13966. switch (nestedNode.type) {
  13967. case "string":
  13968. if (nestedNode.quote === "'") {
  13969. newUrl = newUrl.replace(/(\\)/g, "\\$1").replace(/'/g, "\\'");
  13970. }
  13971. if (nestedNode.quote === '"') {
  13972. newUrl = newUrl.replace(/(\\)/g, "\\$1").replace(/"/g, '\\"');
  13973. }
  13974. break;
  13975. case "word":
  13976. newUrl = newUrl.replace(/("|'|\)|\\)/g, "\\$1");
  13977. break;
  13978. }
  13979. nestedNode.value = newUrl;
  13980. });
  13981. }
  13982. break;
  13983. }
  13984. return node;
  13985. }
  13986. function isWordAFunctionArgument(wordNode, functionNode) {
  13987. return functionNode
  13988. ? functionNode.nodes.some(
  13989. (functionNodeChild) =>
  13990. functionNodeChild.sourceIndex === wordNode.sourceIndex
  13991. )
  13992. : false;
  13993. }
  13994. function localizeDeclarationValues(localize, declaration, context) {
  13995. const valueNodes = lib$3(declaration.value);
  13996. valueNodes.walk((node, index, nodes) => {
  13997. const subContext = {
  13998. options: context.options,
  13999. global: context.global,
  14000. localizeNextItem: localize && !context.global,
  14001. localAliasMap: context.localAliasMap,
  14002. };
  14003. nodes[index] = localizeDeclNode(node, subContext);
  14004. });
  14005. declaration.value = valueNodes.toString();
  14006. }
  14007. function localizeDeclaration(declaration, context) {
  14008. const isAnimation = /animation$/i.test(declaration.prop);
  14009. if (isAnimation) {
  14010. const validIdent = /^-?[_a-z][_a-z0-9-]*$/i;
  14011. /*
  14012. The spec defines some keywords that you can use to describe properties such as the timing
  14013. function. These are still valid animation names, so as long as there is a property that accepts
  14014. a keyword, it is given priority. Only when all the properties that can take a keyword are
  14015. exhausted can the animation name be set to the keyword. I.e.
  14016. animation: infinite infinite;
  14017. The animation will repeat an infinite number of times from the first argument, and will have an
  14018. animation name of infinite from the second.
  14019. */
  14020. const animationKeywords = {
  14021. $alternate: 1,
  14022. "$alternate-reverse": 1,
  14023. $backwards: 1,
  14024. $both: 1,
  14025. $ease: 1,
  14026. "$ease-in": 1,
  14027. "$ease-in-out": 1,
  14028. "$ease-out": 1,
  14029. $forwards: 1,
  14030. $infinite: 1,
  14031. $linear: 1,
  14032. $none: Infinity, // No matter how many times you write none, it will never be an animation name
  14033. $normal: 1,
  14034. $paused: 1,
  14035. $reverse: 1,
  14036. $running: 1,
  14037. "$step-end": 1,
  14038. "$step-start": 1,
  14039. $initial: Infinity,
  14040. $inherit: Infinity,
  14041. $unset: Infinity,
  14042. };
  14043. let parsedAnimationKeywords = {};
  14044. let stepsFunctionNode = null;
  14045. const valueNodes = lib$3(declaration.value).walk((node) => {
  14046. /* If div-token appeared (represents as comma ','), a possibility of an animation-keywords should be reflesh. */
  14047. if (node.type === "div") {
  14048. parsedAnimationKeywords = {};
  14049. }
  14050. if (node.type === "function" && node.value.toLowerCase() === "steps") {
  14051. stepsFunctionNode = node;
  14052. }
  14053. const value =
  14054. node.type === "word" &&
  14055. !isWordAFunctionArgument(node, stepsFunctionNode)
  14056. ? node.value.toLowerCase()
  14057. : null;
  14058. let shouldParseAnimationName = false;
  14059. if (value && validIdent.test(value)) {
  14060. if ("$" + value in animationKeywords) {
  14061. parsedAnimationKeywords["$" + value] =
  14062. "$" + value in parsedAnimationKeywords
  14063. ? parsedAnimationKeywords["$" + value] + 1
  14064. : 0;
  14065. shouldParseAnimationName =
  14066. parsedAnimationKeywords["$" + value] >=
  14067. animationKeywords["$" + value];
  14068. } else {
  14069. shouldParseAnimationName = true;
  14070. }
  14071. }
  14072. const subContext = {
  14073. options: context.options,
  14074. global: context.global,
  14075. localizeNextItem: shouldParseAnimationName && !context.global,
  14076. localAliasMap: context.localAliasMap,
  14077. };
  14078. return localizeDeclNode(node, subContext);
  14079. });
  14080. declaration.value = valueNodes.toString();
  14081. return;
  14082. }
  14083. const isAnimationName = /animation(-name)?$/i.test(declaration.prop);
  14084. if (isAnimationName) {
  14085. return localizeDeclarationValues(true, declaration, context);
  14086. }
  14087. const hasUrl = /url\(/i.test(declaration.value);
  14088. if (hasUrl) {
  14089. return localizeDeclarationValues(false, declaration, context);
  14090. }
  14091. }
  14092. var src$1 = (options = {}) => {
  14093. if (
  14094. options &&
  14095. options.mode &&
  14096. options.mode !== "global" &&
  14097. options.mode !== "local" &&
  14098. options.mode !== "pure"
  14099. ) {
  14100. throw new Error(
  14101. 'options.mode must be either "global", "local" or "pure" (default "local")'
  14102. );
  14103. }
  14104. const pureMode = options && options.mode === "pure";
  14105. const globalMode = options && options.mode === "global";
  14106. return {
  14107. postcssPlugin: "postcss-modules-local-by-default",
  14108. prepare() {
  14109. const localAliasMap = new Map();
  14110. return {
  14111. Once(root) {
  14112. const { icssImports } = extractICSS$1(root, false);
  14113. Object.keys(icssImports).forEach((key) => {
  14114. Object.keys(icssImports[key]).forEach((prop) => {
  14115. localAliasMap.set(prop, icssImports[key][prop]);
  14116. });
  14117. });
  14118. root.walkAtRules((atRule) => {
  14119. if (/keyframes$/i.test(atRule.name)) {
  14120. const globalMatch = /^\s*:global\s*\((.+)\)\s*$/.exec(
  14121. atRule.params
  14122. );
  14123. const localMatch = /^\s*:local\s*\((.+)\)\s*$/.exec(
  14124. atRule.params
  14125. );
  14126. let globalKeyframes = globalMode;
  14127. if (globalMatch) {
  14128. if (pureMode) {
  14129. throw atRule.error(
  14130. "@keyframes :global(...) is not allowed in pure mode"
  14131. );
  14132. }
  14133. atRule.params = globalMatch[1];
  14134. globalKeyframes = true;
  14135. } else if (localMatch) {
  14136. atRule.params = localMatch[0];
  14137. globalKeyframes = false;
  14138. } else if (!globalMode) {
  14139. if (atRule.params && !localAliasMap.has(atRule.params)) {
  14140. atRule.params = ":local(" + atRule.params + ")";
  14141. }
  14142. }
  14143. atRule.walkDecls((declaration) => {
  14144. localizeDeclaration(declaration, {
  14145. localAliasMap,
  14146. options: options,
  14147. global: globalKeyframes,
  14148. });
  14149. });
  14150. } else if (atRule.nodes) {
  14151. atRule.nodes.forEach((declaration) => {
  14152. if (declaration.type === "decl") {
  14153. localizeDeclaration(declaration, {
  14154. localAliasMap,
  14155. options: options,
  14156. global: globalMode,
  14157. });
  14158. }
  14159. });
  14160. }
  14161. });
  14162. root.walkRules((rule) => {
  14163. if (
  14164. rule.parent &&
  14165. rule.parent.type === "atrule" &&
  14166. /keyframes$/i.test(rule.parent.name)
  14167. ) {
  14168. // ignore keyframe rules
  14169. return;
  14170. }
  14171. const context = localizeNode(rule, options.mode, localAliasMap);
  14172. context.options = options;
  14173. context.localAliasMap = localAliasMap;
  14174. if (pureMode && context.hasPureGlobals) {
  14175. throw rule.error(
  14176. 'Selector "' +
  14177. rule.selector +
  14178. '" is not pure ' +
  14179. "(pure selectors must contain at least one local class or id)"
  14180. );
  14181. }
  14182. rule.selector = context.selector;
  14183. // Less-syntax mixins parse as rules with no nodes
  14184. if (rule.nodes) {
  14185. rule.nodes.forEach((declaration) =>
  14186. localizeDeclaration(declaration, context)
  14187. );
  14188. }
  14189. });
  14190. },
  14191. };
  14192. },
  14193. };
  14194. };
  14195. var postcss = true;
  14196. src$1.postcss = postcss;
  14197. const PERMANENT_MARKER = 2;
  14198. const TEMPORARY_MARKER = 1;
  14199. function createError(node, graph) {
  14200. const er = new Error("Nondeterministic import's order");
  14201. const related = graph[node];
  14202. const relatedNode = related.find(
  14203. (relatedNode) => graph[relatedNode].indexOf(node) > -1
  14204. );
  14205. er.nodes = [node, relatedNode];
  14206. return er;
  14207. }
  14208. function walkGraph(node, graph, state, result, strict) {
  14209. if (state[node] === PERMANENT_MARKER) {
  14210. return;
  14211. }
  14212. if (state[node] === TEMPORARY_MARKER) {
  14213. if (strict) {
  14214. return createError(node, graph);
  14215. }
  14216. return;
  14217. }
  14218. state[node] = TEMPORARY_MARKER;
  14219. const children = graph[node];
  14220. const length = children.length;
  14221. for (let i = 0; i < length; ++i) {
  14222. const error = walkGraph(children[i], graph, state, result, strict);
  14223. if (error instanceof Error) {
  14224. return error;
  14225. }
  14226. }
  14227. state[node] = PERMANENT_MARKER;
  14228. result.push(node);
  14229. }
  14230. function topologicalSort(graph, strict) {
  14231. const result = [];
  14232. const state = {};
  14233. const nodes = Object.keys(graph);
  14234. const length = nodes.length;
  14235. for (let i = 0; i < length; ++i) {
  14236. const er = walkGraph(nodes[i], graph, state, result, strict);
  14237. if (er instanceof Error) {
  14238. return er;
  14239. }
  14240. }
  14241. return result;
  14242. }
  14243. var topologicalSort_1 = topologicalSort;
  14244. const matchImports = /^(.+?)\s+from\s+(?:"([^"]+)"|'([^']+)'|(global))$/;
  14245. const icssImport = /^:import\((?:"([^"]+)"|'([^']+)')\)/;
  14246. const VISITED_MARKER = 1;
  14247. /**
  14248. * :import('G') {}
  14249. *
  14250. * Rule
  14251. * composes: ... from 'A'
  14252. * composes: ... from 'B'
  14253. * Rule
  14254. * composes: ... from 'A'
  14255. * composes: ... from 'A'
  14256. * composes: ... from 'C'
  14257. *
  14258. * Results in:
  14259. *
  14260. * graph: {
  14261. * G: [],
  14262. * A: [],
  14263. * B: ['A'],
  14264. * C: ['A'],
  14265. * }
  14266. */
  14267. function addImportToGraph(importId, parentId, graph, visited) {
  14268. const siblingsId = parentId + "_" + "siblings";
  14269. const visitedId = parentId + "_" + importId;
  14270. if (visited[visitedId] !== VISITED_MARKER) {
  14271. if (!Array.isArray(visited[siblingsId])) {
  14272. visited[siblingsId] = [];
  14273. }
  14274. const siblings = visited[siblingsId];
  14275. if (Array.isArray(graph[importId])) {
  14276. graph[importId] = graph[importId].concat(siblings);
  14277. } else {
  14278. graph[importId] = siblings.slice();
  14279. }
  14280. visited[visitedId] = VISITED_MARKER;
  14281. siblings.push(importId);
  14282. }
  14283. }
  14284. var src$2 = (options = {}) => {
  14285. let importIndex = 0;
  14286. const createImportedName =
  14287. typeof options.createImportedName !== "function"
  14288. ? (importName /*, path*/) =>
  14289. `i__imported_${importName.replace(/\W/g, "_")}_${importIndex++}`
  14290. : options.createImportedName;
  14291. const failOnWrongOrder = options.failOnWrongOrder;
  14292. return {
  14293. postcssPlugin: "postcss-modules-extract-imports",
  14294. prepare() {
  14295. const graph = {};
  14296. const visited = {};
  14297. const existingImports = {};
  14298. const importDecls = {};
  14299. const imports = {};
  14300. return {
  14301. Once(root, postcss) {
  14302. // Check the existing imports order and save refs
  14303. root.walkRules((rule) => {
  14304. const matches = icssImport.exec(rule.selector);
  14305. if (matches) {
  14306. const [, /*match*/ doubleQuotePath, singleQuotePath] = matches;
  14307. const importPath = doubleQuotePath || singleQuotePath;
  14308. addImportToGraph(importPath, "root", graph, visited);
  14309. existingImports[importPath] = rule;
  14310. }
  14311. });
  14312. root.walkDecls(/^composes$/, (declaration) => {
  14313. const matches = declaration.value.match(matchImports);
  14314. if (!matches) {
  14315. return;
  14316. }
  14317. let tmpSymbols;
  14318. let [
  14319. ,
  14320. /*match*/ symbols,
  14321. doubleQuotePath,
  14322. singleQuotePath,
  14323. global,
  14324. ] = matches;
  14325. if (global) {
  14326. // Composing globals simply means changing these classes to wrap them in global(name)
  14327. tmpSymbols = symbols.split(/\s+/).map((s) => `global(${s})`);
  14328. } else {
  14329. const importPath = doubleQuotePath || singleQuotePath;
  14330. let parent = declaration.parent;
  14331. let parentIndexes = "";
  14332. while (parent.type !== "root") {
  14333. parentIndexes =
  14334. parent.parent.index(parent) + "_" + parentIndexes;
  14335. parent = parent.parent;
  14336. }
  14337. const { selector } = declaration.parent;
  14338. const parentRule = `_${parentIndexes}${selector}`;
  14339. addImportToGraph(importPath, parentRule, graph, visited);
  14340. importDecls[importPath] = declaration;
  14341. imports[importPath] = imports[importPath] || {};
  14342. tmpSymbols = symbols.split(/\s+/).map((s) => {
  14343. if (!imports[importPath][s]) {
  14344. imports[importPath][s] = createImportedName(s, importPath);
  14345. }
  14346. return imports[importPath][s];
  14347. });
  14348. }
  14349. declaration.value = tmpSymbols.join(" ");
  14350. });
  14351. const importsOrder = topologicalSort_1(graph, failOnWrongOrder);
  14352. if (importsOrder instanceof Error) {
  14353. const importPath = importsOrder.nodes.find((importPath) =>
  14354. // eslint-disable-next-line no-prototype-builtins
  14355. importDecls.hasOwnProperty(importPath)
  14356. );
  14357. const decl = importDecls[importPath];
  14358. throw decl.error(
  14359. "Failed to resolve order of composed modules " +
  14360. importsOrder.nodes
  14361. .map((importPath) => "`" + importPath + "`")
  14362. .join(", ") +
  14363. ".",
  14364. {
  14365. plugin: "postcss-modules-extract-imports",
  14366. word: "composes",
  14367. }
  14368. );
  14369. }
  14370. let lastImportRule;
  14371. importsOrder.forEach((path) => {
  14372. const importedSymbols = imports[path];
  14373. let rule = existingImports[path];
  14374. if (!rule && importedSymbols) {
  14375. rule = postcss.rule({
  14376. selector: `:import("${path}")`,
  14377. raws: { after: "\n" },
  14378. });
  14379. if (lastImportRule) {
  14380. root.insertAfter(lastImportRule, rule);
  14381. } else {
  14382. root.prepend(rule);
  14383. }
  14384. }
  14385. lastImportRule = rule;
  14386. if (!importedSymbols) {
  14387. return;
  14388. }
  14389. Object.keys(importedSymbols).forEach((importedSymbol) => {
  14390. rule.append(
  14391. postcss.decl({
  14392. value: importedSymbol,
  14393. prop: importedSymbols[importedSymbol],
  14394. raws: { before: "\n " },
  14395. })
  14396. );
  14397. });
  14398. });
  14399. },
  14400. };
  14401. },
  14402. };
  14403. };
  14404. var postcss$1 = true;
  14405. src$2.postcss = postcss$1;
  14406. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  14407. function getSingleLocalNamesForComposes(root) {
  14408. return root.nodes.map((node) => {
  14409. if (node.type !== "selector" || node.nodes.length !== 1) {
  14410. throw new Error(
  14411. `composition is only allowed when selector is single :local class name not in "${root}"`
  14412. );
  14413. }
  14414. node = node.nodes[0];
  14415. if (
  14416. node.type !== "pseudo" ||
  14417. node.value !== ":local" ||
  14418. node.nodes.length !== 1
  14419. ) {
  14420. throw new Error(
  14421. 'composition is only allowed when selector is single :local class name not in "' +
  14422. root +
  14423. '", "' +
  14424. node +
  14425. '" is weird'
  14426. );
  14427. }
  14428. node = node.first;
  14429. if (node.type !== "selector" || node.length !== 1) {
  14430. throw new Error(
  14431. 'composition is only allowed when selector is single :local class name not in "' +
  14432. root +
  14433. '", "' +
  14434. node +
  14435. '" is weird'
  14436. );
  14437. }
  14438. node = node.first;
  14439. if (node.type !== "class") {
  14440. // 'id' is not possible, because you can't compose ids
  14441. throw new Error(
  14442. 'composition is only allowed when selector is single :local class name not in "' +
  14443. root +
  14444. '", "' +
  14445. node +
  14446. '" is weird'
  14447. );
  14448. }
  14449. return node.value;
  14450. });
  14451. }
  14452. const whitespace = "[\\x20\\t\\r\\n\\f]";
  14453. const unescapeRegExp = new RegExp(
  14454. "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)",
  14455. "ig"
  14456. );
  14457. function unescape(str) {
  14458. return str.replace(unescapeRegExp, (_, escaped, escapedWhitespace) => {
  14459. const high = "0x" + escaped - 0x10000;
  14460. // NaN means non-codepoint
  14461. // Workaround erroneous numeric interpretation of +"0x"
  14462. return high !== high || escapedWhitespace
  14463. ? escaped
  14464. : high < 0
  14465. ? // BMP codepoint
  14466. String.fromCharCode(high + 0x10000)
  14467. : // Supplemental Plane codepoint (surrogate pair)
  14468. String.fromCharCode((high >> 10) | 0xd800, (high & 0x3ff) | 0xdc00);
  14469. });
  14470. }
  14471. const plugin = (options = {}) => {
  14472. const generateScopedName =
  14473. (options && options.generateScopedName) || plugin.generateScopedName;
  14474. const generateExportEntry =
  14475. (options && options.generateExportEntry) || plugin.generateExportEntry;
  14476. const exportGlobals = options && options.exportGlobals;
  14477. return {
  14478. postcssPlugin: "postcss-modules-scope",
  14479. Once(root, { rule }) {
  14480. const exports = Object.create(null);
  14481. function exportScopedName(name, rawName) {
  14482. const scopedName = generateScopedName(
  14483. rawName ? rawName : name,
  14484. root.source.input.from,
  14485. root.source.input.css
  14486. );
  14487. const exportEntry = generateExportEntry(
  14488. rawName ? rawName : name,
  14489. scopedName,
  14490. root.source.input.from,
  14491. root.source.input.css
  14492. );
  14493. const { key, value } = exportEntry;
  14494. exports[key] = exports[key] || [];
  14495. if (exports[key].indexOf(value) < 0) {
  14496. exports[key].push(value);
  14497. }
  14498. return scopedName;
  14499. }
  14500. function localizeNode(node) {
  14501. switch (node.type) {
  14502. case "selector":
  14503. node.nodes = node.map(localizeNode);
  14504. return node;
  14505. case "class":
  14506. return dist.className({
  14507. value: exportScopedName(
  14508. node.value,
  14509. node.raws && node.raws.value ? node.raws.value : null
  14510. ),
  14511. });
  14512. case "id": {
  14513. return dist.id({
  14514. value: exportScopedName(
  14515. node.value,
  14516. node.raws && node.raws.value ? node.raws.value : null
  14517. ),
  14518. });
  14519. }
  14520. }
  14521. throw new Error(
  14522. `${node.type} ("${node}") is not allowed in a :local block`
  14523. );
  14524. }
  14525. function traverseNode(node) {
  14526. switch (node.type) {
  14527. case "pseudo":
  14528. if (node.value === ":local") {
  14529. if (node.nodes.length !== 1) {
  14530. throw new Error('Unexpected comma (",") in :local block');
  14531. }
  14532. const selector = localizeNode(node.first, node.spaces);
  14533. // move the spaces that were around the psuedo selector to the first
  14534. // non-container node
  14535. selector.first.spaces = node.spaces;
  14536. const nextNode = node.next();
  14537. if (
  14538. nextNode &&
  14539. nextNode.type === "combinator" &&
  14540. nextNode.value === " " &&
  14541. /\\[A-F0-9]{1,6}$/.test(selector.last.value)
  14542. ) {
  14543. selector.last.spaces.after = " ";
  14544. }
  14545. node.replaceWith(selector);
  14546. return;
  14547. }
  14548. /* falls through */
  14549. case "root":
  14550. case "selector": {
  14551. node.each(traverseNode);
  14552. break;
  14553. }
  14554. case "id":
  14555. case "class":
  14556. if (exportGlobals) {
  14557. exports[node.value] = [node.value];
  14558. }
  14559. break;
  14560. }
  14561. return node;
  14562. }
  14563. // Find any :import and remember imported names
  14564. const importedNames = {};
  14565. root.walkRules(/^:import\(.+\)$/, (rule) => {
  14566. rule.walkDecls((decl) => {
  14567. importedNames[decl.prop] = true;
  14568. });
  14569. });
  14570. // Find any :local selectors
  14571. root.walkRules((rule) => {
  14572. let parsedSelector = dist().astSync(rule);
  14573. rule.selector = traverseNode(parsedSelector.clone()).toString();
  14574. rule.walkDecls(/composes|compose-with/i, (decl) => {
  14575. const localNames = getSingleLocalNamesForComposes(parsedSelector);
  14576. const classes = decl.value.split(/\s+/);
  14577. classes.forEach((className) => {
  14578. const global = /^global\(([^)]+)\)$/.exec(className);
  14579. if (global) {
  14580. localNames.forEach((exportedName) => {
  14581. exports[exportedName].push(global[1]);
  14582. });
  14583. } else if (hasOwnProperty$1.call(importedNames, className)) {
  14584. localNames.forEach((exportedName) => {
  14585. exports[exportedName].push(className);
  14586. });
  14587. } else if (hasOwnProperty$1.call(exports, className)) {
  14588. localNames.forEach((exportedName) => {
  14589. exports[className].forEach((item) => {
  14590. exports[exportedName].push(item);
  14591. });
  14592. });
  14593. } else {
  14594. throw decl.error(
  14595. `referenced class name "${className}" in ${decl.prop} not found`
  14596. );
  14597. }
  14598. });
  14599. decl.remove();
  14600. });
  14601. // Find any :local values
  14602. rule.walkDecls((decl) => {
  14603. if (!/:local\s*\((.+?)\)/.test(decl.value)) {
  14604. return;
  14605. }
  14606. let tokens = decl.value.split(/(,|'[^']*'|"[^"]*")/);
  14607. tokens = tokens.map((token, idx) => {
  14608. if (idx === 0 || tokens[idx - 1] === ",") {
  14609. let result = token;
  14610. const localMatch = /:local\s*\((.+?)\)/.exec(token);
  14611. if (localMatch) {
  14612. const input = localMatch.input;
  14613. const matchPattern = localMatch[0];
  14614. const matchVal = localMatch[1];
  14615. const newVal = exportScopedName(matchVal);
  14616. result = input.replace(matchPattern, newVal);
  14617. } else {
  14618. return token;
  14619. }
  14620. return result;
  14621. } else {
  14622. return token;
  14623. }
  14624. });
  14625. decl.value = tokens.join("");
  14626. });
  14627. });
  14628. // Find any :local keyframes
  14629. root.walkAtRules(/keyframes$/i, (atRule) => {
  14630. const localMatch = /^\s*:local\s*\((.+?)\)\s*$/.exec(atRule.params);
  14631. if (!localMatch) {
  14632. return;
  14633. }
  14634. atRule.params = exportScopedName(localMatch[1]);
  14635. });
  14636. // If we found any :locals, insert an :export rule
  14637. const exportedNames = Object.keys(exports);
  14638. if (exportedNames.length > 0) {
  14639. const exportRule = rule({ selector: ":export" });
  14640. exportedNames.forEach((exportedName) =>
  14641. exportRule.append({
  14642. prop: exportedName,
  14643. value: exports[exportedName].join(" "),
  14644. raws: { before: "\n " },
  14645. })
  14646. );
  14647. root.append(exportRule);
  14648. }
  14649. },
  14650. };
  14651. };
  14652. plugin.postcss = true;
  14653. plugin.generateScopedName = function (name, path) {
  14654. const sanitisedPath = path
  14655. .replace(/\.[^./\\]+$/, "")
  14656. .replace(/[\W_]+/g, "_")
  14657. .replace(/^_|_$/g, "");
  14658. return `_${sanitisedPath}__${name}`.trim();
  14659. };
  14660. plugin.generateExportEntry = function (name, scopedName) {
  14661. return {
  14662. key: unescape(name),
  14663. value: unescape(scopedName),
  14664. };
  14665. };
  14666. var src$3 = plugin;
  14667. const matchImports$1 = /^(.+?|\([\s\S]+?\))\s+from\s+("[^"]*"|'[^']*'|[\w-]+)$/;
  14668. const matchValueDefinition = /(?:\s+|^)([\w-]+):?(.*?)$/;
  14669. const matchImport = /^([\w-]+)(?:\s+as\s+([\w-]+))?/;
  14670. var src$4 = (options) => {
  14671. let importIndex = 0;
  14672. const createImportedName =
  14673. (options && options.createImportedName) ||
  14674. ((importName /*, path*/) =>
  14675. `i__const_${importName.replace(/\W/g, "_")}_${importIndex++}`);
  14676. return {
  14677. postcssPlugin: "postcss-modules-values",
  14678. prepare(result) {
  14679. const importAliases = [];
  14680. const definitions = {};
  14681. return {
  14682. Once(root, postcss) {
  14683. root.walkAtRules(/value/i, (atRule) => {
  14684. const matches = atRule.params.match(matchImports$1);
  14685. if (matches) {
  14686. let [, /*match*/ aliases, path] = matches;
  14687. // We can use constants for path names
  14688. if (definitions[path]) {
  14689. path = definitions[path];
  14690. }
  14691. const imports = aliases
  14692. .replace(/^\(\s*([\s\S]+)\s*\)$/, "$1")
  14693. .split(/\s*,\s*/)
  14694. .map((alias) => {
  14695. const tokens = matchImport.exec(alias);
  14696. if (tokens) {
  14697. const [, /*match*/ theirName, myName = theirName] = tokens;
  14698. const importedName = createImportedName(myName);
  14699. definitions[myName] = importedName;
  14700. return { theirName, importedName };
  14701. } else {
  14702. throw new Error(`@import statement "${alias}" is invalid!`);
  14703. }
  14704. });
  14705. importAliases.push({ path, imports });
  14706. atRule.remove();
  14707. return;
  14708. }
  14709. if (atRule.params.indexOf("@value") !== -1) {
  14710. result.warn("Invalid value definition: " + atRule.params);
  14711. }
  14712. let [, key, value] = `${atRule.params}${atRule.raws.between}`.match(
  14713. matchValueDefinition
  14714. );
  14715. const normalizedValue = value.replace(/\/\*((?!\*\/).*?)\*\//g, "");
  14716. if (normalizedValue.length === 0) {
  14717. result.warn("Invalid value definition: " + atRule.params);
  14718. atRule.remove();
  14719. return;
  14720. }
  14721. let isOnlySpace = /^\s+$/.test(normalizedValue);
  14722. if (!isOnlySpace) {
  14723. value = value.trim();
  14724. }
  14725. // Add to the definitions, knowing that values can refer to each other
  14726. definitions[key] = src.replaceValueSymbols(
  14727. value,
  14728. definitions
  14729. );
  14730. atRule.remove();
  14731. });
  14732. /* If we have no definitions, don't continue */
  14733. if (!Object.keys(definitions).length) {
  14734. return;
  14735. }
  14736. /* Perform replacements */
  14737. src.replaceSymbols(root, definitions);
  14738. /* 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 */
  14739. const exportDeclarations = Object.keys(definitions).map((key) =>
  14740. postcss.decl({
  14741. value: definitions[key],
  14742. prop: key,
  14743. raws: { before: "\n " },
  14744. })
  14745. );
  14746. /* Add export rules if any */
  14747. if (exportDeclarations.length > 0) {
  14748. const exportRule = postcss.rule({
  14749. selector: ":export",
  14750. raws: { after: "\n" },
  14751. });
  14752. exportRule.append(exportDeclarations);
  14753. root.prepend(exportRule);
  14754. }
  14755. /* Add import rules */
  14756. importAliases.reverse().forEach(({ path, imports }) => {
  14757. const importRule = postcss.rule({
  14758. selector: `:import(${path})`,
  14759. raws: { after: "\n" },
  14760. });
  14761. imports.forEach(({ theirName, importedName }) => {
  14762. importRule.append({
  14763. value: theirName,
  14764. prop: importedName,
  14765. raws: { before: "\n " },
  14766. });
  14767. });
  14768. root.prepend(importRule);
  14769. });
  14770. },
  14771. };
  14772. },
  14773. };
  14774. };
  14775. var postcss$2 = true;
  14776. src$4.postcss = postcss$2;
  14777. var behaviours_1 = createCommonjsModule(function (module, exports) {
  14778. Object.defineProperty(exports, "__esModule", {
  14779. value: true
  14780. });
  14781. exports.behaviours = undefined;
  14782. exports.getDefaultPlugins = getDefaultPlugins;
  14783. exports.isValidBehaviour = isValidBehaviour;
  14784. var _postcssModulesLocalByDefault2 = _interopRequireDefault(src$1);
  14785. var _postcssModulesExtractImports2 = _interopRequireDefault(src$2);
  14786. var _postcssModulesScope2 = _interopRequireDefault(src$3);
  14787. var _postcssModulesValues2 = _interopRequireDefault(src$4);
  14788. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14789. const behaviours = exports.behaviours = {
  14790. LOCAL: "local",
  14791. GLOBAL: "global"
  14792. };
  14793. function getDefaultPlugins({
  14794. behaviour,
  14795. generateScopedName,
  14796. exportGlobals
  14797. }) {
  14798. const scope = (0, _postcssModulesScope2.default)({ generateScopedName, exportGlobals });
  14799. const plugins = {
  14800. [behaviours.LOCAL]: [_postcssModulesValues2.default, _postcssModulesLocalByDefault2.default, _postcssModulesExtractImports2.default, scope],
  14801. [behaviours.GLOBAL]: [_postcssModulesValues2.default, _postcssModulesExtractImports2.default, scope]
  14802. };
  14803. return plugins[behaviour];
  14804. }
  14805. function isValidBehaviour(behaviour) {
  14806. return Object.keys(behaviours).map(key => behaviours[key]).indexOf(behaviour) > -1;
  14807. }
  14808. });
  14809. var _postcss2$1 = _interopRequireDefault$3(_postcss__default);
  14810. var _lodash2 = _interopRequireDefault$3(lodash_camelcase);
  14811. var _genericNames2 = _interopRequireDefault$3(genericNames);
  14812. var _unquote2 = _interopRequireDefault$3(unquote_1);
  14813. var _parser2$1 = _interopRequireDefault$3(parser$1);
  14814. var _loader2 = _interopRequireDefault$3(loader);
  14815. var _generateScopedName2 = _interopRequireDefault$3(generateScopedName_1);
  14816. var _saveJSON2 = _interopRequireDefault$3(saveJSON_1);
  14817. function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14818. 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"); }); }; }
  14819. const PLUGIN_NAME = "postcss-modules";
  14820. function getDefaultScopeBehaviour(opts) {
  14821. if (opts.scopeBehaviour && (0, behaviours_1.isValidBehaviour)(opts.scopeBehaviour)) {
  14822. return opts.scopeBehaviour;
  14823. }
  14824. return behaviours_1.behaviours.LOCAL;
  14825. }
  14826. function getScopedNameGenerator(opts) {
  14827. const scopedNameGenerator = opts.generateScopedName || _generateScopedName2.default;
  14828. if (typeof scopedNameGenerator === "function") return scopedNameGenerator;
  14829. return (0, _genericNames2.default)(scopedNameGenerator, {
  14830. context: process.cwd(),
  14831. hashPrefix: opts.hashPrefix
  14832. });
  14833. }
  14834. function getLoader(opts, plugins) {
  14835. const root = typeof opts.root === "undefined" ? "/" : opts.root;
  14836. return typeof opts.Loader === "function" ? new opts.Loader(root, plugins) : new _loader2.default(root, plugins);
  14837. }
  14838. function isGlobalModule(globalModules, inputFile) {
  14839. return globalModules.some(regex => inputFile.match(regex));
  14840. }
  14841. function getDefaultPluginsList(opts, inputFile) {
  14842. const globalModulesList = opts.globalModulePaths || null;
  14843. const exportGlobals = opts.exportGlobals || false;
  14844. const defaultBehaviour = getDefaultScopeBehaviour(opts);
  14845. const generateScopedName = getScopedNameGenerator(opts);
  14846. if (globalModulesList && isGlobalModule(globalModulesList, inputFile)) {
  14847. return (0, behaviours_1.getDefaultPlugins)({
  14848. behaviour: behaviours_1.behaviours.GLOBAL,
  14849. generateScopedName,
  14850. exportGlobals
  14851. });
  14852. }
  14853. return (0, behaviours_1.getDefaultPlugins)({
  14854. behaviour: defaultBehaviour,
  14855. generateScopedName,
  14856. exportGlobals
  14857. });
  14858. }
  14859. function isOurPlugin(plugin) {
  14860. return plugin.postcssPlugin === PLUGIN_NAME;
  14861. }
  14862. function dashesCamelCase(string) {
  14863. return string.replace(/-+(\w)/g, (_, firstLetter) => firstLetter.toUpperCase());
  14864. }
  14865. var build = (opts = {}) => {
  14866. return {
  14867. postcssPlugin: PLUGIN_NAME,
  14868. OnceExit(css, { result }) {
  14869. return _asyncToGenerator(function* () {
  14870. const getJSON = opts.getJSON || _saveJSON2.default;
  14871. const inputFile = css.source.input.file;
  14872. const pluginList = getDefaultPluginsList(opts, inputFile);
  14873. const resultPluginIndex = result.processor.plugins.findIndex(function (plugin) {
  14874. return isOurPlugin(plugin);
  14875. });
  14876. if (resultPluginIndex === -1) {
  14877. throw new Error('Plugin missing from options.');
  14878. }
  14879. const earlierPlugins = result.processor.plugins.slice(0, resultPluginIndex);
  14880. const loaderPlugins = [...earlierPlugins, ...pluginList];
  14881. const loader = getLoader(opts, loaderPlugins);
  14882. const fetcher = function fetcher(file, relativeTo, depTrace) {
  14883. const unquoteFile = (0, _unquote2.default)(file);
  14884. const resolvedResult = typeof opts.resolve === 'function' && opts.resolve(unquoteFile);
  14885. const resolvedFile = resolvedResult instanceof Promise ? resolvedResult : Promise.resolve(resolvedResult);
  14886. return resolvedFile.then(function (f) {
  14887. return loader.fetch.call(loader, `"${f || unquoteFile}"`, relativeTo, depTrace);
  14888. });
  14889. };
  14890. const parser = new _parser2$1.default(fetcher);
  14891. yield (0, _postcss2$1.default)([...pluginList, parser.plugin()]).process(css, {
  14892. from: inputFile
  14893. });
  14894. const out = loader.finalSource;
  14895. if (out) css.prepend(out);
  14896. if (opts.localsConvention) {
  14897. const isFunc = typeof opts.localsConvention === "function";
  14898. parser.exportTokens = Object.entries(parser.exportTokens).reduce(function (tokens, [className, value]) {
  14899. if (isFunc) {
  14900. tokens[opts.localsConvention(className, value, inputFile)] = value;
  14901. return tokens;
  14902. }
  14903. switch (opts.localsConvention) {
  14904. case "camelCase":
  14905. tokens[className] = value;
  14906. tokens[(0, _lodash2.default)(className)] = value;
  14907. break;
  14908. case "camelCaseOnly":
  14909. tokens[(0, _lodash2.default)(className)] = value;
  14910. break;
  14911. case "dashes":
  14912. tokens[className] = value;
  14913. tokens[dashesCamelCase(className)] = value;
  14914. break;
  14915. case "dashesOnly":
  14916. tokens[dashesCamelCase(className)] = value;
  14917. break;
  14918. }
  14919. return tokens;
  14920. }, {});
  14921. }
  14922. result.messages.push({
  14923. type: "export",
  14924. plugin: "postcss-modules",
  14925. exportTokens: parser.exportTokens
  14926. });
  14927. // getJSON may return a promise
  14928. return getJSON(css.source.input.file, parser.exportTokens, result.opts.to);
  14929. })();
  14930. }
  14931. };
  14932. };
  14933. var postcss$3 = true;
  14934. build.postcss = postcss$3;
  14935. function compileStyle(options) {
  14936. return doCompileStyle(Object.assign(Object.assign({}, options), { isAsync: false }));
  14937. }
  14938. function compileStyleAsync(options) {
  14939. return doCompileStyle(Object.assign(Object.assign({}, options), { isAsync: true }));
  14940. }
  14941. function doCompileStyle(options) {
  14942. const { filename, id, scoped = false, trim = true, isProd = false, modules = false, modulesOptions = {}, preprocessLang, postcssOptions, postcssPlugins } = options;
  14943. const preprocessor = preprocessLang && processors[preprocessLang];
  14944. const preProcessedSource = preprocessor && preprocess$1(options, preprocessor);
  14945. const map = preProcessedSource
  14946. ? preProcessedSource.map
  14947. : options.inMap || options.map;
  14948. const source = preProcessedSource ? preProcessedSource.code : options.source;
  14949. const shortId = id.replace(/^data-v-/, '');
  14950. const longId = `data-v-${shortId}`;
  14951. const plugins = (postcssPlugins || []).slice();
  14952. plugins.unshift(cssVarsPlugin({ id: shortId, isProd }));
  14953. if (trim) {
  14954. plugins.push(trimPlugin());
  14955. }
  14956. if (scoped) {
  14957. plugins.push(scopedPlugin(longId));
  14958. }
  14959. let cssModules;
  14960. if (modules) {
  14961. if (!options.isAsync) {
  14962. throw new Error('[@vue/compiler-sfc] `modules` option can only be used with compileStyleAsync().');
  14963. }
  14964. plugins.push(build(Object.assign(Object.assign({}, modulesOptions), { getJSON: (_cssFileName, json) => {
  14965. cssModules = json;
  14966. } })));
  14967. }
  14968. const postCSSOptions = Object.assign(Object.assign({}, postcssOptions), { to: filename, from: filename });
  14969. if (map) {
  14970. postCSSOptions.map = {
  14971. inline: false,
  14972. annotation: false,
  14973. prev: map
  14974. };
  14975. }
  14976. let result;
  14977. let code;
  14978. let outMap;
  14979. // stylus output include plain css. so need remove the repeat item
  14980. const dependencies = new Set(preProcessedSource ? preProcessedSource.dependencies : []);
  14981. // sass has filename self when provided filename option
  14982. dependencies.delete(filename);
  14983. const errors = [];
  14984. if (preProcessedSource && preProcessedSource.errors.length) {
  14985. errors.push(...preProcessedSource.errors);
  14986. }
  14987. const recordPlainCssDependencies = (messages) => {
  14988. messages.forEach(msg => {
  14989. if (msg.type === 'dependency') {
  14990. // postcss output path is absolute position path
  14991. dependencies.add(msg.file);
  14992. }
  14993. });
  14994. return dependencies;
  14995. };
  14996. try {
  14997. result = _postcss__default(plugins).process(source, postCSSOptions);
  14998. // In async mode, return a promise.
  14999. if (options.isAsync) {
  15000. return result
  15001. .then(result => ({
  15002. code: result.css || '',
  15003. map: result.map && result.map.toJSON(),
  15004. errors,
  15005. modules: cssModules,
  15006. rawResult: result,
  15007. dependencies: recordPlainCssDependencies(result.messages)
  15008. }))
  15009. .catch(error => ({
  15010. code: '',
  15011. map: undefined,
  15012. errors: [...errors, error],
  15013. rawResult: undefined,
  15014. dependencies
  15015. }));
  15016. }
  15017. recordPlainCssDependencies(result.messages);
  15018. // force synchronous transform (we know we only have sync plugins)
  15019. code = result.css;
  15020. outMap = result.map;
  15021. }
  15022. catch (e) {
  15023. errors.push(e);
  15024. }
  15025. return {
  15026. code: code || ``,
  15027. map: outMap && outMap.toJSON(),
  15028. errors,
  15029. rawResult: result,
  15030. dependencies
  15031. };
  15032. }
  15033. function preprocess$1(options, preprocessor) {
  15034. return preprocessor(options.source, options.inMap || options.map, Object.assign({ filename: options.filename }, options.preprocessOptions), options.preprocessCustomRequire);
  15035. }
  15036. // API
  15037. const walk$1 = estreeWalker.walk;
  15038. exports.MagicString = MagicString__default;
  15039. exports.babelParse = parser$2.parse;
  15040. exports.extractIdentifiers = compilerCore.extractIdentifiers;
  15041. exports.generateCodeFrame = compilerCore.generateCodeFrame;
  15042. exports.isInDestructureAssignment = compilerCore.isInDestructureAssignment;
  15043. exports.isStaticProperty = compilerCore.isStaticProperty;
  15044. exports.walkIdentifiers = compilerCore.walkIdentifiers;
  15045. exports.shouldTransformRef = reactivityTransform.shouldTransform;
  15046. exports.transformRef = reactivityTransform.transform;
  15047. exports.transformRefAST = reactivityTransform.transformAST;
  15048. exports.compileScript = compileScript;
  15049. exports.compileStyle = compileStyle;
  15050. exports.compileStyleAsync = compileStyleAsync;
  15051. exports.compileTemplate = compileTemplate;
  15052. exports.parse = parse;
  15053. exports.rewriteDefault = rewriteDefault;
  15054. exports.walk = walk$1;