@stacksjs/ts-css 0.3.6 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +5 -5
- package/dist/bin/cssx.js +82 -80
- package/dist/chunk-1kmkypmr.js +3 -0
- package/dist/chunk-2wsah70r.js +2 -0
- package/dist/{chunk-mz87cw2e.js → chunk-8h5zg4ad.js} +1 -1
- package/dist/chunk-9ep6bwwb.js +2 -0
- package/dist/{chunk-br9jax0b.js → chunk-b44sfqdn.js} +1 -1
- package/dist/chunk-edwg811g.js +2 -0
- package/dist/chunk-exnx4hfp.js +2 -0
- package/dist/chunk-thy3p95k.js +3 -0
- package/dist/chunk-vbjv9wf0.js +3 -0
- package/dist/chunk-y79srf7m.js +3 -0
- package/dist/engine/index.js +26 -24
- package/dist/index.js +1 -1
- package/dist/optimize/index.js +1 -1
- package/dist/parse/index.js +1 -1
- package/dist/select/index.js +1 -1
- package/dist/what/index.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-0h48763m.js +0 -2
- package/dist/chunk-f9gzb0a5.js +0 -3
- package/dist/chunk-genwkevp.js +0 -3
- package/dist/chunk-mz2p6rjj.js +0 -62
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{F as k}from"./chunk-1kmkypmr.js";var a={};k(a,{stringify:()=>O,parse:()=>W,isTraversal:()=>E,IgnoreCaseMode:()=>N});var w=/(?:\\(?:[\dA-Fa-f]{1,6} ?|[^])|[\w\-\u00B0-\uFFFF])+/y,b=/\\([\dA-Fa-f]{1,6} ?|[^])/g;function S(z){return z.replace(b,(X,Z)=>{if(Z.length>1&&/^[\dA-Fa-f]/.test(Z)){let Q=Number.parseInt(Z,16);if(Q>=55296&&Q<=57343)return"\uFFFD";return String.fromCodePoint(Q)}return Z})}function R(z){return z.indexOf("\\")<0?z:S(z)}var T=new Set(["accept","accept-charset","align","alink","axis","bgcolor","charset","checked","clear","codetype","color","compact","declare","defer","dir","direction","disabled","enctype","face","frame","hreflang","http-equiv","lang","language","link","media","method","multiple","nohref","noresize","noshade","nowrap","readonly","rel","rev","rules","scope","scrolling","selected","shape","target","text","type","valign","valuetype","vlink"]);function x(z){switch(z){case 126:return"element";case 94:return"start";case 36:return"end";case 42:return"any";case 33:return"not";case 124:return"hyphen";default:return null}}function P(z){return z===32||z===9||z===10||z===13||z===12}function W(z,X={}){let Z=[],Q=_(Z,z,X,0);if(Q<z.length)throw Error(`Unmatched selector: ${z.slice(Q)}`);return Z}function Y(z,X){w.lastIndex=X;let Z=w.exec(z);if(!Z)throw Error(`Expected name, found ${z.slice(X)}`);return{value:R(Z[0]),end:X+Z[0].length}}function L(z,X){while(X<z.length&&P(z.charCodeAt(X)))X++;return X}function _(z,X,Z,Q){let H=[],J=L(X,Q),G=X.length,B=Z.xmlMode===!0,D=Z.lowerCaseAttributeNames!==!1&&!B,V=Z.lowerCaseTags!==!1;while(J<G){let U=X.charCodeAt(J);if(P(U)){let $=J+1;while($<G&&P(X.charCodeAt($)))$++;if(H.length===0)return $;J=$,h(H,"descendant");continue}if(U===62||U===60||U===126||U===43||U===124){let $=J+1;while($<G&&P(X.charCodeAt($)))$++;switch(J=$,U){case 62:h(H,"child");break;case 60:h(H,"parent");break;case 126:h(H,"sibling");break;case 43:h(H,"adjacent");break;case 124:if(J<G&&X.charCodeAt(J)===124)J++,J=L(X,J),h(H,"column-combinator");else H.push({type:"tag",name:"",namespace:""});break}continue}if(U===44){if(H.length===0)throw Error("Empty sub-selector");z.push(H),H=[],J=L(X,J+1);continue}if(U===47&&X.charCodeAt(J+1)===42){let $=X.indexOf("*/",J+2);if($<0)throw Error("Unmatched comment");J=L(X,$+2);continue}if(U===42){J++,H.push({type:"universal",namespace:null});continue}if(U===35){let $=Y(X,J+1);J=$.end,H.push({type:"attribute",name:"id",action:"equals",value:$.value,namespace:null,ignoreCase:!1});continue}if(U===46){let $=Y(X,J+1);J=$.end,H.push({type:"attribute",name:"class",action:"element",value:$.value,namespace:null,ignoreCase:!1});continue}if(U===91){J=g(X,J,H,Z,B,D);continue}if(U===58){J=I(X,J,H,Z);continue}if(U===124){J++;let $=Y(X,J);J=$.end,H.push({type:"tag",name:V?$.value.toLowerCase():$.value,namespace:""});continue}{let $=Y(X,J);if(J=$.end,J<G&&X.charCodeAt(J)===124&&X.charCodeAt(J+1)!==61){J++;let j=Y(X,J);J=j.end,H.push({type:"tag",name:V?j.value.toLowerCase():j.value,namespace:$.value})}else H.push({type:"tag",name:V?$.value.toLowerCase():$.value,namespace:null})}}if(H.length>0)z.push(H);return J}function g(z,X,Z,Q,H,J){let G=X+1,B=z.length,D;if(z.charCodeAt(G)===124)throw Error("Empty namespace not supported");if(z.charCodeAt(G)===42&&z.charCodeAt(G+1)===124){G+=2;let K=Y(z,G);G=K.end,D=K.value}else{let K=Y(z,G);if(G=K.end,D=K.value,z.charCodeAt(G)===124&&z.charCodeAt(G+1)!==61){G++;let F=Y(z,G);G=F.end,D=F.value}}G=L(z,G);let V="exists",U="",$=null,j=z.charCodeAt(G);if(j===61)V="equals",G++;else if(j===33&&z.charCodeAt(G+1)===61)V="not",G+=2;else{let K=x(j);if(K!==null&&z.charCodeAt(G+1)===61)V=K,G+=2}if(V!=="exists"){G=L(z,G);let K=z.charCodeAt(G);if(K===34||K===39){let q=A(z,G+1,K);U=R(z.slice(G+1,q)),G=q+1}else{let q=Y(z,G);U=q.value,G=q.end}G=L(z,G);let F=z.charCodeAt(G);if(F===105||F===73)$=!0,G++;else if(F===115||F===83)$=!1,G++}if(z.charCodeAt(G)!==93)throw Error("Expected ]");if(G++,$===null&&!H&&T.has(D.toLowerCase()))$="quirks";return Z.push({type:"attribute",name:J?D.toLowerCase():D,action:V,value:U,namespace:null,ignoreCase:$}),G}function I(z,X,Z,Q){if(z.charCodeAt(X+1)===58){let B=X+2,D=Y(z,B);B=D.end;let V=D.value.toLowerCase(),U=null;if(z.charCodeAt(B)===40){let $=v(z,B);U=z.slice(B+1,$).trim(),B=$+1}return Z.push({type:"pseudo-element",name:V,data:U}),B}let H=X+1,J=Y(z,H);H=J.end;let G=J.value.toLowerCase();if(z.charCodeAt(H)===40){let B=v(z,H),D=z.slice(H+1,B);if(H=B+1,G==="is"||G==="not"||G==="where"||G==="has"||G==="matches"||G==="-moz-any"||G==="-webkit-any"){let V=[];_(V,D.trim(),Q,0),Z.push({type:"pseudo",name:G,data:V})}else Z.push({type:"pseudo",name:G,data:D.trim()})}else Z.push({type:"pseudo",name:G,data:null});return H}function h(z,X){if(z.length>0&&z[z.length-1].type==="descendant"&&X!=="descendant")z.pop();if(z.length>0&&z[z.length-1].type===X)return;z.push({type:X})}function A(z,X,Z){let Q=X,H=z.length;while(Q<H){let J=z.charCodeAt(Q);if(J===92){Q+=2;continue}if(J===Z)return Q;Q++}throw Error("Unterminated string")}function v(z,X){let Z=1,Q=X+1,H=z.length;while(Q<H){let J=z.charCodeAt(Q);if(J===92){Q+=2;continue}if(J===34||J===39){Q=A(z,Q+1,J)+1;continue}if(J===40)Z++;else if(J===41){if(Z--,Z===0)return Q}Q++}throw Error("Unterminated parenthesis")}var f={child:" > ",parent:" < ",sibling:" ~ ",adjacent:" + ",descendant:" ","column-combinator":" || "};function O(z){return z.map(u).join(", ")}function u(z){return z.map((X,Z)=>C(X,z[Z-1])).join("")}function C(z,X){switch(z.type){case"tag":return`${M(z.namespace)}${y(z.name)}`;case"universal":return`${M(z.namespace)}*`;case"attribute":{if(z.name==="id"&&z.action==="equals"&&!z.ignoreCase&&!z.namespace)return`#${y(z.value)}`;if(z.name==="class"&&z.action==="element"&&!z.ignoreCase&&!z.namespace)return`.${y(z.value)}`;let Z=`[${M(z.namespace)}${y(z.name)}`;if(z.action!=="exists"){let Q=p[z.action]??"=";if(Z+=Q,Z+=`"${z.value.replace(/"/g,"\\\"")}"`,z.ignoreCase===!0)Z+=" i";else if(z.ignoreCase===!1)Z+=" s"}return Z+="]",Z}case"pseudo":if(z.data===null)return`:${z.name}`;if(typeof z.data==="string")return`:${z.name}(${z.data})`;return`:${z.name}(${O(z.data)})`;case"pseudo-element":return z.data===null?`::${z.name}`:`::${z.name}(${z.data})`;case"descendant":case"child":case"parent":case"sibling":case"adjacent":case"column-combinator":return f[z.type]??" "}return""}var p={equals:"=",element:"~=",start:"^=",end:"$=",any:"*=",not:"!=",hyphen:"|="};function M(z){if(z===null)return"";if(z==="")return"|";return`${y(z)}|`}var m=/[^\w\u00B0-\uFFFF-]/g;function y(z){if(z==="")return"";return z.replace(m,(X)=>`\\${X}`)}var d=new Set(["adjacent","child","descendant","parent","sibling","column-combinator"]);function E(z){return d.has(z.type)}var N={Unknown:null,QuirksMode:"quirks",IgnoreCase:!0,CaseSensitive:!1};export{W as A,O as B,E as C,N as D,a as E};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{u}from"./chunk-genwkevp.js";var N={};u(N,{List:()=>t,TokenType:()=>b,Tokenizer:()=>d,clone:()=>y,decodeName:()=>x,generate:()=>e,makeList:()=>T,parse:()=>o,walk:()=>n});function _(r){return{prev:null,next:null,data:r}}class t{head=null;tail=null;cursors=[];allocateCursor(r,s){let i={prev:r,next:s};return this.cursors.push(i),i}releaseCursor(){this.cursors.pop()}updateCursors(r,s,i,a){for(let l of this.cursors){if(l.prev===r)l.prev=s;if(l.next===i)l.next=a}}static createItem(r){return _(r)}createItem(r){return _(r)}get isEmpty(){return this.head===null}get first(){return this.head?.data??null}get last(){return this.tail?.data??null}*[Symbol.iterator](){for(let r=this.head;r!=null;r=r.next)yield r.data}fromArray(r){let s=null;this.head=null;for(let i of r){let a=_(i);if(a.prev=s,s)s.next=a;else this.head=a;s=a}return this.tail=s,this}toArray(){let r=[];for(let s=this.head;s!=null;s=s.next)r.push(s.data);return r}toJSON(){return this.toArray()}forEach(r,s){let i=this.allocateCursor(null,this.head);while(i.next!==null){let a=i.next;i.prev=a,i.next=a.next,r.call(s,a.data,a,this)}this.releaseCursor()}forEachRight(r,s){let i=this.allocateCursor(this.tail,null);while(i.prev!==null){let a=i.prev;i.next=a,i.prev=a.prev,r.call(s,a.data,a,this)}this.releaseCursor()}reduce(r,s){let i=s,a=0;for(let l=this.head;l!=null;l=l.next)i=r(i,l.data,a++,this);return i}some(r){let s=0;for(let i=this.head;i!=null;i=i.next)if(r(i.data,s++,this))return!0;return!1}map(r){let s=new t,i=null,a=0;for(let l=this.head;l!=null;l=l.next){let c=_(r(l.data,a++,this));if(c.prev=i,i)i.next=c;else s.head=c;i=c}return s.tail=i,s}filter(r){let s=new t,i=null,a=0;for(let l=this.head;l!=null;l=l.next)if(r(l.data,a++,this)){let c=_(l.data);if(c.prev=i,i)i.next=c;else s.head=c;i=c}return s.tail=i,s}clear(){let r=this.head;while(r){let s=r.next;r.prev=null,r.next=null,r=s}this.head=null,this.tail=null}copy(){let r=new t,s=null;for(let i=this.head;i!=null;i=i.next){let a=_(i.data);if(a.prev=s,s)s.next=a;else r.head=a;s=a}return r.tail=s,r}prepend(r){return this.insert(r,this.head)}prependData(r){return this.insert(_(r),this.head)}append(r){return this.insert(r,null)}appendData(r){return this.insert(_(r),null)}insert(r,s=null){if(s!=null)if(this.updateCursors(s.prev,r,s,r),s.prev===null){if(this.head!==s)throw Error("before doesn't belong to list");this.head=r,s.prev=r,r.next=s,this.updateCursors(null,r,null,null)}else s.prev.next=r,r.prev=s.prev,s.prev=r,r.next=s;else if(this.updateCursors(this.tail,r,null,r),this.tail!==null)this.tail.next=r,r.prev=this.tail,this.tail=r;else this.head=r,this.tail=r;return this}insertData(r,s=null){return this.insert(_(r),s)}remove(r){if(this.updateCursors(r,r.prev,r,r.next),r.prev!==null)r.prev.next=r.next;else if(this.head===r)this.head=r.next;else throw Error("item doesn't belong to list");if(r.next!==null)r.next.prev=r.prev;else if(this.tail===r)this.tail=r.prev;else throw Error("item doesn't belong to list");return r.prev=null,r.next=null,r}push(r){this.insert(_(r),null)}pop(){if(this.tail===null)return null;return this.remove(this.tail)}unshift(r){this.prependData(r)}shift(){if(this.head===null)return null;return this.remove(this.head)}prependList(r){return this.insertList(r,this.head)}appendList(r){return this.insertList(r,null)}insertList(r,s=null){if(r.head===null)return this;if(s!==null){if(this.updateCursors(s.prev,r.tail,s,r.head),s.prev!==null)s.prev.next=r.head,r.head.prev=s.prev;else this.head=r.head;s.prev=r.tail,r.tail.next=s}else{if(this.updateCursors(this.tail,r.tail,null,r.head),this.tail!==null)this.tail.next=r.head,r.head.prev=this.tail;else this.head=r.head;this.tail=r.tail}return r.head=null,r.tail=null,this}replace(r,s){if(s instanceof t)this.insertList(s,r),this.remove(r);else this.insert(s,r),this.remove(r)}}function T(){return new t}function y(r){return G(r)}function G(r){if(r===null||typeof r!=="object")return r;if(r instanceof t){let i=new t;for(let a of r)i.appendData(G(a));return i}if(Array.isArray(r))return r.map(G);if("type"in r&&typeof r.type==="string"){let i={type:r.type};for(let a of Object.keys(r)){if(a==="type")continue;i[a]=G(r[a])}return i}let s={};for(let i of Object.keys(r))s[i]=G(r[i]);return s}function e(r){switch(r.type){case"StyleSheet":return O(r.children,"");case"Rule":return`${e(r.prelude)}{${e(r.block)}}`;case"Block":return ve(r.children);case"Atrule":{let s=`@${r.name}`;if(r.prelude){let i=e(r.prelude);if(i)s+=` ${i}`}if(r.block)s+=`{${e(r.block)}}`;else s+=";";return s}case"AtrulePrelude":return O(r.children,"");case"SelectorList":return O(r.children,",");case"Selector":return O(r.children,"");case"TypeSelector":return r.name;case"IdSelector":return`#${r.name}`;case"ClassSelector":return`.${r.name}`;case"NestingSelector":return"&";case"AttributeSelector":{let s=`[${r.name.name}`;if(r.matcher&&r.value)if(s+=r.matcher,r.value.type==="String")s+=`"${ne(r.value.value)}"`;else s+=r.value.name;if(r.flags)s+=` ${r.flags}`;return s+="]",s}case"PseudoClassSelector":return r.children?`:${r.name}(${O(r.children,"")})`:`:${r.name}`;case"PseudoElementSelector":return r.children?`::${r.name}(${O(r.children,"")})`:`::${r.name}`;case"Combinator":return r.name===" "?" ":r.name;case"Declaration":return`${r.property}:${e(r.value)}${r.important?"!important":""}`;case"DeclarationList":return O(r.children,";");case"Value":return O(r.children,"");case"Identifier":return r.name;case"Number":return r.value;case"Percentage":return`${r.value}%`;case"Dimension":return r.value+r.unit;case"String":return`"${ne(r.value)}"`;case"Url":return/[\s"'()\\\u0000-\u001F\u007F]/.test(r.value)?`url("${ne(r.value)}")`:`url(${r.value})`;case"Hash":return`#${r.name}`;case"Operator":return r.value;case"Function":return`${r.name}(${O(r.children,"")})`;case"Parentheses":return`(${O(r.children,"")})`;case"Brackets":return`[${O(r.children,"")}]`;case"Raw":return r.value;case"Comment":return r.value.startsWith("!")?`/*${r.value}*/`:"";case"WhiteSpace":return" ";case"CDO":return"<!--";case"CDC":return"-->";case"AnPlusB":{let s=r.a??"",i=r.b??"";if(s&&i){let a=Number(i);return`${s==="1"?"":s==="-1"?"-":s}n${a>=0?`+${i}`:i}`}if(s)return`${s==="1"?"":s==="-1"?"-":s}n`;return i}case"Ratio":return`${r.left.value}/${r.right.value}`;case"UnicodeRange":return r.value;case"Nth":return r.selector?`${e(r.nth)} of ${e(r.selector)}`:e(r.nth);case"MediaQueryList":return O(r.children,",");case"MediaQuery":return O(r.children,"");case"MediaFeature":{let s=`(${r.name}`;if(r.value)s+=`:${e(r.value)}`;return s+=")",s}}return""}function O(r,s){let i="",a=!0,l=null,c=r.head;while(c!=null){let p=c.data;if(p.type==="WhiteSpace"){let h=c.next?c.next.data:null;if(fe(l)||fe(h)){c=c.next;continue}}let f=e(p);if(!f){c=c.next;continue}if(!a&&s&&!De(l))i+=s;a=!1,i+=f,l=p,c=c.next}return i}function ve(r){let s="",i=null,a=r.head;while(a!=null){let l=a.data,c=e(l);if(!c){a=a.next;continue}if(i&&Ee(i,l))s+=";";s+=c,i=l,a=a.next}return s}function Ee(r,s){return r.type==="Declaration"&&s.type!=="Comment"}function fe(r){if(!r||r.type!=="Operator")return!1;let s=r.value;return s===":"||s===","||s==="/"}function De(r){if(!r)return!1;return r.type==="Operator"||r.type==="Combinator"}function ne(r){let s="";for(let i=0;i<r.length;i++){let a=r.charCodeAt(i);if(a===92)s+="\\\\";else if(a===34)s+="\\\"";else if(a<32||a===127){let l=a.toString(16),c=i+1<r.length?r.charCodeAt(i+1):-1,p=c===32||c===9||c===10||c===12||c===13||c>=48&&c<=57||c>=65&&c<=70||c>=97&&c<=102;s+=`\\${l}${p?" ":""}`}else s+=r[i]}return s}var b;((C)=>{C[C.EOF=0]="EOF";C[C.Ident=1]="Ident";C[C.Function=2]="Function";C[C.AtKeyword=3]="AtKeyword";C[C.Hash=4]="Hash";C[C.String=5]="String";C[C.BadString=6]="BadString";C[C.Url=7]="Url";C[C.BadUrl=8]="BadUrl";C[C.Delim=9]="Delim";C[C.Number=10]="Number";C[C.Percentage=11]="Percentage";C[C.Dimension=12]="Dimension";C[C.WhiteSpace=13]="WhiteSpace";C[C.CDO=14]="CDO";C[C.CDC=15]="CDC";C[C.Colon=16]="Colon";C[C.Semicolon=17]="Semicolon";C[C.Comma=18]="Comma";C[C.LeftSquareBracket=19]="LeftSquareBracket";C[C.RightSquareBracket=20]="RightSquareBracket";C[C.LeftParenthesis=21]="LeftParenthesis";C[C.RightParenthesis=22]="RightParenthesis";C[C.LeftCurlyBracket=23]="LeftCurlyBracket";C[C.RightCurlyBracket=24]="RightCurlyBracket";C[C.Comment=25]="Comment"})(b||={});var H=(()=>{let r=new Uint8Array(128);for(let s=0;s<128;s++){let i=0;if(s===32||s===9||s===10||s===12||s===13)i|=1;if(s>=48&&s<=57)i|=2;if(s>=48&&s<=57||s>=65&&s<=70||s>=97&&s<=102)i|=4;if(s>=65&&s<=90||s>=97&&s<=122||s===95)i|=8;if(s===10||s===12||s===13)i|=16;r[s]=i}return r})();function V(r){return r<128&&(H[r]&2)!==0}function X(r){return r<128&&(H[r]&4)!==0}function me(r){return r>=128||r<128&&(H[r]&8)!==0}function Re(r){return r===45||r>=128||r<128&&(H[r]&10)!==0}function Ie(r){return r>=0&&r<=8||r===11||r>=14&&r<=31||r===127}function oe(r){return r<128&&(H[r]&16)!==0}function M(r){return r<128&&(H[r]&1)!==0}function j(r,s){if(r!==92)return!1;if(oe(s))return!1;return!0}function re(r,s,i){if(r===45)return me(s)||s===45||j(s,i);if(me(r))return!0;if(r===92)return j(r,s);return!1}function Fe(r,s,i){if(r===43||r===45){if(V(s))return!0;if(s===46&&V(i))return!0;return!1}if(r===46)return V(s);return V(r)}class d{source;offset=0;types;starts;ends;count=0;_tokens=null;_lineStarts=null;constructor(r){this.source=r;let s=Math.max(64,Math.ceil(r.length/3));this.types=new Uint8Array(s),this.starts=new Uint32Array(s),this.ends=new Uint32Array(s),this.tokenize()}get lineStarts(){if(this._lineStarts==null)this._lineStarts=Be(this.source);return this._lineStarts}get tokens(){if(this._tokens!=null)return this._tokens;let r=Array.from({length:this.count});for(let s=0;s<this.count;s++)r[s]={type:this.types[s],start:this.starts[s],end:this.ends[s]};return this._tokens=r,r}addToken(r,s,i){if(this.count>=this.types.length)this.grow();this.types[this.count]=r,this.starts[this.count]=s,this.ends[this.count]=i,this.count++}grow(){let s=this.types.length*2,i=new Uint8Array(s);i.set(this.types),this.types=i;let a=new Uint32Array(s);a.set(this.starts),this.starts=a;let l=new Uint32Array(s);l.set(this.ends),this.ends=l}tokenize(){let r=this.source,s=0,i=r.length;while(s<i){let a=r.charCodeAt(s);if(a===47&&r.charCodeAt(s+1)===42){let p=s;s+=2;while(s<i&&!(r.charCodeAt(s)===42&&r.charCodeAt(s+1)===47))s++;s=s<i?s+2:i,this.addToken(25,p,s);continue}if(M(a)){let p=s;while(s<i&&M(r.charCodeAt(s)))s++;this.addToken(13,p,s);continue}if(a===34||a===39){s=this.consumeString(a,s);continue}if(a===35){if(s+1<i&&(Re(r.charCodeAt(s+1))||j(r.charCodeAt(s+1),r.charCodeAt(s+2)))){let p=s;s++,s=this.consumeName(s),this.addToken(4,p,s);continue}this.addToken(9,s,s+1),s++;continue}switch(a){case 40:this.addToken(21,s,s+1),s++;continue;case 41:this.addToken(22,s,s+1),s++;continue;case 91:this.addToken(19,s,s+1),s++;continue;case 93:this.addToken(20,s,s+1),s++;continue;case 123:this.addToken(23,s,s+1),s++;continue;case 125:this.addToken(24,s,s+1),s++;continue;case 44:this.addToken(18,s,s+1),s++;continue;case 58:this.addToken(16,s,s+1),s++;continue;case 59:this.addToken(17,s,s+1),s++;continue}if(a===60&&r.startsWith("!--",s+1)){this.addToken(14,s,s+4),s+=4;continue}if(a===45&&r.startsWith("->",s+1)){this.addToken(15,s,s+3),s+=3;continue}if(a===64){let p=r.charCodeAt(s+1),f=r.charCodeAt(s+2),h=r.charCodeAt(s+3);if(re(p,f,h)){let S=s;s++,s=this.consumeName(s),this.addToken(3,S,s);continue}this.addToken(9,s,s+1),s++;continue}let l=r.charCodeAt(s+1),c=r.charCodeAt(s+2);if(Fe(a,l,c)){s=this.consumeNumeric(s);continue}if(re(a,l,c)){s=this.consumeIdentLike(s);continue}if(a===92){if(j(a,l)){s=this.consumeIdentLike(s);continue}this.addToken(9,s,s+1),s++;continue}this.addToken(9,s,s+1),s++}this.addToken(0,i,i)}consumeString(r,s){let i=this.source,a=i.length,l=s+1;while(l<a){let c=i.charCodeAt(l);if(c===r)return l++,this.addToken(5,s,l),l;if(oe(c))return this.addToken(6,s,l),l;if(c===92){let p=i.charCodeAt(l+1);if(oe(p)){l+=2;continue}if(l+1<a){l=this.consumeEscapeSkip(l+1);continue}}l++}return this.addToken(5,s,l),l}consumeEscapeSkip(r){let s=this.source;if(r>=s.length)return r;let i=s.charCodeAt(r);if(X(i)){let a=1;r++;while(a<6&&r<s.length&&X(s.charCodeAt(r)))r++,a++;if(r<s.length&&M(s.charCodeAt(r)))r++;return r}return r+1}consumeName(r){let s=this.source,i=s.length,a=r;while(a<i){let l=s.charCodeAt(a);if(l<128&&(H[l]&10)!==0){a++;continue}if(l===45){a++;continue}if(l>=128){a++;continue}if(l===92&&j(l,s.charCodeAt(a+1))){a=this.consumeEscapeSkip(a+1);continue}break}return a}consumeNumber(r){let s=this.source,i=r;if(s.charCodeAt(i)===43||s.charCodeAt(i)===45)i++;while(i<s.length&&V(s.charCodeAt(i)))i++;if(s.charCodeAt(i)===46&&V(s.charCodeAt(i+1))){i+=2;while(i<s.length&&V(s.charCodeAt(i)))i++}let a=s.charCodeAt(i);if(a===69||a===101){let l=s.charCodeAt(i+1),c=s.charCodeAt(i+2);if(V(l)){i+=2;while(i<s.length&&V(s.charCodeAt(i)))i++}else if((l===43||l===45)&&V(c)){i+=3;while(i<s.length&&V(s.charCodeAt(i)))i++}}return i}consumeNumeric(r){let s=this.source,i=this.consumeNumber(r),a=s.charCodeAt(i),l=s.charCodeAt(i+1),c=s.charCodeAt(i+2);if(re(a,l,c)){let p=this.consumeName(i);return this.addToken(12,r,p),p}if(a===37)return this.addToken(11,r,i+1),i+1;return this.addToken(10,r,i),i}consumeIdentLike(r){let s=this.source,i=this.consumeName(r),a=s.charCodeAt(i);if(a===40&&i-r===3){let l=s.charCodeAt(r)|32,c=s.charCodeAt(r+1)|32,p=s.charCodeAt(r+2)|32;if(l===117&&c===114&&p===108){let f=i+1;while(f<s.length&&M(s.charCodeAt(f)))f++;let h=s.charCodeAt(f);if(h===34||h===39)return this.addToken(2,r,i+1),i+1;return this.consumeUrl(r,i)}}if(a===40)return this.addToken(2,r,i+1),i+1;return this.addToken(1,r,i),i}consumeUrl(r,s){let i=this.source,a=i.length,l=s+1;while(l<a&&M(i.charCodeAt(l)))l++;while(l<a){let c=i.charCodeAt(l);if(c===41)return l++,this.addToken(7,r,l),l;if(M(c)){let p=l;while(l<a&&M(i.charCodeAt(l)))l++;if(l>=a)return this.addToken(7,r,l),l;if(i.charCodeAt(l)===41)return l++,this.addToken(7,r,l),l;return this.consumeBadUrl(r,p)}if(c===34||c===39||c===40||Ie(c))return this.consumeBadUrl(r,l);if(c===92){if(j(c,i.charCodeAt(l+1))){l=this.consumeEscapeSkip(l+1);continue}return this.consumeBadUrl(r,l)}l++}return this.addToken(7,r,l),l}consumeBadUrl(r,s){let i=this.source,a=s;while(a<i.length){let l=i.charCodeAt(a);if(l===41){a++;break}if(l===92&&j(l,i.charCodeAt(a+1))){a=this.consumeEscapeSkip(a+1);continue}a++}return this.addToken(8,r,a),a}locate(r){let s=this.lineStarts,i=0,a=s.length-1;while(i<a){let c=i+a+1>>1;if(s[c]<=r)i=c;else a=c-1}let l=s[i];return{line:i+1,column:r-l+1}}}function Be(r){let s=[0],i=r.length;for(let a=0;a<i;a++){let l=r.charCodeAt(a);if(l===10)s.push(a+1);else if(l===13){if(r.charCodeAt(a+1)!==10)s.push(a+1)}}return s}function se(r,s,i){for(let a=s;a<i;a++)if(r.charCodeAt(a)===92)return Oe(r,s,i,a);return r.slice(s,i)}function Oe(r,s,i,a){let l=r.slice(s,a),c=a;while(c<i){if(r.charCodeAt(c)!==92){l+=r[c],c++;continue}if(c+1>=i){c++;continue}let f=r.charCodeAt(c+1);if(f===10){c+=2;continue}if(f===13){c+=r.charCodeAt(c+2)===10?3:2;continue}if(X(f)){let h=c+1,S="";while(S.length<6&&h<i&&X(r.charCodeAt(h)))S+=r[h],h++;let P=Number.parseInt(S,16);if(h<i&&M(r.charCodeAt(h)))h++;l+=P===0||P>=55296&&P<=57343||P>1114111?String.fromCodePoint(65533):String.fromCodePoint(P),c=h;continue}l+=r[c+1],c+=2}return l}function x(r,s,i){for(let a=s;a<i;a++)if(r.charCodeAt(a)===92)return We(r,s,i,a);return r.slice(s,i)}function We(r,s,i,a){let l=r.slice(s,a),c=a;while(c<i){if(r.charCodeAt(c)!==92){l+=r[c],c++;continue}let f=c+1,h="";while(h.length<6&&f<i&&X(r.charCodeAt(f)))h+=r[f],f++;if(h.length>0){let S=Number.parseInt(h,16);if(f<i&&M(r.charCodeAt(f)))f++;l+=S===0||S>=55296&&S<=57343||S>1114111?String.fromCodePoint(65533):String.fromCodePoint(S),c=f;continue}if(f<i){l+=r[f],c=f+1;continue}l+=String.fromCodePoint(65533),c=f}return l}function ge(r,s){let i=new d(r);return{source:r,types:i.types,starts:i.starts,ends:i.ends,count:i.count,end:i.count,pos:0,positions:s.positions??!1,filename:s.filename,parseValue:s.parseValue??!0,parseAtrulePrelude:s.parseAtrulePrelude??!0,parseCustomProperty:s.parseCustomProperty??!1,parseRulePrelude:s.parseRulePrelude??!0,onParseError:s.onParseError,tokenizer:i}}function k(r){return r.pos<r.end?r.types[r.pos]:0}function g(r){let s=r.pos;if(s>=r.end)return{type:0,start:r.starts[s]??r.source.length,end:r.ends[s]??r.source.length};return{type:r.types[s],start:r.starts[s],end:r.ends[s]}}function A(r){let s=r.pos++;if(s>=r.end)return{type:0,start:r.starts[s]??r.source.length,end:r.ends[s]??r.source.length};return{type:r.types[s],start:r.starts[s],end:r.ends[s]}}function q(r,s){return r.source.slice(s.start,s.end)}function z(r){let{types:s,end:i}=r;while(r.pos<i){let a=s[r.pos];if(a===13||a===25)r.pos++;else break}}function ye(r){let{types:s,end:i}=r;while(r.pos<i&&s[r.pos]===13)r.pos++}function L(r,s,i){if(!r.positions)return null;let a=r.tokenizer.locate(s.start),l=r.tokenizer.locate(i.end);return{source:r.filename??"<unknown>",start:{offset:s.start,line:a.line,column:a.column},end:{offset:i.end,line:l.line,column:l.column}}}function Ae(r){if(!r.positions)return null;let s=g(r),i=r.tokenizer.locate(s.start);return{source:r.filename??"<unknown>",start:{offset:s.start,line:i.line,column:i.column},end:{offset:s.start,line:i.line,column:i.column}}}function Y(r,s,i,a){return{type:"Raw",value:r,loc:L(a,s,i)}}function I(){return new t}function ie(r,s,i,a){if(r.onParseError){let{line:l,column:c}=r.tokenizer.locate(i.start),p=SyntaxError(`${r.filename??"<input>"}:${l}:${c}: ${s}`);p.line=l,p.column=c,p.offset=i.start,r.onParseError(p,a)}return a}function o(r,s={}){let i=ge(r,s);switch(s.context??"stylesheet"){case"stylesheet":return ke(i);case"atrule":return ee(i)??Ce(i);case"atrulePrelude":return Ve(i);case"mediaQuery":case"mediaQueryList":return Se(i);case"rule":return le(i);case"selectorList":return de(i);case"selector":return Le(i);case"block":return ce(i);case"declarationList":return qe(i);case"declaration":return ue(i)??Ce(i);case"value":return Me(i);case"raw":return Se(i);default:return ke(i)}}function Ce(r){return{type:"StyleSheet",children:I(),loc:Ae(r)}}function Se(r){let s=g(r),i=s;while(k(r)!==0)i=A(r);return{type:"Raw",value:r.source.slice(s.start,i.end),loc:L(r,s,i)}}function ke(r){let s=g(r),i=I(),{types:a,end:l}=r;while(r.pos<l){let f=a[r.pos];if(f===13){r.pos++;continue}if(f===25){let P={type:25,start:r.starts[r.pos],end:r.ends[r.pos]},m=ae(r,P);r.pos++,i.appendData(m);continue}if(f===0)break;if(f===14||f===15){r.pos++;continue}if(f===3){let P=ee(r);if(P)i.appendData(P);continue}if(f===24){r.pos++;continue}let h=r.pos,S=le(r);if(i.appendData(S),r.pos===h)r.pos++}let c=r.end-1,p=c>=0?{type:r.types[c],start:r.starts[c],end:r.ends[c]}:{type:0,start:0,end:0};return{type:"StyleSheet",children:i,loc:L(r,s,p)}}function ae(r,s){return{type:"Comment",value:r.source.slice(s.start+2,s.end-2),loc:L(r,s,s)}}function ee(r){let s=g(r);if(s.type!==3)return null;r.pos++;let i=Z(r.source,s.start+1,s.end);z(r);let a=r.pos,l=g(r),{types:c,end:p}=r,f=a,h=a;while(f<p){let m=c[f];if(m===0||m===17||m===23)break;if(m!==13&&m!==25)h=f+1;f++}let S=null;if(h>a){let m=r.starts[a],w=r.ends[h-1],v={type:c[h-1],start:r.starts[h-1],end:w},U=r.source.slice(m,w).trim();if(U.length>0)if(r.parseAtrulePrelude)try{let J=r.end;r.end=h,r.pos=a;let W=I();while(k(r)!==0){let Q=K(r);if(Q)W.appendData(Q)}if(Pe(W),r.end=J,r.pos=f,W.isEmpty)S=Y(U,l,v,r);else S={type:"AtrulePrelude",children:W,loc:null}}catch(J){let W=Y(U,l,v,r);ie(r,`Failed to parse @${i} prelude: ${J.message}`,l,W),S=W,r.pos=f}else S=Y(U,l,v,r),r.pos=f;else r.pos=f}else r.pos=f;let P=null;if(k(r)===17)A(r);else if(k(r)===23)P=ce(r,Ue.has(i));return{type:"Atrule",name:i,prelude:S,block:P,loc:L(r,s,g(r))}}var $e=new Set(["is","not","where","has","matches","-moz-any","-webkit-any"]),Ue=new Set(["media","supports","document","layer","container","scope","starting-style","-moz-document","keyframes","-webkit-keyframes","-moz-keyframes","-o-keyframes"]);function Ve(r){let s=g(r),i=I();while(k(r)!==0){if(g(r).type===13){r.pos++;continue}let l=K(r);if(l)i.appendData(l)}return{type:"AtrulePrelude",children:i,loc:L(r,s,g(r))}}function le(r){let s=g(r),i;if(r.parseRulePrelude)i=de(r);else{let l=g(r),c=l;while(k(r)!==0&&k(r)!==23)c=A(r);let p=r.source.slice(l.start,c.end).trim();i=Y(p,l,c,r)}let a=ce(r,!0);return{type:"Rule",prelude:i,block:a,loc:L(r,s,g(r))}}function ce(r,s=!1){let i=g(r);if(k(r)!==23)return{type:"Block",children:I(),loc:Ae(r)};r.pos++;let a=I(),{types:l,end:c}=r;while(r.pos<c){let p=l[r.pos];if(p===24||p===0)break;if(p===13){r.pos++;continue}if(p===25){let h={type:25,start:r.starts[r.pos],end:r.ends[r.pos]};r.pos++,a.appendData(ae(r,h));continue}if(p===3){let h=ee(r);if(h)a.appendData(h);continue}if(s&&ze(r,_e)){let h=le(r);a.appendData(h);continue}let f=ue(r);if(f)a.appendData(f);if(r.pos<c&&l[r.pos]===17)r.pos++}if(k(r)===24)r.pos++;return{type:"Block",children:a,loc:L(r,i,g(r))}}function ze(r,s){let i=r.pos,a=s(r);return r.pos=i,a}function _e(r){let{types:s,end:i}=r;while(r.pos<i){let a=s[r.pos];if(a===23)return!0;if(a===17||a===24||a===0)return!1;r.pos++}return!1}function qe(r){let s=g(r),i=I();while(k(r)!==0&&k(r)!==24){let a=g(r);if(a.type===13){r.pos++;continue}if(a.type===25){i.appendData(ae(r,A(r)));continue}if(a.type===17){r.pos++;continue}if(a.type===3){let c=ee(r);if(c)i.appendData(c);continue}let l=ue(r);if(l)i.appendData(l);if(k(r)===17)A(r)}return{type:"DeclarationList",children:i,loc:L(r,s,g(r))}}function ue(r){z(r);let s=g(r);if(s.type!==1&&s.type!==4&&!(s.type===9&&r.source[s.start]==="*"&&r.source[s.start+1]===" "))if(s.type===9&&r.source[s.start]==="*")r.pos++;else{ie(r,"Expected property name",s,{type:"Raw",value:"",loc:null});let{types:F,end:B}=r;while(r.pos<B){let D=F[r.pos];if(D===0||D===17||D===24)break;r.pos++}return null}let i=r.starts[r.pos],a=r.ends[r.pos];r.pos++;let l=r.source.slice(i,a);if(ye(r),k(r)!==16){ie(r,`Expected ':' after property "${l}"`,g(r),{type:"Raw",value:"",loc:null});let{types:F,end:B}=r;while(r.pos<B){let D=F[r.pos];if(D===0||D===17||D===24)break;r.pos++}return null}r.pos++,ye(r);let{types:c,starts:p,end:f,pos:h}=r,S=h,P=h,m=-1,w=-1;while(S<f){let F=c[S];if(F===0||F===17||F===24)break;if(F===9&&r.source.charCodeAt(p[S])===33){let B=S+1;while(B<f&&c[B]===13)B++;if(B<f&&c[B]===1){let D=p[B];if(r.ends[B]-D===9&&(r.source.charCodeAt(D)|32)===105&&(r.source.charCodeAt(D+1)|32)===109&&(r.source.charCodeAt(D+2)|32)===112&&(r.source.charCodeAt(D+3)|32)===111&&(r.source.charCodeAt(D+4)|32)===114&&(r.source.charCodeAt(D+5)|32)===116&&(r.source.charCodeAt(D+6)|32)===97&&(r.source.charCodeAt(D+7)|32)===110&&(r.source.charCodeAt(D+8)|32)===116){w=S,m=B,S=B+1;continue}}}if(F!==13&&F!==25)P=S+1;S++}let v=P,U=m>=0?{type:1,start:p[m],end:r.ends[m]}:null,J=l.startsWith("--"),W,Q=p[h],pe=v>h?r.ends[v-1]:Q,te={type:c[h],start:Q,end:r.ends[h]},he=v>h?{type:c[v-1],start:p[v-1],end:pe}:te;if(J&&!r.parseCustomProperty||!r.parseValue)W={type:"Raw",value:r.source.slice(Q,pe).trim(),loc:L(r,te,he)};else if(v===h)W={type:"Value",children:I(),loc:L(r,te,he)};else{let F=r.end;r.end=v,r.pos=h,W=Ne(r),r.end=F}return r.pos=S,{type:"Declaration",property:l,important:U?!0:!1,value:W,loc:L(r,s,g(r))}}function Me(r){return Ne(r)}function Ne(r){let s=g(r),i=I();while(k(r)!==0&&k(r)!==17&&k(r)!==24&&k(r)!==22&&k(r)!==20){let a=K(r);if(a)i.appendData(a)}return xe(i),{type:"Value",children:i,loc:L(r,s,g(r))}}function Pe(r){for(let s of r)if("children"in s&&s.children instanceof t)Pe(s.children);xe(r)}function xe(r){let s=r.head;while(s){if(s.data.type==="Number"){let i=s.next;while(i&&i.data.type==="WhiteSpace")i=i.next;if(i&&i.data.type==="Operator"&&i.data.value==="/"){let a=i.next;while(a&&a.data.type==="WhiteSpace")a=a.next;if(a&&a.data.type==="Number"){let l={type:"Ratio",left:s.data,right:a.data,loc:null},c=s.next;while(c&&c!==a.next){let p=c.next;r.remove(c),c=p}r.replace(s,r.createItem(l)),s=r.head;continue}}}s=s.next}}function K(r){let s=r.pos;if(s>=r.end)return null;let i=r.types[s],a=r.starts[s],l=r.ends[s],c=r.source;switch(i){case 13:return r.pos++,r.positions?{type:"WhiteSpace",value:" ",loc:R(r,a,l)}:{type:"WhiteSpace",value:" ",loc:null};case 25:return r.pos++,{type:"Comment",value:c.slice(a+2,l-2),loc:r.positions?R(r,a,l):null};case 10:return r.pos++,{type:"Number",value:c.slice(a,l),loc:r.positions?R(r,a,l):null};case 11:return r.pos++,{type:"Percentage",value:c.slice(a,l-1),loc:r.positions?R(r,a,l):null};case 12:{r.pos++;let p=a,f=c.charCodeAt(p);if(f===43||f===45)p++;let h=!1;while(p<l){let P=c.charCodeAt(p);if(P>=48&&P<=57){p++;continue}if(P===46&&!h){h=!0,p++;continue}break}let S=c.charCodeAt(p);if(S===69||S===101){let P=p+1,m=c.charCodeAt(P);if(m===43||m===45)P++;let w=!1;while(P<l){let v=c.charCodeAt(P);if(v>=48&&v<=57){P++,w=!0;continue}break}if(w)p=P}return{type:"Dimension",value:c.slice(a,p),unit:c.slice(p,l),loc:r.positions?R(r,a,l):null}}case 1:return r.pos++,{type:"Identifier",name:x(c,a,l),loc:r.positions?R(r,a,l):null};case 5:{r.pos++;let p=a+1,h=l-a>=2&&c.charCodeAt(l-1)===c.charCodeAt(a)?l-1:l;return{type:"String",value:se(c,p,h),loc:r.positions?R(r,a,l):null}}case 7:{r.pos++;let p=a+4;while(p<l&&be(c.charCodeAt(p)))p++;let f=l;if(f>p&&c.charCodeAt(f-1)===41)f--;while(f>p&&be(c.charCodeAt(f-1)))f--;let h;if(f-p>=2){let S=c.charCodeAt(p),P=c.charCodeAt(f-1);if((S===34||S===39)&&S===P)h=c.slice(p+1,f-1);else h=c.slice(p,f)}else h=c.slice(p,f);return{type:"Url",value:h,loc:r.positions?R(r,a,l):null}}case 4:return r.pos++,{type:"Hash",name:c.slice(a+1,l),loc:r.positions?R(r,a,l):null};case 2:return He(r);case 21:return Ke(r);case 18:return r.pos++,{type:"Operator",value:",",loc:r.positions?R(r,a,l):null};case 16:return r.pos++,{type:"Operator",value:":",loc:r.positions?R(r,a,l):null};case 9:{r.pos++;let p=c.charCodeAt(a),f=c[a];if(je(p))return{type:"Operator",value:f,loc:r.positions?R(r,a,l):null};return{type:"Identifier",name:f,loc:r.positions?R(r,a,l):null}}case 19:{r.pos++;let p=I();while(k(r)!==0&&k(r)!==20){let h=K(r);if(h)p.appendData(h)}let f=r.pos<r.end?r.ends[r.pos]:l;if(k(r)===20)r.pos++;return{type:"Brackets",children:p,loc:r.positions?R(r,a,f):null}}case 3:case 23:case 24:case 22:case 20:case 17:case 0:case 14:case 15:case 6:case 8:return r.pos++,{type:"Raw",value:c.slice(a,l),loc:r.positions?R(r,a,l):null}}return r.pos++,null}function be(r){return r===32||r===9||r===10||r===12||r===13}function je(r){return r===47||r===43||r===45||r===42||r===61||r===62||r===60||r===126||r===124||r===36||r===94||r===33||r===38}function Z(r,s,i){for(let a=s;a<i;a++){let l=r.charCodeAt(a);if(l>=65&&l<=90)return r.slice(s,i).toLowerCase()}return r.slice(s,i)}function R(r,s,i){let a=r.tokenizer.locate(s),l=r.tokenizer.locate(i);return{source:r.filename??"<unknown>",start:{offset:s,line:a.line,column:a.column},end:{offset:i,line:l.line,column:l.column}}}function He(r){let s=A(r),i=Z(r.source,s.start,s.end-1),a=I();while(k(r)!==0&&k(r)!==22){let l=K(r);if(l)a.appendData(l)}if(k(r)===22)A(r);if(i==="url"){for(let l=a.head;l!=null;l=l.next)if(l.data.type==="String")return{type:"Url",value:l.data.value,loc:L(r,s,g(r))}}return{type:"Function",name:i,children:a,loc:L(r,s,g(r))}}function Ke(r){let s=A(r),i=I();while(k(r)!==0&&k(r)!==22){let a=K(r);if(a)i.appendData(a)}if(k(r)===22)A(r);return{type:"Parentheses",children:i,loc:L(r,s,g(r))}}function de(r){let s=g(r),i=I();while(k(r)!==0){if(z(r),k(r)===0||k(r)===23)break;let a=Le(r);if(a.children.head!==null)i.appendData(a);if(z(r),k(r)===18){A(r);continue}break}return{type:"SelectorList",children:i,loc:L(r,s,g(r))}}function Le(r){let s=g(r),i=I(),a=!0;while(k(r)!==0&&k(r)!==18&&k(r)!==23){let l=g(r);if(l.type===13){if(A(r),!a&&k(r)!==0&&k(r)!==18&&k(r)!==23&&!Te(r)&&!Qe(r)){let p={type:"Combinator",name:" ",loc:L(r,l,l)};i.appendData(p),a=!0}continue}if(l.type===9&&r.source.charCodeAt(l.start)===124&&r.types[r.pos+1]===9&&r.source.charCodeAt(r.starts[r.pos+1])===124){let p=g(r);A(r);let f=A(r),h={type:"Combinator",name:"||",loc:L(r,p,f)};i.appendData(h),a=!0,z(r);continue}if(Te(r)){let p=A(r),h={type:"Combinator",name:r.source[p.start],loc:L(r,p,p)};i.appendData(h),a=!0,z(r);continue}let c=Je(r);if(!c)break;i.appendData(c),a=!1}while(i.tail&&i.tail.data.type==="Combinator")i.remove(i.tail);return{type:"Selector",children:i,loc:L(r,s,g(r))}}function Te(r){let s=g(r);if(s.type!==9)return!1;let i=r.source[s.start];return i===">"||i==="+"||i==="~"}function Qe(r){if(r.types[r.pos]!==9)return!1;if(r.source.charCodeAt(r.starts[r.pos])!==124)return!1;if(r.types[r.pos+1]!==9)return!1;return r.source.charCodeAt(r.starts[r.pos+1])===124}function Je(r){let s=g(r);switch(s.type){case 1:{if(A(r),k(r)===9&&r.source[g(r).start]==="|"&&r.source[g(r).start+1]!=="="&&!(r.types[r.pos+1]===9&&r.source.charCodeAt(r.starts[r.pos+1])===124)){if(A(r),k(r)===1){let a=A(r);return{type:"TypeSelector",name:`${q(r,s)}|${q(r,a)}`,loc:L(r,s,a)}}if(k(r)===9&&r.source[g(r).start]==="*"){let a=A(r);return{type:"TypeSelector",name:`${q(r,s)}|*`,loc:L(r,s,a)}}}return{type:"TypeSelector",name:q(r,s),loc:L(r,s,s)}}case 11:return A(r),{type:"TypeSelector",name:q(r,s),loc:L(r,s,s)};case 10:return A(r),{type:"TypeSelector",name:q(r,s),loc:L(r,s,s)};case 9:{let i=r.source[s.start];if(i==="*")return A(r),{type:"TypeSelector",name:"*",loc:L(r,s,s)};if(i==="."){if(A(r),k(r)===1){let a=A(r);return{type:"ClassSelector",name:q(r,a),loc:L(r,s,a)}}return null}if(i==="&")return A(r),{type:"NestingSelector",loc:L(r,s,s)};return A(r),null}case 4:return A(r),{type:"IdSelector",name:r.source.slice(s.start+1,s.end),loc:L(r,s,s)};case 16:{A(r);let i=k(r)===16;if(i)A(r);return Ge(r,i,s)}case 19:return Xe(r)}return null}function Ge(r,s,i){let a=g(r);if(a.type===1){A(r);let l=Z(r.source,a.start,a.end);return s?{type:"PseudoElementSelector",name:l,children:null,loc:L(r,i,a)}:{type:"PseudoClassSelector",name:l,children:null,loc:L(r,i,a)}}if(a.type===2){A(r);let l=Z(r.source,a.start,a.end-1),c=I();if(!s&&$e.has(l)){let h=g(r),S=h,P=1;while(k(r)!==0&&P>0){if(k(r)===21||k(r)===2)P++;else if(k(r)===22){if(P--,P===0)break}S=A(r)}if(k(r)===22)A(r);let m=r.source.slice(h.start,S.end).trim();if(m.length>0){let w=ge(m,{positions:!1}),v=de(w);c.appendData(v)}}else{while(k(r)!==0&&k(r)!==22){let h=K(r);if(h)c.appendData(h)}if(k(r)===22)A(r)}if(s)return{type:"PseudoElementSelector",name:l,children:c,loc:L(r,i,g(r))};return{type:"PseudoClassSelector",name:l,children:c,loc:L(r,i,g(r))}}return null}function Xe(r){let s=A(r);z(r);let i=g(r);if(i.type!==1)return null;A(r);let a={type:"Identifier",name:q(r,i),loc:L(r,i,i)};z(r);let l=null,c=null,p=null,f=g(r);if(f.type===9){let S=r.source[f.start],P=r.source[f.start+1];if(S==="=")l="=",A(r);else if((S==="~"||S==="|"||S==="^"||S==="$"||S==="*")&&P==="="){A(r);let v=g(r);if(v.type===9&&r.source[v.start]==="=")A(r),l=`${S}=`}z(r);let m=g(r);if(m.type===5){A(r);let v=m.end-m.start>=2&&r.source.charCodeAt(m.end-1)===r.source.charCodeAt(m.start);c={type:"String",value:se(r.source,m.start+1,v?m.end-1:m.end),loc:L(r,m,m)}}else if(m.type===1)A(r),c={type:"Identifier",name:q(r,m),loc:L(r,m,m)};z(r);let w=g(r);if(w.type===1)A(r),p=q(r,w)}z(r);let h=g(r);if(k(r)===20)h=A(r);return{type:"AttributeSelector",name:a,matcher:l,value:c,flags:p,loc:L(r,s,h)}}var we=Symbol("walkSkip"),E=Symbol("walkStop");function Ye(r){return{root:r,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null}}function Ze(r,s){let i=Ye(r),a=typeof s==="function"?s:s.enter,l=typeof s==="function"?null:s.leave??null,c=typeof s==="function"?null:s.visit??null,p=typeof s==="function"?!1:s.reverse??!1;function f(h,S,P){let m=null,w;switch(h.type){case"StyleSheet":m="stylesheet",w=i.stylesheet,i.stylesheet=h;break;case"Atrule":m="atrule",w=i.atrule,i.atrule=h;break;case"AtrulePrelude":m="atrulePrelude",w=i.atrulePrelude,i.atrulePrelude=h;break;case"Rule":m="rule",w=i.rule,i.rule=h;break;case"Selector":m="selector",w=i.selector,i.selector=h;break;case"Block":m="block",w=i.block,i.block=h;break;case"Declaration":m="declaration",w=i.declaration,i.declaration=h;break;case"Function":m="function",w=i.function,i.function=h;break}let v;if((c===null||c===h.type)&&a){let U=a.call(i,h,S,P);if(U===we){if(m)i[m]=w;return}if(U===E){if(m)i[m]=w;return E}}if(v=et(h,p,f),v===E){if(m)i[m]=w;return E}if((c===null||c===h.type)&&l){if(l.call(i,h,S,P)===E){if(m)i[m]=w;return E}}if(m)i[m]=w;return}return f(r,null,null)}var n=Object.assign(Ze,{skip:we,stop:E});function et(r,s,i){if("children"in r&&r.children instanceof t)return tt(r.children,s,i);if(r.type==="Rule"){if(i(r.prelude,null,null)===E)return E;if(i(r.block,null,null)===E)return E;return}if(r.type==="Atrule"){if(r.prelude){if(i(r.prelude,null,null)===E)return E}if(r.block){if(i(r.block,null,null)===E)return E}return}if(r.type==="Declaration")return i(r.value,null,null);if(r.type==="AttributeSelector"){if(i(r.name,null,null)===E)return E;if(r.value)return i(r.value,null,null);return}return}function tt(r,s,i){let a;if(s)r.forEachRight((l,c,p)=>{if(a)return;if(i(l,c,p)===E)a=E});else r.forEach((l,c,p)=>{if(a)return;if(i(l,c,p)===E)a=E});return a}export{t,T,y,e,b,d,x,o,n,N};
|
|
2
|
+
import{c}from"./chunk-vbjv9wf0.js";var T={};c(T,{List:()=>t,TokenType:()=>b,Tokenizer:()=>d,clone:()=>m,decodeName:()=>y,generate:()=>e,makeList:()=>N,parse:()=>o,walk:()=>n});function _(r){return{prev:null,next:null,data:r}}class t{head=null;tail=null;cursors=[];allocateCursor(r,s){let i={prev:r,next:s};return this.cursors.push(i),i}releaseCursor(){this.cursors.pop()}updateCursors(r,s,i,a){for(let l of this.cursors){if(l.prev===r)l.prev=s;if(l.next===i)l.next=a}}static createItem(r){return _(r)}createItem(r){return _(r)}get isEmpty(){return this.head===null}get first(){return this.head?.data??null}get last(){return this.tail?.data??null}*[Symbol.iterator](){for(let r=this.head;r!=null;r=r.next)yield r.data}fromArray(r){let s=null;this.head=null;for(let i of r){let a=_(i);if(a.prev=s,s)s.next=a;else this.head=a;s=a}return this.tail=s,this}toArray(){let r=[];for(let s=this.head;s!=null;s=s.next)r.push(s.data);return r}toJSON(){return this.toArray()}forEach(r,s){let i=this.allocateCursor(null,this.head);while(i.next!==null){let a=i.next;i.prev=a,i.next=a.next,r.call(s,a.data,a,this)}this.releaseCursor()}forEachRight(r,s){let i=this.allocateCursor(this.tail,null);while(i.prev!==null){let a=i.prev;i.next=a,i.prev=a.prev,r.call(s,a.data,a,this)}this.releaseCursor()}reduce(r,s){let i=s,a=0;for(let l=this.head;l!=null;l=l.next)i=r(i,l.data,a++,this);return i}some(r){let s=0;for(let i=this.head;i!=null;i=i.next)if(r(i.data,s++,this))return!0;return!1}map(r){let s=new t,i=null,a=0;for(let l=this.head;l!=null;l=l.next){let u=_(r(l.data,a++,this));if(u.prev=i,i)i.next=u;else s.head=u;i=u}return s.tail=i,s}filter(r){let s=new t,i=null,a=0;for(let l=this.head;l!=null;l=l.next)if(r(l.data,a++,this)){let u=_(l.data);if(u.prev=i,i)i.next=u;else s.head=u;i=u}return s.tail=i,s}clear(){let r=this.head;while(r){let s=r.next;r.prev=null,r.next=null,r=s}this.head=null,this.tail=null}copy(){let r=new t,s=null;for(let i=this.head;i!=null;i=i.next){let a=_(i.data);if(a.prev=s,s)s.next=a;else r.head=a;s=a}return r.tail=s,r}prepend(r){return this.insert(r,this.head)}prependData(r){return this.insert(_(r),this.head)}append(r){return this.insert(r,null)}appendData(r){return this.insert(_(r),null)}insert(r,s=null){if(s!=null)if(this.updateCursors(s.prev,r,s,r),s.prev===null){if(this.head!==s)throw Error("before doesn't belong to list");this.head=r,s.prev=r,r.next=s,this.updateCursors(null,r,null,null)}else s.prev.next=r,r.prev=s.prev,s.prev=r,r.next=s;else if(this.updateCursors(this.tail,r,null,r),this.tail!==null)this.tail.next=r,r.prev=this.tail,this.tail=r;else this.head=r,this.tail=r;return this}insertData(r,s=null){return this.insert(_(r),s)}remove(r){if(this.updateCursors(r,r.prev,r,r.next),r.prev!==null)r.prev.next=r.next;else if(this.head===r)this.head=r.next;else throw Error("item doesn't belong to list");if(r.next!==null)r.next.prev=r.prev;else if(this.tail===r)this.tail=r.prev;else throw Error("item doesn't belong to list");return r.prev=null,r.next=null,r}push(r){this.insert(_(r),null)}pop(){if(this.tail===null)return null;return this.remove(this.tail)}unshift(r){this.prependData(r)}shift(){if(this.head===null)return null;return this.remove(this.head)}prependList(r){return this.insertList(r,this.head)}appendList(r){return this.insertList(r,null)}insertList(r,s=null){if(r.head===null)return this;if(s!==null){if(this.updateCursors(s.prev,r.tail,s,r.head),s.prev!==null)s.prev.next=r.head,r.head.prev=s.prev;else this.head=r.head;s.prev=r.tail,r.tail.next=s}else{if(this.updateCursors(this.tail,r.tail,null,r.head),this.tail!==null)this.tail.next=r.head,r.head.prev=this.tail;else this.head=r.head;this.tail=r.tail}return r.head=null,r.tail=null,this}replace(r,s){if(s instanceof t)this.insertList(s,r),this.remove(r);else this.insert(s,r),this.remove(r)}}function N(){return new t}function m(r){return G(r)}function G(r){if(r===null||typeof r!=="object")return r;if(r instanceof t){let i=new t;for(let a of r)i.appendData(G(a));return i}if(Array.isArray(r))return r.map(G);if("type"in r&&typeof r.type==="string"){let i={type:r.type};for(let a of Object.keys(r)){if(a==="type")continue;i[a]=G(r[a])}return i}let s={};for(let i of Object.keys(r))s[i]=G(r[i]);return s}function e(r){switch(r.type){case"StyleSheet":return O(r.children,"");case"Rule":return`${e(r.prelude)}{${e(r.block)}}`;case"Block":return ve(r.children);case"Atrule":{let s=`@${r.name}`;if(r.prelude){let i=e(r.prelude);if(i)s+=` ${i}`}if(r.block)s+=`{${e(r.block)}}`;else s+=";";return s}case"AtrulePrelude":return O(r.children,"");case"SelectorList":return O(r.children,",");case"Selector":return O(r.children,"");case"TypeSelector":return r.name;case"IdSelector":return`#${r.name}`;case"ClassSelector":return`.${r.name}`;case"NestingSelector":return"&";case"AttributeSelector":{let s=`[${r.name.name}`;if(r.matcher&&r.value)if(s+=r.matcher,r.value.type==="String")s+=`"${ne(r.value.value)}"`;else s+=r.value.name;if(r.flags)s+=` ${r.flags}`;return s+="]",s}case"PseudoClassSelector":return r.children?`:${r.name}(${O(r.children,"")})`:`:${r.name}`;case"PseudoElementSelector":return r.children?`::${r.name}(${O(r.children,"")})`:`::${r.name}`;case"Combinator":return r.name===" "?" ":r.name;case"Declaration":return`${r.property}:${e(r.value)}${r.important?"!important":""}`;case"DeclarationList":return O(r.children,";");case"Value":return O(r.children,"");case"Identifier":return r.name;case"Number":return r.value;case"Percentage":return`${r.value}%`;case"Dimension":return r.value+r.unit;case"String":return`"${ne(r.value)}"`;case"Url":return/[\s"'()\\\u0000-\u001F\u007F]/.test(r.value)?`url("${ne(r.value)}")`:`url(${r.value})`;case"Hash":return`#${r.name}`;case"Operator":return r.value;case"Function":return`${r.name}(${O(r.children,"")})`;case"Parentheses":return`(${O(r.children,"")})`;case"Brackets":return`[${O(r.children,"")}]`;case"Raw":return r.value;case"Comment":return r.value.startsWith("!")?`/*${r.value}*/`:"";case"WhiteSpace":return" ";case"CDO":return"<!--";case"CDC":return"-->";case"AnPlusB":{let s=r.a??"",i=r.b??"";if(s&&i){let a=Number(i);return`${s==="1"?"":s==="-1"?"-":s}n${a>=0?`+${i}`:i}`}if(s)return`${s==="1"?"":s==="-1"?"-":s}n`;return i}case"Ratio":return`${r.left.value}/${r.right.value}`;case"UnicodeRange":return r.value;case"Nth":return r.selector?`${e(r.nth)} of ${e(r.selector)}`:e(r.nth);case"MediaQueryList":return O(r.children,",");case"MediaQuery":return O(r.children,"");case"MediaFeature":{let s=`(${r.name}`;if(r.value)s+=`:${e(r.value)}`;return s+=")",s}}return""}function O(r,s){let i="",a=!0,l=null,u=r.head;while(u!=null){let p=u.data;if(p.type==="WhiteSpace"){let h=u.next?u.next.data:null;if(fe(l)||fe(h)){u=u.next;continue}}let f=e(p);if(!f){u=u.next;continue}if(!a&&s&&!De(l))i+=s;a=!1,i+=f,l=p,u=u.next}return i}function ve(r){let s="",i=null,a=r.head;while(a!=null){let l=a.data,u=e(l);if(!u){a=a.next;continue}if(i&&Ee(i,l))s+=";";s+=u,i=l,a=a.next}return s}function Ee(r,s){return r.type==="Declaration"&&s.type!=="Comment"}function fe(r){if(!r||r.type!=="Operator")return!1;let s=r.value;return s===":"||s===","||s==="/"}function De(r){if(!r)return!1;return r.type==="Operator"||r.type==="Combinator"}function ne(r){let s="";for(let i=0;i<r.length;i++){let a=r.charCodeAt(i);if(a===92)s+="\\\\";else if(a===34)s+="\\\"";else if(a<32||a===127){let l=a.toString(16),u=i+1<r.length?r.charCodeAt(i+1):-1,p=u===32||u===9||u===10||u===12||u===13||u>=48&&u<=57||u>=65&&u<=70||u>=97&&u<=102;s+=`\\${l}${p?" ":""}`}else s+=r[i]}return s}var b;((S)=>{S[S.EOF=0]="EOF";S[S.Ident=1]="Ident";S[S.Function=2]="Function";S[S.AtKeyword=3]="AtKeyword";S[S.Hash=4]="Hash";S[S.String=5]="String";S[S.BadString=6]="BadString";S[S.Url=7]="Url";S[S.BadUrl=8]="BadUrl";S[S.Delim=9]="Delim";S[S.Number=10]="Number";S[S.Percentage=11]="Percentage";S[S.Dimension=12]="Dimension";S[S.WhiteSpace=13]="WhiteSpace";S[S.CDO=14]="CDO";S[S.CDC=15]="CDC";S[S.Colon=16]="Colon";S[S.Semicolon=17]="Semicolon";S[S.Comma=18]="Comma";S[S.LeftSquareBracket=19]="LeftSquareBracket";S[S.RightSquareBracket=20]="RightSquareBracket";S[S.LeftParenthesis=21]="LeftParenthesis";S[S.RightParenthesis=22]="RightParenthesis";S[S.LeftCurlyBracket=23]="LeftCurlyBracket";S[S.RightCurlyBracket=24]="RightCurlyBracket";S[S.Comment=25]="Comment"})(b||={});var H=(()=>{let r=new Uint8Array(128);for(let s=0;s<128;s++){let i=0;if(s===32||s===9||s===10||s===12||s===13)i|=1;if(s>=48&&s<=57)i|=2;if(s>=48&&s<=57||s>=65&&s<=70||s>=97&&s<=102)i|=4;if(s>=65&&s<=90||s>=97&&s<=122||s===95)i|=8;if(s===10||s===12||s===13)i|=16;r[s]=i}return r})();function V(r){return r<128&&(H[r]&2)!==0}function X(r){return r<128&&(H[r]&4)!==0}function me(r){return r>=128||r<128&&(H[r]&8)!==0}function Re(r){return r===45||r>=128||r<128&&(H[r]&10)!==0}function Ie(r){return r>=0&&r<=8||r===11||r>=14&&r<=31||r===127}function oe(r){return r<128&&(H[r]&16)!==0}function M(r){return r<128&&(H[r]&1)!==0}function j(r,s){if(r!==92)return!1;if(oe(s))return!1;return!0}function re(r,s,i){if(r===45)return me(s)||s===45||j(s,i);if(me(r))return!0;if(r===92)return j(r,s);return!1}function Fe(r,s,i){if(r===43||r===45){if(V(s))return!0;if(s===46&&V(i))return!0;return!1}if(r===46)return V(s);return V(r)}class d{source;offset=0;types;starts;ends;count=0;_tokens=null;_lineStarts=null;constructor(r){this.source=r;let s=Math.max(64,Math.ceil(r.length/3));this.types=new Uint8Array(s),this.starts=new Uint32Array(s),this.ends=new Uint32Array(s),this.tokenize()}get lineStarts(){if(this._lineStarts==null)this._lineStarts=Be(this.source);return this._lineStarts}get tokens(){if(this._tokens!=null)return this._tokens;let r=Array.from({length:this.count});for(let s=0;s<this.count;s++)r[s]={type:this.types[s],start:this.starts[s],end:this.ends[s]};return this._tokens=r,r}addToken(r,s,i){if(this.count>=this.types.length)this.grow();this.types[this.count]=r,this.starts[this.count]=s,this.ends[this.count]=i,this.count++}grow(){let s=this.types.length*2,i=new Uint8Array(s);i.set(this.types),this.types=i;let a=new Uint32Array(s);a.set(this.starts),this.starts=a;let l=new Uint32Array(s);l.set(this.ends),this.ends=l}tokenize(){let r=this.source,s=0,i=r.length;while(s<i){let a=r.charCodeAt(s);if(a===47&&r.charCodeAt(s+1)===42){let p=s;s+=2;while(s<i&&!(r.charCodeAt(s)===42&&r.charCodeAt(s+1)===47))s++;s=s<i?s+2:i,this.addToken(25,p,s);continue}if(M(a)){let p=s;while(s<i&&M(r.charCodeAt(s)))s++;this.addToken(13,p,s);continue}if(a===34||a===39){s=this.consumeString(a,s);continue}if(a===35){if(s+1<i&&(Re(r.charCodeAt(s+1))||j(r.charCodeAt(s+1),r.charCodeAt(s+2)))){let p=s;s++,s=this.consumeName(s),this.addToken(4,p,s);continue}this.addToken(9,s,s+1),s++;continue}switch(a){case 40:this.addToken(21,s,s+1),s++;continue;case 41:this.addToken(22,s,s+1),s++;continue;case 91:this.addToken(19,s,s+1),s++;continue;case 93:this.addToken(20,s,s+1),s++;continue;case 123:this.addToken(23,s,s+1),s++;continue;case 125:this.addToken(24,s,s+1),s++;continue;case 44:this.addToken(18,s,s+1),s++;continue;case 58:this.addToken(16,s,s+1),s++;continue;case 59:this.addToken(17,s,s+1),s++;continue}if(a===60&&r.startsWith("!--",s+1)){this.addToken(14,s,s+4),s+=4;continue}if(a===45&&r.startsWith("->",s+1)){this.addToken(15,s,s+3),s+=3;continue}if(a===64){let p=r.charCodeAt(s+1),f=r.charCodeAt(s+2),h=r.charCodeAt(s+3);if(re(p,f,h)){let k=s;s++,s=this.consumeName(s),this.addToken(3,k,s);continue}this.addToken(9,s,s+1),s++;continue}let l=r.charCodeAt(s+1),u=r.charCodeAt(s+2);if(Fe(a,l,u)){s=this.consumeNumeric(s);continue}if(re(a,l,u)){s=this.consumeIdentLike(s);continue}if(a===92){if(j(a,l)){s=this.consumeIdentLike(s);continue}this.addToken(9,s,s+1),s++;continue}this.addToken(9,s,s+1),s++}this.addToken(0,i,i)}consumeString(r,s){let i=this.source,a=i.length,l=s+1;while(l<a){let u=i.charCodeAt(l);if(u===r)return l++,this.addToken(5,s,l),l;if(oe(u))return this.addToken(6,s,l),l;if(u===92){let p=i.charCodeAt(l+1);if(oe(p)){l+=2;continue}if(l+1<a){l=this.consumeEscapeSkip(l+1);continue}}l++}return this.addToken(5,s,l),l}consumeEscapeSkip(r){let s=this.source;if(r>=s.length)return r;let i=s.charCodeAt(r);if(X(i)){let a=1;r++;while(a<6&&r<s.length&&X(s.charCodeAt(r)))r++,a++;if(r<s.length&&M(s.charCodeAt(r)))r++;return r}return r+1}consumeName(r){let s=this.source,i=s.length,a=r;while(a<i){let l=s.charCodeAt(a);if(l<128&&(H[l]&10)!==0){a++;continue}if(l===45){a++;continue}if(l>=128){a++;continue}if(l===92&&j(l,s.charCodeAt(a+1))){a=this.consumeEscapeSkip(a+1);continue}break}return a}consumeNumber(r){let s=this.source,i=r;if(s.charCodeAt(i)===43||s.charCodeAt(i)===45)i++;while(i<s.length&&V(s.charCodeAt(i)))i++;if(s.charCodeAt(i)===46&&V(s.charCodeAt(i+1))){i+=2;while(i<s.length&&V(s.charCodeAt(i)))i++}let a=s.charCodeAt(i);if(a===69||a===101){let l=s.charCodeAt(i+1),u=s.charCodeAt(i+2);if(V(l)){i+=2;while(i<s.length&&V(s.charCodeAt(i)))i++}else if((l===43||l===45)&&V(u)){i+=3;while(i<s.length&&V(s.charCodeAt(i)))i++}}return i}consumeNumeric(r){let s=this.source,i=this.consumeNumber(r),a=s.charCodeAt(i),l=s.charCodeAt(i+1),u=s.charCodeAt(i+2);if(re(a,l,u)){let p=this.consumeName(i);return this.addToken(12,r,p),p}if(a===37)return this.addToken(11,r,i+1),i+1;return this.addToken(10,r,i),i}consumeIdentLike(r){let s=this.source,i=this.consumeName(r),a=s.charCodeAt(i);if(a===40&&i-r===3){let l=s.charCodeAt(r)|32,u=s.charCodeAt(r+1)|32,p=s.charCodeAt(r+2)|32;if(l===117&&u===114&&p===108){let f=i+1;while(f<s.length&&M(s.charCodeAt(f)))f++;let h=s.charCodeAt(f);if(h===34||h===39)return this.addToken(2,r,i+1),i+1;return this.consumeUrl(r,i)}}if(a===40)return this.addToken(2,r,i+1),i+1;return this.addToken(1,r,i),i}consumeUrl(r,s){let i=this.source,a=i.length,l=s+1;while(l<a&&M(i.charCodeAt(l)))l++;while(l<a){let u=i.charCodeAt(l);if(u===41)return l++,this.addToken(7,r,l),l;if(M(u)){let p=l;while(l<a&&M(i.charCodeAt(l)))l++;if(l>=a)return this.addToken(7,r,l),l;if(i.charCodeAt(l)===41)return l++,this.addToken(7,r,l),l;return this.consumeBadUrl(r,p)}if(u===34||u===39||u===40||Ie(u))return this.consumeBadUrl(r,l);if(u===92){if(j(u,i.charCodeAt(l+1))){l=this.consumeEscapeSkip(l+1);continue}return this.consumeBadUrl(r,l)}l++}return this.addToken(7,r,l),l}consumeBadUrl(r,s){let i=this.source,a=s;while(a<i.length){let l=i.charCodeAt(a);if(l===41){a++;break}if(l===92&&j(l,i.charCodeAt(a+1))){a=this.consumeEscapeSkip(a+1);continue}a++}return this.addToken(8,r,a),a}locate(r){let s=this.lineStarts,i=0,a=s.length-1;while(i<a){let u=i+a+1>>1;if(s[u]<=r)i=u;else a=u-1}let l=s[i];return{line:i+1,column:r-l+1}}}function Be(r){let s=[0],i=r.length;for(let a=0;a<i;a++){let l=r.charCodeAt(a);if(l===10)s.push(a+1);else if(l===13){if(r.charCodeAt(a+1)!==10)s.push(a+1)}}return s}function se(r,s,i){for(let a=s;a<i;a++)if(r.charCodeAt(a)===92)return Oe(r,s,i,a);return r.slice(s,i)}function Oe(r,s,i,a){let l=r.slice(s,a),u=a;while(u<i){if(r.charCodeAt(u)!==92){l+=r[u],u++;continue}if(u+1>=i){u++;continue}let f=r.charCodeAt(u+1);if(f===10){u+=2;continue}if(f===13){u+=r.charCodeAt(u+2)===10?3:2;continue}if(X(f)){let h=u+1,k="";while(k.length<6&&h<i&&X(r.charCodeAt(h)))k+=r[h],h++;let x=Number.parseInt(k,16);if(h<i&&M(r.charCodeAt(h)))h++;l+=x===0||x>=55296&&x<=57343||x>1114111?String.fromCodePoint(65533):String.fromCodePoint(x),u=h;continue}l+=r[u+1],u+=2}return l}function y(r,s,i){for(let a=s;a<i;a++)if(r.charCodeAt(a)===92)return We(r,s,i,a);return r.slice(s,i)}function We(r,s,i,a){let l=r.slice(s,a),u=a;while(u<i){if(r.charCodeAt(u)!==92){l+=r[u],u++;continue}let f=u+1,h="";while(h.length<6&&f<i&&X(r.charCodeAt(f)))h+=r[f],f++;if(h.length>0){let k=Number.parseInt(h,16);if(f<i&&M(r.charCodeAt(f)))f++;l+=k===0||k>=55296&&k<=57343||k>1114111?String.fromCodePoint(65533):String.fromCodePoint(k),u=f;continue}if(f<i){l+=r[f],u=f+1;continue}l+=String.fromCodePoint(65533),u=f}return l}function ge(r,s){let i=new d(r);return{source:r,types:i.types,starts:i.starts,ends:i.ends,count:i.count,end:i.count,pos:0,positions:s.positions??!1,filename:s.filename,parseValue:s.parseValue??!0,parseAtrulePrelude:s.parseAtrulePrelude??!0,parseCustomProperty:s.parseCustomProperty??!1,parseRulePrelude:s.parseRulePrelude??!0,onParseError:s.onParseError,tokenizer:i}}function g(r){return r.pos<r.end?r.types[r.pos]:0}function A(r){let s=r.pos;if(s>=r.end)return{type:0,start:r.starts[s]??r.source.length,end:r.ends[s]??r.source.length};return{type:r.types[s],start:r.starts[s],end:r.ends[s]}}function P(r){let s=r.pos++;if(s>=r.end)return{type:0,start:r.starts[s]??r.source.length,end:r.ends[s]??r.source.length};return{type:r.types[s],start:r.starts[s],end:r.ends[s]}}function q(r,s){return r.source.slice(s.start,s.end)}function z(r){let{types:s,end:i}=r;while(r.pos<i){let a=s[r.pos];if(a===13||a===25)r.pos++;else break}}function ye(r){let{types:s,end:i}=r;while(r.pos<i&&s[r.pos]===13)r.pos++}function L(r,s,i){if(!r.positions)return null;let a=r.tokenizer.locate(s.start),l=r.tokenizer.locate(i.end);return{source:r.filename??"<unknown>",start:{offset:s.start,line:a.line,column:a.column},end:{offset:i.end,line:l.line,column:l.column}}}function Ae(r){if(!r.positions)return null;let s=A(r),i=r.tokenizer.locate(s.start);return{source:r.filename??"<unknown>",start:{offset:s.start,line:i.line,column:i.column},end:{offset:s.start,line:i.line,column:i.column}}}function Y(r,s,i,a){return{type:"Raw",value:r,loc:L(a,s,i)}}function I(){return new t}function ie(r,s,i,a){if(r.onParseError){let{line:l,column:u}=r.tokenizer.locate(i.start),p=SyntaxError(`${r.filename??"<input>"}:${l}:${u}: ${s}`);p.line=l,p.column=u,p.offset=i.start,r.onParseError(p,a)}return a}function o(r,s={}){let i=ge(r,s);switch(s.context??"stylesheet"){case"stylesheet":return ke(i);case"atrule":return ee(i)??Ce(i);case"atrulePrelude":return Ve(i);case"mediaQuery":case"mediaQueryList":return Se(i);case"rule":return le(i);case"selectorList":return de(i);case"selector":return Le(i);case"block":return ce(i);case"declarationList":return qe(i);case"declaration":return ue(i)??Ce(i);case"value":return Me(i);case"raw":return Se(i);default:return ke(i)}}function Ce(r){return{type:"StyleSheet",children:I(),loc:Ae(r)}}function Se(r){let s=A(r),i=s;while(g(r)!==0)i=P(r);return{type:"Raw",value:r.source.slice(s.start,i.end),loc:L(r,s,i)}}function ke(r){let s=A(r),i=I(),{types:a,end:l}=r;while(r.pos<l){let f=a[r.pos];if(f===13){r.pos++;continue}if(f===25){let x={type:25,start:r.starts[r.pos],end:r.ends[r.pos]},C=ae(r,x);r.pos++,i.appendData(C);continue}if(f===0)break;if(f===14||f===15){r.pos++;continue}if(f===3){let x=ee(r);if(x)i.appendData(x);continue}if(f===24){r.pos++;continue}let h=r.pos,k=le(r);if(i.appendData(k),r.pos===h)r.pos++}let u=r.end-1,p=u>=0?{type:r.types[u],start:r.starts[u],end:r.ends[u]}:{type:0,start:0,end:0};return{type:"StyleSheet",children:i,loc:L(r,s,p)}}function ae(r,s){return{type:"Comment",value:r.source.slice(s.start+2,s.end-2),loc:L(r,s,s)}}function ee(r){let s=A(r);if(s.type!==3)return null;r.pos++;let i=Z(r.source,s.start+1,s.end);z(r);let a=r.pos,l=A(r),{types:u,end:p}=r,f=a,h=a;while(f<p){let C=u[f];if(C===0||C===17||C===23)break;if(C!==13&&C!==25)h=f+1;f++}let k=null;if(h>a){let C=r.starts[a],w=r.ends[h-1],v={type:u[h-1],start:r.starts[h-1],end:w},U=r.source.slice(C,w).trim();if(U.length>0)if(r.parseAtrulePrelude)try{let J=r.end;r.end=h,r.pos=a;let W=I();while(g(r)!==0){let Q=K(r);if(Q)W.appendData(Q)}if(Pe(W),r.end=J,r.pos=f,W.isEmpty)k=Y(U,l,v,r);else k={type:"AtrulePrelude",children:W,loc:null}}catch(J){let W=Y(U,l,v,r);ie(r,`Failed to parse @${i} prelude: ${J.message}`,l,W),k=W,r.pos=f}else k=Y(U,l,v,r),r.pos=f;else r.pos=f}else r.pos=f;let x=null;if(g(r)===17)P(r);else if(g(r)===23)x=ce(r,Ue.has(i));return{type:"Atrule",name:i,prelude:k,block:x,loc:L(r,s,A(r))}}var $e=new Set(["is","not","where","has","matches","-moz-any","-webkit-any"]),Ue=new Set(["media","supports","document","layer","container","scope","starting-style","-moz-document","keyframes","-webkit-keyframes","-moz-keyframes","-o-keyframes"]);function Ve(r){let s=A(r),i=I();while(g(r)!==0){if(A(r).type===13){r.pos++;continue}let l=K(r);if(l)i.appendData(l)}return{type:"AtrulePrelude",children:i,loc:L(r,s,A(r))}}function le(r){let s=A(r),i;if(r.parseRulePrelude)i=de(r);else{let l=A(r),u=l;while(g(r)!==0&&g(r)!==23)u=P(r);let p=r.source.slice(l.start,u.end).trim();i=Y(p,l,u,r)}let a=ce(r,!0);return{type:"Rule",prelude:i,block:a,loc:L(r,s,A(r))}}function ce(r,s=!1){let i=A(r);if(g(r)!==23)return{type:"Block",children:I(),loc:Ae(r)};r.pos++;let a=I(),{types:l,end:u}=r;while(r.pos<u){let p=l[r.pos];if(p===24||p===0)break;if(p===13){r.pos++;continue}if(p===25){let h={type:25,start:r.starts[r.pos],end:r.ends[r.pos]};r.pos++,a.appendData(ae(r,h));continue}if(p===3){let h=ee(r);if(h)a.appendData(h);continue}if(s&&ze(r,_e)){let h=le(r);a.appendData(h);continue}let f=ue(r);if(f)a.appendData(f);if(r.pos<u&&l[r.pos]===17)r.pos++}if(g(r)===24)r.pos++;return{type:"Block",children:a,loc:L(r,i,A(r))}}function ze(r,s){let i=r.pos,a=s(r);return r.pos=i,a}function _e(r){let{types:s,end:i}=r;while(r.pos<i){let a=s[r.pos];if(a===23)return!0;if(a===17||a===24||a===0)return!1;r.pos++}return!1}function qe(r){let s=A(r),i=I();while(g(r)!==0&&g(r)!==24){let a=A(r);if(a.type===13){r.pos++;continue}if(a.type===25){i.appendData(ae(r,P(r)));continue}if(a.type===17){r.pos++;continue}if(a.type===3){let u=ee(r);if(u)i.appendData(u);continue}let l=ue(r);if(l)i.appendData(l);if(g(r)===17)P(r)}return{type:"DeclarationList",children:i,loc:L(r,s,A(r))}}function ue(r){z(r);let s=A(r);if(s.type!==1&&s.type!==4&&!(s.type===9&&r.source[s.start]==="*"&&r.source[s.start+1]===" "))if(s.type===9&&r.source[s.start]==="*")r.pos++;else{ie(r,"Expected property name",s,{type:"Raw",value:"",loc:null});let{types:F,end:B}=r;while(r.pos<B){let D=F[r.pos];if(D===0||D===17||D===24)break;r.pos++}return null}let i=r.starts[r.pos],a=r.ends[r.pos];r.pos++;let l=r.source.slice(i,a);if(ye(r),g(r)!==16){ie(r,`Expected ':' after property "${l}"`,A(r),{type:"Raw",value:"",loc:null});let{types:F,end:B}=r;while(r.pos<B){let D=F[r.pos];if(D===0||D===17||D===24)break;r.pos++}return null}r.pos++,ye(r);let{types:u,starts:p,end:f,pos:h}=r,k=h,x=h,C=-1,w=-1;while(k<f){let F=u[k];if(F===0||F===17||F===24)break;if(F===9&&r.source.charCodeAt(p[k])===33){let B=k+1;while(B<f&&u[B]===13)B++;if(B<f&&u[B]===1){let D=p[B];if(r.ends[B]-D===9&&(r.source.charCodeAt(D)|32)===105&&(r.source.charCodeAt(D+1)|32)===109&&(r.source.charCodeAt(D+2)|32)===112&&(r.source.charCodeAt(D+3)|32)===111&&(r.source.charCodeAt(D+4)|32)===114&&(r.source.charCodeAt(D+5)|32)===116&&(r.source.charCodeAt(D+6)|32)===97&&(r.source.charCodeAt(D+7)|32)===110&&(r.source.charCodeAt(D+8)|32)===116){w=k,C=B,k=B+1;continue}}}if(F!==13&&F!==25)x=k+1;k++}let v=x,U=C>=0?{type:1,start:p[C],end:r.ends[C]}:null,J=l.startsWith("--"),W,Q=p[h],pe=v>h?r.ends[v-1]:Q,te={type:u[h],start:Q,end:r.ends[h]},he=v>h?{type:u[v-1],start:p[v-1],end:pe}:te;if(J&&!r.parseCustomProperty||!r.parseValue)W={type:"Raw",value:r.source.slice(Q,pe).trim(),loc:L(r,te,he)};else if(v===h)W={type:"Value",children:I(),loc:L(r,te,he)};else{let F=r.end;r.end=v,r.pos=h,W=Ne(r),r.end=F}return r.pos=k,{type:"Declaration",property:l,important:U?!0:!1,value:W,loc:L(r,s,A(r))}}function Me(r){return Ne(r)}function Ne(r){let s=A(r),i=I();while(g(r)!==0&&g(r)!==17&&g(r)!==24&&g(r)!==22&&g(r)!==20){let a=K(r);if(a)i.appendData(a)}return xe(i),{type:"Value",children:i,loc:L(r,s,A(r))}}function Pe(r){for(let s of r)if("children"in s&&s.children instanceof t)Pe(s.children);xe(r)}function xe(r){let s=r.head;while(s){if(s.data.type==="Number"){let i=s.next;while(i&&i.data.type==="WhiteSpace")i=i.next;if(i&&i.data.type==="Operator"&&i.data.value==="/"){let a=i.next;while(a&&a.data.type==="WhiteSpace")a=a.next;if(a&&a.data.type==="Number"){let l={type:"Ratio",left:s.data,right:a.data,loc:null},u=s.next;while(u&&u!==a.next){let p=u.next;r.remove(u),u=p}r.replace(s,r.createItem(l)),s=r.head;continue}}}s=s.next}}function K(r){let s=r.pos;if(s>=r.end)return null;let i=r.types[s],a=r.starts[s],l=r.ends[s],u=r.source;switch(i){case 13:return r.pos++,r.positions?{type:"WhiteSpace",value:" ",loc:R(r,a,l)}:{type:"WhiteSpace",value:" ",loc:null};case 25:return r.pos++,{type:"Comment",value:u.slice(a+2,l-2),loc:r.positions?R(r,a,l):null};case 10:return r.pos++,{type:"Number",value:u.slice(a,l),loc:r.positions?R(r,a,l):null};case 11:return r.pos++,{type:"Percentage",value:u.slice(a,l-1),loc:r.positions?R(r,a,l):null};case 12:{r.pos++;let p=a,f=u.charCodeAt(p);if(f===43||f===45)p++;let h=!1;while(p<l){let x=u.charCodeAt(p);if(x>=48&&x<=57){p++;continue}if(x===46&&!h){h=!0,p++;continue}break}let k=u.charCodeAt(p);if(k===69||k===101){let x=p+1,C=u.charCodeAt(x);if(C===43||C===45)x++;let w=!1;while(x<l){let v=u.charCodeAt(x);if(v>=48&&v<=57){x++,w=!0;continue}break}if(w)p=x}return{type:"Dimension",value:u.slice(a,p),unit:u.slice(p,l),loc:r.positions?R(r,a,l):null}}case 1:return r.pos++,{type:"Identifier",name:y(u,a,l),loc:r.positions?R(r,a,l):null};case 5:{r.pos++;let p=a+1,h=l-a>=2&&u.charCodeAt(l-1)===u.charCodeAt(a)?l-1:l;return{type:"String",value:se(u,p,h),loc:r.positions?R(r,a,l):null}}case 7:{r.pos++;let p=a+4;while(p<l&&be(u.charCodeAt(p)))p++;let f=l;if(f>p&&u.charCodeAt(f-1)===41)f--;while(f>p&&be(u.charCodeAt(f-1)))f--;let h;if(f-p>=2){let k=u.charCodeAt(p),x=u.charCodeAt(f-1);if((k===34||k===39)&&k===x)h=u.slice(p+1,f-1);else h=u.slice(p,f)}else h=u.slice(p,f);return{type:"Url",value:h,loc:r.positions?R(r,a,l):null}}case 4:return r.pos++,{type:"Hash",name:u.slice(a+1,l),loc:r.positions?R(r,a,l):null};case 2:return He(r);case 21:return Ke(r);case 18:return r.pos++,{type:"Operator",value:",",loc:r.positions?R(r,a,l):null};case 16:return r.pos++,{type:"Operator",value:":",loc:r.positions?R(r,a,l):null};case 9:{r.pos++;let p=u.charCodeAt(a),f=u[a];if(je(p))return{type:"Operator",value:f,loc:r.positions?R(r,a,l):null};return{type:"Identifier",name:f,loc:r.positions?R(r,a,l):null}}case 19:{r.pos++;let p=I();while(g(r)!==0&&g(r)!==20){let h=K(r);if(h)p.appendData(h)}let f=r.pos<r.end?r.ends[r.pos]:l;if(g(r)===20)r.pos++;return{type:"Brackets",children:p,loc:r.positions?R(r,a,f):null}}case 3:case 23:case 24:case 22:case 20:case 17:case 0:case 14:case 15:case 6:case 8:return r.pos++,{type:"Raw",value:u.slice(a,l),loc:r.positions?R(r,a,l):null}}return r.pos++,null}function be(r){return r===32||r===9||r===10||r===12||r===13}function je(r){return r===47||r===43||r===45||r===42||r===61||r===62||r===60||r===126||r===124||r===36||r===94||r===33||r===38}function Z(r,s,i){for(let a=s;a<i;a++){let l=r.charCodeAt(a);if(l>=65&&l<=90)return r.slice(s,i).toLowerCase()}return r.slice(s,i)}function R(r,s,i){let a=r.tokenizer.locate(s),l=r.tokenizer.locate(i);return{source:r.filename??"<unknown>",start:{offset:s,line:a.line,column:a.column},end:{offset:i,line:l.line,column:l.column}}}function He(r){let s=P(r),i=Z(r.source,s.start,s.end-1),a=I();while(g(r)!==0&&g(r)!==22){let l=K(r);if(l)a.appendData(l)}if(g(r)===22)P(r);if(i==="url"){for(let l=a.head;l!=null;l=l.next)if(l.data.type==="String")return{type:"Url",value:l.data.value,loc:L(r,s,A(r))}}return{type:"Function",name:i,children:a,loc:L(r,s,A(r))}}function Ke(r){let s=P(r),i=I();while(g(r)!==0&&g(r)!==22){let a=K(r);if(a)i.appendData(a)}if(g(r)===22)P(r);return{type:"Parentheses",children:i,loc:L(r,s,A(r))}}function de(r){let s=A(r),i=I();while(g(r)!==0){if(z(r),g(r)===0||g(r)===23)break;let a=Le(r);if(a.children.head!==null)i.appendData(a);if(z(r),g(r)===18){P(r);continue}break}return{type:"SelectorList",children:i,loc:L(r,s,A(r))}}function Le(r){let s=A(r),i=I(),a=!0;while(g(r)!==0&&g(r)!==18&&g(r)!==23){let l=A(r);if(l.type===13){if(P(r),!a&&g(r)!==0&&g(r)!==18&&g(r)!==23&&!Te(r)&&!Qe(r)){let p={type:"Combinator",name:" ",loc:L(r,l,l)};i.appendData(p),a=!0}continue}if(l.type===9&&r.source.charCodeAt(l.start)===124&&r.types[r.pos+1]===9&&r.source.charCodeAt(r.starts[r.pos+1])===124){let p=A(r);P(r);let f=P(r),h={type:"Combinator",name:"||",loc:L(r,p,f)};i.appendData(h),a=!0,z(r);continue}if(Te(r)){let p=P(r),h={type:"Combinator",name:r.source[p.start],loc:L(r,p,p)};i.appendData(h),a=!0,z(r);continue}let u=Je(r);if(!u)break;i.appendData(u),a=!1}while(i.tail&&i.tail.data.type==="Combinator")i.remove(i.tail);return{type:"Selector",children:i,loc:L(r,s,A(r))}}function Te(r){let s=A(r);if(s.type!==9)return!1;let i=r.source[s.start];return i===">"||i==="+"||i==="~"}function Qe(r){if(r.types[r.pos]!==9)return!1;if(r.source.charCodeAt(r.starts[r.pos])!==124)return!1;if(r.types[r.pos+1]!==9)return!1;return r.source.charCodeAt(r.starts[r.pos+1])===124}function Je(r){let s=A(r);switch(s.type){case 1:{if(P(r),g(r)===9&&r.source[A(r).start]==="|"&&r.source[A(r).start+1]!=="="&&!(r.types[r.pos+1]===9&&r.source.charCodeAt(r.starts[r.pos+1])===124)){if(P(r),g(r)===1){let a=P(r);return{type:"TypeSelector",name:`${q(r,s)}|${q(r,a)}`,loc:L(r,s,a)}}if(g(r)===9&&r.source[A(r).start]==="*"){let a=P(r);return{type:"TypeSelector",name:`${q(r,s)}|*`,loc:L(r,s,a)}}}return{type:"TypeSelector",name:q(r,s),loc:L(r,s,s)}}case 11:return P(r),{type:"TypeSelector",name:q(r,s),loc:L(r,s,s)};case 10:return P(r),{type:"TypeSelector",name:q(r,s),loc:L(r,s,s)};case 9:{let i=r.source[s.start];if(i==="*")return P(r),{type:"TypeSelector",name:"*",loc:L(r,s,s)};if(i==="."){if(P(r),g(r)===1){let a=P(r);return{type:"ClassSelector",name:q(r,a),loc:L(r,s,a)}}return null}if(i==="&")return P(r),{type:"NestingSelector",loc:L(r,s,s)};return P(r),null}case 4:return P(r),{type:"IdSelector",name:r.source.slice(s.start+1,s.end),loc:L(r,s,s)};case 16:{P(r);let i=g(r)===16;if(i)P(r);return Ge(r,i,s)}case 19:return Xe(r)}return null}function Ge(r,s,i){let a=A(r);if(a.type===1){P(r);let l=Z(r.source,a.start,a.end);return s?{type:"PseudoElementSelector",name:l,children:null,loc:L(r,i,a)}:{type:"PseudoClassSelector",name:l,children:null,loc:L(r,i,a)}}if(a.type===2){P(r);let l=Z(r.source,a.start,a.end-1),u=I();if(!s&&$e.has(l)){let h=A(r),k=h,x=1;while(g(r)!==0&&x>0){if(g(r)===21||g(r)===2)x++;else if(g(r)===22){if(x--,x===0)break}k=P(r)}if(g(r)===22)P(r);let C=r.source.slice(h.start,k.end).trim();if(C.length>0){let w=ge(C,{positions:!1}),v=de(w);u.appendData(v)}}else{while(g(r)!==0&&g(r)!==22){let h=K(r);if(h)u.appendData(h)}if(g(r)===22)P(r)}if(s)return{type:"PseudoElementSelector",name:l,children:u,loc:L(r,i,A(r))};return{type:"PseudoClassSelector",name:l,children:u,loc:L(r,i,A(r))}}return null}function Xe(r){let s=P(r);z(r);let i=A(r);if(i.type!==1)return null;P(r);let a={type:"Identifier",name:q(r,i),loc:L(r,i,i)};z(r);let l=null,u=null,p=null,f=A(r);if(f.type===9){let k=r.source[f.start],x=r.source[f.start+1];if(k==="=")l="=",P(r);else if((k==="~"||k==="|"||k==="^"||k==="$"||k==="*")&&x==="="){P(r);let v=A(r);if(v.type===9&&r.source[v.start]==="=")P(r),l=`${k}=`}z(r);let C=A(r);if(C.type===5){P(r);let v=C.end-C.start>=2&&r.source.charCodeAt(C.end-1)===r.source.charCodeAt(C.start);u={type:"String",value:se(r.source,C.start+1,v?C.end-1:C.end),loc:L(r,C,C)}}else if(C.type===1)P(r),u={type:"Identifier",name:q(r,C),loc:L(r,C,C)};z(r);let w=A(r);if(w.type===1)P(r),p=q(r,w)}z(r);let h=A(r);if(g(r)===20)h=P(r);return{type:"AttributeSelector",name:a,matcher:l,value:u,flags:p,loc:L(r,s,h)}}var we=Symbol("walkSkip"),E=Symbol("walkStop");function Ye(r){return{root:r,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null}}function Ze(r,s){let i=Ye(r),a=typeof s==="function"?s:s.enter,l=typeof s==="function"?null:s.leave??null,u=typeof s==="function"?null:s.visit??null,p=typeof s==="function"?!1:s.reverse??!1;function f(h,k,x){let C=null,w;switch(h.type){case"StyleSheet":C="stylesheet",w=i.stylesheet,i.stylesheet=h;break;case"Atrule":C="atrule",w=i.atrule,i.atrule=h;break;case"AtrulePrelude":C="atrulePrelude",w=i.atrulePrelude,i.atrulePrelude=h;break;case"Rule":C="rule",w=i.rule,i.rule=h;break;case"Selector":C="selector",w=i.selector,i.selector=h;break;case"Block":C="block",w=i.block,i.block=h;break;case"Declaration":C="declaration",w=i.declaration,i.declaration=h;break;case"Function":C="function",w=i.function,i.function=h;break}let v;if((u===null||u===h.type)&&a){let U=a.call(i,h,k,x);if(U===we){if(C)i[C]=w;return}if(U===E){if(C)i[C]=w;return E}}if(v=et(h,p,f),v===E){if(C)i[C]=w;return E}if((u===null||u===h.type)&&l){if(l.call(i,h,k,x)===E){if(C)i[C]=w;return E}}if(C)i[C]=w;return}return f(r,null,null)}var n=Object.assign(Ze,{skip:we,stop:E});function et(r,s,i){if("children"in r&&r.children instanceof t)return tt(r.children,s,i);if(r.type==="Rule"){if(i(r.prelude,null,null)===E)return E;if(i(r.block,null,null)===E)return E;return}if(r.type==="Atrule"){if(r.prelude){if(i(r.prelude,null,null)===E)return E}if(r.block){if(i(r.block,null,null)===E)return E}return}if(r.type==="Declaration")return i(r.value,null,null);if(r.type==="AttributeSelector"){if(i(r.name,null,null)===E)return E;if(r.value)return i(r.value,null,null);return}return}function tt(r,s,i){let a;if(s)r.forEachRight((l,u,p)=>{if(a)return;if(i(l,u,p)===E)a=E});else r.forEach((l,u,p)=>{if(a)return;if(i(l,u,p)===E)a=E});return a}export{t,N,m,e,b,d,y,o,n,T};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{F as eM}from"./chunk-1kmkypmr.js";var MQ={};eM(MQ,{walk:()=>wM,parse:()=>WM,makeList:()=>$M,generate:()=>g,decodeName:()=>a,clone:()=>FM,Tokenizer:()=>T,TokenType:()=>p,List:()=>j});function f(M){return{prev:null,next:null,data:M}}class j{head=null;tail=null;cursors=[];allocateCursor(M,Q){let G={prev:M,next:Q};return this.cursors.push(G),G}releaseCursor(){this.cursors.pop()}updateCursors(M,Q,G,J){for(let X of this.cursors){if(X.prev===M)X.prev=Q;if(X.next===G)X.next=J}}static createItem(M){return f(M)}createItem(M){return f(M)}get isEmpty(){return this.head===null}get first(){return this.head?.data??null}get last(){return this.tail?.data??null}*[Symbol.iterator](){for(let M=this.head;M!=null;M=M.next)yield M.data}fromArray(M){let Q=null;this.head=null;for(let G of M){let J=f(G);if(J.prev=Q,Q)Q.next=J;else this.head=J;Q=J}return this.tail=Q,this}toArray(){let M=[];for(let Q=this.head;Q!=null;Q=Q.next)M.push(Q.data);return M}toJSON(){return this.toArray()}forEach(M,Q){let G=this.allocateCursor(null,this.head);while(G.next!==null){let J=G.next;G.prev=J,G.next=J.next,M.call(Q,J.data,J,this)}this.releaseCursor()}forEachRight(M,Q){let G=this.allocateCursor(this.tail,null);while(G.prev!==null){let J=G.prev;G.next=J,G.prev=J.prev,M.call(Q,J.data,J,this)}this.releaseCursor()}reduce(M,Q){let G=Q,J=0;for(let X=this.head;X!=null;X=X.next)G=M(G,X.data,J++,this);return G}some(M){let Q=0;for(let G=this.head;G!=null;G=G.next)if(M(G.data,Q++,this))return!0;return!1}map(M){let Q=new j,G=null,J=0;for(let X=this.head;X!=null;X=X.next){let Y=f(M(X.data,J++,this));if(Y.prev=G,G)G.next=Y;else Q.head=Y;G=Y}return Q.tail=G,Q}filter(M){let Q=new j,G=null,J=0;for(let X=this.head;X!=null;X=X.next)if(M(X.data,J++,this)){let Y=f(X.data);if(Y.prev=G,G)G.next=Y;else Q.head=Y;G=Y}return Q.tail=G,Q}clear(){let M=this.head;while(M){let Q=M.next;M.prev=null,M.next=null,M=Q}this.head=null,this.tail=null}copy(){let M=new j,Q=null;for(let G=this.head;G!=null;G=G.next){let J=f(G.data);if(J.prev=Q,Q)Q.next=J;else M.head=J;Q=J}return M.tail=Q,M}prepend(M){return this.insert(M,this.head)}prependData(M){return this.insert(f(M),this.head)}append(M){return this.insert(M,null)}appendData(M){return this.insert(f(M),null)}insert(M,Q=null){if(Q!=null)if(this.updateCursors(Q.prev,M,Q,M),Q.prev===null){if(this.head!==Q)throw Error("before doesn't belong to list");this.head=M,Q.prev=M,M.next=Q,this.updateCursors(null,M,null,null)}else Q.prev.next=M,M.prev=Q.prev,Q.prev=M,M.next=Q;else if(this.updateCursors(this.tail,M,null,M),this.tail!==null)this.tail.next=M,M.prev=this.tail,this.tail=M;else this.head=M,this.tail=M;return this}insertData(M,Q=null){return this.insert(f(M),Q)}remove(M){if(this.updateCursors(M,M.prev,M,M.next),M.prev!==null)M.prev.next=M.next;else if(this.head===M)this.head=M.next;else throw Error("item doesn't belong to list");if(M.next!==null)M.next.prev=M.prev;else if(this.tail===M)this.tail=M.prev;else throw Error("item doesn't belong to list");return M.prev=null,M.next=null,M}push(M){this.insert(f(M),null)}pop(){if(this.tail===null)return null;return this.remove(this.tail)}unshift(M){this.prependData(M)}shift(){if(this.head===null)return null;return this.remove(this.head)}prependList(M){return this.insertList(M,this.head)}appendList(M){return this.insertList(M,null)}insertList(M,Q=null){if(M.head===null)return this;if(Q!==null){if(this.updateCursors(Q.prev,M.tail,Q,M.head),Q.prev!==null)Q.prev.next=M.head,M.head.prev=Q.prev;else this.head=M.head;Q.prev=M.tail,M.tail.next=Q}else{if(this.updateCursors(this.tail,M.tail,null,M.head),this.tail!==null)this.tail.next=M.head,M.head.prev=this.tail;else this.head=M.head;this.tail=M.tail}return M.head=null,M.tail=null,this}replace(M,Q){if(Q instanceof j)this.insertList(Q,M),this.remove(M);else this.insert(Q,M),this.remove(M)}}function $M(){return new j}function FM(M){return k(M)}function k(M){if(M===null||typeof M!=="object")return M;if(M instanceof j){let G=new j;for(let J of M)G.appendData(k(J));return G}if(Array.isArray(M))return M.map(k);if("type"in M&&typeof M.type==="string"){let G={type:M.type};for(let J of Object.keys(M)){if(J==="type")continue;G[J]=k(M[J])}return G}let Q={};for(let G of Object.keys(M))Q[G]=k(M[G]);return Q}function g(M){switch(M.type){case"StyleSheet":return I(M.children,"");case"Rule":return`${g(M.prelude)}{${g(M.block)}}`;case"Block":return IM(M.children);case"Atrule":{let Q=`@${M.name}`;if(M.prelude){let G=g(M.prelude);if(G)Q+=` ${G}`}if(M.block)Q+=`{${g(M.block)}}`;else Q+=";";return Q}case"AtrulePrelude":return I(M.children,"");case"SelectorList":return I(M.children,",");case"Selector":return I(M.children,"");case"TypeSelector":return M.name;case"IdSelector":return`#${M.name}`;case"ClassSelector":return`.${M.name}`;case"NestingSelector":return"&";case"AttributeSelector":{let Q=`[${M.name.name}`;if(M.matcher&&M.value)if(Q+=M.matcher,M.value.type==="String")Q+=`"${n(M.value.value)}"`;else Q+=M.value.name;if(M.flags)Q+=` ${M.flags}`;return Q+="]",Q}case"PseudoClassSelector":return M.children?`:${M.name}(${I(M.children,"")})`:`:${M.name}`;case"PseudoElementSelector":return M.children?`::${M.name}(${I(M.children,"")})`:`::${M.name}`;case"Combinator":return M.name===" "?" ":M.name;case"Declaration":return`${M.property}:${g(M.value)}${M.important?"!important":""}`;case"DeclarationList":return I(M.children,";");case"Value":return I(M.children,"");case"Identifier":return M.name;case"Number":return M.value;case"Percentage":return`${M.value}%`;case"Dimension":return M.value+M.unit;case"String":return`"${n(M.value)}"`;case"Url":return/[\s"'()\\\u0000-\u001F\u007F]/.test(M.value)?`url("${n(M.value)}")`:`url(${M.value})`;case"Hash":return`#${M.name}`;case"Operator":return M.value;case"Function":return`${M.name}(${I(M.children,"")})`;case"Parentheses":return`(${I(M.children,"")})`;case"Brackets":return`[${I(M.children,"")}]`;case"Raw":return M.value;case"Comment":return M.value.startsWith("!")?`/*${M.value}*/`:"";case"WhiteSpace":return" ";case"CDO":return"<!--";case"CDC":return"-->";case"AnPlusB":{let Q=M.a??"",G=M.b??"";if(Q&&G){let J=Number(G);return`${Q==="1"?"":Q==="-1"?"-":Q}n${J>=0?`+${G}`:G}`}if(Q)return`${Q==="1"?"":Q==="-1"?"-":Q}n`;return G}case"Ratio":return`${M.left.value}/${M.right.value}`;case"UnicodeRange":return M.value;case"Nth":return M.selector?`${g(M.nth)} of ${g(M.selector)}`:g(M.nth);case"MediaQueryList":return I(M.children,",");case"MediaQuery":return I(M.children,"");case"MediaFeature":{let Q=`(${M.name}`;if(M.value)Q+=`:${g(M.value)}`;return Q+=")",Q}}return""}function I(M,Q){let G="",J=!0,X=null,Y=M.head;while(Y!=null){let Z=Y.data;if(Z.type==="WhiteSpace"){let $=Y.next?Y.next.data:null;if(UM(X)||UM($)){Y=Y.next;continue}}let F=g(Z);if(!F){Y=Y.next;continue}if(!J&&Q&&!CM(X))G+=Q;J=!1,G+=F,X=Z,Y=Y.next}return G}function IM(M){let Q="",G=null,J=M.head;while(J!=null){let X=J.data,Y=g(X);if(!Y){J=J.next;continue}if(G&&gM(G,X))Q+=";";Q+=Y,G=X,J=J.next}return Q}function gM(M,Q){return M.type==="Declaration"&&Q.type!=="Comment"}function UM(M){if(!M||M.type!=="Operator")return!1;let Q=M.value;return Q===":"||Q===","||Q==="/"}function CM(M){if(!M)return!1;return M.type==="Operator"||M.type==="Combinator"}function n(M){let Q="";for(let G=0;G<M.length;G++){let J=M.charCodeAt(G);if(J===92)Q+="\\\\";else if(J===34)Q+="\\\"";else if(J<32||J===127){let X=J.toString(16),Y=G+1<M.length?M.charCodeAt(G+1):-1,Z=Y===32||Y===9||Y===10||Y===12||Y===13||Y>=48&&Y<=57||Y>=65&&Y<=70||Y>=97&&Y<=102;Q+=`\\${X}${Z?" ":""}`}else Q+=M[G]}return Q}var p;((K)=>{K[K.EOF=0]="EOF";K[K.Ident=1]="Ident";K[K.Function=2]="Function";K[K.AtKeyword=3]="AtKeyword";K[K.Hash=4]="Hash";K[K.String=5]="String";K[K.BadString=6]="BadString";K[K.Url=7]="Url";K[K.BadUrl=8]="BadUrl";K[K.Delim=9]="Delim";K[K.Number=10]="Number";K[K.Percentage=11]="Percentage";K[K.Dimension=12]="Dimension";K[K.WhiteSpace=13]="WhiteSpace";K[K.CDO=14]="CDO";K[K.CDC=15]="CDC";K[K.Colon=16]="Colon";K[K.Semicolon=17]="Semicolon";K[K.Comma=18]="Comma";K[K.LeftSquareBracket=19]="LeftSquareBracket";K[K.RightSquareBracket=20]="RightSquareBracket";K[K.LeftParenthesis=21]="LeftParenthesis";K[K.RightParenthesis=22]="RightParenthesis";K[K.LeftCurlyBracket=23]="LeftCurlyBracket";K[K.RightCurlyBracket=24]="RightCurlyBracket";K[K.Comment=25]="Comment"})(p||={});var h=(()=>{let M=new Uint8Array(128);for(let Q=0;Q<128;Q++){let G=0;if(Q===32||Q===9||Q===10||Q===12||Q===13)G|=1;if(Q>=48&&Q<=57)G|=2;if(Q>=48&&Q<=57||Q>=65&&Q<=70||Q>=97&&Q<=102)G|=4;if(Q>=65&&Q<=90||Q>=97&&Q<=122||Q===95)G|=8;if(Q===10||Q===12||Q===13)G|=16;M[Q]=G}return M})();function P(M){return M<128&&(h[M]&2)!==0}function l(M){return M<128&&(h[M]&4)!==0}function KM(M){return M>=128||M<128&&(h[M]&8)!==0}function xM(M){return M===45||M>=128||M<128&&(h[M]&10)!==0}function PM(M){return M>=0&&M<=8||M===11||M>=14&&M<=31||M===127}function t(M){return M<128&&(h[M]&16)!==0}function S(M){return M<128&&(h[M]&1)!==0}function v(M,Q){if(M!==92)return!1;if(t(Q))return!1;return!0}function o(M,Q,G){if(M===45)return KM(Q)||Q===45||v(Q,G);if(KM(M))return!0;if(M===92)return v(M,Q);return!1}function bM(M,Q,G){if(M===43||M===45){if(P(Q))return!0;if(Q===46&&P(G))return!0;return!1}if(M===46)return P(Q);return P(M)}class T{source;offset=0;types;starts;ends;count=0;_tokens=null;_lineStarts=null;constructor(M){this.source=M;let Q=Math.max(64,Math.ceil(M.length/3));this.types=new Uint8Array(Q),this.starts=new Uint32Array(Q),this.ends=new Uint32Array(Q),this.tokenize()}get lineStarts(){if(this._lineStarts==null)this._lineStarts=fM(this.source);return this._lineStarts}get tokens(){if(this._tokens!=null)return this._tokens;let M=Array.from({length:this.count});for(let Q=0;Q<this.count;Q++)M[Q]={type:this.types[Q],start:this.starts[Q],end:this.ends[Q]};return this._tokens=M,M}addToken(M,Q,G){if(this.count>=this.types.length)this.grow();this.types[this.count]=M,this.starts[this.count]=Q,this.ends[this.count]=G,this.count++}grow(){let Q=this.types.length*2,G=new Uint8Array(Q);G.set(this.types),this.types=G;let J=new Uint32Array(Q);J.set(this.starts),this.starts=J;let X=new Uint32Array(Q);X.set(this.ends),this.ends=X}tokenize(){let M=this.source,Q=0,G=M.length;while(Q<G){let J=M.charCodeAt(Q);if(J===47&&M.charCodeAt(Q+1)===42){let Z=Q;Q+=2;while(Q<G&&!(M.charCodeAt(Q)===42&&M.charCodeAt(Q+1)===47))Q++;Q=Q<G?Q+2:G,this.addToken(25,Z,Q);continue}if(S(J)){let Z=Q;while(Q<G&&S(M.charCodeAt(Q)))Q++;this.addToken(13,Z,Q);continue}if(J===34||J===39){Q=this.consumeString(J,Q);continue}if(J===35){if(Q+1<G&&(xM(M.charCodeAt(Q+1))||v(M.charCodeAt(Q+1),M.charCodeAt(Q+2)))){let Z=Q;Q++,Q=this.consumeName(Q),this.addToken(4,Z,Q);continue}this.addToken(9,Q,Q+1),Q++;continue}switch(J){case 40:this.addToken(21,Q,Q+1),Q++;continue;case 41:this.addToken(22,Q,Q+1),Q++;continue;case 91:this.addToken(19,Q,Q+1),Q++;continue;case 93:this.addToken(20,Q,Q+1),Q++;continue;case 123:this.addToken(23,Q,Q+1),Q++;continue;case 125:this.addToken(24,Q,Q+1),Q++;continue;case 44:this.addToken(18,Q,Q+1),Q++;continue;case 58:this.addToken(16,Q,Q+1),Q++;continue;case 59:this.addToken(17,Q,Q+1),Q++;continue}if(J===60&&M.startsWith("!--",Q+1)){this.addToken(14,Q,Q+4),Q+=4;continue}if(J===45&&M.startsWith("->",Q+1)){this.addToken(15,Q,Q+3),Q+=3;continue}if(J===64){let Z=M.charCodeAt(Q+1),F=M.charCodeAt(Q+2),$=M.charCodeAt(Q+3);if(o(Z,F,$)){let z=Q;Q++,Q=this.consumeName(Q),this.addToken(3,z,Q);continue}this.addToken(9,Q,Q+1),Q++;continue}let X=M.charCodeAt(Q+1),Y=M.charCodeAt(Q+2);if(bM(J,X,Y)){Q=this.consumeNumeric(Q);continue}if(o(J,X,Y)){Q=this.consumeIdentLike(Q);continue}if(J===92){if(v(J,X)){Q=this.consumeIdentLike(Q);continue}this.addToken(9,Q,Q+1),Q++;continue}this.addToken(9,Q,Q+1),Q++}this.addToken(0,G,G)}consumeString(M,Q){let G=this.source,J=G.length,X=Q+1;while(X<J){let Y=G.charCodeAt(X);if(Y===M)return X++,this.addToken(5,Q,X),X;if(t(Y))return this.addToken(6,Q,X),X;if(Y===92){let Z=G.charCodeAt(X+1);if(t(Z)){X+=2;continue}if(X+1<J){X=this.consumeEscapeSkip(X+1);continue}}X++}return this.addToken(5,Q,X),X}consumeEscapeSkip(M){let Q=this.source;if(M>=Q.length)return M;let G=Q.charCodeAt(M);if(l(G)){let J=1;M++;while(J<6&&M<Q.length&&l(Q.charCodeAt(M)))M++,J++;if(M<Q.length&&S(Q.charCodeAt(M)))M++;return M}return M+1}consumeName(M){let Q=this.source,G=Q.length,J=M;while(J<G){let X=Q.charCodeAt(J);if(X<128&&(h[X]&10)!==0){J++;continue}if(X===45){J++;continue}if(X>=128){J++;continue}if(X===92&&v(X,Q.charCodeAt(J+1))){J=this.consumeEscapeSkip(J+1);continue}break}return J}consumeNumber(M){let Q=this.source,G=M;if(Q.charCodeAt(G)===43||Q.charCodeAt(G)===45)G++;while(G<Q.length&&P(Q.charCodeAt(G)))G++;if(Q.charCodeAt(G)===46&&P(Q.charCodeAt(G+1))){G+=2;while(G<Q.length&&P(Q.charCodeAt(G)))G++}let J=Q.charCodeAt(G);if(J===69||J===101){let X=Q.charCodeAt(G+1),Y=Q.charCodeAt(G+2);if(P(X)){G+=2;while(G<Q.length&&P(Q.charCodeAt(G)))G++}else if((X===43||X===45)&&P(Y)){G+=3;while(G<Q.length&&P(Q.charCodeAt(G)))G++}}return G}consumeNumeric(M){let Q=this.source,G=this.consumeNumber(M),J=Q.charCodeAt(G),X=Q.charCodeAt(G+1),Y=Q.charCodeAt(G+2);if(o(J,X,Y)){let Z=this.consumeName(G);return this.addToken(12,M,Z),Z}if(J===37)return this.addToken(11,M,G+1),G+1;return this.addToken(10,M,G),G}consumeIdentLike(M){let Q=this.source,G=this.consumeName(M),J=Q.charCodeAt(G);if(J===40&&G-M===3){let X=Q.charCodeAt(M)|32,Y=Q.charCodeAt(M+1)|32,Z=Q.charCodeAt(M+2)|32;if(X===117&&Y===114&&Z===108){let F=G+1;while(F<Q.length&&S(Q.charCodeAt(F)))F++;let $=Q.charCodeAt(F);if($===34||$===39)return this.addToken(2,M,G+1),G+1;return this.consumeUrl(M,G)}}if(J===40)return this.addToken(2,M,G+1),G+1;return this.addToken(1,M,G),G}consumeUrl(M,Q){let G=this.source,J=G.length,X=Q+1;while(X<J&&S(G.charCodeAt(X)))X++;while(X<J){let Y=G.charCodeAt(X);if(Y===41)return X++,this.addToken(7,M,X),X;if(S(Y)){let Z=X;while(X<J&&S(G.charCodeAt(X)))X++;if(X>=J)return this.addToken(7,M,X),X;if(G.charCodeAt(X)===41)return X++,this.addToken(7,M,X),X;return this.consumeBadUrl(M,Z)}if(Y===34||Y===39||Y===40||PM(Y))return this.consumeBadUrl(M,X);if(Y===92){if(v(Y,G.charCodeAt(X+1))){X=this.consumeEscapeSkip(X+1);continue}return this.consumeBadUrl(M,X)}X++}return this.addToken(7,M,X),X}consumeBadUrl(M,Q){let G=this.source,J=Q;while(J<G.length){let X=G.charCodeAt(J);if(X===41){J++;break}if(X===92&&v(X,G.charCodeAt(J+1))){J=this.consumeEscapeSkip(J+1);continue}J++}return this.addToken(8,M,J),J}locate(M){let Q=this.lineStarts,G=0,J=Q.length-1;while(G<J){let Y=G+J+1>>1;if(Q[Y]<=M)G=Y;else J=Y-1}let X=Q[G];return{line:G+1,column:M-X+1}}}function fM(M){let Q=[0],G=M.length;for(let J=0;J<G;J++){let X=M.charCodeAt(J);if(X===10)Q.push(J+1);else if(X===13){if(M.charCodeAt(J+1)!==10)Q.push(J+1)}}return Q}function s(M,Q,G){for(let J=Q;J<G;J++)if(M.charCodeAt(J)===92)return EM(M,Q,G,J);return M.slice(Q,G)}function EM(M,Q,G,J){let X=M.slice(Q,J),Y=J;while(Y<G){if(M.charCodeAt(Y)!==92){X+=M[Y],Y++;continue}if(Y+1>=G){Y++;continue}let F=M.charCodeAt(Y+1);if(F===10){Y+=2;continue}if(F===13){Y+=M.charCodeAt(Y+2)===10?3:2;continue}if(l(F)){let $=Y+1,z="";while(z.length<6&&$<G&&l(M.charCodeAt($)))z+=M[$],$++;let V=Number.parseInt(z,16);if($<G&&S(M.charCodeAt($)))$++;X+=V===0||V>=55296&&V<=57343||V>1114111?String.fromCodePoint(65533):String.fromCodePoint(V),Y=$;continue}X+=M[Y+1],Y+=2}return X}function a(M,Q,G){for(let J=Q;J<G;J++)if(M.charCodeAt(J)===92)return SM(M,Q,G,J);return M.slice(Q,G)}function SM(M,Q,G,J){let X=M.slice(Q,J),Y=J;while(Y<G){if(M.charCodeAt(Y)!==92){X+=M[Y],Y++;continue}let F=Y+1,$="";while($.length<6&&F<G&&l(M.charCodeAt(F)))$+=M[F],F++;if($.length>0){let z=Number.parseInt($,16);if(F<G&&S(M.charCodeAt(F)))F++;X+=z===0||z>=55296&&z<=57343||z>1114111?String.fromCodePoint(65533):String.fromCodePoint(z),Y=F;continue}if(F<G){X+=M[F],Y=F+1;continue}X+=String.fromCodePoint(65533),Y=F}return X}function DM(M,Q){let G=new T(M);return{source:M,types:G.types,starts:G.starts,ends:G.ends,count:G.count,end:G.count,pos:0,positions:Q.positions??!1,filename:Q.filename,parseValue:Q.parseValue??!0,parseAtrulePrelude:Q.parseAtrulePrelude??!0,parseCustomProperty:Q.parseCustomProperty??!1,parseRulePrelude:Q.parseRulePrelude??!0,onParseError:Q.onParseError,tokenizer:G}}function q(M){return M.pos<M.end?M.types[M.pos]:0}function H(M){let Q=M.pos;if(Q>=M.end)return{type:0,start:M.starts[Q]??M.source.length,end:M.ends[Q]??M.source.length};return{type:M.types[Q],start:M.starts[Q],end:M.ends[Q]}}function _(M){let Q=M.pos++;if(Q>=M.end)return{type:0,start:M.starts[Q]??M.source.length,end:M.ends[Q]??M.source.length};return{type:M.types[Q],start:M.starts[Q],end:M.ends[Q]}}function E(M,Q){return M.source.slice(Q.start,Q.end)}function b(M){let{types:Q,end:G}=M;while(M.pos<G){let J=Q[M.pos];if(J===13||J===25)M.pos++;else break}}function zM(M){let{types:Q,end:G}=M;while(M.pos<G&&Q[M.pos]===13)M.pos++}function B(M,Q,G){if(!M.positions)return null;let J=M.tokenizer.locate(Q.start),X=M.tokenizer.locate(G.end);return{source:M.filename??"<unknown>",start:{offset:Q.start,line:J.line,column:J.column},end:{offset:G.end,line:X.line,column:X.column}}}function NM(M){if(!M.positions)return null;let Q=H(M),G=M.tokenizer.locate(Q.start);return{source:M.filename??"<unknown>",start:{offset:Q.start,line:G.line,column:G.column},end:{offset:Q.start,line:G.line,column:G.column}}}function d(M,Q,G,J){return{type:"Raw",value:M,loc:B(J,Q,G)}}function O(){return new j}function e(M,Q,G,J){if(M.onParseError){let{line:X,column:Y}=M.tokenizer.locate(G.start),Z=SyntaxError(`${M.filename??"<input>"}:${X}:${Y}: ${Q}`);Z.line=X,Z.column=Y,Z.offset=G.start,M.onParseError(Z,J)}return J}function WM(M,Q={}){let G=DM(M,Q);switch(Q.context??"stylesheet"){case"stylesheet":return _M(G);case"atrule":return r(G)??qM(G);case"atrulePrelude":return mM(G);case"mediaQuery":case"mediaQueryList":return HM(G);case"rule":return QM(G);case"selectorList":return XM(G);case"selector":return OM(G);case"block":return GM(G);case"declarationList":return kM(G);case"declaration":return JM(G)??qM(G);case"value":return lM(G);case"raw":return HM(G);default:return _M(G)}}function qM(M){return{type:"StyleSheet",children:O(),loc:NM(M)}}function HM(M){let Q=H(M),G=Q;while(q(M)!==0)G=_(M);return{type:"Raw",value:M.source.slice(Q.start,G.end),loc:B(M,Q,G)}}function _M(M){let Q=H(M),G=O(),J=M.types,X=M.end;while(M.pos<X){let F=J[M.pos];if(F===13){M.pos++;continue}if(F===25){let V={type:25,start:M.starts[M.pos],end:M.ends[M.pos]},U=MM(M,V);M.pos++,G.appendData(U);continue}if(F===0)break;if(F===14||F===15){M.pos++;continue}if(F===3){let V=r(M);if(V)G.appendData(V);continue}if(F===24){M.pos++;continue}let $=M.pos,z=QM(M);if(G.appendData(z),M.pos===$)M.pos++}let Y=M.end-1,Z=Y>=0?{type:M.types[Y],start:M.starts[Y],end:M.ends[Y]}:{type:0,start:0,end:0};return{type:"StyleSheet",children:G,loc:B(M,Q,Z)}}function MM(M,Q){return{type:"Comment",value:M.source.slice(Q.start+2,Q.end-2),loc:B(M,Q,Q)}}function r(M){let Q=H(M);if(Q.type!==3)return null;M.pos++;let G=c(M.source,Q.start+1,Q.end);b(M);let J=M.pos,X=H(M),Y=M.types,Z=M.end,F=J,$=J;while(F<Z){let U=Y[F];if(U===0||U===17||U===23)break;if(U!==13&&U!==25)$=F+1;F++}let z=null;if($>J){let U=M.starts[J],D=M.ends[$-1],N={type:Y[$-1],start:M.starts[$-1],end:D},x=M.source.slice(U,D).trim();if(x.length>0)if(M.parseAtrulePrelude)try{let u=M.end;M.end=$,M.pos=J;let C=O();while(q(M)!==0){let y=m(M);if(y)C.appendData(y)}if(jM(C),M.end=u,M.pos=F,C.isEmpty)z=d(x,X,N,M);else z={type:"AtrulePrelude",children:C,loc:null}}catch(u){let C=d(x,X,N,M);e(M,`Failed to parse @${G} prelude: ${u.message}`,X,C),z=C,M.pos=F}else z=d(x,X,N,M),M.pos=F;else M.pos=F}else M.pos=F;let V=null;if(q(M)===17)_(M);else if(q(M)===23)V=GM(M,hM.has(G));return{type:"Atrule",name:G,prelude:z,block:V,loc:B(M,Q,H(M))}}var vM=new Set(["is","not","where","has","matches","-moz-any","-webkit-any"]),hM=new Set(["media","supports","document","layer","container","scope","starting-style","-moz-document","keyframes","-webkit-keyframes","-moz-keyframes","-o-keyframes"]);function mM(M){let Q=H(M),G=O();while(q(M)!==0){if(H(M).type===13){M.pos++;continue}let X=m(M);if(X)G.appendData(X)}return{type:"AtrulePrelude",children:G,loc:B(M,Q,H(M))}}function QM(M){let Q=H(M),G;if(M.parseRulePrelude)G=XM(M);else{let X=H(M),Y=X;while(q(M)!==0&&q(M)!==23)Y=_(M);let Z=M.source.slice(X.start,Y.end).trim();G=d(Z,X,Y,M)}let J=GM(M,!0);return{type:"Rule",prelude:G,block:J,loc:B(M,Q,H(M))}}function GM(M,Q=!1){let G=H(M);if(q(M)!==23)return{type:"Block",children:O(),loc:NM(M)};M.pos++;let J=O(),X=M.types,Y=M.end;while(M.pos<Y){let Z=X[M.pos];if(Z===24||Z===0)break;if(Z===13){M.pos++;continue}if(Z===25){let $={type:25,start:M.starts[M.pos],end:M.ends[M.pos]};M.pos++,J.appendData(MM(M,$));continue}if(Z===3){let $=r(M);if($)J.appendData($);continue}if(Q&&yM(M,uM)){let $=QM(M);J.appendData($);continue}let F=JM(M);if(F)J.appendData(F);if(M.pos<Y&&X[M.pos]===17)M.pos++}if(q(M)===24)M.pos++;return{type:"Block",children:J,loc:B(M,G,H(M))}}function yM(M,Q){let G=M.pos,J=Q(M);return M.pos=G,J}function uM(M){let{types:Q,end:G}=M;while(M.pos<G){let J=Q[M.pos];if(J===23)return!0;if(J===17||J===24||J===0)return!1;M.pos++}return!1}function kM(M){let Q=H(M),G=O();while(q(M)!==0&&q(M)!==24){let J=H(M);if(J.type===13){M.pos++;continue}if(J.type===25){G.appendData(MM(M,_(M)));continue}if(J.type===17){M.pos++;continue}if(J.type===3){let Y=r(M);if(Y)G.appendData(Y);continue}let X=JM(M);if(X)G.appendData(X);if(q(M)===17)_(M)}return{type:"DeclarationList",children:G,loc:B(M,Q,H(M))}}function JM(M){b(M);let Q=H(M);if(Q.type!==1&&Q.type!==4&&!(Q.type===9&&M.source[Q.start]==="*"&&M.source[Q.start+1]===" "))if(Q.type===9&&M.source[Q.start]==="*")M.pos++;else{e(M,"Expected property name",Q,{type:"Raw",value:"",loc:null});let{types:L,end:w}=M;while(M.pos<w){let A=L[M.pos];if(A===0||A===17||A===24)break;M.pos++}return null}let G=M.starts[M.pos],J=M.ends[M.pos];M.pos++;let X=M.source.slice(G,J);if(zM(M),q(M)!==16){e(M,`Expected ':' after property "${X}"`,H(M),{type:"Raw",value:"",loc:null});let{types:L,end:w}=M;while(M.pos<w){let A=L[M.pos];if(A===0||A===17||A===24)break;M.pos++}return null}M.pos++,zM(M);let{types:Y,starts:Z,end:F,pos:$}=M,z=$,V=$,U=-1,D=-1;while(z<F){let L=Y[z];if(L===0||L===17||L===24)break;if(L===9&&M.source.charCodeAt(Z[z])===33){let w=z+1;while(w<F&&Y[w]===13)w++;if(w<F&&Y[w]===1){let A=Z[w];if(M.ends[w]-A===9&&(M.source.charCodeAt(A)|32)===105&&(M.source.charCodeAt(A+1)|32)===109&&(M.source.charCodeAt(A+2)|32)===112&&(M.source.charCodeAt(A+3)|32)===111&&(M.source.charCodeAt(A+4)|32)===114&&(M.source.charCodeAt(A+5)|32)===116&&(M.source.charCodeAt(A+6)|32)===97&&(M.source.charCodeAt(A+7)|32)===110&&(M.source.charCodeAt(A+8)|32)===116){D=z,U=w,z=w+1;continue}}}if(L!==13&&L!==25)V=z+1;z++}let N=V,x=U>=0?{type:1,start:Z[U],end:M.ends[U]}:null,u=X.startsWith("--"),C,y=Z[$],YM=N>$?M.ends[N-1]:y,i={type:Y[$],start:y,end:M.ends[$]},ZM=N>$?{type:Y[N-1],start:Z[N-1],end:YM}:i;if(u&&!M.parseCustomProperty||!M.parseValue)C={type:"Raw",value:M.source.slice(y,YM).trim(),loc:B(M,i,ZM)};else if(N===$)C={type:"Value",children:O(),loc:B(M,i,ZM)};else{let L=M.end;M.end=N,M.pos=$,C=AM(M),M.end=L}return M.pos=z,{type:"Declaration",property:X,important:x?!0:!1,value:C,loc:B(M,Q,H(M))}}function lM(M){return AM(M)}function AM(M){let Q=H(M),G=O();while(q(M)!==0&&q(M)!==17&&q(M)!==24&&q(M)!==22&&q(M)!==20){let J=m(M);if(J)G.appendData(J)}return RM(G),{type:"Value",children:G,loc:B(M,Q,H(M))}}function jM(M){for(let Q of M)if("children"in Q&&Q.children instanceof j)jM(Q.children);RM(M)}function RM(M){let Q=M.head;while(Q){if(Q.data.type==="Number"){let G=Q.next;while(G&&G.data.type==="WhiteSpace")G=G.next;if(G&&G.data.type==="Operator"&&G.data.value==="/"){let J=G.next;while(J&&J.data.type==="WhiteSpace")J=J.next;if(J&&J.data.type==="Number"){let X={type:"Ratio",left:Q.data,right:J.data,loc:null},Y=Q.next;while(Y&&Y!==J.next){let Z=Y.next;M.remove(Y),Y=Z}M.replace(Q,M.createItem(X)),Q=M.head;continue}}}Q=Q.next}}function m(M){let Q=M.pos;if(Q>=M.end)return null;let G=M.types[Q],J=M.starts[Q],X=M.ends[Q],Y=M.source;switch(G){case 13:return M.pos++,M.positions?{type:"WhiteSpace",value:" ",loc:R(M,J,X)}:{type:"WhiteSpace",value:" ",loc:null};case 25:return M.pos++,{type:"Comment",value:Y.slice(J+2,X-2),loc:M.positions?R(M,J,X):null};case 10:return M.pos++,{type:"Number",value:Y.slice(J,X),loc:M.positions?R(M,J,X):null};case 11:return M.pos++,{type:"Percentage",value:Y.slice(J,X-1),loc:M.positions?R(M,J,X):null};case 12:{M.pos++;let Z=J,F=Y.charCodeAt(Z);if(F===43||F===45)Z++;let $=!1;while(Z<X){let V=Y.charCodeAt(Z);if(V>=48&&V<=57){Z++;continue}if(V===46&&!$){$=!0,Z++;continue}break}let z=Y.charCodeAt(Z);if(z===69||z===101){let V=Z+1,U=Y.charCodeAt(V);if(U===43||U===45)V++;let D=!1;while(V<X){let N=Y.charCodeAt(V);if(N>=48&&N<=57){V++,D=!0;continue}break}if(D)Z=V}return{type:"Dimension",value:Y.slice(J,Z),unit:Y.slice(Z,X),loc:M.positions?R(M,J,X):null}}case 1:return M.pos++,{type:"Identifier",name:a(Y,J,X),loc:M.positions?R(M,J,X):null};case 5:{M.pos++;let Z=J+1,$=X-J>=2&&Y.charCodeAt(X-1)===Y.charCodeAt(J)?X-1:X;return{type:"String",value:s(Y,Z,$),loc:M.positions?R(M,J,X):null}}case 7:{M.pos++;let Z=J+4;while(Z<X&&VM(Y.charCodeAt(Z)))Z++;let F=X;if(F>Z&&Y.charCodeAt(F-1)===41)F--;while(F>Z&&VM(Y.charCodeAt(F-1)))F--;let $;if(F-Z>=2){let z=Y.charCodeAt(Z),V=Y.charCodeAt(F-1);if((z===34||z===39)&&z===V)$=Y.slice(Z+1,F-1);else $=Y.slice(Z,F)}else $=Y.slice(Z,F);return{type:"Url",value:$,loc:M.positions?R(M,J,X):null}}case 4:return M.pos++,{type:"Hash",name:Y.slice(J+1,X),loc:M.positions?R(M,J,X):null};case 2:return pM(M);case 21:return aM(M);case 18:return M.pos++,{type:"Operator",value:",",loc:M.positions?R(M,J,X):null};case 16:return M.pos++,{type:"Operator",value:":",loc:M.positions?R(M,J,X):null};case 9:{M.pos++;let Z=Y.charCodeAt(J),F=Y[J];if(TM(Z))return{type:"Operator",value:F,loc:M.positions?R(M,J,X):null};return{type:"Identifier",name:F,loc:M.positions?R(M,J,X):null}}case 19:{M.pos++;let Z=O();while(q(M)!==0&&q(M)!==20){let $=m(M);if($)Z.appendData($)}let F=M.pos<M.end?M.ends[M.pos]:X;if(q(M)===20)M.pos++;return{type:"Brackets",children:Z,loc:M.positions?R(M,J,F):null}}case 3:case 23:case 24:case 22:case 20:case 17:case 0:case 14:case 15:case 6:case 8:return M.pos++,{type:"Raw",value:Y.slice(J,X),loc:M.positions?R(M,J,X):null}}return M.pos++,null}function VM(M){return M===32||M===9||M===10||M===12||M===13}function TM(M){return M===47||M===43||M===45||M===42||M===61||M===62||M===60||M===126||M===124||M===36||M===94||M===33||M===38}function c(M,Q,G){for(let J=Q;J<G;J++){let X=M.charCodeAt(J);if(X>=65&&X<=90)return M.slice(Q,G).toLowerCase()}return M.slice(Q,G)}function R(M,Q,G){let J=M.tokenizer.locate(Q),X=M.tokenizer.locate(G);return{source:M.filename??"<unknown>",start:{offset:Q,line:J.line,column:J.column},end:{offset:G,line:X.line,column:X.column}}}function pM(M){let Q=_(M),G=c(M.source,Q.start,Q.end-1),J=O();while(q(M)!==0&&q(M)!==22){let X=m(M);if(X)J.appendData(X)}if(q(M)===22)_(M);if(G==="url"){for(let X=J.head;X!=null;X=X.next)if(X.data.type==="String")return{type:"Url",value:X.data.value,loc:B(M,Q,H(M))}}return{type:"Function",name:G,children:J,loc:B(M,Q,H(M))}}function aM(M){let Q=_(M),G=O();while(q(M)!==0&&q(M)!==22){let J=m(M);if(J)G.appendData(J)}if(q(M)===22)_(M);return{type:"Parentheses",children:G,loc:B(M,Q,H(M))}}function XM(M){let Q=H(M),G=O();while(q(M)!==0){if(b(M),q(M)===0||q(M)===23)break;let J=OM(M);if(J.children.head!==null)G.appendData(J);if(b(M),q(M)===18){_(M);continue}break}return{type:"SelectorList",children:G,loc:B(M,Q,H(M))}}function OM(M){let Q=H(M),G=O(),J=!0;while(q(M)!==0&&q(M)!==18&&q(M)!==23){let X=H(M);if(X.type===13){if(_(M),!J&&q(M)!==0&&q(M)!==18&&q(M)!==23&&!BM(M)&&!dM(M)){let Z={type:"Combinator",name:" ",loc:B(M,X,X)};G.appendData(Z),J=!0}continue}if(X.type===9&&M.source.charCodeAt(X.start)===124&&M.types[M.pos+1]===9&&M.source.charCodeAt(M.starts[M.pos+1])===124){let Z=H(M);_(M);let F=_(M),$={type:"Combinator",name:"||",loc:B(M,Z,F)};G.appendData($),J=!0,b(M);continue}if(BM(M)){let Z=_(M),$={type:"Combinator",name:M.source[Z.start],loc:B(M,Z,Z)};G.appendData($),J=!0,b(M);continue}let Y=cM(M);if(!Y)break;G.appendData(Y),J=!1}while(G.tail&&G.tail.data.type==="Combinator")G.remove(G.tail);return{type:"Selector",children:G,loc:B(M,Q,H(M))}}function BM(M){let Q=H(M);if(Q.type!==9)return!1;let G=M.source[Q.start];return G===">"||G==="+"||G==="~"}function dM(M){if(M.types[M.pos]!==9)return!1;if(M.source.charCodeAt(M.starts[M.pos])!==124)return!1;if(M.types[M.pos+1]!==9)return!1;return M.source.charCodeAt(M.starts[M.pos+1])===124}function cM(M){let Q=H(M);switch(Q.type){case 1:{if(_(M),q(M)===9&&M.source[H(M).start]==="|"&&M.source[H(M).start+1]!=="="&&!(M.types[M.pos+1]===9&&M.source.charCodeAt(M.starts[M.pos+1])===124)){if(_(M),q(M)===1){let J=_(M);return{type:"TypeSelector",name:`${E(M,Q)}|${E(M,J)}`,loc:B(M,Q,J)}}if(q(M)===9&&M.source[H(M).start]==="*"){let J=_(M);return{type:"TypeSelector",name:`${E(M,Q)}|*`,loc:B(M,Q,J)}}}return{type:"TypeSelector",name:E(M,Q),loc:B(M,Q,Q)}}case 11:return _(M),{type:"TypeSelector",name:E(M,Q),loc:B(M,Q,Q)};case 10:return _(M),{type:"TypeSelector",name:E(M,Q),loc:B(M,Q,Q)};case 9:{let G=M.source[Q.start];if(G==="*")return _(M),{type:"TypeSelector",name:"*",loc:B(M,Q,Q)};if(G==="."){if(_(M),q(M)===1){let J=_(M);return{type:"ClassSelector",name:E(M,J),loc:B(M,Q,J)}}return null}if(G==="&")return _(M),{type:"NestingSelector",loc:B(M,Q,Q)};return _(M),null}case 4:return _(M),{type:"IdSelector",name:M.source.slice(Q.start+1,Q.end),loc:B(M,Q,Q)};case 16:{_(M);let G=q(M)===16;if(G)_(M);return rM(M,G,Q)}case 19:return iM(M)}return null}function rM(M,Q,G){let J=H(M);if(J.type===1){_(M);let X=c(M.source,J.start,J.end);return Q?{type:"PseudoElementSelector",name:X,children:null,loc:B(M,G,J)}:{type:"PseudoClassSelector",name:X,children:null,loc:B(M,G,J)}}if(J.type===2){_(M);let X=c(M.source,J.start,J.end-1),Y=O();if(!Q&&vM.has(X)){let $=H(M),z=$,V=1;while(q(M)!==0&&V>0){if(q(M)===21||q(M)===2)V++;else if(q(M)===22){if(V--,V===0)break}z=_(M)}if(q(M)===22)_(M);let U=M.source.slice($.start,z.end).trim();if(U.length>0){let D=DM(U,{positions:!1}),N=XM(D);Y.appendData(N)}}else{while(q(M)!==0&&q(M)!==22){let $=m(M);if($)Y.appendData($)}if(q(M)===22)_(M)}if(Q)return{type:"PseudoElementSelector",name:X,children:Y,loc:B(M,G,H(M))};return{type:"PseudoClassSelector",name:X,children:Y,loc:B(M,G,H(M))}}return null}function iM(M){let Q=_(M);b(M);let G=H(M);if(G.type!==1)return null;_(M);let J={type:"Identifier",name:E(M,G),loc:B(M,G,G)};b(M);let X=null,Y=null,Z=null,F=H(M);if(F.type===9){let z=M.source[F.start],V=M.source[F.start+1];if(z==="=")X="=",_(M);else if((z==="~"||z==="|"||z==="^"||z==="$"||z==="*")&&V==="="){_(M);let N=H(M);if(N.type===9&&M.source[N.start]==="=")_(M),X=`${z}=`}b(M);let U=H(M);if(U.type===5){_(M);let N=U.end-U.start>=2&&M.source.charCodeAt(U.end-1)===M.source.charCodeAt(U.start);Y={type:"String",value:s(M.source,U.start+1,N?U.end-1:U.end),loc:B(M,U,U)}}else if(U.type===1)_(M),Y={type:"Identifier",name:E(M,U),loc:B(M,U,U)};b(M);let D=H(M);if(D.type===1)_(M),Z=E(M,D)}b(M);let $=H(M);if(q(M)===20)$=_(M);return{type:"AttributeSelector",name:J,matcher:X,value:Y,flags:Z,loc:B(M,Q,$)}}var LM=Symbol("walkSkip"),W=Symbol("walkStop");function nM(M){return{root:M,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null}}function oM(M,Q){let G=nM(M),J=typeof Q==="function"?Q:Q.enter,X=typeof Q==="function"?null:Q.leave??null,Y=typeof Q==="function"?null:Q.visit??null,Z=typeof Q==="function"?!1:Q.reverse??!1;function F($,z,V){let U=null,D;switch($.type){case"StyleSheet":U="stylesheet",D=G.stylesheet,G.stylesheet=$;break;case"Atrule":U="atrule",D=G.atrule,G.atrule=$;break;case"AtrulePrelude":U="atrulePrelude",D=G.atrulePrelude,G.atrulePrelude=$;break;case"Rule":U="rule",D=G.rule,G.rule=$;break;case"Selector":U="selector",D=G.selector,G.selector=$;break;case"Block":U="block",D=G.block,G.block=$;break;case"Declaration":U="declaration",D=G.declaration,G.declaration=$;break;case"Function":U="function",D=G.function,G.function=$;break}let N;if((Y===null||Y===$.type)&&J){let x=J.call(G,$,z,V);if(x===LM){if(U)G[U]=D;return}if(x===W){if(U)G[U]=D;return W}}if(N=tM($,Z,F),N===W){if(U)G[U]=D;return W}if((Y===null||Y===$.type)&&X){if(X.call(G,$,z,V)===W){if(U)G[U]=D;return W}}if(U)G[U]=D;return}return F(M,null,null)}var wM=Object.assign(oM,{skip:LM,stop:W});function tM(M,Q,G){if("children"in M&&M.children instanceof j)return sM(M.children,Q,G);if(M.type==="Rule"){if(G(M.prelude,null,null)===W)return W;if(G(M.block,null,null)===W)return W;return}if(M.type==="Atrule"){if(M.prelude){if(G(M.prelude,null,null)===W)return W}if(M.block){if(G(M.block,null,null)===W)return W}return}if(M.type==="Declaration")return G(M.value,null,null);if(M.type==="AttributeSelector"){if(G(M.name,null,null)===W)return W;if(M.value)return G(M.value,null,null);return}return}function sM(M,Q,G){let J;if(Q)M.forEachRight((X,Y,Z)=>{if(J)return;if(G(X,Y,Z)===W)J=W});else M.forEach((X,Y,Z)=>{if(J)return;if(G(X,Y,Z)===W)J=W});return J}export{j as q,$M as r,FM as s,g as t,p as u,T as v,a as w,WM as x,wM as y,MQ as z};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{c}from"./chunk-vbjv9wf0.js";var P={};c(P,{IgnoreCaseMode:()=>E,isTraversal:()=>x,parse:()=>r,stringify:()=>f});var T=/(?:\\(?:[\dA-Fa-f]{1,6} ?|[^])|[\w\-\u00B0-\uFFFF])+/y,_=/\\([\dA-Fa-f]{1,6} ?|[^])/g;function j(e){return e.replace(_,(a,i)=>{if(i.length>1&&/^[\dA-Fa-f]/.test(i)){let u=Number.parseInt(i,16);if(u>=55296&&u<=57343)return"\uFFFD";return String.fromCodePoint(u)}return i})}function O(e){return e.indexOf("\\")<0?e:j(e)}var U=new Set(["accept","accept-charset","align","alink","axis","bgcolor","charset","checked","clear","codetype","color","compact","declare","defer","dir","direction","disabled","enctype","face","frame","hreflang","http-equiv","lang","language","link","media","method","multiple","nohref","noresize","noshade","nowrap","readonly","rel","rev","rules","scope","scrolling","selected","shape","target","text","type","valign","valuetype","vlink"]);function L(e){switch(e){case 126:return"element";case 94:return"start";case 36:return"end";case 42:return"any";case 33:return"not";case 124:return"hyphen";default:return null}}function w(e){return e===32||e===9||e===10||e===13||e===12}function r(e,a={}){let i=[],u=R(i,e,a,0);if(u<e.length)throw Error(`Unmatched selector: ${e.slice(u)}`);return i}function h(e,a){T.lastIndex=a;let i=T.exec(e);if(!i)throw Error(`Expected name, found ${e.slice(a)}`);return{value:O(i[0]),end:a+i[0].length}}function C(e,a){while(a<e.length&&w(e.charCodeAt(a)))a++;return a}function R(e,a,i,u){let o=[],t=C(a,u),n=a.length,d=i.xmlMode===!0,p=i.lowerCaseAttributeNames!==!1&&!d,m=i.lowerCaseTags!==!1;while(t<n){let l=a.charCodeAt(t);if(w(l)){let s=t+1;while(s<n&&w(a.charCodeAt(s)))s++;if(o.length===0)return s;t=s,A(o,"descendant");continue}if(l===62||l===60||l===126||l===43||l===124){let s=t+1;while(s<n&&w(a.charCodeAt(s)))s++;switch(t=s,l){case 62:A(o,"child");break;case 60:A(o,"parent");break;case 126:A(o,"sibling");break;case 43:A(o,"adjacent");break;case 124:if(t<n&&a.charCodeAt(t)===124)t++,t=C(a,t),A(o,"column-combinator");else o.push({type:"tag",name:"",namespace:""});break}continue}if(l===44){if(o.length===0)throw Error("Empty sub-selector");e.push(o),o=[],t=C(a,t+1);continue}if(l===47&&a.charCodeAt(t+1)===42){let s=a.indexOf("*/",t+2);if(s<0)throw Error("Unmatched comment");t=C(a,s+2);continue}if(l===42){t++,o.push({type:"universal",namespace:null});continue}if(l===35){let s=h(a,t+1);t=s.end,o.push({type:"attribute",name:"id",action:"equals",value:s.value,namespace:null,ignoreCase:!1});continue}if(l===46){let s=h(a,t+1);t=s.end,o.push({type:"attribute",name:"class",action:"element",value:s.value,namespace:null,ignoreCase:!1});continue}if(l===91){t=F(a,t,o,i,d,p);continue}if(l===58){t=M(a,t,o,i);continue}if(l===124){t++;let s=h(a,t);t=s.end,o.push({type:"tag",name:m?s.value.toLowerCase():s.value,namespace:""});continue}{let s=h(a,t);if(t=s.end,t<n&&a.charCodeAt(t)===124&&a.charCodeAt(t+1)!==61){t++;let b=h(a,t);t=b.end,o.push({type:"tag",name:m?b.value.toLowerCase():b.value,namespace:s.value})}else o.push({type:"tag",name:m?s.value.toLowerCase():s.value,namespace:null})}}if(o.length>0)e.push(o);return t}function F(e,a,i,u,o,t){let n=a+1,d=e.length,p;if(e.charCodeAt(n)===124)throw Error("Empty namespace not supported");if(e.charCodeAt(n)===42&&e.charCodeAt(n+1)===124){n+=2;let g=h(e,n);n=g.end,p=g.value}else{let g=h(e,n);if(n=g.end,p=g.value,e.charCodeAt(n)===124&&e.charCodeAt(n+1)!==61){n++;let y=h(e,n);n=y.end,p=y.value}}n=C(e,n);let m="exists",l="",s=null,b=e.charCodeAt(n);if(b===61)m="equals",n++;else if(b===33&&e.charCodeAt(n+1)===61)m="not",n+=2;else{let g=L(b);if(g!==null&&e.charCodeAt(n+1)===61)m=g,n+=2}if(m!=="exists"){n=C(e,n);let g=e.charCodeAt(n);if(g===34||g===39){let S=q(e,n+1,g);l=O(e.slice(n+1,S)),n=S+1}else{let S=h(e,n);l=S.value,n=S.end}n=C(e,n);let y=e.charCodeAt(n);if(y===105||y===73)s=!0,n++;else if(y===115||y===83)s=!1,n++}if(e.charCodeAt(n)!==93)throw Error("Expected ]");if(n++,s===null&&!o&&U.has(p.toLowerCase()))s="quirks";return i.push({type:"attribute",name:t?p.toLowerCase():p,action:m,value:l,namespace:null,ignoreCase:s}),n}function M(e,a,i,u){if(e.charCodeAt(a+1)===58){let d=a+2,p=h(e,d);d=p.end;let m=p.value.toLowerCase(),l=null;if(e.charCodeAt(d)===40){let s=I(e,d);l=e.slice(d+1,s).trim(),d=s+1}return i.push({type:"pseudo-element",name:m,data:l}),d}let o=a+1,t=h(e,o);o=t.end;let n=t.value.toLowerCase();if(e.charCodeAt(o)===40){let d=I(e,o),p=e.slice(o+1,d);if(o=d+1,n==="is"||n==="not"||n==="where"||n==="has"||n==="matches"||n==="-moz-any"||n==="-webkit-any"){let m=[];R(m,p.trim(),u,0),i.push({type:"pseudo",name:n,data:m})}else i.push({type:"pseudo",name:n,data:p.trim()})}else i.push({type:"pseudo",name:n,data:null});return o}function A(e,a){if(e.length>0&&e[e.length-1].type==="descendant"&&a!=="descendant")e.pop();if(e.length>0&&e[e.length-1].type===a)return;e.push({type:a})}function q(e,a,i){let u=a,o=e.length;while(u<o){let t=e.charCodeAt(u);if(t===92){u+=2;continue}if(t===i)return u;u++}throw Error("Unterminated string")}function I(e,a){let i=1,u=a+1,o=e.length;while(u<o){let t=e.charCodeAt(u);if(t===92){u+=2;continue}if(t===34||t===39){u=q(e,u+1,t)+1;continue}if(t===40)i++;else if(t===41){if(i--,i===0)return u}u++}throw Error("Unterminated parenthesis")}var D={child:" > ",parent:" < ",sibling:" ~ ",adjacent:" + ",descendant:" ","column-combinator":" || "};function f(e){return e.map(z).join(", ")}function z(e){return e.map((a,i)=>B(a,e[i-1])).join("")}function B(e,a){switch(e.type){case"tag":return`${N(e.namespace)}${v(e.name)}`;case"universal":return`${N(e.namespace)}*`;case"attribute":{if(e.name==="id"&&e.action==="equals"&&!e.ignoreCase&&!e.namespace)return`#${v(e.value)}`;if(e.name==="class"&&e.action==="element"&&!e.ignoreCase&&!e.namespace)return`.${v(e.value)}`;let i=`[${N(e.namespace)}${v(e.name)}`;if(e.action!=="exists"){let u=K[e.action]??"=";if(i+=u,i+=`"${e.value.replace(/"/g,"\\\"")}"`,e.ignoreCase===!0)i+=" i";else if(e.ignoreCase===!1)i+=" s"}return i+="]",i}case"pseudo":if(e.data===null)return`:${e.name}`;if(typeof e.data==="string")return`:${e.name}(${e.data})`;return`:${e.name}(${f(e.data)})`;case"pseudo-element":return e.data===null?`::${e.name}`:`::${e.name}(${e.data})`;case"descendant":case"child":case"parent":case"sibling":case"adjacent":case"column-combinator":return D[e.type]??" "}return""}var K={equals:"=",element:"~=",start:"^=",end:"$=",any:"*=",not:"!=",hyphen:"|="};function N(e){if(e===null)return"";if(e==="")return"|";return`${v(e)}|`}var Q=/[^\w\u00B0-\uFFFF-]/g;function v(e){if(e==="")return"";return e.replace(Q,(a)=>`\\${a}`)}var V=new Set(["adjacent","child","descendant","parent","sibling","column-combinator"]);function x(e){return V.has(e.type)}var E={Unknown:null,QuirksMode:"quirks",IgnoreCase:!0,CaseSensitive:!1};export{r,f,x,E,P};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{A as M}from"./chunk-2wsah70r.js";import{F as l}from"./chunk-1kmkypmr.js";var n={};l(n,{selectOne:()=>s,selectAll:()=>p,parseAndCompile:()=>Y,is:()=>o,compile:()=>O,clearSelectorCache:()=>r});function E(V,K,z,Z){let $=[],j=[K],J=[0];for(;;){if(J[0]>=j[0].length){if(j.length===1)return $;j.shift(),J.shift();continue}let X=j[0][J[0]++];if(!z.isTag(X))continue;if(V(X))$.push(X);if(Z||z.getName(X)!=="template"){let Q=z.getChildren(X);if(Q.length>0)j.unshift(Q),J.unshift(0)}}}function L(V,K,z,Z){let $=[K],j=[0];for(;;){if(j[0]>=$[0].length){if($.length===1)return null;$.shift(),j.shift();continue}let J=$[0][j[0]++];if(!z.isTag(J))continue;if(V(J))return J;if(Z||z.getName(J)!=="template"){let X=z.getChildren(J);if(X.length>0)$.unshift(X),j.unshift(0)}}}function W(V,K){if(Array.isArray(V))return K.removeSubsets(V);return K.getChildren(V)}var D=(V)=>{return!0};function _(V){return V===32||V===9||V===10||V===12||V===13}function I(V,K){let z=K.length,Z=V.length;if(z===0||z>Z)return!1;let $=V.indexOf(K);while($>=0){let j=$===0||_(V.charCodeAt($-1)),J=$+z,X=J===Z||_(V.charCodeAt(J));if(j&&X)return!0;$=V.indexOf(K,$+1)}return!1}function S(V,K,z){if(K.ignoreCase===!0)return!0;if(K.ignoreCase===!1)return!1;if(K.ignoreCase==="quirks")return!z.xmlMode;return!1}function w(V,K,z){let Z=K.adapter,$=V.action,j=V.name,J=V.value,X=S(J,V,K);if(X)J=J.toLowerCase();return g($,j,J,X,Z,z)}function g(V,K,z,Z,$,j){let J=j===D;switch(V){case"exists":if(J)return(X)=>$.hasAttrib(X,K);return(X)=>$.hasAttrib(X,K)&&j(X);case"equals":if(!Z){if(J)return(X)=>$.getAttributeValue(X,K)===z;return(X)=>$.getAttributeValue(X,K)===z&&j(X)}if(J)return(X)=>{let Q=$.getAttributeValue(X,K);if(Q==null)return!1;return Q.toLowerCase()===z};return(X)=>{let Q=$.getAttributeValue(X,K);if(Q==null)return!1;return Q.toLowerCase()===z&&j(X)};case"not":return(X)=>{let Q=$.getAttributeValue(X,K);if(Q==null)return j(X);return(Z?Q.toLowerCase():Q)!==z&&j(X)};case"start":if(z==="")return()=>!1;if(J)return(X)=>{let Q=$.getAttributeValue(X,K);if(Q==null)return!1;return(Z?Q.toLowerCase():Q).startsWith(z)};return(X)=>{let Q=$.getAttributeValue(X,K);if(Q==null)return!1;return(Z?Q.toLowerCase():Q).startsWith(z)&&j(X)};case"end":if(z==="")return()=>!1;if(J)return(X)=>{let Q=$.getAttributeValue(X,K);if(Q==null)return!1;return(Z?Q.toLowerCase():Q).endsWith(z)};return(X)=>{let Q=$.getAttributeValue(X,K);if(Q==null)return!1;return(Z?Q.toLowerCase():Q).endsWith(z)&&j(X)};case"any":{if(z==="")return()=>!1;if(Z){if(J)return(X)=>{let Q=$.getAttributeValue(X,K);if(Q==null)return!1;return Q.toLowerCase().indexOf(z)>=0};return(X)=>{let Q=$.getAttributeValue(X,K);if(Q==null)return!1;return Q.toLowerCase().indexOf(z)>=0&&j(X)}}if(J)return(X)=>{let Q=$.getAttributeValue(X,K);if(Q==null)return!1;return Q.indexOf(z)>=0};return(X)=>{let Q=$.getAttributeValue(X,K);if(Q==null)return!1;return Q.indexOf(z)>=0&&j(X)}}case"element":{if(z===""||/\s/.test(z))return()=>!1;if(Z){if(J)return(X)=>{let Q=$.getAttributeValue(X,K);if(Q==null)return!1;return I(Q.toLowerCase(),z)};return(X)=>{let Q=$.getAttributeValue(X,K);if(Q==null)return!1;return I(Q.toLowerCase(),z)&&j(X)}}if(J)return(X)=>{let Q=$.getAttributeValue(X,K);if(Q==null)return!1;return I(Q,z)};return(X)=>{let Q=$.getAttributeValue(X,K);if(Q==null)return!1;return I(Q,z)&&j(X)}}case"hyphen":if(J)return(X)=>{let Q=$.getAttributeValue(X,K);if(Q==null)return!1;let H=Z?Q.toLowerCase():Q;if(H===z)return!0;if(H.startsWith(z)&&H.charAt(z.length)==="-")return!0;return!1};return(X)=>{let Q=$.getAttributeValue(X,K);if(Q==null)return!1;let H=Z?Q.toLowerCase():Q;if(H===z)return j(X);if(H.startsWith(z)&&H.charAt(z.length)==="-")return j(X);return!1}}return(X)=>{return!1}}var b=new Set(["link","any-link","visited","hover","active","focus","focus-visible","focus-within","target","target-within","enabled","disabled","checked","required","optional","valid","invalid","selected","placeholder-shown","read-only","read-write","in-range","out-of-range","default","indeterminate"]),f=new Set(["is","where","matches","-moz-any","-webkit-any"]),k=new Set(["nth-child","nth-last-child","nth-of-type","nth-last-of-type"]);function y(V,K,z){let Z=K.adapter,$=V.name,j=V.data;if(V.type==="pseudo"&&f.has($)){if(!Array.isArray(j))return z;let J=j.map((X)=>Y(X,K));if(J.length===1){let X=J[0];return(Q)=>X(Q)&&z(Q)}return(X)=>{for(let Q of J)if(Q(X))return z(X);return!1}}if(V.type==="pseudo"&&$==="not"){if(!Array.isArray(j))return z;let J=j.map((X)=>Y(X,K));if(J.length===1){let X=J[0];return(Q)=>!X(Q)&&z(Q)}return(X)=>{for(let Q of J)if(Q(X))return!1;return z(X)}}if(V.type==="pseudo"&&$==="has"){if(!Array.isArray(j))return z;let J=j.map((Q)=>Y(Q,K)),X=J.length===1?J[0]:(Q)=>{for(let H of J)if(H(Q))return!0;return!1};return(Q)=>{let H=Z.getChildren(Q).slice();while(H.length>0){let B=H.pop();if(!Z.isTag(B))continue;if(X(B))return z(Q);let N=Z.getChildren(B);for(let F=0;F<N.length;F++)H.push(N[F])}return!1}}if(V.type==="pseudo"&&k.has($)){let J=u(typeof j==="string"?j:"",$,K);return(X)=>J(X)&&z(X)}if(V.type==="pseudo"&&$==="first-child")return(J)=>{let X=Z.getSiblings(J);for(let Q of X){if(!Z.isTag(Q))continue;return Q===J&&z(J)}return!1};if(V.type==="pseudo"&&$==="last-child")return(J)=>{let X=Z.getSiblings(J);for(let Q=X.length-1;Q>=0;Q--){let H=X[Q];if(!Z.isTag(H))continue;return H===J&&z(J)}return!1};if(V.type==="pseudo"&&$==="first-of-type")return(J)=>{let X=Z.getName(J),Q=Z.getSiblings(J);for(let H of Q){if(!Z.isTag(H)||Z.getName(H)!==X)continue;return H===J&&z(J)}return!1};if(V.type==="pseudo"&&$==="last-of-type")return(J)=>{let X=Z.getName(J),Q=Z.getSiblings(J);for(let H=Q.length-1;H>=0;H--){let B=Q[H];if(!Z.isTag(B)||Z.getName(B)!==X)continue;return B===J&&z(J)}return!1};if(V.type==="pseudo"&&$==="only-child")return(J)=>{let X=Z.getSiblings(J),Q=0,H=!1;for(let B of X){if(!Z.isTag(B))continue;if(Q++,Q>1)return!1;if(B===J)H=!0}return Q===1&&H&&z(J)};if(V.type==="pseudo"&&$==="only-of-type")return(J)=>{let X=Z.getName(J),Q=Z.getSiblings(J),H=0,B=!1;for(let N of Q){if(!Z.isTag(N)||Z.getName(N)!==X)continue;if(H++,H>1)return!1;if(N===J)B=!0}return H===1&&B&&z(J)};if(V.type==="pseudo"&&$==="empty")return(J)=>Z.getChildren(J).length===0&&z(J);if(V.type==="pseudo"&&$==="root")return(J)=>{let X=Z.getParent(J);return(X==null||!Z.isTag(X))&&z(J)};if(V.type==="pseudo"&&$==="scope"){if(K.context&&Array.isArray(K.context)){let J=new Set(K.context);return(X)=>J.has(X)&&z(X)}if(K.context){let J=K.context;return(X)=>X===J&&z(X)}return(J)=>{let X=Z.getParent(J);return(X==null||!Z.isTag(X))&&z(J)}}if(V.type==="pseudo"&&b.has($)){if(K.pseudos&&K.pseudos[$]){let J=K.pseudos[$];if(typeof J==="function")return(X)=>J(X,void 0)&&z(X)}return(J)=>{return!1}}if(V.type==="pseudo-element")return z;if(K.pseudos&&K.pseudos[$]){let J=K.pseudos[$];if(typeof J==="function")return(X)=>J(X,typeof j==="string"?j:void 0)&&z(X);if(typeof J==="string"){let X=M(J),Q=G(X,K);return(H)=>Q(H)&&z(H)}}return(J)=>{return!1}}function v(V){let K=V.trim();if(K==="odd")return{a:2,b:1};if(K==="even")return{a:2,b:0};let z=/^([+-]?\d*)n([+-]\d+)?$/.exec(K.replace(/\s+/g,""));if(z){let $=z[1]===""||z[1]==="+"?1:z[1]==="-"?-1:Number(z[1]),j=z[2]?Number(z[2]):0;return{a:$,b:j}}let Z=Number(K);if(!Number.isNaN(Z))return{a:0,b:Z};return null}function u(V,K,z){let Z=v(V);if(!Z)return()=>!1;let{a:$,b:j}=Z,J=z.adapter,X=K==="nth-of-type"||K==="nth-last-of-type",Q=K==="nth-last-child"||K==="nth-last-of-type";return(H)=>{let B=J.getSiblings(H),N=X?J.getName(H):"",F=0,P=0;for(let U of B){if(!J.isTag(U))continue;if(X&&J.getName(U)!==N)continue;if(P++,U===H)F=P}if(F===0)return!1;let R=Q?P-F+1:F;if($===0)return R===j;return(R-j)/$>=0&&(R-j)%$===0}}function A(V,K,z){let Z=K.adapter,$=z===D;switch(V.type){case"tag":{let j=K.lowerCaseTags!==!1&&!K.xmlMode?V.name.toLowerCase():V.name;if($)return(J)=>Z.getName(J)===j;return(J)=>Z.getName(J)===j&&z(J)}case"universal":return z;case"attribute":return w(V,K,z);case"pseudo":case"pseudo-element":return y(V,K,z);case"descendant":case"child":case"parent":case"sibling":case"adjacent":case"column-combinator":return z}return(j)=>{return!1}}var x={universal:50,tag:30,attribute:1,pseudo:0,"pseudo-element":0},m={exists:10,equals:8,not:7,start:6,end:6,hyphen:5,any:4,element:3};function T(V){let K=x[V.type]??0;if(V.type==="attribute")return K+(m[V.action]??0);return K}function G(V,K){if(V.length===1)return Y(V[0],K);let z=V.map((Z)=>Y(Z,K));return(Z)=>z.some(($)=>$(Z))}function Y(V,K){let z=K.adapter,Z=[[]],$=[];for(let J of V)if(J.type==="descendant"||J.type==="child"||J.type==="sibling"||J.type==="adjacent"||J.type==="parent"||J.type==="column-combinator")$.push(J),Z.push([]);else Z[Z.length-1].push(J);let j=D;for(let J=0;J<Z.length;J++){let X=Z[J].slice().sort((Q,H)=>T(Q)-T(H));for(let Q of X)j=A(Q,K,j);if(J<$.length)j=c($[J],j,z)}return j}function c(V,K,z){switch(V.type){case"descendant":case"column-combinator":return(Z)=>{let $=z.getParent(Z);while($){if(z.isTag($)&&K($))return!0;$=z.getParent($)}return!1};case"child":return(Z)=>{let $=z.getParent(Z);return $!=null&&z.isTag($)&&K($)};case"sibling":return(Z)=>{let $=z.getSiblings(Z);for(let j of $){if(j===Z)return!1;if(z.isTag(j)&&K(j))return!0}return!1};case"adjacent":return(Z)=>{let $=z.getSiblings(Z),j=null;for(let J of $){if(J===Z)return j!=null&&z.isTag(j)&&K(j);j=J}return!1};case"parent":return(Z)=>z.existsOne(K,z.getChildren(Z))}return(Z)=>{return!1}}function h(V){if(!V||!V.adapter)throw Error("css-select: adapter is required");return V.adapter}var q=new WeakMap;function d(V){return(V.xmlMode?1:0)<<0|(V.lowerCaseAttributeNames===!1?1:0)<<1|(V.lowerCaseTags===!1?1:0)<<2}function i(V,K){let z=q.get(V);if(!z)z=[],q.set(V,z);let Z=z[K];if(!Z)Z=new Map,z[K]=Z;return Z}function C(V,K){let z=M(V,{xmlMode:K.xmlMode,lowerCaseAttributeNames:K.lowerCaseAttributeNames,lowerCaseTags:K.lowerCaseTags});return G(z,K)}function O(V,K){if(typeof V!=="string")return G(V,K);if(K.cacheResults===!1||!K.adapter)return C(V,K);let z=i(K.adapter,d(K)),Z=z.get(V);if(Z!==void 0)return Z;return Z=C(V,K),z.set(V,Z),Z}function r(V,K){if(K===void 0){q.delete(V);return}let z=q.get(V);if(!z)return;for(let Z of z)if(Z)Z.delete(K)}function p(V,K,z){let Z=h(z),$=typeof V==="function"?V:O(V,z),j=W(K,Z);return E($,j,Z,z.xmlMode===!0)}function s(V,K,z){let Z=h(z),$=typeof V==="function"?V:O(V,z),j=W(K,Z);return L($,j,Z,z.xmlMode===!0)}function o(V,K,z){return(typeof K==="function"?K:O(K,z))(V)}export{Y as a,O as b,r as c,p as d,s as e,o as f,n as g};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{r}from"./chunk-b44sfqdn.js";import{c}from"./chunk-vbjv9wf0.js";var C={};c(C,{clearSelectorCache:()=>O,compile:()=>g,is:()=>w,parseAndCompile:()=>i,selectAll:()=>v,selectOne:()=>R});function x(u,o,t,l){let a=[],d=[o],n=[0];for(;;){if(n[0]>=d[0].length){if(d.length===1)return a;d.shift(),n.shift();continue}let e=d[0][n[0]++];if(!t.isTag(e))continue;if(u(e))a.push(e);if(l||t.getName(e)!=="template"){let s=t.getChildren(e);if(s.length>0)d.unshift(s),n.unshift(0)}}}function L(u,o,t,l){let a=[o],d=[0];for(;;){if(d[0]>=a[0].length){if(a.length===1)return null;a.shift(),d.shift();continue}let n=a[0][d[0]++];if(!t.isTag(n))continue;if(u(n))return n;if(l||t.getName(n)!=="template"){let e=t.getChildren(n);if(e.length>0)a.unshift(e),d.unshift(0)}}}function Q(u,o){if(Array.isArray(u))return o.removeSubsets(u);return o.getChildren(u)}var y=(u)=>!0;function V(u){return u===32||u===9||u===10||u===12||u===13}function h(u,o){let t=o.length,l=u.length;if(t===0||t>l)return!1;let a=u.indexOf(o);while(a>=0){let d=a===0||V(u.charCodeAt(a-1)),n=a+t,e=n===l||V(u.charCodeAt(n));if(d&&e)return!0;a=u.indexOf(o,a+1)}return!1}function q(u,o,t){if(o.ignoreCase===!0)return!0;if(o.ignoreCase===!1)return!1;if(o.ignoreCase==="quirks")return!t.xmlMode;return!1}function P(u,o,t){let l=o.adapter,{action:a,name:d,value:n}=u,e=q(n,u,o);if(e)n=n.toLowerCase();return D(a,d,n,e,l,t)}function D(u,o,t,l,a,d){let n=d===y;switch(u){case"exists":if(n)return(e)=>a.hasAttrib(e,o);return(e)=>a.hasAttrib(e,o)&&d(e);case"equals":if(!l){if(n)return(e)=>a.getAttributeValue(e,o)===t;return(e)=>a.getAttributeValue(e,o)===t&&d(e)}if(n)return(e)=>{let s=a.getAttributeValue(e,o);if(s==null)return!1;return s.toLowerCase()===t};return(e)=>{let s=a.getAttributeValue(e,o);if(s==null)return!1;return s.toLowerCase()===t&&d(e)};case"not":return(e)=>{let s=a.getAttributeValue(e,o);if(s==null)return d(e);return(l?s.toLowerCase():s)!==t&&d(e)};case"start":if(t==="")return()=>!1;if(n)return(e)=>{let s=a.getAttributeValue(e,o);if(s==null)return!1;return(l?s.toLowerCase():s).startsWith(t)};return(e)=>{let s=a.getAttributeValue(e,o);if(s==null)return!1;return(l?s.toLowerCase():s).startsWith(t)&&d(e)};case"end":if(t==="")return()=>!1;if(n)return(e)=>{let s=a.getAttributeValue(e,o);if(s==null)return!1;return(l?s.toLowerCase():s).endsWith(t)};return(e)=>{let s=a.getAttributeValue(e,o);if(s==null)return!1;return(l?s.toLowerCase():s).endsWith(t)&&d(e)};case"any":{if(t==="")return()=>!1;if(l){if(n)return(e)=>{let s=a.getAttributeValue(e,o);if(s==null)return!1;return s.toLowerCase().indexOf(t)>=0};return(e)=>{let s=a.getAttributeValue(e,o);if(s==null)return!1;return s.toLowerCase().indexOf(t)>=0&&d(e)}}if(n)return(e)=>{let s=a.getAttributeValue(e,o);if(s==null)return!1;return s.indexOf(t)>=0};return(e)=>{let s=a.getAttributeValue(e,o);if(s==null)return!1;return s.indexOf(t)>=0&&d(e)}}case"element":{if(t===""||/\s/.test(t))return()=>!1;if(l){if(n)return(e)=>{let s=a.getAttributeValue(e,o);if(s==null)return!1;return h(s.toLowerCase(),t)};return(e)=>{let s=a.getAttributeValue(e,o);if(s==null)return!1;return h(s.toLowerCase(),t)&&d(e)}}if(n)return(e)=>{let s=a.getAttributeValue(e,o);if(s==null)return!1;return h(s,t)};return(e)=>{let s=a.getAttributeValue(e,o);if(s==null)return!1;return h(s,t)&&d(e)}}case"hyphen":if(n)return(e)=>{let s=a.getAttributeValue(e,o);if(s==null)return!1;let f=l?s.toLowerCase():s;if(f===t)return!0;if(f.startsWith(t)&&f.charAt(t.length)==="-")return!0;return!1};return(e)=>{let s=a.getAttributeValue(e,o);if(s==null)return!1;let f=l?s.toLowerCase():s;if(f===t)return d(e);if(f.startsWith(t)&&f.charAt(t.length)==="-")return d(e);return!1}}return(e)=>!1}var k=new Set(["link","any-link","visited","hover","active","focus","focus-visible","focus-within","target","target-within","enabled","disabled","checked","required","optional","valid","invalid","selected","placeholder-shown","read-only","read-write","in-range","out-of-range","default","indeterminate"]),G=new Set(["is","where","matches","-moz-any","-webkit-any"]),I=new Set(["nth-child","nth-last-child","nth-of-type","nth-last-of-type"]);function W(u,o,t){let l=o.adapter,{name:a,data:d}=u;if(u.type==="pseudo"&&G.has(a)){if(!Array.isArray(d))return t;let n=d.map((e)=>i(e,o));if(n.length===1){let e=n[0];return(s)=>e(s)&&t(s)}return(e)=>{for(let s of n)if(s(e))return t(e);return!1}}if(u.type==="pseudo"&&a==="not"){if(!Array.isArray(d))return t;let n=d.map((e)=>i(e,o));if(n.length===1){let e=n[0];return(s)=>!e(s)&&t(s)}return(e)=>{for(let s of n)if(s(e))return!1;return t(e)}}if(u.type==="pseudo"&&a==="has"){if(!Array.isArray(d))return t;let n=d.map((s)=>i(s,o)),e=n.length===1?n[0]:(s)=>{for(let f of n)if(f(s))return!0;return!1};return(s)=>{let f=l.getChildren(s).slice();while(f.length>0){let m=f.pop();if(!l.isTag(m))continue;if(e(m))return t(s);let p=l.getChildren(m);for(let N=0;N<p.length;N++)f.push(p[N])}return!1}}if(u.type==="pseudo"&&I.has(a)){let n=F(typeof d==="string"?d:"",a,o);return(e)=>n(e)&&t(e)}if(u.type==="pseudo"&&a==="first-child")return(n)=>{let e=l.getSiblings(n);for(let s of e){if(!l.isTag(s))continue;return s===n&&t(n)}return!1};if(u.type==="pseudo"&&a==="last-child")return(n)=>{let e=l.getSiblings(n);for(let s=e.length-1;s>=0;s--){let f=e[s];if(!l.isTag(f))continue;return f===n&&t(n)}return!1};if(u.type==="pseudo"&&a==="first-of-type")return(n)=>{let e=l.getName(n),s=l.getSiblings(n);for(let f of s){if(!l.isTag(f)||l.getName(f)!==e)continue;return f===n&&t(n)}return!1};if(u.type==="pseudo"&&a==="last-of-type")return(n)=>{let e=l.getName(n),s=l.getSiblings(n);for(let f=s.length-1;f>=0;f--){let m=s[f];if(!l.isTag(m)||l.getName(m)!==e)continue;return m===n&&t(n)}return!1};if(u.type==="pseudo"&&a==="only-child")return(n)=>{let e=l.getSiblings(n),s=0,f=!1;for(let m of e){if(!l.isTag(m))continue;if(s++,s>1)return!1;if(m===n)f=!0}return s===1&&f&&t(n)};if(u.type==="pseudo"&&a==="only-of-type")return(n)=>{let e=l.getName(n),s=l.getSiblings(n),f=0,m=!1;for(let p of s){if(!l.isTag(p)||l.getName(p)!==e)continue;if(f++,f>1)return!1;if(p===n)m=!0}return f===1&&m&&t(n)};if(u.type==="pseudo"&&a==="empty")return(n)=>l.getChildren(n).length===0&&t(n);if(u.type==="pseudo"&&a==="root")return(n)=>{let e=l.getParent(n);return(e==null||!l.isTag(e))&&t(n)};if(u.type==="pseudo"&&a==="scope"){if(o.context&&Array.isArray(o.context)){let n=new Set(o.context);return(e)=>n.has(e)&&t(e)}if(o.context){let n=o.context;return(e)=>e===n&&t(e)}return(n)=>{let e=l.getParent(n);return(e==null||!l.isTag(e))&&t(n)}}if(u.type==="pseudo"&&k.has(a)){if(o.pseudos&&o.pseudos[a]){let n=o.pseudos[a];if(typeof n==="function")return(e)=>n(e,void 0)&&t(e)}return(n)=>!1}if(u.type==="pseudo-element")return t;if(o.pseudos&&o.pseudos[a]){let n=o.pseudos[a];if(typeof n==="function")return(e)=>n(e,typeof d==="string"?d:void 0)&&t(e);if(typeof n==="string"){let e=r(n),s=b(e,o);return(f)=>s(f)&&t(f)}}return(n)=>!1}function Y(u){let o=u.trim();if(o==="odd")return{a:2,b:1};if(o==="even")return{a:2,b:0};let t=/^([+-]?\d*)n([+-]\d+)?$/.exec(o.replace(/\s+/g,""));if(t){let a=t[1]===""||t[1]==="+"?1:t[1]==="-"?-1:Number(t[1]),d=t[2]?Number(t[2]):0;return{a,b:d}}let l=Number(o);if(!Number.isNaN(l))return{a:0,b:l};return null}function F(u,o,t){let l=Y(u);if(!l)return()=>!1;let{a,b:d}=l,n=t.adapter,e=o==="nth-of-type"||o==="nth-last-of-type",s=o==="nth-last-child"||o==="nth-last-of-type";return(f)=>{let m=n.getSiblings(f),p=e?n.getName(f):"",N=0,A=0;for(let T of m){if(!n.isTag(T))continue;if(e&&n.getName(T)!==p)continue;if(A++,T===f)N=A}if(N===0)return!1;let S=s?A-N+1:N;if(a===0)return S===d;return(S-d)/a>=0&&(S-d)%a===0}}function M(u,o,t){let l=o.adapter,a=t===y;switch(u.type){case"tag":{let d=o.lowerCaseTags!==!1&&!o.xmlMode?u.name.toLowerCase():u.name;if(a)return(n)=>l.getName(n)===d;return(n)=>l.getName(n)===d&&t(n)}case"universal":return t;case"attribute":return P(u,o,t);case"pseudo":case"pseudo-element":return W(u,o,t);case"descendant":case"child":case"parent":case"sibling":case"adjacent":case"column-combinator":return t}return(d)=>!1}var B={universal:50,tag:30,attribute:1,pseudo:0,"pseudo-element":0},z={exists:10,equals:8,not:7,start:6,end:6,hyphen:5,any:4,element:3};function U(u){let o=B[u.type]??0;if(u.type==="attribute")return o+(z[u.action]??0);return o}function b(u,o){if(u.length===1)return i(u[0],o);let t=u.map((l)=>i(l,o));return(l)=>t.some((a)=>a(l))}function i(u,o){let t=o.adapter,l=[[]],a=[];for(let n of u)if(n.type==="descendant"||n.type==="child"||n.type==="sibling"||n.type==="adjacent"||n.type==="parent"||n.type==="column-combinator")a.push(n),l.push([]);else l[l.length-1].push(n);let d=y;for(let n=0;n<l.length;n++){let e=l[n].slice().sort((s,f)=>U(s)-U(f));for(let s of e)d=M(s,o,d);if(n<a.length)d=H(a[n],d,t)}return d}function H(u,o,t){switch(u.type){case"descendant":case"column-combinator":return(l)=>{let a=t.getParent(l);while(a){if(t.isTag(a)&&o(a))return!0;a=t.getParent(a)}return!1};case"child":return(l)=>{let a=t.getParent(l);return a!=null&&t.isTag(a)&&o(a)};case"sibling":return(l)=>{let a=t.getSiblings(l);for(let d of a){if(d===l)return!1;if(t.isTag(d)&&o(d))return!0}return!1};case"adjacent":return(l)=>{let a=t.getSiblings(l),d=null;for(let n of a){if(n===l)return d!=null&&t.isTag(d)&&o(d);d=n}return!1};case"parent":return(l)=>t.existsOne(o,t.getChildren(l))}return(l)=>!1}function j(u){if(!u||!u.adapter)throw Error("css-select: adapter is required");return u.adapter}var E=new WeakMap;function J(u){return(u.xmlMode?1:0)<<0|(u.lowerCaseAttributeNames===!1?1:0)<<1|(u.lowerCaseTags===!1?1:0)<<2}function K(u,o){let t=E.get(u);if(!t)t=[],E.set(u,t);let l=t[o];if(!l)l=new Map,t[o]=l;return l}function _(u,o){let t=r(u,{xmlMode:o.xmlMode,lowerCaseAttributeNames:o.lowerCaseAttributeNames,lowerCaseTags:o.lowerCaseTags});return b(t,o)}function g(u,o){if(typeof u!=="string")return b(u,o);if(o.cacheResults===!1||!o.adapter)return _(u,o);let t=K(o.adapter,J(o)),l=t.get(u);if(l!==void 0)return l;return l=_(u,o),t.set(u,l),l}function O(u,o){if(o===void 0){E.delete(u);return}let t=E.get(u);if(!t)return;for(let l of t)if(l)l.delete(o)}function v(u,o,t){let l=j(t),a=typeof u==="function"?u:g(u,t),d=Q(o,l);return x(a,d,l,t.xmlMode===!0)}function R(u,o,t){let l=j(t),a=typeof u==="function"?u:g(u,t),d=Q(o,l);return L(a,d,l,t.xmlMode===!0)}function w(u,o,t){return(typeof o==="function"?o:g(o,t))(u)}export{i,g,O,v,R,w,C};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{t as q,x as K,y as E}from"./chunk-9ep6bwwb.js";import{A as R}from"./chunk-2wsah70r.js";import{F as i}from"./chunk-1kmkypmr.js";var n={};i(n,{syntax:()=>l,specificityToString:()=>I,specificity:()=>h,removeComments:()=>B,minifyBlock:()=>W,minify:()=>N,dedupeDeclarations:()=>L,compressTree:()=>w});function B(g,f={}){let b=f.exclamation??!1,H=!1;E(g,($,A,F)=>{if($.type!=="Comment")return;let M=$.value.startsWith("!");if(b===!0&&M)return;if(b==="first-exclamation"&&M&&!H){H=!0;return}if(A&&F)F.remove(A)})}function L(g){E(g,(f)=>{if(f.type!=="Block"&&f.type!=="DeclarationList")return;if(!("children"in f)||!f.children)return;let b=f.children,H=b.head;if(H==null||H.next==null)return;let $=0;for(let M=H;M!=null;M=M.next)if(M.data.type==="Declaration"){if($++,$>=2)break}if($<2)return;let A=new Map,F=[];for(let M=H;M!=null;M=M.next){let X=M.data;if(X.type!=="Declaration")continue;let _=X.property,y=A.get(_);if(y){let c=!!y.decl.important,S=!!X.important;if(S||c===S)F.push(y.item),A.set(_,{item:M,decl:X});else F.push(M)}else A.set(_,{item:M,decl:X})}for(let M of F)b.remove(M)})}var r={black:"#000",fuchsia:"#f0f",white:"#fff",red:"#f00",cyan:"#0ff",blue:"#00f",yellow:"#ff0",magenta:"#f0f",lime:"#0f0",silver:"#c0c0c0",gray:"#808080",maroon:"#800000",olive:"#808000",green:"#008000",purple:"#800080",teal:"#008080",navy:"#000080"},m={"#f00":"red","#ff0000":"red","#000080":"navy","#008080":"teal"};function J(g){if(!g.startsWith("#"))return g;let f=g.slice(1);if(f.length===6){if(f[0]===f[1]&&f[2]===f[3]&&f[4]===f[5])return`#${f[0]}${f[2]}${f[4]}`}if(f.length===8){if(f[0]===f[1]&&f[2]===f[3]&&f[4]===f[5]&&f[6]===f[7])return`#${f[0]}${f[2]}${f[4]}${f[6]}`}return g}function T(g){let f=g.toLowerCase();return r[f]??null}function V(g){let f=g.toLowerCase();return m[f]??null}function v(g,f,b){let H=(g<<16|f<<8|b).toString(16).padStart(6,"0");return J(`#${H}`)}var p=/^rgba?\(\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*(?:[,/]\s*([+-]?\d*\.?\d+%?)\s*)?\)$/;function Y(g){let f=p.exec(g.trim());if(!f)return g;let b=D(f[1]),H=D(f[2]),$=D(f[3]);if(f[4]!==void 0&&!d(f[4]))return g;return v(b,H,$)}function d(g){if(g.endsWith("%"))return Number.parseFloat(g)>=100;return Number.parseFloat(g)>=1}function D(g){if(g.endsWith("%"))return Math.max(0,Math.min(255,Math.round(Number.parseFloat(g)*2.55)));return Math.max(0,Math.min(255,Math.round(Number.parseFloat(g))))}var u=new Set(["px","pt","pc","in","cm","mm","q","em","rem","ex","ch","cap","ic","lh","rlh","vw","vh","vi","vb","vmin","vmax","svw","svh","svi","svb","svmin","svmax","lvw","lvh","lvi","lvb","lvmin","lvmax","dvw","dvh","dvi","dvb","dvmin","dvmax","cqw","cqh","cqi","cqb","cqmin","cqmax"]);function j(g){if(g.charCodeAt(0)===43)g=g.slice(1);if(g.includes(".")){let f=g.replace(/(\.\d*?)0+($|[eE])/,"$1$2");f=f.replace(/\.($|[eE])/,"$1"),g=f}if(g.startsWith("0.")&&g.length>2)g=g.slice(1);else if(g.startsWith("-0.")&&g.length>3)g=`-${g.slice(2)}`;if(g==="-0"||g==="-.0"||g==="-0.0")g="0";return g}function z(g,f){let b=j(g);if((b==="0"||b==="-0")&&u.has(f.toLowerCase()))return{value:"0",unit:""};return{value:b,unit:f}}function C(g){return j(g)}function U(g,f){let b=Number.parseFloat(g);if(!Number.isFinite(b))return g;let H=f<0?0:f;return b.toFixed(H)}var Z=new Set(["color","background","background-color","border","border-color","border-top","border-top-color","border-right","border-right-color","border-bottom","border-bottom-color","border-left","border-left-color","border-block","border-block-color","border-block-start-color","border-block-end-color","border-inline","border-inline-color","border-inline-start-color","border-inline-end-color","outline","outline-color","caret-color","fill","stroke","flood-color","lighting-color","stop-color","column-rule","column-rule-color","text-decoration","text-decoration-color","text-emphasis","text-emphasis-color","text-shadow","box-shadow","accent-color","scrollbar-color"]);function G(g){if(!g||g.type!=="Operator")return!1;let f=g.value;return f===":"||f===","||f==="/"}function a(g){let f=g.children;if(!f)return;while(f.head&&f.head.data.type==="WhiteSpace")f.remove(f.head);while(f.tail&&f.tail.data.type==="WhiteSpace")f.remove(f.tail);let b=f.head;while(b){let H=b.next;if(b.data.type==="WhiteSpace"){let $=b.prev&&G(b.prev.data),A=H&&G(H.data);if($||A)f.remove(b)}b=H}}function w(g,f={}){let b=f.floatPrecision??null,H=b===null?null:($)=>U($,b);E(g,{enter($,A,F){switch($.type){case"Number":{let M=H?H($.value):$.value;$.value=j(M);return}case"Percentage":{let M=H?H($.value):$.value;$.value=C(M);return}case"Dimension":{let M=H?H($.value):$.value,X=z(M,$.unit);$.value=X.value,$.unit=X.unit;return}case"Hash":{let M=J(`#${$.name}`).slice(1);if($.name=M,A&&F&&this.declaration&&Z.has(this.declaration.property.toLowerCase())){let X=V(`#${M}`);if(X&&X.length<M.length+1){let _={type:"Identifier",name:X,loc:$.loc};F.replace(A,F.createItem(_))}}return}case"Identifier":{if(!A||!F||!this.declaration)return;if(!Z.has(this.declaration.property.toLowerCase()))return;let M=T($.name);if(M&&M.length<$.name.length){let X={type:"Hash",name:M.slice(1),loc:$.loc};F.replace(A,F.createItem(X))}return}case"Url":return;case"Function":{let M=$.name.toLowerCase();if((M==="rgb"||M==="rgba")&&A&&F)$.__rgbReplaceCandidate=!0}}},leave($,A,F){if($.type==="Parentheses"||$.type==="Function"||$.type==="Value")a($);if($.type==="Function"&&$.__rgbReplaceCandidate&&A&&F){let M=q($),X=Y(M);if(X!==M&&X.startsWith("#")){let _={type:"Hash",name:X.slice(1),loc:$.loc};F.replace(A,F.createItem(_))}}}})}function N(g,f={}){let b=K(g,{context:"stylesheet"});return k(b,f)}function W(g,f={}){let b=K(g,{context:"declarationList"});return k(b,f)}function k(g,f){if(f.comments===!1)B(g,{exclamation:!1});else if(f.comments==="first-exclamation")B(g,{exclamation:"first-exclamation"});else B(g,{exclamation:!0});return w(g,{floatPrecision:f.floatPrecision??null}),L(g),{css:q(g),ast:g}}function h(g){let f=[0,0,0];if(typeof g==="string"){let b=R(g);return x(b,f),f}if(Array.isArray(g)){if(g.length===0)return f;if(Array.isArray(g[0]))x(g,f);else Q(g,f);return f}return O(g,f),f}function O(g,f){switch(g.type){case"IdSelector":f[0]++;return;case"ClassSelector":case"AttributeSelector":f[1]++;return;case"TypeSelector":if(g.name!=="*")f[2]++;return;case"PseudoClassSelector":{let b=g.name.toLowerCase();if(b==="is"||b==="matches"||b==="-moz-any"||b==="-webkit-any"||b==="not"||b==="has"){if(g.children){let H=[];for(let A of g.children)if(A.type==="SelectorList"&&"children"in A&&A.children)for(let F of A.children)H.push(F);else if(A.type==="Selector")H.push(A);let $=[0,0,0];for(let A of H){let F=h(A);if(P(F,$)>0)$=F}f[0]+=$[0],f[1]+=$[1],f[2]+=$[2]}return}if(b==="where")return;f[1]++;return}case"PseudoElementSelector":f[2]++;return;case"Selector":case"SelectorList":case"AtrulePrelude":if("children"in g&&g.children)for(let b of g.children)O(b,f);return;case"NestingSelector":return}}function x(g,f){for(let b of g)Q(b,f)}function Q(g,f){for(let b of g)switch(b.type){case"tag":if(b.name!=="*")f[2]++;break;case"attribute":if(b.name==="id"&&b.action==="equals")f[0]++;else f[1]++;break;case"pseudo":{let H=b.name.toLowerCase();if(H==="is"||H==="matches"||H==="not"||H==="has"||H==="-moz-any"||H==="-webkit-any"){if(Array.isArray(b.data)){let $=[0,0,0];for(let A of b.data){let F=[0,0,0];if(Q(A,F),P(F,$)>0)$=F}f[0]+=$[0],f[1]+=$[1],f[2]+=$[2]}break}if(H==="where")break;f[1]++;break}case"pseudo-element":f[2]++;break}}function P(g,f){for(let b=0;b<3;b++)if(g[b]!==f[b])return g[b]-f[b];return 0}function I(g){return g.join(",")}var l={specificity:h};
|
|
3
|
+
export{B as h,L as i,w as j,N as k,W as l,h as m,I as n,l as o,n as p};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{e,o,n}from"./chunk-8h5zg4ad.js";import{r}from"./chunk-b44sfqdn.js";import{c}from"./chunk-vbjv9wf0.js";var A={};c(A,{compressTree:()=>p,dedupeDeclarations:()=>u,minify:()=>h,minifyBlock:()=>a,removeComments:()=>s,specificity:()=>l,specificityToString:()=>S,syntax:()=>k});function s(i,t={}){let f=t.exclamation??!1,y=!1;n(i,(m,b,g)=>{if(m.type!=="Comment")return;let d=m.value.startsWith("!");if(f===!0&&d)return;if(f==="first-exclamation"&&d&&!y){y=!0;return}if(b&&g)g.remove(b)})}function u(i){n(i,(t)=>{if(t.type!=="Block"&&t.type!=="DeclarationList")return;if(!("children"in t)||!t.children)return;let f=t.children,y=f.head;if(y==null||y.next==null)return;let m=0;for(let d=y;d!=null;d=d.next)if(d.data.type==="Declaration"){if(m++,m>=2)break}if(m<2)return;let b=new Map,g=[];for(let d=y;d!=null;d=d.next){let x=d.data;if(x.type!=="Declaration")continue;let v=x.property,N=b.get(v);if(N){let z=!!N.decl.important,W=!!x.important;if(W||z===W)g.push(N.item),b.set(v,{item:d,decl:x});else g.push(d)}else b.set(v,{item:d,decl:x})}for(let d of g)f.remove(d)})}var G={black:"#000",fuchsia:"#f0f",white:"#fff",red:"#f00",cyan:"#0ff",blue:"#00f",yellow:"#ff0",magenta:"#f0f",lime:"#0f0",silver:"#c0c0c0",gray:"#808080",maroon:"#800000",olive:"#808000",green:"#008000",purple:"#800080",teal:"#008080",navy:"#000080"},U={"#f00":"red","#ff0000":"red","#000080":"navy","#008080":"teal"};function O(i){if(!i.startsWith("#"))return i;let t=i.slice(1);if(t.length===6){if(t[0]===t[1]&&t[2]===t[3]&&t[4]===t[5])return`#${t[0]}${t[2]}${t[4]}`}if(t.length===8){if(t[0]===t[1]&&t[2]===t[3]&&t[4]===t[5]&&t[6]===t[7])return`#${t[0]}${t[2]}${t[4]}${t[6]}`}return i}function R(i){let t=i.toLowerCase();return G[t]??null}function P(i){let t=i.toLowerCase();return U[t]??null}function X(i,t,f){let y=(i<<16|t<<8|f).toString(16).padStart(6,"0");return O(`#${y}`)}var j=/^rgba?\(\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*(?:[,/]\s*([+-]?\d*\.?\d+%?)\s*)?\)$/;function T(i){let t=j.exec(i.trim());if(!t)return i;let f=w(t[1]),y=w(t[2]),m=w(t[3]);if(t[4]!==void 0&&!V(t[4]))return i;return X(f,y,m)}function V(i){if(i.endsWith("%"))return Number.parseFloat(i)>=100;return Number.parseFloat(i)>=1}function w(i){if(i.endsWith("%"))return Math.max(0,Math.min(255,Math.round(Number.parseFloat(i)*2.55)));return Math.max(0,Math.min(255,Math.round(Number.parseFloat(i))))}var Z=new Set(["px","pt","pc","in","cm","mm","q","em","rem","ex","ch","cap","ic","lh","rlh","vw","vh","vi","vb","vmin","vmax","svw","svh","svi","svb","svmin","svmax","lvw","lvh","lvi","lvb","lvmin","lvmax","dvw","dvh","dvi","dvb","dvmin","dvmax","cqw","cqh","cqi","cqb","cqmin","cqmax"]);function C(i){if(i.charCodeAt(0)===43)i=i.slice(1);if(i.includes(".")){let t=i.replace(/(\.\d*?)0+($|[eE])/,"$1$2");t=t.replace(/\.($|[eE])/,"$1"),i=t}if(i.startsWith("0.")&&i.length>2)i=i.slice(1);else if(i.startsWith("-0.")&&i.length>3)i=`-${i.slice(2)}`;if(i==="-0"||i==="-.0"||i==="-0.0")i="0";return i}function I(i,t){let f=C(i);if((f==="0"||f==="-0")&&Z.has(t.toLowerCase()))return{value:"0",unit:""};return{value:f,unit:t}}function H(i){return C(i)}function _(i,t){let f=Number.parseFloat(i);if(!Number.isFinite(f))return i;let y=t<0?0:t;return f.toFixed(y)}var D=new Set(["color","background","background-color","border","border-color","border-top","border-top-color","border-right","border-right-color","border-bottom","border-bottom-color","border-left","border-left-color","border-block","border-block-color","border-block-start-color","border-block-end-color","border-inline","border-inline-color","border-inline-start-color","border-inline-end-color","outline","outline-color","caret-color","fill","stroke","flood-color","lighting-color","stop-color","column-rule","column-rule-color","text-decoration","text-decoration-color","text-emphasis","text-emphasis-color","text-shadow","box-shadow","accent-color","scrollbar-color"]);function L(i){if(!i||i.type!=="Operator")return!1;let t=i.value;return t===":"||t===","||t==="/"}function J(i){let t=i.children;if(!t)return;while(t.head&&t.head.data.type==="WhiteSpace")t.remove(t.head);while(t.tail&&t.tail.data.type==="WhiteSpace")t.remove(t.tail);let f=t.head;while(f){let y=f.next;if(f.data.type==="WhiteSpace"){let m=f.prev&&L(f.prev.data),b=y&&L(y.data);if(m||b)t.remove(f)}f=y}}function p(i,t={}){let f=t.floatPrecision??null,y=f===null?null:(m)=>_(m,f);n(i,{enter(m,b,g){switch(m.type){case"Number":{let d=y?y(m.value):m.value;m.value=C(d);return}case"Percentage":{let d=y?y(m.value):m.value;m.value=H(d);return}case"Dimension":{let d=y?y(m.value):m.value,x=I(d,m.unit);m.value=x.value,m.unit=x.unit;return}case"Hash":{let d=O(`#${m.name}`).slice(1);if(m.name=d,b&&g&&this.declaration&&D.has(this.declaration.property.toLowerCase())){let x=P(`#${d}`);if(x&&x.length<d.length+1){let v={type:"Identifier",name:x,loc:m.loc};g.replace(b,g.createItem(v))}}return}case"Identifier":{if(!b||!g||!this.declaration)return;if(!D.has(this.declaration.property.toLowerCase()))return;let d=R(m.name);if(d&&d.length<m.name.length){let x={type:"Hash",name:d.slice(1),loc:m.loc};g.replace(b,g.createItem(x))}return}case"Url":return;case"Function":{let d=m.name.toLowerCase();if((d==="rgb"||d==="rgba")&&b&&g)m.__rgbReplaceCandidate=!0}}},leave(m,b,g){if(m.type==="Parentheses"||m.type==="Function"||m.type==="Value")J(m);if(m.type==="Function"&&m.__rgbReplaceCandidate&&b&&g){let d=e(m),x=T(d);if(x!==d&&x.startsWith("#")){let v={type:"Hash",name:x.slice(1),loc:m.loc};g.replace(b,g.createItem(v))}}}})}function h(i,t={}){let f=o(i,{context:"stylesheet"});return E(f,t)}function a(i,t={}){let f=o(i,{context:"declarationList"});return E(f,t)}function E(i,t){if(t.comments===!1)s(i,{exclamation:!1});else if(t.comments==="first-exclamation")s(i,{exclamation:"first-exclamation"});else s(i,{exclamation:!0});return p(i,{floatPrecision:t.floatPrecision??null}),u(i),{css:e(i),ast:i}}function l(i){let t=[0,0,0];if(typeof i==="string"){let f=r(i);return F(f,t),t}if(Array.isArray(i)){if(i.length===0)return t;if(Array.isArray(i[0]))F(i,t);else M(i,t);return t}return q(i,t),t}function q(i,t){switch(i.type){case"IdSelector":t[0]++;return;case"ClassSelector":case"AttributeSelector":t[1]++;return;case"TypeSelector":if(i.name!=="*")t[2]++;return;case"PseudoClassSelector":{let f=i.name.toLowerCase();if(f==="is"||f==="matches"||f==="-moz-any"||f==="-webkit-any"||f==="not"||f==="has"){if(i.children){let y=[];for(let b of i.children)if(b.type==="SelectorList"&&"children"in b&&b.children)for(let g of b.children)y.push(g);else if(b.type==="Selector")y.push(b);let m=[0,0,0];for(let b of y){let g=l(b);if(B(g,m)>0)m=g}t[0]+=m[0],t[1]+=m[1],t[2]+=m[2]}return}if(f==="where")return;t[1]++;return}case"PseudoElementSelector":t[2]++;return;case"Selector":case"SelectorList":case"AtrulePrelude":if("children"in i&&i.children)for(let f of i.children)q(f,t);return;case"NestingSelector":return}}function F(i,t){for(let f of i)M(f,t)}function M(i,t){for(let f of i)switch(f.type){case"tag":if(f.name!=="*")t[2]++;break;case"attribute":if(f.name==="id"&&f.action==="equals")t[0]++;else t[1]++;break;case"pseudo":{let y=f.name.toLowerCase();if(y==="is"||y==="matches"||y==="not"||y==="has"||y==="-moz-any"||y==="-webkit-any"){if(Array.isArray(f.data)){let m=[0,0,0];for(let b of f.data){let g=[0,0,0];if(M(b,g),B(g,m)>0)m=g}t[0]+=m[0],t[1]+=m[1],t[2]+=m[2]}break}if(y==="where")break;t[1]++;break}case"pseudo-element":t[2]++;break}}function B(i,t){for(let f=0;f<3;f++)if(i[f]!==t[f])return i[f]-t[f];return 0}function S(i){return i.join(",")}var k={specificity:l};
|
|
3
|
+
export{s,u,p,h,a,l,S,k,A};
|