1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711 |
- 'use strict';
- Object.defineProperty(exports, '__esModule', { value: true });
- var CompilerDOM = require('@vue/compiler-dom');
- var sourceMap = require('source-map');
- var MagicString = require('magic-string');
- var parser$2 = require('@babel/parser');
- var shared = require('@vue/shared');
- var estreeWalker = require('estree-walker');
- var path = require('path');
- var compilerCore = require('@vue/compiler-core');
- var url = require('url');
- var CompilerSSR = require('@vue/compiler-ssr');
- var fs = require('fs');
- var util$2 = require('util');
- var reactivityTransform = require('@vue/reactivity-transform');
- var _postcss = require('postcss');
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
- function _interopNamespace(e) {
- if (e && e.__esModule) return e;
- var n = Object.create(null);
- if (e) {
- Object.keys(e).forEach(function (k) {
- n[k] = e[k];
- });
- }
- n['default'] = e;
- return Object.freeze(n);
- }
- var CompilerDOM__namespace = /*#__PURE__*/_interopNamespace(CompilerDOM);
- var sourceMap__default = /*#__PURE__*/_interopDefaultLegacy(sourceMap);
- var MagicString__default = /*#__PURE__*/_interopDefaultLegacy(MagicString);
- var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
- var CompilerSSR__namespace = /*#__PURE__*/_interopNamespace(CompilerSSR);
- var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
- var util__default = /*#__PURE__*/_interopDefaultLegacy(util$2);
- var _postcss__default = /*#__PURE__*/_interopDefaultLegacy(_postcss);
- function pad (hash, len) {
- while (hash.length < len) {
- hash = '0' + hash;
- }
- return hash;
- }
- function fold (hash, text) {
- var i;
- var chr;
- var len;
- if (text.length === 0) {
- return hash;
- }
- for (i = 0, len = text.length; i < len; i++) {
- chr = text.charCodeAt(i);
- hash = ((hash << 5) - hash) + chr;
- hash |= 0;
- }
- return hash < 0 ? hash * -2 : hash;
- }
- function foldObject (hash, o, seen) {
- return Object.keys(o).sort().reduce(foldKey, hash);
- function foldKey (hash, key) {
- return foldValue(hash, o[key], key, seen);
- }
- }
- function foldValue (input, value, key, seen) {
- var hash = fold(fold(fold(input, key), toString(value)), typeof value);
- if (value === null) {
- return fold(hash, 'null');
- }
- if (value === undefined) {
- return fold(hash, 'undefined');
- }
- if (typeof value === 'object' || typeof value === 'function') {
- if (seen.indexOf(value) !== -1) {
- return fold(hash, '[Circular]' + key);
- }
- seen.push(value);
- var objHash = foldObject(hash, value, seen);
- if (!('valueOf' in value) || typeof value.valueOf !== 'function') {
- return objHash;
- }
- try {
- return fold(objHash, String(value.valueOf()))
- } catch (err) {
- return fold(objHash, '[valueOf exception]' + (err.stack || err.message))
- }
- }
- return fold(hash, value.toString());
- }
- function toString (o) {
- return Object.prototype.toString.call(o);
- }
- function sum (o) {
- return pad(foldValue(0, o, '', []).toString(16), 8);
- }
- var hashSum = sum;
- const CSS_VARS_HELPER = `useCssVars`;
- function genCssVarsFromList(vars, id, isProd, isSSR = false) {
- return `{\n ${vars
- .map(key => `"${isSSR ? `--` : ``}${genVarName(id, key, isProd)}": (${key})`)
- .join(',\n ')}\n}`;
- }
- function genVarName(id, raw, isProd) {
- if (isProd) {
- return hashSum(id + raw);
- }
- else {
- // escape ASCII Punctuation & Symbols
- return `${id}-${raw.replace(/[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, s => `\\${s}`)}`;
- }
- }
- function normalizeExpression(exp) {
- exp = exp.trim();
- if ((exp[0] === `'` && exp[exp.length - 1] === `'`) ||
- (exp[0] === `"` && exp[exp.length - 1] === `"`)) {
- return exp.slice(1, -1);
- }
- return exp;
- }
- const vBindRE = /v-bind\s*\(/g;
- function parseCssVars(sfc) {
- const vars = [];
- sfc.styles.forEach(style => {
- let match;
- // ignore v-bind() in comments /* ... */
- const content = style.content.replace(/\/\*([\s\S]*?)\*\//g, '');
- while ((match = vBindRE.exec(content))) {
- const start = match.index + match[0].length;
- const end = lexBinding(content, start);
- if (end !== null) {
- const variable = normalizeExpression(content.slice(start, end));
- if (!vars.includes(variable)) {
- vars.push(variable);
- }
- }
- }
- });
- return vars;
- }
- function lexBinding(content, start) {
- let state = 0 /* LexerState.inParens */;
- let parenDepth = 0;
- for (let i = start; i < content.length; i++) {
- const char = content.charAt(i);
- switch (state) {
- case 0 /* LexerState.inParens */:
- if (char === `'`) {
- state = 1 /* LexerState.inSingleQuoteString */;
- }
- else if (char === `"`) {
- state = 2 /* LexerState.inDoubleQuoteString */;
- }
- else if (char === `(`) {
- parenDepth++;
- }
- else if (char === `)`) {
- if (parenDepth > 0) {
- parenDepth--;
- }
- else {
- return i;
- }
- }
- break;
- case 1 /* LexerState.inSingleQuoteString */:
- if (char === `'`) {
- state = 0 /* LexerState.inParens */;
- }
- break;
- case 2 /* LexerState.inDoubleQuoteString */:
- if (char === `"`) {
- state = 0 /* LexerState.inParens */;
- }
- break;
- }
- }
- return null;
- }
- const cssVarsPlugin = opts => {
- const { id, isProd } = opts;
- return {
- postcssPlugin: 'vue-sfc-vars',
- Declaration(decl) {
- // rewrite CSS variables
- const value = decl.value;
- if (vBindRE.test(value)) {
- vBindRE.lastIndex = 0;
- let transformed = '';
- let lastIndex = 0;
- let match;
- while ((match = vBindRE.exec(value))) {
- const start = match.index + match[0].length;
- const end = lexBinding(value, start);
- if (end !== null) {
- const variable = normalizeExpression(value.slice(start, end));
- transformed +=
- value.slice(lastIndex, match.index) +
- `var(--${genVarName(id, variable, isProd)})`;
- lastIndex = end + 1;
- }
- }
- decl.value = transformed + value.slice(lastIndex);
- }
- }
- };
- };
- cssVarsPlugin.postcss = true;
- function genCssVarsCode(vars, bindings, id, isProd) {
- const varsExp = genCssVarsFromList(vars, id, isProd);
- const exp = CompilerDOM.createSimpleExpression(varsExp, false);
- const context = CompilerDOM.createTransformContext(CompilerDOM.createRoot([]), {
- prefixIdentifiers: true,
- inline: true,
- bindingMetadata: bindings.__isScriptSetup === false ? undefined : bindings
- });
- const transformed = CompilerDOM.processExpression(exp, context);
- const transformedString = transformed.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */
- ? transformed.content
- : transformed.children
- .map(c => {
- return typeof c === 'string'
- ? c
- : c.content;
- })
- .join('');
- return `_${CSS_VARS_HELPER}(_ctx => (${transformedString}))`;
- }
- // <script setup> already gets the calls injected as part of the transform
- // this is only for single normal <script>
- function genNormalScriptCssVarsCode(cssVars, bindings, id, isProd) {
- return (`\nimport { ${CSS_VARS_HELPER} as _${CSS_VARS_HELPER} } from 'vue'\n` +
- `const __injectCSSVars__ = () => {\n${genCssVarsCode(cssVars, bindings, id, isProd)}}\n` +
- `const __setup__ = __default__.setup\n` +
- `__default__.setup = __setup__\n` +
- ` ? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }\n` +
- ` : __injectCSSVars__\n`);
- }
- var iterator = function (Yallist) {
- Yallist.prototype[Symbol.iterator] = function* () {
- for (let walker = this.head; walker; walker = walker.next) {
- yield walker.value;
- }
- };
- };
- var yallist = Yallist;
- Yallist.Node = Node;
- Yallist.create = Yallist;
- function Yallist (list) {
- var self = this;
- if (!(self instanceof Yallist)) {
- self = new Yallist();
- }
- self.tail = null;
- self.head = null;
- self.length = 0;
- if (list && typeof list.forEach === 'function') {
- list.forEach(function (item) {
- self.push(item);
- });
- } else if (arguments.length > 0) {
- for (var i = 0, l = arguments.length; i < l; i++) {
- self.push(arguments[i]);
- }
- }
- return self
- }
- Yallist.prototype.removeNode = function (node) {
- if (node.list !== this) {
- throw new Error('removing node which does not belong to this list')
- }
- var next = node.next;
- var prev = node.prev;
- if (next) {
- next.prev = prev;
- }
- if (prev) {
- prev.next = next;
- }
- if (node === this.head) {
- this.head = next;
- }
- if (node === this.tail) {
- this.tail = prev;
- }
- node.list.length--;
- node.next = null;
- node.prev = null;
- node.list = null;
- return next
- };
- Yallist.prototype.unshiftNode = function (node) {
- if (node === this.head) {
- return
- }
- if (node.list) {
- node.list.removeNode(node);
- }
- var head = this.head;
- node.list = this;
- node.next = head;
- if (head) {
- head.prev = node;
- }
- this.head = node;
- if (!this.tail) {
- this.tail = node;
- }
- this.length++;
- };
- Yallist.prototype.pushNode = function (node) {
- if (node === this.tail) {
- return
- }
- if (node.list) {
- node.list.removeNode(node);
- }
- var tail = this.tail;
- node.list = this;
- node.prev = tail;
- if (tail) {
- tail.next = node;
- }
- this.tail = node;
- if (!this.head) {
- this.head = node;
- }
- this.length++;
- };
- Yallist.prototype.push = function () {
- for (var i = 0, l = arguments.length; i < l; i++) {
- push(this, arguments[i]);
- }
- return this.length
- };
- Yallist.prototype.unshift = function () {
- for (var i = 0, l = arguments.length; i < l; i++) {
- unshift(this, arguments[i]);
- }
- return this.length
- };
- Yallist.prototype.pop = function () {
- if (!this.tail) {
- return undefined
- }
- var res = this.tail.value;
- this.tail = this.tail.prev;
- if (this.tail) {
- this.tail.next = null;
- } else {
- this.head = null;
- }
- this.length--;
- return res
- };
- Yallist.prototype.shift = function () {
- if (!this.head) {
- return undefined
- }
- var res = this.head.value;
- this.head = this.head.next;
- if (this.head) {
- this.head.prev = null;
- } else {
- this.tail = null;
- }
- this.length--;
- return res
- };
- Yallist.prototype.forEach = function (fn, thisp) {
- thisp = thisp || this;
- for (var walker = this.head, i = 0; walker !== null; i++) {
- fn.call(thisp, walker.value, i, this);
- walker = walker.next;
- }
- };
- Yallist.prototype.forEachReverse = function (fn, thisp) {
- thisp = thisp || this;
- for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
- fn.call(thisp, walker.value, i, this);
- walker = walker.prev;
- }
- };
- Yallist.prototype.get = function (n) {
- for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
- // abort out of the list early if we hit a cycle
- walker = walker.next;
- }
- if (i === n && walker !== null) {
- return walker.value
- }
- };
- Yallist.prototype.getReverse = function (n) {
- for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
- // abort out of the list early if we hit a cycle
- walker = walker.prev;
- }
- if (i === n && walker !== null) {
- return walker.value
- }
- };
- Yallist.prototype.map = function (fn, thisp) {
- thisp = thisp || this;
- var res = new Yallist();
- for (var walker = this.head; walker !== null;) {
- res.push(fn.call(thisp, walker.value, this));
- walker = walker.next;
- }
- return res
- };
- Yallist.prototype.mapReverse = function (fn, thisp) {
- thisp = thisp || this;
- var res = new Yallist();
- for (var walker = this.tail; walker !== null;) {
- res.push(fn.call(thisp, walker.value, this));
- walker = walker.prev;
- }
- return res
- };
- Yallist.prototype.reduce = function (fn, initial) {
- var acc;
- var walker = this.head;
- if (arguments.length > 1) {
- acc = initial;
- } else if (this.head) {
- walker = this.head.next;
- acc = this.head.value;
- } else {
- throw new TypeError('Reduce of empty list with no initial value')
- }
- for (var i = 0; walker !== null; i++) {
- acc = fn(acc, walker.value, i);
- walker = walker.next;
- }
- return acc
- };
- Yallist.prototype.reduceReverse = function (fn, initial) {
- var acc;
- var walker = this.tail;
- if (arguments.length > 1) {
- acc = initial;
- } else if (this.tail) {
- walker = this.tail.prev;
- acc = this.tail.value;
- } else {
- throw new TypeError('Reduce of empty list with no initial value')
- }
- for (var i = this.length - 1; walker !== null; i--) {
- acc = fn(acc, walker.value, i);
- walker = walker.prev;
- }
- return acc
- };
- Yallist.prototype.toArray = function () {
- var arr = new Array(this.length);
- for (var i = 0, walker = this.head; walker !== null; i++) {
- arr[i] = walker.value;
- walker = walker.next;
- }
- return arr
- };
- Yallist.prototype.toArrayReverse = function () {
- var arr = new Array(this.length);
- for (var i = 0, walker = this.tail; walker !== null; i++) {
- arr[i] = walker.value;
- walker = walker.prev;
- }
- return arr
- };
- Yallist.prototype.slice = function (from, to) {
- to = to || this.length;
- if (to < 0) {
- to += this.length;
- }
- from = from || 0;
- if (from < 0) {
- from += this.length;
- }
- var ret = new Yallist();
- if (to < from || to < 0) {
- return ret
- }
- if (from < 0) {
- from = 0;
- }
- if (to > this.length) {
- to = this.length;
- }
- for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
- walker = walker.next;
- }
- for (; walker !== null && i < to; i++, walker = walker.next) {
- ret.push(walker.value);
- }
- return ret
- };
- Yallist.prototype.sliceReverse = function (from, to) {
- to = to || this.length;
- if (to < 0) {
- to += this.length;
- }
- from = from || 0;
- if (from < 0) {
- from += this.length;
- }
- var ret = new Yallist();
- if (to < from || to < 0) {
- return ret
- }
- if (from < 0) {
- from = 0;
- }
- if (to > this.length) {
- to = this.length;
- }
- for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
- walker = walker.prev;
- }
- for (; walker !== null && i > from; i--, walker = walker.prev) {
- ret.push(walker.value);
- }
- return ret
- };
- Yallist.prototype.splice = function (start, deleteCount /*, ...nodes */) {
- if (start > this.length) {
- start = this.length - 1;
- }
- if (start < 0) {
- start = this.length + start;
- }
- for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
- walker = walker.next;
- }
- var ret = [];
- for (var i = 0; walker && i < deleteCount; i++) {
- ret.push(walker.value);
- walker = this.removeNode(walker);
- }
- if (walker === null) {
- walker = this.tail;
- }
- if (walker !== this.head && walker !== this.tail) {
- walker = walker.prev;
- }
- for (var i = 2; i < arguments.length; i++) {
- walker = insert(this, walker, arguments[i]);
- }
- return ret;
- };
- Yallist.prototype.reverse = function () {
- var head = this.head;
- var tail = this.tail;
- for (var walker = head; walker !== null; walker = walker.prev) {
- var p = walker.prev;
- walker.prev = walker.next;
- walker.next = p;
- }
- this.head = tail;
- this.tail = head;
- return this
- };
- function insert (self, node, value) {
- var inserted = node === self.head ?
- new Node(value, null, node, self) :
- new Node(value, node, node.next, self);
- if (inserted.next === null) {
- self.tail = inserted;
- }
- if (inserted.prev === null) {
- self.head = inserted;
- }
- self.length++;
- return inserted
- }
- function push (self, item) {
- self.tail = new Node(item, self.tail, null, self);
- if (!self.head) {
- self.head = self.tail;
- }
- self.length++;
- }
- function unshift (self, item) {
- self.head = new Node(item, null, self.head, self);
- if (!self.tail) {
- self.tail = self.head;
- }
- self.length++;
- }
- function Node (value, prev, next, list) {
- if (!(this instanceof Node)) {
- return new Node(value, prev, next, list)
- }
- this.list = list;
- this.value = value;
- if (prev) {
- prev.next = this;
- this.prev = prev;
- } else {
- this.prev = null;
- }
- if (next) {
- next.prev = this;
- this.next = next;
- } else {
- this.next = null;
- }
- }
- try {
- // add if support for Symbol.iterator is present
- iterator(Yallist);
- } catch (er) {}
- // A linked list to keep track of recently-used-ness
- const MAX = Symbol('max');
- const LENGTH = Symbol('length');
- const LENGTH_CALCULATOR = Symbol('lengthCalculator');
- const ALLOW_STALE = Symbol('allowStale');
- const MAX_AGE = Symbol('maxAge');
- const DISPOSE = Symbol('dispose');
- const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');
- const LRU_LIST = Symbol('lruList');
- const CACHE = Symbol('cache');
- const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');
- const naiveLength = () => 1;
- // lruList is a yallist where the head is the youngest
- // item, and the tail is the oldest. the list contains the Hit
- // objects as the entries.
- // Each Hit object has a reference to its Yallist.Node. This
- // never changes.
- //
- // cache is a Map (or PseudoMap) that matches the keys to
- // the Yallist.Node object.
- class LRUCache {
- constructor (options) {
- if (typeof options === 'number')
- options = { max: options };
- if (!options)
- options = {};
- if (options.max && (typeof options.max !== 'number' || options.max < 0))
- throw new TypeError('max must be a non-negative number')
- // Kind of weird to have a default max of Infinity, but oh well.
- this[MAX] = options.max || Infinity;
- const lc = options.length || naiveLength;
- this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc;
- this[ALLOW_STALE] = options.stale || false;
- if (options.maxAge && typeof options.maxAge !== 'number')
- throw new TypeError('maxAge must be a number')
- this[MAX_AGE] = options.maxAge || 0;
- this[DISPOSE] = options.dispose;
- this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
- this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
- this.reset();
- }
- // resize the cache when the max changes.
- set max (mL) {
- if (typeof mL !== 'number' || mL < 0)
- throw new TypeError('max must be a non-negative number')
- this[MAX] = mL || Infinity;
- trim(this);
- }
- get max () {
- return this[MAX]
- }
- set allowStale (allowStale) {
- this[ALLOW_STALE] = !!allowStale;
- }
- get allowStale () {
- return this[ALLOW_STALE]
- }
- set maxAge (mA) {
- if (typeof mA !== 'number')
- throw new TypeError('maxAge must be a non-negative number')
- this[MAX_AGE] = mA;
- trim(this);
- }
- get maxAge () {
- return this[MAX_AGE]
- }
- // resize the cache when the lengthCalculator changes.
- set lengthCalculator (lC) {
- if (typeof lC !== 'function')
- lC = naiveLength;
- if (lC !== this[LENGTH_CALCULATOR]) {
- this[LENGTH_CALCULATOR] = lC;
- this[LENGTH] = 0;
- this[LRU_LIST].forEach(hit => {
- hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
- this[LENGTH] += hit.length;
- });
- }
- trim(this);
- }
- get lengthCalculator () { return this[LENGTH_CALCULATOR] }
- get length () { return this[LENGTH] }
- get itemCount () { return this[LRU_LIST].length }
- rforEach (fn, thisp) {
- thisp = thisp || this;
- for (let walker = this[LRU_LIST].tail; walker !== null;) {
- const prev = walker.prev;
- forEachStep(this, fn, walker, thisp);
- walker = prev;
- }
- }
- forEach (fn, thisp) {
- thisp = thisp || this;
- for (let walker = this[LRU_LIST].head; walker !== null;) {
- const next = walker.next;
- forEachStep(this, fn, walker, thisp);
- walker = next;
- }
- }
- keys () {
- return this[LRU_LIST].toArray().map(k => k.key)
- }
- values () {
- return this[LRU_LIST].toArray().map(k => k.value)
- }
- reset () {
- if (this[DISPOSE] &&
- this[LRU_LIST] &&
- this[LRU_LIST].length) {
- this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));
- }
- this[CACHE] = new Map(); // hash of items by key
- this[LRU_LIST] = new yallist(); // list of items in order of use recency
- this[LENGTH] = 0; // length of items in the list
- }
- dump () {
- return this[LRU_LIST].map(hit =>
- isStale(this, hit) ? false : {
- k: hit.key,
- v: hit.value,
- e: hit.now + (hit.maxAge || 0)
- }).toArray().filter(h => h)
- }
- dumpLru () {
- return this[LRU_LIST]
- }
- set (key, value, maxAge) {
- maxAge = maxAge || this[MAX_AGE];
- if (maxAge && typeof maxAge !== 'number')
- throw new TypeError('maxAge must be a number')
- const now = maxAge ? Date.now() : 0;
- const len = this[LENGTH_CALCULATOR](value, key);
- if (this[CACHE].has(key)) {
- if (len > this[MAX]) {
- del(this, this[CACHE].get(key));
- return false
- }
- const node = this[CACHE].get(key);
- const item = node.value;
- // dispose of the old one before overwriting
- // split out into 2 ifs for better coverage tracking
- if (this[DISPOSE]) {
- if (!this[NO_DISPOSE_ON_SET])
- this[DISPOSE](key, item.value);
- }
- item.now = now;
- item.maxAge = maxAge;
- item.value = value;
- this[LENGTH] += len - item.length;
- item.length = len;
- this.get(key);
- trim(this);
- return true
- }
- const hit = new Entry(key, value, len, now, maxAge);
- // oversized objects fall out of cache automatically.
- if (hit.length > this[MAX]) {
- if (this[DISPOSE])
- this[DISPOSE](key, value);
- return false
- }
- this[LENGTH] += hit.length;
- this[LRU_LIST].unshift(hit);
- this[CACHE].set(key, this[LRU_LIST].head);
- trim(this);
- return true
- }
- has (key) {
- if (!this[CACHE].has(key)) return false
- const hit = this[CACHE].get(key).value;
- return !isStale(this, hit)
- }
- get (key) {
- return get(this, key, true)
- }
- peek (key) {
- return get(this, key, false)
- }
- pop () {
- const node = this[LRU_LIST].tail;
- if (!node)
- return null
- del(this, node);
- return node.value
- }
- del (key) {
- del(this, this[CACHE].get(key));
- }
- load (arr) {
- // reset the cache
- this.reset();
- const now = Date.now();
- // A previous serialized cache has the most recent items first
- for (let l = arr.length - 1; l >= 0; l--) {
- const hit = arr[l];
- const expiresAt = hit.e || 0;
- if (expiresAt === 0)
- // the item was created without expiration in a non aged cache
- this.set(hit.k, hit.v);
- else {
- const maxAge = expiresAt - now;
- // dont add already expired items
- if (maxAge > 0) {
- this.set(hit.k, hit.v, maxAge);
- }
- }
- }
- }
- prune () {
- this[CACHE].forEach((value, key) => get(this, key, false));
- }
- }
- const get = (self, key, doUse) => {
- const node = self[CACHE].get(key);
- if (node) {
- const hit = node.value;
- if (isStale(self, hit)) {
- del(self, node);
- if (!self[ALLOW_STALE])
- return undefined
- } else {
- if (doUse) {
- if (self[UPDATE_AGE_ON_GET])
- node.value.now = Date.now();
- self[LRU_LIST].unshiftNode(node);
- }
- }
- return hit.value
- }
- };
- const isStale = (self, hit) => {
- if (!hit || (!hit.maxAge && !self[MAX_AGE]))
- return false
- const diff = Date.now() - hit.now;
- return hit.maxAge ? diff > hit.maxAge
- : self[MAX_AGE] && (diff > self[MAX_AGE])
- };
- const trim = self => {
- if (self[LENGTH] > self[MAX]) {
- for (let walker = self[LRU_LIST].tail;
- self[LENGTH] > self[MAX] && walker !== null;) {
- // We know that we're about to delete this one, and also
- // what the next least recently used key will be, so just
- // go ahead and set it now.
- const prev = walker.prev;
- del(self, walker);
- walker = prev;
- }
- }
- };
- const del = (self, node) => {
- if (node) {
- const hit = node.value;
- if (self[DISPOSE])
- self[DISPOSE](hit.key, hit.value);
- self[LENGTH] -= hit.length;
- self[CACHE].delete(hit.key);
- self[LRU_LIST].removeNode(node);
- }
- };
- class Entry {
- constructor (key, value, length, now, maxAge) {
- this.key = key;
- this.value = value;
- this.length = length;
- this.now = now;
- this.maxAge = maxAge || 0;
- }
- }
- const forEachStep = (self, fn, node, thisp) => {
- let hit = node.value;
- if (isStale(self, hit)) {
- del(self, node);
- if (!self[ALLOW_STALE])
- hit = undefined;
- }
- if (hit)
- fn.call(thisp, hit.value, hit.key, self);
- };
- var lruCache = LRUCache;
- function createCache(size = 500) {
- return new lruCache(size);
- }
- function isRelativeUrl(url) {
- const firstChar = url.charAt(0);
- return firstChar === '.' || firstChar === '~' || firstChar === '@';
- }
- const externalRE = /^(https?:)?\/\//;
- function isExternalUrl(url) {
- return externalRE.test(url);
- }
- const dataUrlRE = /^\s*data:/i;
- function isDataUrl(url) {
- return dataUrlRE.test(url);
- }
- /**
- * Parses string url into URL object.
- */
- function parseUrl(url) {
- const firstChar = url.charAt(0);
- if (firstChar === '~') {
- const secondChar = url.charAt(1);
- url = url.slice(secondChar === '/' ? 2 : 1);
- }
- return parseUriParts(url);
- }
- /**
- * vuejs/component-compiler-utils#22 Support uri fragment in transformed require
- * @param urlString an url as a string
- */
- function parseUriParts(urlString) {
- // A TypeError is thrown if urlString is not a string
- // @see https://nodejs.org/api/url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
- return url.parse(shared.isString(urlString) ? urlString : '', false, true);
- }
- const defaultAssetUrlOptions = {
- base: null,
- includeAbsolute: false,
- tags: {
- video: ['src', 'poster'],
- source: ['src'],
- img: ['src'],
- image: ['xlink:href', 'href'],
- use: ['xlink:href', 'href']
- }
- };
- const normalizeOptions = (options) => {
- if (Object.keys(options).some(key => shared.isArray(options[key]))) {
- // legacy option format which directly passes in tags config
- return {
- ...defaultAssetUrlOptions,
- tags: options
- };
- }
- return {
- ...defaultAssetUrlOptions,
- ...options
- };
- };
- const createAssetUrlTransformWithOptions = (options) => {
- return (node, context) => transformAssetUrl(node, context, options);
- };
- /**
- * A `@vue/compiler-core` plugin that transforms relative asset urls into
- * either imports or absolute urls.
- *
- * ``` js
- * // Before
- * createVNode('img', { src: './logo.png' })
- *
- * // After
- * import _imports_0 from './logo.png'
- * createVNode('img', { src: _imports_0 })
- * ```
- */
- const transformAssetUrl = (node, context, options = defaultAssetUrlOptions) => {
- if (node.type === 1 /* NodeTypes.ELEMENT */) {
- if (!node.props.length) {
- return;
- }
- const tags = options.tags || defaultAssetUrlOptions.tags;
- const attrs = tags[node.tag];
- const wildCardAttrs = tags['*'];
- if (!attrs && !wildCardAttrs) {
- return;
- }
- const assetAttrs = (attrs || []).concat(wildCardAttrs || []);
- node.props.forEach((attr, index) => {
- if (attr.type !== 6 /* NodeTypes.ATTRIBUTE */ ||
- !assetAttrs.includes(attr.name) ||
- !attr.value ||
- isExternalUrl(attr.value.content) ||
- isDataUrl(attr.value.content) ||
- attr.value.content[0] === '#' ||
- (!options.includeAbsolute && !isRelativeUrl(attr.value.content))) {
- return;
- }
- const url = parseUrl(attr.value.content);
- if (options.base && attr.value.content[0] === '.') {
- // explicit base - directly rewrite relative urls into absolute url
- // to avoid generating extra imports
- // Allow for full hostnames provided in options.base
- const base = parseUrl(options.base);
- const protocol = base.protocol || '';
- const host = base.host ? protocol + '//' + base.host : '';
- const basePath = base.path || '/';
- // when packaged in the browser, path will be using the posix-
- // only version provided by rollup-plugin-node-builtins.
- attr.value.content =
- host +
- (path__default.posix || path__default).join(basePath, url.path + (url.hash || ''));
- return;
- }
- // otherwise, transform the url into an import.
- // this assumes a bundler will resolve the import into the correct
- // absolute url (e.g. webpack file-loader)
- const exp = getImportsExpressionExp(url.path, url.hash, attr.loc, context);
- node.props[index] = {
- type: 7 /* NodeTypes.DIRECTIVE */,
- name: 'bind',
- arg: compilerCore.createSimpleExpression(attr.name, true, attr.loc),
- exp,
- modifiers: [],
- loc: attr.loc
- };
- });
- }
- };
- function getImportsExpressionExp(path, hash, loc, context) {
- if (path) {
- let name;
- let exp;
- const existingIndex = context.imports.findIndex(i => i.path === path);
- if (existingIndex > -1) {
- name = `_imports_${existingIndex}`;
- exp = context.imports[existingIndex].exp;
- }
- else {
- name = `_imports_${context.imports.length}`;
- exp = compilerCore.createSimpleExpression(name, false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
- context.imports.push({ exp, path });
- }
- if (!hash) {
- return exp;
- }
- const hashExp = `${name} + '${hash}'`;
- const finalExp = compilerCore.createSimpleExpression(hashExp, false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
- if (!context.hoistStatic) {
- return finalExp;
- }
- const existingHoistIndex = context.hoists.findIndex(h => {
- return (h &&
- h.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
- !h.isStatic &&
- h.content === hashExp);
- });
- if (existingHoistIndex > -1) {
- return compilerCore.createSimpleExpression(`_hoisted_${existingHoistIndex + 1}`, false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
- }
- return context.hoist(finalExp);
- }
- else {
- return compilerCore.createSimpleExpression(`''`, false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
- }
- }
- const srcsetTags = ['img', 'source'];
- // http://w3c.github.io/html/semantics-embedded-content.html#ref-for-image-candidate-string-5
- const escapedSpaceCharacters = /( |\\t|\\n|\\f|\\r)+/g;
- const createSrcsetTransformWithOptions = (options) => {
- return (node, context) => transformSrcset(node, context, options);
- };
- const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
- if (node.type === 1 /* NodeTypes.ELEMENT */) {
- if (srcsetTags.includes(node.tag) && node.props.length) {
- node.props.forEach((attr, index) => {
- if (attr.name === 'srcset' && attr.type === 6 /* NodeTypes.ATTRIBUTE */) {
- if (!attr.value)
- return;
- const value = attr.value.content;
- if (!value)
- return;
- const imageCandidates = value.split(',').map(s => {
- // The attribute value arrives here with all whitespace, except
- // normal spaces, represented by escape sequences
- const [url, descriptor] = s
- .replace(escapedSpaceCharacters, ' ')
- .trim()
- .split(' ', 2);
- return { url, descriptor };
- });
- // data urls contains comma after the encoding so we need to re-merge
- // them
- for (let i = 0; i < imageCandidates.length; i++) {
- const { url } = imageCandidates[i];
- if (isDataUrl(url)) {
- imageCandidates[i + 1].url =
- url + ',' + imageCandidates[i + 1].url;
- imageCandidates.splice(i, 1);
- }
- }
- const shouldProcessUrl = (url) => {
- return (!isExternalUrl(url) &&
- !isDataUrl(url) &&
- (options.includeAbsolute || isRelativeUrl(url)));
- };
- // When srcset does not contain any qualified URLs, skip transforming
- if (!imageCandidates.some(({ url }) => shouldProcessUrl(url))) {
- return;
- }
- if (options.base) {
- const base = options.base;
- const set = [];
- let needImportTransform = false;
- imageCandidates.forEach(candidate => {
- let { url, descriptor } = candidate;
- descriptor = descriptor ? ` ${descriptor}` : ``;
- if (url[0] === '.') {
- candidate.url = (path__default.posix || path__default).join(base, url);
- set.push(candidate.url + descriptor);
- }
- else if (shouldProcessUrl(url)) {
- needImportTransform = true;
- }
- else {
- set.push(url + descriptor);
- }
- });
- if (!needImportTransform) {
- attr.value.content = set.join(', ');
- return;
- }
- }
- const compoundExpression = compilerCore.createCompoundExpression([], attr.loc);
- imageCandidates.forEach(({ url, descriptor }, index) => {
- if (shouldProcessUrl(url)) {
- const { path } = parseUrl(url);
- let exp;
- if (path) {
- const existingImportsIndex = context.imports.findIndex(i => i.path === path);
- if (existingImportsIndex > -1) {
- exp = compilerCore.createSimpleExpression(`_imports_${existingImportsIndex}`, false, attr.loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
- }
- else {
- exp = compilerCore.createSimpleExpression(`_imports_${context.imports.length}`, false, attr.loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
- context.imports.push({ exp, path });
- }
- compoundExpression.children.push(exp);
- }
- }
- else {
- const exp = compilerCore.createSimpleExpression(`"${url}"`, false, attr.loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
- compoundExpression.children.push(exp);
- }
- const isNotLast = imageCandidates.length - 1 > index;
- if (descriptor && isNotLast) {
- compoundExpression.children.push(` + ' ${descriptor}, ' + `);
- }
- else if (descriptor) {
- compoundExpression.children.push(` + ' ${descriptor}'`);
- }
- else if (isNotLast) {
- compoundExpression.children.push(` + ', ' + `);
- }
- });
- let exp = compoundExpression;
- if (context.hoistStatic) {
- exp = context.hoist(compoundExpression);
- exp.constType = 3 /* ConstantTypes.CAN_STRINGIFY */;
- }
- node.props[index] = {
- type: 7 /* NodeTypes.DIRECTIVE */,
- name: 'bind',
- arg: compilerCore.createSimpleExpression('srcset', true, attr.loc),
- exp,
- modifiers: [],
- loc: attr.loc
- };
- }
- });
- }
- }
- };
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
- function getDefaultExportFromCjs (x) {
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
- }
- function getAugmentedNamespace(n) {
- if (n.__esModule) return n;
- var a = Object.defineProperty({}, '__esModule', {value: true});
- Object.keys(n).forEach(function (k) {
- var d = Object.getOwnPropertyDescriptor(n, k);
- Object.defineProperty(a, k, d.get ? d : {
- enumerable: true,
- get: function () {
- return n[k];
- }
- });
- });
- return a;
- }
- function createCommonjsModule(fn) {
- var module = { exports: {} };
- return fn(module, module.exports), module.exports;
- }
- function commonjsRequire (path) {
- 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.');
- }
- var consolidate = createCommonjsModule(function (module, exports) {
- /*
- * Engines which do not support caching of their file contents
- * should use the `read()` function defined in consolidate.js
- * On top of this, when an engine compiles to a `Function`,
- * these functions should either be cached within consolidate.js
- * or the engine itself via `options.cache`. This will allow
- * users and frameworks to pass `options.cache = true` for
- * `NODE_ENV=production`, however edit the file(s) without
- * re-loading the application in development.
- */
- /**
- * Module dependencies.
- */
- var path = path__default;
- var join = path.join;
- var resolve = path.resolve;
- var extname = path.extname;
- var dirname = path.dirname;
- var isAbsolute = path.isAbsolute;
- var readCache = {};
- /**
- * Require cache.
- */
- var cacheStore = {};
- /**
- * Require cache.
- */
- var requires = {};
- /**
- * Clear the cache.
- *
- * @api public
- */
- exports.clearCache = function() {
- readCache = {};
- cacheStore = {};
- };
- /**
- * Conditionally cache `compiled` template based
- * on the `options` filename and `.cache` boolean.
- *
- * @param {Object} options
- * @param {Function} compiled
- * @return {Function}
- * @api private
- */
- function cache(options, compiled) {
- // cachable
- if (compiled && options.filename && options.cache) {
- delete readCache[options.filename];
- cacheStore[options.filename] = compiled;
- return compiled;
- }
- // check cache
- if (options.filename && options.cache) {
- return cacheStore[options.filename];
- }
- return compiled;
- }
- /**
- * Read `path` with `options` with
- * callback `(err, str)`. When `options.cache`
- * is true the template string will be cached.
- *
- * @param {String} options
- * @param {Function} cb
- * @api private
- */
- function read(path, options, cb) {
- var str = readCache[path];
- var cached = options.cache && str && typeof str === 'string';
- // cached (only if cached is a string and not a compiled template function)
- if (cached) return cb(null, str);
- // read
- fs__default.readFile(path, 'utf8', function(err, str) {
- if (err) return cb(err);
- // remove extraneous utf8 BOM marker
- str = str.replace(/^\uFEFF/, '');
- if (options.cache) readCache[path] = str;
- cb(null, str);
- });
- }
- /**
- * Read `path` with `options` with
- * callback `(err, str)`. When `options.cache`
- * is true the partial string will be cached.
- *
- * @param {String} options
- * @param {Function} fn
- * @api private
- */
- function readPartials(path, options, cb) {
- if (!options.partials) return cb();
- var keys = Object.keys(options.partials);
- var partials = {};
- function next(index) {
- if (index === keys.length) return cb(null, partials);
- var key = keys[index];
- var partialPath = options.partials[key];
- if (partialPath === undefined || partialPath === null || partialPath === false) {
- return next(++index);
- }
- var file;
- if (isAbsolute(partialPath)) {
- if (extname(partialPath) !== '') {
- file = partialPath;
- } else {
- file = join(partialPath + extname(path));
- }
- } else {
- file = join(dirname(path), partialPath + extname(path));
- }
- read(file, options, function(err, str) {
- if (err) return cb(err);
- partials[key] = str;
- next(++index);
- });
- }
- next(0);
- }
- /**
- * promisify
- */
- function promisify(cb, fn) {
- return new Promise(function(resolve, reject) {
- cb = cb || function(err, html) {
- if (err) {
- return reject(err);
- }
- resolve(html);
- };
- fn(cb);
- });
- }
- /**
- * fromStringRenderer
- */
- function fromStringRenderer(name) {
- return function(path, options, cb) {
- options.filename = path;
- return promisify(cb, function(cb) {
- readPartials(path, options, function(err, partials) {
- var extend = (requires.extend || (requires.extend = util__default._extend));
- var opts = extend({}, options);
- opts.partials = partials;
- if (err) return cb(err);
- if (cache(opts)) {
- exports[name].render('', opts, cb);
- } else {
- read(path, opts, function(err, str) {
- if (err) return cb(err);
- exports[name].render(str, opts, cb);
- });
- }
- });
- });
- };
- }
- /**
- * velocity support.
- */
- exports.velocityjs = fromStringRenderer('velocityjs');
- /**
- * velocity string support.
- */
- exports.velocityjs.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.velocityjs || (requires.velocityjs = require('velocityjs'));
- try {
- options.locals = options;
- cb(null, engine.render(str, options).trimLeft());
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Liquid support.
- */
- exports.liquid = fromStringRenderer('liquid');
- /**
- * Liquid string support.
- */
- /**
- * Note that in order to get filters and custom tags we've had to push
- * all user-defined locals down into @locals. However, just to make things
- * backwards-compatible, any property of `options` that is left after
- * processing and removing `locals`, `meta`, `filters`, `customTags` and
- * `includeDir` will also become a local.
- */
- function _renderTinyliquid(engine, str, options, cb) {
- var context = engine.newContext();
- var k;
- /**
- * Note that there's a bug in the library that doesn't allow us to pass
- * the locals to newContext(), hence looping through the keys:
- */
- if (options.locals) {
- for (k in options.locals) {
- context.setLocals(k, options.locals[k]);
- }
- delete options.locals;
- }
- if (options.meta) {
- context.setLocals('page', options.meta);
- delete options.meta;
- }
- /**
- * Add any defined filters:
- */
- if (options.filters) {
- for (k in options.filters) {
- context.setFilter(k, options.filters[k]);
- }
- delete options.filters;
- }
- /**
- * Set up a callback for the include directory:
- */
- var includeDir = options.includeDir || process.cwd();
- context.onInclude(function(name, callback) {
- var extname = path.extname(name) ? '' : '.liquid';
- var filename = path.resolve(includeDir, name + extname);
- fs__default.readFile(filename, {encoding: 'utf8'}, function(err, data) {
- if (err) return callback(err);
- callback(null, engine.parse(data));
- });
- });
- delete options.includeDir;
- /**
- * The custom tag functions need to have their results pushed back
- * through the parser, so set up a shim before calling the provided
- * callback:
- */
- var compileOptions = {
- customTags: {}
- };
- if (options.customTags) {
- var tagFunctions = options.customTags;
- for (k in options.customTags) {
- /*Tell jshint there's no problem with having this function in the loop */
- /*jshint -W083 */
- compileOptions.customTags[k] = function(context, name, body) {
- var tpl = tagFunctions[name](body.trim());
- context.astStack.push(engine.parse(tpl));
- };
- /*jshint +W083 */
- }
- delete options.customTags;
- }
- /**
- * Now anything left in `options` becomes a local:
- */
- for (k in options) {
- context.setLocals(k, options[k]);
- }
- /**
- * Finally, execute the template:
- */
- var tmpl = cache(context) || cache(context, engine.compile(str, compileOptions));
- tmpl(context, cb);
- }
- exports.liquid.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.liquid;
- var Liquid;
- try {
- // set up tinyliquid engine
- engine = requires.liquid = require('tinyliquid');
- // use tinyliquid engine
- _renderTinyliquid(engine, str, options, cb);
- return;
- } catch (err) {
- // set up liquid-node engine
- try {
- Liquid = requires.liquid = require('liquid-node');
- engine = new Liquid.Engine();
- } catch (err) {
- throw err;
- }
- }
- // use liquid-node engine
- try {
- var locals = options.locals || {};
- if (options.meta) {
- locals.pages = options.meta;
- delete options.meta;
- }
- /**
- * Add any defined filters:
- */
- if (options.filters) {
- engine.registerFilters(options.filters);
- delete options.filters;
- }
- /**
- * Set up a callback for the include directory:
- */
- var includeDir = options.includeDir || process.cwd();
- engine.fileSystem = new Liquid.LocalFileSystem(includeDir, 'liquid');
- delete options.includeDir;
- /**
- * The custom tag functions need to have their results pushed back
- * through the parser, so set up a shim before calling the provided
- * callback:
- */
- if (options.customTags) {
- var tagFunctions = options.customTags;
- for (k in options.customTags) {
- engine.registerTag(k, tagFunctions[k]);
- }
- delete options.customTags;
- }
- /**
- * Now anything left in `options` becomes a local:
- */
- for (var k in options) {
- locals[k] = options[k];
- }
- /**
- * Finally, execute the template:
- */
- return engine
- .parseAndRender(str, locals)
- .nodeify(function(err, result) {
- if (err) {
- throw new Error(err);
- } else {
- return cb(null, result);
- }
- });
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Jade support.
- */
- exports.jade = function(path, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.jade;
- if (!engine) {
- try {
- engine = requires.jade = require('jade');
- } catch (err) {
- try {
- engine = requires.jade = require('then-jade');
- } catch (otherError) {
- throw err;
- }
- }
- }
- try {
- var tmpl = cache(options) || cache(options, engine.compileFile(path, options));
- cb(null, tmpl(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Jade string support.
- */
- exports.jade.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.jade;
- if (!engine) {
- try {
- engine = requires.jade = require('jade');
- } catch (err) {
- try {
- engine = requires.jade = require('then-jade');
- } catch (otherError) {
- throw err;
- }
- }
- }
- try {
- var tmpl = cache(options) || cache(options, engine.compile(str, options));
- cb(null, tmpl(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Dust support.
- */
- exports.dust = fromStringRenderer('dust');
- /**
- * Dust string support.
- */
- exports.dust.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.dust;
- if (!engine) {
- try {
- engine = requires.dust = require('dust');
- } catch (err) {
- try {
- engine = requires.dust = require('dustjs-helpers');
- } catch (err) {
- engine = requires.dust = require('dustjs-linkedin');
- }
- }
- }
- var ext = 'dust';
- var views = '.';
- if (options) {
- if (options.ext) ext = options.ext;
- if (options.views) views = options.views;
- if (options.settings && options.settings.views) views = options.settings.views;
- }
- if (!options || (options && !options.cache)) engine.cache = {};
- engine.onLoad = function(path, callback) {
- if (extname(path) === '') path += '.' + ext;
- if (path[0] !== '/') path = views + '/' + path;
- read(path, options, callback);
- };
- try {
- var templateName;
- if (options.filename) {
- templateName = options.filename.replace(new RegExp('^' + views + '/'), '').replace(new RegExp('\\.' + ext), '');
- }
- var tmpl = cache(options) || cache(options, engine.compileFn(str, templateName));
- tmpl(options, cb);
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Swig support.
- */
- exports.swig = fromStringRenderer('swig');
- /**
- * Swig string support.
- */
- exports.swig.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.swig;
- if (!engine) {
- try {
- engine = requires.swig = require('swig');
- } catch (err) {
- try {
- engine = requires.swig = require('swig-templates');
- } catch (otherError) {
- throw err;
- }
- }
- }
- try {
- if (options.cache === true) options.cache = 'memory';
- engine.setDefaults({ cache: options.cache });
- var tmpl = cache(options) || cache(options, engine.compile(str, options));
- cb(null, tmpl(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Razor support.
- */
- exports.razor = function(path, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.razor;
- if (!engine) {
- try {
- engine = requires.razor = require('razor-tmpl');
- } catch (err) {
- throw err;
- }
- }
- try {
- var tmpl = cache(options) || cache(options, (locals) => {
- console.log('Rendering razor file', path);
- return engine.renderFileSync(path, locals);
- });
- cb(null, tmpl(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * razor string support.
- */
- exports.razor.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- try {
- var engine = requires.razor = require('razor-tmpl');
- } catch (err) {
- throw err;
- }
- try {
- var tf = engine.compile(str);
- var tmpl = cache(options) || cache(options, tf);
- cb(null, tmpl(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Atpl support.
- */
- exports.atpl = fromStringRenderer('atpl');
- /**
- * Atpl string support.
- */
- exports.atpl.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.atpl || (requires.atpl = require('atpl'));
- try {
- var tmpl = cache(options) || cache(options, engine.compile(str, options));
- cb(null, tmpl(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Liquor support,
- */
- exports.liquor = fromStringRenderer('liquor');
- /**
- * Liquor string support.
- */
- exports.liquor.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.liquor || (requires.liquor = require('liquor'));
- try {
- var tmpl = cache(options) || cache(options, engine.compile(str, options));
- cb(null, tmpl(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Twig support.
- */
- exports.twig = fromStringRenderer('twig');
- /**
- * Twig string support.
- */
- exports.twig.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.twig || (requires.twig = require('twig').twig);
- var templateData = {
- data: str,
- allowInlineIncludes: options.allowInlineIncludes,
- namespaces: options.namespaces,
- path: options.path
- };
- try {
- var tmpl = cache(templateData) || cache(templateData, engine(templateData));
- cb(null, tmpl.render(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * EJS support.
- */
- exports.ejs = fromStringRenderer('ejs');
- /**
- * EJS string support.
- */
- exports.ejs.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.ejs || (requires.ejs = require('ejs'));
- try {
- var tmpl = cache(options) || cache(options, engine.compile(str, options));
- cb(null, tmpl(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Eco support.
- */
- exports.eco = fromStringRenderer('eco');
- /**
- * Eco string support.
- */
- exports.eco.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.eco || (requires.eco = require('eco'));
- try {
- cb(null, engine.render(str, options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Jazz support.
- */
- exports.jazz = fromStringRenderer('jazz');
- /**
- * Jazz string support.
- */
- exports.jazz.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.jazz || (requires.jazz = require('jazz'));
- try {
- var tmpl = cache(options) || cache(options, engine.compile(str, options));
- tmpl.eval(options, function(str) {
- cb(null, str);
- });
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * JQTPL support.
- */
- exports.jqtpl = fromStringRenderer('jqtpl');
- /**
- * JQTPL string support.
- */
- exports.jqtpl.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.jqtpl || (requires.jqtpl = require('jqtpl'));
- try {
- engine.template(str, str);
- cb(null, engine.tmpl(str, options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Haml support.
- */
- exports.haml = fromStringRenderer('haml');
- /**
- * Haml string support.
- */
- exports.haml.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.haml || (requires.haml = require('hamljs'));
- try {
- options.locals = options;
- cb(null, engine.render(str, options).trimLeft());
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Hamlet support.
- */
- exports.hamlet = fromStringRenderer('hamlet');
- /**
- * Hamlet string support.
- */
- exports.hamlet.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.hamlet || (requires.hamlet = require('hamlet'));
- try {
- options.locals = options;
- cb(null, engine.render(str, options).trimLeft());
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Whiskers support.
- */
- exports.whiskers = function(path, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.whiskers || (requires.whiskers = require('whiskers'));
- engine.__express(path, options, cb);
- });
- };
- /**
- * Whiskers string support.
- */
- exports.whiskers.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.whiskers || (requires.whiskers = require('whiskers'));
- try {
- cb(null, engine.render(str, options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Coffee-HAML support.
- */
- exports['haml-coffee'] = fromStringRenderer('haml-coffee');
- /**
- * Coffee-HAML string support.
- */
- exports['haml-coffee'].render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires['haml-coffee'] || (requires['haml-coffee'] = require('haml-coffee'));
- try {
- var tmpl = cache(options) || cache(options, engine.compile(str, options));
- cb(null, tmpl(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Hogan support.
- */
- exports.hogan = fromStringRenderer('hogan');
- /**
- * Hogan string support.
- */
- exports.hogan.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.hogan || (requires.hogan = require('hogan.js'));
- try {
- var tmpl = cache(options) || cache(options, engine.compile(str, options));
- cb(null, tmpl.render(options, options.partials));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * templayed.js support.
- */
- exports.templayed = fromStringRenderer('templayed');
- /**
- * templayed.js string support.
- */
- exports.templayed.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.templayed || (requires.templayed = require('templayed'));
- try {
- var tmpl = cache(options) || cache(options, engine(str));
- cb(null, tmpl(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Handlebars support.
- */
- exports.handlebars = fromStringRenderer('handlebars');
- /**
- * Handlebars string support.
- */
- exports.handlebars.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.handlebars || (requires.handlebars = require('handlebars'));
- try {
- for (var partial in options.partials) {
- engine.registerPartial(partial, options.partials[partial]);
- }
- for (var helper in options.helpers) {
- engine.registerHelper(helper, options.helpers[helper]);
- }
- var tmpl = cache(options) || cache(options, engine.compile(str, options));
- cb(null, tmpl(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Underscore support.
- */
- exports.underscore = fromStringRenderer('underscore');
- /**
- * Underscore string support.
- */
- exports.underscore.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.underscore || (requires.underscore = require('underscore'));
- try {
- const partials = {};
- for (var partial in options.partials) {
- partials[partial] = engine.template(options.partials[partial]);
- }
- options.partials = partials;
- var tmpl = cache(options) || cache(options, engine.template(str, null, options));
- cb(null, tmpl(options).replace(/\n$/, ''));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Lodash support.
- */
- exports.lodash = fromStringRenderer('lodash');
- /**
- * Lodash string support.
- */
- exports.lodash.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.lodash || (requires.lodash = require('lodash'));
- try {
- var tmpl = cache(options) || cache(options, engine.template(str, options));
- cb(null, tmpl(options).replace(/\n$/, ''));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Pug support. (formerly Jade)
- */
- exports.pug = function(path, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.pug;
- if (!engine) {
- try {
- engine = requires.pug = require('pug');
- } catch (err) {
- try {
- engine = requires.pug = require('then-pug');
- } catch (otherError) {
- throw err;
- }
- }
- }
- try {
- var tmpl = cache(options) || cache(options, engine.compileFile(path, options));
- cb(null, tmpl(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Pug string support.
- */
- exports.pug.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.pug;
- if (!engine) {
- try {
- engine = requires.pug = require('pug');
- } catch (err) {
- try {
- engine = requires.pug = require('then-pug');
- } catch (otherError) {
- throw err;
- }
- }
- }
- try {
- var tmpl = cache(options) || cache(options, engine.compile(str, options));
- cb(null, tmpl(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * QEJS support.
- */
- exports.qejs = fromStringRenderer('qejs');
- /**
- * QEJS string support.
- */
- exports.qejs.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- try {
- var engine = requires.qejs || (requires.qejs = require('qejs'));
- engine.render(str, options).then(function(result) {
- cb(null, result);
- }, function(err) {
- cb(err);
- }).done();
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Walrus support.
- */
- exports.walrus = fromStringRenderer('walrus');
- /**
- * Walrus string support.
- */
- exports.walrus.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.walrus || (requires.walrus = require('walrus'));
- try {
- var tmpl = cache(options) || cache(options, engine.parse(str));
- cb(null, tmpl.compile(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Mustache support.
- */
- exports.mustache = fromStringRenderer('mustache');
- /**
- * Mustache string support.
- */
- exports.mustache.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.mustache || (requires.mustache = require('mustache'));
- try {
- cb(null, engine.render(str, options, options.partials));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Just support.
- */
- exports.just = function(path, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.just;
- if (!engine) {
- var JUST = require('just');
- engine = requires.just = new JUST();
- }
- engine.configure({ useCache: options.cache });
- engine.render(path, options, cb);
- });
- };
- /**
- * Just string support.
- */
- exports.just.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var JUST = require('just');
- var engine = new JUST({ root: { page: str }});
- engine.render('page', options, cb);
- });
- };
- /**
- * ECT support.
- */
- exports.ect = function(path, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.ect;
- if (!engine) {
- var ECT = require('ect');
- engine = requires.ect = new ECT(options);
- }
- engine.configure({ cache: options.cache });
- engine.render(path, options, cb);
- });
- };
- /**
- * ECT string support.
- */
- exports.ect.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var ECT = require('ect');
- var engine = new ECT({ root: { page: str }});
- engine.render('page', options, cb);
- });
- };
- /**
- * mote support.
- */
- exports.mote = fromStringRenderer('mote');
- /**
- * mote string support.
- */
- exports.mote.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.mote || (requires.mote = require('mote'));
- try {
- var tmpl = cache(options) || cache(options, engine.compile(str));
- cb(null, tmpl(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Toffee support.
- */
- exports.toffee = function(path, options, cb) {
- return promisify(cb, function(cb) {
- var toffee = requires.toffee || (requires.toffee = require('toffee'));
- toffee.__consolidate_engine_render(path, options, cb);
- });
- };
- /**
- * Toffee string support.
- */
- exports.toffee.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.toffee || (requires.toffee = require('toffee'));
- try {
- engine.str_render(str, options, cb);
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * doT support.
- */
- exports.dot = fromStringRenderer('dot');
- /**
- * doT string support.
- */
- exports.dot.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.dot || (requires.dot = require('dot'));
- var extend = (requires.extend || (requires.extend = util__default._extend));
- try {
- var settings = {};
- settings = extend(settings, engine.templateSettings);
- settings = extend(settings, options ? options.dot : {});
- var tmpl = cache(options) || cache(options, engine.template(str, settings, options));
- cb(null, tmpl(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * bracket support.
- */
- exports.bracket = fromStringRenderer('bracket');
- /**
- * bracket string support.
- */
- exports.bracket.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.bracket || (requires.bracket = require('bracket-template'));
- try {
- var tmpl = cache(options) || cache(options, engine.default.compile(str, options));
- cb(null, tmpl(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Ractive support.
- */
- exports.ractive = fromStringRenderer('ractive');
- /**
- * Ractive string support.
- */
- exports.ractive.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var Engine = requires.ractive || (requires.ractive = require('ractive'));
- var template = cache(options) || cache(options, Engine.parse(str));
- options.template = template;
- if (options.data === null || options.data === undefined) {
- var extend = (requires.extend || (requires.extend = util__default._extend));
- // Shallow clone the options object
- options.data = extend({}, options);
- // Remove consolidate-specific properties from the clone
- var i;
- var length;
- var properties = ['template', 'filename', 'cache', 'partials'];
- for (i = 0, length = properties.length; i < length; i++) {
- var property = properties[i];
- delete options.data[property];
- }
- }
- try {
- cb(null, new Engine(options).toHTML());
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Nunjucks support.
- */
- exports.nunjucks = fromStringRenderer('nunjucks');
- /**
- * Nunjucks string support.
- */
- exports.nunjucks.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- try {
- var engine = options.nunjucksEnv || requires.nunjucks || (requires.nunjucks = require('nunjucks'));
- var env = engine;
- // deprecated fallback support for express
- // <https://github.com/tj/consolidate.js/pull/152>
- // <https://github.com/tj/consolidate.js/pull/224>
- if (options.settings && options.settings.views) {
- env = engine.configure(options.settings.views);
- } else if (options.nunjucks && options.nunjucks.configure) {
- env = engine.configure.apply(engine, options.nunjucks.configure);
- }
- //
- // because `renderString` does not initiate loaders
- // we must manually create a loader for it based off
- // either `options.settings.views` or `options.nunjucks` or `options.nunjucks.root`
- //
- // <https://github.com/mozilla/nunjucks/issues/730>
- // <https://github.com/crocodilejs/node-email-templates/issues/182>
- //
- // so instead we simply check if we passed a custom loader
- // otherwise we create a simple file based loader
- if (options.loader) {
- env = new engine.Environment(options.loader);
- } else if (options.settings && options.settings.views) {
- env = new engine.Environment(
- new engine.FileSystemLoader(options.settings.views)
- );
- } else if (options.nunjucks && options.nunjucks.loader) {
- if (typeof options.nunjucks.loader === 'string') {
- env = new engine.Environment(new engine.FileSystemLoader(options.nunjucks.loader));
- } else {
- env = new engine.Environment(
- new engine.FileSystemLoader(
- options.nunjucks.loader[0],
- options.nunjucks.loader[1]
- )
- );
- }
- }
- env.renderString(str, options, cb);
- } catch (err) {
- throw cb(err);
- }
- });
- };
- /**
- * HTMLing support.
- */
- exports.htmling = fromStringRenderer('htmling');
- /**
- * HTMLing string support.
- */
- exports.htmling.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.htmling || (requires.htmling = require('htmling'));
- try {
- var tmpl = cache(options) || cache(options, engine.string(str));
- cb(null, tmpl.render(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Rendering function
- */
- function requireReact(module, filename) {
- var babel = requires.babel || (requires.babel = require('babel-core'));
- var compiled = babel.transformFileSync(filename, { presets: [ 'react' ] }).code;
- return module._compile(compiled, filename);
- }
- exports.requireReact = requireReact;
- /**
- * Converting a string into a node module.
- */
- function requireReactString(src, filename) {
- var babel = requires.babel || (requires.babel = require('babel-core'));
- if (!filename) filename = '';
- var m = new module.constructor();
- filename = filename || '';
- // Compile Using React
- var compiled = babel.transform(src, { presets: [ 'react' ] }).code;
- // Compile as a module
- m.paths = module.paths;
- m._compile(compiled, filename);
- return m.exports;
- }
- /**
- * A naive helper to replace {{tags}} with options.tags content
- */
- function reactBaseTmpl(data, options) {
- var exp;
- var regex;
- // Iterates through the keys in file object
- // and interpolate / replace {{key}} with it's value
- for (var k in options) {
- if (options.hasOwnProperty(k)) {
- exp = '{{' + k + '}}';
- regex = new RegExp(exp, 'g');
- if (data.match(regex)) {
- data = data.replace(regex, options[k]);
- }
- }
- }
- return data;
- }
- /**
- * Plates Support.
- */
- exports.plates = fromStringRenderer('plates');
- /**
- * Plates string support.
- */
- exports.plates.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.plates || (requires.plates = require('plates'));
- var map = options.map || undefined;
- try {
- var tmpl = engine.bind(str, options, map);
- cb(null, tmpl);
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * The main render parser for React bsaed templates
- */
- function reactRenderer(type) {
- if (commonjsRequire.extensions) {
- // Ensure JSX is transformed on require
- if (!commonjsRequire.extensions['.jsx']) {
- commonjsRequire.extensions['.jsx'] = requireReact;
- }
- // Supporting .react extension as well as test cases
- // Using .react extension is not recommended.
- if (!commonjsRequire.extensions['.react']) {
- commonjsRequire.extensions['.react'] = requireReact;
- }
- }
- // Return rendering fx
- return function(str, options, cb) {
- return promisify(cb, function(cb) {
- // React Import
- var ReactDOM = requires.ReactDOM || (requires.ReactDOM = require('react-dom/server'));
- var react = requires.react || (requires.react = require('react'));
- // Assign HTML Base
- var base = options.base;
- delete options.base;
- var enableCache = options.cache;
- delete options.cache;
- var isNonStatic = options.isNonStatic;
- delete options.isNonStatic;
- // Start Conversion
- try {
- var Code;
- var Factory;
- var baseStr;
- var content;
- var parsed;
- if (!cache(options)) {
- // Parsing
- if (type === 'path') {
- var path = resolve(str);
- delete require.cache[path];
- Code = commonjsRequire(path);
- } else {
- Code = requireReactString(str);
- }
- Factory = cache(options, react.createFactory(Code));
- } else {
- Factory = cache(options);
- }
- parsed = new Factory(options);
- content = (isNonStatic) ? ReactDOM.renderToString(parsed) : ReactDOM.renderToStaticMarkup(parsed);
- if (base) {
- baseStr = readCache[str] || fs__default.readFileSync(resolve(base), 'utf8');
- if (enableCache) {
- readCache[str] = baseStr;
- }
- options.content = content;
- content = reactBaseTmpl(baseStr, options);
- }
- cb(null, content);
- } catch (err) {
- cb(err);
- }
- });
- };
- }
- /**
- * React JS Support
- */
- exports.react = reactRenderer('path');
- /**
- * React JS string support.
- */
- exports.react.render = reactRenderer('string');
- /**
- * ARC-templates support.
- */
- exports['arc-templates'] = fromStringRenderer('arc-templates');
- /**
- * ARC-templates string support.
- */
- exports['arc-templates'].render = function(str, options, cb) {
- var readFileWithOptions = util__default.promisify(read);
- var consolidateFileSystem = {};
- consolidateFileSystem.readFile = function(path) {
- return readFileWithOptions(path, options);
- };
- return promisify(cb, function(cb) {
- try {
- var engine = requires['arc-templates'];
- if (!engine) {
- var Engine = require('arc-templates/dist/es5');
- engine = requires['arc-templates'] = new Engine({ filesystem: consolidateFileSystem });
- }
- var compiler = cache(options) || cache(options, engine.compileString(str, options.filename));
- compiler.then(function(func) { return func(options); })
- .then(function(result) { cb(null, result.content); })
- .catch(cb);
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Vash support
- */
- exports.vash = fromStringRenderer('vash');
- /**
- * Vash string support
- */
- exports.vash.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.vash || (requires.vash = require('vash'));
- try {
- // helper system : https://github.com/kirbysayshi/vash#helper-system
- if (options.helpers) {
- for (var key in options.helpers) {
- if (!options.helpers.hasOwnProperty(key) || typeof options.helpers[key] !== 'function') {
- continue;
- }
- engine.helpers[key] = options.helpers[key];
- }
- }
- var tmpl = cache(options) || cache(options, engine.compile(str, options));
- tmpl(options, function sealLayout(err, ctx) {
- if (err) cb(err);
- ctx.finishLayout();
- cb(null, ctx.toString().replace(/\n$/, ''));
- });
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Slm support.
- */
- exports.slm = fromStringRenderer('slm');
- /**
- * Slm string support.
- */
- exports.slm.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.slm || (requires.slm = require('slm'));
- try {
- var tmpl = cache(options) || cache(options, engine.compile(str, options));
- cb(null, tmpl(options));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Marko support.
- */
- exports.marko = function(path, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.marko || (requires.marko = require('marko'));
- options.writeToDisk = !!options.cache;
- try {
- var tmpl = cache(options) || cache(options, engine.load(path, options));
- tmpl.renderToString(options, cb);
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Marko string support.
- */
- exports.marko.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.marko || (requires.marko = require('marko'));
- options.writeToDisk = !!options.cache;
- options.filename = options.filename || 'string.marko';
- try {
- var tmpl = cache(options) || cache(options, engine.load(options.filename, str, options));
- tmpl.renderToString(options, cb);
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Teacup support.
- */
- exports.teacup = function(path, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.teacup || (requires.teacup = require('teacup/lib/express'));
- commonjsRequire.extensions['.teacup'] = commonjsRequire.extensions['.coffee'];
- if (path[0] !== '/') {
- path = join(process.cwd(), path);
- }
- if (!options.cache) {
- var callback = cb;
- cb = function() {
- delete require.cache[path];
- callback.apply(this, arguments);
- };
- }
- engine.renderFile(path, options, cb);
- });
- };
- /**
- * Teacup string support.
- */
- exports.teacup.render = function(str, options, cb) {
- var coffee = require('coffee-script');
- var vm = require('vm');
- var sandbox = {
- module: {exports: {}},
- require: commonjsRequire
- };
- return promisify(cb, function(cb) {
- vm.runInNewContext(coffee.compile(str), sandbox);
- var tmpl = sandbox.module.exports;
- cb(null, tmpl(options));
- });
- };
- /**
- * Squirrelly support.
- */
- exports.squirrelly = fromStringRenderer('squirrelly');
- /**
- * Squirrelly string support.
- */
- exports.squirrelly.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.squirrelly || (requires.squirrelly = require('squirrelly'));
- try {
- for (var partial in options.partials) {
- engine.definePartial(partial, options.partials[partial]);
- }
- for (var helper in options.helpers) {
- engine.defineHelper(helper, options.helpers[helper]);
- }
- var tmpl = cache(options) || cache(options, engine.Compile(str, options));
- cb(null, tmpl(options, engine));
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * Twing support.
- */
- exports.twing = fromStringRenderer('twing');
- /**
- * Twing string support.
- */
- exports.twing.render = function(str, options, cb) {
- return promisify(cb, function(cb) {
- var engine = requires.twing || (requires.twing = require('twing'));
- try {
- new engine.TwingEnvironment(new engine.TwingLoaderNull()).createTemplate(str).then((twingTemplate) => {
- twingTemplate.render(options).then((rendTmpl) => {
- var tmpl = cache(options) || cache(options, rendTmpl);
- cb(null, tmpl);
- });
- });
- } catch (err) {
- cb(err);
- }
- });
- };
- /**
- * expose the instance of the engine
- */
- exports.requires = requires;
- });
- var consolidate$1 = consolidate;
- const hasWarned = {};
- function warnOnce(msg) {
- const isNodeProd = typeof process !== 'undefined' && process.env.NODE_ENV === 'production';
- if (!isNodeProd && !false && !hasWarned[msg]) {
- hasWarned[msg] = true;
- warn(msg);
- }
- }
- function warn(msg) {
- console.warn(`\x1b[1m\x1b[33m[@vue/compiler-sfc]\x1b[0m\x1b[33m ${msg}\x1b[0m\n`);
- }
- function preprocess({ source, filename, preprocessOptions }, preprocessor) {
- // Consolidate exposes a callback based API, but the callback is in fact
- // called synchronously for most templating engines. In our case, we have to
- // expose a synchronous API so that it is usable in Jest transforms (which
- // have to be sync because they are applied via Node.js require hooks)
- let res = '';
- let err = null;
- preprocessor.render(source, { filename, ...preprocessOptions }, (_err, _res) => {
- if (_err)
- err = _err;
- res = _res;
- });
- if (err)
- throw err;
- return res;
- }
- function compileTemplate(options) {
- const { preprocessLang, preprocessCustomRequire } = options;
- const preprocessor = preprocessLang
- ? preprocessCustomRequire
- ? preprocessCustomRequire(preprocessLang)
- : consolidate$1[preprocessLang]
- : false;
- if (preprocessor) {
- try {
- return doCompileTemplate({
- ...options,
- source: preprocess(options, preprocessor)
- });
- }
- catch (e) {
- return {
- code: `export default function render() {}`,
- source: options.source,
- tips: [],
- errors: [e]
- };
- }
- }
- else if (preprocessLang) {
- return {
- code: `export default function render() {}`,
- source: options.source,
- tips: [
- `Component ${options.filename} uses lang ${preprocessLang} for template. Please install the language preprocessor.`
- ],
- errors: [
- `Component ${options.filename} uses lang ${preprocessLang} for template, however it is not installed.`
- ]
- };
- }
- else {
- return doCompileTemplate(options);
- }
- }
- function doCompileTemplate({ filename, id, scoped, slotted, inMap, source, ssr = false, ssrCssVars, isProd = false, compiler = ssr ? CompilerSSR__namespace : CompilerDOM__namespace, compilerOptions = {}, transformAssetUrls }) {
- const errors = [];
- const warnings = [];
- let nodeTransforms = [];
- if (shared.isObject(transformAssetUrls)) {
- const assetOptions = normalizeOptions(transformAssetUrls);
- nodeTransforms = [
- createAssetUrlTransformWithOptions(assetOptions),
- createSrcsetTransformWithOptions(assetOptions)
- ];
- }
- else if (transformAssetUrls !== false) {
- nodeTransforms = [transformAssetUrl, transformSrcset];
- }
- if (ssr && !ssrCssVars) {
- warnOnce(`compileTemplate is called with \`ssr: true\` but no ` +
- `corresponding \`cssVars\` option.\`.`);
- }
- if (!id) {
- warnOnce(`compileTemplate now requires the \`id\` option.\`.`);
- id = '';
- }
- const shortId = id.replace(/^data-v-/, '');
- const longId = `data-v-${shortId}`;
- let { code, ast, preamble, map } = compiler.compile(source, {
- mode: 'module',
- prefixIdentifiers: true,
- hoistStatic: true,
- cacheHandlers: true,
- ssrCssVars: ssr && ssrCssVars && ssrCssVars.length
- ? genCssVarsFromList(ssrCssVars, shortId, isProd, true)
- : '',
- scopeId: scoped ? longId : undefined,
- slotted,
- sourceMap: true,
- ...compilerOptions,
- nodeTransforms: nodeTransforms.concat(compilerOptions.nodeTransforms || []),
- filename,
- onError: e => errors.push(e),
- onWarn: w => warnings.push(w)
- });
- // inMap should be the map produced by ./parse.ts which is a simple line-only
- // mapping. If it is present, we need to adjust the final map and errors to
- // reflect the original line numbers.
- if (inMap) {
- if (map) {
- map = mapLines(inMap, map);
- }
- if (errors.length) {
- patchErrors(errors, source, inMap);
- }
- }
- const tips = warnings.map(w => {
- let msg = w.message;
- if (w.loc) {
- msg += `\n${shared.generateCodeFrame(source, w.loc.start.offset, w.loc.end.offset)}`;
- }
- return msg;
- });
- return { code, ast, preamble, source, errors, tips, map };
- }
- function mapLines(oldMap, newMap) {
- if (!oldMap)
- return newMap;
- if (!newMap)
- return oldMap;
- const oldMapConsumer = new sourceMap.SourceMapConsumer(oldMap);
- const newMapConsumer = new sourceMap.SourceMapConsumer(newMap);
- const mergedMapGenerator = new sourceMap.SourceMapGenerator();
- newMapConsumer.eachMapping(m => {
- if (m.originalLine == null) {
- return;
- }
- const origPosInOldMap = oldMapConsumer.originalPositionFor({
- line: m.originalLine,
- column: m.originalColumn
- });
- if (origPosInOldMap.source == null) {
- return;
- }
- mergedMapGenerator.addMapping({
- generated: {
- line: m.generatedLine,
- column: m.generatedColumn
- },
- original: {
- line: origPosInOldMap.line,
- // use current column, since the oldMap produced by @vue/compiler-sfc
- // does not
- column: m.originalColumn
- },
- source: origPosInOldMap.source,
- name: origPosInOldMap.name
- });
- });
- // source-map's type definition is incomplete
- const generator = mergedMapGenerator;
- oldMapConsumer.sources.forEach((sourceFile) => {
- generator._sources.add(sourceFile);
- const sourceContent = oldMapConsumer.sourceContentFor(sourceFile);
- if (sourceContent != null) {
- mergedMapGenerator.setSourceContent(sourceFile, sourceContent);
- }
- });
- generator._sourceRoot = oldMap.sourceRoot;
- generator._file = oldMap.file;
- return generator.toJSON();
- }
- function patchErrors(errors, source, inMap) {
- const originalSource = inMap.sourcesContent[0];
- const offset = originalSource.indexOf(source);
- const lineOffset = originalSource.slice(0, offset).split(/\r?\n/).length - 1;
- errors.forEach(err => {
- if (err.loc) {
- err.loc.start.line += lineOffset;
- err.loc.start.offset += offset;
- if (err.loc.end !== err.loc.start) {
- err.loc.end.line += lineOffset;
- err.loc.end.offset += offset;
- }
- }
- });
- }
- const defaultExportRE = /((?:^|\n|;)\s*)export(\s*)default/;
- const namedDefaultExportRE = /((?:^|\n|;)\s*)export(.+)(?:as)?(\s*)default/s;
- const exportDefaultClassRE = /((?:^|\n|;)\s*)export\s+default\s+class\s+([\w$]+)/;
- /**
- * Utility for rewriting `export default` in a script block into a variable
- * declaration so that we can inject things into it
- */
- function rewriteDefault(input, as, parserPlugins) {
- if (!hasDefaultExport(input)) {
- return input + `\nconst ${as} = {}`;
- }
- let replaced;
- const classMatch = input.match(exportDefaultClassRE);
- if (classMatch) {
- replaced =
- input.replace(exportDefaultClassRE, '$1class $2') +
- `\nconst ${as} = ${classMatch[2]}`;
- }
- else {
- replaced = input.replace(defaultExportRE, `$1const ${as} =`);
- }
- if (!hasDefaultExport(replaced)) {
- return replaced;
- }
- // if the script somehow still contains `default export`, it probably has
- // multi-line comments or template strings. fallback to a full parse.
- const s = new MagicString__default(input);
- const ast = parser$2.parse(input, {
- sourceType: 'module',
- plugins: parserPlugins
- }).program.body;
- ast.forEach(node => {
- if (node.type === 'ExportDefaultDeclaration') {
- if (node.declaration.type === 'ClassDeclaration') {
- s.overwrite(node.start, node.declaration.id.start, `class `);
- s.append(`\nconst ${as} = ${node.declaration.id.name}`);
- }
- else {
- s.overwrite(node.start, node.declaration.start, `const ${as} = `);
- }
- }
- if (node.type === 'ExportNamedDeclaration') {
- for (const specifier of node.specifiers) {
- if (specifier.type === 'ExportSpecifier' &&
- specifier.exported.type === 'Identifier' &&
- specifier.exported.name === 'default') {
- if (node.source) {
- if (specifier.local.name === 'default') {
- const end = specifierEnd(input, specifier.local.end, node.end);
- s.prepend(`import { default as __VUE_DEFAULT__ } from '${node.source.value}'\n`);
- s.overwrite(specifier.start, end, ``);
- s.append(`\nconst ${as} = __VUE_DEFAULT__`);
- continue;
- }
- else {
- const end = specifierEnd(input, specifier.exported.end, node.end);
- s.prepend(`import { ${input.slice(specifier.local.start, specifier.local.end)} } from '${node.source.value}'\n`);
- s.overwrite(specifier.start, end, ``);
- s.append(`\nconst ${as} = ${specifier.local.name}`);
- continue;
- }
- }
- const end = specifierEnd(input, specifier.end, node.end);
- s.overwrite(specifier.start, end, ``);
- s.append(`\nconst ${as} = ${specifier.local.name}`);
- }
- }
- }
- });
- return s.toString();
- }
- function hasDefaultExport(input) {
- return defaultExportRE.test(input) || namedDefaultExportRE.test(input);
- }
- function specifierEnd(input, end, nodeEnd) {
- // export { default , foo } ...
- let hasCommas = false;
- let oldEnd = end;
- while (end < nodeEnd) {
- if (/\s/.test(input.charAt(end))) {
- end++;
- }
- else if (input.charAt(end) === ',') {
- end++;
- hasCommas = true;
- break;
- }
- else if (input.charAt(end) === '}') {
- break;
- }
- }
- return hasCommas ? end : oldEnd;
- }
- // Special compiler macros
- const DEFINE_PROPS = 'defineProps';
- const DEFINE_EMITS = 'defineEmits';
- const DEFINE_EXPOSE = 'defineExpose';
- const WITH_DEFAULTS = 'withDefaults';
- // constants
- const DEFAULT_VAR = `__default__`;
- const isBuiltInDir = shared.makeMap(`once,memo,if,for,else,else-if,slot,text,html,on,bind,model,show,cloak,is`);
- /**
- * Compile `<script setup>`
- * It requires the whole SFC descriptor because we need to handle and merge
- * normal `<script>` + `<script setup>` if both are present.
- */
- function compileScript(sfc, options) {
- var _a;
- let { script, scriptSetup, source, filename } = sfc;
- // feature flags
- // TODO remove support for deprecated options when out of experimental
- const enableReactivityTransform = !!options.reactivityTransform ||
- !!options.refSugar ||
- !!options.refTransform;
- const enablePropsTransform = !!options.reactivityTransform || !!options.propsDestructureTransform;
- const isProd = !!options.isProd;
- const genSourceMap = options.sourceMap !== false;
- let refBindings;
- if (!options.id) {
- warnOnce(`compileScript now requires passing the \`id\` option.\n` +
- `Upgrade your vite or vue-loader version for compatibility with ` +
- `the latest experimental proposals.`);
- }
- const scopeId = options.id ? options.id.replace(/^data-v-/, '') : '';
- const cssVars = sfc.cssVars;
- const scriptLang = script && script.lang;
- const scriptSetupLang = scriptSetup && scriptSetup.lang;
- const isTS = scriptLang === 'ts' ||
- scriptLang === 'tsx' ||
- scriptSetupLang === 'ts' ||
- scriptSetupLang === 'tsx';
- // resolve parser plugins
- const plugins = [];
- if (!isTS || scriptLang === 'tsx' || scriptSetupLang === 'tsx') {
- plugins.push('jsx');
- }
- else {
- // If don't match the case of adding jsx, should remove the jsx from the babelParserPlugins
- if (options.babelParserPlugins)
- options.babelParserPlugins = options.babelParserPlugins.filter(n => n !== 'jsx');
- }
- if (options.babelParserPlugins)
- plugins.push(...options.babelParserPlugins);
- if (isTS) {
- plugins.push('typescript');
- if (!plugins.includes('decorators')) {
- plugins.push('decorators-legacy');
- }
- }
- if (!scriptSetup) {
- if (!script) {
- throw new Error(`[@vue/compiler-sfc] SFC contains no <script> tags.`);
- }
- if (scriptLang && !isTS && scriptLang !== 'jsx') {
- // do not process non js/ts script blocks
- return script;
- }
- try {
- let content = script.content;
- let map = script.map;
- const scriptAst = parser$2.parse(content, {
- plugins,
- sourceType: 'module'
- }).program;
- const bindings = analyzeScriptBindings(scriptAst.body);
- if (enableReactivityTransform && reactivityTransform.shouldTransform(content)) {
- const s = new MagicString__default(source);
- const startOffset = script.loc.start.offset;
- const endOffset = script.loc.end.offset;
- const { importedHelpers } = reactivityTransform.transformAST(scriptAst, s, startOffset);
- if (importedHelpers.length) {
- s.prepend(`import { ${importedHelpers
- .map(h => `${h} as _${h}`)
- .join(', ')} } from 'vue'\n`);
- }
- s.remove(0, startOffset);
- s.remove(endOffset, source.length);
- content = s.toString();
- if (genSourceMap) {
- map = s.generateMap({
- source: filename,
- hires: true,
- includeContent: true
- });
- }
- }
- if (cssVars.length) {
- content = rewriteDefault(content, DEFAULT_VAR, plugins);
- content += genNormalScriptCssVarsCode(cssVars, bindings, scopeId, isProd);
- content += `\nexport default ${DEFAULT_VAR}`;
- }
- return {
- ...script,
- content,
- map,
- bindings,
- scriptAst: scriptAst.body
- };
- }
- catch (e) {
- // silently fallback if parse fails since user may be using custom
- // babel syntax
- return script;
- }
- }
- if (script && scriptLang !== scriptSetupLang) {
- throw new Error(`[@vue/compiler-sfc] <script> and <script setup> must have the same ` +
- `language type.`);
- }
- if (scriptSetupLang && !isTS && scriptSetupLang !== 'jsx') {
- // do not process non js/ts script blocks
- return scriptSetup;
- }
- // metadata that needs to be returned
- const bindingMetadata = {};
- const helperImports = new Set();
- const userImports = Object.create(null);
- const scriptBindings = Object.create(null);
- const setupBindings = Object.create(null);
- let defaultExport;
- let hasDefinePropsCall = false;
- let hasDefineEmitCall = false;
- let hasDefineExposeCall = false;
- let hasDefaultExportName = false;
- let hasDefaultExportRender = false;
- let propsRuntimeDecl;
- let propsRuntimeDefaults;
- let propsDestructureDecl;
- let propsDestructureRestId;
- let propsTypeDecl;
- let propsTypeDeclRaw;
- let propsIdentifier;
- let emitsRuntimeDecl;
- let emitsTypeDecl;
- let emitsTypeDeclRaw;
- let emitIdentifier;
- let hasAwait = false;
- let hasInlinedSsrRenderFn = false;
- // props/emits declared via types
- const typeDeclaredProps = {};
- const typeDeclaredEmits = new Set();
- // record declared types for runtime props type generation
- const declaredTypes = {};
- // props destructure data
- const propsDestructuredBindings = Object.create(null);
- // magic-string state
- const s = new MagicString__default(source);
- const startOffset = scriptSetup.loc.start.offset;
- const endOffset = scriptSetup.loc.end.offset;
- const scriptStartOffset = script && script.loc.start.offset;
- const scriptEndOffset = script && script.loc.end.offset;
- function helper(key) {
- helperImports.add(key);
- return `_${key}`;
- }
- function parse(input, options, offset) {
- try {
- return parser$2.parse(input, options).program;
- }
- catch (e) {
- e.message = `[@vue/compiler-sfc] ${e.message}\n\n${sfc.filename}\n${shared.generateCodeFrame(source, e.pos + offset, e.pos + offset + 1)}`;
- throw e;
- }
- }
- function error(msg, node, end = node.end + startOffset) {
- throw new Error(`[@vue/compiler-sfc] ${msg}\n\n${sfc.filename}\n${shared.generateCodeFrame(source, node.start + startOffset, end)}`);
- }
- function hoistNode(node) {
- const start = node.start + startOffset;
- let end = node.end + startOffset;
- // locate comment
- if (node.trailingComments && node.trailingComments.length > 0) {
- const lastCommentNode = node.trailingComments[node.trailingComments.length - 1];
- end = lastCommentNode.end + startOffset;
- }
- // locate the end of whitespace between this statement and the next
- while (end <= source.length) {
- if (!/\s/.test(source.charAt(end))) {
- break;
- }
- end++;
- }
- s.move(start, end, 0);
- }
- function registerUserImport(source, local, imported, isType, isFromSetup, needTemplateUsageCheck) {
- // template usage check is only needed in non-inline mode, so we can skip
- // the work if inlineTemplate is true.
- let isUsedInTemplate = needTemplateUsageCheck;
- if (needTemplateUsageCheck &&
- isTS &&
- sfc.template &&
- !sfc.template.src &&
- !sfc.template.lang) {
- isUsedInTemplate = isImportUsed(local, sfc);
- }
- userImports[local] = {
- isType,
- imported: imported || 'default',
- local,
- source,
- isFromSetup,
- isUsedInTemplate
- };
- }
- function processDefineProps(node, declId) {
- if (!isCallOf(node, DEFINE_PROPS)) {
- return false;
- }
- if (hasDefinePropsCall) {
- error(`duplicate ${DEFINE_PROPS}() call`, node);
- }
- hasDefinePropsCall = true;
- propsRuntimeDecl = node.arguments[0];
- // call has type parameters - infer runtime types from it
- if (node.typeParameters) {
- if (propsRuntimeDecl) {
- error(`${DEFINE_PROPS}() cannot accept both type and non-type arguments ` +
- `at the same time. Use one or the other.`, node);
- }
- propsTypeDeclRaw = node.typeParameters.params[0];
- propsTypeDecl = resolveQualifiedType(propsTypeDeclRaw, node => node.type === 'TSTypeLiteral');
- if (!propsTypeDecl) {
- error(`type argument passed to ${DEFINE_PROPS}() must be a literal type, ` +
- `or a reference to an interface or literal type.`, propsTypeDeclRaw);
- }
- }
- if (declId) {
- if (enablePropsTransform && declId.type === 'ObjectPattern') {
- propsDestructureDecl = declId;
- // props destructure - handle compilation sugar
- for (const prop of declId.properties) {
- if (prop.type === 'ObjectProperty') {
- const propKey = resolveObjectKey(prop.key, prop.computed);
- if (!propKey) {
- error(`${DEFINE_PROPS}() destructure cannot use computed key.`, prop.key);
- }
- if (prop.value.type === 'AssignmentPattern') {
- // default value { foo = 123 }
- const { left, right } = prop.value;
- if (left.type !== 'Identifier') {
- error(`${DEFINE_PROPS}() destructure does not support nested patterns.`, left);
- }
- // store default value
- propsDestructuredBindings[propKey] = {
- local: left.name,
- default: right
- };
- }
- else if (prop.value.type === 'Identifier') {
- // simple destructure
- propsDestructuredBindings[propKey] = {
- local: prop.value.name
- };
- }
- else {
- error(`${DEFINE_PROPS}() destructure does not support nested patterns.`, prop.value);
- }
- }
- else {
- // rest spread
- propsDestructureRestId = prop.argument.name;
- }
- }
- }
- else {
- propsIdentifier = scriptSetup.content.slice(declId.start, declId.end);
- }
- }
- return true;
- }
- function processWithDefaults(node, declId) {
- if (!isCallOf(node, WITH_DEFAULTS)) {
- return false;
- }
- if (processDefineProps(node.arguments[0], declId)) {
- if (propsRuntimeDecl) {
- error(`${WITH_DEFAULTS} can only be used with type-based ` +
- `${DEFINE_PROPS} declaration.`, node);
- }
- if (propsDestructureDecl) {
- error(`${WITH_DEFAULTS}() is unnecessary when using destructure with ${DEFINE_PROPS}().\n` +
- `Prefer using destructure default values, e.g. const { foo = 1 } = defineProps(...).`, node.callee);
- }
- propsRuntimeDefaults = node.arguments[1];
- if (!propsRuntimeDefaults ||
- propsRuntimeDefaults.type !== 'ObjectExpression') {
- error(`The 2nd argument of ${WITH_DEFAULTS} must be an object literal.`, propsRuntimeDefaults || node);
- }
- }
- else {
- error(`${WITH_DEFAULTS}' first argument must be a ${DEFINE_PROPS} call.`, node.arguments[0] || node);
- }
- return true;
- }
- function processDefineEmits(node, declId) {
- if (!isCallOf(node, DEFINE_EMITS)) {
- return false;
- }
- if (hasDefineEmitCall) {
- error(`duplicate ${DEFINE_EMITS}() call`, node);
- }
- hasDefineEmitCall = true;
- emitsRuntimeDecl = node.arguments[0];
- if (node.typeParameters) {
- if (emitsRuntimeDecl) {
- error(`${DEFINE_EMITS}() cannot accept both type and non-type arguments ` +
- `at the same time. Use one or the other.`, node);
- }
- emitsTypeDeclRaw = node.typeParameters.params[0];
- emitsTypeDecl = resolveQualifiedType(emitsTypeDeclRaw, node => node.type === 'TSFunctionType' || node.type === 'TSTypeLiteral');
- if (!emitsTypeDecl) {
- error(`type argument passed to ${DEFINE_EMITS}() must be a function type, ` +
- `a literal type with call signatures, or a reference to the above types.`, emitsTypeDeclRaw);
- }
- }
- if (declId) {
- emitIdentifier =
- declId.type === 'Identifier'
- ? declId.name
- : scriptSetup.content.slice(declId.start, declId.end);
- }
- return true;
- }
- function getAstBody() {
- return scriptAst
- ? [...scriptSetupAst.body, ...scriptAst.body]
- : scriptSetupAst.body;
- }
- function resolveExtendsType(node, qualifier, cache = []) {
- if (node.type === 'TSInterfaceDeclaration' && node.extends) {
- node.extends.forEach(extend => {
- if (extend.type === 'TSExpressionWithTypeArguments' &&
- extend.expression.type === 'Identifier') {
- const body = getAstBody();
- for (const node of body) {
- const qualified = isQualifiedType(node, qualifier, extend.expression.name);
- if (qualified) {
- cache.push(qualified);
- resolveExtendsType(node, qualifier, cache);
- return cache;
- }
- }
- }
- });
- }
- return cache;
- }
- function isQualifiedType(node, qualifier, refName) {
- if (node.type === 'TSInterfaceDeclaration' && node.id.name === refName) {
- return node.body;
- }
- else if (node.type === 'TSTypeAliasDeclaration' &&
- node.id.name === refName &&
- qualifier(node.typeAnnotation)) {
- return node.typeAnnotation;
- }
- else if (node.type === 'ExportNamedDeclaration' && node.declaration) {
- return isQualifiedType(node.declaration, qualifier, refName);
- }
- }
- // filter all extends types to keep the override declaration
- function filterExtendsType(extendsTypes, bodies) {
- extendsTypes.forEach(extend => {
- const body = extend.body;
- body.forEach(newBody => {
- if (newBody.type === 'TSPropertySignature' &&
- newBody.key.type === 'Identifier') {
- const name = newBody.key.name;
- const hasOverride = bodies.some(seenBody => seenBody.type === 'TSPropertySignature' &&
- seenBody.key.type === 'Identifier' &&
- seenBody.key.name === name);
- if (!hasOverride)
- bodies.push(newBody);
- }
- });
- });
- }
- function resolveQualifiedType(node, qualifier) {
- if (qualifier(node)) {
- return node;
- }
- if (node.type === 'TSTypeReference' &&
- node.typeName.type === 'Identifier') {
- const refName = node.typeName.name;
- const body = getAstBody();
- for (const node of body) {
- let qualified = isQualifiedType(node, qualifier, refName);
- if (qualified) {
- const extendsTypes = resolveExtendsType(node, qualifier);
- if (extendsTypes.length) {
- const bodies = [...qualified.body];
- filterExtendsType(extendsTypes, bodies);
- qualified.body = bodies;
- }
- return qualified;
- }
- }
- }
- }
- function processDefineExpose(node) {
- if (isCallOf(node, DEFINE_EXPOSE)) {
- if (hasDefineExposeCall) {
- error(`duplicate ${DEFINE_EXPOSE}() call`, node);
- }
- hasDefineExposeCall = true;
- return true;
- }
- return false;
- }
- function checkInvalidScopeReference(node, method) {
- if (!node)
- return;
- CompilerDOM.walkIdentifiers(node, id => {
- if (setupBindings[id.name]) {
- error(`\`${method}()\` in <script setup> cannot reference locally ` +
- `declared variables because it will be hoisted outside of the ` +
- `setup() function. If your component options require initialization ` +
- `in the module scope, use a separate normal <script> to export ` +
- `the options instead.`, id);
- }
- });
- }
- /**
- * await foo()
- * -->
- * ;(
- * ([__temp,__restore] = withAsyncContext(() => foo())),
- * await __temp,
- * __restore()
- * )
- *
- * const a = await foo()
- * -->
- * const a = (
- * ([__temp, __restore] = withAsyncContext(() => foo())),
- * __temp = await __temp,
- * __restore(),
- * __temp
- * )
- */
- function processAwait(node, needSemi, isStatement) {
- const argumentStart = node.argument.extra && node.argument.extra.parenthesized
- ? node.argument.extra.parenStart
- : node.argument.start;
- const argumentStr = source.slice(argumentStart + startOffset, node.argument.end + startOffset);
- const containsNestedAwait = /\bawait\b/.test(argumentStr);
- s.overwrite(node.start + startOffset, argumentStart + startOffset, `${needSemi ? `;` : ``}(\n ([__temp,__restore] = ${helper(`withAsyncContext`)}(${containsNestedAwait ? `async ` : ``}() => `);
- s.appendLeft(node.end + startOffset, `)),\n ${isStatement ? `` : `__temp = `}await __temp,\n __restore()${isStatement ? `` : `,\n __temp`}\n)`);
- }
- /**
- * check defaults. If the default object is an object literal with only
- * static properties, we can directly generate more optimized default
- * declarations. Otherwise we will have to fallback to runtime merging.
- */
- function hasStaticWithDefaults() {
- return (propsRuntimeDefaults &&
- propsRuntimeDefaults.type === 'ObjectExpression' &&
- propsRuntimeDefaults.properties.every(node => (node.type === 'ObjectProperty' &&
- (!node.computed || node.key.type.endsWith('Literal'))) ||
- node.type === 'ObjectMethod'));
- }
- function genRuntimeProps(props) {
- const keys = Object.keys(props);
- if (!keys.length) {
- return ``;
- }
- const hasStaticDefaults = hasStaticWithDefaults();
- const scriptSetupSource = scriptSetup.content;
- let propsDecls = `{
- ${keys
- .map(key => {
- let defaultString;
- const destructured = genDestructuredDefaultValue(key);
- if (destructured) {
- defaultString = `default: ${destructured}`;
- }
- else if (hasStaticDefaults) {
- const prop = propsRuntimeDefaults.properties.find(node => {
- if (node.type === 'SpreadElement')
- return false;
- return resolveObjectKey(node.key, node.computed) === key;
- });
- if (prop) {
- if (prop.type === 'ObjectProperty') {
- // prop has corresponding static default value
- defaultString = `default: ${scriptSetupSource.slice(prop.value.start, prop.value.end)}`;
- }
- else {
- defaultString = `${prop.async ? 'async ' : ''}${prop.kind !== 'method' ? `${prop.kind} ` : ''}default() ${scriptSetupSource.slice(prop.body.start, prop.body.end)}`;
- }
- }
- }
- const { type, required } = props[key];
- if (!isProd) {
- return `${key}: { type: ${toRuntimeTypeString(type)}, required: ${required}${defaultString ? `, ${defaultString}` : ``} }`;
- }
- else if (type.some(el => el === 'Boolean' || (defaultString && el === 'Function'))) {
- // #4783 production: if boolean or defaultString and function exists, should keep the type.
- return `${key}: { type: ${toRuntimeTypeString(type)}${defaultString ? `, ${defaultString}` : ``} }`;
- }
- else {
- // production: checks are useless
- return `${key}: ${defaultString ? `{ ${defaultString} }` : 'null'}`;
- }
- })
- .join(',\n ')}\n }`;
- if (propsRuntimeDefaults && !hasStaticDefaults) {
- propsDecls = `${helper('mergeDefaults')}(${propsDecls}, ${source.slice(propsRuntimeDefaults.start + startOffset, propsRuntimeDefaults.end + startOffset)})`;
- }
- return `\n props: ${propsDecls},`;
- }
- function genDestructuredDefaultValue(key) {
- const destructured = propsDestructuredBindings[key];
- if (destructured && destructured.default) {
- const value = scriptSetup.content.slice(destructured.default.start, destructured.default.end);
- const isLiteral = destructured.default.type.endsWith('Literal');
- return isLiteral ? value : `() => (${value})`;
- }
- }
- function genSetupPropsType(node) {
- const scriptSetupSource = scriptSetup.content;
- if (hasStaticWithDefaults()) {
- // if withDefaults() is used, we need to remove the optional flags
- // on props that have default values
- let res = `{ `;
- const members = node.type === 'TSTypeLiteral' ? node.members : node.body;
- for (const m of members) {
- if ((m.type === 'TSPropertySignature' ||
- m.type === 'TSMethodSignature') &&
- m.typeAnnotation &&
- m.key.type === 'Identifier') {
- if (propsRuntimeDefaults.properties.some(p => {
- if (p.type === 'SpreadElement')
- return false;
- return (resolveObjectKey(p.key, p.computed) ===
- m.key.name);
- })) {
- res +=
- m.key.name +
- (m.type === 'TSMethodSignature' ? '()' : '') +
- scriptSetupSource.slice(m.typeAnnotation.start, m.typeAnnotation.end) +
- ', ';
- }
- else {
- res +=
- scriptSetupSource.slice(m.start, m.typeAnnotation.end) + `, `;
- }
- }
- }
- return (res.length ? res.slice(0, -2) : res) + ` }`;
- }
- else {
- return scriptSetupSource.slice(node.start, node.end);
- }
- }
- // 0. parse both <script> and <script setup> blocks
- const scriptAst = script &&
- parse(script.content, {
- plugins,
- sourceType: 'module'
- }, scriptStartOffset);
- const scriptSetupAst = parse(scriptSetup.content, {
- plugins: [
- ...plugins,
- // allow top level await but only inside <script setup>
- 'topLevelAwait'
- ],
- sourceType: 'module'
- }, startOffset);
- // 1.1 walk import delcarations of <script>
- if (scriptAst) {
- for (const node of scriptAst.body) {
- if (node.type === 'ImportDeclaration') {
- // record imports for dedupe
- for (const specifier of node.specifiers) {
- const imported = specifier.type === 'ImportSpecifier' &&
- specifier.imported.type === 'Identifier' &&
- specifier.imported.name;
- registerUserImport(node.source.value, specifier.local.name, imported, node.importKind === 'type' ||
- (specifier.type === 'ImportSpecifier' &&
- specifier.importKind === 'type'), false, !options.inlineTemplate);
- }
- }
- }
- }
- // 1.2 walk import declarations of <script setup>
- for (const node of scriptSetupAst.body) {
- if (node.type === 'ImportDeclaration') {
- // import declarations are moved to top
- hoistNode(node);
- // dedupe imports
- let removed = 0;
- const removeSpecifier = (i) => {
- const removeLeft = i > removed;
- removed++;
- const current = node.specifiers[i];
- const next = node.specifiers[i + 1];
- s.remove(removeLeft
- ? node.specifiers[i - 1].end + startOffset
- : current.start + startOffset, next && !removeLeft
- ? next.start + startOffset
- : current.end + startOffset);
- };
- for (let i = 0; i < node.specifiers.length; i++) {
- const specifier = node.specifiers[i];
- const local = specifier.local.name;
- let imported = specifier.type === 'ImportSpecifier' &&
- specifier.imported.type === 'Identifier' &&
- specifier.imported.name;
- if (specifier.type === 'ImportNamespaceSpecifier') {
- imported = '*';
- }
- const source = node.source.value;
- const existing = userImports[local];
- if (source === 'vue' &&
- (imported === DEFINE_PROPS ||
- imported === DEFINE_EMITS ||
- imported === DEFINE_EXPOSE)) {
- warnOnce(`\`${imported}\` is a compiler macro and no longer needs to be imported.`);
- removeSpecifier(i);
- }
- else if (existing) {
- if (existing.source === source && existing.imported === imported) {
- // already imported in <script setup>, dedupe
- removeSpecifier(i);
- }
- else {
- error(`different imports aliased to same local name.`, specifier);
- }
- }
- else {
- registerUserImport(source, local, imported, node.importKind === 'type' ||
- (specifier.type === 'ImportSpecifier' &&
- specifier.importKind === 'type'), true, !options.inlineTemplate);
- }
- }
- if (node.specifiers.length && removed === node.specifiers.length) {
- s.remove(node.start + startOffset, node.end + startOffset);
- }
- }
- }
- // 1.3 resolve possible user import alias of `ref` and `reactive`
- const vueImportAliases = {};
- for (const key in userImports) {
- const { source, imported, local } = userImports[key];
- if (source === 'vue')
- vueImportAliases[imported] = local;
- }
- // 2.1 process normal <script> body
- if (script && scriptAst) {
- for (const node of scriptAst.body) {
- if (node.type === 'ExportDefaultDeclaration') {
- // export default
- defaultExport = node;
- // check if user has manually specified `name` or 'render` option in
- // export default
- // if has name, skip name inference
- // if has render and no template, generate return object instead of
- // empty render function (#4980)
- let optionProperties;
- if (defaultExport.declaration.type === 'ObjectExpression') {
- optionProperties = defaultExport.declaration.properties;
- }
- else if (defaultExport.declaration.type === 'CallExpression' &&
- defaultExport.declaration.arguments[0].type === 'ObjectExpression') {
- optionProperties = defaultExport.declaration.arguments[0].properties;
- }
- if (optionProperties) {
- for (const s of optionProperties) {
- if (s.type === 'ObjectProperty' &&
- s.key.type === 'Identifier' &&
- s.key.name === 'name') {
- hasDefaultExportName = true;
- }
- if ((s.type === 'ObjectMethod' || s.type === 'ObjectProperty') &&
- s.key.type === 'Identifier' &&
- s.key.name === 'render') {
- // TODO warn when we provide a better way to do it?
- hasDefaultExportRender = true;
- }
- }
- }
- // export default { ... } --> const __default__ = { ... }
- const start = node.start + scriptStartOffset;
- const end = node.declaration.start + scriptStartOffset;
- s.overwrite(start, end, `const ${DEFAULT_VAR} = `);
- }
- else if (node.type === 'ExportNamedDeclaration') {
- const defaultSpecifier = node.specifiers.find(s => s.exported.type === 'Identifier' && s.exported.name === 'default');
- if (defaultSpecifier) {
- defaultExport = node;
- // 1. remove specifier
- if (node.specifiers.length > 1) {
- s.remove(defaultSpecifier.start + scriptStartOffset, defaultSpecifier.end + scriptStartOffset);
- }
- else {
- s.remove(node.start + scriptStartOffset, node.end + scriptStartOffset);
- }
- if (node.source) {
- // export { x as default } from './x'
- // rewrite to `import { x as __default__ } from './x'` and
- // add to top
- s.prepend(`import { ${defaultSpecifier.local.name} as ${DEFAULT_VAR} } from '${node.source.value}'\n`);
- }
- else {
- // export { x as default }
- // rewrite to `const __default__ = x` and move to end
- s.appendLeft(scriptEndOffset, `\nconst ${DEFAULT_VAR} = ${defaultSpecifier.local.name}\n`);
- }
- }
- if (node.declaration) {
- walkDeclaration(node.declaration, scriptBindings, vueImportAliases);
- }
- }
- else if ((node.type === 'VariableDeclaration' ||
- node.type === 'FunctionDeclaration' ||
- node.type === 'ClassDeclaration' ||
- node.type === 'TSEnumDeclaration') &&
- !node.declare) {
- walkDeclaration(node, scriptBindings, vueImportAliases);
- }
- }
- // apply reactivity transform
- if (enableReactivityTransform && reactivityTransform.shouldTransform(script.content)) {
- const { rootRefs, importedHelpers } = reactivityTransform.transformAST(scriptAst, s, scriptStartOffset);
- refBindings = rootRefs;
- for (const h of importedHelpers) {
- helperImports.add(h);
- }
- }
- // <script> after <script setup>
- // we need to move the block up so that `const __default__` is
- // declared before being used in the actual component definition
- if (scriptStartOffset > startOffset) {
- // if content doesn't end with newline, add one
- if (!/\n$/.test(script.content.trim())) {
- s.appendLeft(scriptEndOffset, `\n`);
- }
- s.move(scriptStartOffset, scriptEndOffset, 0);
- }
- }
- // 2.2 process <script setup> body
- for (const node of scriptSetupAst.body) {
- // (Dropped) `ref: x` bindings
- // TODO remove when out of experimental
- if (node.type === 'LabeledStatement' &&
- node.label.name === 'ref' &&
- node.body.type === 'ExpressionStatement') {
- error(`ref sugar using the label syntax was an experimental proposal and ` +
- `has been dropped based on community feedback. Please check out ` +
- `the new proposal at https://github.com/vuejs/rfcs/discussions/369`, node);
- }
- if (node.type === 'ExpressionStatement') {
- // process `defineProps` and `defineEmit(s)` calls
- if (processDefineProps(node.expression) ||
- processDefineEmits(node.expression) ||
- processWithDefaults(node.expression)) {
- s.remove(node.start + startOffset, node.end + startOffset);
- }
- else if (processDefineExpose(node.expression)) {
- // defineExpose({}) -> expose({})
- const callee = node.expression.callee;
- s.overwrite(callee.start + startOffset, callee.end + startOffset, 'expose');
- }
- }
- if (node.type === 'VariableDeclaration' && !node.declare) {
- const total = node.declarations.length;
- let left = total;
- for (let i = 0; i < total; i++) {
- const decl = node.declarations[i];
- if (decl.init) {
- // defineProps / defineEmits
- const isDefineProps = processDefineProps(decl.init, decl.id) ||
- processWithDefaults(decl.init, decl.id);
- const isDefineEmits = processDefineEmits(decl.init, decl.id);
- if (isDefineProps || isDefineEmits) {
- if (left === 1) {
- s.remove(node.start + startOffset, node.end + startOffset);
- }
- else {
- let start = decl.start + startOffset;
- let end = decl.end + startOffset;
- if (i === 0) {
- // first one, locate the start of the next
- end = node.declarations[i + 1].start + startOffset;
- }
- else {
- // not first one, locate the end of the prev
- start = node.declarations[i - 1].end + startOffset;
- }
- s.remove(start, end);
- left--;
- }
- }
- }
- }
- }
- // walk declarations to record declared bindings
- if ((node.type === 'VariableDeclaration' ||
- node.type === 'FunctionDeclaration' ||
- node.type === 'ClassDeclaration') &&
- !node.declare) {
- walkDeclaration(node, setupBindings, vueImportAliases);
- }
- // walk statements & named exports / variable declarations for top level
- // await
- if ((node.type === 'VariableDeclaration' && !node.declare) ||
- node.type.endsWith('Statement')) {
- const scope = [scriptSetupAst.body];
- estreeWalker.walk(node, {
- enter(child, parent) {
- if (CompilerDOM.isFunctionType(child)) {
- this.skip();
- }
- if (child.type === 'BlockStatement') {
- scope.push(child.body);
- }
- if (child.type === 'AwaitExpression') {
- hasAwait = true;
- // if the await expression is an expression statement and
- // - is in the root scope
- // - or is not the first statement in a nested block scope
- // then it needs a semicolon before the generated code.
- const currentScope = scope[scope.length - 1];
- const needsSemi = currentScope.some((n, i) => {
- return ((scope.length === 1 || i > 0) &&
- n.type === 'ExpressionStatement' &&
- n.start === child.start);
- });
- processAwait(child, needsSemi, parent.type === 'ExpressionStatement');
- }
- },
- exit(node) {
- if (node.type === 'BlockStatement')
- scope.pop();
- }
- });
- }
- if ((node.type === 'ExportNamedDeclaration' && node.exportKind !== 'type') ||
- node.type === 'ExportAllDeclaration' ||
- node.type === 'ExportDefaultDeclaration') {
- error(`<script setup> cannot contain ES module exports. ` +
- `If you are using a previous version of <script setup>, please ` +
- `consult the updated RFC at https://github.com/vuejs/rfcs/pull/227.`, node);
- }
- if (isTS) {
- // runtime enum
- if (node.type === 'TSEnumDeclaration') {
- registerBinding(setupBindings, node.id, "setup-const" /* BindingTypes.SETUP_CONST */);
- }
- // move all Type declarations to outer scope
- if (node.type.startsWith('TS') ||
- (node.type === 'ExportNamedDeclaration' &&
- node.exportKind === 'type') ||
- (node.type === 'VariableDeclaration' && node.declare)) {
- recordType(node, declaredTypes);
- hoistNode(node);
- }
- }
- }
- // 3. Apply reactivity transform
- if ((enableReactivityTransform &&
- // normal <script> had ref bindings that maybe used in <script setup>
- (refBindings || reactivityTransform.shouldTransform(scriptSetup.content))) ||
- propsDestructureDecl) {
- const { rootRefs, importedHelpers } = reactivityTransform.transformAST(scriptSetupAst, s, startOffset, refBindings, propsDestructuredBindings);
- refBindings = refBindings ? [...refBindings, ...rootRefs] : rootRefs;
- for (const h of importedHelpers) {
- helperImports.add(h);
- }
- }
- // 4. extract runtime props/emits code from setup context type
- if (propsTypeDecl) {
- extractRuntimeProps(propsTypeDecl, typeDeclaredProps, declaredTypes);
- }
- if (emitsTypeDecl) {
- extractRuntimeEmits(emitsTypeDecl, typeDeclaredEmits);
- }
- // 5. check useOptions args to make sure it doesn't reference setup scope
- // variables
- checkInvalidScopeReference(propsRuntimeDecl, DEFINE_PROPS);
- checkInvalidScopeReference(propsRuntimeDefaults, DEFINE_PROPS);
- checkInvalidScopeReference(propsDestructureDecl, DEFINE_PROPS);
- checkInvalidScopeReference(emitsRuntimeDecl, DEFINE_EMITS);
- // 6. remove non-script content
- if (script) {
- if (startOffset < scriptStartOffset) {
- // <script setup> before <script>
- s.remove(0, startOffset);
- s.remove(endOffset, scriptStartOffset);
- s.remove(scriptEndOffset, source.length);
- }
- else {
- // <script> before <script setup>
- s.remove(0, scriptStartOffset);
- s.remove(scriptEndOffset, startOffset);
- s.remove(endOffset, source.length);
- }
- }
- else {
- // only <script setup>
- s.remove(0, startOffset);
- s.remove(endOffset, source.length);
- }
- // 7. analyze binding metadata
- if (scriptAst) {
- Object.assign(bindingMetadata, analyzeScriptBindings(scriptAst.body));
- }
- if (propsRuntimeDecl) {
- for (const key of getObjectOrArrayExpressionKeys(propsRuntimeDecl)) {
- bindingMetadata[key] = "props" /* BindingTypes.PROPS */;
- }
- }
- for (const key in typeDeclaredProps) {
- bindingMetadata[key] = "props" /* BindingTypes.PROPS */;
- }
- // props aliases
- if (propsDestructureDecl) {
- if (propsDestructureRestId) {
- bindingMetadata[propsDestructureRestId] =
- "setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */;
- }
- for (const key in propsDestructuredBindings) {
- const { local } = propsDestructuredBindings[key];
- if (local !== key) {
- bindingMetadata[local] = "props-aliased" /* BindingTypes.PROPS_ALIASED */;
- (bindingMetadata.__propsAliases ||
- (bindingMetadata.__propsAliases = {}))[local] = key;
- }
- }
- }
- for (const [key, { isType, imported, source }] of Object.entries(userImports)) {
- if (isType)
- continue;
- bindingMetadata[key] =
- imported === '*' ||
- (imported === 'default' && source.endsWith('.vue')) ||
- source === 'vue'
- ? "setup-const" /* BindingTypes.SETUP_CONST */
- : "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */;
- }
- for (const key in scriptBindings) {
- bindingMetadata[key] = scriptBindings[key];
- }
- for (const key in setupBindings) {
- bindingMetadata[key] = setupBindings[key];
- }
- // known ref bindings
- if (refBindings) {
- for (const key of refBindings) {
- bindingMetadata[key] = "setup-ref" /* BindingTypes.SETUP_REF */;
- }
- }
- // 8. inject `useCssVars` calls
- if (cssVars.length &&
- // no need to do this when targeting SSR
- !(options.inlineTemplate && ((_a = options.templateOptions) === null || _a === void 0 ? void 0 : _a.ssr))) {
- helperImports.add(CSS_VARS_HELPER);
- helperImports.add('unref');
- s.prependRight(startOffset, `\n${genCssVarsCode(cssVars, bindingMetadata, scopeId, isProd)}\n`);
- }
- // 9. finalize setup() argument signature
- let args = `__props`;
- if (propsTypeDecl) {
- // mark as any and only cast on assignment
- // since the user defined complex types may be incompatible with the
- // inferred type from generated runtime declarations
- args += `: any`;
- }
- // inject user assignment of props
- // we use a default __props so that template expressions referencing props
- // can use it directly
- if (propsIdentifier) {
- s.prependLeft(startOffset, `\nconst ${propsIdentifier} = __props${propsTypeDecl ? ` as ${genSetupPropsType(propsTypeDecl)}` : ``};\n`);
- }
- if (propsDestructureRestId) {
- s.prependLeft(startOffset, `\nconst ${propsDestructureRestId} = ${helper(`createPropsRestProxy`)}(__props, ${JSON.stringify(Object.keys(propsDestructuredBindings))});\n`);
- }
- // inject temp variables for async context preservation
- if (hasAwait) {
- const any = isTS ? `: any` : ``;
- s.prependLeft(startOffset, `\nlet __temp${any}, __restore${any}\n`);
- }
- const destructureElements = hasDefineExposeCall || !options.inlineTemplate ? [`expose`] : [];
- if (emitIdentifier) {
- destructureElements.push(emitIdentifier === `emit` ? `emit` : `emit: ${emitIdentifier}`);
- }
- if (destructureElements.length) {
- args += `, { ${destructureElements.join(', ')} }`;
- if (emitsTypeDecl) {
- args += `: { emit: (${scriptSetup.content.slice(emitsTypeDecl.start, emitsTypeDecl.end)}), expose: any, slots: any, attrs: any }`;
- }
- }
- // 10. generate return statement
- let returned;
- if (!options.inlineTemplate || (!sfc.template && hasDefaultExportRender)) {
- // non-inline mode, or has manual render in normal <script>
- // return bindings from script and script setup
- const allBindings = {
- ...scriptBindings,
- ...setupBindings
- };
- for (const key in userImports) {
- if (!userImports[key].isType && userImports[key].isUsedInTemplate) {
- allBindings[key] = true;
- }
- }
- returned = `{ `;
- for (const key in allBindings) {
- if (allBindings[key] === true &&
- userImports[key].source !== 'vue' &&
- !userImports[key].source.endsWith('.vue')) {
- // generate getter for import bindings
- // skip vue imports since we know they will never change
- returned += `get ${key}() { return ${key} }, `;
- }
- else if (bindingMetadata[key] === "setup-let" /* BindingTypes.SETUP_LET */) {
- // local let binding, also add setter
- const setArg = key === 'v' ? `_v` : `v`;
- returned +=
- `get ${key}() { return ${key} }, ` +
- `set ${key}(${setArg}) { ${key} = ${setArg} }, `;
- }
- else {
- returned += `${key}, `;
- }
- }
- returned = returned.replace(/, $/, '') + ` }`;
- }
- else {
- // inline mode
- if (sfc.template && !sfc.template.src) {
- if (options.templateOptions && options.templateOptions.ssr) {
- hasInlinedSsrRenderFn = true;
- }
- // inline render function mode - we are going to compile the template and
- // inline it right here
- const { code, ast, preamble, tips, errors } = compileTemplate({
- 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: {
- ...(options.templateOptions &&
- options.templateOptions.compilerOptions),
- inline: true,
- isTS,
- bindingMetadata
- }
- });
- if (tips.length) {
- tips.forEach(warnOnce);
- }
- const err = errors[0];
- if (typeof err === 'string') {
- throw new Error(err);
- }
- else if (err) {
- if (err.loc) {
- err.message +=
- `\n\n` +
- sfc.filename +
- '\n' +
- shared.generateCodeFrame(source, err.loc.start.offset, err.loc.end.offset) +
- `\n`;
- }
- throw err;
- }
- if (preamble) {
- s.prepend(preamble);
- }
- // avoid duplicated unref import
- // as this may get injected by the render function preamble OR the
- // css vars codegen
- if (ast && ast.helpers.includes(CompilerDOM.UNREF)) {
- helperImports.delete('unref');
- }
- returned = code;
- }
- else {
- returned = `() => {}`;
- }
- }
- if (!options.inlineTemplate && !false) {
- // in non-inline mode, the `__isScriptSetup: true` flag is used by
- // componentPublicInstance proxy to allow properties that start with $ or _
- s.appendRight(endOffset, `\nconst __returned__ = ${returned}\n` +
- `Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true })\n` +
- `return __returned__` +
- `\n}\n\n`);
- }
- else {
- s.appendRight(endOffset, `\nreturn ${returned}\n}\n\n`);
- }
- // 11. finalize default export
- let runtimeOptions = ``;
- if (!hasDefaultExportName && filename && filename !== DEFAULT_FILENAME) {
- const match = filename.match(/([^/\\]+)\.\w+$/);
- if (match) {
- runtimeOptions += `\n __name: '${match[1]}',`;
- }
- }
- if (hasInlinedSsrRenderFn) {
- runtimeOptions += `\n __ssrInlineRender: true,`;
- }
- if (propsRuntimeDecl) {
- let declCode = scriptSetup.content
- .slice(propsRuntimeDecl.start, propsRuntimeDecl.end)
- .trim();
- if (propsDestructureDecl) {
- const defaults = [];
- for (const key in propsDestructuredBindings) {
- const d = genDestructuredDefaultValue(key);
- if (d)
- defaults.push(`${key}: ${d}`);
- }
- if (defaults.length) {
- declCode = `${helper(`mergeDefaults`)}(${declCode}, {\n ${defaults.join(',\n ')}\n})`;
- }
- }
- runtimeOptions += `\n props: ${declCode},`;
- }
- else if (propsTypeDecl) {
- runtimeOptions += genRuntimeProps(typeDeclaredProps);
- }
- if (emitsRuntimeDecl) {
- runtimeOptions += `\n emits: ${scriptSetup.content
- .slice(emitsRuntimeDecl.start, emitsRuntimeDecl.end)
- .trim()},`;
- }
- else if (emitsTypeDecl) {
- runtimeOptions += genRuntimeEmits(typeDeclaredEmits);
- }
- // <script setup> components are closed by default. If the user did not
- // explicitly call `defineExpose`, call expose() with no args.
- const exposeCall = hasDefineExposeCall || options.inlineTemplate ? `` : ` expose();\n`;
- // wrap setup code with function.
- if (isTS) {
- // for TS, make sure the exported type is still valid type with
- // correct props information
- // we have to use object spread for types to be merged properly
- // user's TS setting should compile it down to proper targets
- // export default defineComponent({ ...__default__, ... })
- const def = defaultExport ? `\n ...${DEFAULT_VAR},` : ``;
- s.prependLeft(startOffset, `\nexport default /*#__PURE__*/${helper(`defineComponent`)}({${def}${runtimeOptions}\n ${hasAwait ? `async ` : ``}setup(${args}) {\n${exposeCall}`);
- s.appendRight(endOffset, `})`);
- }
- else {
- if (defaultExport) {
- // without TS, can't rely on rest spread, so we use Object.assign
- // export default Object.assign(__default__, { ... })
- s.prependLeft(startOffset, `\nexport default /*#__PURE__*/Object.assign(${DEFAULT_VAR}, {${runtimeOptions}\n ` +
- `${hasAwait ? `async ` : ``}setup(${args}) {\n${exposeCall}`);
- s.appendRight(endOffset, `})`);
- }
- else {
- s.prependLeft(startOffset, `\nexport default {${runtimeOptions}\n ` +
- `${hasAwait ? `async ` : ``}setup(${args}) {\n${exposeCall}`);
- s.appendRight(endOffset, `}`);
- }
- }
- // 12. finalize Vue helper imports
- if (helperImports.size > 0) {
- s.prepend(`import { ${[...helperImports]
- .map(h => `${h} as _${h}`)
- .join(', ')} } from 'vue'\n`);
- }
- s.trim();
- return {
- ...scriptSetup,
- bindings: bindingMetadata,
- imports: userImports,
- content: s.toString(),
- map: genSourceMap
- ? s.generateMap({
- source: filename,
- hires: true,
- includeContent: true
- })
- : undefined,
- scriptAst: scriptAst === null || scriptAst === void 0 ? void 0 : scriptAst.body,
- scriptSetupAst: scriptSetupAst === null || scriptSetupAst === void 0 ? void 0 : scriptSetupAst.body
- };
- }
- function registerBinding(bindings, node, type) {
- bindings[node.name] = type;
- }
- function walkDeclaration(node, bindings, userImportAliases) {
- if (node.type === 'VariableDeclaration') {
- const isConst = node.kind === 'const';
- // export const foo = ...
- for (const { id, init } of node.declarations) {
- const isDefineCall = !!(isConst &&
- isCallOf(init, c => c === DEFINE_PROPS || c === DEFINE_EMITS || c === WITH_DEFAULTS));
- if (id.type === 'Identifier') {
- let bindingType;
- const userReactiveBinding = userImportAliases['reactive'];
- if (isCallOf(init, userReactiveBinding)) {
- // treat reactive() calls as let since it's meant to be mutable
- bindingType = isConst
- ? "setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */
- : "setup-let" /* BindingTypes.SETUP_LET */;
- }
- else if (
- // if a declaration is a const literal, we can mark it so that
- // the generated render fn code doesn't need to unref() it
- isDefineCall ||
- (isConst && canNeverBeRef(init, userReactiveBinding))) {
- bindingType = isCallOf(init, DEFINE_PROPS)
- ? "setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */
- : "setup-const" /* BindingTypes.SETUP_CONST */;
- }
- else if (isConst) {
- if (isCallOf(init, userImportAliases['ref'])) {
- bindingType = "setup-ref" /* BindingTypes.SETUP_REF */;
- }
- else {
- bindingType = "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */;
- }
- }
- else {
- bindingType = "setup-let" /* BindingTypes.SETUP_LET */;
- }
- registerBinding(bindings, id, bindingType);
- }
- else {
- if (isCallOf(init, DEFINE_PROPS)) {
- // skip walking props destructure
- return;
- }
- if (id.type === 'ObjectPattern') {
- walkObjectPattern(id, bindings, isConst, isDefineCall);
- }
- else if (id.type === 'ArrayPattern') {
- walkArrayPattern(id, bindings, isConst, isDefineCall);
- }
- }
- }
- }
- else if (node.type === 'TSEnumDeclaration' ||
- node.type === 'FunctionDeclaration' ||
- node.type === 'ClassDeclaration') {
- // export function foo() {} / export class Foo {}
- // export declarations must be named.
- bindings[node.id.name] = "setup-const" /* BindingTypes.SETUP_CONST */;
- }
- }
- function walkObjectPattern(node, bindings, isConst, isDefineCall = false) {
- for (const p of node.properties) {
- if (p.type === 'ObjectProperty') {
- if (p.key.type === 'Identifier' && p.key === p.value) {
- // shorthand: const { x } = ...
- const type = isDefineCall
- ? "setup-const" /* BindingTypes.SETUP_CONST */
- : isConst
- ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
- : "setup-let" /* BindingTypes.SETUP_LET */;
- registerBinding(bindings, p.key, type);
- }
- else {
- walkPattern(p.value, bindings, isConst, isDefineCall);
- }
- }
- else {
- // ...rest
- // argument can only be identifier when destructuring
- const type = isConst ? "setup-const" /* BindingTypes.SETUP_CONST */ : "setup-let" /* BindingTypes.SETUP_LET */;
- registerBinding(bindings, p.argument, type);
- }
- }
- }
- function walkArrayPattern(node, bindings, isConst, isDefineCall = false) {
- for (const e of node.elements) {
- e && walkPattern(e, bindings, isConst, isDefineCall);
- }
- }
- function walkPattern(node, bindings, isConst, isDefineCall = false) {
- if (node.type === 'Identifier') {
- const type = isDefineCall
- ? "setup-const" /* BindingTypes.SETUP_CONST */
- : isConst
- ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
- : "setup-let" /* BindingTypes.SETUP_LET */;
- registerBinding(bindings, node, type);
- }
- else if (node.type === 'RestElement') {
- // argument can only be identifier when destructuring
- const type = isConst ? "setup-const" /* BindingTypes.SETUP_CONST */ : "setup-let" /* BindingTypes.SETUP_LET */;
- registerBinding(bindings, node.argument, type);
- }
- else if (node.type === 'ObjectPattern') {
- walkObjectPattern(node, bindings, isConst);
- }
- else if (node.type === 'ArrayPattern') {
- walkArrayPattern(node, bindings, isConst);
- }
- else if (node.type === 'AssignmentPattern') {
- if (node.left.type === 'Identifier') {
- const type = isDefineCall
- ? "setup-const" /* BindingTypes.SETUP_CONST */
- : isConst
- ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
- : "setup-let" /* BindingTypes.SETUP_LET */;
- registerBinding(bindings, node.left, type);
- }
- else {
- walkPattern(node.left, bindings, isConst);
- }
- }
- }
- function recordType(node, declaredTypes) {
- if (node.type === 'TSInterfaceDeclaration') {
- declaredTypes[node.id.name] = [`Object`];
- }
- else if (node.type === 'TSTypeAliasDeclaration') {
- declaredTypes[node.id.name] = inferRuntimeType(node.typeAnnotation, declaredTypes);
- }
- else if (node.type === 'ExportNamedDeclaration' && node.declaration) {
- recordType(node.declaration, declaredTypes);
- }
- }
- function extractRuntimeProps(node, props, declaredTypes, isProd) {
- const members = node.type === 'TSTypeLiteral' ? node.members : node.body;
- for (const m of members) {
- if ((m.type === 'TSPropertySignature' || m.type === 'TSMethodSignature') &&
- m.key.type === 'Identifier') {
- let type;
- if (m.type === 'TSMethodSignature') {
- type = ['Function'];
- }
- else if (m.typeAnnotation) {
- type = inferRuntimeType(m.typeAnnotation.typeAnnotation, declaredTypes);
- }
- props[m.key.name] = {
- key: m.key.name,
- required: !m.optional,
- type: type || [`null`]
- };
- }
- }
- }
- function inferRuntimeType(node, declaredTypes) {
- switch (node.type) {
- case 'TSStringKeyword':
- return ['String'];
- case 'TSNumberKeyword':
- return ['Number'];
- case 'TSBooleanKeyword':
- return ['Boolean'];
- case 'TSObjectKeyword':
- return ['Object'];
- case 'TSTypeLiteral':
- // TODO (nice to have) generate runtime property validation
- return ['Object'];
- case 'TSFunctionType':
- return ['Function'];
- case 'TSArrayType':
- case 'TSTupleType':
- // TODO (nice to have) generate runtime element type/length checks
- return ['Array'];
- case 'TSLiteralType':
- switch (node.literal.type) {
- case 'StringLiteral':
- return ['String'];
- case 'BooleanLiteral':
- return ['Boolean'];
- case 'NumericLiteral':
- case 'BigIntLiteral':
- return ['Number'];
- default:
- return [`null`];
- }
- case 'TSTypeReference':
- if (node.typeName.type === 'Identifier') {
- if (declaredTypes[node.typeName.name]) {
- return declaredTypes[node.typeName.name];
- }
- switch (node.typeName.name) {
- case 'Array':
- case 'Function':
- case 'Object':
- case 'Set':
- case 'Map':
- case 'WeakSet':
- case 'WeakMap':
- case 'Date':
- case 'Promise':
- return [node.typeName.name];
- case 'Record':
- case 'Partial':
- case 'Readonly':
- case 'Pick':
- case 'Omit':
- case 'Exclude':
- case 'Extract':
- case 'Required':
- case 'InstanceType':
- return ['Object'];
- }
- }
- return [`null`];
- case 'TSParenthesizedType':
- return inferRuntimeType(node.typeAnnotation, declaredTypes);
- case 'TSUnionType':
- return [
- ...new Set([].concat(...node.types.map(t => inferRuntimeType(t, declaredTypes))))
- ];
- case 'TSIntersectionType':
- return ['Object'];
- case 'TSSymbolKeyword':
- return ['Symbol'];
- default:
- return [`null`]; // no runtime check
- }
- }
- function toRuntimeTypeString(types) {
- return types.length > 1 ? `[${types.join(', ')}]` : types[0];
- }
- function extractRuntimeEmits(node, emits) {
- if (node.type === 'TSTypeLiteral' || node.type === 'TSInterfaceBody') {
- const members = node.type === 'TSTypeLiteral' ? node.members : node.body;
- for (let t of members) {
- if (t.type === 'TSCallSignatureDeclaration') {
- extractEventNames(t.parameters[0], emits);
- }
- }
- return;
- }
- else {
- extractEventNames(node.parameters[0], emits);
- }
- }
- function extractEventNames(eventName, emits) {
- if (eventName.type === 'Identifier' &&
- eventName.typeAnnotation &&
- eventName.typeAnnotation.type === 'TSTypeAnnotation') {
- const typeNode = eventName.typeAnnotation.typeAnnotation;
- if (typeNode.type === 'TSLiteralType') {
- if (typeNode.literal.type !== 'UnaryExpression') {
- emits.add(String(typeNode.literal.value));
- }
- }
- else if (typeNode.type === 'TSUnionType') {
- for (const t of typeNode.types) {
- if (t.type === 'TSLiteralType' &&
- t.literal.type !== 'UnaryExpression') {
- emits.add(String(t.literal.value));
- }
- }
- }
- }
- }
- function genRuntimeEmits(emits) {
- return emits.size
- ? `\n emits: [${Array.from(emits)
- .map(p => JSON.stringify(p))
- .join(', ')}],`
- : ``;
- }
- function isCallOf(node, test) {
- return !!(node &&
- test &&
- node.type === 'CallExpression' &&
- node.callee.type === 'Identifier' &&
- (typeof test === 'string'
- ? node.callee.name === test
- : test(node.callee.name)));
- }
- function canNeverBeRef(node, userReactiveImport) {
- if (isCallOf(node, userReactiveImport)) {
- return true;
- }
- switch (node.type) {
- case 'UnaryExpression':
- case 'BinaryExpression':
- case 'ArrayExpression':
- case 'ObjectExpression':
- case 'FunctionExpression':
- case 'ArrowFunctionExpression':
- case 'UpdateExpression':
- case 'ClassExpression':
- case 'TaggedTemplateExpression':
- return true;
- case 'SequenceExpression':
- return canNeverBeRef(node.expressions[node.expressions.length - 1], userReactiveImport);
- default:
- if (node.type.endsWith('Literal')) {
- return true;
- }
- return false;
- }
- }
- /**
- * Analyze bindings in normal `<script>`
- * Note that `compileScriptSetup` already analyzes bindings as part of its
- * compilation process so this should only be used on single `<script>` SFCs.
- */
- function analyzeScriptBindings(ast) {
- for (const node of ast) {
- if (node.type === 'ExportDefaultDeclaration' &&
- node.declaration.type === 'ObjectExpression') {
- return analyzeBindingsFromOptions(node.declaration);
- }
- }
- return {};
- }
- function analyzeBindingsFromOptions(node) {
- const bindings = {};
- // #3270, #3275
- // mark non-script-setup so we don't resolve components/directives from these
- Object.defineProperty(bindings, '__isScriptSetup', {
- enumerable: false,
- value: false
- });
- for (const property of node.properties) {
- if (property.type === 'ObjectProperty' &&
- !property.computed &&
- property.key.type === 'Identifier') {
- // props
- if (property.key.name === 'props') {
- // props: ['foo']
- // props: { foo: ... }
- for (const key of getObjectOrArrayExpressionKeys(property.value)) {
- bindings[key] = "props" /* BindingTypes.PROPS */;
- }
- }
- // inject
- else if (property.key.name === 'inject') {
- // inject: ['foo']
- // inject: { foo: {} }
- for (const key of getObjectOrArrayExpressionKeys(property.value)) {
- bindings[key] = "options" /* BindingTypes.OPTIONS */;
- }
- }
- // computed & methods
- else if (property.value.type === 'ObjectExpression' &&
- (property.key.name === 'computed' || property.key.name === 'methods')) {
- // methods: { foo() {} }
- // computed: { foo() {} }
- for (const key of getObjectExpressionKeys(property.value)) {
- bindings[key] = "options" /* BindingTypes.OPTIONS */;
- }
- }
- }
- // setup & data
- else if (property.type === 'ObjectMethod' &&
- property.key.type === 'Identifier' &&
- (property.key.name === 'setup' || property.key.name === 'data')) {
- for (const bodyItem of property.body.body) {
- // setup() {
- // return {
- // foo: null
- // }
- // }
- if (bodyItem.type === 'ReturnStatement' &&
- bodyItem.argument &&
- bodyItem.argument.type === 'ObjectExpression') {
- for (const key of getObjectExpressionKeys(bodyItem.argument)) {
- bindings[key] =
- property.key.name === 'setup'
- ? "setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */
- : "data" /* BindingTypes.DATA */;
- }
- }
- }
- }
- }
- return bindings;
- }
- function getObjectExpressionKeys(node) {
- const keys = [];
- for (const prop of node.properties) {
- if (prop.type === 'SpreadElement')
- continue;
- const key = resolveObjectKey(prop.key, prop.computed);
- if (key)
- keys.push(String(key));
- }
- return keys;
- }
- function getArrayExpressionKeys(node) {
- const keys = [];
- for (const element of node.elements) {
- if (element && element.type === 'StringLiteral') {
- keys.push(element.value);
- }
- }
- return keys;
- }
- function getObjectOrArrayExpressionKeys(value) {
- if (value.type === 'ArrayExpression') {
- return getArrayExpressionKeys(value);
- }
- if (value.type === 'ObjectExpression') {
- return getObjectExpressionKeys(value);
- }
- return [];
- }
- const templateUsageCheckCache = createCache();
- function resolveTemplateUsageCheckString(sfc) {
- const { content, ast } = sfc.template;
- const cached = templateUsageCheckCache.get(content);
- if (cached) {
- return cached;
- }
- let code = '';
- CompilerDOM.transform(CompilerDOM.createRoot([ast]), {
- nodeTransforms: [
- node => {
- if (node.type === 1 /* NodeTypes.ELEMENT */) {
- if (!CompilerDOM.parserOptions.isNativeTag(node.tag) &&
- !CompilerDOM.parserOptions.isBuiltInComponent(node.tag)) {
- code += `,${shared.camelize(node.tag)},${shared.capitalize(shared.camelize(node.tag))}`;
- }
- for (let i = 0; i < node.props.length; i++) {
- const prop = node.props[i];
- if (prop.type === 7 /* NodeTypes.DIRECTIVE */) {
- if (!isBuiltInDir(prop.name)) {
- code += `,v${shared.capitalize(shared.camelize(prop.name))}`;
- }
- if (prop.exp) {
- code += `,${processExp(prop.exp.content, prop.name)}`;
- }
- }
- }
- }
- else if (node.type === 5 /* NodeTypes.INTERPOLATION */) {
- code += `,${processExp(node.content.content)}`;
- }
- }
- ]
- });
- code += ';';
- templateUsageCheckCache.set(content, code);
- return code;
- }
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
- function processExp(exp, dir) {
- if (/ as\s+\w|<.*>|:/.test(exp)) {
- if (dir === 'slot') {
- exp = `(${exp})=>{}`;
- }
- else if (dir === 'on') {
- exp = `()=>{return ${exp}}`;
- }
- else if (dir === 'for') {
- const inMatch = exp.match(forAliasRE);
- if (inMatch) {
- const [, LHS, RHS] = inMatch;
- return processExp(`(${LHS})=>{}`) + processExp(RHS);
- }
- }
- let ret = '';
- // has potential type cast or generic arguments that uses types
- const ast = parser$2.parseExpression(exp, { plugins: ['typescript'] });
- CompilerDOM.walkIdentifiers(ast, node => {
- ret += `,` + node.name;
- });
- return ret;
- }
- return stripStrings(exp);
- }
- function stripStrings(exp) {
- return exp
- .replace(/'[^']*'|"[^"]*"/g, '')
- .replace(/`[^`]+`/g, stripTemplateString);
- }
- function stripTemplateString(str) {
- const interpMatch = str.match(/\${[^}]+}/g);
- if (interpMatch) {
- return interpMatch.map(m => m.slice(2, -1)).join(',');
- }
- return '';
- }
- function isImportUsed(local, sfc) {
- return new RegExp(
- // #4274 escape $ since it's a special char in regex
- // (and is the only regex special char that is valid in identifiers)
- `[^\\w$_]${local.replace(/\$/g, '\\$')}[^\\w$_]`).test(resolveTemplateUsageCheckString(sfc));
- }
- /**
- * Note: this comparison assumes the prev/next script are already identical,
- * and only checks the special case where <script setup lang="ts"> unused import
- * pruning result changes due to template changes.
- */
- function hmrShouldReload(prevImports, next) {
- if (!next.scriptSetup ||
- (next.scriptSetup.lang !== 'ts' && next.scriptSetup.lang !== 'tsx')) {
- return false;
- }
- // for each previous import, check if its used status remain the same based on
- // the next descriptor's template
- for (const key in prevImports) {
- // if an import was previous unused, but now is used, we need to force
- // reload so that the script now includes that import.
- if (!prevImports[key].isUsedInTemplate && isImportUsed(key, next)) {
- return true;
- }
- }
- return false;
- }
- function resolveObjectKey(node, computed) {
- switch (node.type) {
- case 'StringLiteral':
- case 'NumericLiteral':
- return node.value;
- case 'Identifier':
- if (!computed)
- return node.name;
- }
- return undefined;
- }
- const DEFAULT_FILENAME = 'anonymous.vue';
- const sourceToSFC = createCache();
- function parse(source, { sourceMap = true, filename = DEFAULT_FILENAME, sourceRoot = '', pad = false, ignoreEmpty = true, compiler = CompilerDOM__namespace } = {}) {
- const sourceKey = source + sourceMap + filename + sourceRoot + pad + compiler.parse;
- const cache = sourceToSFC.get(sourceKey);
- if (cache) {
- return cache;
- }
- const descriptor = {
- filename,
- source,
- template: null,
- script: null,
- scriptSetup: null,
- styles: [],
- customBlocks: [],
- cssVars: [],
- slotted: false,
- shouldForceReload: prevImports => hmrShouldReload(prevImports, descriptor)
- };
- const errors = [];
- const ast = compiler.parse(source, {
- // there are no components at SFC parsing level
- isNativeTag: () => true,
- // preserve all whitespaces
- isPreTag: () => true,
- getTextMode: ({ tag, props }, parent) => {
- // all top level elements except <template> are parsed as raw text
- // containers
- if ((!parent && tag !== 'template') ||
- // <template lang="xxx"> should also be treated as raw text
- (tag === 'template' &&
- props.some(p => p.type === 6 /* NodeTypes.ATTRIBUTE */ &&
- p.name === 'lang' &&
- p.value &&
- p.value.content &&
- p.value.content !== 'html'))) {
- return 2 /* TextModes.RAWTEXT */;
- }
- else {
- return 0 /* TextModes.DATA */;
- }
- },
- onError: e => {
- errors.push(e);
- }
- });
- ast.children.forEach(node => {
- if (node.type !== 1 /* NodeTypes.ELEMENT */) {
- return;
- }
- // we only want to keep the nodes that are not empty (when the tag is not a template)
- if (ignoreEmpty &&
- node.tag !== 'template' &&
- isEmpty(node) &&
- !hasSrc(node)) {
- return;
- }
- switch (node.tag) {
- case 'template':
- if (!descriptor.template) {
- const templateBlock = (descriptor.template = createBlock(node, source, false));
- templateBlock.ast = node;
- // warn against 2.x <template functional>
- if (templateBlock.attrs.functional) {
- const err = new SyntaxError(`<template functional> is no longer supported in Vue 3, since ` +
- `functional components no longer have significant performance ` +
- `difference from stateful ones. Just use a normal <template> ` +
- `instead.`);
- err.loc = node.props.find(p => p.name === 'functional').loc;
- errors.push(err);
- }
- }
- else {
- errors.push(createDuplicateBlockError(node));
- }
- break;
- case 'script':
- const scriptBlock = createBlock(node, source, pad);
- const isSetup = !!scriptBlock.attrs.setup;
- if (isSetup && !descriptor.scriptSetup) {
- descriptor.scriptSetup = scriptBlock;
- break;
- }
- if (!isSetup && !descriptor.script) {
- descriptor.script = scriptBlock;
- break;
- }
- errors.push(createDuplicateBlockError(node, isSetup));
- break;
- case 'style':
- const styleBlock = createBlock(node, source, pad);
- if (styleBlock.attrs.vars) {
- errors.push(new SyntaxError(`<style vars> has been replaced by a new proposal: ` +
- `https://github.com/vuejs/rfcs/pull/231`));
- }
- descriptor.styles.push(styleBlock);
- break;
- default:
- descriptor.customBlocks.push(createBlock(node, source, pad));
- break;
- }
- });
- if (!descriptor.template && !descriptor.script && !descriptor.scriptSetup) {
- errors.push(new SyntaxError(`At least one <template> or <script> is required in a single file component.`));
- }
- if (descriptor.scriptSetup) {
- if (descriptor.scriptSetup.src) {
- errors.push(new SyntaxError(`<script setup> cannot use the "src" attribute because ` +
- `its syntax will be ambiguous outside of the component.`));
- descriptor.scriptSetup = null;
- }
- if (descriptor.script && descriptor.script.src) {
- errors.push(new SyntaxError(`<script> cannot use the "src" attribute when <script setup> is ` +
- `also present because they must be processed together.`));
- descriptor.script = null;
- }
- }
- if (sourceMap) {
- const genMap = (block) => {
- if (block && !block.src) {
- block.map = generateSourceMap(filename, source, block.content, sourceRoot, !pad || block.type === 'template' ? block.loc.start.line - 1 : 0);
- }
- };
- genMap(descriptor.template);
- genMap(descriptor.script);
- descriptor.styles.forEach(genMap);
- descriptor.customBlocks.forEach(genMap);
- }
- // parse CSS vars
- descriptor.cssVars = parseCssVars(descriptor);
- // check if the SFC uses :slotted
- const slottedRE = /(?:::v-|:)slotted\(/;
- descriptor.slotted = descriptor.styles.some(s => s.scoped && slottedRE.test(s.content));
- const result = {
- descriptor,
- errors
- };
- sourceToSFC.set(sourceKey, result);
- return result;
- }
- function createDuplicateBlockError(node, isScriptSetup = false) {
- const err = new SyntaxError(`Single file component can contain only one <${node.tag}${isScriptSetup ? ` setup` : ``}> element`);
- err.loc = node.loc;
- return err;
- }
- function createBlock(node, source, pad) {
- const type = node.tag;
- let { start, end } = node.loc;
- let content = '';
- if (node.children.length) {
- start = node.children[0].loc.start;
- end = node.children[node.children.length - 1].loc.end;
- content = source.slice(start.offset, end.offset);
- }
- else {
- const offset = node.loc.source.indexOf(`</`);
- if (offset > -1) {
- start = {
- line: start.line,
- column: start.column + offset,
- offset: start.offset + offset
- };
- }
- end = { ...start };
- }
- const loc = {
- source: content,
- start,
- end
- };
- const attrs = {};
- const block = {
- type,
- content,
- loc,
- attrs
- };
- if (pad) {
- block.content = padContent(source, block, pad) + block.content;
- }
- node.props.forEach(p => {
- if (p.type === 6 /* NodeTypes.ATTRIBUTE */) {
- attrs[p.name] = p.value ? p.value.content || true : true;
- if (p.name === 'lang') {
- block.lang = p.value && p.value.content;
- }
- else if (p.name === 'src') {
- block.src = p.value && p.value.content;
- }
- else if (type === 'style') {
- if (p.name === 'scoped') {
- block.scoped = true;
- }
- else if (p.name === 'module') {
- block.module = attrs[p.name];
- }
- }
- else if (type === 'script' && p.name === 'setup') {
- block.setup = attrs.setup;
- }
- }
- });
- return block;
- }
- const splitRE = /\r?\n/g;
- const emptyRE = /^(?:\/\/)?\s*$/;
- const replaceRE = /./g;
- function generateSourceMap(filename, source, generated, sourceRoot, lineOffset) {
- const map = new sourceMap.SourceMapGenerator({
- file: filename.replace(/\\/g, '/'),
- sourceRoot: sourceRoot.replace(/\\/g, '/')
- });
- map.setSourceContent(filename, source);
- generated.split(splitRE).forEach((line, index) => {
- if (!emptyRE.test(line)) {
- const originalLine = index + 1 + lineOffset;
- const generatedLine = index + 1;
- for (let i = 0; i < line.length; i++) {
- if (!/\s/.test(line[i])) {
- map.addMapping({
- source: filename,
- original: {
- line: originalLine,
- column: i
- },
- generated: {
- line: generatedLine,
- column: i
- }
- });
- }
- }
- }
- });
- return JSON.parse(map.toString());
- }
- function padContent(content, block, pad) {
- content = content.slice(0, block.loc.start.offset);
- if (pad === 'space') {
- return content.replace(replaceRE, ' ');
- }
- else {
- const offset = content.split(splitRE).length;
- const padChar = block.type === 'script' && !block.lang ? '//\n' : '\n';
- return Array(offset).join(padChar);
- }
- }
- function hasSrc(node) {
- return node.props.some(p => {
- if (p.type !== 6 /* NodeTypes.ATTRIBUTE */) {
- return false;
- }
- return p.name === 'src';
- });
- }
- /**
- * Returns true if the node has no children
- * once the empty text nodes (trimmed content) have been filtered out.
- */
- function isEmpty(node) {
- for (let i = 0; i < node.children.length; i++) {
- const child = node.children[i];
- if (child.type !== 2 /* NodeTypes.TEXT */ || child.content.trim() !== '') {
- return false;
- }
- }
- return true;
- }
- const trimPlugin = () => {
- return {
- postcssPlugin: 'vue-sfc-trim',
- Once(root) {
- root.walk(({ type, raws }) => {
- if (type === 'rule' || type === 'atrule') {
- if (raws.before)
- raws.before = '\n';
- if ('after' in raws && raws.after)
- raws.after = '\n';
- }
- });
- }
- };
- };
- trimPlugin.postcss = true;
- var unesc_1 = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = unesc;
- // Many thanks for this post which made this migration much easier.
- // https://mathiasbynens.be/notes/css-escapes
- /**
- *
- * @param {string} str
- * @returns {[string, number]|undefined}
- */
- function gobbleHex(str) {
- var lower = str.toLowerCase();
- var hex = '';
- var spaceTerminated = false;
- for (var i = 0; i < 6 && lower[i] !== undefined; i++) {
- var code = lower.charCodeAt(i); // check to see if we are dealing with a valid hex char [a-f|0-9]
- var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57; // https://drafts.csswg.org/css-syntax/#consume-escaped-code-point
- spaceTerminated = code === 32;
- if (!valid) {
- break;
- }
- hex += lower[i];
- }
- if (hex.length === 0) {
- return undefined;
- }
- var codePoint = parseInt(hex, 16);
- var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF; // Add special case for
- // "If this number is zero, or is for a surrogate, or is greater than the maximum allowed code point"
- // https://drafts.csswg.org/css-syntax/#maximum-allowed-code-point
- if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10FFFF) {
- return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)];
- }
- return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)];
- }
- var CONTAINS_ESCAPE = /\\/;
- function unesc(str) {
- var needToProcess = CONTAINS_ESCAPE.test(str);
- if (!needToProcess) {
- return str;
- }
- var ret = "";
- for (var i = 0; i < str.length; i++) {
- if (str[i] === "\\") {
- var gobbled = gobbleHex(str.slice(i + 1, i + 7));
- if (gobbled !== undefined) {
- ret += gobbled[0];
- i += gobbled[1];
- continue;
- } // Retain a pair of \\ if double escaped `\\\\`
- // https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e
- if (str[i + 1] === "\\") {
- ret += "\\";
- i++;
- continue;
- } // if \\ is at the end of the string retain it
- // https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb
- if (str.length === i + 1) {
- ret += str[i];
- }
- continue;
- }
- ret += str[i];
- }
- return ret;
- }
- module.exports = exports.default;
- });
- var getProp_1 = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = getProp;
- function getProp(obj) {
- for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- props[_key - 1] = arguments[_key];
- }
- while (props.length > 0) {
- var prop = props.shift();
- if (!obj[prop]) {
- return undefined;
- }
- obj = obj[prop];
- }
- return obj;
- }
- module.exports = exports.default;
- });
- var ensureObject_1 = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = ensureObject;
- function ensureObject(obj) {
- for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- props[_key - 1] = arguments[_key];
- }
- while (props.length > 0) {
- var prop = props.shift();
- if (!obj[prop]) {
- obj[prop] = {};
- }
- obj = obj[prop];
- }
- }
- module.exports = exports.default;
- });
- var stripComments_1 = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = stripComments;
- function stripComments(str) {
- var s = "";
- var commentStart = str.indexOf("/*");
- var lastEnd = 0;
- while (commentStart >= 0) {
- s = s + str.slice(lastEnd, commentStart);
- var commentEnd = str.indexOf("*/", commentStart + 2);
- if (commentEnd < 0) {
- return s;
- }
- lastEnd = commentEnd + 2;
- commentStart = str.indexOf("/*", lastEnd);
- }
- s = s + str.slice(lastEnd);
- return s;
- }
- module.exports = exports.default;
- });
- var util = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.stripComments = exports.ensureObject = exports.getProp = exports.unesc = void 0;
- var _unesc = _interopRequireDefault(unesc_1);
- exports.unesc = _unesc["default"];
- var _getProp = _interopRequireDefault(getProp_1);
- exports.getProp = _getProp["default"];
- var _ensureObject = _interopRequireDefault(ensureObject_1);
- exports.ensureObject = _ensureObject["default"];
- var _stripComments = _interopRequireDefault(stripComments_1);
- exports.stripComments = _stripComments["default"];
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- });
- var node = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = void 0;
- 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); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
- var cloneNode = function cloneNode(obj, parent) {
- if (typeof obj !== 'object' || obj === null) {
- return obj;
- }
- var cloned = new obj.constructor();
- for (var i in obj) {
- if (!obj.hasOwnProperty(i)) {
- continue;
- }
- var value = obj[i];
- var type = typeof value;
- if (i === 'parent' && type === 'object') {
- if (parent) {
- cloned[i] = parent;
- }
- } else if (value instanceof Array) {
- cloned[i] = value.map(function (j) {
- return cloneNode(j, cloned);
- });
- } else {
- cloned[i] = cloneNode(value, cloned);
- }
- }
- return cloned;
- };
- var Node = /*#__PURE__*/function () {
- function Node(opts) {
- if (opts === void 0) {
- opts = {};
- }
- Object.assign(this, opts);
- this.spaces = this.spaces || {};
- this.spaces.before = this.spaces.before || '';
- this.spaces.after = this.spaces.after || '';
- }
- var _proto = Node.prototype;
- _proto.remove = function remove() {
- if (this.parent) {
- this.parent.removeChild(this);
- }
- this.parent = undefined;
- return this;
- };
- _proto.replaceWith = function replaceWith() {
- if (this.parent) {
- for (var index in arguments) {
- this.parent.insertBefore(this, arguments[index]);
- }
- this.remove();
- }
- return this;
- };
- _proto.next = function next() {
- return this.parent.at(this.parent.index(this) + 1);
- };
- _proto.prev = function prev() {
- return this.parent.at(this.parent.index(this) - 1);
- };
- _proto.clone = function clone(overrides) {
- if (overrides === void 0) {
- overrides = {};
- }
- var cloned = cloneNode(this);
- for (var name in overrides) {
- cloned[name] = overrides[name];
- }
- return cloned;
- }
- /**
- * Some non-standard syntax doesn't follow normal escaping rules for css.
- * This allows non standard syntax to be appended to an existing property
- * by specifying the escaped value. By specifying the escaped value,
- * illegal characters are allowed to be directly inserted into css output.
- * @param {string} name the property to set
- * @param {any} value the unescaped value of the property
- * @param {string} valueEscaped optional. the escaped value of the property.
- */
- ;
- _proto.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) {
- if (!this.raws) {
- this.raws = {};
- }
- var originalValue = this[name];
- var originalEscaped = this.raws[name];
- this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first.
- if (originalEscaped || valueEscaped !== value) {
- this.raws[name] = (originalEscaped || originalValue) + valueEscaped;
- } else {
- delete this.raws[name]; // delete any escaped value that was created by the setter.
- }
- }
- /**
- * Some non-standard syntax doesn't follow normal escaping rules for css.
- * This allows the escaped value to be specified directly, allowing illegal
- * characters to be directly inserted into css output.
- * @param {string} name the property to set
- * @param {any} value the unescaped value of the property
- * @param {string} valueEscaped the escaped value of the property.
- */
- ;
- _proto.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) {
- if (!this.raws) {
- this.raws = {};
- }
- this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
- this.raws[name] = valueEscaped;
- }
- /**
- * When you want a value to passed through to CSS directly. This method
- * deletes the corresponding raw value causing the stringifier to fallback
- * to the unescaped value.
- * @param {string} name the property to set.
- * @param {any} value The value that is both escaped and unescaped.
- */
- ;
- _proto.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) {
- this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
- if (this.raws) {
- delete this.raws[name];
- }
- }
- /**
- *
- * @param {number} line The number (starting with 1)
- * @param {number} column The column number (starting with 1)
- */
- ;
- _proto.isAtPosition = function isAtPosition(line, column) {
- if (this.source && this.source.start && this.source.end) {
- if (this.source.start.line > line) {
- return false;
- }
- if (this.source.end.line < line) {
- return false;
- }
- if (this.source.start.line === line && this.source.start.column > column) {
- return false;
- }
- if (this.source.end.line === line && this.source.end.column < column) {
- return false;
- }
- return true;
- }
- return undefined;
- };
- _proto.stringifyProperty = function stringifyProperty(name) {
- return this.raws && this.raws[name] || this[name];
- };
- _proto.valueToString = function valueToString() {
- return String(this.stringifyProperty("value"));
- };
- _proto.toString = function toString() {
- return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join('');
- };
- _createClass(Node, [{
- key: "rawSpaceBefore",
- get: function get() {
- var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before;
- if (rawSpace === undefined) {
- rawSpace = this.spaces && this.spaces.before;
- }
- return rawSpace || "";
- },
- set: function set(raw) {
- (0, util.ensureObject)(this, "raws", "spaces");
- this.raws.spaces.before = raw;
- }
- }, {
- key: "rawSpaceAfter",
- get: function get() {
- var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after;
- if (rawSpace === undefined) {
- rawSpace = this.spaces.after;
- }
- return rawSpace || "";
- },
- set: function set(raw) {
- (0, util.ensureObject)(this, "raws", "spaces");
- this.raws.spaces.after = raw;
- }
- }]);
- return Node;
- }();
- exports["default"] = Node;
- module.exports = exports.default;
- });
- var types = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- 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;
- var TAG = 'tag';
- exports.TAG = TAG;
- var STRING = 'string';
- exports.STRING = STRING;
- var SELECTOR = 'selector';
- exports.SELECTOR = SELECTOR;
- var ROOT = 'root';
- exports.ROOT = ROOT;
- var PSEUDO = 'pseudo';
- exports.PSEUDO = PSEUDO;
- var NESTING = 'nesting';
- exports.NESTING = NESTING;
- var ID = 'id';
- exports.ID = ID;
- var COMMENT = 'comment';
- exports.COMMENT = COMMENT;
- var COMBINATOR = 'combinator';
- exports.COMBINATOR = COMBINATOR;
- var CLASS = 'class';
- exports.CLASS = CLASS;
- var ATTRIBUTE = 'attribute';
- exports.ATTRIBUTE = ATTRIBUTE;
- var UNIVERSAL = 'universal';
- exports.UNIVERSAL = UNIVERSAL;
- });
- var container = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = void 0;
- var _node = _interopRequireDefault(node);
- var types$1 = _interopRequireWildcard(types);
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
- 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; }
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- 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); }
- 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); }
- 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; }
- 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); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- var Container = /*#__PURE__*/function (_Node) {
- _inheritsLoose(Container, _Node);
- function Container(opts) {
- var _this;
- _this = _Node.call(this, opts) || this;
- if (!_this.nodes) {
- _this.nodes = [];
- }
- return _this;
- }
- var _proto = Container.prototype;
- _proto.append = function append(selector) {
- selector.parent = this;
- this.nodes.push(selector);
- return this;
- };
- _proto.prepend = function prepend(selector) {
- selector.parent = this;
- this.nodes.unshift(selector);
- return this;
- };
- _proto.at = function at(index) {
- return this.nodes[index];
- };
- _proto.index = function index(child) {
- if (typeof child === 'number') {
- return child;
- }
- return this.nodes.indexOf(child);
- };
- _proto.removeChild = function removeChild(child) {
- child = this.index(child);
- this.at(child).parent = undefined;
- this.nodes.splice(child, 1);
- var index;
- for (var id in this.indexes) {
- index = this.indexes[id];
- if (index >= child) {
- this.indexes[id] = index - 1;
- }
- }
- return this;
- };
- _proto.removeAll = function removeAll() {
- for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done;) {
- var node = _step.value;
- node.parent = undefined;
- }
- this.nodes = [];
- return this;
- };
- _proto.empty = function empty() {
- return this.removeAll();
- };
- _proto.insertAfter = function insertAfter(oldNode, newNode) {
- newNode.parent = this;
- var oldIndex = this.index(oldNode);
- this.nodes.splice(oldIndex + 1, 0, newNode);
- newNode.parent = this;
- var index;
- for (var id in this.indexes) {
- index = this.indexes[id];
- if (oldIndex <= index) {
- this.indexes[id] = index + 1;
- }
- }
- return this;
- };
- _proto.insertBefore = function insertBefore(oldNode, newNode) {
- newNode.parent = this;
- var oldIndex = this.index(oldNode);
- this.nodes.splice(oldIndex, 0, newNode);
- newNode.parent = this;
- var index;
- for (var id in this.indexes) {
- index = this.indexes[id];
- if (index <= oldIndex) {
- this.indexes[id] = index + 1;
- }
- }
- return this;
- };
- _proto._findChildAtPosition = function _findChildAtPosition(line, col) {
- var found = undefined;
- this.each(function (node) {
- if (node.atPosition) {
- var foundChild = node.atPosition(line, col);
- if (foundChild) {
- found = foundChild;
- return false;
- }
- } else if (node.isAtPosition(line, col)) {
- found = node;
- return false;
- }
- });
- return found;
- }
- /**
- * Return the most specific node at the line and column number given.
- * The source location is based on the original parsed location, locations aren't
- * updated as selector nodes are mutated.
- *
- * Note that this location is relative to the location of the first character
- * of the selector, and not the location of the selector in the overall document
- * when used in conjunction with postcss.
- *
- * If not found, returns undefined.
- * @param {number} line The line number of the node to find. (1-based index)
- * @param {number} col The column number of the node to find. (1-based index)
- */
- ;
- _proto.atPosition = function atPosition(line, col) {
- if (this.isAtPosition(line, col)) {
- return this._findChildAtPosition(line, col) || this;
- } else {
- return undefined;
- }
- };
- _proto._inferEndPosition = function _inferEndPosition() {
- if (this.last && this.last.source && this.last.source.end) {
- this.source = this.source || {};
- this.source.end = this.source.end || {};
- Object.assign(this.source.end, this.last.source.end);
- }
- };
- _proto.each = function each(callback) {
- if (!this.lastEach) {
- this.lastEach = 0;
- }
- if (!this.indexes) {
- this.indexes = {};
- }
- this.lastEach++;
- var id = this.lastEach;
- this.indexes[id] = 0;
- if (!this.length) {
- return undefined;
- }
- var index, result;
- while (this.indexes[id] < this.length) {
- index = this.indexes[id];
- result = callback(this.at(index), index);
- if (result === false) {
- break;
- }
- this.indexes[id] += 1;
- }
- delete this.indexes[id];
- if (result === false) {
- return false;
- }
- };
- _proto.walk = function walk(callback) {
- return this.each(function (node, i) {
- var result = callback(node, i);
- if (result !== false && node.length) {
- result = node.walk(callback);
- }
- if (result === false) {
- return false;
- }
- });
- };
- _proto.walkAttributes = function walkAttributes(callback) {
- var _this2 = this;
- return this.walk(function (selector) {
- if (selector.type === types$1.ATTRIBUTE) {
- return callback.call(_this2, selector);
- }
- });
- };
- _proto.walkClasses = function walkClasses(callback) {
- var _this3 = this;
- return this.walk(function (selector) {
- if (selector.type === types$1.CLASS) {
- return callback.call(_this3, selector);
- }
- });
- };
- _proto.walkCombinators = function walkCombinators(callback) {
- var _this4 = this;
- return this.walk(function (selector) {
- if (selector.type === types$1.COMBINATOR) {
- return callback.call(_this4, selector);
- }
- });
- };
- _proto.walkComments = function walkComments(callback) {
- var _this5 = this;
- return this.walk(function (selector) {
- if (selector.type === types$1.COMMENT) {
- return callback.call(_this5, selector);
- }
- });
- };
- _proto.walkIds = function walkIds(callback) {
- var _this6 = this;
- return this.walk(function (selector) {
- if (selector.type === types$1.ID) {
- return callback.call(_this6, selector);
- }
- });
- };
- _proto.walkNesting = function walkNesting(callback) {
- var _this7 = this;
- return this.walk(function (selector) {
- if (selector.type === types$1.NESTING) {
- return callback.call(_this7, selector);
- }
- });
- };
- _proto.walkPseudos = function walkPseudos(callback) {
- var _this8 = this;
- return this.walk(function (selector) {
- if (selector.type === types$1.PSEUDO) {
- return callback.call(_this8, selector);
- }
- });
- };
- _proto.walkTags = function walkTags(callback) {
- var _this9 = this;
- return this.walk(function (selector) {
- if (selector.type === types$1.TAG) {
- return callback.call(_this9, selector);
- }
- });
- };
- _proto.walkUniversals = function walkUniversals(callback) {
- var _this10 = this;
- return this.walk(function (selector) {
- if (selector.type === types$1.UNIVERSAL) {
- return callback.call(_this10, selector);
- }
- });
- };
- _proto.split = function split(callback) {
- var _this11 = this;
- var current = [];
- return this.reduce(function (memo, node, index) {
- var split = callback.call(_this11, node);
- current.push(node);
- if (split) {
- memo.push(current);
- current = [];
- } else if (index === _this11.length - 1) {
- memo.push(current);
- }
- return memo;
- }, []);
- };
- _proto.map = function map(callback) {
- return this.nodes.map(callback);
- };
- _proto.reduce = function reduce(callback, memo) {
- return this.nodes.reduce(callback, memo);
- };
- _proto.every = function every(callback) {
- return this.nodes.every(callback);
- };
- _proto.some = function some(callback) {
- return this.nodes.some(callback);
- };
- _proto.filter = function filter(callback) {
- return this.nodes.filter(callback);
- };
- _proto.sort = function sort(callback) {
- return this.nodes.sort(callback);
- };
- _proto.toString = function toString() {
- return this.map(String).join('');
- };
- _createClass(Container, [{
- key: "first",
- get: function get() {
- return this.at(0);
- }
- }, {
- key: "last",
- get: function get() {
- return this.at(this.length - 1);
- }
- }, {
- key: "length",
- get: function get() {
- return this.nodes.length;
- }
- }]);
- return Container;
- }(_node["default"]);
- exports["default"] = Container;
- module.exports = exports.default;
- });
- var root = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = void 0;
- var _container = _interopRequireDefault(container);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- 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); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- var Root = /*#__PURE__*/function (_Container) {
- _inheritsLoose(Root, _Container);
- function Root(opts) {
- var _this;
- _this = _Container.call(this, opts) || this;
- _this.type = types.ROOT;
- return _this;
- }
- var _proto = Root.prototype;
- _proto.toString = function toString() {
- var str = this.reduce(function (memo, selector) {
- memo.push(String(selector));
- return memo;
- }, []).join(',');
- return this.trailingComma ? str + ',' : str;
- };
- _proto.error = function error(message, options) {
- if (this._error) {
- return this._error(message, options);
- } else {
- return new Error(message);
- }
- };
- _createClass(Root, [{
- key: "errorGenerator",
- set: function set(handler) {
- this._error = handler;
- }
- }]);
- return Root;
- }(_container["default"]);
- exports["default"] = Root;
- module.exports = exports.default;
- });
- var selector = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = void 0;
- var _container = _interopRequireDefault(container);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- var Selector = /*#__PURE__*/function (_Container) {
- _inheritsLoose(Selector, _Container);
- function Selector(opts) {
- var _this;
- _this = _Container.call(this, opts) || this;
- _this.type = types.SELECTOR;
- return _this;
- }
- return Selector;
- }(_container["default"]);
- exports["default"] = Selector;
- module.exports = exports.default;
- });
- /*! https://mths.be/cssesc v3.0.0 by @mathias */
- var object = {};
- var hasOwnProperty = object.hasOwnProperty;
- var merge = function merge(options, defaults) {
- if (!options) {
- return defaults;
- }
- var result = {};
- for (var key in defaults) {
- // `if (defaults.hasOwnProperty(key) { … }` is not needed here, since
- // only recognized option names are used.
- result[key] = hasOwnProperty.call(options, key) ? options[key] : defaults[key];
- }
- return result;
- };
- var regexAnySingleEscape = /[ -,\.\/:-@\[-\^`\{-~]/;
- var regexSingleEscape = /[ -,\.\/:-@\[\]\^`\{-~]/;
- var regexExcessiveSpaces = /(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g;
- // https://mathiasbynens.be/notes/css-escapes#css
- var cssesc = function cssesc(string, options) {
- options = merge(options, cssesc.options);
- if (options.quotes != 'single' && options.quotes != 'double') {
- options.quotes = 'single';
- }
- var quote = options.quotes == 'double' ? '"' : '\'';
- var isIdentifier = options.isIdentifier;
- var firstChar = string.charAt(0);
- var output = '';
- var counter = 0;
- var length = string.length;
- while (counter < length) {
- var character = string.charAt(counter++);
- var codePoint = character.charCodeAt();
- var value = void 0;
- // If it’s not a printable ASCII character…
- if (codePoint < 0x20 || codePoint > 0x7E) {
- if (codePoint >= 0xD800 && codePoint <= 0xDBFF && counter < length) {
- // It’s a high surrogate, and there is a next character.
- var extra = string.charCodeAt(counter++);
- if ((extra & 0xFC00) == 0xDC00) {
- // next character is low surrogate
- codePoint = ((codePoint & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000;
- } else {
- // It’s an unmatched surrogate; only append this code unit, in case
- // the next code unit is the high surrogate of a surrogate pair.
- counter--;
- }
- }
- value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
- } else {
- if (options.escapeEverything) {
- if (regexAnySingleEscape.test(character)) {
- value = '\\' + character;
- } else {
- value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
- }
- } else if (/[\t\n\f\r\x0B]/.test(character)) {
- value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
- } else if (character == '\\' || !isIdentifier && (character == '"' && quote == character || character == '\'' && quote == character) || isIdentifier && regexSingleEscape.test(character)) {
- value = '\\' + character;
- } else {
- value = character;
- }
- }
- output += value;
- }
- if (isIdentifier) {
- if (/^-[-\d]/.test(output)) {
- output = '\\-' + output.slice(1);
- } else if (/\d/.test(firstChar)) {
- output = '\\3' + firstChar + ' ' + output.slice(1);
- }
- }
- // Remove spaces after `\HEX` escapes that are not followed by a hex digit,
- // since they’re redundant. Note that this is only possible if the escape
- // sequence isn’t preceded by an odd number of backslashes.
- output = output.replace(regexExcessiveSpaces, function ($0, $1, $2) {
- if ($1 && $1.length % 2) {
- // It’s not safe to remove the space, so don’t.
- return $0;
- }
- // Strip the space.
- return ($1 || '') + $2;
- });
- if (!isIdentifier && options.wrap) {
- return quote + output + quote;
- }
- return output;
- };
- // Expose default options (so they can be overridden globally).
- cssesc.options = {
- 'escapeEverything': false,
- 'isIdentifier': false,
- 'quotes': 'single',
- 'wrap': false
- };
- cssesc.version = '3.0.0';
- var cssesc_1 = cssesc;
- var className = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = void 0;
- var _cssesc = _interopRequireDefault(cssesc_1);
- var _node = _interopRequireDefault(node);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- 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); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- var ClassName = /*#__PURE__*/function (_Node) {
- _inheritsLoose(ClassName, _Node);
- function ClassName(opts) {
- var _this;
- _this = _Node.call(this, opts) || this;
- _this.type = types.CLASS;
- _this._constructed = true;
- return _this;
- }
- var _proto = ClassName.prototype;
- _proto.valueToString = function valueToString() {
- return '.' + _Node.prototype.valueToString.call(this);
- };
- _createClass(ClassName, [{
- key: "value",
- get: function get() {
- return this._value;
- },
- set: function set(v) {
- if (this._constructed) {
- var escaped = (0, _cssesc["default"])(v, {
- isIdentifier: true
- });
- if (escaped !== v) {
- (0, util.ensureObject)(this, "raws");
- this.raws.value = escaped;
- } else if (this.raws) {
- delete this.raws.value;
- }
- }
- this._value = v;
- }
- }]);
- return ClassName;
- }(_node["default"]);
- exports["default"] = ClassName;
- module.exports = exports.default;
- });
- var comment = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = void 0;
- var _node = _interopRequireDefault(node);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- var Comment = /*#__PURE__*/function (_Node) {
- _inheritsLoose(Comment, _Node);
- function Comment(opts) {
- var _this;
- _this = _Node.call(this, opts) || this;
- _this.type = types.COMMENT;
- return _this;
- }
- return Comment;
- }(_node["default"]);
- exports["default"] = Comment;
- module.exports = exports.default;
- });
- var id = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = void 0;
- var _node = _interopRequireDefault(node);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- var ID = /*#__PURE__*/function (_Node) {
- _inheritsLoose(ID, _Node);
- function ID(opts) {
- var _this;
- _this = _Node.call(this, opts) || this;
- _this.type = types.ID;
- return _this;
- }
- var _proto = ID.prototype;
- _proto.valueToString = function valueToString() {
- return '#' + _Node.prototype.valueToString.call(this);
- };
- return ID;
- }(_node["default"]);
- exports["default"] = ID;
- module.exports = exports.default;
- });
- var namespace = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = void 0;
- var _cssesc = _interopRequireDefault(cssesc_1);
- var _node = _interopRequireDefault(node);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- 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); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- var Namespace = /*#__PURE__*/function (_Node) {
- _inheritsLoose(Namespace, _Node);
- function Namespace() {
- return _Node.apply(this, arguments) || this;
- }
- var _proto = Namespace.prototype;
- _proto.qualifiedName = function qualifiedName(value) {
- if (this.namespace) {
- return this.namespaceString + "|" + value;
- } else {
- return value;
- }
- };
- _proto.valueToString = function valueToString() {
- return this.qualifiedName(_Node.prototype.valueToString.call(this));
- };
- _createClass(Namespace, [{
- key: "namespace",
- get: function get() {
- return this._namespace;
- },
- set: function set(namespace) {
- if (namespace === true || namespace === "*" || namespace === "&") {
- this._namespace = namespace;
- if (this.raws) {
- delete this.raws.namespace;
- }
- return;
- }
- var escaped = (0, _cssesc["default"])(namespace, {
- isIdentifier: true
- });
- this._namespace = namespace;
- if (escaped !== namespace) {
- (0, util.ensureObject)(this, "raws");
- this.raws.namespace = escaped;
- } else if (this.raws) {
- delete this.raws.namespace;
- }
- }
- }, {
- key: "ns",
- get: function get() {
- return this._namespace;
- },
- set: function set(namespace) {
- this.namespace = namespace;
- }
- }, {
- key: "namespaceString",
- get: function get() {
- if (this.namespace) {
- var ns = this.stringifyProperty("namespace");
- if (ns === true) {
- return '';
- } else {
- return ns;
- }
- } else {
- return '';
- }
- }
- }]);
- return Namespace;
- }(_node["default"]);
- exports["default"] = Namespace;
- module.exports = exports.default;
- });
- var tag = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = void 0;
- var _namespace = _interopRequireDefault(namespace);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- var Tag = /*#__PURE__*/function (_Namespace) {
- _inheritsLoose(Tag, _Namespace);
- function Tag(opts) {
- var _this;
- _this = _Namespace.call(this, opts) || this;
- _this.type = types.TAG;
- return _this;
- }
- return Tag;
- }(_namespace["default"]);
- exports["default"] = Tag;
- module.exports = exports.default;
- });
- var string = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = void 0;
- var _node = _interopRequireDefault(node);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- var String = /*#__PURE__*/function (_Node) {
- _inheritsLoose(String, _Node);
- function String(opts) {
- var _this;
- _this = _Node.call(this, opts) || this;
- _this.type = types.STRING;
- return _this;
- }
- return String;
- }(_node["default"]);
- exports["default"] = String;
- module.exports = exports.default;
- });
- var pseudo = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = void 0;
- var _container = _interopRequireDefault(container);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- var Pseudo = /*#__PURE__*/function (_Container) {
- _inheritsLoose(Pseudo, _Container);
- function Pseudo(opts) {
- var _this;
- _this = _Container.call(this, opts) || this;
- _this.type = types.PSEUDO;
- return _this;
- }
- var _proto = Pseudo.prototype;
- _proto.toString = function toString() {
- var params = this.length ? '(' + this.map(String).join(',') + ')' : '';
- return [this.rawSpaceBefore, this.stringifyProperty("value"), params, this.rawSpaceAfter].join('');
- };
- return Pseudo;
- }(_container["default"]);
- exports["default"] = Pseudo;
- module.exports = exports.default;
- });
- /**
- * For Node.js, simply re-export the core `util.deprecate` function.
- */
- var node$1 = util__default.deprecate;
- var attribute = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.unescapeValue = unescapeValue;
- exports["default"] = void 0;
- var _cssesc = _interopRequireDefault(cssesc_1);
- var _unesc = _interopRequireDefault(unesc_1);
- var _namespace = _interopRequireDefault(namespace);
- var _CSSESC_QUOTE_OPTIONS;
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- 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); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- var WRAPPED_IN_QUOTES = /^('|")([^]*)\1$/;
- var warnOfDeprecatedValueAssignment = node$1(function () {}, "Assigning an attribute a value containing characters that might need to be escaped is deprecated. " + "Call attribute.setValue() instead.");
- var warnOfDeprecatedQuotedAssignment = node$1(function () {}, "Assigning attr.quoted is deprecated and has no effect. Assign to attr.quoteMark instead.");
- var warnOfDeprecatedConstructor = node$1(function () {}, "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now.");
- function unescapeValue(value) {
- var deprecatedUsage = false;
- var quoteMark = null;
- var unescaped = value;
- var m = unescaped.match(WRAPPED_IN_QUOTES);
- if (m) {
- quoteMark = m[1];
- unescaped = m[2];
- }
- unescaped = (0, _unesc["default"])(unescaped);
- if (unescaped !== value) {
- deprecatedUsage = true;
- }
- return {
- deprecatedUsage: deprecatedUsage,
- unescaped: unescaped,
- quoteMark: quoteMark
- };
- }
- function handleDeprecatedContructorOpts(opts) {
- if (opts.quoteMark !== undefined) {
- return opts;
- }
- if (opts.value === undefined) {
- return opts;
- }
- warnOfDeprecatedConstructor();
- var _unescapeValue = unescapeValue(opts.value),
- quoteMark = _unescapeValue.quoteMark,
- unescaped = _unescapeValue.unescaped;
- if (!opts.raws) {
- opts.raws = {};
- }
- if (opts.raws.value === undefined) {
- opts.raws.value = opts.value;
- }
- opts.value = unescaped;
- opts.quoteMark = quoteMark;
- return opts;
- }
- var Attribute = /*#__PURE__*/function (_Namespace) {
- _inheritsLoose(Attribute, _Namespace);
- function Attribute(opts) {
- var _this;
- if (opts === void 0) {
- opts = {};
- }
- _this = _Namespace.call(this, handleDeprecatedContructorOpts(opts)) || this;
- _this.type = types.ATTRIBUTE;
- _this.raws = _this.raws || {};
- Object.defineProperty(_this.raws, 'unquoted', {
- get: node$1(function () {
- return _this.value;
- }, "attr.raws.unquoted is deprecated. Call attr.value instead."),
- set: node$1(function () {
- return _this.value;
- }, "Setting attr.raws.unquoted is deprecated and has no effect. attr.value is unescaped by default now.")
- });
- _this._constructed = true;
- return _this;
- }
- /**
- * Returns the Attribute's value quoted such that it would be legal to use
- * in the value of a css file. The original value's quotation setting
- * used for stringification is left unchanged. See `setValue(value, options)`
- * if you want to control the quote settings of a new value for the attribute.
- *
- * You can also change the quotation used for the current value by setting quoteMark.
- *
- * Options:
- * * quoteMark {'"' | "'" | null} - Use this value to quote the value. If this
- * option is not set, the original value for quoteMark will be used. If
- * indeterminate, a double quote is used. The legal values are:
- * * `null` - the value will be unquoted and characters will be escaped as necessary.
- * * `'` - the value will be quoted with a single quote and single quotes are escaped.
- * * `"` - the value will be quoted with a double quote and double quotes are escaped.
- * * preferCurrentQuoteMark {boolean} - if true, prefer the source quote mark
- * over the quoteMark option value.
- * * smart {boolean} - if true, will select a quote mark based on the value
- * and the other options specified here. See the `smartQuoteMark()`
- * method.
- **/
- var _proto = Attribute.prototype;
- _proto.getQuotedValue = function getQuotedValue(options) {
- if (options === void 0) {
- options = {};
- }
- var quoteMark = this._determineQuoteMark(options);
- var cssescopts = CSSESC_QUOTE_OPTIONS[quoteMark];
- var escaped = (0, _cssesc["default"])(this._value, cssescopts);
- return escaped;
- };
- _proto._determineQuoteMark = function _determineQuoteMark(options) {
- return options.smart ? this.smartQuoteMark(options) : this.preferredQuoteMark(options);
- }
- /**
- * Set the unescaped value with the specified quotation options. The value
- * provided must not include any wrapping quote marks -- those quotes will
- * be interpreted as part of the value and escaped accordingly.
- */
- ;
- _proto.setValue = function setValue(value, options) {
- if (options === void 0) {
- options = {};
- }
- this._value = value;
- this._quoteMark = this._determineQuoteMark(options);
- this._syncRawValue();
- }
- /**
- * Intelligently select a quoteMark value based on the value's contents. If
- * the value is a legal CSS ident, it will not be quoted. Otherwise a quote
- * mark will be picked that minimizes the number of escapes.
- *
- * If there's no clear winner, the quote mark from these options is used,
- * then the source quote mark (this is inverted if `preferCurrentQuoteMark` is
- * true). If the quoteMark is unspecified, a double quote is used.
- *
- * @param options This takes the quoteMark and preferCurrentQuoteMark options
- * from the quoteValue method.
- */
- ;
- _proto.smartQuoteMark = function smartQuoteMark(options) {
- var v = this.value;
- var numSingleQuotes = v.replace(/[^']/g, '').length;
- var numDoubleQuotes = v.replace(/[^"]/g, '').length;
- if (numSingleQuotes + numDoubleQuotes === 0) {
- var escaped = (0, _cssesc["default"])(v, {
- isIdentifier: true
- });
- if (escaped === v) {
- return Attribute.NO_QUOTE;
- } else {
- var pref = this.preferredQuoteMark(options);
- if (pref === Attribute.NO_QUOTE) {
- // pick a quote mark that isn't none and see if it's smaller
- var quote = this.quoteMark || options.quoteMark || Attribute.DOUBLE_QUOTE;
- var opts = CSSESC_QUOTE_OPTIONS[quote];
- var quoteValue = (0, _cssesc["default"])(v, opts);
- if (quoteValue.length < escaped.length) {
- return quote;
- }
- }
- return pref;
- }
- } else if (numDoubleQuotes === numSingleQuotes) {
- return this.preferredQuoteMark(options);
- } else if (numDoubleQuotes < numSingleQuotes) {
- return Attribute.DOUBLE_QUOTE;
- } else {
- return Attribute.SINGLE_QUOTE;
- }
- }
- /**
- * Selects the preferred quote mark based on the options and the current quote mark value.
- * If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)`
- * instead.
- */
- ;
- _proto.preferredQuoteMark = function preferredQuoteMark(options) {
- var quoteMark = options.preferCurrentQuoteMark ? this.quoteMark : options.quoteMark;
- if (quoteMark === undefined) {
- quoteMark = options.preferCurrentQuoteMark ? options.quoteMark : this.quoteMark;
- }
- if (quoteMark === undefined) {
- quoteMark = Attribute.DOUBLE_QUOTE;
- }
- return quoteMark;
- };
- _proto._syncRawValue = function _syncRawValue() {
- var rawValue = (0, _cssesc["default"])(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]);
- if (rawValue === this._value) {
- if (this.raws) {
- delete this.raws.value;
- }
- } else {
- this.raws.value = rawValue;
- }
- };
- _proto._handleEscapes = function _handleEscapes(prop, value) {
- if (this._constructed) {
- var escaped = (0, _cssesc["default"])(value, {
- isIdentifier: true
- });
- if (escaped !== value) {
- this.raws[prop] = escaped;
- } else {
- delete this.raws[prop];
- }
- }
- };
- _proto._spacesFor = function _spacesFor(name) {
- var attrSpaces = {
- before: '',
- after: ''
- };
- var spaces = this.spaces[name] || {};
- var rawSpaces = this.raws.spaces && this.raws.spaces[name] || {};
- return Object.assign(attrSpaces, spaces, rawSpaces);
- };
- _proto._stringFor = function _stringFor(name, spaceName, concat) {
- if (spaceName === void 0) {
- spaceName = name;
- }
- if (concat === void 0) {
- concat = defaultAttrConcat;
- }
- var attrSpaces = this._spacesFor(spaceName);
- return concat(this.stringifyProperty(name), attrSpaces);
- }
- /**
- * returns the offset of the attribute part specified relative to the
- * start of the node of the output string.
- *
- * * "ns" - alias for "namespace"
- * * "namespace" - the namespace if it exists.
- * * "attribute" - the attribute name
- * * "attributeNS" - the start of the attribute or its namespace
- * * "operator" - the match operator of the attribute
- * * "value" - The value (string or identifier)
- * * "insensitive" - the case insensitivity flag;
- * @param part One of the possible values inside an attribute.
- * @returns -1 if the name is invalid or the value doesn't exist in this attribute.
- */
- ;
- _proto.offsetOf = function offsetOf(name) {
- var count = 1;
- var attributeSpaces = this._spacesFor("attribute");
- count += attributeSpaces.before.length;
- if (name === "namespace" || name === "ns") {
- return this.namespace ? count : -1;
- }
- if (name === "attributeNS") {
- return count;
- }
- count += this.namespaceString.length;
- if (this.namespace) {
- count += 1;
- }
- if (name === "attribute") {
- return count;
- }
- count += this.stringifyProperty("attribute").length;
- count += attributeSpaces.after.length;
- var operatorSpaces = this._spacesFor("operator");
- count += operatorSpaces.before.length;
- var operator = this.stringifyProperty("operator");
- if (name === "operator") {
- return operator ? count : -1;
- }
- count += operator.length;
- count += operatorSpaces.after.length;
- var valueSpaces = this._spacesFor("value");
- count += valueSpaces.before.length;
- var value = this.stringifyProperty("value");
- if (name === "value") {
- return value ? count : -1;
- }
- count += value.length;
- count += valueSpaces.after.length;
- var insensitiveSpaces = this._spacesFor("insensitive");
- count += insensitiveSpaces.before.length;
- if (name === "insensitive") {
- return this.insensitive ? count : -1;
- }
- return -1;
- };
- _proto.toString = function toString() {
- var _this2 = this;
- var selector = [this.rawSpaceBefore, '['];
- selector.push(this._stringFor('qualifiedAttribute', 'attribute'));
- if (this.operator && (this.value || this.value === '')) {
- selector.push(this._stringFor('operator'));
- selector.push(this._stringFor('value'));
- selector.push(this._stringFor('insensitiveFlag', 'insensitive', function (attrValue, attrSpaces) {
- if (attrValue.length > 0 && !_this2.quoted && attrSpaces.before.length === 0 && !(_this2.spaces.value && _this2.spaces.value.after)) {
- attrSpaces.before = " ";
- }
- return defaultAttrConcat(attrValue, attrSpaces);
- }));
- }
- selector.push(']');
- selector.push(this.rawSpaceAfter);
- return selector.join('');
- };
- _createClass(Attribute, [{
- key: "quoted",
- get: function get() {
- var qm = this.quoteMark;
- return qm === "'" || qm === '"';
- },
- set: function set(value) {
- warnOfDeprecatedQuotedAssignment();
- }
- /**
- * returns a single (`'`) or double (`"`) quote character if the value is quoted.
- * returns `null` if the value is not quoted.
- * returns `undefined` if the quotation state is unknown (this can happen when
- * the attribute is constructed without specifying a quote mark.)
- */
- }, {
- key: "quoteMark",
- get: function get() {
- return this._quoteMark;
- }
- /**
- * Set the quote mark to be used by this attribute's value.
- * If the quote mark changes, the raw (escaped) value at `attr.raws.value` of the attribute
- * value is updated accordingly.
- *
- * @param {"'" | '"' | null} quoteMark The quote mark or `null` if the value should be unquoted.
- */
- ,
- set: function set(quoteMark) {
- if (!this._constructed) {
- this._quoteMark = quoteMark;
- return;
- }
- if (this._quoteMark !== quoteMark) {
- this._quoteMark = quoteMark;
- this._syncRawValue();
- }
- }
- }, {
- key: "qualifiedAttribute",
- get: function get() {
- return this.qualifiedName(this.raws.attribute || this.attribute);
- }
- }, {
- key: "insensitiveFlag",
- get: function get() {
- return this.insensitive ? 'i' : '';
- }
- }, {
- key: "value",
- get: function get() {
- return this._value;
- }
- /**
- * Before 3.0, the value had to be set to an escaped value including any wrapped
- * quote marks. In 3.0, the semantics of `Attribute.value` changed so that the value
- * is unescaped during parsing and any quote marks are removed.
- *
- * Because the ambiguity of this semantic change, if you set `attr.value = newValue`,
- * a deprecation warning is raised when the new value contains any characters that would
- * require escaping (including if it contains wrapped quotes).
- *
- * Instead, you should call `attr.setValue(newValue, opts)` and pass options that describe
- * how the new value is quoted.
- */
- ,
- set: function set(v) {
- if (this._constructed) {
- var _unescapeValue2 = unescapeValue(v),
- deprecatedUsage = _unescapeValue2.deprecatedUsage,
- unescaped = _unescapeValue2.unescaped,
- quoteMark = _unescapeValue2.quoteMark;
- if (deprecatedUsage) {
- warnOfDeprecatedValueAssignment();
- }
- if (unescaped === this._value && quoteMark === this._quoteMark) {
- return;
- }
- this._value = unescaped;
- this._quoteMark = quoteMark;
- this._syncRawValue();
- } else {
- this._value = v;
- }
- }
- }, {
- key: "attribute",
- get: function get() {
- return this._attribute;
- },
- set: function set(name) {
- this._handleEscapes("attribute", name);
- this._attribute = name;
- }
- }]);
- return Attribute;
- }(_namespace["default"]);
- exports["default"] = Attribute;
- Attribute.NO_QUOTE = null;
- Attribute.SINGLE_QUOTE = "'";
- Attribute.DOUBLE_QUOTE = '"';
- var CSSESC_QUOTE_OPTIONS = (_CSSESC_QUOTE_OPTIONS = {
- "'": {
- quotes: 'single',
- wrap: true
- },
- '"': {
- quotes: 'double',
- wrap: true
- }
- }, _CSSESC_QUOTE_OPTIONS[null] = {
- isIdentifier: true
- }, _CSSESC_QUOTE_OPTIONS);
- function defaultAttrConcat(attrValue, attrSpaces) {
- return "" + attrSpaces.before + attrValue + attrSpaces.after;
- }
- });
- var universal = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = void 0;
- var _namespace = _interopRequireDefault(namespace);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- var Universal = /*#__PURE__*/function (_Namespace) {
- _inheritsLoose(Universal, _Namespace);
- function Universal(opts) {
- var _this;
- _this = _Namespace.call(this, opts) || this;
- _this.type = types.UNIVERSAL;
- _this.value = '*';
- return _this;
- }
- return Universal;
- }(_namespace["default"]);
- exports["default"] = Universal;
- module.exports = exports.default;
- });
- var combinator = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = void 0;
- var _node = _interopRequireDefault(node);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- var Combinator = /*#__PURE__*/function (_Node) {
- _inheritsLoose(Combinator, _Node);
- function Combinator(opts) {
- var _this;
- _this = _Node.call(this, opts) || this;
- _this.type = types.COMBINATOR;
- return _this;
- }
- return Combinator;
- }(_node["default"]);
- exports["default"] = Combinator;
- module.exports = exports.default;
- });
- var nesting = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = void 0;
- var _node = _interopRequireDefault(node);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- var Nesting = /*#__PURE__*/function (_Node) {
- _inheritsLoose(Nesting, _Node);
- function Nesting(opts) {
- var _this;
- _this = _Node.call(this, opts) || this;
- _this.type = types.NESTING;
- _this.value = '&';
- return _this;
- }
- return Nesting;
- }(_node["default"]);
- exports["default"] = Nesting;
- module.exports = exports.default;
- });
- var sortAscending_1 = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = sortAscending;
- function sortAscending(list) {
- return list.sort(function (a, b) {
- return a - b;
- });
- }
- module.exports = exports.default;
- });
- var tokenTypes = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- 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;
- var ampersand = 38; // `&`.charCodeAt(0);
- exports.ampersand = ampersand;
- var asterisk = 42; // `*`.charCodeAt(0);
- exports.asterisk = asterisk;
- var at = 64; // `@`.charCodeAt(0);
- exports.at = at;
- var comma = 44; // `,`.charCodeAt(0);
- exports.comma = comma;
- var colon = 58; // `:`.charCodeAt(0);
- exports.colon = colon;
- var semicolon = 59; // `;`.charCodeAt(0);
- exports.semicolon = semicolon;
- var openParenthesis = 40; // `(`.charCodeAt(0);
- exports.openParenthesis = openParenthesis;
- var closeParenthesis = 41; // `)`.charCodeAt(0);
- exports.closeParenthesis = closeParenthesis;
- var openSquare = 91; // `[`.charCodeAt(0);
- exports.openSquare = openSquare;
- var closeSquare = 93; // `]`.charCodeAt(0);
- exports.closeSquare = closeSquare;
- var dollar = 36; // `$`.charCodeAt(0);
- exports.dollar = dollar;
- var tilde = 126; // `~`.charCodeAt(0);
- exports.tilde = tilde;
- var caret = 94; // `^`.charCodeAt(0);
- exports.caret = caret;
- var plus = 43; // `+`.charCodeAt(0);
- exports.plus = plus;
- var equals = 61; // `=`.charCodeAt(0);
- exports.equals = equals;
- var pipe = 124; // `|`.charCodeAt(0);
- exports.pipe = pipe;
- var greaterThan = 62; // `>`.charCodeAt(0);
- exports.greaterThan = greaterThan;
- var space = 32; // ` `.charCodeAt(0);
- exports.space = space;
- var singleQuote = 39; // `'`.charCodeAt(0);
- exports.singleQuote = singleQuote;
- var doubleQuote = 34; // `"`.charCodeAt(0);
- exports.doubleQuote = doubleQuote;
- var slash = 47; // `/`.charCodeAt(0);
- exports.slash = slash;
- var bang = 33; // `!`.charCodeAt(0);
- exports.bang = bang;
- var backslash = 92; // '\\'.charCodeAt(0);
- exports.backslash = backslash;
- var cr = 13; // '\r'.charCodeAt(0);
- exports.cr = cr;
- var feed = 12; // '\f'.charCodeAt(0);
- exports.feed = feed;
- var newline = 10; // '\n'.charCodeAt(0);
- exports.newline = newline;
- var tab = 9; // '\t'.charCodeAt(0);
- // Expose aliases primarily for readability.
- exports.tab = tab;
- var str = singleQuote; // No good single character representation!
- exports.str = str;
- var comment = -1;
- exports.comment = comment;
- var word = -2;
- exports.word = word;
- var combinator = -3;
- exports.combinator = combinator;
- });
- var tokenize_1 = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = tokenize;
- exports.FIELDS = void 0;
- var t = _interopRequireWildcard(tokenTypes);
- var _unescapable, _wordDelimiters;
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
- 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; }
- var unescapable = (_unescapable = {}, _unescapable[t.tab] = true, _unescapable[t.newline] = true, _unescapable[t.cr] = true, _unescapable[t.feed] = true, _unescapable);
- 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);
- var hex = {};
- var hexChars = "0123456789abcdefABCDEF";
- for (var i = 0; i < hexChars.length; i++) {
- hex[hexChars.charCodeAt(i)] = true;
- }
- /**
- * Returns the last index of the bar css word
- * @param {string} css The string in which the word begins
- * @param {number} start The index into the string where word's first letter occurs
- */
- function consumeWord(css, start) {
- var next = start;
- var code;
- do {
- code = css.charCodeAt(next);
- if (wordDelimiters[code]) {
- return next - 1;
- } else if (code === t.backslash) {
- next = consumeEscape(css, next) + 1;
- } else {
- // All other characters are part of the word
- next++;
- }
- } while (next < css.length);
- return next - 1;
- }
- /**
- * Returns the last index of the escape sequence
- * @param {string} css The string in which the sequence begins
- * @param {number} start The index into the string where escape character (`\`) occurs.
- */
- function consumeEscape(css, start) {
- var next = start;
- var code = css.charCodeAt(next + 1);
- if (unescapable[code]) ; else if (hex[code]) {
- var hexDigits = 0; // consume up to 6 hex chars
- do {
- next++;
- hexDigits++;
- code = css.charCodeAt(next + 1);
- } while (hex[code] && hexDigits < 6); // if fewer than 6 hex chars, a trailing space ends the escape
- if (hexDigits < 6 && code === t.space) {
- next++;
- }
- } else {
- // the next char is part of the current word
- next++;
- }
- return next;
- }
- var FIELDS = {
- TYPE: 0,
- START_LINE: 1,
- START_COL: 2,
- END_LINE: 3,
- END_COL: 4,
- START_POS: 5,
- END_POS: 6
- };
- exports.FIELDS = FIELDS;
- function tokenize(input) {
- var tokens = [];
- var css = input.css.valueOf();
- var _css = css,
- length = _css.length;
- var offset = -1;
- var line = 1;
- var start = 0;
- var end = 0;
- var code, content, endColumn, endLine, escaped, escapePos, last, lines, next, nextLine, nextOffset, quote, tokenType;
- function unclosed(what, fix) {
- if (input.safe) {
- // fyi: this is never set to true.
- css += fix;
- next = css.length - 1;
- } else {
- throw input.error('Unclosed ' + what, line, start - offset, start);
- }
- }
- while (start < length) {
- code = css.charCodeAt(start);
- if (code === t.newline) {
- offset = start;
- line += 1;
- }
- switch (code) {
- case t.space:
- case t.tab:
- case t.newline:
- case t.cr:
- case t.feed:
- next = start;
- do {
- next += 1;
- code = css.charCodeAt(next);
- if (code === t.newline) {
- offset = next;
- line += 1;
- }
- } while (code === t.space || code === t.newline || code === t.tab || code === t.cr || code === t.feed);
- tokenType = t.space;
- endLine = line;
- endColumn = next - offset - 1;
- end = next;
- break;
- case t.plus:
- case t.greaterThan:
- case t.tilde:
- case t.pipe:
- next = start;
- do {
- next += 1;
- code = css.charCodeAt(next);
- } while (code === t.plus || code === t.greaterThan || code === t.tilde || code === t.pipe);
- tokenType = t.combinator;
- endLine = line;
- endColumn = start - offset;
- end = next;
- break;
- // Consume these characters as single tokens.
- case t.asterisk:
- case t.ampersand:
- case t.bang:
- case t.comma:
- case t.equals:
- case t.dollar:
- case t.caret:
- case t.openSquare:
- case t.closeSquare:
- case t.colon:
- case t.semicolon:
- case t.openParenthesis:
- case t.closeParenthesis:
- next = start;
- tokenType = code;
- endLine = line;
- endColumn = start - offset;
- end = next + 1;
- break;
- case t.singleQuote:
- case t.doubleQuote:
- quote = code === t.singleQuote ? "'" : '"';
- next = start;
- do {
- escaped = false;
- next = css.indexOf(quote, next + 1);
- if (next === -1) {
- unclosed('quote', quote);
- }
- escapePos = next;
- while (css.charCodeAt(escapePos - 1) === t.backslash) {
- escapePos -= 1;
- escaped = !escaped;
- }
- } while (escaped);
- tokenType = t.str;
- endLine = line;
- endColumn = start - offset;
- end = next + 1;
- break;
- default:
- if (code === t.slash && css.charCodeAt(start + 1) === t.asterisk) {
- next = css.indexOf('*/', start + 2) + 1;
- if (next === 0) {
- unclosed('comment', '*/');
- }
- content = css.slice(start, next + 1);
- lines = content.split('\n');
- last = lines.length - 1;
- if (last > 0) {
- nextLine = line + last;
- nextOffset = next - lines[last].length;
- } else {
- nextLine = line;
- nextOffset = offset;
- }
- tokenType = t.comment;
- line = nextLine;
- endLine = nextLine;
- endColumn = next - nextOffset;
- } else if (code === t.slash) {
- next = start;
- tokenType = code;
- endLine = line;
- endColumn = start - offset;
- end = next + 1;
- } else {
- next = consumeWord(css, start);
- tokenType = t.word;
- endLine = line;
- endColumn = next - offset;
- }
- end = next + 1;
- break;
- } // Ensure that the token structure remains consistent
- tokens.push([tokenType, // [0] Token type
- line, // [1] Starting line
- start - offset, // [2] Starting column
- endLine, // [3] Ending line
- endColumn, // [4] Ending column
- start, // [5] Start position / Source index
- end // [6] End position
- ]); // Reset offset for the next token
- if (nextOffset) {
- offset = nextOffset;
- nextOffset = null;
- }
- start = end;
- }
- return tokens;
- }
- });
- var parser = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = void 0;
- var _root = _interopRequireDefault(root);
- var _selector = _interopRequireDefault(selector);
- var _className = _interopRequireDefault(className);
- var _comment = _interopRequireDefault(comment);
- var _id = _interopRequireDefault(id);
- var _tag = _interopRequireDefault(tag);
- var _string = _interopRequireDefault(string);
- var _pseudo = _interopRequireDefault(pseudo);
- var _attribute = _interopRequireWildcard(attribute);
- var _universal = _interopRequireDefault(universal);
- var _combinator = _interopRequireDefault(combinator);
- var _nesting = _interopRequireDefault(nesting);
- var _sortAscending = _interopRequireDefault(sortAscending_1);
- var _tokenize = _interopRequireWildcard(tokenize_1);
- var tokens = _interopRequireWildcard(tokenTypes);
- var types$1 = _interopRequireWildcard(types);
- var _WHITESPACE_TOKENS, _Object$assign;
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
- 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; }
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- 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); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
- 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);
- var WHITESPACE_EQUIV_TOKENS = Object.assign({}, WHITESPACE_TOKENS, (_Object$assign = {}, _Object$assign[tokens.comment] = true, _Object$assign));
- function tokenStart(token) {
- return {
- line: token[_tokenize.FIELDS.START_LINE],
- column: token[_tokenize.FIELDS.START_COL]
- };
- }
- function tokenEnd(token) {
- return {
- line: token[_tokenize.FIELDS.END_LINE],
- column: token[_tokenize.FIELDS.END_COL]
- };
- }
- function getSource(startLine, startColumn, endLine, endColumn) {
- return {
- start: {
- line: startLine,
- column: startColumn
- },
- end: {
- line: endLine,
- column: endColumn
- }
- };
- }
- function getTokenSource(token) {
- return getSource(token[_tokenize.FIELDS.START_LINE], token[_tokenize.FIELDS.START_COL], token[_tokenize.FIELDS.END_LINE], token[_tokenize.FIELDS.END_COL]);
- }
- function getTokenSourceSpan(startToken, endToken) {
- if (!startToken) {
- return undefined;
- }
- return getSource(startToken[_tokenize.FIELDS.START_LINE], startToken[_tokenize.FIELDS.START_COL], endToken[_tokenize.FIELDS.END_LINE], endToken[_tokenize.FIELDS.END_COL]);
- }
- function unescapeProp(node, prop) {
- var value = node[prop];
- if (typeof value !== "string") {
- return;
- }
- if (value.indexOf("\\") !== -1) {
- (0, util.ensureObject)(node, 'raws');
- node[prop] = (0, util.unesc)(value);
- if (node.raws[prop] === undefined) {
- node.raws[prop] = value;
- }
- }
- return node;
- }
- function indexesOf(array, item) {
- var i = -1;
- var indexes = [];
- while ((i = array.indexOf(item, i + 1)) !== -1) {
- indexes.push(i);
- }
- return indexes;
- }
- function uniqs() {
- var list = Array.prototype.concat.apply([], arguments);
- return list.filter(function (item, i) {
- return i === list.indexOf(item);
- });
- }
- var Parser = /*#__PURE__*/function () {
- function Parser(rule, options) {
- if (options === void 0) {
- options = {};
- }
- this.rule = rule;
- this.options = Object.assign({
- lossy: false,
- safe: false
- }, options);
- this.position = 0;
- this.css = typeof this.rule === 'string' ? this.rule : this.rule.selector;
- this.tokens = (0, _tokenize["default"])({
- css: this.css,
- error: this._errorGenerator(),
- safe: this.options.safe
- });
- var rootSource = getTokenSourceSpan(this.tokens[0], this.tokens[this.tokens.length - 1]);
- this.root = new _root["default"]({
- source: rootSource
- });
- this.root.errorGenerator = this._errorGenerator();
- var selector = new _selector["default"]({
- source: {
- start: {
- line: 1,
- column: 1
- }
- }
- });
- this.root.append(selector);
- this.current = selector;
- this.loop();
- }
- var _proto = Parser.prototype;
- _proto._errorGenerator = function _errorGenerator() {
- var _this = this;
- return function (message, errorOptions) {
- if (typeof _this.rule === 'string') {
- return new Error(message);
- }
- return _this.rule.error(message, errorOptions);
- };
- };
- _proto.attribute = function attribute() {
- var attr = [];
- var startingToken = this.currToken;
- this.position++;
- while (this.position < this.tokens.length && this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
- attr.push(this.currToken);
- this.position++;
- }
- if (this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
- return this.expected('closing square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
- }
- var len = attr.length;
- var node = {
- source: getSource(startingToken[1], startingToken[2], this.currToken[3], this.currToken[4]),
- sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
- };
- if (len === 1 && !~[tokens.word].indexOf(attr[0][_tokenize.FIELDS.TYPE])) {
- return this.expected('attribute', attr[0][_tokenize.FIELDS.START_POS]);
- }
- var pos = 0;
- var spaceBefore = '';
- var commentBefore = '';
- var lastAdded = null;
- var spaceAfterMeaningfulToken = false;
- while (pos < len) {
- var token = attr[pos];
- var content = this.content(token);
- var next = attr[pos + 1];
- switch (token[_tokenize.FIELDS.TYPE]) {
- case tokens.space:
- // if (
- // len === 1 ||
- // pos === 0 && this.content(next) === '|'
- // ) {
- // return this.expected('attribute', token[TOKEN.START_POS], content);
- // }
- spaceAfterMeaningfulToken = true;
- if (this.options.lossy) {
- break;
- }
- if (lastAdded) {
- (0, util.ensureObject)(node, 'spaces', lastAdded);
- var prevContent = node.spaces[lastAdded].after || '';
- node.spaces[lastAdded].after = prevContent + content;
- var existingComment = (0, util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || null;
- if (existingComment) {
- node.raws.spaces[lastAdded].after = existingComment + content;
- }
- } else {
- spaceBefore = spaceBefore + content;
- commentBefore = commentBefore + content;
- }
- break;
- case tokens.asterisk:
- if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
- node.operator = content;
- lastAdded = 'operator';
- } else if ((!node.namespace || lastAdded === "namespace" && !spaceAfterMeaningfulToken) && next) {
- if (spaceBefore) {
- (0, util.ensureObject)(node, 'spaces', 'attribute');
- node.spaces.attribute.before = spaceBefore;
- spaceBefore = '';
- }
- if (commentBefore) {
- (0, util.ensureObject)(node, 'raws', 'spaces', 'attribute');
- node.raws.spaces.attribute.before = spaceBefore;
- commentBefore = '';
- }
- node.namespace = (node.namespace || "") + content;
- var rawValue = (0, util.getProp)(node, 'raws', 'namespace') || null;
- if (rawValue) {
- node.raws.namespace += content;
- }
- lastAdded = 'namespace';
- }
- spaceAfterMeaningfulToken = false;
- break;
- case tokens.dollar:
- if (lastAdded === "value") {
- var oldRawValue = (0, util.getProp)(node, 'raws', 'value');
- node.value += "$";
- if (oldRawValue) {
- node.raws.value = oldRawValue + "$";
- }
- break;
- }
- // Falls through
- case tokens.caret:
- if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
- node.operator = content;
- lastAdded = 'operator';
- }
- spaceAfterMeaningfulToken = false;
- break;
- case tokens.combinator:
- if (content === '~' && next[_tokenize.FIELDS.TYPE] === tokens.equals) {
- node.operator = content;
- lastAdded = 'operator';
- }
- if (content !== '|') {
- spaceAfterMeaningfulToken = false;
- break;
- }
- if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
- node.operator = content;
- lastAdded = 'operator';
- } else if (!node.namespace && !node.attribute) {
- node.namespace = true;
- }
- spaceAfterMeaningfulToken = false;
- break;
- case tokens.word:
- 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.
- !node.operator && !node.namespace) {
- node.namespace = content;
- lastAdded = 'namespace';
- } else if (!node.attribute || lastAdded === "attribute" && !spaceAfterMeaningfulToken) {
- if (spaceBefore) {
- (0, util.ensureObject)(node, 'spaces', 'attribute');
- node.spaces.attribute.before = spaceBefore;
- spaceBefore = '';
- }
- if (commentBefore) {
- (0, util.ensureObject)(node, 'raws', 'spaces', 'attribute');
- node.raws.spaces.attribute.before = commentBefore;
- commentBefore = '';
- }
- node.attribute = (node.attribute || "") + content;
- var _rawValue = (0, util.getProp)(node, 'raws', 'attribute') || null;
- if (_rawValue) {
- node.raws.attribute += content;
- }
- lastAdded = 'attribute';
- } else if (!node.value && node.value !== "" || lastAdded === "value" && !spaceAfterMeaningfulToken) {
- var _unescaped = (0, util.unesc)(content);
- var _oldRawValue = (0, util.getProp)(node, 'raws', 'value') || '';
- var oldValue = node.value || '';
- node.value = oldValue + _unescaped;
- node.quoteMark = null;
- if (_unescaped !== content || _oldRawValue) {
- (0, util.ensureObject)(node, 'raws');
- node.raws.value = (_oldRawValue || oldValue) + content;
- }
- lastAdded = 'value';
- } else {
- var insensitive = content === 'i' || content === "I";
- if ((node.value || node.value === '') && (node.quoteMark || spaceAfterMeaningfulToken)) {
- node.insensitive = insensitive;
- if (!insensitive || content === "I") {
- (0, util.ensureObject)(node, 'raws');
- node.raws.insensitiveFlag = content;
- }
- lastAdded = 'insensitive';
- if (spaceBefore) {
- (0, util.ensureObject)(node, 'spaces', 'insensitive');
- node.spaces.insensitive.before = spaceBefore;
- spaceBefore = '';
- }
- if (commentBefore) {
- (0, util.ensureObject)(node, 'raws', 'spaces', 'insensitive');
- node.raws.spaces.insensitive.before = commentBefore;
- commentBefore = '';
- }
- } else if (node.value || node.value === '') {
- lastAdded = 'value';
- node.value += content;
- if (node.raws.value) {
- node.raws.value += content;
- }
- }
- }
- spaceAfterMeaningfulToken = false;
- break;
- case tokens.str:
- if (!node.attribute || !node.operator) {
- return this.error("Expected an attribute followed by an operator preceding the string.", {
- index: token[_tokenize.FIELDS.START_POS]
- });
- }
- var _unescapeValue = (0, _attribute.unescapeValue)(content),
- unescaped = _unescapeValue.unescaped,
- quoteMark = _unescapeValue.quoteMark;
- node.value = unescaped;
- node.quoteMark = quoteMark;
- lastAdded = 'value';
- (0, util.ensureObject)(node, 'raws');
- node.raws.value = content;
- spaceAfterMeaningfulToken = false;
- break;
- case tokens.equals:
- if (!node.attribute) {
- return this.expected('attribute', token[_tokenize.FIELDS.START_POS], content);
- }
- if (node.value) {
- return this.error('Unexpected "=" found; an operator was already defined.', {
- index: token[_tokenize.FIELDS.START_POS]
- });
- }
- node.operator = node.operator ? node.operator + content : content;
- lastAdded = 'operator';
- spaceAfterMeaningfulToken = false;
- break;
- case tokens.comment:
- if (lastAdded) {
- if (spaceAfterMeaningfulToken || next && next[_tokenize.FIELDS.TYPE] === tokens.space || lastAdded === 'insensitive') {
- var lastComment = (0, util.getProp)(node, 'spaces', lastAdded, 'after') || '';
- var rawLastComment = (0, util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || lastComment;
- (0, util.ensureObject)(node, 'raws', 'spaces', lastAdded);
- node.raws.spaces[lastAdded].after = rawLastComment + content;
- } else {
- var lastValue = node[lastAdded] || '';
- var rawLastValue = (0, util.getProp)(node, 'raws', lastAdded) || lastValue;
- (0, util.ensureObject)(node, 'raws');
- node.raws[lastAdded] = rawLastValue + content;
- }
- } else {
- commentBefore = commentBefore + content;
- }
- break;
- default:
- return this.error("Unexpected \"" + content + "\" found.", {
- index: token[_tokenize.FIELDS.START_POS]
- });
- }
- pos++;
- }
- unescapeProp(node, "attribute");
- unescapeProp(node, "namespace");
- this.newNode(new _attribute["default"](node));
- this.position++;
- }
- /**
- * return a node containing meaningless garbage up to (but not including) the specified token position.
- * if the token position is negative, all remaining tokens are consumed.
- *
- * This returns an array containing a single string node if all whitespace,
- * otherwise an array of comment nodes with space before and after.
- *
- * These tokens are not added to the current selector, the caller can add them or use them to amend
- * a previous node's space metadata.
- *
- * In lossy mode, this returns only comments.
- */
- ;
- _proto.parseWhitespaceEquivalentTokens = function parseWhitespaceEquivalentTokens(stopPosition) {
- if (stopPosition < 0) {
- stopPosition = this.tokens.length;
- }
- var startPosition = this.position;
- var nodes = [];
- var space = "";
- var lastComment = undefined;
- do {
- if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) {
- if (!this.options.lossy) {
- space += this.content();
- }
- } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.comment) {
- var spaces = {};
- if (space) {
- spaces.before = space;
- space = "";
- }
- lastComment = new _comment["default"]({
- value: this.content(),
- source: getTokenSource(this.currToken),
- sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
- spaces: spaces
- });
- nodes.push(lastComment);
- }
- } while (++this.position < stopPosition);
- if (space) {
- if (lastComment) {
- lastComment.spaces.after = space;
- } else if (!this.options.lossy) {
- var firstToken = this.tokens[startPosition];
- var lastToken = this.tokens[this.position - 1];
- nodes.push(new _string["default"]({
- value: '',
- source: getSource(firstToken[_tokenize.FIELDS.START_LINE], firstToken[_tokenize.FIELDS.START_COL], lastToken[_tokenize.FIELDS.END_LINE], lastToken[_tokenize.FIELDS.END_COL]),
- sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
- spaces: {
- before: space,
- after: ''
- }
- }));
- }
- }
- return nodes;
- }
- /**
- *
- * @param {*} nodes
- */
- ;
- _proto.convertWhitespaceNodesToSpace = function convertWhitespaceNodesToSpace(nodes, requiredSpace) {
- var _this2 = this;
- if (requiredSpace === void 0) {
- requiredSpace = false;
- }
- var space = "";
- var rawSpace = "";
- nodes.forEach(function (n) {
- var spaceBefore = _this2.lossySpace(n.spaces.before, requiredSpace);
- var rawSpaceBefore = _this2.lossySpace(n.rawSpaceBefore, requiredSpace);
- space += spaceBefore + _this2.lossySpace(n.spaces.after, requiredSpace && spaceBefore.length === 0);
- rawSpace += spaceBefore + n.value + _this2.lossySpace(n.rawSpaceAfter, requiredSpace && rawSpaceBefore.length === 0);
- });
- if (rawSpace === space) {
- rawSpace = undefined;
- }
- var result = {
- space: space,
- rawSpace: rawSpace
- };
- return result;
- };
- _proto.isNamedCombinator = function isNamedCombinator(position) {
- if (position === void 0) {
- position = this.position;
- }
- 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;
- };
- _proto.namedCombinator = function namedCombinator() {
- if (this.isNamedCombinator()) {
- var nameRaw = this.content(this.tokens[this.position + 1]);
- var name = (0, util.unesc)(nameRaw).toLowerCase();
- var raws = {};
- if (name !== nameRaw) {
- raws.value = "/" + nameRaw + "/";
- }
- var node = new _combinator["default"]({
- value: "/" + name + "/",
- 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]),
- sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
- raws: raws
- });
- this.position = this.position + 3;
- return node;
- } else {
- this.unexpected();
- }
- };
- _proto.combinator = function combinator() {
- var _this3 = this;
- if (this.content() === '|') {
- return this.namespace();
- } // We need to decide between a space that's a descendant combinator and meaningless whitespace at the end of a selector.
- var nextSigTokenPos = this.locateNextMeaningfulToken(this.position);
- if (nextSigTokenPos < 0 || this.tokens[nextSigTokenPos][_tokenize.FIELDS.TYPE] === tokens.comma) {
- var nodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
- if (nodes.length > 0) {
- var last = this.current.last;
- if (last) {
- var _this$convertWhitespa = this.convertWhitespaceNodesToSpace(nodes),
- space = _this$convertWhitespa.space,
- rawSpace = _this$convertWhitespa.rawSpace;
- if (rawSpace !== undefined) {
- last.rawSpaceAfter += rawSpace;
- }
- last.spaces.after += space;
- } else {
- nodes.forEach(function (n) {
- return _this3.newNode(n);
- });
- }
- }
- return;
- }
- var firstToken = this.currToken;
- var spaceOrDescendantSelectorNodes = undefined;
- if (nextSigTokenPos > this.position) {
- spaceOrDescendantSelectorNodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
- }
- var node;
- if (this.isNamedCombinator()) {
- node = this.namedCombinator();
- } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.combinator) {
- node = new _combinator["default"]({
- value: this.content(),
- source: getTokenSource(this.currToken),
- sourceIndex: this.currToken[_tokenize.FIELDS.START_POS]
- });
- this.position++;
- } else if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) ; else if (!spaceOrDescendantSelectorNodes) {
- this.unexpected();
- }
- if (node) {
- if (spaceOrDescendantSelectorNodes) {
- var _this$convertWhitespa2 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes),
- _space = _this$convertWhitespa2.space,
- _rawSpace = _this$convertWhitespa2.rawSpace;
- node.spaces.before = _space;
- node.rawSpaceBefore = _rawSpace;
- }
- } else {
- // descendant combinator
- var _this$convertWhitespa3 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes, true),
- _space2 = _this$convertWhitespa3.space,
- _rawSpace2 = _this$convertWhitespa3.rawSpace;
- if (!_rawSpace2) {
- _rawSpace2 = _space2;
- }
- var spaces = {};
- var raws = {
- spaces: {}
- };
- if (_space2.endsWith(' ') && _rawSpace2.endsWith(' ')) {
- spaces.before = _space2.slice(0, _space2.length - 1);
- raws.spaces.before = _rawSpace2.slice(0, _rawSpace2.length - 1);
- } else if (_space2.startsWith(' ') && _rawSpace2.startsWith(' ')) {
- spaces.after = _space2.slice(1);
- raws.spaces.after = _rawSpace2.slice(1);
- } else {
- raws.value = _rawSpace2;
- }
- node = new _combinator["default"]({
- value: ' ',
- source: getTokenSourceSpan(firstToken, this.tokens[this.position - 1]),
- sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
- spaces: spaces,
- raws: raws
- });
- }
- if (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.space) {
- node.spaces.after = this.optionalSpace(this.content());
- this.position++;
- }
- return this.newNode(node);
- };
- _proto.comma = function comma() {
- if (this.position === this.tokens.length - 1) {
- this.root.trailingComma = true;
- this.position++;
- return;
- }
- this.current._inferEndPosition();
- var selector = new _selector["default"]({
- source: {
- start: tokenStart(this.tokens[this.position + 1])
- }
- });
- this.current.parent.append(selector);
- this.current = selector;
- this.position++;
- };
- _proto.comment = function comment() {
- var current = this.currToken;
- this.newNode(new _comment["default"]({
- value: this.content(),
- source: getTokenSource(current),
- sourceIndex: current[_tokenize.FIELDS.START_POS]
- }));
- this.position++;
- };
- _proto.error = function error(message, opts) {
- throw this.root.error(message, opts);
- };
- _proto.missingBackslash = function missingBackslash() {
- return this.error('Expected a backslash preceding the semicolon.', {
- index: this.currToken[_tokenize.FIELDS.START_POS]
- });
- };
- _proto.missingParenthesis = function missingParenthesis() {
- return this.expected('opening parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
- };
- _proto.missingSquareBracket = function missingSquareBracket() {
- return this.expected('opening square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
- };
- _proto.unexpected = function unexpected() {
- return this.error("Unexpected '" + this.content() + "'. Escaping special characters with \\ may help.", this.currToken[_tokenize.FIELDS.START_POS]);
- };
- _proto.namespace = function namespace() {
- var before = this.prevToken && this.content(this.prevToken) || true;
- if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.word) {
- this.position++;
- return this.word(before);
- } else if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.asterisk) {
- this.position++;
- return this.universal(before);
- }
- };
- _proto.nesting = function nesting() {
- if (this.nextToken) {
- var nextContent = this.content(this.nextToken);
- if (nextContent === "|") {
- this.position++;
- return;
- }
- }
- var current = this.currToken;
- this.newNode(new _nesting["default"]({
- value: this.content(),
- source: getTokenSource(current),
- sourceIndex: current[_tokenize.FIELDS.START_POS]
- }));
- this.position++;
- };
- _proto.parentheses = function parentheses() {
- var last = this.current.last;
- var unbalanced = 1;
- this.position++;
- if (last && last.type === types$1.PSEUDO) {
- var selector = new _selector["default"]({
- source: {
- start: tokenStart(this.tokens[this.position - 1])
- }
- });
- var cache = this.current;
- last.append(selector);
- this.current = selector;
- while (this.position < this.tokens.length && unbalanced) {
- if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
- unbalanced++;
- }
- if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
- unbalanced--;
- }
- if (unbalanced) {
- this.parse();
- } else {
- this.current.source.end = tokenEnd(this.currToken);
- this.current.parent.source.end = tokenEnd(this.currToken);
- this.position++;
- }
- }
- this.current = cache;
- } else {
- // I think this case should be an error. It's used to implement a basic parse of media queries
- // but I don't think it's a good idea.
- var parenStart = this.currToken;
- var parenValue = "(";
- var parenEnd;
- while (this.position < this.tokens.length && unbalanced) {
- if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
- unbalanced++;
- }
- if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
- unbalanced--;
- }
- parenEnd = this.currToken;
- parenValue += this.parseParenthesisToken(this.currToken);
- this.position++;
- }
- if (last) {
- last.appendToPropertyAndEscape("value", parenValue, parenValue);
- } else {
- this.newNode(new _string["default"]({
- value: parenValue,
- source: getSource(parenStart[_tokenize.FIELDS.START_LINE], parenStart[_tokenize.FIELDS.START_COL], parenEnd[_tokenize.FIELDS.END_LINE], parenEnd[_tokenize.FIELDS.END_COL]),
- sourceIndex: parenStart[_tokenize.FIELDS.START_POS]
- }));
- }
- }
- if (unbalanced) {
- return this.expected('closing parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
- }
- };
- _proto.pseudo = function pseudo() {
- var _this4 = this;
- var pseudoStr = '';
- var startingToken = this.currToken;
- while (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.colon) {
- pseudoStr += this.content();
- this.position++;
- }
- if (!this.currToken) {
- return this.expected(['pseudo-class', 'pseudo-element'], this.position - 1);
- }
- if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.word) {
- this.splitWord(false, function (first, length) {
- pseudoStr += first;
- _this4.newNode(new _pseudo["default"]({
- value: pseudoStr,
- source: getTokenSourceSpan(startingToken, _this4.currToken),
- sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
- }));
- if (length > 1 && _this4.nextToken && _this4.nextToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
- _this4.error('Misplaced parenthesis.', {
- index: _this4.nextToken[_tokenize.FIELDS.START_POS]
- });
- }
- });
- } else {
- return this.expected(['pseudo-class', 'pseudo-element'], this.currToken[_tokenize.FIELDS.START_POS]);
- }
- };
- _proto.space = function space() {
- var content = this.content(); // Handle space before and after the selector
- if (this.position === 0 || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis || this.current.nodes.every(function (node) {
- return node.type === 'comment';
- })) {
- this.spaces = this.optionalSpace(content);
- this.position++;
- } else if (this.position === this.tokens.length - 1 || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
- this.current.last.spaces.after = this.optionalSpace(content);
- this.position++;
- } else {
- this.combinator();
- }
- };
- _proto.string = function string() {
- var current = this.currToken;
- this.newNode(new _string["default"]({
- value: this.content(),
- source: getTokenSource(current),
- sourceIndex: current[_tokenize.FIELDS.START_POS]
- }));
- this.position++;
- };
- _proto.universal = function universal(namespace) {
- var nextToken = this.nextToken;
- if (nextToken && this.content(nextToken) === '|') {
- this.position++;
- return this.namespace();
- }
- var current = this.currToken;
- this.newNode(new _universal["default"]({
- value: this.content(),
- source: getTokenSource(current),
- sourceIndex: current[_tokenize.FIELDS.START_POS]
- }), namespace);
- this.position++;
- };
- _proto.splitWord = function splitWord(namespace, firstCallback) {
- var _this5 = this;
- var nextToken = this.nextToken;
- var word = this.content();
- while (nextToken && ~[tokens.dollar, tokens.caret, tokens.equals, tokens.word].indexOf(nextToken[_tokenize.FIELDS.TYPE])) {
- this.position++;
- var current = this.content();
- word += current;
- if (current.lastIndexOf('\\') === current.length - 1) {
- var next = this.nextToken;
- if (next && next[_tokenize.FIELDS.TYPE] === tokens.space) {
- word += this.requiredSpace(this.content(next));
- this.position++;
- }
- }
- nextToken = this.nextToken;
- }
- var hasClass = indexesOf(word, '.').filter(function (i) {
- // Allow escaped dot within class name
- var escapedDot = word[i - 1] === '\\'; // Allow decimal numbers percent in @keyframes
- var isKeyframesPercent = /^\d+\.\d+%$/.test(word);
- return !escapedDot && !isKeyframesPercent;
- });
- var hasId = indexesOf(word, '#').filter(function (i) {
- return word[i - 1] !== '\\';
- }); // Eliminate Sass interpolations from the list of id indexes
- var interpolations = indexesOf(word, '#{');
- if (interpolations.length) {
- hasId = hasId.filter(function (hashIndex) {
- return !~interpolations.indexOf(hashIndex);
- });
- }
- var indices = (0, _sortAscending["default"])(uniqs([0].concat(hasClass, hasId)));
- indices.forEach(function (ind, i) {
- var index = indices[i + 1] || word.length;
- var value = word.slice(ind, index);
- if (i === 0 && firstCallback) {
- return firstCallback.call(_this5, value, indices.length);
- }
- var node;
- var current = _this5.currToken;
- var sourceIndex = current[_tokenize.FIELDS.START_POS] + indices[i];
- var source = getSource(current[1], current[2] + ind, current[3], current[2] + (index - 1));
- if (~hasClass.indexOf(ind)) {
- var classNameOpts = {
- value: value.slice(1),
- source: source,
- sourceIndex: sourceIndex
- };
- node = new _className["default"](unescapeProp(classNameOpts, "value"));
- } else if (~hasId.indexOf(ind)) {
- var idOpts = {
- value: value.slice(1),
- source: source,
- sourceIndex: sourceIndex
- };
- node = new _id["default"](unescapeProp(idOpts, "value"));
- } else {
- var tagOpts = {
- value: value,
- source: source,
- sourceIndex: sourceIndex
- };
- unescapeProp(tagOpts, "value");
- node = new _tag["default"](tagOpts);
- }
- _this5.newNode(node, namespace); // Ensure that the namespace is used only once
- namespace = null;
- });
- this.position++;
- };
- _proto.word = function word(namespace) {
- var nextToken = this.nextToken;
- if (nextToken && this.content(nextToken) === '|') {
- this.position++;
- return this.namespace();
- }
- return this.splitWord(namespace);
- };
- _proto.loop = function loop() {
- while (this.position < this.tokens.length) {
- this.parse(true);
- }
- this.current._inferEndPosition();
- return this.root;
- };
- _proto.parse = function parse(throwOnParenthesis) {
- switch (this.currToken[_tokenize.FIELDS.TYPE]) {
- case tokens.space:
- this.space();
- break;
- case tokens.comment:
- this.comment();
- break;
- case tokens.openParenthesis:
- this.parentheses();
- break;
- case tokens.closeParenthesis:
- if (throwOnParenthesis) {
- this.missingParenthesis();
- }
- break;
- case tokens.openSquare:
- this.attribute();
- break;
- case tokens.dollar:
- case tokens.caret:
- case tokens.equals:
- case tokens.word:
- this.word();
- break;
- case tokens.colon:
- this.pseudo();
- break;
- case tokens.comma:
- this.comma();
- break;
- case tokens.asterisk:
- this.universal();
- break;
- case tokens.ampersand:
- this.nesting();
- break;
- case tokens.slash:
- case tokens.combinator:
- this.combinator();
- break;
- case tokens.str:
- this.string();
- break;
- // These cases throw; no break needed.
- case tokens.closeSquare:
- this.missingSquareBracket();
- case tokens.semicolon:
- this.missingBackslash();
- default:
- this.unexpected();
- }
- }
- /**
- * Helpers
- */
- ;
- _proto.expected = function expected(description, index, found) {
- if (Array.isArray(description)) {
- var last = description.pop();
- description = description.join(', ') + " or " + last;
- }
- var an = /^[aeiou]/.test(description[0]) ? 'an' : 'a';
- if (!found) {
- return this.error("Expected " + an + " " + description + ".", {
- index: index
- });
- }
- return this.error("Expected " + an + " " + description + ", found \"" + found + "\" instead.", {
- index: index
- });
- };
- _proto.requiredSpace = function requiredSpace(space) {
- return this.options.lossy ? ' ' : space;
- };
- _proto.optionalSpace = function optionalSpace(space) {
- return this.options.lossy ? '' : space;
- };
- _proto.lossySpace = function lossySpace(space, required) {
- if (this.options.lossy) {
- return required ? ' ' : '';
- } else {
- return space;
- }
- };
- _proto.parseParenthesisToken = function parseParenthesisToken(token) {
- var content = this.content(token);
- if (token[_tokenize.FIELDS.TYPE] === tokens.space) {
- return this.requiredSpace(content);
- } else {
- return content;
- }
- };
- _proto.newNode = function newNode(node, namespace) {
- if (namespace) {
- if (/^ +$/.test(namespace)) {
- if (!this.options.lossy) {
- this.spaces = (this.spaces || '') + namespace;
- }
- namespace = true;
- }
- node.namespace = namespace;
- unescapeProp(node, "namespace");
- }
- if (this.spaces) {
- node.spaces.before = this.spaces;
- this.spaces = '';
- }
- return this.current.append(node);
- };
- _proto.content = function content(token) {
- if (token === void 0) {
- token = this.currToken;
- }
- return this.css.slice(token[_tokenize.FIELDS.START_POS], token[_tokenize.FIELDS.END_POS]);
- };
- /**
- * returns the index of the next non-whitespace, non-comment token.
- * returns -1 if no meaningful token is found.
- */
- _proto.locateNextMeaningfulToken = function locateNextMeaningfulToken(startPosition) {
- if (startPosition === void 0) {
- startPosition = this.position + 1;
- }
- var searchPosition = startPosition;
- while (searchPosition < this.tokens.length) {
- if (WHITESPACE_EQUIV_TOKENS[this.tokens[searchPosition][_tokenize.FIELDS.TYPE]]) {
- searchPosition++;
- continue;
- } else {
- return searchPosition;
- }
- }
- return -1;
- };
- _createClass(Parser, [{
- key: "currToken",
- get: function get() {
- return this.tokens[this.position];
- }
- }, {
- key: "nextToken",
- get: function get() {
- return this.tokens[this.position + 1];
- }
- }, {
- key: "prevToken",
- get: function get() {
- return this.tokens[this.position - 1];
- }
- }]);
- return Parser;
- }();
- exports["default"] = Parser;
- module.exports = exports.default;
- });
- var processor = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = void 0;
- var _parser = _interopRequireDefault(parser);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- var Processor = /*#__PURE__*/function () {
- function Processor(func, options) {
- this.func = func || function noop() {};
- this.funcRes = null;
- this.options = options;
- }
- var _proto = Processor.prototype;
- _proto._shouldUpdateSelector = function _shouldUpdateSelector(rule, options) {
- if (options === void 0) {
- options = {};
- }
- var merged = Object.assign({}, this.options, options);
- if (merged.updateSelector === false) {
- return false;
- } else {
- return typeof rule !== "string";
- }
- };
- _proto._isLossy = function _isLossy(options) {
- if (options === void 0) {
- options = {};
- }
- var merged = Object.assign({}, this.options, options);
- if (merged.lossless === false) {
- return true;
- } else {
- return false;
- }
- };
- _proto._root = function _root(rule, options) {
- if (options === void 0) {
- options = {};
- }
- var parser = new _parser["default"](rule, this._parseOptions(options));
- return parser.root;
- };
- _proto._parseOptions = function _parseOptions(options) {
- return {
- lossy: this._isLossy(options)
- };
- };
- _proto._run = function _run(rule, options) {
- var _this = this;
- if (options === void 0) {
- options = {};
- }
- return new Promise(function (resolve, reject) {
- try {
- var root = _this._root(rule, options);
- Promise.resolve(_this.func(root)).then(function (transform) {
- var string = undefined;
- if (_this._shouldUpdateSelector(rule, options)) {
- string = root.toString();
- rule.selector = string;
- }
- return {
- transform: transform,
- root: root,
- string: string
- };
- }).then(resolve, reject);
- } catch (e) {
- reject(e);
- return;
- }
- });
- };
- _proto._runSync = function _runSync(rule, options) {
- if (options === void 0) {
- options = {};
- }
- var root = this._root(rule, options);
- var transform = this.func(root);
- if (transform && typeof transform.then === "function") {
- throw new Error("Selector processor returned a promise to a synchronous call.");
- }
- var string = undefined;
- if (options.updateSelector && typeof rule !== "string") {
- string = root.toString();
- rule.selector = string;
- }
- return {
- transform: transform,
- root: root,
- string: string
- };
- }
- /**
- * Process rule into a selector AST.
- *
- * @param rule {postcss.Rule | string} The css selector to be processed
- * @param options The options for processing
- * @returns {Promise<parser.Root>} The AST of the selector after processing it.
- */
- ;
- _proto.ast = function ast(rule, options) {
- return this._run(rule, options).then(function (result) {
- return result.root;
- });
- }
- /**
- * Process rule into a selector AST synchronously.
- *
- * @param rule {postcss.Rule | string} The css selector to be processed
- * @param options The options for processing
- * @returns {parser.Root} The AST of the selector after processing it.
- */
- ;
- _proto.astSync = function astSync(rule, options) {
- return this._runSync(rule, options).root;
- }
- /**
- * Process a selector into a transformed value asynchronously
- *
- * @param rule {postcss.Rule | string} The css selector to be processed
- * @param options The options for processing
- * @returns {Promise<any>} The value returned by the processor.
- */
- ;
- _proto.transform = function transform(rule, options) {
- return this._run(rule, options).then(function (result) {
- return result.transform;
- });
- }
- /**
- * Process a selector into a transformed value synchronously.
- *
- * @param rule {postcss.Rule | string} The css selector to be processed
- * @param options The options for processing
- * @returns {any} The value returned by the processor.
- */
- ;
- _proto.transformSync = function transformSync(rule, options) {
- return this._runSync(rule, options).transform;
- }
- /**
- * Process a selector into a new selector string asynchronously.
- *
- * @param rule {postcss.Rule | string} The css selector to be processed
- * @param options The options for processing
- * @returns {string} the selector after processing.
- */
- ;
- _proto.process = function process(rule, options) {
- return this._run(rule, options).then(function (result) {
- return result.string || result.root.toString();
- });
- }
- /**
- * Process a selector into a new selector string synchronously.
- *
- * @param rule {postcss.Rule | string} The css selector to be processed
- * @param options The options for processing
- * @returns {string} the selector after processing.
- */
- ;
- _proto.processSync = function processSync(rule, options) {
- var result = this._runSync(rule, options);
- return result.string || result.root.toString();
- };
- return Processor;
- }();
- exports["default"] = Processor;
- module.exports = exports.default;
- });
- var constructors = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- 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;
- var _attribute = _interopRequireDefault(attribute);
- var _className = _interopRequireDefault(className);
- var _combinator = _interopRequireDefault(combinator);
- var _comment = _interopRequireDefault(comment);
- var _id = _interopRequireDefault(id);
- var _nesting = _interopRequireDefault(nesting);
- var _pseudo = _interopRequireDefault(pseudo);
- var _root = _interopRequireDefault(root);
- var _selector = _interopRequireDefault(selector);
- var _string = _interopRequireDefault(string);
- var _tag = _interopRequireDefault(tag);
- var _universal = _interopRequireDefault(universal);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- var attribute$1 = function attribute(opts) {
- return new _attribute["default"](opts);
- };
- exports.attribute = attribute$1;
- var className$1 = function className(opts) {
- return new _className["default"](opts);
- };
- exports.className = className$1;
- var combinator$1 = function combinator(opts) {
- return new _combinator["default"](opts);
- };
- exports.combinator = combinator$1;
- var comment$1 = function comment(opts) {
- return new _comment["default"](opts);
- };
- exports.comment = comment$1;
- var id$1 = function id(opts) {
- return new _id["default"](opts);
- };
- exports.id = id$1;
- var nesting$1 = function nesting(opts) {
- return new _nesting["default"](opts);
- };
- exports.nesting = nesting$1;
- var pseudo$1 = function pseudo(opts) {
- return new _pseudo["default"](opts);
- };
- exports.pseudo = pseudo$1;
- var root$1 = function root(opts) {
- return new _root["default"](opts);
- };
- exports.root = root$1;
- var selector$1 = function selector(opts) {
- return new _selector["default"](opts);
- };
- exports.selector = selector$1;
- var string$1 = function string(opts) {
- return new _string["default"](opts);
- };
- exports.string = string$1;
- var tag$1 = function tag(opts) {
- return new _tag["default"](opts);
- };
- exports.tag = tag$1;
- var universal$1 = function universal(opts) {
- return new _universal["default"](opts);
- };
- exports.universal = universal$1;
- });
- var guards = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.isNode = isNode;
- exports.isPseudoElement = isPseudoElement;
- exports.isPseudoClass = isPseudoClass;
- exports.isContainer = isContainer;
- exports.isNamespace = isNamespace;
- 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;
- var _IS_TYPE;
- 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);
- function isNode(node) {
- return typeof node === "object" && IS_TYPE[node.type];
- }
- function isNodeType(type, node) {
- return isNode(node) && node.type === type;
- }
- var isAttribute = isNodeType.bind(null, types.ATTRIBUTE);
- exports.isAttribute = isAttribute;
- var isClassName = isNodeType.bind(null, types.CLASS);
- exports.isClassName = isClassName;
- var isCombinator = isNodeType.bind(null, types.COMBINATOR);
- exports.isCombinator = isCombinator;
- var isComment = isNodeType.bind(null, types.COMMENT);
- exports.isComment = isComment;
- var isIdentifier = isNodeType.bind(null, types.ID);
- exports.isIdentifier = isIdentifier;
- var isNesting = isNodeType.bind(null, types.NESTING);
- exports.isNesting = isNesting;
- var isPseudo = isNodeType.bind(null, types.PSEUDO);
- exports.isPseudo = isPseudo;
- var isRoot = isNodeType.bind(null, types.ROOT);
- exports.isRoot = isRoot;
- var isSelector = isNodeType.bind(null, types.SELECTOR);
- exports.isSelector = isSelector;
- var isString = isNodeType.bind(null, types.STRING);
- exports.isString = isString;
- var isTag = isNodeType.bind(null, types.TAG);
- exports.isTag = isTag;
- var isUniversal = isNodeType.bind(null, types.UNIVERSAL);
- exports.isUniversal = isUniversal;
- function isPseudoElement(node) {
- return isPseudo(node) && node.value && (node.value.startsWith("::") || node.value.toLowerCase() === ":before" || node.value.toLowerCase() === ":after");
- }
- function isPseudoClass(node) {
- return isPseudo(node) && !isPseudoElement(node);
- }
- function isContainer(node) {
- return !!(isNode(node) && node.walk);
- }
- function isNamespace(node) {
- return isAttribute(node) || isTag(node);
- }
- });
- var selectors = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- Object.keys(types).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === types[key]) return;
- exports[key] = types[key];
- });
- Object.keys(constructors).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === constructors[key]) return;
- exports[key] = constructors[key];
- });
- Object.keys(guards).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === guards[key]) return;
- exports[key] = guards[key];
- });
- });
- var dist = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = void 0;
- var _processor = _interopRequireDefault(processor);
- var selectors$1 = _interopRequireWildcard(selectors);
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
- 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; }
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- var parser = function parser(processor) {
- return new _processor["default"](processor);
- };
- Object.assign(parser, selectors$1);
- delete parser.__esModule;
- var _default = parser;
- exports["default"] = _default;
- module.exports = exports.default;
- });
- var selectorParser = /*@__PURE__*/getDefaultExportFromCjs(dist);
- const animationNameRE = /^(-\w+-)?animation-name$/;
- const animationRE = /^(-\w+-)?animation$/;
- const scopedPlugin = (id = '') => {
- const keyframes = Object.create(null);
- const shortId = id.replace(/^data-v-/, '');
- return {
- postcssPlugin: 'vue-sfc-scoped',
- Rule(rule) {
- processRule(id, rule);
- },
- AtRule(node) {
- if (/-?keyframes$/.test(node.name) &&
- !node.params.endsWith(`-${shortId}`)) {
- // register keyframes
- keyframes[node.params] = node.params = node.params + '-' + shortId;
- }
- },
- OnceExit(root) {
- if (Object.keys(keyframes).length) {
- // If keyframes are found in this <style>, find and rewrite animation names
- // in declarations.
- // Caveat: this only works for keyframes and animation rules in the same
- // <style> element.
- // individual animation-name declaration
- root.walkDecls(decl => {
- if (animationNameRE.test(decl.prop)) {
- decl.value = decl.value
- .split(',')
- .map(v => keyframes[v.trim()] || v.trim())
- .join(',');
- }
- // shorthand
- if (animationRE.test(decl.prop)) {
- decl.value = decl.value
- .split(',')
- .map(v => {
- const vals = v.trim().split(/\s+/);
- const i = vals.findIndex(val => keyframes[val]);
- if (i !== -1) {
- vals.splice(i, 1, keyframes[vals[i]]);
- return vals.join(' ');
- }
- else {
- return v;
- }
- })
- .join(',');
- }
- });
- }
- }
- };
- };
- const processedRules = new WeakSet();
- function processRule(id, rule) {
- if (processedRules.has(rule) ||
- (rule.parent &&
- rule.parent.type === 'atrule' &&
- /-?keyframes$/.test(rule.parent.name))) {
- return;
- }
- processedRules.add(rule);
- rule.selector = selectorParser(selectorRoot => {
- selectorRoot.each(selector => {
- rewriteSelector(id, selector, selectorRoot);
- });
- }).processSync(rule.selector);
- }
- function rewriteSelector(id, selector, selectorRoot, slotted = false) {
- let node = null;
- let shouldInject = true;
- // find the last child node to insert attribute selector
- selector.each(n => {
- // DEPRECATED ">>>" and "/deep/" combinator
- if (n.type === 'combinator' &&
- (n.value === '>>>' || n.value === '/deep/')) {
- n.value = ' ';
- n.spaces.before = n.spaces.after = '';
- warn(`the >>> and /deep/ combinators have been deprecated. ` +
- `Use :deep() instead.`);
- return false;
- }
- if (n.type === 'pseudo') {
- const { value } = n;
- // deep: inject [id] attribute at the node before the ::v-deep
- // combinator.
- if (value === ':deep' || value === '::v-deep') {
- if (n.nodes.length) {
- // .foo ::v-deep(.bar) -> .foo[xxxxxxx] .bar
- // replace the current node with ::v-deep's inner selector
- let last = n;
- n.nodes[0].each(ss => {
- selector.insertAfter(last, ss);
- last = ss;
- });
- // insert a space combinator before if it doesn't already have one
- const prev = selector.at(selector.index(n) - 1);
- if (!prev || !isSpaceCombinator(prev)) {
- selector.insertAfter(n, selectorParser.combinator({
- value: ' '
- }));
- }
- selector.removeChild(n);
- }
- else {
- // DEPRECATED usage
- // .foo ::v-deep .bar -> .foo[xxxxxxx] .bar
- warn(`::v-deep usage as a combinator has ` +
- `been deprecated. Use :deep(<inner-selector>) instead.`);
- const prev = selector.at(selector.index(n) - 1);
- if (prev && isSpaceCombinator(prev)) {
- selector.removeChild(prev);
- }
- selector.removeChild(n);
- }
- return false;
- }
- // slot: use selector inside `::v-slotted` and inject [id + '-s']
- // instead.
- // ::v-slotted(.foo) -> .foo[xxxxxxx-s]
- if (value === ':slotted' || value === '::v-slotted') {
- rewriteSelector(id, n.nodes[0], selectorRoot, true /* slotted */);
- let last = n;
- n.nodes[0].each(ss => {
- selector.insertAfter(last, ss);
- last = ss;
- });
- // selector.insertAfter(n, n.nodes[0])
- selector.removeChild(n);
- // since slotted attribute already scopes the selector there's no
- // need for the non-slot attribute.
- shouldInject = false;
- return false;
- }
- // global: replace with inner selector and do not inject [id].
- // ::v-global(.foo) -> .foo
- if (value === ':global' || value === '::v-global') {
- selectorRoot.insertAfter(selector, n.nodes[0]);
- selectorRoot.removeChild(selector);
- return false;
- }
- }
- if (n.type !== 'pseudo' && n.type !== 'combinator') {
- node = n;
- }
- });
- if (node) {
- node.spaces.after = '';
- }
- else {
- // For deep selectors & standalone pseudo selectors,
- // the attribute selectors are prepended rather than appended.
- // So all leading spaces must be eliminated to avoid problems.
- selector.first.spaces.before = '';
- }
- if (shouldInject) {
- const idToAdd = slotted ? id + '-s' : id;
- selector.insertAfter(
- // If node is null it means we need to inject [id] at the start
- // insertAfter can handle `null` here
- node, selectorParser.attribute({
- attribute: idToAdd,
- value: idToAdd,
- raws: {},
- quoteMark: `"`
- }));
- }
- }
- function isSpaceCombinator(node) {
- return node.type === 'combinator' && /^\s+$/.test(node.value);
- }
- scopedPlugin.postcss = true;
- var SourceMapConsumer = sourceMap__default.SourceMapConsumer;
- var SourceMapGenerator = sourceMap__default.SourceMapGenerator;
- var mergeSourceMap = merge$1;
- /**
- * Merge old source map and new source map and return merged.
- * If old or new source map value is falsy, return another one as it is.
- *
- * @param {object|string} [oldMap] old source map object
- * @param {object|string} [newmap] new source map object
- * @return {object|undefined} merged source map object, or undefined when both old and new source map are undefined
- */
- function merge$1(oldMap, newMap) {
- if (!oldMap) return newMap
- if (!newMap) return oldMap
- var oldMapConsumer = new SourceMapConsumer(oldMap);
- var newMapConsumer = new SourceMapConsumer(newMap);
- var mergedMapGenerator = new SourceMapGenerator();
- // iterate on new map and overwrite original position of new map with one of old map
- newMapConsumer.eachMapping(function(m) {
- // pass when `originalLine` is null.
- // It occurs in case that the node does not have origin in original code.
- if (m.originalLine == null) return
- var origPosInOldMap = oldMapConsumer.originalPositionFor({
- line: m.originalLine,
- column: m.originalColumn
- });
- if (origPosInOldMap.source == null) return
- mergedMapGenerator.addMapping({
- original: {
- line: origPosInOldMap.line,
- column: origPosInOldMap.column
- },
- generated: {
- line: m.generatedLine,
- column: m.generatedColumn
- },
- source: origPosInOldMap.source,
- name: origPosInOldMap.name
- });
- });
- var consumers = [oldMapConsumer, newMapConsumer];
- consumers.forEach(function(consumer) {
- consumer.sources.forEach(function(sourceFile) {
- mergedMapGenerator._sources.add(sourceFile);
- var sourceContent = consumer.sourceContentFor(sourceFile);
- if (sourceContent != null) {
- mergedMapGenerator.setSourceContent(sourceFile, sourceContent);
- }
- });
- });
- mergedMapGenerator._sourceRoot = oldMap.sourceRoot;
- mergedMapGenerator._file = oldMap.file;
- return JSON.parse(mergedMapGenerator.toString())
- }
- // .scss/.sass processor
- const scss = (source, map, options, load = require) => {
- const nodeSass = load('sass');
- const finalOptions = {
- ...options,
- data: getSource(source, options.filename, options.additionalData),
- file: options.filename,
- outFile: options.filename,
- sourceMap: !!map
- };
- try {
- const result = nodeSass.renderSync(finalOptions);
- const dependencies = result.stats.includedFiles;
- if (map) {
- return {
- code: result.css.toString(),
- map: mergeSourceMap(map, JSON.parse(result.map.toString())),
- errors: [],
- dependencies
- };
- }
- return { code: result.css.toString(), errors: [], dependencies };
- }
- catch (e) {
- return { code: '', errors: [e], dependencies: [] };
- }
- };
- const sass = (source, map, options, load) => scss(source, map, {
- ...options,
- indentedSyntax: true
- }, load);
- // .less
- const less = (source, map, options, load = require) => {
- const nodeLess = load('less');
- let result;
- let error = null;
- nodeLess.render(getSource(source, options.filename, options.additionalData), { ...options, syncImport: true }, (err, output) => {
- error = err;
- result = output;
- });
- if (error)
- return { code: '', errors: [error], dependencies: [] };
- const dependencies = result.imports;
- if (map) {
- return {
- code: result.css.toString(),
- map: mergeSourceMap(map, result.map),
- errors: [],
- dependencies: dependencies
- };
- }
- return {
- code: result.css.toString(),
- errors: [],
- dependencies: dependencies
- };
- };
- // .styl
- const styl = (source, map, options, load = require) => {
- const nodeStylus = load('stylus');
- try {
- const ref = nodeStylus(source);
- Object.keys(options).forEach(key => ref.set(key, options[key]));
- if (map)
- ref.set('sourcemap', { inline: false, comment: false });
- const result = ref.render();
- const dependencies = ref.deps();
- if (map) {
- return {
- code: result,
- map: mergeSourceMap(map, ref.sourcemap),
- errors: [],
- dependencies
- };
- }
- return { code: result, errors: [], dependencies };
- }
- catch (e) {
- return { code: '', errors: [e], dependencies: [] };
- }
- };
- function getSource(source, filename, additionalData) {
- if (!additionalData)
- return source;
- if (shared.isFunction(additionalData)) {
- return additionalData(source, filename);
- }
- return additionalData + source;
- }
- const processors = {
- less,
- sass,
- scss,
- styl,
- stylus: styl
- };
- /**
- * lodash (Custom Build) <https://lodash.com/>
- * Build: `lodash modularize exports="npm" -o ./`
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
- * Released under MIT license <https://lodash.com/license>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */
- /** Used as references for various `Number` constants. */
- var INFINITY = 1 / 0;
- /** `Object#toString` result references. */
- var symbolTag = '[object Symbol]';
- /** Used to match words composed of alphanumeric characters. */
- var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
- /** Used to match Latin Unicode letters (excluding mathematical operators). */
- var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
- /** Used to compose unicode character classes. */
- var rsAstralRange = '\\ud800-\\udfff',
- rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
- rsComboSymbolsRange = '\\u20d0-\\u20f0',
- rsDingbatRange = '\\u2700-\\u27bf',
- rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
- rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
- rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
- rsPunctuationRange = '\\u2000-\\u206f',
- 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',
- rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
- rsVarRange = '\\ufe0e\\ufe0f',
- rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
- /** Used to compose unicode capture groups. */
- var rsApos = "['\u2019]",
- rsAstral = '[' + rsAstralRange + ']',
- rsBreak = '[' + rsBreakRange + ']',
- rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
- rsDigits = '\\d+',
- rsDingbat = '[' + rsDingbatRange + ']',
- rsLower = '[' + rsLowerRange + ']',
- rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
- rsFitz = '\\ud83c[\\udffb-\\udfff]',
- rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
- rsNonAstral = '[^' + rsAstralRange + ']',
- rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
- rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
- rsUpper = '[' + rsUpperRange + ']',
- rsZWJ = '\\u200d';
- /** Used to compose unicode regexes. */
- var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
- rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
- rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
- rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
- reOptMod = rsModifier + '?',
- rsOptVar = '[' + rsVarRange + ']?',
- rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
- rsSeq = rsOptVar + reOptMod + rsOptJoin,
- rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
- rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
- /** Used to match apostrophes. */
- var reApos = RegExp(rsApos, 'g');
- /**
- * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
- * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
- */
- var reComboMark = RegExp(rsCombo, 'g');
- /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
- var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
- /** Used to match complex or compound words. */
- var reUnicodeWord = RegExp([
- rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
- rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
- rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
- rsUpper + '+' + rsOptUpperContr,
- rsDigits,
- rsEmoji
- ].join('|'), 'g');
- /** 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/). */
- var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
- /** Used to detect strings that need a more robust regexp to match words. */
- 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 ]/;
- /** Used to map Latin Unicode letters to basic Latin letters. */
- var deburredLetters = {
- // Latin-1 Supplement block.
- '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
- '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
- '\xc7': 'C', '\xe7': 'c',
- '\xd0': 'D', '\xf0': 'd',
- '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
- '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
- '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
- '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
- '\xd1': 'N', '\xf1': 'n',
- '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
- '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
- '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
- '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
- '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
- '\xc6': 'Ae', '\xe6': 'ae',
- '\xde': 'Th', '\xfe': 'th',
- '\xdf': 'ss',
- // Latin Extended-A block.
- '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
- '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
- '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
- '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
- '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
- '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
- '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
- '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
- '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
- '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
- '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
- '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
- '\u0134': 'J', '\u0135': 'j',
- '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
- '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
- '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
- '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
- '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
- '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
- '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
- '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
- '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
- '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
- '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
- '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
- '\u0163': 't', '\u0165': 't', '\u0167': 't',
- '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
- '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
- '\u0174': 'W', '\u0175': 'w',
- '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
- '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
- '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
- '\u0132': 'IJ', '\u0133': 'ij',
- '\u0152': 'Oe', '\u0153': 'oe',
- '\u0149': "'n", '\u017f': 'ss'
- };
- /** Detect free variable `global` from Node.js. */
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
- /** Detect free variable `self`. */
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
- /** Used as a reference to the global object. */
- var root$1 = freeGlobal || freeSelf || Function('return this')();
- /**
- * A specialized version of `_.reduce` for arrays without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} [array] The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @param {*} [accumulator] The initial value.
- * @param {boolean} [initAccum] Specify using the first element of `array` as
- * the initial value.
- * @returns {*} Returns the accumulated value.
- */
- function arrayReduce(array, iteratee, accumulator, initAccum) {
- var index = -1,
- length = array ? array.length : 0;
- if (initAccum && length) {
- accumulator = array[++index];
- }
- while (++index < length) {
- accumulator = iteratee(accumulator, array[index], index, array);
- }
- return accumulator;
- }
- /**
- * Converts an ASCII `string` to an array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the converted array.
- */
- function asciiToArray(string) {
- return string.split('');
- }
- /**
- * Splits an ASCII `string` into an array of its words.
- *
- * @private
- * @param {string} The string to inspect.
- * @returns {Array} Returns the words of `string`.
- */
- function asciiWords(string) {
- return string.match(reAsciiWord) || [];
- }
- /**
- * The base implementation of `_.propertyOf` without support for deep paths.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Function} Returns the new accessor function.
- */
- function basePropertyOf(object) {
- return function(key) {
- return object == null ? undefined : object[key];
- };
- }
- /**
- * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
- * letters to basic Latin letters.
- *
- * @private
- * @param {string} letter The matched letter to deburr.
- * @returns {string} Returns the deburred letter.
- */
- var deburrLetter = basePropertyOf(deburredLetters);
- /**
- * Checks if `string` contains Unicode symbols.
- *
- * @private
- * @param {string} string The string to inspect.
- * @returns {boolean} Returns `true` if a symbol is found, else `false`.
- */
- function hasUnicode(string) {
- return reHasUnicode.test(string);
- }
- /**
- * Checks if `string` contains a word composed of Unicode symbols.
- *
- * @private
- * @param {string} string The string to inspect.
- * @returns {boolean} Returns `true` if a word is found, else `false`.
- */
- function hasUnicodeWord(string) {
- return reHasUnicodeWord.test(string);
- }
- /**
- * Converts `string` to an array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the converted array.
- */
- function stringToArray(string) {
- return hasUnicode(string)
- ? unicodeToArray(string)
- : asciiToArray(string);
- }
- /**
- * Converts a Unicode `string` to an array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the converted array.
- */
- function unicodeToArray(string) {
- return string.match(reUnicode) || [];
- }
- /**
- * Splits a Unicode `string` into an array of its words.
- *
- * @private
- * @param {string} The string to inspect.
- * @returns {Array} Returns the words of `string`.
- */
- function unicodeWords(string) {
- return string.match(reUnicodeWord) || [];
- }
- /** Used for built-in method references. */
- var objectProto = Object.prototype;
- /**
- * Used to resolve the
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objectToString = objectProto.toString;
- /** Built-in value references. */
- var Symbol$1 = root$1.Symbol;
- /** Used to convert symbols to primitives and strings. */
- var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
- symbolToString = symbolProto ? symbolProto.toString : undefined;
- /**
- * The base implementation of `_.slice` without an iteratee call guard.
- *
- * @private
- * @param {Array} array The array to slice.
- * @param {number} [start=0] The start position.
- * @param {number} [end=array.length] The end position.
- * @returns {Array} Returns the slice of `array`.
- */
- function baseSlice(array, start, end) {
- var index = -1,
- length = array.length;
- if (start < 0) {
- start = -start > length ? 0 : (length + start);
- }
- end = end > length ? length : end;
- if (end < 0) {
- end += length;
- }
- length = start > end ? 0 : ((end - start) >>> 0);
- start >>>= 0;
- var result = Array(length);
- while (++index < length) {
- result[index] = array[index + start];
- }
- return result;
- }
- /**
- * The base implementation of `_.toString` which doesn't convert nullish
- * values to empty strings.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- */
- function baseToString(value) {
- // Exit early for strings to avoid a performance hit in some environments.
- if (typeof value == 'string') {
- return value;
- }
- if (isSymbol(value)) {
- return symbolToString ? symbolToString.call(value) : '';
- }
- var result = (value + '');
- return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
- }
- /**
- * Casts `array` to a slice if it's needed.
- *
- * @private
- * @param {Array} array The array to inspect.
- * @param {number} start The start position.
- * @param {number} [end=array.length] The end position.
- * @returns {Array} Returns the cast slice.
- */
- function castSlice(array, start, end) {
- var length = array.length;
- end = end === undefined ? length : end;
- return (!start && end >= length) ? array : baseSlice(array, start, end);
- }
- /**
- * Creates a function like `_.lowerFirst`.
- *
- * @private
- * @param {string} methodName The name of the `String` case method to use.
- * @returns {Function} Returns the new case function.
- */
- function createCaseFirst(methodName) {
- return function(string) {
- string = toString$1(string);
- var strSymbols = hasUnicode(string)
- ? stringToArray(string)
- : undefined;
- var chr = strSymbols
- ? strSymbols[0]
- : string.charAt(0);
- var trailing = strSymbols
- ? castSlice(strSymbols, 1).join('')
- : string.slice(1);
- return chr[methodName]() + trailing;
- };
- }
- /**
- * Creates a function like `_.camelCase`.
- *
- * @private
- * @param {Function} callback The function to combine each word.
- * @returns {Function} Returns the new compounder function.
- */
- function createCompounder(callback) {
- return function(string) {
- return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
- };
- }
- /**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
- function isObjectLike(value) {
- return !!value && typeof value == 'object';
- }
- /**
- * Checks if `value` is classified as a `Symbol` primitive or object.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
- * @example
- *
- * _.isSymbol(Symbol.iterator);
- * // => true
- *
- * _.isSymbol('abc');
- * // => false
- */
- function isSymbol(value) {
- return typeof value == 'symbol' ||
- (isObjectLike(value) && objectToString.call(value) == symbolTag);
- }
- /**
- * Converts `value` to a string. An empty string is returned for `null`
- * and `undefined` values. The sign of `-0` is preserved.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category Lang
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- * @example
- *
- * _.toString(null);
- * // => ''
- *
- * _.toString(-0);
- * // => '-0'
- *
- * _.toString([1, 2, 3]);
- * // => '1,2,3'
- */
- function toString$1(value) {
- return value == null ? '' : baseToString(value);
- }
- /**
- * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to convert.
- * @returns {string} Returns the camel cased string.
- * @example
- *
- * _.camelCase('Foo Bar');
- * // => 'fooBar'
- *
- * _.camelCase('--foo-bar--');
- * // => 'fooBar'
- *
- * _.camelCase('__FOO_BAR__');
- * // => 'fooBar'
- */
- var camelCase = createCompounder(function(result, word, index) {
- word = word.toLowerCase();
- return result + (index ? capitalize(word) : word);
- });
- /**
- * Converts the first character of `string` to upper case and the remaining
- * to lower case.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to capitalize.
- * @returns {string} Returns the capitalized string.
- * @example
- *
- * _.capitalize('FRED');
- * // => 'Fred'
- */
- function capitalize(string) {
- return upperFirst(toString$1(string).toLowerCase());
- }
- /**
- * Deburrs `string` by converting
- * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
- * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
- * letters to basic Latin letters and removing
- * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to deburr.
- * @returns {string} Returns the deburred string.
- * @example
- *
- * _.deburr('déjà vu');
- * // => 'deja vu'
- */
- function deburr(string) {
- string = toString$1(string);
- return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
- }
- /**
- * Converts the first character of `string` to upper case.
- *
- * @static
- * @memberOf _
- * @since 4.0.0
- * @category String
- * @param {string} [string=''] The string to convert.
- * @returns {string} Returns the converted string.
- * @example
- *
- * _.upperFirst('fred');
- * // => 'Fred'
- *
- * _.upperFirst('FRED');
- * // => 'FRED'
- */
- var upperFirst = createCaseFirst('toUpperCase');
- /**
- * Splits `string` into an array of its words.
- *
- * @static
- * @memberOf _
- * @since 3.0.0
- * @category String
- * @param {string} [string=''] The string to inspect.
- * @param {RegExp|string} [pattern] The pattern to match words.
- * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {Array} Returns the words of `string`.
- * @example
- *
- * _.words('fred, barney, & pebbles');
- * // => ['fred', 'barney', 'pebbles']
- *
- * _.words('fred, barney, & pebbles', /[^, ]+/g);
- * // => ['fred', 'barney', '&', 'pebbles']
- */
- function words(string, pattern, guard) {
- string = toString$1(string);
- pattern = guard ? undefined : pattern;
- if (pattern === undefined) {
- return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
- }
- return string.match(pattern) || [];
- }
- var lodash_camelcase = camelCase;
- var unicode = createCommonjsModule(function (module, exports) {
- 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]/;
- });
- 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)}
- var util$1 = /*#__PURE__*/Object.defineProperty({
- isSpaceSeparator: isSpaceSeparator_1,
- isIdStartChar: isIdStartChar_1,
- isIdContinueChar: isIdContinueChar_1,
- isDigit: isDigit_1,
- isHexDigit: isHexDigit_1
- }, '__esModule', {value: true});
- var parse_1 = createCommonjsModule(function (module, exports) {
- 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'];
- });
- var stringify_1 = createCommonjsModule(function (module, exports) {
- 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'];
- });
- var lib = createCommonjsModule(function (module, exports) {
- 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'];
- });
- const specialValues = {
- null: null,
- true: true,
- false: false,
- };
- function parseQuery(query) {
- if (query.substr(0, 1) !== '?') {
- throw new Error(
- "A valid query string passed to parseQuery should begin with '?'"
- );
- }
- query = query.substr(1);
- if (!query) {
- return {};
- }
- if (query.substr(0, 1) === '{' && query.substr(-1) === '}') {
- return lib.parse(query);
- }
- const queryArgs = query.split(/[,&]/g);
- const result = {};
- queryArgs.forEach((arg) => {
- const idx = arg.indexOf('=');
- if (idx >= 0) {
- let name = arg.substr(0, idx);
- let value = decodeURIComponent(arg.substr(idx + 1));
- if (specialValues.hasOwnProperty(value)) {
- value = specialValues[value];
- }
- if (name.substr(-2) === '[]') {
- name = decodeURIComponent(name.substr(0, name.length - 2));
- if (!Array.isArray(result[name])) {
- result[name] = [];
- }
- result[name].push(value);
- } else {
- name = decodeURIComponent(name);
- result[name] = value;
- }
- } else {
- if (arg.substr(0, 1) === '-') {
- result[decodeURIComponent(arg.substr(1))] = false;
- } else if (arg.substr(0, 1) === '+') {
- result[decodeURIComponent(arg.substr(1))] = true;
- } else {
- result[decodeURIComponent(arg)] = true;
- }
- }
- });
- return result;
- }
- var parseQuery_1 = parseQuery;
- function getOptions(loaderContext) {
- const query = loaderContext.query;
- if (typeof query === 'string' && query !== '') {
- return parseQuery_1(loaderContext.query);
- }
- if (!query || typeof query !== 'object') {
- // Not object-like queries are not supported.
- return null;
- }
- return query;
- }
- var getOptions_1 = getOptions;
- const matchRelativePath = /^\.\.?[/\\]/;
- function isAbsolutePath(str) {
- return path__default.posix.isAbsolute(str) || path__default.win32.isAbsolute(str);
- }
- function isRelativePath(str) {
- return matchRelativePath.test(str);
- }
- function stringifyRequest(loaderContext, request) {
- const splitted = request.split('!');
- const context =
- loaderContext.context ||
- (loaderContext.options && loaderContext.options.context);
- return JSON.stringify(
- splitted
- .map((part) => {
- // First, separate singlePath from query, because the query might contain paths again
- const splittedPart = part.match(/^(.*?)(\?.*)/);
- const query = splittedPart ? splittedPart[2] : '';
- let singlePath = splittedPart ? splittedPart[1] : part;
- if (isAbsolutePath(singlePath) && context) {
- singlePath = path__default.relative(context, singlePath);
- if (isAbsolutePath(singlePath)) {
- // If singlePath still matches an absolute path, singlePath was on a different drive than context.
- // In this case, we leave the path platform-specific without replacing any separators.
- // @see https://github.com/webpack/loader-utils/pull/14
- return singlePath + query;
- }
- if (isRelativePath(singlePath) === false) {
- // Ensure that the relative path starts at least with ./ otherwise it would be a request into the modules directory (like node_modules).
- singlePath = './' + singlePath;
- }
- }
- return singlePath.replace(/\\/g, '/') + query;
- })
- .join('!')
- );
- }
- var stringifyRequest_1 = stringifyRequest;
- function getRemainingRequest(loaderContext) {
- if (loaderContext.remainingRequest) {
- return loaderContext.remainingRequest;
- }
- const request = loaderContext.loaders
- .slice(loaderContext.loaderIndex + 1)
- .map((obj) => obj.request)
- .concat([loaderContext.resource]);
- return request.join('!');
- }
- var getRemainingRequest_1 = getRemainingRequest;
- function getCurrentRequest(loaderContext) {
- if (loaderContext.currentRequest) {
- return loaderContext.currentRequest;
- }
- const request = loaderContext.loaders
- .slice(loaderContext.loaderIndex)
- .map((obj) => obj.request)
- .concat([loaderContext.resource]);
- return request.join('!');
- }
- var getCurrentRequest_1 = getCurrentRequest;
- function isUrlRequest(url, root) {
- // An URL is not an request if
- // 1. It's an absolute url and it is not `windows` path like `C:\dir\file`
- if (/^[a-z][a-z0-9+.-]*:/i.test(url) && !path__default.win32.isAbsolute(url)) {
- return false;
- }
- // 2. It's a protocol-relative
- if (/^\/\//.test(url)) {
- return false;
- }
- // 3. It's some kind of url for a template
- if (/^[{}[\]#*;,'§$%&(=?`´^°<>]/.test(url)) {
- return false;
- }
- // 4. It's also not an request if root isn't set and it's a root-relative url
- if ((root === undefined || root === false) && /^\//.test(url)) {
- return false;
- }
- return true;
- }
- var isUrlRequest_1 = isUrlRequest;
- // we can't use path.win32.isAbsolute because it also matches paths starting with a forward slash
- const matchNativeWin32Path = /^[A-Z]:[/\\]|^\\\\/i;
- function urlToRequest(url, root) {
- // Do not rewrite an empty url
- if (url === '') {
- return '';
- }
- const moduleRequestRegex = /^[^?]*~/;
- let request;
- if (matchNativeWin32Path.test(url)) {
- // absolute windows path, keep it
- request = url;
- } else if (root !== undefined && root !== false && /^\//.test(url)) {
- // if root is set and the url is root-relative
- switch (typeof root) {
- // 1. root is a string: root is prefixed to the url
- case 'string':
- // special case: `~` roots convert to module request
- if (moduleRequestRegex.test(root)) {
- request = root.replace(/([^~/])$/, '$1/') + url.slice(1);
- } else {
- request = root + url;
- }
- break;
- // 2. root is `true`: absolute paths are allowed
- // *nix only, windows-style absolute paths are always allowed as they doesn't start with a `/`
- case 'boolean':
- request = url;
- break;
- default:
- throw new Error(
- "Unexpected parameters to loader-utils 'urlToRequest': url = " +
- url +
- ', root = ' +
- root +
- '.'
- );
- }
- } else if (/^\.\.?\//.test(url)) {
- // A relative url stays
- request = url;
- } else {
- // every other url is threaded like a relative url
- request = './' + url;
- }
- // A `~` makes the url an module
- if (moduleRequestRegex.test(request)) {
- request = request.replace(moduleRequestRegex, '');
- }
- return request;
- }
- var urlToRequest_1 = urlToRequest;
- function parseString(str) {
- try {
- if (str[0] === '"') {
- return JSON.parse(str);
- }
- if (str[0] === "'" && str.substr(str.length - 1) === "'") {
- return parseString(
- str
- .replace(/\\.|"/g, (x) => (x === '"' ? '\\"' : x))
- .replace(/^'|'$/g, '"')
- );
- }
- return JSON.parse('"' + str + '"');
- } catch (e) {
- return str;
- }
- }
- var parseString_1 = parseString;
- /*
- * big.js v5.2.2
- * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
- * Copyright (c) 2018 Michael Mclaughlin <M8ch88l@gmail.com>
- * https://github.com/MikeMcl/big.js/LICENCE
- */
- /************************************** EDITABLE DEFAULTS *****************************************/
- // The default values below must be integers within the stated ranges.
- /*
- * The maximum number of decimal places (DP) of the results of operations involving division:
- * div and sqrt, and pow with negative exponents.
- */
- var DP = 20, // 0 to MAX_DP
- /*
- * The rounding mode (RM) used when rounding to the above decimal places.
- *
- * 0 Towards zero (i.e. truncate, no rounding). (ROUND_DOWN)
- * 1 To nearest neighbour. If equidistant, round up. (ROUND_HALF_UP)
- * 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN)
- * 3 Away from zero. (ROUND_UP)
- */
- RM = 1, // 0, 1, 2 or 3
- // The maximum value of DP and Big.DP.
- MAX_DP = 1E6, // 0 to 1000000
- // The maximum magnitude of the exponent argument to the pow method.
- MAX_POWER = 1E6, // 1 to 1000000
- /*
- * The negative exponent (NE) at and beneath which toString returns exponential notation.
- * (JavaScript numbers: -7)
- * -1000000 is the minimum recommended exponent value of a Big.
- */
- NE = -7, // 0 to -1000000
- /*
- * The positive exponent (PE) at and above which toString returns exponential notation.
- * (JavaScript numbers: 21)
- * 1000000 is the maximum recommended exponent value of a Big.
- * (This limit is not enforced or checked.)
- */
- PE = 21, // 0 to 1000000
- /**************************************************************************************************/
- // Error messages.
- NAME = '[big.js] ',
- INVALID = NAME + 'Invalid ',
- INVALID_DP = INVALID + 'decimal places',
- INVALID_RM = INVALID + 'rounding mode',
- DIV_BY_ZERO = NAME + 'Division by zero',
- // The shared prototype object.
- P = {},
- UNDEFINED = void 0,
- NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
- /*
- * Create and return a Big constructor.
- *
- */
- function _Big_() {
- /*
- * The Big constructor and exported function.
- * Create and return a new instance of a Big number object.
- *
- * n {number|string|Big} A numeric value.
- */
- function Big(n) {
- var x = this;
- // Enable constructor usage without new.
- if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n);
- // Duplicate.
- if (n instanceof Big) {
- x.s = n.s;
- x.e = n.e;
- x.c = n.c.slice();
- } else {
- parse$1(x, n);
- }
- /*
- * Retain a reference to this Big constructor, and shadow Big.prototype.constructor which
- * points to Object.
- */
- x.constructor = Big;
- }
- Big.prototype = P;
- Big.DP = DP;
- Big.RM = RM;
- Big.NE = NE;
- Big.PE = PE;
- Big.version = '5.2.2';
- return Big;
- }
- /*
- * Parse the number or string value passed to a Big constructor.
- *
- * x {Big} A Big number instance.
- * n {number|string} A numeric value.
- */
- function parse$1(x, n) {
- var e, i, nl;
- // Minus zero?
- if (n === 0 && 1 / n < 0) n = '-0';
- else if (!NUMERIC.test(n += '')) throw Error(INVALID + 'number');
- // Determine sign.
- x.s = n.charAt(0) == '-' ? (n = n.slice(1), -1) : 1;
- // Decimal point?
- if ((e = n.indexOf('.')) > -1) n = n.replace('.', '');
- // Exponential form?
- if ((i = n.search(/e/i)) > 0) {
- // Determine exponent.
- if (e < 0) e = i;
- e += +n.slice(i + 1);
- n = n.substring(0, i);
- } else if (e < 0) {
- // Integer.
- e = n.length;
- }
- nl = n.length;
- // Determine leading zeros.
- for (i = 0; i < nl && n.charAt(i) == '0';) ++i;
- if (i == nl) {
- // Zero.
- x.c = [x.e = 0];
- } else {
- // Determine trailing zeros.
- for (; nl > 0 && n.charAt(--nl) == '0';);
- x.e = e - i - 1;
- x.c = [];
- // Convert string to array of digits without leading/trailing zeros.
- for (e = 0; i <= nl;) x.c[e++] = +n.charAt(i++);
- }
- return x;
- }
- /*
- * Round Big x to a maximum of dp decimal places using rounding mode rm.
- * Called by stringify, P.div, P.round and P.sqrt.
- *
- * x {Big} The Big to round.
- * dp {number} Integer, 0 to MAX_DP inclusive.
- * rm {number} 0, 1, 2 or 3 (DOWN, HALF_UP, HALF_EVEN, UP)
- * [more] {boolean} Whether the result of division was truncated.
- */
- function round(x, dp, rm, more) {
- var xc = x.c,
- i = x.e + dp + 1;
- if (i < xc.length) {
- if (rm === 1) {
- // xc[i] is the digit after the digit that may be rounded up.
- more = xc[i] >= 5;
- } else if (rm === 2) {
- more = xc[i] > 5 || xc[i] == 5 &&
- (more || i < 0 || xc[i + 1] !== UNDEFINED || xc[i - 1] & 1);
- } else if (rm === 3) {
- more = more || !!xc[0];
- } else {
- more = false;
- if (rm !== 0) throw Error(INVALID_RM);
- }
- if (i < 1) {
- xc.length = 1;
- if (more) {
- // 1, 0.1, 0.01, 0.001, 0.0001 etc.
- x.e = -dp;
- xc[0] = 1;
- } else {
- // Zero.
- xc[0] = x.e = 0;
- }
- } else {
- // Remove any digits after the required decimal places.
- xc.length = i--;
- // Round up?
- if (more) {
- // Rounding up may mean the previous digit has to be rounded up.
- for (; ++xc[i] > 9;) {
- xc[i] = 0;
- if (!i--) {
- ++x.e;
- xc.unshift(1);
- }
- }
- }
- // Remove trailing zeros.
- for (i = xc.length; !xc[--i];) xc.pop();
- }
- } else if (rm < 0 || rm > 3 || rm !== ~~rm) {
- throw Error(INVALID_RM);
- }
- return x;
- }
- /*
- * Return a string representing the value of Big x in normal or exponential notation.
- * Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
- *
- * x {Big}
- * id? {number} Caller id.
- * 1 toExponential
- * 2 toFixed
- * 3 toPrecision
- * 4 valueOf
- * n? {number|undefined} Caller's argument.
- * k? {number|undefined}
- */
- function stringify(x, id, n, k) {
- var e, s,
- Big = x.constructor,
- z = !x.c[0];
- if (n !== UNDEFINED) {
- if (n !== ~~n || n < (id == 3) || n > MAX_DP) {
- throw Error(id == 3 ? INVALID + 'precision' : INVALID_DP);
- }
- x = new Big(x);
- // The index of the digit that may be rounded up.
- n = k - x.e;
- // Round?
- if (x.c.length > ++k) round(x, n, Big.RM);
- // toFixed: recalculate k as x.e may have changed if value rounded up.
- if (id == 2) k = x.e + n + 1;
- // Append zeros?
- for (; x.c.length < k;) x.c.push(0);
- }
- e = x.e;
- s = x.c.join('');
- n = s.length;
- // Exponential notation?
- if (id != 2 && (id == 1 || id == 3 && k <= e || e <= Big.NE || e >= Big.PE)) {
- s = s.charAt(0) + (n > 1 ? '.' + s.slice(1) : '') + (e < 0 ? 'e' : 'e+') + e;
- // Normal notation.
- } else if (e < 0) {
- for (; ++e;) s = '0' + s;
- s = '0.' + s;
- } else if (e > 0) {
- if (++e > n) for (e -= n; e--;) s += '0';
- else if (e < n) s = s.slice(0, e) + '.' + s.slice(e);
- } else if (n > 1) {
- s = s.charAt(0) + '.' + s.slice(1);
- }
- return x.s < 0 && (!z || id == 4) ? '-' + s : s;
- }
- // Prototype/instance methods
- /*
- * Return a new Big whose value is the absolute value of this Big.
- */
- P.abs = function () {
- var x = new this.constructor(this);
- x.s = 1;
- return x;
- };
- /*
- * Return 1 if the value of this Big is greater than the value of Big y,
- * -1 if the value of this Big is less than the value of Big y, or
- * 0 if they have the same value.
- */
- P.cmp = function (y) {
- var isneg,
- x = this,
- xc = x.c,
- yc = (y = new x.constructor(y)).c,
- i = x.s,
- j = y.s,
- k = x.e,
- l = y.e;
- // Either zero?
- if (!xc[0] || !yc[0]) return !xc[0] ? !yc[0] ? 0 : -j : i;
- // Signs differ?
- if (i != j) return i;
- isneg = i < 0;
- // Compare exponents.
- if (k != l) return k > l ^ isneg ? 1 : -1;
- j = (k = xc.length) < (l = yc.length) ? k : l;
- // Compare digit by digit.
- for (i = -1; ++i < j;) {
- if (xc[i] != yc[i]) return xc[i] > yc[i] ^ isneg ? 1 : -1;
- }
- // Compare lengths.
- return k == l ? 0 : k > l ^ isneg ? 1 : -1;
- };
- /*
- * Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,
- * if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
- */
- P.div = function (y) {
- var x = this,
- Big = x.constructor,
- a = x.c, // dividend
- b = (y = new Big(y)).c, // divisor
- k = x.s == y.s ? 1 : -1,
- dp = Big.DP;
- if (dp !== ~~dp || dp < 0 || dp > MAX_DP) throw Error(INVALID_DP);
- // Divisor is zero?
- if (!b[0]) throw Error(DIV_BY_ZERO);
- // Dividend is 0? Return +-0.
- if (!a[0]) return new Big(k * 0);
- var bl, bt, n, cmp, ri,
- bz = b.slice(),
- ai = bl = b.length,
- al = a.length,
- r = a.slice(0, bl), // remainder
- rl = r.length,
- q = y, // quotient
- qc = q.c = [],
- qi = 0,
- d = dp + (q.e = x.e - y.e) + 1; // number of digits of the result
- q.s = k;
- k = d < 0 ? 0 : d;
- // Create version of divisor with leading zero.
- bz.unshift(0);
- // Add zeros to make remainder as long as divisor.
- for (; rl++ < bl;) r.push(0);
- do {
- // n is how many times the divisor goes into current remainder.
- for (n = 0; n < 10; n++) {
- // Compare divisor and remainder.
- if (bl != (rl = r.length)) {
- cmp = bl > rl ? 1 : -1;
- } else {
- for (ri = -1, cmp = 0; ++ri < bl;) {
- if (b[ri] != r[ri]) {
- cmp = b[ri] > r[ri] ? 1 : -1;
- break;
- }
- }
- }
- // If divisor < remainder, subtract divisor from remainder.
- if (cmp < 0) {
- // Remainder can't be more than 1 digit longer than divisor.
- // Equalise lengths using divisor with extra leading zero?
- for (bt = rl == bl ? b : bz; rl;) {
- if (r[--rl] < bt[rl]) {
- ri = rl;
- for (; ri && !r[--ri];) r[ri] = 9;
- --r[ri];
- r[rl] += 10;
- }
- r[rl] -= bt[rl];
- }
- for (; !r[0];) r.shift();
- } else {
- break;
- }
- }
- // Add the digit n to the result array.
- qc[qi++] = cmp ? n : ++n;
- // Update the remainder.
- if (r[0] && cmp) r[rl] = a[ai] || 0;
- else r = [a[ai]];
- } while ((ai++ < al || r[0] !== UNDEFINED) && k--);
- // Leading zero? Do not remove if result is simply zero (qi == 1).
- if (!qc[0] && qi != 1) {
- // There can't be more than one zero.
- qc.shift();
- q.e--;
- }
- // Round?
- if (qi > d) round(q, dp, Big.RM, r[0] !== UNDEFINED);
- return q;
- };
- /*
- * Return true if the value of this Big is equal to the value of Big y, otherwise return false.
- */
- P.eq = function (y) {
- return !this.cmp(y);
- };
- /*
- * Return true if the value of this Big is greater than the value of Big y, otherwise return
- * false.
- */
- P.gt = function (y) {
- return this.cmp(y) > 0;
- };
- /*
- * Return true if the value of this Big is greater than or equal to the value of Big y, otherwise
- * return false.
- */
- P.gte = function (y) {
- return this.cmp(y) > -1;
- };
- /*
- * Return true if the value of this Big is less than the value of Big y, otherwise return false.
- */
- P.lt = function (y) {
- return this.cmp(y) < 0;
- };
- /*
- * Return true if the value of this Big is less than or equal to the value of Big y, otherwise
- * return false.
- */
- P.lte = function (y) {
- return this.cmp(y) < 1;
- };
- /*
- * Return a new Big whose value is the value of this Big minus the value of Big y.
- */
- P.minus = P.sub = function (y) {
- var i, j, t, xlty,
- x = this,
- Big = x.constructor,
- a = x.s,
- b = (y = new Big(y)).s;
- // Signs differ?
- if (a != b) {
- y.s = -b;
- return x.plus(y);
- }
- var xc = x.c.slice(),
- xe = x.e,
- yc = y.c,
- ye = y.e;
- // Either zero?
- if (!xc[0] || !yc[0]) {
- // y is non-zero? x is non-zero? Or both are zero.
- return yc[0] ? (y.s = -b, y) : new Big(xc[0] ? x : 0);
- }
- // Determine which is the bigger number. Prepend zeros to equalise exponents.
- if (a = xe - ye) {
- if (xlty = a < 0) {
- a = -a;
- t = xc;
- } else {
- ye = xe;
- t = yc;
- }
- t.reverse();
- for (b = a; b--;) t.push(0);
- t.reverse();
- } else {
- // Exponents equal. Check digit by digit.
- j = ((xlty = xc.length < yc.length) ? xc : yc).length;
- for (a = b = 0; b < j; b++) {
- if (xc[b] != yc[b]) {
- xlty = xc[b] < yc[b];
- break;
- }
- }
- }
- // x < y? Point xc to the array of the bigger number.
- if (xlty) {
- t = xc;
- xc = yc;
- yc = t;
- y.s = -y.s;
- }
- /*
- * Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only
- * needs to start at yc.length.
- */
- if ((b = (j = yc.length) - (i = xc.length)) > 0) for (; b--;) xc[i++] = 0;
- // Subtract yc from xc.
- for (b = i; j > a;) {
- if (xc[--j] < yc[j]) {
- for (i = j; i && !xc[--i];) xc[i] = 9;
- --xc[i];
- xc[j] += 10;
- }
- xc[j] -= yc[j];
- }
- // Remove trailing zeros.
- for (; xc[--b] === 0;) xc.pop();
- // Remove leading zeros and adjust exponent accordingly.
- for (; xc[0] === 0;) {
- xc.shift();
- --ye;
- }
- if (!xc[0]) {
- // n - n = +0
- y.s = 1;
- // Result must be zero.
- xc = [ye = 0];
- }
- y.c = xc;
- y.e = ye;
- return y;
- };
- /*
- * Return a new Big whose value is the value of this Big modulo the value of Big y.
- */
- P.mod = function (y) {
- var ygtx,
- x = this,
- Big = x.constructor,
- a = x.s,
- b = (y = new Big(y)).s;
- if (!y.c[0]) throw Error(DIV_BY_ZERO);
- x.s = y.s = 1;
- ygtx = y.cmp(x) == 1;
- x.s = a;
- y.s = b;
- if (ygtx) return new Big(x);
- a = Big.DP;
- b = Big.RM;
- Big.DP = Big.RM = 0;
- x = x.div(y);
- Big.DP = a;
- Big.RM = b;
- return this.minus(x.times(y));
- };
- /*
- * Return a new Big whose value is the value of this Big plus the value of Big y.
- */
- P.plus = P.add = function (y) {
- var t,
- x = this,
- Big = x.constructor,
- a = x.s,
- b = (y = new Big(y)).s;
- // Signs differ?
- if (a != b) {
- y.s = -b;
- return x.minus(y);
- }
- var xe = x.e,
- xc = x.c,
- ye = y.e,
- yc = y.c;
- // Either zero? y is non-zero? x is non-zero? Or both are zero.
- if (!xc[0] || !yc[0]) return yc[0] ? y : new Big(xc[0] ? x : a * 0);
- xc = xc.slice();
- // Prepend zeros to equalise exponents.
- // Note: reverse faster than unshifts.
- if (a = xe - ye) {
- if (a > 0) {
- ye = xe;
- t = yc;
- } else {
- a = -a;
- t = xc;
- }
- t.reverse();
- for (; a--;) t.push(0);
- t.reverse();
- }
- // Point xc to the longer array.
- if (xc.length - yc.length < 0) {
- t = yc;
- yc = xc;
- xc = t;
- }
- a = yc.length;
- // Only start adding at yc.length - 1 as the further digits of xc can be left as they are.
- for (b = 0; a; xc[a] %= 10) b = (xc[--a] = xc[a] + yc[a] + b) / 10 | 0;
- // No need to check for zero, as +x + +y != 0 && -x + -y != 0
- if (b) {
- xc.unshift(b);
- ++ye;
- }
- // Remove trailing zeros.
- for (a = xc.length; xc[--a] === 0;) xc.pop();
- y.c = xc;
- y.e = ye;
- return y;
- };
- /*
- * Return a Big whose value is the value of this Big raised to the power n.
- * If n is negative, round to a maximum of Big.DP decimal places using rounding
- * mode Big.RM.
- *
- * n {number} Integer, -MAX_POWER to MAX_POWER inclusive.
- */
- P.pow = function (n) {
- var x = this,
- one = new x.constructor(1),
- y = one,
- isneg = n < 0;
- if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) throw Error(INVALID + 'exponent');
- if (isneg) n = -n;
- for (;;) {
- if (n & 1) y = y.times(x);
- n >>= 1;
- if (!n) break;
- x = x.times(x);
- }
- return isneg ? one.div(y) : y;
- };
- /*
- * Return a new Big whose value is the value of this Big rounded using rounding mode rm
- * to a maximum of dp decimal places, or, if dp is negative, to an integer which is a
- * multiple of 10**-dp.
- * If dp is not specified, round to 0 decimal places.
- * If rm is not specified, use Big.RM.
- *
- * dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
- * rm? 0, 1, 2 or 3 (ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP)
- */
- P.round = function (dp, rm) {
- var Big = this.constructor;
- if (dp === UNDEFINED) dp = 0;
- else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) throw Error(INVALID_DP);
- return round(new Big(this), dp, rm === UNDEFINED ? Big.RM : rm);
- };
- /*
- * Return a new Big whose value is the square root of the value of this Big, rounded, if
- * necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
- */
- P.sqrt = function () {
- var r, c, t,
- x = this,
- Big = x.constructor,
- s = x.s,
- e = x.e,
- half = new Big(0.5);
- // Zero?
- if (!x.c[0]) return new Big(x);
- // Negative?
- if (s < 0) throw Error(NAME + 'No square root');
- // Estimate.
- s = Math.sqrt(x + '');
- // Math.sqrt underflow/overflow?
- // Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
- if (s === 0 || s === 1 / 0) {
- c = x.c.join('');
- if (!(c.length + e & 1)) c += '0';
- s = Math.sqrt(c);
- e = ((e + 1) / 2 | 0) - (e < 0 || e & 1);
- r = new Big((s == 1 / 0 ? '1e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e);
- } else {
- r = new Big(s);
- }
- e = r.e + (Big.DP += 4);
- // Newton-Raphson iteration.
- do {
- t = r;
- r = half.times(t.plus(x.div(t)));
- } while (t.c.slice(0, e).join('') !== r.c.slice(0, e).join(''));
- return round(r, Big.DP -= 4, Big.RM);
- };
- /*
- * Return a new Big whose value is the value of this Big times the value of Big y.
- */
- P.times = P.mul = function (y) {
- var c,
- x = this,
- Big = x.constructor,
- xc = x.c,
- yc = (y = new Big(y)).c,
- a = xc.length,
- b = yc.length,
- i = x.e,
- j = y.e;
- // Determine sign of result.
- y.s = x.s == y.s ? 1 : -1;
- // Return signed 0 if either 0.
- if (!xc[0] || !yc[0]) return new Big(y.s * 0);
- // Initialise exponent of result as x.e + y.e.
- y.e = i + j;
- // If array xc has fewer digits than yc, swap xc and yc, and lengths.
- if (a < b) {
- c = xc;
- xc = yc;
- yc = c;
- j = a;
- a = b;
- b = j;
- }
- // Initialise coefficient array of result with zeros.
- for (c = new Array(j = a + b); j--;) c[j] = 0;
- // Multiply.
- // i is initially xc.length.
- for (i = b; i--;) {
- b = 0;
- // a is yc.length.
- for (j = a + i; j > i;) {
- // Current sum of products at this digit position, plus carry.
- b = c[j] + yc[i] * xc[j - i - 1] + b;
- c[j--] = b % 10;
- // carry
- b = b / 10 | 0;
- }
- c[j] = (c[j] + b) % 10;
- }
- // Increment result exponent if there is a final carry, otherwise remove leading zero.
- if (b) ++y.e;
- else c.shift();
- // Remove trailing zeros.
- for (i = c.length; !c[--i];) c.pop();
- y.c = c;
- return y;
- };
- /*
- * Return a string representing the value of this Big in exponential notation to dp fixed decimal
- * places and rounded using Big.RM.
- *
- * dp? {number} Integer, 0 to MAX_DP inclusive.
- */
- P.toExponential = function (dp) {
- return stringify(this, 1, dp, dp);
- };
- /*
- * Return a string representing the value of this Big in normal notation to dp fixed decimal
- * places and rounded using Big.RM.
- *
- * dp? {number} Integer, 0 to MAX_DP inclusive.
- *
- * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
- * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
- */
- P.toFixed = function (dp) {
- return stringify(this, 2, dp, this.e + dp);
- };
- /*
- * Return a string representing the value of this Big rounded to sd significant digits using
- * Big.RM. Use exponential notation if sd is less than the number of digits necessary to represent
- * the integer part of the value in normal notation.
- *
- * sd {number} Integer, 1 to MAX_DP inclusive.
- */
- P.toPrecision = function (sd) {
- return stringify(this, 3, sd, sd - 1);
- };
- /*
- * Return a string representing the value of this Big.
- * Return exponential notation if this Big has a positive exponent equal to or greater than
- * Big.PE, or a negative exponent equal to or less than Big.NE.
- * Omit the sign for negative zero.
- */
- P.toString = function () {
- return stringify(this);
- };
- /*
- * Return a string representing the value of this Big.
- * Return exponential notation if this Big has a positive exponent equal to or greater than
- * Big.PE, or a negative exponent equal to or less than Big.NE.
- * Include the sign for negative zero.
- */
- P.valueOf = P.toJSON = function () {
- return stringify(this, 4);
- };
- // Export
- var Big = _Big_();
- var big = /*#__PURE__*/Object.freeze({
- __proto__: null,
- Big: Big,
- 'default': Big
- });
- var require$$0 = /*@__PURE__*/getAugmentedNamespace(big);
- const baseEncodeTables = {
- 26: 'abcdefghijklmnopqrstuvwxyz',
- 32: '123456789abcdefghjkmnpqrstuvwxyz', // no 0lio
- 36: '0123456789abcdefghijklmnopqrstuvwxyz',
- 49: 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no lIO
- 52: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
- 58: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no 0lIO
- 62: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
- 64: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_',
- };
- function encodeBufferToBase(buffer, base) {
- const encodeTable = baseEncodeTables[base];
- if (!encodeTable) {
- throw new Error('Unknown encoding base' + base);
- }
- const readLength = buffer.length;
- const Big = require$$0;
- Big.RM = Big.DP = 0;
- let b = new Big(0);
- for (let i = readLength - 1; i >= 0; i--) {
- b = b.times(256).plus(buffer[i]);
- }
- let output = '';
- while (b.gt(0)) {
- output = encodeTable[b.mod(base)] + output;
- b = b.div(base);
- }
- Big.DP = 20;
- Big.RM = 1;
- return output;
- }
- function getHashDigest(buffer, hashType, digestType, maxLength) {
- hashType = hashType || 'md5';
- maxLength = maxLength || 9999;
- const hash = require('crypto').createHash(hashType);
- hash.update(buffer);
- if (
- digestType === 'base26' ||
- digestType === 'base32' ||
- digestType === 'base36' ||
- digestType === 'base49' ||
- digestType === 'base52' ||
- digestType === 'base58' ||
- digestType === 'base62' ||
- digestType === 'base64'
- ) {
- return encodeBufferToBase(hash.digest(), digestType.substr(4)).substr(
- 0,
- maxLength
- );
- } else {
- return hash.digest(digestType || 'hex').substr(0, maxLength);
- }
- }
- var getHashDigest_1 = getHashDigest;
- var emojisList = [
- "🀄️",
- "🃏",
- "🅰️",
- "🅱️",
- "🅾️",
- "🅿️",
- "🆎",
- "🆑",
- "🆒",
- "🆓",
- "🆔",
- "🆕",
- "🆖",
- "🆗",
- "🆘",
- "🆙",
- "🆚",
- "🇦🇨",
- "🇦🇩",
- "🇦🇪",
- "🇦🇫",
- "🇦🇬",
- "🇦🇮",
- "🇦🇱",
- "🇦🇲",
- "🇦🇴",
- "🇦🇶",
- "🇦🇷",
- "🇦🇸",
- "🇦🇹",
- "🇦🇺",
- "🇦🇼",
- "🇦🇽",
- "🇦🇿",
- "🇦",
- "🇧🇦",
- "🇧🇧",
- "🇧🇩",
- "🇧🇪",
- "🇧🇫",
- "🇧🇬",
- "🇧🇭",
- "🇧🇮",
- "🇧🇯",
- "🇧🇱",
- "🇧🇲",
- "🇧🇳",
- "🇧🇴",
- "🇧🇶",
- "🇧🇷",
- "🇧🇸",
- "🇧🇹",
- "🇧🇻",
- "🇧🇼",
- "🇧🇾",
- "🇧🇿",
- "🇧",
- "🇨🇦",
- "🇨🇨",
- "🇨🇩",
- "🇨🇫",
- "🇨🇬",
- "🇨🇭",
- "🇨🇮",
- "🇨🇰",
- "🇨🇱",
- "🇨🇲",
- "🇨🇳",
- "🇨🇴",
- "🇨🇵",
- "🇨🇷",
- "🇨🇺",
- "🇨🇻",
- "🇨🇼",
- "🇨🇽",
- "🇨🇾",
- "🇨🇿",
- "🇨",
- "🇩🇪",
- "🇩🇬",
- "🇩🇯",
- "🇩🇰",
- "🇩🇲",
- "🇩🇴",
- "🇩🇿",
- "🇩",
- "🇪🇦",
- "🇪🇨",
- "🇪🇪",
- "🇪🇬",
- "🇪🇭",
- "🇪🇷",
- "🇪🇸",
- "🇪🇹",
- "🇪🇺",
- "🇪",
- "🇫🇮",
- "🇫🇯",
- "🇫🇰",
- "🇫🇲",
- "🇫🇴",
- "🇫🇷",
- "🇫",
- "🇬🇦",
- "🇬🇧",
- "🇬🇩",
- "🇬🇪",
- "🇬🇫",
- "🇬🇬",
- "🇬🇭",
- "🇬🇮",
- "🇬🇱",
- "🇬🇲",
- "🇬🇳",
- "🇬🇵",
- "🇬🇶",
- "🇬🇷",
- "🇬🇸",
- "🇬🇹",
- "🇬🇺",
- "🇬🇼",
- "🇬🇾",
- "🇬",
- "🇭🇰",
- "🇭🇲",
- "🇭🇳",
- "🇭🇷",
- "🇭🇹",
- "🇭🇺",
- "🇭",
- "🇮🇨",
- "🇮🇩",
- "🇮🇪",
- "🇮🇱",
- "🇮🇲",
- "🇮🇳",
- "🇮🇴",
- "🇮🇶",
- "🇮🇷",
- "🇮🇸",
- "🇮🇹",
- "🇮",
- "🇯🇪",
- "🇯🇲",
- "🇯🇴",
- "🇯🇵",
- "🇯",
- "🇰🇪",
- "🇰🇬",
- "🇰🇭",
- "🇰🇮",
- "🇰🇲",
- "🇰🇳",
- "🇰🇵",
- "🇰🇷",
- "🇰🇼",
- "🇰🇾",
- "🇰🇿",
- "🇰",
- "🇱🇦",
- "🇱🇧",
- "🇱🇨",
- "🇱🇮",
- "🇱🇰",
- "🇱🇷",
- "🇱🇸",
- "🇱🇹",
- "🇱🇺",
- "🇱🇻",
- "🇱🇾",
- "🇱",
- "🇲🇦",
- "🇲🇨",
- "🇲🇩",
- "🇲🇪",
- "🇲🇫",
- "🇲🇬",
- "🇲🇭",
- "🇲🇰",
- "🇲🇱",
- "🇲🇲",
- "🇲🇳",
- "🇲🇴",
- "🇲🇵",
- "🇲🇶",
- "🇲🇷",
- "🇲🇸",
- "🇲🇹",
- "🇲🇺",
- "🇲🇻",
- "🇲🇼",
- "🇲🇽",
- "🇲🇾",
- "🇲🇿",
- "🇲",
- "🇳🇦",
- "🇳🇨",
- "🇳🇪",
- "🇳🇫",
- "🇳🇬",
- "🇳🇮",
- "🇳🇱",
- "🇳🇴",
- "🇳🇵",
- "🇳🇷",
- "🇳🇺",
- "🇳🇿",
- "🇳",
- "🇴🇲",
- "🇴",
- "🇵🇦",
- "🇵🇪",
- "🇵🇫",
- "🇵🇬",
- "🇵🇭",
- "🇵🇰",
- "🇵🇱",
- "🇵🇲",
- "🇵🇳",
- "🇵🇷",
- "🇵🇸",
- "🇵🇹",
- "🇵🇼",
- "🇵🇾",
- "🇵",
- "🇶🇦",
- "🇶",
- "🇷🇪",
- "🇷🇴",
- "🇷🇸",
- "🇷🇺",
- "🇷🇼",
- "🇷",
- "🇸🇦",
- "🇸🇧",
- "🇸🇨",
- "🇸🇩",
- "🇸🇪",
- "🇸🇬",
- "🇸🇭",
- "🇸🇮",
- "🇸🇯",
- "🇸🇰",
- "🇸🇱",
- "🇸🇲",
- "🇸🇳",
- "🇸🇴",
- "🇸🇷",
- "🇸🇸",
- "🇸🇹",
- "🇸🇻",
- "🇸🇽",
- "🇸🇾",
- "🇸🇿",
- "🇸",
- "🇹🇦",
- "🇹🇨",
- "🇹🇩",
- "🇹🇫",
- "🇹🇬",
- "🇹🇭",
- "🇹🇯",
- "🇹🇰",
- "🇹🇱",
- "🇹🇲",
- "🇹🇳",
- "🇹🇴",
- "🇹🇷",
- "🇹🇹",
- "🇹🇻",
- "🇹🇼",
- "🇹🇿",
- "🇹",
- "🇺🇦",
- "🇺🇬",
- "🇺🇲",
- "🇺🇳",
- "🇺🇸",
- "🇺🇾",
- "🇺🇿",
- "🇺",
- "🇻🇦",
- "🇻🇨",
- "🇻🇪",
- "🇻🇬",
- "🇻🇮",
- "🇻🇳",
- "🇻🇺",
- "🇻",
- "🇼🇫",
- "🇼🇸",
- "🇼",
- "🇽🇰",
- "🇽",
- "🇾🇪",
- "🇾🇹",
- "🇾",
- "🇿🇦",
- "🇿🇲",
- "🇿🇼",
- "🇿",
- "🈁",
- "🈂️",
- "🈚️",
- "🈯️",
- "🈲",
- "🈳",
- "🈴",
- "🈵",
- "🈶",
- "🈷️",
- "🈸",
- "🈹",
- "🈺",
- "🉐",
- "🉑",
- "🌀",
- "🌁",
- "🌂",
- "🌃",
- "🌄",
- "🌅",
- "🌆",
- "🌇",
- "🌈",
- "🌉",
- "🌊",
- "🌋",
- "🌌",
- "🌍",
- "🌎",
- "🌏",
- "🌐",
- "🌑",
- "🌒",
- "🌓",
- "🌔",
- "🌕",
- "🌖",
- "🌗",
- "🌘",
- "🌙",
- "🌚",
- "🌛",
- "🌜",
- "🌝",
- "🌞",
- "🌟",
- "🌠",
- "🌡️",
- "🌤️",
- "🌥️",
- "🌦️",
- "🌧️",
- "🌨️",
- "🌩️",
- "🌪️",
- "🌫️",
- "🌬️",
- "🌭",
- "🌮",
- "🌯",
- "🌰",
- "🌱",
- "🌲",
- "🌳",
- "🌴",
- "🌵",
- "🌶️",
- "🌷",
- "🌸",
- "🌹",
- "🌺",
- "🌻",
- "🌼",
- "🌽",
- "🌾",
- "🌿",
- "🍀",
- "🍁",
- "🍂",
- "🍃",
- "🍄",
- "🍅",
- "🍆",
- "🍇",
- "🍈",
- "🍉",
- "🍊",
- "🍋",
- "🍌",
- "🍍",
- "🍎",
- "🍏",
- "🍐",
- "🍑",
- "🍒",
- "🍓",
- "🍔",
- "🍕",
- "🍖",
- "🍗",
- "🍘",
- "🍙",
- "🍚",
- "🍛",
- "🍜",
- "🍝",
- "🍞",
- "🍟",
- "🍠",
- "🍡",
- "🍢",
- "🍣",
- "🍤",
- "🍥",
- "🍦",
- "🍧",
- "🍨",
- "🍩",
- "🍪",
- "🍫",
- "🍬",
- "🍭",
- "🍮",
- "🍯",
- "🍰",
- "🍱",
- "🍲",
- "🍳",
- "🍴",
- "🍵",
- "🍶",
- "🍷",
- "🍸",
- "🍹",
- "🍺",
- "🍻",
- "🍼",
- "🍽️",
- "🍾",
- "🍿",
- "🎀",
- "🎁",
- "🎂",
- "🎃",
- "🎄",
- "🎅🏻",
- "🎅🏼",
- "🎅🏽",
- "🎅🏾",
- "🎅🏿",
- "🎅",
- "🎆",
- "🎇",
- "🎈",
- "🎉",
- "🎊",
- "🎋",
- "🎌",
- "🎍",
- "🎎",
- "🎏",
- "🎐",
- "🎑",
- "🎒",
- "🎓",
- "🎖️",
- "🎗️",
- "🎙️",
- "🎚️",
- "🎛️",
- "🎞️",
- "🎟️",
- "🎠",
- "🎡",
- "🎢",
- "🎣",
- "🎤",
- "🎥",
- "🎦",
- "🎧",
- "🎨",
- "🎩",
- "🎪",
- "🎫",
- "🎬",
- "🎭",
- "🎮",
- "🎯",
- "🎰",
- "🎱",
- "🎲",
- "🎳",
- "🎴",
- "🎵",
- "🎶",
- "🎷",
- "🎸",
- "🎹",
- "🎺",
- "🎻",
- "🎼",
- "🎽",
- "🎾",
- "🎿",
- "🏀",
- "🏁",
- "🏂🏻",
- "🏂🏼",
- "🏂🏽",
- "🏂🏾",
- "🏂🏿",
- "🏂",
- "🏃🏻♀️",
- "🏃🏻♂️",
- "🏃🏻",
- "🏃🏼♀️",
- "🏃🏼♂️",
- "🏃🏼",
- "🏃🏽♀️",
- "🏃🏽♂️",
- "🏃🏽",
- "🏃🏾♀️",
- "🏃🏾♂️",
- "🏃🏾",
- "🏃🏿♀️",
- "🏃🏿♂️",
- "🏃🏿",
- "🏃♀️",
- "🏃♂️",
- "🏃",
- "🏄🏻♀️",
- "🏄🏻♂️",
- "🏄🏻",
- "🏄🏼♀️",
- "🏄🏼♂️",
- "🏄🏼",
- "🏄🏽♀️",
- "🏄🏽♂️",
- "🏄🏽",
- "🏄🏾♀️",
- "🏄🏾♂️",
- "🏄🏾",
- "🏄🏿♀️",
- "🏄🏿♂️",
- "🏄🏿",
- "🏄♀️",
- "🏄♂️",
- "🏄",
- "🏅",
- "🏆",
- "🏇🏻",
- "🏇🏼",
- "🏇🏽",
- "🏇🏾",
- "🏇🏿",
- "🏇",
- "🏈",
- "🏉",
- "🏊🏻♀️",
- "🏊🏻♂️",
- "🏊🏻",
- "🏊🏼♀️",
- "🏊🏼♂️",
- "🏊🏼",
- "🏊🏽♀️",
- "🏊🏽♂️",
- "🏊🏽",
- "🏊🏾♀️",
- "🏊🏾♂️",
- "🏊🏾",
- "🏊🏿♀️",
- "🏊🏿♂️",
- "🏊🏿",
- "🏊♀️",
- "🏊♂️",
- "🏊",
- "🏋🏻♀️",
- "🏋🏻♂️",
- "🏋🏻",
- "🏋🏼♀️",
- "🏋🏼♂️",
- "🏋🏼",
- "🏋🏽♀️",
- "🏋🏽♂️",
- "🏋🏽",
- "🏋🏾♀️",
- "🏋🏾♂️",
- "🏋🏾",
- "🏋🏿♀️",
- "🏋🏿♂️",
- "🏋🏿",
- "🏋️♀️",
- "🏋️♂️",
- "🏋️",
- "🏌🏻♀️",
- "🏌🏻♂️",
- "🏌🏻",
- "🏌🏼♀️",
- "🏌🏼♂️",
- "🏌🏼",
- "🏌🏽♀️",
- "🏌🏽♂️",
- "🏌🏽",
- "🏌🏾♀️",
- "🏌🏾♂️",
- "🏌🏾",
- "🏌🏿♀️",
- "🏌🏿♂️",
- "🏌🏿",
- "🏌️♀️",
- "🏌️♂️",
- "🏌️",
- "🏍️",
- "🏎️",
- "🏏",
- "🏐",
- "🏑",
- "🏒",
- "🏓",
- "🏔️",
- "🏕️",
- "🏖️",
- "🏗️",
- "🏘️",
- "🏙️",
- "🏚️",
- "🏛️",
- "🏜️",
- "🏝️",
- "🏞️",
- "🏟️",
- "🏠",
- "🏡",
- "🏢",
- "🏣",
- "🏤",
- "🏥",
- "🏦",
- "🏧",
- "🏨",
- "🏩",
- "🏪",
- "🏫",
- "🏬",
- "🏭",
- "🏮",
- "🏯",
- "🏰",
- "🏳️🌈",
- "🏳️",
- "🏴☠️",
- "🏴",
- "🏴",
- "🏴",
- "🏴",
- "🏵️",
- "🏷️",
- "🏸",
- "🏹",
- "🏺",
- "🏻",
- "🏼",
- "🏽",
- "🏾",
- "🏿",
- "🐀",
- "🐁",
- "🐂",
- "🐃",
- "🐄",
- "🐅",
- "🐆",
- "🐇",
- "🐈",
- "🐉",
- "🐊",
- "🐋",
- "🐌",
- "🐍",
- "🐎",
- "🐏",
- "🐐",
- "🐑",
- "🐒",
- "🐓",
- "🐔",
- "🐕🦺",
- "🐕",
- "🐖",
- "🐗",
- "🐘",
- "🐙",
- "🐚",
- "🐛",
- "🐜",
- "🐝",
- "🐞",
- "🐟",
- "🐠",
- "🐡",
- "🐢",
- "🐣",
- "🐤",
- "🐥",
- "🐦",
- "🐧",
- "🐨",
- "🐩",
- "🐪",
- "🐫",
- "🐬",
- "🐭",
- "🐮",
- "🐯",
- "🐰",
- "🐱",
- "🐲",
- "🐳",
- "🐴",
- "🐵",
- "🐶",
- "🐷",
- "🐸",
- "🐹",
- "🐺",
- "🐻",
- "🐼",
- "🐽",
- "🐾",
- "🐿️",
- "👀",
- "👁🗨",
- "👁️",
- "👂🏻",
- "👂🏼",
- "👂🏽",
- "👂🏾",
- "👂🏿",
- "👂",
- "👃🏻",
- "👃🏼",
- "👃🏽",
- "👃🏾",
- "👃🏿",
- "👃",
- "👄",
- "👅",
- "👆🏻",
- "👆🏼",
- "👆🏽",
- "👆🏾",
- "👆🏿",
- "👆",
- "👇🏻",
- "👇🏼",
- "👇🏽",
- "👇🏾",
- "👇🏿",
- "👇",
- "👈🏻",
- "👈🏼",
- "👈🏽",
- "👈🏾",
- "👈🏿",
- "👈",
- "👉🏻",
- "👉🏼",
- "👉🏽",
- "👉🏾",
- "👉🏿",
- "👉",
- "👊🏻",
- "👊🏼",
- "👊🏽",
- "👊🏾",
- "👊🏿",
- "👊",
- "👋🏻",
- "👋🏼",
- "👋🏽",
- "👋🏾",
- "👋🏿",
- "👋",
- "👌🏻",
- "👌🏼",
- "👌🏽",
- "👌🏾",
- "👌🏿",
- "👌",
- "👍🏻",
- "👍🏼",
- "👍🏽",
- "👍🏾",
- "👍🏿",
- "👍",
- "👎🏻",
- "👎🏼",
- "👎🏽",
- "👎🏾",
- "👎🏿",
- "👎",
- "👏🏻",
- "👏🏼",
- "👏🏽",
- "👏🏾",
- "👏🏿",
- "👏",
- "👐🏻",
- "👐🏼",
- "👐🏽",
- "👐🏾",
- "👐🏿",
- "👐",
- "👑",
- "👒",
- "👓",
- "👔",
- "👕",
- "👖",
- "👗",
- "👘",
- "👙",
- "👚",
- "👛",
- "👜",
- "👝",
- "👞",
- "👟",
- "👠",
- "👡",
- "👢",
- "👣",
- "👤",
- "👥",
- "👦🏻",
- "👦🏼",
- "👦🏽",
- "👦🏾",
- "👦🏿",
- "👦",
- "👧🏻",
- "👧🏼",
- "👧🏽",
- "👧🏾",
- "👧🏿",
- "👧",
- "👨🏻🌾",
- "👨🏻🍳",
- "👨🏻🎓",
- "👨🏻🎤",
- "👨🏻🎨",
- "👨🏻🏫",
- "👨🏻🏭",
- "👨🏻💻",
- "👨🏻💼",
- "👨🏻🔧",
- "👨🏻🔬",
- "👨🏻🚀",
- "👨🏻🚒",
- "👨🏻🦯",
- "👨🏻🦰",
- "👨🏻🦱",
- "👨🏻🦲",
- "👨🏻🦳",
- "👨🏻🦼",
- "👨🏻🦽",
- "👨🏻⚕️",
- "👨🏻⚖️",
- "👨🏻✈️",
- "👨🏻",
- "👨🏼🌾",
- "👨🏼🍳",
- "👨🏼🎓",
- "👨🏼🎤",
- "👨🏼🎨",
- "👨🏼🏫",
- "👨🏼🏭",
- "👨🏼💻",
- "👨🏼💼",
- "👨🏼🔧",
- "👨🏼🔬",
- "👨🏼🚀",
- "👨🏼🚒",
- "👨🏼🤝👨🏻",
- "👨🏼🦯",
- "👨🏼🦰",
- "👨🏼🦱",
- "👨🏼🦲",
- "👨🏼🦳",
- "👨🏼🦼",
- "👨🏼🦽",
- "👨🏼⚕️",
- "👨🏼⚖️",
- "👨🏼✈️",
- "👨🏼",
- "👨🏽🌾",
- "👨🏽🍳",
- "👨🏽🎓",
- "👨🏽🎤",
- "👨🏽🎨",
- "👨🏽🏫",
- "👨🏽🏭",
- "👨🏽💻",
- "👨🏽💼",
- "👨🏽🔧",
- "👨🏽🔬",
- "👨🏽🚀",
- "👨🏽🚒",
- "👨🏽🤝👨🏻",
- "👨🏽🤝👨🏼",
- "👨🏽🦯",
- "👨🏽🦰",
- "👨🏽🦱",
- "👨🏽🦲",
- "👨🏽🦳",
- "👨🏽🦼",
- "👨🏽🦽",
- "👨🏽⚕️",
- "👨🏽⚖️",
- "👨🏽✈️",
- "👨🏽",
- "👨🏾🌾",
- "👨🏾🍳",
- "👨🏾🎓",
- "👨🏾🎤",
- "👨🏾🎨",
- "👨🏾🏫",
- "👨🏾🏭",
- "👨🏾💻",
- "👨🏾💼",
- "👨🏾🔧",
- "👨🏾🔬",
- "👨🏾🚀",
- "👨🏾🚒",
- "👨🏾🤝👨🏻",
- "👨🏾🤝👨🏼",
- "👨🏾🤝👨🏽",
- "👨🏾🦯",
- "👨🏾🦰",
- "👨🏾🦱",
- "👨🏾🦲",
- "👨🏾🦳",
- "👨🏾🦼",
- "👨🏾🦽",
- "👨🏾⚕️",
- "👨🏾⚖️",
- "👨🏾✈️",
- "👨🏾",
- "👨🏿🌾",
- "👨🏿🍳",
- "👨🏿🎓",
- "👨🏿🎤",
- "👨🏿🎨",
- "👨🏿🏫",
- "👨🏿🏭",
- "👨🏿💻",
- "👨🏿💼",
- "👨🏿🔧",
- "👨🏿🔬",
- "👨🏿🚀",
- "👨🏿🚒",
- "👨🏿🤝👨🏻",
- "👨🏿🤝👨🏼",
- "👨🏿🤝👨🏽",
- "👨🏿🤝👨🏾",
- "👨🏿🦯",
- "👨🏿🦰",
- "👨🏿🦱",
- "👨🏿🦲",
- "👨🏿🦳",
- "👨🏿🦼",
- "👨🏿🦽",
- "👨🏿⚕️",
- "👨🏿⚖️",
- "👨🏿✈️",
- "👨🏿",
- "👨🌾",
- "👨🍳",
- "👨🎓",
- "👨🎤",
- "👨🎨",
- "👨🏫",
- "👨🏭",
- "👨👦👦",
- "👨👦",
- "👨👧👦",
- "👨👧👧",
- "👨👧",
- "👨👨👦👦",
- "👨👨👦",
- "👨👨👧👦",
- "👨👨👧👧",
- "👨👨👧",
- "👨👩👦👦",
- "👨👩👦",
- "👨👩👧👦",
- "👨👩👧👧",
- "👨👩👧",
- "👨💻",
- "👨💼",
- "👨🔧",
- "👨🔬",
- "👨🚀",
- "👨🚒",
- "👨🦯",
- "👨🦰",
- "👨🦱",
- "👨🦲",
- "👨🦳",
- "👨🦼",
- "👨🦽",
- "👨⚕️",
- "👨⚖️",
- "👨✈️",
- "👨❤️👨",
- "👨❤️💋👨",
- "👨",
- "👩🏻🌾",
- "👩🏻🍳",
- "👩🏻🎓",
- "👩🏻🎤",
- "👩🏻🎨",
- "👩🏻🏫",
- "👩🏻🏭",
- "👩🏻💻",
- "👩🏻💼",
- "👩🏻🔧",
- "👩🏻🔬",
- "👩🏻🚀",
- "👩🏻🚒",
- "👩🏻🤝👨🏼",
- "👩🏻🤝👨🏽",
- "👩🏻🤝👨🏾",
- "👩🏻🤝👨🏿",
- "👩🏻🦯",
- "👩🏻🦰",
- "👩🏻🦱",
- "👩🏻🦲",
- "👩🏻🦳",
- "👩🏻🦼",
- "👩🏻🦽",
- "👩🏻⚕️",
- "👩🏻⚖️",
- "👩🏻✈️",
- "👩🏻",
- "👩🏼🌾",
- "👩🏼🍳",
- "👩🏼🎓",
- "👩🏼🎤",
- "👩🏼🎨",
- "👩🏼🏫",
- "👩🏼🏭",
- "👩🏼💻",
- "👩🏼💼",
- "👩🏼🔧",
- "👩🏼🔬",
- "👩🏼🚀",
- "👩🏼🚒",
- "👩🏼🤝👨🏻",
- "👩🏼🤝👨🏽",
- "👩🏼🤝👨🏾",
- "👩🏼🤝👨🏿",
- "👩🏼🤝👩🏻",
- "👩🏼🦯",
- "👩🏼🦰",
- "👩🏼🦱",
- "👩🏼🦲",
- "👩🏼🦳",
- "👩🏼🦼",
- "👩🏼🦽",
- "👩🏼⚕️",
- "👩🏼⚖️",
- "👩🏼✈️",
- "👩🏼",
- "👩🏽🌾",
- "👩🏽🍳",
- "👩🏽🎓",
- "👩🏽🎤",
- "👩🏽🎨",
- "👩🏽🏫",
- "👩🏽🏭",
- "👩🏽💻",
- "👩🏽💼",
- "👩🏽🔧",
- "👩🏽🔬",
- "👩🏽🚀",
- "👩🏽🚒",
- "👩🏽🤝👨🏻",
- "👩🏽🤝👨🏼",
- "👩🏽🤝👨🏾",
- "👩🏽🤝👨🏿",
- "👩🏽🤝👩🏻",
- "👩🏽🤝👩🏼",
- "👩🏽🦯",
- "👩🏽🦰",
- "👩🏽🦱",
- "👩🏽🦲",
- "👩🏽🦳",
- "👩🏽🦼",
- "👩🏽🦽",
- "👩🏽⚕️",
- "👩🏽⚖️",
- "👩🏽✈️",
- "👩🏽",
- "👩🏾🌾",
- "👩🏾🍳",
- "👩🏾🎓",
- "👩🏾🎤",
- "👩🏾🎨",
- "👩🏾🏫",
- "👩🏾🏭",
- "👩🏾💻",
- "👩🏾💼",
- "👩🏾🔧",
- "👩🏾🔬",
- "👩🏾🚀",
- "👩🏾🚒",
- "👩🏾🤝👨🏻",
- "👩🏾🤝👨🏼",
- "👩🏾🤝👨🏽",
- "👩🏾🤝👨🏿",
- "👩🏾🤝👩🏻",
- "👩🏾🤝👩🏼",
- "👩🏾🤝👩🏽",
- "👩🏾🦯",
- "👩🏾🦰",
- "👩🏾🦱",
- "👩🏾🦲",
- "👩🏾🦳",
- "👩🏾🦼",
- "👩🏾🦽",
- "👩🏾⚕️",
- "👩🏾⚖️",
- "👩🏾✈️",
- "👩🏾",
- "👩🏿🌾",
- "👩🏿🍳",
- "👩🏿🎓",
- "👩🏿🎤",
- "👩🏿🎨",
- "👩🏿🏫",
- "👩🏿🏭",
- "👩🏿💻",
- "👩🏿💼",
- "👩🏿🔧",
- "👩🏿🔬",
- "👩🏿🚀",
- "👩🏿🚒",
- "👩🏿🤝👨🏻",
- "👩🏿🤝👨🏼",
- "👩🏿🤝👨🏽",
- "👩🏿🤝👨🏾",
- "👩🏿🤝👩🏻",
- "👩🏿🤝👩🏼",
- "👩🏿🤝👩🏽",
- "👩🏿🤝👩🏾",
- "👩🏿🦯",
- "👩🏿🦰",
- "👩🏿🦱",
- "👩🏿🦲",
- "👩🏿🦳",
- "👩🏿🦼",
- "👩🏿🦽",
- "👩🏿⚕️",
- "👩🏿⚖️",
- "👩🏿✈️",
- "👩🏿",
- "👩🌾",
- "👩🍳",
- "👩🎓",
- "👩🎤",
- "👩🎨",
- "👩🏫",
- "👩🏭",
- "👩👦👦",
- "👩👦",
- "👩👧👦",
- "👩👧👧",
- "👩👧",
- "👩👩👦👦",
- "👩👩👦",
- "👩👩👧👦",
- "👩👩👧👧",
- "👩👩👧",
- "👩💻",
- "👩💼",
- "👩🔧",
- "👩🔬",
- "👩🚀",
- "👩🚒",
- "👩🦯",
- "👩🦰",
- "👩🦱",
- "👩🦲",
- "👩🦳",
- "👩🦼",
- "👩🦽",
- "👩⚕️",
- "👩⚖️",
- "👩✈️",
- "👩❤️👨",
- "👩❤️👩",
- "👩❤️💋👨",
- "👩❤️💋👩",
- "👩",
- "👪",
- "👫🏻",
- "👫🏼",
- "👫🏽",
- "👫🏾",
- "👫🏿",
- "👫",
- "👬🏻",
- "👬🏼",
- "👬🏽",
- "👬🏾",
- "👬🏿",
- "👬",
- "👭🏻",
- "👭🏼",
- "👭🏽",
- "👭🏾",
- "👭🏿",
- "👭",
- "👮🏻♀️",
- "👮🏻♂️",
- "👮🏻",
- "👮🏼♀️",
- "👮🏼♂️",
- "👮🏼",
- "👮🏽♀️",
- "👮🏽♂️",
- "👮🏽",
- "👮🏾♀️",
- "👮🏾♂️",
- "👮🏾",
- "👮🏿♀️",
- "👮🏿♂️",
- "👮🏿",
- "👮♀️",
- "👮♂️",
- "👮",
- "👯♀️",
- "👯♂️",
- "👯",
- "👰🏻",
- "👰🏼",
- "👰🏽",
- "👰🏾",
- "👰🏿",
- "👰",
- "👱🏻♀️",
- "👱🏻♂️",
- "👱🏻",
- "👱🏼♀️",
- "👱🏼♂️",
- "👱🏼",
- "👱🏽♀️",
- "👱🏽♂️",
- "👱🏽",
- "👱🏾♀️",
- "👱🏾♂️",
- "👱🏾",
- "👱🏿♀️",
- "👱🏿♂️",
- "👱🏿",
- "👱♀️",
- "👱♂️",
- "👱",
- "👲🏻",
- "👲🏼",
- "👲🏽",
- "👲🏾",
- "👲🏿",
- "👲",
- "👳🏻♀️",
- "👳🏻♂️",
- "👳🏻",
- "👳🏼♀️",
- "👳🏼♂️",
- "👳🏼",
- "👳🏽♀️",
- "👳🏽♂️",
- "👳🏽",
- "👳🏾♀️",
- "👳🏾♂️",
- "👳🏾",
- "👳🏿♀️",
- "👳🏿♂️",
- "👳🏿",
- "👳♀️",
- "👳♂️",
- "👳",
- "👴🏻",
- "👴🏼",
- "👴🏽",
- "👴🏾",
- "👴🏿",
- "👴",
- "👵🏻",
- "👵🏼",
- "👵🏽",
- "👵🏾",
- "👵🏿",
- "👵",
- "👶🏻",
- "👶🏼",
- "👶🏽",
- "👶🏾",
- "👶🏿",
- "👶",
- "👷🏻♀️",
- "👷🏻♂️",
- "👷🏻",
- "👷🏼♀️",
- "👷🏼♂️",
- "👷🏼",
- "👷🏽♀️",
- "👷🏽♂️",
- "👷🏽",
- "👷🏾♀️",
- "👷🏾♂️",
- "👷🏾",
- "👷🏿♀️",
- "👷🏿♂️",
- "👷🏿",
- "👷♀️",
- "👷♂️",
- "👷",
- "👸🏻",
- "👸🏼",
- "👸🏽",
- "👸🏾",
- "👸🏿",
- "👸",
- "👹",
- "👺",
- "👻",
- "👼🏻",
- "👼🏼",
- "👼🏽",
- "👼🏾",
- "👼🏿",
- "👼",
- "👽",
- "👾",
- "👿",
- "💀",
- "💁🏻♀️",
- "💁🏻♂️",
- "💁🏻",
- "💁🏼♀️",
- "💁🏼♂️",
- "💁🏼",
- "💁🏽♀️",
- "💁🏽♂️",
- "💁🏽",
- "💁🏾♀️",
- "💁🏾♂️",
- "💁🏾",
- "💁🏿♀️",
- "💁🏿♂️",
- "💁🏿",
- "💁♀️",
- "💁♂️",
- "💁",
- "💂🏻♀️",
- "💂🏻♂️",
- "💂🏻",
- "💂🏼♀️",
- "💂🏼♂️",
- "💂🏼",
- "💂🏽♀️",
- "💂🏽♂️",
- "💂🏽",
- "💂🏾♀️",
- "💂🏾♂️",
- "💂🏾",
- "💂🏿♀️",
- "💂🏿♂️",
- "💂🏿",
- "💂♀️",
- "💂♂️",
- "💂",
- "💃🏻",
- "💃🏼",
- "💃🏽",
- "💃🏾",
- "💃🏿",
- "💃",
- "💄",
- "💅🏻",
- "💅🏼",
- "💅🏽",
- "💅🏾",
- "💅🏿",
- "💅",
- "💆🏻♀️",
- "💆🏻♂️",
- "💆🏻",
- "💆🏼♀️",
- "💆🏼♂️",
- "💆🏼",
- "💆🏽♀️",
- "💆🏽♂️",
- "💆🏽",
- "💆🏾♀️",
- "💆🏾♂️",
- "💆🏾",
- "💆🏿♀️",
- "💆🏿♂️",
- "💆🏿",
- "💆♀️",
- "💆♂️",
- "💆",
- "💇🏻♀️",
- "💇🏻♂️",
- "💇🏻",
- "💇🏼♀️",
- "💇🏼♂️",
- "💇🏼",
- "💇🏽♀️",
- "💇🏽♂️",
- "💇🏽",
- "💇🏾♀️",
- "💇🏾♂️",
- "💇🏾",
- "💇🏿♀️",
- "💇🏿♂️",
- "💇🏿",
- "💇♀️",
- "💇♂️",
- "💇",
- "💈",
- "💉",
- "💊",
- "💋",
- "💌",
- "💍",
- "💎",
- "💏",
- "💐",
- "💑",
- "💒",
- "💓",
- "💔",
- "💕",
- "💖",
- "💗",
- "💘",
- "💙",
- "💚",
- "💛",
- "💜",
- "💝",
- "💞",
- "💟",
- "💠",
- "💡",
- "💢",
- "💣",
- "💤",
- "💥",
- "💦",
- "💧",
- "💨",
- "💩",
- "💪🏻",
- "💪🏼",
- "💪🏽",
- "💪🏾",
- "💪🏿",
- "💪",
- "💫",
- "💬",
- "💭",
- "💮",
- "💯",
- "💰",
- "💱",
- "💲",
- "💳",
- "💴",
- "💵",
- "💶",
- "💷",
- "💸",
- "💹",
- "💺",
- "💻",
- "💼",
- "💽",
- "💾",
- "💿",
- "📀",
- "📁",
- "📂",
- "📃",
- "📄",
- "📅",
- "📆",
- "📇",
- "📈",
- "📉",
- "📊",
- "📋",
- "📌",
- "📍",
- "📎",
- "📏",
- "📐",
- "📑",
- "📒",
- "📓",
- "📔",
- "📕",
- "📖",
- "📗",
- "📘",
- "📙",
- "📚",
- "📛",
- "📜",
- "📝",
- "📞",
- "📟",
- "📠",
- "📡",
- "📢",
- "📣",
- "📤",
- "📥",
- "📦",
- "📧",
- "📨",
- "📩",
- "📪",
- "📫",
- "📬",
- "📭",
- "📮",
- "📯",
- "📰",
- "📱",
- "📲",
- "📳",
- "📴",
- "📵",
- "📶",
- "📷",
- "📸",
- "📹",
- "📺",
- "📻",
- "📼",
- "📽️",
- "📿",
- "🔀",
- "🔁",
- "🔂",
- "🔃",
- "🔄",
- "🔅",
- "🔆",
- "🔇",
- "🔈",
- "🔉",
- "🔊",
- "🔋",
- "🔌",
- "🔍",
- "🔎",
- "🔏",
- "🔐",
- "🔑",
- "🔒",
- "🔓",
- "🔔",
- "🔕",
- "🔖",
- "🔗",
- "🔘",
- "🔙",
- "🔚",
- "🔛",
- "🔜",
- "🔝",
- "🔞",
- "🔟",
- "🔠",
- "🔡",
- "🔢",
- "🔣",
- "🔤",
- "🔥",
- "🔦",
- "🔧",
- "🔨",
- "🔩",
- "🔪",
- "🔫",
- "🔬",
- "🔭",
- "🔮",
- "🔯",
- "🔰",
- "🔱",
- "🔲",
- "🔳",
- "🔴",
- "🔵",
- "🔶",
- "🔷",
- "🔸",
- "🔹",
- "🔺",
- "🔻",
- "🔼",
- "🔽",
- "🕉️",
- "🕊️",
- "🕋",
- "🕌",
- "🕍",
- "🕎",
- "🕐",
- "🕑",
- "🕒",
- "🕓",
- "🕔",
- "🕕",
- "🕖",
- "🕗",
- "🕘",
- "🕙",
- "🕚",
- "🕛",
- "🕜",
- "🕝",
- "🕞",
- "🕟",
- "🕠",
- "🕡",
- "🕢",
- "🕣",
- "🕤",
- "🕥",
- "🕦",
- "🕧",
- "🕯️",
- "🕰️",
- "🕳️",
- "🕴🏻♀️",
- "🕴🏻♂️",
- "🕴🏻",
- "🕴🏼♀️",
- "🕴🏼♂️",
- "🕴🏼",
- "🕴🏽♀️",
- "🕴🏽♂️",
- "🕴🏽",
- "🕴🏾♀️",
- "🕴🏾♂️",
- "🕴🏾",
- "🕴🏿♀️",
- "🕴🏿♂️",
- "🕴🏿",
- "🕴️♀️",
- "🕴️♂️",
- "🕴️",
- "🕵🏻♀️",
- "🕵🏻♂️",
- "🕵🏻",
- "🕵🏼♀️",
- "🕵🏼♂️",
- "🕵🏼",
- "🕵🏽♀️",
- "🕵🏽♂️",
- "🕵🏽",
- "🕵🏾♀️",
- "🕵🏾♂️",
- "🕵🏾",
- "🕵🏿♀️",
- "🕵🏿♂️",
- "🕵🏿",
- "🕵️♀️",
- "🕵️♂️",
- "🕵️",
- "🕶️",
- "🕷️",
- "🕸️",
- "🕹️",
- "🕺🏻",
- "🕺🏼",
- "🕺🏽",
- "🕺🏾",
- "🕺🏿",
- "🕺",
- "🖇️",
- "🖊️",
- "🖋️",
- "🖌️",
- "🖍️",
- "🖐🏻",
- "🖐🏼",
- "🖐🏽",
- "🖐🏾",
- "🖐🏿",
- "🖐️",
- "🖕🏻",
- "🖕🏼",
- "🖕🏽",
- "🖕🏾",
- "🖕🏿",
- "🖕",
- "🖖🏻",
- "🖖🏼",
- "🖖🏽",
- "🖖🏾",
- "🖖🏿",
- "🖖",
- "🖤",
- "🖥️",
- "🖨️",
- "🖱️",
- "🖲️",
- "🖼️",
- "🗂️",
- "🗃️",
- "🗄️",
- "🗑️",
- "🗒️",
- "🗓️",
- "🗜️",
- "🗝️",
- "🗞️",
- "🗡️",
- "🗣️",
- "🗨️",
- "🗯️",
- "🗳️",
- "🗺️",
- "🗻",
- "🗼",
- "🗽",
- "🗾",
- "🗿",
- "😀",
- "😁",
- "😂",
- "😃",
- "😄",
- "😅",
- "😆",
- "😇",
- "😈",
- "😉",
- "😊",
- "😋",
- "😌",
- "😍",
- "😎",
- "😏",
- "😐",
- "😑",
- "😒",
- "😓",
- "😔",
- "😕",
- "😖",
- "😗",
- "😘",
- "😙",
- "😚",
- "😛",
- "😜",
- "😝",
- "😞",
- "😟",
- "😠",
- "😡",
- "😢",
- "😣",
- "😤",
- "😥",
- "😦",
- "😧",
- "😨",
- "😩",
- "😪",
- "😫",
- "😬",
- "😭",
- "😮",
- "😯",
- "😰",
- "😱",
- "😲",
- "😳",
- "😴",
- "😵",
- "😶",
- "😷",
- "😸",
- "😹",
- "😺",
- "😻",
- "😼",
- "😽",
- "😾",
- "😿",
- "🙀",
- "🙁",
- "🙂",
- "🙃",
- "🙄",
- "🙅🏻♀️",
- "🙅🏻♂️",
- "🙅🏻",
- "🙅🏼♀️",
- "🙅🏼♂️",
- "🙅🏼",
- "🙅🏽♀️",
- "🙅🏽♂️",
- "🙅🏽",
- "🙅🏾♀️",
- "🙅🏾♂️",
- "🙅🏾",
- "🙅🏿♀️",
- "🙅🏿♂️",
- "🙅🏿",
- "🙅♀️",
- "🙅♂️",
- "🙅",
- "🙆🏻♀️",
- "🙆🏻♂️",
- "🙆🏻",
- "🙆🏼♀️",
- "🙆🏼♂️",
- "🙆🏼",
- "🙆🏽♀️",
- "🙆🏽♂️",
- "🙆🏽",
- "🙆🏾♀️",
- "🙆🏾♂️",
- "🙆🏾",
- "🙆🏿♀️",
- "🙆🏿♂️",
- "🙆🏿",
- "🙆♀️",
- "🙆♂️",
- "🙆",
- "🙇🏻♀️",
- "🙇🏻♂️",
- "🙇🏻",
- "🙇🏼♀️",
- "🙇🏼♂️",
- "🙇🏼",
- "🙇🏽♀️",
- "🙇🏽♂️",
- "🙇🏽",
- "🙇🏾♀️",
- "🙇🏾♂️",
- "🙇🏾",
- "🙇🏿♀️",
- "🙇🏿♂️",
- "🙇🏿",
- "🙇♀️",
- "🙇♂️",
- "🙇",
- "🙈",
- "🙉",
- "🙊",
- "🙋🏻♀️",
- "🙋🏻♂️",
- "🙋🏻",
- "🙋🏼♀️",
- "🙋🏼♂️",
- "🙋🏼",
- "🙋🏽♀️",
- "🙋🏽♂️",
- "🙋🏽",
- "🙋🏾♀️",
- "🙋🏾♂️",
- "🙋🏾",
- "🙋🏿♀️",
- "🙋🏿♂️",
- "🙋🏿",
- "🙋♀️",
- "🙋♂️",
- "🙋",
- "🙌🏻",
- "🙌🏼",
- "🙌🏽",
- "🙌🏾",
- "🙌🏿",
- "🙌",
- "🙍🏻♀️",
- "🙍🏻♂️",
- "🙍🏻",
- "🙍🏼♀️",
- "🙍🏼♂️",
- "🙍🏼",
- "🙍🏽♀️",
- "🙍🏽♂️",
- "🙍🏽",
- "🙍🏾♀️",
- "🙍🏾♂️",
- "🙍🏾",
- "🙍🏿♀️",
- "🙍🏿♂️",
- "🙍🏿",
- "🙍♀️",
- "🙍♂️",
- "🙍",
- "🙎🏻♀️",
- "🙎🏻♂️",
- "🙎🏻",
- "🙎🏼♀️",
- "🙎🏼♂️",
- "🙎🏼",
- "🙎🏽♀️",
- "🙎🏽♂️",
- "🙎🏽",
- "🙎🏾♀️",
- "🙎🏾♂️",
- "🙎🏾",
- "🙎🏿♀️",
- "🙎🏿♂️",
- "🙎🏿",
- "🙎♀️",
- "🙎♂️",
- "🙎",
- "🙏🏻",
- "🙏🏼",
- "🙏🏽",
- "🙏🏾",
- "🙏🏿",
- "🙏",
- "🚀",
- "🚁",
- "🚂",
- "🚃",
- "🚄",
- "🚅",
- "🚆",
- "🚇",
- "🚈",
- "🚉",
- "🚊",
- "🚋",
- "🚌",
- "🚍",
- "🚎",
- "🚏",
- "🚐",
- "🚑",
- "🚒",
- "🚓",
- "🚔",
- "🚕",
- "🚖",
- "🚗",
- "🚘",
- "🚙",
- "🚚",
- "🚛",
- "🚜",
- "🚝",
- "🚞",
- "🚟",
- "🚠",
- "🚡",
- "🚢",
- "🚣🏻♀️",
- "🚣🏻♂️",
- "🚣🏻",
- "🚣🏼♀️",
- "🚣🏼♂️",
- "🚣🏼",
- "🚣🏽♀️",
- "🚣🏽♂️",
- "🚣🏽",
- "🚣🏾♀️",
- "🚣🏾♂️",
- "🚣🏾",
- "🚣🏿♀️",
- "🚣🏿♂️",
- "🚣🏿",
- "🚣♀️",
- "🚣♂️",
- "🚣",
- "🚤",
- "🚥",
- "🚦",
- "🚧",
- "🚨",
- "🚩",
- "🚪",
- "🚫",
- "🚬",
- "🚭",
- "🚮",
- "🚯",
- "🚰",
- "🚱",
- "🚲",
- "🚳",
- "🚴🏻♀️",
- "🚴🏻♂️",
- "🚴🏻",
- "🚴🏼♀️",
- "🚴🏼♂️",
- "🚴🏼",
- "🚴🏽♀️",
- "🚴🏽♂️",
- "🚴🏽",
- "🚴🏾♀️",
- "🚴🏾♂️",
- "🚴🏾",
- "🚴🏿♀️",
- "🚴🏿♂️",
- "🚴🏿",
- "🚴♀️",
- "🚴♂️",
- "🚴",
- "🚵🏻♀️",
- "🚵🏻♂️",
- "🚵🏻",
- "🚵🏼♀️",
- "🚵🏼♂️",
- "🚵🏼",
- "🚵🏽♀️",
- "🚵🏽♂️",
- "🚵🏽",
- "🚵🏾♀️",
- "🚵🏾♂️",
- "🚵🏾",
- "🚵🏿♀️",
- "🚵🏿♂️",
- "🚵🏿",
- "🚵♀️",
- "🚵♂️",
- "🚵",
- "🚶🏻♀️",
- "🚶🏻♂️",
- "🚶🏻",
- "🚶🏼♀️",
- "🚶🏼♂️",
- "🚶🏼",
- "🚶🏽♀️",
- "🚶🏽♂️",
- "🚶🏽",
- "🚶🏾♀️",
- "🚶🏾♂️",
- "🚶🏾",
- "🚶🏿♀️",
- "🚶🏿♂️",
- "🚶🏿",
- "🚶♀️",
- "🚶♂️",
- "🚶",
- "🚷",
- "🚸",
- "🚹",
- "🚺",
- "🚻",
- "🚼",
- "🚽",
- "🚾",
- "🚿",
- "🛀🏻",
- "🛀🏼",
- "🛀🏽",
- "🛀🏾",
- "🛀🏿",
- "🛀",
- "🛁",
- "🛂",
- "🛃",
- "🛄",
- "🛅",
- "🛋️",
- "🛌🏻",
- "🛌🏼",
- "🛌🏽",
- "🛌🏾",
- "🛌🏿",
- "🛌",
- "🛍️",
- "🛎️",
- "🛏️",
- "🛐",
- "🛑",
- "🛒",
- "🛕",
- "🛠️",
- "🛡️",
- "🛢️",
- "🛣️",
- "🛤️",
- "🛥️",
- "🛩️",
- "🛫",
- "🛬",
- "🛰️",
- "🛳️",
- "🛴",
- "🛵",
- "🛶",
- "🛷",
- "🛸",
- "🛹",
- "🛺",
- "🟠",
- "🟡",
- "🟢",
- "🟣",
- "🟤",
- "🟥",
- "🟦",
- "🟧",
- "🟨",
- "🟩",
- "🟪",
- "🟫",
- "🤍",
- "🤎",
- "🤏🏻",
- "🤏🏼",
- "🤏🏽",
- "🤏🏾",
- "🤏🏿",
- "🤏",
- "🤐",
- "🤑",
- "🤒",
- "🤓",
- "🤔",
- "🤕",
- "🤖",
- "🤗",
- "🤘🏻",
- "🤘🏼",
- "🤘🏽",
- "🤘🏾",
- "🤘🏿",
- "🤘",
- "🤙🏻",
- "🤙🏼",
- "🤙🏽",
- "🤙🏾",
- "🤙🏿",
- "🤙",
- "🤚🏻",
- "🤚🏼",
- "🤚🏽",
- "🤚🏾",
- "🤚🏿",
- "🤚",
- "🤛🏻",
- "🤛🏼",
- "🤛🏽",
- "🤛🏾",
- "🤛🏿",
- "🤛",
- "🤜🏻",
- "🤜🏼",
- "🤜🏽",
- "🤜🏾",
- "🤜🏿",
- "🤜",
- "🤝",
- "🤞🏻",
- "🤞🏼",
- "🤞🏽",
- "🤞🏾",
- "🤞🏿",
- "🤞",
- "🤟🏻",
- "🤟🏼",
- "🤟🏽",
- "🤟🏾",
- "🤟🏿",
- "🤟",
- "🤠",
- "🤡",
- "🤢",
- "🤣",
- "🤤",
- "🤥",
- "🤦🏻♀️",
- "🤦🏻♂️",
- "🤦🏻",
- "🤦🏼♀️",
- "🤦🏼♂️",
- "🤦🏼",
- "🤦🏽♀️",
- "🤦🏽♂️",
- "🤦🏽",
- "🤦🏾♀️",
- "🤦🏾♂️",
- "🤦🏾",
- "🤦🏿♀️",
- "🤦🏿♂️",
- "🤦🏿",
- "🤦♀️",
- "🤦♂️",
- "🤦",
- "🤧",
- "🤨",
- "🤩",
- "🤪",
- "🤫",
- "🤬",
- "🤭",
- "🤮",
- "🤯",
- "🤰🏻",
- "🤰🏼",
- "🤰🏽",
- "🤰🏾",
- "🤰🏿",
- "🤰",
- "🤱🏻",
- "🤱🏼",
- "🤱🏽",
- "🤱🏾",
- "🤱🏿",
- "🤱",
- "🤲🏻",
- "🤲🏼",
- "🤲🏽",
- "🤲🏾",
- "🤲🏿",
- "🤲",
- "🤳🏻",
- "🤳🏼",
- "🤳🏽",
- "🤳🏾",
- "🤳🏿",
- "🤳",
- "🤴🏻",
- "🤴🏼",
- "🤴🏽",
- "🤴🏾",
- "🤴🏿",
- "🤴",
- "🤵🏻♀️",
- "🤵🏻♂️",
- "🤵🏻",
- "🤵🏼♀️",
- "🤵🏼♂️",
- "🤵🏼",
- "🤵🏽♀️",
- "🤵🏽♂️",
- "🤵🏽",
- "🤵🏾♀️",
- "🤵🏾♂️",
- "🤵🏾",
- "🤵🏿♀️",
- "🤵🏿♂️",
- "🤵🏿",
- "🤵♀️",
- "🤵♂️",
- "🤵",
- "🤶🏻",
- "🤶🏼",
- "🤶🏽",
- "🤶🏾",
- "🤶🏿",
- "🤶",
- "🤷🏻♀️",
- "🤷🏻♂️",
- "🤷🏻",
- "🤷🏼♀️",
- "🤷🏼♂️",
- "🤷🏼",
- "🤷🏽♀️",
- "🤷🏽♂️",
- "🤷🏽",
- "🤷🏾♀️",
- "🤷🏾♂️",
- "🤷🏾",
- "🤷🏿♀️",
- "🤷🏿♂️",
- "🤷🏿",
- "🤷♀️",
- "🤷♂️",
- "🤷",
- "🤸🏻♀️",
- "🤸🏻♂️",
- "🤸🏻",
- "🤸🏼♀️",
- "🤸🏼♂️",
- "🤸🏼",
- "🤸🏽♀️",
- "🤸🏽♂️",
- "🤸🏽",
- "🤸🏾♀️",
- "🤸🏾♂️",
- "🤸🏾",
- "🤸🏿♀️",
- "🤸🏿♂️",
- "🤸🏿",
- "🤸♀️",
- "🤸♂️",
- "🤸",
- "🤹🏻♀️",
- "🤹🏻♂️",
- "🤹🏻",
- "🤹🏼♀️",
- "🤹🏼♂️",
- "🤹🏼",
- "🤹🏽♀️",
- "🤹🏽♂️",
- "🤹🏽",
- "🤹🏾♀️",
- "🤹🏾♂️",
- "🤹🏾",
- "🤹🏿♀️",
- "🤹🏿♂️",
- "🤹🏿",
- "🤹♀️",
- "🤹♂️",
- "🤹",
- "🤺",
- "🤼♀️",
- "🤼♂️",
- "🤼",
- "🤽🏻♀️",
- "🤽🏻♂️",
- "🤽🏻",
- "🤽🏼♀️",
- "🤽🏼♂️",
- "🤽🏼",
- "🤽🏽♀️",
- "🤽🏽♂️",
- "🤽🏽",
- "🤽🏾♀️",
- "🤽🏾♂️",
- "🤽🏾",
- "🤽🏿♀️",
- "🤽🏿♂️",
- "🤽🏿",
- "🤽♀️",
- "🤽♂️",
- "🤽",
- "🤾🏻♀️",
- "🤾🏻♂️",
- "🤾🏻",
- "🤾🏼♀️",
- "🤾🏼♂️",
- "🤾🏼",
- "🤾🏽♀️",
- "🤾🏽♂️",
- "🤾🏽",
- "🤾🏾♀️",
- "🤾🏾♂️",
- "🤾🏾",
- "🤾🏿♀️",
- "🤾🏿♂️",
- "🤾🏿",
- "🤾♀️",
- "🤾♂️",
- "🤾",
- "🤿",
- "🥀",
- "🥁",
- "🥂",
- "🥃",
- "🥄",
- "🥅",
- "🥇",
- "🥈",
- "🥉",
- "🥊",
- "🥋",
- "🥌",
- "🥍",
- "🥎",
- "🥏",
- "🥐",
- "🥑",
- "🥒",
- "🥓",
- "🥔",
- "🥕",
- "🥖",
- "🥗",
- "🥘",
- "🥙",
- "🥚",
- "🥛",
- "🥜",
- "🥝",
- "🥞",
- "🥟",
- "🥠",
- "🥡",
- "🥢",
- "🥣",
- "🥤",
- "🥥",
- "🥦",
- "🥧",
- "🥨",
- "🥩",
- "🥪",
- "🥫",
- "🥬",
- "🥭",
- "🥮",
- "🥯",
- "🥰",
- "🥱",
- "🥳",
- "🥴",
- "🥵",
- "🥶",
- "🥺",
- "🥻",
- "🥼",
- "🥽",
- "🥾",
- "🥿",
- "🦀",
- "🦁",
- "🦂",
- "🦃",
- "🦄",
- "🦅",
- "🦆",
- "🦇",
- "🦈",
- "🦉",
- "🦊",
- "🦋",
- "🦌",
- "🦍",
- "🦎",
- "🦏",
- "🦐",
- "🦑",
- "🦒",
- "🦓",
- "🦔",
- "🦕",
- "🦖",
- "🦗",
- "🦘",
- "🦙",
- "🦚",
- "🦛",
- "🦜",
- "🦝",
- "🦞",
- "🦟",
- "🦠",
- "🦡",
- "🦢",
- "🦥",
- "🦦",
- "🦧",
- "🦨",
- "🦩",
- "🦪",
- "🦮",
- "🦯",
- "🦰",
- "🦱",
- "🦲",
- "🦳",
- "🦴",
- "🦵🏻",
- "🦵🏼",
- "🦵🏽",
- "🦵🏾",
- "🦵🏿",
- "🦵",
- "🦶🏻",
- "🦶🏼",
- "🦶🏽",
- "🦶🏾",
- "🦶🏿",
- "🦶",
- "🦷",
- "🦸🏻♀️",
- "🦸🏻♂️",
- "🦸🏻",
- "🦸🏼♀️",
- "🦸🏼♂️",
- "🦸🏼",
- "🦸🏽♀️",
- "🦸🏽♂️",
- "🦸🏽",
- "🦸🏾♀️",
- "🦸🏾♂️",
- "🦸🏾",
- "🦸🏿♀️",
- "🦸🏿♂️",
- "🦸🏿",
- "🦸♀️",
- "🦸♂️",
- "🦸",
- "🦹🏻♀️",
- "🦹🏻♂️",
- "🦹🏻",
- "🦹🏼♀️",
- "🦹🏼♂️",
- "🦹🏼",
- "🦹🏽♀️",
- "🦹🏽♂️",
- "🦹🏽",
- "🦹🏾♀️",
- "🦹🏾♂️",
- "🦹🏾",
- "🦹🏿♀️",
- "🦹🏿♂️",
- "🦹🏿",
- "🦹♀️",
- "🦹♂️",
- "🦹",
- "🦺",
- "🦻🏻",
- "🦻🏼",
- "🦻🏽",
- "🦻🏾",
- "🦻🏿",
- "🦻",
- "🦼",
- "🦽",
- "🦾",
- "🦿",
- "🧀",
- "🧁",
- "🧂",
- "🧃",
- "🧄",
- "🧅",
- "🧆",
- "🧇",
- "🧈",
- "🧉",
- "🧊",
- "🧍🏻♀️",
- "🧍🏻♂️",
- "🧍🏻",
- "🧍🏼♀️",
- "🧍🏼♂️",
- "🧍🏼",
- "🧍🏽♀️",
- "🧍🏽♂️",
- "🧍🏽",
- "🧍🏾♀️",
- "🧍🏾♂️",
- "🧍🏾",
- "🧍🏿♀️",
- "🧍🏿♂️",
- "🧍🏿",
- "🧍♀️",
- "🧍♂️",
- "🧍",
- "🧎🏻♀️",
- "🧎🏻♂️",
- "🧎🏻",
- "🧎🏼♀️",
- "🧎🏼♂️",
- "🧎🏼",
- "🧎🏽♀️",
- "🧎🏽♂️",
- "🧎🏽",
- "🧎🏾♀️",
- "🧎🏾♂️",
- "🧎🏾",
- "🧎🏿♀️",
- "🧎🏿♂️",
- "🧎🏿",
- "🧎♀️",
- "🧎♂️",
- "🧎",
- "🧏🏻♀️",
- "🧏🏻♂️",
- "🧏🏻",
- "🧏🏼♀️",
- "🧏🏼♂️",
- "🧏🏼",
- "🧏🏽♀️",
- "🧏🏽♂️",
- "🧏🏽",
- "🧏🏾♀️",
- "🧏🏾♂️",
- "🧏🏾",
- "🧏🏿♀️",
- "🧏🏿♂️",
- "🧏🏿",
- "🧏♀️",
- "🧏♂️",
- "🧏",
- "🧐",
- "🧑🏻🤝🧑🏻",
- "🧑🏻",
- "🧑🏼🤝🧑🏻",
- "🧑🏼🤝🧑🏼",
- "🧑🏼",
- "🧑🏽🤝🧑🏻",
- "🧑🏽🤝🧑🏼",
- "🧑🏽🤝🧑🏽",
- "🧑🏽",
- "🧑🏾🤝🧑🏻",
- "🧑🏾🤝🧑🏼",
- "🧑🏾🤝🧑🏽",
- "🧑🏾🤝🧑🏾",
- "🧑🏾",
- "🧑🏿🤝🧑🏻",
- "🧑🏿🤝🧑🏼",
- "🧑🏿🤝🧑🏽",
- "🧑🏿🤝🧑🏾",
- "🧑🏿🤝🧑🏿",
- "🧑🏿",
- "🧑🤝🧑",
- "🧑",
- "🧒🏻",
- "🧒🏼",
- "🧒🏽",
- "🧒🏾",
- "🧒🏿",
- "🧒",
- "🧓🏻",
- "🧓🏼",
- "🧓🏽",
- "🧓🏾",
- "🧓🏿",
- "🧓",
- "🧔🏻",
- "🧔🏼",
- "🧔🏽",
- "🧔🏾",
- "🧔🏿",
- "🧔",
- "🧕🏻",
- "🧕🏼",
- "🧕🏽",
- "🧕🏾",
- "🧕🏿",
- "🧕",
- "🧖🏻♀️",
- "🧖🏻♂️",
- "🧖🏻",
- "🧖🏼♀️",
- "🧖🏼♂️",
- "🧖🏼",
- "🧖🏽♀️",
- "🧖🏽♂️",
- "🧖🏽",
- "🧖🏾♀️",
- "🧖🏾♂️",
- "🧖🏾",
- "🧖🏿♀️",
- "🧖🏿♂️",
- "🧖🏿",
- "🧖♀️",
- "🧖♂️",
- "🧖",
- "🧗🏻♀️",
- "🧗🏻♂️",
- "🧗🏻",
- "🧗🏼♀️",
- "🧗🏼♂️",
- "🧗🏼",
- "🧗🏽♀️",
- "🧗🏽♂️",
- "🧗🏽",
- "🧗🏾♀️",
- "🧗🏾♂️",
- "🧗🏾",
- "🧗🏿♀️",
- "🧗🏿♂️",
- "🧗🏿",
- "🧗♀️",
- "🧗♂️",
- "🧗",
- "🧘🏻♀️",
- "🧘🏻♂️",
- "🧘🏻",
- "🧘🏼♀️",
- "🧘🏼♂️",
- "🧘🏼",
- "🧘🏽♀️",
- "🧘🏽♂️",
- "🧘🏽",
- "🧘🏾♀️",
- "🧘🏾♂️",
- "🧘🏾",
- "🧘🏿♀️",
- "🧘🏿♂️",
- "🧘🏿",
- "🧘♀️",
- "🧘♂️",
- "🧘",
- "🧙🏻♀️",
- "🧙🏻♂️",
- "🧙🏻",
- "🧙🏼♀️",
- "🧙🏼♂️",
- "🧙🏼",
- "🧙🏽♀️",
- "🧙🏽♂️",
- "🧙🏽",
- "🧙🏾♀️",
- "🧙🏾♂️",
- "🧙🏾",
- "🧙🏿♀️",
- "🧙🏿♂️",
- "🧙🏿",
- "🧙♀️",
- "🧙♂️",
- "🧙",
- "🧚🏻♀️",
- "🧚🏻♂️",
- "🧚🏻",
- "🧚🏼♀️",
- "🧚🏼♂️",
- "🧚🏼",
- "🧚🏽♀️",
- "🧚🏽♂️",
- "🧚🏽",
- "🧚🏾♀️",
- "🧚🏾♂️",
- "🧚🏾",
- "🧚🏿♀️",
- "🧚🏿♂️",
- "🧚🏿",
- "🧚♀️",
- "🧚♂️",
- "🧚",
- "🧛🏻♀️",
- "🧛🏻♂️",
- "🧛🏻",
- "🧛🏼♀️",
- "🧛🏼♂️",
- "🧛🏼",
- "🧛🏽♀️",
- "🧛🏽♂️",
- "🧛🏽",
- "🧛🏾♀️",
- "🧛🏾♂️",
- "🧛🏾",
- "🧛🏿♀️",
- "🧛🏿♂️",
- "🧛🏿",
- "🧛♀️",
- "🧛♂️",
- "🧛",
- "🧜🏻♀️",
- "🧜🏻♂️",
- "🧜🏻",
- "🧜🏼♀️",
- "🧜🏼♂️",
- "🧜🏼",
- "🧜🏽♀️",
- "🧜🏽♂️",
- "🧜🏽",
- "🧜🏾♀️",
- "🧜🏾♂️",
- "🧜🏾",
- "🧜🏿♀️",
- "🧜🏿♂️",
- "🧜🏿",
- "🧜♀️",
- "🧜♂️",
- "🧜",
- "🧝🏻♀️",
- "🧝🏻♂️",
- "🧝🏻",
- "🧝🏼♀️",
- "🧝🏼♂️",
- "🧝🏼",
- "🧝🏽♀️",
- "🧝🏽♂️",
- "🧝🏽",
- "🧝🏾♀️",
- "🧝🏾♂️",
- "🧝🏾",
- "🧝🏿♀️",
- "🧝🏿♂️",
- "🧝🏿",
- "🧝♀️",
- "🧝♂️",
- "🧝",
- "🧞♀️",
- "🧞♂️",
- "🧞",
- "🧟♀️",
- "🧟♂️",
- "🧟",
- "🧠",
- "🧡",
- "🧢",
- "🧣",
- "🧤",
- "🧥",
- "🧦",
- "🧧",
- "🧨",
- "🧩",
- "🧪",
- "🧫",
- "🧬",
- "🧭",
- "🧮",
- "🧯",
- "🧰",
- "🧱",
- "🧲",
- "🧳",
- "🧴",
- "🧵",
- "🧶",
- "🧷",
- "🧸",
- "🧹",
- "🧺",
- "🧻",
- "🧼",
- "🧽",
- "🧾",
- "🧿",
- "🩰",
- "🩱",
- "🩲",
- "🩳",
- "🩸",
- "🩹",
- "🩺",
- "🪀",
- "🪁",
- "🪂",
- "🪐",
- "🪑",
- "🪒",
- "🪓",
- "🪔",
- "🪕",
- "‼️",
- "⁉️",
- "™️",
- "ℹ️",
- "↔️",
- "↕️",
- "↖️",
- "↗️",
- "↘️",
- "↙️",
- "↩️",
- "↪️",
- "#⃣",
- "⌚️",
- "⌛️",
- "⌨️",
- "⏏️",
- "⏩",
- "⏪",
- "⏫",
- "⏬",
- "⏭️",
- "⏮️",
- "⏯️",
- "⏰",
- "⏱️",
- "⏲️",
- "⏳",
- "⏸️",
- "⏹️",
- "⏺️",
- "Ⓜ️",
- "▪️",
- "▫️",
- "▶️",
- "◀️",
- "◻️",
- "◼️",
- "◽️",
- "◾️",
- "☀️",
- "☁️",
- "☂️",
- "☃️",
- "☄️",
- "☎️",
- "☑️",
- "☔️",
- "☕️",
- "☘️",
- "☝🏻",
- "☝🏼",
- "☝🏽",
- "☝🏾",
- "☝🏿",
- "☝️",
- "☠️",
- "☢️",
- "☣️",
- "☦️",
- "☪️",
- "☮️",
- "☯️",
- "☸️",
- "☹️",
- "☺️",
- "♀️",
- "♂️",
- "♈️",
- "♉️",
- "♊️",
- "♋️",
- "♌️",
- "♍️",
- "♎️",
- "♏️",
- "♐️",
- "♑️",
- "♒️",
- "♓️",
- "♟️",
- "♠️",
- "♣️",
- "♥️",
- "♦️",
- "♨️",
- "♻️",
- "♾",
- "♿️",
- "⚒️",
- "⚓️",
- "⚔️",
- "⚕️",
- "⚖️",
- "⚗️",
- "⚙️",
- "⚛️",
- "⚜️",
- "⚠️",
- "⚡️",
- "⚪️",
- "⚫️",
- "⚰️",
- "⚱️",
- "⚽️",
- "⚾️",
- "⛄️",
- "⛅️",
- "⛈️",
- "⛎",
- "⛏️",
- "⛑️",
- "⛓️",
- "⛔️",
- "⛩️",
- "⛪️",
- "⛰️",
- "⛱️",
- "⛲️",
- "⛳️",
- "⛴️",
- "⛵️",
- "⛷🏻",
- "⛷🏼",
- "⛷🏽",
- "⛷🏾",
- "⛷🏿",
- "⛷️",
- "⛸️",
- "⛹🏻♀️",
- "⛹🏻♂️",
- "⛹🏻",
- "⛹🏼♀️",
- "⛹🏼♂️",
- "⛹🏼",
- "⛹🏽♀️",
- "⛹🏽♂️",
- "⛹🏽",
- "⛹🏾♀️",
- "⛹🏾♂️",
- "⛹🏾",
- "⛹🏿♀️",
- "⛹🏿♂️",
- "⛹🏿",
- "⛹️♀️",
- "⛹️♂️",
- "⛹️",
- "⛺️",
- "⛽️",
- "✂️",
- "✅",
- "✈️",
- "✉️",
- "✊🏻",
- "✊🏼",
- "✊🏽",
- "✊🏾",
- "✊🏿",
- "✊",
- "✋🏻",
- "✋🏼",
- "✋🏽",
- "✋🏾",
- "✋🏿",
- "✋",
- "✌🏻",
- "✌🏼",
- "✌🏽",
- "✌🏾",
- "✌🏿",
- "✌️",
- "✍🏻",
- "✍🏼",
- "✍🏽",
- "✍🏾",
- "✍🏿",
- "✍️",
- "✏️",
- "✒️",
- "✔️",
- "✖️",
- "✝️",
- "✡️",
- "✨",
- "✳️",
- "✴️",
- "❄️",
- "❇️",
- "❌",
- "❎",
- "❓",
- "❔",
- "❕",
- "❗️",
- "❣️",
- "❤️",
- "➕",
- "➖",
- "➗",
- "➡️",
- "➰",
- "➿",
- "⤴️",
- "⤵️",
- "*⃣",
- "⬅️",
- "⬆️",
- "⬇️",
- "⬛️",
- "⬜️",
- "⭐️",
- "⭕️",
- "0⃣",
- "〰️",
- "〽️",
- "1⃣",
- "2⃣",
- "㊗️",
- "㊙️",
- "3⃣",
- "4⃣",
- "5⃣",
- "6⃣",
- "7⃣",
- "8⃣",
- "9⃣",
- "©️",
- "®️",
- ""
- ];
- const emojiRegex = /[\uD800-\uDFFF]./;
- const emojiList = emojisList.filter((emoji) => emojiRegex.test(emoji));
- const emojiCache = {};
- function encodeStringToEmoji(content, length) {
- if (emojiCache[content]) {
- return emojiCache[content];
- }
- length = length || 1;
- const emojis = [];
- do {
- if (!emojiList.length) {
- throw new Error('Ran out of emoji');
- }
- const index = Math.floor(Math.random() * emojiList.length);
- emojis.push(emojiList[index]);
- emojiList.splice(index, 1);
- } while (--length > 0);
- const emojiEncoding = emojis.join('');
- emojiCache[content] = emojiEncoding;
- return emojiEncoding;
- }
- function interpolateName(loaderContext, name, options) {
- let filename;
- const hasQuery =
- loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1;
- if (typeof name === 'function') {
- filename = name(
- loaderContext.resourcePath,
- hasQuery ? loaderContext.resourceQuery : undefined
- );
- } else {
- filename = name || '[hash].[ext]';
- }
- const context = options.context;
- const content = options.content;
- const regExp = options.regExp;
- let ext = 'bin';
- let basename = 'file';
- let directory = '';
- let folder = '';
- let query = '';
- if (loaderContext.resourcePath) {
- const parsed = path__default.parse(loaderContext.resourcePath);
- let resourcePath = loaderContext.resourcePath;
- if (parsed.ext) {
- ext = parsed.ext.substr(1);
- }
- if (parsed.dir) {
- basename = parsed.name;
- resourcePath = parsed.dir + path__default.sep;
- }
- if (typeof context !== 'undefined') {
- directory = path__default
- .relative(context, resourcePath + '_')
- .replace(/\\/g, '/')
- .replace(/\.\.(\/)?/g, '_$1');
- directory = directory.substr(0, directory.length - 1);
- } else {
- directory = resourcePath.replace(/\\/g, '/').replace(/\.\.(\/)?/g, '_$1');
- }
- if (directory.length === 1) {
- directory = '';
- } else if (directory.length > 1) {
- folder = path__default.basename(directory);
- }
- }
- if (loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1) {
- query = loaderContext.resourceQuery;
- const hashIdx = query.indexOf('#');
- if (hashIdx >= 0) {
- query = query.substr(0, hashIdx);
- }
- }
- let url = filename;
- if (content) {
- // Match hash template
- url = url
- // `hash` and `contenthash` are same in `loader-utils` context
- // let's keep `hash` for backward compatibility
- .replace(
- /\[(?:([^:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi,
- (all, hashType, digestType, maxLength) =>
- getHashDigest_1(content, hashType, digestType, parseInt(maxLength, 10))
- )
- .replace(/\[emoji(?::(\d+))?\]/gi, (all, length) =>
- encodeStringToEmoji(content, parseInt(length, 10))
- );
- }
- url = url
- .replace(/\[ext\]/gi, () => ext)
- .replace(/\[name\]/gi, () => basename)
- .replace(/\[path\]/gi, () => directory)
- .replace(/\[folder\]/gi, () => folder)
- .replace(/\[query\]/gi, () => query);
- if (regExp && loaderContext.resourcePath) {
- const match = loaderContext.resourcePath.match(new RegExp(regExp));
- match &&
- match.forEach((matched, i) => {
- url = url.replace(new RegExp('\\[' + i + '\\]', 'ig'), matched);
- });
- }
- if (
- typeof loaderContext.options === 'object' &&
- typeof loaderContext.options.customInterpolateName === 'function'
- ) {
- url = loaderContext.options.customInterpolateName.call(
- loaderContext,
- url,
- name,
- options
- );
- }
- return url;
- }
- var interpolateName_1 = interpolateName;
- var getOptions_1$1 = getOptions_1;
- var parseQuery_1$1 = parseQuery_1;
- var stringifyRequest_1$1 = stringifyRequest_1;
- var getRemainingRequest_1$1 = getRemainingRequest_1;
- var getCurrentRequest_1$1 = getCurrentRequest_1;
- var isUrlRequest_1$1 = isUrlRequest_1;
- var urlToRequest_1$1 = urlToRequest_1;
- var parseString_1$1 = parseString_1;
- var getHashDigest_1$1 = getHashDigest_1;
- var interpolateName_1$1 = interpolateName_1;
- var lib$1 = {
- getOptions: getOptions_1$1,
- parseQuery: parseQuery_1$1,
- stringifyRequest: stringifyRequest_1$1,
- getRemainingRequest: getRemainingRequest_1$1,
- getCurrentRequest: getCurrentRequest_1$1,
- isUrlRequest: isUrlRequest_1$1,
- urlToRequest: urlToRequest_1$1,
- parseString: parseString_1$1,
- getHashDigest: getHashDigest_1$1,
- interpolateName: interpolateName_1$1
- };
- var interpolateName$1 = lib$1.interpolateName;
- /**
- * @param {string} pattern
- * @param {object} options
- * @param {string} options.context
- * @param {string} options.hashPrefix
- * @return {function}
- */
- var genericNames = function createGenerator(pattern, options) {
- options = options || {};
- var context =
- options && typeof options.context === "string"
- ? options.context
- : process.cwd();
- var hashPrefix =
- options && typeof options.hashPrefix === "string" ? options.hashPrefix : "";
- /**
- * @param {string} localName Usually a class name
- * @param {string} filepath Absolute path
- * @return {string}
- */
- return function generate(localName, filepath) {
- var name = pattern.replace(/\[local\]/gi, localName);
- var loaderContext = {
- resourcePath: filepath
- };
- var loaderOptions = {
- content:
- hashPrefix +
- path__default.relative(context, filepath).replace(/\\/g, "/") +
- "+" +
- localName,
- context: context
- };
- var genericName = interpolateName$1(loaderContext, name, loaderOptions);
- return genericName
- .replace(new RegExp("[^a-zA-Z0-9\\-_\u00A0-\uFFFF]", "g"), "-")
- .replace(/^((-?[0-9])|--)/, "_$1");
- };
- };
- var _default = unquote;
- // copied from https://github.com/lakenen/node-unquote
- var reg = /['"]/;
- function unquote(str) {
- if (!str) {
- return "";
- }
- if (reg.test(str.charAt(0))) {
- str = str.substr(1);
- }
- if (reg.test(str.charAt(str.length - 1))) {
- str = str.substr(0, str.length - 1);
- }
- return str;
- }
- var unquote_1 = /*#__PURE__*/Object.defineProperty({
- default: _default
- }, '__esModule', {value: true});
- var replaceAll_1 = replaceAll;
- var matchConstName = /[$#]?[\w-\.]+/g;
- function replaceAll(replacements, text) {
- var matches = void 0;
- while (matches = matchConstName.exec(text)) {
- var replacement = replacements[matches[0]];
- if (replacement) {
- text = text.slice(0, matches.index) + replacement + text.slice(matchConstName.lastIndex);
- matchConstName.lastIndex -= matches[0].length - replacement.length;
- }
- }
- return text;
- }
- var _default$1 = function (css, translations) {
- css.walkDecls(function (decl) {
- return decl.value = replaceAll(translations, decl.value);
- });
- css.walkAtRules('media', function (atRule) {
- return atRule.params = replaceAll(translations, atRule.params);
- });
- };
- var lib$2 = /*#__PURE__*/Object.defineProperty({
- replaceAll: replaceAll_1,
- default: _default$1
- }, '__esModule', {value: true});
- var _icssReplaceSymbols2 = _interopRequireDefault(lib$2);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- // Copied from https://github.com/css-modules/css-modules-loader-core
- const importRegexp = /^:import\((.+)\)$/;
- class Parser {
- constructor(pathFetcher, trace) {
- this.pathFetcher = pathFetcher;
- this.plugin = this.plugin.bind(this);
- this.exportTokens = {};
- this.translations = {};
- this.trace = trace;
- }
- plugin() {
- const parser = this;
- return {
- postcssPlugin: "css-modules-parser",
- OnceExit(css) {
- return Promise.all(parser.fetchAllImports(css)).then(() => parser.linkImportedSymbols(css)).then(() => parser.extractExports(css));
- }
- };
- }
- fetchAllImports(css) {
- let imports = [];
- css.each(node => {
- if (node.type == "rule" && node.selector.match(importRegexp)) {
- imports.push(this.fetchImport(node, css.source.input.from, imports.length));
- }
- });
- return imports;
- }
- linkImportedSymbols(css) {
- (0, _icssReplaceSymbols2.default)(css, this.translations);
- }
- extractExports(css) {
- css.each(node => {
- if (node.type == "rule" && node.selector == ":export") this.handleExport(node);
- });
- }
- handleExport(exportNode) {
- exportNode.each(decl => {
- if (decl.type == "decl") {
- Object.keys(this.translations).forEach(translation => {
- decl.value = decl.value.replace(translation, this.translations[translation]);
- });
- this.exportTokens[decl.prop] = decl.value;
- }
- });
- exportNode.remove();
- }
- fetchImport(importNode, relativeTo, depNr) {
- let file = importNode.selector.match(importRegexp)[1],
- depTrace = this.trace + String.fromCharCode(depNr);
- return this.pathFetcher(file, relativeTo, depTrace).then(exports => {
- importNode.each(decl => {
- if (decl.type == "decl") {
- this.translations[decl.prop] = exports[decl.value];
- }
- });
- importNode.remove();
- }, err => console.log(err));
- }
- }
- var _default$2 = Parser;
- var parser$1 = /*#__PURE__*/Object.defineProperty({
- default: _default$2
- }, '__esModule', {value: true});
- var _postcss2 = _interopRequireDefault$1(_postcss__default);
- var _fs2 = _interopRequireDefault$1(fs__default);
- var _path2 = _interopRequireDefault$1(path__default);
- var _parser2 = _interopRequireDefault$1(parser$1);
- function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- // Copied from https://github.com/css-modules/css-modules-loader-core
- class Core {
- constructor(plugins) {
- this.plugins = plugins || Core.defaultPlugins;
- }
- load(sourceString, sourcePath, trace, pathFetcher) {
- let parser = new _parser2.default(pathFetcher, trace);
- return (0, _postcss2.default)(this.plugins.concat([parser.plugin()])).process(sourceString, { from: "/" + sourcePath }).then(result => {
- return {
- injectableSource: result.css,
- exportTokens: parser.exportTokens
- };
- });
- }
- }
- // Sorts dependencies in the following way:
- // AAA comes before AA and A
- // AB comes after AA and before A
- // All Bs come after all As
- // This ensures that the files are always returned in the following order:
- // - In the order they were required, except
- // - After all their dependencies
- const traceKeySorter = (a, b) => {
- if (a.length < b.length) {
- return a < b.substring(0, a.length) ? -1 : 1;
- } else if (a.length > b.length) {
- return a.substring(0, b.length) <= b ? -1 : 1;
- } else {
- return a < b ? -1 : 1;
- }
- };
- class FileSystemLoader {
- constructor(root, plugins) {
- this.root = root;
- this.sources = {};
- this.traces = {};
- this.importNr = 0;
- this.core = new Core(plugins);
- this.tokensByFile = {};
- }
- fetch(_newPath, relativeTo, _trace) {
- let newPath = _newPath.replace(/^["']|["']$/g, ""),
- trace = _trace || String.fromCharCode(this.importNr++);
- return new Promise((resolve, reject) => {
- let relativeDir = _path2.default.dirname(relativeTo),
- rootRelativePath = _path2.default.resolve(relativeDir, newPath),
- fileRelativePath = _path2.default.resolve(_path2.default.join(this.root, relativeDir), newPath);
- // if the path is not relative or absolute, try to resolve it in node_modules
- if (newPath[0] !== "." && newPath[0] !== "/") {
- try {
- fileRelativePath = require.resolve(newPath);
- } catch (e) {
- // noop
- }
- }
- const tokens = this.tokensByFile[fileRelativePath];
- if (tokens) {
- return resolve(tokens);
- }
- _fs2.default.readFile(fileRelativePath, "utf-8", (err, source) => {
- if (err) reject(err);
- this.core.load(source, rootRelativePath, trace, this.fetch.bind(this)).then(({ injectableSource, exportTokens }) => {
- this.sources[fileRelativePath] = injectableSource;
- this.traces[trace] = fileRelativePath;
- this.tokensByFile[fileRelativePath] = exportTokens;
- resolve(exportTokens);
- }, reject);
- });
- });
- }
- get finalSource() {
- const traces = this.traces;
- const sources = this.sources;
- let written = new Set();
- return Object.keys(traces).sort(traceKeySorter).map(key => {
- const filename = traces[key];
- if (written.has(filename)) {
- return null;
- }
- written.add(filename);
- return sources[filename];
- }).join("");
- }
- }
- var _default$3 = FileSystemLoader;
- var loader = /*#__PURE__*/Object.defineProperty({
- default: _default$3
- }, '__esModule', {value: true});
- function hash(str) {
- var hash = 5381,
- i = str.length;
- while(i) {
- hash = (hash * 33) ^ str.charCodeAt(--i);
- }
- /* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
- * integers. Since we want the results to be always positive, convert the
- * signed int to an unsigned by doing an unsigned bitshift. */
- return hash >>> 0;
- }
- var stringHash = hash;
- var _default$4 = generateScopedName;
- var _stringHash2 = _interopRequireDefault$2(stringHash);
- function _interopRequireDefault$2(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- function generateScopedName(name, filename, css) {
- const i = css.indexOf(`.${name}`);
- const lineNumber = css.substr(0, i).split(/[\r\n]/).length;
- const hash = (0, _stringHash2.default)(css).toString(36).substr(0, 5);
- return `_${name}_${hash}_${lineNumber}`;
- }
- var generateScopedName_1 = /*#__PURE__*/Object.defineProperty({
- default: _default$4
- }, '__esModule', {value: true});
- var _default$5 = saveJSON;
- function saveJSON(cssFile, json) {
- return new Promise((resolve, reject) => {
- (0, fs__default.writeFile)(`${cssFile}.json`, JSON.stringify(json), e => e ? reject(e) : resolve(json));
- });
- }
- var saveJSON_1 = /*#__PURE__*/Object.defineProperty({
- default: _default$5
- }, '__esModule', {value: true});
- var openParentheses = "(".charCodeAt(0);
- var closeParentheses = ")".charCodeAt(0);
- var singleQuote = "'".charCodeAt(0);
- var doubleQuote = '"'.charCodeAt(0);
- var backslash = "\\".charCodeAt(0);
- var slash = "/".charCodeAt(0);
- var comma = ",".charCodeAt(0);
- var colon = ":".charCodeAt(0);
- var star = "*".charCodeAt(0);
- var uLower = "u".charCodeAt(0);
- var uUpper = "U".charCodeAt(0);
- var plus = "+".charCodeAt(0);
- var isUnicodeRange = /^[a-f0-9?-]+$/i;
- var parse$2 = function(input) {
- var tokens = [];
- var value = input;
- var next,
- quote,
- prev,
- token,
- escape,
- escapePos,
- whitespacePos,
- parenthesesOpenPos;
- var pos = 0;
- var code = value.charCodeAt(pos);
- var max = value.length;
- var stack = [{ nodes: tokens }];
- var balanced = 0;
- var parent;
- var name = "";
- var before = "";
- var after = "";
- while (pos < max) {
- // Whitespaces
- if (code <= 32) {
- next = pos;
- do {
- next += 1;
- code = value.charCodeAt(next);
- } while (code <= 32);
- token = value.slice(pos, next);
- prev = tokens[tokens.length - 1];
- if (code === closeParentheses && balanced) {
- after = token;
- } else if (prev && prev.type === "div") {
- prev.after = token;
- prev.sourceEndIndex += token.length;
- } else if (
- code === comma ||
- code === colon ||
- (code === slash &&
- value.charCodeAt(next + 1) !== star &&
- (!parent ||
- (parent && parent.type === "function" && parent.value !== "calc")))
- ) {
- before = token;
- } else {
- tokens.push({
- type: "space",
- sourceIndex: pos,
- sourceEndIndex: next,
- value: token
- });
- }
- pos = next;
- // Quotes
- } else if (code === singleQuote || code === doubleQuote) {
- next = pos;
- quote = code === singleQuote ? "'" : '"';
- token = {
- type: "string",
- sourceIndex: pos,
- quote: quote
- };
- do {
- escape = false;
- next = value.indexOf(quote, next + 1);
- if (~next) {
- escapePos = next;
- while (value.charCodeAt(escapePos - 1) === backslash) {
- escapePos -= 1;
- escape = !escape;
- }
- } else {
- value += quote;
- next = value.length - 1;
- token.unclosed = true;
- }
- } while (escape);
- token.value = value.slice(pos + 1, next);
- token.sourceEndIndex = token.unclosed ? next : next + 1;
- tokens.push(token);
- pos = next + 1;
- code = value.charCodeAt(pos);
- // Comments
- } else if (code === slash && value.charCodeAt(pos + 1) === star) {
- next = value.indexOf("*/", pos);
- token = {
- type: "comment",
- sourceIndex: pos,
- sourceEndIndex: next + 2
- };
- if (next === -1) {
- token.unclosed = true;
- next = value.length;
- token.sourceEndIndex = next;
- }
- token.value = value.slice(pos + 2, next);
- tokens.push(token);
- pos = next + 2;
- code = value.charCodeAt(pos);
- // Operation within calc
- } else if (
- (code === slash || code === star) &&
- parent &&
- parent.type === "function" &&
- parent.value === "calc"
- ) {
- token = value[pos];
- tokens.push({
- type: "word",
- sourceIndex: pos - before.length,
- sourceEndIndex: pos + token.length,
- value: token
- });
- pos += 1;
- code = value.charCodeAt(pos);
- // Dividers
- } else if (code === slash || code === comma || code === colon) {
- token = value[pos];
- tokens.push({
- type: "div",
- sourceIndex: pos - before.length,
- sourceEndIndex: pos + token.length,
- value: token,
- before: before,
- after: ""
- });
- before = "";
- pos += 1;
- code = value.charCodeAt(pos);
- // Open parentheses
- } else if (openParentheses === code) {
- // Whitespaces after open parentheses
- next = pos;
- do {
- next += 1;
- code = value.charCodeAt(next);
- } while (code <= 32);
- parenthesesOpenPos = pos;
- token = {
- type: "function",
- sourceIndex: pos - name.length,
- value: name,
- before: value.slice(parenthesesOpenPos + 1, next)
- };
- pos = next;
- if (name === "url" && code !== singleQuote && code !== doubleQuote) {
- next -= 1;
- do {
- escape = false;
- next = value.indexOf(")", next + 1);
- if (~next) {
- escapePos = next;
- while (value.charCodeAt(escapePos - 1) === backslash) {
- escapePos -= 1;
- escape = !escape;
- }
- } else {
- value += ")";
- next = value.length - 1;
- token.unclosed = true;
- }
- } while (escape);
- // Whitespaces before closed
- whitespacePos = next;
- do {
- whitespacePos -= 1;
- code = value.charCodeAt(whitespacePos);
- } while (code <= 32);
- if (parenthesesOpenPos < whitespacePos) {
- if (pos !== whitespacePos + 1) {
- token.nodes = [
- {
- type: "word",
- sourceIndex: pos,
- sourceEndIndex: whitespacePos + 1,
- value: value.slice(pos, whitespacePos + 1)
- }
- ];
- } else {
- token.nodes = [];
- }
- if (token.unclosed && whitespacePos + 1 !== next) {
- token.after = "";
- token.nodes.push({
- type: "space",
- sourceIndex: whitespacePos + 1,
- sourceEndIndex: next,
- value: value.slice(whitespacePos + 1, next)
- });
- } else {
- token.after = value.slice(whitespacePos + 1, next);
- token.sourceEndIndex = next;
- }
- } else {
- token.after = "";
- token.nodes = [];
- }
- pos = next + 1;
- token.sourceEndIndex = token.unclosed ? next : pos;
- code = value.charCodeAt(pos);
- tokens.push(token);
- } else {
- balanced += 1;
- token.after = "";
- token.sourceEndIndex = pos + 1;
- tokens.push(token);
- stack.push(token);
- tokens = token.nodes = [];
- parent = token;
- }
- name = "";
- // Close parentheses
- } else if (closeParentheses === code && balanced) {
- pos += 1;
- code = value.charCodeAt(pos);
- parent.after = after;
- parent.sourceEndIndex += after.length;
- after = "";
- balanced -= 1;
- stack[stack.length - 1].sourceEndIndex = pos;
- stack.pop();
- parent = stack[balanced];
- tokens = parent.nodes;
- // Words
- } else {
- next = pos;
- do {
- if (code === backslash) {
- next += 1;
- }
- next += 1;
- code = value.charCodeAt(next);
- } while (
- next < max &&
- !(
- code <= 32 ||
- code === singleQuote ||
- code === doubleQuote ||
- code === comma ||
- code === colon ||
- code === slash ||
- code === openParentheses ||
- (code === star &&
- parent &&
- parent.type === "function" &&
- parent.value === "calc") ||
- (code === slash &&
- parent.type === "function" &&
- parent.value === "calc") ||
- (code === closeParentheses && balanced)
- )
- );
- token = value.slice(pos, next);
- if (openParentheses === code) {
- name = token;
- } else if (
- (uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) &&
- plus === token.charCodeAt(1) &&
- isUnicodeRange.test(token.slice(2))
- ) {
- tokens.push({
- type: "unicode-range",
- sourceIndex: pos,
- sourceEndIndex: next,
- value: token
- });
- } else {
- tokens.push({
- type: "word",
- sourceIndex: pos,
- sourceEndIndex: next,
- value: token
- });
- }
- pos = next;
- }
- }
- for (pos = stack.length - 1; pos; pos -= 1) {
- stack[pos].unclosed = true;
- stack[pos].sourceEndIndex = value.length;
- }
- return stack[0].nodes;
- };
- var walk = function walk(nodes, cb, bubble) {
- var i, max, node, result;
- for (i = 0, max = nodes.length; i < max; i += 1) {
- node = nodes[i];
- if (!bubble) {
- result = cb(node, i, nodes);
- }
- if (
- result !== false &&
- node.type === "function" &&
- Array.isArray(node.nodes)
- ) {
- walk(node.nodes, cb, bubble);
- }
- if (bubble) {
- cb(node, i, nodes);
- }
- }
- };
- function stringifyNode(node, custom) {
- var type = node.type;
- var value = node.value;
- var buf;
- var customResult;
- if (custom && (customResult = custom(node)) !== undefined) {
- return customResult;
- } else if (type === "word" || type === "space") {
- return value;
- } else if (type === "string") {
- buf = node.quote || "";
- return buf + value + (node.unclosed ? "" : buf);
- } else if (type === "comment") {
- return "/*" + value + (node.unclosed ? "" : "*/");
- } else if (type === "div") {
- return (node.before || "") + value + (node.after || "");
- } else if (Array.isArray(node.nodes)) {
- buf = stringify$1(node.nodes, custom);
- if (type !== "function") {
- return buf;
- }
- return (
- value +
- "(" +
- (node.before || "") +
- buf +
- (node.after || "") +
- (node.unclosed ? "" : ")")
- );
- }
- return value;
- }
- function stringify$1(nodes, custom) {
- var result, i;
- if (Array.isArray(nodes)) {
- result = "";
- for (i = nodes.length - 1; ~i; i -= 1) {
- result = stringifyNode(nodes[i], custom) + result;
- }
- return result;
- }
- return stringifyNode(nodes, custom);
- }
- var stringify_1$1 = stringify$1;
- var minus = "-".charCodeAt(0);
- var plus$1 = "+".charCodeAt(0);
- var dot = ".".charCodeAt(0);
- var exp = "e".charCodeAt(0);
- var EXP = "E".charCodeAt(0);
- // Check if three code points would start a number
- // https://www.w3.org/TR/css-syntax-3/#starts-with-a-number
- function likeNumber(value) {
- var code = value.charCodeAt(0);
- var nextCode;
- if (code === plus$1 || code === minus) {
- nextCode = value.charCodeAt(1);
- if (nextCode >= 48 && nextCode <= 57) {
- return true;
- }
- var nextNextCode = value.charCodeAt(2);
- if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) {
- return true;
- }
- return false;
- }
- if (code === dot) {
- nextCode = value.charCodeAt(1);
- if (nextCode >= 48 && nextCode <= 57) {
- return true;
- }
- return false;
- }
- if (code >= 48 && code <= 57) {
- return true;
- }
- return false;
- }
- // Consume a number
- // https://www.w3.org/TR/css-syntax-3/#consume-number
- var unit = function(value) {
- var pos = 0;
- var length = value.length;
- var code;
- var nextCode;
- var nextNextCode;
- if (length === 0 || !likeNumber(value)) {
- return false;
- }
- code = value.charCodeAt(pos);
- if (code === plus$1 || code === minus) {
- pos++;
- }
- while (pos < length) {
- code = value.charCodeAt(pos);
- if (code < 48 || code > 57) {
- break;
- }
- pos += 1;
- }
- code = value.charCodeAt(pos);
- nextCode = value.charCodeAt(pos + 1);
- if (code === dot && nextCode >= 48 && nextCode <= 57) {
- pos += 2;
- while (pos < length) {
- code = value.charCodeAt(pos);
- if (code < 48 || code > 57) {
- break;
- }
- pos += 1;
- }
- }
- code = value.charCodeAt(pos);
- nextCode = value.charCodeAt(pos + 1);
- nextNextCode = value.charCodeAt(pos + 2);
- if (
- (code === exp || code === EXP) &&
- ((nextCode >= 48 && nextCode <= 57) ||
- ((nextCode === plus$1 || nextCode === minus) &&
- nextNextCode >= 48 &&
- nextNextCode <= 57))
- ) {
- pos += nextCode === plus$1 || nextCode === minus ? 3 : 2;
- while (pos < length) {
- code = value.charCodeAt(pos);
- if (code < 48 || code > 57) {
- break;
- }
- pos += 1;
- }
- }
- return {
- number: value.slice(0, pos),
- unit: value.slice(pos)
- };
- };
- function ValueParser(value) {
- if (this instanceof ValueParser) {
- this.nodes = parse$2(value);
- return this;
- }
- return new ValueParser(value);
- }
- ValueParser.prototype.toString = function() {
- return Array.isArray(this.nodes) ? stringify_1$1(this.nodes) : "";
- };
- ValueParser.prototype.walk = function(cb, bubble) {
- walk(this.nodes, cb, bubble);
- return this;
- };
- ValueParser.unit = unit;
- ValueParser.walk = walk;
- ValueParser.stringify = stringify_1$1;
- var lib$3 = ValueParser;
- const matchValueName = /[$]?[\w-]+/g;
- const replaceValueSymbols = (value, replacements) => {
- let matches;
- while ((matches = matchValueName.exec(value))) {
- const replacement = replacements[matches[0]];
- if (replacement) {
- value =
- value.slice(0, matches.index) +
- replacement +
- value.slice(matchValueName.lastIndex);
- matchValueName.lastIndex -= matches[0].length - replacement.length;
- }
- }
- return value;
- };
- var replaceValueSymbols_1 = replaceValueSymbols;
- const replaceSymbols = (css, replacements) => {
- css.walk((node) => {
- if (node.type === "decl" && node.value) {
- node.value = replaceValueSymbols_1(node.value.toString(), replacements);
- } else if (node.type === "rule" && node.selector) {
- node.selector = replaceValueSymbols_1(
- node.selector.toString(),
- replacements
- );
- } else if (node.type === "atrule" && node.params) {
- node.params = replaceValueSymbols_1(node.params.toString(), replacements);
- }
- });
- };
- var replaceSymbols_1 = replaceSymbols;
- const importPattern = /^:import\(("[^"]*"|'[^']*'|[^"']+)\)$/;
- const balancedQuotes = /^("[^"]*"|'[^']*'|[^"']+)$/;
- const getDeclsObject = (rule) => {
- const object = {};
- rule.walkDecls((decl) => {
- const before = decl.raws.before ? decl.raws.before.trim() : "";
- object[before + decl.prop] = decl.value;
- });
- return object;
- };
- /**
- *
- * @param {string} css
- * @param {boolean} removeRules
- * @param {'auto' | 'rule' | 'at-rule'} mode
- */
- const extractICSS = (css, removeRules = true, mode = "auto") => {
- const icssImports = {};
- const icssExports = {};
- function addImports(node, path) {
- const unquoted = path.replace(/'|"/g, "");
- icssImports[unquoted] = Object.assign(
- icssImports[unquoted] || {},
- getDeclsObject(node)
- );
- if (removeRules) {
- node.remove();
- }
- }
- function addExports(node) {
- Object.assign(icssExports, getDeclsObject(node));
- if (removeRules) {
- node.remove();
- }
- }
- css.each((node) => {
- if (node.type === "rule" && mode !== "at-rule") {
- if (node.selector.slice(0, 7) === ":import") {
- const matches = importPattern.exec(node.selector);
- if (matches) {
- addImports(node, matches[1]);
- }
- }
- if (node.selector === ":export") {
- addExports(node);
- }
- }
- if (node.type === "atrule" && mode !== "rule") {
- if (node.name === "icss-import") {
- const matches = balancedQuotes.exec(node.params);
- if (matches) {
- addImports(node, matches[1]);
- }
- }
- if (node.name === "icss-export") {
- addExports(node);
- }
- }
- });
- return { icssImports, icssExports };
- };
- var extractICSS_1 = extractICSS;
- const createImports = (imports, postcss, mode = "rule") => {
- return Object.keys(imports).map((path) => {
- const aliases = imports[path];
- const declarations = Object.keys(aliases).map((key) =>
- postcss.decl({
- prop: key,
- value: aliases[key],
- raws: { before: "\n " },
- })
- );
- const hasDeclarations = declarations.length > 0;
- const rule =
- mode === "rule"
- ? postcss.rule({
- selector: `:import('${path}')`,
- raws: { after: hasDeclarations ? "\n" : "" },
- })
- : postcss.atRule({
- name: "icss-import",
- params: `'${path}'`,
- raws: { after: hasDeclarations ? "\n" : "" },
- });
- if (hasDeclarations) {
- rule.append(declarations);
- }
- return rule;
- });
- };
- const createExports = (exports, postcss, mode = "rule") => {
- const declarations = Object.keys(exports).map((key) =>
- postcss.decl({
- prop: key,
- value: exports[key],
- raws: { before: "\n " },
- })
- );
- if (declarations.length === 0) {
- return [];
- }
- const rule =
- mode === "rule"
- ? postcss.rule({
- selector: `:export`,
- raws: { after: "\n" },
- })
- : postcss.atRule({
- name: "icss-export",
- raws: { after: "\n" },
- });
- rule.append(declarations);
- return [rule];
- };
- const createICSSRules = (imports, exports, postcss, mode) => [
- ...createImports(imports, postcss, mode),
- ...createExports(exports, postcss, mode),
- ];
- var createICSSRules_1 = createICSSRules;
- var src = {
- replaceValueSymbols: replaceValueSymbols_1,
- replaceSymbols: replaceSymbols_1,
- extractICSS: extractICSS_1,
- createICSSRules: createICSSRules_1,
- };
- const { extractICSS: extractICSS$1 } = src;
- const isSpacing = (node) => node.type === "combinator" && node.value === " ";
- function normalizeNodeArray(nodes) {
- const array = [];
- nodes.forEach((x) => {
- if (Array.isArray(x)) {
- normalizeNodeArray(x).forEach((item) => {
- array.push(item);
- });
- } else if (x) {
- array.push(x);
- }
- });
- if (array.length > 0 && isSpacing(array[array.length - 1])) {
- array.pop();
- }
- return array;
- }
- function localizeNode(rule, mode, localAliasMap) {
- const transform = (node, context) => {
- if (context.ignoreNextSpacing && !isSpacing(node)) {
- throw new Error("Missing whitespace after " + context.ignoreNextSpacing);
- }
- if (context.enforceNoSpacing && isSpacing(node)) {
- throw new Error("Missing whitespace before " + context.enforceNoSpacing);
- }
- let newNodes;
- switch (node.type) {
- case "root": {
- let resultingGlobal;
- context.hasPureGlobals = false;
- newNodes = node.nodes.map((n) => {
- const nContext = {
- global: context.global,
- lastWasSpacing: true,
- hasLocals: false,
- explicit: false,
- };
- n = transform(n, nContext);
- if (typeof resultingGlobal === "undefined") {
- resultingGlobal = nContext.global;
- } else if (resultingGlobal !== nContext.global) {
- throw new Error(
- 'Inconsistent rule global/local result in rule "' +
- node +
- '" (multiple selectors must result in the same mode for the rule)'
- );
- }
- if (!nContext.hasLocals) {
- context.hasPureGlobals = true;
- }
- return n;
- });
- context.global = resultingGlobal;
- node.nodes = normalizeNodeArray(newNodes);
- break;
- }
- case "selector": {
- newNodes = node.map((childNode) => transform(childNode, context));
- node = node.clone();
- node.nodes = normalizeNodeArray(newNodes);
- break;
- }
- case "combinator": {
- if (isSpacing(node)) {
- if (context.ignoreNextSpacing) {
- context.ignoreNextSpacing = false;
- context.lastWasSpacing = false;
- context.enforceNoSpacing = false;
- return null;
- }
- context.lastWasSpacing = true;
- return node;
- }
- break;
- }
- case "pseudo": {
- let childContext;
- const isNested = !!node.length;
- const isScoped = node.value === ":local" || node.value === ":global";
- const isImportExport =
- node.value === ":import" || node.value === ":export";
- if (isImportExport) {
- context.hasLocals = true;
- // :local(.foo)
- } else if (isNested) {
- if (isScoped) {
- if (node.nodes.length === 0) {
- throw new Error(`${node.value}() can't be empty`);
- }
- if (context.inside) {
- throw new Error(
- `A ${node.value} is not allowed inside of a ${context.inside}(...)`
- );
- }
- childContext = {
- global: node.value === ":global",
- inside: node.value,
- hasLocals: false,
- explicit: true,
- };
- newNodes = node
- .map((childNode) => transform(childNode, childContext))
- .reduce((acc, next) => acc.concat(next.nodes), []);
- if (newNodes.length) {
- const { before, after } = node.spaces;
- const first = newNodes[0];
- const last = newNodes[newNodes.length - 1];
- first.spaces = { before, after: first.spaces.after };
- last.spaces = { before: last.spaces.before, after };
- }
- node = newNodes;
- break;
- } else {
- childContext = {
- global: context.global,
- inside: context.inside,
- lastWasSpacing: true,
- hasLocals: false,
- explicit: context.explicit,
- };
- newNodes = node.map((childNode) =>
- transform(childNode, childContext)
- );
- node = node.clone();
- node.nodes = normalizeNodeArray(newNodes);
- if (childContext.hasLocals) {
- context.hasLocals = true;
- }
- }
- break;
- //:local .foo .bar
- } else if (isScoped) {
- if (context.inside) {
- throw new Error(
- `A ${node.value} is not allowed inside of a ${context.inside}(...)`
- );
- }
- const addBackSpacing = !!node.spaces.before;
- context.ignoreNextSpacing = context.lastWasSpacing
- ? node.value
- : false;
- context.enforceNoSpacing = context.lastWasSpacing
- ? false
- : node.value;
- context.global = node.value === ":global";
- context.explicit = true;
- // because this node has spacing that is lost when we remove it
- // we make up for it by adding an extra combinator in since adding
- // spacing on the parent selector doesn't work
- return addBackSpacing
- ? dist.combinator({ value: " " })
- : null;
- }
- break;
- }
- case "id":
- case "class": {
- if (!node.value) {
- throw new Error("Invalid class or id selector syntax");
- }
- if (context.global) {
- break;
- }
- const isImportedValue = localAliasMap.has(node.value);
- const isImportedWithExplicitScope = isImportedValue && context.explicit;
- if (!isImportedValue || isImportedWithExplicitScope) {
- const innerNode = node.clone();
- innerNode.spaces = { before: "", after: "" };
- node = dist.pseudo({
- value: ":local",
- nodes: [innerNode],
- spaces: node.spaces,
- });
- context.hasLocals = true;
- }
- break;
- }
- }
- context.lastWasSpacing = false;
- context.ignoreNextSpacing = false;
- context.enforceNoSpacing = false;
- return node;
- };
- const rootContext = {
- global: mode === "global",
- hasPureGlobals: false,
- };
- rootContext.selector = dist((root) => {
- transform(root, rootContext);
- }).processSync(rule, { updateSelector: false, lossless: true });
- return rootContext;
- }
- function localizeDeclNode(node, context) {
- switch (node.type) {
- case "word":
- if (context.localizeNextItem) {
- if (!context.localAliasMap.has(node.value)) {
- node.value = ":local(" + node.value + ")";
- context.localizeNextItem = false;
- }
- }
- break;
- case "function":
- if (
- context.options &&
- context.options.rewriteUrl &&
- node.value.toLowerCase() === "url"
- ) {
- node.nodes.map((nestedNode) => {
- if (nestedNode.type !== "string" && nestedNode.type !== "word") {
- return;
- }
- let newUrl = context.options.rewriteUrl(
- context.global,
- nestedNode.value
- );
- switch (nestedNode.type) {
- case "string":
- if (nestedNode.quote === "'") {
- newUrl = newUrl.replace(/(\\)/g, "\\$1").replace(/'/g, "\\'");
- }
- if (nestedNode.quote === '"') {
- newUrl = newUrl.replace(/(\\)/g, "\\$1").replace(/"/g, '\\"');
- }
- break;
- case "word":
- newUrl = newUrl.replace(/("|'|\)|\\)/g, "\\$1");
- break;
- }
- nestedNode.value = newUrl;
- });
- }
- break;
- }
- return node;
- }
- function isWordAFunctionArgument(wordNode, functionNode) {
- return functionNode
- ? functionNode.nodes.some(
- (functionNodeChild) =>
- functionNodeChild.sourceIndex === wordNode.sourceIndex
- )
- : false;
- }
- function localizeDeclarationValues(localize, declaration, context) {
- const valueNodes = lib$3(declaration.value);
- valueNodes.walk((node, index, nodes) => {
- const subContext = {
- options: context.options,
- global: context.global,
- localizeNextItem: localize && !context.global,
- localAliasMap: context.localAliasMap,
- };
- nodes[index] = localizeDeclNode(node, subContext);
- });
- declaration.value = valueNodes.toString();
- }
- function localizeDeclaration(declaration, context) {
- const isAnimation = /animation$/i.test(declaration.prop);
- if (isAnimation) {
- const validIdent = /^-?[_a-z][_a-z0-9-]*$/i;
- /*
- The spec defines some keywords that you can use to describe properties such as the timing
- function. These are still valid animation names, so as long as there is a property that accepts
- a keyword, it is given priority. Only when all the properties that can take a keyword are
- exhausted can the animation name be set to the keyword. I.e.
-
- animation: infinite infinite;
-
- The animation will repeat an infinite number of times from the first argument, and will have an
- animation name of infinite from the second.
- */
- const animationKeywords = {
- $alternate: 1,
- "$alternate-reverse": 1,
- $backwards: 1,
- $both: 1,
- $ease: 1,
- "$ease-in": 1,
- "$ease-in-out": 1,
- "$ease-out": 1,
- $forwards: 1,
- $infinite: 1,
- $linear: 1,
- $none: Infinity, // No matter how many times you write none, it will never be an animation name
- $normal: 1,
- $paused: 1,
- $reverse: 1,
- $running: 1,
- "$step-end": 1,
- "$step-start": 1,
- $initial: Infinity,
- $inherit: Infinity,
- $unset: Infinity,
- };
- let parsedAnimationKeywords = {};
- let stepsFunctionNode = null;
- const valueNodes = lib$3(declaration.value).walk((node) => {
- /* If div-token appeared (represents as comma ','), a possibility of an animation-keywords should be reflesh. */
- if (node.type === "div") {
- parsedAnimationKeywords = {};
- }
- if (node.type === "function" && node.value.toLowerCase() === "steps") {
- stepsFunctionNode = node;
- }
- const value =
- node.type === "word" &&
- !isWordAFunctionArgument(node, stepsFunctionNode)
- ? node.value.toLowerCase()
- : null;
- let shouldParseAnimationName = false;
- if (value && validIdent.test(value)) {
- if ("$" + value in animationKeywords) {
- parsedAnimationKeywords["$" + value] =
- "$" + value in parsedAnimationKeywords
- ? parsedAnimationKeywords["$" + value] + 1
- : 0;
- shouldParseAnimationName =
- parsedAnimationKeywords["$" + value] >=
- animationKeywords["$" + value];
- } else {
- shouldParseAnimationName = true;
- }
- }
- const subContext = {
- options: context.options,
- global: context.global,
- localizeNextItem: shouldParseAnimationName && !context.global,
- localAliasMap: context.localAliasMap,
- };
- return localizeDeclNode(node, subContext);
- });
- declaration.value = valueNodes.toString();
- return;
- }
- const isAnimationName = /animation(-name)?$/i.test(declaration.prop);
- if (isAnimationName) {
- return localizeDeclarationValues(true, declaration, context);
- }
- const hasUrl = /url\(/i.test(declaration.value);
- if (hasUrl) {
- return localizeDeclarationValues(false, declaration, context);
- }
- }
- var src$1 = (options = {}) => {
- if (
- options &&
- options.mode &&
- options.mode !== "global" &&
- options.mode !== "local" &&
- options.mode !== "pure"
- ) {
- throw new Error(
- 'options.mode must be either "global", "local" or "pure" (default "local")'
- );
- }
- const pureMode = options && options.mode === "pure";
- const globalMode = options && options.mode === "global";
- return {
- postcssPlugin: "postcss-modules-local-by-default",
- prepare() {
- const localAliasMap = new Map();
- return {
- Once(root) {
- const { icssImports } = extractICSS$1(root, false);
- Object.keys(icssImports).forEach((key) => {
- Object.keys(icssImports[key]).forEach((prop) => {
- localAliasMap.set(prop, icssImports[key][prop]);
- });
- });
- root.walkAtRules((atRule) => {
- if (/keyframes$/i.test(atRule.name)) {
- const globalMatch = /^\s*:global\s*\((.+)\)\s*$/.exec(
- atRule.params
- );
- const localMatch = /^\s*:local\s*\((.+)\)\s*$/.exec(
- atRule.params
- );
- let globalKeyframes = globalMode;
- if (globalMatch) {
- if (pureMode) {
- throw atRule.error(
- "@keyframes :global(...) is not allowed in pure mode"
- );
- }
- atRule.params = globalMatch[1];
- globalKeyframes = true;
- } else if (localMatch) {
- atRule.params = localMatch[0];
- globalKeyframes = false;
- } else if (!globalMode) {
- if (atRule.params && !localAliasMap.has(atRule.params)) {
- atRule.params = ":local(" + atRule.params + ")";
- }
- }
- atRule.walkDecls((declaration) => {
- localizeDeclaration(declaration, {
- localAliasMap,
- options: options,
- global: globalKeyframes,
- });
- });
- } else if (atRule.nodes) {
- atRule.nodes.forEach((declaration) => {
- if (declaration.type === "decl") {
- localizeDeclaration(declaration, {
- localAliasMap,
- options: options,
- global: globalMode,
- });
- }
- });
- }
- });
- root.walkRules((rule) => {
- if (
- rule.parent &&
- rule.parent.type === "atrule" &&
- /keyframes$/i.test(rule.parent.name)
- ) {
- // ignore keyframe rules
- return;
- }
- const context = localizeNode(rule, options.mode, localAliasMap);
- context.options = options;
- context.localAliasMap = localAliasMap;
- if (pureMode && context.hasPureGlobals) {
- throw rule.error(
- 'Selector "' +
- rule.selector +
- '" is not pure ' +
- "(pure selectors must contain at least one local class or id)"
- );
- }
- rule.selector = context.selector;
- // Less-syntax mixins parse as rules with no nodes
- if (rule.nodes) {
- rule.nodes.forEach((declaration) =>
- localizeDeclaration(declaration, context)
- );
- }
- });
- },
- };
- },
- };
- };
- var postcss = true;
- src$1.postcss = postcss;
- const PERMANENT_MARKER = 2;
- const TEMPORARY_MARKER = 1;
- function createError(node, graph) {
- const er = new Error("Nondeterministic import's order");
- const related = graph[node];
- const relatedNode = related.find(
- (relatedNode) => graph[relatedNode].indexOf(node) > -1
- );
- er.nodes = [node, relatedNode];
- return er;
- }
- function walkGraph(node, graph, state, result, strict) {
- if (state[node] === PERMANENT_MARKER) {
- return;
- }
- if (state[node] === TEMPORARY_MARKER) {
- if (strict) {
- return createError(node, graph);
- }
- return;
- }
- state[node] = TEMPORARY_MARKER;
- const children = graph[node];
- const length = children.length;
- for (let i = 0; i < length; ++i) {
- const error = walkGraph(children[i], graph, state, result, strict);
- if (error instanceof Error) {
- return error;
- }
- }
- state[node] = PERMANENT_MARKER;
- result.push(node);
- }
- function topologicalSort(graph, strict) {
- const result = [];
- const state = {};
- const nodes = Object.keys(graph);
- const length = nodes.length;
- for (let i = 0; i < length; ++i) {
- const er = walkGraph(nodes[i], graph, state, result, strict);
- if (er instanceof Error) {
- return er;
- }
- }
- return result;
- }
- var topologicalSort_1 = topologicalSort;
- const matchImports = /^(.+?)\s+from\s+(?:"([^"]+)"|'([^']+)'|(global))$/;
- const icssImport = /^:import\((?:"([^"]+)"|'([^']+)')\)/;
- const VISITED_MARKER = 1;
- /**
- * :import('G') {}
- *
- * Rule
- * composes: ... from 'A'
- * composes: ... from 'B'
- * Rule
- * composes: ... from 'A'
- * composes: ... from 'A'
- * composes: ... from 'C'
- *
- * Results in:
- *
- * graph: {
- * G: [],
- * A: [],
- * B: ['A'],
- * C: ['A'],
- * }
- */
- function addImportToGraph(importId, parentId, graph, visited) {
- const siblingsId = parentId + "_" + "siblings";
- const visitedId = parentId + "_" + importId;
- if (visited[visitedId] !== VISITED_MARKER) {
- if (!Array.isArray(visited[siblingsId])) {
- visited[siblingsId] = [];
- }
- const siblings = visited[siblingsId];
- if (Array.isArray(graph[importId])) {
- graph[importId] = graph[importId].concat(siblings);
- } else {
- graph[importId] = siblings.slice();
- }
- visited[visitedId] = VISITED_MARKER;
- siblings.push(importId);
- }
- }
- var src$2 = (options = {}) => {
- let importIndex = 0;
- const createImportedName =
- typeof options.createImportedName !== "function"
- ? (importName /*, path*/) =>
- `i__imported_${importName.replace(/\W/g, "_")}_${importIndex++}`
- : options.createImportedName;
- const failOnWrongOrder = options.failOnWrongOrder;
- return {
- postcssPlugin: "postcss-modules-extract-imports",
- prepare() {
- const graph = {};
- const visited = {};
- const existingImports = {};
- const importDecls = {};
- const imports = {};
- return {
- Once(root, postcss) {
- // Check the existing imports order and save refs
- root.walkRules((rule) => {
- const matches = icssImport.exec(rule.selector);
- if (matches) {
- const [, /*match*/ doubleQuotePath, singleQuotePath] = matches;
- const importPath = doubleQuotePath || singleQuotePath;
- addImportToGraph(importPath, "root", graph, visited);
- existingImports[importPath] = rule;
- }
- });
- root.walkDecls(/^composes$/, (declaration) => {
- const matches = declaration.value.match(matchImports);
- if (!matches) {
- return;
- }
- let tmpSymbols;
- let [
- ,
- /*match*/ symbols,
- doubleQuotePath,
- singleQuotePath,
- global,
- ] = matches;
- if (global) {
- // Composing globals simply means changing these classes to wrap them in global(name)
- tmpSymbols = symbols.split(/\s+/).map((s) => `global(${s})`);
- } else {
- const importPath = doubleQuotePath || singleQuotePath;
- let parent = declaration.parent;
- let parentIndexes = "";
- while (parent.type !== "root") {
- parentIndexes =
- parent.parent.index(parent) + "_" + parentIndexes;
- parent = parent.parent;
- }
- const { selector } = declaration.parent;
- const parentRule = `_${parentIndexes}${selector}`;
- addImportToGraph(importPath, parentRule, graph, visited);
- importDecls[importPath] = declaration;
- imports[importPath] = imports[importPath] || {};
- tmpSymbols = symbols.split(/\s+/).map((s) => {
- if (!imports[importPath][s]) {
- imports[importPath][s] = createImportedName(s, importPath);
- }
- return imports[importPath][s];
- });
- }
- declaration.value = tmpSymbols.join(" ");
- });
- const importsOrder = topologicalSort_1(graph, failOnWrongOrder);
- if (importsOrder instanceof Error) {
- const importPath = importsOrder.nodes.find((importPath) =>
- // eslint-disable-next-line no-prototype-builtins
- importDecls.hasOwnProperty(importPath)
- );
- const decl = importDecls[importPath];
- throw decl.error(
- "Failed to resolve order of composed modules " +
- importsOrder.nodes
- .map((importPath) => "`" + importPath + "`")
- .join(", ") +
- ".",
- {
- plugin: "postcss-modules-extract-imports",
- word: "composes",
- }
- );
- }
- let lastImportRule;
- importsOrder.forEach((path) => {
- const importedSymbols = imports[path];
- let rule = existingImports[path];
- if (!rule && importedSymbols) {
- rule = postcss.rule({
- selector: `:import("${path}")`,
- raws: { after: "\n" },
- });
- if (lastImportRule) {
- root.insertAfter(lastImportRule, rule);
- } else {
- root.prepend(rule);
- }
- }
- lastImportRule = rule;
- if (!importedSymbols) {
- return;
- }
- Object.keys(importedSymbols).forEach((importedSymbol) => {
- rule.append(
- postcss.decl({
- value: importedSymbol,
- prop: importedSymbols[importedSymbol],
- raws: { before: "\n " },
- })
- );
- });
- });
- },
- };
- },
- };
- };
- var postcss$1 = true;
- src$2.postcss = postcss$1;
- const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
- function getSingleLocalNamesForComposes(root) {
- return root.nodes.map((node) => {
- if (node.type !== "selector" || node.nodes.length !== 1) {
- throw new Error(
- `composition is only allowed when selector is single :local class name not in "${root}"`
- );
- }
- node = node.nodes[0];
- if (
- node.type !== "pseudo" ||
- node.value !== ":local" ||
- node.nodes.length !== 1
- ) {
- throw new Error(
- 'composition is only allowed when selector is single :local class name not in "' +
- root +
- '", "' +
- node +
- '" is weird'
- );
- }
- node = node.first;
- if (node.type !== "selector" || node.length !== 1) {
- throw new Error(
- 'composition is only allowed when selector is single :local class name not in "' +
- root +
- '", "' +
- node +
- '" is weird'
- );
- }
- node = node.first;
- if (node.type !== "class") {
- // 'id' is not possible, because you can't compose ids
- throw new Error(
- 'composition is only allowed when selector is single :local class name not in "' +
- root +
- '", "' +
- node +
- '" is weird'
- );
- }
- return node.value;
- });
- }
- const whitespace = "[\\x20\\t\\r\\n\\f]";
- const unescapeRegExp = new RegExp(
- "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)",
- "ig"
- );
- function unescape(str) {
- return str.replace(unescapeRegExp, (_, escaped, escapedWhitespace) => {
- const high = "0x" + escaped - 0x10000;
- // NaN means non-codepoint
- // Workaround erroneous numeric interpretation of +"0x"
- return high !== high || escapedWhitespace
- ? escaped
- : high < 0
- ? // BMP codepoint
- String.fromCharCode(high + 0x10000)
- : // Supplemental Plane codepoint (surrogate pair)
- String.fromCharCode((high >> 10) | 0xd800, (high & 0x3ff) | 0xdc00);
- });
- }
- const plugin = (options = {}) => {
- const generateScopedName =
- (options && options.generateScopedName) || plugin.generateScopedName;
- const generateExportEntry =
- (options && options.generateExportEntry) || plugin.generateExportEntry;
- const exportGlobals = options && options.exportGlobals;
- return {
- postcssPlugin: "postcss-modules-scope",
- Once(root, { rule }) {
- const exports = Object.create(null);
- function exportScopedName(name, rawName) {
- const scopedName = generateScopedName(
- rawName ? rawName : name,
- root.source.input.from,
- root.source.input.css
- );
- const exportEntry = generateExportEntry(
- rawName ? rawName : name,
- scopedName,
- root.source.input.from,
- root.source.input.css
- );
- const { key, value } = exportEntry;
- exports[key] = exports[key] || [];
- if (exports[key].indexOf(value) < 0) {
- exports[key].push(value);
- }
- return scopedName;
- }
- function localizeNode(node) {
- switch (node.type) {
- case "selector":
- node.nodes = node.map(localizeNode);
- return node;
- case "class":
- return dist.className({
- value: exportScopedName(
- node.value,
- node.raws && node.raws.value ? node.raws.value : null
- ),
- });
- case "id": {
- return dist.id({
- value: exportScopedName(
- node.value,
- node.raws && node.raws.value ? node.raws.value : null
- ),
- });
- }
- }
- throw new Error(
- `${node.type} ("${node}") is not allowed in a :local block`
- );
- }
- function traverseNode(node) {
- switch (node.type) {
- case "pseudo":
- if (node.value === ":local") {
- if (node.nodes.length !== 1) {
- throw new Error('Unexpected comma (",") in :local block');
- }
- const selector = localizeNode(node.first, node.spaces);
- // move the spaces that were around the psuedo selector to the first
- // non-container node
- selector.first.spaces = node.spaces;
- const nextNode = node.next();
- if (
- nextNode &&
- nextNode.type === "combinator" &&
- nextNode.value === " " &&
- /\\[A-F0-9]{1,6}$/.test(selector.last.value)
- ) {
- selector.last.spaces.after = " ";
- }
- node.replaceWith(selector);
- return;
- }
- /* falls through */
- case "root":
- case "selector": {
- node.each(traverseNode);
- break;
- }
- case "id":
- case "class":
- if (exportGlobals) {
- exports[node.value] = [node.value];
- }
- break;
- }
- return node;
- }
- // Find any :import and remember imported names
- const importedNames = {};
- root.walkRules(/^:import\(.+\)$/, (rule) => {
- rule.walkDecls((decl) => {
- importedNames[decl.prop] = true;
- });
- });
- // Find any :local selectors
- root.walkRules((rule) => {
- let parsedSelector = dist().astSync(rule);
- rule.selector = traverseNode(parsedSelector.clone()).toString();
- rule.walkDecls(/composes|compose-with/i, (decl) => {
- const localNames = getSingleLocalNamesForComposes(parsedSelector);
- const classes = decl.value.split(/\s+/);
- classes.forEach((className) => {
- const global = /^global\(([^)]+)\)$/.exec(className);
- if (global) {
- localNames.forEach((exportedName) => {
- exports[exportedName].push(global[1]);
- });
- } else if (hasOwnProperty$1.call(importedNames, className)) {
- localNames.forEach((exportedName) => {
- exports[exportedName].push(className);
- });
- } else if (hasOwnProperty$1.call(exports, className)) {
- localNames.forEach((exportedName) => {
- exports[className].forEach((item) => {
- exports[exportedName].push(item);
- });
- });
- } else {
- throw decl.error(
- `referenced class name "${className}" in ${decl.prop} not found`
- );
- }
- });
- decl.remove();
- });
- // Find any :local values
- rule.walkDecls((decl) => {
- if (!/:local\s*\((.+?)\)/.test(decl.value)) {
- return;
- }
- let tokens = decl.value.split(/(,|'[^']*'|"[^"]*")/);
- tokens = tokens.map((token, idx) => {
- if (idx === 0 || tokens[idx - 1] === ",") {
- let result = token;
- const localMatch = /:local\s*\((.+?)\)/.exec(token);
- if (localMatch) {
- const input = localMatch.input;
- const matchPattern = localMatch[0];
- const matchVal = localMatch[1];
- const newVal = exportScopedName(matchVal);
- result = input.replace(matchPattern, newVal);
- } else {
- return token;
- }
- return result;
- } else {
- return token;
- }
- });
- decl.value = tokens.join("");
- });
- });
- // Find any :local keyframes
- root.walkAtRules(/keyframes$/i, (atRule) => {
- const localMatch = /^\s*:local\s*\((.+?)\)\s*$/.exec(atRule.params);
- if (!localMatch) {
- return;
- }
- atRule.params = exportScopedName(localMatch[1]);
- });
- // If we found any :locals, insert an :export rule
- const exportedNames = Object.keys(exports);
- if (exportedNames.length > 0) {
- const exportRule = rule({ selector: ":export" });
- exportedNames.forEach((exportedName) =>
- exportRule.append({
- prop: exportedName,
- value: exports[exportedName].join(" "),
- raws: { before: "\n " },
- })
- );
- root.append(exportRule);
- }
- },
- };
- };
- plugin.postcss = true;
- plugin.generateScopedName = function (name, path) {
- const sanitisedPath = path
- .replace(/\.[^./\\]+$/, "")
- .replace(/[\W_]+/g, "_")
- .replace(/^_|_$/g, "");
- return `_${sanitisedPath}__${name}`.trim();
- };
- plugin.generateExportEntry = function (name, scopedName) {
- return {
- key: unescape(name),
- value: unescape(scopedName),
- };
- };
- var src$3 = plugin;
- const matchImports$1 = /^(.+?|\([\s\S]+?\))\s+from\s+("[^"]*"|'[^']*'|[\w-]+)$/;
- const matchValueDefinition = /(?:\s+|^)([\w-]+):?(.*?)$/;
- const matchImport = /^([\w-]+)(?:\s+as\s+([\w-]+))?/;
- var src$4 = (options) => {
- let importIndex = 0;
- const createImportedName =
- (options && options.createImportedName) ||
- ((importName /*, path*/) =>
- `i__const_${importName.replace(/\W/g, "_")}_${importIndex++}`);
- return {
- postcssPlugin: "postcss-modules-values",
- prepare(result) {
- const importAliases = [];
- const definitions = {};
- return {
- Once(root, postcss) {
- root.walkAtRules(/value/i, (atRule) => {
- const matches = atRule.params.match(matchImports$1);
- if (matches) {
- let [, /*match*/ aliases, path] = matches;
- // We can use constants for path names
- if (definitions[path]) {
- path = definitions[path];
- }
- const imports = aliases
- .replace(/^\(\s*([\s\S]+)\s*\)$/, "$1")
- .split(/\s*,\s*/)
- .map((alias) => {
- const tokens = matchImport.exec(alias);
- if (tokens) {
- const [, /*match*/ theirName, myName = theirName] = tokens;
- const importedName = createImportedName(myName);
- definitions[myName] = importedName;
- return { theirName, importedName };
- } else {
- throw new Error(`@import statement "${alias}" is invalid!`);
- }
- });
- importAliases.push({ path, imports });
- atRule.remove();
- return;
- }
- if (atRule.params.indexOf("@value") !== -1) {
- result.warn("Invalid value definition: " + atRule.params);
- }
- let [, key, value] = `${atRule.params}${atRule.raws.between}`.match(
- matchValueDefinition
- );
- const normalizedValue = value.replace(/\/\*((?!\*\/).*?)\*\//g, "");
- if (normalizedValue.length === 0) {
- result.warn("Invalid value definition: " + atRule.params);
- atRule.remove();
- return;
- }
- let isOnlySpace = /^\s+$/.test(normalizedValue);
- if (!isOnlySpace) {
- value = value.trim();
- }
- // Add to the definitions, knowing that values can refer to each other
- definitions[key] = src.replaceValueSymbols(
- value,
- definitions
- );
- atRule.remove();
- });
- /* If we have no definitions, don't continue */
- if (!Object.keys(definitions).length) {
- return;
- }
- /* Perform replacements */
- src.replaceSymbols(root, definitions);
- /* 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 */
- const exportDeclarations = Object.keys(definitions).map((key) =>
- postcss.decl({
- value: definitions[key],
- prop: key,
- raws: { before: "\n " },
- })
- );
- /* Add export rules if any */
- if (exportDeclarations.length > 0) {
- const exportRule = postcss.rule({
- selector: ":export",
- raws: { after: "\n" },
- });
- exportRule.append(exportDeclarations);
- root.prepend(exportRule);
- }
- /* Add import rules */
- importAliases.reverse().forEach(({ path, imports }) => {
- const importRule = postcss.rule({
- selector: `:import(${path})`,
- raws: { after: "\n" },
- });
- imports.forEach(({ theirName, importedName }) => {
- importRule.append({
- value: theirName,
- prop: importedName,
- raws: { before: "\n " },
- });
- });
- root.prepend(importRule);
- });
- },
- };
- },
- };
- };
- var postcss$2 = true;
- src$4.postcss = postcss$2;
- var behaviours_1 = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.behaviours = undefined;
- exports.getDefaultPlugins = getDefaultPlugins;
- exports.isValidBehaviour = isValidBehaviour;
- var _postcssModulesLocalByDefault2 = _interopRequireDefault(src$1);
- var _postcssModulesExtractImports2 = _interopRequireDefault(src$2);
- var _postcssModulesScope2 = _interopRequireDefault(src$3);
- var _postcssModulesValues2 = _interopRequireDefault(src$4);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- const behaviours = exports.behaviours = {
- LOCAL: "local",
- GLOBAL: "global"
- };
- function getDefaultPlugins({
- behaviour,
- generateScopedName,
- exportGlobals
- }) {
- const scope = (0, _postcssModulesScope2.default)({ generateScopedName, exportGlobals });
- const plugins = {
- [behaviours.LOCAL]: [_postcssModulesValues2.default, _postcssModulesLocalByDefault2.default, _postcssModulesExtractImports2.default, scope],
- [behaviours.GLOBAL]: [_postcssModulesValues2.default, _postcssModulesExtractImports2.default, scope]
- };
- return plugins[behaviour];
- }
- function isValidBehaviour(behaviour) {
- return Object.keys(behaviours).map(key => behaviours[key]).indexOf(behaviour) > -1;
- }
- });
- var _postcss2$1 = _interopRequireDefault$3(_postcss__default);
- var _lodash2 = _interopRequireDefault$3(lodash_camelcase);
- var _genericNames2 = _interopRequireDefault$3(genericNames);
- var _unquote2 = _interopRequireDefault$3(unquote_1);
- var _parser2$1 = _interopRequireDefault$3(parser$1);
- var _loader2 = _interopRequireDefault$3(loader);
- var _generateScopedName2 = _interopRequireDefault$3(generateScopedName_1);
- var _saveJSON2 = _interopRequireDefault$3(saveJSON_1);
- function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- 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"); }); }; }
- const PLUGIN_NAME = "postcss-modules";
- function getDefaultScopeBehaviour(opts) {
- if (opts.scopeBehaviour && (0, behaviours_1.isValidBehaviour)(opts.scopeBehaviour)) {
- return opts.scopeBehaviour;
- }
- return behaviours_1.behaviours.LOCAL;
- }
- function getScopedNameGenerator(opts) {
- const scopedNameGenerator = opts.generateScopedName || _generateScopedName2.default;
- if (typeof scopedNameGenerator === "function") return scopedNameGenerator;
- return (0, _genericNames2.default)(scopedNameGenerator, {
- context: process.cwd(),
- hashPrefix: opts.hashPrefix
- });
- }
- function getLoader(opts, plugins) {
- const root = typeof opts.root === "undefined" ? "/" : opts.root;
- return typeof opts.Loader === "function" ? new opts.Loader(root, plugins) : new _loader2.default(root, plugins);
- }
- function isGlobalModule(globalModules, inputFile) {
- return globalModules.some(regex => inputFile.match(regex));
- }
- function getDefaultPluginsList(opts, inputFile) {
- const globalModulesList = opts.globalModulePaths || null;
- const exportGlobals = opts.exportGlobals || false;
- const defaultBehaviour = getDefaultScopeBehaviour(opts);
- const generateScopedName = getScopedNameGenerator(opts);
- if (globalModulesList && isGlobalModule(globalModulesList, inputFile)) {
- return (0, behaviours_1.getDefaultPlugins)({
- behaviour: behaviours_1.behaviours.GLOBAL,
- generateScopedName,
- exportGlobals
- });
- }
- return (0, behaviours_1.getDefaultPlugins)({
- behaviour: defaultBehaviour,
- generateScopedName,
- exportGlobals
- });
- }
- function isOurPlugin(plugin) {
- return plugin.postcssPlugin === PLUGIN_NAME;
- }
- function dashesCamelCase(string) {
- return string.replace(/-+(\w)/g, (_, firstLetter) => firstLetter.toUpperCase());
- }
- var build = (opts = {}) => {
- return {
- postcssPlugin: PLUGIN_NAME,
- OnceExit(css, { result }) {
- return _asyncToGenerator(function* () {
- const getJSON = opts.getJSON || _saveJSON2.default;
- const inputFile = css.source.input.file;
- const pluginList = getDefaultPluginsList(opts, inputFile);
- const resultPluginIndex = result.processor.plugins.findIndex(function (plugin) {
- return isOurPlugin(plugin);
- });
- if (resultPluginIndex === -1) {
- throw new Error('Plugin missing from options.');
- }
- const earlierPlugins = result.processor.plugins.slice(0, resultPluginIndex);
- const loaderPlugins = [...earlierPlugins, ...pluginList];
- const loader = getLoader(opts, loaderPlugins);
- const fetcher = function fetcher(file, relativeTo, depTrace) {
- const unquoteFile = (0, _unquote2.default)(file);
- const resolvedResult = typeof opts.resolve === 'function' && opts.resolve(unquoteFile);
- const resolvedFile = resolvedResult instanceof Promise ? resolvedResult : Promise.resolve(resolvedResult);
- return resolvedFile.then(function (f) {
- return loader.fetch.call(loader, `"${f || unquoteFile}"`, relativeTo, depTrace);
- });
- };
- const parser = new _parser2$1.default(fetcher);
- yield (0, _postcss2$1.default)([...pluginList, parser.plugin()]).process(css, {
- from: inputFile
- });
- const out = loader.finalSource;
- if (out) css.prepend(out);
- if (opts.localsConvention) {
- const isFunc = typeof opts.localsConvention === "function";
- parser.exportTokens = Object.entries(parser.exportTokens).reduce(function (tokens, [className, value]) {
- if (isFunc) {
- tokens[opts.localsConvention(className, value, inputFile)] = value;
- return tokens;
- }
- switch (opts.localsConvention) {
- case "camelCase":
- tokens[className] = value;
- tokens[(0, _lodash2.default)(className)] = value;
- break;
- case "camelCaseOnly":
- tokens[(0, _lodash2.default)(className)] = value;
- break;
- case "dashes":
- tokens[className] = value;
- tokens[dashesCamelCase(className)] = value;
- break;
- case "dashesOnly":
- tokens[dashesCamelCase(className)] = value;
- break;
- }
- return tokens;
- }, {});
- }
- result.messages.push({
- type: "export",
- plugin: "postcss-modules",
- exportTokens: parser.exportTokens
- });
- // getJSON may return a promise
- return getJSON(css.source.input.file, parser.exportTokens, result.opts.to);
- })();
- }
- };
- };
- var postcss$3 = true;
- build.postcss = postcss$3;
- function compileStyle(options) {
- return doCompileStyle({
- ...options,
- isAsync: false
- });
- }
- function compileStyleAsync(options) {
- return doCompileStyle({
- ...options,
- isAsync: true
- });
- }
- function doCompileStyle(options) {
- const { filename, id, scoped = false, trim = true, isProd = false, modules = false, modulesOptions = {}, preprocessLang, postcssOptions, postcssPlugins } = options;
- const preprocessor = preprocessLang && processors[preprocessLang];
- const preProcessedSource = preprocessor && preprocess$1(options, preprocessor);
- const map = preProcessedSource
- ? preProcessedSource.map
- : options.inMap || options.map;
- const source = preProcessedSource ? preProcessedSource.code : options.source;
- const shortId = id.replace(/^data-v-/, '');
- const longId = `data-v-${shortId}`;
- const plugins = (postcssPlugins || []).slice();
- plugins.unshift(cssVarsPlugin({ id: shortId, isProd }));
- if (trim) {
- plugins.push(trimPlugin());
- }
- if (scoped) {
- plugins.push(scopedPlugin(longId));
- }
- let cssModules;
- if (modules) {
- if (!options.isAsync) {
- throw new Error('[@vue/compiler-sfc] `modules` option can only be used with compileStyleAsync().');
- }
- plugins.push(build({
- ...modulesOptions,
- getJSON: (_cssFileName, json) => {
- cssModules = json;
- }
- }));
- }
- const postCSSOptions = {
- ...postcssOptions,
- to: filename,
- from: filename
- };
- if (map) {
- postCSSOptions.map = {
- inline: false,
- annotation: false,
- prev: map
- };
- }
- let result;
- let code;
- let outMap;
- // stylus output include plain css. so need remove the repeat item
- const dependencies = new Set(preProcessedSource ? preProcessedSource.dependencies : []);
- // sass has filename self when provided filename option
- dependencies.delete(filename);
- const errors = [];
- if (preProcessedSource && preProcessedSource.errors.length) {
- errors.push(...preProcessedSource.errors);
- }
- const recordPlainCssDependencies = (messages) => {
- messages.forEach(msg => {
- if (msg.type === 'dependency') {
- // postcss output path is absolute position path
- dependencies.add(msg.file);
- }
- });
- return dependencies;
- };
- try {
- result = _postcss__default(plugins).process(source, postCSSOptions);
- // In async mode, return a promise.
- if (options.isAsync) {
- return result
- .then(result => ({
- code: result.css || '',
- map: result.map && result.map.toJSON(),
- errors,
- modules: cssModules,
- rawResult: result,
- dependencies: recordPlainCssDependencies(result.messages)
- }))
- .catch(error => ({
- code: '',
- map: undefined,
- errors: [...errors, error],
- rawResult: undefined,
- dependencies
- }));
- }
- recordPlainCssDependencies(result.messages);
- // force synchronous transform (we know we only have sync plugins)
- code = result.css;
- outMap = result.map;
- }
- catch (e) {
- errors.push(e);
- }
- return {
- code: code || ``,
- map: outMap && outMap.toJSON(),
- errors,
- rawResult: result,
- dependencies
- };
- }
- function preprocess$1(options, preprocessor) {
- return preprocessor(options.source, options.inMap || options.map, {
- filename: options.filename,
- ...options.preprocessOptions
- }, options.preprocessCustomRequire);
- }
- // API
- const walk$1 = estreeWalker.walk;
- exports.MagicString = MagicString__default;
- exports.babelParse = parser$2.parse;
- exports.extractIdentifiers = compilerCore.extractIdentifiers;
- exports.generateCodeFrame = compilerCore.generateCodeFrame;
- exports.isInDestructureAssignment = compilerCore.isInDestructureAssignment;
- exports.isStaticProperty = compilerCore.isStaticProperty;
- exports.walkIdentifiers = compilerCore.walkIdentifiers;
- exports.shouldTransformRef = reactivityTransform.shouldTransform;
- exports.transformRef = reactivityTransform.transform;
- exports.transformRefAST = reactivityTransform.transformAST;
- exports.compileScript = compileScript;
- exports.compileStyle = compileStyle;
- exports.compileStyleAsync = compileStyleAsync;
- exports.compileTemplate = compileTemplate;
- exports.parse = parse;
- exports.rewriteDefault = rewriteDefault;
- exports.walk = walk$1;
|