UNPKG

css-tree

Version:

A tool set for CSS: fast detailed parser (CSS → AST), walker (AST traversal), generator (AST → CSS) and lexer (validation and matching) based on specs and browser implementations

10 lines 203 kB
var csstree=(()=>{var Hs=Object.create;var Pt=Object.defineProperty;var Gs=Object.getOwnPropertyDescriptor;var Ys=Object.getOwnPropertyNames;var Ks=Object.getPrototypeOf,Vs=Object.prototype.hasOwnProperty;var _e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),f=(e,t)=>{for(var r in t)Pt(e,r,{get:t[r],enumerable:!0})},xo=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ys(t))!Vs.call(e,i)&&i!==r&&Pt(e,i,{get:()=>t[i],enumerable:!(n=Gs(t,i))||n.enumerable});return e};var Qs=(e,t,r)=>(r=e!=null?Hs(Ks(e)):{},xo(t||!e||!e.__esModule?Pt(r,"default",{value:e,enumerable:!0}):r,e)),Xs=e=>xo(Pt({},"__esModule",{value:!0}),e);var Do=_e(Cr=>{var No="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");Cr.encode=function(e){if(0<=e&&e<No.length)return No[e];throw new TypeError("Must be between 0 and 63: "+e)};Cr.decode=function(e){var t=65,r=90,n=97,i=122,o=48,a=57,c=43,u=47,s=26,l=52;return t<=e&&e<=r?e-t:n<=e&&e<=i?e-n+s:o<=e&&e<=a?e-o+l:e==c?62:e==u?63:-1}});var Bo=_e(Lr=>{var Oo=Do(),Tr=5,Fo=1<<Tr,Ro=Fo-1,Mo=Fo;function cl(e){return e<0?(-e<<1)+1:(e<<1)+0}function ul(e){var t=(e&1)===1,r=e>>1;return t?-r:r}Lr.encode=function(t){var r="",n,i=cl(t);do n=i&Ro,i>>>=Tr,i>0&&(n|=Mo),r+=Oo.encode(n);while(i>0);return r};Lr.decode=function(t,r,n){var i=t.length,o=0,a=0,c,u;do{if(r>=i)throw new Error("Expected more digits in base 64 VLQ value.");if(u=Oo.decode(t.charCodeAt(r++)),u===-1)throw new Error("Invalid base64 digit: "+t.charAt(r-1));c=!!(u&Mo),u&=Ro,o=o+(u<<a),a+=Tr}while(c);n.value=ul(o),n.rest=r}});var qt=_e(W=>{function pl(e,t,r){if(t in e)return e[t];if(arguments.length===3)return r;throw new Error('"'+t+'" is a required argument.')}W.getArg=pl;var _o=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,hl=/^data:.+\,.+$/;function pt(e){var t=e.match(_o);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}W.urlParse=pt;function Xe(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}W.urlGenerate=Xe;var ml=32;function dl(e){var t=[];return function(r){for(var n=0;n<t.length;n++)if(t[n].input===r){var i=t[0];return t[0]=t[n],t[n]=i,t[0].result}var o=e(r);return t.unshift({input:r,result:o}),t.length>ml&&t.pop(),o}}var Ar=dl(function(t){var r=t,n=pt(t);if(n){if(!n.path)return t;r=n.path}for(var i=W.isAbsolute(r),o=[],a=0,c=0;;)if(a=c,c=r.indexOf("/",a),c===-1){o.push(r.slice(a));break}else for(o.push(r.slice(a,c));c<r.length&&r[c]==="/";)c++;for(var u,s=0,c=o.length-1;c>=0;c--)u=o[c],u==="."?o.splice(c,1):u===".."?s++:s>0&&(u===""?(o.splice(c+1,s),s=0):(o.splice(c,2),s--));return r=o.join("/"),r===""&&(r=i?"/":"."),n?(n.path=r,Xe(n)):r});W.normalize=Ar;function Wo(e,t){e===""&&(e="."),t===""&&(t=".");var r=pt(t),n=pt(e);if(n&&(e=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),Xe(r);if(r||t.match(hl))return t;if(n&&!n.host&&!n.path)return n.host=t,Xe(n);var i=t.charAt(0)==="/"?t:Ar(e.replace(/\/+$/,"")+"/"+t);return n?(n.path=i,Xe(n)):i}W.join=Wo;W.isAbsolute=function(e){return e.charAt(0)==="/"||_o.test(e)};function fl(e,t){e===""&&(e="."),e=e.replace(/\/$/,"");for(var r=0;t.indexOf(e+"/")!==0;){var n=e.lastIndexOf("/");if(n<0||(e=e.slice(0,n),e.match(/^([^\/]+:\/)?\/*$/)))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)}W.relative=fl;var qo=(function(){var e=Object.create(null);return!("__proto__"in e)})();function jo(e){return e}function gl(e){return Uo(e)?"$"+e:e}W.toSetString=qo?jo:gl;function bl(e){return Uo(e)?e.slice(1):e}W.fromSetString=qo?jo:bl;function Uo(e){if(!e)return!1;var t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(var r=t-10;r>=0;r--)if(e.charCodeAt(r)!==36)return!1;return!0}function yl(e,t,r){var n=ke(e.source,t.source);return n!==0||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0||r)||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=e.generatedLine-t.generatedLine,n!==0)?n:ke(e.name,t.name)}W.compareByOriginalPositions=yl;function xl(e,t,r){var n;return n=e.originalLine-t.originalLine,n!==0||(n=e.originalColumn-t.originalColumn,n!==0||r)||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=e.generatedLine-t.generatedLine,n!==0)?n:ke(e.name,t.name)}W.compareByOriginalPositionsNoSource=xl;function kl(e,t,r){var n=e.generatedLine-t.generatedLine;return n!==0||(n=e.generatedColumn-t.generatedColumn,n!==0||r)||(n=ke(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:ke(e.name,t.name)}W.compareByGeneratedPositionsDeflated=kl;function wl(e,t,r){var n=e.generatedColumn-t.generatedColumn;return n!==0||r||(n=ke(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:ke(e.name,t.name)}W.compareByGeneratedPositionsDeflatedNoLine=wl;function ke(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function vl(e,t){var r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=ke(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:ke(e.name,t.name)}W.compareByGeneratedPositionsInflated=vl;function Sl(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}W.parseSourceMapInput=Sl;function Cl(e,t,r){if(t=t||"",e&&(e[e.length-1]!=="/"&&t[0]!=="/"&&(e+="/"),t=e+t),r){var n=pt(r);if(!n)throw new Error("sourceMapURL could not be parsed");if(n.path){var i=n.path.lastIndexOf("/");i>=0&&(n.path=n.path.substring(0,i+1))}t=Wo(Xe(n),t)}return Ar(t)}W.computeSourceURL=Cl});var Go=_e(Ho=>{var Er=qt(),zr=Object.prototype.hasOwnProperty,Oe=typeof Map<"u";function we(){this._array=[],this._set=Oe?new Map:Object.create(null)}we.fromArray=function(t,r){for(var n=new we,i=0,o=t.length;i<o;i++)n.add(t[i],r);return n};we.prototype.size=function(){return Oe?this._set.size:Object.getOwnPropertyNames(this._set).length};we.prototype.add=function(t,r){var n=Oe?t:Er.toSetString(t),i=Oe?this.has(t):zr.call(this._set,n),o=this._array.length;(!i||r)&&this._array.push(t),i||(Oe?this._set.set(t,o):this._set[n]=o)};we.prototype.has=function(t){if(Oe)return this._set.has(t);var r=Er.toSetString(t);return zr.call(this._set,r)};we.prototype.indexOf=function(t){if(Oe){var r=this._set.get(t);if(r>=0)return r}else{var n=Er.toSetString(t);if(zr.call(this._set,n))return this._set[n]}throw new Error('"'+t+'" is not in the set.')};we.prototype.at=function(t){if(t>=0&&t<this._array.length)return this._array[t];throw new Error("No element indexed by "+t)};we.prototype.toArray=function(){return this._array.slice()};Ho.ArraySet=we});var Vo=_e(Ko=>{var Yo=qt();function Tl(e,t){var r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,o=t.generatedColumn;return n>r||n==r&&o>=i||Yo.compareByGeneratedPositionsInflated(e,t)<=0}function jt(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}jt.prototype.unsortedForEach=function(t,r){this._array.forEach(t,r)};jt.prototype.add=function(t){Tl(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))};jt.prototype.toArray=function(){return this._sorted||(this._array.sort(Yo.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};Ko.MappingList=jt});var Xo=_e(Qo=>{var ht=Bo(),F=qt(),Ut=Go().ArraySet,Ll=Vo().MappingList;function oe(e){e||(e={}),this._file=F.getArg(e,"file",null),this._sourceRoot=F.getArg(e,"sourceRoot",null),this._skipValidation=F.getArg(e,"skipValidation",!1),this._ignoreInvalidMapping=F.getArg(e,"ignoreInvalidMapping",!1),this._sources=new Ut,this._names=new Ut,this._mappings=new Ll,this._sourcesContents=null}oe.prototype._version=3;oe.fromSourceMap=function(t,r){var n=t.sourceRoot,i=new oe(Object.assign(r||{},{file:t.file,sourceRoot:n}));return t.eachMapping(function(o){var a={generated:{line:o.generatedLine,column:o.generatedColumn}};o.source!=null&&(a.source=o.source,n!=null&&(a.source=F.relative(n,a.source)),a.original={line:o.originalLine,column:o.originalColumn},o.name!=null&&(a.name=o.name)),i.addMapping(a)}),t.sources.forEach(function(o){var a=o;n!==null&&(a=F.relative(n,o)),i._sources.has(a)||i._sources.add(a);var c=t.sourceContentFor(o);c!=null&&i.setSourceContent(o,c)}),i};oe.prototype.addMapping=function(t){var r=F.getArg(t,"generated"),n=F.getArg(t,"original",null),i=F.getArg(t,"source",null),o=F.getArg(t,"name",null);!this._skipValidation&&this._validateMapping(r,n,i,o)===!1||(i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),o!=null&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:i,name:o}))};oe.prototype.setSourceContent=function(t,r){var n=t;this._sourceRoot!=null&&(n=F.relative(this._sourceRoot,n)),r!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[F.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[F.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};oe.prototype.applySourceMap=function(t,r,n){var i=r;if(r==null){if(t.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);i=t.file}var o=this._sourceRoot;o!=null&&(i=F.relative(o,i));var a=new Ut,c=new Ut;this._mappings.unsortedForEach(function(u){if(u.source===i&&u.originalLine!=null){var s=t.originalPositionFor({line:u.originalLine,column:u.originalColumn});s.source!=null&&(u.source=s.source,n!=null&&(u.source=F.join(n,u.source)),o!=null&&(u.source=F.relative(o,u.source)),u.originalLine=s.line,u.originalColumn=s.column,s.name!=null&&(u.name=s.name))}var l=u.source;l!=null&&!a.has(l)&&a.add(l);var p=u.name;p!=null&&!c.has(p)&&c.add(p)},this),this._sources=a,this._names=c,t.sources.forEach(function(u){var s=t.sourceContentFor(u);s!=null&&(n!=null&&(u=F.join(n,u)),o!=null&&(u=F.relative(o,u)),this.setSourceContent(u,s))},this)};oe.prototype._validateMapping=function(t,r,n,i){if(r&&typeof r.line!="number"&&typeof r.column!="number"){var o="original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.";if(this._ignoreInvalidMapping)return typeof console<"u"&&console.warn&&console.warn(o),!1;throw new Error(o)}if(!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0&&!r&&!n&&!i)){if(t&&"line"in t&&"column"in t&&r&&"line"in r&&"column"in r&&t.line>0&&t.column>=0&&r.line>0&&r.column>=0&&n)return;var o="Invalid mapping: "+JSON.stringify({generated:t,source:n,original:r,name:i});if(this._ignoreInvalidMapping)return typeof console<"u"&&console.warn&&console.warn(o),!1;throw new Error(o)}};oe.prototype._serializeMappings=function(){for(var t=0,r=1,n=0,i=0,o=0,a=0,c="",u,s,l,p,h=this._mappings.toArray(),d=0,b=h.length;d<b;d++){if(s=h[d],u="",s.generatedLine!==r)for(t=0;s.generatedLine!==r;)u+=";",r++;else if(d>0){if(!F.compareByGeneratedPositionsInflated(s,h[d-1]))continue;u+=","}u+=ht.encode(s.generatedColumn-t),t=s.generatedColumn,s.source!=null&&(p=this._sources.indexOf(s.source),u+=ht.encode(p-a),a=p,u+=ht.encode(s.originalLine-1-i),i=s.originalLine-1,u+=ht.encode(s.originalColumn-n),n=s.originalColumn,s.name!=null&&(l=this._names.indexOf(s.name),u+=ht.encode(l-o),o=l)),c+=u}return c};oe.prototype._generateSourcesContent=function(t,r){return t.map(function(n){if(!this._sourcesContents)return null;r!=null&&(n=F.relative(r,n));var i=F.toSetString(n);return Object.prototype.hasOwnProperty.call(this._sourcesContents,i)?this._sourcesContents[i]:null},this)};oe.prototype.toJSON=function(){var t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(t.file=this._file),this._sourceRoot!=null&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t};oe.prototype.toString=function(){return JSON.stringify(this.toJSON())};Qo.SourceMapGenerator=oe});var Ed={};f(Ed,{Lexer:()=>Re,List:()=>j,OffsetToLocation:()=>Ye,TokenStream:()=>Ke,clone:()=>fr,createLexer:()=>kd,createSyntax:()=>sr,definitionSyntax:()=>Jr,find:()=>vd,findAll:()=>Cd,findLast:()=>Sd,fork:()=>Ad,fromPlainObject:()=>Ld,generate:()=>yd,ident:()=>yo,isCustomProperty:()=>gt,keyword:()=>ft,lexer:()=>xd,parse:()=>bd,property:()=>Qt,string:()=>pr,toPlainObject:()=>Td,tokenNames:()=>Te,tokenTypes:()=>It,tokenize:()=>gd,url:()=>mr,vendorPrefix:()=>Wl,version:()=>md,walk:()=>wd});var It={};f(It,{AtKeyword:()=>N,BadString:()=>We,BadUrl:()=>Y,CDC:()=>K,CDO:()=>Ie,Colon:()=>B,Comma:()=>V,Comment:()=>D,Delim:()=>w,Dimension:()=>k,EOF:()=>be,Function:()=>x,Hash:()=>T,Ident:()=>m,LeftCurlyBracket:()=>R,LeftParenthesis:()=>S,LeftSquareBracket:()=>$,Number:()=>g,Percentage:()=>P,RightCurlyBracket:()=>Z,RightParenthesis:()=>y,RightSquareBracket:()=>ee,Semicolon:()=>_,String:()=>ne,Url:()=>M,WhiteSpace:()=>L});var be=0,m=1,x=2,N=3,T=4,ne=5,We=6,M=7,Y=8,w=9,g=10,P=11,k=12,L=13,Ie=14,K=15,B=16,_=17,V=18,$=19,ee=20,S=21,y=22,R=23,Z=24,D=25;function O(e){return e>=48&&e<=57}function te(e){return O(e)||e>=65&&e<=70||e>=97&&e<=102}function Dt(e){return e>=65&&e<=90}function $s(e){return e>=97&&e<=122}function Zs(e){return Dt(e)||$s(e)}function Js(e){return e>=128}function Nt(e){return Zs(e)||Js(e)||e===95}function qe(e){return Nt(e)||O(e)||e===45}function el(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function at(e){return e===10||e===13||e===12}function me(e){return at(e)||e===32||e===9}function Q(e,t){return!(e!==92||at(t)||t===0)}function je(e,t,r){return e===45?Nt(t)||t===45||Q(t,r):Nt(e)?!0:e===92?Q(e,t):!1}function Ot(e,t,r){return e===43||e===45?O(t)?2:t===46&&O(r)?3:0:e===46?O(t)?2:0:O(e)?1:0}function Ft(e){return e===65279||e===65534?1:0}var gr=new Array(128),tl=128,st=130,br=131,Rt=132,yr=133;for(let e=0;e<gr.length;e++)gr[e]=me(e)&&st||O(e)&&br||Nt(e)&&Rt||el(e)&&yr||e||tl;function Mt(e){return e<128?gr[e]:Rt}function Ue(e,t){return t<e.length?e.charCodeAt(t):0}function Bt(e,t,r){return r===13&&Ue(e,t+1)===10?2:1}function ye(e,t,r){let n=e.charCodeAt(t);return Dt(n)&&(n=n|32),n===r}function xe(e,t,r,n){if(r-t!==n.length||t<0||r>e.length)return!1;for(let i=t;i<r;i++){let o=n.charCodeAt(i-t),a=e.charCodeAt(i);if(Dt(a)&&(a=a|32),a!==o)return!1}return!0}function ko(e,t){for(;t>=0&&me(e.charCodeAt(t));t--);return t+1}function lt(e,t){for(;t<e.length&&me(e.charCodeAt(t));t++);return t}function xr(e,t){for(;t<e.length&&O(e.charCodeAt(t));t++);return t}function se(e,t){if(t+=2,te(Ue(e,t-1))){for(let n=Math.min(e.length,t+5);t<n&&te(Ue(e,t));t++);let r=Ue(e,t);me(r)&&(t+=Bt(e,t,r))}return t}function ct(e,t){for(;t<e.length;t++){let r=e.charCodeAt(t);if(!qe(r)){if(Q(r,Ue(e,t+1))){t=se(e,t)-1;continue}break}}return t}function Ne(e,t){let r=e.charCodeAt(t);if((r===43||r===45)&&(r=e.charCodeAt(t+=1)),O(r)&&(t=xr(e,t+1),r=e.charCodeAt(t)),r===46&&O(e.charCodeAt(t+1))&&(t+=2,t=xr(e,t)),ye(e,t,101)){let n=0;r=e.charCodeAt(t+1),(r===45||r===43)&&(n=1,r=e.charCodeAt(t+2)),O(r)&&(t=xr(e,t+1+n+1))}return t}function _t(e,t){for(;t<e.length;t++){let r=e.charCodeAt(t);if(r===41){t++;break}Q(r,Ue(e,t+1))&&(t=se(e,t))}return t}function He(e){if(e.length===1&&!te(e.charCodeAt(0)))return e[0];let t=parseInt(e,16);return(t===0||t>=55296&&t<=57343||t>1114111)&&(t=65533),String.fromCodePoint(t)}var Te=["EOF-token","ident-token","function-token","at-keyword-token","hash-token","string-token","bad-string-token","url-token","bad-url-token","delim-token","number-token","percentage-token","dimension-token","whitespace-token","CDO-token","CDC-token","colon-token","semicolon-token","comma-token","[-token","]-token","(-token",")-token","{-token","}-token","comment-token"];function Ge(e=null,t){return e===null||e.length<t?new Uint32Array(Math.max(t+1024,16384)):e}var wo=10,rl=12,vo=13;function So(e){let t=e.source,r=t.length,n=t.length>0?Ft(t.charCodeAt(0)):0,i=Ge(e.lines,r),o=Ge(e.columns,r),a=e.startLine,c=e.startColumn;for(let u=n;u<r;u++){let s=t.charCodeAt(u);i[u]=a,o[u]=c++,(s===wo||s===vo||s===rl)&&(s===vo&&u+1<r&&t.charCodeAt(u+1)===wo&&(u++,i[u]=a,o[u]=c),a++,c=1)}i[r]=a,o[r]=c,e.lines=i,e.columns=o,e.computed=!0}var Ye=class{constructor(t,r,n,i){this.setSource(t,r,n,i),this.lines=null,this.columns=null}setSource(t="",r=0,n=1,i=1){this.source=t,this.startOffset=r,this.startLine=n,this.startColumn=i,this.computed=!1}getLocation(t,r){return this.computed||So(this),{source:r,offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]}}getLocationRange(t,r,n){return this.computed||So(this),{source:n,start:{offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]},end:{offset:this.startOffset+r,line:this.lines[r],column:this.columns[r]}}}};var le=16777215,ce=24,ut=1,Wt=2,Le=new Uint8Array(32);Le[2]=22;Le[21]=22;Le[19]=20;Le[23]=24;var ue=new Uint8Array(32);ue[2]=ut;ue[21]=ut;ue[19]=ut;ue[23]=ut;ue[22]=Wt;ue[20]=Wt;ue[24]=Wt;function Co(e,t,r){return e<t?t:e>r?r:e}var Ke=class{constructor(t,r){this.setSource(t,r)}reset(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset}setSource(t="",r=()=>{}){t=String(t||"");let n=t.length,i=Ge(this.offsetAndType,t.length+1),o=Ge(this.balance,t.length+1),a=0,c=-1,u=0,s=t.length;this.offsetAndType=null,this.balance=null,o.fill(0),r(t,(l,p,h)=>{let d=a++;if(i[d]=l<<ce|h,c===-1&&(c=p),o[d]=s,l===u){let b=o[s];o[s]=d,s=b,u=Le[i[b]>>ce]}else this.isBlockOpenerTokenType(l)&&(s=d,u=Le[l])}),i[a]=0<<ce|n,o[a]=a;for(let l=0;l<a;l++){let p=o[l];if(p<=l){let h=o[p];h!==l&&(o[l]=h)}else p>a&&(o[l]=a)}this.source=t,this.firstCharOffset=c===-1?0:c,this.tokenCount=a,this.offsetAndType=i,this.balance=o,this.reset(),this.next()}lookupType(t){return t+=this.tokenIndex,t<this.tokenCount?this.offsetAndType[t]>>ce:0}lookupTypeNonSC(t){for(let r=this.tokenIndex;r<this.tokenCount;r++){let n=this.offsetAndType[r]>>ce;if(n!==13&&n!==25&&t--===0)return n}return 0}lookupOffset(t){return t+=this.tokenIndex,t<this.tokenCount?this.offsetAndType[t-1]&le:this.source.length}lookupOffsetNonSC(t){for(let r=this.tokenIndex;r<this.tokenCount;r++){let n=this.offsetAndType[r]>>ce;if(n!==13&&n!==25&&t--===0)return r-this.tokenIndex}return 0}lookupValue(t,r){return t+=this.tokenIndex,t<this.tokenCount?xe(this.source,this.offsetAndType[t-1]&le,this.offsetAndType[t]&le,r):!1}getTokenStart(t){return t===this.tokenIndex?this.tokenStart:t>0?t<this.tokenCount?this.offsetAndType[t-1]&le:this.offsetAndType[this.tokenCount]&le:this.firstCharOffset}getTokenEnd(t){return t===this.tokenIndex?this.tokenEnd:this.offsetAndType[Co(t,0,this.tokenCount)]&le}getTokenType(t){return t===this.tokenIndex?this.tokenType:this.offsetAndType[Co(t,0,this.tokenCount)]>>ce}substrToCursor(t){return this.source.substring(t,this.tokenStart)}isBlockOpenerTokenType(t){return ue[t]===ut}isBlockCloserTokenType(t){return ue[t]===Wt}getBlockTokenPairIndex(t){let r=this.getTokenType(t);if(ue[r]===1){let n=this.balance[t],i=this.getTokenType(n);return Le[r]===i?n:-1}else if(ue[r]===2){let n=this.balance[t],i=this.getTokenType(n);return Le[i]===r?n:-1}return-1}isBalanceEdge(t){return this.balance[this.tokenIndex]<t}isDelim(t,r){return r?this.lookupType(r)===9&&this.source.charCodeAt(this.lookupOffset(r))===t:this.tokenType===9&&this.source.charCodeAt(this.tokenStart)===t}skip(t){let r=this.tokenIndex+t;r<this.tokenCount?(this.tokenIndex=r,this.tokenStart=this.offsetAndType[r-1]&le,r=this.offsetAndType[r],this.tokenType=r>>ce,this.tokenEnd=r&le):(this.tokenIndex=this.tokenCount,this.next())}next(){let t=this.tokenIndex+1;t<this.tokenCount?(this.tokenIndex=t,this.tokenStart=this.tokenEnd,t=this.offsetAndType[t],this.tokenType=t>>ce,this.tokenEnd=t&le):(this.eof=!0,this.tokenIndex=this.tokenCount,this.tokenType=0,this.tokenStart=this.tokenEnd=this.source.length)}skipSC(){for(;this.tokenType===13||this.tokenType===25;)this.next()}skipUntilBalanced(t,r){let n=t,i=0,o=0;e:for(;n<this.tokenCount;n++){if(i=this.balance[n],i<t)break e;switch(o=n>0?this.offsetAndType[n-1]&le:this.firstCharOffset,r(this.source.charCodeAt(o))){case 1:break e;case 2:n++;break e;default:this.isBlockOpenerTokenType(this.offsetAndType[n]>>ce)&&(n=i)}}this.skip(n-this.tokenIndex)}forEachToken(t){for(let r=0,n=this.firstCharOffset;r<this.tokenCount;r++){let i=n,o=this.offsetAndType[r],a=o&le,c=o>>ce;n=a,t(c,i,a,r)}}dump(){let t=new Array(this.tokenCount);return this.forEachToken((r,n,i,o)=>{t[o]={idx:o,type:Te[r],chunk:this.source.substring(n,i),balance:this.balance[o]}}),t}};function Ae(e,t){function r(p){return p<c?e.charCodeAt(p):0}function n(){if(s=Ne(e,s),je(r(s),r(s+1),r(s+2))){l=12,s=ct(e,s);return}if(r(s)===37){l=11,s++;return}l=10}function i(){let p=s;if(s=ct(e,s),xe(e,p,s,"url")&&r(s)===40){if(s=lt(e,s+1),r(s)===34||r(s)===39){l=2,s=p+4;return}a();return}if(r(s)===40){l=2,s++;return}l=1}function o(p){for(p||(p=r(s++)),l=5;s<e.length;s++){let h=e.charCodeAt(s);switch(Mt(h)){case p:s++;return;case st:if(at(h)){s+=Bt(e,s,h),l=6;return}break;case 92:if(s===e.length-1)break;let d=r(s+1);at(d)?s+=Bt(e,s+1,d):Q(h,d)&&(s=se(e,s)-1);break}}}function a(){for(l=7,s=lt(e,s);s<e.length;s++){let p=e.charCodeAt(s);switch(Mt(p)){case 41:s++;return;case st:if(s=lt(e,s),r(s)===41||s>=e.length){s<e.length&&s++;return}s=_t(e,s),l=8;return;case 34:case 39:case 40:case yr:s=_t(e,s),l=8;return;case 92:if(Q(p,r(s+1))){s=se(e,s)-1;break}s=_t(e,s),l=8;return}}}e=String(e||"");let c=e.length,u=Ft(r(0)),s=u,l;for(;s<c;){let p=e.charCodeAt(s);switch(Mt(p)){case st:l=13,s=lt(e,s+1);break;case 34:o();break;case 35:qe(r(s+1))||Q(r(s+1),r(s+2))?(l=4,s=ct(e,s+1)):(l=9,s++);break;case 39:o();break;case 40:l=21,s++;break;case 41:l=22,s++;break;case 43:Ot(p,r(s+1),r(s+2))?n():(l=9,s++);break;case 44:l=18,s++;break;case 45:Ot(p,r(s+1),r(s+2))?n():r(s+1)===45&&r(s+2)===62?(l=15,s=s+3):je(p,r(s+1),r(s+2))?i():(l=9,s++);break;case 46:Ot(p,r(s+1),r(s+2))?n():(l=9,s++);break;case 47:r(s+1)===42?(l=25,s=e.indexOf("*/",s+2),s=s===-1?e.length:s+2):(l=9,s++);break;case 58:l=16,s++;break;case 59:l=17,s++;break;case 60:r(s+1)===33&&r(s+2)===45&&r(s+3)===45?(l=14,s=s+4):(l=9,s++);break;case 64:je(r(s+1),r(s+2),r(s+3))?(l=3,s=ct(e,s+1)):(l=9,s++);break;case 91:l=19,s++;break;case 92:Q(p,r(s+1))?i():(l=9,s++);break;case 93:l=20,s++;break;case 123:l=23,s++;break;case 125:l=24,s++;break;case br:n();break;case Rt:i();break;default:l=9,s++}t(l,u,u=s)}}var Ve=null,j=class e{static createItem(t){return{prev:null,next:null,data:t}}constructor(){this.head=null,this.tail=null,this.cursor=null}createItem(t){return e.createItem(t)}allocateCursor(t,r){let n;return Ve!==null?(n=Ve,Ve=Ve.cursor,n.prev=t,n.next=r,n.cursor=this.cursor):n={prev:t,next:r,cursor:this.cursor},this.cursor=n,n}releaseCursor(){let{cursor:t}=this;this.cursor=t.cursor,t.prev=null,t.next=null,t.cursor=Ve,Ve=t}updateCursors(t,r,n,i){let{cursor:o}=this;for(;o!==null;)o.prev===t&&(o.prev=r),o.next===n&&(o.next=i),o=o.cursor}*[Symbol.iterator](){for(let t=this.head;t!==null;t=t.next)yield t.data}get size(){let t=0;for(let r=this.head;r!==null;r=r.next)t++;return t}get isEmpty(){return this.head===null}get first(){return this.head&&this.head.data}get last(){return this.tail&&this.tail.data}fromArray(t){let r=null;this.head=null;for(let n of t){let i=e.createItem(n);r!==null?r.next=i:this.head=i,i.prev=r,r=i}return this.tail=r,this}toArray(){return[...this]}toJSON(){return[...this]}forEach(t,r=this){let n=this.allocateCursor(null,this.head);for(;n.next!==null;){let i=n.next;n.next=i.next,t.call(r,i.data,i,this)}this.releaseCursor()}forEachRight(t,r=this){let n=this.allocateCursor(this.tail,null);for(;n.prev!==null;){let i=n.prev;n.prev=i.prev,t.call(r,i.data,i,this)}this.releaseCursor()}reduce(t,r,n=this){let i=this.allocateCursor(null,this.head),o=r,a;for(;i.next!==null;)a=i.next,i.next=a.next,o=t.call(n,o,a.data,a,this);return this.releaseCursor(),o}reduceRight(t,r,n=this){let i=this.allocateCursor(this.tail,null),o=r,a;for(;i.prev!==null;)a=i.prev,i.prev=a.prev,o=t.call(n,o,a.data,a,this);return this.releaseCursor(),o}some(t,r=this){for(let n=this.head;n!==null;n=n.next)if(t.call(r,n.data,n,this))return!0;return!1}map(t,r=this){let n=new e;for(let i=this.head;i!==null;i=i.next)n.appendData(t.call(r,i.data,i,this));return n}filter(t,r=this){let n=new e;for(let i=this.head;i!==null;i=i.next)t.call(r,i.data,i,this)&&n.appendData(i.data);return n}nextUntil(t,r,n=this){if(t===null)return;let i=this.allocateCursor(null,t);for(;i.next!==null;){let o=i.next;if(i.next=o.next,r.call(n,o.data,o,this))break}this.releaseCursor()}prevUntil(t,r,n=this){if(t===null)return;let i=this.allocateCursor(t,null);for(;i.prev!==null;){let o=i.prev;if(i.prev=o.prev,r.call(n,o.data,o,this))break}this.releaseCursor()}clear(){this.head=null,this.tail=null}copy(){let t=new e;for(let r of this)t.appendData(r);return t}prepend(t){return this.updateCursors(null,t,this.head,t),this.head!==null?(this.head.prev=t,t.next=this.head):this.tail=t,this.head=t,this}prependData(t){return this.prepend(e.createItem(t))}append(t){return this.insert(t)}appendData(t){return this.insert(e.createItem(t))}insert(t,r=null){if(r!==null)if(this.updateCursors(r.prev,t,r,t),r.prev===null){if(this.head!==r)throw new Error("before doesn't belong to list");this.head=t,r.prev=t,t.next=r,this.updateCursors(null,t)}else r.prev.next=t,t.prev=r.prev,r.prev=t,t.next=r;else this.updateCursors(this.tail,t,null,t),this.tail!==null?(this.tail.next=t,t.prev=this.tail):this.head=t,this.tail=t;return this}insertData(t,r){return this.insert(e.createItem(t),r)}remove(t){if(this.updateCursors(t,t.prev,t,t.next),t.prev!==null)t.prev.next=t.next;else{if(this.head!==t)throw new Error("item doesn't belong to list");this.head=t.next}if(t.next!==null)t.next.prev=t.prev;else{if(this.tail!==t)throw new Error("item doesn't belong to list");this.tail=t.prev}return t.prev=null,t.next=null,t}push(t){this.insert(e.createItem(t))}pop(){return this.tail!==null?this.remove(this.tail):null}unshift(t){this.prepend(e.createItem(t))}shift(){return this.head!==null?this.remove(this.head):null}prependList(t){return this.insertList(t,this.head)}appendList(t){return this.insertList(t)}insertList(t,r){return t.head===null?this:(r!=null?(this.updateCursors(r.prev,t.tail,r,t.head),r.prev!==null?(r.prev.next=t.head,t.head.prev=r.prev):this.head=t.head,r.prev=t.tail,t.tail.next=r):(this.updateCursors(this.tail,t.tail,null,t.head),this.tail!==null?(this.tail.next=t.head,t.head.prev=this.tail):this.head=t.head,this.tail=t.tail),t.head=null,t.tail=null,this)}replace(t,r){"head"in r?this.insertList(r,t):this.insert(r,t),this.remove(t)}};function De(e,t){let r=Object.create(SyntaxError.prototype),n=new Error;return Object.assign(r,{name:e,message:t,get stack(){return(n.stack||"").replace(/^(.+\n){1,3}/,`${e}: ${t} `)}})}var kr=100,To=60,Lo=" ";function Ao({source:e,line:t,column:r,baseLine:n,baseColumn:i},o){function a(b,U){return s.slice(b,U).map((J,v)=>String(b+v+1).padStart(h)+" |"+J).join(` `)}let c=` `.repeat(Math.max(n-1,0)),u=" ".repeat(Math.max(i-1,0)),s=(c+u+e).split(/\r\n?|\n|\f/),l=Math.max(1,t-o)-1,p=Math.min(t+o,s.length+1),h=Math.max(4,String(p).length)+1,d=0;r+=(Lo.length-1)*(s[t-1].substr(0,r-1).match(/\t/g)||[]).length,r>kr&&(d=r-To+3,r=To-2);for(let b=l;b<=p;b++)b>=0&&b<s.length&&(s[b]=s[b].replace(/\t/g,Lo),s[b]=(d>0&&s[b].length>d?"\u2026":"")+s[b].substr(d,kr-2)+(s[b].length>d+kr-1?"\u2026":""));return[a(l,t),new Array(r+h+2).join("-")+"^",a(t,p)].filter(Boolean).join(` `).replace(/^(\s+\d+\s+\|\n)+/,"").replace(/\n(\s+\d+\s+\|)+$/,"")}function wr(e,t,r,n,i,o=1,a=1){return Object.assign(De("SyntaxError",e),{source:t,offset:r,line:n,column:i,sourceFragment(u){return Ao({source:t,line:n,column:i,baseLine:o,baseColumn:a},isNaN(u)?0:u)},get formattedMessage(){return`Parse error: ${e} `+Ao({source:t,line:n,column:i,baseLine:o,baseColumn:a},2)}})}function Eo(e){let t=this.createList(),r=!1,n={recognizer:e};for(;!this.eof;){switch(this.tokenType){case 25:this.next();continue;case 13:r=!0,this.next();continue}let i=e.getNode.call(this,n);if(i===void 0)break;r&&(e.onWhiteSpace&&e.onWhiteSpace.call(this,i,t,n),r=!1),t.push(i)}return r&&e.onWhiteSpace&&e.onWhiteSpace.call(this,null,t,n),t}var Qe=()=>{},nl=33,il=35,vr=59,zo=123,Po=0,ol={createList(){return[]},createSingleNodeList(e){return[e]},getFirstListNode(e){return e&&e[0]||null},getLastListNode(e){return e&&e.length>0?e[e.length-1]:null}},al={createList(){return new j},createSingleNodeList(e){return new j().appendData(e)},getFirstListNode(e){return e&&e.first},getLastListNode(e){return e&&e.last}};function sl(e){return function(){return this[e]()}}function Sr(e){let t=Object.create(null);for(let r of Object.keys(e)){let n=e[r],i=n.parse||n;i&&(t[r]=i)}return t}function ll(e){let t={context:Object.create(null),features:Object.assign(Object.create(null),e.features),scope:Object.assign(Object.create(null),e.scope),atrule:Sr(e.atrule),pseudo:Sr(e.pseudo),node:Sr(e.node)};for(let[r,n]of Object.entries(e.parseContext))switch(typeof n){case"function":t.context[r]=n;break;case"string":t.context[r]=sl(n);break}return{config:t,...t,...t.node}}function Io(e){let t="",r="<unknown>",n=!1,i=Qe,o=!1,a=new Ye,c=Object.assign(new Ke,ll(e||{}),{parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:Eo,consumeUntilBalanceEnd:()=>0,consumeUntilLeftCurlyBracket(l){return l===zo?1:0},consumeUntilLeftCurlyBracketOrSemicolon(l){return l===zo||l===vr?1:0},consumeUntilExclamationMarkOrSemicolon(l){return l===nl||l===vr?1:0},consumeUntilSemicolonIncluded(l){return l===vr?2:0},createList:Qe,createSingleNodeList:Qe,getFirstListNode:Qe,getLastListNode:Qe,parseWithFallback(l,p){let h=this.tokenIndex;try{return l.call(this)}catch(d){if(o)throw d;this.skip(h-this.tokenIndex);let b=p.call(this);return o=!0,i(d,b),o=!1,b}},lookupNonWSType(l){let p;do if(p=this.lookupType(l++),p!==13&&p!==25)return p;while(p!==Po);return Po},charCodeAt(l){return l>=0&&l<t.length?t.charCodeAt(l):0},substring(l,p){return t.substring(l,p)},substrToCursor(l){return this.source.substring(l,this.tokenStart)},cmpChar(l,p){return ye(t,l,p)},cmpStr(l,p,h){return xe(t,l,p,h)},consume(l){let p=this.tokenStart;return this.eat(l),this.substrToCursor(p)},consumeFunctionName(){let l=t.substring(this.tokenStart,this.tokenEnd-1);return this.eat(2),l},consumeNumber(l){let p=t.substring(this.tokenStart,Ne(t,this.tokenStart));return this.eat(l),p},eat(l){if(this.tokenType!==l){let p=Te[l].slice(0,-6).replace(/-/g," ").replace(/^./,b=>b.toUpperCase()),h=`${/[[\](){}]/.test(p)?`"${p}"`:p} is expected`,d=this.tokenStart;switch(l){case 1:this.tokenType===2||this.tokenType===7?(d=this.tokenEnd-1,h="Identifier is expected but function found"):h="Identifier is expected";break;case 4:this.isDelim(il)&&(this.next(),d++,h="Name is expected");break;case 11:this.tokenType===10&&(d=this.tokenEnd,h="Percent sign is expected");break}this.error(h,d)}this.next()},eatIdent(l){(this.tokenType!==1||this.lookupValue(0,l)===!1)&&this.error(`Identifier "${l}" is expected`),this.next()},eatDelim(l){this.isDelim(l)||this.error(`Delim "${String.fromCharCode(l)}" is expected`),this.next()},getLocation(l,p){return n?a.getLocationRange(l,p,r):null},getLocationFromList(l){if(n){let p=this.getFirstListNode(l),h=this.getLastListNode(l);return a.getLocationRange(p!==null?p.loc.start.offset-a.startOffset:this.tokenStart,h!==null?h.loc.end.offset-a.startOffset:this.tokenStart,r)}return null},error(l,p){let h=typeof p<"u"&&p<t.length?a.getLocation(p):this.eof?a.getLocation(ko(t,t.length-1)):a.getLocation(this.tokenStart);throw new wr(l||"Unexpected input",t,h.offset,h.line,h.column,a.startLine,a.startColumn)}}),u=()=>({filename:r,source:t,tokenCount:c.tokenCount,getTokenType:l=>c.getTokenType(l),getTokenTypeName:l=>Te[c.getTokenType(l)],getTokenStart:l=>c.getTokenStart(l),getTokenEnd:l=>c.getTokenEnd(l),getTokenValue:l=>c.source.substring(c.getTokenStart(l),c.getTokenEnd(l)),substring:(l,p)=>c.source.substring(l,p),balance:c.balance.subarray(0,c.tokenCount+1),isBlockOpenerTokenType:c.isBlockOpenerTokenType,isBlockCloserTokenType:c.isBlockCloserTokenType,getBlockTokenPairIndex:l=>c.getBlockTokenPairIndex(l),getLocation:l=>a.getLocation(l,r),getRangeLocation:(l,p)=>a.getLocationRange(l,p,r)});return Object.assign(function(l,p){t=l,p=p||{},c.setSource(t,Ae),a.setSource(t,p.offset,p.line,p.column),r=p.filename||"<unknown>",n=!!p.positions,i=typeof p.onParseError=="function"?p.onParseError:Qe,o=!1,c.parseAtrulePrelude="parseAtrulePrelude"in p?!!p.parseAtrulePrelude:!0,c.parseRulePrelude="parseRulePrelude"in p?!!p.parseRulePrelude:!0,c.parseValue="parseValue"in p?!!p.parseValue:!0,c.parseCustomProperty="parseCustomProperty"in p?!!p.parseCustomProperty:!1;let{context:h="default",list:d=!0,onComment:b,onToken:U}=p;if(!(h in c.context))throw new Error("Unknown context `"+h+"`");Object.assign(c,d?al:ol),Array.isArray(U)?c.forEachToken((v,E,H)=>{U.push({type:v,start:E,end:H})}):typeof U=="function"&&c.forEachToken(U.bind(u())),typeof b=="function"&&c.forEachToken((v,E,H)=>{if(v===25){let z=c.getLocation(E,H),re=xe(t,H-2,H,"*/")?t.slice(E+2,H-2):t.slice(E+2,H);b(re,z)}});let J=c.context[h].call(c,p);return c.eof||c.error(),J},{SyntaxError:wr,config:c.config})}var Zo=Qs(Xo(),1),$o=new Set(["Atrule","Selector","Declaration"]);function Jo(e){let t=new Zo.SourceMapGenerator,r={line:1,column:0},n={line:0,column:0},i={line:1,column:0},o={generated:i},a=1,c=0,u=!1,s=e.node;e.node=function(h){if(h.loc&&h.loc.start&&$o.has(h.type)){let d=h.loc.start.line,b=h.loc.start.column-1;(n.line!==d||n.column!==b)&&(n.line=d,n.column=b,r.line=a,r.column=c,u&&(u=!1,(r.line!==i.line||r.column!==i.column)&&t.addMapping(o)),u=!0,t.addMapping({source:h.loc.source,original:n,generated:r}))}s.call(this,h),u&&$o.has(h.type)&&(i.line=a,i.column=c)};let l=e.emit;e.emit=function(h,d,b){for(let U=0;U<h.length;U++)h.charCodeAt(U)===10?(a++,c=0):c++;l(h,d,b)};let p=e.result;return e.result=function(){return u&&t.addMapping(o),{css:p(),map:t}},e}var Ht={};f(Ht,{safe:()=>Ir,spec:()=>Pl});var Al=43,El=45,Pr=(e,t)=>(e===9&&(e=t),typeof e=="string"&&(e=Math.min(e.charCodeAt(0),128)<<6),e<<1),ea=[[1,1],[1,2],[1,7],[1,8],[1,"-"],[1,10],[1,11],[1,12],[1,15],[1,21],[3,1],[3,2],[3,7],[3,8],[3,"-"],[3,10],[3,11],[3,12],[3,15],[4,1],[4,2],[4,7],[4,8],[4,"-"],[4,10],[4,11],[4,12],[4,15],[12,1],[12,2],[12,7],[12,8],[12,"-"],[12,10],[12,11],[12,12],[12,15],["#",1],["#",2],["#",7],["#",8],["#","-"],["#",10],["#",11],["#",12],["#",15],["-",1],["-",2],["-",7],["-",8],["-","-"],["-",10],["-",11],["-",12],["-",15],[10,1],[10,2],[10,7],[10,8],[10,10],[10,11],[10,12],[10,"%"],[10,15],["@",1],["@",2],["@",7],["@",8],["@","-"],["@",15],[".",10],[".",11],[".",12],["+",10],["+",11],["+",12],["/","*"]],zl=ea.concat([[1,4],[12,4],[4,4],[3,21],[3,5],[3,16],[11,11],[11,12],[11,2],[11,"-"],[22,1],[22,2],[22,11],[22,12],[22,4],[22,"-"]]);function ta(e){let t=new Set(e.map(([r,n])=>Pr(r)<<16|Pr(n)));return function(r,n,i){let o=Pr(n,i),a=i.charCodeAt(0),c=a===El&&n!==1&&n!==2&&n!==15||a===Al?t.has((r&65534)<<16|a<<7):t.has((r&65534)<<16|o);return o|c}}var Pl=ta(ea),Ir=ta(zl);var Il=92;function Nl(e,t){if(typeof t=="function"){let r=null;e.children.forEach(n=>{r!==null&&t.call(this,r),this.node(n),r=n});return}e.children.forEach(this.node,this)}function ra(e){let t=new Map;for(let[r,n]of Object.entries(e.node))typeof(n.generate||n)=="function"&&t.set(r,n.generate||n);return function(r,n){let i="",o=0,a={node(u){if(t.has(u.type))t.get(u.type).call(c,u);else throw new Error("Unknown node type: "+u.type)},tokenBefore:Ir,token(u,s,l){o=this.tokenBefore(o,u,s),!l&&o&1&&this.emit(" ",13,!0),this.emit(s,u,!1),u===9&&s.charCodeAt(0)===Il&&this.emit(` `,13,!0)},emit(u){i+=u},result(){return i}};n&&(typeof n.decorator=="function"&&(a=n.decorator(a)),n.sourceMap&&(a=Jo(a)),n.mode in Ht&&(a.tokenBefore=Ht[n.mode]));let c={node:u=>a.node(u),children:Nl,token:(u,s)=>a.token(u,s),tokenize:u=>Ae(u,(s,l,p)=>{a.token(s,u.slice(l,p),l!==0)})};return a.node(r),a.result()}}function na(e){return{fromPlainObject(t){return e(t,{enter(r){r.children&&!(r.children instanceof j)&&(r.children=new j().fromArray(r.children))}}),t},toPlainObject(t){return e(t,{leave(r){r.children&&r.children instanceof j&&(r.children=r.children.toArray())}}),t}}}var{hasOwnProperty:Nr}=Object.prototype,mt=function(){};function ia(e){return typeof e=="function"?e:mt}function oa(e,t){return function(r,n,i){r.type===t&&e.call(this,r,n,i)}}function Dl(e,t){let r=t.structure,n=[];for(let i in r){if(Nr.call(r,i)===!1)continue;let o=r[i],a={name:i,type:!1,nullable:!1};Array.isArray(o)||(o=[o]);for(let c of o)c===null?a.nullable=!0:typeof c=="string"?a.type="node":Array.isArray(c)&&(a.type="list");a.type&&n.push(a)}return n.length?{context:t.walkContext,fields:n}:null}function Ol(e){let t={};for(let r in e.node)if(Nr.call(e.node,r)){let n=e.node[r];if(!n.structure)throw new Error("Missed `structure` field in `"+r+"` node type definition");t[r]=Dl(r,n)}return t}function aa(e,t){let r=e.fields.slice(),n=e.context,i=typeof n=="string";return t&&r.reverse(),function(o,a,c,u){let s;i&&(s=a[n],a[n]=o);for(let l of r){let p=o[l.name];if(!l.nullable||p){if(l.type==="list"){if(t?p.reduceRight(u,!1):p.reduce(u,!1))return!0}else if(c(p))return!0}}i&&(a[n]=s)}}function sa({StyleSheet:e,Atrule:t,Rule:r,Block:n,DeclarationList:i}){return{Atrule:{StyleSheet:e,Atrule:t,Rule:r,Block:n},Rule:{StyleSheet:e,Atrule:t,Rule:r,Block:n},Declaration:{StyleSheet:e,Atrule:t,Rule:r,Block:n,DeclarationList:i}}}function la(e){let t=Ol(e),r={},n={},i=Symbol("break-walk"),o=Symbol("skip-node");for(let s in t)Nr.call(t,s)&&t[s]!==null&&(r[s]=aa(t[s],!1),n[s]=aa(t[s],!0));let a=sa(r),c=sa(n),u=function(s,l){function p(v,E,H){let z=h.call(J,v,E,H);return z===i?!0:z===o?!1:!!(b.hasOwnProperty(v.type)&&b[v.type](v,J,p,U)||d.call(J,v,E,H)===i)}let h=mt,d=mt,b=r,U=(v,E,H,z)=>v||p(E,H,z),J={break:i,skip:o,root:s,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null};if(typeof l=="function")h=l;else if(l&&(h=ia(l.enter),d=ia(l.leave),l.reverse&&(b=n),l.visit)){if(a.hasOwnProperty(l.visit))b=l.reverse?c[l.visit]:a[l.visit];else if(!t.hasOwnProperty(l.visit))throw new Error("Bad value `"+l.visit+"` for `visit` option (should be: "+Object.keys(t).sort().join(", ")+")");h=oa(h,l.visit),d=oa(d,l.visit)}if(h===mt&&d===mt)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");p(s)};return u.break=i,u.skip=o,u.find=function(s,l){let p=null;return u(s,function(h,d,b){if(l.call(this,h,d,b))return p=h,i}),p},u.findLast=function(s,l){let p=null;return u(s,{reverse:!0,enter(h,d,b){if(l.call(this,h,d,b))return p=h,i}}),p},u.findAll=function(s,l){let p=[];return u(s,function(h,d,b){l.call(this,h,d,b)&&p.push(h)}),p},u}function Fl(e){return e}function Rl(e){let{min:t,max:r,comma:n}=e;return t===0&&r===0?n?"#?":"*":t===0&&r===1?"?":t===1&&r===0?n?"#":"+":t===1&&r===1?"":(n?"#":"")+(t===r?"{"+t+"}":"{"+t+","+(r!==0?r:"")+"}")}function Ml(e){if(e.type==="Range")return" ["+(e.min===null?"-\u221E":e.min)+","+(e.max===null?"\u221E":e.max)+"]";throw new Error("Unknown node type `"+e.type+"`")}function Bl(e,t,r,n){let i=e.combinator===" "||n?e.combinator:" "+e.combinator+" ",o=e.terms.map(a=>Gt(a,t,r,n)).join(i);return e.explicit||r?(n||o[0]===","?"[":"[ ")+o+(n?"]":" ]"):o}function Gt(e,t,r,n){let i;switch(e.type){case"Group":i=Bl(e,t,r,n)+(e.disallowEmpty?"!":"");break;case"Multiplier":return Gt(e.term,t,r,n)+t(Rl(e),e);case"Boolean":i="<boolean-expr["+Gt(e.term,t,r,n)+"]>";break;case"Type":i="<"+e.name+(e.opts?t(Ml(e.opts),e.opts):"")+">";break;case"Property":i="<'"+e.name+"'>";break;case"Keyword":i=e.name;break;case"AtKeyword":i="@"+e.name;break;case"Function":i=e.name+"(";break;case"String":case"Token":i=e.value;break;case"Comma":i=",";break;default:throw new Error("Unknown node type `"+e.type+"`")}return t(i,e)}function Fe(e,t){let r=Fl,n=!1,i=!1;return typeof t=="function"?r=t:t&&(n=!!t.forceBraces,i=!!t.compact,typeof t.decorate=="function"&&(r=t.decorate)),Gt(e,r,n,i)}var ca={offset:0,line:1,column:1};function _l(e,t){let r=e.tokens,n=e.longestMatch,i=n<r.length&&r[n].node||null,o=i!==t?i:null,a=0,c=0,u=0,s="",l,p;for(let h=0;h<r.length;h++){let d=r[h].value;h===n&&(c=d.length,a=s.length),o!==null&&r[h].node===o&&(h<=n?u++:u=0),s+=d}return n===r.length||u>1?(l=Yt(o||t,"end")||dt(ca,s),p=dt(l)):(l=Yt(o,"start")||dt(Yt(t,"start")||ca,s.slice(0,a)),p=Yt(o,"end")||dt(l,s.substr(a,c))),{css:s,mismatchOffset:a,mismatchLength:c,start:l,end:p}}function Yt(e,t){let r=e&&e.loc&&e.loc[t];return r?"line"in r?dt(r):r:null}function dt({offset:e,line:t,column:r},n){let i={offset:e,line:t,column:r};if(n){let o=n.split(/\n|\r\n?|\f/);i.offset+=n.length,i.line+=o.length-1,i.column=o.length===1?i.column+n.length:o.pop().length+1}return i}var $e=function(e,t){let r=De("SyntaxReferenceError",e+(t?" `"+t+"`":""));return r.reference=t,r},ua=function(e,t,r,n){let i=De("SyntaxMatchError",e),{css:o,mismatchOffset:a,mismatchLength:c,start:u,end:s}=_l(n,r);return i.rawMessage=e,i.syntax=t?Fe(t):"<generic>",i.css=o,i.mismatchOffset=a,i.mismatchLength=c,i.message=e+` syntax: `+i.syntax+` value: `+(o||"<empty string>")+` --------`+new Array(i.mismatchOffset+1).join("-")+"^",Object.assign(i,u),i.loc={source:r&&r.loc&&r.loc.source||"<unknown>",start:u,end:s},i};var Kt=new Map,Ze=new Map,Vt=45,ft=ql,Qt=jl,Wl=Dr;function gt(e,t){return t=t||0,e.length-t>=2&&e.charCodeAt(t)===Vt&&e.charCodeAt(t+1)===Vt}function Dr(e,t){if(t=t||0,e.length-t>=3&&e.charCodeAt(t)===Vt&&e.charCodeAt(t+1)!==Vt){let r=e.indexOf("-",t+2);if(r!==-1)return e.substring(t,r+1)}return""}function ql(e){if(Kt.has(e))return Kt.get(e);let t=e.toLowerCase(),r=Kt.get(t);if(r===void 0){let n=gt(t,0),i=n?"":Dr(t,0);r=Object.freeze({basename:t.substr(i.length),name:t,prefix:i,vendor:i,custom:n})}return Kt.set(e,r),r}function jl(e){if(Ze.has(e))return Ze.get(e);let t=e,r=e[0];r==="/"?r=e[1]==="/"?"//":"/":r!=="_"&&r!=="*"&&r!=="$"&&r!=="#"&&r!=="+"&&r!=="&"&&(r="");let n=gt(t,r.length);if(!n&&(t=t.toLowerCase(),Ze.has(t))){let c=Ze.get(t);return Ze.set(e,c),c}let i=n?"":Dr(t,r.length),o=t.substr(0,r.length+i.length),a=Object.freeze({basename:t.substr(o.length),name:t.substr(r.length),hack:r,vendor:i,prefix:o,custom:n});return Ze.set(e,a),a}var Je=["initial","inherit","unset","revert","revert-layer"];var yt=43,de=45,Or=110,et=!0,Hl=!1;function Rr(e,t){return e!==null&&e.type===9&&e.value.charCodeAt(0)===t}function bt(e,t,r){for(;e!==null&&(e.type===13||e.type===25);)e=r(++t);return t}function Ee(e,t,r,n){if(!e)return 0;let i=e.value.charCodeAt(t);if(i===yt||i===de){if(r)return 0;t++}for(;t<e.value.length;t++)if(!O(e.value.charCodeAt(t)))return 0;return n+1}function Fr(e,t,r){let n=!1,i=bt(e,t,r);if(e=r(i),e===null)return t;if(e.type!==10)if(Rr(e,yt)||Rr(e,de)){if(n=!0,i=bt(r(++i),i,r),e=r(i),e===null||e.type!==10)return 0}else return t;if(!n){let o=e.value.charCodeAt(0);if(o!==yt&&o!==de)return 0}return Ee(e,n?0:1,n,i)}function Mr(e,t){let r=0;if(!e)return 0;if(e.type===10)return Ee(e,0,Hl,r);if(e.type===1&&e.value.charCodeAt(0)===de){if(!ye(e.value,1,Or))return 0;switch(e.value.length){case 2:return Fr(t(++r),r,t);case 3:return e.value.charCodeAt(2)!==de?0:(r=bt(t(++r),r,t),e=t(r),Ee(e,0,et,r));default:return e.value.charCodeAt(2)!==de?0:Ee(e,3,et,r)}}else if(e.type===1||Rr(e,yt)&&t(r+1).type===1){if(e.type!==1&&(e=t(++r)),e===null||!ye(e.value,0,Or))return 0;switch(e.value.length){case 1:return Fr(t(++r),r,t);case 2:return e.value.charCodeAt(1)!==de?0:(r=bt(t(++r),r,t),e=t(r),Ee(e,0,et,r));default:return e.value.charCodeAt(1)!==de?0:Ee(e,2,et,r)}}else if(e.type===12){let n=e.value.charCodeAt(0),i=n===yt||n===de?1:0,o=i;for(;o<e.value.length&&O(e.value.charCodeAt(o));o++);return o===i||!ye(e.value,o,Or)?0:o+1===e.value.length?Fr(t(++r),r,t):e.value.charCodeAt(o+1)!==de?0:o+2===e.value.length?(r=bt(t(++r),r,t),e=t(r),Ee(e,0,et,r)):Ee(e,o+2,et,r)}return 0}var Gl=43,pa=45,ha=63,Yl=117;function Br(e,t){return e!==null&&e.type===9&&e.value.charCodeAt(0)===t}function Kl(e,t){return e.value.charCodeAt(0)===t}function xt(e,t,r){let n=0;for(let i=t;i<e.value.length;i++){let o=e.value.charCodeAt(i);if(o===pa&&r&&n!==0)return xt(e,t+n+1,!1),6;if(!te(o)||++n>6)return 0}return n}function Xt(e,t,r){if(!e)return 0;for(;Br(r(t),ha);){if(++e>6)return 0;t++}return t}function _r(e,t){let r=0;if(e===null||e.type!==1||!ye(e.value,0,Yl)||(e=t(++r),e===null))return 0;if(Br(e,Gl))return e=t(++r),e===null?0:e.type===1?Xt(xt(e,0,!0),++r,t):Br(e,ha)?Xt(1,++r,t):0;if(e.type===10){let n=xt(e,1,!0);return n===0?0:(e=t(++r),e===null?r:e.type===12||e.type===10?!Kl(e,pa)||!xt(e,1,!1)?0:r+1:Xt(n,r,t))}return e.type===12?Xt(xt(e,1,!0),++r,t):0}var Wr=["calc(","-moz-calc(","-webkit-calc("],qr=["min(","max(","clamp("],jr=["round(","mod(","rem("],Vl=["sin(","cos(","tan("],Ql=["asin(","acos(","atan(","atan2("],Xl=["pow(","sqrt(","log(","exp(","sign("],Ur=["hypot("],Hr=["abs("],ma=[...Wr,...qr,...jr,...Vl,...Xl,...Ur,...Hr],$l=[...Wr,...qr,...jr,...Ur,...Hr],ve=[...Wr,...qr,...jr,...Ql,...Ur,...Hr],Gr=new Map([[2,22],[21,22],[19,20],[23,24]]);function pe(e,t){return t<e.length?e.charCodeAt(t):0}function da(e,t){return xe(e,0,e.length,t)}function fa(e,t){for(let r=0;r<t.length;r++)if(da(e,t[r]))return!0;return!1}function ga(e,t){return t!==e.length-2?!1:pe(e,t)===92&&O(pe(e,t+1))}function $t(e,t,r){if(e&&e.type==="Range"){let n=Number(r!==void 0&&r!==t.length?t.substr(0,r):t);if(isNaN(n)||e.min!==null&&n<e.min&&typeof e.min!="string"||e.max!==null&&n>e.max&&typeof e.max!="string")return!0}return!1}function Zl(e,t){let r=0,n=[],i=0;e:do{switch(e.type){case 24:case 22:case 20:if(e.type!==r)break e;if(r=n.pop(),n.length===0){i++;break e}break;case 2:case 21:case 19:case 23:n.push(r),r=Gr.get(e.type);break}i++}while(e=t(i));return i}function ae(e,t){return function(r,n,i){return r===null?0:r.type===2&&fa(r.value,t)?Zl(r,n):e(r,n,i)}}function I(e){return function(t){return t===null||t.type!==e?0:1}}function Jl(e){if(e===null||e.type!==1)return 0;let t=e.value.toLowerCase();return fa(t,Je)||da(t,"default")?0:1}function ba(e){return e===null||e.type!==1||pe(e.value,0)!==45||pe(e.value,1)!==45?0:1}function ec(e){return!ba(e)||e.value==="--"?0:1}function tc(e){if(e===null||e.type!==4)return 0;let t=e.value.length;if(t!==4&&t!==5&&t!==7&&t!==9)return 0;for(let r=1;r<t;r++)if(!te(pe(e.value,r)))return 0;return 1}function rc(e){return e===null||e.type!==4||!je(pe(e.value,1),pe(e.value,2),pe(e.value,3))?0:1}function nc(e,t){if(!e)return 0;let r=0,n=[],i=0;e:do{switch(e.type){case 6:case 8:break e;case 24:case 22:case 20:if(e.type!==r)break e;r=n.pop();break;case 17:if(r===0)break e;break;case 9:if(r===0&&e.value==="!")break e;break;case 2:case 21:case 19:case 23:n.push(r),r=Gr.get(e.type);break}i++}while(e=t(i));return i}function ic(e,t){if(!e)return 0;let r=0,n=[],i=0;e:do{switch(e.type){case 6:case 8:break e;case 24:case 22:case 20:if(e.type!==r)break e;r=n.pop();break;case 2:case 21:case 19:case 23:n.push(r),r=Gr.get(e.type);break}i++}while(e=t(i));return i}function Se(e){return e&&(e=new Set(e)),function(t,r,n){if(t===null||t.type!==12)return 0;let i=Ne(t.value,0);if(e!==null){let o=t.value.indexOf("\\",i),a=o===-1||!ga(t.value,o)?t.value.substr(i):t.value.substring(i,o);if(e.has(a.toLowerCase())===!1)return 0}return $t(n,t.value,i)?0:1}}function oc(e,t,r){return e===null||e.type!==11||$t(r,e.value,e.value.length-1)?0:1}function ya(e){return typeof e!="function"&&(e=function(){return 0}),function(t,r,n){return t!==null&&t.type===10&&Number(t.value)===0?1:e(t,r,n)}}function ac(e,t,r){if(e===null)return 0;let n=Ne(e.value,0);return!(n===e.value.length)&&!ga(e.value,n)||$t(r,e.value,n)?0:1}function sc(e,t,r){if(e===null||e.type!==10)return 0;let n=pe(e.value,0)===43||pe(e.value,0)===45?1:0;for(;n<e.value.length;n++)if(!O(pe(e.value,n)))return 0;return $t(r,e.value,n)?0:1}var lc={"ident-token":I(1),"function-token":I(2),"at-keyword-token":I(3),"hash-token":I(4),"string-token":I(5),"bad-string-token":I(6),"url-token":I(7),"bad-url-token":I(8),"delim-token":I(9),"number-token":I(10),"percentage-token":I(11),"dimension-token":I(12),"whitespace-token":I(13),"CDO-token":I(14),"CDC-token":I(15),"colon-token":I(16),"semicolon-token":I(17),"comma-token":I(18),"[-token":I(19),"]-token":I(20),"(-token":I(21),")-token":I(22),"{-token":I(23),"}-token":I(24)},cc={string:I(5),ident:I(1),percentage:ae(oc,$l),zero:ya(),number:ae(ac,ma),integer:ae(sc,ma),"custom-ident":Jl,"dashed-ident":ba,"custom-property-name":ec,"hex-color":tc,"id-selector":rc,"an-plus-b":Mr,urange:_r,"declaration-value":nc,"any-value":ic},uc=["length","angle","time","frequency","resolution","flex","decibel","semitones"];function pc(e){let{angle:t,decibel:r,frequency:n,flex:i,length:o,resolution:a,semitones:c,time:u}=e||{};return{dimension:ae(Se(null),ve),angle:ae(Se(t),ve),decibel:ae(Se(r),ve),frequency:ae(Se(n),ve),flex:ae(Se(i),ve),length:ae(ya(Se(o)),ve),resolution:ae(Se(a),ve),semitones:ae(Se(c),ve),time:ae(Se(u),ve)}}function hc(e){let t=new Set;for(let r of uc)if(Array.isArray(e[r]))for(let n of e[r])t.add(n.toLowerCase());return function(n){return n===null?0:n.type===9&&n.value==="%"||n.type===1&&t.has(n.value.toLowerCase())?1:0}}function xa(e){return{...lc,...cc,...pc(e),"attr-unit":hc(e)}}var Zt={};f(Zt,{angle:()=>dc,decibel:()=>xc,flex:()=>yc,frequency:()=>gc,length:()=>mc,resolution:()=>bc,semitones:()=>kc,time:()=>fc});var mc=["cm","mm","q","in","pt","pc","px","em",