@teacss/language-server 0.4.3 → 0.4.4

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.
Files changed (2) hide show
  1. package/dist/server.js +11 -11
  2. package/package.json +7 -7
package/dist/server.js CHANGED
@@ -16,19 +16,19 @@ import{a as e,i as t,n,o as r,r as i,t as a}from"./semanticTokens-Cniz5X9a.js";i
16
16
  `||O===`\r`||O===`\u2028`||O===`\u2029`){s=void 0,l=!1,u=-1,d=0,Pt(h,`string`),a+=O,o++;continue}if(O===`\\`){let t=Pe(e,o);a+=e.slice(o,t),o=t;continue}if(O===s){s=void 0,l=!1,u=-1,d=0,Pt(h,`string`),a+=O,o++;continue}if(O!==`{`){a+=O,o++;continue}}else if(E.at(-1)?.inText){let t=E.at(-1);if(O===`\\`){let t=Pe(e,o,!0);a+=e.slice(o,t),o=t;continue}if(O==="`"){E.pop(),Pt(h,`template`),a+=O,o++;continue}if(O===`{`&&e[o-1]===`$`){t.groupLimit=-1,t.inText=!1,t.interpolationDepth=1,J(f,`I`),h.canEnd=!1,h.forceRegex=!1,h.lastSignificant=`{`,h.lastWord=``,a+=O,o++;continue}if(t.css){let n=Fe(e,o,t.css);a+=e.slice(o,n),o=n,t.css.depth===0&&(t.css=void 0,t.cssBoundary=n);continue}if(O!==`{`){a+=O,o++;continue}}else if(x===`text`){if(O===`{`){let n=t===`auto`?Ne(e,o):void 0;if(n){D===o&&a.length>0&&!/\s/.test(a.at(-1))&&(a+=` `),a+=n.value,D=n.end,o=n.end;continue}J(w,`T`),x=void 0,J(f,`J`),b++,J(C,!1),h.canEnd=!1,h.forceRegex=!1,h.lastSignificant=`{`,h.lastWord=``}else if(O===`<`&&(e[o+1]===`/`||e[o+1]===`>`||/[A-Z_$a-z]/.test(e[o+1]??``))){v=e[o+1]===`/`,x=`tag`;let t=zt(e,o);S=t?Vt(e,t,r):-1}a+=O,o++;continue}else if(x===`tag`&&o<=S){a+=O,o++;continue}else if(x===`tag`&&O===`{`){J(w,`G`),x=void 0,J(f,`J`),b++,J(C,nn(e,o)),h.canEnd=!1,h.forceRegex=!1,h.lastSignificant=`{`,h.lastWord=``,a+=O,o++;continue}else if(x===`tag`&&O===`>`){let t=o-1;for(;/\s/.test(e[t]??``);)t--;let n=e[t]===`/`;v?y=Math.max(0,y-1):n||y++;let r=T.at(-1);r&&y===r.baseDepth&&(v||n)?(T.pop(),x=r.resumeExpression?void 0:y>0?`text`:void 0,Pt(h,`jsx`)):x=`text`,v=!1,S=-1,a+=O,o++;continue}else if(x===`tag`&&O!==`'`&&O!==`"`){a+=O,o++;continue}else if(O===`<`&&en(o,h.canEnd,i)){J(T,{baseDepth:y,resumeExpression:b>0}),v=!1,x=`tag`;let t=zt(e,o);S=t?Vt(e,t,r):-1,a+=O,o++;continue}else if(O===`\\`){let t=Jt(e,o);if(t){a+=e.slice(o,t.end),o=t.end,Pt(h,`word`);continue}}else if(O===`'`||O===`"`){s=O,l=rn(e,o)||an(h)||x===void 0&&C.at(-1)===!0&&on(e,o,h),u=-1,d=o+1,a+=O,o++;continue}else if(O==="`"){J(E,{classLiteral:rn(e,o)||an(h)||x===void 0&&C.at(-1)===!0&&on(e,o,h),cssBoundary:o+1,groupLimit:-1,inText:!0,interpolationDepth:0}),a+=O,o++;continue}else if(O===`/`&&e[o+1]===`/`){c=`line`,u=-1,d=o+2,a+=`//`,o+=2;continue}else if(O===`/`&&e[o+1]===`*`){c=`block`,u=-1,d=o+2,a+=`/*`,o+=2;continue}else if(O===`/`&&o>=m&&Lt(e,o,h.forceRegex,h.canEnd)){let t=Rt(e,o);if(t.end!==-1){a+=e.slice(o,t.end),o=t.end,Pt(h,`regex`);continue}m=t.failedUntil}if(O===`}`){let e=f.pop(),t=E.at(-1);if(t&&!t.inText&&(t.interpolationDepth--,t.interpolationDepth===0&&(t.groupLimit=-1,t.inText=!0)),e===`J`&&(b--,C.pop(),x=w.at(-1)===`G`?`tag`:`text`,w.pop()),e===`T`){let e=h.pendingFunctions.at(-1);e?.phase===`return-type`&&(e.typeCanEnd=!0)}h.canEnd=e!==`B`,h.forceRegex=e===`B`,h.labelCandidate=!1,h.labelColon=-1,h.lastSignificant=`}`,h.lastWord=``,h.statementStart=e===`B`,e===`B`&&(p=o+1),a+=O,o++;continue}if(O!==`{`){(O===`
17
17
  `||O===`\r`||O===`\u2028`||O===`\u2029`)&&Mt(h,f.length)&&(p=o+1),/\s/.test(O)||(h.forceRegex=!1),h.canEnd=It(e,o,h.canEnd,h),O===`;`&&(Nt(h,f.at(-1)===`T`),f.length===0&&(p=o+1)),a+=O,o++;continue}let k=c===void 0&&s===void 0&&!E.at(-1)?.inText,A=k?jt(h):void 0,j=k&&h.labelColon>=0,M=k&&h.statementStart&&(f.at(-1)===`B`||p>0||f.length===0&&wt(e,o));if(k&&(f.length>0||A!==void 0||j||M||h.forceRegex||h.lastSignificant&&Le.includes(h.lastSignificant)||Re.has(h.lastWord)||nt(e,o,Math.max(p,_))||$e(e,o)||et(e,o))){let t=h.forceRegex||j||M?`B`:A??(Tt(e,o,p,h.parenKinds.length,h.lastSignificant)?`B`:`O`);J(f,t);let n=E.at(-1);n&&!n.inText&&n.interpolationDepth++,h.canEnd=!1,h.forceRegex=!1,h.labelCandidate=!1,h.labelColon=-1,h.lastSignificant=`{`,h.lastWord=``,h.statementStart=t===`B`,a+=O,o++;continue}let N=E.at(-1),P=e.length;if(s||c?(u<o&&(u=sn(e,o+1,s,c,!1)),P=u):N?.inText&&(N.groupLimit<o&&(N.groupLimit=sn(e,o+1,void 0,void 0,!0)),P=N.groupLimit),(e[o-1]===`#`||e[o-1]===`@`)&&!tt(e,o-1)){let t=Ie(e,o,P);if(t!==-1){a+=e.slice(o,t+1),o=t+1;continue}}let F=N?.inText===!0,I=s===void 0&&c===void 0&&!F?Oe(e,o,P):De(e,o,P),L=I.kind===`close`?I.index:-1,R=N===void 0||F||s!==void 0||c!==void 0,z=F?N.cssBoundary:s||c?d:_,ee=R&&!l&&!(F&&N.classLiteral)&&Qe(e,o,F,z),B=ee?Ie(e,o,P):-1;if(ee&&(s===void 0&&c===void 0||B!==-1)&&(B===-1||e[B+1]!==`@`)){let e={blockComment:!1,depth:1,lineComment:!1,parenDepth:0};F?N.css=e:g=e,a+=O,o++;continue}if(I.kind!==`close`){I.kind===`open`&&n&&(n.seen=!0),a+=e.slice(o,I.index),o=I.index,F?N.cssBoundary=I.index:s||c?d=I.index:_=I.index;continue}let V=e.slice(o+1,L),{conds:H,end:U}=Ae(e,L+1,P),te=je(V);if(te.length===0){a+=O,o++;continue}D===o&&a.length>0&&!/\s/.test(a.at(-1))&&(a+=` `),a+=te.map(e=>`${e}${H}`).join(` `),D=U,F?N.cssBoundary=U:s||c?d=U:_=U,o=U}return a}function ln(e,t){let n={seen:!1};return{code:cn(e,t,n),nestedOpening:n.seen}}function un(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const dn=/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/;function fn(e){return dn.test(e)}function pn(e){let t,n,r=2166136261;for(t=0,n=e.length;t<n;t++)r^=e.charCodeAt(t),r+=(r<<1)+(r<<4)+(r<<7)+(r<<8)+(r<<24);return`00000${(r>>>0).toString(36)}`.slice(-6)}const mn=/[\\:]?[\s'"`;{}]+/g;new RegExp(mn.source,mn.flags);const hn=`@teacss-skip-bracket-`,gn=/@teacss-skip-bracket-[\da-z]{6}/g,_n=/[\s'"`;{}]/;function vn(e,t){return e[t+1]!==`/`&&/[A-Z_$]/i.test(e[t+1]??``)}function yn(e,t,n){if(n>0)return!0;if(!/\s/.test(e[t-1]??``))return!1;let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;return e[r]!==`=`}function bn(e){return e!==void 0&&/\.html?$/i.test(e.split(/[?#]/,1)[0])}function xn(e){return e!==void 0&&/\.(?:[cm]?[jt]sx?|mdx)$/i.test(e.split(/[?#]/,1)[0])}function Sn(e){if(e===void 0)return`auto`;let t=e.split(/[?#]/,1)[0];return/\.(?:[cm]?ts)$/i.test(t)?`none`:/\.tsx$/i.test(t)?`tsx`:/\.(?:jsx|mdx)$/i.test(t)?`raw`:`auto`}function Cn(e,t){let n=[],r=[],i=!1,a=0,o=!1,s=!1,c;for(let l=0;l<e.length;l++){let u=e[l],d=e[l+1];if(!o){if(e.startsWith(`<!--`,l)){let t=e.indexOf(`-->`,l+4);if(t===-1)break;l=t+2}else u===`<`&&vn(e,l)&&(o=!0,r=[]);continue}if(s){(u===`
18
18
  `||u===`\r`||u===`\u2028`||u===`\u2029`)&&(s=!1);continue}if(i){u===`*`&&d===`/`&&(i=!1,l++);continue}if(c){u===`\\`?l++:u===c&&(c=void 0);continue}if(u===`/`&&d===`*`&&yn(e,l,a)){i=!0,l++;continue}if(u===`/`&&d===`/`&&yn(e,l,a)){s=!0,l++;continue}if(u===`"`||u===`'`||u==="`"){c=u;continue}if(a>0){u===`{`?a++:u===`}`&&a--;continue}if(u===`{`){a=1;continue}if(u===`>`){for(let e of r)q(n,e);r=[],o=!1;continue}if(!/\s/.test(e[l-1]??``)||e.slice(l,l+5).toLowerCase()!==`class`)continue;let f=l+5;for(;/\s/.test(e[f]??``);)f++;if(e[f]!==`=`)continue;for(f++;/\s/.test(e[f]??``);)f++;if(!e[f]||(t?/[\s"'`=<>]/:/[\s"'`={<>]/).test(e[f]))continue;let p=f+1;for(;p<e.length&&!/[\s"'`=<>]/.test(e[p]);)p++;q(r,{end:p,start:l,valueStart:f}),l=p-1}if(n.length===0)return e;let l=[],u=0;for(let{end:t,start:r,valueStart:i}of n){let n=e.slice(i,t);q(l,e.slice(u,r)),q(l,` `.repeat(t-r-n.length-2)),q(l,`"${n}"`),u=t}return q(l,e.slice(u)),l.join(``)}function wn(e){if(!e)return!1;let t=e.charCodeAt(0);switch(t){case 9:case 10:case 11:case 12:case 13:case 32:case 34:case 39:case 59:case 96:case 123:case 125:return!0;default:return t>127&&_n.test(e)}}function Tn(e){let t=e?.charCodeAt(0);return t===10||t===13||t===8232||t===8233}function En(e,t){return e[t+1]===`\r`&&e[t+2]===`
19
- `?t+2:t+1}function Dn(e,t){let n=t;for(;/\s/.test(e[n]??``);)n++;if(e[n]!==`:`)return!1;for(n++;/\s/.test(e[n]??``);)n++;return e[n]===`[`&&Te(e,n)}const On=new Set([`await`,`break`,`case`,`continue`,`debugger`,`delete`,`do`,`else`,`in`,`instanceof`,`new`,`of`,`return`,`throw`,`typeof`,`void`,`yield`]),kn=new Set([`for`,`if`,`while`,`with`]);function An(e,t){let n=0;for(;t>0&&e[--t]===`\\`;)n++;return n%2==1}function jn(e,t){let n=0;for(let r=t;r>=0;r--){let t=e[r];if(t===`"`||t===`'`||t==="`"){let n=r-1;for(;n>=0&&(e[n]!==t||An(e,n));)n--;if(n<0)return!1;r=n}else if(t===`/`&&e[r-1]===`*`){let t=e.lastIndexOf(`/*`,r-2);if(t<0)return!1;r=t}else if(t===`)`)n++;else if(t===`(`){if(n--,n!==0)continue;let t=r;for(;t>0&&/\s/.test(e[t-1]);)t--;let i=t;for(;i>0&&/[\w$]/.test(e[i-1]);)i--;return i>0&&/[\w$.]/.test(e[i-1])?!1:kn.has(e.slice(i,t))}}return!1}function Mn(e,t){let n=0;for(let r=t;r>=0;r--){let t=e[r];if(t===`"`||t===`'`||t==="`"){let n=r-1;for(;n>=0&&(e[n]!==t||An(e,n));)n--;if(n<0)return-1;r=n}else if(t===`/`&&e[r-1]===`*`){let t=e.lastIndexOf(`/*`,r-2);if(t<0)return-1;r=t}else if(t===`}`)n++;else if(t===`{`&&(n--,n===0))return r}return-1}function Nn(e,t){for(;t>0&&/\s/.test(e[t-1]);)t--;let n=t;for(;n>0&&/[\w$]/.test(e[n-1]);)n--;return{start:n,value:e.slice(n,t)}}function Pn(e,t){let n=Mn(e,t);if(n<0)return!1;let r=n;for(;r>0&&/\s/.test(e[r-1]);)r--;if(r===0)return!0;let i=e[r-1];if(i===`)`||i===`>`&&e[r-2]===`=`||`;{}:`.includes(i))return!0;let a=Nn(e,r);return[`catch`,`class`,`do`,`else`,`finally`,`static`,`try`].includes(a.value)?!0:a.value?Nn(e,a.start).value===`class`:!1}function Fn(e,t){if(e[t+1]===`/`||e[t+1]===`*`||e[t-1]===`<`&&(e[t+1]===`>`||/[A-Z_$]/i.test(e[t+1]??``)))return!1;let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;if(n<0)return!0;if((e[n]===`+`||e[n]===`-`)&&e[n-1]===e[n]||e[n]===`!`&&n>0&&/[\w$)\]]/.test(e[n-1]??``)||e[n]===`>`&&n>0&&/[\w$)>]/.test(e[n-1]??``))return!1;if(`=([{,:;!?&|+-*%^~<>`.includes(e[n])||e[n]===`)`&&jn(e,n)||e[n]===`}`&&Pn(e,n))return!0;let r=n+1;for(;n>=0&&/[\w$]/.test(e[n]);)n--;let i=e.slice(n+1,r);return On.has(i)?!0:i==="default"&&Nn(e,n+1).value===`export`}function In(e,t){let n=!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(Tn(t))return-1;if(t===`\\`)r++;else if(t===`[`)n=!0;else if(t===`]`)n=!1;else if(t===`/`&&!n){for(r++;/[a-z]/i.test(e[r]??``);)r++;return r}}return-1}function Ln(e,t=!1){let n=[],r=[],i=[],a=!1,o=!1,s,c=-1,l,u=-1,d=!1;for(let f=0;f<e.length;f++){let p=e[f];if(!a&&!s&&p===`/`&&Fn(e,f)){let t=In(e,f);if(t!==-1){f=t-1,d=!1;continue}}if(n.length===0){wn(p)?d=!1:p===`/`&&(d=!0),p===`[`&&(q(n,f),o=d&&e[f-1]!==`:`&&e[f-1]!==`@`,i=[],l=void 0);continue}if(wn(p)&&(u=f),Tn(p)){n.length=0,i=[],a=!1,o=!1,s=void 0,c=-1,l=void 0;continue}if((a||s)&&/\s/.test(p)&&(l??=he(e,n.at(-1),!1,f),l===void 0)){n.length=0,i=[],a=!1,o=!1,s=void 0,c=-1;continue}if(!a&&!s&&p===`/`&&o){n.length=0,i=[],o=!1,c=-1;continue}if(a){p===`*`&&e[f+1]===`/`&&(a=!1,f++);continue}if(s){p===`\\`?(Tn(e[f+1])?(n.length=0,i=[],a=!1,s=void 0,c=-1):wn(e[f+1])&&(u=f+1),f++):p===s&&(q(i,[c+1,f]),s=void 0,c=-1);continue}if(p===`/`&&e[f+1]===`*`)a=!0,f++;else if(p===`"`||p===`'`)s=p,c=f;else if(p===`\\`)Tn(e[f+1])&&(n.length=0,i=[],a=!1,s=void 0,c=-1),wn(e[f+1])&&(u=f+1),f++;else if(p===`[`)q(n,f);else if(p===`]`){let a=n.pop(),s=f+1,c=!1;if(s!==a+2&&u>a){let n=e[a-1]===`:`||e[a-1]===`@`,i=e[s]===`:`&&!!e[s+1]&&!_n.test(e[s+1]);c=n&&!we(e,a)||i&&!(t&&Dn(e,s)),c&&q(r,[a,s])}if(n.length===0){if(o=!1,l=void 0,!c)for(let[t,n]of i)for(let[i,a]of Ln(e.slice(t,n)))q(r,[t+i,t+a]);i=[]}}}let f=[];for(let e of r.sort(([e,t],[n,r])=>e-n||r-t))(f.length===0||e[0]>=f.at(-1)[1])&&q(f,e);return f}const Rn=/^(?:--?[\w-]+|[A-Z_$][\w$-]*|@teacss-skip-bracket-[\da-z]{6})$/i;function zn(e,t){let n=t;for(;n>0&&/[\w-]/.test(e[n-1]);)n--;if(n===t||e[n-1]!==`:`)return!1;let r=n-1,i=r;for(;i>0&&/[\w$@-]/.test(e[i-1]);)i--;if(!Rn.test(e.slice(i,r)))return!1;let a=i-1;for(;a>=0&&/\s/.test(e[a]);)a--;return a<0||!`{,?`.includes(e[a])}function Bn(e){let t=[],n=[],r=[],i=!1,a,o,s=-1,c,l=()=>{if(s<0||n.length===0)return;let e=n.at(-1);e.attached&&e.containsGroupBrace&&q(t,[e.start,s+1]),s=-1};for(let u=0;u<e.length;u++){let d=e[u];if(n.length===0){a?a!=="`"&&Tn(d)?a=void 0:d===`\\`?u=En(e,u):d===a?a=void 0:d===`(`&&zn(e,u)&&(q(n,{attached:!0,containsGroupBrace:!1,outerQuote:a,start:u}),c=void 0):d===`"`||d===`'`||d==="`"?a=d:d===`(`&&zn(e,u)&&(q(n,{attached:!0,containsGroupBrace:!1,outerQuote:void 0,start:u}),c=void 0);continue}if(Tn(d)){l(),n.length=0,r.length=0,i=!1,o=void 0,a!=="`"&&(a=void 0),c=void 0;continue}if((o||i)&&/\s/.test(d)&&(c??=he(e,n.at(-1).start,!0,u),c===void 0)){n.length=0,r.length=0,i=!1,o=void 0,s=-1;continue}if(o){d===`\\`?u=En(e,u):d===o?o=void 0:d===`{`&&(n.at(-1).containsGroupBrace=!0);continue}if(i){d===`*`&&e[u+1]===`/`&&(i=!1,u++);continue}let f=n[0].outerQuote;if(d===`/`&&e[u+1]===`*`)i=!0,u++;else if(f&&d===f)l(),n.length=0,r.length=0,i=!1,a=void 0;else if(d===`"`||d===`'`||d==="`")o=d;else if(d===`\\`)u=En(e,u);else if(r.length>0)d===`[`?q(r,`]`):d===`(`?q(r,`)`):d===r.at(-1)?(r.pop(),r.length===0?s=-1:d===`)`&&(s=u)):d===`{`&&(n.at(-1).containsGroupBrace=!0);else if(d===`[`)q(r,`]`);else if(d===`{`)n.at(-1).containsGroupBrace=!0;else if(d===`(`)q(n,{attached:zn(e,u),containsGroupBrace:!1,outerQuote:f,start:u});else if(d===`)`){let e=n.pop();e.attached&&e.containsGroupBrace&&q(t,[e.start,u+1]),e.containsGroupBrace&&n.length>0&&(n.at(-1).containsGroupBrace=!0),n.length===0&&(c=void 0)}}l();let u=[];for(let e of t.sort(([e,t],[n,r])=>e-n||r-t))(u.length===0||e[0]>=u.at(-1)[1])&&q(u,e);return u}function Vn(e,t,n){if(!t.length)return e;let r=new Set([...e.matchAll(gn)].map(e=>e[0])),i=new Set([...n.keys(),...r]),a=[],o=0;for(let[s,c]of t){let t=e.slice(s,c),l=0,u;for(;u=`${hn}${pn(l?`${t}:${l}`:t)}`,l++,!(n.get(u)===t&&!r.has(u)||!i.has(u)););i.add(u),n.set(u,t),q(a,e.slice(o,s)),q(a,u),o=c}return q(a,e.slice(o)),a.join(``)}function Hn(e,t,n=!1){return Vn(e,Ln(e,n),t)}function Un(e,t){return Vn(e,Bn(e),t)}function Wn(e,t){let n=e;for(let e=0;e<t.size&&n.includes(hn);e++){let e=n.replace(gn,e=>t.get(e)??e);if(e===n)break;n=e}return n}function Gn(e,t){let n=new Map;e.includes(`[`)&&(e=Hn(e,n,!0)),e.includes(`(`)&&(e=Un(e,n));let r=ln(e,t);e=r.code;for(let i=1;i<5&&r.nestedOpening;i++){let i=e;if(i.includes(`[`)&&(i=Hn(i,n)),i.includes(`(`)&&(i=Un(i,n)),r=ln(i,t),r.code===i)break;e=r.code}e.includes(`[`)&&(e=Hn(e,n)),e.includes(`(`)&&(e=Un(e,n));let i=e.split(mn);return n.size?i.map(e=>e.includes(hn)?Wn(e,n):e):i}const Kn={name:`@teacss/core/extractor-split`,order:0,extract({code:e,id:t}){return Gn(xn(t)?e:Cn(e,bn(t)),Sn(t))}};function qn(e,t,n){if(Object.hasOwn(e,t)){if(!Reflect.set(e,t,n))throw TypeError(`Cannot assign event "${String(t)}"`)}else Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}function Jn(){return{events:Object.create(null),emit(e,...t){let n=Object.hasOwn(this.events,e)?this.events[e]:void 0,r=le(Array.isArray(n)?n:[]).map(e=>e);for(let e of r)e(...t)},on(e,t){let n=this.events,r=Object.hasOwn(n,e)?n[e]:void 0,i=Array.isArray(r)?r:[];return Array.isArray(r)||qn(n,e,i),Object.defineProperty(i,i.length,{configurable:!0,enumerable:!0,value:t,writable:!0}),()=>{let r=Object.hasOwn(n,e)?n[e]:void 0;qn(n,e,le(Array.isArray(r)?r:[]).filter(e=>e!==t))}}}}const Yn=/^\[(.+?)~?="(.*)"\]$/,Xn=/[\w\u00A0-\uFFFF%-?]/;new RegExp(Yn.source,Yn.flags),new RegExp(Xn.source,Xn.flags);function Zn(e){return e.match(Yn)}function Qn(e){return e!=null}const $n={minAffix:4,maxDistance:1,minDistanceLength:6,segmentAffix:!0},er={minAffix:3,maxDistance:1,minDistanceLength:0,segmentAffix:!1},tr={minAffix:3,maxDistance:2,minDistanceLength:0,segmentAffix:!1};function nr(e){let t=0,n;for(let r=0;r<e.length;r++){let i=e[r];if(n){i===`\\`?r++:i===n&&(n=void 0);continue}if(i===`"`||i===`'`)n=i;else if(i===`\\`)r++;else if(i===`[`||i===`(`)t++;else if(i===`]`||i===`)`)t--;else if(i===`@`&&t===0)return e.slice(0,r)}return e}function rr(e){if(e.flags)return;let t=e.source;if(!t.startsWith(`^`))return;let n=1;for(;n<t.length&&/[A-Za-z0-9_-]/.test(t[n]);)n++;return t[n]===`:`&&n>1?t.slice(1,n):void 0}const ir=new WeakMap;function ar(e){let t=ir.get(e.rulesStaticMap);if(t)return t;let n=new Map,r=new Set;for(let t of Object.keys(e.rulesStaticMap)){let e=t.indexOf(`:`);if(e<=0)continue;let r=t.slice(0,e),i=n.get(r);i||(i=new Set,n.set(r,i)),i.add(t.slice(e+1))}for(let t of e.rulesDynamic){let e=rr(t[0]);e!=null&&!n.has(e)&&r.add(e)}let i={prefixValues:n,dynamicPrefixes:r};return ir.set(e.rulesStaticMap,i),i}function or(e,t,n){if(e===t)return 0;if(Math.abs(e.length-t.length)>n)return 1/0;let r=Array.from({length:t.length+1},(e,t)=>t);for(let i=1;i<=e.length;i++){let a=[i],o=i;for(let n=1;n<=t.length;n++){let s=e[i-1]===t[n-1]?0:1;a[n]=Math.min(r[n]+1,a[n-1]+1,r[n-1]+s),a[n]<o&&(o=a[n])}if(o>n)return 1/0;r=a}return r[t.length]<=n?r[t.length]:1/0}function sr(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return r}function cr(e,t){return(t.startsWith(e)?t[e.length]===`-`:t.endsWith(e)&&t[t.length-e.length-1]===`-`)&&(e.includes(`-`)||e.length>=6)}function lr(e,t,n){if(e.length>=n.minDistanceLength){let r=or(e,t,n.maxDistance);if(r!==1/0)return r}let r=e.length<=t.length?e:t,i=e.length<=t.length?t:e;if(r.length>=n.minAffix&&(n.segmentAffix?cr(r,i):i.startsWith(r)||i.endsWith(r)||i.includes(r)))return 3+(i.length-r.length)/100;if(!n.segmentAffix&&sr(e,t)>=n.minAffix)return 5+Math.abs(e.length-t.length)/100}function ur(e,t,n={}){let r=nr(e),i=r.indexOf(`:`);if(i<=0)return;let a=r.slice(0,i),o=r.slice(i+1),{prefixValues:s,dynamicPrefixes:c}=ar(t),l=[];if(s.has(a)||c.has(a))for(let e of s.get(a)??[]){if(e===o)continue;let t=lr(o,e,tr);t!==void 0&&l.push({suggestion:`${a}:${e}`,score:t})}else{if(!n.confirmedIntent&&a.length<3)return;let e=new Set([...s.keys(),...c]);for(let t of e){let e=lr(a,t,n.confirmedIntent?er:$n);if(e===void 0)continue;let r=s.get(t)?.has(o)||c.has(t);l.push({suggestion:`${t}:${o}`,score:r?e:e+10})}if(l.length===0)return}l.sort((e,t)=>e.score-t.score||(e.suggestion<t.suggestion?-1:1));let u=new Set,d=[];for(let{suggestion:e}of l)if(!(u.has(e)||e===r)&&(u.add(e),d.push(e),d.length===3))break;return d}Object.freeze({shortcutsNoMerge:Symbol.for(`@teacss/core/shortcut-no-merge`),noMerge:Symbol.for(`@teacss/core/no-merge`),noScope:Symbol.for(`@teacss/core/no-scope`),variants:Symbol.for(`@teacss/core/variants`),parent:Symbol.for(`@teacss/core/parent`),selector:Symbol.for(`@teacss/core/selector`),layer:Symbol.for(`@teacss/core/layer`),sort:Symbol.for(`@teacss/core/sort`),body:Symbol.for(`@teacss/core/body`)});const dr={px:1,rem:16,em:16,in:96,pt:96/72,pc:16,cm:96/2.54,mm:96/25.4,q:96/101.6},fr=`vw.vh.vi.vb.vmin.vmax.svw.svh.svmin.svmax.lvw.lvh.lvmin.lvmax.dvw.dvh.dvmin.dvmax.cqw.cqh.cqi.cqb.cqmin.cqmax.ch.ex.cap.ic.lh.rlh.%`.split(`.`),pr=RegExp(`^([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:e[+-]?\\d+)?)(${[...Object.keys(dr),...fr].sort((e,t)=>t.length-e.length).join(`|`)})?$`,`i`);function mr(e){let t=pr.exec(e.trim());if(!t)return null;let n=Number.parseFloat(t[1]);if(!Number.isFinite(n))return null;let r=(t[2]??`px`).toLowerCase();if(!Object.hasOwn(dr,r))return{unit:r,value:n};let i=Math.round(n*dr[r]*1e6)/1e6;return{unit:`px`,value:Number.isFinite(i)?i:n*dr[r]}}function hr(e){let t=e.indexOf(` $$ `),n=t<0?e:e.slice(0,t);if(!/^@media\b/i.test(n)||/\bnot\b/i.test(n))return null;for(let e of n.matchAll(/\(\s*min-width\s*:\s*([^)]*?)\s*\)/gi)){let t=mr(e[1]);if(t)return t}for(let e of n.matchAll(/\(\s*max-width\s*:\s*([^)]*?)\s*\)/gi)){let t=mr(e[1]);if(t)return{unit:t.unit,value:-t.value}}return null}function gr(e,t){return e<t?-1:+(e>t)}function _r(e,t,n){let r=(e.get(t)??0)-(e.get(n)??0);if(r)return r;let i=hr(t),a=hr(n);if(i==null!=(a==null))return i==null?-1:1;if(i!=null&&a!=null){if(i.unit!==a.unit)return gr(i.unit,a.unit);if(i.value!==a.value)return i.value-a.value}return gr(t,n)}Function.prototype;const vr=`@teacss-skip-start`,yr=`@teacss-skip-end`;RegExp(`(//\\s*?${vr}\\s*?|\\/\\*\\s*?${vr}\\s*?\\*\\/|<!--\\s*?${vr}\\s*?-->)[\\s\\S]*?(//\\s*?${yr}\\s*?|\\/\\*\\s*?${yr}\\s*?\\*\\/|<!--\\s*?${yr}\\s*?-->)`,`g`);const br=RegExp(`(//\\s*?${vr}\\s*?|\\/\\*\\s*?${vr}\\s*?\\*\\/|<!--\\s*?${vr}\\s*?-->)[\\s\\S]*?(//\\s*?${yr}\\s*?|\\/\\*\\s*?${yr}\\s*?\\*\\/|<!--\\s*?${yr}\\s*?-->)`,`g`);function xr(e){return e===`
20
- `||e===`\r`||e===`\u2028`||e===`\u2029`}function Sr(e,t,n){for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`\\`){r++;continue}if(t===n)return r+1;if(n!=="`"&&xr(t))return r}return e.length}const Cr=/\.(?:[cm]?[jt]sx?|vue|svelte|astro|marko|php|phtml|scss|sass|less|styl(?:us)?)(?:$|\?)/i,wr=/\.(?:html?|vue|svelte|astro|marko|mdx?|php|phtml)(?:$|\?)/i;function Tr(e,t){let n=[],r=t===void 0||Cr.test(t),i=t===void 0||wr.test(t);for(let t=0;t<e.length;){let a=e[t];if(a===`"`||a===`'`||a==="`"){t=Sr(e,t,a);continue}if(e.startsWith(`{/*`,t)){let r=e.indexOf(`*/}`,t+3);n.push([t,r<0?e.length:r+3]),t=n[n.length-1][1];continue}if(i&&e.startsWith(`<!--`,t)){let r=e.indexOf(`-->`,t+4);n.push([t,r<0?e.length:r+3]),t=n[n.length-1][1];continue}if(e.startsWith(`/*`,t)){let r=e.indexOf(`*/`,t+2);n.push([t,r<0?e.length:r+2]),t=n[n.length-1][1];continue}if(r&&e.startsWith(`//`,t)){let r=e.slice(t+2).search(/[\n\r]/),i=r<0?e.length:t+2+r;n.push([t,i]),t=n[n.length-1][1];continue}t++}return n}const Er=[/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|`(?:\\[\s\S]|[^`\\])*`/g,/<[^/?<>0-9$_!"'](?:"[^"]*"|'[^']*'|[^>])+>/g,/(@apply|--at-apply)[^;]*;/g],Dr=[br],Or=/([\\:]?[\s"'`;<>]|:\(|\)"|\)\s)/g,kr=/(?:[\w&:[\]-]|\[\S{1,64}=\S{1,64}\]){1,64}\[\\?['"]?\S{0,64}?['"]\]\]?[\w:@-]{0,64}/g,Ar=/\[(\\\W|[\w-]){1,64}:[^\s:]{0,64}?("\S{1,64}?"|'\S{1,64}?'|`\S{1,64}?`|[^\s:]{1,64}?)[^\s:]{0,64}?\)?\]/g;async function jr(e,t,n=``){let r=e.config.extractors?.find(e=>e.name===`pug`);if(!r)return{pug:!1,code:``};let i={code:t,id:n};await r.extract?.(i);let a=i.code.startsWith(t)?i.code.substring(t.length+2):i.code;return i.code===t?{pug:!1,code:``}:{pug:!0,code:a}}function Mr(e,t,n){let r=[];t.has(e)&&r.push([n,n+e.length,e]);let i=new Set;for(let a of e.matchAll(/\.([^.#=\s(]+)(?=[.#=\s(]|$)/g)){let e=a[1];if(e.includes(`:`)||i.has(e)||!t.has(e))continue;i.add(e);let o=n+a.index+1;r.push([o,o+e.length,e])}return r}function Nr(e,t){let n=e.flags.includes(`g`)?e.flags:`${e.flags}g`;return t.matchAll(new RegExp(e.source,n))}function Pr(e,t){let n=t.map(([t,n])=>[Math.max(0,t),Math.min(e.length,n)]).filter(([e,t])=>t>e).sort((e,t)=>e[0]-t[0]||e[1]-t[1]);if(!n.length)return e;let r=[];for(let[e,t]of n){let n=r.at(-1);n&&e<=n[1]?n[1]=Math.max(n[1],t):r.push([e,t])}let i=[],a=0;for(let[t,n]of r)i.push(e.slice(a,t),` `.repeat(n-t)),a=n;return i.push(e.slice(a)),i.join(``)}function Fr(e){let t=[...e].sort((e,t)=>e[0]-t[0]||t[1]-e[1]),n=[],r=[],i=-1;for(let[e,a]of t)n.push(e),i=Math.max(i,a),r.push(i);return{starts:n,maxEnds:r}}function Ir(e,t,n){let r=0,i=e.starts.length;for(;r<i;){let n=r+i>>>1;e.starts[n]<=t?r=n+1:i=n}return r>0&&e.maxEnds[r-1]>=n}function Lr(e){return e===void 0||/[\s'"`;<>]/.test(e)}function Rr(e,t){if(!t.size)return[];let n={children:new Map};for(let e of t){let t=n;for(let n=0;n<e.length;n++){let r=e[n],i=t.children.get(r);i||(i={children:new Map},t.children.set(r,i)),t=i}t.value=e}let r=[];for(let t=0;t<e.length;t++){if(!Lr(e[t-1]))continue;let i=n;for(let n=t;n<e.length;n++){let a=i.children.get(e[n]);if(!a)break;i=a,i.value&&Lr(e[n+1])&&r.push([t,n+1,i.value])}}return r}function zr(e,t,n){for(let r=t+1;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===n)return r;return-1}function Br(e,t,n){if(!n)return[];let r=[],i=RegExp(`(^|[^\\w:-])${un(t)}\\s*=\\s*(['"])`,`g`);for(let t of e.matchAll(i)){let i=t.index+t[0].length-1,a=zr(e,i,t[2]);if(!(a<0))for(let t=e.indexOf(n,i+1);t>=0&&t+n.length<=a;t=e.indexOf(n,t+n.length)){let o=t===i+1||/\s/.test(e[t-1]),s=t+n.length===a||/\s/.test(e[t+n.length]);o&&s&&r.push(t)}}return r}function Vr(e,t){let n=0,r=0,i=!1;for(let a=t+1;a<e.length;a++){let t=e[a];if(t===`(`){if(n===0&&r===0&&!i)return-1;n++}else if(t===`)`)n>0&&n--;else if(t===`[`)r++;else if(t===`]`)r>0&&r--;else if((t===`:`||t===`;`)&&n===0&&r===0)i=!0;else if(t===`}`&&n===0&&r===0)return a}return-1}function Hr(e,t){let n=t;if(e[n]===`!`&&n++,e[n]!==`@`)return{suffix:e.slice(t,n),end:n};let r=0,i=0;for(;n<e.length;n++){let t=e[n];if(t===`(`)r++;else if(t===`)`)r>0&&r--;else if(t===`[`)i++;else if(t===`]`)i>0&&i--;else if((/\s/.test(t)||t===`"`||t===`'`||t==="`"||t===`{`||t===`}`)&&r===0&&i===0)break}return{suffix:e.slice(t,n),end:n}}function Ur(e){let t=[],n=0,r=0,i=0;for(let a=0;a<e.length;a++){let o=e[a];o===`(`?n++:o===`)`?n>0&&n--:o===`[`?r++:o===`]`?r>0&&r--:o===`;`&&n===0&&r===0&&(t.push(e.slice(i,a).trim()),i=a+1)}return t.push(e.slice(i).trim()),t.filter(Boolean)}function Wr(e,t,n){let r=Vr(e,t);if(r<0)return null;let i=Ur(e.slice(t+1,r));if(!i.length)return null;let{suffix:a,end:o}=Hr(e,r+1);return i.every(e=>n.has(e)||n.has(`${e}${a}`))?[t,o,e.slice(t,o)]:null}function Gr(e,t,n=[],r={}){let i=[],a=[],o=new Set,s=new Set,c=[];if(r.excludeRanges&&(e=Pr(e,r.excludeRanges)),r.excludeRegex)for(let t of r.excludeRegex){let n=Array.from(Nr(t,e),e=>[e.index,e.index+e[0].length]);e=Pr(e,n)}if(r.includeRegex)for(let t of r.includeRegex)for(let n of Nr(t,e))c.push([n.index,n.index+n[0].length]);else c.push([0,e.length]);let l=Fr(c);Array.from(t).forEach(e=>{let t=Zn(e);t?t[2]?a.push(t):(/[><()]|\[\\?['"`]/.test(t[1])&&s.add(t[1]),o.add(t[1])):(/[><()]|\[\\?['"`]/.test(e)&&s.add(e),o.add(e))}),i.push(...Rr(e,s));let u=0;e.split(Or).forEach(e=>{let t=u+e.length;r.isPug?i.push(...Mr(e,o,u)):o.has(e)&&i.push([u,t,e]),u=t});for(let t of e.matchAll(kr)){let e=t.index,n=e+t[0].length;o.has(t[0])&&i.push([e,n,t[0]])}let d=new Set(i.map(([e,t])=>`${e}:${t}`));for(let t of e.matchAll(Ar)){let e=t.index,n=e+t[0].length;if(o.has(t[0])){let r=`${e}:${n}`;d.has(r)||(d.add(r),i.push([e,n,t[0]]))}}a.forEach(([,t,n])=>{for(let r of Br(e,t,n)){let e=r+n.length;i.push([r,e,`[${t}="${n}"]`])}});for(let t=e.indexOf(`{`);t>=0;t=e.indexOf(`{`,t+1)){let n=Wr(e,t,o);if(!n)continue;let[r,a]=n;for(let e=i.length-1;e>=0;e--){let[t,n]=i[e];t>=r&&n<=a&&i.splice(e,1)}i.some(([e,t])=>e===r&&t===a)||i.push(n)}i.push(...n.map(e=>[e.offset,e.offset+e.length,e.className]));let f=new Set;return i.filter(([e,t])=>Ir(l,e,t)).filter(([e,t,n])=>{let r=`${e}:${t}:${n}`;return f.has(r)?!1:(f.add(r),!0)}).sort((e,t)=>e[0]-t[0])}const Kr=[`@teacss/directives`,`@teacss/transformer-compile-class`];async function qr(e,t,n=``,r={}){let i=new c(t),a={generator:e,tokens:new Set},o=e.config.transformers?.filter(e=>!Kr.includes(e.name)),s=[];for(let e of[`pre`,`default`,`post`])for(let t of o?.filter(t=>(t.enforce??`default`)===e)||[]){let e=(await t.transform(i,n,a))?.highlightAnnotations;e&&s.push(...e)}let{pug:l,code:u}=await jr(e,i.toString(),n);return Gr(t,[...(await e.generate(l?u:i.toString(),{preflights:!1,safelist:!1})).matched],s,{isPug:l,...r})}function Jr(e,t,n,r){if(!(r<1)){if(e.delete(t),e.size>=r){let t=e.keys().next();t.done||e.delete(t.value)}e.set(t,n)}}function Yr(e,t,n,r){let i=e.get(t);if(i)return Jr(e,t,i,n),i;let a;return a=r().catch(n=>{throw e.get(t)===a&&e.delete(t),n}),Jr(e,t,a,n),a}const Xr=new Map;function Zr(e){Xr.delete(e)}function Qr(){Xr.clear()}function $r(e,t,n,r=!1,i=!1){i&&Xr.delete(n);let a=Xr.get(n);if(a&&a.code===t&&a.config===e.config&&a.generator===e&&a.strictAnnotationMatch===r)return Jr(Xr,n,a,100),a.result;let o=qr(e,t,n,{excludeRanges:Tr(t,n),excludeRegex:Dr,...r?{includeRegex:Er}:null});return Jr(Xr,n,{code:t,config:e.config,generator:e,strictAnnotationMatch:r,result:o},100),o}
19
+ `?t+2:t+1}function Dn(e,t){let n=t;for(;/\s/.test(e[n]??``);)n++;if(e[n]!==`:`)return!1;for(n++;/\s/.test(e[n]??``);)n++;return e[n]===`[`&&Te(e,n)}const On=new Set([`await`,`break`,`case`,`continue`,`debugger`,`delete`,`do`,`else`,`in`,`instanceof`,`new`,`of`,`return`,`throw`,`typeof`,`void`,`yield`]),kn=new Set([`for`,`if`,`while`,`with`]);function An(e,t){let n=0;for(;t>0&&e[--t]===`\\`;)n++;return n%2==1}function jn(e,t){let n=0;for(let r=t;r>=0;r--){let t=e[r];if(t===`"`||t===`'`||t==="`"){let n=r-1;for(;n>=0&&(e[n]!==t||An(e,n));)n--;if(n<0)return!1;r=n}else if(t===`/`&&e[r-1]===`*`){let t=e.lastIndexOf(`/*`,r-2);if(t<0)return!1;r=t}else if(t===`)`)n++;else if(t===`(`){if(n--,n!==0)continue;let t=r;for(;t>0&&/\s/.test(e[t-1]);)t--;let i=t;for(;i>0&&/[\w$]/.test(e[i-1]);)i--;return i>0&&/[\w$.]/.test(e[i-1])?!1:kn.has(e.slice(i,t))}}return!1}function Mn(e,t){let n=0;for(let r=t;r>=0;r--){let t=e[r];if(t===`"`||t===`'`||t==="`"){let n=r-1;for(;n>=0&&(e[n]!==t||An(e,n));)n--;if(n<0)return-1;r=n}else if(t===`/`&&e[r-1]===`*`){let t=e.lastIndexOf(`/*`,r-2);if(t<0)return-1;r=t}else if(t===`}`)n++;else if(t===`{`&&(n--,n===0))return r}return-1}function Nn(e,t){for(;t>0&&/\s/.test(e[t-1]);)t--;let n=t;for(;n>0&&/[\w$]/.test(e[n-1]);)n--;return{start:n,value:e.slice(n,t)}}function Pn(e,t){let n=Mn(e,t);if(n<0)return!1;let r=n;for(;r>0&&/\s/.test(e[r-1]);)r--;if(r===0)return!0;let i=e[r-1];if(i===`)`||i===`>`&&e[r-2]===`=`||`;{}:`.includes(i))return!0;let a=Nn(e,r);return[`catch`,`class`,`do`,`else`,`finally`,`static`,`try`].includes(a.value)?!0:a.value?Nn(e,a.start).value===`class`:!1}function Fn(e,t){if(e[t+1]===`/`||e[t+1]===`*`||e[t-1]===`<`&&(e[t+1]===`>`||/[A-Z_$]/i.test(e[t+1]??``)))return!1;let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;if(n<0)return!0;if((e[n]===`+`||e[n]===`-`)&&e[n-1]===e[n]||e[n]===`!`&&n>0&&/[\w$)\]]/.test(e[n-1]??``)||e[n]===`>`&&n>0&&/[\w$)>]/.test(e[n-1]??``))return!1;if(`=([{,:;!?&|+-*%^~<>`.includes(e[n])||e[n]===`)`&&jn(e,n)||e[n]===`}`&&Pn(e,n))return!0;let r=n+1;for(;n>=0&&/[\w$]/.test(e[n]);)n--;let i=e.slice(n+1,r);return On.has(i)?!0:i==="default"&&Nn(e,n+1).value===`export`}function In(e,t){let n=!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(Tn(t))return-1;if(t===`\\`)r++;else if(t===`[`)n=!0;else if(t===`]`)n=!1;else if(t===`/`&&!n){for(r++;/[a-z]/i.test(e[r]??``);)r++;return r}}return-1}function Ln(e,t=!1){let n=[],r=[],i=[],a=!1,o=!1,s,c=-1,l,u=-1,d=!1;for(let f=0;f<e.length;f++){let p=e[f];if(!a&&!s&&p===`/`&&Fn(e,f)){let t=In(e,f);if(t!==-1){f=t-1,d=!1;continue}}if(n.length===0){wn(p)?d=!1:p===`/`&&(d=!0),p===`[`&&(q(n,f),o=d&&e[f-1]!==`:`&&e[f-1]!==`@`,i=[],l=void 0);continue}if(wn(p)&&(u=f),Tn(p)){n.length=0,i=[],a=!1,o=!1,s=void 0,c=-1,l=void 0;continue}if((a||s)&&/\s/.test(p)&&(l??=he(e,n.at(-1),!1,f),l===void 0)){n.length=0,i=[],a=!1,o=!1,s=void 0,c=-1;continue}if(!a&&!s&&p===`/`&&o){n.length=0,i=[],o=!1,c=-1;continue}if(a){p===`*`&&e[f+1]===`/`&&(a=!1,f++);continue}if(s){p===`\\`?(Tn(e[f+1])?(n.length=0,i=[],a=!1,s=void 0,c=-1):wn(e[f+1])&&(u=f+1),f++):p===s&&(q(i,[c+1,f]),s=void 0,c=-1);continue}if(p===`/`&&e[f+1]===`*`)a=!0,f++;else if(p===`"`||p===`'`)s=p,c=f;else if(p===`\\`)Tn(e[f+1])&&(n.length=0,i=[],a=!1,s=void 0,c=-1),wn(e[f+1])&&(u=f+1),f++;else if(p===`[`)q(n,f);else if(p===`]`){let a=n.pop(),s=f+1,c=!1;if(s!==a+2&&u>a){let n=e[a-1]===`:`||e[a-1]===`@`,i=e[s]===`:`&&!!e[s+1]&&!_n.test(e[s+1]);c=n&&!we(e,a)||i&&!(t&&Dn(e,s)),c&&q(r,[a,s])}if(n.length===0){if(o=!1,l=void 0,!c)for(let[t,n]of i)for(let[i,a]of Ln(e.slice(t,n)))q(r,[t+i,t+a]);i=[]}}}let f=[];for(let e of r.sort(([e,t],[n,r])=>e-n||r-t))(f.length===0||e[0]>=f.at(-1)[1])&&q(f,e);return f}const Rn=/^(?:--?[\w-]+|[A-Z_$][\w$-]*|@teacss-skip-bracket-[\da-z]{6})$/i;function zn(e,t){let n=t;for(;n>0&&/[\w-]/.test(e[n-1]);)n--;if(n===t||e[n-1]!==`:`)return!1;let r=n-1,i=r;for(;i>0&&/[\w$@-]/.test(e[i-1]);)i--;if(!Rn.test(e.slice(i,r)))return!1;let a=i-1;for(;a>=0&&/\s/.test(e[a]);)a--;return a<0||!`{,?`.includes(e[a])}function Bn(e){let t=[],n=[],r=[],i=!1,a,o,s=-1,c,l=()=>{if(s<0||n.length===0)return;let e=n.at(-1);e.attached&&e.containsGroupBrace&&q(t,[e.start,s+1]),s=-1};for(let u=0;u<e.length;u++){let d=e[u];if(n.length===0){a?a!=="`"&&Tn(d)?a=void 0:d===`\\`?u=En(e,u):d===a?a=void 0:d===`(`&&zn(e,u)&&(q(n,{attached:!0,containsGroupBrace:!1,outerQuote:a,start:u}),c=void 0):d===`"`||d===`'`||d==="`"?a=d:d===`(`&&zn(e,u)&&(q(n,{attached:!0,containsGroupBrace:!1,outerQuote:void 0,start:u}),c=void 0);continue}if(Tn(d)){l(),n.length=0,r.length=0,i=!1,o=void 0,a!=="`"&&(a=void 0),c=void 0;continue}if((o||i)&&/\s/.test(d)&&(c??=he(e,n.at(-1).start,!0,u),c===void 0)){n.length=0,r.length=0,i=!1,o=void 0,s=-1;continue}if(o){d===`\\`?u=En(e,u):d===o?o=void 0:d===`{`&&(n.at(-1).containsGroupBrace=!0);continue}if(i){d===`*`&&e[u+1]===`/`&&(i=!1,u++);continue}let f=n[0].outerQuote;if(d===`/`&&e[u+1]===`*`)i=!0,u++;else if(f&&d===f)l(),n.length=0,r.length=0,i=!1,a=void 0;else if(d===`"`||d===`'`||d==="`")o=d;else if(d===`\\`)u=En(e,u);else if(r.length>0)d===`[`?q(r,`]`):d===`(`?q(r,`)`):d===r.at(-1)?(r.pop(),r.length===0?s=-1:d===`)`&&(s=u)):d===`{`&&(n.at(-1).containsGroupBrace=!0);else if(d===`[`)q(r,`]`);else if(d===`{`)n.at(-1).containsGroupBrace=!0;else if(d===`(`)q(n,{attached:zn(e,u),containsGroupBrace:!1,outerQuote:f,start:u});else if(d===`)`){let e=n.pop();e.attached&&e.containsGroupBrace&&q(t,[e.start,u+1]),e.containsGroupBrace&&n.length>0&&(n.at(-1).containsGroupBrace=!0),n.length===0&&(c=void 0)}}l();let u=[];for(let e of t.sort(([e,t],[n,r])=>e-n||r-t))(u.length===0||e[0]>=u.at(-1)[1])&&q(u,e);return u}function Vn(e,t,n){if(!t.length)return e;let r=new Set([...e.matchAll(gn)].map(e=>e[0])),i=new Set([...n.keys(),...r]),a=[],o=0;for(let[s,c]of t){let t=e.slice(s,c),l=0,u;for(;u=`${hn}${pn(l?`${t}:${l}`:t)}`,l++,!(n.get(u)===t&&!r.has(u)||!i.has(u)););i.add(u),n.set(u,t),q(a,e.slice(o,s)),q(a,u),o=c}return q(a,e.slice(o)),a.join(``)}function Hn(e,t,n=!1){return Vn(e,Ln(e,n),t)}function Un(e,t){return Vn(e,Bn(e),t)}function Wn(e,t){let n=e;for(let e=0;e<t.size&&n.includes(hn);e++){let e=n.replace(gn,e=>t.get(e)??e);if(e===n)break;n=e}return n}function Gn(e,t){let n=new Map;e.includes(`[`)&&(e=Hn(e,n,!0)),e.includes(`(`)&&(e=Un(e,n));let r=ln(e,t);e=r.code;for(let i=1;i<5&&r.nestedOpening;i++){let i=e;if(i.includes(`[`)&&(i=Hn(i,n)),i.includes(`(`)&&(i=Un(i,n)),r=ln(i,t),r.code===i)break;e=r.code}e.includes(`[`)&&(e=Hn(e,n)),e.includes(`(`)&&(e=Un(e,n));let i=e.split(mn);return n.size?i.map(e=>e.includes(hn)?Wn(e,n):e):i}const Kn={name:`@teacss/core/extractor-split`,order:0,extract({code:e,id:t}){return Gn(xn(t)?e:Cn(e,bn(t)),Sn(t))}};function qn(e,t,n){if(Object.hasOwn(e,t)){if(!Reflect.set(e,t,n))throw TypeError(`Cannot assign event "${String(t)}"`)}else Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}function Jn(){return{events:Object.create(null),emit(e,...t){let n=Object.hasOwn(this.events,e)?this.events[e]:void 0,r=le(Array.isArray(n)?n:[]).map(e=>e);for(let e of r)e(...t)},on(e,t){let n=this.events,r=Object.hasOwn(n,e)?n[e]:void 0,i=Array.isArray(r)?r:[];return Array.isArray(r)||qn(n,e,i),Object.defineProperty(i,i.length,{configurable:!0,enumerable:!0,value:t,writable:!0}),()=>{let r=Object.hasOwn(n,e)?n[e]:void 0;qn(n,e,le(Array.isArray(r)?r:[]).filter(e=>e!==t))}}}}const Yn=/^\[(.+?)~?="(.*)"\]$/,Xn=/[\w\u00A0-\uFFFF%-?]/;new RegExp(Yn.source,Yn.flags),new RegExp(Xn.source,Xn.flags);function Zn(e){return e.match(Yn)}function Qn(e){return e!=null}const $n={minAffix:4,maxDistance:1,minDistanceLength:6,segmentAffix:!0},er={minAffix:3,maxDistance:1,minDistanceLength:0,segmentAffix:!1},tr={minAffix:3,maxDistance:2,minDistanceLength:0,segmentAffix:!1};function nr(e){let t=0,n;for(let r=0;r<e.length;r++){let i=e[r];if(n){i===`\\`?r++:i===n&&(n=void 0);continue}if(i===`"`||i===`'`)n=i;else if(i===`\\`)r++;else if(i===`[`||i===`(`)t++;else if(i===`]`||i===`)`)t--;else if(i===`@`&&t===0)return e.slice(0,r)}return e}function rr(e){if(e.flags)return;let t=e.source;if(!t.startsWith(`^`))return;let n=1;for(;n<t.length&&/[A-Za-z0-9_-]/.test(t[n]);)n++;return t[n]===`:`&&n>1?t.slice(1,n):void 0}function ir(e,t){for(let n of t){let t=n[0];if((t.global||t.sticky)&&(t.lastIndex=0),t.test(e))return!0}return!1}const ar=new WeakMap;function or(e){let t=ar.get(e.rulesStaticMap);if(t)return t;let n=new Map,r=new Set;for(let t of Object.keys(e.rulesStaticMap)){let e=t.indexOf(`:`);if(e<=0)continue;let r=t.slice(0,e),i=n.get(r);i||(i=new Set,n.set(r,i)),i.add(t.slice(e+1))}for(let t of e.rulesDynamic){let e=rr(t[0]);e!=null&&!n.has(e)&&r.add(e)}let i={prefixValues:n,dynamicPrefixes:r};return ar.set(e.rulesStaticMap,i),i}function sr(e,t,n){if(e===t)return 0;if(Math.abs(e.length-t.length)>n)return 1/0;let r=Array.from({length:t.length+1},(e,t)=>t);for(let i=1;i<=e.length;i++){let a=[i],o=i;for(let n=1;n<=t.length;n++){let s=e[i-1]===t[n-1]?0:1;a[n]=Math.min(r[n]+1,a[n-1]+1,r[n-1]+s),a[n]<o&&(o=a[n])}if(o>n)return 1/0;r=a}return r[t.length]<=n?r[t.length]:1/0}function cr(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return r}function lr(e,t){return(t.startsWith(e)?t[e.length]===`-`:t.endsWith(e)&&t[t.length-e.length-1]===`-`)&&(e.includes(`-`)||e.length>=6)}function ur(e,t,n){if(e.length>=n.minDistanceLength){let r=sr(e,t,n.maxDistance);if(r!==1/0)return r}let r=e.length<=t.length?e:t,i=e.length<=t.length?t:e;if(r.length>=n.minAffix&&(n.segmentAffix?lr(r,i):i.startsWith(r)||i.endsWith(r)||i.includes(r)))return 3+(i.length-r.length)/100;if(!n.segmentAffix&&cr(e,t)>=n.minAffix)return 5+Math.abs(e.length-t.length)/100}function dr(e,t,n={}){let r=nr(e),i=r.indexOf(`:`);if(i<=0)return;let a=r.slice(0,i),o=r.slice(i+1),{prefixValues:s,dynamicPrefixes:c}=or(t),l=[];if(s.has(a)||c.has(a)||ir(r,t.rulesDynamic))for(let e of s.get(a)??[]){if(e===o)continue;let t=ur(o,e,tr);t!==void 0&&l.push({suggestion:`${a}:${e}`,score:t})}else{if(!n.confirmedIntent&&a.length<3)return;let e=new Set([...s.keys(),...c]);for(let t of e){let e=ur(a,t,n.confirmedIntent?er:$n);if(e===void 0)continue;let r=s.get(t)?.has(o)||c.has(t);l.push({suggestion:`${t}:${o}`,score:r?e:e+10})}if(l.length===0)return}l.sort((e,t)=>e.score-t.score||(e.suggestion<t.suggestion?-1:1));let u=new Set,d=[];for(let{suggestion:e}of l)if(!(u.has(e)||e===r)&&(u.add(e),d.push(e),d.length===3))break;return d}Object.freeze({shortcutsNoMerge:Symbol.for(`@teacss/core/shortcut-no-merge`),noMerge:Symbol.for(`@teacss/core/no-merge`),noScope:Symbol.for(`@teacss/core/no-scope`),variants:Symbol.for(`@teacss/core/variants`),parent:Symbol.for(`@teacss/core/parent`),selector:Symbol.for(`@teacss/core/selector`),layer:Symbol.for(`@teacss/core/layer`),sort:Symbol.for(`@teacss/core/sort`),body:Symbol.for(`@teacss/core/body`)});const fr={px:1,rem:16,em:16,in:96,pt:96/72,pc:16,cm:96/2.54,mm:96/25.4,q:96/101.6},pr=`vw.vh.vi.vb.vmin.vmax.svw.svh.svmin.svmax.lvw.lvh.lvmin.lvmax.dvw.dvh.dvmin.dvmax.cqw.cqh.cqi.cqb.cqmin.cqmax.ch.ex.cap.ic.lh.rlh.%`.split(`.`),mr=RegExp(`^([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:e[+-]?\\d+)?)(${[...Object.keys(fr),...pr].sort((e,t)=>t.length-e.length).join(`|`)})?$`,`i`);function hr(e){let t=mr.exec(e.trim());if(!t)return null;let n=Number.parseFloat(t[1]);if(!Number.isFinite(n))return null;let r=(t[2]??`px`).toLowerCase();if(!Object.hasOwn(fr,r))return{unit:r,value:n};let i=Math.round(n*fr[r]*1e6)/1e6;return{unit:`px`,value:Number.isFinite(i)?i:n*fr[r]}}function gr(e){let t=e.indexOf(` $$ `),n=t<0?e:e.slice(0,t);if(!/^@media\b/i.test(n)||/\bnot\b/i.test(n))return null;for(let e of n.matchAll(/\(\s*min-width\s*:\s*([^)]*?)\s*\)/gi)){let t=hr(e[1]);if(t)return t}for(let e of n.matchAll(/\(\s*max-width\s*:\s*([^)]*?)\s*\)/gi)){let t=hr(e[1]);if(t)return{unit:t.unit,value:-t.value}}return null}function _r(e,t){return e<t?-1:+(e>t)}function vr(e,t,n){let r=(e.get(t)??0)-(e.get(n)??0);if(r)return r;let i=gr(t),a=gr(n);if(i==null!=(a==null))return i==null?-1:1;if(i!=null&&a!=null){if(i.unit!==a.unit)return _r(i.unit,a.unit);if(i.value!==a.value)return i.value-a.value}return _r(t,n)}Function.prototype;const yr=`@teacss-skip-start`,br=`@teacss-skip-end`;RegExp(`(//\\s*?${yr}\\s*?|\\/\\*\\s*?${yr}\\s*?\\*\\/|<!--\\s*?${yr}\\s*?-->)[\\s\\S]*?(//\\s*?${br}\\s*?|\\/\\*\\s*?${br}\\s*?\\*\\/|<!--\\s*?${br}\\s*?-->)`,`g`);const xr=RegExp(`(//\\s*?${yr}\\s*?|\\/\\*\\s*?${yr}\\s*?\\*\\/|<!--\\s*?${yr}\\s*?-->)[\\s\\S]*?(//\\s*?${br}\\s*?|\\/\\*\\s*?${br}\\s*?\\*\\/|<!--\\s*?${br}\\s*?-->)`,`g`);function Sr(e){return e===`
20
+ `||e===`\r`||e===`\u2028`||e===`\u2029`}function Cr(e,t,n){for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`\\`){r++;continue}if(t===n)return r+1;if(n!=="`"&&Sr(t))return r}return e.length}const wr=/\.(?:[cm]?[jt]sx?|vue|svelte|astro|marko|php|phtml|scss|sass|less|styl(?:us)?)(?:$|\?)/i,Tr=/\.(?:html?|vue|svelte|astro|marko|mdx?|php|phtml)(?:$|\?)/i;function Er(e,t){let n=[],r=t===void 0||wr.test(t),i=t===void 0||Tr.test(t);for(let t=0;t<e.length;){let a=e[t];if(a===`"`||a===`'`||a==="`"){t=Cr(e,t,a);continue}if(e.startsWith(`{/*`,t)){let r=e.indexOf(`*/}`,t+3);n.push([t,r<0?e.length:r+3]),t=n[n.length-1][1];continue}if(i&&e.startsWith(`<!--`,t)){let r=e.indexOf(`-->`,t+4);n.push([t,r<0?e.length:r+3]),t=n[n.length-1][1];continue}if(e.startsWith(`/*`,t)){let r=e.indexOf(`*/`,t+2);n.push([t,r<0?e.length:r+2]),t=n[n.length-1][1];continue}if(r&&e.startsWith(`//`,t)){let r=e.slice(t+2).search(/[\n\r]/),i=r<0?e.length:t+2+r;n.push([t,i]),t=n[n.length-1][1];continue}t++}return n}const Dr=[/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|`(?:\\[\s\S]|[^`\\])*`/g,/<[^/?<>0-9$_!"'](?:"[^"]*"|'[^']*'|[^>])+>/g,/(@apply|--at-apply)[^;]*;/g],Or=[xr],kr=/([\\:]?[\s"'`;<>]|:\(|\)"|\)\s)/g,Ar=/(?:[\w&:[\]-]|\[\S{1,64}=\S{1,64}\]){1,64}\[\\?['"]?\S{0,64}?['"]\]\]?[\w:@-]{0,64}/g,jr=/\[(\\\W|[\w-]){1,64}:[^\s:]{0,64}?("\S{1,64}?"|'\S{1,64}?'|`\S{1,64}?`|[^\s:]{1,64}?)[^\s:]{0,64}?\)?\]/g;async function Mr(e,t,n=``){let r=e.config.extractors?.find(e=>e.name===`pug`);if(!r)return{pug:!1,code:``};let i={code:t,id:n};await r.extract?.(i);let a=i.code.startsWith(t)?i.code.substring(t.length+2):i.code;return i.code===t?{pug:!1,code:``}:{pug:!0,code:a}}function Nr(e,t,n){let r=[];t.has(e)&&r.push([n,n+e.length,e]);let i=new Set;for(let a of e.matchAll(/\.([^.#=\s(]+)(?=[.#=\s(]|$)/g)){let e=a[1];if(e.includes(`:`)||i.has(e)||!t.has(e))continue;i.add(e);let o=n+a.index+1;r.push([o,o+e.length,e])}return r}function Pr(e,t){let n=e.flags.includes(`g`)?e.flags:`${e.flags}g`;return t.matchAll(new RegExp(e.source,n))}function Fr(e,t){let n=t.map(([t,n])=>[Math.max(0,t),Math.min(e.length,n)]).filter(([e,t])=>t>e).sort((e,t)=>e[0]-t[0]||e[1]-t[1]);if(!n.length)return e;let r=[];for(let[e,t]of n){let n=r.at(-1);n&&e<=n[1]?n[1]=Math.max(n[1],t):r.push([e,t])}let i=[],a=0;for(let[t,n]of r)i.push(e.slice(a,t),` `.repeat(n-t)),a=n;return i.push(e.slice(a)),i.join(``)}function Ir(e){let t=[...e].sort((e,t)=>e[0]-t[0]||t[1]-e[1]),n=[],r=[],i=-1;for(let[e,a]of t)n.push(e),i=Math.max(i,a),r.push(i);return{starts:n,maxEnds:r}}function Lr(e,t,n){let r=0,i=e.starts.length;for(;r<i;){let n=r+i>>>1;e.starts[n]<=t?r=n+1:i=n}return r>0&&e.maxEnds[r-1]>=n}function Rr(e){return e===void 0||/[\s'"`;<>]/.test(e)}function zr(e,t){if(!t.size)return[];let n={children:new Map};for(let e of t){let t=n;for(let n=0;n<e.length;n++){let r=e[n],i=t.children.get(r);i||(i={children:new Map},t.children.set(r,i)),t=i}t.value=e}let r=[];for(let t=0;t<e.length;t++){if(!Rr(e[t-1]))continue;let i=n;for(let n=t;n<e.length;n++){let a=i.children.get(e[n]);if(!a)break;i=a,i.value&&Rr(e[n+1])&&r.push([t,n+1,i.value])}}return r}function Br(e,t,n){for(let r=t+1;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===n)return r;return-1}function Vr(e,t,n){if(!n)return[];let r=[],i=RegExp(`(^|[^\\w:-])${un(t)}\\s*=\\s*(['"])`,`g`);for(let t of e.matchAll(i)){let i=t.index+t[0].length-1,a=Br(e,i,t[2]);if(!(a<0))for(let t=e.indexOf(n,i+1);t>=0&&t+n.length<=a;t=e.indexOf(n,t+n.length)){let o=t===i+1||/\s/.test(e[t-1]),s=t+n.length===a||/\s/.test(e[t+n.length]);o&&s&&r.push(t)}}return r}function Hr(e,t){let n=0,r=0,i=!1;for(let a=t+1;a<e.length;a++){let t=e[a];if(t===`(`){if(n===0&&r===0&&!i)return-1;n++}else if(t===`)`)n>0&&n--;else if(t===`[`)r++;else if(t===`]`)r>0&&r--;else if((t===`:`||t===`;`)&&n===0&&r===0)i=!0;else if(t===`}`&&n===0&&r===0)return a}return-1}function Ur(e,t){let n=t;if(e[n]===`!`&&n++,e[n]!==`@`)return{suffix:e.slice(t,n),end:n};let r=0,i=0;for(;n<e.length;n++){let t=e[n];if(t===`(`)r++;else if(t===`)`)r>0&&r--;else if(t===`[`)i++;else if(t===`]`)i>0&&i--;else if((/\s/.test(t)||t===`"`||t===`'`||t==="`"||t===`{`||t===`}`)&&r===0&&i===0)break}return{suffix:e.slice(t,n),end:n}}function Wr(e){let t=[],n=0,r=0,i=0;for(let a=0;a<e.length;a++){let o=e[a];o===`(`?n++:o===`)`?n>0&&n--:o===`[`?r++:o===`]`?r>0&&r--:o===`;`&&n===0&&r===0&&(t.push(e.slice(i,a).trim()),i=a+1)}return t.push(e.slice(i).trim()),t.filter(Boolean)}function Gr(e,t,n){let r=Hr(e,t);if(r<0)return null;let i=Wr(e.slice(t+1,r));if(!i.length)return null;let{suffix:a,end:o}=Ur(e,r+1);return i.every(e=>n.has(e)||n.has(`${e}${a}`))?[t,o,e.slice(t,o)]:null}function Kr(e,t,n=[],r={}){let i=[],a=[],o=new Set,s=new Set,c=[];if(r.excludeRanges&&(e=Fr(e,r.excludeRanges)),r.excludeRegex)for(let t of r.excludeRegex){let n=Array.from(Pr(t,e),e=>[e.index,e.index+e[0].length]);e=Fr(e,n)}if(r.includeRegex)for(let t of r.includeRegex)for(let n of Pr(t,e))c.push([n.index,n.index+n[0].length]);else c.push([0,e.length]);let l=Ir(c);Array.from(t).forEach(e=>{let t=Zn(e);t?t[2]?a.push(t):(/[><()]|\[\\?['"`]/.test(t[1])&&s.add(t[1]),o.add(t[1])):(/[><()]|\[\\?['"`]/.test(e)&&s.add(e),o.add(e))}),i.push(...zr(e,s));let u=0;e.split(kr).forEach(e=>{let t=u+e.length;r.isPug?i.push(...Nr(e,o,u)):o.has(e)&&i.push([u,t,e]),u=t});for(let t of e.matchAll(Ar)){let e=t.index,n=e+t[0].length;o.has(t[0])&&i.push([e,n,t[0]])}let d=new Set(i.map(([e,t])=>`${e}:${t}`));for(let t of e.matchAll(jr)){let e=t.index,n=e+t[0].length;if(o.has(t[0])){let r=`${e}:${n}`;d.has(r)||(d.add(r),i.push([e,n,t[0]]))}}a.forEach(([,t,n])=>{for(let r of Vr(e,t,n)){let e=r+n.length;i.push([r,e,`[${t}="${n}"]`])}});for(let t=e.indexOf(`{`);t>=0;t=e.indexOf(`{`,t+1)){let n=Gr(e,t,o);if(!n)continue;let[r,a]=n;for(let e=i.length-1;e>=0;e--){let[t,n]=i[e];t>=r&&n<=a&&i.splice(e,1)}i.some(([e,t])=>e===r&&t===a)||i.push(n)}i.push(...n.map(e=>[e.offset,e.offset+e.length,e.className]));let f=new Set;return i.filter(([e,t])=>Lr(l,e,t)).filter(([e,t,n])=>{let r=`${e}:${t}:${n}`;return f.has(r)?!1:(f.add(r),!0)}).sort((e,t)=>e[0]-t[0])}const qr=[`@teacss/directives`,`@teacss/transformer-compile-class`];async function Jr(e,t,n=``,r={}){let i=new c(t),a={generator:e,tokens:new Set},o=e.config.transformers?.filter(e=>!qr.includes(e.name)),s=[];for(let e of[`pre`,`default`,`post`])for(let t of o?.filter(t=>(t.enforce??`default`)===e)||[]){let e=(await t.transform(i,n,a))?.highlightAnnotations;e&&s.push(...e)}let{pug:l,code:u}=await Mr(e,i.toString(),n);return Kr(t,[...(await e.generate(l?u:i.toString(),{preflights:!1,safelist:!1})).matched],s,{isPug:l,...r})}function Yr(e,t,n,r){if(!(r<1)){if(e.delete(t),e.size>=r){let t=e.keys().next();t.done||e.delete(t.value)}e.set(t,n)}}function Xr(e,t,n,r){let i=e.get(t);if(i)return Yr(e,t,i,n),i;let a;return a=r().catch(n=>{throw e.get(t)===a&&e.delete(t),n}),Yr(e,t,a,n),a}const Zr=new Map;function Qr(e){Zr.delete(e)}function $r(){Zr.clear()}function ei(e,t,n,r=!1,i=!1){i&&Zr.delete(n);let a=Zr.get(n);if(a&&a.code===t&&a.config===e.config&&a.generator===e&&a.strictAnnotationMatch===r)return Yr(Zr,n,a,100),a.result;let o=Jr(e,t,n,{excludeRanges:Er(t,n),excludeRegex:Or,...r?{includeRegex:Dr}:null});return Yr(Zr,n,{code:t,config:e.config,generator:e,strictAnnotationMatch:r,result:o},100),o}
21
21
  /** @license
22
22
  * fzf v0.5.2
23
23
  * Copyright (c) 2021 Ajit
24
24
  * Licensed under BSD 3-Clause
25
25
  */
26
- const ei={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t`,383:`s`,384:`b`,385:`B`,387:`b`,390:`O`,392:`c`,393:`D`,394:`D`,396:`d`,398:`E`,400:`E`,402:`f`,403:`G`,407:`I`,409:`k`,410:`l`,412:`M`,413:`N`,414:`n`,415:`O`,421:`p`,427:`t`,429:`t`,430:`T`,434:`V`,436:`y`,438:`z`,477:`e`,485:`g`,544:`N`,545:`d`,549:`z`,564:`l`,565:`n`,566:`t`,567:`j`,570:`A`,571:`C`,572:`c`,573:`L`,574:`T`,575:`s`,576:`z`,579:`B`,580:`U`,581:`V`,582:`E`,583:`e`,584:`J`,585:`j`,586:`Q`,587:`q`,588:`R`,589:`r`,590:`Y`,591:`y`,592:`a`,593:`a`,595:`b`,596:`o`,597:`c`,598:`d`,599:`d`,600:`e`,603:`e`,604:`e`,605:`e`,606:`e`,607:`j`,608:`g`,609:`g`,610:`G`,613:`h`,614:`h`,616:`i`,618:`I`,619:`l`,620:`l`,621:`l`,623:`m`,624:`m`,625:`m`,626:`n`,627:`n`,628:`N`,629:`o`,633:`r`,634:`r`,635:`r`,636:`r`,637:`r`,638:`r`,639:`r`,640:`R`,641:`R`,642:`s`,647:`t`,648:`t`,649:`u`,651:`v`,652:`v`,653:`w`,654:`y`,655:`Y`,656:`z`,657:`z`,663:`c`,665:`B`,666:`e`,667:`G`,668:`H`,669:`j`,670:`k`,671:`L`,672:`q`,686:`h`,867:`a`,868:`e`,869:`i`,870:`o`,871:`u`,872:`c`,873:`d`,874:`h`,875:`m`,876:`r`,877:`t`,878:`v`,879:`x`,7424:`A`,7427:`B`,7428:`C`,7429:`D`,7431:`E`,7432:`e`,7433:`i`,7434:`J`,7435:`K`,7436:`L`,7437:`M`,7438:`N`,7439:`O`,7440:`O`,7441:`o`,7442:`o`,7443:`o`,7446:`o`,7447:`o`,7448:`P`,7449:`R`,7450:`R`,7451:`T`,7452:`U`,7453:`u`,7454:`u`,7455:`m`,7456:`V`,7457:`W`,7458:`Z`,7522:`i`,7523:`r`,7524:`u`,7525:`v`,7834:`a`,7835:`s`,8305:`i`,8341:`h`,8342:`k`,8343:`l`,8344:`m`,8345:`n`,8346:`p`,8347:`s`,8348:`t`,8580:`c`};for(let e=`̀`.codePointAt(0);e<=`ͯ`.codePointAt(0);++e){let t=String.fromCodePoint(e);for(let e of`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`){let n=(e+t).normalize().codePointAt(0);n>126&&(ei[n]=e)}}const ti={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(let e of Object.keys(ti)){let t=e.toUpperCase();for(let n=ti[e][0];n<=ti[e][1];++n)ei[n]=n%2==0?t:e}function ni(e){if(e<192||e>8580)return e;let t=ei[e];return t===void 0?e:t.codePointAt(0)}function ri(e){return e}function ii(e){return e}function ai(e,t){return e>t?e:t}const oi=e=>e.split(``).map(e=>e.codePointAt(0)),si=new Set(` \f
27
- \r \v\xA0 \u2028\u2029   `.split(``).map(e=>e.codePointAt(0)));for(let e=` `.codePointAt(0);e<=` `.codePointAt(0);e++)si.add(e);const ci=``.codePointAt(0),li=`A`.codePointAt(0),ui=`Z`.codePointAt(0),di=`a`.codePointAt(0),fi=`z`.codePointAt(0),pi=`0`.codePointAt(0),mi=`9`.codePointAt(0);function hi(e,t,n){return n?e:t-e-1}function gi(e){return e?new Set:null}function _i(e,t,n){if(t!==null&&t.i16.length>e+n){let r=t.i16.subarray(e,e+n);return[e+n,r]}return[e,new Int16Array(n)]}function vi(e,t,n){if(t!==null&&t.i32.length>e+n){let r=t.i32.subarray(e,e+n);return[e+n,r]}return[e,new Int32Array(n)]}function yi(e){return e>=di&&e<=fi?1:e>=li&&e<=ui?2:e>=pi&&e<=mi?4:0}function bi(e){let t=String.fromCodePoint(e);return t===t.toUpperCase()?t===t.toLowerCase()?t.match(/\p{Number}/gu)===null?t.match(/\p{Letter}/gu)===null?0:3:4:2:1}function xi(e){return e<=ci?yi(e):bi(e)}function Si(e,t){return e===0&&t!==0?8:e===1&&t===2||e!==4&&t===4?7:t===0?8:0}function Ci(e,t){return t===0?8:Si(xi(e[t-1]),xi(e[t]))}function wi(e,t,n,r){let i=e.slice(r),a=i.indexOf(n);if(a===0)return r;if(!t&&n>=di&&n<=fi){a>0&&(i=i.slice(0,a));let e=i.indexOf(n-32);e>=0&&(a=e)}return a<0?-1:r+a}function Ti(e){for(let t of e)if(t>=128)return!1;return!0}function Ei(e,t,n){if(!Ti(e))return 0;if(!Ti(t))return-1;let r=0,i=0;for(let a=0;a<t.length;a++){if(i=wi(e,n,t[a],i),i<0)return-1;a===0&&i>0&&(r=i-1),i++}return r}const Di=(e,t,n,r,i,a,o)=>{let s=i.length;if(s===0)return[{start:0,end:0,score:0},gi(a)];let c=r.length;if(o!==null&&c*s>o.i16.length)return ki(e,t,n,r,i,a);let l=Ei(r,i,e);if(l<0)return[{start:-1,end:-1,score:0},null];let u=0,d=0,f=null,p=null,m=null,h=null;[u,f]=_i(u,o,c),[u,p]=_i(u,o,c),[u,m]=_i(u,o,c),[d,h]=vi(d,o,s);let[,g]=vi(d,o,c);for(let e=0;e<g.length;e++)g[e]=r[e];let _=ri(0),v=0,y=0,b=0,x=i[0],S=i[0],C=ri(0),w=0,T=!1,E=g.subarray(l),D=f.subarray(l).subarray(0,E.length),O=p.subarray(l).subarray(0,E.length),k=m.subarray(l).subarray(0,E.length);for(let[r,a]of E.entries()){let o=null;a<=ci?(o=yi(a),!e&&o===2&&(a+=32)):(o=bi(a),!e&&o===2&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0)),t&&(a=ni(a))),E[r]=a;let c=Si(w,o);if(k[r]=c,w=o,a===S&&(y<s&&(h[y]=ii(l+r),y++,S=i[Math.min(y,s-1)]),b=l+r),a===x){let e=16+c*2;if(D[r]=e,O[r]=1,s===1&&(n&&e>_||!n&&e>=_)&&(_=e,v=l+r,n&&c===8))break;T=!1}else T?D[r]=ai(C+-1,0):D[r]=ai(C+-3,0),O[r]=0,T=!0;C=D[r]}if(y!==s)return[{start:-1,end:-1,score:0},null];if(s===1){let e={start:v,end:v+1,score:_};if(!a)return[e,null];let t=new Set;return t.add(v),[e,t]}let A=h[0],j=b-A+1,M=null;[u,M]=_i(u,o,j*s);{let e=f.subarray(A,b+1);for(let[t,n]of e.entries())M[t]=n}let[,N]=_i(u,o,j*s);{let e=p.subarray(A,b+1);for(let[t,n]of e.entries())N[t]=n}let P=h.subarray(1),F=i.slice(1).slice(0,P.length);for(let[e,t]of P.entries()){let r=!1,i=F[e],a=e+1,o=a*j,c=g.subarray(t,b+1),l=m.subarray(t).subarray(0,c.length),u=N.subarray(o+t-A).subarray(0,c.length),d=N.subarray(o+t-A-1-j).subarray(0,c.length),f=M.subarray(o+t-A).subarray(0,c.length),p=M.subarray(o+t-A-1-j).subarray(0,c.length),h=M.subarray(o+t-A-1).subarray(0,c.length);h[0]=0;for(let[e,o]of c.entries()){let c=e+t,g=0,y=0,b=0;if(y=r?h[e]+-1:h[e]+-3,i===o){g=p[e]+16;let t=l[e];b=d[e]+1,t===8?b=1:b>1&&(t=ai(t,ai(4,m[c-b+1]))),g+t<y?(g+=l[e],b=0):g+=t}u[e]=b,r=g<y;let x=ai(ai(g,y),0);a===s-1&&(n&&x>_||!n&&x>=_)&&(_=x,v=c),f[e]=x}}let I=gi(a),L=A;if(a&&I!==null){let e=s-1;L=v;let t=!0;for(;;){let n=e*j,r=L-A,i=M[n+r],a=0,o=0;if(e>0&&L>=h[e]&&(a=M[n-j+r-1]),L>h[e]&&(o=M[n+r-1]),i>a&&(i>o||i===o&&t)){if(I.add(L),e===0)break;e--}t=N[n+r]>1||n+j+r+1<N.length&&N[n+j+r+1]>0,L--}}return[{start:L,end:v+1,score:_},I]};function Oi(e,t,n,r,i,a,o){let s=0,c=0,l=!1,u=0,d=ri(0),f=gi(o),p=0;i>0&&(p=xi(n[i-1]));for(let m=i;m<a;m++){let i=n[m],a=xi(i);if(e||(i>=li&&i<=ui?i+=32:i>ci&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),t&&(i=ni(i)),i===r[s]){o&&f!==null&&f.add(m),c+=16;let e=Si(p,a);u===0?d=e:(e===8&&(d=e),e=ai(ai(e,d),4)),s===0?c+=e*2:c+=e,l=!1,u++,s++}else l?c+=-1:c+=-3,l=!0,u=0,d=0;p=a}return[c,f]}const ki=(e,t,n,r,i,a,o)=>{if(i.length===0)return[{start:0,end:0,score:0},null];if(Ei(r,i,e)<0)return[{start:-1,end:-1,score:0},null];let s=0,c=-1,l=-1,u=r.length,d=i.length;for(let a=0;a<u;a++){let o=r[hi(a,u,n)];e||(o>=li&&o<=ui?o+=32:o>ci&&(o=String.fromCodePoint(o).toLowerCase().codePointAt(0))),t&&(o=ni(o));let f=i[hi(s,d,n)];if(o===f&&(c<0&&(c=a),s++,s===d)){l=a+1;break}}if(c>=0&&l>=0){s--;for(let t=l-1;t>=c;t--){let a=r[hi(t,u,n)];e||(a>=li&&a<=ui?a+=32:a>ci&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0)));let o=i[hi(s,d,n)];if(a===o&&(s--,s<0)){c=t;break}}if(!n){let e=c;c=u-l,l=u-e}let[o,f]=Oi(e,t,r,i,c,l,a);return[{start:c,end:l,score:o},f]}return[{start:-1,end:-1,score:0},null]},Ai=(e,t,n,r,i,a,o)=>{if(i.length===0)return[{start:0,end:0,score:0},null];let s=r.length,c=i.length;if(s<c||Ei(r,i,e)<0)return[{start:-1,end:-1,score:0},null];let l=0,u=-1,d=ri(0),f=ri(-1);for(let a=0;a<s;a++){let o=hi(a,s,n),p=r[o];e||(p>=li&&p<=ui?p+=32:p>ci&&(p=String.fromCodePoint(p).toLowerCase().codePointAt(0))),t&&(p=ni(p));let m=hi(l,c,n);if(i[m]===p){if(m===0&&(d=Ci(r,o)),l++,l===c){if(d>f&&(u=a,f=d),d===8)break;a-=l-1,l=0,d=0}}else a-=l,l=0,d=0}if(u>=0){let a=0,o=0;n?(a=u-c+1,o=u+1):(a=s-(u+1),o=s-(u-c+1));let[l]=Oi(e,t,r,i,a,o,!1);return[{start:a,end:o,score:l},null]}return[{start:-1,end:-1,score:0},null]};function ji(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}const Mi=ji(102400,2048),Ni=(e,t,n)=>{let r=!1;switch(t){case`smart-case`:e.toLowerCase()!==e&&(r=!0);break;case`case-sensitive`:r=!0;break;case`case-insensitive`:e=e.toLowerCase(),r=!1;break}let i=oi(e);return n&&(i=i.map(ni)),{queryRunes:i,caseSensitive:r}};function Pi(e,t){let n=Object.keys(e).map(e=>parseInt(e,10)).sort((e,t)=>t-e),r=[];for(let i of n)if(r=r.concat(e[i]),r.length>=t)break;return r}function Fi(e,t,n){return r=>{let i=this.runesList[r];if(t.length>i.length)return;let[a,o]=this.algoFn(n,this.opts.normalize,this.opts.forward,i,t,!0,Mi);if(a.start===-1)return;if(this.opts.fuzzy===!1){o=new Set;for(let e=a.start;e<a.end;++e)o.add(e)}let s=this.opts.sort?a.score:0;e[s]===void 0&&(e[s]=[]),e[s].push({item:this.items[r],...a,positions:o??new Set})}}function Ii(e){let{queryRunes:t,caseSensitive:n}=Ni(e,this.opts.casing,this.opts.normalize),r={},i=Fi.bind(this)(r,t,n);for(let e=0,t=this.runesList.length;e<t;++e)i(e);return Pi(r,this.opts.limit)}const Li={limit:1/0,selector:e=>e,casing:`smart-case`,normalize:!0,fuzzy:`v2`,tiebreakers:[],sort:!0,forward:!0};var Ri=class{constructor(e,...t){switch(this.opts={...Li,...t[0]},this.items=e,this.runesList=e.map(e=>oi(this.opts.selector(e).normalize())),this.algoFn=Ai,this.opts.fuzzy){case`v2`:this.algoFn=Di;break;case`v1`:this.algoFn=ki;break}}};const zi={...Li,match:Ii};var Bi=class extends Ri{constructor(e,...t){super(e,...t),this.opts={...zi,...t[0]}}find(e){return e.length===0||this.items.length===0?this.items.slice(0,this.opts.limit).map(Vi):(e=e.normalize(),Hi(this.opts.match.bind(this)(e),this.opts))}};({...Li});const Vi=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function Hi(e,t){if(t.sort){let{selector:n}=t;e.sort((e,r)=>{if(e.score===r.score)for(let i of t.tiebreakers){let t=i(e,r,n);if(t!==0)return t}return 0})}return Number.isFinite(t.limit)&&e.splice(t.limit),e}function Ui(e,t,n){return n(e.item).length-n(t.item).length}function Wi(e,t){return e.start-t.start}var Gi=class{constructor(e,...t){this.finder=new Bi(e,...t),this.find=this.finder.find.bind(this.finder)}},Y=C(`lru-cache:metrics`),Ki=w(`lru-cache`),qi=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date,Ji=()=>Y.hasSubscribers||Ki.hasSubscribers,Yi=new Set,Xi=typeof process==`object`&&process?process:{},Zi=(e,t,n,r)=>{typeof Xi.emitWarning==`function`?Xi.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},Qi=e=>!Yi.has(e),$i=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),ea=e=>$i(e)?e<=2**8?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?ta:null:null,ta=class extends Array{constructor(e){super(e),this.fill(0)}},na=class e{heap;length;static#e=!1;static create(t){let n=ea(t);if(!n)return[];e.#e=!0;let r=new e(t,n);return e.#e=!1,r}constructor(t,n){if(!e.#e)throw TypeError(`instantiate Stack using Stack.create(n)`);this.heap=new n(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},ra=class e{#e;#t;#n;#r;#i;#a;#o;#s;get perf(){return this.#s}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#x,autopurgeTimers:e.#S,sizes:e.#y,keyMap:e.#u,keyList:e.#d,valList:e.#f,next:e.#p,prev:e.#m,get head(){return e.#h},get tail(){return e.#g},free:e.#_,isBackgroundFetch:t=>e.#W(t),backgroundFetch:(t,n,r,i)=>e.#U(t,n,r,i),moveToTail:t=>e.#X(t),indexes:t=>e.#I(t),rindexes:t=>e.#L(t),isStale:t=>e.#j(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#l}get size(){return this.#c}get fetchMethod(){return this.#a}get memoMethod(){return this.#o}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#i}constructor(t){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:s,allowStale:c,dispose:l,onInsert:u,disposeAfter:d,noDisposeOnSet:f,noUpdateTTL:p,maxSize:m=0,maxEntrySize:h=0,sizeCalculation:g,fetchMethod:_,memoMethod:v,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:S,ignoreFetchAbort:C,backgroundFetchSize:w=1,perf:T}=t;if(this.backgroundFetchSize=w,T!==void 0&&typeof T?.now!=`function`)throw TypeError(`perf option must have a now() method if specified`);if(this.#s=T??qi,n!==0&&!$i(n))throw TypeError(`max option must be a nonnegative integer`);let E=n?ea(n):Array;if(!E)throw Error(`invalid max value: `+n);if(this.#e=n,this.#t=m,this.maxEntrySize=h||this.#t,this.sizeCalculation=g,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError(`cannot set sizeCalculation without setting maxSize or maxEntrySize`);if(typeof this.sizeCalculation!=`function`)throw TypeError(`sizeCalculation set to non-function`)}if(v!==void 0&&typeof v!=`function`)throw TypeError(`memoMethod must be a function if defined`);if(this.#o=v,_!==void 0&&typeof _!=`function`)throw TypeError(`fetchMethod must be a function if specified`);if(this.#a=_,this.#w=!!_,this.#u=new Map,this.#d=Array.from({length:n}).fill(void 0),this.#f=Array.from({length:n}).fill(void 0),this.#p=new E(n),this.#m=new E(n),this.#h=0,this.#g=0,this.#_=na.create(n),this.#c=0,this.#l=0,typeof l==`function`&&(this.#n=l),typeof u==`function`&&(this.#r=u),typeof d==`function`?(this.#i=d,this.#v=[]):(this.#i=void 0,this.#v=void 0),this.#C=!!this.#n,this.#E=!!this.#r,this.#T=!!this.#i,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!C,this.maxEntrySize!==0){if(this.#t!==0&&!$i(this.#t))throw TypeError(`maxSize must be a positive integer if specified`);if(!$i(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);this.#M()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!s,this.ttlResolution=$i(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!$i(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);this.#D()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t=`LRU_CACHE_UNBOUNDED`;Qi(t)&&(Yi.add(t),Zi(`TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.`,`UnboundedCacheWarning`,t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#D(){let e=new ta(this.#e),t=new ta(this.#e);this.#x=e,this.#b=t;let n=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#S=n,this.#A=(n,i,a=this.#s.now())=>{t[n]=i===0?0:a,e[n]=i,r(n,i)},this.#O=n=>{t[n]=e[n]===0?0:this.#s.now(),r(n,e[n])};let r=this.ttlAutopurge?(e,t)=>{if(n?.[e]&&(clearTimeout(n[e]),n[e]=void 0),t&&t!==0&&n){let i=setTimeout(()=>{this.#j(e)?(this.#Z(this.#d[e],`expire`),n[e]=void 0):r(e,o(e))},t+1);i.unref&&i.unref(),n[e]=i}}:()=>{};this.#k=(n,r)=>{if(e[r]){let o=e[r],s=t[r];if(!o||!s)return;n.ttl=o,n.start=s,n.now=i||a(),n.remainingTTL=o-(n.now-s)}};let i=0,a=()=>{let e=this.#s.now();if(this.ttlResolution>0){i=e;let t=setTimeout(()=>i=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=e=>{let t=this.#u.get(e);return t===void 0?0:o(t)};let o=n=>{let r=e[n],o=t[n];return!r||!o?1/0:r-((i||a())-o)};this.#j=n=>{let r=t[n],o=e[n];return!!o&&!!r&&(i||a())-r>o}}#O=()=>{};#k=()=>{};#A=()=>{};#j=()=>!1;#M(){let e=new ta(this.#e);this.#l=0,this.#y=e,this.#N=t=>{this.#l-=e[t],e[t]=0},this.#F=(e,t,n,r)=>{if(!$i(n)){if(this.#W(t))return this.backgroundFetchSize;if(r){if(typeof r!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=r(t,e),!$i(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}else throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`)}return n},this.#P=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#l>n;)this.#B(!0)}this.#l+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#l)}}#N=e=>{};#P=(e,t,n)=>{};#F=(e,t,n,r)=>{if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`);return 0};*#I({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;this.#R(t)&&((e||!this.#j(t))&&(yield t),t!==this.#h);)t=this.#m[t]}*#L({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#h;this.#R(t)&&((e||!this.#j(t))&&(yield t),t!==this.#g);)t=this.#p[t]}#R(e){return e!==void 0&&this.#u.get(this.#d[e])===e}*entries(){for(let e of this.#I())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#W(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*rentries(){for(let e of this.#L())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#W(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*keys(){for(let e of this.#I()){let t=this.#d[e];t!==void 0&&!this.#W(this.#f[e])&&(yield t)}}*rkeys(){for(let e of this.#L()){let t=this.#d[e];t!==void 0&&!this.#W(this.#f[e])&&(yield t)}}*values(){for(let e of this.#I())this.#f[e]!==void 0&&!this.#W(this.#f[e])&&(yield this.#f[e])}*rvalues(){for(let e of this.#L())this.#f[e]!==void 0&&!this.#W(this.#f[e])&&(yield this.#f[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]=`LRUCache`;find(e,t={}){for(let n of this.#I()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;if(i!==void 0&&e(i,this.#d[n],this))return this.#J(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#I()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#L()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#L({allowStale:!0}))this.#j(t)&&(this.#Z(this.#d[t],`expire`),e=!0);return e}info(e){let t=this.#u.get(e);if(t===void 0)return;let n=this.#f[t],r=this.#W(n)?n.__staleWhileFetching:n;if(r===void 0)return;let i={value:r};if(this.#x&&this.#b){let e=this.#x[t],n=this.#b[t];e&&n&&(i.ttl=e-(this.#s.now()-n),i.start=Date.now())}return this.#y&&(i.size=this.#y[t]),i}dump(){let e=[];for(let t of this.#I({allowStale:!0})){let n=this.#d[t],r=this.#f[t],i=this.#W(r)?r.__staleWhileFetching:r;if(i===void 0||n===void 0)continue;let a={value:i};if(this.#x&&this.#b){a.ttl=this.#x[t];let e=this.#s.now()-this.#b[t];a.start=Math.floor(Date.now()-e)}this.#y&&(a.size=this.#y[t]),e.unshift([n,a])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=this.#s.now()-e}this.#z(t,n.value,n)}}set(e,t,n={}){let{status:r=Y.hasSubscribers?{}:void 0}=n;n.status=r,r&&(r.op=`set`,r.key=e,t!==void 0&&(r.value=t),r.cache=this);let i=this.#z(e,t,n);return r&&Y.hasSubscribers&&Y.publish(r),i}#z(e,t,n,r){let{ttl:i=this.ttl,start:a,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:c}=n,l=this.#W(t);if(t===void 0)return c&&(c.set=`deleted`),this.delete(e),this;let{noUpdateTTL:u=this.noUpdateTTL}=n;c&&!l&&(c.value=t);let d=this.#F(e,t,n.size||0,s,c);if(this.maxEntrySize&&d>this.maxEntrySize)return this.#Z(e,`set`),c&&(c.set=`miss`,c.maxEntrySizeExceeded=!0),this;let f=this.#c===0?void 0:this.#u.get(e);if(f===void 0)f=this.#c===0?this.#g:this.#_.length===0?this.#c===this.#e?this.#B(!1):this.#c:this.#_.pop(),this.#d[f]=e,this.#f[f]=t,this.#u.set(e,f),this.#p[this.#g]=f,this.#m[f]=this.#g,this.#g=f,this.#c++,this.#P(f,d,c),c&&(c.set=`add`),u=!1,this.#E&&!l&&this.#r?.(t,e,`add`);else{this.#X(f);let n=this.#f[f];if(t!==n){if(!o)if(this.#W(n)){n!==r&&n.__abortController.abort(Error(`replaced`));let{__staleWhileFetching:i}=n;i!==void 0&&i!==t&&(this.#C&&this.#n?.(i,e,`set`),this.#T&&this.#v?.push([i,e,`set`]))}else this.#C&&this.#n?.(n,e,`set`),this.#T&&this.#v?.push([n,e,`set`]);if(this.#N(f),this.#P(f,d,c),this.#f[f]=t,!l){let r=n&&this.#W(n)?n.__staleWhileFetching:n,i=r===void 0?`add`:t===r?`update`:`replace`;c&&(c.set=i,r!==void 0&&(c.oldValue=r)),this.#E&&this.onInsert?.(t,e,i)}}else l||(c&&(c.set=`update`),this.#E&&this.onInsert?.(t,e,`update`))}if(i!==0&&!this.#x&&this.#D(),this.#x&&(u||this.#A(f,i,a),c&&this.#k(c,f)),!o&&this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return this}pop(){try{for(;this.#c;){let e=this.#f[this.#h];if(this.#B(!0),this.#W(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}}#B(e){let t=this.#h,n=this.#d[t],r=this.#f[t],i=this.#W(r);i&&r.__abortController.abort(Error(`evicted`));let a=i?r.__staleWhileFetching:r;return(this.#C||this.#T)&&a!==void 0&&(this.#C&&this.#n?.(a,n,`evict`),this.#T&&this.#v?.push([a,n,`evict`])),this.#N(t),this.#S?.[t]&&(clearTimeout(this.#S[t]),this.#S[t]=void 0),e&&(this.#d[t]=void 0,this.#f[t]=void 0,this.#_.push(t)),this.#c===1?(this.#h=this.#g=0,this.#_.length=0):this.#h=this.#p[t],this.#u.delete(n),this.#c--,t}has(e,t={}){let{status:n=Y.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`has`,n.key=e,n.cache=this);let r=this.#V(e,t);return Y.hasSubscribers&&Y.publish(n),r}#V(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#u.get(e);if(i!==void 0){let e=this.#f[i];if(this.#W(e)&&e.__staleWhileFetching===void 0)return!1;if(this.#j(i))r&&(r.has=`stale`,this.#k(r,i));else return n&&this.#O(i),r&&(r.has=`hit`,this.#k(r,i)),!0}else r&&(r.has=`miss`);return!1}peek(e,t={}){let{status:n=Ji()?{}:void 0}=t;n&&(n.op=`peek`,n.key=e,n.cache=this),t.status=n;let r=this.#H(e,t);return Y.hasSubscribers&&Y.publish(n),r}#H(e,t){let{status:n,allowStale:r=this.allowStale}=t,i=this.#u.get(e);if(i===void 0||!r&&this.#j(i)){n&&(n.peek=i===void 0?`miss`:`stale`);return}let a=this.#f[i],o=this.#W(a)?a.__staleWhileFetching:a;return n&&(o===void 0?n.peek=`miss`:(n.peek=`hit`,n.value=o)),o}#U(e,t,n,r){let i=t===void 0?void 0:this.#f[t];if(this.#W(i))return i;let a=new AbortController,{signal:o}=n;o?.addEventListener(`abort`,()=>a.abort(o.reason),{signal:a.signal});let s={signal:a.signal,options:n,context:r},c=(r,i=!1)=>{let{aborted:o}=a.signal,c=n.ignoreFetchAbort&&r!==void 0,l=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&r!==void 0);if(n.status&&(o&&!i?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,c&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),o&&!c&&!i)return u(a.signal.reason,l);let d=f,p=this.#f[t];return(p===f||p===void 0&&c&&i)&&(r===void 0?d.__staleWhileFetching===void 0?this.#Z(e,`fetch`):this.#f[t]=d.__staleWhileFetching:(n.status&&(n.status.fetchUpdated=!0),this.#z(e,r,s.options,d))),r},l=e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),u(e,!1)),u=(r,i)=>{let{aborted:o}=a.signal,s=o&&n.allowStaleOnFetchAbort,c=s||n.allowStaleOnFetchRejection,l=c||n.noDeleteOnFetchRejection,u=f;if(this.#f[t]===f&&(!l||!i&&u.__staleWhileFetching===void 0?this.#Z(e,`fetch`):s||(this.#f[t]=u.__staleWhileFetching)),c)return n.status&&u.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw r},d=(t,r)=>{let o=this.#a?.(e,i,s);a.signal.addEventListener(`abort`,()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>c(e,!0)))}),o&&o instanceof Promise?o.then(e=>t(e===void 0?void 0:e),r):o!==void 0&&t(o)};n.status&&(n.status.fetchDispatched=!0);let f=new Promise(d).then(c,l),p=Object.assign(f,{__abortController:a,__staleWhileFetching:i,__returned:void 0});return t===void 0?(this.#z(e,p,{...s.options,status:void 0}),t=this.#u.get(e)):this.#f[t]=p,p}#W(e){if(!this.#w)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty(`__staleWhileFetching`)&&t.__abortController instanceof AbortController}fetch(e,t={}){let n=Ki.hasSubscribers,{status:r=Ji()?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let i=this.#G(e,t);return r&&n&&(r.trace=!0,Ki.tracePromise(()=>i,r).catch(()=>{})),i}async#G(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:m,forceRefresh:h=!1,status:g,signal:_}=t;if(g&&(g.op=`fetch`,g.key=e,h&&(g.forceRefresh=!0),g.cache=this),!this.#w)return g&&(g.fetch=`get`),this.#J(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:g});let v={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:a,noDisposeOnSet:o,size:s,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:p,ignoreFetchAbort:f,status:g,signal:_},y=this.#u.get(e);if(y===void 0){g&&(g.fetch=`miss`);let t=this.#U(e,y,v,m);return t.__returned=t}else{let t=this.#f[y];if(this.#W(t)){let e=n&&t.__staleWhileFetching!==void 0;return g&&(g.fetch=`inflight`,e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#j(y);if(!h&&!i)return g&&(g.fetch=`hit`),this.#X(y),r&&this.#O(y),g&&this.#k(g,y),t;let a=this.#U(e,y,v,m),o=a.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=i?`stale`:`refresh`,o&&i&&(g.returnedStale=!0)),o?a.__staleWhileFetching:a.__returned=a}}forceFetch(e,t={}){let n=Ki.hasSubscribers,{status:r=Ji()?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let i=this.#K(e,t);return r&&n&&(r.trace=!0,Ki.tracePromise(()=>i,r).catch(()=>{})),i}async#K(e,t={}){let n=await this.#G(e,t);if(n===void 0)throw Error(`fetch() returned undefined`);return n}memo(e,t={}){let{status:n=Y.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`memo`,n.key=e,t.context&&(n.context=t.context),n.cache=this);let r=this.#q(e,t);return n&&(n.value=r),Y.hasSubscribers&&Y.publish(n),r}#q(e,t={}){let n=this.#o;if(!n)throw Error(`no memoMethod provided to constructor`);let{context:r,status:i,forceRefresh:a,...o}=t;i&&a&&(i.forceRefresh=!0);let s=this.#J(e,o),c=a||s===void 0;if(i&&(i.memo=c?`miss`:`hit`,c||(i.value=s)),!c)return s;let l=n(e,s,{options:o,context:r});return i&&(i.value=l),this.#z(e,l,o),l}get(e,t={}){let{status:n=Y.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`get`,n.key=e,n.cache=this);let r=this.#J(e,t);return n&&(r!==void 0&&(n.value=r),Y.hasSubscribers&&Y.publish(n)),r}#J(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:a}=t,o=this.#u.get(e);if(o===void 0){a&&(a.get=`miss`);return}let s=this.#f[o],c=this.#W(s);return a&&this.#k(a,o),this.#j(o)?c?(a&&(a.get=`stale-fetching`),n&&s.__staleWhileFetching!==void 0?(a&&(a.returnedStale=!0),s.__staleWhileFetching):void 0):(i||this.#Z(e,`expire`),a&&(a.get=`stale`),n?(a&&(a.returnedStale=!0),s):void 0):(a&&(a.get=c?`fetching`:`hit`),this.#X(o),r&&this.#O(o),c?s.__staleWhileFetching:s)}#Y(e,t){this.#m[t]=e,this.#p[e]=t}#X(e){e!==this.#g&&(e===this.#h?this.#h=this.#p[e]:this.#Y(this.#m[e],this.#p[e]),this.#Y(this.#g,e),this.#g=e)}delete(e){return this.#Z(e,`delete`)}#Z(e,t){Y.hasSubscribers&&Y.publish({op:`delete`,delete:t,key:e,cache:this});let n=!1;if(this.#c!==0){let r=this.#u.get(e);if(r!==void 0)if(this.#S?.[r]&&(clearTimeout(this.#S[r]),this.#S[r]=void 0),n=!0,this.#c===1)this.#Q(t);else{this.#N(r);let n=this.#f[r];if(this.#W(n)?n.__abortController.abort(Error(`deleted`)):(this.#C||this.#T)&&(this.#C&&this.#n?.(n,e,t),this.#T&&this.#v?.push([n,e,t])),this.#u.delete(e),this.#d[r]=void 0,this.#f[r]=void 0,r===this.#g)this.#g=this.#m[r];else if(r===this.#h)this.#h=this.#p[r];else{let e=this.#m[r];this.#p[e]=this.#p[r];let t=this.#p[r];this.#m[t]=this.#m[r]}this.#c--,this.#_.push(r)}}if(this.#T&&this.#v?.length){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return n}clear(){return this.#Q(`delete`)}#Q(e){for(let t of this.#L({allowStale:!0})){let n=this.#f[t];if(this.#W(n))n.__abortController.abort(Error(`deleted`));else{let r=this.#d[t];this.#C&&this.#n?.(n,r,e),this.#T&&this.#v?.push([n,r,e])}}if(this.#u.clear(),this.#f.fill(void 0),this.#d.fill(void 0),this.#x&&this.#b){this.#x.fill(0),this.#b.fill(0);for(let e of this.#S??[])e!==void 0&&clearTimeout(e);this.#S?.fill(void 0)}if(this.#y&&this.#y.fill(0),this.#h=0,this.#g=0,this.#_.length=0,this.#l=0,this.#c=0,this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}},ia=`@teacss/autocomplete`;const aa=5e4,oa=2e6,sa=5e4,ca=4096,la=1e3,ua=5e7,da=1e5,fa=new Map(Array.from(`ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåçèéêëìíîïñòóôõöøùúûüýÿĀāĂ㥹ĆćĈĉĊċČčĎďđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥħĨĩĪīĬĭĮįİıĴĵĶķĹĺĻļĽľŀłŃńŅņŇňŌōŎŏŐőŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƃƆƈƉƊƌƎƐƒƓƗƙƚƜƝƞƟƠơƥƫƭƮƯưƲƴƶǍǎǏǐǑǒǓǔǗǘǝǥǦǧǨǩǪǫǰǴǵǸǹȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȞȟȠȡȥȦȧȨȩȮȯȲȳȴȵȶȷȺȻȼȽȾȿɀɃɄɅɆɇɈɉɊɋɌɍɎɏɐɑɓɔɕɖɗɘɛɜɝɞɟɠɡɢɥɦɨɪɫɬɭɯɰɱɲɳɴɵɹɺɻɼɽɾɿʀʁʂʇʈʉʋʌʍʎʏʐʑʗʙʚʛʜʝʞʟʠʮͣͤͥͦͧͨͩͪͫͬͭͮͯᴀᴃᴄᴅᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᵢᵣᵤᵥḀḁḂḃḄḅḆḇḊḋḌḍḎḏḐḑḒḓḘḙḚḛḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉṊṋṔṕṖṗṘṙṚṛṞṟṠṡṢṣṪṫṬṭṮṯṰṱṲṳṴṵṶṷṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐốỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹⁱₕₖₗₘₙₚₛₜↄ`,(e,t)=>[e,`AAAAAACEEEEIIIINOOOOOOUUUUYsaaaaaaceeeeiiiinoooooouuuuyyAaAaAaCcCcCcCcDddEeEeEeEeEeGgGgGgGgHhhIiIiIiIiIiJjKkLlLlLlllNnNnNnOoOoOoRrRrRrSsSsSsSsTtTttUuUuUuUuUuUuWwYyYZzZzZzsbBbOcDDdEEfGIklMNnOOopttTUuVyzAaIiOoUuUuegGgKkOojGgNnAaAaEeEeIiIiOoOoRrRrUuUuSsTtHhNdzAaEeOoYylntjACcLTszBUVEeJjQqRrYyaabocddeeeeejggGhhiIlllmmmnnNorrrrrrrRRsttuvvwyYzzcBeGHjkLqhaeioucdhmrtvxABCDEeiJKLMNOOoooooPRRTUuumVWZiruvAaBbBbBbDdDdDdDdDdEeEeFfGgHhHhHhHhHhIiIiKkKkKkLlLlLlMmMmMmNnNnNnNnPpPpRrRrRrSsSsTtTtTtTtUuUuUuVvVvWwWwWwWwWwXxXxYyZzZzZzhtwyasAaAaAaAaAaAaAaAaAaAaAaAaEeEeEeEeEeEeEeEeIiIiOoOoOoOoOoOoOoOoOoOoOoOoUuUuUuUuUuUuUuYyYyYyYyihklmnpstc`[t]])),pa={maxAttempts:sa,maxCandidateLength:ca,maxCandidates:aa,maxCharacters:oa,maxScans:da,maxScannedCharacters:5e7},ma={...pa,maxCandidateLength:oa,maxCandidates:la};function ha(){return{suggestions:[],attempts:0,candidates:0,characters:0,scans:0,truncated:!1}}const ga=new WeakMap,_a=new WeakMap;function va(e,t,n){let r=ga.get(e);if(!r){let n=e.suggest(t,`prefix`)??[];return{suggestions:n,attempts:n.length,candidates:n.length,characters:n.reduce((e,t)=>e+t.length,0),scans:n.length,truncated:!1}}return r(t,n)}function ya(e,t,n){let r=_a.get(e);return r?r(t,n):va(e,t,n)}var ba=class extends Error{template;constructor(e,t){super(e),this.template=t,this.name=ia,this.template=t}toString(){return`⚠️ [${this.name}]: ${this.message}. ${this.template?`Template: ${this.template}.`:``}`}};const xa={directions:`(x|y|t|b|l|r|s|e)`,num:`(${[0,1,2,3,4,5,6,8,10,12,24,36].join(`|`)})`,percent:`(${[0,10,20,30,40,50,60,70,80,90,100].join(`|`)})`,percentage:`(${[`10%`,`20%`,`30%`,`40%`,`50%`,`60%`,`70%`,`80%`,`90%`,`100%`].join(`|`)})`},Sa=[`DEFAULT`];function Ca(e,t,n,r){let i=0;Array.from(e.matchAll(t)).forEach(t=>{let a=t.index;i!==a&&r(e.slice(i,a),i,a),n(t),i=a+t[0].length}),i!==e.length&&r(e.slice(i),i,e.length)}const wa=aa;function Ta(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]===`(`)n++;else if(e[r]===`)`&&--n===0)return r}function Ea(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?n++:a===`)`?n--:a===`|`&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t}function Da(e,t){let n=e.indexOf(`(`),r=n===-1?void 0:Ta(e,n);if(n===-1||r==null)return[e];let i=e.slice(0,n),a=Da(e.slice(r+1),t);if(a===void 0)return;let o=[];for(let s of Ea(e.slice(n+1,r))){let e=Da(s,t);if(e===void 0)return;for(let n of e)for(let e of a){if(--t.remaining<0)return;o.push(`${i}${n}${e}`)}}return o}function Oa(e){let t={remaining:wa},n=[];for(let r of Ea(e)){let e=Da(r,t);if(e===void 0)return;n.push(...e)}return n}function ka(e,t={},n={}){let r=[],i=[],a={...xa,...n};e=e.replace(/<([\w-]+)>/g,(e,t,n,r)=>Object.hasOwn(a,t)?a[t]:(i.push(new ba(`Unknown template shorthand: <${t}>`,r)),e)),c(e),i.length&&(r.length=0);let o={parts:r,suggest:l,errors:i};return ga.set(o,d),_a.set(o,u),o;function s(e){Ca(e,/\$([\w.|-]+)/g,e=>{r.push({type:`theme`,objects:e[1].split(`|`).map(n=>{let r=n.split(`.`).reduce((t,n)=>!n||typeof t!=`object`||!t||!Object.hasOwn(t,n)||!t[n]?(i.push(new ba(`Invalid theme key: ${n}`,e.input)),{}):t[n],t);return typeof r!=`object`||!r||Array.isArray(r)?(i.push(new ba(`Invalid theme path: ${n}`,e.input)),{}):r})})},e=>{r.push({type:`static`,value:e})})}function c(t){let n=0;for(let a=0;a<t.length;a++){if(t[a]!==`(`)continue;let o=Ta(t,a);if(o==null)break;let c=t.slice(a+1,o);if(n!==a&&s(t.slice(n,a)),n=o+1,!c.includes(`|`)){r.push({type:`static`,value:t.slice(a,o+1)}),a=o;continue}let l=Oa(c);l===void 0?(i.push(new ba(`Template group expands past ${wa} values: (${c})`,e)),r.push({type:`static`,value:t.slice(a,o+1)})):r.push({type:`group`,values:l}),a=o}n!==t.length&&s(t.slice(n))}function l(e,t=`prefix`){if(e.length>1&&t===`fuzzy`){let t=e!==e.toLowerCase(),n=Wa(e,t),i=d(e,{maxCandidates:la}).suggestions.filter(e=>Ra(n,Wa(e,t),e,0));if(n.length>ca)return i;let a=Co(r,{},e).candidates;if(i.length){let e=new Set(i);if(a.every(t=>e.has(t)))return i}if(La(e,a.reduce((e,t)=>e+t.length,0))){let t=Pa(a,e),n=t.filter(t=>Ua(t,e));return n.length?vo(n,[...i,...t]):vo(i,t)}return vo(i,new Gi(a,{fuzzy:`v1`,limit:la}).find(e).map(e=>e.item))}return u(e).suggestions}function u(e,t={}){let n={...ma,...t},i=Na(e);if(i.length>n.maxCandidateLength)return ha();let a=Aa(r);if(a){let t=ja(r,0,a.index);if(!to(t,e)&&!to(Na(t),i))return ha();let o=ja(r,a.index+1,r.length);return no(a.part,t,o,e,a.suppressPartialRoots,n)}let o=Ma(r);return o&&!to(o,e)&&!to(Na(o),Na(e))?ha():Ka(r,e,n)}function d(e,t={}){let n={...pa,...t},i=u(e,n),a=Ma(r);if(i.suggestions.length||!a)return i;let o={...n,maxAttempts:n.maxAttempts-i.attempts,maxCandidates:n.maxCandidates-i.candidates,maxCharacters:n.maxCharacters-i.characters,maxScans:n.maxScans-i.scans},s=u(a+e,o);return{suggestions:s.suggestions,attempts:i.attempts+s.attempts,candidates:i.candidates+s.candidates,characters:i.characters+s.characters,scans:i.scans+s.scans,truncated:i.truncated||s.truncated}}}function Aa(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i.type!==`static`){if(i.type===`group`&&i.values.length>0&&i.values.every(e=>e===``)){n=!0;continue}if(i.type!==`theme`||t)return;t={index:r,part:i}}}return t&&{...t,suppressPartialRoots:n}}function ja(e,t,n){let r=``;for(let i=t;i<n;i++){let t=e[i];t.type===`static`&&(r+=t.value)}return r}function Ma(e){let t=e.findIndex(e=>e.type!==`static`);return ja(e,0,t<0?e.length:t)}function Na(e){return e.replace(/-/g,``)}function Pa(e,t){return Fa(e,t)}function Fa(e,t,n={}){let r={...pa,maxCandidates:la,...n};if(!t)return Ia(e,r);let i=t!==t.toLowerCase(),a=Wa(t,i);if(a.length>r.maxCandidateLength)return[];let o={characters:0,items:[],retained:new Set},s=new Set,c=e[Symbol.iterator](),l=0,u=0;for(;l<r.maxAttempts&&u<r.maxScannedCharacters;){let e=c.next();if(e.done)break;let t=e.value,n=l++;if(!t||t.length>r.maxCandidateLength||s.has(t)||t.length>r.maxScannedCharacters-u)continue;s.add(t),u+=t.length;let d=Ra(a,Wa(t,i),t,n);d&&za(o,d,r.maxCandidates,r.maxCharacters)}return o.items.sort(Ha).map(({candidate:e})=>e)}function Ia(e,t){let n=[],r=new Set,i=e[Symbol.iterator](),a=0,o=0,s=0;for(;a<t.maxAttempts&&n.length<t.maxCandidates&&o<t.maxCharacters&&s<t.maxScannedCharacters;){let e=i.next();if(e.done)break;let c=e.value;a++,!(!c||c.length>t.maxCandidateLength||r.has(c)||c.length>t.maxScannedCharacters-s)&&(r.add(c),s+=c.length,!(o+c.length>t.maxCharacters)&&(n.push(c),o+=c.length))}return n}function La(e,t){return e.length*t>ua}function Ra(e,t,n,r){if(t===e)return{candidate:n,category:0,gaps:0,longestRun:e.length,start:0,order:r};if(t.startsWith(e))return{candidate:n,category:1,gaps:0,longestRun:e.length,start:0,order:r};let i=0,a=-1,o=-1,s=0,c=0,l=0;for(let n=0;n<t.length&&i<e.length;n++)t[n]===e[i]&&(a<0&&(a=n),o>=0&&(l+=n-o-1),s=n===o+1?s+1:1,c=Math.max(c,s),o=n,i++);if(i===e.length)return{candidate:n,category:2,gaps:l,longestRun:c,start:a,order:r}}function za(e,t,n,r){e.retained.has(t.candidate)||(e.items.length<n&&e.characters+t.candidate.length<=r?(e.items.push(t),e.retained.add(t.candidate),e.characters+=t.candidate.length,Ba(e.items,e.items.length-1)):e.items.length&&Ha(t,e.items[0])<0&&e.characters-e.items[0].candidate.length+t.candidate.length<=r&&(e.retained.delete(e.items[0].candidate),e.characters+=t.candidate.length-e.items[0].candidate.length,e.items[0]=t,e.retained.add(t.candidate),Va(e.items,0)))}function Ba(e,t){for(;t>0;){let n=t-1>>>1;if(Ha(e[t],e[n])<=0)return;[e[n],e[t]]=[e[t],e[n]],t=n}}function Va(e,t){for(;;){let n=t*2+1;if(n>=e.length)return;let r=n+1,i=n;if(r<e.length&&Ha(e[r],e[n])>0&&(i=r),Ha(e[i],e[t])<=0)return;[e[t],e[i]]=[e[i],e[t]],t=i}}function Ha(e,t){return e.category-t.category||e.gaps-t.gaps||t.longestRun-e.longestRun||e.start-t.start||e.candidate.length-t.candidate.length||e.order-t.order}function Ua(e,t){let n=t!==t.toLowerCase();return Wa(e,n)===Wa(t,n)}function Wa(e,t){let n=e.normalize(),r=Ga(n)?n:Array.from(n,e=>fa.get(e)??e).join(``);return t?r:r.toLowerCase()}function Ga(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>127)return!1;return!0}function Ka(e,t,n={}){let r={...pa,...n};if(r.maxAttempts<=0||r.maxCandidates<=0||r.maxCharacters<=0)return ha();let i=Na(t),a=qa(),o=qa(),s=r.maxCandidates,c=ao(r.maxScans),l=[],u=Array.from({length:e.length},()=>``),d=Array.from({length:e.length+1},()=>0),f=Array.from({length:e.length+1},()=>0),p=Array.from({length:e.length+1},()=>0),m=[],h=new Set,g=0,_=0;for(;_>=0&&!c.truncated;){if(_===e.length){let e=u.join(``),n=f[_]>=t.length,c=p[_]>=i.length;if((n||c)&&e.length<=r.maxCharacters){let t=!h.has(e);(!t||g<r.maxAttempts)&&(t&&(h.add(e),g++),n&&Ja(a,e,m,s,r),c&&Ja(o,e,m,s,r))}_--;continue}if(g>=r.maxAttempts)break;let n=l[_];n||(n={choiceIndex:0,iterator:yo(e[_],r.maxCandidateLength-d[_],c)},l[_]=n);let v=n.iterator.next();if(v.done){l.pop(),_--;continue}let y=n.choiceIndex++,b=v.value,x=d[_]+b.length;if(x>r.maxCandidateLength)continue;let S=f[_]<0?-1:eo(t,f[_],b,!1),C=p[_]<0?-1:eo(i,p[_],b,!0);if(S<0&&C<0)continue;for(;m.length&&!(m.at(-1).depth<_);)m.pop();y>0&&m.push({depth:_,index:y}),u[_]=b;let w=_+1;d[w]=x,f[w]=S,p[w]=C,l.length=w,_=w}let v=a.entries.length?a:o;v.entries.sort((e,t)=>$a(e.path,t.path));let y=v.entries.map(e=>e.candidate);return{suggestions:y,attempts:g,candidates:y.length,characters:v.characters,scans:c.initial-c.remaining,truncated:c.truncated}}function qa(){return{characters:0,entries:[],indices:new Map}}function Ja(e,t,n,r,i){let a=e.indices.get(t);if(a!==void 0){let t=e.entries[a];$a(n,t.path)<0&&(t.path=n.slice(),Za(e,a));return}if(r<=0||t.length>i.maxCharacters)return;let o={candidate:t,path:n.slice()};if(e.entries.length>=r){if($a(o.path,e.entries[0].path)>=0)return;Ya(e)}for(;e.entries.length&&e.characters+t.length>i.maxCharacters;){if($a(o.path,e.entries[0].path)>=0)return;Ya(e)}e.characters+t.length>i.maxCharacters||(e.indices.set(t,e.entries.length),e.entries.push(o),e.characters+=t.length,Xa(e,e.entries.length-1))}function Ya(e){let t=e.entries[0],n=e.entries.pop();e.indices.delete(t.candidate),e.characters-=t.candidate.length,e.entries.length&&(e.entries[0]=n,e.indices.set(n.candidate,0),Za(e,0))}function Xa(e,t){for(;t>0;){let n=t-1>>>1;if($a(e.entries[t].path,e.entries[n].path)<=0)return;Qa(e,n,t),t=n}}function Za(e,t){for(;;){let n=t*2+1;if(n>=e.entries.length)return;let r=n+1,i=n;if(r<e.entries.length&&$a(e.entries[r].path,e.entries[n].path)>0&&(i=r),$a(e.entries[i].path,e.entries[t].path)<=0)return;Qa(e,i,t),t=i}}function Qa(e,t,n){[e.entries[t],e.entries[n]]=[e.entries[n],e.entries[t]],e.indices.set(e.entries[t].candidate,t),e.indices.set(e.entries[n].candidate,n)}function $a(e,t){let n=e.length-1,r=t.length-1;for(;n>=0||r>=0;){let i=n>=0?e[n].depth:-1,a=r>=0?t[r].depth:-1,o=Math.max(i,a),s=i===o?e[n--].index:0,c=a===o?t[r--].index:0;if(s!==c)return s-c}return 0}function eo(e,t,n,r){let i=t;for(let t=0;t<n.length;t++){let a=n[t];if(!(r&&a===`-`)){if(i<e.length&&e[i]!==a)return-1;i++}}return i}function to(e,t){return e.length<=t.length?t.startsWith(e):e.startsWith(t)}function no(e,t,n,r,i,a){let o={...pa,...a};if(t.length+1>o.maxCandidateLength)return ha();let s=ao(o.maxScans),c=co(e.objects,s),l=lo(r,!1,o),u=lo(Na(r),!0,o);ro(c,t,n,o.maxCandidateLength,i,l,u,s);let d=fo(l,s);if(d.suggestions.length||!d.exhausted)return d;let f=fo(u,s);return{suggestions:f.suggestions,attempts:d.attempts+f.attempts,candidates:d.candidates+f.candidates,characters:d.characters+f.characters,scans:f.scans,truncated:f.truncated}}function ro(e,t,n,r,i,a,o,s){for(let c of e){let e=t+c.key,l=po(e,a.input,!1),u=po(e,o.input,!0);if(l===`none`&&u===`none`)continue;let d=ho(c.objects,e,n,a.input,o.input,r),f=l===`partial`||u===`partial`?go(d,s):void 0,p=f!==void 0;if(mo(a,l,c.hasLeaf,p,e,n,i),mo(o,u,c.hasLeaf,p,e,n,i),a.blocked)return;for(f??=go(d,s);f;){if((l===`reached`||i&&l===`partial`)&&uo(a,f.candidate,f.rawMatch),(u===`reached`||i&&u===`partial`)&&uo(o,f.candidate,f.normalizedMatch),a.blocked)return;f=go(d,s)}if(s.truncated||a.blocked)return}}function io(e){return!!e&&e[0]!==`_`&&!Sa.includes(e)}function ao(e=da){let t=Math.max(0,e);return{initial:t,remaining:t,truncated:!1}}function oo(e){return e.remaining<=0?(e.truncated=!0,!1):(e.remaining--,!0)}function*so(e){yield*Object.keys(e)}function co(e,t){let n=new Map;outer:for(let r of e)for(let e of so(r)){if(!oo(t))break outer;if(!io(e))continue;let i=r[e];if(i==null)continue;let a=n.get(e)??{key:e,hasLeaf:!1,objects:[]};if(typeof i!=`object`||Array.isArray(i))a.hasLeaf=!0;else{let e=i;a.objects.push(e),a.hasLeaf||=Object.hasOwn(e,`DEFAULT`)&&e.DEFAULT!==null&&e.DEFAULT!==void 0}n.set(e,a)}return[...n.values()]}function lo(e,t,n){return{attempts:0,blocked:n.maxAttempts<=0||n.maxCandidates<=0||n.maxCharacters<=0,characters:0,input:e,limits:n,normalize:t,seen:new Set,suggestions:[]}}function uo(e,t,n){!n||e.blocked||e.seen.has(t)||(e.seen.add(t),e.attempts++,t.length<=e.limits.maxCandidateLength&&e.characters+t.length<=e.limits.maxCharacters&&(e.suggestions.push(t),e.characters+=t.length),e.blocked||=e.attempts>=e.limits.maxAttempts||e.suggestions.length>=e.limits.maxCandidates||e.characters>=e.limits.maxCharacters)}function fo(e,t){return{suggestions:e.suggestions,attempts:e.attempts,candidates:e.suggestions.length,characters:e.characters,scans:t.initial-t.remaining,truncated:t.truncated,exhausted:!e.blocked&&!t.truncated}}function po(e,t,n){let r=n?Na(e):e;return t.startsWith(r)?`reached`:r.startsWith(t)?`partial`:`none`}function mo(e,t,n,r,i,a,o){if(t===`none`)return;if(t===`partial`&&r){(n||!o)&&uo(e,i,!0);return}if(!n)return;let s=i+a;uo(e,s,(e.normalize?Na(s):s).startsWith(e.input))}function ho(e,t,n,r,i,a){return{base:t,fragments:[],frames:[],maxCandidateLength:a,normalizedInput:i,normalizedMatchedLength:eo(i,0,t,!0),objectIndex:0,objects:e,rawInput:r,rawMatchedLength:eo(r,0,t,!1),staticSuffix:n}}function go(e,t){for(;!t.truncated;){if(!e.frames.length){if(e.objectIndex>=e.objects.length)return;let t=e.objects[e.objectIndex++];e.frames.push({depth:0,iterator:so(t),normalizedMatchedLength:e.normalizedMatchedLength,object:t,rawMatchedLength:e.rawMatchedLength,valueLength:0})}let n=e.frames.at(-1),r=n.iterator.next();if(r.done){e.frames.pop(),e.fragments.length=n.depth;continue}if(!oo(t))return;let i=r.value;if(!io(i))continue;let a=n.object[i];if(a==null)continue;let o=n.valueLength+ +!!n.depth+i.length;if(e.base.length+o+e.staticSuffix.length+1>e.maxCandidateLength)continue;let s=`-${i}`,c=n.rawMatchedLength<0?-1:eo(e.rawInput,n.rawMatchedLength,s,!1),l=n.normalizedMatchedLength<0?-1:eo(e.normalizedInput,n.normalizedMatchedLength,s,!0);if(c<0&&l<0)continue;e.fragments.length=n.depth,e.fragments.push(i);let u=typeof a==`object`&&!Array.isArray(a)?a:void 0;if(u&&e.frames.push({depth:n.depth+1,iterator:so(u),normalizedMatchedLength:l,object:u,rawMatchedLength:c,valueLength:o}),!(!u||Object.hasOwn(u,`DEFAULT`)&&u.DEFAULT!==null&&u.DEFAULT!==void 0))continue;let d=_o(e.rawInput,c,e.staticSuffix,!1),f=_o(e.normalizedInput,l,e.staticSuffix,!0);if(!(!d&&!f))return{candidate:`${e.base}-${e.fragments.join(`-`)}${e.staticSuffix}`,normalizedMatch:f,rawMatch:d}}}function _o(e,t,n,r){return t<0?!1:eo(e,t,n,r)>=e.length}function vo(e,t){let n=[],r=new Set,i=0,a=(e,t)=>{for(let a of e){if(n.length===t)return;if(!(!a||r.has(a)||a.length>ca)){if(i+a.length>oa)return;r.add(a),n.push(a),i+=a.length}}};return a(e,t.length?750:la),a(t,la),a(e,la),n}function*yo(e,t,n){e.type===`theme`?yield*xo(e.objects,t,n):yield*bo(e,t,n)}function*bo(e,t,n){if(e.type===`static`){e.value.length<=t&&(yield e.value);return}if(e.type===`group`)for(let r of e.values){if(!oo(n))return;r.length<=t&&(yield r)}}function*xo(e,t,n){let r=[];for(let i of e){r.length=0;let e=[{depth:0,iterator:so(i),object:i,valueLength:0}];for(;e.length&&!n.truncated;){let i=e.at(-1),a=i.iterator.next();if(a.done){e.pop(),r.length=i.depth;continue}if(!oo(n))return;let o=a.value;if(!io(o))continue;let s=i.object[o];if(s==null)continue;let c=i.valueLength+ +!!i.depth+o.length;if(c>t)continue;r.length=i.depth,r.push(o);let l=typeof s==`object`&&!Array.isArray(s)?s:void 0;l&&e.push({depth:i.depth+1,iterator:so(l),object:l,valueLength:c}),(!l||Object.hasOwn(l,`DEFAULT`)&&l.DEFAULT!==null&&l.DEFAULT!==void 0)&&(yield r.join(`-`))}}}function So(e,t){let n=ao(t.maxScans),r=e.map(e=>({done:!1,iterator:yo(e,t.maxCandidateLength,n),pending:void 0,seen:new Set,values:[]})),i=e.length+Math.max(0,t.maxCandidates-1),a=r.length,o=0,s=0,c=!1,l=r.length;for(;l&&!n.truncated;){let e=!1;for(let n of r){if(!n.values.length&&n.pending!==void 0&&o+n.pending.length<=t.maxCharacters){n.values.push(n.pending),o+=n.pending.length,n.pending=void 0,s++,l--,e=!0;continue}if(n.done)continue;let r=n.iterator.next();if(e=!0,r.done){n.done=!0,a--;continue}if(n.seen.has(r.value))continue;if(n.seen.add(r.value),!n.values.length){o+r.value.length<=t.maxCharacters?(n.values.push(r.value),o+=r.value.length,s++,l--):(n.pending===void 0||r.value.length<n.pending.length)&&(n.pending=r.value,c=!0);continue}let i=n.values[0];r.value.length<i.length&&(n.values[0]=r.value,o+=r.value.length-i.length,c=!0)}if(!e)break}for(;a&&s<i&&o<t.maxCharacters&&!n.truncated;){let e=!1;for(let n of r){if(n.done)continue;let r=n.iterator.next();if(r.done){n.done=!0,a--;continue}if(e=!0,!n.seen.has(r.value)){if(n.seen.add(r.value),o+r.value.length>t.maxCharacters){c=!0;continue}if(n.values.push(r.value),o+=r.value.length,s++,s===i)break}}if(!e)break}return c||=n.truncated||a>0||l>0,{scans:n.initial-n.remaining,truncated:c,values:r.map(e=>e.values)}}function Co(e,t={},n=``){let r={...pa,...t},i=So(e,r),a=i.values,o=i.scans,s,c=()=>{if(s===void 0){let t=wo(a,n,r);s=t?{combination:t,scans:0}:To(e,n,r,Math.max(0,r.maxScans-o)),o+=s.scans}return s};if(a.some(e=>!e.length)){let e=i.truncated?c().combination:void 0;if(!e)return{candidates:[],truncated:i.truncated,attempts:0,scans:o};let t=Do(r),n={remaining:r.maxAttempts};return Oo(t,n,0)&&Po(t,e),{candidates:[...t.candidates],truncated:!0,attempts:r.maxAttempts-n.remaining,scans:o}}let l=0;for(let e of a){let t=e[0].length;for(let n=1;n<e.length;n++)t=Math.min(t,e[n].length);if(l+=t,l>Math.min(r.maxCandidateLength,r.maxCharacters)){let e=i.truncated?c().combination:void 0;if(!e)return{candidates:[],truncated:!0,attempts:0,scans:o};let t=Do(r),n={remaining:r.maxAttempts};return Oo(t,n,0)&&Po(t,e),{candidates:[...t.candidates],truncated:!0,attempts:r.maxAttempts-n.remaining,scans:o}}}let u=1,d=0,f=i.truncated;for(let e of a){if(f)continue;let t=0;for(let n of e)if(t+=n.length,t>r.maxCharacters)break;let n=d*e.length,i=u*t;u>r.maxCandidates/e.length||u>r.maxAttempts/e.length||n>r.maxCharacters||i>r.maxCharacters-n?f=!0:(u*=e.length,d=n+i)}let p={remaining:r.maxAttempts};if(!f){let e=Do(r);return No(e,a,u,p),{candidates:[...e.candidates],truncated:!1,attempts:r.maxAttempts-p.remaining,scans:o}}let m=Do(r),h=a.map(e=>e[0]),g=a.flatMap((e,t)=>e.length>1?[t]:[]),_=c().combination;_&&Oo(m,p,0)&&Po(m,_),Oo(m,p,0)&&Po(m,h);let v=Math.min(sa,Math.max(0,p.remaining));return e.length&&v>ua/e.length?{candidates:[...m.candidates],truncated:!0,attempts:r.maxAttempts-p.remaining,scans:o}:(ko(m,a,h,g,p),jo(m,a,h,g,p),Ao(m,a,h,g,p),Mo(m,a,h,g,p),No(m,a,r.maxAttempts,p,!0),{candidates:[...m.candidates],truncated:!0,attempts:r.maxAttempts-p.remaining,scans:o})}function wo(e,t,n){if(!t||e.some(e=>!e.length))return;let r=t!==t.toLowerCase(),i=Wa(t,r);if(!i||i.length>n.maxCandidateLength)return;let a=Math.min(n.maxCandidateLength,n.maxCharacters),o=Array.from({length:e.length+1},()=>0);for(let t=e.length-1;t>=0;t--){let n=e[t][0].length;for(let r=1;r<e[t].length;r++)n=Math.min(n,e[t][r].length);o[t]=o[t+1]+n}if(o[0]>a)return;let s=[],c=0,l=0;for(let t=0;t<e.length;t++){let n,u=l;for(let s of e[t]){if(c+s.length+o[t+1]>a)continue;let e=Eo(i,l,Wa(s,r)),d=e>l,f=u>l;(n===void 0||d&&!f||d===f&&(s.length<n.length||s.length===n.length&&e>u))&&(n=s,u=e)}if(n===void 0)return;s.push(n),c+=n.length,l=u}if(l<i.length)return;let u=s.join(``);if(Ra(i,Wa(u,r),u,0))return s}function To(e,t,n,r){let i=ao(r),a=e=>({combination:e,scans:i.initial-i.remaining});if(!t)return a();let o=t!==t.toLowerCase(),s=Wa(t,o);if(!s||s.length>n.maxCandidateLength)return a();let c=Math.min(n.maxCandidateLength,n.maxCharacters),l=[{characters:0,choice:``,matched:0}],u=0,d=0;for(let t of e){let e=new Map,n=new Set;for(let r of yo(t,c,i)){if(n.has(r))continue;n.add(r);let t={normalized:Wa(r,o),raw:r};for(let n of l){if(d++,u+=t.normalized.length,d>sa||u>ua)return a();let r=n.characters+t.raw.length;if(r>c)continue;let i=Eo(s,n.matched,t.normalized),o=e.get(i);o&&o.characters<=r||e.set(i,{characters:r,choice:t.raw,matched:i,previous:n})}}if(!e.size)return a();let r=1/0;l=[...e.values()].sort((e,t)=>t.matched-e.matched||e.characters-t.characters).filter(e=>e.characters>=r?!1:(r=e.characters,!0))}let f=l.find(e=>e.matched===s.length);if(!f)return a();let p=Array.from({length:e.length},()=>``),m=f;for(let t=e.length-1;t>=0;t--)p[t]=m.choice,m=m.previous;let h=p.join(``);return Ra(s,Wa(h,o),h,0)?a(p):a()}function Eo(e,t,n){for(let r=0;r<n.length&&t<e.length;r++)n[r]===e[t]&&t++;return t}function Do(e){return{candidates:new Set,characters:0,maxCandidateLength:e.maxCandidateLength,maxCandidates:e.maxCandidates,maxCharacters:e.maxCharacters}}function Oo(e,t,n){return n>=sa||t.remaining<=0||e.candidates.size>=e.maxCandidates||e.characters>=e.maxCharacters?!1:(t.remaining--,!0)}function ko(e,t,n,r,i){let a=0;for(let o of r){if(!Oo(e,i,a))return;a++;let r=n.slice();r[o]=t[o].at(-1),Po(e,r)}}function Ao(e,t,n,r,i){let a=0;for(let o=0;o<r.length;o++)for(let s=o+1;s<r.length;s++){if(!Oo(e,i,a))return;a++;let c=r[o],l=r[s],u=n.slice();u[c]=t[c].at(-1),u[l]=t[l].at(-1),Po(e,u)}}function jo(e,t,n,r,i){let a=0;for(let o of r)for(let r=1;r<t[o].length-1;r++){if(!Oo(e,i,a))return;a++;let s=n.slice();s[o]=t[o][r],Po(e,s)}}function Mo(e,t,n,r,i){let a=0;for(let o=0;o<r.length;o++)for(let s=o+1;s<r.length;s++){let c=r[o],l=r[s];for(let r=1;r<t[c].length;r++)for(let o=1;o<t[l].length;o++){if(r===t[c].length-1&&o===t[l].length-1)continue;if(!Oo(e,i,a))return;a++;let s=n.slice();s[c]=t[c][r],s[l]=t[l][o],Po(e,s)}}}function No(e,t,n,r,i=!1){if(!t.length){Oo(e,r,0)&&Po(e,[``]);return}let a=t.map(()=>0),o=t.flatMap((e,t)=>e.length>1?[t]:[]),s=()=>{let e=o.length-1;for(;e>=0;){let n=o[e];if(a[n]++,a[n]<t[n].length)return!0;a[n]=0,e--}return!1};if(i&&!s())return;let c=Math.min(n,sa);for(let n=0;n<c;n++){if(!Oo(e,r,n))return;if(Po(e,t.map((e,t)=>e[a[t]])),!s())break}}function Po(e,t){let n=e.maxCharacters-e.characters,r=0;for(let i of t)if(r+=i.length,r>Math.min(e.maxCandidateLength,n))return;let i=t.join(``);e.candidates.has(i)||e.candidates.size===e.maxCandidates||e.characters+i.length>e.maxCharacters||(e.candidates.add(i),e.characters+=i.length)}function Fo(e,t,n=!0){let r=t,i=t,a=/[^\s>"'`;]/;for(;r&&a.test(e.charAt(r-1));)--r;for(;i<e.length&&a.test(e.charAt(i));)++i;if(n)return{content:e.slice(r,i),start:r,end:i};let o=Wo(e,t),s=o?.key.toLowerCase();if(o&&(s?.endsWith(`class`)||s?.endsWith(`classname`)))return r=Math.max(r,o.valueStart),{content:e.slice(r,i),start:r,end:i};let c=e.slice(0,r).trimEnd();if(/(?:^|[\s;{])@apply$/.test(c))return{content:e.slice(r,i),start:r,end:i}}const Io=new Set(`a abbr address area article aside audio b base bdi bdo blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins kbd label legend li link main map mark menu meta meter nav noscript object ol optgroup option output p picture pre progress q rp rt ruby s samp script search section select slot small source span strong style sub summary sup table tbody td template textarea tfoot th thead time title tr track u ul var video wbr svg`.split(` `)),Lo=new Set(`=([{,:;!?&|>~`);function Ro(e){return e>=65&&e<=90||e>=97&&e<=122}function zo(e){return Ro(e)||e===95}function Bo(e){return zo(e)||e>=48&&e<=57||e===36||e===45||e===46||e===58}function Vo(e,t,n){let r=t-n.length;return r<0||e.slice(r,t)!==n?!1:r===0||!Bo(e.charCodeAt(r-1))}function Ho(e,t,n,r){if(Io.has(n.toLowerCase())||n.includes(`-`)||r&&n.charCodeAt(0)>=65&&n.charCodeAt(0)<=90)return!0;let i=t-1;for(;i>=0&&/\s/.test(e.charAt(i));)i--;return i<0||Lo.has(e.charAt(i))?!0:Vo(e,i+1,`return`)}function Uo(e){let t,n=!1,r,i=0,a=0;for(;a<e.length;){if(t){let o=e.charAt(a);r?o===`\\`?a++:o===r&&(r=void 0):o===`"`||o===`'`?r=o:o===`{`?i++:o===`}`?i>0&&i--:o===`>`&&i===0&&(t=void 0,n=!0),a++;continue}if(e.charAt(a)===`;`&&(n=!1),e.charCodeAt(a)!==60){a++;continue}let o=a++;if(!zo(e.charCodeAt(a)))continue;let s=a;for(;a<e.length&&Bo(e.charCodeAt(a));)a++;if(a<e.length&&!/[\s/>]/.test(e.charAt(a)))continue;let c=e.slice(s,a);Ho(e,o,c,n)&&(t={name:c,start:o},i=0)}return t}function Wo(e,t){let n=e.substring(0,t),r=Uo(n);if(!r)return;let i=r.start+1,a=n.slice(i),o=-1,s=-1,c=-1,l=-1,u=-1,d=-1,f;for(let e=0;e<a.length;e++){let t=a.charAt(e);if(f){t===`\\`?e++:t===f&&(f=void 0);continue}if(t===`"`||t===`'`){f=t,o<0&&(o=e);continue}if(/\s/.test(t)){o>=0&&(s=o,c=e,o=-1);continue}if(t===`=`){let t=o>=0?o:s,n=o>=0?e:c;t>=0&&n>t&&t>=l&&(l=t,u=n,d=e)}o<0&&(o=e)}if(l<0)return;let p=d+1;for(;/\s/.test(a.charAt(p));)p++;let m=a.charAt(p);if(m===`"`||m===`'`){p++;for(let e=p;e<a.length;e++){let t=a.charAt(e);if(t===`\\`)e++;else if(t===m)return}}else if(/[\s>]/.test(a.slice(p)))return;return{key:a.slice(l,u),valueStart:i+p}}function Go(e,t){return Wo(e,t)?.key}function Ko(e,t){return Wo(e,t)}const X=1e3,qo=6e5,Jo=5e7,Yo=6e4,Xo=3e5,Zo=5e4,Qo=2e5,$o=5e3,Z={...pa,maxAttempts:15e3,maxCandidates:15e3,maxCharacters:6e5,maxScans:3e5};function es(){return{active:0,waiters:[]}}function ts(e){return e>=48&&e<=57}function ns(e){for(let t=0;t<e.length;t++)if(ts(e.charCodeAt(t)))return!0;return!1}function rs(e,t){let n=0,r=0;for(;n<e.length&&r<t.length;){let i=e.charCodeAt(n),a=t.charCodeAt(r),o=ts(i),s=ts(a);if(o&&s){let i=n+1,a=r+1;for(;i<e.length&&ts(e.charCodeAt(i));)i++;for(;a<t.length&&ts(t.charCodeAt(a));)a++;let o=n,s=r;for(;o<i-1&&e.charCodeAt(o)===48;)o++;for(;s<a-1&&t.charCodeAt(s)===48;)s++;let c=i-o,l=a-s;if(c!==l)return c<l?-1:1;for(;o<i;){let n=e.charCodeAt(o)-t.charCodeAt(s);if(n)return n<0?-1:1;o++,s++}n=i,r=a;continue}if(i!==a)return i<a?-1:1;n++,r++}return n!==e.length||r!==t.length?n===e.length?-1:1:0}function is(e,t){let n=ns(e);return n===ns(t)?rs(e,t)||(e===t?0:e<t?-1:1):n?1:-1}function as(e,t=Xo,n=Jo){return{attempts:0,heap:[],limit:e,maxAttempts:t,maxScannedCharacters:n,retained:new Set,scannedCharacters:0}}function os(e){return e.attempts<e.maxAttempts&&e.scannedCharacters<e.maxScannedCharacters}function ss(e,t){return os(e)?(e.attempts++,!t||e.retained.has(t)||t.length>Yo||t.length>e.maxScannedCharacters-e.scannedCharacters?!0:(e.scannedCharacters+=t.length,cs(e,t),!0)):!1}function cs(e,t){if(!(!t||e.retained.has(t)||t.length>Yo)){if(e.heap.length<e.limit){e.heap.push(t),e.retained.add(t),ls(e.heap,e.heap.length-1);return}is(t,e.heap[0])>=0||(e.retained.delete(e.heap[0]),e.heap[0]=t,e.retained.add(t),us(e.heap,0))}}function ls(e,t){let n=t;for(;n>0;){let t=Math.floor((n-1)/2);if(is(e[t],e[n])>=0)return;[e[t],e[n]]=[e[n],e[t]],n=t}}function us(e,t){let n=t;for(;;){let t=n*2+1;if(t>=e.length)return;let r=t+1,i=r<e.length&&is(e[r],e[t])>0?r:t;if(is(e[n],e[i])>=0)return;[e[n],e[i]]=[e[i],e[n]],n=i}}function ds(e){let t=[],n=0;for(let r of e.heap.sort(is))n+r.length>qo||(t.push(r),n+=r.length);return t}function fs(e,t,n,r){return Math.floor((t+n)*e/r)-Math.floor(t*e/r)}function*ps(e){let t=e.filter(e=>e.length).map(e=>({index:0,source:e})),n=0;for(;t.length;){let e=t[n];yield e.source[e.index++],e.index===e.source.length?t.splice(n,1):n++,n===t.length&&(n=0)}}function*ms(e,t,n,r,i,a){for(;n.attempts<r&&n.characters<i;){let r=e.next();if(r.done)return;let o=r.value;n.attempts++,!(!o||t.has(o)||o.length>a||o.length>i-n.characters)&&(t.add(o),n.characters+=o.length,yield o)}}function hs(e){let t=``;for(let n of e.parts){if(n.type!==`static`)break;t+=n.value}return t}function gs(e,t){if(!t)return{priorityCount:0,templates:[...e]};let n=t.replace(/-/g,``),r=[],i=[];for(let a=0;a<e.length;a++){let o=e[a],s=hs(o),c=s.replace(/-/g,``),l=-1;s&&t.startsWith(s)?l=0:c&&n.startsWith(c)?l=1:s.startsWith(t)?l=2:c.startsWith(n)&&(l=3),l<0?i.push(o):r.push({category:l,index:a,parsed:o,prefixLength:l<2?l?c.length:s.length:0})}return r.sort((e,t)=>e.category-t.category||t.prefixLength-e.prefixLength||e.index-t.index),{priorityCount:r.length,templates:[...r.map(({parsed:e})=>e),...i]}}function _s(e,t){return e.length<=t?[...e]:t<=0?[]:t===1?[e[0]]:Array.from({length:t},(n,r)=>e[Math.floor(r*(e.length-1)/(t-1))])}async function vs(e,t,n){let r=Array(e.length),i=0,a=!1,o=Array.from({length:Math.min(t,e.length)},async()=>{for(;!a&&i<e.length;){let t=i++;try{r[t]=await n(e[t])}catch(e){throw a=!0,e}}});return await Promise.all(o),r}function ys(e,t=X){let n=as(t);for(let t of e)if(!ss(n,t))break;return ds(n)}function bs(e,t){let n=[],r=new Set,i=0,a=0;for(let o of e)if(o.startsWith(t)){if(i===Xo||n.length===X||a>=qo)break;i++,!(!o||r.has(o)||o.length>Yo||a+o.length>qo)&&(r.add(o),n.push(o),a+=o.length)}return n}function xs(e,t={}){let n=new Map,r=new ra({max:$o,maxSize:32e6,sizeCalculation:(e,t)=>Math.max(1,t.length*2+e.reduce((e,t)=>e+t.length*2+8,0))}),i=new Map,a=e.config,o=0,s=[],c,l,u=[],d=0,f=new Set,p=new Set,m=[],h=new Map,g=new Set,_=es(),{matchType:v=`prefix`,throwErrors:y=!0}=t;return ee(),{suggest:S,suggestInFile:w,templates:m,cache:r,errorCache:i,reset:ee,enumerate:b};async function b(){let e=Array.from(`abcdefghijklmnopqrstuvwxyz`),t=[...e,`-`],n=e.flatMap(e=>[e,...t.map(t=>`${e}${t}`)]);for(;;){B();let e=a,t=o,r=new Set;if(await x(n,r,e,t,e=>e)&&await x([...r].filter(e=>/^\w+$/.test(e)&&e.length>3),r,e,t,e=>`${e}-`))return r}}async function x(e,t,n,r,i){for(let a=0;a<e.length;a+=128){let o=await H(Promise.all(e.slice(a,a+128).map(e=>S(i(e)))),n,r);if(o.stale)return!1;for(let e of o.value)for(let n of e)t.add(n)}return!0}async function S(e,t=!1){if(B(),!t&&e.length<1)return[];if(r.has(e))return r.get(e);let n=h.get(e);if(n)return n;let i=C(e,t);h.set(e,i);try{return await i}finally{h.get(e)===i&&h.delete(e)}}async function C(t,n){for(;;){B();let i=a,s=o;if(!n&&t.length<1)return[];if(r.has(t))return r.get(t);let c=i.presets.find(e=>e.name===`@teacss/preset-attributify`)?.options?.prefix,l=c?t.startsWith(c)?t.slice(c.length):t.replace(`:${c}`,`:`):t,u=await H(e.matchVariants(l),i,s);if(u.stale)continue;let d=await H(Promise.all(u.value.map(async([,e])=>{if(!e&&l)return[];let n=e?t.indexOf(e):t.length;n===-1&&(n=0);let r=t.slice(0,n),a=t.slice(n+e.length),o=v===`fuzzy`?[E(e,i,s),k(e,i,s),O(e),D(e)]:[E(e,i,s),D(e),O(e),k(e,i,s)];return U(await Promise.all(o),r,a)})),i,s);if(d.stale)continue;let f=d.value.flat();if(f=v===`fuzzy`?F(Fa(f,t,{maxCandidates:Z.maxCandidates,maxCharacters:Z.maxCharacters}),t):ys(f),!V(i,s))return r.set(t,f),f}}async function w(e,t){B();let n=a,r=o,i=Go(e,t)!==void 0,s=await H(T(e,t,n),n,r);if(s.stale)return w(e,t);let c=s.value;if(c){let a=await S(c.extracted,i);if(V(n,r))return w(e,t);let o=c.transformSuggestions?c.transformSuggestions(a):a;return{suggestions:a.map((e,t)=>[e,o[t]]),resolveReplacement:c.resolveReplacement}}let l=Fo(e,t,n.presets.some(e=>e.name===`@teacss/preset-attributify`));if(!l)return;let u=await S(l.content,i);return V(n,r)?w(e,t):{suggestions:u.map(e=>[e,e]),resolveReplacement:e=>({start:l.start,end:l.end,replacement:e})}}async function T(e,t,n){if(!n.autocomplete.extractors.length)return null;for(let r of n.autocomplete.extractors){let n=await r.extract({content:e,cursor:t});if(n)return n}return null}async function E(t,n,r){let i=await e.parseToken(t,`-`);return i&&!V(n,r)&&(p.delete(t),p.add(t),p.size>$o&&p.delete(p.values().next().value)),i?[t]:[]}async function D(e){if(v===`fuzzy`){let t=I(),n=F(u,e,t,d),r=Fa(L(),e,{maxAttempts:Xo,maxCandidates:750,maxCharacters:6e4});return Fa([...n,...r],e,{maxCandidates:X,maxCharacters:Z.maxCharacters})}return c??=[...s].sort(is),bs(c,e)}async function O(t){return ys(n());function*n(){for(let e of p)e.startsWith(t)&&(yield e);for(let[n,r]of e.cache){if(!r)continue;let e=n.replace(/ -$/,``);e.startsWith(t)&&(yield e)}}}async function k(e,t,n){let r=m.filter(e=>typeof e==`function`);if(v!==`fuzzy`){let i=R(e),a=await A(r,e,t,n);return[...i,...a]}let i=z(e),a=await j(r,e,t,n);return[...i,...a]}async function A(e,t,n,r){if(!e.length)return[];let i=as(X),a=as(X);for(let o=0;o<e.length;o+=8){let s=await vs(e.slice(o,o+8),8,e=>M(e,t,n,r));if(V(n,r))return[];let c=fs(Xo,o,s.length,e.length),l=fs(Jo,o,s.length,e.length),u=as(X,c,l),d=ps(s.filter(e=>!!e?.length));for(;os(u);){let e=d.next();if(e.done)break;ss(u,e.value)}for(let e of ds(u))cs(i,e);let f=as(X,c,l);for(;os(f);){let e=d.next();if(e.done)break;ss(f,e.value)}for(let e of ds(f))cs(i,e);for(;os(a);){let e=d.next();if(e.done)break;ss(a,e.value)}}for(let e of ds(a))cs(i,e);return ds(i)}async function j(e,t,n,r){if(!e.length)return[];let i=[],a=new Set,o={attempts:0,characters:0};for(let s=0;s<e.length;s+=32){let c=await vs(e.slice(s,s+32),32,e=>M(e,t,n,r));if(V(n,r))return[];let l=ps(c.filter(e=>!!e?.length)),u=fs(Xo,s,c.length,e.length),d=fs(pa.maxScannedCharacters,s,c.length,e.length),f=Fa(l,t,{maxAttempts:u,maxCandidates:X,maxCharacters:Z.maxCharacters,maxScannedCharacters:d});i=Fa([...i,...f],t,{maxAttempts:i.length+f.length,maxCandidates:X,maxCharacters:Z.maxCharacters});let p=Fa(ms(l,a,{attempts:0,characters:0},u,d,pa.maxCandidateLength),t,{maxAttempts:u,maxCandidates:750,maxCharacters:Z.maxCharacters,maxScannedCharacters:d});i=Fa([...i,...p],t,{maxAttempts:i.length+p.length,maxCandidates:X,maxCharacters:Z.maxCharacters});let m=Fa(ms(l,a,{attempts:0,characters:0},u,d,pa.maxCandidateLength),t,{maxAttempts:u,maxCandidates:750,maxCharacters:Z.maxCharacters,maxScannedCharacters:d});i=Fa([...i,...m],t,{maxAttempts:i.length+m.length,maxCandidates:X,maxCharacters:Z.maxCharacters});let h=Fa(ms(l,a,o,Xo,pa.maxScannedCharacters,pa.maxCandidateLength),t,{maxAttempts:Xo-o.attempts,maxCandidates:750,maxCharacters:Z.maxCharacters,maxScannedCharacters:pa.maxScannedCharacters-o.characters});i=Fa([...i,...h],t,{maxAttempts:i.length+h.length,maxCandidates:X,maxCharacters:Z.maxCharacters})}return i}async function M(e,t,n,r){let i=_;await N(i);try{if(V(n,r))return;try{return await e(t)}catch{return}}finally{P(i)}}async function N(e){if(e.active<128){e.active++;return}await new Promise(t=>e.waiters.push(t))}function P(e){let t=e.waiters.shift();t?t():e.active--}function F(e,t,n,r){return La(t,r??e.reduce((e,t)=>e+t.length,0))?Fa(e,t,{maxCandidates:X,maxCharacters:Z.maxCharacters}):(n??new Gi(e,{fuzzy:`v1`,limit:X,tiebreakers:[Wi,Ui]})).find(t).map(e=>e.item)}function I(){if(l)return l;let e=new Set,t=0,n=0,r=n=>!n||e.has(n)||n.length>Z.maxCandidateLength||e.size===Z.maxCandidates||t+n.length>Z.maxCharacters?!1:(e.add(n),t+=n.length,!0),i=0;for(;i<s.length&&n<Z.maxAttempts&&e.size<Z.maxCandidates&&t<Z.maxCharacters;){let e=s[i++];n++,r(e)&&f.add(e)}return u=[...e],d=t,l=new Gi(u,{fuzzy:`v1`,limit:X,tiebreakers:[Wi,Ui]}),l}function*L(){for(let e of s)f.has(e)||(yield e)}function R(e){let t=as(X),r=0,i=0,a=0,o=gs([...n.values()],e).templates.slice(0,Zo);for(let n=0;n<o.length;n++){let s=Xo-r,c=Jo-i,l=Qo-a;if(c<=0||s<=0||l<=0||!os(t))break;let u=o.length-n,d=Math.max(1,Math.floor(s/u)),f=ya(o[n],e,{maxAttempts:d,maxCandidateLength:Yo,maxCandidates:d,maxCharacters:Math.max(1,Math.floor(c/u)),maxScans:Math.max(1,Math.floor(l/u))});r+=f.attempts,i+=f.characters,a+=f.scans;for(let e of f.suggestions)if(!ss(t,e))break}return ds(t)}function z(e){let t=[],r=new Set,i=0,a=0,o=0,s=0,c=gs([...n.values()],e).templates.slice(0,Zo),l=e=>{!e||r.has(e)||e.length>pa.maxCandidateLength||o>=Z.maxCandidates||i+e.length>Z.maxCharacters||(r.add(e),t.push(e),o++,i+=e.length)},u=0;for(let t of Fa(f(),e,{maxAttempts:Zo,maxCandidates:750,maxCharacters:Z.maxCharacters}))l(t);let d=_s(c,Math.max(1,Math.floor(Math.min(Z.maxAttempts,Z.maxCandidates-o)/2)));for(let t=0;t<d.length;t++){let n=Z.maxAttempts-a,r=Z.maxCandidates-o,c=Z.maxCharacters-i,u=Z.maxScans-s;if(n<=0||r<=0||c<=0||u<=0)break;let f=d.length-t,p={maxAttempts:Math.max(2,Math.floor(n/f)),maxCandidates:Math.max(2,Math.floor(r/f)),maxCharacters:Math.max(1,Math.floor(c/f)),maxScans:Math.max(1,Math.floor(u/f))},m;if(e.length<=1){let n=ya(d[t],e,p);m=n.suggestions,a+=n.attempts,s+=n.scans}else{let n=Co(d[t].parts,p,e);m=n.candidates,a+=n.attempts,s+=n.scans}for(let e of m)l(e)}return Fa(t,e,{maxAttempts:Z.maxAttempts,maxCandidates:750,maxCharacters:Z.maxCharacters});function*f(){for(let t=0;t<c.length;t++){let n=Qo-u;if(n<=0)return;let r=c.length-t,i=(e.length<=1?ya:va)(c[t],e,{maxAttempts:1,maxCandidates:1,maxCharacters:pa.maxCandidateLength,maxScans:Math.max(1,Math.floor(n/r))});u+=i.scans,yield*i.suggestions}}}function ee(){let t=e.config,v=[...Object.keys(t.rulesStaticMap),...t.shortcuts.filter(e=>typeof e[0]==`string`).map(e=>e[0])],b=[...t.autocomplete.templates||[],...t.rulesDynamic.flatMap(e=>le(e?.[2]?.autocomplete||[])),...t.shortcuts.flatMap(e=>le(e?.[2]?.autocomplete||[])),...t.variants.flatMap(e=>le(e.autocomplete||[]))],x=new Map,S=new Map;for(let e of b)if(typeof e!=`function`){if(x.has(e)||S.has(e))continue;let n=ka(e,t.theme,t.autocomplete.shorthands);n.errors.length&&S.set(e,n.errors),x.set(e,n)}if(S.size&&y){i.clear();for(let[e,t]of S)i.set(e,t);let e=Array.from(S.values()).flat().map(e=>e.toString()).join(`
28
- `);throw Error(e)}o++;for(let e of[...g])e();a=t,s=v,c=void 0,m.length=0,m.push(...b),n.clear();for(let[e,t]of x)n.set(e,t);r.clear(),h.clear(),_=es(),i.clear();for(let[e,t]of S)i.set(e,t);l=void 0,u=[],d=0,f.clear(),p.clear()}function B(){a!==e.config&&ee()}function V(t,n){return t!==e.config||n!==o}function H(t,n,r){return new Promise((i,a)=>{let o=!1,s=e=>{o||(o=!0,l(),g.delete(c),i(e))},c=()=>s({stale:!0}),l=e.events.on(`config`,e=>{e!==n&&c()});g.add(c),Promise.resolve(t).then(e=>s({stale:!1,value:e}),e=>{o||(o=!0,l(),g.delete(c),a(e))}),V(n,r)&&c()})}function U(t,n=``,r=``){let i=ue(t.flat()).filter(t=>!!(t&&!t.endsWith(`-`)&&!e.isBlocked(t)&&!e.isBlocked(n+t+r)));v!==`fuzzy`&&i.sort(is);let a=i.map(e=>n+e+r);return v===`fuzzy`?a:ys(a)}}function Ss(e){try{return x(e)}catch{try{let t=new URL(e);return t.protocol===`file:`?e:decodeURIComponent(t.pathname.replace(/^\/([a-z]:)/i,`$1`))}catch{return e}}}const Cs=/<style[^>]*>[\s\S]*?(?:<\/style>|<\/>|$)/g,ws=/(?:<\/style>|<\/>)$/,Ts=/<template\b[^>]*\slang\s*=\s*(?:'pug'|"pug")[^>]*>/i;function Es(e,t,n){let r=t.match(/\.(svelte|vue|astro|marko)$/);if(r&&Ds(e,t)){let t=e.slice(0,n);if(/\.$/.test(t)||/\.\S+$/.test(t))return!0}if((r?[...e.matchAll(Cs)].some(t=>{let r=t.index,i=r+t[0].length,a=i===e.length&&!ws.test(t[0]);return n>r&&(n<i||a&&n===i)}):/\.(?:css|scss|sass|less|styl(?:us)?|pcss|postcss)$/i.test(t))||Go(e,n)!==void 0)return!0;let i=e.slice(n).replace(/"[^"]*"|\{[^}]*\}|'[^']*'/g,``);return/^[^<>]*>/.test(i)}function Ds(e,t){return t.endsWith(`.vue`)&&Ts.test(e)}function Os(e,t){let n=d.relative(e,t);return n!==``&&n!==`..`&&!n.startsWith(`..${d.sep}`)&&!d.isAbsolute(n)}const ks={log(){},warn(){}},As=/[\\/](?:node_modules|dist|\.temp|\.cache)[\\/]/;var js=class{cwd;logger;ready;contextsMap=new Map;configSources=[];fileContextCache=new Map;configExistsCache=new Map;loadingContexts=new Map;contextLoadVersions=new Map;contextReloadDisposers=new Map;failedConfigSources=new Map;discoveredConfigs=new Set;yarnPnpSetupFailures=new Set;lifecycleVersion=0;workspaceRoots;events=Jn();constructor(e,t=ks,n=[e]){this.cwd=e,this.logger=t,this.workspaceRoots=Array.from(new Set(n.length?n:[e])),this.ready=this.reload()}log(e){this.logger.log(e)}warn(e){this.logger.warn(e)}isTarget(e){return Array.from(this.contextsMap.keys()).some(t=>Os(t,e))}get contexts(){return Array.from(new Set(this.contextsMap.values())).filter(Qn)}async setRoots(e){let t=Array.from(new Set(e)),n=Array.from(this.contextsMap.keys()),r=this.workspaceRoots.length===t.length&&t.every(e=>this.workspaceRoots.includes(e)),i=n.length===t.length&&t.every(e=>n.includes(e));if(r&&i)return;let a=++this.lifecycleVersion;this.workspaceRoots=t;for(let e of n)t.includes(e)||this.removeContext(e,`contextUnload`,!0);a===this.lifecycleVersion&&(this.resetCaches(),await this.loadRoots(t.filter(e=>!n.includes(e)),a),a===this.lifecycleVersion&&this.events.emit(`reload`))}async reload(){let e=++this.lifecycleVersion,t=Array.from(this.contextsMap.keys()),n=t.length?t:this.workspaceRoots;for(let e of t)this.removeContext(e,`contextUnload`,!1);e===this.lifecycleVersion&&(this.resetCaches(),await this.loadRoots(n,e),e===this.lifecycleVersion&&this.events.emit(`reload`))}async unloadContext(e){this.removeContext(e,`contextUnload`,!0)}async unload(e){this.removeContext(e,`unload`,!0)}removeContext(e,t,n){n&&(this.contextLoadVersions.set(e,(this.contextLoadVersions.get(e)??0)+1),this.loadingContexts.delete(e));let r=this.contextsMap.get(e);r!==void 0&&(this.contextsMap.delete(e),this.failedConfigSources.delete(e),this.syncConfigSources(),r&&(this.disposeContextReload(r),this.clearFileContextCache(r),this.events.emit(t,r),t===`contextUnload`&&this.events.emit(`reload`)))}syncConfigSources(){let e=this.contexts.flatMap(e=>e.getConfigFileList()),t=Array.from(this.failedConfigSources.values()).flat(),n=Array.from(new Set([...e,...t]));this.configSources.splice(0,this.configSources.length,...n)}clearFileContextCache(e){for(let[t,n]of this.fileContextCache)n===e&&this.fileContextCache.delete(t)}resetCaches(){this.fileContextCache.clear(),this.configExistsCache.clear()}releaseDocument(e){this.fileContextCache.delete(e),this.invalidateConfigSearchPath(e)}invalidateConfigSearchPath(e){let t=d.dirname(e),n=this.getWorkspaceBoundary(t);if(n)for(;t===n||Os(n,t);){if(this.configExistsCache.delete(t),t===n)return;t=d.dirname(t)}}async loadRoots(e,t){let n=e.map(e=>({dir:e,loadVersion:this.contextLoadVersions.get(e)??0}));await Promise.all(n.map(async({dir:e,loadVersion:n})=>{try{await this.loadContextInDirectoryWithVersion(e,t,n)}catch(n){if(t!==this.lifecycleVersion)return;this.warn(`⚠️ Failed to reload context for ${e}: ${String(n.stack??n)}`)}}))}async loadContextInDirectory(e){return this.loadContextInDirectoryWithVersion(e,void 0,this.contextLoadVersions.get(e)??0)}async loadContextInDirectoryWithVersion(e,t,n){if(!this.isLoadCurrent(e,t,n))return;let r=this.contextsMap.get(e);if(r!==void 0)return r;let i=this.loadingContexts.get(e);if(i&&i.lifecycleVersion===t&&i.loadVersion===n)return i.promise;let a=this.loadContext(e,t,n);this.loadingContexts.set(e,{lifecycleVersion:t,loadVersion:n,promise:a});try{return await a}finally{this.loadingContexts.get(e)?.promise===a&&this.loadingContexts.delete(e)}}async loadContext(e,t,n){this.setupYarnPnp(e),this.discoveredConfigs.has(e)||this.log(`🛠 Resolving config for ${e}`);let r=y(e,{},e=>{e.config.details=!0}),i=[];try{i=(await r.updateRoot(e)).sources}catch(i){return this.isLoadCurrent(e,t,n)?(this.warn(`⚠️ Error on loading config. Config directory: ${e}`),this.warn(String(i.stack??i)),this.failedConfigSources.set(e,r.getConfigFileList()),this.finishLoading(e,null,t,n)):void 0}if(!this.isLoadCurrent(e,t,n))return;if(this.failedConfigSources.delete(e),!i.length)return this.log(`ℹ️ No config sources found in ${e}`),this.finishLoading(e,null,t,n);if(await r.ready,!this.isLoadCurrent(e,t,n))return;this.setupContextReload(r),this.logConfigInfo(i,r.generator);let a=this.finishLoading(e,r,t,n);return this.events.emit(`contextLoaded`,r),a}setupYarnPnp(e){for(let t of[`.pnp.js`,`.pnp.cjs`]){let n=d.join(e,t);if(u(n))try{ce(n).setup(),this.yarnPnpSetupFailures.delete(n)}catch(e){if(this.yarnPnpSetupFailures.has(n))continue;this.yarnPnpSetupFailures.add(n);let t=e instanceof Error?e.message:String(e);this.warn(`⚠️ Failed to setup Yarn PnP from ${n}: ${t}`)}}}setupContextReload(e){this.disposeContextReload(e);let t=e.onReload(()=>{for(let[t,n]of this.fileContextCache)(n===e||!n)&&this.fileContextCache.delete(t);this.configExistsCache.clear(),this.syncConfigSources(),this.events.emit(`contextReload`,e)});this.contextReloadDisposers.set(e,t);for(let[e,t]of this.fileContextCache)t||this.fileContextCache.delete(e)}disposeContextReload(e){this.contextReloadDisposers.get(e)?.(),this.contextReloadDisposers.delete(e)}isLoadCurrent(e,t,n){return(t===void 0||t===this.lifecycleVersion)&&n===(this.contextLoadVersions.get(e)??0)}logConfigInfo(e,t){let n=e.length===1?e[0]:`\n${e.map(e=>` - ${e}`).join(`
29
- `)}`;this.log(`🛠 New configuration loaded from ${n}`),this.log(`ℹ️ ${t.config.presets.length} presets, ${t.config.rulesSize} rules, ${t.config.shortcuts.length} shortcuts, ${t.config.variants.length} variants, ${t.config.transformers?.length||0} transformers loaded`)}finishLoading(e,t,n,r){if(!this.isLoadCurrent(e,n,r))return;this.contextsMap.has(e)||this.contextsMap.set(e,t),this.syncConfigSources(),this.fileContextCache.clear(),this.events.emit(`reload`);let i=Array.from(this.contextsMap.entries()).filter(([,e])=>e).map(([e])=>e).join(`, `)||`[none]`;return this.log(`🗂️ Enabled context: ${i}`),t}async resolveClosestContext(e,t){if(As.test(t))return;if(this.fileContextCache.has(t)){let e=this.fileContextCache.get(t);return Jr(this.fileContextCache,t,e,100),e}let n=await this.discoverAndLoadConfig(t);if(n)return n;let r=Array.from(this.contextsMap.entries()).sort((e,t)=>t[0].length-e[0].length);for(let[n,i]of r)if(!(!i||!Os(n,t))&&(i.filter(e,t)||fn(t)))return Jr(this.fileContextCache,t,i,100),i;for(let[e,n]of r)if(n&&Os(e,t))return Jr(this.fileContextCache,t,n,100),n}async discoverAndLoadConfig(e){let t=this.lifecycleVersion,n=await this.findConfigDirectory(d.dirname(e),t);if(t!==this.lifecycleVersion||!n||this.contextsMap.has(n))return;this.discoveredConfigs.has(n)||(this.log(`🔍 Discovered config in ${n}`),this.discoveredConfigs.add(n));let r=this.contextLoadVersions.get(n)??0;if(await this.loadContextInDirectoryWithVersion(n,t,r),!this.isLoadCurrent(n,t,r))return;let i=this.contextsMap.get(n);return i&&Jr(this.fileContextCache,e,i,100),i}async findConfigDirectory(e,t){let n=this.configExistsCache.get(e);if(n!==void 0)return Jr(this.configExistsCache,e,n,100),n||void 0;let r=this.getWorkspaceBoundary(e);if(!r)return;let i=d.parse(e).root,a=[],o=e;for(;o!==i&&(Os(r,o)||o===r);){a.push(o);let e=this.configExistsCache.get(o);if(e!==void 0)return Jr(this.configExistsCache,o,e,100),this.cacheSearchPath(a,e||!1),e||void 0;let n=await this.hasConfigFiles(o);if(t!==this.lifecycleVersion)return;if(n)return this.cacheSearchPath(a,o),o;o=d.dirname(o)}this.cacheSearchPath(a,!1)}getWorkspaceBoundary(e){return[...this.workspaceRoots,...this.contextsMap.keys()].filter(t=>t===e||Os(t,e)).sort((e,t)=>t.length-e.length)[0]}async hasConfigFiles(e){return!!g(e)}cacheSearchPath(e,t){for(let n of e)Jr(this.configExistsCache,n,t,100)}};const Ms=/^[A-Za-z]:\//;function Ns(e=``){return e&&e.replace(/\\/g,`/`).replace(Ms,e=>e.toUpperCase())}const Ps=/^[/\\]{2}/,Fs=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,Is=/^[A-Za-z]:$/,Ls=function(e){if(e.length===0)return`.`;e=Ns(e);let t=e.match(Ps),n=Hs(e),r=e[e.length-1]===`/`;return e=Vs(e,!n),e.length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),Is.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!Hs(e)?`/${e}`:e)},Rs=function(...e){let t=``;for(let n of e)if(n)if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;e&&r?t+=n.slice(1):t+=e||r?n:`/${n}`}else t+=n;return Ls(t)};function zs(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const Bs=function(...e){e=e.map(e=>Ns(e));let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:zs();!i||i.length===0||(t=`${i}/${t}`,n=Hs(i))}return t=Vs(t,!n),n&&!Hs(t)?`/${t}`:t.length>0?t:`.`};function Vs(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(i!==s-1&&a!==1)if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}const Hs=function(e){return Fs.test(e)};var Us=K(((e,t)=>{let n=`[^\\\\/]`,r=`[^/]`,i=`(?:\\/|$)`,a=`(?:^|\\/)`,o=`\\.{1,2}${i}`,s={DOT_LITERAL:`\\.`,PLUS_LITERAL:`\\+`,QMARK_LITERAL:`\\?`,SLASH_LITERAL:`\\/`,ONE_CHAR:`(?=.)`,QMARK:r,END_ANCHOR:i,DOTS_SLASH:o,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!${a}${o})`,NO_DOT_SLASH:`(?!\\.{0,1}${i})`,NO_DOTS_SLASH:`(?!${o})`,QMARK_NO_DOT:`[^.\\/]`,STAR:`${r}*?`,START_ANCHOR:a,SEP:`/`},c={...s,SLASH_LITERAL:`[\\\\/]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`\\.{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!\\.{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!\\.{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:`[^.\\\\/]`,START_ANCHOR:`(?:^|[\\\\/])`,END_ANCHOR:`(?:[\\\\/]|$)`,SEP:`\\`};t.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:{__proto__:null,alnum:`a-zA-Z0-9`,alpha:`a-zA-Z`,ascii:`\\x00-\\x7F`,blank:` \\t`,cntrl:`\\x00-\\x1F\\x7F`,digit:`0-9`,graph:`\\x21-\\x7E`,lower:`a-z`,print:`\\x20-\\x7E `,punct:`\\-!"#$%&'()\\*+,./:;<=>?@[\\]^_\`{|}~`,space:` \\t\\r\\n\\v\\f`,upper:`A-Z`,word:`A-Za-z0-9_`,xdigit:`A-Fa-f0-9`},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":`*`,"**/**":`**`,"**/**/**":`**`},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(e){return{"!":{type:`negate`,open:`(?:(?!(?:`,close:`))${e.STAR})`},"?":{type:`qmark`,open:`(?:`,close:`)?`},"+":{type:`plus`,open:`(?:`,close:`)+`},"*":{type:`star`,open:`(?:`,close:`)*`},"@":{type:`at`,open:`(?:`,close:`)`}}},globChars(e){return e===!0?c:s}}})),Ws=K((e=>{let{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=Us();e.isObject=e=>typeof e==`object`&&!!e&&!Array.isArray(e),e.hasRegexChars=e=>r.test(e),e.isRegexChar=t=>t.length===1&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(i,`\\$1`),e.toPosixSlashes=e=>e.replace(t,`/`),e.isWindows=()=>{if(typeof navigator<`u`&&navigator.platform){let e=navigator.platform.toLowerCase();return e===`win32`||e===`windows`}return typeof process<`u`&&process.platform?process.platform===`win32`:!1},e.removeBackslashes=e=>e.replace(n,e=>e===`\\`?``:e),e.escapeLast=(t,n,r)=>{let i=t.lastIndexOf(n,r);return i===-1?t:t[i-1]===`\\`?e.escapeLast(t,n,i-1):`${t.slice(0,i)}\\${t.slice(i)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith(`./`)&&(n=n.slice(2),t.prefix=`./`),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?``:`^`}(?:${e})${n.contains?``:`$`}`;return t.negated===!0&&(r=`(?:^(?!${r}).*$)`),r},e.basename=(e,{windows:t}={})=>{let n=e.split(t?/[\\/]/:`/`),r=n[n.length-1];return r===``?n[n.length-2]:r}})),Gs=K(((e,t)=>{let n=Ws(),{CHAR_ASTERISK:r,CHAR_AT:i,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:c,CHAR_FORWARD_SLASH:l,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:d,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_PLUS:p,CHAR_QUESTION_MARK:m,CHAR_RIGHT_CURLY_BRACE:h,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:_}=Us(),v=e=>e===l||e===a,y=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let b=t||{},x=e.length-1,S=b.parts===!0||b.scanToEnd===!0,C=[],w=[],T=[],E=e,D=-1,O=0,k=0,A=!1,j=!1,M=!1,N=!1,P=!1,F=!1,I=!1,L=!1,R=!1,z=!1,ee=0,B,V,H={value:``,depth:0,isGlob:!1},U=()=>D>=x,te=()=>E.charCodeAt(D+1),W=()=>(B=V,E.charCodeAt(++D));for(;D<x;){V=W();let e;if(V===a){I=H.backslashes=!0,V=W(),V===u&&(F=!0);continue}if(F===!0||V===u){for(ee++;U()!==!0&&(V=W());){if(V===a){I=H.backslashes=!0,W();continue}if(V===u){ee++;continue}if(F!==!0&&V===s&&(V=W())===s){if(A=H.isBrace=!0,M=H.isGlob=!0,z=!0,S===!0)continue;break}if(F!==!0&&V===o){if(A=H.isBrace=!0,M=H.isGlob=!0,z=!0,S===!0)continue;break}if(V===h&&(ee--,ee===0)){F=!1,A=H.isBrace=!0,z=!0;break}}if(S===!0)continue;break}if(V===l){if(C.push(D),w.push(H),H={value:``,depth:0,isGlob:!1},z===!0)continue;if(B===s&&D===O+1){O+=2;continue}k=D+1;continue}if(b.noext!==!0&&(V===p||V===i||V===r||V===m||V===c)&&te()===d){if(M=H.isGlob=!0,N=H.isExtglob=!0,z=!0,V===c&&D===O&&(R=!0),S===!0){for(;U()!==!0&&(V=W());){if(V===a){I=H.backslashes=!0,V=W();continue}if(V===g){M=H.isGlob=!0,z=!0;break}}continue}break}if(V===r){if(B===r&&(P=H.isGlobstar=!0),M=H.isGlob=!0,z=!0,S===!0)continue;break}if(V===m){if(M=H.isGlob=!0,z=!0,S===!0)continue;break}if(V===f){for(;U()!==!0&&(e=W());){if(e===a){I=H.backslashes=!0,W();continue}if(e===_){j=H.isBracket=!0,M=H.isGlob=!0,z=!0;break}}if(S===!0)continue;break}if(b.nonegate!==!0&&V===c&&D===O){L=H.negated=!0,O++;continue}if(b.noparen!==!0&&V===d){if(M=H.isGlob=!0,S===!0){for(;U()!==!0&&(V=W());){if(V===d){I=H.backslashes=!0,V=W();continue}if(V===g){z=!0;break}}continue}break}if(M===!0){if(z=!0,S===!0)continue;break}}b.noext===!0&&(N=!1,M=!1);let G=E,ne=``,re=``;O>0&&(ne=E.slice(0,O),E=E.slice(O),k-=O),G&&M===!0&&k>0?(G=E.slice(0,k),re=E.slice(k)):M===!0?(G=``,re=E):G=E,G&&G!==``&&G!==`/`&&G!==E&&v(G.charCodeAt(G.length-1))&&(G=G.slice(0,-1)),b.unescape===!0&&(re&&=n.removeBackslashes(re),G&&I===!0&&(G=n.removeBackslashes(G)));let ie={prefix:ne,input:e,start:O,base:G,glob:re,isBrace:A,isBracket:j,isGlob:M,isExtglob:N,isGlobstar:P,negated:L,negatedExtglob:R};if(b.tokens===!0&&(ie.maxDepth=0,v(V)||w.push(H),ie.tokens=w),b.parts===!0||b.tokens===!0){let t;for(let n=0;n<C.length;n++){let r=t?t+1:O,i=C[n],a=e.slice(r,i);b.tokens&&(n===0&&O!==0?(w[n].isPrefix=!0,w[n].value=ne):w[n].value=a,y(w[n]),ie.maxDepth+=w[n].depth),(n!==0||a!==``)&&T.push(a),t=i}if(t&&t+1<e.length){let n=e.slice(t+1);T.push(n),b.tokens&&(w[w.length-1].value=n,y(w[w.length-1]),ie.maxDepth+=w[w.length-1].depth)}ie.slashes=C,ie.parts=T}return ie}})),Ks=K(((e,t)=>{let n=Us(),r=Ws(),{MAX_LENGTH:i,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:c}=n,l=(e,t)=>{if(typeof t.expandRange==`function`)return t.expandRange(...e,t);e.sort();let n=`[${e.join(`-`)}]`;try{new RegExp(n)}catch{return e.map(e=>r.escapeRegex(e)).join(`..`)}return n},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,d=e=>{let t=[],n=0,r=0,i=0,a=``,o=!1;for(let s of e){if(o===!0){a+=s,o=!1;continue}if(s===`\\`){a+=s,o=!0;continue}if(s===`"`){i=i===1?0:1,a+=s;continue}if(i===0){if(s===`[`)n++;else if(s===`]`&&n>0)n--;else if(n===0){if(s===`(`)r++;else if(s===`)`&&r>0)r--;else if(s===`|`&&r===0){t.push(a),a=``;continue}}}a+=s}return t.push(a),t},f=e=>{let t=!1;for(let n of e){if(t===!0){t=!1;continue}if(n===`\\`){t=!0;continue}if(/[?*+@!()[\]{}]/.test(n))return!1}return!0},p=e=>{let t=e.trim(),n=!0;for(;n===!0;)n=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),n=!0);if(f(t))return t.replace(/\\(.)/g,`$1`)},m=e=>{let t=e.map(p).filter(Boolean);for(let e=0;e<t.length;e++)for(let n=e+1;n<t.length;n++){let r=t[e],i=t[n],a=r[0];if(!(!a||r!==a.repeat(r.length)||i!==a.repeat(i.length))&&(r===i||r.startsWith(i)||i.startsWith(r)))return!0}return!1},h=(e,t=!0)=>{if(e[0]!==`+`&&e[0]!==`*`||e[1]!==`(`)return;let n=0,r=0,i=0,a=!1;for(let o=1;o<e.length;o++){let s=e[o];if(a===!0){a=!1;continue}if(s===`\\`){a=!0;continue}if(s===`"`){i=i===1?0:1;continue}if(i!==1){if(s===`[`){n++;continue}if(s===`]`&&n>0){n--;continue}if(!(n>0)){if(s===`(`){r++;continue}if(s===`)`&&(r--,r===0))return t===!0&&o!==e.length-1?void 0:{type:e[0],body:e.slice(2,o),end:o}}}}},g=e=>`${e.length===1?r.escapeRegex(e[0]):`[${e.map(e=>r.escapeRegex(e)).join(``)}]`}*`,_=e=>{let t=0,n=[];for(;t<e.length;){let r=h(e.slice(t),!1);if(!r||r.type!==`*`)return;let i=d(r.body).map(e=>e.trim());if(i.length!==1)return;let a=p(i[0]);if(!a||a.length!==1)return;n.push(a),t+=r.end+1}if(!(n.length<1))return n},v=e=>{let t=0,n=e.trim(),r=h(n);for(;r;)t++,n=r.body.trim(),r=h(n);return t},y=(e,t)=>{if(t.maxExtglobRecursion===!1)return{risky:!1};let r=typeof t.maxExtglobRecursion==`number`?t.maxExtglobRecursion:n.DEFAULT_MAX_EXTGLOB_RECURSION,i=d(e).map(e=>e.trim());if(i.length>1&&(i.some(e=>e===``)||i.some(e=>/^[*?]+$/.test(e))||m(i)))return{risky:!0};let a=[],o=!1,s=!0;for(let e of i){let t=_(e);if(t){o=!0,a.push(...t);continue}let n=p(e);if(n&&n.length===1){a.push(n);continue}if(s=!1,v(e)>r)return{risky:!0}}return o?s?{risky:!0,safeOutput:g([...new Set(a)])}:{risky:!0}:{risky:!1}},b=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);e=c[e]||e;let d={...t},f=typeof d.maxLength==`number`?Math.min(i,d.maxLength):i,p=e.length;if(p>f)throw SyntaxError(`Input length: ${p}, exceeds maximum allowed length: ${f}`);let m={type:`bos`,value:``,output:d.prepend||``},h=[m],g=d.capture?``:`?:`,_=n.globChars(d.windows),v=n.extglobChars(_),{DOT_LITERAL:x,PLUS_LITERAL:S,SLASH_LITERAL:C,ONE_CHAR:w,DOTS_SLASH:T,NO_DOT:E,NO_DOT_SLASH:D,NO_DOTS_SLASH:O,QMARK:k,QMARK_NO_DOT:A,STAR:j,START_ANCHOR:M}=_,N=e=>`(${g}(?:(?!${M}${e.dot?T:x}).)*?)`,P=d.dot?``:E,F=d.dot?k:A,I=d.bash===!0?N(d):j;d.capture&&(I=`(${I})`),typeof d.noext==`boolean`&&(d.noextglob=d.noext);let L={input:e,index:-1,start:0,dot:d.dot===!0,consumed:``,output:``,prefix:``,backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:h};e=r.removePrefix(e,L),p=e.length;let R=[],z=[],ee=[],B=m,V,H=()=>L.index===p-1,U=L.peek=(t=1)=>e[L.index+t],te=L.advance=()=>e[++L.index]||``,W=()=>e.slice(L.index+1),G=(e=``,t=0)=>{L.consumed+=e,L.index+=t},ne=e=>{L.output+=e.output==null?e.value:e.output,G(e.value)},re=()=>{let e=1;for(;U()===`!`&&(U(2)!==`(`||U(3)===`?`);)te(),L.start++,e++;return e%2==0?!1:(L.negated=!0,L.start++,!0)},ie=e=>{L[e]++,ee.push(e)},ae=e=>{L[e]--,ee.pop()},K=e=>{if(B.type===`globstar`){let t=L.braces>0&&(e.type===`comma`||e.type===`brace`),n=e.extglob===!0||R.length&&(e.type===`pipe`||e.type===`paren`);e.type!==`slash`&&e.type!==`paren`&&!t&&!n&&(L.output=L.output.slice(0,-B.output.length),B.type=`star`,B.value=`*`,B.output=I,L.output+=B.output)}if(R.length&&e.type!==`paren`&&(R[R.length-1].inner+=e.value),(e.value||e.output)&&ne(e),B&&B.type===`text`&&e.type===`text`){B.output=(B.output||B.value)+e.value,B.value+=e.value;return}e.prev=B,h.push(e),B=e},oe=(e,t)=>{let n={...v[t],conditions:1,inner:``};n.prev=B,n.parens=L.parens,n.output=L.output,n.startIndex=L.index,n.tokensIndex=h.length;let r=(d.capture?`(`:``)+n.open;ie(`parens`),K({type:e,value:t,output:L.output?``:w}),K({type:`paren`,extglob:!0,value:te(),output:r}),R.push(n)},se=n=>{let i=e.slice(n.startIndex,L.index+1),a=e.slice(n.startIndex+2,L.index),o=y(a,d);if((n.type===`plus`||n.type===`star`)&&o.risky){let e=o.safeOutput?(n.output?``:w)+(d.capture?`(${o.safeOutput})`:o.safeOutput):void 0,t=h[n.tokensIndex];t.type=`text`,t.value=i,t.output=e||r.escapeRegex(i);for(let e=n.tokensIndex+1;e<h.length;e++)h[e].value=``,h[e].output=``,delete h[e].suffix;L.output=n.output+t.output,L.backtrack=!0,K({type:`paren`,extglob:!0,value:V,output:``}),ae(`parens`);return}let s=n.close+(d.capture?`)`:``),c;if(n.type===`negate`){let e=I;n.inner&&n.inner.length>1&&n.inner.includes(`/`)&&(e=N(d)),(e!==I||H()||/^\)+$/.test(W()))&&(s=n.close=`)$))${e}`),n.inner.includes(`*`)&&(c=W())&&/^\.[^\\/.]+$/.test(c)&&(s=n.close=`)${b(c,{...t,fastpaths:!1}).output})${e})`),n.prev.type===`bos`&&(L.negatedExtglob=!0)}K({type:`paren`,extglob:!0,value:V,output:s}),ae(`parens`)};if(d.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let n=!1,i=e.replace(s,(e,t,r,i,a,o)=>i===`\\`?(n=!0,e):i===`?`?t?t+i+(a?k.repeat(a.length):``):o===0?F+(a?k.repeat(a.length):``):k.repeat(r.length):i===`.`?x.repeat(r.length):i===`*`?t?t+i+(a?I:``):I:t?e:`\\${e}`);return n===!0&&(i=d.unescape===!0?i.replace(/\\/g,``):i.replace(/\\+/g,e=>e.length%2==0?`\\\\`:e?`\\`:``)),i===e&&d.contains===!0?(L.output=e,L):(L.output=r.wrapOutput(i,L,t),L)}for(;!H();){if(V=te(),V===`\0`)continue;if(V===`\\`){let e=U();if(e===`/`&&d.bash!==!0||e===`.`||e===`;`)continue;if(!e){V+=`\\`,K({type:`text`,value:V});continue}let t=/^\\+/.exec(W()),n=0;if(t&&t[0].length>2&&(n=t[0].length,L.index+=n,n%2!=0&&(V+=`\\`)),d.unescape===!0?V=te():V+=te(),L.brackets===0){K({type:`text`,value:V});continue}}if(L.brackets>0&&(V!==`]`||B.value===`[`||B.value===`[^`)){if(d.posix!==!1&&V===`:`){let e=B.value.slice(1);if(e.includes(`[`)&&(B.posix=!0,e.includes(`:`))){let e=B.value.lastIndexOf(`[`),t=B.value.slice(0,e),n=B.value.slice(e+2),r=a[n];if(r){B.value=t+r,L.backtrack=!0,te(),!m.output&&h.indexOf(B)===1&&(m.output=w);continue}}}(V===`[`&&U()!==`:`||V===`-`&&U()===`]`)&&(V=`\\${V}`),V===`]`&&(B.value===`[`||B.value===`[^`)&&(V=`\\${V}`),d.posix===!0&&V===`!`&&B.value===`[`&&(V=`^`),B.value+=V,ne({value:V});continue}if(L.quotes===1&&V!==`"`){V=r.escapeRegex(V),B.value+=V,ne({value:V});continue}if(V===`"`){L.quotes=L.quotes===1?0:1,d.keepQuotes===!0&&K({type:`text`,value:V});continue}if(V===`(`){ie(`parens`),K({type:`paren`,value:V});continue}if(V===`)`){if(L.parens===0&&d.strictBrackets===!0)throw SyntaxError(u(`opening`,`(`));let e=R[R.length-1];if(e&&L.parens===e.parens+1){se(R.pop());continue}K({type:`paren`,value:V,output:L.parens?`)`:`\\)`}),ae(`parens`);continue}if(V===`[`){if(d.nobracket===!0||!W().includes(`]`)){if(d.nobracket!==!0&&d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));V=`\\${V}`}else ie(`brackets`);K({type:`bracket`,value:V});continue}if(V===`]`){if(d.nobracket===!0||B&&B.type===`bracket`&&B.value.length===1){K({type:`text`,value:V,output:`\\${V}`});continue}if(L.brackets===0){if(d.strictBrackets===!0)throw SyntaxError(u(`opening`,`[`));K({type:`text`,value:V,output:`\\${V}`});continue}ae(`brackets`);let e=B.value.slice(1);if(B.posix!==!0&&e[0]===`^`&&!e.includes(`/`)&&(V=`/${V}`),B.value+=V,ne({value:V}),d.literalBrackets===!1||r.hasRegexChars(e))continue;let t=r.escapeRegex(B.value);if(L.output=L.output.slice(0,-B.value.length),d.literalBrackets===!0){L.output+=t,B.value=t;continue}B.value=`(${g}${t}|${B.value})`,L.output+=B.value;continue}if(V===`{`&&d.nobrace!==!0){ie(`braces`);let e={type:`brace`,value:V,output:`(`,outputIndex:L.output.length,tokensIndex:L.tokens.length};z.push(e),K(e);continue}if(V===`}`){let e=z[z.length-1];if(d.nobrace===!0||!e){K({type:`text`,value:V,output:V});continue}let t=`)`;if(e.dots===!0){let e=h.slice(),n=[];for(let t=e.length-1;t>=0&&(h.pop(),e[t].type!==`brace`);t--)e[t].type!==`dots`&&n.unshift(e[t].value);t=l(n,d),L.backtrack=!0}if(e.comma!==!0&&e.dots!==!0){let n=L.output.slice(0,e.outputIndex),r=L.tokens.slice(e.tokensIndex);e.value=e.output=`\\{`,V=t=`\\}`,L.output=n;for(let e of r)L.output+=e.output||e.value}K({type:`brace`,value:V,output:t}),ae(`braces`),z.pop();continue}if(V===`|`){R.length>0&&R[R.length-1].conditions++,K({type:`text`,value:V});continue}if(V===`,`){let e=V,t=z[z.length-1];t&&ee[ee.length-1]===`braces`&&(t.comma=!0,e=`|`),K({type:`comma`,value:V,output:e});continue}if(V===`/`){if(B.type===`dot`&&L.index===L.start+1){L.start=L.index+1,L.consumed=``,L.output=``,h.pop(),B=m;continue}K({type:`slash`,value:V,output:C});continue}if(V===`.`){if(L.braces>0&&B.type===`dot`){B.value===`.`&&(B.output=x);let e=z[z.length-1];B.type=`dots`,B.output+=V,B.value+=V,e.dots=!0;continue}if(L.braces+L.parens===0&&B.type!==`bos`&&B.type!==`slash`){K({type:`text`,value:V,output:x});continue}K({type:`dot`,value:V,output:x});continue}if(V===`?`){if(!(B&&B.value===`(`)&&d.noextglob!==!0&&U()===`(`&&U(2)!==`?`){oe(`qmark`,V);continue}if(B&&B.type===`paren`){let e=U(),t=V;(B.value===`(`&&!/[!=<:]/.test(e)||e===`<`&&!/<([!=]|\w+>)/.test(W()))&&(t=`\\${V}`),K({type:`text`,value:V,output:t});continue}if(d.dot!==!0&&(B.type===`slash`||B.type===`bos`)){K({type:`qmark`,value:V,output:A});continue}K({type:`qmark`,value:V,output:k});continue}if(V===`!`){if(d.noextglob!==!0&&U()===`(`&&(U(2)!==`?`||!/[!=<:]/.test(U(3)))){oe(`negate`,V);continue}if(d.nonegate!==!0&&L.index===0){re();continue}}if(V===`+`){if(d.noextglob!==!0&&U()===`(`&&U(2)!==`?`){oe(`plus`,V);continue}if(B&&B.value===`(`||d.regex===!1){K({type:`plus`,value:V,output:S});continue}if(B&&(B.type===`bracket`||B.type===`paren`||B.type===`brace`)||L.parens>0){K({type:`plus`,value:V});continue}K({type:`plus`,value:S});continue}if(V===`@`){if(d.noextglob!==!0&&U()===`(`&&U(2)!==`?`){K({type:`at`,extglob:!0,value:V,output:``});continue}K({type:`text`,value:V});continue}if(V!==`*`){(V===`$`||V===`^`)&&(V=`\\${V}`);let e=o.exec(W());e&&(V+=e[0],L.index+=e[0].length),K({type:`text`,value:V});continue}if(B&&(B.type===`globstar`||B.star===!0)){B.type=`star`,B.star=!0,B.value+=V,B.output=I,L.backtrack=!0,L.globstar=!0,G(V);continue}let t=W();if(d.noextglob!==!0&&/^\([^?]/.test(t)){oe(`star`,V);continue}if(B.type===`star`){if(d.noglobstar===!0){G(V);continue}let n=B.prev,r=n.prev,i=n.type===`slash`||n.type===`bos`,a=r&&(r.type===`star`||r.type===`globstar`);if(d.bash===!0&&(!i||t[0]&&t[0]!==`/`)){K({type:`star`,value:V,output:``});continue}let o=L.braces>0&&(n.type===`comma`||n.type===`brace`),s=R.length&&(n.type===`pipe`||n.type===`paren`);if(!i&&n.type!==`paren`&&!o&&!s){K({type:`star`,value:V,output:``});continue}for(;t.slice(0,3)===`/**`;){let n=e[L.index+4];if(n&&n!==`/`)break;t=t.slice(3),G(`/**`,3)}if(n.type===`bos`&&H()){B.type=`globstar`,B.value+=V,B.output=N(d),L.output=B.output,L.globstar=!0,G(V);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&!a&&H()){L.output=L.output.slice(0,-(n.output+B.output).length),n.output=`(?:${n.output}`,B.type=`globstar`,B.output=N(d)+(d.strictSlashes?`)`:`|$)`),B.value+=V,L.globstar=!0,L.output+=n.output+B.output,G(V);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&t[0]===`/`){let e=t[1]===void 0?``:`|$`;L.output=L.output.slice(0,-(n.output+B.output).length),n.output=`(?:${n.output}`,B.type=`globstar`,B.output=`${N(d)}${C}|${C}${e})`,B.value+=V,L.output+=n.output+B.output,L.globstar=!0,G(V+te()),K({type:`slash`,value:`/`,output:``});continue}if(n.type===`bos`&&t[0]===`/`){B.type=`globstar`,B.value+=V,B.output=`(?:^|${C}|${N(d)}${C})`,L.output=B.output,L.globstar=!0,G(V+te()),K({type:`slash`,value:`/`,output:``});continue}L.output=L.output.slice(0,-B.output.length),B.type=`globstar`,B.output=N(d),B.value+=V,L.output+=B.output,L.globstar=!0,G(V);continue}let n={type:`star`,value:V,output:I};if(d.bash===!0){n.output=`.*?`,(B.type===`bos`||B.type===`slash`)&&(n.output=P+n.output),K(n);continue}if(B&&(B.type===`bracket`||B.type===`paren`)&&d.regex===!0){n.output=V,K(n);continue}(L.index===L.start||B.type===`slash`||B.type===`dot`)&&(B.type===`dot`?(L.output+=D,B.output+=D):d.dot===!0?(L.output+=O,B.output+=O):(L.output+=P,B.output+=P),U()!==`*`&&(L.output+=w,B.output+=w)),K(n)}for(;L.brackets>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));L.output=r.escapeLast(L.output,`[`),ae(`brackets`)}for(;L.parens>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`)`));L.output=r.escapeLast(L.output,`(`),ae(`parens`)}for(;L.braces>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`}`));L.output=r.escapeLast(L.output,`{`),ae(`braces`)}if(d.strictSlashes!==!0&&(B.type===`star`||B.type===`bracket`)&&K({type:`maybe_slash`,value:``,output:`${C}?`}),L.backtrack===!0){L.output=``;for(let e of L.tokens)L.output+=e.output==null?e.value:e.output,e.suffix&&(L.output+=e.suffix)}return L};b.fastpaths=(e,t)=>{let a={...t},o=typeof a.maxLength==`number`?Math.min(i,a.maxLength):i,s=e.length;if(s>o)throw SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${o}`);e=c[e]||e;let{DOT_LITERAL:l,SLASH_LITERAL:u,ONE_CHAR:d,DOTS_SLASH:f,NO_DOT:p,NO_DOTS:m,NO_DOTS_SLASH:h,STAR:g,START_ANCHOR:_}=n.globChars(a.windows),v=a.dot?m:p,y=a.dot?h:p,b=a.capture?``:`?:`,x={negated:!1,prefix:``},S=a.bash===!0?`.*?`:g;a.capture&&(S=`(${S})`);let C=e=>e.noglobstar===!0?S:`(${b}(?:(?!${_}${e.dot?f:l}).)*?)`,w=e=>{switch(e){case`*`:return`${v}${d}${S}`;case`.*`:return`${l}${d}${S}`;case`*.*`:return`${v}${S}${l}${d}${S}`;case`*/*`:return`${v}${S}${u}${d}${y}${S}`;case`**`:return v+C(a);case`**/*`:return`(?:${v}${C(a)}${u})?${y}${d}${S}`;case`**/*.*`:return`(?:${v}${C(a)}${u})?${y}${S}${l}${d}${S}`;case`**/.*`:return`(?:${v}${C(a)}${u})?${l}${d}${S}`;default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=w(t[1]);return n?n+l+t[2]:void 0}}},T=w(r.removePrefix(e,x));return T&&a.strictSlashes!==!0&&(T+=`${u}?`),T},t.exports=b})),qs=K(((e,t)=>{let n=Gs(),r=Ks(),i=Ws(),a=Us(),o=e=>e&&typeof e==`object`&&!Array.isArray(e),s=(e,t,n=!1)=>{if(Array.isArray(e)){let r=e.map(e=>s(e,t,n));return e=>{for(let t of r){let n=t(e);if(n)return n}return!1}}let r=o(e)&&e.tokens&&e.input;if(e===``||typeof e!=`string`&&!r)throw TypeError(`Expected pattern to be a non-empty string`);let i=t||{},a=i.windows,c=r?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=c.state;delete c.state;let u=()=>!1;if(i.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};u=s(i.ignore,e,n)}let d=(n,r=!1)=>{let{isMatch:o,match:d,output:f}=s.test(n,c,t,{glob:e,posix:a}),p={glob:e,state:l,regex:c,posix:a,input:n,output:f,match:d,isMatch:o};return typeof i.onResult==`function`&&i.onResult(p),o===!1?(p.isMatch=!1,r?p:!1):u(n)?(typeof i.onIgnore==`function`&&i.onIgnore(p),p.isMatch=!1,r?p:!1):(typeof i.onMatch==`function`&&i.onMatch(p),!r||p)};return n&&(d.state=l),d};s.test=(e,t,n,{glob:r,posix:a}={})=>{if(typeof e!=`string`)throw TypeError(`Expected input to be a string`);if(e===``)return{isMatch:!1,output:``};let o=n||{},c=o.format||(a?i.toPosixSlashes:null),l=e===r,u=l&&c?c(e):e;return l===!1&&(u=c?c(e):e,l=u===r),(l===!1||o.capture===!0)&&(l=o.matchBase===!0||o.basename===!0?s.matchBase(e,t,n,a):t.exec(u)),{isMatch:!!l,match:l,output:u}},s.matchBase=(e,t,n,r=n&&n.windows)=>(t instanceof RegExp?t:s.makeRe(t,n)).test(i.basename(e,{windows:r})),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map(e=>s.parse(e,t)):r(e,{...t,fastpaths:!1}),s.scan=(e,t)=>n(e,t),s.compileRe=(e,t,n=!1,r=!1)=>{if(n===!0)return e.output;let i=t||{},a=i.contains?``:`^`,o=i.contains?``:`$`,c=`${a}(?:${e.output})${o}`;e&&e.negated===!0&&(c=`^(?!${c}).*$`);let l=s.toRegex(c,t);return r===!0&&(l.state=e),l},s.makeRe=(e,t={},n=!1,i=!1)=>{if(!e||typeof e!=`string`)throw TypeError(`Expected a non-empty string`);let a={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]===`.`||e[0]===`*`)&&(a.output=r.fastpaths(e,t)),a.output||(a=r(e,t)),s.compileRe(a,t,n,i)},s.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?`i`:``))}catch(e){if(t&&t.debug===!0)throw e;return/$^/}},s.constants=a,t.exports=s})),Js=se(K(((e,t)=>{let n=qs(),r=Ws();function i(e,t,i=!1){return t&&(t.windows===null||t.windows===void 0)&&(t={...t,windows:r.isWindows()}),n(e,t,i)}Object.assign(i,n),t.exports=i}))(),1);function Ys(e){return e.replaceAll(`\\`,`/`)}const Xs=Array.isArray;function Zs(e){return Xs(e)?e:e==null?[]:[e]}const Qs=`[_#EsCaPe#_]`;function $s(e,t){return t===!1||Hs(e)||e.startsWith(`**`)?Ys(e):Rs(Ys(Bs(t||``)).replaceAll(/[-^$*+?.()|[\]{}]/g,`${Qs}$&`),Ys(e)).replaceAll(Qs,`\\`)}function ec(e,t,n){let r=n&&n.resolve,i=e=>e instanceof RegExp?e:{test:t=>(0,Js.default)($s(e,r),{dot:!0})(t)},a=Zs(e).map(i),o=Zs(t).map(i);return!a.length&&!o.length?e=>typeof e==`string`&&!e.includes(`\0`):function(e){if(typeof e!=`string`||e.includes(`\0`))return!1;let t=Ys(e);for(let e of o)if(e instanceof RegExp&&(e.lastIndex=0),e.test(t))return!1;for(let e of a)if(e instanceof RegExp&&(e.lastIndex=0),e.test(t))return!0;return!a.length}}const tc={root:void 0,colorPreview:!1,remToPxPreview:!0,remToPxRatio:16,syntaxHighlight:!0,strictAnnotationMatch:!1,unmatchedDiagnostics:!0,autocompleteMatchType:`prefix`,autocompleteStrict:!1,autocompleteMaxItems:1e3},nc=/^#(?:[0-9a-f]{3,8})$/i,rc=/^(?:rgb|rgba|hsl|hsla|hwb|oklch|oklab|lab|lch|device-cmyk|color)\(/i,ic=/^(?:media|supports|container)\b/;function ac(e={}){let t=new Set(Object.keys(e.colors??{})),n=new Set(Object.keys(e.breakpoint??e.breakpoints??{}));return{isColorValue(e){let n=e.trim();if(n.startsWith(`[`)&&n.endsWith(`]`)&&(n=n.slice(1,-1)),!n)return!1;if(n===`current`||n===`transparent`||nc.test(n)||rc.test(n))return!0;let r=n.split(`/`)[0].split(`-`)[0];return t.has(r)},isBreakpoint(e){if(ic.test(e))return!0;let t=e.replace(/^(?:max|min)-/,``).split(/[^a-z0-9]/i)[0];return n.has(t)}}}N([P,F,I,L,R,z]);const oc=/var\((?<cssVarName>--[^,|)]+)(?:,(?<fallback>[^)]+))?\)/g,sc=String.raw`(?:#|0x)(?:[a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})\b|(?:rgb|rgba|hsl|hsla|hwb|oklch|oklab|lab|lch|device-cmyk|color)\([^)]*\)`,cc=new RegExp(sc,`g`),lc=/var\((--[^,|)]+)(?:,([^)]+))?\)/,uc=String.raw`(?:^|[;{]\s*)(?:[\w-]+-color|color|fill|stroke)\s*:\s*(?<value>[^;}{]+)`,dc=new RegExp(uc,`gm`),fc=/(?:^|[;{])\s*--[^\s:;{}]+\s*:/m,pc=new RegExp(sc,`i`),mc=new RegExp(uc,`m`),hc=new RegExp(String.raw`color-mix\([^,]+,\s*(?<color>${sc})\s+(?<weight>\d+(?:\.\d+)?%)\s*,\s*transparent\s*\)`,`i`);function gc(e){return fc.test(e)||mc.test(e)||_c(e)}function _c(e){return pc.test(e)}function vc(e){let t=/(?:^|[;{])\s*(?<key>--[^\s:;{}]+)\s*:\s*(?<value>[^;{}]+)(?=;|})/gm,n=new Map;for(let r of e.matchAll(t)){let e=r.groups?.key;e&&n.set(e,(r.groups?.value??``).trim().replace(/\s*!important\s*$/,``))}return n}function yc(e,t){let n=e.trim(),r=new Set;for(;n.startsWith(`var(`);){let e=n.match(lc);if(!e)break;let i=e[1].trim(),a=e[2]?.trim();if(r.has(i))return a;r.add(i);let o=t.get(i)?.trim();if(o){n=o;continue}return a||`1`}return n}function bc(e,t){let n=e;for(let r of e.matchAll(oc)){let e=r[0],i=r.groups?.cssVarName?.trim(),a=r.groups?.fallback;if(!i)continue;let o=t.get(i);o?n=n.replaceAll(e,yc(o,t)??a??`1`):a&&(n=n.replaceAll(e,a))}return n.replaceAll(/,?\s+var\(--.*?\)/g,``)}function xc(e,t){let n=bc(e,t),r=n.match(hc);if(r?.groups?.color){let e=r.groups.color,t=r.groups.weight;if(e)return/\//.test(e)?e:e.replace(/\)$/,` / ${t})`)}let i=n.match(cc)?.[0];if(!i){let e=n.trim().replace(/\s*!important$/,``);return M(e).isValid()?e:void 0}return/\/\)/.test(i)&&(i=i.replace(/ \/\)/g,`/ 1)`)),i}function Sc(e){let t=vc(e);for(let n of e.matchAll(dc)){let e=n.groups?.value;if(!e)continue;let r=xc(e,t);if(r)return r}return xc(e,t)}function Cc(e){let t=M(e);if(!t.isValid())return;let n=t.toRgb();return{red:n.r/255,green:n.g/255,blue:n.b/255,alpha:n.alpha}}const wc=/(-?[\d.]+)rem(\s+!important)?;/;let Tc;function Ec(e){return e.default??e}function Dc(){return Tc??=Promise.all([import(`prettier/standalone`),import(`prettier/parser-postcss`)]).then(([e,t])=>({prettier:Ec(e),parserCSS:Ec(t)}))}function Oc(e,t=16){if(!e)return``;if(t<1)return e;let n=0,r=[];for(;n<e.length;){let i=e.slice(n).match(wc);if(i?.index==null)break;let a=` /* ${Number.parseFloat(i[1])*t}px */`,o=n+i.index+i[0].length;r.push(e.slice(n,o)),r.push(a),n=o}return r.push(e.slice(n)),r.join(``)}async function kc(e,t,n){let[r,{prettier:i,parserCSS:a}]=await Promise.all([e.generate(new Set(le(t)),{preflights:!1,safelist:!1}),Dc()]),o=Oc(r.css,n),s=await i.format(o,{parser:`css`,plugins:[a]});return{...r,prettified:s}}async function Ac(e,t,n){return`\`\`\`css\n${(await kc(e,t,n)).prettified.trimEnd()}\n\`\`\``}const jc=[`property`,`class`,`keyword`,`number`,`enumMember`,`string`,`operator`,`type`],Mc=[`important`,`pseudoClass`,`pseudoElement`,`query`,`selector`,`variable`,`combinator`,`bracket`,`group`,`condition`],Nc=/^-?(?:\d+\.?\d*|\.\d+)[a-z%]*$/i,Pc=/^[>+~_[&.#*: ]/,Fc=/^[>+~_.#]/;function Ic(e,t){return t?.isColorValue?.(e)?`enumMember`:e.startsWith(`[`)?`string`:Nc.test(e)?`number`:`keyword`}function Lc(e,t){return e.startsWith(`::`)?{type:`type`,modifier:`pseudoElement`,symbolLen:0}:Fc.test(e)?{type:`type`,modifier:`selector`,symbolLen:1}:Pc.test(e)?{type:`type`,modifier:`selector`,symbolLen:0}:t?.isBreakpoint?.(e)?{type:`keyword`,modifier:`query`,symbolLen:0}:{type:`keyword`,modifier:`pseudoClass`,symbolLen:0}}function Rc(e,t,n,r){e.push({start:n,length:1,type:`operator`,modifiers:[`condition`]});let i=n+1,a=t;if(a.startsWith(`!`)&&(e.push({start:i,length:1,type:`operator`,modifiers:[`important`]}),i+=1,a=a.slice(1)),a.length){let{type:t,modifier:n,symbolLen:o}=Lc(a,r);o&&(e.push({start:i,length:o,type:`operator`,modifiers:[`combinator`]}),i+=o,a=a.slice(o)),a.length&&e.push({start:i,length:a.length,type:t,modifiers:[n]})}return n+t.length+1}function zc(e,t,n){let r=-1,i=t=>{r>=0&&(e.push({start:n+r,length:t-r,type:`string`,modifiers:[]}),r=-1)};for(let a=0;a<t.length;a++){let o=t[a];o===`[`||o===`]`||o===`_`?(i(a),e.push({start:n+a,length:1,type:`operator`,modifiers:[`bracket`]})):r<0&&(r=a)}i(t.length)}function Bc(e,t,n,r,i){let a=+!!t.startsWith(`$`);a&&e.push({start:n,length:1,type:`operator`,modifiers:[`variable`]});let o=t.slice(a);if(!o.length)return;if(r===`value`&&o.startsWith(`[`)){zc(e,o,n+a);return}if(r===`value`&&a&&o.includes(`|`)){let t=o.indexOf(`|`),r=o.slice(0,t),s=o.slice(t+1);if(r.length&&e.push({start:n+a,length:r.length,type:Ic(r,i),modifiers:[]}),e.push({start:n+a+t,length:1,type:`operator`,modifiers:[`important`]}),s.length){let r=n+a+t+1;s.startsWith(`[`)?zc(e,s,r):e.push({start:r,length:s.length,type:Ic(s,i),modifiers:[]})}return}let s=r===`property`?`property`:Ic(o,i);e.push({start:n+a,length:o.length,type:s,modifiers:[]})}function Vc(e,t,n){if(!e)return[];if(e.startsWith(`{`)&&e.includes(`}`))return Uc(e,t,n);let r=pe(e),i=[];if(r.keyword)r.body.length&&(r.body.startsWith(`[`)?zc(i,r.body,t):i.push({start:t,length:r.body.length,type:`class`,modifiers:[]}));else{let e=r.property??``,a=r.value??``;e.length&&Bc(i,e,t,`property`,n),i.push({start:t+e.length,length:1,type:`operator`,modifiers:[]}),a.length&&Bc(i,a,t+e.length+1,`value`,n)}let a=t+r.body.length;r.important&&(i.push({start:a,length:1,type:`operator`,modifiers:[`important`]}),a+=1);for(let e of r.conditions)a=Rc(i,e,a,n);return i}function Hc(e,t,n){let r=0;for(let i=n;i<e.length;i++){let n=e[i];if(n===`\\`)i++;else if(n===`[`||n===`(`)r++;else if(n===`]`||n===`)`)r--;else if(n===t&&r<=0)return i}return-1}function Uc(e,t,n){let r=[],i=Hc(e,`}`,0);r.push({start:t,length:1,type:`operator`,modifiers:[`group`]});let a=t+1,o=e.slice(1,i),s=[],c=0;for(;;){let e=Hc(o,`;`,c);if(e===-1){s.push(o.slice(c));break}s.push(o.slice(c,e)),c=e+1}s.forEach((e,t)=>{if(t>0&&(r.push({start:a,length:1,type:`operator`,modifiers:[`group`]}),a+=1),e.length){for(let t of Vc(e,a,n))r.push(t);a+=e.length}}),r.push({start:t+i,length:1,type:`operator`,modifiers:[`group`]});let l=t+i+1,u=e.slice(i+1);if(u.startsWith(`!`)&&(r.push({start:l,length:1,type:`operator`,modifiers:[`important`]}),l+=1,u=u.slice(1)),u.startsWith(`@`))for(let e of u.slice(1).split(`@`))l=Rc(r,e,l,n);return r}const Wc=new Map,Gc=new WeakMap;function Kc(e,t){return e<t?-1:+(e>t)}function qc(e,t){return Kc(e??``,t??``)}function Jc(e,t){return e[0]-t[0]||(e[4]?.sort??0)-(t[4]?.sort??0)||qc(e[5]?.currentSelector,t[5]?.currentSelector)||qc(e[1],t[1])||Kc(e[2],t[2])}function Yc(e){let t=!1,n=0,r,i=``;for(let a=0;a<e.length;a++){let o=e[a];if(t){o===`*`&&e[a+1]===`/`&&(t=!1,a++);continue}if(r){o===`\\`?a++:o===r&&(r=void 0);continue}if(o===`/`&&e[a+1]===`*`){t=!0,a++;continue}if(o===`\\`){a++;continue}if(o===`"`||o===`'`){r=o;continue}if(!/\s/.test(o)||e[a+1]!==`$`||e[a+2]!==`$`||!/\s/.test(e[a+3]??``))continue;let s=a+4;for(;s<e.length&&/\s/.test(e[s]);)s++;i+=`${e.slice(n,a)} `,n=s,a=s-1}return n?i+e.slice(n):e}function Xc(e){let t=[],n=0,r=!1,i=0,a,o=0;for(let s=0;s<e.length;s++){let c=e[s];r?c===`*`&&e[s+1]===`/`&&(r=!1,s++):a?c===`\\`?s++:c===a&&(a=void 0):c===`/`&&e[s+1]===`*`?(r=!0,s++):c===`"`||c===`'`?a=c:c===`(`?i++:c===`)`?i>0&&i--:c===`[`?n++:c===`]`?n>0&&n--:n===0&&i===0&&e.startsWith(` $$ `,s)&&(t.push(e.slice(o,s)),s+=3,o=s+1)}return t.push(e.slice(o)),t}function Zc(e){let t=Wc.get(e);if(t!==void 0)return t;let n=gc(e);return Jr(Wc,e,n,2048),n}function Qc(e){let t=new Map,n=new Map,r=0;for(let i of e){let[a,o,s]=i;if(s){e[r++]=i;continue}let c=a.length?t:n,l=c.get(o);l?a.length&&l[0].push(...a):(c.set(o,i),e[r++]=i)}e.length=r}function $c(e,t,n){let r=e.sort(Jc).map(([,e,t,,n,,r])=>{let i=e&&!n?.noScope?Yc(e):e;return[i==null?[]:[[i,n?.sort??0]],t,!!(r??n?.noMerge)]});t&&Qc(r);let i=[];for(let e=r.length-1;e>=0;e--){let[t,n]=r[e],a=t.length===1?t[0][0]:``;t.length>1&&(t.sort((e,t)=>e[1]-t[1]||Kc(e[0],t[0])),a=[...new Set(t.map(([e])=>e).filter(Boolean))].join(`,
30
- `)),i.push(a?`${a}{${n}}`:n)}let a=[...new Set(i)].reverse();return(n?a:a.filter(Zc)).join(`
31
- `)}function el(e,t,n){let r=new Map,i=new Set([me]);for(let e of n){let t=e[4]?.layer||`utilities`;i.add(t);let n=e[3]||``,a=r.get(t);a||(a=new Map,r.set(t,a));let o=a.get(n);o?o.push(e):a.set(n,[e])}let a=t=>Object.hasOwn(e.layers,t)?e.layers[t]??0:0,o=e.sortLayers([...i].sort((e,t)=>a(e)-a(t)||Kc(e,t))),s=[];for(let n of o){let i=r.get(n);if(i)for(let n of[...i.keys()].sort((e,n)=>_r(t,e,n))){let t=$c(i.get(n),e.mergeSelectors,Zc(n));if(t)if(!n)s.push(t);else{let e=Xc(n);s.push(`${e.join(`{`)}{${t}${`}`.repeat(e.length)}`)}}}return s.join(`
32
- `)}async function tl(e,t){let n=e.config,r=await e.parseToken(t);if(e.config!==n)return tl(e,t);if(r?.length)return Sc(el(n,new Map(e.parentOrders),r))}async function nl(e,t){let n=Gc.get(e);return(!n||n.config!==e.config)&&(n={config:e.config,values:new Map},Gc.set(e,n)),Yr(n.values,t,1e3,()=>tl(e,t).then(e=>e?{colorString:e,color:Cc(e)}:{}))}const rl=[...Mc,`teacss`],il={tokenTypes:[...jc],tokenModifiers:rl},al=new Map(jc.map((e,t)=>[e,t])),ol=new Map(rl.map((e,t)=>[e,1<<t])),sl=ol.get(`teacss`)??0,cl=/^-?(?:\d+\.?\d*|\.\d+)[a-z%]*$/i,ll=new WeakMap,ul={log(){},warn(){}};function dl(e,t){let n=Go(e,t)?.toLowerCase();return n?.endsWith(`class`)||n?.endsWith(`classname`)}function fl(e){let t=[];if(!e.includes(`:`))for(let n=e.indexOf(`-`);n>0;n=e.indexOf(`-`,n+1))t.push(`${e.slice(0,n)}:${e.slice(n+1)}`);let n=e.indexOf(`:`);return n>0&&e.indexOf(`:`,n+1)>n&&t.push(`${e.slice(n+1)}@${e.slice(0,n)}`),t}function pl(e,t){let n=e[t-1];if(n===`"`||n===`'`){for(let r=t;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===n)return r;return e.length}let r=t;for(;r<e.length&&!/[\s>]/.test(e[r]);)r++;return r}async function ml(e,t,n){let r=Array(e.length),i=0,a=Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){let t=i++;r[t]=await n(e[t],t)}});return await Promise.all(a),r}function hl(e){return!e.startsWith(`[`)||!e.endsWith(`]`)||Cc(e.slice(1,-1).replace(/\\?_/g,e=>e===`_`?` `:`_`).trim())!==void 0}function gl(e){let t=ll.get(e);if(t?.config===e.config)return t.classifier;let n=ac(e.config?.theme??{});return ll.set(e,{config:e.config,classifier:n}),n}function _l(e){e.sort((e,t)=>e.line-t.line||e.char-t.char);let t=[],n=0,r=0;for(let i of e){let e=i.line-n,a=e===0?i.char-r:i.char;t.push(e,a,i.length,i.type,i.modifiers),n=i.line,r=i.char}return{data:t}}function vl(e,t,n,r,i=sl){let a=e.positionAt(t);return{line:a.line,char:a.character,length:n,type:al.get(r)??0,modifiers:i}}function yl(e,t,n,r,i=sl){let a=[],o=0;for(let s=0;s<n.length;s++)(n[s]===`\r`||n[s]===`
33
- `)&&(s>o&&a.push(vl(e,t+o,s-o,r,i)),n[s]===`\r`&&n[s+1]===`
34
- `&&s++,o=s+1);return o<n.length&&a.push(vl(e,t+o,n.length-o,r,i)),a}function bl(e,t){return t.isColorValue?.(e)?`enumMember`:cl.test(e)?`number`:`string`}function xl(e,t,n){return e.some(e=>e.open===t&&e.close===n-1)}function Sl(e,t,n){let r=[];for(let i of n){r.push(vl(e,i.open,1,`operator`,sl|(ol.get(`group`)??0)));for(let n of i.declarations){let{property:i,start:a,colon:o,value:s,valueStart:c}=n;r.push(vl(e,a,2,`operator`,sl|(ol.get(`variable`)??0))),r.push(vl(e,a+2,i.length-2,`property`)),r.push(vl(e,o,1,`operator`)),s&&r.push(...yl(e,c,s,bl(s,t)))}r.push(vl(e,i.close,1,`operator`,sl|(ol.get(`group`)??0)))}return r}var Cl=class{contextManager;getSettings;logger;autoCompletes=new Map;semanticTokensCache=new Map;featureFailures=new Map;constructor(e){this.getSettings=e.getSettings??(()=>tc),this.logger=e.logger??ul;let t=e.folderPaths?.length?e.folderPaths:[e.rootPath];this.contextManager=new js(e.rootPath,this.logger,t),this.contextManager.events.on(`contextReload`,e=>this.resetFeatureCaches(e)),this.contextManager.events.on(`contextUnload`,e=>this.resetFeatureCaches(e)),this.contextManager.events.on(`unload`,e=>this.resetFeatureCaches(e))}get events(){return this.contextManager.events}get ready(){return this.contextManager.ready}resetAutoCompleteCache(e){e?this.autoCompletes.delete(e):this.autoCompletes.clear()}resetFeatureCaches(e){this.resetAutoCompleteCache(e),this.semanticTokensCache.clear(),this.featureFailures.clear()}reportFeatureFailure(e,t,n){let r=`${e}\0${t}`,i=n instanceof Error?n.message:String(n);this.featureFailures.get(r)!==i&&(Jr(this.featureFailures,r,i,100),this.logger.warn(`⚠️ Failed to provide ${e} for ${t}: ${i}`))}clearFeatureFailure(e,t){this.featureFailures.delete(`${e}\0${t}`)}getAutocomplete(e,t){let n=this.autoCompletes.get(e);if(n?.matchType===t)return n.autocomplete;let r=xs(e.generator,{matchType:t,throwErrors:!1});return this.autoCompletes.set(e,{matchType:t,autocomplete:r}),r}async resolveTargetContext(e){let t=Ss(e.uri);if(!this.contextManager.isTarget(t))return null;let n=e.getText();if(!n)return null;let r=await this.contextManager.resolveClosestContext(n,t);return!r||!(r.filter(n,t)||n.includes(`@teacss-ide-include`)||this.contextManager.configSources.includes(t)||fn(t))?null:{ctx:r,id:t,code:n,doc:e.getText()===n?e:O.create(e.uri,e.languageId,e.version,n)}}async getSemanticTokens(e){let t={data:[]},n=`semantic tokens`;try{let r=this.getSettings();if(!r.syntaxHighlight)return this.clearFeatureFailure(n,e.uri),t;let i=await this.resolveTargetContext(e);if(!i)return this.clearFeatureFailure(n,e.uri),t;let{ctx:a,id:o,code:s,doc:c}=i,l=r.strictAnnotationMatch,u=this.semanticTokensCache.get(o);if(u&&u.code===s&&u.generator===a.generator&&u.strictAnnotationMatch===l)return Jr(this.semanticTokensCache,o,u,100),this.clearFeatureFailure(n,e.uri),u.result;let d=await $r(a.generator,s,o,l),f=gl(a.generator),p=[],m=new Map,h=fn(o)?v(s):[];for(let[e,t]of d){if(xl(h,e,t))continue;let n=s.slice(e,t),r=m.get(n);r||(r=Vc(n,0,f),m.set(n,r));for(let t of r){let n=e+t.start,r=c.positionAt(n),i=sl;for(let e of t.modifiers)i|=ol.get(e)??0;p.push({line:r.line,char:r.character,length:t.length,type:al.get(t.type)??0,modifiers:i})}}h.length&&p.push(...Sl(c,f,h));let g=_l(p);return Jr(this.semanticTokensCache,o,{code:s,generator:a.generator,strictAnnotationMatch:l,result:g},100),this.clearFeatureFailure(n,e.uri),g}catch(r){return this.reportFeatureFailure(n,e.uri,r),t}}async getDiagnostics(e){try{let t=await this.resolveTargetContext(e);if(!t)return this.clearFeatureFailure(`diagnostics`,e.uri),[];let{ctx:n,id:r,code:i,doc:a}=t,o;if(fn(r))o=m(i,_(n.generator.config?.theme??{})).map(e=>({range:{start:a.positionAt(e.start),end:a.positionAt(e.end)},message:e.message,severity:j.Warning,source:`teacss`,code:e.reason}));else if(this.getSettings().unmatchedDiagnostics){let e=await Kn.extract?.({code:i,id:r,generator:n.generator})??[],t=Gr(i,Array.from(new Set(e)).filter(e=>typeof e==`string`&&e.length>0),[],{excludeRanges:Tr(i,r)}).filter(([e,t])=>dl(i,Math.max(e+1,t-1))),s=await n.generator.generate(new Set(t.map(e=>e[2])),{preflights:!1,safelist:!1}),c=t.filter(e=>!s.matched.has(e[2])),l=new Map;for(let[,,e]of c){let t=nr(e),r=e.slice(t.length),i=ur(e,n.generator.config,{confirmedIntent:!0})?.map(e=>`${e}${r}`)??[];l.set(e,Array.from(new Set([...fl(e),...i])))}let u=Array.from(new Set(Array.from(l.values()).flat())),d=u.length?(await n.generator.generate(new Set(u),{preflights:!1,safelist:!1})).matched:new Set;o=c.map(([e,t,n])=>{let r=(l.get(n)??[]).filter(e=>d.has(e)).slice(0,3);return{range:{start:a.positionAt(e),end:a.positionAt(t)},message:r.length?`Unmatched TeaCSS token \`${n}\`. Did you mean ${r.map(e=>`\`${e}\``).join(`, `)}?`:`Unmatched TeaCSS token \`${n}\` generates no CSS.`,severity:j.Warning,source:`teacss`,code:`unmatched-token`,data:{token:n,suggestions:r}}})}else o=[];return this.clearFeatureFailure(`diagnostics`,e.uri),o}catch(t){return this.reportFeatureFailure(`diagnostics`,e.uri,t),[]}}async getCodeActions(e,t){let n=[];for(let r of t){if(r.source!==`teacss`||r.code!==`unmatched-token`)continue;let t=r.data;if(!Array.isArray(t?.suggestions))continue;let i=t.suggestions.filter(e=>typeof e==`string`);for(let t=0;t<i.length;t++){let a=i[t];n.push({title:`Replace with ${a}`,kind:k.QuickFix,diagnostics:[r],isPreferred:t===0,edit:{changes:{[e.uri]:[{range:r.range,newText:a}]}}})}}return n}async getProjectStatus(e){let t=await this.resolveTargetContext(e);if(!t)return null;let{ctx:n,id:r,code:i}=t,a=n.getConfigFileList(),o=a.find(e=>fn(e))??null,s=n.generator.config.presets.map(e=>e.name||`(anonymous)`),c=[...n.generator.config.content?.filesystem??[]],l=n.filter(i,r)||i.includes(`@teacss-ide-include`)||fn(r),u=(await $r(n.generator,i,r,this.getSettings().strictAnnotationMatch)).length,d=(await this.getDiagnostics(e)).filter(e=>e.code===`unmatched-token`).length,f=[];return o||f.push(`No TeaCSS CSS entry was resolved.`),s.length||f.push(`The active entry selects no preset.`),l||f.push(`The active file is outside the entry's @source coverage.`),{root:n.root,entry:o,configSources:a,presets:s,sources:c,rules:n.generator.config.rulesSize,shortcuts:n.generator.config.shortcuts.length,activeFile:r,activeFileCovered:l,matchedCount:u,unmatchedCount:d,issues:f}}async getClassNameEdits(e){let t=await this.resolveTargetContext(e);if(!t)return[];let{ctx:n,id:r,code:i,doc:a}=t,o=await Kn.extract?.({code:i,id:r,generator:n.generator})??[],s=Gr(i,Array.from(new Set(o)).filter(e=>typeof e==`string`&&e.length>0),[],{excludeRanges:Tr(i,r)}),c=new Map;for(let[e,t]of s){let n=Ko(i,Math.max(e+1,t-1)),r=n?.key.toLowerCase();!n||!(r?.endsWith(`class`)||r?.endsWith(`classname`))||c.set(n.valueStart,pl(i,n.valueStart))}let l=Array.from(c,([e,t])=>({end:t,start:e,tokens:i.slice(e,t).match(/\S+/g)??[]})).filter(e=>e.tokens.length>1),u=Array.from(new Set(l.flatMap(e=>e.tokens)));if(!u.length)return[];let d=await n.generator.generate(new Set(u),{extendedInfo:!0,preflights:!1,safelist:!1}),f=d.css,p=new Map;for(let[e,t]of d.matched){let n=t.data.map(e=>e[1]?f.indexOf(e[1]):-1).filter(e=>e>=0);p.set(e,n.length?Math.min(...n):t.data[0]?.[0]??2**53-1)}let m=[];for(let e of l){let t=e.tokens.filter(e=>d.matched.has(e));if(t.length<2)continue;t.sort((e,t)=>(p.get(e)??2**53-1)-(p.get(t)??2**53-1)||(e<t?-1:+(e>t)));let n=0,r=e.tokens.map(e=>d.matched.has(e)?t[n++]:e).join(` `);r!==i.slice(e.start,e.end)&&m.push({range:{start:a.positionAt(e.start),end:a.positionAt(e.end)},newText:r})}return m}async getHover(e,t){let n=`hover`;try{if(fn(Ss(e.uri)))return this.clearFeatureFailure(n,e.uri),null;let r=this.getSettings(),i=await this.resolveTargetContext(e);if(!i)return this.clearFeatureFailure(n,e.uri),null;let{ctx:a,id:o,code:s,doc:c}=i,l=c.offsetAt(t),u=(await $r(a.generator,s,o,r.strictAnnotationMatch)).find(([e,t])=>l>=e&&l<t);if(!u)return this.clearFeatureFailure(n,e.uri),null;let d=r.remToPxPreview?r.remToPxRatio:-1,f={contents:{kind:`markdown`,value:await Ac(a.generator,u[2],d)},range:{start:c.positionAt(u[0]),end:c.positionAt(u[1])}};return this.clearFeatureFailure(n,e.uri),f}catch(t){return this.reportFeatureFailure(n,e.uri,t),null}}async getDocumentColors(e){let t=`document colors`;try{let n=this.getSettings();if(!n.colorPreview)return this.clearFeatureFailure(t,e.uri),[];let r=await this.resolveTargetContext(e);if(!r)return this.clearFeatureFailure(t,e.uri),[];let{ctx:i,id:a,code:o,doc:s}=r,c=await $r(i.generator,o,a,n.strictAnnotationMatch),l=[],u=!1;for(let[n,r,a]of c)try{let{color:e}=await nl(i.generator,a);e&&l.push({range:{start:s.positionAt(n),end:s.positionAt(r)},color:{...e}})}catch(n){u=!0,this.reportFeatureFailure(t,e.uri,n)}return u||this.clearFeatureFailure(t,e.uri),l}catch(n){return this.reportFeatureFailure(t,e.uri,n),[]}}getColorPresentations(e,t,n){let r=Math.round(e.red*255),i=Math.round(e.green*255),a=Math.round(e.blue*255),o=Math.min(1,Math.max(0,e.alpha)),s=e=>e.toString(16).padStart(2,`0`),c=o<1?`#${s(r)}${s(i)}${s(a)}${s(Math.round(o*255))}`:`#${s(r)}${s(i)}${s(a)}`;if(t&&n){let e=wl(n),r=n.slice(0,e),i=n.slice(e),a=r.indexOf(`:`);if(a>0){let e=r.endsWith(`!`)?`!`:``;if(hl(r.slice(a+1,r.length-e.length))){let n=`${r.slice(0,a)}:[${c}]${e}${i}`;return[{label:n,textEdit:{range:t,newText:n}}]}}}return n&&t?[{label:n,textEdit:{range:t,newText:n}}]:[{label:c}]}async getMatchedPositions(e){let t=this.getSettings(),n=await this.resolveTargetContext(e);if(!n)return[];let{ctx:r,id:i,code:a}=n;return(await $r(r.generator,a,i,t.strictAnnotationMatch)).map(([e,t,n])=>({start:e,end:t,text:n}))}async getReferences(e,t){let n=this.getSettings(),r=Ss(e.uri),i=e.getText(),a=await this.contextManager.resolveClosestContext(i,r);if(!a?.filter(i,r))return null;let o=e.getText()===i?e:O.create(e.uri,e.languageId,e.version,i),s=await $r(a.generator,i,r,n.strictAnnotationMatch),c=o.offsetAt(t),l=s.find(e=>e[0]<=c&&c<e[1]);if(!l?.[2])return null;let u=l[2],d=new Set(a.generator.getCachedEquivalentTokens(u)),m=a.getConfigFileList().find(e=>fn(e)),h=a.generator.config.content?.filesystem,g=h??b,_=g.filter(e=>!e.startsWith(`!`)),v=g.filter(e=>e.startsWith(`!`)).map(e=>e.slice(1)),y=m?f(m):a.root,x=ec(void 0,h===void 0?[...D,...v]:v,{resolve:y}),C=h===void 0?new Set([`node_modules`,`dist`,`build`,`storybook-static`]):void 0,w=[];if(_.length)for await(let e of T(_,{cwd:y,exclude:e=>C?.has(e)??!1})){let t=p(y,e);x(t)&&w.push(t)}return w.includes(r)||w.unshift(r),(await ml(Array.from(new Set(w)),16,async e=>{let t;try{t=e===r?i:await E(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return[];throw e}let s=e===r?o:O.create(S(e).href,``,0,t);return(await $r(a.generator,t,e,n.strictAnnotationMatch)).filter(e=>d.has(e[2])).map(e=>({uri:s.uri,range:{start:s.positionAt(e[0]),end:s.positionAt(e[1])}}))})).flat()}async getCompletions(e,t){let n=`completions`;try{let r=this.getSettings(),i=Ss(e.uri);if(!this.contextManager.isTarget(i))return this.clearFeatureFailure(n,e.uri),null;let a=e.getText();if(!a)return this.clearFeatureFailure(n,e.uri),null;let o=await this.contextManager.resolveClosestContext(a,i);if(!o)return this.clearFeatureFailure(n,e.uri),null;let s=e.getText()===a?e:O.create(e.uri,e.languageId,e.version,a),c=s.offsetAt(t);if(r.autocompleteStrict&&!Es(a,i,c))return this.clearFeatureFailure(n,e.uri),null;let l=await this.getSuggestionResult({ctx:o,code:a,id:i,offset:c,matchType:r.autocompleteMatchType});if(!l?.suggestions.length)return this.clearFeatureFailure(n,e.uri),null;let u=l.suggestions.slice(0,r.autocompleteMaxItems),d=r.colorPreview?await ml(u,32,async([e])=>{try{return(await nl(o.generator,e)).colorString}catch{return}}):[],f=[];for(let t=0;t<u.length;t++){let[n,r]=u[t],i=d[t],a=l.resolveReplacement(n),o={label:r,kind:i?A.Color:A.EnumMember,sortText:i?/-\d$/.test(r)?`1`:`2`:void 0,data:{value:n,uri:e.uri},textEdit:{range:{start:s.positionAt(a.start),end:s.positionAt(a.end)},newText:a.replacement}};i&&(o.documentation=i),f.push(o)}return this.clearFeatureFailure(n,e.uri),{isIncomplete:!0,items:f}}catch(t){return this.reportFeatureFailure(n,e.uri,t),null}}async resolveCompletion(e,t){if(!e.data?.uri||!e.data?.value||!t)return e;let n=this.getSettings(),r=Ss(e.data.uri),i=t.getText(),a=await this.contextManager.resolveClosestContext(i,r);if(!a)return e;let o=n.remToPxPreview?n.remToPxRatio:-1;return e.kind===A.Color?e.detail=await(await kc(a.generator,e.data.value,o)).prettified:e.documentation={kind:`markdown`,value:await Ac(a.generator,e.data.value,o)},e}async getSuggestionResult({ctx:e,code:t,id:n,offset:r,matchType:i}){let a=Ds(t,n);if(!e.filter(t,n)&&!fn(n)&&!a)return null;let o=this.getAutocomplete(e,i),s;if(a){let e=t.substring(0,r).match(/\.[-\w]*$/);if(e){let t=e[0].substring(1),n=await o.suggest(t||``);n.length&&(s={suggestions:n.map(e=>[e,e]),resolveReplacement:e=>({start:r-(t?.length||0),end:r,replacement:e})})}else s=await o.suggestInFile(t,r)}else s=await o.suggestInFile(t,r);return s}};function wl(e){let t=0,n;for(let r=0;r<e.length;r++){let i=e[r];if(n){i===`\\`?r++:i===n&&(n=void 0);continue}if(i===`"`||i===`'`)n=i;else if(i===`\\`)r++;else if(i===`[`||i===`(`)t++;else if(i===`]`||i===`)`)t--;else if(i===`@`&&t===0)return r}return e.length}function Tl(e,t){let n=Dl(t.workspaceFolderPaths||[]),r=n.length?n:Dl([t.workspaceRootPath]),i=le(e).filter(e=>typeof e==`string`&&e.length>0);if(!i.length)return r;let a=Dl([t.workspaceFileDir,...n,t.workspaceRootPath]);return Dl(i.flatMap(e=>El(e,a)))}function El(e,t){if(!e)return[];if(Ol(e))return[d.normalize(e)];let n=d.normalize(e),r=t.filter(e=>{let t=d.normalize(e);return t===n||t.endsWith(`${d.sep}${n}`)});if(r.length)return r;let i=t.map(t=>d.resolve(t,e)),a=i.filter(e=>u(e));return a.length?a:i.slice(0,1)}function Dl(e){return Array.from(new Set(e.filter(Boolean).map(e=>d.normalize(e))))}function Ol(e){return d.isAbsolute(e)||d.win32.isAbsolute(e)}function kl(e,t,n,i=r){e.onCodeAction(async e=>{await i();let r=n(),a=t.get(e.textDocument.uri);return!r||!a?[]:r.getCodeActions(a,e.context.diagnostics)})}const Al=/[\\/](?:node_modules|dist|\.temp|\.cache|\.git)[\\/]/,jl=new Set([`node_modules`,`dist`,`.temp`,`.cache`,`.git`]),Ml=`**/{${Array.from(new Set(h.map(e=>d.posix.basename(e)))).join(`,`)}}`;function Nl(e,t){let n=d.relative(e,t);return n===``||!n.startsWith(`..${d.sep}`)&&n!==`..`&&!d.isAbsolute(n)}function Pl(e){return[...e].map(e=>e===`*`?`[*]`:e===`?`?`[?]`:e===`[`?`[[]`:e===`]`?`[]]`:e===`{`?`[{]`:e===`}`?`[}]`:e).join(``)}function Fl(e){try{let t=JSON.parse(l.readFileSync(d.join(e,`package.json`),`utf8`))?.teacss?.entry;return typeof t==`string`&&t?d.resolve(e,t):void 0}catch{return}}function Il(e){let t=[],n=[e];for(let e of n){let r;try{r=l.readdirSync(e,{withFileTypes:!0})}catch{continue}if(r.some(e=>e.isFile()&&e.name===`package.json`)){let n=Fl(e);n&&t.push({directory:e,entry:n})}for(let t of r)t.isDirectory()&&!jl.has(t.name)&&n.push(d.join(e,t.name))}return t.sort((e,t)=>e.directory<t.directory?-1:+(e.directory>t.directory))}function Ll(e,t){return t.map(e=>d.normalize(e)).filter(t=>Nl(t,e)).sort((e,t)=>t.length-e.length)[0]}function Rl(e,t){let n=d.dirname(e);for(;Nl(t,n);){if(d.normalize(g(n)??``)===e)return!0;if(n===t)break;n=d.dirname(n)}return!1}function zl(e){let t=e.map(({globPattern:e,kind:t})=>typeof e==`string`?`${t??``}\0${e}`:`${t??``}\0${e.baseUri}\0${e.pattern}`);return JSON.stringify(t.sort())}function Bl(e,t,n){let r=new Map,i=(e,t,i=!0)=>{let a=i?Pl(t):t,o={baseUri:S(e).href,pattern:a};r.set(`${o.baseUri}\0${a}`,{globPattern:o,kind:n})};for(let t of e)i(d.dirname(t),d.basename(t));for(let e of t){i(e,Ml,!1);for(let{directory:t,entry:n}of Il(e)){let e=d.relative(t,n);Nl(t,n)?i(t,e.split(d.sep).join(`/`)):i(d.dirname(n),d.basename(n))}}return Array.from(r.values())}function Vl(e,t,n){let r=new Set(t.map(e=>d.normalize(e))),i=new Set(n.map(Fl).filter(e=>!!e).map(e=>d.normalize(e))),a=new Set;for(let t of e){let e;try{e=d.normalize(x(t.uri))}catch{return!0}if(r.has(e)||i.has(e))return!0;if(Al.test(e))continue;let o=Ll(e,n);if(!o){a.add(e);continue}if(d.basename(e)===`package.json`)return!0;if(d.extname(e).toLowerCase()!==`.css`){a.add(e);continue}try{if(Rl(e,o))return!0}catch{return!0}}if(a.size){for(let e of n)for(let{entry:t}of Il(e))if(a.has(d.normalize(t)))return!0}return!1}function Hl(e){let t,n,r,i,a=0,o=Promise.resolve();return{update(s){let c=zl(s);if(i&&r===c)return i;if(!i&&n===c)return Promise.resolve();let l=++a,u=o.then(async()=>{if(l!==a||n===c)return;let r=await e(s);if(l!==a){r.dispose();return}t?.dispose(),t=r,n=c});o=u.catch(()=>{}),r=c,i=u;let d=()=>{i===u&&(i=void 0,r=void 0)};return u.then(d,d),u}}}function Ul(e){return e instanceof Error?e.message:String(e)}function Wl(e){let t=new Map,n=new Map,r=0;return{async publish(i){let a=++r;t.set(i.uri,a);try{let r=await e.getDiagnostics(i);if(t.get(i.uri)!==a)return;await e.sendDiagnostics(i.uri,r),t.get(i.uri)===a&&n.delete(i.uri)}catch(r){if(t.get(i.uri)!==a)return;let o=Ul(r);if(n.get(i.uri)===o)return;n.set(i.uri,o),e.reportError(i.uri,r)}},invalidate(e){t.delete(e),n.delete(e)}}}function Gl(e,t){e.on(`uncaughtExceptionMonitor`,(e,n)=>{t(`[teacss] ${n===`unhandledRejection`?`Unhandled rejection`:`Uncaught exception`}: ${e.message}`)})}function Kl(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function ql(e,t){return typeof e==`boolean`?e:t}function Jl(e,t){if(e!==null)return typeof e==`string`?e:Array.isArray(e)?e.filter(e=>typeof e==`string`):t}function Yl(e,t){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:t}function Xl(e,t){return typeof e!=`number`||!Number.isFinite(e)?t:Math.min(1e4,Math.max(0,Math.floor(e)))}function Zl(e){let t=Kl(e),n={};return Object.hasOwn(t,`root`)&&(n.root=t.root),(t.semanticTokens===`native`||t.semanticTokens===`overlay`)&&(n.semanticTokens=t.semanticTokens),typeof t.workspaceFileDir==`string`&&(n.workspaceFileDir=t.workspaceFileDir),Array.isArray(t.workspaceFolderPaths)&&(n.workspaceFolderPaths=t.workspaceFolderPaths.filter(e=>typeof e==`string`)),n}function Ql(e,t){let n=Kl(t),r=Kl(n.autocomplete),i=r.matchType;return{root:Jl(n.root,e.root),colorPreview:ql(n.colorPreview,e.colorPreview),remToPxPreview:ql(n.remToPxPreview,e.remToPxPreview),remToPxRatio:Yl(n.remToPxRatio,e.remToPxRatio),syntaxHighlight:ql(n.syntaxHighlight,e.syntaxHighlight),strictAnnotationMatch:ql(n.strictAnnotationMatch,e.strictAnnotationMatch),unmatchedDiagnostics:ql(n.unmatchedDiagnostics,e.unmatchedDiagnostics),autocompleteMatchType:i===`prefix`||i===`fuzzy`?i:e.autocompleteMatchType,autocompleteStrict:ql(r.strict,e.autocompleteStrict),autocompleteMaxItems:Xl(r.maxItems,e.autocompleteMaxItems)}}function $l(e){return Ql(tc,e)}function eu(e,t){return e.syntaxHighlight!==t.syntaxHighlight||e.strictAnnotationMatch!==t.strictAnnotationMatch}function tu(e,t){let n=new Set(e),r=new Set(t);return n.size!==r.size||[...n].some(e=>!r.has(e))}async function nu(e,t,n){if(e)try{return await t()}catch(e){n(e);return}}const Q=te(B.all),ru=new H(O);let iu=$l(),$,au=!1,ou=!1,su=!1,cu=!1,lu=!1,uu=!1,du=0,fu;const pu=new Promise(e=>{fu=e}),mu=U.Create|U.Change|U.Delete,hu=[{globPattern:`**/*.css`,kind:mu}],gu={folderPaths:[]};function _u(e){iu=Ql(iu,e)}function vu(e){return Tl(e,{workspaceRootPath:gu.rootPath,workspaceFileDir:gu.fileDir,workspaceFolderPaths:gu.folderPaths})}function yu(e){return typeof e==`string`?e.length>0:Array.isArray(e)&&e.some(Boolean)}async function bu(){$&&await xu(()=>$.contextManager.setRoots(vu(iu.root)))}async function xu(e){du++;try{return await e()}finally{du--}}function Su(e,t,n){gu.rootPath=e?Ss(e):void 0,gu.fileDir=n?.workspaceFileDir,gu.folderPaths=n?.workspaceFolderPaths||t?.map(e=>Ss(e.uri))||[]}function Cu(e=gu.rootPath){if(!e)return;let t=new Cl({rootPath:e,folderPaths:vu(iu.root),logger:{log:e=>Q.console.log(e),warn:e=>Q.console.warn(e)},getSettings:Nu});$=t;let n=()=>{du||(ku().catch(e=>Au(`Failed to update config watchers`,e)),ju(),Wu())};return t.events.on(`reload`,()=>{du||ku().catch(e=>Au(`Failed to update config watchers`,e))}),t.events.on(`contextLoaded`,n),t.events.on(`contextReload`,n),t.events.on(`contextUnload`,n),t.events.on(`unload`,n),t}async function wu(e){$||!e[0]||await Cu(e[0])?.ready}function Tu(){return $?.contextManager.configSources??[]}function Eu(){return Array.from(new Set([...vu(iu.root),...$?.contextManager.contextsMap.keys()??[]]))}function Du(){let e=Tu(),t=Bl(e,Eu(),mu);return e.length?t:[...hu,...t]}const Ou=Hl(async e=>Q.client.register(ee.type,{watchers:[...e]}));async function ku(){!au||!uu||!$||await Ou.update(Du())}function Au(e,t){Q.console.error(`[teacss] ${e}: ${t instanceof Error?t.message:String(t)}`)}async function ju(){uu&&(lu?await Q.sendNotification(`teacss/semanticTokens/refresh`).catch(e=>Au(`Failed to refresh semantic token decorations`,e)):cu&&await Q.languages.semanticTokens.refresh().catch(e=>Au(`Failed to refresh semantic tokens`,e)))}const Mu=Wl({async getDiagnostics(e){return await Fu(),await $?.getDiagnostics(e)??[]},sendDiagnostics(e,t){return Q.sendDiagnostics({uri:e,diagnostics:[...t]})},reportError(e,t){Au(`Failed to publish diagnostics for ${e}`,t)}});Gl(s,e=>Q.console.error(e));function Nu(){return iu}function Pu(){return $}function Fu(){return pu}Q.onInitialize(r=>{au=!!r.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration,ou=!!r.capabilities.workspace?.configuration,su=!!r.capabilities.workspace?.workspaceFolders,cu=!!r.capabilities.workspace?.semanticTokens?.refreshSupport;let o=Zl(r.initializationOptions);lu=o?.semanticTokens===`overlay`,`root`in o&&_u({root:o.root});let s=r.workspaceFolders,c=s?.[0]?.uri||r.rootUri;Su(c,s,o);let l=c?void 0:vu(iu.root)[0];return c?Cu():l&&Cu(l),kl(Q,ru,Pu,Fu),t(Q,ru,Pu,Fu),i(Q,ru,Pu,Fu),e(Q,ru,Pu,Fu),n(Q,ru,Pu,Fu),a(Q,ru,Pu,Fu),{capabilities:{textDocumentSync:V.Incremental,completionProvider:{resolveProvider:!0,triggerCharacters:[`-`,`:`,` `,`"`,`'`]},hoverProvider:!0,codeActionProvider:!0,referencesProvider:!0,colorProvider:!0,...lu?{}:{semanticTokensProvider:{legend:il,full:!0}},...su?{workspace:{workspaceFolders:{supported:!0,changeNotifications:!0}}}:{}}}}),Q.onInitialized(async()=>{su&&Q.workspace.onDidChangeWorkspaceFolders(e=>{Gu(e).catch(e=>Au(`Failed to update workspace folders`,e))});try{let e=await nu(ou,()=>Q.workspace.getConfiguration(`teacss`),e=>Au(`Failed to read workspace configuration`,e));e!==void 0&&_u(e),await wu(vu(iu.root)),$&&(await $.ready,await bu())}catch(e){Au(`Failed to complete initial setup`,e)}finally{uu=!0,fu?.(),fu=void 0}Q.console.log(`✅ TeaCSS Language Server initialized`),await ku().catch(e=>Au(`Failed to update config watchers`,e)),await ju()});let Iu;Q.onDidChangeWatchedFiles(e=>{Vl(e.changes,Tu(),Eu())&&(clearTimeout(Iu),Iu=setTimeout(()=>{Lu().catch(e=>Au(`Failed to reload config sources`,e))},500))});async function Lu(){await Fu(),$&&(Q.console.log(`🔄 Config source changed, reloading TeaCSS...`),Qr(),await xu(()=>$.contextManager.reload()),Q.console.log(`🔵 Reloaded.`),await ku().catch(e=>Au(`Failed to update config watchers`,e)),await ju(),await Wu())}Q.onDidChangeConfiguration(async e=>{await Fu();let t=e.settings?.teacss;if(t!==void 0){let e=iu,n=vu(e.root);_u(t);let r=vu(iu.root),i=tu(n,r);i&&(await wu(r),$&&await xu(()=>$.contextManager.setRoots(r)),await ku().catch(e=>Au(`Failed to update config watchers`,e)),await Wu()),!i&&e.unmatchedDiagnostics!==iu.unmatchedDiagnostics&&await Wu(),(i||eu(e,iu))&&await ju()}});async function Ru(){return await Fu(),$?(Qr(),await xu(()=>$.contextManager.reload()),await ku().catch(e=>Au(`Failed to update config watchers`,e)),await ju(),await Wu(),{success:!0}):{success:!1}}async function zu(e){if(await Fu(),!$)return{count:0};let t=ru.get(e.uri);if(!t)return{count:0};let n=Ss(e.uri),r=t.getText(),i=await $.contextManager.resolveClosestContext(r,n);return i?{count:(await i.generator.generate(r,{id:n,preflights:!1,safelist:!1,minify:!0})).matched.size}:{count:0}}async function Bu(e){if(await Fu(),!$)return{positions:[]};let t=ru.get(e.uri);return t?{positions:(await $.getMatchedPositions(t)).map(e=>({start:t.positionAt(e.start),end:t.positionAt(e.end),className:e.text}))}:{positions:[]}}async function Vu(e){if(await Fu(),!$)return null;let t=e.uri?ru.get(e.uri):ru.all()[0];return t?$.getProjectStatus(t):null}async function Hu(e){if(await Fu(),!$)return[];let t=ru.get(e.uri);return t?$.getClassNameEdits(t):[]}Q.onRequest(`teacss/reloadConfig`,Ru),Q.onRequest(`teacss/getMatchedCount`,zu),Q.onRequest(`teacss/getMatchedPositions`,Bu),Q.onRequest(`teacss/projectStatus`,Vu),Q.onRequest(`teacss/normalizeClasses`,Hu);async function Uu(e){$&&await Mu.publish(e)}async function Wu(){await Promise.all(ru.all().map(e=>Uu(e)))}async function Gu(e){await Fu();let t=new Set(e.removed.map(e=>Ss(e.uri))),n=gu.folderPaths.filter(e=>!t.has(e));for(let t of e.added){let e=Ss(t.uri);n.includes(e)||n.push(e)}if(gu.folderPaths=n,gu.rootPath=n[0],!$&&gu.rootPath&&(Cu(),await Pu()?.ready),!$)return;Qr();let r=yu(iu.root)?vu(iu.root):gu.folderPaths;await xu(()=>$.contextManager.setRoots(r)),await ku().catch(e=>Au(`Failed to update config watchers`,e)),await ju(),await Wu()}ru.onDidChangeContent(e=>{Zr(Ss(e.document.uri)),Uu(e.document)}),ru.onDidClose(e=>{let t=Ss(e.document.uri);Zr(t),$?.contextManager.releaseDocument(t),Mu.invalidate(e.document.uri),Q.sendDiagnostics({uri:e.document.uri,diagnostics:[]})}),ru.listen(Q),Q.listen();export{};
26
+ const ti={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t`,383:`s`,384:`b`,385:`B`,387:`b`,390:`O`,392:`c`,393:`D`,394:`D`,396:`d`,398:`E`,400:`E`,402:`f`,403:`G`,407:`I`,409:`k`,410:`l`,412:`M`,413:`N`,414:`n`,415:`O`,421:`p`,427:`t`,429:`t`,430:`T`,434:`V`,436:`y`,438:`z`,477:`e`,485:`g`,544:`N`,545:`d`,549:`z`,564:`l`,565:`n`,566:`t`,567:`j`,570:`A`,571:`C`,572:`c`,573:`L`,574:`T`,575:`s`,576:`z`,579:`B`,580:`U`,581:`V`,582:`E`,583:`e`,584:`J`,585:`j`,586:`Q`,587:`q`,588:`R`,589:`r`,590:`Y`,591:`y`,592:`a`,593:`a`,595:`b`,596:`o`,597:`c`,598:`d`,599:`d`,600:`e`,603:`e`,604:`e`,605:`e`,606:`e`,607:`j`,608:`g`,609:`g`,610:`G`,613:`h`,614:`h`,616:`i`,618:`I`,619:`l`,620:`l`,621:`l`,623:`m`,624:`m`,625:`m`,626:`n`,627:`n`,628:`N`,629:`o`,633:`r`,634:`r`,635:`r`,636:`r`,637:`r`,638:`r`,639:`r`,640:`R`,641:`R`,642:`s`,647:`t`,648:`t`,649:`u`,651:`v`,652:`v`,653:`w`,654:`y`,655:`Y`,656:`z`,657:`z`,663:`c`,665:`B`,666:`e`,667:`G`,668:`H`,669:`j`,670:`k`,671:`L`,672:`q`,686:`h`,867:`a`,868:`e`,869:`i`,870:`o`,871:`u`,872:`c`,873:`d`,874:`h`,875:`m`,876:`r`,877:`t`,878:`v`,879:`x`,7424:`A`,7427:`B`,7428:`C`,7429:`D`,7431:`E`,7432:`e`,7433:`i`,7434:`J`,7435:`K`,7436:`L`,7437:`M`,7438:`N`,7439:`O`,7440:`O`,7441:`o`,7442:`o`,7443:`o`,7446:`o`,7447:`o`,7448:`P`,7449:`R`,7450:`R`,7451:`T`,7452:`U`,7453:`u`,7454:`u`,7455:`m`,7456:`V`,7457:`W`,7458:`Z`,7522:`i`,7523:`r`,7524:`u`,7525:`v`,7834:`a`,7835:`s`,8305:`i`,8341:`h`,8342:`k`,8343:`l`,8344:`m`,8345:`n`,8346:`p`,8347:`s`,8348:`t`,8580:`c`};for(let e=`̀`.codePointAt(0);e<=`ͯ`.codePointAt(0);++e){let t=String.fromCodePoint(e);for(let e of`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`){let n=(e+t).normalize().codePointAt(0);n>126&&(ti[n]=e)}}const ni={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(let e of Object.keys(ni)){let t=e.toUpperCase();for(let n=ni[e][0];n<=ni[e][1];++n)ti[n]=n%2==0?t:e}function ri(e){if(e<192||e>8580)return e;let t=ti[e];return t===void 0?e:t.codePointAt(0)}function ii(e){return e}function ai(e){return e}function oi(e,t){return e>t?e:t}const si=e=>e.split(``).map(e=>e.codePointAt(0)),ci=new Set(` \f
27
+ \r \v\xA0 \u2028\u2029   `.split(``).map(e=>e.codePointAt(0)));for(let e=` `.codePointAt(0);e<=` `.codePointAt(0);e++)ci.add(e);const li=``.codePointAt(0),ui=`A`.codePointAt(0),di=`Z`.codePointAt(0),fi=`a`.codePointAt(0),pi=`z`.codePointAt(0),mi=`0`.codePointAt(0),hi=`9`.codePointAt(0);function gi(e,t,n){return n?e:t-e-1}function _i(e){return e?new Set:null}function vi(e,t,n){if(t!==null&&t.i16.length>e+n){let r=t.i16.subarray(e,e+n);return[e+n,r]}return[e,new Int16Array(n)]}function yi(e,t,n){if(t!==null&&t.i32.length>e+n){let r=t.i32.subarray(e,e+n);return[e+n,r]}return[e,new Int32Array(n)]}function bi(e){return e>=fi&&e<=pi?1:e>=ui&&e<=di?2:e>=mi&&e<=hi?4:0}function xi(e){let t=String.fromCodePoint(e);return t===t.toUpperCase()?t===t.toLowerCase()?t.match(/\p{Number}/gu)===null?t.match(/\p{Letter}/gu)===null?0:3:4:2:1}function Si(e){return e<=li?bi(e):xi(e)}function Ci(e,t){return e===0&&t!==0?8:e===1&&t===2||e!==4&&t===4?7:t===0?8:0}function wi(e,t){return t===0?8:Ci(Si(e[t-1]),Si(e[t]))}function Ti(e,t,n,r){let i=e.slice(r),a=i.indexOf(n);if(a===0)return r;if(!t&&n>=fi&&n<=pi){a>0&&(i=i.slice(0,a));let e=i.indexOf(n-32);e>=0&&(a=e)}return a<0?-1:r+a}function Ei(e){for(let t of e)if(t>=128)return!1;return!0}function Di(e,t,n){if(!Ei(e))return 0;if(!Ei(t))return-1;let r=0,i=0;for(let a=0;a<t.length;a++){if(i=Ti(e,n,t[a],i),i<0)return-1;a===0&&i>0&&(r=i-1),i++}return r}const Oi=(e,t,n,r,i,a,o)=>{let s=i.length;if(s===0)return[{start:0,end:0,score:0},_i(a)];let c=r.length;if(o!==null&&c*s>o.i16.length)return Ai(e,t,n,r,i,a);let l=Di(r,i,e);if(l<0)return[{start:-1,end:-1,score:0},null];let u=0,d=0,f=null,p=null,m=null,h=null;[u,f]=vi(u,o,c),[u,p]=vi(u,o,c),[u,m]=vi(u,o,c),[d,h]=yi(d,o,s);let[,g]=yi(d,o,c);for(let e=0;e<g.length;e++)g[e]=r[e];let _=ii(0),v=0,y=0,b=0,x=i[0],S=i[0],C=ii(0),w=0,T=!1,E=g.subarray(l),D=f.subarray(l).subarray(0,E.length),O=p.subarray(l).subarray(0,E.length),k=m.subarray(l).subarray(0,E.length);for(let[r,a]of E.entries()){let o=null;a<=li?(o=bi(a),!e&&o===2&&(a+=32)):(o=xi(a),!e&&o===2&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0)),t&&(a=ri(a))),E[r]=a;let c=Ci(w,o);if(k[r]=c,w=o,a===S&&(y<s&&(h[y]=ai(l+r),y++,S=i[Math.min(y,s-1)]),b=l+r),a===x){let e=16+c*2;if(D[r]=e,O[r]=1,s===1&&(n&&e>_||!n&&e>=_)&&(_=e,v=l+r,n&&c===8))break;T=!1}else T?D[r]=oi(C+-1,0):D[r]=oi(C+-3,0),O[r]=0,T=!0;C=D[r]}if(y!==s)return[{start:-1,end:-1,score:0},null];if(s===1){let e={start:v,end:v+1,score:_};if(!a)return[e,null];let t=new Set;return t.add(v),[e,t]}let A=h[0],j=b-A+1,M=null;[u,M]=vi(u,o,j*s);{let e=f.subarray(A,b+1);for(let[t,n]of e.entries())M[t]=n}let[,N]=vi(u,o,j*s);{let e=p.subarray(A,b+1);for(let[t,n]of e.entries())N[t]=n}let P=h.subarray(1),F=i.slice(1).slice(0,P.length);for(let[e,t]of P.entries()){let r=!1,i=F[e],a=e+1,o=a*j,c=g.subarray(t,b+1),l=m.subarray(t).subarray(0,c.length),u=N.subarray(o+t-A).subarray(0,c.length),d=N.subarray(o+t-A-1-j).subarray(0,c.length),f=M.subarray(o+t-A).subarray(0,c.length),p=M.subarray(o+t-A-1-j).subarray(0,c.length),h=M.subarray(o+t-A-1).subarray(0,c.length);h[0]=0;for(let[e,o]of c.entries()){let c=e+t,g=0,y=0,b=0;if(y=r?h[e]+-1:h[e]+-3,i===o){g=p[e]+16;let t=l[e];b=d[e]+1,t===8?b=1:b>1&&(t=oi(t,oi(4,m[c-b+1]))),g+t<y?(g+=l[e],b=0):g+=t}u[e]=b,r=g<y;let x=oi(oi(g,y),0);a===s-1&&(n&&x>_||!n&&x>=_)&&(_=x,v=c),f[e]=x}}let I=_i(a),L=A;if(a&&I!==null){let e=s-1;L=v;let t=!0;for(;;){let n=e*j,r=L-A,i=M[n+r],a=0,o=0;if(e>0&&L>=h[e]&&(a=M[n-j+r-1]),L>h[e]&&(o=M[n+r-1]),i>a&&(i>o||i===o&&t)){if(I.add(L),e===0)break;e--}t=N[n+r]>1||n+j+r+1<N.length&&N[n+j+r+1]>0,L--}}return[{start:L,end:v+1,score:_},I]};function ki(e,t,n,r,i,a,o){let s=0,c=0,l=!1,u=0,d=ii(0),f=_i(o),p=0;i>0&&(p=Si(n[i-1]));for(let m=i;m<a;m++){let i=n[m],a=Si(i);if(e||(i>=ui&&i<=di?i+=32:i>li&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),t&&(i=ri(i)),i===r[s]){o&&f!==null&&f.add(m),c+=16;let e=Ci(p,a);u===0?d=e:(e===8&&(d=e),e=oi(oi(e,d),4)),s===0?c+=e*2:c+=e,l=!1,u++,s++}else l?c+=-1:c+=-3,l=!0,u=0,d=0;p=a}return[c,f]}const Ai=(e,t,n,r,i,a,o)=>{if(i.length===0)return[{start:0,end:0,score:0},null];if(Di(r,i,e)<0)return[{start:-1,end:-1,score:0},null];let s=0,c=-1,l=-1,u=r.length,d=i.length;for(let a=0;a<u;a++){let o=r[gi(a,u,n)];e||(o>=ui&&o<=di?o+=32:o>li&&(o=String.fromCodePoint(o).toLowerCase().codePointAt(0))),t&&(o=ri(o));let f=i[gi(s,d,n)];if(o===f&&(c<0&&(c=a),s++,s===d)){l=a+1;break}}if(c>=0&&l>=0){s--;for(let t=l-1;t>=c;t--){let a=r[gi(t,u,n)];e||(a>=ui&&a<=di?a+=32:a>li&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0)));let o=i[gi(s,d,n)];if(a===o&&(s--,s<0)){c=t;break}}if(!n){let e=c;c=u-l,l=u-e}let[o,f]=ki(e,t,r,i,c,l,a);return[{start:c,end:l,score:o},f]}return[{start:-1,end:-1,score:0},null]},ji=(e,t,n,r,i,a,o)=>{if(i.length===0)return[{start:0,end:0,score:0},null];let s=r.length,c=i.length;if(s<c||Di(r,i,e)<0)return[{start:-1,end:-1,score:0},null];let l=0,u=-1,d=ii(0),f=ii(-1);for(let a=0;a<s;a++){let o=gi(a,s,n),p=r[o];e||(p>=ui&&p<=di?p+=32:p>li&&(p=String.fromCodePoint(p).toLowerCase().codePointAt(0))),t&&(p=ri(p));let m=gi(l,c,n);if(i[m]===p){if(m===0&&(d=wi(r,o)),l++,l===c){if(d>f&&(u=a,f=d),d===8)break;a-=l-1,l=0,d=0}}else a-=l,l=0,d=0}if(u>=0){let a=0,o=0;n?(a=u-c+1,o=u+1):(a=s-(u+1),o=s-(u-c+1));let[l]=ki(e,t,r,i,a,o,!1);return[{start:a,end:o,score:l},null]}return[{start:-1,end:-1,score:0},null]};function Mi(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}const Ni=Mi(102400,2048),Pi=(e,t,n)=>{let r=!1;switch(t){case`smart-case`:e.toLowerCase()!==e&&(r=!0);break;case`case-sensitive`:r=!0;break;case`case-insensitive`:e=e.toLowerCase(),r=!1;break}let i=si(e);return n&&(i=i.map(ri)),{queryRunes:i,caseSensitive:r}};function Fi(e,t){let n=Object.keys(e).map(e=>parseInt(e,10)).sort((e,t)=>t-e),r=[];for(let i of n)if(r=r.concat(e[i]),r.length>=t)break;return r}function Ii(e,t,n){return r=>{let i=this.runesList[r];if(t.length>i.length)return;let[a,o]=this.algoFn(n,this.opts.normalize,this.opts.forward,i,t,!0,Ni);if(a.start===-1)return;if(this.opts.fuzzy===!1){o=new Set;for(let e=a.start;e<a.end;++e)o.add(e)}let s=this.opts.sort?a.score:0;e[s]===void 0&&(e[s]=[]),e[s].push({item:this.items[r],...a,positions:o??new Set})}}function Li(e){let{queryRunes:t,caseSensitive:n}=Pi(e,this.opts.casing,this.opts.normalize),r={},i=Ii.bind(this)(r,t,n);for(let e=0,t=this.runesList.length;e<t;++e)i(e);return Fi(r,this.opts.limit)}const Ri={limit:1/0,selector:e=>e,casing:`smart-case`,normalize:!0,fuzzy:`v2`,tiebreakers:[],sort:!0,forward:!0};var zi=class{constructor(e,...t){switch(this.opts={...Ri,...t[0]},this.items=e,this.runesList=e.map(e=>si(this.opts.selector(e).normalize())),this.algoFn=ji,this.opts.fuzzy){case`v2`:this.algoFn=Oi;break;case`v1`:this.algoFn=Ai;break}}};const Bi={...Ri,match:Li};var Vi=class extends zi{constructor(e,...t){super(e,...t),this.opts={...Bi,...t[0]}}find(e){return e.length===0||this.items.length===0?this.items.slice(0,this.opts.limit).map(Hi):(e=e.normalize(),Ui(this.opts.match.bind(this)(e),this.opts))}};({...Ri});const Hi=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function Ui(e,t){if(t.sort){let{selector:n}=t;e.sort((e,r)=>{if(e.score===r.score)for(let i of t.tiebreakers){let t=i(e,r,n);if(t!==0)return t}return 0})}return Number.isFinite(t.limit)&&e.splice(t.limit),e}function Wi(e,t,n){return n(e.item).length-n(t.item).length}function Gi(e,t){return e.start-t.start}var Ki=class{constructor(e,...t){this.finder=new Vi(e,...t),this.find=this.finder.find.bind(this.finder)}},Y=C(`lru-cache:metrics`),qi=w(`lru-cache`),Ji=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date,Yi=()=>Y.hasSubscribers||qi.hasSubscribers,Xi=new Set,Zi=typeof process==`object`&&process?process:{},Qi=(e,t,n,r)=>{typeof Zi.emitWarning==`function`?Zi.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},$i=e=>!Xi.has(e),ea=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),ta=e=>ea(e)?e<=2**8?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?na:null:null,na=class extends Array{constructor(e){super(e),this.fill(0)}},ra=class e{heap;length;static#e=!1;static create(t){let n=ta(t);if(!n)return[];e.#e=!0;let r=new e(t,n);return e.#e=!1,r}constructor(t,n){if(!e.#e)throw TypeError(`instantiate Stack using Stack.create(n)`);this.heap=new n(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},ia=class e{#e;#t;#n;#r;#i;#a;#o;#s;get perf(){return this.#s}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#x,autopurgeTimers:e.#S,sizes:e.#y,keyMap:e.#u,keyList:e.#d,valList:e.#f,next:e.#p,prev:e.#m,get head(){return e.#h},get tail(){return e.#g},free:e.#_,isBackgroundFetch:t=>e.#W(t),backgroundFetch:(t,n,r,i)=>e.#U(t,n,r,i),moveToTail:t=>e.#X(t),indexes:t=>e.#I(t),rindexes:t=>e.#L(t),isStale:t=>e.#j(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#l}get size(){return this.#c}get fetchMethod(){return this.#a}get memoMethod(){return this.#o}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#i}constructor(t){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:s,allowStale:c,dispose:l,onInsert:u,disposeAfter:d,noDisposeOnSet:f,noUpdateTTL:p,maxSize:m=0,maxEntrySize:h=0,sizeCalculation:g,fetchMethod:_,memoMethod:v,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:S,ignoreFetchAbort:C,backgroundFetchSize:w=1,perf:T}=t;if(this.backgroundFetchSize=w,T!==void 0&&typeof T?.now!=`function`)throw TypeError(`perf option must have a now() method if specified`);if(this.#s=T??Ji,n!==0&&!ea(n))throw TypeError(`max option must be a nonnegative integer`);let E=n?ta(n):Array;if(!E)throw Error(`invalid max value: `+n);if(this.#e=n,this.#t=m,this.maxEntrySize=h||this.#t,this.sizeCalculation=g,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError(`cannot set sizeCalculation without setting maxSize or maxEntrySize`);if(typeof this.sizeCalculation!=`function`)throw TypeError(`sizeCalculation set to non-function`)}if(v!==void 0&&typeof v!=`function`)throw TypeError(`memoMethod must be a function if defined`);if(this.#o=v,_!==void 0&&typeof _!=`function`)throw TypeError(`fetchMethod must be a function if specified`);if(this.#a=_,this.#w=!!_,this.#u=new Map,this.#d=Array.from({length:n}).fill(void 0),this.#f=Array.from({length:n}).fill(void 0),this.#p=new E(n),this.#m=new E(n),this.#h=0,this.#g=0,this.#_=ra.create(n),this.#c=0,this.#l=0,typeof l==`function`&&(this.#n=l),typeof u==`function`&&(this.#r=u),typeof d==`function`?(this.#i=d,this.#v=[]):(this.#i=void 0,this.#v=void 0),this.#C=!!this.#n,this.#E=!!this.#r,this.#T=!!this.#i,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!C,this.maxEntrySize!==0){if(this.#t!==0&&!ea(this.#t))throw TypeError(`maxSize must be a positive integer if specified`);if(!ea(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);this.#M()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!s,this.ttlResolution=ea(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!ea(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);this.#D()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t=`LRU_CACHE_UNBOUNDED`;$i(t)&&(Xi.add(t),Qi(`TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.`,`UnboundedCacheWarning`,t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#D(){let e=new na(this.#e),t=new na(this.#e);this.#x=e,this.#b=t;let n=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#S=n,this.#A=(n,i,a=this.#s.now())=>{t[n]=i===0?0:a,e[n]=i,r(n,i)},this.#O=n=>{t[n]=e[n]===0?0:this.#s.now(),r(n,e[n])};let r=this.ttlAutopurge?(e,t)=>{if(n?.[e]&&(clearTimeout(n[e]),n[e]=void 0),t&&t!==0&&n){let i=setTimeout(()=>{this.#j(e)?(this.#Z(this.#d[e],`expire`),n[e]=void 0):r(e,o(e))},t+1);i.unref&&i.unref(),n[e]=i}}:()=>{};this.#k=(n,r)=>{if(e[r]){let o=e[r],s=t[r];if(!o||!s)return;n.ttl=o,n.start=s,n.now=i||a(),n.remainingTTL=o-(n.now-s)}};let i=0,a=()=>{let e=this.#s.now();if(this.ttlResolution>0){i=e;let t=setTimeout(()=>i=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=e=>{let t=this.#u.get(e);return t===void 0?0:o(t)};let o=n=>{let r=e[n],o=t[n];return!r||!o?1/0:r-((i||a())-o)};this.#j=n=>{let r=t[n],o=e[n];return!!o&&!!r&&(i||a())-r>o}}#O=()=>{};#k=()=>{};#A=()=>{};#j=()=>!1;#M(){let e=new na(this.#e);this.#l=0,this.#y=e,this.#N=t=>{this.#l-=e[t],e[t]=0},this.#F=(e,t,n,r)=>{if(!ea(n)){if(this.#W(t))return this.backgroundFetchSize;if(r){if(typeof r!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=r(t,e),!ea(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}else throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`)}return n},this.#P=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#l>n;)this.#B(!0)}this.#l+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#l)}}#N=e=>{};#P=(e,t,n)=>{};#F=(e,t,n,r)=>{if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`);return 0};*#I({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;this.#R(t)&&((e||!this.#j(t))&&(yield t),t!==this.#h);)t=this.#m[t]}*#L({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#h;this.#R(t)&&((e||!this.#j(t))&&(yield t),t!==this.#g);)t=this.#p[t]}#R(e){return e!==void 0&&this.#u.get(this.#d[e])===e}*entries(){for(let e of this.#I())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#W(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*rentries(){for(let e of this.#L())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#W(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*keys(){for(let e of this.#I()){let t=this.#d[e];t!==void 0&&!this.#W(this.#f[e])&&(yield t)}}*rkeys(){for(let e of this.#L()){let t=this.#d[e];t!==void 0&&!this.#W(this.#f[e])&&(yield t)}}*values(){for(let e of this.#I())this.#f[e]!==void 0&&!this.#W(this.#f[e])&&(yield this.#f[e])}*rvalues(){for(let e of this.#L())this.#f[e]!==void 0&&!this.#W(this.#f[e])&&(yield this.#f[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]=`LRUCache`;find(e,t={}){for(let n of this.#I()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;if(i!==void 0&&e(i,this.#d[n],this))return this.#J(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#I()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#L()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#L({allowStale:!0}))this.#j(t)&&(this.#Z(this.#d[t],`expire`),e=!0);return e}info(e){let t=this.#u.get(e);if(t===void 0)return;let n=this.#f[t],r=this.#W(n)?n.__staleWhileFetching:n;if(r===void 0)return;let i={value:r};if(this.#x&&this.#b){let e=this.#x[t],n=this.#b[t];e&&n&&(i.ttl=e-(this.#s.now()-n),i.start=Date.now())}return this.#y&&(i.size=this.#y[t]),i}dump(){let e=[];for(let t of this.#I({allowStale:!0})){let n=this.#d[t],r=this.#f[t],i=this.#W(r)?r.__staleWhileFetching:r;if(i===void 0||n===void 0)continue;let a={value:i};if(this.#x&&this.#b){a.ttl=this.#x[t];let e=this.#s.now()-this.#b[t];a.start=Math.floor(Date.now()-e)}this.#y&&(a.size=this.#y[t]),e.unshift([n,a])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=this.#s.now()-e}this.#z(t,n.value,n)}}set(e,t,n={}){let{status:r=Y.hasSubscribers?{}:void 0}=n;n.status=r,r&&(r.op=`set`,r.key=e,t!==void 0&&(r.value=t),r.cache=this);let i=this.#z(e,t,n);return r&&Y.hasSubscribers&&Y.publish(r),i}#z(e,t,n,r){let{ttl:i=this.ttl,start:a,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:c}=n,l=this.#W(t);if(t===void 0)return c&&(c.set=`deleted`),this.delete(e),this;let{noUpdateTTL:u=this.noUpdateTTL}=n;c&&!l&&(c.value=t);let d=this.#F(e,t,n.size||0,s,c);if(this.maxEntrySize&&d>this.maxEntrySize)return this.#Z(e,`set`),c&&(c.set=`miss`,c.maxEntrySizeExceeded=!0),this;let f=this.#c===0?void 0:this.#u.get(e);if(f===void 0)f=this.#c===0?this.#g:this.#_.length===0?this.#c===this.#e?this.#B(!1):this.#c:this.#_.pop(),this.#d[f]=e,this.#f[f]=t,this.#u.set(e,f),this.#p[this.#g]=f,this.#m[f]=this.#g,this.#g=f,this.#c++,this.#P(f,d,c),c&&(c.set=`add`),u=!1,this.#E&&!l&&this.#r?.(t,e,`add`);else{this.#X(f);let n=this.#f[f];if(t!==n){if(!o)if(this.#W(n)){n!==r&&n.__abortController.abort(Error(`replaced`));let{__staleWhileFetching:i}=n;i!==void 0&&i!==t&&(this.#C&&this.#n?.(i,e,`set`),this.#T&&this.#v?.push([i,e,`set`]))}else this.#C&&this.#n?.(n,e,`set`),this.#T&&this.#v?.push([n,e,`set`]);if(this.#N(f),this.#P(f,d,c),this.#f[f]=t,!l){let r=n&&this.#W(n)?n.__staleWhileFetching:n,i=r===void 0?`add`:t===r?`update`:`replace`;c&&(c.set=i,r!==void 0&&(c.oldValue=r)),this.#E&&this.onInsert?.(t,e,i)}}else l||(c&&(c.set=`update`),this.#E&&this.onInsert?.(t,e,`update`))}if(i!==0&&!this.#x&&this.#D(),this.#x&&(u||this.#A(f,i,a),c&&this.#k(c,f)),!o&&this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return this}pop(){try{for(;this.#c;){let e=this.#f[this.#h];if(this.#B(!0),this.#W(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}}#B(e){let t=this.#h,n=this.#d[t],r=this.#f[t],i=this.#W(r);i&&r.__abortController.abort(Error(`evicted`));let a=i?r.__staleWhileFetching:r;return(this.#C||this.#T)&&a!==void 0&&(this.#C&&this.#n?.(a,n,`evict`),this.#T&&this.#v?.push([a,n,`evict`])),this.#N(t),this.#S?.[t]&&(clearTimeout(this.#S[t]),this.#S[t]=void 0),e&&(this.#d[t]=void 0,this.#f[t]=void 0,this.#_.push(t)),this.#c===1?(this.#h=this.#g=0,this.#_.length=0):this.#h=this.#p[t],this.#u.delete(n),this.#c--,t}has(e,t={}){let{status:n=Y.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`has`,n.key=e,n.cache=this);let r=this.#V(e,t);return Y.hasSubscribers&&Y.publish(n),r}#V(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#u.get(e);if(i!==void 0){let e=this.#f[i];if(this.#W(e)&&e.__staleWhileFetching===void 0)return!1;if(this.#j(i))r&&(r.has=`stale`,this.#k(r,i));else return n&&this.#O(i),r&&(r.has=`hit`,this.#k(r,i)),!0}else r&&(r.has=`miss`);return!1}peek(e,t={}){let{status:n=Yi()?{}:void 0}=t;n&&(n.op=`peek`,n.key=e,n.cache=this),t.status=n;let r=this.#H(e,t);return Y.hasSubscribers&&Y.publish(n),r}#H(e,t){let{status:n,allowStale:r=this.allowStale}=t,i=this.#u.get(e);if(i===void 0||!r&&this.#j(i)){n&&(n.peek=i===void 0?`miss`:`stale`);return}let a=this.#f[i],o=this.#W(a)?a.__staleWhileFetching:a;return n&&(o===void 0?n.peek=`miss`:(n.peek=`hit`,n.value=o)),o}#U(e,t,n,r){let i=t===void 0?void 0:this.#f[t];if(this.#W(i))return i;let a=new AbortController,{signal:o}=n;o?.addEventListener(`abort`,()=>a.abort(o.reason),{signal:a.signal});let s={signal:a.signal,options:n,context:r},c=(r,i=!1)=>{let{aborted:o}=a.signal,c=n.ignoreFetchAbort&&r!==void 0,l=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&r!==void 0);if(n.status&&(o&&!i?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,c&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),o&&!c&&!i)return u(a.signal.reason,l);let d=f,p=this.#f[t];return(p===f||p===void 0&&c&&i)&&(r===void 0?d.__staleWhileFetching===void 0?this.#Z(e,`fetch`):this.#f[t]=d.__staleWhileFetching:(n.status&&(n.status.fetchUpdated=!0),this.#z(e,r,s.options,d))),r},l=e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),u(e,!1)),u=(r,i)=>{let{aborted:o}=a.signal,s=o&&n.allowStaleOnFetchAbort,c=s||n.allowStaleOnFetchRejection,l=c||n.noDeleteOnFetchRejection,u=f;if(this.#f[t]===f&&(!l||!i&&u.__staleWhileFetching===void 0?this.#Z(e,`fetch`):s||(this.#f[t]=u.__staleWhileFetching)),c)return n.status&&u.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw r},d=(t,r)=>{let o=this.#a?.(e,i,s);a.signal.addEventListener(`abort`,()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>c(e,!0)))}),o&&o instanceof Promise?o.then(e=>t(e===void 0?void 0:e),r):o!==void 0&&t(o)};n.status&&(n.status.fetchDispatched=!0);let f=new Promise(d).then(c,l),p=Object.assign(f,{__abortController:a,__staleWhileFetching:i,__returned:void 0});return t===void 0?(this.#z(e,p,{...s.options,status:void 0}),t=this.#u.get(e)):this.#f[t]=p,p}#W(e){if(!this.#w)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty(`__staleWhileFetching`)&&t.__abortController instanceof AbortController}fetch(e,t={}){let n=qi.hasSubscribers,{status:r=Yi()?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let i=this.#G(e,t);return r&&n&&(r.trace=!0,qi.tracePromise(()=>i,r).catch(()=>{})),i}async#G(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:m,forceRefresh:h=!1,status:g,signal:_}=t;if(g&&(g.op=`fetch`,g.key=e,h&&(g.forceRefresh=!0),g.cache=this),!this.#w)return g&&(g.fetch=`get`),this.#J(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:g});let v={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:a,noDisposeOnSet:o,size:s,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:p,ignoreFetchAbort:f,status:g,signal:_},y=this.#u.get(e);if(y===void 0){g&&(g.fetch=`miss`);let t=this.#U(e,y,v,m);return t.__returned=t}else{let t=this.#f[y];if(this.#W(t)){let e=n&&t.__staleWhileFetching!==void 0;return g&&(g.fetch=`inflight`,e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#j(y);if(!h&&!i)return g&&(g.fetch=`hit`),this.#X(y),r&&this.#O(y),g&&this.#k(g,y),t;let a=this.#U(e,y,v,m),o=a.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=i?`stale`:`refresh`,o&&i&&(g.returnedStale=!0)),o?a.__staleWhileFetching:a.__returned=a}}forceFetch(e,t={}){let n=qi.hasSubscribers,{status:r=Yi()?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let i=this.#K(e,t);return r&&n&&(r.trace=!0,qi.tracePromise(()=>i,r).catch(()=>{})),i}async#K(e,t={}){let n=await this.#G(e,t);if(n===void 0)throw Error(`fetch() returned undefined`);return n}memo(e,t={}){let{status:n=Y.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`memo`,n.key=e,t.context&&(n.context=t.context),n.cache=this);let r=this.#q(e,t);return n&&(n.value=r),Y.hasSubscribers&&Y.publish(n),r}#q(e,t={}){let n=this.#o;if(!n)throw Error(`no memoMethod provided to constructor`);let{context:r,status:i,forceRefresh:a,...o}=t;i&&a&&(i.forceRefresh=!0);let s=this.#J(e,o),c=a||s===void 0;if(i&&(i.memo=c?`miss`:`hit`,c||(i.value=s)),!c)return s;let l=n(e,s,{options:o,context:r});return i&&(i.value=l),this.#z(e,l,o),l}get(e,t={}){let{status:n=Y.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`get`,n.key=e,n.cache=this);let r=this.#J(e,t);return n&&(r!==void 0&&(n.value=r),Y.hasSubscribers&&Y.publish(n)),r}#J(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:a}=t,o=this.#u.get(e);if(o===void 0){a&&(a.get=`miss`);return}let s=this.#f[o],c=this.#W(s);return a&&this.#k(a,o),this.#j(o)?c?(a&&(a.get=`stale-fetching`),n&&s.__staleWhileFetching!==void 0?(a&&(a.returnedStale=!0),s.__staleWhileFetching):void 0):(i||this.#Z(e,`expire`),a&&(a.get=`stale`),n?(a&&(a.returnedStale=!0),s):void 0):(a&&(a.get=c?`fetching`:`hit`),this.#X(o),r&&this.#O(o),c?s.__staleWhileFetching:s)}#Y(e,t){this.#m[t]=e,this.#p[e]=t}#X(e){e!==this.#g&&(e===this.#h?this.#h=this.#p[e]:this.#Y(this.#m[e],this.#p[e]),this.#Y(this.#g,e),this.#g=e)}delete(e){return this.#Z(e,`delete`)}#Z(e,t){Y.hasSubscribers&&Y.publish({op:`delete`,delete:t,key:e,cache:this});let n=!1;if(this.#c!==0){let r=this.#u.get(e);if(r!==void 0)if(this.#S?.[r]&&(clearTimeout(this.#S[r]),this.#S[r]=void 0),n=!0,this.#c===1)this.#Q(t);else{this.#N(r);let n=this.#f[r];if(this.#W(n)?n.__abortController.abort(Error(`deleted`)):(this.#C||this.#T)&&(this.#C&&this.#n?.(n,e,t),this.#T&&this.#v?.push([n,e,t])),this.#u.delete(e),this.#d[r]=void 0,this.#f[r]=void 0,r===this.#g)this.#g=this.#m[r];else if(r===this.#h)this.#h=this.#p[r];else{let e=this.#m[r];this.#p[e]=this.#p[r];let t=this.#p[r];this.#m[t]=this.#m[r]}this.#c--,this.#_.push(r)}}if(this.#T&&this.#v?.length){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return n}clear(){return this.#Q(`delete`)}#Q(e){for(let t of this.#L({allowStale:!0})){let n=this.#f[t];if(this.#W(n))n.__abortController.abort(Error(`deleted`));else{let r=this.#d[t];this.#C&&this.#n?.(n,r,e),this.#T&&this.#v?.push([n,r,e])}}if(this.#u.clear(),this.#f.fill(void 0),this.#d.fill(void 0),this.#x&&this.#b){this.#x.fill(0),this.#b.fill(0);for(let e of this.#S??[])e!==void 0&&clearTimeout(e);this.#S?.fill(void 0)}if(this.#y&&this.#y.fill(0),this.#h=0,this.#g=0,this.#_.length=0,this.#l=0,this.#c=0,this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}},aa=`@teacss/autocomplete`;const oa=5e4,sa=2e6,ca=5e4,la=4096,ua=1e3,da=5e7,fa=1e5,pa=new Map(Array.from(`ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåçèéêëìíîïñòóôõöøùúûüýÿĀāĂ㥹ĆćĈĉĊċČčĎďđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥħĨĩĪīĬĭĮįİıĴĵĶķĹĺĻļĽľŀłŃńŅņŇňŌōŎŏŐőŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƃƆƈƉƊƌƎƐƒƓƗƙƚƜƝƞƟƠơƥƫƭƮƯưƲƴƶǍǎǏǐǑǒǓǔǗǘǝǥǦǧǨǩǪǫǰǴǵǸǹȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȞȟȠȡȥȦȧȨȩȮȯȲȳȴȵȶȷȺȻȼȽȾȿɀɃɄɅɆɇɈɉɊɋɌɍɎɏɐɑɓɔɕɖɗɘɛɜɝɞɟɠɡɢɥɦɨɪɫɬɭɯɰɱɲɳɴɵɹɺɻɼɽɾɿʀʁʂʇʈʉʋʌʍʎʏʐʑʗʙʚʛʜʝʞʟʠʮͣͤͥͦͧͨͩͪͫͬͭͮͯᴀᴃᴄᴅᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᵢᵣᵤᵥḀḁḂḃḄḅḆḇḊḋḌḍḎḏḐḑḒḓḘḙḚḛḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉṊṋṔṕṖṗṘṙṚṛṞṟṠṡṢṣṪṫṬṭṮṯṰṱṲṳṴṵṶṷṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐốỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹⁱₕₖₗₘₙₚₛₜↄ`,(e,t)=>[e,`AAAAAACEEEEIIIINOOOOOOUUUUYsaaaaaaceeeeiiiinoooooouuuuyyAaAaAaCcCcCcCcDddEeEeEeEeEeGgGgGgGgHhhIiIiIiIiIiJjKkLlLlLlllNnNnNnOoOoOoRrRrRrSsSsSsSsTtTttUuUuUuUuUuUuWwYyYZzZzZzsbBbOcDDdEEfGIklMNnOOopttTUuVyzAaIiOoUuUuegGgKkOojGgNnAaAaEeEeIiIiOoOoRrRrUuUuSsTtHhNdzAaEeOoYylntjACcLTszBUVEeJjQqRrYyaabocddeeeeejggGhhiIlllmmmnnNorrrrrrrRRsttuvvwyYzzcBeGHjkLqhaeioucdhmrtvxABCDEeiJKLMNOOoooooPRRTUuumVWZiruvAaBbBbBbDdDdDdDdDdEeEeFfGgHhHhHhHhHhIiIiKkKkKkLlLlLlMmMmMmNnNnNnNnPpPpRrRrRrSsSsTtTtTtTtUuUuUuVvVvWwWwWwWwWwXxXxYyZzZzZzhtwyasAaAaAaAaAaAaAaAaAaAaAaAaEeEeEeEeEeEeEeEeIiIiOoOoOoOoOoOoOoOoOoOoOoOoUuUuUuUuUuUuUuYyYyYyYyihklmnpstc`[t]])),ma={maxAttempts:ca,maxCandidateLength:la,maxCandidates:oa,maxCharacters:sa,maxScans:fa,maxScannedCharacters:5e7},ha={...ma,maxCandidateLength:sa,maxCandidates:ua};function ga(){return{suggestions:[],attempts:0,candidates:0,characters:0,scans:0,truncated:!1}}const _a=new WeakMap,va=new WeakMap;function ya(e,t,n){let r=_a.get(e);if(!r){let n=e.suggest(t,`prefix`)??[];return{suggestions:n,attempts:n.length,candidates:n.length,characters:n.reduce((e,t)=>e+t.length,0),scans:n.length,truncated:!1}}return r(t,n)}function ba(e,t,n){let r=va.get(e);return r?r(t,n):ya(e,t,n)}var xa=class extends Error{template;constructor(e,t){super(e),this.template=t,this.name=aa,this.template=t}toString(){return`⚠️ [${this.name}]: ${this.message}. ${this.template?`Template: ${this.template}.`:``}`}};const Sa={directions:`(x|y|t|b|l|r|s|e)`,num:`(${[0,1,2,3,4,5,6,8,10,12,24,36].join(`|`)})`,percent:`(${[0,10,20,30,40,50,60,70,80,90,100].join(`|`)})`,percentage:`(${[`10%`,`20%`,`30%`,`40%`,`50%`,`60%`,`70%`,`80%`,`90%`,`100%`].join(`|`)})`},Ca=[`DEFAULT`];function wa(e,t,n,r){let i=0;Array.from(e.matchAll(t)).forEach(t=>{let a=t.index;i!==a&&r(e.slice(i,a),i,a),n(t),i=a+t[0].length}),i!==e.length&&r(e.slice(i),i,e.length)}const Ta=oa;function Ea(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]===`(`)n++;else if(e[r]===`)`&&--n===0)return r}function Da(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?n++:a===`)`?n--:a===`|`&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t}function Oa(e,t){let n=e.indexOf(`(`),r=n===-1?void 0:Ea(e,n);if(n===-1||r==null)return[e];let i=e.slice(0,n),a=Oa(e.slice(r+1),t);if(a===void 0)return;let o=[];for(let s of Da(e.slice(n+1,r))){let e=Oa(s,t);if(e===void 0)return;for(let n of e)for(let e of a){if(--t.remaining<0)return;o.push(`${i}${n}${e}`)}}return o}function ka(e){let t={remaining:Ta},n=[];for(let r of Da(e)){let e=Oa(r,t);if(e===void 0)return;n.push(...e)}return n}function Aa(e,t={},n={}){let r=[],i=[],a={...Sa,...n};e=e.replace(/<([\w-]+)>/g,(e,t,n,r)=>Object.hasOwn(a,t)?a[t]:(i.push(new xa(`Unknown template shorthand: <${t}>`,r)),e)),c(e),i.length&&(r.length=0);let o={parts:r,suggest:l,errors:i};return _a.set(o,d),va.set(o,u),o;function s(e){wa(e,/\$([\w.|-]+)/g,e=>{r.push({type:`theme`,objects:e[1].split(`|`).map(n=>{let r=n.split(`.`).reduce((t,n)=>!n||typeof t!=`object`||!t||!Object.hasOwn(t,n)||!t[n]?(i.push(new xa(`Invalid theme key: ${n}`,e.input)),{}):t[n],t);return typeof r!=`object`||!r||Array.isArray(r)?(i.push(new xa(`Invalid theme path: ${n}`,e.input)),{}):r})})},e=>{r.push({type:`static`,value:e})})}function c(t){let n=0;for(let a=0;a<t.length;a++){if(t[a]!==`(`)continue;let o=Ea(t,a);if(o==null)break;let c=t.slice(a+1,o);if(n!==a&&s(t.slice(n,a)),n=o+1,!c.includes(`|`)){r.push({type:`static`,value:t.slice(a,o+1)}),a=o;continue}let l=ka(c);l===void 0?(i.push(new xa(`Template group expands past ${Ta} values: (${c})`,e)),r.push({type:`static`,value:t.slice(a,o+1)})):r.push({type:`group`,values:l}),a=o}n!==t.length&&s(t.slice(n))}function l(e,t=`prefix`){if(e.length>1&&t===`fuzzy`){let t=e!==e.toLowerCase(),n=Ga(e,t),i=d(e,{maxCandidates:ua}).suggestions.filter(e=>za(n,Ga(e,t),e,0));if(n.length>la)return i;let a=wo(r,{},e).candidates;if(i.length){let e=new Set(i);if(a.every(t=>e.has(t)))return i}if(Ra(e,a.reduce((e,t)=>e+t.length,0))){let t=Fa(a,e),n=t.filter(t=>Wa(t,e));return n.length?yo(n,[...i,...t]):yo(i,t)}return yo(i,new Ki(a,{fuzzy:`v1`,limit:ua}).find(e).map(e=>e.item))}return u(e).suggestions}function u(e,t={}){let n={...ha,...t},i=Pa(e);if(i.length>n.maxCandidateLength)return ga();let a=ja(r);if(a){let t=Ma(r,0,a.index);if(!no(t,e)&&!no(Pa(t),i))return ga();let o=Ma(r,a.index+1,r.length);return ro(a.part,t,o,e,a.suppressPartialRoots,n)}let o=Na(r);return o&&!no(o,e)&&!no(Pa(o),Pa(e))?ga():qa(r,e,n)}function d(e,t={}){let n={...ma,...t},i=u(e,n),a=Na(r);if(i.suggestions.length||!a)return i;let o={...n,maxAttempts:n.maxAttempts-i.attempts,maxCandidates:n.maxCandidates-i.candidates,maxCharacters:n.maxCharacters-i.characters,maxScans:n.maxScans-i.scans},s=u(a+e,o);return{suggestions:s.suggestions,attempts:i.attempts+s.attempts,candidates:i.candidates+s.candidates,characters:i.characters+s.characters,scans:i.scans+s.scans,truncated:i.truncated||s.truncated}}}function ja(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i.type!==`static`){if(i.type===`group`&&i.values.length>0&&i.values.every(e=>e===``)){n=!0;continue}if(i.type!==`theme`||t)return;t={index:r,part:i}}}return t&&{...t,suppressPartialRoots:n}}function Ma(e,t,n){let r=``;for(let i=t;i<n;i++){let t=e[i];t.type===`static`&&(r+=t.value)}return r}function Na(e){let t=e.findIndex(e=>e.type!==`static`);return Ma(e,0,t<0?e.length:t)}function Pa(e){return e.replace(/-/g,``)}function Fa(e,t){return Ia(e,t)}function Ia(e,t,n={}){let r={...ma,maxCandidates:ua,...n};if(!t)return La(e,r);let i=t!==t.toLowerCase(),a=Ga(t,i);if(a.length>r.maxCandidateLength)return[];let o={characters:0,items:[],retained:new Set},s=new Set,c=e[Symbol.iterator](),l=0,u=0;for(;l<r.maxAttempts&&u<r.maxScannedCharacters;){let e=c.next();if(e.done)break;let t=e.value,n=l++;if(!t||t.length>r.maxCandidateLength||s.has(t)||t.length>r.maxScannedCharacters-u)continue;s.add(t),u+=t.length;let d=za(a,Ga(t,i),t,n);d&&Ba(o,d,r.maxCandidates,r.maxCharacters)}return o.items.sort(Ua).map(({candidate:e})=>e)}function La(e,t){let n=[],r=new Set,i=e[Symbol.iterator](),a=0,o=0,s=0;for(;a<t.maxAttempts&&n.length<t.maxCandidates&&o<t.maxCharacters&&s<t.maxScannedCharacters;){let e=i.next();if(e.done)break;let c=e.value;a++,!(!c||c.length>t.maxCandidateLength||r.has(c)||c.length>t.maxScannedCharacters-s)&&(r.add(c),s+=c.length,!(o+c.length>t.maxCharacters)&&(n.push(c),o+=c.length))}return n}function Ra(e,t){return e.length*t>da}function za(e,t,n,r){if(t===e)return{candidate:n,category:0,gaps:0,longestRun:e.length,start:0,order:r};if(t.startsWith(e))return{candidate:n,category:1,gaps:0,longestRun:e.length,start:0,order:r};let i=0,a=-1,o=-1,s=0,c=0,l=0;for(let n=0;n<t.length&&i<e.length;n++)t[n]===e[i]&&(a<0&&(a=n),o>=0&&(l+=n-o-1),s=n===o+1?s+1:1,c=Math.max(c,s),o=n,i++);if(i===e.length)return{candidate:n,category:2,gaps:l,longestRun:c,start:a,order:r}}function Ba(e,t,n,r){e.retained.has(t.candidate)||(e.items.length<n&&e.characters+t.candidate.length<=r?(e.items.push(t),e.retained.add(t.candidate),e.characters+=t.candidate.length,Va(e.items,e.items.length-1)):e.items.length&&Ua(t,e.items[0])<0&&e.characters-e.items[0].candidate.length+t.candidate.length<=r&&(e.retained.delete(e.items[0].candidate),e.characters+=t.candidate.length-e.items[0].candidate.length,e.items[0]=t,e.retained.add(t.candidate),Ha(e.items,0)))}function Va(e,t){for(;t>0;){let n=t-1>>>1;if(Ua(e[t],e[n])<=0)return;[e[n],e[t]]=[e[t],e[n]],t=n}}function Ha(e,t){for(;;){let n=t*2+1;if(n>=e.length)return;let r=n+1,i=n;if(r<e.length&&Ua(e[r],e[n])>0&&(i=r),Ua(e[i],e[t])<=0)return;[e[t],e[i]]=[e[i],e[t]],t=i}}function Ua(e,t){return e.category-t.category||e.gaps-t.gaps||t.longestRun-e.longestRun||e.start-t.start||e.candidate.length-t.candidate.length||e.order-t.order}function Wa(e,t){let n=t!==t.toLowerCase();return Ga(e,n)===Ga(t,n)}function Ga(e,t){let n=e.normalize(),r=Ka(n)?n:Array.from(n,e=>pa.get(e)??e).join(``);return t?r:r.toLowerCase()}function Ka(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>127)return!1;return!0}function qa(e,t,n={}){let r={...ma,...n};if(r.maxAttempts<=0||r.maxCandidates<=0||r.maxCharacters<=0)return ga();let i=Pa(t),a=Ja(),o=Ja(),s=r.maxCandidates,c=oo(r.maxScans),l=[],u=Array.from({length:e.length},()=>``),d=Array.from({length:e.length+1},()=>0),f=Array.from({length:e.length+1},()=>0),p=Array.from({length:e.length+1},()=>0),m=[],h=new Set,g=0,_=0;for(;_>=0&&!c.truncated;){if(_===e.length){let e=u.join(``),n=f[_]>=t.length,c=p[_]>=i.length;if((n||c)&&e.length<=r.maxCharacters){let t=!h.has(e);(!t||g<r.maxAttempts)&&(t&&(h.add(e),g++),n&&Ya(a,e,m,s,r),c&&Ya(o,e,m,s,r))}_--;continue}if(g>=r.maxAttempts)break;let n=l[_];n||(n={choiceIndex:0,iterator:bo(e[_],r.maxCandidateLength-d[_],c)},l[_]=n);let v=n.iterator.next();if(v.done){l.pop(),_--;continue}let y=n.choiceIndex++,b=v.value,x=d[_]+b.length;if(x>r.maxCandidateLength)continue;let S=f[_]<0?-1:to(t,f[_],b,!1),C=p[_]<0?-1:to(i,p[_],b,!0);if(S<0&&C<0)continue;for(;m.length&&!(m.at(-1).depth<_);)m.pop();y>0&&m.push({depth:_,index:y}),u[_]=b;let w=_+1;d[w]=x,f[w]=S,p[w]=C,l.length=w,_=w}let v=a.entries.length?a:o;v.entries.sort((e,t)=>eo(e.path,t.path));let y=v.entries.map(e=>e.candidate);return{suggestions:y,attempts:g,candidates:y.length,characters:v.characters,scans:c.initial-c.remaining,truncated:c.truncated}}function Ja(){return{characters:0,entries:[],indices:new Map}}function Ya(e,t,n,r,i){let a=e.indices.get(t);if(a!==void 0){let t=e.entries[a];eo(n,t.path)<0&&(t.path=n.slice(),Qa(e,a));return}if(r<=0||t.length>i.maxCharacters)return;let o={candidate:t,path:n.slice()};if(e.entries.length>=r){if(eo(o.path,e.entries[0].path)>=0)return;Xa(e)}for(;e.entries.length&&e.characters+t.length>i.maxCharacters;){if(eo(o.path,e.entries[0].path)>=0)return;Xa(e)}e.characters+t.length>i.maxCharacters||(e.indices.set(t,e.entries.length),e.entries.push(o),e.characters+=t.length,Za(e,e.entries.length-1))}function Xa(e){let t=e.entries[0],n=e.entries.pop();e.indices.delete(t.candidate),e.characters-=t.candidate.length,e.entries.length&&(e.entries[0]=n,e.indices.set(n.candidate,0),Qa(e,0))}function Za(e,t){for(;t>0;){let n=t-1>>>1;if(eo(e.entries[t].path,e.entries[n].path)<=0)return;$a(e,n,t),t=n}}function Qa(e,t){for(;;){let n=t*2+1;if(n>=e.entries.length)return;let r=n+1,i=n;if(r<e.entries.length&&eo(e.entries[r].path,e.entries[n].path)>0&&(i=r),eo(e.entries[i].path,e.entries[t].path)<=0)return;$a(e,i,t),t=i}}function $a(e,t,n){[e.entries[t],e.entries[n]]=[e.entries[n],e.entries[t]],e.indices.set(e.entries[t].candidate,t),e.indices.set(e.entries[n].candidate,n)}function eo(e,t){let n=e.length-1,r=t.length-1;for(;n>=0||r>=0;){let i=n>=0?e[n].depth:-1,a=r>=0?t[r].depth:-1,o=Math.max(i,a),s=i===o?e[n--].index:0,c=a===o?t[r--].index:0;if(s!==c)return s-c}return 0}function to(e,t,n,r){let i=t;for(let t=0;t<n.length;t++){let a=n[t];if(!(r&&a===`-`)){if(i<e.length&&e[i]!==a)return-1;i++}}return i}function no(e,t){return e.length<=t.length?t.startsWith(e):e.startsWith(t)}function ro(e,t,n,r,i,a){let o={...ma,...a};if(t.length+1>o.maxCandidateLength)return ga();let s=oo(o.maxScans),c=lo(e.objects,s),l=uo(r,!1,o),u=uo(Pa(r),!0,o);io(c,t,n,o.maxCandidateLength,i,l,u,s);let d=po(l,s);if(d.suggestions.length||!d.exhausted)return d;let f=po(u,s);return{suggestions:f.suggestions,attempts:d.attempts+f.attempts,candidates:d.candidates+f.candidates,characters:d.characters+f.characters,scans:f.scans,truncated:f.truncated}}function io(e,t,n,r,i,a,o,s){for(let c of e){let e=t+c.key,l=mo(e,a.input,!1),u=mo(e,o.input,!0);if(l===`none`&&u===`none`)continue;let d=go(c.objects,e,n,a.input,o.input,r),f=l===`partial`||u===`partial`?_o(d,s):void 0,p=f!==void 0;if(ho(a,l,c.hasLeaf,p,e,n,i),ho(o,u,c.hasLeaf,p,e,n,i),a.blocked)return;for(f??=_o(d,s);f;){if((l===`reached`||i&&l===`partial`)&&fo(a,f.candidate,f.rawMatch),(u===`reached`||i&&u===`partial`)&&fo(o,f.candidate,f.normalizedMatch),a.blocked)return;f=_o(d,s)}if(s.truncated||a.blocked)return}}function ao(e){return!!e&&e[0]!==`_`&&!Ca.includes(e)}function oo(e=fa){let t=Math.max(0,e);return{initial:t,remaining:t,truncated:!1}}function so(e){return e.remaining<=0?(e.truncated=!0,!1):(e.remaining--,!0)}function*co(e){yield*Object.keys(e)}function lo(e,t){let n=new Map;outer:for(let r of e)for(let e of co(r)){if(!so(t))break outer;if(!ao(e))continue;let i=r[e];if(i==null)continue;let a=n.get(e)??{key:e,hasLeaf:!1,objects:[]};if(typeof i!=`object`||Array.isArray(i))a.hasLeaf=!0;else{let e=i;a.objects.push(e),a.hasLeaf||=Object.hasOwn(e,`DEFAULT`)&&e.DEFAULT!==null&&e.DEFAULT!==void 0}n.set(e,a)}return[...n.values()]}function uo(e,t,n){return{attempts:0,blocked:n.maxAttempts<=0||n.maxCandidates<=0||n.maxCharacters<=0,characters:0,input:e,limits:n,normalize:t,seen:new Set,suggestions:[]}}function fo(e,t,n){!n||e.blocked||e.seen.has(t)||(e.seen.add(t),e.attempts++,t.length<=e.limits.maxCandidateLength&&e.characters+t.length<=e.limits.maxCharacters&&(e.suggestions.push(t),e.characters+=t.length),e.blocked||=e.attempts>=e.limits.maxAttempts||e.suggestions.length>=e.limits.maxCandidates||e.characters>=e.limits.maxCharacters)}function po(e,t){return{suggestions:e.suggestions,attempts:e.attempts,candidates:e.suggestions.length,characters:e.characters,scans:t.initial-t.remaining,truncated:t.truncated,exhausted:!e.blocked&&!t.truncated}}function mo(e,t,n){let r=n?Pa(e):e;return t.startsWith(r)?`reached`:r.startsWith(t)?`partial`:`none`}function ho(e,t,n,r,i,a,o){if(t===`none`)return;if(t===`partial`&&r){(n||!o)&&fo(e,i,!0);return}if(!n)return;let s=i+a;fo(e,s,(e.normalize?Pa(s):s).startsWith(e.input))}function go(e,t,n,r,i,a){return{base:t,fragments:[],frames:[],maxCandidateLength:a,normalizedInput:i,normalizedMatchedLength:to(i,0,t,!0),objectIndex:0,objects:e,rawInput:r,rawMatchedLength:to(r,0,t,!1),staticSuffix:n}}function _o(e,t){for(;!t.truncated;){if(!e.frames.length){if(e.objectIndex>=e.objects.length)return;let t=e.objects[e.objectIndex++];e.frames.push({depth:0,iterator:co(t),normalizedMatchedLength:e.normalizedMatchedLength,object:t,rawMatchedLength:e.rawMatchedLength,valueLength:0})}let n=e.frames.at(-1),r=n.iterator.next();if(r.done){e.frames.pop(),e.fragments.length=n.depth;continue}if(!so(t))return;let i=r.value;if(!ao(i))continue;let a=n.object[i];if(a==null)continue;let o=n.valueLength+ +!!n.depth+i.length;if(e.base.length+o+e.staticSuffix.length+1>e.maxCandidateLength)continue;let s=`-${i}`,c=n.rawMatchedLength<0?-1:to(e.rawInput,n.rawMatchedLength,s,!1),l=n.normalizedMatchedLength<0?-1:to(e.normalizedInput,n.normalizedMatchedLength,s,!0);if(c<0&&l<0)continue;e.fragments.length=n.depth,e.fragments.push(i);let u=typeof a==`object`&&!Array.isArray(a)?a:void 0;if(u&&e.frames.push({depth:n.depth+1,iterator:co(u),normalizedMatchedLength:l,object:u,rawMatchedLength:c,valueLength:o}),!(!u||Object.hasOwn(u,`DEFAULT`)&&u.DEFAULT!==null&&u.DEFAULT!==void 0))continue;let d=vo(e.rawInput,c,e.staticSuffix,!1),f=vo(e.normalizedInput,l,e.staticSuffix,!0);if(!(!d&&!f))return{candidate:`${e.base}-${e.fragments.join(`-`)}${e.staticSuffix}`,normalizedMatch:f,rawMatch:d}}}function vo(e,t,n,r){return t<0?!1:to(e,t,n,r)>=e.length}function yo(e,t){let n=[],r=new Set,i=0,a=(e,t)=>{for(let a of e){if(n.length===t)return;if(!(!a||r.has(a)||a.length>la)){if(i+a.length>sa)return;r.add(a),n.push(a),i+=a.length}}};return a(e,t.length?750:ua),a(t,ua),a(e,ua),n}function*bo(e,t,n){e.type===`theme`?yield*So(e.objects,t,n):yield*xo(e,t,n)}function*xo(e,t,n){if(e.type===`static`){e.value.length<=t&&(yield e.value);return}if(e.type===`group`)for(let r of e.values){if(!so(n))return;r.length<=t&&(yield r)}}function*So(e,t,n){let r=[];for(let i of e){r.length=0;let e=[{depth:0,iterator:co(i),object:i,valueLength:0}];for(;e.length&&!n.truncated;){let i=e.at(-1),a=i.iterator.next();if(a.done){e.pop(),r.length=i.depth;continue}if(!so(n))return;let o=a.value;if(!ao(o))continue;let s=i.object[o];if(s==null)continue;let c=i.valueLength+ +!!i.depth+o.length;if(c>t)continue;r.length=i.depth,r.push(o);let l=typeof s==`object`&&!Array.isArray(s)?s:void 0;l&&e.push({depth:i.depth+1,iterator:co(l),object:l,valueLength:c}),(!l||Object.hasOwn(l,`DEFAULT`)&&l.DEFAULT!==null&&l.DEFAULT!==void 0)&&(yield r.join(`-`))}}}function Co(e,t){let n=oo(t.maxScans),r=e.map(e=>({done:!1,iterator:bo(e,t.maxCandidateLength,n),pending:void 0,seen:new Set,values:[]})),i=e.length+Math.max(0,t.maxCandidates-1),a=r.length,o=0,s=0,c=!1,l=r.length;for(;l&&!n.truncated;){let e=!1;for(let n of r){if(!n.values.length&&n.pending!==void 0&&o+n.pending.length<=t.maxCharacters){n.values.push(n.pending),o+=n.pending.length,n.pending=void 0,s++,l--,e=!0;continue}if(n.done)continue;let r=n.iterator.next();if(e=!0,r.done){n.done=!0,a--;continue}if(n.seen.has(r.value))continue;if(n.seen.add(r.value),!n.values.length){o+r.value.length<=t.maxCharacters?(n.values.push(r.value),o+=r.value.length,s++,l--):(n.pending===void 0||r.value.length<n.pending.length)&&(n.pending=r.value,c=!0);continue}let i=n.values[0];r.value.length<i.length&&(n.values[0]=r.value,o+=r.value.length-i.length,c=!0)}if(!e)break}for(;a&&s<i&&o<t.maxCharacters&&!n.truncated;){let e=!1;for(let n of r){if(n.done)continue;let r=n.iterator.next();if(r.done){n.done=!0,a--;continue}if(e=!0,!n.seen.has(r.value)){if(n.seen.add(r.value),o+r.value.length>t.maxCharacters){c=!0;continue}if(n.values.push(r.value),o+=r.value.length,s++,s===i)break}}if(!e)break}return c||=n.truncated||a>0||l>0,{scans:n.initial-n.remaining,truncated:c,values:r.map(e=>e.values)}}function wo(e,t={},n=``){let r={...ma,...t},i=Co(e,r),a=i.values,o=i.scans,s,c=()=>{if(s===void 0){let t=To(a,n,r);s=t?{combination:t,scans:0}:Eo(e,n,r,Math.max(0,r.maxScans-o)),o+=s.scans}return s};if(a.some(e=>!e.length)){let e=i.truncated?c().combination:void 0;if(!e)return{candidates:[],truncated:i.truncated,attempts:0,scans:o};let t=Oo(r),n={remaining:r.maxAttempts};return ko(t,n,0)&&Fo(t,e),{candidates:[...t.candidates],truncated:!0,attempts:r.maxAttempts-n.remaining,scans:o}}let l=0;for(let e of a){let t=e[0].length;for(let n=1;n<e.length;n++)t=Math.min(t,e[n].length);if(l+=t,l>Math.min(r.maxCandidateLength,r.maxCharacters)){let e=i.truncated?c().combination:void 0;if(!e)return{candidates:[],truncated:!0,attempts:0,scans:o};let t=Oo(r),n={remaining:r.maxAttempts};return ko(t,n,0)&&Fo(t,e),{candidates:[...t.candidates],truncated:!0,attempts:r.maxAttempts-n.remaining,scans:o}}}let u=1,d=0,f=i.truncated;for(let e of a){if(f)continue;let t=0;for(let n of e)if(t+=n.length,t>r.maxCharacters)break;let n=d*e.length,i=u*t;u>r.maxCandidates/e.length||u>r.maxAttempts/e.length||n>r.maxCharacters||i>r.maxCharacters-n?f=!0:(u*=e.length,d=n+i)}let p={remaining:r.maxAttempts};if(!f){let e=Oo(r);return Po(e,a,u,p),{candidates:[...e.candidates],truncated:!1,attempts:r.maxAttempts-p.remaining,scans:o}}let m=Oo(r),h=a.map(e=>e[0]),g=a.flatMap((e,t)=>e.length>1?[t]:[]),_=c().combination;_&&ko(m,p,0)&&Fo(m,_),ko(m,p,0)&&Fo(m,h);let v=Math.min(ca,Math.max(0,p.remaining));return e.length&&v>da/e.length?{candidates:[...m.candidates],truncated:!0,attempts:r.maxAttempts-p.remaining,scans:o}:(Ao(m,a,h,g,p),Mo(m,a,h,g,p),jo(m,a,h,g,p),No(m,a,h,g,p),Po(m,a,r.maxAttempts,p,!0),{candidates:[...m.candidates],truncated:!0,attempts:r.maxAttempts-p.remaining,scans:o})}function To(e,t,n){if(!t||e.some(e=>!e.length))return;let r=t!==t.toLowerCase(),i=Ga(t,r);if(!i||i.length>n.maxCandidateLength)return;let a=Math.min(n.maxCandidateLength,n.maxCharacters),o=Array.from({length:e.length+1},()=>0);for(let t=e.length-1;t>=0;t--){let n=e[t][0].length;for(let r=1;r<e[t].length;r++)n=Math.min(n,e[t][r].length);o[t]=o[t+1]+n}if(o[0]>a)return;let s=[],c=0,l=0;for(let t=0;t<e.length;t++){let n,u=l;for(let s of e[t]){if(c+s.length+o[t+1]>a)continue;let e=Do(i,l,Ga(s,r)),d=e>l,f=u>l;(n===void 0||d&&!f||d===f&&(s.length<n.length||s.length===n.length&&e>u))&&(n=s,u=e)}if(n===void 0)return;s.push(n),c+=n.length,l=u}if(l<i.length)return;let u=s.join(``);if(za(i,Ga(u,r),u,0))return s}function Eo(e,t,n,r){let i=oo(r),a=e=>({combination:e,scans:i.initial-i.remaining});if(!t)return a();let o=t!==t.toLowerCase(),s=Ga(t,o);if(!s||s.length>n.maxCandidateLength)return a();let c=Math.min(n.maxCandidateLength,n.maxCharacters),l=[{characters:0,choice:``,matched:0}],u=0,d=0;for(let t of e){let e=new Map,n=new Set;for(let r of bo(t,c,i)){if(n.has(r))continue;n.add(r);let t={normalized:Ga(r,o),raw:r};for(let n of l){if(d++,u+=t.normalized.length,d>ca||u>da)return a();let r=n.characters+t.raw.length;if(r>c)continue;let i=Do(s,n.matched,t.normalized),o=e.get(i);o&&o.characters<=r||e.set(i,{characters:r,choice:t.raw,matched:i,previous:n})}}if(!e.size)return a();let r=1/0;l=[...e.values()].sort((e,t)=>t.matched-e.matched||e.characters-t.characters).filter(e=>e.characters>=r?!1:(r=e.characters,!0))}let f=l.find(e=>e.matched===s.length);if(!f)return a();let p=Array.from({length:e.length},()=>``),m=f;for(let t=e.length-1;t>=0;t--)p[t]=m.choice,m=m.previous;let h=p.join(``);return za(s,Ga(h,o),h,0)?a(p):a()}function Do(e,t,n){for(let r=0;r<n.length&&t<e.length;r++)n[r]===e[t]&&t++;return t}function Oo(e){return{candidates:new Set,characters:0,maxCandidateLength:e.maxCandidateLength,maxCandidates:e.maxCandidates,maxCharacters:e.maxCharacters}}function ko(e,t,n){return n>=ca||t.remaining<=0||e.candidates.size>=e.maxCandidates||e.characters>=e.maxCharacters?!1:(t.remaining--,!0)}function Ao(e,t,n,r,i){let a=0;for(let o of r){if(!ko(e,i,a))return;a++;let r=n.slice();r[o]=t[o].at(-1),Fo(e,r)}}function jo(e,t,n,r,i){let a=0;for(let o=0;o<r.length;o++)for(let s=o+1;s<r.length;s++){if(!ko(e,i,a))return;a++;let c=r[o],l=r[s],u=n.slice();u[c]=t[c].at(-1),u[l]=t[l].at(-1),Fo(e,u)}}function Mo(e,t,n,r,i){let a=0;for(let o of r)for(let r=1;r<t[o].length-1;r++){if(!ko(e,i,a))return;a++;let s=n.slice();s[o]=t[o][r],Fo(e,s)}}function No(e,t,n,r,i){let a=0;for(let o=0;o<r.length;o++)for(let s=o+1;s<r.length;s++){let c=r[o],l=r[s];for(let r=1;r<t[c].length;r++)for(let o=1;o<t[l].length;o++){if(r===t[c].length-1&&o===t[l].length-1)continue;if(!ko(e,i,a))return;a++;let s=n.slice();s[c]=t[c][r],s[l]=t[l][o],Fo(e,s)}}}function Po(e,t,n,r,i=!1){if(!t.length){ko(e,r,0)&&Fo(e,[``]);return}let a=t.map(()=>0),o=t.flatMap((e,t)=>e.length>1?[t]:[]),s=()=>{let e=o.length-1;for(;e>=0;){let n=o[e];if(a[n]++,a[n]<t[n].length)return!0;a[n]=0,e--}return!1};if(i&&!s())return;let c=Math.min(n,ca);for(let n=0;n<c;n++){if(!ko(e,r,n))return;if(Fo(e,t.map((e,t)=>e[a[t]])),!s())break}}function Fo(e,t){let n=e.maxCharacters-e.characters,r=0;for(let i of t)if(r+=i.length,r>Math.min(e.maxCandidateLength,n))return;let i=t.join(``);e.candidates.has(i)||e.candidates.size===e.maxCandidates||e.characters+i.length>e.maxCharacters||(e.candidates.add(i),e.characters+=i.length)}function Io(e,t,n=!0){let r=t,i=t,a=/[^\s>"'`;]/;for(;r&&a.test(e.charAt(r-1));)--r;for(;i<e.length&&a.test(e.charAt(i));)++i;if(n)return{content:e.slice(r,i),start:r,end:i};let o=Go(e,t),s=o?.key.toLowerCase();if(o&&(s?.endsWith(`class`)||s?.endsWith(`classname`)))return r=Math.max(r,o.valueStart),{content:e.slice(r,i),start:r,end:i};let c=e.slice(0,r).trimEnd();if(/(?:^|[\s;{])@apply$/.test(c))return{content:e.slice(r,i),start:r,end:i}}const Lo=new Set(`a abbr address area article aside audio b base bdi bdo blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins kbd label legend li link main map mark menu meta meter nav noscript object ol optgroup option output p picture pre progress q rp rt ruby s samp script search section select slot small source span strong style sub summary sup table tbody td template textarea tfoot th thead time title tr track u ul var video wbr svg`.split(` `)),Ro=new Set(`=([{,:;!?&|>~`);function zo(e){return e>=65&&e<=90||e>=97&&e<=122}function Bo(e){return zo(e)||e===95}function Vo(e){return Bo(e)||e>=48&&e<=57||e===36||e===45||e===46||e===58}function Ho(e,t,n){let r=t-n.length;return r<0||e.slice(r,t)!==n?!1:r===0||!Vo(e.charCodeAt(r-1))}function Uo(e,t,n,r){if(Lo.has(n.toLowerCase())||n.includes(`-`)||r&&n.charCodeAt(0)>=65&&n.charCodeAt(0)<=90)return!0;let i=t-1;for(;i>=0&&/\s/.test(e.charAt(i));)i--;return i<0||Ro.has(e.charAt(i))?!0:Ho(e,i+1,`return`)}function Wo(e){let t,n=!1,r,i=0,a=0;for(;a<e.length;){if(t){let o=e.charAt(a);r?o===`\\`?a++:o===r&&(r=void 0):o===`"`||o===`'`?r=o:o===`{`?i++:o===`}`?i>0&&i--:o===`>`&&i===0&&(t=void 0,n=!0),a++;continue}if(e.charAt(a)===`;`&&(n=!1),e.charCodeAt(a)!==60){a++;continue}let o=a++;if(!Bo(e.charCodeAt(a)))continue;let s=a;for(;a<e.length&&Vo(e.charCodeAt(a));)a++;if(a<e.length&&!/[\s/>]/.test(e.charAt(a)))continue;let c=e.slice(s,a);Uo(e,o,c,n)&&(t={name:c,start:o},i=0)}return t}function Go(e,t){let n=e.substring(0,t),r=Wo(n);if(!r)return;let i=r.start+1,a=n.slice(i),o=-1,s=-1,c=-1,l=-1,u=-1,d=-1,f;for(let e=0;e<a.length;e++){let t=a.charAt(e);if(f){t===`\\`?e++:t===f&&(f=void 0);continue}if(t===`"`||t===`'`){f=t,o<0&&(o=e);continue}if(/\s/.test(t)){o>=0&&(s=o,c=e,o=-1);continue}if(t===`=`){let t=o>=0?o:s,n=o>=0?e:c;t>=0&&n>t&&t>=l&&(l=t,u=n,d=e)}o<0&&(o=e)}if(l<0)return;let p=d+1;for(;/\s/.test(a.charAt(p));)p++;let m=a.charAt(p);if(m===`"`||m===`'`){p++;for(let e=p;e<a.length;e++){let t=a.charAt(e);if(t===`\\`)e++;else if(t===m)return}}else if(/[\s>]/.test(a.slice(p)))return;return{key:a.slice(l,u),valueStart:i+p}}function Ko(e,t){return Go(e,t)?.key}function qo(e,t){return Go(e,t)}const X=1e3,Jo=6e5,Yo=5e7,Xo=6e4,Zo=3e5,Qo=5e4,$o=2e5,es=5e3,Z={...ma,maxAttempts:15e3,maxCandidates:15e3,maxCharacters:6e5,maxScans:3e5};function ts(){return{active:0,waiters:[]}}function ns(e){return e>=48&&e<=57}function rs(e){for(let t=0;t<e.length;t++)if(ns(e.charCodeAt(t)))return!0;return!1}function is(e,t){let n=0,r=0;for(;n<e.length&&r<t.length;){let i=e.charCodeAt(n),a=t.charCodeAt(r),o=ns(i),s=ns(a);if(o&&s){let i=n+1,a=r+1;for(;i<e.length&&ns(e.charCodeAt(i));)i++;for(;a<t.length&&ns(t.charCodeAt(a));)a++;let o=n,s=r;for(;o<i-1&&e.charCodeAt(o)===48;)o++;for(;s<a-1&&t.charCodeAt(s)===48;)s++;let c=i-o,l=a-s;if(c!==l)return c<l?-1:1;for(;o<i;){let n=e.charCodeAt(o)-t.charCodeAt(s);if(n)return n<0?-1:1;o++,s++}n=i,r=a;continue}if(i!==a)return i<a?-1:1;n++,r++}return n!==e.length||r!==t.length?n===e.length?-1:1:0}function as(e,t){let n=rs(e);return n===rs(t)?is(e,t)||(e===t?0:e<t?-1:1):n?1:-1}function os(e,t=Zo,n=Yo){return{attempts:0,heap:[],limit:e,maxAttempts:t,maxScannedCharacters:n,retained:new Set,scannedCharacters:0}}function ss(e){return e.attempts<e.maxAttempts&&e.scannedCharacters<e.maxScannedCharacters}function cs(e,t){return ss(e)?(e.attempts++,!t||e.retained.has(t)||t.length>Xo||t.length>e.maxScannedCharacters-e.scannedCharacters?!0:(e.scannedCharacters+=t.length,ls(e,t),!0)):!1}function ls(e,t){if(!(!t||e.retained.has(t)||t.length>Xo)){if(e.heap.length<e.limit){e.heap.push(t),e.retained.add(t),us(e.heap,e.heap.length-1);return}as(t,e.heap[0])>=0||(e.retained.delete(e.heap[0]),e.heap[0]=t,e.retained.add(t),ds(e.heap,0))}}function us(e,t){let n=t;for(;n>0;){let t=Math.floor((n-1)/2);if(as(e[t],e[n])>=0)return;[e[t],e[n]]=[e[n],e[t]],n=t}}function ds(e,t){let n=t;for(;;){let t=n*2+1;if(t>=e.length)return;let r=t+1,i=r<e.length&&as(e[r],e[t])>0?r:t;if(as(e[n],e[i])>=0)return;[e[n],e[i]]=[e[i],e[n]],n=i}}function fs(e){let t=[],n=0;for(let r of e.heap.sort(as))n+r.length>Jo||(t.push(r),n+=r.length);return t}function ps(e,t,n,r){return Math.floor((t+n)*e/r)-Math.floor(t*e/r)}function*ms(e){let t=e.filter(e=>e.length).map(e=>({index:0,source:e})),n=0;for(;t.length;){let e=t[n];yield e.source[e.index++],e.index===e.source.length?t.splice(n,1):n++,n===t.length&&(n=0)}}function*hs(e,t,n,r,i,a){for(;n.attempts<r&&n.characters<i;){let r=e.next();if(r.done)return;let o=r.value;n.attempts++,!(!o||t.has(o)||o.length>a||o.length>i-n.characters)&&(t.add(o),n.characters+=o.length,yield o)}}function gs(e){let t=``;for(let n of e.parts){if(n.type!==`static`)break;t+=n.value}return t}function _s(e,t){if(!t)return{priorityCount:0,templates:[...e]};let n=t.replace(/-/g,``),r=[],i=[];for(let a=0;a<e.length;a++){let o=e[a],s=gs(o),c=s.replace(/-/g,``),l=-1;s&&t.startsWith(s)?l=0:c&&n.startsWith(c)?l=1:s.startsWith(t)?l=2:c.startsWith(n)&&(l=3),l<0?i.push(o):r.push({category:l,index:a,parsed:o,prefixLength:l<2?l?c.length:s.length:0})}return r.sort((e,t)=>e.category-t.category||t.prefixLength-e.prefixLength||e.index-t.index),{priorityCount:r.length,templates:[...r.map(({parsed:e})=>e),...i]}}function vs(e,t){return e.length<=t?[...e]:t<=0?[]:t===1?[e[0]]:Array.from({length:t},(n,r)=>e[Math.floor(r*(e.length-1)/(t-1))])}async function ys(e,t,n){let r=Array(e.length),i=0,a=!1,o=Array.from({length:Math.min(t,e.length)},async()=>{for(;!a&&i<e.length;){let t=i++;try{r[t]=await n(e[t])}catch(e){throw a=!0,e}}});return await Promise.all(o),r}function bs(e,t=X){let n=os(t);for(let t of e)if(!cs(n,t))break;return fs(n)}function xs(e,t){let n=[],r=new Set,i=0,a=0;for(let o of e)if(o.startsWith(t)){if(i===Zo||n.length===X||a>=Jo)break;i++,!(!o||r.has(o)||o.length>Xo||a+o.length>Jo)&&(r.add(o),n.push(o),a+=o.length)}return n}function Ss(e,t={}){let n=new Map,r=new ia({max:es,maxSize:32e6,sizeCalculation:(e,t)=>Math.max(1,t.length*2+e.reduce((e,t)=>e+t.length*2+8,0))}),i=new Map,a=e.config,o=0,s=[],c,l,u=[],d=0,f=new Set,p=new Set,m=[],h=new Map,g=new Set,_=ts(),{matchType:v=`prefix`,throwErrors:y=!0}=t;return ee(),{suggest:S,suggestInFile:w,templates:m,cache:r,errorCache:i,reset:ee,enumerate:b};async function b(){let e=Array.from(`abcdefghijklmnopqrstuvwxyz`),t=[...e,`-`],n=e.flatMap(e=>[e,...t.map(t=>`${e}${t}`)]);for(;;){B();let e=a,t=o,r=new Set;if(await x(n,r,e,t,e=>e)&&await x([...r].filter(e=>/^\w+$/.test(e)&&e.length>3),r,e,t,e=>`${e}-`))return r}}async function x(e,t,n,r,i){for(let a=0;a<e.length;a+=128){let o=await H(Promise.all(e.slice(a,a+128).map(e=>S(i(e)))),n,r);if(o.stale)return!1;for(let e of o.value)for(let n of e)t.add(n)}return!0}async function S(e,t=!1){if(B(),!t&&e.length<1)return[];if(r.has(e))return r.get(e);let n=h.get(e);if(n)return n;let i=C(e,t);h.set(e,i);try{return await i}finally{h.get(e)===i&&h.delete(e)}}async function C(t,n){for(;;){B();let i=a,s=o;if(!n&&t.length<1)return[];if(r.has(t))return r.get(t);let c=i.presets.find(e=>e.name===`@teacss/preset-attributify`)?.options?.prefix,l=c?t.startsWith(c)?t.slice(c.length):t.replace(`:${c}`,`:`):t,u=await H(e.matchVariants(l),i,s);if(u.stale)continue;let d=await H(Promise.all(u.value.map(async([,e])=>{if(!e&&l)return[];let n=e?t.indexOf(e):t.length;n===-1&&(n=0);let r=t.slice(0,n),a=t.slice(n+e.length),o=v===`fuzzy`?[E(e,i,s),k(e,i,s),O(e),D(e)]:[E(e,i,s),D(e),O(e),k(e,i,s)];return U(await Promise.all(o),r,a)})),i,s);if(d.stale)continue;let f=d.value.flat();if(f=v===`fuzzy`?F(Ia(f,t,{maxCandidates:Z.maxCandidates,maxCharacters:Z.maxCharacters}),t):bs(f),!V(i,s))return r.set(t,f),f}}async function w(e,t){B();let n=a,r=o,i=Ko(e,t)!==void 0,s=await H(T(e,t,n),n,r);if(s.stale)return w(e,t);let c=s.value;if(c){let a=await S(c.extracted,i);if(V(n,r))return w(e,t);let o=c.transformSuggestions?c.transformSuggestions(a):a;return{suggestions:a.map((e,t)=>[e,o[t]]),resolveReplacement:c.resolveReplacement}}let l=Io(e,t,n.presets.some(e=>e.name===`@teacss/preset-attributify`));if(!l)return;let u=await S(l.content,i);return V(n,r)?w(e,t):{suggestions:u.map(e=>[e,e]),resolveReplacement:e=>({start:l.start,end:l.end,replacement:e})}}async function T(e,t,n){if(!n.autocomplete.extractors.length)return null;for(let r of n.autocomplete.extractors){let n=await r.extract({content:e,cursor:t});if(n)return n}return null}async function E(t,n,r){let i=await e.parseToken(t,`-`);return i&&!V(n,r)&&(p.delete(t),p.add(t),p.size>es&&p.delete(p.values().next().value)),i?[t]:[]}async function D(e){if(v===`fuzzy`){let t=I(),n=F(u,e,t,d),r=Ia(L(),e,{maxAttempts:Zo,maxCandidates:750,maxCharacters:6e4});return Ia([...n,...r],e,{maxCandidates:X,maxCharacters:Z.maxCharacters})}return c??=[...s].sort(as),xs(c,e)}async function O(t){return bs(n());function*n(){for(let e of p)e.startsWith(t)&&(yield e);for(let[n,r]of e.cache){if(!r)continue;let e=n.replace(/ -$/,``);e.startsWith(t)&&(yield e)}}}async function k(e,t,n){let r=m.filter(e=>typeof e==`function`);if(v!==`fuzzy`){let i=R(e),a=await A(r,e,t,n);return[...i,...a]}let i=z(e),a=await j(r,e,t,n);return[...i,...a]}async function A(e,t,n,r){if(!e.length)return[];let i=os(X),a=os(X);for(let o=0;o<e.length;o+=8){let s=await ys(e.slice(o,o+8),8,e=>M(e,t,n,r));if(V(n,r))return[];let c=ps(Zo,o,s.length,e.length),l=ps(Yo,o,s.length,e.length),u=os(X,c,l),d=ms(s.filter(e=>!!e?.length));for(;ss(u);){let e=d.next();if(e.done)break;cs(u,e.value)}for(let e of fs(u))ls(i,e);let f=os(X,c,l);for(;ss(f);){let e=d.next();if(e.done)break;cs(f,e.value)}for(let e of fs(f))ls(i,e);for(;ss(a);){let e=d.next();if(e.done)break;cs(a,e.value)}}for(let e of fs(a))ls(i,e);return fs(i)}async function j(e,t,n,r){if(!e.length)return[];let i=[],a=new Set,o={attempts:0,characters:0};for(let s=0;s<e.length;s+=32){let c=await ys(e.slice(s,s+32),32,e=>M(e,t,n,r));if(V(n,r))return[];let l=ms(c.filter(e=>!!e?.length)),u=ps(Zo,s,c.length,e.length),d=ps(ma.maxScannedCharacters,s,c.length,e.length),f=Ia(l,t,{maxAttempts:u,maxCandidates:X,maxCharacters:Z.maxCharacters,maxScannedCharacters:d});i=Ia([...i,...f],t,{maxAttempts:i.length+f.length,maxCandidates:X,maxCharacters:Z.maxCharacters});let p=Ia(hs(l,a,{attempts:0,characters:0},u,d,ma.maxCandidateLength),t,{maxAttempts:u,maxCandidates:750,maxCharacters:Z.maxCharacters,maxScannedCharacters:d});i=Ia([...i,...p],t,{maxAttempts:i.length+p.length,maxCandidates:X,maxCharacters:Z.maxCharacters});let m=Ia(hs(l,a,{attempts:0,characters:0},u,d,ma.maxCandidateLength),t,{maxAttempts:u,maxCandidates:750,maxCharacters:Z.maxCharacters,maxScannedCharacters:d});i=Ia([...i,...m],t,{maxAttempts:i.length+m.length,maxCandidates:X,maxCharacters:Z.maxCharacters});let h=Ia(hs(l,a,o,Zo,ma.maxScannedCharacters,ma.maxCandidateLength),t,{maxAttempts:Zo-o.attempts,maxCandidates:750,maxCharacters:Z.maxCharacters,maxScannedCharacters:ma.maxScannedCharacters-o.characters});i=Ia([...i,...h],t,{maxAttempts:i.length+h.length,maxCandidates:X,maxCharacters:Z.maxCharacters})}return i}async function M(e,t,n,r){let i=_;await N(i);try{if(V(n,r))return;try{return await e(t)}catch{return}}finally{P(i)}}async function N(e){if(e.active<128){e.active++;return}await new Promise(t=>e.waiters.push(t))}function P(e){let t=e.waiters.shift();t?t():e.active--}function F(e,t,n,r){return Ra(t,r??e.reduce((e,t)=>e+t.length,0))?Ia(e,t,{maxCandidates:X,maxCharacters:Z.maxCharacters}):(n??new Ki(e,{fuzzy:`v1`,limit:X,tiebreakers:[Gi,Wi]})).find(t).map(e=>e.item)}function I(){if(l)return l;let e=new Set,t=0,n=0,r=n=>!n||e.has(n)||n.length>Z.maxCandidateLength||e.size===Z.maxCandidates||t+n.length>Z.maxCharacters?!1:(e.add(n),t+=n.length,!0),i=0;for(;i<s.length&&n<Z.maxAttempts&&e.size<Z.maxCandidates&&t<Z.maxCharacters;){let e=s[i++];n++,r(e)&&f.add(e)}return u=[...e],d=t,l=new Ki(u,{fuzzy:`v1`,limit:X,tiebreakers:[Gi,Wi]}),l}function*L(){for(let e of s)f.has(e)||(yield e)}function R(e){let t=os(X),r=0,i=0,a=0,o=_s([...n.values()],e).templates.slice(0,Qo);for(let n=0;n<o.length;n++){let s=Zo-r,c=Yo-i,l=$o-a;if(c<=0||s<=0||l<=0||!ss(t))break;let u=o.length-n,d=Math.max(1,Math.floor(s/u)),f=ba(o[n],e,{maxAttempts:d,maxCandidateLength:Xo,maxCandidates:d,maxCharacters:Math.max(1,Math.floor(c/u)),maxScans:Math.max(1,Math.floor(l/u))});r+=f.attempts,i+=f.characters,a+=f.scans;for(let e of f.suggestions)if(!cs(t,e))break}return fs(t)}function z(e){let t=[],r=new Set,i=0,a=0,o=0,s=0,c=_s([...n.values()],e).templates.slice(0,Qo),l=e=>{!e||r.has(e)||e.length>ma.maxCandidateLength||o>=Z.maxCandidates||i+e.length>Z.maxCharacters||(r.add(e),t.push(e),o++,i+=e.length)},u=0;for(let t of Ia(f(),e,{maxAttempts:Qo,maxCandidates:750,maxCharacters:Z.maxCharacters}))l(t);let d=vs(c,Math.max(1,Math.floor(Math.min(Z.maxAttempts,Z.maxCandidates-o)/2)));for(let t=0;t<d.length;t++){let n=Z.maxAttempts-a,r=Z.maxCandidates-o,c=Z.maxCharacters-i,u=Z.maxScans-s;if(n<=0||r<=0||c<=0||u<=0)break;let f=d.length-t,p={maxAttempts:Math.max(2,Math.floor(n/f)),maxCandidates:Math.max(2,Math.floor(r/f)),maxCharacters:Math.max(1,Math.floor(c/f)),maxScans:Math.max(1,Math.floor(u/f))},m;if(e.length<=1){let n=ba(d[t],e,p);m=n.suggestions,a+=n.attempts,s+=n.scans}else{let n=wo(d[t].parts,p,e);m=n.candidates,a+=n.attempts,s+=n.scans}for(let e of m)l(e)}return Ia(t,e,{maxAttempts:Z.maxAttempts,maxCandidates:750,maxCharacters:Z.maxCharacters});function*f(){for(let t=0;t<c.length;t++){let n=$o-u;if(n<=0)return;let r=c.length-t,i=(e.length<=1?ba:ya)(c[t],e,{maxAttempts:1,maxCandidates:1,maxCharacters:ma.maxCandidateLength,maxScans:Math.max(1,Math.floor(n/r))});u+=i.scans,yield*i.suggestions}}}function ee(){let t=e.config,v=[...Object.keys(t.rulesStaticMap),...t.shortcuts.filter(e=>typeof e[0]==`string`).map(e=>e[0])],b=[...t.autocomplete.templates||[],...t.rulesDynamic.flatMap(e=>le(e?.[2]?.autocomplete||[])),...t.shortcuts.flatMap(e=>le(e?.[2]?.autocomplete||[])),...t.variants.flatMap(e=>le(e.autocomplete||[]))],x=new Map,S=new Map;for(let e of b)if(typeof e!=`function`){if(x.has(e)||S.has(e))continue;let n=Aa(e,t.theme,t.autocomplete.shorthands);n.errors.length&&S.set(e,n.errors),x.set(e,n)}if(S.size&&y){i.clear();for(let[e,t]of S)i.set(e,t);let e=Array.from(S.values()).flat().map(e=>e.toString()).join(`
28
+ `);throw Error(e)}o++;for(let e of[...g])e();a=t,s=v,c=void 0,m.length=0,m.push(...b),n.clear();for(let[e,t]of x)n.set(e,t);r.clear(),h.clear(),_=ts(),i.clear();for(let[e,t]of S)i.set(e,t);l=void 0,u=[],d=0,f.clear(),p.clear()}function B(){a!==e.config&&ee()}function V(t,n){return t!==e.config||n!==o}function H(t,n,r){return new Promise((i,a)=>{let o=!1,s=e=>{o||(o=!0,l(),g.delete(c),i(e))},c=()=>s({stale:!0}),l=e.events.on(`config`,e=>{e!==n&&c()});g.add(c),Promise.resolve(t).then(e=>s({stale:!1,value:e}),e=>{o||(o=!0,l(),g.delete(c),a(e))}),V(n,r)&&c()})}function U(t,n=``,r=``){let i=ue(t.flat()).filter(t=>!!(t&&!t.endsWith(`-`)&&!e.isBlocked(t)&&!e.isBlocked(n+t+r)));v!==`fuzzy`&&i.sort(as);let a=i.map(e=>n+e+r);return v===`fuzzy`?a:bs(a)}}function Cs(e){try{return x(e)}catch{try{let t=new URL(e);return t.protocol===`file:`?e:decodeURIComponent(t.pathname.replace(/^\/([a-z]:)/i,`$1`))}catch{return e}}}const ws=/<style[^>]*>[\s\S]*?(?:<\/style>|<\/>|$)/g,Ts=/(?:<\/style>|<\/>)$/,Es=/<template\b[^>]*\slang\s*=\s*(?:'pug'|"pug")[^>]*>/i;function Ds(e,t,n){let r=t.match(/\.(svelte|vue|astro|marko)$/);if(r&&Os(e,t)){let t=e.slice(0,n);if(/\.$/.test(t)||/\.\S+$/.test(t))return!0}if((r?[...e.matchAll(ws)].some(t=>{let r=t.index,i=r+t[0].length,a=i===e.length&&!Ts.test(t[0]);return n>r&&(n<i||a&&n===i)}):/\.(?:css|scss|sass|less|styl(?:us)?|pcss|postcss)$/i.test(t))||Ko(e,n)!==void 0)return!0;let i=e.slice(n).replace(/"[^"]*"|\{[^}]*\}|'[^']*'/g,``);return/^[^<>]*>/.test(i)}function Os(e,t){return t.endsWith(`.vue`)&&Es.test(e)}function ks(e,t){let n=d.relative(e,t);return n!==``&&n!==`..`&&!n.startsWith(`..${d.sep}`)&&!d.isAbsolute(n)}const As={log(){},warn(){}},js=/[\\/](?:node_modules|dist|\.temp|\.cache)[\\/]/;var Ms=class{cwd;logger;ready;contextsMap=new Map;configSources=[];fileContextCache=new Map;configExistsCache=new Map;loadingContexts=new Map;contextLoadVersions=new Map;contextReloadDisposers=new Map;failedConfigSources=new Map;discoveredConfigs=new Set;yarnPnpSetupFailures=new Set;lifecycleVersion=0;workspaceRoots;events=Jn();constructor(e,t=As,n=[e]){this.cwd=e,this.logger=t,this.workspaceRoots=Array.from(new Set(n.length?n:[e])),this.ready=this.reload()}log(e){this.logger.log(e)}warn(e){this.logger.warn(e)}isTarget(e){return Array.from(this.contextsMap.keys()).some(t=>ks(t,e))}get contexts(){return Array.from(new Set(this.contextsMap.values())).filter(Qn)}async setRoots(e){let t=Array.from(new Set(e)),n=Array.from(this.contextsMap.keys()),r=this.workspaceRoots.length===t.length&&t.every(e=>this.workspaceRoots.includes(e)),i=n.length===t.length&&t.every(e=>n.includes(e));if(r&&i)return;let a=++this.lifecycleVersion;this.workspaceRoots=t;for(let e of n)t.includes(e)||this.removeContext(e,`contextUnload`,!0);a===this.lifecycleVersion&&(this.resetCaches(),await this.loadRoots(t.filter(e=>!n.includes(e)),a),a===this.lifecycleVersion&&this.events.emit(`reload`))}async reload(){let e=++this.lifecycleVersion,t=Array.from(this.contextsMap.keys()),n=t.length?t:this.workspaceRoots;for(let e of t)this.removeContext(e,`contextUnload`,!1);e===this.lifecycleVersion&&(this.resetCaches(),await this.loadRoots(n,e),e===this.lifecycleVersion&&this.events.emit(`reload`))}async unloadContext(e){this.removeContext(e,`contextUnload`,!0)}async unload(e){this.removeContext(e,`unload`,!0)}removeContext(e,t,n){n&&(this.contextLoadVersions.set(e,(this.contextLoadVersions.get(e)??0)+1),this.loadingContexts.delete(e));let r=this.contextsMap.get(e);r!==void 0&&(this.contextsMap.delete(e),this.failedConfigSources.delete(e),this.syncConfigSources(),r&&(this.disposeContextReload(r),this.clearFileContextCache(r),this.events.emit(t,r),t===`contextUnload`&&this.events.emit(`reload`)))}syncConfigSources(){let e=this.contexts.flatMap(e=>e.getConfigFileList()),t=Array.from(this.failedConfigSources.values()).flat(),n=Array.from(new Set([...e,...t]));this.configSources.splice(0,this.configSources.length,...n)}clearFileContextCache(e){for(let[t,n]of this.fileContextCache)n===e&&this.fileContextCache.delete(t)}resetCaches(){this.fileContextCache.clear(),this.configExistsCache.clear()}releaseDocument(e){this.fileContextCache.delete(e),this.invalidateConfigSearchPath(e)}invalidateConfigSearchPath(e){let t=d.dirname(e),n=this.getWorkspaceBoundary(t);if(n)for(;t===n||ks(n,t);){if(this.configExistsCache.delete(t),t===n)return;t=d.dirname(t)}}async loadRoots(e,t){let n=e.map(e=>({dir:e,loadVersion:this.contextLoadVersions.get(e)??0}));await Promise.all(n.map(async({dir:e,loadVersion:n})=>{try{await this.loadContextInDirectoryWithVersion(e,t,n)}catch(n){if(t!==this.lifecycleVersion)return;this.warn(`⚠️ Failed to reload context for ${e}: ${String(n.stack??n)}`)}}))}async loadContextInDirectory(e){return this.loadContextInDirectoryWithVersion(e,void 0,this.contextLoadVersions.get(e)??0)}async loadContextInDirectoryWithVersion(e,t,n){if(!this.isLoadCurrent(e,t,n))return;let r=this.contextsMap.get(e);if(r!==void 0)return r;let i=this.loadingContexts.get(e);if(i&&i.lifecycleVersion===t&&i.loadVersion===n)return i.promise;let a=this.loadContext(e,t,n);this.loadingContexts.set(e,{lifecycleVersion:t,loadVersion:n,promise:a});try{return await a}finally{this.loadingContexts.get(e)?.promise===a&&this.loadingContexts.delete(e)}}async loadContext(e,t,n){this.setupYarnPnp(e),this.discoveredConfigs.has(e)||this.log(`🛠 Resolving config for ${e}`);let r=y(e,{},e=>{e.config.details=!0}),i=[];try{i=(await r.updateRoot(e)).sources}catch(i){return this.isLoadCurrent(e,t,n)?(this.warn(`⚠️ Error on loading config. Config directory: ${e}`),this.warn(String(i.stack??i)),this.failedConfigSources.set(e,r.getConfigFileList()),this.finishLoading(e,null,t,n)):void 0}if(!this.isLoadCurrent(e,t,n))return;if(this.failedConfigSources.delete(e),!i.length)return this.log(`ℹ️ No config sources found in ${e}`),this.finishLoading(e,null,t,n);if(await r.ready,!this.isLoadCurrent(e,t,n))return;this.setupContextReload(r),this.logConfigInfo(i,r.generator);let a=this.finishLoading(e,r,t,n);return this.events.emit(`contextLoaded`,r),a}setupYarnPnp(e){for(let t of[`.pnp.js`,`.pnp.cjs`]){let n=d.join(e,t);if(u(n))try{ce(n).setup(),this.yarnPnpSetupFailures.delete(n)}catch(e){if(this.yarnPnpSetupFailures.has(n))continue;this.yarnPnpSetupFailures.add(n);let t=e instanceof Error?e.message:String(e);this.warn(`⚠️ Failed to setup Yarn PnP from ${n}: ${t}`)}}}setupContextReload(e){this.disposeContextReload(e);let t=e.onReload(()=>{for(let[t,n]of this.fileContextCache)(n===e||!n)&&this.fileContextCache.delete(t);this.configExistsCache.clear(),this.syncConfigSources(),this.events.emit(`contextReload`,e)});this.contextReloadDisposers.set(e,t);for(let[e,t]of this.fileContextCache)t||this.fileContextCache.delete(e)}disposeContextReload(e){this.contextReloadDisposers.get(e)?.(),this.contextReloadDisposers.delete(e)}isLoadCurrent(e,t,n){return(t===void 0||t===this.lifecycleVersion)&&n===(this.contextLoadVersions.get(e)??0)}logConfigInfo(e,t){let n=e.length===1?e[0]:`\n${e.map(e=>` - ${e}`).join(`
29
+ `)}`;this.log(`🛠 New configuration loaded from ${n}`),this.log(`ℹ️ ${t.config.presets.length} presets, ${t.config.rulesSize} rules, ${t.config.shortcuts.length} shortcuts, ${t.config.variants.length} variants, ${t.config.transformers?.length||0} transformers loaded`)}finishLoading(e,t,n,r){if(!this.isLoadCurrent(e,n,r))return;this.contextsMap.has(e)||this.contextsMap.set(e,t),this.syncConfigSources(),this.fileContextCache.clear(),this.events.emit(`reload`);let i=Array.from(this.contextsMap.entries()).filter(([,e])=>e).map(([e])=>e).join(`, `)||`[none]`;return this.log(`🗂️ Enabled context: ${i}`),t}async resolveClosestContext(e,t){if(js.test(t))return;if(this.fileContextCache.has(t)){let e=this.fileContextCache.get(t);return Yr(this.fileContextCache,t,e,100),e}let n=await this.discoverAndLoadConfig(t);if(n)return n;let r=Array.from(this.contextsMap.entries()).sort((e,t)=>t[0].length-e[0].length);for(let[n,i]of r)if(!(!i||!ks(n,t))&&(i.filter(e,t)||fn(t)))return Yr(this.fileContextCache,t,i,100),i;for(let[e,n]of r)if(n&&ks(e,t))return Yr(this.fileContextCache,t,n,100),n}async discoverAndLoadConfig(e){let t=this.lifecycleVersion,n=await this.findConfigDirectory(d.dirname(e),t);if(t!==this.lifecycleVersion||!n||this.contextsMap.has(n))return;this.discoveredConfigs.has(n)||(this.log(`🔍 Discovered config in ${n}`),this.discoveredConfigs.add(n));let r=this.contextLoadVersions.get(n)??0;if(await this.loadContextInDirectoryWithVersion(n,t,r),!this.isLoadCurrent(n,t,r))return;let i=this.contextsMap.get(n);return i&&Yr(this.fileContextCache,e,i,100),i}async findConfigDirectory(e,t){let n=this.configExistsCache.get(e);if(n!==void 0)return Yr(this.configExistsCache,e,n,100),n||void 0;let r=this.getWorkspaceBoundary(e);if(!r)return;let i=d.parse(e).root,a=[],o=e;for(;o!==i&&(ks(r,o)||o===r);){a.push(o);let e=this.configExistsCache.get(o);if(e!==void 0)return Yr(this.configExistsCache,o,e,100),this.cacheSearchPath(a,e||!1),e||void 0;let n=await this.hasConfigFiles(o);if(t!==this.lifecycleVersion)return;if(n)return this.cacheSearchPath(a,o),o;o=d.dirname(o)}this.cacheSearchPath(a,!1)}getWorkspaceBoundary(e){return[...this.workspaceRoots,...this.contextsMap.keys()].filter(t=>t===e||ks(t,e)).sort((e,t)=>t.length-e.length)[0]}async hasConfigFiles(e){return!!g(e)}cacheSearchPath(e,t){for(let n of e)Yr(this.configExistsCache,n,t,100)}};const Ns=/^[A-Za-z]:\//;function Ps(e=``){return e&&e.replace(/\\/g,`/`).replace(Ns,e=>e.toUpperCase())}const Fs=/^[/\\]{2}/,Is=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,Ls=/^[A-Za-z]:$/,Rs=function(e){if(e.length===0)return`.`;e=Ps(e);let t=e.match(Fs),n=Us(e),r=e[e.length-1]===`/`;return e=Hs(e,!n),e.length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),Ls.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!Us(e)?`/${e}`:e)},zs=function(...e){let t=``;for(let n of e)if(n)if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;e&&r?t+=n.slice(1):t+=e||r?n:`/${n}`}else t+=n;return Rs(t)};function Bs(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const Vs=function(...e){e=e.map(e=>Ps(e));let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:Bs();!i||i.length===0||(t=`${i}/${t}`,n=Us(i))}return t=Hs(t,!n),n&&!Us(t)?`/${t}`:t.length>0?t:`.`};function Hs(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(i!==s-1&&a!==1)if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}const Us=function(e){return Is.test(e)};var Ws=K(((e,t)=>{let n=`[^\\\\/]`,r=`[^/]`,i=`(?:\\/|$)`,a=`(?:^|\\/)`,o=`\\.{1,2}${i}`,s={DOT_LITERAL:`\\.`,PLUS_LITERAL:`\\+`,QMARK_LITERAL:`\\?`,SLASH_LITERAL:`\\/`,ONE_CHAR:`(?=.)`,QMARK:r,END_ANCHOR:i,DOTS_SLASH:o,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!${a}${o})`,NO_DOT_SLASH:`(?!\\.{0,1}${i})`,NO_DOTS_SLASH:`(?!${o})`,QMARK_NO_DOT:`[^.\\/]`,STAR:`${r}*?`,START_ANCHOR:a,SEP:`/`},c={...s,SLASH_LITERAL:`[\\\\/]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`\\.{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!\\.)`,NO_DOTS:`(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!\\.{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!\\.{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:`[^.\\\\/]`,START_ANCHOR:`(?:^|[\\\\/])`,END_ANCHOR:`(?:[\\\\/]|$)`,SEP:`\\`};t.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:{__proto__:null,alnum:`a-zA-Z0-9`,alpha:`a-zA-Z`,ascii:`\\x00-\\x7F`,blank:` \\t`,cntrl:`\\x00-\\x1F\\x7F`,digit:`0-9`,graph:`\\x21-\\x7E`,lower:`a-z`,print:`\\x20-\\x7E `,punct:`\\-!"#$%&'()\\*+,./:;<=>?@[\\]^_\`{|}~`,space:` \\t\\r\\n\\v\\f`,upper:`A-Z`,word:`A-Za-z0-9_`,xdigit:`A-Fa-f0-9`},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":`*`,"**/**":`**`,"**/**/**":`**`},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(e){return{"!":{type:`negate`,open:`(?:(?!(?:`,close:`))${e.STAR})`},"?":{type:`qmark`,open:`(?:`,close:`)?`},"+":{type:`plus`,open:`(?:`,close:`)+`},"*":{type:`star`,open:`(?:`,close:`)*`},"@":{type:`at`,open:`(?:`,close:`)`}}},globChars(e){return e===!0?c:s}}})),Gs=K((e=>{let{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=Ws();e.isObject=e=>typeof e==`object`&&!!e&&!Array.isArray(e),e.hasRegexChars=e=>r.test(e),e.isRegexChar=t=>t.length===1&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(i,`\\$1`),e.toPosixSlashes=e=>e.replace(t,`/`),e.isWindows=()=>{if(typeof navigator<`u`&&navigator.platform){let e=navigator.platform.toLowerCase();return e===`win32`||e===`windows`}return typeof process<`u`&&process.platform?process.platform===`win32`:!1},e.removeBackslashes=e=>e.replace(n,e=>e===`\\`?``:e),e.escapeLast=(t,n,r)=>{let i=t.lastIndexOf(n,r);return i===-1?t:t[i-1]===`\\`?e.escapeLast(t,n,i-1):`${t.slice(0,i)}\\${t.slice(i)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith(`./`)&&(n=n.slice(2),t.prefix=`./`),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?``:`^`}(?:${e})${n.contains?``:`$`}`;return t.negated===!0&&(r=`(?:^(?!${r}).*$)`),r},e.basename=(e,{windows:t}={})=>{let n=e.split(t?/[\\/]/:`/`),r=n[n.length-1];return r===``?n[n.length-2]:r}})),Ks=K(((e,t)=>{let n=Gs(),{CHAR_ASTERISK:r,CHAR_AT:i,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:c,CHAR_FORWARD_SLASH:l,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:d,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_PLUS:p,CHAR_QUESTION_MARK:m,CHAR_RIGHT_CURLY_BRACE:h,CHAR_RIGHT_PARENTHESES:g,CHAR_RIGHT_SQUARE_BRACKET:_}=Ws(),v=e=>e===l||e===a,y=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let b=t||{},x=e.length-1,S=b.parts===!0||b.scanToEnd===!0,C=[],w=[],T=[],E=e,D=-1,O=0,k=0,A=!1,j=!1,M=!1,N=!1,P=!1,F=!1,I=!1,L=!1,R=!1,z=!1,ee=0,B,V,H={value:``,depth:0,isGlob:!1},U=()=>D>=x,te=()=>E.charCodeAt(D+1),W=()=>(B=V,E.charCodeAt(++D));for(;D<x;){V=W();let e;if(V===a){I=H.backslashes=!0,V=W(),V===u&&(F=!0);continue}if(F===!0||V===u){for(ee++;U()!==!0&&(V=W());){if(V===a){I=H.backslashes=!0,W();continue}if(V===u){ee++;continue}if(F!==!0&&V===s&&(V=W())===s){if(A=H.isBrace=!0,M=H.isGlob=!0,z=!0,S===!0)continue;break}if(F!==!0&&V===o){if(A=H.isBrace=!0,M=H.isGlob=!0,z=!0,S===!0)continue;break}if(V===h&&(ee--,ee===0)){F=!1,A=H.isBrace=!0,z=!0;break}}if(S===!0)continue;break}if(V===l){if(C.push(D),w.push(H),H={value:``,depth:0,isGlob:!1},z===!0)continue;if(B===s&&D===O+1){O+=2;continue}k=D+1;continue}if(b.noext!==!0&&(V===p||V===i||V===r||V===m||V===c)&&te()===d){if(M=H.isGlob=!0,N=H.isExtglob=!0,z=!0,V===c&&D===O&&(R=!0),S===!0){for(;U()!==!0&&(V=W());){if(V===a){I=H.backslashes=!0,V=W();continue}if(V===g){M=H.isGlob=!0,z=!0;break}}continue}break}if(V===r){if(B===r&&(P=H.isGlobstar=!0),M=H.isGlob=!0,z=!0,S===!0)continue;break}if(V===m){if(M=H.isGlob=!0,z=!0,S===!0)continue;break}if(V===f){for(;U()!==!0&&(e=W());){if(e===a){I=H.backslashes=!0,W();continue}if(e===_){j=H.isBracket=!0,M=H.isGlob=!0,z=!0;break}}if(S===!0)continue;break}if(b.nonegate!==!0&&V===c&&D===O){L=H.negated=!0,O++;continue}if(b.noparen!==!0&&V===d){if(M=H.isGlob=!0,S===!0){for(;U()!==!0&&(V=W());){if(V===d){I=H.backslashes=!0,V=W();continue}if(V===g){z=!0;break}}continue}break}if(M===!0){if(z=!0,S===!0)continue;break}}b.noext===!0&&(N=!1,M=!1);let G=E,ne=``,re=``;O>0&&(ne=E.slice(0,O),E=E.slice(O),k-=O),G&&M===!0&&k>0?(G=E.slice(0,k),re=E.slice(k)):M===!0?(G=``,re=E):G=E,G&&G!==``&&G!==`/`&&G!==E&&v(G.charCodeAt(G.length-1))&&(G=G.slice(0,-1)),b.unescape===!0&&(re&&=n.removeBackslashes(re),G&&I===!0&&(G=n.removeBackslashes(G)));let ie={prefix:ne,input:e,start:O,base:G,glob:re,isBrace:A,isBracket:j,isGlob:M,isExtglob:N,isGlobstar:P,negated:L,negatedExtglob:R};if(b.tokens===!0&&(ie.maxDepth=0,v(V)||w.push(H),ie.tokens=w),b.parts===!0||b.tokens===!0){let t;for(let n=0;n<C.length;n++){let r=t?t+1:O,i=C[n],a=e.slice(r,i);b.tokens&&(n===0&&O!==0?(w[n].isPrefix=!0,w[n].value=ne):w[n].value=a,y(w[n]),ie.maxDepth+=w[n].depth),(n!==0||a!==``)&&T.push(a),t=i}if(t&&t+1<e.length){let n=e.slice(t+1);T.push(n),b.tokens&&(w[w.length-1].value=n,y(w[w.length-1]),ie.maxDepth+=w[w.length-1].depth)}ie.slashes=C,ie.parts=T}return ie}})),qs=K(((e,t)=>{let n=Ws(),r=Gs(),{MAX_LENGTH:i,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:c}=n,l=(e,t)=>{if(typeof t.expandRange==`function`)return t.expandRange(...e,t);e.sort();let n=`[${e.join(`-`)}]`;try{new RegExp(n)}catch{return e.map(e=>r.escapeRegex(e)).join(`..`)}return n},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,d=e=>{let t=[],n=0,r=0,i=0,a=``,o=!1;for(let s of e){if(o===!0){a+=s,o=!1;continue}if(s===`\\`){a+=s,o=!0;continue}if(s===`"`){i=i===1?0:1,a+=s;continue}if(i===0){if(s===`[`)n++;else if(s===`]`&&n>0)n--;else if(n===0){if(s===`(`)r++;else if(s===`)`&&r>0)r--;else if(s===`|`&&r===0){t.push(a),a=``;continue}}}a+=s}return t.push(a),t},f=e=>{let t=!1;for(let n of e){if(t===!0){t=!1;continue}if(n===`\\`){t=!0;continue}if(/[?*+@!()[\]{}]/.test(n))return!1}return!0},p=e=>{let t=e.trim(),n=!0;for(;n===!0;)n=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),n=!0);if(f(t))return t.replace(/\\(.)/g,`$1`)},m=e=>{let t=e.map(p).filter(Boolean);for(let e=0;e<t.length;e++)for(let n=e+1;n<t.length;n++){let r=t[e],i=t[n],a=r[0];if(!(!a||r!==a.repeat(r.length)||i!==a.repeat(i.length))&&(r===i||r.startsWith(i)||i.startsWith(r)))return!0}return!1},h=(e,t=!0)=>{if(e[0]!==`+`&&e[0]!==`*`||e[1]!==`(`)return;let n=0,r=0,i=0,a=!1;for(let o=1;o<e.length;o++){let s=e[o];if(a===!0){a=!1;continue}if(s===`\\`){a=!0;continue}if(s===`"`){i=i===1?0:1;continue}if(i!==1){if(s===`[`){n++;continue}if(s===`]`&&n>0){n--;continue}if(!(n>0)){if(s===`(`){r++;continue}if(s===`)`&&(r--,r===0))return t===!0&&o!==e.length-1?void 0:{type:e[0],body:e.slice(2,o),end:o}}}}},g=e=>`${e.length===1?r.escapeRegex(e[0]):`[${e.map(e=>r.escapeRegex(e)).join(``)}]`}*`,_=e=>{let t=0,n=[];for(;t<e.length;){let r=h(e.slice(t),!1);if(!r||r.type!==`*`)return;let i=d(r.body).map(e=>e.trim());if(i.length!==1)return;let a=p(i[0]);if(!a||a.length!==1)return;n.push(a),t+=r.end+1}if(!(n.length<1))return n},v=e=>{let t=0,n=e.trim(),r=h(n);for(;r;)t++,n=r.body.trim(),r=h(n);return t},y=(e,t)=>{if(t.maxExtglobRecursion===!1)return{risky:!1};let r=typeof t.maxExtglobRecursion==`number`?t.maxExtglobRecursion:n.DEFAULT_MAX_EXTGLOB_RECURSION,i=d(e).map(e=>e.trim());if(i.length>1&&(i.some(e=>e===``)||i.some(e=>/^[*?]+$/.test(e))||m(i)))return{risky:!0};let a=[],o=!1,s=!0;for(let e of i){let t=_(e);if(t){o=!0,a.push(...t);continue}let n=p(e);if(n&&n.length===1){a.push(n);continue}if(s=!1,v(e)>r)return{risky:!0}}return o?s?{risky:!0,safeOutput:g([...new Set(a)])}:{risky:!0}:{risky:!1}},b=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);e=c[e]||e;let d={...t},f=typeof d.maxLength==`number`?Math.min(i,d.maxLength):i,p=e.length;if(p>f)throw SyntaxError(`Input length: ${p}, exceeds maximum allowed length: ${f}`);let m={type:`bos`,value:``,output:d.prepend||``},h=[m],g=d.capture?``:`?:`,_=n.globChars(d.windows),v=n.extglobChars(_),{DOT_LITERAL:x,PLUS_LITERAL:S,SLASH_LITERAL:C,ONE_CHAR:w,DOTS_SLASH:T,NO_DOT:E,NO_DOT_SLASH:D,NO_DOTS_SLASH:O,QMARK:k,QMARK_NO_DOT:A,STAR:j,START_ANCHOR:M}=_,N=e=>`(${g}(?:(?!${M}${e.dot?T:x}).)*?)`,P=d.dot?``:E,F=d.dot?k:A,I=d.bash===!0?N(d):j;d.capture&&(I=`(${I})`),typeof d.noext==`boolean`&&(d.noextglob=d.noext);let L={input:e,index:-1,start:0,dot:d.dot===!0,consumed:``,output:``,prefix:``,backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:h};e=r.removePrefix(e,L),p=e.length;let R=[],z=[],ee=[],B=m,V,H=()=>L.index===p-1,U=L.peek=(t=1)=>e[L.index+t],te=L.advance=()=>e[++L.index]||``,W=()=>e.slice(L.index+1),G=(e=``,t=0)=>{L.consumed+=e,L.index+=t},ne=e=>{L.output+=e.output==null?e.value:e.output,G(e.value)},re=()=>{let e=1;for(;U()===`!`&&(U(2)!==`(`||U(3)===`?`);)te(),L.start++,e++;return e%2==0?!1:(L.negated=!0,L.start++,!0)},ie=e=>{L[e]++,ee.push(e)},ae=e=>{L[e]--,ee.pop()},K=e=>{if(B.type===`globstar`){let t=L.braces>0&&(e.type===`comma`||e.type===`brace`),n=e.extglob===!0||R.length&&(e.type===`pipe`||e.type===`paren`);e.type!==`slash`&&e.type!==`paren`&&!t&&!n&&(L.output=L.output.slice(0,-B.output.length),B.type=`star`,B.value=`*`,B.output=I,L.output+=B.output)}if(R.length&&e.type!==`paren`&&(R[R.length-1].inner+=e.value),(e.value||e.output)&&ne(e),B&&B.type===`text`&&e.type===`text`){B.output=(B.output||B.value)+e.value,B.value+=e.value;return}e.prev=B,h.push(e),B=e},oe=(e,t)=>{let n={...v[t],conditions:1,inner:``};n.prev=B,n.parens=L.parens,n.output=L.output,n.startIndex=L.index,n.tokensIndex=h.length;let r=(d.capture?`(`:``)+n.open;ie(`parens`),K({type:e,value:t,output:L.output?``:w}),K({type:`paren`,extglob:!0,value:te(),output:r}),R.push(n)},se=n=>{let i=e.slice(n.startIndex,L.index+1),a=e.slice(n.startIndex+2,L.index),o=y(a,d);if((n.type===`plus`||n.type===`star`)&&o.risky){let e=o.safeOutput?(n.output?``:w)+(d.capture?`(${o.safeOutput})`:o.safeOutput):void 0,t=h[n.tokensIndex];t.type=`text`,t.value=i,t.output=e||r.escapeRegex(i);for(let e=n.tokensIndex+1;e<h.length;e++)h[e].value=``,h[e].output=``,delete h[e].suffix;L.output=n.output+t.output,L.backtrack=!0,K({type:`paren`,extglob:!0,value:V,output:``}),ae(`parens`);return}let s=n.close+(d.capture?`)`:``),c;if(n.type===`negate`){let e=I;n.inner&&n.inner.length>1&&n.inner.includes(`/`)&&(e=N(d)),(e!==I||H()||/^\)+$/.test(W()))&&(s=n.close=`)$))${e}`),n.inner.includes(`*`)&&(c=W())&&/^\.[^\\/.]+$/.test(c)&&(s=n.close=`)${b(c,{...t,fastpaths:!1}).output})${e})`),n.prev.type===`bos`&&(L.negatedExtglob=!0)}K({type:`paren`,extglob:!0,value:V,output:s}),ae(`parens`)};if(d.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let n=!1,i=e.replace(s,(e,t,r,i,a,o)=>i===`\\`?(n=!0,e):i===`?`?t?t+i+(a?k.repeat(a.length):``):o===0?F+(a?k.repeat(a.length):``):k.repeat(r.length):i===`.`?x.repeat(r.length):i===`*`?t?t+i+(a?I:``):I:t?e:`\\${e}`);return n===!0&&(i=d.unescape===!0?i.replace(/\\/g,``):i.replace(/\\+/g,e=>e.length%2==0?`\\\\`:e?`\\`:``)),i===e&&d.contains===!0?(L.output=e,L):(L.output=r.wrapOutput(i,L,t),L)}for(;!H();){if(V=te(),V===`\0`)continue;if(V===`\\`){let e=U();if(e===`/`&&d.bash!==!0||e===`.`||e===`;`)continue;if(!e){V+=`\\`,K({type:`text`,value:V});continue}let t=/^\\+/.exec(W()),n=0;if(t&&t[0].length>2&&(n=t[0].length,L.index+=n,n%2!=0&&(V+=`\\`)),d.unescape===!0?V=te():V+=te(),L.brackets===0){K({type:`text`,value:V});continue}}if(L.brackets>0&&(V!==`]`||B.value===`[`||B.value===`[^`)){if(d.posix!==!1&&V===`:`){let e=B.value.slice(1);if(e.includes(`[`)&&(B.posix=!0,e.includes(`:`))){let e=B.value.lastIndexOf(`[`),t=B.value.slice(0,e),n=B.value.slice(e+2),r=a[n];if(r){B.value=t+r,L.backtrack=!0,te(),!m.output&&h.indexOf(B)===1&&(m.output=w);continue}}}(V===`[`&&U()!==`:`||V===`-`&&U()===`]`)&&(V=`\\${V}`),V===`]`&&(B.value===`[`||B.value===`[^`)&&(V=`\\${V}`),d.posix===!0&&V===`!`&&B.value===`[`&&(V=`^`),B.value+=V,ne({value:V});continue}if(L.quotes===1&&V!==`"`){V=r.escapeRegex(V),B.value+=V,ne({value:V});continue}if(V===`"`){L.quotes=L.quotes===1?0:1,d.keepQuotes===!0&&K({type:`text`,value:V});continue}if(V===`(`){ie(`parens`),K({type:`paren`,value:V});continue}if(V===`)`){if(L.parens===0&&d.strictBrackets===!0)throw SyntaxError(u(`opening`,`(`));let e=R[R.length-1];if(e&&L.parens===e.parens+1){se(R.pop());continue}K({type:`paren`,value:V,output:L.parens?`)`:`\\)`}),ae(`parens`);continue}if(V===`[`){if(d.nobracket===!0||!W().includes(`]`)){if(d.nobracket!==!0&&d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));V=`\\${V}`}else ie(`brackets`);K({type:`bracket`,value:V});continue}if(V===`]`){if(d.nobracket===!0||B&&B.type===`bracket`&&B.value.length===1){K({type:`text`,value:V,output:`\\${V}`});continue}if(L.brackets===0){if(d.strictBrackets===!0)throw SyntaxError(u(`opening`,`[`));K({type:`text`,value:V,output:`\\${V}`});continue}ae(`brackets`);let e=B.value.slice(1);if(B.posix!==!0&&e[0]===`^`&&!e.includes(`/`)&&(V=`/${V}`),B.value+=V,ne({value:V}),d.literalBrackets===!1||r.hasRegexChars(e))continue;let t=r.escapeRegex(B.value);if(L.output=L.output.slice(0,-B.value.length),d.literalBrackets===!0){L.output+=t,B.value=t;continue}B.value=`(${g}${t}|${B.value})`,L.output+=B.value;continue}if(V===`{`&&d.nobrace!==!0){ie(`braces`);let e={type:`brace`,value:V,output:`(`,outputIndex:L.output.length,tokensIndex:L.tokens.length};z.push(e),K(e);continue}if(V===`}`){let e=z[z.length-1];if(d.nobrace===!0||!e){K({type:`text`,value:V,output:V});continue}let t=`)`;if(e.dots===!0){let e=h.slice(),n=[];for(let t=e.length-1;t>=0&&(h.pop(),e[t].type!==`brace`);t--)e[t].type!==`dots`&&n.unshift(e[t].value);t=l(n,d),L.backtrack=!0}if(e.comma!==!0&&e.dots!==!0){let n=L.output.slice(0,e.outputIndex),r=L.tokens.slice(e.tokensIndex);e.value=e.output=`\\{`,V=t=`\\}`,L.output=n;for(let e of r)L.output+=e.output||e.value}K({type:`brace`,value:V,output:t}),ae(`braces`),z.pop();continue}if(V===`|`){R.length>0&&R[R.length-1].conditions++,K({type:`text`,value:V});continue}if(V===`,`){let e=V,t=z[z.length-1];t&&ee[ee.length-1]===`braces`&&(t.comma=!0,e=`|`),K({type:`comma`,value:V,output:e});continue}if(V===`/`){if(B.type===`dot`&&L.index===L.start+1){L.start=L.index+1,L.consumed=``,L.output=``,h.pop(),B=m;continue}K({type:`slash`,value:V,output:C});continue}if(V===`.`){if(L.braces>0&&B.type===`dot`){B.value===`.`&&(B.output=x);let e=z[z.length-1];B.type=`dots`,B.output+=V,B.value+=V,e.dots=!0;continue}if(L.braces+L.parens===0&&B.type!==`bos`&&B.type!==`slash`){K({type:`text`,value:V,output:x});continue}K({type:`dot`,value:V,output:x});continue}if(V===`?`){if(!(B&&B.value===`(`)&&d.noextglob!==!0&&U()===`(`&&U(2)!==`?`){oe(`qmark`,V);continue}if(B&&B.type===`paren`){let e=U(),t=V;(B.value===`(`&&!/[!=<:]/.test(e)||e===`<`&&!/<([!=]|\w+>)/.test(W()))&&(t=`\\${V}`),K({type:`text`,value:V,output:t});continue}if(d.dot!==!0&&(B.type===`slash`||B.type===`bos`)){K({type:`qmark`,value:V,output:A});continue}K({type:`qmark`,value:V,output:k});continue}if(V===`!`){if(d.noextglob!==!0&&U()===`(`&&(U(2)!==`?`||!/[!=<:]/.test(U(3)))){oe(`negate`,V);continue}if(d.nonegate!==!0&&L.index===0){re();continue}}if(V===`+`){if(d.noextglob!==!0&&U()===`(`&&U(2)!==`?`){oe(`plus`,V);continue}if(B&&B.value===`(`||d.regex===!1){K({type:`plus`,value:V,output:S});continue}if(B&&(B.type===`bracket`||B.type===`paren`||B.type===`brace`)||L.parens>0){K({type:`plus`,value:V});continue}K({type:`plus`,value:S});continue}if(V===`@`){if(d.noextglob!==!0&&U()===`(`&&U(2)!==`?`){K({type:`at`,extglob:!0,value:V,output:``});continue}K({type:`text`,value:V});continue}if(V!==`*`){(V===`$`||V===`^`)&&(V=`\\${V}`);let e=o.exec(W());e&&(V+=e[0],L.index+=e[0].length),K({type:`text`,value:V});continue}if(B&&(B.type===`globstar`||B.star===!0)){B.type=`star`,B.star=!0,B.value+=V,B.output=I,L.backtrack=!0,L.globstar=!0,G(V);continue}let t=W();if(d.noextglob!==!0&&/^\([^?]/.test(t)){oe(`star`,V);continue}if(B.type===`star`){if(d.noglobstar===!0){G(V);continue}let n=B.prev,r=n.prev,i=n.type===`slash`||n.type===`bos`,a=r&&(r.type===`star`||r.type===`globstar`);if(d.bash===!0&&(!i||t[0]&&t[0]!==`/`)){K({type:`star`,value:V,output:``});continue}let o=L.braces>0&&(n.type===`comma`||n.type===`brace`),s=R.length&&(n.type===`pipe`||n.type===`paren`);if(!i&&n.type!==`paren`&&!o&&!s){K({type:`star`,value:V,output:``});continue}for(;t.slice(0,3)===`/**`;){let n=e[L.index+4];if(n&&n!==`/`)break;t=t.slice(3),G(`/**`,3)}if(n.type===`bos`&&H()){B.type=`globstar`,B.value+=V,B.output=N(d),L.output=B.output,L.globstar=!0,G(V);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&!a&&H()){L.output=L.output.slice(0,-(n.output+B.output).length),n.output=`(?:${n.output}`,B.type=`globstar`,B.output=N(d)+(d.strictSlashes?`)`:`|$)`),B.value+=V,L.globstar=!0,L.output+=n.output+B.output,G(V);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&t[0]===`/`){let e=t[1]===void 0?``:`|$`;L.output=L.output.slice(0,-(n.output+B.output).length),n.output=`(?:${n.output}`,B.type=`globstar`,B.output=`${N(d)}${C}|${C}${e})`,B.value+=V,L.output+=n.output+B.output,L.globstar=!0,G(V+te()),K({type:`slash`,value:`/`,output:``});continue}if(n.type===`bos`&&t[0]===`/`){B.type=`globstar`,B.value+=V,B.output=`(?:^|${C}|${N(d)}${C})`,L.output=B.output,L.globstar=!0,G(V+te()),K({type:`slash`,value:`/`,output:``});continue}L.output=L.output.slice(0,-B.output.length),B.type=`globstar`,B.output=N(d),B.value+=V,L.output+=B.output,L.globstar=!0,G(V);continue}let n={type:`star`,value:V,output:I};if(d.bash===!0){n.output=`.*?`,(B.type===`bos`||B.type===`slash`)&&(n.output=P+n.output),K(n);continue}if(B&&(B.type===`bracket`||B.type===`paren`)&&d.regex===!0){n.output=V,K(n);continue}(L.index===L.start||B.type===`slash`||B.type===`dot`)&&(B.type===`dot`?(L.output+=D,B.output+=D):d.dot===!0?(L.output+=O,B.output+=O):(L.output+=P,B.output+=P),U()!==`*`&&(L.output+=w,B.output+=w)),K(n)}for(;L.brackets>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));L.output=r.escapeLast(L.output,`[`),ae(`brackets`)}for(;L.parens>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`)`));L.output=r.escapeLast(L.output,`(`),ae(`parens`)}for(;L.braces>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`}`));L.output=r.escapeLast(L.output,`{`),ae(`braces`)}if(d.strictSlashes!==!0&&(B.type===`star`||B.type===`bracket`)&&K({type:`maybe_slash`,value:``,output:`${C}?`}),L.backtrack===!0){L.output=``;for(let e of L.tokens)L.output+=e.output==null?e.value:e.output,e.suffix&&(L.output+=e.suffix)}return L};b.fastpaths=(e,t)=>{let a={...t},o=typeof a.maxLength==`number`?Math.min(i,a.maxLength):i,s=e.length;if(s>o)throw SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${o}`);e=c[e]||e;let{DOT_LITERAL:l,SLASH_LITERAL:u,ONE_CHAR:d,DOTS_SLASH:f,NO_DOT:p,NO_DOTS:m,NO_DOTS_SLASH:h,STAR:g,START_ANCHOR:_}=n.globChars(a.windows),v=a.dot?m:p,y=a.dot?h:p,b=a.capture?``:`?:`,x={negated:!1,prefix:``},S=a.bash===!0?`.*?`:g;a.capture&&(S=`(${S})`);let C=e=>e.noglobstar===!0?S:`(${b}(?:(?!${_}${e.dot?f:l}).)*?)`,w=e=>{switch(e){case`*`:return`${v}${d}${S}`;case`.*`:return`${l}${d}${S}`;case`*.*`:return`${v}${S}${l}${d}${S}`;case`*/*`:return`${v}${S}${u}${d}${y}${S}`;case`**`:return v+C(a);case`**/*`:return`(?:${v}${C(a)}${u})?${y}${d}${S}`;case`**/*.*`:return`(?:${v}${C(a)}${u})?${y}${S}${l}${d}${S}`;case`**/.*`:return`(?:${v}${C(a)}${u})?${l}${d}${S}`;default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=w(t[1]);return n?n+l+t[2]:void 0}}},T=w(r.removePrefix(e,x));return T&&a.strictSlashes!==!0&&(T+=`${u}?`),T},t.exports=b})),Js=K(((e,t)=>{let n=Ks(),r=qs(),i=Gs(),a=Ws(),o=e=>e&&typeof e==`object`&&!Array.isArray(e),s=(e,t,n=!1)=>{if(Array.isArray(e)){let r=e.map(e=>s(e,t,n));return e=>{for(let t of r){let n=t(e);if(n)return n}return!1}}let r=o(e)&&e.tokens&&e.input;if(e===``||typeof e!=`string`&&!r)throw TypeError(`Expected pattern to be a non-empty string`);let i=t||{},a=i.windows,c=r?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=c.state;delete c.state;let u=()=>!1;if(i.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};u=s(i.ignore,e,n)}let d=(n,r=!1)=>{let{isMatch:o,match:d,output:f}=s.test(n,c,t,{glob:e,posix:a}),p={glob:e,state:l,regex:c,posix:a,input:n,output:f,match:d,isMatch:o};return typeof i.onResult==`function`&&i.onResult(p),o===!1?(p.isMatch=!1,r?p:!1):u(n)?(typeof i.onIgnore==`function`&&i.onIgnore(p),p.isMatch=!1,r?p:!1):(typeof i.onMatch==`function`&&i.onMatch(p),!r||p)};return n&&(d.state=l),d};s.test=(e,t,n,{glob:r,posix:a}={})=>{if(typeof e!=`string`)throw TypeError(`Expected input to be a string`);if(e===``)return{isMatch:!1,output:``};let o=n||{},c=o.format||(a?i.toPosixSlashes:null),l=e===r,u=l&&c?c(e):e;return l===!1&&(u=c?c(e):e,l=u===r),(l===!1||o.capture===!0)&&(l=o.matchBase===!0||o.basename===!0?s.matchBase(e,t,n,a):t.exec(u)),{isMatch:!!l,match:l,output:u}},s.matchBase=(e,t,n,r=n&&n.windows)=>(t instanceof RegExp?t:s.makeRe(t,n)).test(i.basename(e,{windows:r})),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map(e=>s.parse(e,t)):r(e,{...t,fastpaths:!1}),s.scan=(e,t)=>n(e,t),s.compileRe=(e,t,n=!1,r=!1)=>{if(n===!0)return e.output;let i=t||{},a=i.contains?``:`^`,o=i.contains?``:`$`,c=`${a}(?:${e.output})${o}`;e&&e.negated===!0&&(c=`^(?!${c}).*$`);let l=s.toRegex(c,t);return r===!0&&(l.state=e),l},s.makeRe=(e,t={},n=!1,i=!1)=>{if(!e||typeof e!=`string`)throw TypeError(`Expected a non-empty string`);let a={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]===`.`||e[0]===`*`)&&(a.output=r.fastpaths(e,t)),a.output||(a=r(e,t)),s.compileRe(a,t,n,i)},s.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?`i`:``))}catch(e){if(t&&t.debug===!0)throw e;return/$^/}},s.constants=a,t.exports=s})),Ys=se(K(((e,t)=>{let n=Js(),r=Gs();function i(e,t,i=!1){return t&&(t.windows===null||t.windows===void 0)&&(t={...t,windows:r.isWindows()}),n(e,t,i)}Object.assign(i,n),t.exports=i}))(),1);function Xs(e){return e.replaceAll(`\\`,`/`)}const Zs=Array.isArray;function Qs(e){return Zs(e)?e:e==null?[]:[e]}const $s=`[_#EsCaPe#_]`;function ec(e,t){return t===!1||Us(e)||e.startsWith(`**`)?Xs(e):zs(Xs(Vs(t||``)).replaceAll(/[-^$*+?.()|[\]{}]/g,`${$s}$&`),Xs(e)).replaceAll($s,`\\`)}function tc(e,t,n){let r=n&&n.resolve,i=e=>e instanceof RegExp?e:{test:t=>(0,Ys.default)(ec(e,r),{dot:!0})(t)},a=Qs(e).map(i),o=Qs(t).map(i);return!a.length&&!o.length?e=>typeof e==`string`&&!e.includes(`\0`):function(e){if(typeof e!=`string`||e.includes(`\0`))return!1;let t=Xs(e);for(let e of o)if(e instanceof RegExp&&(e.lastIndex=0),e.test(t))return!1;for(let e of a)if(e instanceof RegExp&&(e.lastIndex=0),e.test(t))return!0;return!a.length}}const nc={root:void 0,colorPreview:!1,remToPxPreview:!0,remToPxRatio:16,syntaxHighlight:!0,strictAnnotationMatch:!1,unmatchedDiagnostics:!0,autocompleteMatchType:`prefix`,autocompleteStrict:!1,autocompleteMaxItems:1e3},rc=/^#(?:[0-9a-f]{3,8})$/i,ic=/^(?:rgb|rgba|hsl|hsla|hwb|oklch|oklab|lab|lch|device-cmyk|color)\(/i,ac=/^(?:media|supports|container)\b/;function oc(e={}){let t=new Set(Object.keys(e.colors??{})),n=new Set(Object.keys(e.breakpoint??e.breakpoints??{}));return{isColorValue(e){let n=e.trim();if(n.startsWith(`[`)&&n.endsWith(`]`)&&(n=n.slice(1,-1)),!n)return!1;if(n===`current`||n===`transparent`||rc.test(n)||ic.test(n))return!0;let r=n.split(`/`)[0].split(`-`)[0];return t.has(r)},isBreakpoint(e){if(ac.test(e))return!0;let t=e.replace(/^(?:max|min)-/,``).split(/[^a-z0-9]/i)[0];return n.has(t)}}}N([P,F,I,L,R,z]);const sc=/var\((?<cssVarName>--[^,|)]+)(?:,(?<fallback>[^)]+))?\)/g,cc=String.raw`(?:#|0x)(?:[a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})\b|(?:rgb|rgba|hsl|hsla|hwb|oklch|oklab|lab|lch|device-cmyk|color)\([^)]*\)`,lc=new RegExp(cc,`g`),uc=/var\((--[^,|)]+)(?:,([^)]+))?\)/,dc=String.raw`(?:^|[;{]\s*)(?:[\w-]+-color|color|fill|stroke)\s*:\s*(?<value>[^;}{]+)`,fc=new RegExp(dc,`gm`),pc=/(?:^|[;{])\s*--[^\s:;{}]+\s*:/m,mc=new RegExp(cc,`i`),hc=new RegExp(dc,`m`),gc=new RegExp(String.raw`color-mix\([^,]+,\s*(?<color>${cc})\s+(?<weight>\d+(?:\.\d+)?%)\s*,\s*transparent\s*\)`,`i`);function _c(e){return pc.test(e)||hc.test(e)||vc(e)}function vc(e){return mc.test(e)}function yc(e){let t=/(?:^|[;{])\s*(?<key>--[^\s:;{}]+)\s*:\s*(?<value>[^;{}]+)(?=;|})/gm,n=new Map;for(let r of e.matchAll(t)){let e=r.groups?.key;e&&n.set(e,(r.groups?.value??``).trim().replace(/\s*!important\s*$/,``))}return n}function bc(e,t){let n=e.trim(),r=new Set;for(;n.startsWith(`var(`);){let e=n.match(uc);if(!e)break;let i=e[1].trim(),a=e[2]?.trim();if(r.has(i))return a;r.add(i);let o=t.get(i)?.trim();if(o){n=o;continue}return a||`1`}return n}function xc(e,t){let n=e;for(let r of e.matchAll(sc)){let e=r[0],i=r.groups?.cssVarName?.trim(),a=r.groups?.fallback;if(!i)continue;let o=t.get(i);o?n=n.replaceAll(e,bc(o,t)??a??`1`):a&&(n=n.replaceAll(e,a))}return n.replaceAll(/,?\s+var\(--.*?\)/g,``)}function Sc(e,t){let n=xc(e,t),r=n.match(gc);if(r?.groups?.color){let e=r.groups.color,t=r.groups.weight;if(e)return/\//.test(e)?e:e.replace(/\)$/,` / ${t})`)}let i=n.match(lc)?.[0];if(!i){let e=n.trim().replace(/\s*!important$/,``);return M(e).isValid()?e:void 0}return/\/\)/.test(i)&&(i=i.replace(/ \/\)/g,`/ 1)`)),i}function Cc(e){let t=yc(e);for(let n of e.matchAll(fc)){let e=n.groups?.value;if(!e)continue;let r=Sc(e,t);if(r)return r}return Sc(e,t)}function wc(e){let t=M(e);if(!t.isValid())return;let n=t.toRgb();return{red:n.r/255,green:n.g/255,blue:n.b/255,alpha:n.alpha}}const Tc=/(-?[\d.]+)rem(\s+!important)?;/;let Ec;function Dc(e){return e.default??e}function Oc(){return Ec??=Promise.all([import(`prettier/standalone`),import(`prettier/parser-postcss`)]).then(([e,t])=>({prettier:Dc(e),parserCSS:Dc(t)}))}function kc(e,t=16){if(!e)return``;if(t<1)return e;let n=0,r=[];for(;n<e.length;){let i=e.slice(n).match(Tc);if(i?.index==null)break;let a=` /* ${Number.parseFloat(i[1])*t}px */`,o=n+i.index+i[0].length;r.push(e.slice(n,o)),r.push(a),n=o}return r.push(e.slice(n)),r.join(``)}async function Ac(e,t,n){let[r,{prettier:i,parserCSS:a}]=await Promise.all([e.generate(new Set(le(t)),{preflights:!1,safelist:!1}),Oc()]),o=kc(r.css,n),s=await i.format(o,{parser:`css`,plugins:[a]});return{...r,prettified:s}}async function jc(e,t,n){return`\`\`\`css\n${(await Ac(e,t,n)).prettified.trimEnd()}\n\`\`\``}const Mc=[`property`,`class`,`keyword`,`number`,`enumMember`,`string`,`operator`,`type`],Nc=[`important`,`pseudoClass`,`pseudoElement`,`query`,`selector`,`variable`,`combinator`,`bracket`,`group`,`condition`],Pc=/^-?(?:\d+\.?\d*|\.\d+)[a-z%]*$/i,Fc=/^[>+~_[&.#*: ]/,Ic=/^[>+~_.#]/;function Lc(e,t){return t?.isColorValue?.(e)?`enumMember`:e.startsWith(`[`)?`string`:Pc.test(e)?`number`:`keyword`}function Rc(e,t){return e.startsWith(`::`)?{type:`type`,modifier:`pseudoElement`,symbolLen:0}:Ic.test(e)?{type:`type`,modifier:`selector`,symbolLen:1}:Fc.test(e)?{type:`type`,modifier:`selector`,symbolLen:0}:t?.isBreakpoint?.(e)?{type:`keyword`,modifier:`query`,symbolLen:0}:{type:`keyword`,modifier:`pseudoClass`,symbolLen:0}}function zc(e,t,n,r){e.push({start:n,length:1,type:`operator`,modifiers:[`condition`]});let i=n+1,a=t;if(a.startsWith(`!`)&&(e.push({start:i,length:1,type:`operator`,modifiers:[`important`]}),i+=1,a=a.slice(1)),a.length){let{type:t,modifier:n,symbolLen:o}=Rc(a,r);o&&(e.push({start:i,length:o,type:`operator`,modifiers:[`combinator`]}),i+=o,a=a.slice(o)),a.length&&e.push({start:i,length:a.length,type:t,modifiers:[n]})}return n+t.length+1}function Bc(e,t,n){let r=-1,i=t=>{r>=0&&(e.push({start:n+r,length:t-r,type:`string`,modifiers:[]}),r=-1)};for(let a=0;a<t.length;a++){let o=t[a];o===`[`||o===`]`||o===`_`?(i(a),e.push({start:n+a,length:1,type:`operator`,modifiers:[`bracket`]})):r<0&&(r=a)}i(t.length)}function Vc(e,t,n,r,i){let a=+!!t.startsWith(`$`);a&&e.push({start:n,length:1,type:`operator`,modifiers:[`variable`]});let o=t.slice(a);if(!o.length)return;if(r===`value`&&o.startsWith(`[`)){Bc(e,o,n+a);return}if(r===`value`&&a&&o.includes(`|`)){let t=o.indexOf(`|`),r=o.slice(0,t),s=o.slice(t+1);if(r.length&&e.push({start:n+a,length:r.length,type:Lc(r,i),modifiers:[]}),e.push({start:n+a+t,length:1,type:`operator`,modifiers:[`important`]}),s.length){let r=n+a+t+1;s.startsWith(`[`)?Bc(e,s,r):e.push({start:r,length:s.length,type:Lc(s,i),modifiers:[]})}return}let s=r===`property`?`property`:Lc(o,i);e.push({start:n+a,length:o.length,type:s,modifiers:[]})}function Hc(e,t,n){if(!e)return[];if(e.startsWith(`{`)&&e.includes(`}`))return Wc(e,t,n);let r=pe(e),i=[];if(r.keyword)r.body.length&&(r.body.startsWith(`[`)?Bc(i,r.body,t):i.push({start:t,length:r.body.length,type:`class`,modifiers:[]}));else{let e=r.property??``,a=r.value??``;e.length&&Vc(i,e,t,`property`,n),i.push({start:t+e.length,length:1,type:`operator`,modifiers:[]}),a.length&&Vc(i,a,t+e.length+1,`value`,n)}let a=t+r.body.length;r.important&&(i.push({start:a,length:1,type:`operator`,modifiers:[`important`]}),a+=1);for(let e of r.conditions)a=zc(i,e,a,n);return i}function Uc(e,t,n){let r=0;for(let i=n;i<e.length;i++){let n=e[i];if(n===`\\`)i++;else if(n===`[`||n===`(`)r++;else if(n===`]`||n===`)`)r--;else if(n===t&&r<=0)return i}return-1}function Wc(e,t,n){let r=[],i=Uc(e,`}`,0);r.push({start:t,length:1,type:`operator`,modifiers:[`group`]});let a=t+1,o=e.slice(1,i),s=[],c=0;for(;;){let e=Uc(o,`;`,c);if(e===-1){s.push(o.slice(c));break}s.push(o.slice(c,e)),c=e+1}s.forEach((e,t)=>{if(t>0&&(r.push({start:a,length:1,type:`operator`,modifiers:[`group`]}),a+=1),e.length){for(let t of Hc(e,a,n))r.push(t);a+=e.length}}),r.push({start:t+i,length:1,type:`operator`,modifiers:[`group`]});let l=t+i+1,u=e.slice(i+1);if(u.startsWith(`!`)&&(r.push({start:l,length:1,type:`operator`,modifiers:[`important`]}),l+=1,u=u.slice(1)),u.startsWith(`@`))for(let e of u.slice(1).split(`@`))l=zc(r,e,l,n);return r}const Gc=new Map,Kc=new WeakMap;function qc(e,t){return e<t?-1:+(e>t)}function Jc(e,t){return qc(e??``,t??``)}function Yc(e,t){return e[0]-t[0]||(e[4]?.sort??0)-(t[4]?.sort??0)||Jc(e[5]?.currentSelector,t[5]?.currentSelector)||Jc(e[1],t[1])||qc(e[2],t[2])}function Xc(e){let t=!1,n=0,r,i=``;for(let a=0;a<e.length;a++){let o=e[a];if(t){o===`*`&&e[a+1]===`/`&&(t=!1,a++);continue}if(r){o===`\\`?a++:o===r&&(r=void 0);continue}if(o===`/`&&e[a+1]===`*`){t=!0,a++;continue}if(o===`\\`){a++;continue}if(o===`"`||o===`'`){r=o;continue}if(!/\s/.test(o)||e[a+1]!==`$`||e[a+2]!==`$`||!/\s/.test(e[a+3]??``))continue;let s=a+4;for(;s<e.length&&/\s/.test(e[s]);)s++;i+=`${e.slice(n,a)} `,n=s,a=s-1}return n?i+e.slice(n):e}function Zc(e){let t=[],n=0,r=!1,i=0,a,o=0;for(let s=0;s<e.length;s++){let c=e[s];r?c===`*`&&e[s+1]===`/`&&(r=!1,s++):a?c===`\\`?s++:c===a&&(a=void 0):c===`/`&&e[s+1]===`*`?(r=!0,s++):c===`"`||c===`'`?a=c:c===`(`?i++:c===`)`?i>0&&i--:c===`[`?n++:c===`]`?n>0&&n--:n===0&&i===0&&e.startsWith(` $$ `,s)&&(t.push(e.slice(o,s)),s+=3,o=s+1)}return t.push(e.slice(o)),t}function Qc(e){let t=Gc.get(e);if(t!==void 0)return t;let n=_c(e);return Yr(Gc,e,n,2048),n}function $c(e){let t=new Map,n=new Map,r=0;for(let i of e){let[a,o,s]=i;if(s){e[r++]=i;continue}let c=a.length?t:n,l=c.get(o);l?a.length&&l[0].push(...a):(c.set(o,i),e[r++]=i)}e.length=r}function el(e,t,n){let r=e.sort(Yc).map(([,e,t,,n,,r])=>{let i=e&&!n?.noScope?Xc(e):e;return[i==null?[]:[[i,n?.sort??0]],t,!!(r??n?.noMerge)]});t&&$c(r);let i=[];for(let e=r.length-1;e>=0;e--){let[t,n]=r[e],a=t.length===1?t[0][0]:``;t.length>1&&(t.sort((e,t)=>e[1]-t[1]||qc(e[0],t[0])),a=[...new Set(t.map(([e])=>e).filter(Boolean))].join(`,
30
+ `)),i.push(a?`${a}{${n}}`:n)}let a=[...new Set(i)].reverse();return(n?a:a.filter(Qc)).join(`
31
+ `)}function tl(e,t,n){let r=new Map,i=new Set([me]);for(let e of n){let t=e[4]?.layer||`utilities`;i.add(t);let n=e[3]||``,a=r.get(t);a||(a=new Map,r.set(t,a));let o=a.get(n);o?o.push(e):a.set(n,[e])}let a=t=>Object.hasOwn(e.layers,t)?e.layers[t]??0:0,o=e.sortLayers([...i].sort((e,t)=>a(e)-a(t)||qc(e,t))),s=[];for(let n of o){let i=r.get(n);if(i)for(let n of[...i.keys()].sort((e,n)=>vr(t,e,n))){let t=el(i.get(n),e.mergeSelectors,Qc(n));if(t)if(!n)s.push(t);else{let e=Zc(n);s.push(`${e.join(`{`)}{${t}${`}`.repeat(e.length)}`)}}}return s.join(`
32
+ `)}async function nl(e,t){let n=e.config,r=await e.parseToken(t);if(e.config!==n)return nl(e,t);if(r?.length)return Cc(tl(n,new Map(e.parentOrders),r))}async function rl(e,t){let n=Kc.get(e);return(!n||n.config!==e.config)&&(n={config:e.config,values:new Map},Kc.set(e,n)),Xr(n.values,t,1e3,()=>nl(e,t).then(e=>e?{colorString:e,color:wc(e)}:{}))}const il=[...Nc,`teacss`],al={tokenTypes:[...Mc],tokenModifiers:il},ol=new Map(Mc.map((e,t)=>[e,t])),sl=new Map(il.map((e,t)=>[e,1<<t])),cl=sl.get(`teacss`)??0,ll=/^-?(?:\d+\.?\d*|\.\d+)[a-z%]*$/i,ul=new WeakMap,dl={log(){},warn(){}};function fl(e,t){let n=Ko(e,t)?.toLowerCase();return n?.endsWith(`class`)||n?.endsWith(`classname`)}function pl(e){let t=[];if(!e.includes(`:`))for(let n=e.indexOf(`-`);n>0;n=e.indexOf(`-`,n+1))t.push(`${e.slice(0,n)}:${e.slice(n+1)}`);let n=e.indexOf(`:`);return n>0&&e.indexOf(`:`,n+1)>n&&t.push(`${e.slice(n+1)}@${e.slice(0,n)}`),t}function ml(e,t){let n=e[t-1];if(n===`"`||n===`'`){for(let r=t;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===n)return r;return e.length}let r=t;for(;r<e.length&&!/[\s>]/.test(e[r]);)r++;return r}async function hl(e,t,n){let r=Array(e.length),i=0,a=Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){let t=i++;r[t]=await n(e[t],t)}});return await Promise.all(a),r}function gl(e){return!e.startsWith(`[`)||!e.endsWith(`]`)||wc(e.slice(1,-1).replace(/\\?_/g,e=>e===`_`?` `:`_`).trim())!==void 0}function _l(e){let t=ul.get(e);if(t?.config===e.config)return t.classifier;let n=oc(e.config?.theme??{});return ul.set(e,{config:e.config,classifier:n}),n}function vl(e){e.sort((e,t)=>e.line-t.line||e.char-t.char);let t=[],n=0,r=0;for(let i of e){let e=i.line-n,a=e===0?i.char-r:i.char;t.push(e,a,i.length,i.type,i.modifiers),n=i.line,r=i.char}return{data:t}}function yl(e,t,n,r,i=cl){let a=e.positionAt(t);return{line:a.line,char:a.character,length:n,type:ol.get(r)??0,modifiers:i}}function bl(e,t,n,r,i=cl){let a=[],o=0;for(let s=0;s<n.length;s++)(n[s]===`\r`||n[s]===`
33
+ `)&&(s>o&&a.push(yl(e,t+o,s-o,r,i)),n[s]===`\r`&&n[s+1]===`
34
+ `&&s++,o=s+1);return o<n.length&&a.push(yl(e,t+o,n.length-o,r,i)),a}function xl(e,t){return t.isColorValue?.(e)?`enumMember`:ll.test(e)?`number`:`string`}function Sl(e,t,n){return e.some(e=>e.open===t&&e.close===n-1)}function Cl(e,t,n){let r=[];for(let i of n){r.push(yl(e,i.open,1,`operator`,cl|(sl.get(`group`)??0)));for(let n of i.declarations){let{property:i,start:a,colon:o,value:s,valueStart:c}=n;r.push(yl(e,a,2,`operator`,cl|(sl.get(`variable`)??0))),r.push(yl(e,a+2,i.length-2,`property`)),r.push(yl(e,o,1,`operator`)),s&&r.push(...bl(e,c,s,xl(s,t)))}r.push(yl(e,i.close,1,`operator`,cl|(sl.get(`group`)??0)))}return r}var wl=class{contextManager;getSettings;logger;autoCompletes=new Map;semanticTokensCache=new Map;featureFailures=new Map;constructor(e){this.getSettings=e.getSettings??(()=>nc),this.logger=e.logger??dl;let t=e.folderPaths?.length?e.folderPaths:[e.rootPath];this.contextManager=new Ms(e.rootPath,this.logger,t),this.contextManager.events.on(`contextReload`,e=>this.resetFeatureCaches(e)),this.contextManager.events.on(`contextUnload`,e=>this.resetFeatureCaches(e)),this.contextManager.events.on(`unload`,e=>this.resetFeatureCaches(e))}get events(){return this.contextManager.events}get ready(){return this.contextManager.ready}resetAutoCompleteCache(e){e?this.autoCompletes.delete(e):this.autoCompletes.clear()}resetFeatureCaches(e){this.resetAutoCompleteCache(e),this.semanticTokensCache.clear(),this.featureFailures.clear()}reportFeatureFailure(e,t,n){let r=`${e}\0${t}`,i=n instanceof Error?n.message:String(n);this.featureFailures.get(r)!==i&&(Yr(this.featureFailures,r,i,100),this.logger.warn(`⚠️ Failed to provide ${e} for ${t}: ${i}`))}clearFeatureFailure(e,t){this.featureFailures.delete(`${e}\0${t}`)}getAutocomplete(e,t){let n=this.autoCompletes.get(e);if(n?.matchType===t)return n.autocomplete;let r=Ss(e.generator,{matchType:t,throwErrors:!1});return this.autoCompletes.set(e,{matchType:t,autocomplete:r}),r}async resolveTargetContext(e){let t=Cs(e.uri);if(!this.contextManager.isTarget(t))return null;let n=e.getText();if(!n)return null;let r=await this.contextManager.resolveClosestContext(n,t);return!r||!(r.filter(n,t)||n.includes(`@teacss-ide-include`)||this.contextManager.configSources.includes(t)||fn(t))?null:{ctx:r,id:t,code:n,doc:e.getText()===n?e:O.create(e.uri,e.languageId,e.version,n)}}async getSemanticTokens(e){let t={data:[]},n=`semantic tokens`;try{let r=this.getSettings();if(!r.syntaxHighlight)return this.clearFeatureFailure(n,e.uri),t;let i=await this.resolveTargetContext(e);if(!i)return this.clearFeatureFailure(n,e.uri),t;let{ctx:a,id:o,code:s,doc:c}=i,l=r.strictAnnotationMatch,u=this.semanticTokensCache.get(o);if(u&&u.code===s&&u.generator===a.generator&&u.strictAnnotationMatch===l)return Yr(this.semanticTokensCache,o,u,100),this.clearFeatureFailure(n,e.uri),u.result;let d=await ei(a.generator,s,o,l),f=_l(a.generator),p=[],m=new Map,h=fn(o)?v(s):[];for(let[e,t]of d){if(Sl(h,e,t))continue;let n=s.slice(e,t),r=m.get(n);r||(r=Hc(n,0,f),m.set(n,r));for(let t of r){let n=e+t.start,r=c.positionAt(n),i=cl;for(let e of t.modifiers)i|=sl.get(e)??0;p.push({line:r.line,char:r.character,length:t.length,type:ol.get(t.type)??0,modifiers:i})}}h.length&&p.push(...Cl(c,f,h));let g=vl(p);return Yr(this.semanticTokensCache,o,{code:s,generator:a.generator,strictAnnotationMatch:l,result:g},100),this.clearFeatureFailure(n,e.uri),g}catch(r){return this.reportFeatureFailure(n,e.uri,r),t}}async getDiagnostics(e){try{let t=await this.resolveTargetContext(e);if(!t)return this.clearFeatureFailure(`diagnostics`,e.uri),[];let{ctx:n,id:r,code:i,doc:a}=t,o;if(fn(r))o=m(i,_(n.generator.config?.theme??{})).map(e=>({range:{start:a.positionAt(e.start),end:a.positionAt(e.end)},message:e.message,severity:j.Warning,source:`teacss`,code:e.reason}));else if(this.getSettings().unmatchedDiagnostics){let e=await Kn.extract?.({code:i,id:r,generator:n.generator})??[],t=Kr(i,Array.from(new Set(e)).filter(e=>typeof e==`string`&&e.length>0),[],{excludeRanges:Er(i,r)}).filter(([e,t])=>fl(i,Math.max(e+1,t-1))),s=await n.generator.generate(new Set(t.map(e=>e[2])),{preflights:!1,safelist:!1}),c=t.filter(e=>!s.matched.has(e[2])),l=new Map;for(let[,,e]of c){let t=nr(e),r=e.slice(t.length),i=dr(e,n.generator.config,{confirmedIntent:!0})?.map(e=>`${e}${r}`)??[];l.set(e,Array.from(new Set([...pl(e),...i])))}let u=Array.from(new Set(Array.from(l.values()).flat())),d=u.length?(await n.generator.generate(new Set(u),{preflights:!1,safelist:!1})).matched:new Set;o=c.map(([e,t,n])=>{let r=(l.get(n)??[]).filter(e=>d.has(e)).slice(0,3);return{range:{start:a.positionAt(e),end:a.positionAt(t)},message:r.length?`Unmatched TeaCSS token \`${n}\`. Did you mean ${r.map(e=>`\`${e}\``).join(`, `)}?`:`Unmatched TeaCSS token \`${n}\` generates no CSS.`,severity:j.Warning,source:`teacss`,code:`unmatched-token`,data:{token:n,suggestions:r}}})}else o=[];return this.clearFeatureFailure(`diagnostics`,e.uri),o}catch(t){return this.reportFeatureFailure(`diagnostics`,e.uri,t),[]}}async getCodeActions(e,t){let n=[];for(let r of t){if(r.source!==`teacss`||r.code!==`unmatched-token`)continue;let t=r.data;if(!Array.isArray(t?.suggestions))continue;let i=t.suggestions.filter(e=>typeof e==`string`);for(let t=0;t<i.length;t++){let a=i[t];n.push({title:`Replace with ${a}`,kind:k.QuickFix,diagnostics:[r],isPreferred:t===0,edit:{changes:{[e.uri]:[{range:r.range,newText:a}]}}})}}return n}async getProjectStatus(e){let t=await this.resolveTargetContext(e);if(!t)return null;let{ctx:n,id:r,code:i}=t,a=n.getConfigFileList(),o=a.find(e=>fn(e))??null,s=n.generator.config.presets.map(e=>e.name||`(anonymous)`),c=[...n.generator.config.content?.filesystem??[]],l=n.filter(i,r)||i.includes(`@teacss-ide-include`)||fn(r),u=(await ei(n.generator,i,r,this.getSettings().strictAnnotationMatch)).length,d=(await this.getDiagnostics(e)).filter(e=>e.code===`unmatched-token`).length,f=[];return o||f.push(`No TeaCSS CSS entry was resolved.`),s.length||f.push(`The active entry selects no preset.`),l||f.push(`The active file is outside the entry's @source coverage.`),{root:n.root,entry:o,configSources:a,presets:s,sources:c,rules:n.generator.config.rulesSize,shortcuts:n.generator.config.shortcuts.length,activeFile:r,activeFileCovered:l,matchedCount:u,unmatchedCount:d,issues:f}}async getClassNameEdits(e){let t=await this.resolveTargetContext(e);if(!t)return[];let{ctx:n,id:r,code:i,doc:a}=t,o=await Kn.extract?.({code:i,id:r,generator:n.generator})??[],s=Kr(i,Array.from(new Set(o)).filter(e=>typeof e==`string`&&e.length>0),[],{excludeRanges:Er(i,r)}),c=new Map;for(let[e,t]of s){let n=qo(i,Math.max(e+1,t-1)),r=n?.key.toLowerCase();!n||!(r?.endsWith(`class`)||r?.endsWith(`classname`))||c.set(n.valueStart,ml(i,n.valueStart))}let l=Array.from(c,([e,t])=>({end:t,start:e,tokens:i.slice(e,t).match(/\S+/g)??[]})).filter(e=>e.tokens.length>1),u=Array.from(new Set(l.flatMap(e=>e.tokens)));if(!u.length)return[];let d=await n.generator.generate(new Set(u),{extendedInfo:!0,preflights:!1,safelist:!1}),f=d.css,p=new Map;for(let[e,t]of d.matched){let n=t.data.map(e=>e[1]?f.indexOf(e[1]):-1).filter(e=>e>=0);p.set(e,n.length?Math.min(...n):t.data[0]?.[0]??2**53-1)}let m=[];for(let e of l){let t=e.tokens.filter(e=>d.matched.has(e));if(t.length<2)continue;t.sort((e,t)=>(p.get(e)??2**53-1)-(p.get(t)??2**53-1)||(e<t?-1:+(e>t)));let n=0,r=e.tokens.map(e=>d.matched.has(e)?t[n++]:e).join(` `);r!==i.slice(e.start,e.end)&&m.push({range:{start:a.positionAt(e.start),end:a.positionAt(e.end)},newText:r})}return m}async getHover(e,t){let n=`hover`;try{if(fn(Cs(e.uri)))return this.clearFeatureFailure(n,e.uri),null;let r=this.getSettings(),i=await this.resolveTargetContext(e);if(!i)return this.clearFeatureFailure(n,e.uri),null;let{ctx:a,id:o,code:s,doc:c}=i,l=c.offsetAt(t),u=(await ei(a.generator,s,o,r.strictAnnotationMatch)).find(([e,t])=>l>=e&&l<t);if(!u)return this.clearFeatureFailure(n,e.uri),null;let d=r.remToPxPreview?r.remToPxRatio:-1,f={contents:{kind:`markdown`,value:await jc(a.generator,u[2],d)},range:{start:c.positionAt(u[0]),end:c.positionAt(u[1])}};return this.clearFeatureFailure(n,e.uri),f}catch(t){return this.reportFeatureFailure(n,e.uri,t),null}}async getDocumentColors(e){let t=`document colors`;try{let n=this.getSettings();if(!n.colorPreview)return this.clearFeatureFailure(t,e.uri),[];let r=await this.resolveTargetContext(e);if(!r)return this.clearFeatureFailure(t,e.uri),[];let{ctx:i,id:a,code:o,doc:s}=r,c=await ei(i.generator,o,a,n.strictAnnotationMatch),l=[],u=!1;for(let[n,r,a]of c)try{let{color:e}=await rl(i.generator,a);e&&l.push({range:{start:s.positionAt(n),end:s.positionAt(r)},color:{...e}})}catch(n){u=!0,this.reportFeatureFailure(t,e.uri,n)}return u||this.clearFeatureFailure(t,e.uri),l}catch(n){return this.reportFeatureFailure(t,e.uri,n),[]}}getColorPresentations(e,t,n){let r=Math.round(e.red*255),i=Math.round(e.green*255),a=Math.round(e.blue*255),o=Math.min(1,Math.max(0,e.alpha)),s=e=>e.toString(16).padStart(2,`0`),c=o<1?`#${s(r)}${s(i)}${s(a)}${s(Math.round(o*255))}`:`#${s(r)}${s(i)}${s(a)}`;if(t&&n){let e=Tl(n),r=n.slice(0,e),i=n.slice(e),a=r.indexOf(`:`);if(a>0){let e=r.endsWith(`!`)?`!`:``;if(gl(r.slice(a+1,r.length-e.length))){let n=`${r.slice(0,a)}:[${c}]${e}${i}`;return[{label:n,textEdit:{range:t,newText:n}}]}}}return n&&t?[{label:n,textEdit:{range:t,newText:n}}]:[{label:c}]}async getMatchedPositions(e){let t=this.getSettings(),n=await this.resolveTargetContext(e);if(!n)return[];let{ctx:r,id:i,code:a}=n;return(await ei(r.generator,a,i,t.strictAnnotationMatch)).map(([e,t,n])=>({start:e,end:t,text:n}))}async getReferences(e,t){let n=this.getSettings(),r=Cs(e.uri),i=e.getText(),a=await this.contextManager.resolveClosestContext(i,r);if(!a?.filter(i,r))return null;let o=e.getText()===i?e:O.create(e.uri,e.languageId,e.version,i),s=await ei(a.generator,i,r,n.strictAnnotationMatch),c=o.offsetAt(t),l=s.find(e=>e[0]<=c&&c<e[1]);if(!l?.[2])return null;let u=l[2],d=new Set(a.generator.getCachedEquivalentTokens(u)),m=a.getConfigFileList().find(e=>fn(e)),h=a.generator.config.content?.filesystem,g=h??b,_=g.filter(e=>!e.startsWith(`!`)),v=g.filter(e=>e.startsWith(`!`)).map(e=>e.slice(1)),y=m?f(m):a.root,x=tc(void 0,h===void 0?[...D,...v]:v,{resolve:y}),C=h===void 0?new Set([`node_modules`,`dist`,`build`,`storybook-static`]):void 0,w=[];if(_.length)for await(let e of T(_,{cwd:y,exclude:e=>C?.has(e)??!1})){let t=p(y,e);x(t)&&w.push(t)}return w.includes(r)||w.unshift(r),(await hl(Array.from(new Set(w)),16,async e=>{let t;try{t=e===r?i:await E(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return[];throw e}let s=e===r?o:O.create(S(e).href,``,0,t);return(await ei(a.generator,t,e,n.strictAnnotationMatch)).filter(e=>d.has(e[2])).map(e=>({uri:s.uri,range:{start:s.positionAt(e[0]),end:s.positionAt(e[1])}}))})).flat()}async getCompletions(e,t){let n=`completions`;try{let r=this.getSettings(),i=Cs(e.uri);if(!this.contextManager.isTarget(i))return this.clearFeatureFailure(n,e.uri),null;let a=e.getText();if(!a)return this.clearFeatureFailure(n,e.uri),null;let o=await this.contextManager.resolveClosestContext(a,i);if(!o)return this.clearFeatureFailure(n,e.uri),null;let s=e.getText()===a?e:O.create(e.uri,e.languageId,e.version,a),c=s.offsetAt(t);if(r.autocompleteStrict&&!Ds(a,i,c))return this.clearFeatureFailure(n,e.uri),null;let l=await this.getSuggestionResult({ctx:o,code:a,id:i,offset:c,matchType:r.autocompleteMatchType});if(!l?.suggestions.length)return this.clearFeatureFailure(n,e.uri),null;let u=l.suggestions.slice(0,r.autocompleteMaxItems),d=r.colorPreview?await hl(u,32,async([e])=>{try{return(await rl(o.generator,e)).colorString}catch{return}}):[],f=[];for(let t=0;t<u.length;t++){let[n,r]=u[t],i=d[t],a=l.resolveReplacement(n),o={label:r,kind:i?A.Color:A.EnumMember,sortText:i?/-\d$/.test(r)?`1`:`2`:void 0,data:{value:n,uri:e.uri},textEdit:{range:{start:s.positionAt(a.start),end:s.positionAt(a.end)},newText:a.replacement}};i&&(o.documentation=i),f.push(o)}return this.clearFeatureFailure(n,e.uri),{isIncomplete:!0,items:f}}catch(t){return this.reportFeatureFailure(n,e.uri,t),null}}async resolveCompletion(e,t){if(!e.data?.uri||!e.data?.value||!t)return e;let n=this.getSettings(),r=Cs(e.data.uri),i=t.getText(),a=await this.contextManager.resolveClosestContext(i,r);if(!a)return e;let o=n.remToPxPreview?n.remToPxRatio:-1;return e.kind===A.Color?e.detail=await(await Ac(a.generator,e.data.value,o)).prettified:e.documentation={kind:`markdown`,value:await jc(a.generator,e.data.value,o)},e}async getSuggestionResult({ctx:e,code:t,id:n,offset:r,matchType:i}){let a=Os(t,n);if(!e.filter(t,n)&&!fn(n)&&!a)return null;let o=this.getAutocomplete(e,i),s;if(a){let e=t.substring(0,r).match(/\.[-\w]*$/);if(e){let t=e[0].substring(1),n=await o.suggest(t||``);n.length&&(s={suggestions:n.map(e=>[e,e]),resolveReplacement:e=>({start:r-(t?.length||0),end:r,replacement:e})})}else s=await o.suggestInFile(t,r)}else s=await o.suggestInFile(t,r);return s}};function Tl(e){let t=0,n;for(let r=0;r<e.length;r++){let i=e[r];if(n){i===`\\`?r++:i===n&&(n=void 0);continue}if(i===`"`||i===`'`)n=i;else if(i===`\\`)r++;else if(i===`[`||i===`(`)t++;else if(i===`]`||i===`)`)t--;else if(i===`@`&&t===0)return r}return e.length}function El(e,t){let n=Ol(t.workspaceFolderPaths||[]),r=n.length?n:Ol([t.workspaceRootPath]),i=le(e).filter(e=>typeof e==`string`&&e.length>0);if(!i.length)return r;let a=Ol([t.workspaceFileDir,...n,t.workspaceRootPath]);return Ol(i.flatMap(e=>Dl(e,a)))}function Dl(e,t){if(!e)return[];if(kl(e))return[d.normalize(e)];let n=d.normalize(e),r=t.filter(e=>{let t=d.normalize(e);return t===n||t.endsWith(`${d.sep}${n}`)});if(r.length)return r;let i=t.map(t=>d.resolve(t,e)),a=i.filter(e=>u(e));return a.length?a:i.slice(0,1)}function Ol(e){return Array.from(new Set(e.filter(Boolean).map(e=>d.normalize(e))))}function kl(e){return d.isAbsolute(e)||d.win32.isAbsolute(e)}function Al(e,t,n,i=r){e.onCodeAction(async e=>{await i();let r=n(),a=t.get(e.textDocument.uri);return!r||!a?[]:r.getCodeActions(a,e.context.diagnostics)})}const jl=/[\\/](?:node_modules|dist|\.temp|\.cache|\.git)[\\/]/,Ml=new Set([`node_modules`,`dist`,`.temp`,`.cache`,`.git`]),Nl=`**/{${Array.from(new Set(h.map(e=>d.posix.basename(e)))).join(`,`)}}`;function Pl(e,t){let n=d.relative(e,t);return n===``||!n.startsWith(`..${d.sep}`)&&n!==`..`&&!d.isAbsolute(n)}function Fl(e){return[...e].map(e=>e===`*`?`[*]`:e===`?`?`[?]`:e===`[`?`[[]`:e===`]`?`[]]`:e===`{`?`[{]`:e===`}`?`[}]`:e).join(``)}function Il(e){try{let t=JSON.parse(l.readFileSync(d.join(e,`package.json`),`utf8`))?.teacss?.entry;return typeof t==`string`&&t?d.resolve(e,t):void 0}catch{return}}function Ll(e){let t=[],n=[e];for(let e of n){let r;try{r=l.readdirSync(e,{withFileTypes:!0})}catch{continue}if(r.some(e=>e.isFile()&&e.name===`package.json`)){let n=Il(e);n&&t.push({directory:e,entry:n})}for(let t of r)t.isDirectory()&&!Ml.has(t.name)&&n.push(d.join(e,t.name))}return t.sort((e,t)=>e.directory<t.directory?-1:+(e.directory>t.directory))}function Rl(e,t){return t.map(e=>d.normalize(e)).filter(t=>Pl(t,e)).sort((e,t)=>t.length-e.length)[0]}function zl(e,t){let n=d.dirname(e);for(;Pl(t,n);){if(d.normalize(g(n)??``)===e)return!0;if(n===t)break;n=d.dirname(n)}return!1}function Bl(e){let t=e.map(({globPattern:e,kind:t})=>typeof e==`string`?`${t??``}\0${e}`:`${t??``}\0${e.baseUri}\0${e.pattern}`);return JSON.stringify(t.sort())}function Vl(e,t,n){let r=new Map,i=(e,t,i=!0)=>{let a=i?Fl(t):t,o={baseUri:S(e).href,pattern:a};r.set(`${o.baseUri}\0${a}`,{globPattern:o,kind:n})};for(let t of e)i(d.dirname(t),d.basename(t));for(let e of t){i(e,Nl,!1);for(let{directory:t,entry:n}of Ll(e)){let e=d.relative(t,n);Pl(t,n)?i(t,e.split(d.sep).join(`/`)):i(d.dirname(n),d.basename(n))}}return Array.from(r.values())}function Hl(e,t,n){let r=new Set(t.map(e=>d.normalize(e))),i=new Set(n.map(Il).filter(e=>!!e).map(e=>d.normalize(e))),a=new Set;for(let t of e){let e;try{e=d.normalize(x(t.uri))}catch{return!0}if(r.has(e)||i.has(e))return!0;if(jl.test(e))continue;let o=Rl(e,n);if(!o){a.add(e);continue}if(d.basename(e)===`package.json`)return!0;if(d.extname(e).toLowerCase()!==`.css`){a.add(e);continue}try{if(zl(e,o))return!0}catch{return!0}}if(a.size){for(let e of n)for(let{entry:t}of Ll(e))if(a.has(d.normalize(t)))return!0}return!1}function Ul(e){let t,n,r,i,a=0,o=Promise.resolve();return{update(s){let c=Bl(s);if(i&&r===c)return i;if(!i&&n===c)return Promise.resolve();let l=++a,u=o.then(async()=>{if(l!==a||n===c)return;let r=await e(s);if(l!==a){r.dispose();return}t?.dispose(),t=r,n=c});o=u.catch(()=>{}),r=c,i=u;let d=()=>{i===u&&(i=void 0,r=void 0)};return u.then(d,d),u}}}function Wl(e){return e instanceof Error?e.message:String(e)}function Gl(e){let t=new Map,n=new Map,r=0;return{async publish(i){let a=++r;t.set(i.uri,a);try{let r=await e.getDiagnostics(i);if(t.get(i.uri)!==a)return;await e.sendDiagnostics(i.uri,r),t.get(i.uri)===a&&n.delete(i.uri)}catch(r){if(t.get(i.uri)!==a)return;let o=Wl(r);if(n.get(i.uri)===o)return;n.set(i.uri,o),e.reportError(i.uri,r)}},invalidate(e){t.delete(e),n.delete(e)}}}function Kl(e,t){e.on(`uncaughtExceptionMonitor`,(e,n)=>{t(`[teacss] ${n===`unhandledRejection`?`Unhandled rejection`:`Uncaught exception`}: ${e.message}`)})}function ql(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Jl(e,t){return typeof e==`boolean`?e:t}function Yl(e,t){if(e!==null)return typeof e==`string`?e:Array.isArray(e)?e.filter(e=>typeof e==`string`):t}function Xl(e,t){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:t}function Zl(e,t){return typeof e!=`number`||!Number.isFinite(e)?t:Math.min(1e4,Math.max(0,Math.floor(e)))}function Ql(e){let t=ql(e),n={};return Object.hasOwn(t,`root`)&&(n.root=t.root),(t.semanticTokens===`native`||t.semanticTokens===`overlay`)&&(n.semanticTokens=t.semanticTokens),typeof t.workspaceFileDir==`string`&&(n.workspaceFileDir=t.workspaceFileDir),Array.isArray(t.workspaceFolderPaths)&&(n.workspaceFolderPaths=t.workspaceFolderPaths.filter(e=>typeof e==`string`)),n}function $l(e,t){let n=ql(t),r=ql(n.autocomplete),i=r.matchType;return{root:Yl(n.root,e.root),colorPreview:Jl(n.colorPreview,e.colorPreview),remToPxPreview:Jl(n.remToPxPreview,e.remToPxPreview),remToPxRatio:Xl(n.remToPxRatio,e.remToPxRatio),syntaxHighlight:Jl(n.syntaxHighlight,e.syntaxHighlight),strictAnnotationMatch:Jl(n.strictAnnotationMatch,e.strictAnnotationMatch),unmatchedDiagnostics:Jl(n.unmatchedDiagnostics,e.unmatchedDiagnostics),autocompleteMatchType:i===`prefix`||i===`fuzzy`?i:e.autocompleteMatchType,autocompleteStrict:Jl(r.strict,e.autocompleteStrict),autocompleteMaxItems:Zl(r.maxItems,e.autocompleteMaxItems)}}function eu(e){return $l(nc,e)}function tu(e,t){return e.syntaxHighlight!==t.syntaxHighlight||e.strictAnnotationMatch!==t.strictAnnotationMatch}function nu(e,t){let n=new Set(e),r=new Set(t);return n.size!==r.size||[...n].some(e=>!r.has(e))}async function ru(e,t,n){if(e)try{return await t()}catch(e){n(e);return}}const Q=te(B.all),iu=new H(O);let au=eu(),$,ou=!1,su=!1,cu=!1,lu=!1,uu=!1,du=!1,fu=0,pu;const mu=new Promise(e=>{pu=e}),hu=U.Create|U.Change|U.Delete,gu=[{globPattern:`**/*.css`,kind:hu}],_u={folderPaths:[]};function vu(e){au=$l(au,e)}function yu(e){return El(e,{workspaceRootPath:_u.rootPath,workspaceFileDir:_u.fileDir,workspaceFolderPaths:_u.folderPaths})}function bu(e){return typeof e==`string`?e.length>0:Array.isArray(e)&&e.some(Boolean)}async function xu(){$&&await Su(()=>$.contextManager.setRoots(yu(au.root)))}async function Su(e){fu++;try{return await e()}finally{fu--}}function Cu(e,t,n){_u.rootPath=e?Cs(e):void 0,_u.fileDir=n?.workspaceFileDir,_u.folderPaths=n?.workspaceFolderPaths||t?.map(e=>Cs(e.uri))||[]}function wu(e=_u.rootPath){if(!e)return;let t=new wl({rootPath:e,folderPaths:yu(au.root),logger:{log:e=>Q.console.log(e),warn:e=>Q.console.warn(e)},getSettings:Pu});$=t;let n=()=>{fu||(Au().catch(e=>ju(`Failed to update config watchers`,e)),Mu(),Gu())};return t.events.on(`reload`,()=>{fu||Au().catch(e=>ju(`Failed to update config watchers`,e))}),t.events.on(`contextLoaded`,n),t.events.on(`contextReload`,n),t.events.on(`contextUnload`,n),t.events.on(`unload`,n),t}async function Tu(e){$||!e[0]||await wu(e[0])?.ready}function Eu(){return $?.contextManager.configSources??[]}function Du(){return Array.from(new Set([...yu(au.root),...$?.contextManager.contextsMap.keys()??[]]))}function Ou(){let e=Eu(),t=Vl(e,Du(),hu);return e.length?t:[...gu,...t]}const ku=Ul(async e=>Q.client.register(ee.type,{watchers:[...e]}));async function Au(){!ou||!du||!$||await ku.update(Ou())}function ju(e,t){Q.console.error(`[teacss] ${e}: ${t instanceof Error?t.message:String(t)}`)}async function Mu(){du&&(uu?await Q.sendNotification(`teacss/semanticTokens/refresh`).catch(e=>ju(`Failed to refresh semantic token decorations`,e)):lu&&await Q.languages.semanticTokens.refresh().catch(e=>ju(`Failed to refresh semantic tokens`,e)))}const Nu=Gl({async getDiagnostics(e){return await Iu(),await $?.getDiagnostics(e)??[]},sendDiagnostics(e,t){return Q.sendDiagnostics({uri:e,diagnostics:[...t]})},reportError(e,t){ju(`Failed to publish diagnostics for ${e}`,t)}});Kl(s,e=>Q.console.error(e));function Pu(){return au}function Fu(){return $}function Iu(){return mu}Q.onInitialize(r=>{ou=!!r.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration,su=!!r.capabilities.workspace?.configuration,cu=!!r.capabilities.workspace?.workspaceFolders,lu=!!r.capabilities.workspace?.semanticTokens?.refreshSupport;let o=Ql(r.initializationOptions);uu=o?.semanticTokens===`overlay`,`root`in o&&vu({root:o.root});let s=r.workspaceFolders,c=s?.[0]?.uri||r.rootUri;Cu(c,s,o);let l=c?void 0:yu(au.root)[0];return c?wu():l&&wu(l),Al(Q,iu,Fu,Iu),t(Q,iu,Fu,Iu),i(Q,iu,Fu,Iu),e(Q,iu,Fu,Iu),n(Q,iu,Fu,Iu),a(Q,iu,Fu,Iu),{capabilities:{textDocumentSync:V.Incremental,completionProvider:{resolveProvider:!0,triggerCharacters:[`-`,`:`,` `,`"`,`'`]},hoverProvider:!0,codeActionProvider:!0,referencesProvider:!0,colorProvider:!0,...uu?{}:{semanticTokensProvider:{legend:al,full:!0}},...cu?{workspace:{workspaceFolders:{supported:!0,changeNotifications:!0}}}:{}}}}),Q.onInitialized(async()=>{cu&&Q.workspace.onDidChangeWorkspaceFolders(e=>{Ku(e).catch(e=>ju(`Failed to update workspace folders`,e))});try{let e=await ru(su,()=>Q.workspace.getConfiguration(`teacss`),e=>ju(`Failed to read workspace configuration`,e));e!==void 0&&vu(e),await Tu(yu(au.root)),$&&(await $.ready,await xu())}catch(e){ju(`Failed to complete initial setup`,e)}finally{du=!0,pu?.(),pu=void 0}Q.console.log(`✅ TeaCSS Language Server initialized`),await Au().catch(e=>ju(`Failed to update config watchers`,e)),await Mu()});let Lu;Q.onDidChangeWatchedFiles(e=>{Hl(e.changes,Eu(),Du())&&(clearTimeout(Lu),Lu=setTimeout(()=>{Ru().catch(e=>ju(`Failed to reload config sources`,e))},500))});async function Ru(){await Iu(),$&&(Q.console.log(`🔄 Config source changed, reloading TeaCSS...`),$r(),await Su(()=>$.contextManager.reload()),Q.console.log(`🔵 Reloaded.`),await Au().catch(e=>ju(`Failed to update config watchers`,e)),await Mu(),await Gu())}Q.onDidChangeConfiguration(async e=>{await Iu();let t=e.settings?.teacss;if(t!==void 0){let e=au,n=yu(e.root);vu(t);let r=yu(au.root),i=nu(n,r);i&&(await Tu(r),$&&await Su(()=>$.contextManager.setRoots(r)),await Au().catch(e=>ju(`Failed to update config watchers`,e)),await Gu()),!i&&e.unmatchedDiagnostics!==au.unmatchedDiagnostics&&await Gu(),(i||tu(e,au))&&await Mu()}});async function zu(){return await Iu(),$?($r(),await Su(()=>$.contextManager.reload()),await Au().catch(e=>ju(`Failed to update config watchers`,e)),await Mu(),await Gu(),{success:!0}):{success:!1}}async function Bu(e){if(await Iu(),!$)return{count:0};let t=iu.get(e.uri);if(!t)return{count:0};let n=Cs(e.uri),r=t.getText(),i=await $.contextManager.resolveClosestContext(r,n);return i?{count:(await i.generator.generate(r,{id:n,preflights:!1,safelist:!1,minify:!0})).matched.size}:{count:0}}async function Vu(e){if(await Iu(),!$)return{positions:[]};let t=iu.get(e.uri);return t?{positions:(await $.getMatchedPositions(t)).map(e=>({start:t.positionAt(e.start),end:t.positionAt(e.end),className:e.text}))}:{positions:[]}}async function Hu(e){if(await Iu(),!$)return null;let t=e.uri?iu.get(e.uri):iu.all()[0];return t?$.getProjectStatus(t):null}async function Uu(e){if(await Iu(),!$)return[];let t=iu.get(e.uri);return t?$.getClassNameEdits(t):[]}Q.onRequest(`teacss/reloadConfig`,zu),Q.onRequest(`teacss/getMatchedCount`,Bu),Q.onRequest(`teacss/getMatchedPositions`,Vu),Q.onRequest(`teacss/projectStatus`,Hu),Q.onRequest(`teacss/normalizeClasses`,Uu);async function Wu(e){$&&await Nu.publish(e)}async function Gu(){await Promise.all(iu.all().map(e=>Wu(e)))}async function Ku(e){await Iu();let t=new Set(e.removed.map(e=>Cs(e.uri))),n=_u.folderPaths.filter(e=>!t.has(e));for(let t of e.added){let e=Cs(t.uri);n.includes(e)||n.push(e)}if(_u.folderPaths=n,_u.rootPath=n[0],!$&&_u.rootPath&&(wu(),await Fu()?.ready),!$)return;$r();let r=bu(au.root)?yu(au.root):_u.folderPaths;await Su(()=>$.contextManager.setRoots(r)),await Au().catch(e=>ju(`Failed to update config watchers`,e)),await Mu(),await Gu()}iu.onDidChangeContent(e=>{Qr(Cs(e.document.uri)),Wu(e.document)}),iu.onDidClose(e=>{let t=Cs(e.document.uri);Qr(t),$?.contextManager.releaseDocument(t),Nu.invalidate(e.document.uri),Q.sendDiagnostics({uri:e.document.uri,diagnostics:[]})}),iu.listen(Q),Q.listen();export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teacss/language-server",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "Standalone LSP server for TeaCSS — completion, hover, color, and token highlighting over stdio.",
5
5
  "homepage": "https://css.teasim.com",
6
6
  "funding": "https://github.com/sponsors/billgo",
@@ -30,9 +30,9 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@colordx/core": "^5.5.0",
33
- "@teacss/config": "0.4.3",
34
- "@teacss/language-service": "0.4.3",
35
- "@teacss/runtime": "0.4.3",
33
+ "@teacss/config": "0.4.4",
34
+ "@teacss/language-service": "0.4.4",
35
+ "@teacss/runtime": "0.4.4",
36
36
  "magic-string": "^1.1.0",
37
37
  "prettier": "^3.9.6",
38
38
  "vscode-languageserver": "^10.1.0",
@@ -40,9 +40,9 @@
40
40
  "vscode-languageserver-types": "^3.18.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@teacss/autocomplete": "0.4.3",
44
- "@teacss/core": "0.4.3",
45
- "@teacss/preset-standard": "0.4.3"
43
+ "@teacss/autocomplete": "0.4.4",
44
+ "@teacss/core": "0.4.4",
45
+ "@teacss/preset-standard": "0.4.4"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=22.12.0"