@teacss/language-server 0.5.2 → 0.6.0

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 +29 -28
  2. package/package.json +7 -7
package/dist/server.js CHANGED
@@ -1,33 +1,34 @@
1
- import{a as e,i as t,n,o as r,r as i,t as a}from"./semanticTokens-Cniz5X9a.js";import{createRequire as o}from"node:module";import s from"node:process";import c from"magic-string";import l,{existsSync as u}from"node:fs";import d,{dirname as f,resolve as p}from"node:path";import{diagnoseCustom as m,entryDiscoveryFiles as h,findEntry as g,scaleThemeKeys as _,scanCustomBlocks as v}from"@teacss/config";import{createContext as y,defaultFilesystemGlobs as b}from"@teacss/runtime";import{fileURLToPath as x,pathToFileURL as S}from"node:url";import{channel as C,tracingChannel as w}from"node:diagnostics_channel";import{glob as T,readFile as E}from"node:fs/promises";import{DEFAULT_SOURCE_IGNORE as D}from"@teacss/runtime/source-generation";import{TextDocument as O}from"vscode-languageserver-textdocument";import{CodeActionKind as k,CompletionItemKind as A,DiagnosticSeverity as j}from"vscode-languageserver-types";import{colordx as M,extend as N}from"@colordx/core";import P from"@colordx/core/plugins/cmyk";import F from"@colordx/core/plugins/hwb";import I from"@colordx/core/plugins/lab";import L from"@colordx/core/plugins/lch";import R from"@colordx/core/plugins/names";import z from"@colordx/core/plugins/p3";import{DidChangeWatchedFilesNotification as ee,ProposedFeatures as B,TextDocumentSyncKind as V,TextDocuments as H,WatchKind as U,createConnection as te}from"vscode-languageserver/node";var W=Object.create,G=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,re=Object.getOwnPropertyNames,ie=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty,K=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),oe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=re(t),a=0,o=i.length,s;a<o;a++)s=i[a],!ae.call(e,s)&&s!==n&&G(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=ne(t,s))||r.enumerable});return e},se=(e,t,n)=>(n=e==null?{}:W(ie(e)),oe(t||!e||!e.__esModule||!ae.call(e,`default`)?G(n,`default`,{value:e,enumerable:!0}):n,e)),ce=o(import.meta.url);function q(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function*le(e){if(Array.isArray(e))for(let t=0,n=e.length;t<n;t++)Object.hasOwn(e,t)&&(yield e[t])}function ue(e){return e.replace(/\\([\da-f]{1,6})(?:\r\n|[ \t\n\r\f])?|\\([^\n\r\f])/gi,(e,t,n)=>{if(!t)return n;let r=Number.parseInt(t,16);return String.fromCodePoint(r===0||r>1114111||r>=55296&&r<=57343?65533:r)})}function de(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function fe(e=void 0){if(e===void 0)return[];if(!Array.isArray(e))return[e];for(let t=0,n=e.length;t<n;t++){if(Object.hasOwn(e,t))continue;let r=[],i=0;for(let t=0;t<n;t++)Object.hasOwn(e,t)&&de(r,i++,e[t]);return r}return e}function pe(e){return Array.from(new Set(le(e)))}function J(e,t){let n=e.length;n in e?Object.defineProperty(e,n,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[n]=t}function me(e,t,n=!1,r=t+1){let i=e[t];if(i!==`[`&&i!==`(`)return;let a=i===`[`?`]`:`)`,o=!1,s;for(let i=t+1;i<e.length;i++){let t=e[i];if(t===`
2
- `||t===`\r`||t===`\u2028`||t===`\u2029`)return;if(o){t===`*`&&e[i+1]===`/`&&(o=!1,i++);continue}if(s){t===`\\`?i++:t===s&&(s=void 0);continue}if(i>=r&&/\s/.test(t))return;if(t===`\\`)i++;else if(t===`/`&&e[i+1]===`*`)o=!0,i++;else if(t===`"`||t===`'`||n&&t==="`")s=t;else if(t===`[`||t===`(`)a+=t===`[`?`]`:`)`;else if(t===a.at(-1)&&(a=a.slice(0,-1),!a))return i+1}}function he(e,t){let n=0;for(;e[t-n-1]===`\\`;)n++;return n%2==1}const ge=/^(?:[\p{ID_Continue}$-]|\u200C|\u200D)+$/u,_e=/^(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?|\d(?:_?\d)*\.|\.\d(?:_?\d)*)(?:e[+-]?\d(?:_?\d)*)?$/i;function ve(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;return n>=0&&`{,`.includes(e[n])}function ye(e,t,n){let r=t+1;for(;/\s/.test(e[r]??``);)r++;if(e[r]!==`/`||e[r+1]===`/`||e[r+1]===`*`)return!1;let i=!1;for(r++;r<n;r++){let t=e[r];if(t===`
3
- `||t===`\r`||t===`\u2028`||t===`\u2029`)return!1;if(t===`\\`)r++;else if(t===`[`)i=!0;else if(t===`]`&&i)i=!1;else if(t===`/`&&!i){for(r++;/[a-z]/i.test(e[r]??``);)r++;for(;/\s/.test(e[r]??``);)r++;return r===n}}return!1}function be(e,t){let n=0,r;for(let i=t;i>=0;i--){let a=e[i];if(r)a===r&&!he(e,i)&&(r=void 0);else if(a===`"`||a===`'`||a==="`")r=a;else if(a===`]`)n++;else if(a===`[`&&(n--,ve(e,i)&&(n===0||ye(e,i,t))))return i}}function xe(e,t){let n=e[t];if(n===`"`||n===`'`||n==="`"){for(let r=t-1;r>=0;r--)if(e[r]===n&&!he(e,r))return r;return}if(n===`]`)return be(e,t);let r=t;for(;r>0&&!/\s/.test(e[r-1])&&!`({,[`.includes(e[r-1]);)r--;let i=e.slice(r,t+1);return ge.test(i)||_e.test(i)?r:void 0}function Se(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;if(n<0)return!1;if(`=({,[`.includes(e[n]))return!0;if(e[n]!==`:`)return!1;for(n--;n>=0&&/\s/.test(e[n]);)n--;let r=xe(e,n);if(r===void 0)return!1;for(n=r-1;n>=0&&/\s/.test(e[n]);)n--;return n>=0&&`{,[?`.includes(e[n])}function Ce(e,t){return Se(e,t)}function we(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e[n]!==`"`&&e[n]!==`'`&&e[n]!=="`"?!1:Ce(e,t)}function Te(e){let t=[],n=[],r=new Map,i=!1,a,o;for(let s=0;s<e.length;s++){let c=e[s];if(n.length===0){c===`\\`?(/\s/.test(e[s+1]??``)&&(a=void 0),s++):/\s/.test(c)?a=void 0:c===`"`||c===`'`?a=a===c?void 0:a??c:!a&&c===`[`&&J(n,s);continue}if((o||i)&&c===`[`&&/[:@\s]/.test(e[s-1])){J(n,s),r.set(s,o??i),i=!1,o=void 0;continue}if(i){c===`*`&&e[s+1]===`/`&&(i=!1,s++);continue}if(o){c===`\\`?s++:c===o&&(o=void 0);continue}if(c===`/`&&e[s+1]===`*`)i=!0,s++;else if(c===`"`||c===`'`)o=c;else if(c===`\\`)s++;else if(c===`[`)J(n,s);else if(c===`]`){let a=n.pop(),c=r.get(a);(/[:@]/.test(e[a-1])||e[s+1]===`:`)&&J(t,{end:s+1,start:a}),c===!0?i=!0:c&&(o=c)}}let s=[];for(let e of t.sort((e,t)=>e.start-t.start||t.end-e.end))(!s.length||e.start>=s.at(-1).end)&&J(s,e);return s}function Ee(e){let t=``,n,r=-1,i=-1,a=-1,o=[];for(let s=0;s<e.length;s++){let c=e[s];if(n){c===`\\`?s++:c===n&&(n=void 0);continue}if((t.length>0||i!==-1)&&c===`\\`){s++;continue}if(t.length>0&&(c===`"`||c===`'`)){n=c;continue}if((t.length>0||i!==-1)&&c===`/`&&e[s+1]===`*`){let t=e.indexOf(`*/`,s+2);if(t<0)break;s=t+1;continue}c===`(`||c===`[`?t+=c===`(`?`)`:`]`:c===t.at(-1)?t=t.slice(0,-1):t.length===0&&(c===`@`?(i===-1&&(i=s),J(o,s)):i===-1&&(c===`:`&&r===-1?r=s:c===`!`&&(a=s)))}let s=i===-1?e.length:i,c=e.slice(0,s),l=!1;s>0&&a===s-1&&(l=!0,c=c.slice(0,-1));let u=[];for(let t=0;t<o.length;t++){let n=o[t]+1,r=t+1<o.length?o[t+1]:e.length;J(u,e.slice(n,r))}return r!==-1&&r<s?{raw:e,body:c,property:e.slice(0,r),value:c.slice(r+1),keyword:!1,important:l,conditions:u}:{raw:e,body:c,keyword:!0,important:l,conditions:u}}const De=`utilities`;Object.freeze({imports:-200,properties:-150,preflights:-100,shortcuts:-50,primitives:-10,[De]:0});function Oe(e,t,n){let r=e[t];if(n.blockComment)return r===`*`&&e[t+1]===`/`?(n.blockComment=!1,t+1):t;if(n.quote)return r===`\\`?t+1:(r===n.quote&&(n.quote=void 0),t);if(n.closers.length>0&&r===`/`&&e[t+1]===`*`)return n.blockComment=!0,t+1;if(n.closers.length>0&&(r===`"`||r===`'`))return n.quote=r,t;if(r===`\\`)return t+1;if(r===`(`||r===`[`)return q(n.closers,r===`(`?`)`:`]`),t;if(r===n.closers.at(-1))return n.closers.pop(),t}function ke(e,t,n=e.length){let r={closers:[]};for(let i=t+1;i<n;i++){let t=e[i],n=Oe(e,i,r);if(n!==void 0){i=n;continue}if(r.closers.length===0){if(t===`}`)return{index:i,kind:`close`};if(t===`{`)return{index:i,kind:`open`}}}return{index:n,kind:`limit`}}function Ae(e,t,n=e.length){let r={closers:[]},i=Ot();for(let a=t+1;a<n;a++){let t=e[a],n=Oe(e,a,r);if(n!==void 0){a=n;continue}if(!(r.closers.length>0)){if(t===`}`)return{index:a,kind:`close`};if(t===`{`)return{index:a,kind:`open`};if(t===`'`||t===`"`||t==="`"||t===`/`&&(e[a+1]===`/`||e[a+1]===`*`||zt(e,a,i.forceRegex,i.canEnd)))return{index:a,kind:`host`};/\s/.test(t)||(i.forceRegex=!1),i.canEnd=Rt(e,a,i.canEnd,i)}}return{index:n,kind:`limit`}}const je=/[\s'"`;{},\])]/;function Me(e,t,n=e.length){if(e[t]!==`@`)return{conds:``,end:t};let r={closers:[]},i=t;for(;i<n;i++){let t=e[i],n=Oe(e,i,r);if(n!==void 0){i=n;continue}if(t===`/`&&(e[i+1]===`/`||e[i+1]===`*`)&&r.closers.length===0||je.test(t)&&r.closers.length===0)break}return{conds:e.slice(t,i),end:i}}function Ne(e,t=!1){let n=[],r={closers:[]},i=0;for(let a=0;a<e.length;a++){let o=e[a],s=Oe(e,a,r);if(s!==void 0){a=s;continue}(o===`;`||t&&/\s/.test(o))&&r.closers.length===0&&(q(n,e.slice(i,a)),i=a+1)}return q(n,e.slice(i)),n.map(e=>e.trim()).filter(Boolean)}function Pe(e){let t={closers:[]},n=!1,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=Oe(e,i,t);if(o!==void 0){i=o;continue}if(!(t.closers.length>0)){if(a===`<`&&Vt(e,i))return!1;if(a===`;`)return!0;a===`:`?n=!0:a===`?`&&(r=!0)}}return n&&!r}function Fe(e,t){let n=Ae(e,t);if(n.kind!==`close`)return;let r=e.slice(t+1,n.index);if(!Pe(r))return;let i=Ne(r,!0);if(i.length===0)return;let{conds:a,end:o}=Me(e,n.index+1);return{end:o,value:i.map(e=>`${e}${a}`).join(` `)}}function Ie(e,t,n=!1){let r=t+1;if(r>=e.length)return e.length;if(e[r]===`\r`&&e[r+1]===`
4
- `||n&&e[r]===`$`&&e[r+1]===`{`)return r+2;if(e[r]===`u`&&e[r+1]===`{`){let t=r+2;for(;/[0-9a-f]/i.test(e[t]??``);)t++;if(t>r+2&&e[t]===`}`)return t+1}return r+1}function Le(e,t,n){let r=e[t];return n.lineComment?((r===`
5
- `||r===`\r`||r===`\u2028`||r===`\u2029`)&&(n.lineComment=!1),t+1):n.blockComment?r===`*`&&e[t+1]===`/`?(n.blockComment=!1,t+2):t+1:n.quote?r===`\\`?Ie(e,t):(r===n.quote&&(n.quote=void 0),t+1):r===`\\`?Ie(e,t):r===`/`&&e[t+1]===`*`?(n.blockComment=!0,t+2):r===`/`&&e[t+1]===`/`&&n.parenDepth===0?(n.lineComment=!0,t+2):(r===`'`||r===`"`?n.quote=r:r===`(`?n.parenDepth++:r===`)`&&n.parenDepth>0?n.parenDepth--:r===`{`&&n.parenDepth===0?n.depth++:r===`}`&&n.parenDepth===0&&n.depth--,t+1)}function Re(e,t,n){let r={blockComment:!1,depth:1,lineComment:!1,parenDepth:0};for(let i=t+1;i<n;){let t=i;if(i=Le(e,i,r),r.depth===0)return t}return-1}const ze=`=([{,:>)$?|&.!~+-*/%^<`,Be=new Set(`as.assert.await.case.catch.class.const.default.delete.do.else.export.extends.finally.implements.import.in.instanceof.is.keyof.let.new.of.return.satisfies.static.throw.type.typeof.try.var.void.with.yield`.split(`.`)),Ve=new Set([`await`,`case`,`delete`,`do`,`else`,`in`,`new`,`of`,`return`,`throw`,`typeof`,`void`,`yield`]),He=new Set([`catch`,`for`,`if`,`switch`,`while`,`with`]),Ue=/^(?:a|abbr|address|animate|animateMotion|animateTransform|annotation|area|article|aside|audio|b|base|bdi|bdo|blockquote|body|br|button|canvas|caption|circle|cite|clipPath|code|col|colgroup|data|datalist|dd|defs|del|desc|details|dfn|dialog|discard|div|dl|dt|ellipse|em|embed|feBlend|feColorMatrix|feComponentTransfer|feComposite|feConvolveMatrix|feDiffuseLighting|feDisplacementMap|feDistantLight|feDropShadow|feFlood|feFuncA|feFuncB|feFuncG|feFuncR|feGaussianBlur|feImage|feMerge|feMergeNode|feMorphology|feOffset|fePointLight|feSpecularLighting|feSpotLight|feTile|feTurbulence|fieldset|figcaption|figure|filter|footer|foreignObject|form|g|h[1-6]|head|header|hgroup|hr|html|i|iframe|image|img|input|ins|kbd|label|legend|li|line|linearGradient|link|maction|maligngroup|malignmark|main|map|mark|marker|mask|math|menu|meta|metadata|meter|menclose|merror|mfenced|mfrac|mglyph|mi|mlabeledtr|mlongdiv|mmultiscripts|mn|mo|mover|mpadded|mpath|mphantom|mprescripts|mroot|mrow|ms|mscarries|mscarry|msgroup|msline|mspace|msqrt|msrow|mstack|mstyle|msub|msubsup|msup|mtable|mtd|mtext|mtr|munder|munderover|nav|noscript|object|ol|optgroup|option|output|p|path|pattern|picture|polygon|polyline|pre|progress|q|radialGradient|rect|rp|rt|ruby|s|samp|script|search|section|select|selectedcontent|semantics|set|slot|small|source|span|stop|strong|style|sub|summary|sup|svg|switch|symbol|table|tbody|td|template|text|textPath|textarea|tfoot|th|thead|time|title|tr|track|tspan|u|ul|use|var|video|view|wbr|[a-z][-\w]*-[\w-]+)$/i,We=/^(?:--|-?)[_a-z][-\w]*$/i,Ge=/^[+-]?(?:(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)%$/i;function Ke(e){if(/^(?:from|to)$/i.test(e)||Ge.test(e))return!0;let t=e.search(/\s/u);if(t<1)return!1;let n=e.slice(t).trim();return We.test(e.slice(0,t))&&Ge.test(n)}function qe(e,t,n=0){let r=e.slice(n,t);return/(?:^|[;}\n\r])\s*(?:(?:export|default|declare|async)\s+)*function(?:\s*\*)?[\s\S]*$/.test(r)}function Je(e,t,n=0){return/\bfunction(?:\s*\*)?[\s\S]*$/.test(e.slice(n,t))}function Ye(e,t,n=0){let r=e.slice(n,t);return/(?:^|[;{}\n\r])\s*(?:(?:export|default|declare|abstract)\s+)*(?:class|interface|namespace|enum|module|global)\b[^{};]*$/.test(r)}function Xe(e,t,n=0){return/(?:^|[^\w$])(?:abstract\s+)?class\b[^{};]*$/.test(e.slice(n,t))}function Ze(e,t,n=0){return Ye(e,t,n)||Xe(e,t,n)||Je(e,t,n)}function Qe(e,t){let n=-1,r=0,i=0,a=0,o;for(let s=0;s<e.length;s++){let c=e[s];if(o){c===`\\`?s++:c===o&&(o=void 0);continue}if(i>0){c===`\\`?s++:c===`'`||c===`"`?o=c:c===`{`?i++:c===`}`&&i--;continue}if((t&&c===`$`||c===`#`||c===`@`)&&e[s+1]===`{`){i=1,s++;continue}if(c===`\\`){s++;continue}if(c===`'`||c===`"`){o=c;continue}c===`[`?r++:c===`]`&&r>0?r--:c===`(`?a++:c===`)`&&a>0?a--:r===0&&a===0&&(c===`;`||c===`{`||c===`}`||c===`
6
- `||c===`\r`||t&&c==="`")&&(n=s)}return n}function $e(e){for(let t of e)if((t.codePointAt(0)??0)>127)return!0;return!1}function et(e,t,n=!1,r=0){let i=e.slice(r,t),a=Qe(i,n),o=i.slice(a+1).trim();if(o.length===0)return!1;let s=o.split(/\s*(?:,|>|\+|~)\s*|\s+/).filter(Boolean),c=o.split(`,`).map(e=>e.trim());return/^@(?:-[a-z]+-)?[a-z][-\w]*\b/i.test(o)||/^%[-_a-z][-\w]*$/i.test(o)||/(?:^|[\s>+~,])(?:&|[-_a-z][-\w]*|\*)?(?:[.#](?=\S)|\[[^\]]*\])/i.test(o)||/(?:^|[\s>+~,])(?:\*|[-\w]+)\|(?:\*|[-\w]+)(?=$|[\s.#:[>+~,])/i.test(o)||/^(?:(?:[a-z][-\w]*)?|&):{1,2}[-\w(]/i.test(o)||/(?:^|[\s>+~,])\\[0-9a-f]{1,6}\s?/i.test(o)||$e(o)||n&&o.includes("${")||o.includes(`#{`)||o.includes(`@{`)||c.every(Ke)||s.length>0&&s.every(e=>e===`*`||Ue.test(e))}function tt(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;let r=e[n];if(r!==`'`&&r!==`"`)return!1;for(n++;n<e.length;n++){let t=e[n];if(t===`\\`)n++;else if(t===r){for(n++;/\s/.test(e[n]??``);)n++;return e[n]===`:`}}return!1}function nt(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e.startsWith(`...`,n)}function rt(e,t){let n=0;for(t--;t>=0&&e[t]===`\\`;t--)n++;return n%2==1}function it(e,t,n=0){let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;if(r<0)return!1;if(ze.includes(e[r]))return!0;let i=r+1;for(;r>=0&&/[\w$]/.test(e[r]);)r--;let a=e.slice(r+1,i);return Be.has(a)||Ze(e,t,n)}const at=new Set([`catch`,`class`,`do`,`else`,`finally`,`switch`,`try`]),ot=/^(?:(?:await\s+)?using|break|class|const|continue|debugger|declare|do|enum|export|for|function|if|import|interface|let|namespace|return|switch|throw|try|type|var|while|with)(?=$|[\s;(){}])/,st=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*(?:\s*(?:(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*|(?:\?\.)?\[[^\]]+\]))*\s*(?:(?:\?\.)?\(|\+\+|--|[-+*/%&|^]?=(?!=|>))/u,ct=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*\s*(?:(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*)+\s*$/u,lt=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*(?:\s*(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*)*\s*(?:\?\.)?\[[^\]]+\]\s*$/u,ut=/^new\s+(?:class\b|function\b|[$_\p{ID_Start}])/u,dt=/^\([\s\S]*\)$/,ft=/^\([\s\S]*\)\s*(?:\(|\?\.|\.)/,pt=/^(?:(?:await|delete|typeof|void)\s+\S|yield(?:\s+\S|\s*\*\s*\S))/u,mt=/^(?:\+\+|--|!|~)\s*\S/u,ht=/^\[[\s\S]*\]\s*=(?!=|>)/,gt=new Set([`as`,`in`,`instanceof`,`satisfies`]),_t=/^(?:=(?!=|>)|\+=|-=|\*\*=|\*=|\/=|%=|&&=|&=|\|\|=|\|=|\^=|\?\?=|<<=|>>>=|>>=)/,vt=/^(?:(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[bB][01](?:_?[01])*|0[oO][0-7](?:_?[0-7])*)n?|(?:\d(?:_?\d)*)n|(?:\d(?:_?\d)*\.(?:\d(?:_?\d)*)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|\d(?:_?\d)*(?:[eE][+-]?\d(?:_?\d)*)?)/;function yt(e){let t={closers:[]},n=!1,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=t.closers.length===0,s=Oe(e,i,t);if(s!==void 0){o&&(a===`(`||a===`[`)&&(n=!0),i=s;continue}if(!(t.closers.length>0)){if(a===`:`||a===`@`)return!n||r?void 0:a===`:`?`declaration`:`condition`;if(a===`!`&&i===e.length-1)return!n||r?void 0:`important`;/\s/u.test(a)?r=!0:n=!0}}}function bt(e,t){if(pt.test(e))return!0;if(!mt.test(e))return!1;let n=yt(e);return n===void 0||t&&n===`important`}function xt(e,t){if(!ht.test(e))return!1;let n=yt(e);return n===void 0||t&&n===`important`}function St(e,t){let n={closers:[]};for(let r=t;r<e.length;r++){let t=Oe(e,r,n);if(t!==void 0&&(r=t,n.closers.length===0))return r+1}}function Ct(e){let t={closers:[]},n=-1;for(let r=0;r<e.length;r++){let i=Oe(e,r,t);if(i!==void 0){r=i;continue}if(!(t.closers.length>0)){if(/\s/u.test(e[r]))return-1;n===-1&&(e[r]===`:`||e[r]===`@`)&&r>0&&(n=r)}}return n}function wt(e,t){let n=t=>{for(;t<e.length&&/\s/u.test(e[t]);)t++;return t},r=0;for(;e[r]===`+`||e[r]===`-`;)r=n(r+1);let i=Zt(e,r);i?.value===`await`&&/\s/u.test(e[i.end]??``)&&(r=n(i.end),i=Zt(e,r));let a;if(i!==void 0)a=`identifier`,r=i.end;else if(e[r]===`[`||e[r]===`(`){let t=St(e,r);if(t===void 0)return!1;a=e[r]===`[`?`array`:`parenthesized`,r=t}else{let t=vt.exec(e.slice(r));if(t===null)return!1;a=`number`,r+=t[0].length}let o=!1,s=!1;for(;r<e.length;){let t=r;if(r=n(r),e[r]===`!`&&e[r+1]!==`=`){s=!0,r++;continue}if(e[r]===`(`||e.startsWith(`?.(`,r))return!0;if(e.startsWith(`?.`,r))r=n(r+2);else if(e[r]===`.`)r=n(r+1);else if(e[r]!==`[`){r=t;break}if(e[r]===`[`){let t=St(e,r);if(t===void 0)return!1;o=!0,s=!1,r=t;continue}if(e[r]===`#`&&r++,i=Zt(e,r),i===void 0)return!1;o=!0,s=!1,r=i.end}if(r=n(r),e[r]===`(`||e.startsWith(`?.(`,r))return!0;if(o&&e.slice(r).trim().length===0)return!s||yt(e)!==`important`||t;if(a===`array`&&!o)return!1;if(e.startsWith(`++`,r)||e.startsWith(`--`,r))return e.slice(r+2).trim().length===0;let c=_t.exec(e.slice(r));return c!==null&&e.slice(r+c[0].length).trim().length>0}function Tt(e){let t=Ct(e),n=(t,n)=>{let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;let i=t+n;for(;i<e.length&&/\s/.test(e[i]);)i++;return r>=0&&e[r]!==`:`&&i<e.length},r=(t,r,i)=>{let a=e[r-1]??``,o=e[i]??``;return!/\s/u.test(a)&&!`)!]`.includes(a)||!/\s/u.test(o)&&!`([`.includes(o)&&(t!==`in`&&t!==`instanceof`||!`!~+-`.includes(o))&&(t!==`as`&&t!==`satisfies`||o!==`-`)?!1:n(r,i-r)},i={closers:[]};for(let a=0;a<e.length;a++){let o=e[a],s=Oe(e,a,i);if(s!==void 0){a=s;continue}if(i.closers.length>0||t>=0&&a>t)continue;let c=e[a+1],l=Zt(e,a);if(l!==void 0){if(gt.has(l.value)&&r(l.value,a,l.end))return!0;a=l.end-1;continue}if((o===`?`||o===`<`||o===`>`)&&n(a,c===o||c===`=`||o===`?`&&c===`.`?2:1)||(o===`=`&&c===`=`||o===`!`&&c===`=`||o===`&`&&c===`&`||o===`|`&&c===`|`||o===`*`&&c===`*`)&&n(a,2)||`+-*/%&|^`.includes(o)&&(/\s/.test(e[a-1]??``)||/\s/.test(c??``))&&n(a,1)||o===`,`&&(/\s/.test(e[a-1]??``)||/\s/.test(c??``))&&n(a,1))return!0}return!1}function Et(e,t){let n=Ae(e,t);if(n.kind===`open`)return!0;if(n.kind!==`close`)return!1;let r=Ne(e.slice(t+1,n.index));if(r.length===0)return!0;let i=r.length===1;return r.some(e=>ot.test(e)||st.test(e)||ct.test(e)||lt.test(e)||wt(e,i)||ut.test(e)||dt.test(e)||ft.test(e)||bt(e,i)||xt(e,i)||Tt(e))}function Dt(e,t,n=0,r=0,i=``){if(`:|&=,(`.includes(i))return!1;let a=t-1;for(;a>=0&&/\s/.test(e[a]);)a--;let o=e.slice(n,t);if(Je(e,t,n))return r>0||`:|&=,(`.includes(e[a]??``)?!1:qe(e,t,n);if(/\bclass\b[^;]*$/.test(o))return Ye(e,t,n);if(e[a]===`)`||e[a]===`>`)return e.slice(Math.max(n,a-1),a+1)!==`=>`;let s=a+1;for(;a>=0&&/[\w$]/.test(e[a]);)a--;let c=e.slice(a+1,s);return at.has(c)?!0:Ze(e,t,n)}function Ot(){return{angleDepth:0,canEnd:!1,classParenRoles:[],forceRegex:!1,labelCandidate:!1,labelColon:-1,lastSignificant:``,lastWord:``,parenKinds:[],pendingFunctions:[],restrictedLineStatement:!1,statementStart:!0,typeDeclaration:!1}}const kt=new Set([`abstract`,`async`,`declare`,`default`,`export`]),At=new Set([`abstract`,`asserts`,`extends`,`in`,`infer`,`is`,`keyof`,`new`,`readonly`,`typeof`,`unique`]);function jt(e,t){let n=e.pendingFunctions.at(-1);n?.phase===`return-type`&&(n.typeCanEnd=!At.has(t))}function Mt(e,t,n){let r=e.pendingFunctions.at(-1);r?.phase===`return-type`&&(`|&?:=,(`.includes(t)||t===`[`||t===`<`?r.typeCanEnd=!1:(n||t===`]`||t===`>`||t===`)`)&&(r.typeCanEnd=!0))}function Nt(e){let t=e.pendingFunctions.at(-1);if(t)return t.phase===`after-params`?(e.pendingFunctions.pop(),t.kind):t.phase===`return-type`?t.typeCanEnd?(e.pendingFunctions.pop(),t.kind):`T`:`O`}function Pt(e,t){return!e.restrictedLineStatement&&!(e.typeDeclaration&&t===0&&e.canEnd)?!1:(e.canEnd=!1,e.forceRegex=!0,e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=``,e.lastWord=``,e.restrictedLineStatement=!1,e.statementStart=!0,e.typeDeclaration=!1,!0)}function Ft(e,t=!1){e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=`;`,e.lastWord=``,t||(e.pendingFunctions.length=0),e.restrictedLineStatement=!1,e.statementStart=!0,e.typeDeclaration=!1}function It(e,t){e.canEnd=!0,e.forceRegex=!1,e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=t,e.lastWord=``,e.statementStart=!1,Mt(e,t,!0)}function Lt(e,t,n){if(!n||/\s/.test(e[t-1]??``))return!1;let r=t+1;for(;/\s/.test(e[r]??``);)r++;return/[A-Z_$\p{ID_Start}]/u.test(e[r]??``)}function Rt(e,t,n,r){let i=e[t],a=r?.lastWord??``;if(/\s/.test(i??``))return n;if(/[\w$\p{ID_Continue}]/u.test(i??``)){if(/[\w$\p{ID_Continue}]/u.test(e[t+1]??``))return n;let i=t;for(;i>0&&/[\w$\p{ID_Continue}]/u.test(e[i-1]??``);)i--;let a=e.slice(i,t+1),o=i-1;for(;o>=0&&/\s/.test(e[o]??``);)o--;let s=e[o]===`.`||e[o]===`#`;if(r){let e=r.statementStart;r.labelCandidate=e,r.labelColon=-1,r.lastSignificant=`word`,r.lastWord=s?``:a,!s&&a===`function`?q(r.pendingFunctions,{kind:e?`B`:`O`,phase:`before-params`,typeCanEnd:!1}):s||jt(r,a),!s&&e&&(a===`type`||a===`import`||a===`interface`||a===`declare`||a===`export`)&&(r.typeDeclaration=!0),!s&&e&&(a===`break`||a===`continue`||a===`debugger`)&&(r.restrictedLineStatement=!0),r.statementStart=!s&&e&&kt.has(a)}return s||!(Be.has(a)||He.has(a))}if(r&&(i!==`:`&&(r.labelCandidate=!1),i!==`{`&&(r.labelColon=-1),r.lastWord=``,r.statementStart=!1),/\d/.test(i??``)||i===`.`&&n&&/\d/.test(e[t-1]??``))return r&&(r.lastSignificant=`number`,Mt(r,i,!0)),!0;if(i===`]`)return r&&(r.lastSignificant=i,Mt(r,i,!0)),!0;if(i===`[`)return r&&(r.lastSignificant=i,Mt(r,i,!1)),!1;if(i===`(`){if(r){let e=r.pendingFunctions.at(-1);q(r.classParenRoles,a===`cn`?`C`:n||e?.phase===`before-params`||He.has(a)?`O`:`T`),e?.phase===`before-params`?(e.phase=`params`,q(r.parenKinds,`F`)):q(r.parenKinds,He.has(a)?`1`:`0`),r.forceRegex=!1,r.lastSignificant=i,Mt(r,i,!1)}return!1}if(i===`)`){if(r){r.classParenRoles.pop();let e=r.parenKinds.pop();if(r.forceRegex=e===`1`,e===`F`){let e=r.pendingFunctions.at(-1);e?.phase===`params`&&(e.phase=`after-params`)}r.lastSignificant=i,Mt(r,i,!0)}return!0}if(i===`<`)return r&&(Lt(e,t,n)&&r.angleDepth++,r.lastSignificant=i,Mt(r,i,!1)),!1;if(i===`>`)return r?.angleDepth?(r.angleDepth--,r.lastSignificant=i,Mt(r,i,!0),!0):(r&&(r.lastSignificant=i,Mt(r,i,!1)),!1);if(i===`+`||i===`-`)return r&&(r.lastSignificant=i),e[t-1]===i||e[t+1]===i?(r&&Mt(r,i,n),n):(r&&Mt(r,i,!1),!1);if(i===`:`&&r){let e=r.pendingFunctions.at(-1);return e?.phase===`after-params`&&(e.phase=`return-type`,e.typeCanEnd=!1),r.labelCandidate&&(r.labelColon=t),r.lastSignificant=i,Mt(r,i,!1),!1}return i===`!`&&e[t+1]!==`=`?(r&&(r.lastSignificant=i,Mt(r,i,n)),n):i===`}`||i===`'`||i===`"`||i==="`"?(r&&(r.lastSignificant=i,Mt(r,i,!0)),!0):(r&&(r.lastSignificant=i,Mt(r,i,!1)),!1)}function zt(e,t,n=!1,r){if(e[t+1]===`/`||e[t+1]===`*`)return!1;if(n)return!0;if(r!==void 0)return!r;let i=t-1;for(;i>=0&&/\s/.test(e[i]);)i--;if(i<0)return!0;if((e[i]===`+`||e[i]===`-`)&&e[i-1]===e[i]||e[i]===`!`&&i>0&&/[\w$)\]]/.test(e[i-1]??``)||e[i]===`>`&&i>0&&/[\w$)>]/.test(e[i-1]??``))return!1;if(`=([{,:;!?&|+-*%^~<>`.includes(e[i]))return!0;let a=i+1;for(;i>=0&&/[\w$]/.test(e[i]);)i--;return Ve.has(e.slice(i+1,a))}function Bt(e,t){let n=!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`
7
- `||t===`\r`||t===`\u2028`||t===`\u2029`)return{end:-1,failedUntil:r};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{end:r,failedUntil:r}}}return{end:-1,failedUntil:e.length}}function Vt(e,t){let n=e[t+1]===`/`,r=t+(n?2:1),i=r;if(e[r]!==`>`){let t=e.codePointAt(r);if(t===void 0)return;let a=String.fromCodePoint(t);if(!Jt.test(a))return;for(i+=a.length;i<e.length;){let t=e.codePointAt(i);if(t===void 0)break;let n=String.fromCodePoint(t);if(!Yt.test(n)&&!`:.-`.includes(n))break;i+=n.length}let o=e[i];if(!/[\s/>]/.test(o??``)&&(o!==`<`||n))return}return{closing:n,name:e.slice(r,i),nameEnd:i}}function Ht(e,t,n){let r=n.get(t);if(r!==void 0)return r;let i=!1,a=!1,o=[],s;for(let r=t;r<e.length;r++){let c=e[r],l=e[r+1];if(a)(c===`
8
- `||c===`\r`||c===`\u2028`||c===`\u2029`)&&(a=!1);else if(i)c===`*`&&l===`/`&&(i=!1,r++);else if(s)c===`\\`?r++:c===s&&(s=void 0);else if(c===`/`&&l===`/`)a=!0,r++;else if(c===`/`&&l===`*`)i=!0,r++;else if(c===`'`||c===`"`||c==="`")s=c;else if(c===`<`)q(o,r);else if(c===`>`&&e[r-1]!==`=`){let e=o.pop();if(e!==void 0&&(n.set(e,r),e===t))return r}}for(let e of o)n.set(e,-1);return-1}function Ut(e,t,n){return!t.closing&&e[t.nameEnd]===`<`?Ht(e,t.nameEnd,n):-1}function Wt(e,t=0){return{blockComment:!1,braceDepth:+!!e,braceKinds:[],declarationBoundary:t,expression:Ot(),failedRegexUntil:-1,kind:`host`,lineComment:!1,terminating:e}}function Gt(e){let t=e.at(-1);t?.kind===`host`&&It(t.expression,`jsx`)}function Kt(e,t,n){for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`\\`)r=Ie(e,r,n==="`")-1;else if(t===n)return r+1}return-1}const qt=new Set(`break.case.catch.class.const.continue.debugger.default.delete.do.else.enum.export.extends.false.finally.for.function.if.import.in.instanceof.new.null.return.super.switch.this.throw.true.try.typeof.var.void.while.with`.split(`.`)),Jt=/^[$_\p{ID_Start}]$/u,Yt=/^(?:[$\p{ID_Continue}]|\u200c|\u200d)$/u;function Xt(e,t){if(e[t]!==`\\`||e[t+1]!==`u`)return;if(e[t+2]===`{`){let n=0,r=t+3,i=0;for(;/^[0-9a-f]$/i.test(e[r]??``);){if(i=i*16+Number.parseInt(e[r],16),i>1114111)return;n++,r++}return n===0||e[r]!==`}`?void 0:{character:String.fromCodePoint(i),end:r+1}}let n=e.slice(t+2,t+6);if(/^[0-9a-f]{4}$/i.test(n))return{character:String.fromCodePoint(Number.parseInt(n,16)),end:t+6}}function Zt(e,t){let n=[],r=!1,i=t,a=!0;for(;i<e.length;){let t=Xt(e,i),o=t?.character??String.fromCodePoint(e.codePointAt(i));if(!(a?Jt.test(o):Yt.test(o)))break;q(n,o),r||=t!==void 0,i=t?.end??i+o.length,a=!1}return a?void 0:{end:i,escaped:r,value:n.join(``)}}function Qt(e,t,n){let r=[],i=!1,a=!1,o=!1,s=!0,c=!1,l=`start`,u=!1,d;for(let f=t+1;f<n;f++){let t=e[f],n=e[f+1];if(o){(t===`
9
- `||t===`\r`||t===`\u2028`||t===`\u2029`)&&(o=!1);continue}if(i){t===`*`&&n===`/`&&(i=!1,f++);continue}if(d){t===`\\`?f++:t===d&&(d=void 0);continue}if(t===`/`&&n===`/`){o=!0,f++;continue}if(t===`/`&&n===`*`){i=!0,f++;continue}if(t===`'`||t===`"`||t==="`"){if(r.length===0&&l!==`constraint`&&l!=="default")return!1;d=t,u=!0;continue}if(t===`(`||t===`[`||t===`{`||t===`<`){if(r.length===0&&l!==`constraint`&&l!=="default")return!1;q(r,t===`(`?`)`:t===`[`?`]`:t===`{`?`}`:`>`),u=!0;continue}if(t===r.at(-1)){r.pop();continue}if(r.length>0||/\s/.test(t))continue;if(t===`,`)return!(l===`start`||l===`after-const`||(l===`constraint`||l==="default")&&!u);if(t===`=`){if(n===`>`){if(l!==`constraint`&&l!=="default")return!1;u=!0,f++;continue}if(l===`constraint`&&!u||l!==`after-name`&&l!==`constraint`)return!1;a=!0,l=`default`,u=!1;continue}let p=Zt(e,f);if(p){let e=p.value;if(l===`start`)!p.escaped&&e===`const`?l=`after-const`:(c=!0,s=!qt.has(e),l=`after-name`);else if(l===`after-const`)c=!0,s=!qt.has(e),l=`after-name`;else if(l===`after-name`){if(p.escaped||e!==`extends`)return!1;a=!0,l=`constraint`,u=!1}else u=!0;f=p.end-1}else{if(t===`/`||l!==`constraint`&&l!=="default")return!1;u=!0}}return!c||!s||!a||l===`after-const`||(l===`constraint`||l==="default")&&!u?!1:l===`after-name`||l===`constraint`||l==="default"}function $t(e,t){let n=t;for(;n<e.length;)if(/\s/.test(e[n]))n++;else if(e[n]===`/`&&e[n+1]===`/`)for(n+=2;n<e.length&&e[n]!==`
10
- `&&e[n]!==`\r`&&e[n]!==`\u2028`&&e[n]!==`\u2029`;)n++;else if(e[n]===`/`&&e[n+1]===`*`){let t=e.indexOf(`*/`,n+2);if(t===-1)return e.length;n=t+2}else break;return n}function en(e,t,n){let r=Ht(e,t,n);return r===-1||!Qt(e,t,r)?-1:e[$t(e,r+1)]===`(`?r:-1}function tn(e,t,n){let r=new Set,i=[Wt(!1)],a=0;for(;a<e.length;){let o=i.at(-1),s=e[a],c=e[a+1];if(o.kind===`template`){s===`\\`?a=Ie(e,a,!0):s==="`"?(i.pop(),Gt(i),a++):s===`$`&&c===`{`?(q(i,Wt(!0)),a+=2):a++;continue}if(o.kind===`element`){if(n===`auto`&&(s===`'`||s===`"`||s==="`")&&a>=o.failedQuoteUntil[s]){let t=Kt(e,a,s);if(t!==-1){a=t;continue}o.failedQuoteUntil[s]=e.length}if(n===`auto`&&s===`/`&&c===`*`&&a>=o.failedBlockCommentUntil){let t=e.indexOf(`*/`,a+2);if(t!==-1){a=t+2;continue}o.failedBlockCommentUntil=e.length}if(s===`{`){q(i,Wt(!0,a+1)),a++;continue}if(s!==`<`){a++;continue}let r=Vt(e,a);if(!r){a++;continue}q(i,{blockComment:!1,closing:r.closing,kind:`tag`,name:r.name,opening:a,typeEnd:Ut(e,r,t)}),a=r.nameEnd;continue}if(o.kind===`tag`){if(o.blockComment){s===`*`&&c===`/`?(o.blockComment=!1,a+=2):a++;continue}if(o.quote){s===`\\`?a=Ie(e,a):(s===o.quote&&(o.quote=void 0),a++);continue}if(s===`/`&&c===`*`){o.blockComment=!0,a+=2;continue}if(s===`'`||s===`"`){o.quote=s,a++;continue}if(a<=o.typeEnd){a++;continue}if(s===`<`){i.pop();continue}if(s===`{`){q(i,Wt(!0,a+1)),a++;continue}if(s!==`>`){a++;continue}let t=a-1;for(;/\s/.test(e[t]??``);)t--;let n=!o.closing&&e[t]===`/`;if(i.pop(),o.closing){let e=i.at(-1);e?.kind===`element`&&e.name===o.name&&(i.pop(),r.add(e.opening),Gt(i))}else n?(r.add(o.opening),Gt(i)):q(i,{failedBlockCommentUntil:-1,failedQuoteUntil:{'"':-1,"'":-1,"`":-1},kind:`element`,name:o.name,opening:o.opening});a++;continue}if(o.lineComment){(s===`
11
- `||s===`\r`||s===`\u2028`||s===`\u2029`)&&(o.lineComment=!1,Pt(o.expression,o.braceDepth)),a++;continue}if(o.blockComment){s===`*`&&c===`/`?(o.blockComment=!1,a+=2):a++;continue}if(o.quote){s===`\\`?a=Ie(e,a):(s===o.quote&&(o.quote=void 0,It(o.expression,`string`)),a++);continue}if(s===`/`&&c===`/`){o.lineComment=!0,a+=2;continue}if(s===`/`&&c===`*`){o.blockComment=!0,a+=2;continue}if(s===`'`||s===`"`){o.quote=s,a++;continue}if(s==="`"){q(i,{kind:`template`}),a++;continue}if(s===`\\`){let t=Xt(e,a);if(t){a=t.end,It(o.expression,`word`);continue}}if(s===`/`&&a>=o.failedRegexUntil&&zt(e,a,o.expression.forceRegex,o.expression.canEnd)){let t=Bt(e,a);if(t.end!==-1){a=t.end,It(o.expression,`regex`);continue}o.failedRegexUntil=t.failedUntil}if(s===`<`&&!o.expression.canEnd){let r=Vt(e,a);if(r&&!r.closing){let o=n===`tsx`?en(e,a,t):-1;if(o!==-1){a=o+1;continue}q(i,{blockComment:!1,closing:!1,kind:`tag`,name:r.name,opening:a,typeEnd:Ut(e,r,t)}),a=r.nameEnd;continue}}if(s===`{`){let t=Nt(o.expression),n=o.expression.labelColon>=0,r=o.expression.statementStart&&(o.braceKinds.at(-1)===`B`||o.declarationBoundary>0||o.braceKinds.length===0&&Et(e,a)),i=o.expression.forceRegex||n||r?`B`:t??(Dt(e,a,o.declarationBoundary,o.expression.parenKinds.length,o.expression.lastSignificant)?`B`:`O`);q(o.braceKinds,i),o.braceDepth++,o.expression.canEnd=!1,o.expression.forceRegex=!1,o.expression.labelCandidate=!1,o.expression.labelColon=-1,o.expression.lastSignificant=`{`,o.expression.lastWord=``,o.expression.statementStart=i===`B`,a++;continue}if(s===`}`&&o.braceDepth>0){if(o.braceDepth--,o.terminating&&o.braceDepth===0)i.pop();else{let e=o.braceKinds.pop();o.expression.canEnd=e!==`B`,o.expression.forceRegex=e===`B`,o.expression.labelCandidate=!1,o.expression.labelColon=-1,o.expression.lastSignificant=`}`,o.expression.lastWord=``,o.expression.statementStart=e===`B`,e===`B`&&(o.declarationBoundary=a+1)}a++;continue}if((s===`
12
- `||s===`\r`||s===`\u2028`||s===`\u2029`)&&Pt(o.expression,o.braceDepth)){a++;continue}/\s/.test(s)||(o.expression.forceRegex=!1),o.expression.canEnd=Rt(e,a,o.expression.canEnd,o.expression),s===`;`&&(Ft(o.expression,o.braceKinds.at(-1)===`T`),o.braceKinds.length===0&&(o.declarationBoundary=a+1)),a++}return r}function nn(e,t,n){return!t&&n.has(e)}function rn(e,t){for(;t>=0&&/\s/.test(e[t]??``);)t--;if(e[t]!==`=`)return!1;for(t--;t>=0&&/\s/.test(e[t]??``);)t--;let n=t+1;for(;t>=0&&/[\w$-]/.test(e[t]??``);)t--;let r=e.slice(t+1,n);return r===`class`||r===`className`}function an(e,t){return rn(e,t-1)}function on(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]??``);)n--;return e[n]===`{`?rn(e,n-1):rn(e,n)}function sn(e){for(let t=e.classParenRoles.length-1;t>=0;t--){let n=e.classParenRoles[t];if(n!==`T`)return n===`C`}return!1}function cn(e,t,n){let r=t-1;for(;r>=0&&/\s/.test(e[r]??``);)r--;return e[r]===`(`?n.classParenRoles.at(-1)===`T`:e[r]===`[`||e[r]===`?`||e[r]===`:`||e[r]===`&`&&e[r-1]===`&`||e[r]===`|`&&e[r-1]===`|`}function ln(e,t,n,r,i){if(r===`block`){let n=e.indexOf(`*/`,t);return n===-1?e.length:n}if(r===`line`){for(let n=t;n<e.length;n++){let t=e[n];if(t===`
13
- `||t===`\r`||t===`\u2028`||t===`\u2029`)return n}return e.length}if(n){for(let r=t;r<e.length;r++){let t=e[r];if(t===`\\`)r=Ie(e,r)-1;else if(t===n||t===`
14
- `||t===`\r`||t===`\u2028`||t===`\u2029`)return r}return e.length}if(i)for(let n=t;n<e.length;n++){let t=e[n];if(t===`\\`)n=Ie(e,n,!0)-1;else if(t==="`"||t===`$`&&e[n+1]===`{`)return n}return e.length}function un(e,t,n){if(!e.includes(`{`))return e;let r=new Map,i=t!==`none`&&e.includes(`<`)?tn(e,r,t):new Set,a=``,o=0,s,c,l=!1,u=-1,d=0,f=[],p=0,m=-1,h=Ot(),g,_=0,v=!1,y=0,b=0,x,S=-1,C=[],w=[],T=[],E=[],D=-1;for(;o<e.length;){let O=e[o];if(g){let t=Le(e,o,g);a+=e.slice(o,t),o=t,g.depth===0&&(g=void 0,_=t);continue}if(c){if(c===`line`&&(O===`
15
- `||O===`\r`||O===`\u2028`||O===`\u2029`)){c=void 0,u=-1,d=0,Pt(h,f.length)&&(p=o+1),a+=O,o++;continue}if(c===`block`&&O===`*`&&e[o+1]===`/`){c=void 0,u=-1,d=0,a+=`*/`,o+=2;continue}if(O!==`{`){a+=O,o++;continue}}else if(s){if(O===`
16
- `||O===`\r`||O===`\u2028`||O===`\u2029`){s=void 0,l=!1,u=-1,d=0,It(h,`string`),a+=O,o++;continue}if(O===`\\`){let t=Ie(e,o);a+=e.slice(o,t),o=t;continue}if(O===s){s=void 0,l=!1,u=-1,d=0,It(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=Ie(e,o,!0);a+=e.slice(o,t),o=t;continue}if(O==="`"){E.pop(),It(h,`template`),a+=O,o++;continue}if(O===`{`&&e[o-1]===`$`){t.groupLimit=-1,t.inText=!1,t.interpolationDepth=1,q(f,`I`),h.canEnd=!1,h.forceRegex=!1,h.lastSignificant=`{`,h.lastWord=``,a+=O,o++;continue}if(t.css){let n=Le(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`?Fe(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}q(w,`T`),x=void 0,q(f,`J`),b++,q(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=Vt(e,o);S=t?Ut(e,t,r):-1}a+=O,o++;continue}else if(x===`tag`&&o<=S){a+=O,o++;continue}else if(x===`tag`&&O===`{`){q(w,`G`),x=void 0,q(f,`J`),b++,q(C,an(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,It(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===`<`&&nn(o,h.canEnd,i)){q(T,{baseDepth:y,resumeExpression:b>0}),v=!1,x=`tag`;let t=Vt(e,o);S=t?Ut(e,t,r):-1,a+=O,o++;continue}else if(O===`\\`){let t=Xt(e,o);if(t){a+=e.slice(o,t.end),o=t.end,It(h,`word`);continue}}else if(O===`'`||O===`"`){s=O,l=on(e,o)||sn(h)||x===void 0&&C.at(-1)===!0&&cn(e,o,h),u=-1,d=o+1,a+=O,o++;continue}else if(O==="`"){q(E,{classLiteral:on(e,o)||sn(h)||x===void 0&&C.at(-1)===!0&&cn(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&&zt(e,o,h.forceRegex,h.canEnd)){let t=Bt(e,o);if(t.end!==-1){a+=e.slice(o,t.end),o=t.end,It(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
- `||O===`\r`||O===`\u2028`||O===`\u2029`)&&Pt(h,f.length)&&(p=o+1),/\s/.test(O)||(h.forceRegex=!1),h.canEnd=Rt(e,o,h.canEnd,h),O===`;`&&(Ft(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?Nt(h):void 0,j=k&&h.labelColon>=0,M=k&&h.statementStart&&(f.at(-1)===`B`||p>0||f.length===0&&Et(e,o));if(k&&(f.length>0||A!==void 0||j||M||h.forceRegex||h.lastSignificant&&ze.includes(h.lastSignificant)||Be.has(h.lastWord)||it(e,o,Math.max(p,_))||tt(e,o)||nt(e,o))){let t=h.forceRegex||j||M?`B`:A??(Dt(e,o,p,h.parenKinds.length,h.lastSignificant)?`B`:`O`);q(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=ln(e,o+1,s,c,!1)),P=u):N?.inText&&(N.groupLimit<o&&(N.groupLimit=ln(e,o+1,void 0,void 0,!0)),P=N.groupLimit),(e[o-1]===`#`||e[o-1]===`@`)&&!rt(e,o-1)){let t=Re(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?Ae(e,o,P):ke(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)&&et(e,o,F,z),B=ee?Re(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}=Me(e,L+1,P),te=Ne(V,!0);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 dn(e,t){let n={seen:!1};return{code:un(e,t,n),nestedOpening:n.seen}}const fn=/^(?:--?[\w-]+|[A-Z_$][\w$-]*|@teacss-skip-bracket-[\da-z]{6})$/i;function pn(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(!fn.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 mn(e){let t=[],n=[],r=[],i=!1,a;for(let o=0;o<e.length;o++){let s=e[o],c=e[o+1];if(n.length===0){s===`(`&&pn(e,o)&&q(n,{attached:!0,start:o});continue}if(i)s===`*`&&c===`/`&&(i=!1,o++);else if(a)s===`\\`?o++:s===a&&(a=void 0);else if(s===`\\`)o++;else if(s===`/`&&c===`*`)i=!0,o++;else if(s===`'`||s===`"`||s==="`")a=s;else if(r.length>0)s===`[`||s===`(`?q(r,s===`[`?`]`:`)`):s===r.at(-1)&&r.pop();else if(s===`[`)q(r,`]`);else if(s===`(`)q(n,{attached:pn(e,o),start:o});else if(s===`)`){let e=n.pop();e.attached&&q(t,{end:o+1,start:e.start})}}let o=[];for(let e of t.sort((e,t)=>e.start-t.start||t.end-e.end))(o.length===0||e.start>=o.at(-1).end)&&q(o,e);return o}function hn(e){let t={seen:!1},n=gn(e,t);for(let e=1;e<5&&t.seen;e++){t.seen=!1;let e=gn(n,t);if(e===n)break;n=e}return n}function gn(e,t){if(!e.includes(`{`))return e;let n=``,r=0,i=-1,a=0,o=0,s=e.includes(`[`)?Te(e):[],c=e.includes(`(`)?mn(e):[],l={closers:[]};for(;r<e.length;){for(;a<s.length&&s[a].end<=r;)a++;for(;o<c.length&&c[o].end<=r;)o++;let u=a<s.length?s[a]:void 0,d=o<c.length?c[o]:void 0,f=u?.start===r?u:d?.start===r?d:void 0;if(f&&l.blockComment!==!0&&l.quote===void 0){n+=e.slice(r,f.end),r=f.end;continue}l.closers.length>0&&/\s/.test(e[r])&&(l.blockComment=!1,l.closers.length=0,l.quote=void 0);let p=Oe(e,r,l);if(p!==void 0){n+=e.slice(r,p+1),r=p+1;continue}let m=e[r];if(l.closers.length>0||m!==`{`){n+=m,r++;continue}let h=ke(e,r);if(h.kind!==`close`){h.kind===`open`&&t&&(t.seen=!0),n+=e.slice(r,h.index),r=h.index;continue}let g=h.index,_=e.slice(r+1,g),{conds:v,end:y}=Me(e,g+1),b=Ne(_,!0);if(b.length===0){n+=m,r++;continue}i===r&&n.length>0&&!/\s/.test(n.at(-1))&&(n+=` `),n+=b.map(e=>`${e}${v}`).join(` `),i=y,r=y}return n}function _n(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const vn=/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/;function yn(e){return vn.test(e)}function bn(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 xn=/[\\:]?[\s'"`;{}]+/g;new RegExp(xn);const Sn=`@teacss-skip-bracket-`,Cn=/@teacss-skip-bracket-[\da-z]{6}/g,wn=/[\s'"`;{}]/,Tn=/^!?[.#>_+~:]/,En=/[^\S\t\n\v\f\r \u2028\u2029]/;function Dn(e,t){return/[A-Z_$]/i.test(e[t+1]??``)}function On(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 kn(e){return e!==void 0&&/\.html?$/i.test(e.split(/[?#]/,1)[0])}function An(e){return e!==void 0&&/\.(?:[cm]?[jt]sx?|mdx)$/i.test(e.split(/[?#]/,1)[0])}function jn(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 Mn(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===`<`&&Dn(e,l)&&(o=!0,r=[]);continue}if(s){Pn(u)&&(s=!1);continue}if(i){u===`*`&&d===`/`&&(i=!1,l++);continue}if(c){u===`\\`?l++:u===c&&(c=void 0);continue}if(u===`/`&&d===`*`&&On(e,l,a)){i=!0,l++;continue}if(u===`/`&&d===`/`&&On(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)J(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&&!/[ \t\n\r\f"'`=<>]/.test(e[p]);)p++;J(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);J(l,e.slice(u,r)),J(l,` `.repeat(t-r-n.length-2)),J(l,`"${n}"`),u=t}return J(l,e.slice(u)),l.join(``)}function Nn(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&&wn.test(e)}}function Pn(e){let t=e?.charCodeAt(0);return t===10||t===13||t===8232||t===8233}function Fn(e,t){return e[t+1]===`\r`&&e[t+2]===`
18
- `?t+2:t+1}function In(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]===`[`&&we(e,n)}const Ln=new Set([`await`,`break`,`case`,`continue`,`debugger`,`delete`,`do`,`else`,`in`,`instanceof`,`new`,`of`,`return`,`throw`,`typeof`,`void`,`yield`]),Rn=new Set([`for`,`if`,`while`,`with`]);function zn(e,t){let n=0;for(;t>0&&e[--t]===`\\`;)n++;return n%2==1}function Bn(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||zn(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:Rn.has(e.slice(i,t))}}return!1}function Vn(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||zn(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 Hn(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 Un(e,t){let n=Vn(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=Hn(e,r);return[`catch`,`class`,`do`,`else`,`finally`,`static`,`try`].includes(a.value)?!0:a.value?Hn(e,a.start).value===`class`:!1}function Wn(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]===`)`&&Bn(e,n)||e[n]===`}`&&Un(e,n))return!0;let r=n+1;for(;n>=0&&/[\w$]/.test(e[n]);)n--;let i=e.slice(n+1,r);return Ln.has(i)?!0:i==="default"&&Hn(e,n+1).value===`export`}function Gn(e,t){let n=!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(Pn(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 Kn(e,t=!1){let n=[],r=[],i=[],a=!1,o=!1,s,c=-1,l,u=-1,d=!1,f=!1;function p(){f=!1,n.length=0,i=[],a=!1,o=!1,s=void 0,l=void 0}for(let m=0;m<e.length;m++){let h=e[m];if(!a&&!s&&h===`/`&&Wn(e,m)){let t=Gn(e,m);if(t!==-1){m=t-1,d=!1,f=!1;continue}}if(n.length===0){if(Nn(h)?f=d=!1:h===`/`&&(d=!0),h===`@`&&!e.startsWith(Sn,m)&&!zn(e,m)&&(f=m>0&&(!Nn(e[m-1])||e[m-1]===`}`)&&Tn.test(e.slice(m+1))),f&&h===`\\`){/\s/.test(e[m+1])&&(f=!1),m++;continue}h===`[`&&(J(n,m),o=d&&e[m-1]!==`:`&&e[m-1]!==`@`);continue}if(Nn(h)&&(u=m),Pn(h)){p();continue}if((a||s)&&/\s/.test(h)&&(l??=me(e,n.at(-1),!1,f?e.length:m),l===void 0)){p();continue}if(!a&&!s&&h===`/`&&o){p();continue}if(a){h===`*`&&e[m+1]===`/`&&(a=!1,m++);continue}if(s){h===`\\`?(Pn(e[m+1])?p():Nn(e[m+1])&&(u=m+1),m++):h===s&&(J(i,[c+1,m]),s=void 0);continue}if(h===`/`&&e[m+1]===`*`)a=!0,m++;else if(h===`"`||h===`'`)s=h,c=m;else if(h===`\\`)Pn(e[m+1])&&p(),Nn(e[m+1])&&(u=m+1),m++;else if(h===`[`)J(n,m);else if(h===`]`){let a=n.pop(),s=m+1,c=!1;if(u>a){let n=f||e[a-1]===`:`||e[a-1]===`@`,i=e[s]===`:`&&!!e[s+1]&&!wn.test(e[s+1]);c=n&&!Ce(e,a)||i&&!(t&&In(e,s)),c&&J(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 Kn(e.slice(t,n)))J(r,[t+i,t+a]);i=[]}}}let m=[];for(let e of r.sort(([e,t],[n,r])=>e-n||r-t))(m.length===0||e[0]>=m.at(-1)[1])&&J(m,e);return m}const qn=/^(?:--?[\w-]+|[A-Z_$][\w$-]*|@teacss-skip-bracket-[\da-z]{6})$/i;function Jn(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(!qn.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 Yn(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&&J(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!=="`"&&Pn(d)?a=void 0:d===`\\`?u=Fn(e,u):d===a?a=void 0:d===`(`&&Jn(e,u)&&(J(n,{attached:!0,containsGroupBrace:!1,outerQuote:a,start:u}),c=void 0):d===`"`||d===`'`||d==="`"?a=d:d===`(`&&Jn(e,u)&&(J(n,{attached:!0,containsGroupBrace:!1,outerQuote:void 0,start:u}),c=void 0);continue}if(Pn(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??=me(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=Fn(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=Fn(e,u);else if(r.length>0)d===`[`?J(r,`]`):d===`(`?J(r,`)`):d===r.at(-1)?(r.pop(),r.length===0?s=-1:d===`)`&&(s=u)):d===`{`&&(n.at(-1).containsGroupBrace=!0);else if(d===`[`)J(r,`]`);else if(d===`{`)n.at(-1).containsGroupBrace=!0;else if(d===`(`)J(n,{attached:Jn(e,u),containsGroupBrace:!1,outerQuote:f,start:u});else if(d===`)`){let e=n.pop();e.attached&&e.containsGroupBrace&&J(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])&&J(u,e);return u}function Xn(e,t,n){if(!t.length)return e;let r=new Set(e.match(Cn)),i=[],a=0;for(let[o,s]of t){let t=e.slice(o,s),c=0,l;for(;l=`${Sn}${bn(c?`${t}:${c}`:t)}`,c++,r.has(l)||n.has(l)&&n.get(l)!==t;);n.set(l,t),J(i,e.slice(a,o)),J(i,l),a=s}return J(i,e.slice(a)),i.join(``)}function Zn(e,t,n=!1){return Xn(e,Kn(e,n),t)}function Qn(e,t){return Xn(e,Yn(e),t)}function $n(e,t){let n=[],r=0;for(let t=0;t<e.length;t++){let i=e[t];if(i===`\\`){let i=e[t+1];r&&i&&(/['"`;{}]/.test(i)||r===2&&En.test(i))?J(n,[t,t+2]):Nn(i)&&(r=0),t++}else Nn(i)?r===2&&En.test(i)?J(n,[t,t+1]):r=0:i===`@`&&(r=Tn.test(e.slice(t+1))?2:1)}return Xn(e,n,t)}function er(e,t){let n=e;for(let e=0;e<t.size&&n.includes(Sn);e++){let e=n.replace(Cn,e=>t.get(e)??e);if(e===n)break;n=e}return n}function tr(e,t){let n=new Map;En.test(e)&&(e=$n(e,n)),e.includes(`[`)&&(e=Zn(e,n,!0)),e.includes(`(`)&&(e=Qn(e,n));let r=dn(e,t);e=r.code;for(let i=1;i<5&&r.nestedOpening;i++){let i=e;if(i.includes(`[`)&&(i=Zn(i,n)),i.includes(`(`)&&(i=Qn(i,n)),r=dn(i,t),r.code===i)break;e=r.code}e.includes(`[`)&&(e=Zn(e,n)),e.includes(`(`)&&(e=Qn(e,n)),e.includes(`\\`)&&(e=$n(e,n));let i=e.split(xn);return n.size?i.map(e=>e.includes(Sn)?er(e,n):e):i}const nr={name:`@teacss/core/extractor-split`,order:0,extract({code:e,id:t}){return tr(An(t)?e:Mn(e,kn(t)),jn(t))}};function rr(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 ir(){return{events:Object.create(null),emit(e,...t){let n=this.events,r=Array.from(le(Object.hasOwn(n,e)?n[e]:void 0));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:[];i!==r&&rr(n,e,i),q(i,t);let a=!0;return()=>{a&&=(rr(n,e,Array.from(le(Object.hasOwn(n,e)?n[e]:void 0)).filter(e=>e!==t)),!1)}}}}const ar=/^\[(.+?)~?="(.*)"\]$/,or=/[\w\u00A0-\uFFFF%-?]/;new RegExp(ar.source,ar.flags),new RegExp(or.source,or.flags);function sr(e){return e.match(ar)}function cr(e){return e!=null}const lr=Object.getOwnPropertyDescriptor(RegExp.prototype,`source`).get,ur=[[`d`,Object.getOwnPropertyDescriptor(RegExp.prototype,`hasIndices`)?.get],[`g`,Object.getOwnPropertyDescriptor(RegExp.prototype,`global`)?.get],[`i`,Object.getOwnPropertyDescriptor(RegExp.prototype,`ignoreCase`)?.get],[`m`,Object.getOwnPropertyDescriptor(RegExp.prototype,`multiline`)?.get],[`s`,Object.getOwnPropertyDescriptor(RegExp.prototype,`dotAll`)?.get],[`u`,Object.getOwnPropertyDescriptor(RegExp.prototype,`unicode`)?.get],[`v`,Object.getOwnPropertyDescriptor(RegExp.prototype,`unicodeSets`)?.get],[`y`,Object.getOwnPropertyDescriptor(RegExp.prototype,`sticky`)?.get]],dr=Object.getOwnPropertyDescriptor(RegExp.prototype,`global`)?.get,fr=Object.getOwnPropertyDescriptor(RegExp.prototype,`sticky`)?.get,pr=RegExp.prototype.exec;function mr(e){return Reflect.apply(lr,e,[])}function hr(e){return!!(dr&&Reflect.apply(dr,e,[])||fr&&Reflect.apply(fr,e,[]))}function gr(e){let t=``;for(let[n,r]of ur)r&&Reflect.apply(r,e,[])&&(t+=n);return t}function _r(e,t){let n=t.exec;if(!hr(t))return Reflect.apply(n,t,[e]);if(Object.getOwnPropertyDescriptor(t,`lastIndex`)?.writable===!1){if(n!==pr)return Reflect.apply(n,t,[e]);let r=new RegExp(mr(t),gr(t));return Reflect.apply(pr,r,[e])}t.lastIndex=0;try{return Reflect.apply(n,t,[e])}finally{Object.getOwnPropertyDescriptor(t,`lastIndex`)?.writable!==!1&&(t.lastIndex=0)}}const vr=/^[a-z][a-z0-9-]*$/,yr={minAffix:4,maxDistance:1,minDistanceLength:6,segmentAffix:!0},br={minAffix:3,maxDistance:1,minDistanceLength:0,segmentAffix:!1},xr={minAffix:3,maxDistance:2,minDistanceLength:0,segmentAffix:!1},Sr=new Set([`about`,`blob`,`bun`,`chrome`,`data`,`deno`,`file`,`ftp`,`http`,`https`,`jsr`,`mailto`,`node`,`npm`,`tel`,`urn`,`vscode`,`virtual`,`ws`,`wss`]);function Cr(e){let{body:t,important:n}=Ee(e);return n?`${t}!`:t}function wr(e){let t=Cr(e);if(!t||t.startsWith(`$`)||t.startsWith(`[`))return!1;let n=t.indexOf(`:`);if(n<=0||n===t.length-1)return!1;let r=t.slice(0,n);return!vr.test(r)||t.startsWith(`//`,n+1)?!1:!Sr.has(r)}function Tr(e){if(gr(e))return;let t=mr(e);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 Er(e,t){let n=Object.hasOwn(e,2)?e[2]:void 0,r=n;for(;r!=null&&r!==Object.prototype&&r!==Array.prototype&&r!==Function.prototype;){if(Object.hasOwn(r,t))return Reflect.get(n,t);r=Object.getPrototypeOf(r)}}function Dr(e){return le(fe(Er(e,`prefix`)||``))}function Or(e,t){for(let n of le(t))for(let t of Dr(n))if(e.startsWith(t)&&_r(e.slice(t.length),n[0]))return!0;return!1}const kr=new WeakMap;function Ar(e){let t=e.rulesStaticMap,n=kr.get(t);if(n)return n;let r=new Map,i=new Set,a=new Set;for(let e of Object.keys(t)){let n=e.indexOf(`:`);if(n<=0)continue;let i=e.slice(0,n),o=Object.hasOwn(t,e)&&t[e];if(!o)continue;if(Er(o,`internal`)){a.add(i);continue}let s=r.get(i);s||(s=new Set,r.set(i,s)),s.add(e.slice(n+1))}for(let t of le(e.rulesDynamic)){let e=Tr(t[0]);if(e!=null)for(let n of Dr(t)){let o=(n+e).split(`:`,1)[0];Er(t,`internal`)?a.add(o):r.has(o)||i.add(o)}}let o={prefixValues:r,dynamicPrefixes:i,internalPrefixes:a};return kr.set(t,o),o}function jr(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),i=[...r];for(let a=1;a<=e.length;a++){i[0]=a;let o=a;for(let n=1;n<=t.length;n++){let s=e[a-1]===t[n-1]?0:1;i[n]=Math.min(r[n]+1,i[n-1]+1,r[n-1]+s),i[n]<o&&(o=i[n])}if(o>n)return 1/0;[r,i]=[i,r]}return r[t.length]<=n?r[t.length]:1/0}function Mr(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return r}function Nr(e,t){return(t.startsWith(e)?t[e.length]===`-`:t.endsWith(e)&&t[t.length-e.length-1]===`-`)&&(e.includes(`-`)||e.length>=6)}function Pr(e,t,n){if(e.length>=n.minDistanceLength){let r=jr(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?Nr(r,i):i.startsWith(r)||i.endsWith(r)||i.includes(r)))return 3+(i.length-r.length)/100;if(!n.segmentAffix&&Mr(e,t)>=n.minAffix)return 5+Math.abs(e.length-t.length)/100}function Fr(e,t,n={}){let{body:r,important:i}=Ee(e),a=r.indexOf(`:`);if(a<=0)return;let o=r.slice(0,a),s=r.slice(a+1),{prefixValues:c,dynamicPrefixes:l,internalPrefixes:u}=Ar(t),d=[];if(c.has(o)||l.has(o)||u.has(o)||Or(r,t.rulesDynamic))for(let e of c.get(o)??[]){if(e===s)continue;let t=Pr(s,e,xr);t!==void 0&&J(d,{suggestion:`${o}:${e}`,score:t})}else{if(!n.confirmedIntent&&o.length<3)return;let e=new Set([...c.keys(),...l]);for(let t of e){let e=Pr(o,t,n.confirmedIntent?br:yr);if(e===void 0)continue;let r=c.get(t)?.has(s)||l.has(t);J(d,{suggestion:`${t}:${s}`,score:r?e:e+10})}if(d.length===0)return}d.sort((e,t)=>e.score-t.score||(e.suggestion<t.suggestion?-1:1));let f=new Set,p=[];for(let{suggestion:e}of d)if(!(f.has(e)||e===r)&&(f.add(e),J(p,i?`${e}!`:e),p.length===3))break;return p}function Ir(e){let t=e.split(/\s+/);return t[0]===``&&t.shift(),t.at(-1)===``&&t.pop(),t}function Lr(e){if(!e.includes(`[`))return Ir(e);let t=Te(e);if(t.length===0)return Ir(e);let n=[],r=0,i=-1;for(let a=0;a<e.length;a++){let o=t[r];if(o&&a===o.start){i<0&&(i=a),a=o.end-1,r++;continue}/\s/.test(e[a])?(i>=0&&J(n,e.slice(i,a)),i=-1):i<0&&(i=a)}return i>=0&&J(n,e.slice(i)),n}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 Rr={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},zr=RegExp(`^[ \\t\\n\\r\\f]*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:e[+-]?\\d+)?)(${Object.keys(Rr).join(`|`)}|[sld]?v(?:[whib]|min|max)|cq(?:[whib]|min|max)|r?(?:ch|ex|cap|ic|lh)|%)?[ \\t\\n\\r\\f]*(?![\\s\\S])`,`i`);function Br(e){let t=zr.exec(e);if(!t)return null;let n=Number.parseFloat(t[1]),r=(t[2]??`px`).toLowerCase();if(Object.hasOwn(Rr,r)&&(n*=Rr[r],r=`px`),!Number.isFinite(n))return null;let i=r===`px`?Math.round(n*1e6)/1e6:n;return{unit:r,value:Number.isFinite(i)?i:n}}function Vr(e){let t=!1,n=Wr(e)[0];if(/["'\\/]|not/i.test(n)&&(n=n.replace(/"(?:\\[\s\S]|[^"\\])*(?:"|$)|'(?:\\[\s\S]|[^'\\])*(?:'|$)|\/\*[\s\S]*?(?:\*\/|$)|((?:[-\w\u0080-\uffff]|\\(?:[\da-f]{1,6}(?:\r\n|[ \t\n\r\f])?|[^\n\r\f]))+)|\\[\s\S]/gi,(e,n)=>n?(ue(n).toLowerCase()===`not`&&(t=!0),n.includes(`\\`)?`_`:n):` `)),!/^@media(?=[ \t\n\r\f(])/i.test(n)||t)return null;let r=null;for(let e of n.matchAll(/\([ \t\n\r\f]*(min|max)-width[ \t\n\r\f]*:([^)]*)\)/gi)){let t=Br(e[2]);if(t){if(/min/i.test(e[1]))return t;r??={unit:t.unit,value:-t.value}}}return r}function Hr(e,t){return e<t?-1:+(e>t)}function Ur(e,t,n){let r=(e.get(t)??0)-(e.get(n)??0);if(r)return r;let i=Vr(t),a=Vr(n);if(i==null!=(a==null))return i==null?-1:1;if(i!=null&&a!=null){if(i.unit!==a.unit)return Hr(i.unit,a.unit);if(i.value!==a.value)return i.value-a.value}return Hr(t,n)}function Wr(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===`\\`?s++: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)&&(J(t,e.slice(o,s)),s+=3,o=s+1)}return J(t,e.slice(o)),t}Function.prototype;const Gr=`@teacss-skip-start`,Kr=`@teacss-skip-end`;RegExp(`(//\\s*?${Gr}\\s*?|\\/\\*\\s*?${Gr}\\s*?\\*\\/|<!--\\s*?${Gr}\\s*?-->)[\\s\\S]*?(//\\s*?${Kr}\\s*?|\\/\\*\\s*?${Kr}\\s*?\\*\\/|<!--\\s*?${Kr}\\s*?-->)`,`g`);const qr=RegExp(`(//\\s*?${Gr}\\s*?|\\/\\*\\s*?${Gr}\\s*?\\*\\/|<!--\\s*?${Gr}\\s*?-->)[\\s\\S]*?(//\\s*?${Kr}\\s*?|\\/\\*\\s*?${Kr}\\s*?\\*\\/|<!--\\s*?${Kr}\\s*?-->)`,`g`);function Jr(e){return e===`
19
- `||e===`\r`||e===`\u2028`||e===`\u2029`}function Yr(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!=="`"&&Jr(t))return r}return e.length}const Xr=/\.(?:[cm]?[jt]sx?|vue|svelte|astro|marko|php|phtml|scss|sass|less|styl(?:us)?)(?:$|\?)/i,Zr=/\.(?:html?|vue|svelte|astro|marko|mdx?|php|phtml)(?:$|\?)/i;function Qr(e,t){let n=[],r=t===void 0||Xr.test(t),i=t===void 0||Zr.test(t);for(let t=0;t<e.length;){let a=e[t];if(a===`"`||a===`'`||a==="`"){t=Yr(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 $r=[/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|`(?:\\[\s\S]|[^`\\])*`/g,/<[^/?<>0-9$_!"'](?:"[^"]*"|'[^']*'|[^>])+>/g,/(@apply|--at-apply)[^;]*;/g],ei=[qr],ti=/([\\:]?[\s"'`;<>]|:\(|\)"|\)\s)/g,ni=/(?:[\w&:[\]-]|\[\S{1,64}=\S{1,64}\]){1,64}\[\\?['"]?\S{0,64}?['"]\]\]?[\w:@-]{0,64}/g,ri=/\[(\\\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 ii(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 ai(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 oi(e,t){let n=e.flags.includes(`g`)?e.flags:`${e.flags}g`;return t.matchAll(new RegExp(e.source,n))}function si(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 ci(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 li(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 ui(e){return e===void 0||/[\s'"`;<>]/.test(e)}function di(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(!ui(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&&ui(e[n+1])&&r.push([t,n+1,i.value])}}return r}function fi(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 pi(e,t,n){if(!n)return[];let r=[],i=RegExp(`(^|[^\\w:-])${_n(t)}\\s*=\\s*(['"])`,`g`);for(let t of e.matchAll(i)){let i=t.index+t[0].length-1,a=fi(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 mi(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 hi(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 gi(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 _i(e,t,n){let r=mi(e,t);if(r<0)return null;let i=gi(e.slice(t+1,r));if(!i.length)return null;let{suffix:a,end:o}=hi(e,r+1);return i.every(e=>n.has(e)||n.has(`${e}${a}`))?[t,o,e.slice(t,o)]:null}function vi(e,t,n=[],r={}){let i=[],a=[],o=new Set,s=new Set,c=[];if(r.excludeRanges&&(e=si(e,r.excludeRanges)),r.excludeRegex)for(let t of r.excludeRegex){let n=Array.from(oi(t,e),e=>[e.index,e.index+e[0].length]);e=si(e,n)}if(r.includeRegex)for(let t of r.includeRegex)for(let n of oi(t,e))c.push([n.index,n.index+n[0].length]);else c.push([0,e.length]);let l=ci(c);Array.from(t).forEach(e=>{let t=sr(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(...di(e,s));let u=0;e.split(ti).forEach(e=>{let t=u+e.length;r.isPug?i.push(...ai(e,o,u)):o.has(e)&&i.push([u,t,e]),u=t});for(let t of e.matchAll(ni)){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(ri)){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 pi(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=_i(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])=>li(l,e,t)).filter(([e,t,n])=>{let r=`${e}:${t}:${n}`;return!f.has(r)&&(f.add(r),!0)}).sort((e,t)=>e[0]-t[0])}const yi=[`@teacss/directives`,`@teacss/transformer-compile-class`];async function bi(e,t,n=``,r={}){let i=new c(t),a={generator:e,tokens:new Set},o=e.config.transformers?.filter(e=>!yi.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 ii(e,i.toString(),n);return vi(t,[...(await e.generate(l?u:i.toString(),{preflights:!1,safelist:!1})).matched],s,{isPug:l,...r})}function xi(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 Si(e,t,n,r){let i=e.get(t);if(i)return xi(e,t,i,n),i;let a;return a=r().catch(n=>{throw e.get(t)===a&&e.delete(t),n}),xi(e,t,a,n),a}const Ci=new Map;function wi(e){Ci.delete(e)}function Ti(){Ci.clear()}function Ei(e,t,n,r=!1,i=!1){i&&Ci.delete(n);let a=Ci.get(n);if(a&&a.code===t&&a.config===e.config&&a.generator===e&&a.strictAnnotationMatch===r)return xi(Ci,n,a,100),a.result;let o=bi(e,t,n,{excludeRanges:Qr(t,n),excludeRegex:ei,...r?{includeRegex:$r}:null});return xi(Ci,n,{code:t,config:e.config,generator:e,strictAnnotationMatch:r,result:o},100),o}
1
+ import{a as e,i as t,n,o as r,r as i,t as a}from"./semanticTokens-Cniz5X9a.js";import{createRequire as o}from"node:module";import s from"node:process";import c from"magic-string";import{channel as l,tracingChannel as u}from"node:diagnostics_channel";import d,{existsSync as f}from"node:fs";import p,{dirname as m,resolve as h}from"node:path";import{ROLE_DIRECTIVES as g,customToTheme as _,diagnoseCustom as v,diagnoseEntry as y,entryDiscoveryFiles as b,findEntry as x,parseEntry as S,scaleThemeKeys as C,scanCustomBlocks as w,scanTopLevelAtRules as T}from"@teacss/config";import{createContext as E,defaultFilesystemGlobs as D}from"@teacss/runtime";import{fileURLToPath as O,pathToFileURL as k}from"node:url";import{glob as A,readFile as j}from"node:fs/promises";import{DEFAULT_SOURCE_IGNORE as M}from"@teacss/runtime/source-generation";import{TextDocument as N}from"vscode-languageserver-textdocument";import{CodeActionKind as ee,CompletionItemKind as P,DiagnosticSeverity as F}from"vscode-languageserver-types";import{colordx as I,extend as L}from"@colordx/core";import R from"@colordx/core/plugins/cmyk";import te from"@colordx/core/plugins/hwb";import z from"@colordx/core/plugins/lab";import B from"@colordx/core/plugins/lch";import V from"@colordx/core/plugins/names";import H from"@colordx/core/plugins/p3";import{DidChangeWatchedFilesNotification as ne,ProposedFeatures as U,TextDocumentSyncKind as W,TextDocuments as re,WatchKind as ie,createConnection as ae}from"vscode-languageserver/node";var oe=Object.create,G=Object.defineProperty,se=Object.getOwnPropertyDescriptor,ce=Object.getOwnPropertyNames,le=Object.getPrototypeOf,ue=Object.prototype.hasOwnProperty,de=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),fe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ce(t),a=0,o=i.length,s;a<o;a++)s=i[a],!ue.call(e,s)&&s!==n&&G(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=se(t,s))||r.enumerable});return e},pe=(e,t,n)=>(n=e==null?{}:oe(le(e)),fe(t||!e||!e.__esModule||!ue.call(e,`default`)?G(n,`default`,{value:e,enumerable:!0}):n,e)),me=o(import.meta.url);function K(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function*q(e){if(Array.isArray(e))for(let t=0,n=e.length;t<n;t++)Object.hasOwn(e,t)&&(yield e[t])}function he(e){return e.replace(/\\([\da-f]{1,6})(?:\r\n|[ \t\n\r\f])?|\\([^\n\r\f])/gi,(e,t,n)=>{if(!t)return n;let r=Number.parseInt(t,16);return String.fromCodePoint(r===0||r>1114111||r>=55296&&r<=57343?65533:r)})}function ge(e,t){let n=e;for(;n!==null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function _e(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function ve(e=void 0){if(e===void 0)return[];if(!Array.isArray(e))return[e];for(let t=0,n=e.length;t<n;t++){if(Object.hasOwn(e,t))continue;let r=[],i=0;for(let t=0;t<n;t++)Object.hasOwn(e,t)&&_e(r,i++,e[t]);return r}return e}function ye(e){return Array.from(new Set(q(e)))}function be(e){return typeof e==`string`}function J(e,t){let n=e.length;n in e?Object.defineProperty(e,n,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[n]=t}function xe(e,t,n=!1,r=t+1){let i=e[t];if(i!==`[`&&i!==`(`)return;let a=i===`[`?`]`:`)`,o=!1,s;for(let i=t+1;i<e.length;i++){let t=e[i];if(t===`
2
+ `||t===`\r`||t===`\u2028`||t===`\u2029`)return;if(o){t===`*`&&e[i+1]===`/`&&(o=!1,i++);continue}if(s){t===`\\`?i++:t===s&&(s=void 0);continue}if(i>=r&&/\s/.test(t))return;if(t===`\\`)i++;else if(t===`/`&&e[i+1]===`*`)o=!0,i++;else if(t===`"`||t===`'`||n&&t==="`")s=t;else if(t===`[`||t===`(`)a+=t===`[`?`]`:`)`;else if(t===a.at(-1)&&(a=a.slice(0,-1),!a))return i+1}}function Se(e,t){let n=0;for(;e[t-n-1]===`\\`;)n++;return n%2==1}const Ce=/^(?:[\p{ID_Continue}$-]|\u200C|\u200D)+$/u,we=/^(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?|\d(?:_?\d)*\.|\.\d(?:_?\d)*)(?:e[+-]?\d(?:_?\d)*)?$/i;function Te(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;return n>=0&&`{,`.includes(e[n])}function Ee(e,t,n){let r=t+1;for(;/\s/.test(e[r]??``);)r++;if(e[r]!==`/`||e[r+1]===`/`||e[r+1]===`*`)return!1;let i=!1;for(r++;r<n;r++){let t=e[r];if(t===`
3
+ `||t===`\r`||t===`\u2028`||t===`\u2029`)return!1;if(t===`\\`)r++;else if(t===`[`)i=!0;else if(t===`]`&&i)i=!1;else if(t===`/`&&!i){for(r++;/[a-z]/i.test(e[r]??``);)r++;for(;/\s/.test(e[r]??``);)r++;return r===n}}return!1}function De(e,t){let n=0,r;for(let i=t;i>=0;i--){let a=e[i];if(r)a===r&&!Se(e,i)&&(r=void 0);else if(a===`"`||a===`'`||a==="`")r=a;else if(a===`]`)n++;else if(a===`[`&&(n--,Te(e,i)&&(n===0||Ee(e,i,t))))return i}}function Oe(e,t){let n=e[t];if(n===`"`||n===`'`||n==="`"){for(let r=t-1;r>=0;r--)if(e[r]===n&&!Se(e,r))return r;return}if(n===`]`)return De(e,t);let r=t;for(;r>0&&!/\s/.test(e[r-1])&&!`({,[`.includes(e[r-1]);)r--;let i=e.slice(r,t+1);return Ce.test(i)||we.test(i)?r:void 0}function ke(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;if(n<0)return!1;if(`=({,[`.includes(e[n]))return!0;if(e[n]!==`:`)return!1;for(n--;n>=0&&/\s/.test(e[n]);)n--;let r=Oe(e,n);if(r===void 0)return!1;for(n=r-1;n>=0&&/\s/.test(e[n]);)n--;return n>=0&&`{,[?`.includes(e[n])}function Ae(e,t){return ke(e,t)}function je(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e[n]!==`"`&&e[n]!==`'`&&e[n]!=="`"?!1:Ae(e,t)}function Me(e){let t=[],n=[],r=new Map,i=!1,a,o;for(let s=0;s<e.length;s++){let c=e[s];if(n.length===0){c===`\\`?(/\s/.test(e[s+1]??``)&&(a=void 0),s++):/\s/.test(c)?a=void 0:c===`"`||c===`'`?a=a===c?void 0:a??c:!a&&c===`[`&&J(n,s);continue}if((o||i)&&c===`[`&&/[:@\s]/.test(e[s-1])){J(n,s),r.set(s,o??i),i=!1,o=void 0;continue}if(i){c===`*`&&e[s+1]===`/`&&(i=!1,s++);continue}if(o){c===`\\`?s++:c===o&&(o=void 0);continue}if(c===`/`&&e[s+1]===`*`)i=!0,s++;else if(c===`"`||c===`'`)o=c;else if(c===`\\`)s++;else if(c===`[`)J(n,s);else if(c===`]`){let a=n.pop(),c=r.get(a);(/[:@]/.test(e[a-1])||e[s+1]===`:`)&&J(t,{end:s+1,start:a}),c===!0?i=!0:c&&(o=c)}}let s=[];for(let e of t.sort((e,t)=>e.start-t.start||t.end-e.end))(!s.length||e.start>=s.at(-1).end)&&J(s,e);return s}function Ne(e){let t=``,n,r=-1,i=-1,a=-1,o=[];for(let s=0;s<e.length;s++){let c=e[s];if(n){c===`\\`?s++:c===n&&(n=void 0);continue}if((t.length>0||i!==-1)&&c===`\\`){s++;continue}if(t.length>0&&(c===`"`||c===`'`)){n=c;continue}if((t.length>0||i!==-1)&&c===`/`&&e[s+1]===`*`){let t=e.indexOf(`*/`,s+2);if(t<0)break;s=t+1;continue}c===`(`||c===`[`?t+=c===`(`?`)`:`]`:c===t.at(-1)?t=t.slice(0,-1):t.length===0&&(c===`@`?(i===-1&&(i=s),J(o,s)):i===-1&&(c===`:`&&r===-1?r=s:c===`!`&&(a=s)))}let s=i===-1?e.length:i,c=e.slice(0,s),l=!1;s>0&&a===s-1&&(l=!0,c=c.slice(0,-1));let u=[];for(let t=0;t<o.length;t++){let n=o[t]+1,r=t+1<o.length?o[t+1]:e.length;J(u,e.slice(n,r))}return r!==-1&&r<s?{raw:e,body:c,property:e.slice(0,r),value:c.slice(r+1),keyword:!1,important:l,conditions:u}:{raw:e,body:c,keyword:!0,important:l,conditions:u}}const Pe=Symbol.for(`@teacss/core/config-validators`);function Fe(e){if(!Object.hasOwn(e,Pe))return;let t=Reflect.get(e,Pe);if(!Array.isArray(t))throw TypeError(`[Teacss] invalid internal configuration validators`);for(let n of q(t))n(e)}const Ie=`utilities`,Le=Object.freeze({imports:-200,properties:-150,preflights:-100,shortcuts:-50,primitives:-10,[Ie]:0});function Re(e,t,n){let r=e[t];if(n.blockComment)return r===`*`&&e[t+1]===`/`?(n.blockComment=!1,t+1):t;if(n.quote)return r===`\\`?t+1:(r===n.quote&&(n.quote=void 0),t);if(n.closers.length>0&&r===`/`&&e[t+1]===`*`)return n.blockComment=!0,t+1;if(n.closers.length>0&&(r===`"`||r===`'`))return n.quote=r,t;if(r===`\\`)return t+1;if(r===`(`||r===`[`)return K(n.closers,r===`(`?`)`:`]`),t;if(r===n.closers.at(-1))return n.closers.pop(),t}function ze(e,t,n=e.length){let r={closers:[]};for(let i=t+1;i<n;i++){let t=e[i],n=Re(e,i,r);if(n!==void 0){i=n;continue}if(r.closers.length===0){if(t===`}`)return{index:i,kind:`close`};if(t===`{`)return{index:i,kind:`open`}}}return{index:n,kind:`limit`}}function Be(e,t,n=e.length){let r={closers:[]},i=Rt();for(let a=t+1;a<n;a++){let t=e[a],n=Re(e,a,r);if(n!==void 0){a=n;continue}if(!(r.closers.length>0)){if(t===`}`)return{index:a,kind:`close`};if(t===`{`)return{index:a,kind:`open`};if(t===`'`||t===`"`||t==="`"||t===`/`&&(e[a+1]===`/`||e[a+1]===`*`||Yt(e,a,i.forceRegex,i.canEnd)))return{index:a,kind:`host`};/\s/.test(t)||(i.forceRegex=!1),i.canEnd=Jt(e,a,i.canEnd,i)}}return{index:n,kind:`limit`}}const Ve=/[\s'"`;{},\])]/;function He(e,t,n=e.length){if(e[t]!==`@`)return{conds:``,end:t};let r={closers:[]},i=t;for(;i<n;i++){let t=e[i],n=Re(e,i,r);if(n!==void 0){i=n;continue}if(t===`/`&&(e[i+1]===`/`||e[i+1]===`*`)&&r.closers.length===0||Ve.test(t)&&r.closers.length===0)break}return{conds:e.slice(t,i),end:i}}function Ue(e,t=!1){let n=[],r={closers:[]},i=0;for(let a=0;a<e.length;a++){let o=e[a],s=Re(e,a,r);if(s!==void 0){a=s;continue}(o===`;`||t&&/\s/.test(o))&&r.closers.length===0&&(K(n,e.slice(i,a)),i=a+1)}return K(n,e.slice(i)),n.map(e=>e.trim()).filter(Boolean)}function We(e){let t={closers:[]},n=!1,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=Re(e,i,t);if(o!==void 0){i=o;continue}if(!(t.closers.length>0)){if(a===`<`&&Zt(e,i))return!1;if(a===`;`)return!0;a===`:`?n=!0:a===`?`&&(r=!0)}}return n&&!r}function Ge(e,t){let n=Be(e,t);if(n.kind!==`close`)return;let r=e.slice(t+1,n.index);if(!We(r))return;let i=Ue(r,!0);if(i.length===0)return;let{conds:a,end:o}=He(e,n.index+1);return{end:o,value:i.map(e=>`${e}${a}`).join(` `)}}function Ke(e,t,n=!1){let r=t+1;if(r>=e.length)return e.length;if(e[r]===`\r`&&e[r+1]===`
4
+ `||n&&e[r]===`$`&&e[r+1]===`{`)return r+2;if(e[r]===`u`&&e[r+1]===`{`){let t=r+2;for(;/[0-9a-f]/i.test(e[t]??``);)t++;if(t>r+2&&e[t]===`}`)return t+1}return r+1}function qe(e,t,n){let r=e[t];return n.lineComment?((r===`
5
+ `||r===`\r`||r===`\u2028`||r===`\u2029`)&&(n.lineComment=!1),t+1):n.blockComment?r===`*`&&e[t+1]===`/`?(n.blockComment=!1,t+2):t+1:n.quote?r===`\\`?Ke(e,t):(r===n.quote&&(n.quote=void 0),t+1):r===`\\`?Ke(e,t):r===`/`&&e[t+1]===`*`?(n.blockComment=!0,t+2):r===`/`&&e[t+1]===`/`&&n.parenDepth===0?(n.lineComment=!0,t+2):(r===`'`||r===`"`?n.quote=r:r===`(`?n.parenDepth++:r===`)`&&n.parenDepth>0?n.parenDepth--:r===`{`&&n.parenDepth===0?n.depth++:r===`}`&&n.parenDepth===0&&n.depth--,t+1)}function Je(e,t,n){let r={blockComment:!1,depth:1,lineComment:!1,parenDepth:0};for(let i=t+1;i<n;){let t=i;if(i=qe(e,i,r),r.depth===0)return t}return-1}const Ye=`=([{,:>)$?|&.!~+-*/%^<`,Xe=new Set(`as.assert.await.case.catch.class.const.default.delete.do.else.export.extends.finally.implements.import.in.instanceof.is.keyof.let.new.of.return.satisfies.static.throw.type.typeof.try.var.void.with.yield`.split(`.`)),Ze=new Set([`await`,`case`,`delete`,`do`,`else`,`in`,`new`,`of`,`return`,`throw`,`typeof`,`void`,`yield`]),Qe=new Set([`catch`,`for`,`if`,`switch`,`while`,`with`]),$e=/^(?:a|abbr|address|animate|animateMotion|animateTransform|annotation|area|article|aside|audio|b|base|bdi|bdo|blockquote|body|br|button|canvas|caption|circle|cite|clipPath|code|col|colgroup|data|datalist|dd|defs|del|desc|details|dfn|dialog|discard|div|dl|dt|ellipse|em|embed|feBlend|feColorMatrix|feComponentTransfer|feComposite|feConvolveMatrix|feDiffuseLighting|feDisplacementMap|feDistantLight|feDropShadow|feFlood|feFuncA|feFuncB|feFuncG|feFuncR|feGaussianBlur|feImage|feMerge|feMergeNode|feMorphology|feOffset|fePointLight|feSpecularLighting|feSpotLight|feTile|feTurbulence|fieldset|figcaption|figure|filter|footer|foreignObject|form|g|h[1-6]|head|header|hgroup|hr|html|i|iframe|image|img|input|ins|kbd|label|legend|li|line|linearGradient|link|maction|maligngroup|malignmark|main|map|mark|marker|mask|math|menu|meta|metadata|meter|menclose|merror|mfenced|mfrac|mglyph|mi|mlabeledtr|mlongdiv|mmultiscripts|mn|mo|mover|mpadded|mpath|mphantom|mprescripts|mroot|mrow|ms|mscarries|mscarry|msgroup|msline|mspace|msqrt|msrow|mstack|mstyle|msub|msubsup|msup|mtable|mtd|mtext|mtr|munder|munderover|nav|noscript|object|ol|optgroup|option|output|p|path|pattern|picture|polygon|polyline|pre|progress|q|radialGradient|rect|rp|rt|ruby|s|samp|script|search|section|select|selectedcontent|semantics|set|slot|small|source|span|stop|strong|style|sub|summary|sup|svg|switch|symbol|table|tbody|td|template|text|textPath|textarea|tfoot|th|thead|time|title|tr|track|tspan|u|ul|use|var|video|view|wbr|[a-z][-\w]*-[\w-]+)$/i,et=/^(?:--|-?)[_a-z][-\w]*$/i,tt=/^[+-]?(?:(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)%$/i;function nt(e){if(/^(?:from|to)$/i.test(e)||tt.test(e))return!0;let t=e.search(/\s/u);if(t<1)return!1;let n=e.slice(t).trim();return et.test(e.slice(0,t))&&tt.test(n)}function rt(e,t,n=0){let r=e.slice(n,t);return/(?:^|[;}\n\r])\s*(?:(?:export|default|declare|async)\s+)*function(?:\s*\*)?[\s\S]*$/.test(r)}function it(e,t,n=0){return/\bfunction(?:\s*\*)?[\s\S]*$/.test(e.slice(n,t))}function at(e,t,n=0){let r=e.slice(n,t);return/(?:^|[;{}\n\r])\s*(?:(?:export|default|declare|abstract)\s+)*(?:class|interface|namespace|enum|module|global)\b[^{};]*$/.test(r)}function ot(e,t,n=0){return/(?:^|[^\w$])(?:abstract\s+)?class\b[^{};]*$/.test(e.slice(n,t))}function st(e,t,n=0){return at(e,t,n)||ot(e,t,n)||it(e,t,n)}function ct(e,t){let n=-1,r=0,i=0,a=0,o;for(let s=0;s<e.length;s++){let c=e[s];if(o){c===`\\`?s++:c===o&&(o=void 0);continue}if(i>0){c===`\\`?s++:c===`'`||c===`"`?o=c:c===`{`?i++:c===`}`&&i--;continue}if((t&&c===`$`||c===`#`||c===`@`)&&e[s+1]===`{`){i=1,s++;continue}if(c===`\\`){s++;continue}if(c===`'`||c===`"`){o=c;continue}c===`[`?r++:c===`]`&&r>0?r--:c===`(`?a++:c===`)`&&a>0?a--:r===0&&a===0&&(c===`;`||c===`{`||c===`}`||c===`
6
+ `||c===`\r`||t&&c==="`")&&(n=s)}return n}function lt(e){for(let t of e)if((t.codePointAt(0)??0)>127)return!0;return!1}function ut(e,t,n=!1,r=0){let i=e.slice(r,t),a=ct(i,n),o=i.slice(a+1).trim();if(o.length===0)return!1;let s=o.split(/\s*(?:,|>|\+|~)\s*|\s+/).filter(Boolean),c=o.split(`,`).map(e=>e.trim());return/^@(?:-[a-z]+-)?[a-z][-\w]*\b/i.test(o)||/^%[-_a-z][-\w]*$/i.test(o)||/(?:^|[\s>+~,])(?:&|[-_a-z][-\w]*|\*)?(?:[.#](?=\S)|\[[^\]]*\])/i.test(o)||/(?:^|[\s>+~,])(?:\*|[-\w]+)\|(?:\*|[-\w]+)(?=$|[\s.#:[>+~,])/i.test(o)||/^(?:(?:[a-z][-\w]*)?|&):{1,2}[-\w(]/i.test(o)||/(?:^|[\s>+~,])\\[0-9a-f]{1,6}\s?/i.test(o)||lt(o)||n&&o.includes("${")||o.includes(`#{`)||o.includes(`@{`)||c.every(nt)||s.length>0&&s.every(e=>e===`*`||$e.test(e))}function dt(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;let r=e[n];if(r!==`'`&&r!==`"`)return!1;for(n++;n<e.length;n++){let t=e[n];if(t===`\\`)n++;else if(t===r){for(n++;/\s/.test(e[n]??``);)n++;return e[n]===`:`}}return!1}function ft(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e.startsWith(`...`,n)}function pt(e,t){let n=0;for(t--;t>=0&&e[t]===`\\`;t--)n++;return n%2==1}function mt(e,t,n=0){let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;if(r<0)return!1;if(Ye.includes(e[r]))return!0;let i=r+1;for(;r>=0&&/[\w$]/.test(e[r]);)r--;let a=e.slice(r+1,i);return Xe.has(a)||st(e,t,n)}const ht=new Set([`catch`,`class`,`do`,`else`,`finally`,`switch`,`try`]),gt=/^(?:(?:await\s+)?using|break|class|const|continue|debugger|declare|do|enum|export|for|function|if|import|interface|let|namespace|return|switch|throw|try|type|var|while|with)(?=$|[\s;(){}])/,_t=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*(?:\s*(?:(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*|(?:\?\.)?\[[^\]]+\]))*\s*(?:(?:\?\.)?\(|\+\+|--|[-+*/%&|^]?=(?!=|>))/u,vt=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*\s*(?:(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*)+\s*$/u,yt=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*(?:\s*(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*)*\s*(?:\?\.)?\[[^\]]+\]\s*$/u,bt=/^new\s+(?:class\b|function\b|[$_\p{ID_Start}])/u,xt=/^\([\s\S]*\)$/,St=/^\([\s\S]*\)\s*(?:\(|\?\.|\.)/,Ct=/^(?:(?:await|delete|typeof|void)\s+\S|yield(?:\s+\S|\s*\*\s*\S))/u,wt=/^(?:\+\+|--|!|~)\s*\S/u,Tt=/^\[[\s\S]*\]\s*=(?!=|>)/,Et=new Set([`as`,`in`,`instanceof`,`satisfies`]),Dt=/^(?:=(?!=|>)|\+=|-=|\*\*=|\*=|\/=|%=|&&=|&=|\|\|=|\|=|\^=|\?\?=|<<=|>>>=|>>=)/,Ot=/^(?:(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[bB][01](?:_?[01])*|0[oO][0-7](?:_?[0-7])*)n?|(?:\d(?:_?\d)*)n|(?:\d(?:_?\d)*\.(?:\d(?:_?\d)*)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|\d(?:_?\d)*(?:[eE][+-]?\d(?:_?\d)*)?)/;function kt(e){let t={closers:[]},n=!1,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=t.closers.length===0,s=Re(e,i,t);if(s!==void 0){o&&(a===`(`||a===`[`)&&(n=!0),i=s;continue}if(!(t.closers.length>0)){if(a===`:`||a===`@`)return!n||r?void 0:a===`:`?`declaration`:`condition`;if(a===`!`&&i===e.length-1)return!n||r?void 0:`important`;/\s/u.test(a)?r=!0:n=!0}}}function At(e,t){if(Ct.test(e))return!0;if(!wt.test(e))return!1;let n=kt(e);return n===void 0||t&&n===`important`}function jt(e,t){if(!Tt.test(e))return!1;let n=kt(e);return n===void 0||t&&n===`important`}function Mt(e,t){let n={closers:[]};for(let r=t;r<e.length;r++){let t=Re(e,r,n);if(t!==void 0&&(r=t,n.closers.length===0))return r+1}}function Nt(e){let t={closers:[]},n=-1;for(let r=0;r<e.length;r++){let i=Re(e,r,t);if(i!==void 0){r=i;continue}if(!(t.closers.length>0)){if(/\s/u.test(e[r]))return-1;n===-1&&(e[r]===`:`||e[r]===`@`)&&r>0&&(n=r)}}return n}function Pt(e,t){let n=t=>{for(;t<e.length&&/\s/u.test(e[t]);)t++;return t},r=0;for(;e[r]===`+`||e[r]===`-`;)r=n(r+1);let i=cn(e,r);i?.value===`await`&&/\s/u.test(e[i.end]??``)&&(r=n(i.end),i=cn(e,r));let a;if(i!==void 0)a=`identifier`,r=i.end;else if(e[r]===`[`||e[r]===`(`){let t=Mt(e,r);if(t===void 0)return!1;a=e[r]===`[`?`array`:`parenthesized`,r=t}else{let t=Ot.exec(e.slice(r));if(t===null)return!1;a=`number`,r+=t[0].length}let o=!1,s=!1;for(;r<e.length;){let t=r;if(r=n(r),e[r]===`!`&&e[r+1]!==`=`){s=!0,r++;continue}if(e[r]===`(`||e.startsWith(`?.(`,r))return!0;if(e.startsWith(`?.`,r))r=n(r+2);else if(e[r]===`.`)r=n(r+1);else if(e[r]!==`[`){r=t;break}if(e[r]===`[`){let t=Mt(e,r);if(t===void 0)return!1;o=!0,s=!1,r=t;continue}if(e[r]===`#`&&r++,i=cn(e,r),i===void 0)return!1;o=!0,s=!1,r=i.end}if(r=n(r),e[r]===`(`||e.startsWith(`?.(`,r))return!0;if(o&&e.slice(r).trim().length===0)return!s||kt(e)!==`important`||t;if(a===`array`&&!o)return!1;if(e.startsWith(`++`,r)||e.startsWith(`--`,r))return e.slice(r+2).trim().length===0;let c=Dt.exec(e.slice(r));return c!==null&&e.slice(r+c[0].length).trim().length>0}function Ft(e){let t=Nt(e),n=(t,n)=>{let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;let i=t+n;for(;i<e.length&&/\s/.test(e[i]);)i++;return r>=0&&e[r]!==`:`&&i<e.length},r=(t,r,i)=>{let a=e[r-1]??``,o=e[i]??``;return!/\s/u.test(a)&&!`)!]`.includes(a)||!/\s/u.test(o)&&!`([`.includes(o)&&(t!==`in`&&t!==`instanceof`||!`!~+-`.includes(o))&&(t!==`as`&&t!==`satisfies`||o!==`-`)?!1:n(r,i-r)},i={closers:[]};for(let a=0;a<e.length;a++){let o=e[a],s=Re(e,a,i);if(s!==void 0){a=s;continue}if(i.closers.length>0||t>=0&&a>t)continue;let c=e[a+1],l=cn(e,a);if(l!==void 0){if(Et.has(l.value)&&r(l.value,a,l.end))return!0;a=l.end-1;continue}if((o===`?`||o===`<`||o===`>`)&&n(a,c===o||c===`=`||o===`?`&&c===`.`?2:1)||(o===`=`&&c===`=`||o===`!`&&c===`=`||o===`&`&&c===`&`||o===`|`&&c===`|`||o===`*`&&c===`*`)&&n(a,2)||`+-*/%&|^`.includes(o)&&(/\s/.test(e[a-1]??``)||/\s/.test(c??``))&&n(a,1)||o===`,`&&(/\s/.test(e[a-1]??``)||/\s/.test(c??``))&&n(a,1))return!0}return!1}function It(e,t){let n=Be(e,t);if(n.kind===`open`)return!0;if(n.kind!==`close`)return!1;let r=Ue(e.slice(t+1,n.index));if(r.length===0)return!0;let i=r.length===1;return r.some(e=>gt.test(e)||_t.test(e)||vt.test(e)||yt.test(e)||Pt(e,i)||bt.test(e)||xt.test(e)||St.test(e)||At(e,i)||jt(e,i)||Ft(e))}function Lt(e,t,n=0,r=0,i=``){if(`:|&=,(`.includes(i))return!1;let a=t-1;for(;a>=0&&/\s/.test(e[a]);)a--;let o=e.slice(n,t);if(it(e,t,n))return r>0||`:|&=,(`.includes(e[a]??``)?!1:rt(e,t,n);if(/\bclass\b[^;]*$/.test(o))return at(e,t,n);if(e[a]===`)`||e[a]===`>`)return e.slice(Math.max(n,a-1),a+1)!==`=>`;let s=a+1;for(;a>=0&&/[\w$]/.test(e[a]);)a--;let c=e.slice(a+1,s);return ht.has(c)?!0:st(e,t,n)}function Rt(){return{angleDepth:0,canEnd:!1,classParenRoles:[],forceRegex:!1,labelCandidate:!1,labelColon:-1,lastSignificant:``,lastWord:``,parenKinds:[],pendingFunctions:[],restrictedLineStatement:!1,statementStart:!0,typeDeclaration:!1}}const zt=new Set([`abstract`,`async`,`declare`,`default`,`export`]),Bt=new Set([`abstract`,`asserts`,`extends`,`in`,`infer`,`is`,`keyof`,`new`,`readonly`,`typeof`,`unique`]);function Vt(e,t){let n=e.pendingFunctions.at(-1);n?.phase===`return-type`&&(n.typeCanEnd=!Bt.has(t))}function Ht(e,t,n){let r=e.pendingFunctions.at(-1);r?.phase===`return-type`&&(`|&?:=,(`.includes(t)||t===`[`||t===`<`?r.typeCanEnd=!1:(n||t===`]`||t===`>`||t===`)`)&&(r.typeCanEnd=!0))}function Ut(e){let t=e.pendingFunctions.at(-1);if(t)return t.phase===`after-params`?(e.pendingFunctions.pop(),t.kind):t.phase===`return-type`?t.typeCanEnd?(e.pendingFunctions.pop(),t.kind):`T`:`O`}function Wt(e,t){return!e.restrictedLineStatement&&!(e.typeDeclaration&&t===0&&e.canEnd)?!1:(e.canEnd=!1,e.forceRegex=!0,e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=``,e.lastWord=``,e.restrictedLineStatement=!1,e.statementStart=!0,e.typeDeclaration=!1,!0)}function Gt(e,t=!1){e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=`;`,e.lastWord=``,t||(e.pendingFunctions.length=0),e.restrictedLineStatement=!1,e.statementStart=!0,e.typeDeclaration=!1}function Kt(e,t){e.canEnd=!0,e.forceRegex=!1,e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=t,e.lastWord=``,e.statementStart=!1,Ht(e,t,!0)}function qt(e,t,n){if(!n||/\s/.test(e[t-1]??``))return!1;let r=t+1;for(;/\s/.test(e[r]??``);)r++;return/[A-Z_$\p{ID_Start}]/u.test(e[r]??``)}function Jt(e,t,n,r){let i=e[t],a=r?.lastWord??``;if(/\s/.test(i??``))return n;if(/[\w$\p{ID_Continue}]/u.test(i??``)){if(/[\w$\p{ID_Continue}]/u.test(e[t+1]??``))return n;let i=t;for(;i>0&&/[\w$\p{ID_Continue}]/u.test(e[i-1]??``);)i--;let a=e.slice(i,t+1),o=i-1;for(;o>=0&&/\s/.test(e[o]??``);)o--;let s=e[o]===`.`||e[o]===`#`;if(r){let e=r.statementStart;r.labelCandidate=e,r.labelColon=-1,r.lastSignificant=`word`,r.lastWord=s?``:a,!s&&a===`function`?K(r.pendingFunctions,{kind:e?`B`:`O`,phase:`before-params`,typeCanEnd:!1}):s||Vt(r,a),!s&&e&&(a===`type`||a===`import`||a===`interface`||a===`declare`||a===`export`)&&(r.typeDeclaration=!0),!s&&e&&(a===`break`||a===`continue`||a===`debugger`)&&(r.restrictedLineStatement=!0),r.statementStart=!s&&e&&zt.has(a)}return s||!(Xe.has(a)||Qe.has(a))}if(r&&(i!==`:`&&(r.labelCandidate=!1),i!==`{`&&(r.labelColon=-1),r.lastWord=``,r.statementStart=!1),/\d/.test(i??``)||i===`.`&&n&&/\d/.test(e[t-1]??``))return r&&(r.lastSignificant=`number`,Ht(r,i,!0)),!0;if(i===`]`)return r&&(r.lastSignificant=i,Ht(r,i,!0)),!0;if(i===`[`)return r&&(r.lastSignificant=i,Ht(r,i,!1)),!1;if(i===`(`){if(r){let e=r.pendingFunctions.at(-1);K(r.classParenRoles,a===`cn`?`C`:n||e?.phase===`before-params`||Qe.has(a)?`O`:`T`),e?.phase===`before-params`?(e.phase=`params`,K(r.parenKinds,`F`)):K(r.parenKinds,Qe.has(a)?`1`:`0`),r.forceRegex=!1,r.lastSignificant=i,Ht(r,i,!1)}return!1}if(i===`)`){if(r){r.classParenRoles.pop();let e=r.parenKinds.pop();if(r.forceRegex=e===`1`,e===`F`){let e=r.pendingFunctions.at(-1);e?.phase===`params`&&(e.phase=`after-params`)}r.lastSignificant=i,Ht(r,i,!0)}return!0}if(i===`<`)return r&&(qt(e,t,n)&&r.angleDepth++,r.lastSignificant=i,Ht(r,i,!1)),!1;if(i===`>`)return r?.angleDepth?(r.angleDepth--,r.lastSignificant=i,Ht(r,i,!0),!0):(r&&(r.lastSignificant=i,Ht(r,i,!1)),!1);if(i===`+`||i===`-`)return r&&(r.lastSignificant=i),e[t-1]===i||e[t+1]===i?(r&&Ht(r,i,n),n):(r&&Ht(r,i,!1),!1);if(i===`:`&&r){let e=r.pendingFunctions.at(-1);return e?.phase===`after-params`&&(e.phase=`return-type`,e.typeCanEnd=!1),r.labelCandidate&&(r.labelColon=t),r.lastSignificant=i,Ht(r,i,!1),!1}return i===`!`&&e[t+1]!==`=`?(r&&(r.lastSignificant=i,Ht(r,i,n)),n):i===`}`||i===`'`||i===`"`||i==="`"?(r&&(r.lastSignificant=i,Ht(r,i,!0)),!0):(r&&(r.lastSignificant=i,Ht(r,i,!1)),!1)}function Yt(e,t,n=!1,r){if(e[t+1]===`/`||e[t+1]===`*`)return!1;if(n)return!0;if(r!==void 0)return!r;let i=t-1;for(;i>=0&&/\s/.test(e[i]);)i--;if(i<0)return!0;if((e[i]===`+`||e[i]===`-`)&&e[i-1]===e[i]||e[i]===`!`&&i>0&&/[\w$)\]]/.test(e[i-1]??``)||e[i]===`>`&&i>0&&/[\w$)>]/.test(e[i-1]??``))return!1;if(`=([{,:;!?&|+-*%^~<>`.includes(e[i]))return!0;let a=i+1;for(;i>=0&&/[\w$]/.test(e[i]);)i--;return Ze.has(e.slice(i+1,a))}function Xt(e,t){let n=!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`
7
+ `||t===`\r`||t===`\u2028`||t===`\u2029`)return{end:-1,failedUntil:r};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{end:r,failedUntil:r}}}return{end:-1,failedUntil:e.length}}function Zt(e,t){let n=e[t+1]===`/`,r=t+(n?2:1),i=r;if(e[r]!==`>`){let t=e.codePointAt(r);if(t===void 0)return;let a=String.fromCodePoint(t);if(!an.test(a))return;for(i+=a.length;i<e.length;){let t=e.codePointAt(i);if(t===void 0)break;let n=String.fromCodePoint(t);if(!on.test(n)&&!`:.-`.includes(n))break;i+=n.length}let o=e[i];if(!/[\s/>]/.test(o??``)&&(o!==`<`||n))return}return{closing:n,name:e.slice(r,i),nameEnd:i}}function Qt(e,t,n){let r=n.get(t);if(r!==void 0)return r;let i=!1,a=!1,o=[],s;for(let r=t;r<e.length;r++){let c=e[r],l=e[r+1];if(a)(c===`
8
+ `||c===`\r`||c===`\u2028`||c===`\u2029`)&&(a=!1);else if(i)c===`*`&&l===`/`&&(i=!1,r++);else if(s)c===`\\`?r++:c===s&&(s=void 0);else if(c===`/`&&l===`/`)a=!0,r++;else if(c===`/`&&l===`*`)i=!0,r++;else if(c===`'`||c===`"`||c==="`")s=c;else if(c===`<`)K(o,r);else if(c===`>`&&e[r-1]!==`=`){let e=o.pop();if(e!==void 0&&(n.set(e,r),e===t))return r}}for(let e of o)n.set(e,-1);return-1}function $t(e,t,n){return!t.closing&&e[t.nameEnd]===`<`?Qt(e,t.nameEnd,n):-1}function en(e,t=0){return{blockComment:!1,braceDepth:+!!e,braceKinds:[],declarationBoundary:t,expression:Rt(),failedRegexUntil:-1,kind:`host`,lineComment:!1,terminating:e}}function tn(e){let t=e.at(-1);t?.kind===`host`&&Kt(t.expression,`jsx`)}function nn(e,t,n){for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`\\`)r=Ke(e,r,n==="`")-1;else if(t===n)return r+1}return-1}const rn=new Set(`break.case.catch.class.const.continue.debugger.default.delete.do.else.enum.export.extends.false.finally.for.function.if.import.in.instanceof.new.null.return.super.switch.this.throw.true.try.typeof.var.void.while.with`.split(`.`)),an=/^[$_\p{ID_Start}]$/u,on=/^(?:[$\p{ID_Continue}]|\u200c|\u200d)$/u;function sn(e,t){if(e[t]!==`\\`||e[t+1]!==`u`)return;if(e[t+2]===`{`){let n=0,r=t+3,i=0;for(;/^[0-9a-f]$/i.test(e[r]??``);){if(i=i*16+Number.parseInt(e[r],16),i>1114111)return;n++,r++}return n===0||e[r]!==`}`?void 0:{character:String.fromCodePoint(i),end:r+1}}let n=e.slice(t+2,t+6);if(/^[0-9a-f]{4}$/i.test(n))return{character:String.fromCodePoint(Number.parseInt(n,16)),end:t+6}}function cn(e,t){let n=[],r=!1,i=t,a=!0;for(;i<e.length;){let t=sn(e,i),o=t?.character??String.fromCodePoint(e.codePointAt(i));if(!(a?an.test(o):on.test(o)))break;K(n,o),r||=t!==void 0,i=t?.end??i+o.length,a=!1}return a?void 0:{end:i,escaped:r,value:n.join(``)}}function ln(e,t,n){let r=[],i=!1,a=!1,o=!1,s=!0,c=!1,l=`start`,u=!1,d;for(let f=t+1;f<n;f++){let t=e[f],n=e[f+1];if(o){(t===`
9
+ `||t===`\r`||t===`\u2028`||t===`\u2029`)&&(o=!1);continue}if(i){t===`*`&&n===`/`&&(i=!1,f++);continue}if(d){t===`\\`?f++:t===d&&(d=void 0);continue}if(t===`/`&&n===`/`){o=!0,f++;continue}if(t===`/`&&n===`*`){i=!0,f++;continue}if(t===`'`||t===`"`||t==="`"){if(r.length===0&&l!==`constraint`&&l!=="default")return!1;d=t,u=!0;continue}if(t===`(`||t===`[`||t===`{`||t===`<`){if(r.length===0&&l!==`constraint`&&l!=="default")return!1;K(r,t===`(`?`)`:t===`[`?`]`:t===`{`?`}`:`>`),u=!0;continue}if(t===r.at(-1)){r.pop();continue}if(r.length>0||/\s/.test(t))continue;if(t===`,`)return!(l===`start`||l===`after-const`||(l===`constraint`||l==="default")&&!u);if(t===`=`){if(n===`>`){if(l!==`constraint`&&l!=="default")return!1;u=!0,f++;continue}if(l===`constraint`&&!u||l!==`after-name`&&l!==`constraint`)return!1;a=!0,l=`default`,u=!1;continue}let p=cn(e,f);if(p){let e=p.value;if(l===`start`)!p.escaped&&e===`const`?l=`after-const`:(c=!0,s=!rn.has(e),l=`after-name`);else if(l===`after-const`)c=!0,s=!rn.has(e),l=`after-name`;else if(l===`after-name`){if(p.escaped||e!==`extends`)return!1;a=!0,l=`constraint`,u=!1}else u=!0;f=p.end-1}else{if(t===`/`||l!==`constraint`&&l!=="default")return!1;u=!0}}return!c||!s||!a||l===`after-const`||(l===`constraint`||l==="default")&&!u?!1:l===`after-name`||l===`constraint`||l==="default"}function un(e,t){let n=t;for(;n<e.length;)if(/\s/.test(e[n]))n++;else if(e[n]===`/`&&e[n+1]===`/`)for(n+=2;n<e.length&&e[n]!==`
10
+ `&&e[n]!==`\r`&&e[n]!==`\u2028`&&e[n]!==`\u2029`;)n++;else if(e[n]===`/`&&e[n+1]===`*`){let t=e.indexOf(`*/`,n+2);if(t===-1)return e.length;n=t+2}else break;return n}function dn(e,t,n){let r=Qt(e,t,n);return r===-1||!ln(e,t,r)?-1:e[un(e,r+1)]===`(`?r:-1}function fn(e,t,n){let r=new Set,i=[en(!1)],a=0;for(;a<e.length;){let o=i.at(-1),s=e[a],c=e[a+1];if(o.kind===`template`){s===`\\`?a=Ke(e,a,!0):s==="`"?(i.pop(),tn(i),a++):s===`$`&&c===`{`?(K(i,en(!0)),a+=2):a++;continue}if(o.kind===`element`){if(n===`auto`&&(s===`'`||s===`"`||s==="`")&&a>=o.failedQuoteUntil[s]){let t=nn(e,a,s);if(t!==-1){a=t;continue}o.failedQuoteUntil[s]=e.length}if(n===`auto`&&s===`/`&&c===`*`&&a>=o.failedBlockCommentUntil){let t=e.indexOf(`*/`,a+2);if(t!==-1){a=t+2;continue}o.failedBlockCommentUntil=e.length}if(s===`{`){K(i,en(!0,a+1)),a++;continue}if(s!==`<`){a++;continue}let r=Zt(e,a);if(!r){a++;continue}K(i,{blockComment:!1,closing:r.closing,kind:`tag`,name:r.name,opening:a,typeEnd:$t(e,r,t)}),a=r.nameEnd;continue}if(o.kind===`tag`){if(o.blockComment){s===`*`&&c===`/`?(o.blockComment=!1,a+=2):a++;continue}if(o.quote){s===`\\`?a=Ke(e,a):(s===o.quote&&(o.quote=void 0),a++);continue}if(s===`/`&&c===`*`){o.blockComment=!0,a+=2;continue}if(s===`'`||s===`"`){o.quote=s,a++;continue}if(a<=o.typeEnd){a++;continue}if(s===`<`){i.pop();continue}if(s===`{`){K(i,en(!0,a+1)),a++;continue}if(s!==`>`){a++;continue}let t=a-1;for(;/\s/.test(e[t]??``);)t--;let n=!o.closing&&e[t]===`/`;if(i.pop(),o.closing){let e=i.at(-1);e?.kind===`element`&&e.name===o.name&&(i.pop(),r.add(e.opening),tn(i))}else n?(r.add(o.opening),tn(i)):K(i,{failedBlockCommentUntil:-1,failedQuoteUntil:{'"':-1,"'":-1,"`":-1},kind:`element`,name:o.name,opening:o.opening});a++;continue}if(o.lineComment){(s===`
11
+ `||s===`\r`||s===`\u2028`||s===`\u2029`)&&(o.lineComment=!1,Wt(o.expression,o.braceDepth)),a++;continue}if(o.blockComment){s===`*`&&c===`/`?(o.blockComment=!1,a+=2):a++;continue}if(o.quote){s===`\\`?a=Ke(e,a):(s===o.quote&&(o.quote=void 0,Kt(o.expression,`string`)),a++);continue}if(s===`/`&&c===`/`){o.lineComment=!0,a+=2;continue}if(s===`/`&&c===`*`){o.blockComment=!0,a+=2;continue}if(s===`'`||s===`"`){o.quote=s,a++;continue}if(s==="`"){K(i,{kind:`template`}),a++;continue}if(s===`\\`){let t=sn(e,a);if(t){a=t.end,Kt(o.expression,`word`);continue}}if(s===`/`&&a>=o.failedRegexUntil&&Yt(e,a,o.expression.forceRegex,o.expression.canEnd)){let t=Xt(e,a);if(t.end!==-1){a=t.end,Kt(o.expression,`regex`);continue}o.failedRegexUntil=t.failedUntil}if(s===`<`&&!o.expression.canEnd){let r=Zt(e,a);if(r&&!r.closing){let o=n===`tsx`?dn(e,a,t):-1;if(o!==-1){a=o+1;continue}K(i,{blockComment:!1,closing:!1,kind:`tag`,name:r.name,opening:a,typeEnd:$t(e,r,t)}),a=r.nameEnd;continue}}if(s===`{`){let t=Ut(o.expression),n=o.expression.labelColon>=0,r=o.expression.statementStart&&(o.braceKinds.at(-1)===`B`||o.declarationBoundary>0||o.braceKinds.length===0&&It(e,a)),i=o.expression.forceRegex||n||r?`B`:t??(Lt(e,a,o.declarationBoundary,o.expression.parenKinds.length,o.expression.lastSignificant)?`B`:`O`);K(o.braceKinds,i),o.braceDepth++,o.expression.canEnd=!1,o.expression.forceRegex=!1,o.expression.labelCandidate=!1,o.expression.labelColon=-1,o.expression.lastSignificant=`{`,o.expression.lastWord=``,o.expression.statementStart=i===`B`,a++;continue}if(s===`}`&&o.braceDepth>0){if(o.braceDepth--,o.terminating&&o.braceDepth===0)i.pop();else{let e=o.braceKinds.pop();o.expression.canEnd=e!==`B`,o.expression.forceRegex=e===`B`,o.expression.labelCandidate=!1,o.expression.labelColon=-1,o.expression.lastSignificant=`}`,o.expression.lastWord=``,o.expression.statementStart=e===`B`,e===`B`&&(o.declarationBoundary=a+1)}a++;continue}if((s===`
12
+ `||s===`\r`||s===`\u2028`||s===`\u2029`)&&Wt(o.expression,o.braceDepth)){a++;continue}/\s/.test(s)||(o.expression.forceRegex=!1),o.expression.canEnd=Jt(e,a,o.expression.canEnd,o.expression),s===`;`&&(Gt(o.expression,o.braceKinds.at(-1)===`T`),o.braceKinds.length===0&&(o.declarationBoundary=a+1)),a++}return r}function pn(e,t,n){return!t&&n.has(e)}function mn(e,t){for(;t>=0&&/\s/.test(e[t]??``);)t--;if(e[t]!==`=`)return!1;for(t--;t>=0&&/\s/.test(e[t]??``);)t--;let n=t+1;for(;t>=0&&/[\w$-]/.test(e[t]??``);)t--;let r=e.slice(t+1,n);return r===`class`||r===`className`}function hn(e,t){return mn(e,t-1)}function gn(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]??``);)n--;return e[n]===`{`?mn(e,n-1):mn(e,n)}function _n(e){for(let t=e.classParenRoles.length-1;t>=0;t--){let n=e.classParenRoles[t];if(n!==`T`)return n===`C`}return!1}function vn(e,t,n){let r=t-1;for(;r>=0&&/\s/.test(e[r]??``);)r--;return e[r]===`(`?n.classParenRoles.at(-1)===`T`:e[r]===`[`||e[r]===`?`||e[r]===`:`||e[r]===`&`&&e[r-1]===`&`||e[r]===`|`&&e[r-1]===`|`}function yn(e,t,n,r,i){if(r===`block`){let n=e.indexOf(`*/`,t);return n===-1?e.length:n}if(r===`line`){for(let n=t;n<e.length;n++){let t=e[n];if(t===`
13
+ `||t===`\r`||t===`\u2028`||t===`\u2029`)return n}return e.length}if(n){for(let r=t;r<e.length;r++){let t=e[r];if(t===`\\`)r=Ke(e,r)-1;else if(t===n||t===`
14
+ `||t===`\r`||t===`\u2028`||t===`\u2029`)return r}return e.length}if(i)for(let n=t;n<e.length;n++){let t=e[n];if(t===`\\`)n=Ke(e,n,!0)-1;else if(t==="`"||t===`$`&&e[n+1]===`{`)return n}return e.length}function bn(e,t,n){if(!e.includes(`{`))return e;let r=new Map,i=t!==`none`&&e.includes(`<`)?fn(e,r,t):new Set,a=``,o=0,s,c,l=!1,u=-1,d=0,f=[],p=0,m=-1,h=Rt(),g,_=0,v=!1,y=0,b=0,x,S=-1,C=[],w=[],T=[],E=[],D=-1;for(;o<e.length;){let O=e[o];if(g){let t=qe(e,o,g);a+=e.slice(o,t),o=t,g.depth===0&&(g=void 0,_=t);continue}if(c){if(c===`line`&&(O===`
15
+ `||O===`\r`||O===`\u2028`||O===`\u2029`)){c=void 0,u=-1,d=0,Wt(h,f.length)&&(p=o+1),a+=O,o++;continue}if(c===`block`&&O===`*`&&e[o+1]===`/`){c=void 0,u=-1,d=0,a+=`*/`,o+=2;continue}if(O!==`{`){a+=O,o++;continue}}else if(s){if(O===`
16
+ `||O===`\r`||O===`\u2028`||O===`\u2029`){s=void 0,l=!1,u=-1,d=0,Kt(h,`string`),a+=O,o++;continue}if(O===`\\`){let t=Ke(e,o);a+=e.slice(o,t),o=t;continue}if(O===s){s=void 0,l=!1,u=-1,d=0,Kt(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=Ke(e,o,!0);a+=e.slice(o,t),o=t;continue}if(O==="`"){E.pop(),Kt(h,`template`),a+=O,o++;continue}if(O===`{`&&e[o-1]===`$`){t.groupLimit=-1,t.inText=!1,t.interpolationDepth=1,K(f,`I`),h.canEnd=!1,h.forceRegex=!1,h.lastSignificant=`{`,h.lastWord=``,a+=O,o++;continue}if(t.css){let n=qe(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`?Ge(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}K(w,`T`),x=void 0,K(f,`J`),b++,K(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?$t(e,t,r):-1}a+=O,o++;continue}else if(x===`tag`&&o<=S){a+=O,o++;continue}else if(x===`tag`&&O===`{`){K(w,`G`),x=void 0,K(f,`J`),b++,K(C,hn(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,Kt(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===`<`&&pn(o,h.canEnd,i)){K(T,{baseDepth:y,resumeExpression:b>0}),v=!1,x=`tag`;let t=Zt(e,o);S=t?$t(e,t,r):-1,a+=O,o++;continue}else if(O===`\\`){let t=sn(e,o);if(t){a+=e.slice(o,t.end),o=t.end,Kt(h,`word`);continue}}else if(O===`'`||O===`"`){s=O,l=gn(e,o)||_n(h)||x===void 0&&C.at(-1)===!0&&vn(e,o,h),u=-1,d=o+1,a+=O,o++;continue}else if(O==="`"){K(E,{classLiteral:gn(e,o)||_n(h)||x===void 0&&C.at(-1)===!0&&vn(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&&Yt(e,o,h.forceRegex,h.canEnd)){let t=Xt(e,o);if(t.end!==-1){a+=e.slice(o,t.end),o=t.end,Kt(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
+ `||O===`\r`||O===`\u2028`||O===`\u2029`)&&Wt(h,f.length)&&(p=o+1),/\s/.test(O)||(h.forceRegex=!1),h.canEnd=Jt(e,o,h.canEnd,h),O===`;`&&(Gt(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?Ut(h):void 0,j=k&&h.labelColon>=0,M=k&&h.statementStart&&(f.at(-1)===`B`||p>0||f.length===0&&It(e,o));if(k&&(f.length>0||A!==void 0||j||M||h.forceRegex||h.lastSignificant&&Ye.includes(h.lastSignificant)||Xe.has(h.lastWord)||mt(e,o,Math.max(p,_))||dt(e,o)||ft(e,o))){let t=h.forceRegex||j||M?`B`:A??(Lt(e,o,p,h.parenKinds.length,h.lastSignificant)?`B`:`O`);K(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),ee=e.length;if(s||c?(u<o&&(u=yn(e,o+1,s,c,!1)),ee=u):N?.inText&&(N.groupLimit<o&&(N.groupLimit=yn(e,o+1,void 0,void 0,!0)),ee=N.groupLimit),(e[o-1]===`#`||e[o-1]===`@`)&&!pt(e,o-1)){let t=Je(e,o,ee);if(t!==-1){a+=e.slice(o,t+1),o=t+1;continue}}let P=N?.inText===!0,F=s===void 0&&c===void 0&&!P?Be(e,o,ee):ze(e,o,ee),I=F.kind===`close`?F.index:-1,L=N===void 0||P||s!==void 0||c!==void 0,R=P?N.cssBoundary:s||c?d:_,te=L&&!l&&!(P&&N.classLiteral)&&ut(e,o,P,R),z=te?Je(e,o,ee):-1;if(te&&(s===void 0&&c===void 0||z!==-1)&&(z===-1||e[z+1]!==`@`)){let e={blockComment:!1,depth:1,lineComment:!1,parenDepth:0};P?N.css=e:g=e,a+=O,o++;continue}if(F.kind!==`close`){F.kind===`open`&&n&&(n.seen=!0),a+=e.slice(o,F.index),o=F.index,P?N.cssBoundary=F.index:s||c?d=F.index:_=F.index;continue}let B=e.slice(o+1,I),{conds:V,end:H}=He(e,I+1,ee),ne=Ue(B,!0);if(ne.length===0){a+=O,o++;continue}D===o&&a.length>0&&!/\s/.test(a.at(-1))&&(a+=` `),a+=ne.map(e=>`${e}${V}`).join(` `),D=H,P?N.cssBoundary=H:s||c?d=H:_=H,o=H}return a}function xn(e,t){let n={seen:!1};return{code:bn(e,t,n),nestedOpening:n.seen}}const Sn=/^(?:--?[\w-]+|[A-Z_$][\w$-]*|@teacss-skip-bracket-[\da-z]{6})$/i;function Cn(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(!Sn.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 wn(e){let t=[],n=[],r=[],i=!1,a;for(let o=0;o<e.length;o++){let s=e[o],c=e[o+1];if(n.length===0){s===`(`&&Cn(e,o)&&K(n,{attached:!0,start:o});continue}if(i)s===`*`&&c===`/`&&(i=!1,o++);else if(a)s===`\\`?o++:s===a&&(a=void 0);else if(s===`\\`)o++;else if(s===`/`&&c===`*`)i=!0,o++;else if(s===`'`||s===`"`||s==="`")a=s;else if(r.length>0)s===`[`||s===`(`?K(r,s===`[`?`]`:`)`):s===r.at(-1)&&r.pop();else if(s===`[`)K(r,`]`);else if(s===`(`)K(n,{attached:Cn(e,o),start:o});else if(s===`)`){let e=n.pop();e.attached&&K(t,{end:o+1,start:e.start})}}let o=[];for(let e of t.sort((e,t)=>e.start-t.start||t.end-e.end))(o.length===0||e.start>=o.at(-1).end)&&K(o,e);return o}function Tn(e){let t={seen:!1},n=En(e,t);for(let e=1;e<5&&t.seen;e++){t.seen=!1;let e=En(n,t);if(e===n)break;n=e}return n}function En(e,t){if(!e.includes(`{`))return e;let n=``,r=0,i=-1,a=0,o=0,s=e.includes(`[`)?Me(e):[],c=e.includes(`(`)?wn(e):[],l={closers:[]};for(;r<e.length;){for(;a<s.length&&s[a].end<=r;)a++;for(;o<c.length&&c[o].end<=r;)o++;let u=a<s.length?s[a]:void 0,d=o<c.length?c[o]:void 0,f=u?.start===r?u:d?.start===r?d:void 0;if(f&&l.blockComment!==!0&&l.quote===void 0){n+=e.slice(r,f.end),r=f.end;continue}l.closers.length>0&&/\s/.test(e[r])&&(l.blockComment=!1,l.closers.length=0,l.quote=void 0);let p=Re(e,r,l);if(p!==void 0){n+=e.slice(r,p+1),r=p+1;continue}let m=e[r];if(l.closers.length>0||m!==`{`){n+=m,r++;continue}let h=ze(e,r);if(h.kind!==`close`){h.kind===`open`&&t&&(t.seen=!0),n+=e.slice(r,h.index),r=h.index;continue}let g=h.index,_=e.slice(r+1,g),{conds:v,end:y}=He(e,g+1),b=Ue(_,!0);if(b.length===0){n+=m,r++;continue}i===r&&n.length>0&&!/\s/.test(n.at(-1))&&(n+=` `),n+=b.map(e=>`${e}${v}`).join(` `),i=y,r=y}return n}function Dn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const On=/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/;function kn(e){return On.test(e)}function An(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 jn=/[\\:]?[\s'"`;{}]+/g;new RegExp(jn);const Mn=`@teacss-skip-bracket-`,Nn=/@teacss-skip-bracket-[\da-z]{6}/g,Pn=/[\s'"`;{}]/,Fn=/^!?[.#>_+~:]/,In=/[^\S\t\n\v\f\r \u2028\u2029]/;function Ln(e,t){return/[A-Z_$]/i.test(e[t+1]??``)}function Rn(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 zn(e){return e!==void 0&&/\.html?$/i.test(e.split(/[?#]/,1)[0])}function Bn(e){return e!==void 0&&/\.(?:[cm]?[jt]sx?|mdx)$/i.test(e.split(/[?#]/,1)[0])}function Vn(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 Hn(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===`<`&&Ln(e,l)&&(o=!0,r=[]);continue}if(s){Wn(u)&&(s=!1);continue}if(i){u===`*`&&d===`/`&&(i=!1,l++);continue}if(c){u===`\\`?l++:u===c&&(c=void 0);continue}if(u===`/`&&d===`*`&&Rn(e,l,a)){i=!0,l++;continue}if(u===`/`&&d===`/`&&Rn(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)J(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&&!/[ \t\n\r\f"'`=<>]/.test(e[p]);)p++;J(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);J(l,e.slice(u,r)),J(l,` `.repeat(t-r-n.length-2)),J(l,`"${n}"`),u=t}return J(l,e.slice(u)),l.join(``)}function Un(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&&Pn.test(e)}}function Wn(e){let t=e?.charCodeAt(0);return t===10||t===13||t===8232||t===8233}function Gn(e,t){return e[t+1]===`\r`&&e[t+2]===`
18
+ `?t+2:t+1}function Kn(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]===`[`&&je(e,n)}const qn=new Set([`await`,`break`,`case`,`continue`,`debugger`,`delete`,`do`,`else`,`in`,`instanceof`,`new`,`of`,`return`,`throw`,`typeof`,`void`,`yield`]),Jn=new Set([`for`,`if`,`while`,`with`]);function Yn(e,t){let n=0;for(;t>0&&e[--t]===`\\`;)n++;return n%2==1}function Xn(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||Yn(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:Jn.has(e.slice(i,t))}}return!1}function Zn(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||Yn(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 Qn(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 $n(e,t){let n=Zn(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=Qn(e,r);return[`catch`,`class`,`do`,`else`,`finally`,`static`,`try`].includes(a.value)?!0:a.value?Qn(e,a.start).value===`class`:!1}function er(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]===`)`&&Xn(e,n)||e[n]===`}`&&$n(e,n))return!0;let r=n+1;for(;n>=0&&/[\w$]/.test(e[n]);)n--;let i=e.slice(n+1,r);return qn.has(i)?!0:i==="default"&&Qn(e,n+1).value===`export`}function tr(e,t){let n=!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(Wn(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 nr(e,t=!1){let n=[],r=[],i=[],a=!1,o=!1,s,c=-1,l,u=-1,d=!1,f=!1;function p(){f=!1,n.length=0,i=[],a=!1,o=!1,s=void 0,l=void 0}for(let m=0;m<e.length;m++){let h=e[m];if(!a&&!s&&h===`/`&&er(e,m)){let t=tr(e,m);if(t!==-1){m=t-1,d=!1,f=!1;continue}}if(n.length===0){if(Un(h)?f=d=!1:h===`/`&&(d=!0),h===`@`&&!e.startsWith(Mn,m)&&!Yn(e,m)&&(f=m>0&&(!Un(e[m-1])||e[m-1]===`}`)&&Fn.test(e.slice(m+1))),f&&h===`\\`){/\s/.test(e[m+1])&&(f=!1),m++;continue}h===`[`&&(J(n,m),o=d&&e[m-1]!==`:`&&e[m-1]!==`@`);continue}if(Un(h)&&(u=m),Wn(h)){p();continue}if((a||s)&&/\s/.test(h)&&(l??=xe(e,n.at(-1),!1,f?e.length:m),l===void 0)){p();continue}if(!a&&!s&&h===`/`&&o){p();continue}if(a){h===`*`&&e[m+1]===`/`&&(a=!1,m++);continue}if(s){h===`\\`?(Wn(e[m+1])?p():Un(e[m+1])&&(u=m+1),m++):h===s&&(J(i,[c+1,m]),s=void 0);continue}if(h===`/`&&e[m+1]===`*`)a=!0,m++;else if(h===`"`||h===`'`)s=h,c=m;else if(h===`\\`)Wn(e[m+1])&&p(),Un(e[m+1])&&(u=m+1),m++;else if(h===`[`)J(n,m);else if(h===`]`){let a=n.pop(),s=m+1,c=!1;if(u>a){let n=f||e[a-1]===`:`||e[a-1]===`@`,i=e[s]===`:`&&!!e[s+1]&&!Pn.test(e[s+1]);c=n&&!Ae(e,a)||i&&!(t&&Kn(e,s)),c&&J(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 nr(e.slice(t,n)))J(r,[t+i,t+a]);i=[]}}}let m=[];for(let e of r.sort(([e,t],[n,r])=>e-n||r-t))(m.length===0||e[0]>=m.at(-1)[1])&&J(m,e);return m}const rr=/^(?:--?[\w-]+|[A-Z_$][\w$-]*|@teacss-skip-bracket-[\da-z]{6})$/i;function ir(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(!rr.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 ar(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&&J(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!=="`"&&Wn(d)?a=void 0:d===`\\`?u=Gn(e,u):d===a?a=void 0:d===`(`&&ir(e,u)&&(J(n,{attached:!0,containsGroupBrace:!1,outerQuote:a,start:u}),c=void 0):d===`"`||d===`'`||d==="`"?a=d:d===`(`&&ir(e,u)&&(J(n,{attached:!0,containsGroupBrace:!1,outerQuote:void 0,start:u}),c=void 0);continue}if(Wn(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??=xe(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=Gn(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=Gn(e,u);else if(r.length>0)d===`[`?J(r,`]`):d===`(`?J(r,`)`):d===r.at(-1)?(r.pop(),r.length===0?s=-1:d===`)`&&(s=u)):d===`{`&&(n.at(-1).containsGroupBrace=!0);else if(d===`[`)J(r,`]`);else if(d===`{`)n.at(-1).containsGroupBrace=!0;else if(d===`(`)J(n,{attached:ir(e,u),containsGroupBrace:!1,outerQuote:f,start:u});else if(d===`)`){let e=n.pop();e.attached&&e.containsGroupBrace&&J(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])&&J(u,e);return u}function or(e,t,n){if(!t.length)return e;let r=new Set(e.match(Nn)),i=[],a=0;for(let[o,s]of t){let t=e.slice(o,s),c=0,l;for(;l=`${Mn}${An(c?`${t}:${c}`:t)}`,c++,r.has(l)||n.has(l)&&n.get(l)!==t;);n.set(l,t),J(i,e.slice(a,o)),J(i,l),a=s}return J(i,e.slice(a)),i.join(``)}function sr(e,t,n=!1){return or(e,nr(e,n),t)}function cr(e,t){return or(e,ar(e),t)}function lr(e,t){let n=[],r=0;for(let t=0;t<e.length;t++){let i=e[t];if(i===`\\`){let i=e[t+1];r&&i&&(/['"`;{}]/.test(i)||r===2&&In.test(i))?J(n,[t,t+2]):Un(i)&&(r=0),t++}else Un(i)?r===2&&In.test(i)?J(n,[t,t+1]):r=0:i===`@`&&(r=Fn.test(e.slice(t+1))?2:1)}return or(e,n,t)}function ur(e,t){let n=e;for(let e=0;e<t.size&&n.includes(Mn);e++){let e=n.replace(Nn,e=>t.get(e)??e);if(e===n)break;n=e}return n}function dr(e,t){let n=new Map;In.test(e)&&(e=lr(e,n)),e.includes(`[`)&&(e=sr(e,n,!0)),e.includes(`(`)&&(e=cr(e,n));let r=xn(e,t);e=r.code;for(let i=1;i<5&&r.nestedOpening;i++){let i=e;if(i.includes(`[`)&&(i=sr(i,n)),i.includes(`(`)&&(i=cr(i,n)),r=xn(i,t),r.code===i)break;e=r.code}e.includes(`[`)&&(e=sr(e,n)),e.includes(`(`)&&(e=cr(e,n)),e.includes(`\\`)&&(e=lr(e,n));let i=e.split(jn);return n.size?i.map(e=>e.includes(Mn)?ur(e,n):e):i}const fr={name:`@teacss/core/extractor-split`,order:0,extract({code:e,id:t}){return dr(Bn(t)?e:Hn(e,zn(t)),Vn(t))}};function pr(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 mr(){return{events:Object.create(null),emit(e,...t){let n=this.events,r=Array.from(q(Object.hasOwn(n,e)?n[e]:void 0));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:[];i!==r&&pr(n,e,i),K(i,t);let a=!0;return()=>{a&&=(pr(n,e,Array.from(q(Object.hasOwn(n,e)?n[e]:void 0)).filter(e=>e!==t)),!1)}}}}const hr=/^\[(.+?)~?="(.*)"\]$/,gr=/[\w\u00A0-\uFFFF%-?]/;new RegExp(hr.source,hr.flags),new RegExp(gr.source,gr.flags);function _r(e){return e.match(hr)}function vr(e){return typeof e==`function`?{match:e}:e}function yr(e){return e!=null}function br(e){return Reflect.ownKeys(e).filter(t=>Object.getOwnPropertyDescriptor(e,t)?.enumerable)}function xr(e,t){if(Object.getOwnPropertyDescriptor(e,t)?.enumerable)return{value:Reflect.get(e,t)}}function Sr(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Cr(e,t,n=!1){let r=e,i=t;if(Array.isArray(i))return[...n&&Array.isArray(r)?q(r):[],...q(i)];if(Sr(i)&&Object.hasOwn(i,`$reset`)&&i.$reset)return wr(i);if(!Sr(i))return i;if(!Sr(r))return wr(i);let a={...r};return br(i).forEach(e=>{if(e===`$reset`)return;let t=xr(i,e);if(!t)return;let r=t.value,o=Object.hasOwn(a,e)?Reflect.get(a,e):void 0;Sr(r)||Array.isArray(r)?_e(a,e,Cr(o,r,n)):_e(a,e,r)}),a}function wr(e){if(Array.isArray(e))return Array.from(q(e),wr);if(Sr(e)){let t={};for(let n of br(e)){if(n===`$reset`)continue;let r=xr(e,n);r&&_e(t,n,wr(r.value))}return t}return e}function Tr(e){return typeof e!=`object`||!e?e:Er(e)}function Er(e){if(Array.isArray(e)){let t=Array.from({length:e.length});for(let n=t.length-1;n>=0;n--)t[n]=Object.hasOwn(e,n)?Tr(e[n]):void 0;return t}if(Sr(e)){let t=e,n={};for(let e of br(t)){let r=xr(t,e);r&&_e(n,e,Tr(r.value))}return n}return e}function Dr(e){return Object.hasOwn(e,0)&&be(e[0])}const Or=Object.getOwnPropertyDescriptor(RegExp.prototype,`source`).get,kr=[[`d`,Object.getOwnPropertyDescriptor(RegExp.prototype,`hasIndices`)?.get],[`g`,Object.getOwnPropertyDescriptor(RegExp.prototype,`global`)?.get],[`i`,Object.getOwnPropertyDescriptor(RegExp.prototype,`ignoreCase`)?.get],[`m`,Object.getOwnPropertyDescriptor(RegExp.prototype,`multiline`)?.get],[`s`,Object.getOwnPropertyDescriptor(RegExp.prototype,`dotAll`)?.get],[`u`,Object.getOwnPropertyDescriptor(RegExp.prototype,`unicode`)?.get],[`v`,Object.getOwnPropertyDescriptor(RegExp.prototype,`unicodeSets`)?.get],[`y`,Object.getOwnPropertyDescriptor(RegExp.prototype,`sticky`)?.get]],Ar=Object.getOwnPropertyDescriptor(RegExp.prototype,`global`)?.get,jr=Object.getOwnPropertyDescriptor(RegExp.prototype,`sticky`)?.get,Mr=RegExp.prototype.exec;function Nr(e){return Reflect.apply(Or,e,[])}function Pr(e){return!!(Ar&&Reflect.apply(Ar,e,[])||jr&&Reflect.apply(jr,e,[]))}function Fr(e){let t=``;for(let[n,r]of kr)r&&Reflect.apply(r,e,[])&&(t+=n);return t}function Ir(e,t){let n=t.exec;if(!Pr(t))return Reflect.apply(n,t,[e]);if(Object.getOwnPropertyDescriptor(t,`lastIndex`)?.writable===!1){if(n!==Mr)return Reflect.apply(n,t,[e]);let r=new RegExp(Nr(t),Fr(t));return Reflect.apply(Mr,r,[e])}t.lastIndex=0;try{return Reflect.apply(n,t,[e])}finally{Object.getOwnPropertyDescriptor(t,`lastIndex`)?.writable!==!1&&(t.lastIndex=0)}}const Lr=/^[a-z][a-z0-9-]*$/,Rr={minAffix:4,maxDistance:1,minDistanceLength:6,segmentAffix:!0},zr={minAffix:3,maxDistance:1,minDistanceLength:0,segmentAffix:!1},Br={minAffix:3,maxDistance:2,minDistanceLength:0,segmentAffix:!1},Vr=new Set([`about`,`blob`,`bun`,`chrome`,`data`,`deno`,`file`,`ftp`,`http`,`https`,`jsr`,`mailto`,`node`,`npm`,`tel`,`urn`,`vscode`,`virtual`,`ws`,`wss`]);function Hr(e){let{body:t,important:n}=Ne(e);return n?`${t}!`:t}function Ur(e){let t=Hr(e);if(!t||t.startsWith(`$`)||t.startsWith(`[`))return!1;let n=t.indexOf(`:`);if(n<=0||n===t.length-1)return!1;let r=t.slice(0,n);return!Lr.test(r)||t.startsWith(`//`,n+1)?!1:!Vr.has(r)}function Wr(e){if(Fr(e))return;let t=Nr(e);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 Gr(e,t){let n=Object.hasOwn(e,2)?e[2]:void 0,r=n;for(;r!=null&&r!==Object.prototype&&r!==Array.prototype&&r!==Function.prototype;){if(Object.hasOwn(r,t))return Reflect.get(n,t);r=Object.getPrototypeOf(r)}}function Kr(e){return q(ve(Gr(e,`prefix`)||``))}function qr(e,t){for(let n of q(t))for(let t of Kr(n))if(e.startsWith(t)&&Ir(e.slice(t.length),n[0]))return!0;return!1}const Jr=new WeakMap;function Yr(e){let t=e.rulesStaticMap,n=Jr.get(t);if(n)return n;let r=new Map,i=new Set,a=new Set;for(let e of Object.keys(t)){let n=e.indexOf(`:`);if(n<=0)continue;let i=e.slice(0,n),o=Object.hasOwn(t,e)&&t[e];if(!o)continue;if(Gr(o,`internal`)){a.add(i);continue}let s=r.get(i);s||(s=new Set,r.set(i,s)),s.add(e.slice(n+1))}for(let t of q(e.rulesDynamic)){let e=Wr(t[0]);if(e!=null)for(let n of Kr(t)){let o=(n+e).split(`:`,1)[0];Gr(t,`internal`)?a.add(o):r.has(o)||i.add(o)}}let o={prefixValues:r,dynamicPrefixes:i,internalPrefixes:a};return Jr.set(t,o),o}function Xr(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),i=[...r];for(let a=1;a<=e.length;a++){i[0]=a;let o=a;for(let n=1;n<=t.length;n++){let s=e[a-1]===t[n-1]?0:1;i[n]=Math.min(r[n]+1,i[n-1]+1,r[n-1]+s),i[n]<o&&(o=i[n])}if(o>n)return 1/0;[r,i]=[i,r]}return r[t.length]<=n?r[t.length]:1/0}function Zr(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return r}function Qr(e,t){return(t.startsWith(e)?t[e.length]===`-`:t.endsWith(e)&&t[t.length-e.length-1]===`-`)&&(e.includes(`-`)||e.length>=6)}function $r(e,t,n){if(e.length>=n.minDistanceLength){let r=Xr(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?Qr(r,i):i.startsWith(r)||i.endsWith(r)||i.includes(r)))return 3+(i.length-r.length)/100;if(!n.segmentAffix&&Zr(e,t)>=n.minAffix)return 5+Math.abs(e.length-t.length)/100}function ei(e,t,n={}){let{body:r,important:i}=Ne(e),a=r.indexOf(`:`);if(a<=0)return;let o=r.slice(0,a),s=r.slice(a+1),{prefixValues:c,dynamicPrefixes:l,internalPrefixes:u}=Yr(t),d=[];if(c.has(o)||l.has(o)||u.has(o)||qr(r,t.rulesDynamic))for(let e of c.get(o)??[]){if(e===s)continue;let t=$r(s,e,Br);t!==void 0&&J(d,{suggestion:`${o}:${e}`,score:t})}else{if(!n.confirmedIntent&&o.length<3)return;let e=new Set([...c.keys(),...l]);for(let t of e){let e=$r(o,t,n.confirmedIntent?zr:Rr);if(e===void 0)continue;let r=c.get(t)?.has(s)||l.has(t);J(d,{suggestion:`${t}:${s}`,score:r?e:e+10})}if(d.length===0)return}d.sort((e,t)=>e.score-t.score||(e.suggestion<t.suggestion?-1:1));let f=new Set,p=[];for(let{suggestion:e}of d)if(!(f.has(e)||e===r)&&(f.add(e),J(p,i?`${e}!`:e),p.length===3))break;return p}function ti(e){let t=e.split(/\s+/);return t[0]===``&&t.shift(),t.at(-1)===``&&t.pop(),t}function ni(e){if(!e.includes(`[`))return ti(e);let t=Me(e);if(t.length===0)return ti(e);let n=[],r=0,i=-1;for(let a=0;a<e.length;a++){let o=t[r];if(o&&a===o.start){i<0&&(i=a),a=o.end-1,r++;continue}/\s/.test(e[a])?(i>=0&&J(n,e.slice(i,a)),i=-1):i<0&&(i=a)}return i>=0&&J(n,e.slice(i)),n}function ri(e,t,n){let r=e;for(;r!==null&&r!==Object.prototype&&!Object.hasOwn(r,t);)r=Object.getPrototypeOf(r);if(r!==null&&r!==Object.prototype){if(!Reflect.set(e,t,n))throw TypeError(`Cannot assign rule metadata "${String(t)}"`)}else _e(e,t,n)}function ii(e,t){let n=e;for(;n!==null&&n!==Object.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function ai(e){let t=[void 0,void 0,void 0];for(let n=0;n<2;n++){if(!Object.hasOwn(e,n))throw TypeError(`[Teacss] invalid rule or shortcut entry: matcher and body must be own tuple values`);t[n]=e[n]}let n=Object.hasOwn(e,2)?e[2]:void 0;if(n!==void 0){let e={...n},r=Object.hasOwn(e,`prefix`)&&e.prefix;Array.isArray(r)&&(e.prefix=[...q(r)]),t[2]=e}return t}function oi(e){return Array.from(q(e),ai)}function si(e,t=!0){let n=Object.create(null),r=[];for(let[i,a]of e.entries()){let e=Object.hasOwn(a,2)?a[2]:void 0;if(e===void 0){if(e={},Object.hasOwn(a,2)){if(!Reflect.set(a,2,e))throw TypeError(`Cannot assign rule metadata`)}else _e(a,2,e)}if(ri(e,`__index`,i),Dr(a)){let r=ve(ii(e,`prefix`)??``);for(let e of r){let r=e+a[0];if(t&&Ne(r).keyword)throw TypeError(`[Teacss] ordinary rule "${r}" is a bare name; use shortcuts or a declaration name (property:value).`);n[r]=a}}else K(r,a)}return r.reverse(),{rulesSize:e.length,rulesDynamic:r,rulesStaticMap:n}}function ci(e){let t=oi(e.rules),n=si(t);e.rules=t,e.rulesSize=n.rulesSize,e.rulesDynamic=n.rulesDynamic,e.rulesStaticMap=n.rulesStaticMap}function Y(e,t){return e!=null&&Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function li(e){return[...q(ve(e))]}function ui(e,t){for(let t=e.length;t>0;t--)Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:e[t-1],writable:!0});_e(e,0,t)}function di(e){let t=new Set,n=[];for(let r of e){let e=r.name;t.has(e)||(t.add(e),K(n,r))}return n}function fi(e){return Array.from(e,(e,t)=>({index:t,order:ge(e,`order`)||0,value:e})).sort((e,t)=>e.order-t.order||e.index-t.index).map(({value:e})=>e)}function pi(e,t){let n={...e};for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(t,e)?.enumerable)continue;let r=Reflect.get(t,e);r!==void 0&&_e(n,e,r)}return n}function mi(e){return Array.from(q(ve(e)),e=>Array.isArray(e)?[e]:Object.entries(e)).flat()}const hi=new WeakSet;function gi(e,t){let n={};for(let t of Reflect.ownKeys(e)){if(t===`name`||!Object.getOwnPropertyDescriptor(e,t)?.enumerable)continue;let r=Reflect.get(e,t);_e(n,t,t===`prefix`&&Array.isArray(r)?[...q(r)]:r)}return _e(n,`name`,t),n}async function _i(e,t){let n=typeof e==`function`?await e():await e;if(typeof n!=`object`||!n||Array.isArray(n))throw TypeError(`Invalid TeaCSS preset: expected an object, received ${n===null?`null`:Array.isArray(n)?`array`:typeof n}.`);t?.(n);let r=Object.hasOwn(n,`name`)?Reflect.get(n,`name`):void 0;if(typeof r!=`string`||r.trim()===``)throw TypeError(`Invalid TeaCSS preset: expected a non-empty string name.`);if(hi.has(n))return n;n=gi(n,r),hi.add(n);let i=Y(n,`shortcuts`),a=Y(n,`rules`),o=i?oi(mi(i)):void 0;n.shortcuts=o,n.rules=a?oi(a):void 0;let s=Y(n,`prefix`),c=Y(n,`layer`);if(s||c){let e=e=>{e[2]||={};let t=e[2];ge(t,`prefix`)==null&&s&&_e(t,`prefix`,[...ve(s)]),ge(t,`layer`)==null&&c&&_e(t,`layer`,c)};o?.forEach(e),n.rules?.forEach(e)}return n}async function vi(e){return yi(e,new Set)}async function yi(e,t){let n=new Set(t),r=e=>{if(t.has(e))throw TypeError(`Circular TeaCSS preset reference detected.`);n.add(e)};r(e);let i=await _i(e,r),a=Y(i,`presets`);if(!a)return[i];let o=Array.from(q(ve(a)),e=>Array.isArray(e)?[...q(e)]:[e]).flat();return[i,...(await Promise.all(o.map(e=>yi(e,n)))).flat()]}function bi(e){if(e.length===0)return{};let t=[],n=[],r=!1,i=!1,a=[],o=[];for(let s of e){let e=Y(s,`pipeline`),c=Y(s,`filesystem`),l=Y(s,`inline`),u=e&&Y(e,`include`),d=e&&Y(e,`exclude`);e===!1?(i=!0,r=!0):r||(e!==void 0&&(i=!0),u&&K(t,u),d&&K(n,d)),c&&K(a,c),l&&K(o,l)}let s={};return r?s.pipeline=!1:i&&(s.pipeline={},t.length&&(s.pipeline.include=ye(wi(t))),n.length&&(s.pipeline.exclude=ye(wi(n)))),a.length&&(s.filesystem=ye(a.flatMap(li))),o.length&&(s.inline=ye(o.flatMap(li))),s}async function xi(e={},t={}){let n=pi(t,e),r=Y(n,`presets`)??[],i=Array.from(q(ve(r)),li).flat(),a=di((await Promise.all(i.map(vi))).flat()),o=Array.from(a,e=>({enforce:Y(e,`enforce`),preset:e})),s=[...o.filter(({enforce:e})=>e===`pre`),...o.filter(({enforce:e})=>e==null),...o.filter(({enforce:e})=>e===`post`)].map(({preset:e})=>e),c=[...s,n],l=[...c].reverse(),u=c.reduce((e,t)=>({...e,...Y(t,`layers`)}),{...Le});function d(e){return ye(c.flatMap(t=>li(Y(t,e))))}let f=d(`extractors`),p=l.map(e=>Y(e,`extractorDefault`)).find(e=>e!==void 0);p===void 0&&(p=fr),p&&!f.includes(p)&&ui(f,p);let m=fi(f),h=oi(d(`rules`)),{rulesSize:g,rulesStaticMap:_,rulesDynamic:v}=si(h,!1),y=c.map(e=>Y(e,`autocomplete`)),b=e=>y.flatMap(t=>li(Y(t,e))),x={templates:ye(b(`templates`)),extractors:fi(b(`extractors`)),shorthands:Ci(y.map(e=>Y(e,`shorthands`)||{}))},S=d(`separators`);S.length||(S=[`:`,`-`]);let C=bi(d(`content`)),w=l.map(e=>Y(e,`details`)).find(e=>e!==void 0),T=l.map(e=>Y(e,`outputToCssLayers`)).find(e=>e!==void 0),E=l.map(e=>Y(e,`sortLayers`)).find(e=>e!==void 0),D=Y(n,`envMode`)||`build`,O={...n,mergeSelectors:Y(n,`mergeSelectors`)??!0,warn:Y(n,`warn`)??!0,unmatched:Y(n,`unmatched`)??`off`,outputToCssLayers:T,sortLayers:E??(e=>e),blocklist:d(`blocklist`),presets:s,envMode:D,shortcutsLayer:Y(n,`shortcutsLayer`)||`shortcuts`,layers:u,theme:Si(c.map(e=>Y(e,`theme`))),rules:h,rulesSize:g,rulesDynamic:v,rulesStaticMap:_,preprocess:d(`preprocess`),postprocess:d(`postprocess`),preflights:d(`preflights`),autocomplete:x,variants:fi(d(`variants`).map(vr)),shortcuts:oi(mi(d(`shortcuts`))).reverse(),extractors:m,safelist:d(`safelist`),separators:S,details:w??D===`dev`,content:C,transformers:di(d(`transformers`))},k=d(`extendTheme`);for(let e of k)O.theme=e(O.theme,O)||O.theme;for(let e of c){let t=Y(e,`configResolved`);t!=null&&await t(O)}return ci(O),Fe(O),O}function Si(e){return e.reduce((e,t)=>{if(!t)return e;let n=Er(t);if(!Sr(n))return n;if(!Sr(e)){if(!Reflect.ownKeys(n).some(e=>Object.getOwnPropertyDescriptor(n,e)?.enumerable))return e;if(Object.hasOwn(n,`$reset`)&&Reflect.get(n,`$reset`))return Cr({},n);throw TypeError(`[Teacss] cannot safely merge a plain theme into a non-plain theme; use extendTheme for a class-aware merge or $reset to replace it.`)}return Cr(e,n)},{})}function Ci(e){return e.reduce((e,t)=>{let n=Object.create(null);for(let e of Object.keys(t)){if(!Object.hasOwn(t,e))continue;let r=t[e];if(Array.isArray(r)){let t=li(r);n[e]=t.length===1?t[0]??``:`(${t.join(`|`)})`}else n[e]=r}return{...e,...n}},{})}function wi(e){return e.flatMap(e=>li(Ti(e)))}function Ti(e){return Array.isArray(e)?e:e?[e]:[]}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 Ei={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},Di=RegExp(`^[ \\t\\n\\r\\f]*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:e[+-]?\\d+)?)(${Object.keys(Ei).join(`|`)}|[sld]?v(?:[whib]|min|max)|cq(?:[whib]|min|max)|r?(?:ch|ex|cap|ic|lh)|%)?[ \\t\\n\\r\\f]*(?![\\s\\S])`,`i`);function Oi(e){let t=Di.exec(e);if(!t)return null;let n=Number.parseFloat(t[1]),r=(t[2]??`px`).toLowerCase();if(Object.hasOwn(Ei,r)&&(n*=Ei[r],r=`px`),!Number.isFinite(n))return null;let i=r===`px`?Math.round(n*1e6)/1e6:n;return{unit:r,value:Number.isFinite(i)?i:n}}function ki(e){let t=!1,n=Mi(e)[0];if(/["'\\/]|not/i.test(n)&&(n=n.replace(/"(?:\\[\s\S]|[^"\\])*(?:"|$)|'(?:\\[\s\S]|[^'\\])*(?:'|$)|\/\*[\s\S]*?(?:\*\/|$)|((?:[-\w\u0080-\uffff]|\\(?:[\da-f]{1,6}(?:\r\n|[ \t\n\r\f])?|[^\n\r\f]))+)|\\[\s\S]/gi,(e,n)=>n?(he(n).toLowerCase()===`not`&&(t=!0),n.includes(`\\`)?`_`:n):` `)),!/^@media(?=[ \t\n\r\f(])/i.test(n)||t)return null;let r=null;for(let e of n.matchAll(/\([ \t\n\r\f]*(min|max)-width[ \t\n\r\f]*:([^)]*)\)/gi)){let t=Oi(e[2]);if(t){if(/min/i.test(e[1]))return t;r??={unit:t.unit,value:-t.value}}}return r}function Ai(e,t){return e<t?-1:+(e>t)}function ji(e,t,n){let r=(e.get(t)??0)-(e.get(n)??0);if(r)return r;let i=ki(t),a=ki(n);if(i==null!=(a==null))return i==null?-1:1;if(i!=null&&a!=null){if(i.unit!==a.unit)return Ai(i.unit,a.unit);if(i.value!==a.value)return i.value-a.value}return Ai(t,n)}function Mi(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===`\\`?s++: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)&&(J(t,e.slice(o,s)),s+=3,o=s+1)}return J(t,e.slice(o)),t}Function.prototype;const Ni=`@teacss-skip-start`,Pi=`@teacss-skip-end`;RegExp(`(//\\s*?${Ni}\\s*?|\\/\\*\\s*?${Ni}\\s*?\\*\\/|<!--\\s*?${Ni}\\s*?-->)[\\s\\S]*?(//\\s*?${Pi}\\s*?|\\/\\*\\s*?${Pi}\\s*?\\*\\/|<!--\\s*?${Pi}\\s*?-->)`,`g`);const Fi=RegExp(`(//\\s*?${Ni}\\s*?|\\/\\*\\s*?${Ni}\\s*?\\*\\/|<!--\\s*?${Ni}\\s*?-->)[\\s\\S]*?(//\\s*?${Pi}\\s*?|\\/\\*\\s*?${Pi}\\s*?\\*\\/|<!--\\s*?${Pi}\\s*?-->)`,`g`);function Ii(e){return e===`
19
+ `||e===`\r`||e===`\u2028`||e===`\u2029`}function Li(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!=="`"&&Ii(t))return r}return e.length}const Ri=/\.(?:[cm]?[jt]sx?|vue|svelte|astro|marko|php|phtml|scss|sass|less|styl(?:us)?)(?:$|\?)/i,zi=/\.(?:html?|vue|svelte|astro|marko|mdx?|php|phtml)(?:$|\?)/i;function Bi(e,t){let n=[],r=t===void 0||Ri.test(t),i=t===void 0||zi.test(t);for(let t=0;t<e.length;){let a=e[t];if(a===`"`||a===`'`||a==="`"){t=Li(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 Vi=[/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|`(?:\\[\s\S]|[^`\\])*`/g,/<[^/?<>0-9$_!"'](?:"[^"]*"|'[^']*'|[^>])+>/g,/(@apply|--at-apply)[^;]*;/g],Hi=[Fi],Ui={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`}
20
20
  /** @license
21
21
  * fzf v0.5.2
22
22
  * Copyright (c) 2021 Ajit
23
23
  * Licensed under BSD 3-Clause
24
24
  */
25
- const Di={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&&(Di[n]=e)}}const Oi={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(let e of Object.keys(Oi)){let t=e.toUpperCase();for(let n=Oi[e][0];n<=Oi[e][1];++n)Di[n]=n%2==0?t:e}function ki(e){if(e<192||e>8580)return e;let t=Di[e];return t===void 0?e:t.codePointAt(0)}function Ai(e){return e}function ji(e){return e}function Mi(e,t){return e>t?e:t}const Ni=e=>e.split(``).map(e=>e.codePointAt(0)),Pi=new Set(` \f
26
- \r \v\xA0 \u2028\u2029   `.split(``).map(e=>e.codePointAt(0)));for(let e=` `.codePointAt(0);e<=` `.codePointAt(0);e++)Pi.add(e);const Fi=``.codePointAt(0),Ii=`A`.codePointAt(0),Li=`Z`.codePointAt(0),Ri=`a`.codePointAt(0),zi=`z`.codePointAt(0),Bi=`0`.codePointAt(0),Vi=`9`.codePointAt(0);function Hi(e,t,n){return n?e:t-e-1}function Ui(e){return e?new Set:null}function Wi(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 Gi(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 Ki(e){return e>=Ri&&e<=zi?1:e>=Ii&&e<=Li?2:e>=Bi&&e<=Vi?4:0}function qi(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 Ji(e){return e<=Fi?Ki(e):qi(e)}function Yi(e,t){return e===0&&t!==0?8:e===1&&t===2||e!==4&&t===4?7:t===0?8:0}function Xi(e,t){return t===0?8:Yi(Ji(e[t-1]),Ji(e[t]))}function Zi(e,t,n,r){let i=e.slice(r),a=i.indexOf(n);if(a===0)return r;if(!t&&n>=Ri&&n<=zi){a>0&&(i=i.slice(0,a));let e=i.indexOf(n-32);e>=0&&(a=e)}return a<0?-1:r+a}function Qi(e){for(let t of e)if(t>=128)return!1;return!0}function $i(e,t,n){if(!Qi(e))return 0;if(!Qi(t))return-1;let r=0,i=0;for(let a=0;a<t.length;a++){if(i=Zi(e,n,t[a],i),i<0)return-1;a===0&&i>0&&(r=i-1),i++}return r}const ea=(e,t,n,r,i,a,o)=>{let s=i.length;if(s===0)return[{start:0,end:0,score:0},Ui(a)];let c=r.length;if(o!==null&&c*s>o.i16.length)return na(e,t,n,r,i,a);let l=$i(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]=Wi(u,o,c),[u,p]=Wi(u,o,c),[u,m]=Wi(u,o,c),[d,h]=Gi(d,o,s);let[,g]=Gi(d,o,c);for(let e=0;e<g.length;e++)g[e]=r[e];let _=Ai(0),v=0,y=0,b=0,x=i[0],S=i[0],C=Ai(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<=Fi?(o=Ki(a),!e&&o===2&&(a+=32)):(o=qi(a),!e&&o===2&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0)),t&&(a=ki(a))),E[r]=a;let c=Yi(w,o);if(k[r]=c,w=o,a===S&&(y<s&&(h[y]=ji(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 D[r]=Mi(T?C+-1: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]=Wi(u,o,j*s);{let e=f.subarray(A,b+1);for(let[t,n]of e.entries())M[t]=n}let[,N]=Wi(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=Mi(t,Mi(4,m[c-b+1]))),g+t<y?(g+=l[e],b=0):g+=t}u[e]=b,r=g<y;let x=Mi(Mi(g,y),0);a===s-1&&(n&&x>_||!n&&x>=_)&&(_=x,v=c),f[e]=x}}let I=Ui(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 ta(e,t,n,r,i,a,o){let s=0,c=0,l=!1,u=0,d=Ai(0),f=Ui(o),p=0;i>0&&(p=Ji(n[i-1]));for(let m=i;m<a;m++){let i=n[m],a=Ji(i);if(e||(i>=Ii&&i<=Li?i+=32:i>Fi&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),t&&(i=ki(i)),i===r[s]){o&&f!==null&&f.add(m),c+=16;let e=Yi(p,a);u===0?d=e:(e===8&&(d=e),e=Mi(Mi(e,d),4)),c+=s===0?e*2:e,l=!1,u++,s++}else c+=l?-1:-3,l=!0,u=0,d=0;p=a}return[c,f]}const na=(e,t,n,r,i,a,o)=>{if(i.length===0)return[{start:0,end:0,score:0},null];if($i(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>=Ii&&o<=Li?o+=32:o>Fi&&(o=String.fromCodePoint(o).toLowerCase().codePointAt(0))),t&&(o=ki(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>=Ii&&a<=Li?a+=32:a>Fi&&(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]=ta(e,t,r,i,c,l,a);return[{start:c,end:l,score:o},f]}return[{start:-1,end:-1,score:0},null]},ra=(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||$i(r,i,e)<0)return[{start:-1,end:-1,score:0},null];let l=0,u=-1,d=Ai(0),f=Ai(-1);for(let a=0;a<s;a++){let o=Hi(a,s,n),p=r[o];e||(p>=Ii&&p<=Li?p+=32:p>Fi&&(p=String.fromCodePoint(p).toLowerCase().codePointAt(0))),t&&(p=ki(p));let m=Hi(l,c,n);if(i[m]===p){if(m===0&&(d=Xi(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]=ta(e,t,r,i,a,o,!1);return[{start:a,end:o,score:l},null]}return[{start:-1,end:-1,score:0},null]};function ia(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}const aa=ia(102400,2048),oa=(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}let i=Ni(e);return n&&(i=i.map(ki)),{queryRunes:i,caseSensitive:r}};function sa(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 ca(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,aa);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 la(e){let{queryRunes:t,caseSensitive:n}=oa(e,this.opts.casing,this.opts.normalize),r={},i=ca.bind(this)(r,t,n);for(let e=0,t=this.runesList.length;e<t;++e)i(e);return sa(r,this.opts.limit)}const ua={limit:1/0,selector:e=>e,casing:`smart-case`,normalize:!0,fuzzy:`v2`,tiebreakers:[],sort:!0,forward:!0};var da=class{constructor(e,...t){switch(this.opts={...ua,...t[0]},this.items=e,this.runesList=e.map(e=>Ni(this.opts.selector(e).normalize())),this.algoFn=ra,this.opts.fuzzy){case`v2`:this.algoFn=ea;break;case`v1`:this.algoFn=na}}};const fa={...ua,match:la};var pa=class extends da{constructor(e,...t){super(e,...t),this.opts={...fa,...t[0]}}find(e){return e.length===0||this.items.length===0?this.items.slice(0,this.opts.limit).map(ma):(e=e.normalize(),ha(this.opts.match.bind(this)(e),this.opts))}};({...ua});const ma=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function ha(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 ga(e,t,n){return n(e.item).length-n(t.item).length}function _a(e,t){return e.start-t.start}var va=class{constructor(e,...t){this.finder=new pa(e,...t),this.find=this.finder.find.bind(this.finder)}},Y=C(`lru-cache:metrics`),ya=w(`lru-cache`),ba=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date,xa=()=>Y.hasSubscribers||ya.hasSubscribers,Sa=new Set,Ca=typeof process==`object`&&process?process:{},wa=(e,t,n,r)=>{typeof Ca.emitWarning==`function`?Ca.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},Ta=e=>!Sa.has(e),Ea=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),Da=e=>Ea(e)?e<=256?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?Oa:null:null,Oa=class extends Array{constructor(e){super(e),this.fill(0)}},ka=class e{heap;length;static#e=!1;static create(t){let n=Da(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]}},Aa=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??ba,n!==0&&!Ea(n))throw TypeError(`max option must be a nonnegative integer`);let E=n?Da(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.#_=ka.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`;Ta(t)&&(Sa.add(t),wa(`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 Oa(this.#e),t=new Oa(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 Oa(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=xa()?{}: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=ya.hasSubscribers,{status:r=xa()?{}: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,ya.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}{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=ya.hasSubscribers,{status:r=xa()?{}: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,ya.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)}}},ja=`@teacss/autocomplete`;const Ma=5e4,Na=2e6,Pa=5e4,Fa=4096,Ia=1e3,La=5e7,Ra=1e5,za=new Map(Array.from(`ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåçèéêëìíîïñòóôõöøùúûüýÿĀāĂ㥹ĆćĈĉĊċČčĎďđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥħĨĩĪīĬĭĮįİıĴĵĶķĹĺĻļĽľŀłŃńŅņŇňŌōŎŏŐőŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƃƆƈƉƊƌƎƐƒƓƗƙƚƜƝƞƟƠơƥƫƭƮƯưƲƴƶǍǎǏǐǑǒǓǔǗǘǝǥǦǧǨǩǪǫǰǴǵǸǹȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȞȟȠȡȥȦȧȨȩȮȯȲȳȴȵȶȷȺȻȼȽȾȿɀɃɄɅɆɇɈɉɊɋɌɍɎɏɐɑɓɔɕɖɗɘɛɜɝɞɟɠɡɢɥɦɨɪɫɬɭɯɰɱɲɳɴɵɹɺɻɼɽɾɿʀʁʂʇʈʉʋʌʍʎʏʐʑʗʙʚʛʜʝʞʟʠʮͣͤͥͦͧͨͩͪͫͬͭͮͯᴀᴃᴄᴅᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᵢᵣᵤᵥḀḁḂḃḄḅḆḇḊḋḌḍḎḏḐḑḒḓḘḙḚḛḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉṊṋṔṕṖṗṘṙṚṛṞṟṠṡṢṣṪṫṬṭṮṯṰṱṲṳṴṵṶṷṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐốỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹⁱₕₖₗₘₙₚₛₜↄ`,(e,t)=>[e,`AAAAAACEEEEIIIINOOOOOOUUUUYsaaaaaaceeeeiiiinoooooouuuuyyAaAaAaCcCcCcCcDddEeEeEeEeEeGgGgGgGgHhhIiIiIiIiIiJjKkLlLlLlllNnNnNnOoOoOoRrRrRrSsSsSsSsTtTttUuUuUuUuUuUuWwYyYZzZzZzsbBbOcDDdEEfGIklMNnOOopttTUuVyzAaIiOoUuUuegGgKkOojGgNnAaAaEeEeIiIiOoOoRrRrUuUuSsTtHhNdzAaEeOoYylntjACcLTszBUVEeJjQqRrYyaabocddeeeeejggGhhiIlllmmmnnNorrrrrrrRRsttuvvwyYzzcBeGHjkLqhaeioucdhmrtvxABCDEeiJKLMNOOoooooPRRTUuumVWZiruvAaBbBbBbDdDdDdDdDdEeEeFfGgHhHhHhHhHhIiIiKkKkKkLlLlLlMmMmMmNnNnNnNnPpPpRrRrRrSsSsTtTtTtTtUuUuUuVvVvWwWwWwWwWwXxXxYyZzZzZzhtwyasAaAaAaAaAaAaAaAaAaAaAaAaEeEeEeEeEeEeEeEeIiIiOoOoOoOoOoOoOoOoOoOoOoOoUuUuUuUuUuUuUuYyYyYyYyihklmnpstc`[t]])),Ba={maxAttempts:Pa,maxCandidateLength:Fa,maxCandidates:Ma,maxCharacters:Na,maxScans:Ra,maxScannedCharacters:5e7},Va={...Ba,maxCandidateLength:Na,maxCandidates:Ia};function Ha(){return{suggestions:[],attempts:0,candidates:0,characters:0,scans:0,truncated:!1}}const Ua=new WeakMap,Wa=new WeakMap;function Ga(e,t,n){let r=Ua.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 Ka(e,t,n){let r=Wa.get(e);return r?r(t,n):Ga(e,t,n)}var qa=class extends Error{template;constructor(e,t){super(e),this.template=t,this.name=ja,this.template=t}toString(){return`⚠️ [${this.name}]: ${this.message}. ${this.template?`Template: ${this.template}.`:``}`}};const Ja={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(`|`)})`},Ya=[`DEFAULT`];function Xa(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 Za=Ma;function Qa(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 $a(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 eo(e,t){let n=e.indexOf(`(`),r=n===-1?void 0:Qa(e,n);if(n===-1||r==null)return[e];let i=e.slice(0,n),a=eo(e.slice(r+1),t);if(a===void 0)return;let o=[];for(let s of $a(e.slice(n+1,r))){let e=eo(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 to(e){let t={remaining:Za},n=[];for(let r of $a(e)){let e=eo(r,t);if(e===void 0)return;n.push(...e)}return n}function no(e,t={},n={}){let r=[],i=[],a={...Ja,...n};e=e.replace(/<([\w-]+)>/g,(e,t,n,r)=>Object.hasOwn(a,t)?a[t]:(i.push(new qa(`Unknown template shorthand: <${t}>`,r)),e)),c(e),i.length&&(r.length=0);let o={parts:r,suggest:l,errors:i};return Ua.set(o,d),Wa.set(o,u),o;function s(e){Xa(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 qa(`Invalid theme key: ${n}`,e.input)),{}):t[n],t);return typeof r!=`object`||!r||Array.isArray(r)?(i.push(new qa(`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=Qa(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=to(c);l===void 0?(i.push(new qa(`Template group expands past ${Za} 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=vo(e,t),i=d(e,{maxCandidates:Ia}).suggestions.filter(e=>fo(n,vo(e,t),e,0));if(n.length>Fa)return i;let a=Xo(r,{},e).candidates;if(i.length){let e=new Set(i);if(a.every(t=>e.has(t)))return i}if(uo(e,a.reduce((e,t)=>e+t.length,0))){let t=so(a,e),n=t.filter(t=>_o(t,e));return n.length?Go(n,[...i,...t]):Go(i,t)}return Go(i,new va(a,{fuzzy:`v1`,limit:Ia}).find(e).map(e=>e.item))}return u(e).suggestions}function u(e,t={}){let n={...Va,...t},i=oo(e);if(i.length>n.maxCandidateLength)return Ha();let a=ro(r);if(a){let t=io(r,0,a.index);if(!ko(t,e)&&!ko(oo(t),i))return Ha();let o=io(r,a.index+1,r.length);return Ao(a.part,t,o,e,a.suppressPartialRoots,n)}let o=ao(r);return o&&!ko(o,e)&&!ko(oo(o),oo(e))?Ha():bo(r,e,n)}function d(e,t={}){let n={...Ba,...t},i=u(e,n),a=ao(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 ro(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 io(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 ao(e){let t=e.findIndex(e=>e.type!==`static`);return io(e,0,t<0?e.length:t)}function oo(e){return e.replace(/-/g,``)}function so(e,t){return co(e,t)}function co(e,t,n={}){let r={...Ba,maxCandidates:Ia,...n};if(!t)return lo(e,r);let i=t!==t.toLowerCase(),a=vo(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=fo(a,vo(t,i),t,n);d&&po(o,d,r.maxCandidates,r.maxCharacters)}return o.items.sort(go).map(({candidate:e})=>e)}function lo(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 uo(e,t){return e.length*t>La}function fo(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 po(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,mo(e.items,e.items.length-1)):e.items.length&&go(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),ho(e.items,0)))}function mo(e,t){for(;t>0;){let n=t-1>>>1;if(go(e[t],e[n])<=0)return;[e[n],e[t]]=[e[t],e[n]],t=n}}function ho(e,t){for(;;){let n=t*2+1;if(n>=e.length)return;let r=n+1,i=n;if(r<e.length&&go(e[r],e[n])>0&&(i=r),go(e[i],e[t])<=0)return;[e[t],e[i]]=[e[i],e[t]],t=i}}function go(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 _o(e,t){let n=t!==t.toLowerCase();return vo(e,n)===vo(t,n)}function vo(e,t){let n=e.normalize(),r=yo(n)?n:Array.from(n,e=>za.get(e)??e).join(``);return t?r:r.toLowerCase()}function yo(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>127)return!1;return!0}function bo(e,t,n={}){let r={...Ba,...n};if(r.maxAttempts<=0||r.maxCandidates<=0||r.maxCharacters<=0)return Ha();let i=oo(t),a=xo(),o=xo(),s=r.maxCandidates,c=No(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&&So(a,e,m,s,r),c&&So(o,e,m,s,r))}_--;continue}if(g>=r.maxAttempts)break;let n=l[_];n||(n={choiceIndex:0,iterator:Ko(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:Oo(t,f[_],b,!1),C=p[_]<0?-1:Oo(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)=>Do(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 xo(){return{characters:0,entries:[],indices:new Map}}function So(e,t,n,r,i){let a=e.indices.get(t);if(a!==void 0){let t=e.entries[a];Do(n,t.path)<0&&(t.path=n.slice(),To(e,a));return}if(r<=0||t.length>i.maxCharacters)return;let o={candidate:t,path:n.slice()};if(e.entries.length>=r){if(Do(o.path,e.entries[0].path)>=0)return;Co(e)}for(;e.entries.length&&e.characters+t.length>i.maxCharacters;){if(Do(o.path,e.entries[0].path)>=0)return;Co(e)}e.characters+t.length>i.maxCharacters||(e.indices.set(t,e.entries.length),e.entries.push(o),e.characters+=t.length,wo(e,e.entries.length-1))}function Co(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),To(e,0))}function wo(e,t){for(;t>0;){let n=t-1>>>1;if(Do(e.entries[t].path,e.entries[n].path)<=0)return;Eo(e,n,t),t=n}}function To(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&&Do(e.entries[r].path,e.entries[n].path)>0&&(i=r),Do(e.entries[i].path,e.entries[t].path)<=0)return;Eo(e,i,t),t=i}}function Eo(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 Do(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 Oo(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 ko(e,t){return e.length<=t.length?t.startsWith(e):e.startsWith(t)}function Ao(e,t,n,r,i,a){let o={...Ba,...a};if(t.length+1>o.maxCandidateLength)return Ha();let s=No(o.maxScans),c=Io(e.objects,s),l=Lo(r,!1,o),u=Lo(oo(r),!0,o);jo(c,t,n,o.maxCandidateLength,i,l,u,s);let d=zo(l,s);if(d.suggestions.length||!d.exhausted)return d;let f=zo(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 jo(e,t,n,r,i,a,o,s){for(let c of e){let e=t+c.key,l=Bo(e,a.input,!1),u=Bo(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`?Uo(d,s):void 0,p=f!==void 0;if(Vo(a,l,c.hasLeaf,p,e,n,i),Vo(o,u,c.hasLeaf,p,e,n,i),a.blocked)return;for(f??=Uo(d,s);f;){if((l===`reached`||i&&l===`partial`)&&Ro(a,f.candidate,f.rawMatch),(u===`reached`||i&&u===`partial`)&&Ro(o,f.candidate,f.normalizedMatch),a.blocked)return;f=Uo(d,s)}if(s.truncated||a.blocked)return}}function Mo(e){return!!e&&e[0]!==`_`&&!Ya.includes(e)}function No(e=Ra){let t=Math.max(0,e);return{initial:t,remaining:t,truncated:!1}}function Po(e){return e.remaining<=0?(e.truncated=!0,!1):(e.remaining--,!0)}function*Fo(e){yield*Object.keys(e)}function Io(e,t){let n=new Map;outer:for(let r of e)for(let e of Fo(r)){if(!Po(t))break outer;if(!Mo(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 Ro(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 zo(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 Bo(e,t,n){let r=n?oo(e):e;return t.startsWith(r)?`reached`:r.startsWith(t)?`partial`:`none`}function Vo(e,t,n,r,i,a,o){if(t===`none`)return;if(t===`partial`&&r){(n||!o)&&Ro(e,i,!0);return}if(!n)return;let s=i+a;Ro(e,s,(e.normalize?oo(s):s).startsWith(e.input))}function Ho(e,t,n,r,i,a){return{base:t,fragments:[],frames:[],maxCandidateLength:a,normalizedInput:i,normalizedMatchedLength:Oo(i,0,t,!0),objectIndex:0,objects:e,rawInput:r,rawMatchedLength:Oo(r,0,t,!1),staticSuffix:n}}function Uo(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:Fo(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(!Po(t))return;let i=r.value;if(!Mo(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:Oo(e.rawInput,n.rawMatchedLength,s,!1),l=n.normalizedMatchedLength<0?-1:Oo(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:Fo(u),normalizedMatchedLength:l,object:u,rawMatchedLength:c,valueLength:o}),!(!u||Object.hasOwn(u,`DEFAULT`)&&u.DEFAULT!==null&&u.DEFAULT!==void 0))continue;let d=Wo(e.rawInput,c,e.staticSuffix,!1),f=Wo(e.normalizedInput,l,e.staticSuffix,!0);if(d||f)return{candidate:`${e.base}-${e.fragments.join(`-`)}${e.staticSuffix}`,normalizedMatch:f,rawMatch:d}}}function Wo(e,t,n,r){return t<0?!1:Oo(e,t,n,r)>=e.length}function Go(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>Fa)){if(i+a.length>Na)return;r.add(a),n.push(a),i+=a.length}}};return a(e,t.length?750:Ia),a(t,Ia),a(e,Ia),n}function*Ko(e,t,n){e.type===`theme`?yield*Jo(e.objects,t,n):yield*qo(e,t,n)}function*qo(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(!Po(n))return;r.length<=t&&(yield r)}}function*Jo(e,t,n){let r=[];for(let i of e){r.length=0;let e=[{depth:0,iterator:Fo(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(!Po(n))return;let o=a.value;if(!Mo(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:Fo(l),object:l,valueLength:c}),(!l||Object.hasOwn(l,`DEFAULT`)&&l.DEFAULT!==null&&l.DEFAULT!==void 0)&&(yield r.join(`-`))}}}function Yo(e,t){let n=No(t.maxScans),r=e.map(e=>({done:!1,iterator:Ko(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 Xo(e,t={},n=``){let r={...Ba,...t},i=Yo(e,r),a=i.values,o=i.scans,s,c=()=>{if(s===void 0){let t=Zo(a,n,r);s=t?{combination:t,scans:0}:Qo(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=es(r),n={remaining:r.maxAttempts};return ts(t,n,0)&&ss(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=es(r),n={remaining:r.maxAttempts};return ts(t,n,0)&&ss(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=es(r);return os(e,a,u,p),{candidates:[...e.candidates],truncated:!1,attempts:r.maxAttempts-p.remaining,scans:o}}let m=es(r),h=a.map(e=>e[0]),g=a.flatMap((e,t)=>e.length>1?[t]:[]),_=c().combination;_&&ts(m,p,0)&&ss(m,_),ts(m,p,0)&&ss(m,h);let v=Math.min(Pa,Math.max(0,p.remaining));return e.length&&v>La/e.length?{candidates:[...m.candidates],truncated:!0,attempts:r.maxAttempts-p.remaining,scans:o}:(ns(m,a,h,g,p),is(m,a,h,g,p),rs(m,a,h,g,p),as(m,a,h,g,p),os(m,a,r.maxAttempts,p,!0),{candidates:[...m.candidates],truncated:!0,attempts:r.maxAttempts-p.remaining,scans:o})}function Zo(e,t,n){if(!t||e.some(e=>!e.length))return;let r=t!==t.toLowerCase(),i=vo(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=$o(i,l,vo(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(fo(i,vo(u,r),u,0))return s}function Qo(e,t,n,r){let i=No(r),a=e=>({combination:e,scans:i.initial-i.remaining});if(!t)return a();let o=t!==t.toLowerCase(),s=vo(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 Ko(t,c,i)){if(n.has(r))continue;n.add(r);let t={normalized:vo(r,o),raw:r};for(let n of l){if(d++,u+=t.normalized.length,d>Pa||u>La)return a();let r=n.characters+t.raw.length;if(r>c)continue;let i=$o(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 fo(s,vo(h,o),h,0)?a(p):a()}function $o(e,t,n){for(let r=0;r<n.length&&t<e.length;r++)n[r]===e[t]&&t++;return t}function es(e){return{candidates:new Set,characters:0,maxCandidateLength:e.maxCandidateLength,maxCandidates:e.maxCandidates,maxCharacters:e.maxCharacters}}function ts(e,t,n){return n>=Pa||t.remaining<=0||e.candidates.size>=e.maxCandidates||e.characters>=e.maxCharacters?!1:(t.remaining--,!0)}function ns(e,t,n,r,i){let a=0;for(let o of r){if(!ts(e,i,a))return;a++;let r=n.slice();r[o]=t[o].at(-1),ss(e,r)}}function rs(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(!ts(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),ss(e,u)}}function is(e,t,n,r,i){let a=0;for(let o of r)for(let r=1;r<t[o].length-1;r++){if(!ts(e,i,a))return;a++;let s=n.slice();s[o]=t[o][r],ss(e,s)}}function as(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(!ts(e,i,a))return;a++;let s=n.slice();s[c]=t[c][r],s[l]=t[l][o],ss(e,s)}}}function os(e,t,n,r,i=!1){if(!t.length){ts(e,r,0)&&ss(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,Pa);for(let n=0;n<c;n++){if(!ts(e,r,n))return;if(ss(e,t.map((e,t)=>e[a[t]])),!s())break}}function ss(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 cs(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=_s(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 ls=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(` `)),us=new Set(`=([{,:;!?&|>~`);function ds(e){return e>=65&&e<=90||e>=97&&e<=122}function fs(e){return ds(e)||e===95}function ps(e){return fs(e)||e>=48&&e<=57||e===36||e===45||e===46||e===58}function ms(e,t,n){let r=t-n.length;return r<0||e.slice(r,t)!==n?!1:r===0||!ps(e.charCodeAt(r-1))}function hs(e,t,n,r){if(ls.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||us.has(e.charAt(i))?!0:ms(e,i+1,`return`)}function gs(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(!fs(e.charCodeAt(a)))continue;let s=a;for(;a<e.length&&ps(e.charCodeAt(a));)a++;if(a<e.length&&!/[\s/>]/.test(e.charAt(a)))continue;let c=e.slice(s,a);hs(e,o,c,n)&&(t={name:c,start:o},i=0)}return t}function _s(e,t){let n=e.substring(0,t),r=gs(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 vs(e,t){return _s(e,t)?.key}function ys(e,t){return _s(e,t)}const X=1e3,bs=6e5,xs=5e7,Ss=6e4,Cs=3e5,ws=5e4,Ts=2e5,Es=5e3,Z={...Ba,maxAttempts:15e3,maxCandidates:15e3,maxCharacters:6e5,maxScans:3e5};function Ds(){return{active:0,waiters:[]}}function Os(e){return e>=48&&e<=57}function ks(e){for(let t=0;t<e.length;t++)if(Os(e.charCodeAt(t)))return!0;return!1}function As(e,t){let n=0,r=0;for(;n<e.length&&r<t.length;){let i=e.charCodeAt(n),a=t.charCodeAt(r),o=Os(i),s=Os(a);if(o&&s){let i=n+1,a=r+1;for(;i<e.length&&Os(e.charCodeAt(i));)i++;for(;a<t.length&&Os(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 js(e,t){let n=ks(e);return n===ks(t)?As(e,t)||(e===t?0:e<t?-1:1):n?1:-1}function Ms(e,t=Cs,n=xs){return{attempts:0,heap:[],limit:e,maxAttempts:t,maxScannedCharacters:n,retained:new Set,scannedCharacters:0}}function Ns(e){return e.attempts<e.maxAttempts&&e.scannedCharacters<e.maxScannedCharacters}function Ps(e,t){return Ns(e)?(e.attempts++,!t||e.retained.has(t)||t.length>Ss||t.length>e.maxScannedCharacters-e.scannedCharacters?!0:(e.scannedCharacters+=t.length,Fs(e,t),!0)):!1}function Fs(e,t){if(!(!t||e.retained.has(t)||t.length>Ss)){if(e.heap.length<e.limit){e.heap.push(t),e.retained.add(t),Is(e.heap,e.heap.length-1);return}js(t,e.heap[0])>=0||(e.retained.delete(e.heap[0]),e.heap[0]=t,e.retained.add(t),Ls(e.heap,0))}}function Is(e,t){let n=t;for(;n>0;){let t=Math.floor((n-1)/2);if(js(e[t],e[n])>=0)return;[e[t],e[n]]=[e[n],e[t]],n=t}}function Ls(e,t){let n=t;for(;;){let t=n*2+1;if(t>=e.length)return;let r=t+1,i=r<e.length&&js(e[r],e[t])>0?r:t;if(js(e[n],e[i])>=0)return;[e[n],e[i]]=[e[i],e[n]],n=i}}function Rs(e){let t=[],n=0;for(let r of e.heap.sort(js))n+r.length>bs||(t.push(r),n+=r.length);return t}function zs(e,t,n,r){return Math.floor((t+n)*e/r)-Math.floor(t*e/r)}function*Bs(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*Vs(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 Us(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 Ws(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 Gs(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 Ks(e,t=X){let n=Ms(t);for(let t of e)if(!Ps(n,t))break;return Rs(n)}function qs(e,t){let n=[],r=new Set,i=0,a=0;for(let o of e)if(o.startsWith(t)){if(i===Cs||n.length===X||a>=bs)break;i++,!(!o||r.has(o)||o.length>Ss||a+o.length>bs)&&(r.add(o),n.push(o),a+=o.length)}return n}function Js(e,t={}){let n=new Map,r=new Aa({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,_=Ds(),{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(co(f,t,{maxCandidates:Z.maxCandidates,maxCharacters:Z.maxCharacters}),t):Ks(f),!V(i,s))return r.set(t,f),f}}async function w(e,t){B();let n=a,r=o,i=vs(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=cs(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=co(L(),e,{maxAttempts:Cs,maxCandidates:750,maxCharacters:6e4});return co([...n,...r],e,{maxCandidates:X,maxCharacters:Z.maxCharacters})}return c??=[...s].sort(js),qs(c,e)}async function O(t){return Ks(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=Ms(X),a=Ms(X);for(let o=0;o<e.length;o+=8){let s=await Gs(e.slice(o,o+8),8,e=>M(e,t,n,r));if(V(n,r))return[];let c=zs(Cs,o,s.length,e.length),l=zs(xs,o,s.length,e.length),u=Ms(X,c,l),d=Bs(s.filter(e=>!!e?.length));for(;Ns(u);){let e=d.next();if(e.done)break;Ps(u,e.value)}for(let e of Rs(u))Fs(i,e);let f=Ms(X,c,l);for(;Ns(f);){let e=d.next();if(e.done)break;Ps(f,e.value)}for(let e of Rs(f))Fs(i,e);for(;Ns(a);){let e=d.next();if(e.done)break;Ps(a,e.value)}}for(let e of Rs(a))Fs(i,e);return Rs(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 Gs(e.slice(s,s+32),32,e=>M(e,t,n,r));if(V(n,r))return[];let l=Bs(c.filter(e=>!!e?.length)),u=zs(Cs,s,c.length,e.length),d=zs(Ba.maxScannedCharacters,s,c.length,e.length),f=co(l,t,{maxAttempts:u,maxCandidates:X,maxCharacters:Z.maxCharacters,maxScannedCharacters:d});i=co([...i,...f],t,{maxAttempts:i.length+f.length,maxCandidates:X,maxCharacters:Z.maxCharacters});let p=co(Vs(l,a,{attempts:0,characters:0},u,d,Ba.maxCandidateLength),t,{maxAttempts:u,maxCandidates:750,maxCharacters:Z.maxCharacters,maxScannedCharacters:d});i=co([...i,...p],t,{maxAttempts:i.length+p.length,maxCandidates:X,maxCharacters:Z.maxCharacters});let m=co(Vs(l,a,{attempts:0,characters:0},u,d,Ba.maxCandidateLength),t,{maxAttempts:u,maxCandidates:750,maxCharacters:Z.maxCharacters,maxScannedCharacters:d});i=co([...i,...m],t,{maxAttempts:i.length+m.length,maxCandidates:X,maxCharacters:Z.maxCharacters});let h=co(Vs(l,a,o,Cs,Ba.maxScannedCharacters,Ba.maxCandidateLength),t,{maxAttempts:Cs-o.attempts,maxCandidates:750,maxCharacters:Z.maxCharacters,maxScannedCharacters:Ba.maxScannedCharacters-o.characters});i=co([...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 uo(t,r??e.reduce((e,t)=>e+t.length,0))?co(e,t,{maxCandidates:X,maxCharacters:Z.maxCharacters}):(n??new va(e,{fuzzy:`v1`,limit:X,tiebreakers:[_a,ga]})).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 va(u,{fuzzy:`v1`,limit:X,tiebreakers:[_a,ga]}),l}function*L(){for(let e of s)f.has(e)||(yield e)}function R(e){let t=Ms(X),r=0,i=0,a=0,o=Us([...n.values()],e).templates.slice(0,ws);for(let n=0;n<o.length;n++){let s=Cs-r,c=xs-i,l=Ts-a;if(c<=0||s<=0||l<=0||!Ns(t))break;let u=o.length-n,d=Math.max(1,Math.floor(s/u)),f=Ka(o[n],e,{maxAttempts:d,maxCandidateLength:Ss,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(!Ps(t,e))break}return Rs(t)}function z(e){let t=[],r=new Set,i=0,a=0,o=0,s=0,c=Us([...n.values()],e).templates.slice(0,ws),l=e=>{!e||r.has(e)||e.length>Ba.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 co(f(),e,{maxAttempts:ws,maxCandidates:750,maxCharacters:Z.maxCharacters}))l(t);let d=Ws(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=Ka(d[t],e,p);m=n.suggestions,a+=n.attempts,s+=n.scans}else{let n=Xo(d[t].parts,p,e);m=n.candidates,a+=n.attempts,s+=n.scans}for(let e of m)l(e)}return co(t,e,{maxAttempts:Z.maxAttempts,maxCandidates:750,maxCharacters:Z.maxCharacters});function*f(){for(let t=0;t<c.length;t++){let n=Ts-u;if(n<=0)return;let r=c.length-t,i=(e.length<=1?Ka:Ga)(c[t],e,{maxAttempts:1,maxCandidates:1,maxCharacters:Ba.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=>fe(e?.[2]?.autocomplete||[])),...t.shortcuts.flatMap(e=>fe(e?.[2]?.autocomplete||[])),...t.variants.flatMap(e=>fe(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=no(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(`
27
- `);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(),_=Ds(),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=pe(t.flat()).filter(t=>!(!t||t.endsWith(`-`)||e.isBlocked(t)||e.isBlocked(n+t+r)));v!==`fuzzy`&&i.sort(js);let a=i.map(e=>n+e+r);return v===`fuzzy`?a:Ks(a)}}function Ys(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 Xs=/<style[^>]*>[\s\S]*?(?:<\/style>|<\/>|$)/g,Zs=/(?:<\/style>|<\/>)$/,Qs=/<template\b[^>]*\slang\s*=\s*(?:'pug'|"pug")[^>]*>/i;function $s(e,t,n){let r=t.match(/\.(svelte|vue|astro|marko)$/);if(r&&ec(e,t)){let t=e.slice(0,n);if(/\.$/.test(t)||/\.\S+$/.test(t))return!0}if((r?[...e.matchAll(Xs)].some(t=>{let r=t.index,i=r+t[0].length,a=i===e.length&&!Zs.test(t[0]);return n>r&&(n<i||a&&n===i)}):/\.(?:css|scss|sass|less|styl(?:us)?|pcss|postcss)$/i.test(t))||vs(e,n)!==void 0)return!0;let i=e.slice(n).replace(/"[^"]*"|\{[^}]*\}|'[^']*'/g,``);return/^[^<>]*>/.test(i)}function ec(e,t){return t.endsWith(`.vue`)&&Qs.test(e)}function tc(e,t){let n=d.relative(e,t);return n!==``&&n!==`..`&&!n.startsWith(`..${d.sep}`)&&!d.isAbsolute(n)}const nc={log(){},warn(){}},rc=/[\\/](?:node_modules|dist|\.temp|\.cache)[\\/]/;var ic=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=ir();constructor(e,t=nc,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=>tc(t,e))}get contexts(){return Array.from(new Set(this.contextsMap.values())).filter(cr)}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||tc(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(`
28
- `)}`;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(rc.test(t))return;if(this.fileContextCache.has(t)){let e=this.fileContextCache.get(t);return xi(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&&tc(n,t)&&(i.filter(e,t)||yn(t)))return xi(this.fileContextCache,t,i,100),i;for(let[e,n]of r)if(n&&tc(e,t))return xi(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&&xi(this.fileContextCache,e,i,100),i}async findConfigDirectory(e,t){let n=this.configExistsCache.get(e);if(n!==void 0)return xi(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&&(tc(r,o)||o===r);){a.push(o);let e=this.configExistsCache.get(o);if(e!==void 0)return xi(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||tc(t,e)).sort((e,t)=>t.length-e.length)[0]}async hasConfigFiles(e){return!!g(e)}cacheSearchPath(e,t){for(let n of e)xi(this.configExistsCache,n,t,100)}};const ac=/^[A-Za-z]:\//;function oc(e=``){return e&&e.replace(/\\/g,`/`).replace(ac,e=>e.toUpperCase())}const sc=/^[/\\]{2}/,cc=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,lc=/^[A-Za-z]:$/,uc=function(e){if(e.length===0)return`.`;e=oc(e);let t=e.match(sc),n=hc(e),r=e[e.length-1]===`/`;return e=mc(e,!n),e.length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),lc.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!hc(e)?`/${e}`:e)},dc=function(...e){let t=``;for(let n of e)if(n){if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;t+=e&&r?n.slice(1):e||r?n:`/${n}`}else t+=n}return uc(t)};function fc(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const pc=function(...e){e=e.map(e=>oc(e));let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:fc();i&&i.length!==0&&(t=`${i}/${t}`,n=hc(i))}return t=mc(t,!n),n&&!hc(t)?`/${t}`:t.length>0?t:`.`};function mc(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}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 hc=function(e){return cc.test(e)};var gc=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:65536,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}}})),_c=K((e=>{let{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=gc();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}})),vc=K(((e,t)=>{let n=_c(),{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:_}=gc(),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}})),yc=K(((e,t)=>{let n=gc(),r=_c(),{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&&(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})),bc=K(((e,t)=>{let n=vc(),r=yc(),i=_c(),a=gc(),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})),xc=se(K(((e,t)=>{let n=bc(),r=_c();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 Sc(e){return e.replaceAll(`\\`,`/`)}const Cc=Array.isArray;function wc(e){return Cc(e)?e:e==null?[]:[e]}const Tc=`[_#EsCaPe#_]`;function Ec(e,t){return t===!1||hc(e)||e.startsWith(`**`)?Sc(e):dc(Sc(pc(t||``)).replaceAll(/[-^$*+?.()|[\]{}]/g,`${Tc}$&`),Sc(e)).replaceAll(Tc,`\\`)}function Dc(e,t,n){let r=n&&n.resolve,i=e=>e instanceof RegExp?e:{test:t=>(0,xc.default)(Ec(e,r),{dot:!0})(t)},a=wc(e).map(i),o=wc(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=Sc(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 Oc={root:void 0,colorPreview:!1,remToPxPreview:!0,remToPxRatio:16,syntaxHighlight:!0,strictAnnotationMatch:!1,unmatchedDiagnostics:!0,autocompleteMatchType:`prefix`,autocompleteStrict:!1,autocompleteMaxItems:1e3},kc=/^#(?:[0-9a-f]{3,8})$/i,Ac=/^(?:rgb|rgba|hsl|hsla|hwb|oklch|oklab|lab|lch|device-cmyk|color)\(/i,jc=/^(?:media|supports|container)\b/;function Mc(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`||kc.test(n)||Ac.test(n))return!0;let r=n.split(`/`)[0].split(`-`)[0];return t.has(r)},isBreakpoint(e){if(jc.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 Nc=/var\((?<cssVarName>--[^,|)]+)(?:,(?<fallback>[^)]+))?\)/g,Pc=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)\([^)]*\)`,Fc=new RegExp(Pc,`g`),Ic=/var\((--[^,|)]+)(?:,([^)]+))?\)/,Lc=String.raw`(?:^|[;{]\s*)(?:[\w-]+-color|color|fill|stroke)\s*:\s*(?<value>[^;}{]+)`,Rc=new RegExp(Lc,`gm`),zc=/(?:^|[;{])\s*--[^\s:;{}]+\s*:/m,Bc=new RegExp(Pc,`i`),Vc=new RegExp(Lc,`m`),Hc=new RegExp(String.raw`color-mix\([^,]+,\s*(?<color>${Pc})\s+(?<weight>\d+(?:\.\d+)?%)\s*,\s*transparent\s*\)`,`i`);function Uc(e){return zc.test(e)||Vc.test(e)||Wc(e)}function Wc(e){return Bc.test(e)}function Gc(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 Kc(e,t){let n=e.trim(),r=new Set;for(;n.startsWith(`var(`);){let e=n.match(Ic);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 qc(e,t){let n=e;for(let r of e.matchAll(Nc)){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,Kc(o,t)??a??`1`):a&&(n=n.replaceAll(e,a))}return n.replaceAll(/,?\s+var\(--.*?\)/g,``)}function Jc(e,t){let n=qc(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(Fc)?.[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 Yc(e){let t=Gc(e);for(let n of e.matchAll(Rc)){let e=n.groups?.value;if(!e)continue;let r=Jc(e,t);if(r)return r}return Jc(e,t)}function Xc(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 Zc=/(-?[\d.]+)rem(\s+!important)?;/;let Qc;function $c(e){return e.default??e}function el(){return Qc??=Promise.all([import(`prettier/standalone`),import(`prettier/parser-postcss`)]).then(([e,t])=>({prettier:$c(e),parserCSS:$c(t)}))}function tl(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(Zc);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 nl(e,t,n){let[r,{prettier:i,parserCSS:a}]=await Promise.all([e.generate(new Set(fe(t)),{preflights:!1,safelist:!1}),el()]),o=tl(r.css,n),s=await i.format(o,{parser:`css`,plugins:[a]});return{...r,prettified:s}}async function rl(e,t,n){return`\`\`\`css\n${(await nl(e,t,n)).prettified.trimEnd()}\n\`\`\``}const il=[`property`,`class`,`keyword`,`number`,`enumMember`,`string`,`operator`,`type`],al=[`important`,`pseudoClass`,`pseudoElement`,`query`,`selector`,`variable`,`combinator`,`bracket`,`group`,`condition`],ol=/^-?(?:\d+\.?\d*|\.\d+)[a-z%]*$/i,sl=/^[>+~_[&.#*: ]/,cl=/^[>+~_.#]/;function ll(e,t){return t?.isColorValue?.(e)?`enumMember`:e.startsWith(`[`)?`string`:ol.test(e)?`number`:`keyword`}function ul(e,t){return e.startsWith(`::`)?{type:`type`,modifier:`pseudoElement`,symbolLen:0}:cl.test(e)?{type:`type`,modifier:`selector`,symbolLen:1}:sl.test(e)?{type:`type`,modifier:`selector`,symbolLen:0}:t?.isBreakpoint?.(e)?{type:`keyword`,modifier:`query`,symbolLen:0}:{type:`keyword`,modifier:`pseudoClass`,symbolLen:0}}function dl(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}=ul(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 fl(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 pl(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(`[`)){fl(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:ll(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(`[`)?fl(e,s,r):e.push({start:r,length:s.length,type:ll(s,i),modifiers:[]})}return}let s=r===`property`?`property`:ll(o,i);e.push({start:n+a,length:o.length,type:s,modifiers:[]})}function ml(e,t,n){if(!e)return[];if(e.startsWith(`{`)&&e.includes(`}`))return gl(e,t,n);let r=Ee(e),i=[];if(r.keyword)r.body.length&&(r.body.startsWith(`[`)?fl(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&&pl(i,e,t,`property`,n),i.push({start:t+e.length,length:1,type:`operator`,modifiers:[]}),a.length&&pl(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=dl(i,e,a,n);return i}function hl(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 gl(e,t,n){let r=[],i=hl(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=hl(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 ml(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=dl(r,e,l,n);return r}const _l=new Map,vl=new WeakMap;function yl(e,t){return e<t?-1:+(e>t)}function bl(e,t){return yl(e??``,t??``)}function xl(e,t){return e[0]-t[0]||(e[4]?.sort??0)-(t[4]?.sort??0)||bl(e[5]?.currentSelector,t[5]?.currentSelector)||bl(e[1],t[1])||yl(e[2],t[2])}function Sl(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 Cl(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 wl(e){let t=_l.get(e);if(t!==void 0)return t;let n=Uc(e);return xi(_l,e,n,2048),n}function Tl(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(xl).map(([,e,t,,n,,r])=>{let i=e&&!n?.noScope?Sl(e):e;return[i==null?[]:[[i,n?.sort??0]],t,!!(r??n?.noMerge)]});t&&Tl(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]||yl(e[0],t[0])),a=[...new Set(t.map(([e])=>e).filter(Boolean))].join(`,
29
- `)),i.push(a?`${a}{${n}}`:n)}let a=[...new Set(i)].reverse();return(n?a:a.filter(wl)).join(`
30
- `)}function Dl(e,t,n){let r=new Map,i=new Set([De]);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)||yl(e,t))),s=[];for(let n of o){let i=r.get(n);if(i)for(let n of[...i.keys()].sort((e,n)=>Ur(t,e,n))){let t=El(i.get(n),e.mergeSelectors,wl(n));if(t){if(!n)s.push(t);else{let e=Cl(n);s.push(`${e.join(`{`)}{${t}${`}`.repeat(e.length)}`)}}}}return s.join(`
31
- `)}async function Ol(e,t){let n=e.config,r=await e.parseToken(t);if(e.config!==n)return Ol(e,t);if(r?.length)return Yc(Dl(n,new Map(e.parentOrders),r))}async function kl(e,t){let n=vl.get(e);return(!n||n.config!==e.config)&&(n={config:e.config,values:new Map},vl.set(e,n)),Si(n.values,t,1e3,()=>Ol(e,t).then(e=>e?{colorString:e,color:Xc(e)}:{}))}const Al=[...al,`teacss`],jl={tokenTypes:[...il],tokenModifiers:Al},Ml=new Map(il.map((e,t)=>[e,t])),Nl=new Map(Al.map((e,t)=>[e,1<<t])),Pl=Nl.get(`teacss`)??0,Fl=/^-?(?:\d+\.?\d*|\.\d+)[a-z%]*$/i,Il=new WeakMap,Ll={log(){},warn(){}};function Rl(e,t){let n=vs(e,t)?.toLowerCase();return n?.endsWith(`class`)||n?.endsWith(`classname`)}function zl(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 Bl(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 Vl(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(`]`)||Xc(e.slice(1,-1).replace(/\\?_/g,e=>e===`_`?` `:`_`).trim())!==void 0}function Ul(e){let t=Il.get(e);if(t?.config===e.config)return t.classifier;let n=Mc(e.config?.theme??{});return Il.set(e,{config:e.config,classifier:n}),n}function Wl(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 Gl(e,t,n,r,i=Pl){let a=e.positionAt(t);return{line:a.line,char:a.character,length:n,type:Ml.get(r)??0,modifiers:i}}function Kl(e,t,n,r,i=Pl){let a=[],o=0;for(let s=0;s<n.length;s++)(n[s]===`\r`||n[s]===`
32
- `)&&(s>o&&a.push(Gl(e,t+o,s-o,r,i)),n[s]===`\r`&&n[s+1]===`
33
- `&&s++,o=s+1);return o<n.length&&a.push(Gl(e,t+o,n.length-o,r,i)),a}function ql(e,t){return t.isColorValue?.(e)?`enumMember`:Fl.test(e)?`number`:`string`}function Jl(e,t,n){return e.some(e=>e.open===t&&e.close===n-1)}function Yl(e,t,n){let r=[];for(let i of n){r.push(Gl(e,i.open,1,`operator`,Pl|(Nl.get(`group`)??0)));for(let n of i.declarations){let{property:i,start:a,colon:o,value:s,valueStart:c}=n;r.push(Gl(e,a,2,`operator`,Pl|(Nl.get(`variable`)??0))),r.push(Gl(e,a+2,i.length-2,`property`)),r.push(Gl(e,o,1,`operator`)),s&&r.push(...Kl(e,c,s,ql(s,t)))}r.push(Gl(e,i.close,1,`operator`,Pl|(Nl.get(`group`)??0)))}return r}var Xl=class{contextManager;getSettings;logger;autoCompletes=new Map;semanticTokensCache=new Map;featureFailures=new Map;constructor(e){this.getSettings=e.getSettings??(()=>Oc),this.logger=e.logger??Ll;let t=e.folderPaths?.length?e.folderPaths:[e.rootPath];this.contextManager=new ic(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&&(xi(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=Js(e.generator,{matchType:t,throwErrors:!1});return this.autoCompletes.set(e,{matchType:t,autocomplete:r}),r}async resolveTargetContext(e){let t=Ys(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)||yn(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 xi(this.semanticTokensCache,o,u,100),this.clearFeatureFailure(n,e.uri),u.result;let d=await Ei(a.generator,s,o,l),f=Ul(a.generator),p=[],m=new Map,h=yn(o)?v(s):[];for(let[e,t]of d){if(Jl(h,e,t))continue;let n=s.slice(e,t),r=m.get(n);r||(r=ml(n,0,f),m.set(n,r));for(let t of r){let n=e+t.start,r=c.positionAt(n),i=Pl;for(let e of t.modifiers)i|=Nl.get(e)??0;p.push({line:r.line,char:r.character,length:t.length,type:Ml.get(t.type)??0,modifiers:i})}}h.length&&p.push(...Yl(c,f,h));let g=Wl(p);return xi(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(yn(r)){let e=n.generator.config?.theme??{},t=_(e);o=m(i,t,e).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 nr.extract?.({code:i,id:r,generator:n.generator})??[],t=vi(i,Array.from(new Set(e)).filter(e=>typeof e==`string`&&e.length>0),[],{excludeRanges:Qr(i,r)}).filter(([e,t])=>Rl(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])=>{if(s.matched.has(e))return!1;if(!e.includes(`{`))return!0;let t=Lr(hn(e));return t.length===1&&t[0]===e||!t.every(e=>s.matched.has(e))&&t.some(e=>!s.matched.has(e)&&wr(e))}),l=new Map;for(let[,,e]of c){let t=Cr(e),r=e.slice(t.length),i=Fr(e,n.generator.config,{confirmedIntent:!0})?.map(e=>`${e}${r}`)??[];l.set(e,Array.from(new Set([...zl(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.flatMap(([e,t,n])=>{let r=(l.get(n)??[]).filter(e=>d.has(e)).slice(0,3);return!r.length&&!wr(n)&&Cr(n)===n&&!n.includes(`{`)?[]:[{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=>yn(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`)||yn(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 nr.extract?.({code:i,id:r,generator:n.generator})??[],s=vi(i,Array.from(new Set(o)).filter(e=>typeof e==`string`&&e.length>0),[],{excludeRanges:Qr(i,r)}),c=new Map;for(let[e,t]of s){let n=ys(i,Math.max(e+1,t-1)),r=n?.key.toLowerCase();n&&(r?.endsWith(`class`)||r?.endsWith(`classname`))&&c.set(n.valueStart,Bl(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(yn(Ys(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 rl(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 kl(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=Zl(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 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=Ys(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=>yn(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=Dc(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 Vl(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=Ys(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&&!$s(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 Vl(u,32,async([e])=>{try{return(await kl(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=Ys(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 nl(a.generator,e.data.value,o)).prettified:e.documentation={kind:`markdown`,value:await rl(a.generator,e.data.value,o)},e}async getSuggestionResult({ctx:e,code:t,id:n,offset:r,matchType:i}){let a=ec(t,n);if(!e.filter(t,n)&&!yn(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 Zl(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 Ql(e,t){let n=eu(t.workspaceFolderPaths||[]),r=n.length?n:eu([t.workspaceRootPath]),i=fe(e).filter(e=>typeof e==`string`&&e.length>0);if(!i.length)return r;let a=eu([t.workspaceFileDir,...n,t.workspaceRootPath]);return eu(i.flatMap(e=>$l(e,a)))}function $l(e,t){if(!e)return[];if(tu(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 eu(e){return Array.from(new Set(e.filter(Boolean).map(e=>d.normalize(e))))}function tu(e){return d.isAbsolute(e)||d.win32.isAbsolute(e)}function nu(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 ru=/[\\/](?:node_modules|dist|\.temp|\.cache|\.git)[\\/]/,iu=new Set([`node_modules`,`dist`,`.temp`,`.cache`,`.git`]),au=`**/{${Array.from(new Set(h.map(e=>d.posix.basename(e)))).join(`,`)}}`;function ou(e,t){let n=d.relative(e,t);return n===``||!n.startsWith(`..${d.sep}`)&&n!==`..`&&!d.isAbsolute(n)}function su(e){return[...e].map(e=>e===`*`?`[*]`:e===`?`?`[?]`:e===`[`?`[[]`:e===`]`?`[]]`:e===`{`?`[{]`:e===`}`?`[}]`:e).join(``)}function cu(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 lu(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=cu(e);n&&t.push({directory:e,entry:n})}for(let t of r)t.isDirectory()&&!iu.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 uu(e,t){return t.map(e=>d.normalize(e)).filter(t=>ou(t,e)).sort((e,t)=>t.length-e.length)[0]}function du(e,t){let n=d.dirname(e);for(;ou(t,n);){if(d.normalize(g(n)??``)===e)return!0;if(n===t)break;n=d.dirname(n)}return!1}function fu(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 pu(e,t,n){let r=new Map,i=(e,t,i=!0)=>{let a=i?su(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,au,!1);for(let{directory:t,entry:n}of lu(e)){let e=d.relative(t,n);ou(t,n)?i(t,e.split(d.sep).join(`/`)):i(d.dirname(n),d.basename(n))}}return Array.from(r.values())}function mu(e,t,n){let r=new Set(t.map(e=>d.normalize(e))),i=new Set(n.map(cu).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(ru.test(e))continue;let o=uu(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(du(e,o))return!0}catch{return!0}}if(a.size){for(let e of n)for(let{entry:t}of lu(e))if(a.has(d.normalize(t)))return!0}return!1}function hu(e){let t,n,r,i,a=0,o=Promise.resolve();return{update(s){let c=fu(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 gu(e){return e instanceof Error?e.message:String(e)}function _u(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=gu(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 vu(e,t){e.on(`uncaughtExceptionMonitor`,(e,n)=>{t(`[teacss] ${n===`unhandledRejection`?`Unhandled rejection`:`Uncaught exception`}: ${e.message}`)})}function yu(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function bu(e,t){return typeof e==`boolean`?e:t}function xu(e,t){if(e!==null)return typeof e==`string`?e:Array.isArray(e)?e.filter(e=>typeof e==`string`):t}function Su(e,t){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:t}function Cu(e,t){return typeof e!=`number`||!Number.isFinite(e)?t:Math.min(1e4,Math.max(0,Math.floor(e)))}function wu(e){let t=yu(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 Tu(e,t){let n=yu(t),r=yu(n.autocomplete),i=r.matchType;return{root:xu(n.root,e.root),colorPreview:bu(n.colorPreview,e.colorPreview),remToPxPreview:bu(n.remToPxPreview,e.remToPxPreview),remToPxRatio:Su(n.remToPxRatio,e.remToPxRatio),syntaxHighlight:bu(n.syntaxHighlight,e.syntaxHighlight),strictAnnotationMatch:bu(n.strictAnnotationMatch,e.strictAnnotationMatch),unmatchedDiagnostics:bu(n.unmatchedDiagnostics,e.unmatchedDiagnostics),autocompleteMatchType:i===`prefix`||i===`fuzzy`?i:e.autocompleteMatchType,autocompleteStrict:bu(r.strict,e.autocompleteStrict),autocompleteMaxItems:Cu(r.maxItems,e.autocompleteMaxItems)}}function Eu(e){return Tu(Oc,e)}function Du(e,t){return e.syntaxHighlight!==t.syntaxHighlight||e.strictAnnotationMatch!==t.strictAnnotationMatch}function Ou(e,t){let n=new Set(e),r=new Set(t);return n.size!==r.size||[...n].some(e=>!r.has(e))}async function ku(e,t,n){if(e)try{return await t()}catch(e){n(e);return}}const Q=te(B.all),Au=new H(O);let ju=Eu(),$,Mu=!1,Nu=!1,Pu=!1,Fu=!1,Iu=!1,Lu=!1,Ru=0,zu;const Bu=new Promise(e=>{zu=e}),Vu=U.Create|U.Change|U.Delete,Hu=[{globPattern:`**/*.css`,kind:Vu}],Uu={folderPaths:[]};function Wu(e){ju=Tu(ju,e)}function Gu(e){return Ql(e,{workspaceRootPath:Uu.rootPath,workspaceFileDir:Uu.fileDir,workspaceFolderPaths:Uu.folderPaths})}function Ku(e){return typeof e==`string`?e.length>0:Array.isArray(e)&&e.some(Boolean)}async function qu(){$&&await Ju(()=>$.contextManager.setRoots(Gu(ju.root)))}async function Ju(e){Ru++;try{return await e()}finally{Ru--}}function Yu(e,t,n){Uu.rootPath=e?Ys(e):void 0,Uu.fileDir=n?.workspaceFileDir,Uu.folderPaths=n?.workspaceFolderPaths||t?.map(e=>Ys(e.uri))||[]}function Xu(e=Uu.rootPath){if(!e)return;let t=new Xl({rootPath:e,folderPaths:Gu(ju.root),logger:{log:e=>Q.console.log(e),warn:e=>Q.console.warn(e)},getSettings:od});$=t;let n=()=>{Ru||(nd().catch(e=>rd(`Failed to update config watchers`,e)),id(),_d())};return t.events.on(`reload`,()=>{Ru||nd().catch(e=>rd(`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 Zu(e){!$&&e[0]&&await Xu(e[0])?.ready}function Qu(){return $?.contextManager.configSources??[]}function $u(){return Array.from(new Set([...Gu(ju.root),...$?.contextManager.contextsMap.keys()??[]]))}function ed(){let e=Qu(),t=pu(e,$u(),Vu);return e.length?t:[...Hu,...t]}const td=hu(async e=>Q.client.register(ee.type,{watchers:[...e]}));async function nd(){Mu&&Lu&&$&&await td.update(ed())}function rd(e,t){Q.console.error(`[teacss] ${e}: ${t instanceof Error?t.message:String(t)}`)}async function id(){Lu&&(Iu?await Q.sendNotification(`teacss/semanticTokens/refresh`).catch(e=>rd(`Failed to refresh semantic token decorations`,e)):Fu&&await Q.languages.semanticTokens.refresh().catch(e=>rd(`Failed to refresh semantic tokens`,e)))}const ad=_u({async getDiagnostics(e){return await cd(),await $?.getDiagnostics(e)??[]},sendDiagnostics(e,t){return Q.sendDiagnostics({uri:e,diagnostics:[...t]})},reportError(e,t){rd(`Failed to publish diagnostics for ${e}`,t)}});vu(s,e=>Q.console.error(e));function od(){return ju}function sd(){return $}function cd(){return Bu}Q.onInitialize(r=>{Mu=!!r.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration,Nu=!!r.capabilities.workspace?.configuration,Pu=!!r.capabilities.workspace?.workspaceFolders,Fu=!!r.capabilities.workspace?.semanticTokens?.refreshSupport;let o=wu(r.initializationOptions);Iu=o?.semanticTokens===`overlay`,`root`in o&&Wu({root:o.root});let s=r.workspaceFolders,c=s?.[0]?.uri||r.rootUri;Yu(c,s,o);let l=c?void 0:Gu(ju.root)[0];return c?Xu():l&&Xu(l),nu(Q,Au,sd,cd),t(Q,Au,sd,cd),i(Q,Au,sd,cd),e(Q,Au,sd,cd),n(Q,Au,sd,cd),a(Q,Au,sd,cd),{capabilities:{textDocumentSync:V.Incremental,completionProvider:{resolveProvider:!0,triggerCharacters:[`-`,`:`,` `,`"`,`'`]},hoverProvider:!0,codeActionProvider:!0,referencesProvider:!0,colorProvider:!0,...Iu?{}:{semanticTokensProvider:{legend:jl,full:!0}},...Pu?{workspace:{workspaceFolders:{supported:!0,changeNotifications:!0}}}:{}}}}),Q.onInitialized(async()=>{Pu&&Q.workspace.onDidChangeWorkspaceFolders(e=>{vd(e).catch(e=>rd(`Failed to update workspace folders`,e))});try{let e=await ku(Nu,()=>Q.workspace.getConfiguration(`teacss`),e=>rd(`Failed to read workspace configuration`,e));e!==void 0&&Wu(e),await Zu(Gu(ju.root)),$&&(await $.ready,await qu())}catch(e){rd(`Failed to complete initial setup`,e)}finally{Lu=!0,zu?.(),zu=void 0}Q.console.log(`✅ TeaCSS Language Server initialized`),await nd().catch(e=>rd(`Failed to update config watchers`,e)),await id()});let ld;Q.onDidChangeWatchedFiles(e=>{mu(e.changes,Qu(),$u())&&(clearTimeout(ld),ld=setTimeout(()=>{ud().catch(e=>rd(`Failed to reload config sources`,e))},500))});async function ud(){await cd(),$&&(Q.console.log(`🔄 Config source changed, reloading TeaCSS...`),Ti(),await Ju(()=>$.contextManager.reload()),Q.console.log(`🔵 Reloaded.`),await nd().catch(e=>rd(`Failed to update config watchers`,e)),await id(),await _d())}Q.onDidChangeConfiguration(async e=>{await cd();let t=e.settings?.teacss;if(t!==void 0){let e=ju,n=Gu(e.root);Wu(t);let r=Gu(ju.root),i=Ou(n,r);i&&(await Zu(r),$&&await Ju(()=>$.contextManager.setRoots(r)),await nd().catch(e=>rd(`Failed to update config watchers`,e)),await _d()),!i&&e.unmatchedDiagnostics!==ju.unmatchedDiagnostics&&await _d(),(i||Du(e,ju))&&await id()}});async function dd(){return await cd(),$?(Ti(),await Ju(()=>$.contextManager.reload()),await nd().catch(e=>rd(`Failed to update config watchers`,e)),await id(),await _d(),{success:!0}):{success:!1}}async function fd(e){if(await cd(),!$)return{count:0};let t=Au.get(e.uri);if(!t)return{count:0};let n=Ys(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 pd(e){if(await cd(),!$)return{positions:[]};let t=Au.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 md(e){if(await cd(),!$)return null;let t=e.uri?Au.get(e.uri):Au.all()[0];return t?$.getProjectStatus(t):null}async function hd(e){if(await cd(),!$)return[];let t=Au.get(e.uri);return t?$.getClassNameEdits(t):[]}Q.onRequest(`teacss/reloadConfig`,dd),Q.onRequest(`teacss/getMatchedCount`,fd),Q.onRequest(`teacss/getMatchedPositions`,pd),Q.onRequest(`teacss/projectStatus`,md),Q.onRequest(`teacss/normalizeClasses`,hd);async function gd(e){$&&await ad.publish(e)}async function _d(){await Promise.all(Au.all().map(e=>gd(e)))}async function vd(e){await cd();let t=new Set(e.removed.map(e=>Ys(e.uri))),n=Uu.folderPaths.filter(e=>!t.has(e));for(let t of e.added){let e=Ys(t.uri);n.includes(e)||n.push(e)}if(Uu.folderPaths=n,Uu.rootPath=n[0],!$&&Uu.rootPath&&(Xu(),await sd()?.ready),!$)return;Ti();let r=Ku(ju.root)?Gu(ju.root):Uu.folderPaths;await Ju(()=>$.contextManager.setRoots(r)),await nd().catch(e=>rd(`Failed to update config watchers`,e)),await id(),await _d()}Au.onDidChangeContent(e=>{wi(Ys(e.document.uri)),gd(e.document)}),Au.onDidClose(e=>{let t=Ys(e.document.uri);wi(t),$?.contextManager.releaseDocument(t),ad.invalidate(e.document.uri),Q.sendDiagnostics({uri:e.document.uri,diagnostics:[]})}),Au.listen(Q),Q.listen();export{};
25
+ ;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&&(Ui[n]=e)}}const Wi={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(let e of Object.keys(Wi)){let t=e.toUpperCase();for(let n=Wi[e][0];n<=Wi[e][1];++n)Ui[n]=n%2==0?t:e}function Gi(e){if(e<192||e>8580)return e;let t=Ui[e];return t===void 0?e:t.codePointAt(0)}function Ki(e){return e}function qi(e){return e}function Ji(e,t){return e>t?e:t}const Yi=e=>e.split(``).map(e=>e.codePointAt(0)),Xi=new Set(` \f
26
+ \r \v\xA0 \u2028\u2029   `.split(``).map(e=>e.codePointAt(0)));for(let e=` `.codePointAt(0);e<=` `.codePointAt(0);e++)Xi.add(e);const Zi=``.codePointAt(0),Qi=`A`.codePointAt(0),$i=`Z`.codePointAt(0),ea=`a`.codePointAt(0),ta=`z`.codePointAt(0),na=`0`.codePointAt(0),ra=`9`.codePointAt(0);function ia(e,t,n){return n?e:t-e-1}function aa(e){return e?new Set:null}function oa(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 sa(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 ca(e){return e>=ea&&e<=ta?1:e>=Qi&&e<=$i?2:e>=na&&e<=ra?4:0}function la(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 ua(e){return e<=Zi?ca(e):la(e)}function da(e,t){return e===0&&t!==0?8:e===1&&t===2||e!==4&&t===4?7:t===0?8:0}function fa(e,t){return t===0?8:da(ua(e[t-1]),ua(e[t]))}function pa(e,t,n,r){let i=e.slice(r),a=i.indexOf(n);if(a===0)return r;if(!t&&n>=ea&&n<=ta){a>0&&(i=i.slice(0,a));let e=i.indexOf(n-32);e>=0&&(a=e)}return a<0?-1:r+a}function ma(e){for(let t of e)if(t>=128)return!1;return!0}function ha(e,t,n){if(!ma(e))return 0;if(!ma(t))return-1;let r=0,i=0;for(let a=0;a<t.length;a++){if(i=pa(e,n,t[a],i),i<0)return-1;a===0&&i>0&&(r=i-1),i++}return r}const ga=(e,t,n,r,i,a,o)=>{let s=i.length;if(s===0)return[{start:0,end:0,score:0},aa(a)];let c=r.length;if(o!==null&&c*s>o.i16.length)return va(e,t,n,r,i,a);let l=ha(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]=oa(u,o,c),[u,p]=oa(u,o,c),[u,m]=oa(u,o,c),[d,h]=sa(d,o,s);let[,g]=sa(d,o,c);for(let e=0;e<g.length;e++)g[e]=r[e];let _=Ki(0),v=0,y=0,b=0,x=i[0],S=i[0],C=Ki(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<=Zi?(o=ca(a),!e&&o===2&&(a+=32)):(o=la(a),!e&&o===2&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0)),t&&(a=Gi(a))),E[r]=a;let c=da(w,o);if(k[r]=c,w=o,a===S&&(y<s&&(h[y]=qi(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 D[r]=Ji(T?C+-1: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]=oa(u,o,j*s);{let e=f.subarray(A,b+1);for(let[t,n]of e.entries())M[t]=n}let[,N]=oa(u,o,j*s);{let e=p.subarray(A,b+1);for(let[t,n]of e.entries())N[t]=n}let ee=h.subarray(1),P=i.slice(1).slice(0,ee.length);for(let[e,t]of ee.entries()){let r=!1,i=P[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=Ji(t,Ji(4,m[c-b+1]))),g+t<y?(g+=l[e],b=0):g+=t}u[e]=b,r=g<y;let x=Ji(Ji(g,y),0);a===s-1&&(n&&x>_||!n&&x>=_)&&(_=x,v=c),f[e]=x}}let F=aa(a),I=A;if(a&&F!==null){let e=s-1;I=v;let t=!0;for(;;){let n=e*j,r=I-A,i=M[n+r],a=0,o=0;if(e>0&&I>=h[e]&&(a=M[n-j+r-1]),I>h[e]&&(o=M[n+r-1]),i>a&&(i>o||i===o&&t)){if(F.add(I),e===0)break;e--}t=N[n+r]>1||n+j+r+1<N.length&&N[n+j+r+1]>0,I--}}return[{start:I,end:v+1,score:_},F]};function _a(e,t,n,r,i,a,o){let s=0,c=0,l=!1,u=0,d=Ki(0),f=aa(o),p=0;i>0&&(p=ua(n[i-1]));for(let m=i;m<a;m++){let i=n[m],a=ua(i);if(e||(i>=Qi&&i<=$i?i+=32:i>Zi&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),t&&(i=Gi(i)),i===r[s]){o&&f!==null&&f.add(m),c+=16;let e=da(p,a);u===0?d=e:(e===8&&(d=e),e=Ji(Ji(e,d),4)),c+=s===0?e*2:e,l=!1,u++,s++}else c+=l?-1:-3,l=!0,u=0,d=0;p=a}return[c,f]}const va=(e,t,n,r,i,a,o)=>{if(i.length===0)return[{start:0,end:0,score:0},null];if(ha(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[ia(a,u,n)];e||(o>=Qi&&o<=$i?o+=32:o>Zi&&(o=String.fromCodePoint(o).toLowerCase().codePointAt(0))),t&&(o=Gi(o));let f=i[ia(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[ia(t,u,n)];e||(a>=Qi&&a<=$i?a+=32:a>Zi&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0)));let o=i[ia(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]=_a(e,t,r,i,c,l,a);return[{start:c,end:l,score:o},f]}return[{start:-1,end:-1,score:0},null]},ya=(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||ha(r,i,e)<0)return[{start:-1,end:-1,score:0},null];let l=0,u=-1,d=Ki(0),f=Ki(-1);for(let a=0;a<s;a++){let o=ia(a,s,n),p=r[o];e||(p>=Qi&&p<=$i?p+=32:p>Zi&&(p=String.fromCodePoint(p).toLowerCase().codePointAt(0))),t&&(p=Gi(p));let m=ia(l,c,n);if(i[m]===p){if(m===0&&(d=fa(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]=_a(e,t,r,i,a,o,!1);return[{start:a,end:o,score:l},null]}return[{start:-1,end:-1,score:0},null]};function ba(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}const xa=ba(102400,2048),Sa=(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}let i=Yi(e);return n&&(i=i.map(Gi)),{queryRunes:i,caseSensitive:r}};function Ca(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 wa(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,xa);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 Ta(e){let{queryRunes:t,caseSensitive:n}=Sa(e,this.opts.casing,this.opts.normalize),r={},i=wa.bind(this)(r,t,n);for(let e=0,t=this.runesList.length;e<t;++e)i(e);return Ca(r,this.opts.limit)}const Ea={limit:1/0,selector:e=>e,casing:`smart-case`,normalize:!0,fuzzy:`v2`,tiebreakers:[],sort:!0,forward:!0};var Da=class{constructor(e,...t){switch(this.opts={...Ea,...t[0]},this.items=e,this.runesList=e.map(e=>Yi(this.opts.selector(e).normalize())),this.algoFn=ya,this.opts.fuzzy){case`v2`:this.algoFn=ga;break;case`v1`:this.algoFn=va}}};const Oa={...Ea,match:Ta};var ka=class extends Da{constructor(e,...t){super(e,...t),this.opts={...Oa,...t[0]}}find(e){return e.length===0||this.items.length===0?this.items.slice(0,this.opts.limit).map(Aa):(e=e.normalize(),ja(this.opts.match.bind(this)(e),this.opts))}};({...Ea});const Aa=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function ja(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 Ma(e,t,n){return n(e.item).length-n(t.item).length}function Na(e,t){return e.start-t.start}var Pa=class{constructor(e,...t){this.finder=new ka(e,...t),this.find=this.finder.find.bind(this.finder)}},X=l(`lru-cache:metrics`),Fa=u(`lru-cache`),Ia=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date,La=()=>X.hasSubscribers||Fa.hasSubscribers,Ra=new Set,za=typeof process==`object`&&process?process:{},Ba=(e,t,n,r)=>{typeof za.emitWarning==`function`?za.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},Va=e=>!Ra.has(e),Ha=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),Ua=e=>Ha(e)?e<=256?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?Wa:null:null,Wa=class extends Array{constructor(e){super(e),this.fill(0)}},Ga=class e{heap;length;static#e=!1;static create(t){let n=Ua(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]}},Ka=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??Ia,n!==0&&!Ha(n))throw TypeError(`max option must be a nonnegative integer`);let E=n?Ua(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.#_=Ga.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&&!Ha(this.#t))throw TypeError(`maxSize must be a positive integer if specified`);if(!Ha(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=Ha(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!Ha(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`;Va(t)&&(Ra.add(t),Ba(`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 Wa(this.#e),t=new Wa(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 Wa(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(!Ha(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),!Ha(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=X.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&&X.hasSubscribers&&X.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=X.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`has`,n.key=e,n.cache=this);let r=this.#V(e,t);return X.hasSubscribers&&X.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=La()?{}:void 0}=t;n&&(n.op=`peek`,n.key=e,n.cache=this),t.status=n;let r=this.#H(e,t);return X.hasSubscribers&&X.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=Fa.hasSubscribers,{status:r=La()?{}: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,Fa.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}{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=Fa.hasSubscribers,{status:r=La()?{}: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,Fa.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=X.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),X.hasSubscribers&&X.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=X.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),X.hasSubscribers&&X.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){X.hasSubscribers&&X.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)}}},qa=`@teacss/autocomplete`;const Ja=5e4,Ya=2e6,Xa=5e4,Za=4096,Qa=1e3,$a=5e7,eo=1e5,to=new Map(Array.from(`ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåçèéêëìíîïñòóôõöøùúûüýÿĀāĂ㥹ĆćĈĉĊċČčĎďđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥħĨĩĪīĬĭĮįİıĴĵĶķĹĺĻļĽľŀłŃńŅņŇňŌōŎŏŐőŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƃƆƈƉƊƌƎƐƒƓƗƙƚƜƝƞƟƠơƥƫƭƮƯưƲƴƶǍǎǏǐǑǒǓǔǗǘǝǥǦǧǨǩǪǫǰǴǵǸǹȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȞȟȠȡȥȦȧȨȩȮȯȲȳȴȵȶȷȺȻȼȽȾȿɀɃɄɅɆɇɈɉɊɋɌɍɎɏɐɑɓɔɕɖɗɘɛɜɝɞɟɠɡɢɥɦɨɪɫɬɭɯɰɱɲɳɴɵɹɺɻɼɽɾɿʀʁʂʇʈʉʋʌʍʎʏʐʑʗʙʚʛʜʝʞʟʠʮͣͤͥͦͧͨͩͪͫͬͭͮͯᴀᴃᴄᴅᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᵢᵣᵤᵥḀḁḂḃḄḅḆḇḊḋḌḍḎḏḐḑḒḓḘḙḚḛḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉṊṋṔṕṖṗṘṙṚṛṞṟṠṡṢṣṪṫṬṭṮṯṰṱṲṳṴṵṶṷṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐốỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹⁱₕₖₗₘₙₚₛₜↄ`,(e,t)=>[e,`AAAAAACEEEEIIIINOOOOOOUUUUYsaaaaaaceeeeiiiinoooooouuuuyyAaAaAaCcCcCcCcDddEeEeEeEeEeGgGgGgGgHhhIiIiIiIiIiJjKkLlLlLlllNnNnNnOoOoOoRrRrRrSsSsSsSsTtTttUuUuUuUuUuUuWwYyYZzZzZzsbBbOcDDdEEfGIklMNnOOopttTUuVyzAaIiOoUuUuegGgKkOojGgNnAaAaEeEeIiIiOoOoRrRrUuUuSsTtHhNdzAaEeOoYylntjACcLTszBUVEeJjQqRrYyaabocddeeeeejggGhhiIlllmmmnnNorrrrrrrRRsttuvvwyYzzcBeGHjkLqhaeioucdhmrtvxABCDEeiJKLMNOOoooooPRRTUuumVWZiruvAaBbBbBbDdDdDdDdDdEeEeFfGgHhHhHhHhHhIiIiKkKkKkLlLlLlMmMmMmNnNnNnNnPpPpRrRrRrSsSsTtTtTtTtUuUuUuVvVvWwWwWwWwWwXxXxYyZzZzZzhtwyasAaAaAaAaAaAaAaAaAaAaAaAaEeEeEeEeEeEeEeEeIiIiOoOoOoOoOoOoOoOoOoOoOoOoUuUuUuUuUuUuUuYyYyYyYyihklmnpstc`[t]])),no={maxAttempts:Xa,maxCandidateLength:Za,maxCandidates:Ja,maxCharacters:Ya,maxScans:eo,maxScannedCharacters:5e7},ro={...no,maxCandidateLength:Ya,maxCandidates:Qa};function io(){return{suggestions:[],attempts:0,candidates:0,characters:0,scans:0,truncated:!1}}const ao=new WeakMap,oo=new WeakMap;function so(e,t,n){let r=ao.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 co(e,t,n){let r=oo.get(e);return r?r(t,n):so(e,t,n)}var lo=class extends Error{template;constructor(e,t){super(e),this.template=t,this.name=qa,this.template=t}toString(){return`⚠️ [${this.name}]: ${this.message}. ${this.template?`Template: ${this.template}.`:``}`}};const uo={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(`|`)})`},fo=[`DEFAULT`];function po(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 mo=Ja;function ho(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 go(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 _o(e,t){let n=e.indexOf(`(`),r=n===-1?void 0:ho(e,n);if(n===-1||r==null)return[e];let i=e.slice(0,n),a=_o(e.slice(r+1),t);if(a===void 0)return;let o=[];for(let s of go(e.slice(n+1,r))){let e=_o(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 vo(e){let t={remaining:mo},n=[];for(let r of go(e)){let e=_o(r,t);if(e===void 0)return;n.push(...e)}return n}function yo(e,t={},n={}){let r=[],i=[],a={...uo,...n};e=e.replace(/<([\w-]+)>/g,(e,t,n,r)=>Object.hasOwn(a,t)?a[t]:(i.push(new lo(`Unknown template shorthand: <${t}>`,r)),e)),c(e),i.length&&(r.length=0);let o={parts:r,suggest:l,errors:i};return ao.set(o,d),oo.set(o,u),o;function s(e){po(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 lo(`Invalid theme key: ${n}`,e.input)),{}):t[n],t);return typeof r!=`object`||!r||Array.isArray(r)?(i.push(new lo(`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=ho(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=vo(c);l===void 0?(i.push(new lo(`Template group expands past ${mo} 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=Po(e,t),i=d(e,{maxCandidates:Qa}).suggestions.filter(e=>Oo(n,Po(e,t),e,0));if(n.length>Za)return i;let a=fs(r,{},e).candidates;if(i.length){let e=new Set(i);if(a.every(t=>e.has(t)))return i}if(Do(e,a.reduce((e,t)=>e+t.length,0))){let t=wo(a,e),n=t.filter(t=>No(t,e));return n.length?ss(n,[...i,...t]):ss(i,t)}return ss(i,new Pa(a,{fuzzy:`v1`,limit:Qa}).find(e).map(e=>e.item))}return u(e).suggestions}function u(e,t={}){let n={...ro,...t},i=Co(e);if(i.length>n.maxCandidateLength)return io();let a=bo(r);if(a){let t=xo(r,0,a.index);if(!Go(t,e)&&!Go(Co(t),i))return io();let o=xo(r,a.index+1,r.length);return Ko(a.part,t,o,e,a.suppressPartialRoots,n)}let o=So(r);return o&&!Go(o,e)&&!Go(Co(o),Co(e))?io():Io(r,e,n)}function d(e,t={}){let n={...no,...t},i=u(e,n),a=So(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 bo(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 xo(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 So(e){let t=e.findIndex(e=>e.type!==`static`);return xo(e,0,t<0?e.length:t)}function Co(e){return e.replace(/-/g,``)}function wo(e,t){return To(e,t)}function To(e,t,n={}){let r={...no,maxCandidates:Qa,...n};if(!t)return Eo(e,r);let i=t!==t.toLowerCase(),a=Po(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=Oo(a,Po(t,i),t,n);d&&ko(o,d,r.maxCandidates,r.maxCharacters)}return o.items.sort(Mo).map(({candidate:e})=>e)}function Eo(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 Do(e,t){return e.length*t>$a}function Oo(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 ko(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,Ao(e.items,e.items.length-1)):e.items.length&&Mo(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),jo(e.items,0)))}function Ao(e,t){for(;t>0;){let n=t-1>>>1;if(Mo(e[t],e[n])<=0)return;[e[n],e[t]]=[e[t],e[n]],t=n}}function jo(e,t){for(;;){let n=t*2+1;if(n>=e.length)return;let r=n+1,i=n;if(r<e.length&&Mo(e[r],e[n])>0&&(i=r),Mo(e[i],e[t])<=0)return;[e[t],e[i]]=[e[i],e[t]],t=i}}function Mo(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 No(e,t){let n=t!==t.toLowerCase();return Po(e,n)===Po(t,n)}function Po(e,t){let n=e.normalize(),r=Fo(n)?n:Array.from(n,e=>to.get(e)??e).join(``);return t?r:r.toLowerCase()}function Fo(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>127)return!1;return!0}function Io(e,t,n={}){let r={...no,...n};if(r.maxAttempts<=0||r.maxCandidates<=0||r.maxCharacters<=0)return io();let i=Co(t),a=Lo(),o=Lo(),s=r.maxCandidates,c=Yo(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&&Ro(a,e,m,s,r),c&&Ro(o,e,m,s,r))}_--;continue}if(g>=r.maxAttempts)break;let n=l[_];n||(n={choiceIndex:0,iterator:cs(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:Wo(t,f[_],b,!1),C=p[_]<0?-1:Wo(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)=>Uo(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 Lo(){return{characters:0,entries:[],indices:new Map}}function Ro(e,t,n,r,i){let a=e.indices.get(t);if(a!==void 0){let t=e.entries[a];Uo(n,t.path)<0&&(t.path=n.slice(),Vo(e,a));return}if(r<=0||t.length>i.maxCharacters)return;let o={candidate:t,path:n.slice()};if(e.entries.length>=r){if(Uo(o.path,e.entries[0].path)>=0)return;zo(e)}for(;e.entries.length&&e.characters+t.length>i.maxCharacters;){if(Uo(o.path,e.entries[0].path)>=0)return;zo(e)}e.characters+t.length>i.maxCharacters||(e.indices.set(t,e.entries.length),e.entries.push(o),e.characters+=t.length,Bo(e,e.entries.length-1))}function zo(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),Vo(e,0))}function Bo(e,t){for(;t>0;){let n=t-1>>>1;if(Uo(e.entries[t].path,e.entries[n].path)<=0)return;Ho(e,n,t),t=n}}function Vo(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&&Uo(e.entries[r].path,e.entries[n].path)>0&&(i=r),Uo(e.entries[i].path,e.entries[t].path)<=0)return;Ho(e,i,t),t=i}}function Ho(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 Uo(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 Wo(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 Go(e,t){return e.length<=t.length?t.startsWith(e):e.startsWith(t)}function Ko(e,t,n,r,i,a){let o={...no,...a};if(t.length+1>o.maxCandidateLength)return io();let s=Yo(o.maxScans),c=Qo(e.objects,s),l=$o(r,!1,o),u=$o(Co(r),!0,o);qo(c,t,n,o.maxCandidateLength,i,l,u,s);let d=ts(l,s);if(d.suggestions.length||!d.exhausted)return d;let f=ts(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 qo(e,t,n,r,i,a,o,s){for(let c of e){let e=t+c.key,l=ns(e,a.input,!1),u=ns(e,o.input,!0);if(l===`none`&&u===`none`)continue;let d=is(c.objects,e,n,a.input,o.input,r),f=l===`partial`||u===`partial`?as(d,s):void 0,p=f!==void 0;if(rs(a,l,c.hasLeaf,p,e,n,i),rs(o,u,c.hasLeaf,p,e,n,i),a.blocked)return;for(f??=as(d,s);f;){if((l===`reached`||i&&l===`partial`)&&es(a,f.candidate,f.rawMatch),(u===`reached`||i&&u===`partial`)&&es(o,f.candidate,f.normalizedMatch),a.blocked)return;f=as(d,s)}if(s.truncated||a.blocked)return}}function Jo(e){return!!e&&e[0]!==`_`&&!fo.includes(e)}function Yo(e=eo){let t=Math.max(0,e);return{initial:t,remaining:t,truncated:!1}}function Xo(e){return e.remaining<=0?(e.truncated=!0,!1):(e.remaining--,!0)}function*Zo(e){yield*Object.keys(e)}function Qo(e,t){let n=new Map;outer:for(let r of e)for(let e of Zo(r)){if(!Xo(t))break outer;if(!Jo(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 $o(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 es(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 ts(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 ns(e,t,n){let r=n?Co(e):e;return t.startsWith(r)?`reached`:r.startsWith(t)?`partial`:`none`}function rs(e,t,n,r,i,a,o){if(t===`none`)return;if(t===`partial`&&r){(n||!o)&&es(e,i,!0);return}if(!n)return;let s=i+a;es(e,s,(e.normalize?Co(s):s).startsWith(e.input))}function is(e,t,n,r,i,a){return{base:t,fragments:[],frames:[],maxCandidateLength:a,normalizedInput:i,normalizedMatchedLength:Wo(i,0,t,!0),objectIndex:0,objects:e,rawInput:r,rawMatchedLength:Wo(r,0,t,!1),staticSuffix:n}}function as(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:Zo(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(!Xo(t))return;let i=r.value;if(!Jo(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:Wo(e.rawInput,n.rawMatchedLength,s,!1),l=n.normalizedMatchedLength<0?-1:Wo(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:Zo(u),normalizedMatchedLength:l,object:u,rawMatchedLength:c,valueLength:o}),!(!u||Object.hasOwn(u,`DEFAULT`)&&u.DEFAULT!==null&&u.DEFAULT!==void 0))continue;let d=os(e.rawInput,c,e.staticSuffix,!1),f=os(e.normalizedInput,l,e.staticSuffix,!0);if(d||f)return{candidate:`${e.base}-${e.fragments.join(`-`)}${e.staticSuffix}`,normalizedMatch:f,rawMatch:d}}}function os(e,t,n,r){return t<0?!1:Wo(e,t,n,r)>=e.length}function ss(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>Za)){if(i+a.length>Ya)return;r.add(a),n.push(a),i+=a.length}}};return a(e,t.length?750:Qa),a(t,Qa),a(e,Qa),n}function*cs(e,t,n){e.type===`theme`?yield*us(e.objects,t,n):yield*ls(e,t,n)}function*ls(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(!Xo(n))return;r.length<=t&&(yield r)}}function*us(e,t,n){let r=[];for(let i of e){r.length=0;let e=[{depth:0,iterator:Zo(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(!Xo(n))return;let o=a.value;if(!Jo(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:Zo(l),object:l,valueLength:c}),(!l||Object.hasOwn(l,`DEFAULT`)&&l.DEFAULT!==null&&l.DEFAULT!==void 0)&&(yield r.join(`-`))}}}function ds(e,t){let n=Yo(t.maxScans),r=e.map(e=>({done:!1,iterator:cs(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 fs(e,t={},n=``){let r={...no,...t},i=ds(e,r),a=i.values,o=i.scans,s,c=()=>{if(s===void 0){let t=ps(a,n,r);s=t?{combination:t,scans:0}:ms(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=gs(r),n={remaining:r.maxAttempts};return _s(t,n,0)&&Cs(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=gs(r),n={remaining:r.maxAttempts};return _s(t,n,0)&&Cs(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=gs(r);return Ss(e,a,u,p),{candidates:[...e.candidates],truncated:!1,attempts:r.maxAttempts-p.remaining,scans:o}}let m=gs(r),h=a.map(e=>e[0]),g=a.flatMap((e,t)=>e.length>1?[t]:[]),_=c().combination;_&&_s(m,p,0)&&Cs(m,_),_s(m,p,0)&&Cs(m,h);let v=Math.min(Xa,Math.max(0,p.remaining));return e.length&&v>$a/e.length?{candidates:[...m.candidates],truncated:!0,attempts:r.maxAttempts-p.remaining,scans:o}:(vs(m,a,h,g,p),bs(m,a,h,g,p),ys(m,a,h,g,p),xs(m,a,h,g,p),Ss(m,a,r.maxAttempts,p,!0),{candidates:[...m.candidates],truncated:!0,attempts:r.maxAttempts-p.remaining,scans:o})}function ps(e,t,n){if(!t||e.some(e=>!e.length))return;let r=t!==t.toLowerCase(),i=Po(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=hs(i,l,Po(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(Oo(i,Po(u,r),u,0))return s}function ms(e,t,n,r){let i=Yo(r),a=e=>({combination:e,scans:i.initial-i.remaining});if(!t)return a();let o=t!==t.toLowerCase(),s=Po(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 cs(t,c,i)){if(n.has(r))continue;n.add(r);let t={normalized:Po(r,o),raw:r};for(let n of l){if(d++,u+=t.normalized.length,d>Xa||u>$a)return a();let r=n.characters+t.raw.length;if(r>c)continue;let i=hs(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 Oo(s,Po(h,o),h,0)?a(p):a()}function hs(e,t,n){for(let r=0;r<n.length&&t<e.length;r++)n[r]===e[t]&&t++;return t}function gs(e){return{candidates:new Set,characters:0,maxCandidateLength:e.maxCandidateLength,maxCandidates:e.maxCandidates,maxCharacters:e.maxCharacters}}function _s(e,t,n){return n>=Xa||t.remaining<=0||e.candidates.size>=e.maxCandidates||e.characters>=e.maxCharacters?!1:(t.remaining--,!0)}function vs(e,t,n,r,i){let a=0;for(let o of r){if(!_s(e,i,a))return;a++;let r=n.slice();r[o]=t[o].at(-1),Cs(e,r)}}function ys(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(!_s(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),Cs(e,u)}}function bs(e,t,n,r,i){let a=0;for(let o of r)for(let r=1;r<t[o].length-1;r++){if(!_s(e,i,a))return;a++;let s=n.slice();s[o]=t[o][r],Cs(e,s)}}function xs(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(!_s(e,i,a))return;a++;let s=n.slice();s[c]=t[c][r],s[l]=t[l][o],Cs(e,s)}}}function Ss(e,t,n,r,i=!1){if(!t.length){_s(e,r,0)&&Cs(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,Xa);for(let n=0;n<c;n++){if(!_s(e,r,n))return;if(Cs(e,t.map((e,t)=>e[a[t]])),!s())break}}function Cs(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 ws(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=Ns(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 Ts=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(` `)),Es=new Set(`=([{,:;!?&|>~`);function Ds(e){return e>=65&&e<=90||e>=97&&e<=122}function Os(e){return Ds(e)||e===95}function ks(e){return Os(e)||e>=48&&e<=57||e===36||e===45||e===46||e===58}function As(e,t,n){let r=t-n.length;return r<0||e.slice(r,t)!==n?!1:r===0||!ks(e.charCodeAt(r-1))}function js(e,t,n,r){if(Ts.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||Es.has(e.charAt(i))?!0:As(e,i+1,`return`)}function Ms(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(!Os(e.charCodeAt(a)))continue;let s=a;for(;a<e.length&&ks(e.charCodeAt(a));)a++;if(a<e.length&&!/[\s/>]/.test(e.charAt(a)))continue;let c=e.slice(s,a);js(e,o,c,n)&&(t={name:c,start:o},i=0)}return t}function Ns(e,t){let n=e.substring(0,t),r=Ms(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 Ps(e,t){return Ns(e,t)?.key}function Fs(e,t){return Ns(e,t)}const Is=1e3,Ls=6e5,Rs=5e7,zs=6e4,Bs=3e5,Vs=5e4,Hs=2e5,Us=5e3,Z={...no,maxAttempts:15e3,maxCandidates:15e3,maxCharacters:6e5,maxScans:3e5};function Ws(){return{active:0,waiters:[]}}function Gs(e){return e>=48&&e<=57}function Ks(e){for(let t=0;t<e.length;t++)if(Gs(e.charCodeAt(t)))return!0;return!1}function qs(e,t){let n=0,r=0;for(;n<e.length&&r<t.length;){let i=e.charCodeAt(n),a=t.charCodeAt(r),o=Gs(i),s=Gs(a);if(o&&s){let i=n+1,a=r+1;for(;i<e.length&&Gs(e.charCodeAt(i));)i++;for(;a<t.length&&Gs(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 Js(e,t){let n=Ks(e);return n===Ks(t)?qs(e,t)||(e===t?0:e<t?-1:1):n?1:-1}function Ys(e,t=Bs,n=Rs){return{attempts:0,heap:[],limit:e,maxAttempts:t,maxScannedCharacters:n,retained:new Set,scannedCharacters:0}}function Xs(e){return e.attempts<e.maxAttempts&&e.scannedCharacters<e.maxScannedCharacters}function Zs(e,t){return Xs(e)?(e.attempts++,!t||e.retained.has(t)||t.length>zs||t.length>e.maxScannedCharacters-e.scannedCharacters?!0:(e.scannedCharacters+=t.length,Qs(e,t),!0)):!1}function Qs(e,t){if(!(!t||e.retained.has(t)||t.length>zs)){if(e.heap.length<e.limit){e.heap.push(t),e.retained.add(t),$s(e.heap,e.heap.length-1);return}Js(t,e.heap[0])>=0||(e.retained.delete(e.heap[0]),e.heap[0]=t,e.retained.add(t),ec(e.heap,0))}}function $s(e,t){let n=t;for(;n>0;){let t=Math.floor((n-1)/2);if(Js(e[t],e[n])>=0)return;[e[t],e[n]]=[e[n],e[t]],n=t}}function ec(e,t){let n=t;for(;;){let t=n*2+1;if(t>=e.length)return;let r=t+1,i=r<e.length&&Js(e[r],e[t])>0?r:t;if(Js(e[n],e[i])>=0)return;[e[n],e[i]]=[e[i],e[n]],n=i}}function tc(e){let t=[],n=0;for(let r of e.heap.sort(Js))n+r.length>Ls||(t.push(r),n+=r.length);return t}function nc(e,t,n,r){return Math.floor((t+n)*e/r)-Math.floor(t*e/r)}function*rc(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*ic(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 ac(e){let t=``;for(let n of e.parts){if(n.type!==`static`)break;t+=n.value}return t}function oc(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=ac(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 sc(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 cc(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 lc(e,t=Is){let n=Ys(t);for(let t of e)if(!Zs(n,t))break;return tc(n)}function uc(e,t){let n=[],r=new Set,i=0,a=0;for(let o of e)if(o.startsWith(t)){if(i===Bs||n.length===Is||a>=Ls)break;i++,!(!o||r.has(o)||o.length>zs||a+o.length>Ls)&&(r.add(o),n.push(o),a+=o.length)}return n}function dc(e,t={}){let n=new Map,r=new Ka({max:Us,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,_=Ws(),{matchType:v=`prefix`,throwErrors:y=!0}=t;return te(),{suggest:S,suggestInFile:w,templates:m,cache:r,errorCache:i,reset:te,enumerate:b};async function b(){let e=Array.from(`abcdefghijklmnopqrstuvwxyz`),t=[...e,`-`],n=e.flatMap(e=>[e,...t.map(t=>`${e}${t}`)]);for(;;){z();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 V(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(z(),!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(;;){z();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 V(e.matchVariants(l),i,s);if(u.stale)continue;let d=await V(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 H(await Promise.all(o),r,a)})),i,s);if(d.stale)continue;let f=d.value.flat();if(f=v===`fuzzy`?P(To(f,t,{maxCandidates:Z.maxCandidates,maxCharacters:Z.maxCharacters}),t):lc(f),!B(i,s))return r.set(t,f),f}}async function w(e,t){z();let n=a,r=o,i=Ps(e,t)!==void 0,s=await V(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(B(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=ws(e,t,n.presets.some(e=>e.name===`@teacss/preset-attributify`));if(!l)return;let u=await S(l.content,i);return B(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&&!B(n,r)&&(p.delete(t),p.add(t),p.size>Us&&p.delete(p.values().next().value)),i?[t]:[]}async function D(e){if(v===`fuzzy`){let t=F(),n=P(u,e,t,d),r=To(I(),e,{maxAttempts:Bs,maxCandidates:750,maxCharacters:6e4});return To([...n,...r],e,{maxCandidates:Is,maxCharacters:Z.maxCharacters})}return c??=[...s].sort(Js),uc(c,e)}async function O(t){return lc(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=L(e),a=await A(r,e,t,n);return[...i,...a]}let i=R(e),a=await j(r,e,t,n);return[...i,...a]}async function A(e,t,n,r){if(!e.length)return[];let i=Ys(Is),a=Ys(Is);for(let o=0;o<e.length;o+=8){let s=await cc(e.slice(o,o+8),8,e=>M(e,t,n,r));if(B(n,r))return[];let c=nc(Bs,o,s.length,e.length),l=nc(Rs,o,s.length,e.length),u=Ys(Is,c,l),d=rc(s.filter(e=>!!e?.length));for(;Xs(u);){let e=d.next();if(e.done)break;Zs(u,e.value)}for(let e of tc(u))Qs(i,e);let f=Ys(Is,c,l);for(;Xs(f);){let e=d.next();if(e.done)break;Zs(f,e.value)}for(let e of tc(f))Qs(i,e);for(;Xs(a);){let e=d.next();if(e.done)break;Zs(a,e.value)}}for(let e of tc(a))Qs(i,e);return tc(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 cc(e.slice(s,s+32),32,e=>M(e,t,n,r));if(B(n,r))return[];let l=rc(c.filter(e=>!!e?.length)),u=nc(Bs,s,c.length,e.length),d=nc(no.maxScannedCharacters,s,c.length,e.length),f=To(l,t,{maxAttempts:u,maxCandidates:Is,maxCharacters:Z.maxCharacters,maxScannedCharacters:d});i=To([...i,...f],t,{maxAttempts:i.length+f.length,maxCandidates:Is,maxCharacters:Z.maxCharacters});let p=To(ic(l,a,{attempts:0,characters:0},u,d,no.maxCandidateLength),t,{maxAttempts:u,maxCandidates:750,maxCharacters:Z.maxCharacters,maxScannedCharacters:d});i=To([...i,...p],t,{maxAttempts:i.length+p.length,maxCandidates:Is,maxCharacters:Z.maxCharacters});let m=To(ic(l,a,{attempts:0,characters:0},u,d,no.maxCandidateLength),t,{maxAttempts:u,maxCandidates:750,maxCharacters:Z.maxCharacters,maxScannedCharacters:d});i=To([...i,...m],t,{maxAttempts:i.length+m.length,maxCandidates:Is,maxCharacters:Z.maxCharacters});let h=To(ic(l,a,o,Bs,no.maxScannedCharacters,no.maxCandidateLength),t,{maxAttempts:Bs-o.attempts,maxCandidates:750,maxCharacters:Z.maxCharacters,maxScannedCharacters:no.maxScannedCharacters-o.characters});i=To([...i,...h],t,{maxAttempts:i.length+h.length,maxCandidates:Is,maxCharacters:Z.maxCharacters})}return i}async function M(e,t,n,r){let i=_;await N(i);try{if(B(n,r))return;try{return await e(t)}catch{return}}finally{ee(i)}}async function N(e){if(e.active<128){e.active++;return}await new Promise(t=>e.waiters.push(t))}function ee(e){let t=e.waiters.shift();t?t():e.active--}function P(e,t,n,r){return Do(t,r??e.reduce((e,t)=>e+t.length,0))?To(e,t,{maxCandidates:Is,maxCharacters:Z.maxCharacters}):(n??new Pa(e,{fuzzy:`v1`,limit:Is,tiebreakers:[Na,Ma]})).find(t).map(e=>e.item)}function F(){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 Pa(u,{fuzzy:`v1`,limit:Is,tiebreakers:[Na,Ma]}),l}function*I(){for(let e of s)f.has(e)||(yield e)}function L(e){let t=Ys(Is),r=0,i=0,a=0,o=oc([...n.values()],e).templates.slice(0,Vs);for(let n=0;n<o.length;n++){let s=Bs-r,c=Rs-i,l=Hs-a;if(c<=0||s<=0||l<=0||!Xs(t))break;let u=o.length-n,d=Math.max(1,Math.floor(s/u)),f=co(o[n],e,{maxAttempts:d,maxCandidateLength:zs,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(!Zs(t,e))break}return tc(t)}function R(e){let t=[],r=new Set,i=0,a=0,o=0,s=0,c=oc([...n.values()],e).templates.slice(0,Vs),l=e=>{!e||r.has(e)||e.length>no.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 To(f(),e,{maxAttempts:Vs,maxCandidates:750,maxCharacters:Z.maxCharacters}))l(t);let d=sc(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=co(d[t],e,p);m=n.suggestions,a+=n.attempts,s+=n.scans}else{let n=fs(d[t].parts,p,e);m=n.candidates,a+=n.attempts,s+=n.scans}for(let e of m)l(e)}return To(t,e,{maxAttempts:Z.maxAttempts,maxCandidates:750,maxCharacters:Z.maxCharacters});function*f(){for(let t=0;t<c.length;t++){let n=Hs-u;if(n<=0)return;let r=c.length-t,i=(e.length<=1?co:so)(c[t],e,{maxAttempts:1,maxCandidates:1,maxCharacters:no.maxCandidateLength,maxScans:Math.max(1,Math.floor(n/r))});u+=i.scans,yield*i.suggestions}}}function te(){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=>ve(e?.[2]?.autocomplete||[])),...t.shortcuts.flatMap(e=>ve(e?.[2]?.autocomplete||[])),...t.variants.flatMap(e=>ve(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=yo(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(`
27
+ `);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(),_=Ws(),i.clear();for(let[e,t]of S)i.set(e,t);l=void 0,u=[],d=0,f.clear(),p.clear()}function z(){a!==e.config&&te()}function B(t,n){return t!==e.config||n!==o}function V(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))}),B(n,r)&&c()})}function H(t,n=``,r=``){let i=ye(t.flat()).filter(t=>!(!t||t.endsWith(`-`)||e.isBlocked(t)||e.isBlocked(n+t+r)));v!==`fuzzy`&&i.sort(Js);let a=i.map(e=>n+e+r);return v===`fuzzy`?a:lc(a)}}function fc(e,t){let n=e[t];for(let r=t+1;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===n)return r+1;return e.length}function pc(e,t){if(e[t]===`"`||e[t]===`'`||e[t]==="`")return fc(e,t);if(e[t]!==`{`){let n=t;for(;n<e.length&&!/[\s>]/.test(e[n]);)n++;return n}let n=1;for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`"`||t===`'`||t==="`")r=fc(e,r)-1;else if(e.startsWith(`/*`,r)){let t=e.indexOf(`*/`,r+2);if(t<0)return e.length;r=t+1}else if(e.startsWith(`//`,r)){let t=e.indexOf(`
28
+ `,r+2);if(t<0)return e.length;r=t}else if(t===`{`)n++;else if(t===`}`&&--n===0)return r+1}return e.length}function mc(e){let t=[],n=/(?:^|\s)((?::|v-bind:)?(?:data-css-(?:primary|neutral|success|warning|failure|general|focused|mode|group|peer)|lang))\s*=\s*/gi;for(let r=n.exec(e);r;r=n.exec(e)){let i=r.index+r[0].length;if(Ps(e,i)?.toLowerCase()!==r[1].toLowerCase())continue;let a=pc(e,i);t.push([i,a]),n.lastIndex=Math.max(i,a)}return t}function hc(e,t){return mc(e).some(([e,n])=>t>=e&&t<=n)}const gc=/([\\:]?[\s"'`;<>]|:\(|\)"|\)\s)/g,_c=/(?:[\w&:[\]-]|\[\S{1,64}=\S{1,64}\]){1,64}\[\\?['"]?\S{0,64}?['"]\]\]?[\w:@-]{0,64}/g,vc=/\[(\\\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 yc(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 bc(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 xc(e,t){let n=e.flags.includes(`g`)?e.flags:`${e.flags}g`;return t.matchAll(new RegExp(e.source,n))}function Sc(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 Cc(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 wc(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 Tc(e){return e===void 0||/[\s'"`;<>]/.test(e)}function Ec(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(!Tc(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&&Tc(e[n+1])&&r.push([t,n+1,i.value])}}return r}function Dc(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 Oc(e,t,n){if(!n)return[];let r=[],i=RegExp(`(^|[^\\w:-])${Dn(t)}\\s*=\\s*(['"])`,`g`);for(let t of e.matchAll(i)){let i=t.index+t[0].length-1,a=Dc(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 kc(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 Ac(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 jc(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 Mc(e,t,n){let r=kc(e,t);if(r<0)return null;let i=jc(e.slice(t+1,r));if(!i.length)return null;let{suffix:a,end:o}=Ac(e,r+1);return i.every(e=>n.has(e)||n.has(`${e}${a}`))?[t,o,e.slice(t,o)]:null}function Nc(e,t,n=[],r={}){let i=[],a=[],o=new Set,s=new Set,c=[],l=mc(e);if(e=Sc(e,l),r.excludeRanges&&(e=Sc(e,r.excludeRanges)),r.excludeRegex)for(let t of r.excludeRegex){let n=Array.from(xc(t,e),e=>[e.index,e.index+e[0].length]);e=Sc(e,n)}if(r.includeRegex)for(let t of r.includeRegex)for(let n of xc(t,e))c.push([n.index,n.index+n[0].length]);else c.push([0,e.length]);let u=Cc(c);Array.from(t).forEach(e=>{let t=_r(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(...Ec(e,s));let d=0;e.split(gc).forEach(e=>{let t=d+e.length;r.isPug?i.push(...bc(e,o,d)):o.has(e)&&i.push([d,t,e]),d=t});for(let t of e.matchAll(_c)){let e=t.index,n=e+t[0].length;o.has(t[0])&&i.push([e,n,t[0]])}let f=new Set(i.map(([e,t])=>`${e}:${t}`));for(let t of e.matchAll(vc)){let e=t.index,n=e+t[0].length;if(o.has(t[0])){let r=`${e}:${n}`;f.has(r)||(f.add(r),i.push([e,n,t[0]]))}}a.forEach(([,t,n])=>{for(let r of Oc(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=Mc(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 p=new Set;return i.filter(([e,t])=>!l.some(([n,r])=>e<r&&t>n)).filter(([e,t])=>wc(u,e,t)).filter(([e,t,n])=>{let r=`${e}:${t}:${n}`;return!p.has(r)&&(p.add(r),!0)}).sort((e,t)=>e[0]-t[0])}const Pc=[`@teacss/directives`,`@teacss/transformer-compile-class`];async function Fc(e,t,n=``,r={}){let i=new c(t),a={generator:e,tokens:new Set},o=e.config.transformers?.filter(e=>!Pc.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 yc(e,i.toString(),n);return Nc(t,[...(await e.generate(l?u:i.toString(),{preflights:!1,safelist:!1})).matched],s,{isPug:l,...r})}function Ic(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 Lc(e,t,n,r){let i=e.get(t);if(i)return Ic(e,t,i,n),i;let a;return a=r().catch(n=>{throw e.get(t)===a&&e.delete(t),n}),Ic(e,t,a,n),a}const Rc=new Map;function zc(e){Rc.delete(e)}function Bc(){Rc.clear()}function Vc(e,t,n,r=!1,i=!1){i&&Rc.delete(n);let a=Rc.get(n);if(a&&a.code===t&&a.config===e.config&&a.generator===e&&a.strictAnnotationMatch===r)return Ic(Rc,n,a,100),a.result;let o=Fc(e,t,n,{excludeRanges:Bi(t,n),excludeRegex:Hi,...r?{includeRegex:Vi}:null});return Ic(Rc,n,{code:t,config:e.config,generator:e,strictAnnotationMatch:r,result:o},100),o}function Hc(e){try{return O(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 Uc=/<style[^>]*>[\s\S]*?(?:<\/style>|<\/>|$)/g,Wc=/(?:<\/style>|<\/>)$/,Gc=/<template\b[^>]*\slang\s*=\s*(?:'pug'|"pug")[^>]*>/i;function Kc(e,t,n){let r=t.match(/\.(svelte|vue|astro|marko)$/);if(r&&qc(e,t)){let t=e.slice(0,n);if(/\.$/.test(t)||/\.\S+$/.test(t))return!0}if((r?[...e.matchAll(Uc)].some(t=>{let r=t.index,i=r+t[0].length,a=i===e.length&&!Wc.test(t[0]);return n>r&&(n<i||a&&n===i)}):/\.(?:css|scss|sass|less|styl(?:us)?|pcss|postcss)$/i.test(t))||Ps(e,n)!==void 0)return!0;let i=e.slice(n).replace(/"[^"]*"|\{[^}]*\}|'[^']*'/g,``);return/^[^<>]*>/.test(i)}function qc(e,t){return t.endsWith(`.vue`)&&Gc.test(e)}function Jc(e,t){let n=p.relative(e,t);return n!==``&&n!==`..`&&!n.startsWith(`..${p.sep}`)&&!p.isAbsolute(n)}const Yc={log(){},warn(){}},Xc=/[\\/](?:node_modules|dist|\.temp|\.cache)[\\/]/;var Zc=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=mr();constructor(e,t=Yc,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=>Jc(t,e))}get contexts(){return Array.from(new Set(this.contextsMap.values())).filter(yr)}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=p.dirname(e),n=this.getWorkspaceBoundary(t);if(n)for(;t===n||Jc(n,t);){if(this.configExistsCache.delete(t),t===n)return;t=p.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=E(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=p.join(e,t);if(f(n))try{me(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(Xc.test(t))return;if(this.fileContextCache.has(t)){let e=this.fileContextCache.get(t);return Ic(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&&Jc(n,t)&&(i.filter(e,t)||kn(t)))return Ic(this.fileContextCache,t,i,100),i;for(let[e,n]of r)if(n&&Jc(e,t))return Ic(this.fileContextCache,t,n,100),n}async discoverAndLoadConfig(e){let t=this.lifecycleVersion,n=await this.findConfigDirectory(p.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&&Ic(this.fileContextCache,e,i,100),i}async findConfigDirectory(e,t){let n=this.configExistsCache.get(e);if(n!==void 0)return Ic(this.configExistsCache,e,n,100),n||void 0;let r=this.getWorkspaceBoundary(e);if(!r)return;let i=p.parse(e).root,a=[],o=e;for(;o!==i&&(Jc(r,o)||o===r);){a.push(o);let e=this.configExistsCache.get(o);if(e!==void 0)return Ic(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=p.dirname(o)}this.cacheSearchPath(a,!1)}getWorkspaceBoundary(e){return[...this.workspaceRoots,...this.contextsMap.keys()].filter(t=>t===e||Jc(t,e)).sort((e,t)=>t.length-e.length)[0]}async hasConfigFiles(e){return!!x(e)}cacheSearchPath(e,t){for(let n of e)Ic(this.configExistsCache,n,t,100)}};const Qc=/^[A-Za-z]:\//;function $c(e=``){return e&&e.replace(/\\/g,`/`).replace(Qc,e=>e.toUpperCase())}const el=/^[/\\]{2}/,tl=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,nl=/^[A-Za-z]:$/,rl=function(e){if(e.length===0)return`.`;e=$c(e);let t=e.match(el),n=cl(e),r=e[e.length-1]===`/`;return e=sl(e,!n),e.length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),nl.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!cl(e)?`/${e}`:e)},il=function(...e){let t=``;for(let n of e)if(n){if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;t+=e&&r?n.slice(1):e||r?n:`/${n}`}else t+=n}return rl(t)};function al(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const ol=function(...e){e=e.map(e=>$c(e));let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:al();i&&i.length!==0&&(t=`${i}/${t}`,n=cl(i))}return t=sl(t,!n),n&&!cl(t)?`/${t}`:t.length>0?t:`.`};function sl(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}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 cl=function(e){return tl.test(e)};var ll=de(((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:65536,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}}})),ul=de((e=>{let{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=ll();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}})),dl=de(((e,t)=>{let n=ul(),{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:_}=ll(),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,ee=!1,P=!1,F=!1,I=!1,L=!1,R=!1,te=0,z,B,V={value:``,depth:0,isGlob:!1},H=()=>D>=x,ne=()=>E.charCodeAt(D+1),U=()=>(z=B,E.charCodeAt(++D));for(;D<x;){B=U();let e;if(B===a){F=V.backslashes=!0,B=U(),B===u&&(P=!0);continue}if(P===!0||B===u){for(te++;H()!==!0&&(B=U());){if(B===a){F=V.backslashes=!0,U();continue}if(B===u){te++;continue}if(P!==!0&&B===s&&(B=U())===s){if(A=V.isBrace=!0,M=V.isGlob=!0,R=!0,S===!0)continue;break}if(P!==!0&&B===o){if(A=V.isBrace=!0,M=V.isGlob=!0,R=!0,S===!0)continue;break}if(B===h&&(te--,te===0)){P=!1,A=V.isBrace=!0,R=!0;break}}if(S===!0)continue;break}if(B===l){if(C.push(D),w.push(V),V={value:``,depth:0,isGlob:!1},R===!0)continue;if(z===s&&D===O+1){O+=2;continue}k=D+1;continue}if(b.noext!==!0&&(B===p||B===i||B===r||B===m||B===c)&&ne()===d){if(M=V.isGlob=!0,N=V.isExtglob=!0,R=!0,B===c&&D===O&&(L=!0),S===!0){for(;H()!==!0&&(B=U());){if(B===a){F=V.backslashes=!0,B=U();continue}if(B===g){M=V.isGlob=!0,R=!0;break}}continue}break}if(B===r){if(z===r&&(ee=V.isGlobstar=!0),M=V.isGlob=!0,R=!0,S===!0)continue;break}if(B===m){if(M=V.isGlob=!0,R=!0,S===!0)continue;break}if(B===f){for(;H()!==!0&&(e=U());){if(e===a){F=V.backslashes=!0,U();continue}if(e===_){j=V.isBracket=!0,M=V.isGlob=!0,R=!0;break}}if(S===!0)continue;break}if(b.nonegate!==!0&&B===c&&D===O){I=V.negated=!0,O++;continue}if(b.noparen!==!0&&B===d){if(M=V.isGlob=!0,S===!0){for(;H()!==!0&&(B=U());){if(B===d){F=V.backslashes=!0,B=U();continue}if(B===g){R=!0;break}}continue}break}if(M===!0){if(R=!0,S===!0)continue;break}}b.noext===!0&&(N=!1,M=!1);let W=E,re=``,ie=``;O>0&&(re=E.slice(0,O),E=E.slice(O),k-=O),W&&M===!0&&k>0?(W=E.slice(0,k),ie=E.slice(k)):M===!0?(W=``,ie=E):W=E,W&&W!==``&&W!==`/`&&W!==E&&v(W.charCodeAt(W.length-1))&&(W=W.slice(0,-1)),b.unescape===!0&&(ie&&=n.removeBackslashes(ie),W&&F===!0&&(W=n.removeBackslashes(W)));let ae={prefix:re,input:e,start:O,base:W,glob:ie,isBrace:A,isBracket:j,isGlob:M,isExtglob:N,isGlobstar:ee,negated:I,negatedExtglob:L};if(b.tokens===!0&&(ae.maxDepth=0,v(B)||w.push(V),ae.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=re):w[n].value=a,y(w[n]),ae.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]),ae.maxDepth+=w[w.length-1].depth)}ae.slashes=C,ae.parts=T}return ae}})),fl=de(((e,t)=>{let n=ll(),r=ul(),{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}).)*?)`,ee=d.dot?``:E,P=d.dot?k:A,F=d.bash===!0?N(d):j;d.capture&&(F=`(${F})`),typeof d.noext==`boolean`&&(d.noextglob=d.noext);let I={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,I),p=e.length;let L=[],R=[],te=[],z=m,B,V=()=>I.index===p-1,H=I.peek=(t=1)=>e[I.index+t],ne=I.advance=()=>e[++I.index]||``,U=()=>e.slice(I.index+1),W=(e=``,t=0)=>{I.consumed+=e,I.index+=t},re=e=>{I.output+=e.output==null?e.value:e.output,W(e.value)},ie=()=>{let e=1;for(;H()===`!`&&(H(2)!==`(`||H(3)===`?`);)ne(),I.start++,e++;return e%2!=0&&(I.negated=!0,I.start++,!0)},ae=e=>{I[e]++,te.push(e)},oe=e=>{I[e]--,te.pop()},G=e=>{if(z.type===`globstar`){let t=I.braces>0&&(e.type===`comma`||e.type===`brace`),n=e.extglob===!0||L.length&&(e.type===`pipe`||e.type===`paren`);e.type!==`slash`&&e.type!==`paren`&&!t&&!n&&(I.output=I.output.slice(0,-z.output.length),z.type=`star`,z.value=`*`,z.output=F,I.output+=z.output)}if(L.length&&e.type!==`paren`&&(L[L.length-1].inner+=e.value),(e.value||e.output)&&re(e),z&&z.type===`text`&&e.type===`text`){z.output=(z.output||z.value)+e.value,z.value+=e.value;return}e.prev=z,h.push(e),z=e},se=(e,t)=>{let n={...v[t],conditions:1,inner:``};n.prev=z,n.parens=I.parens,n.output=I.output,n.startIndex=I.index,n.tokensIndex=h.length;let r=(d.capture?`(`:``)+n.open;ae(`parens`),G({type:e,value:t,output:I.output?``:w}),G({type:`paren`,extglob:!0,value:ne(),output:r}),L.push(n)},ce=n=>{let i=e.slice(n.startIndex,I.index+1),a=e.slice(n.startIndex+2,I.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;I.output=n.output+t.output,I.backtrack=!0,G({type:`paren`,extglob:!0,value:B,output:``}),oe(`parens`);return}let s=n.close+(d.capture?`)`:``),c;if(n.type===`negate`){let e=F;n.inner&&n.inner.length>1&&n.inner.includes(`/`)&&(e=N(d)),(e!==F||V()||/^\)+$/.test(U()))&&(s=n.close=`)$))${e}`),n.inner.includes(`*`)&&(c=U())&&/^\.[^\\/.]+$/.test(c)&&(s=n.close=`)${b(c,{...t,fastpaths:!1}).output})${e})`),n.prev.type===`bos`&&(I.negatedExtglob=!0)}G({type:`paren`,extglob:!0,value:B,output:s}),oe(`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?P+(a?k.repeat(a.length):``):k.repeat(r.length):i===`.`?x.repeat(r.length):i===`*`?t?t+i+(a?F:``):F: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?(I.output=e,I):(I.output=r.wrapOutput(i,I,t),I)}for(;!V();){if(B=ne(),B===`\0`)continue;if(B===`\\`){let e=H();if(e===`/`&&d.bash!==!0||e===`.`||e===`;`)continue;if(!e){B+=`\\`,G({type:`text`,value:B});continue}let t=/^\\+/.exec(U()),n=0;if(t&&t[0].length>2&&(n=t[0].length,I.index+=n,n%2!=0&&(B+=`\\`)),d.unescape===!0?B=ne():B+=ne(),I.brackets===0){G({type:`text`,value:B});continue}}if(I.brackets>0&&(B!==`]`||z.value===`[`||z.value===`[^`)){if(d.posix!==!1&&B===`:`){let e=z.value.slice(1);if(e.includes(`[`)&&(z.posix=!0,e.includes(`:`))){let e=z.value.lastIndexOf(`[`),t=z.value.slice(0,e),n=z.value.slice(e+2),r=a[n];if(r){z.value=t+r,I.backtrack=!0,ne(),!m.output&&h.indexOf(z)===1&&(m.output=w);continue}}}(B===`[`&&H()!==`:`||B===`-`&&H()===`]`)&&(B=`\\${B}`),B===`]`&&(z.value===`[`||z.value===`[^`)&&(B=`\\${B}`),d.posix===!0&&B===`!`&&z.value===`[`&&(B=`^`),z.value+=B,re({value:B});continue}if(I.quotes===1&&B!==`"`){B=r.escapeRegex(B),z.value+=B,re({value:B});continue}if(B===`"`){I.quotes=I.quotes===1?0:1,d.keepQuotes===!0&&G({type:`text`,value:B});continue}if(B===`(`){ae(`parens`),G({type:`paren`,value:B});continue}if(B===`)`){if(I.parens===0&&d.strictBrackets===!0)throw SyntaxError(u(`opening`,`(`));let e=L[L.length-1];if(e&&I.parens===e.parens+1){ce(L.pop());continue}G({type:`paren`,value:B,output:I.parens?`)`:`\\)`}),oe(`parens`);continue}if(B===`[`){if(d.nobracket===!0||!U().includes(`]`)){if(d.nobracket!==!0&&d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));B=`\\${B}`}else ae(`brackets`);G({type:`bracket`,value:B});continue}if(B===`]`){if(d.nobracket===!0||z&&z.type===`bracket`&&z.value.length===1){G({type:`text`,value:B,output:`\\${B}`});continue}if(I.brackets===0){if(d.strictBrackets===!0)throw SyntaxError(u(`opening`,`[`));G({type:`text`,value:B,output:`\\${B}`});continue}oe(`brackets`);let e=z.value.slice(1);if(z.posix!==!0&&e[0]===`^`&&!e.includes(`/`)&&(B=`/${B}`),z.value+=B,re({value:B}),d.literalBrackets===!1||r.hasRegexChars(e))continue;let t=r.escapeRegex(z.value);if(I.output=I.output.slice(0,-z.value.length),d.literalBrackets===!0){I.output+=t,z.value=t;continue}z.value=`(${g}${t}|${z.value})`,I.output+=z.value;continue}if(B===`{`&&d.nobrace!==!0){ae(`braces`);let e={type:`brace`,value:B,output:`(`,outputIndex:I.output.length,tokensIndex:I.tokens.length};R.push(e),G(e);continue}if(B===`}`){let e=R[R.length-1];if(d.nobrace===!0||!e){G({type:`text`,value:B,output:B});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),I.backtrack=!0}if(e.comma!==!0&&e.dots!==!0){let n=I.output.slice(0,e.outputIndex),r=I.tokens.slice(e.tokensIndex);e.value=e.output=`\\{`,B=t=`\\}`,I.output=n;for(let e of r)I.output+=e.output||e.value}G({type:`brace`,value:B,output:t}),oe(`braces`),R.pop();continue}if(B===`|`){L.length>0&&L[L.length-1].conditions++,G({type:`text`,value:B});continue}if(B===`,`){let e=B,t=R[R.length-1];t&&te[te.length-1]===`braces`&&(t.comma=!0,e=`|`),G({type:`comma`,value:B,output:e});continue}if(B===`/`){if(z.type===`dot`&&I.index===I.start+1){I.start=I.index+1,I.consumed=``,I.output=``,h.pop(),z=m;continue}G({type:`slash`,value:B,output:C});continue}if(B===`.`){if(I.braces>0&&z.type===`dot`){z.value===`.`&&(z.output=x);let e=R[R.length-1];z.type=`dots`,z.output+=B,z.value+=B,e.dots=!0;continue}if(I.braces+I.parens===0&&z.type!==`bos`&&z.type!==`slash`){G({type:`text`,value:B,output:x});continue}G({type:`dot`,value:B,output:x});continue}if(B===`?`){if(!(z&&z.value===`(`)&&d.noextglob!==!0&&H()===`(`&&H(2)!==`?`){se(`qmark`,B);continue}if(z&&z.type===`paren`){let e=H(),t=B;(z.value===`(`&&!/[!=<:]/.test(e)||e===`<`&&!/<([!=]|\w+>)/.test(U()))&&(t=`\\${B}`),G({type:`text`,value:B,output:t});continue}if(d.dot!==!0&&(z.type===`slash`||z.type===`bos`)){G({type:`qmark`,value:B,output:A});continue}G({type:`qmark`,value:B,output:k});continue}if(B===`!`){if(d.noextglob!==!0&&H()===`(`&&(H(2)!==`?`||!/[!=<:]/.test(H(3)))){se(`negate`,B);continue}if(d.nonegate!==!0&&I.index===0){ie();continue}}if(B===`+`){if(d.noextglob!==!0&&H()===`(`&&H(2)!==`?`){se(`plus`,B);continue}if(z&&z.value===`(`||d.regex===!1){G({type:`plus`,value:B,output:S});continue}if(z&&(z.type===`bracket`||z.type===`paren`||z.type===`brace`)||I.parens>0){G({type:`plus`,value:B});continue}G({type:`plus`,value:S});continue}if(B===`@`){if(d.noextglob!==!0&&H()===`(`&&H(2)!==`?`){G({type:`at`,extglob:!0,value:B,output:``});continue}G({type:`text`,value:B});continue}if(B!==`*`){(B===`$`||B===`^`)&&(B=`\\${B}`);let e=o.exec(U());e&&(B+=e[0],I.index+=e[0].length),G({type:`text`,value:B});continue}if(z&&(z.type===`globstar`||z.star===!0)){z.type=`star`,z.star=!0,z.value+=B,z.output=F,I.backtrack=!0,I.globstar=!0,W(B);continue}let t=U();if(d.noextglob!==!0&&/^\([^?]/.test(t)){se(`star`,B);continue}if(z.type===`star`){if(d.noglobstar===!0){W(B);continue}let n=z.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]!==`/`)){G({type:`star`,value:B,output:``});continue}let o=I.braces>0&&(n.type===`comma`||n.type===`brace`),s=L.length&&(n.type===`pipe`||n.type===`paren`);if(!i&&n.type!==`paren`&&!o&&!s){G({type:`star`,value:B,output:``});continue}for(;t.slice(0,3)===`/**`;){let n=e[I.index+4];if(n&&n!==`/`)break;t=t.slice(3),W(`/**`,3)}if(n.type===`bos`&&V()){z.type=`globstar`,z.value+=B,z.output=N(d),I.output=z.output,I.globstar=!0,W(B);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&!a&&V()){I.output=I.output.slice(0,-(n.output+z.output).length),n.output=`(?:${n.output}`,z.type=`globstar`,z.output=N(d)+(d.strictSlashes?`)`:`|$)`),z.value+=B,I.globstar=!0,I.output+=n.output+z.output,W(B);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&t[0]===`/`){let e=t[1]===void 0?``:`|$`;I.output=I.output.slice(0,-(n.output+z.output).length),n.output=`(?:${n.output}`,z.type=`globstar`,z.output=`${N(d)}${C}|${C}${e})`,z.value+=B,I.output+=n.output+z.output,I.globstar=!0,W(B+ne()),G({type:`slash`,value:`/`,output:``});continue}if(n.type===`bos`&&t[0]===`/`){z.type=`globstar`,z.value+=B,z.output=`(?:^|${C}|${N(d)}${C})`,I.output=z.output,I.globstar=!0,W(B+ne()),G({type:`slash`,value:`/`,output:``});continue}I.output=I.output.slice(0,-z.output.length),z.type=`globstar`,z.output=N(d),z.value+=B,I.output+=z.output,I.globstar=!0,W(B);continue}let n={type:`star`,value:B,output:F};if(d.bash===!0){n.output=`.*?`,(z.type===`bos`||z.type===`slash`)&&(n.output=ee+n.output),G(n);continue}if(z&&(z.type===`bracket`||z.type===`paren`)&&d.regex===!0){n.output=B,G(n);continue}(I.index===I.start||z.type===`slash`||z.type===`dot`)&&(z.type===`dot`?(I.output+=D,z.output+=D):d.dot===!0?(I.output+=O,z.output+=O):(I.output+=ee,z.output+=ee),H()!==`*`&&(I.output+=w,z.output+=w)),G(n)}for(;I.brackets>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));I.output=r.escapeLast(I.output,`[`),oe(`brackets`)}for(;I.parens>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`)`));I.output=r.escapeLast(I.output,`(`),oe(`parens`)}for(;I.braces>0;){if(d.strictBrackets===!0)throw SyntaxError(u(`closing`,`}`));I.output=r.escapeLast(I.output,`{`),oe(`braces`)}if(d.strictSlashes!==!0&&(z.type===`star`||z.type===`bracket`)&&G({type:`maybe_slash`,value:``,output:`${C}?`}),I.backtrack===!0){I.output=``;for(let e of I.tokens)I.output+=e.output==null?e.value:e.output,e.suffix&&(I.output+=e.suffix)}return I};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})),pl=de(((e,t)=>{let n=dl(),r=fl(),i=ul(),a=ll(),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})),ml=pe(de(((e,t)=>{let n=pl(),r=ul();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 hl(e){return e.replaceAll(`\\`,`/`)}const gl=Array.isArray;function _l(e){return gl(e)?e:e==null?[]:[e]}const vl=`[_#EsCaPe#_]`;function yl(e,t){return t===!1||cl(e)||e.startsWith(`**`)?hl(e):il(hl(ol(t||``)).replaceAll(/[-^$*+?.()|[\]{}]/g,`${vl}$&`),hl(e)).replaceAll(vl,`\\`)}function bl(e,t,n){let r=n&&n.resolve,i=e=>e instanceof RegExp?e:{test:t=>(0,ml.default)(yl(e,r),{dot:!0})(t)},a=_l(e).map(i),o=_l(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=hl(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 xl={root:void 0,colorPreview:!1,remToPxPreview:!0,remToPxRatio:16,syntaxHighlight:!0,strictAnnotationMatch:!1,unmatchedDiagnostics:!0,autocompleteMatchType:`prefix`,autocompleteStrict:!1,autocompleteMaxItems:1e3},Sl=/^#(?:[0-9a-f]{3,8})$/i,Cl=/^(?:rgb|rgba|hsl|hsla|hwb|oklch|oklab|lab|lch|device-cmyk|color)\(/i,wl=/^(?:media|supports|container)\b/;function Tl(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`||Sl.test(n)||Cl.test(n))return!0;let r=n.split(`/`)[0].split(`-`)[0];return t.has(r)},isBreakpoint(e){if(wl.test(e))return!0;let t=e.replace(/^(?:max|min)-/,``).split(/[^a-z0-9]/i)[0];return n.has(t)}}}L([R,te,z,B,V,H]);const El=/var\((?<cssVarName>--[^,|)]+)(?:,(?<fallback>[^)]+))?\)/g,Dl=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)\([^)]*\)`,Ol=new RegExp(Dl,`g`),kl=/var\((--[^,|)]+)(?:,([^)]+))?\)/,Al=String.raw`(?:^|[;{]\s*)(?:[\w-]+-color|color|fill|stroke)\s*:\s*(?<value>[^;}{]+)`,jl=new RegExp(Al,`gm`),Ml=/(?:^|[;{])\s*--[^\s:;{}]+\s*:/m,Nl=new RegExp(Dl,`i`),Pl=new RegExp(Al,`m`),Fl=new RegExp(String.raw`color-mix\([^,]+,\s*(?<color>${Dl})\s+(?<weight>\d+(?:\.\d+)?%)\s*,\s*transparent\s*\)`,`i`);function Il(e){return Ml.test(e)||Pl.test(e)||Ll(e)}function Ll(e){return Nl.test(e)}function Rl(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 zl(e,t){let n=e.trim(),r=new Set;for(;n.startsWith(`var(`);){let e=n.match(kl);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 Bl(e,t){let n=e;for(let r of e.matchAll(El)){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,zl(o,t)??a??`1`):a&&(n=n.replaceAll(e,a))}return n.replaceAll(/,?\s+var\(--.*?\)/g,``)}function Vl(e,t){let n=Bl(e,t),r=n.match(Fl);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(Ol)?.[0];if(!i){let e=n.trim().replace(/\s*!important$/,``);return I(e).isValid()?e:void 0}return/\/\)/.test(i)&&(i=i.replace(/ \/\)/g,`/ 1)`)),i}function Hl(e){let t=Rl(e);for(let n of e.matchAll(jl)){let e=n.groups?.value;if(!e)continue;let r=Vl(e,t);if(r)return r}return Vl(e,t)}function Ul(e){let t=I(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 Wl=/(-?[\d.]+)rem(\s+!important)?;/;let Gl;function Kl(e){return e.default??e}function ql(){return Gl??=Promise.all([import(`prettier/standalone`),import(`prettier/parser-postcss`)]).then(([e,t])=>({prettier:Kl(e),parserCSS:Kl(t)}))}function Jl(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(Wl);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 Yl(e,t,n){let[r,{prettier:i,parserCSS:a}]=await Promise.all([e.generate(new Set(ve(t)),{preflights:!1,safelist:!1}),ql()]),o=Jl(r.css,n),s=await i.format(o,{parser:`css`,plugins:[a]});return{...r,prettified:s}}async function Xl(e,t,n){return`\`\`\`css\n${(await Yl(e,t,n)).prettified.trimEnd()}\n\`\`\``}const Zl=[`property`,`class`,`keyword`,`number`,`enumMember`,`string`,`operator`,`type`],Ql=[`important`,`pseudoClass`,`pseudoElement`,`query`,`selector`,`variable`,`combinator`,`bracket`,`group`,`condition`],$l=/^-?(?:\d+\.?\d*|\.\d+)[a-z%]*$/i,eu=/^[>+~_[&.#*: ]/,tu=/^[>+~_.#]/;function nu(e,t){return t?.isColorValue?.(e)?`enumMember`:e.startsWith(`[`)?`string`:$l.test(e)?`number`:`keyword`}function ru(e,t){return e.startsWith(`::`)?{type:`type`,modifier:`pseudoElement`,symbolLen:0}:tu.test(e)?{type:`type`,modifier:`selector`,symbolLen:1}:eu.test(e)?{type:`type`,modifier:`selector`,symbolLen:0}:t?.isBreakpoint?.(e)?{type:`keyword`,modifier:`query`,symbolLen:0}:{type:`keyword`,modifier:`pseudoClass`,symbolLen:0}}function iu(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}=ru(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 au(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 ou(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(`[`)){au(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:nu(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(`[`)?au(e,s,r):e.push({start:r,length:s.length,type:nu(s,i),modifiers:[]})}return}let s=r===`property`?`property`:nu(o,i);e.push({start:n+a,length:o.length,type:s,modifiers:[]})}function su(e,t,n){if(!e)return[];if(e.startsWith(`{`)&&e.includes(`}`))return lu(e,t,n);let r=Ne(e),i=[];if(r.keyword)r.body.length&&(r.body.startsWith(`[`)?au(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&&ou(i,e,t,`property`,n),i.push({start:t+e.length,length:1,type:`operator`,modifiers:[]}),a.length&&ou(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=iu(i,e,a,n);return i}function cu(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 lu(e,t,n){let r=[],i=cu(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=cu(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 su(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=iu(r,e,l,n);return r}const uu=new Map,du=new WeakMap;function fu(e,t){return e<t?-1:+(e>t)}function pu(e,t){return fu(e??``,t??``)}function mu(e,t){return e[0]-t[0]||(e[4]?.sort??0)-(t[4]?.sort??0)||pu(e[5]?.currentSelector,t[5]?.currentSelector)||pu(e[1],t[1])||fu(e[2],t[2])}function hu(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 gu(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 _u(e){let t=uu.get(e);if(t!==void 0)return t;let n=Il(e);return Ic(uu,e,n,2048),n}function vu(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 yu(e,t,n){let r=e.sort(mu).map(([,e,t,,n,,r])=>{let i=e&&!n?.noScope?hu(e):e;return[i==null?[]:[[i,n?.sort??0]],t,!!(r??n?.noMerge)]});t&&vu(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]||fu(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(_u)).join(`
31
+ `)}function bu(e,t,n){let r=new Map,i=new Set([Ie]);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)||fu(e,t))),s=[];for(let n of o){let i=r.get(n);if(i)for(let n of[...i.keys()].sort((e,n)=>ji(t,e,n))){let t=yu(i.get(n),e.mergeSelectors,_u(n));if(t){if(!n)s.push(t);else{let e=gu(n);s.push(`${e.join(`{`)}{${t}${`}`.repeat(e.length)}`)}}}}return s.join(`
32
+ `)}async function xu(e,t){let n=e.config,r=await e.parseToken(t);if(e.config!==n)return xu(e,t);if(r?.length)return Hl(bu(n,new Map(e.parentOrders),r))}async function Su(e,t){let n=du.get(e);return(!n||n.config!==e.config)&&(n={config:e.config,values:new Map},du.set(e,n)),Lc(n.values,t,1e3,()=>xu(e,t).then(e=>e?{colorString:e,color:Ul(e)}:{}))}const Cu=[...Ql,`teacss`],wu={tokenTypes:[...Zl],tokenModifiers:Cu},Tu=new Map(Zl.map((e,t)=>[e,t])),Eu=new Map(Cu.map((e,t)=>[e,1<<t])),Du=Eu.get(`teacss`)??0,Ou=/^-?(?:\d+\.?\d*|\.\d+)[a-z%]*$/i,ku=new WeakMap,Au={log(){},warn(){}};function ju(e,t){let n=Ps(e,t)?.toLowerCase();return n?.endsWith(`class`)||n?.endsWith(`classname`)}function Mu(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 Nu(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 Pu(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 Fu(e){return!e.startsWith(`[`)||!e.endsWith(`]`)||Ul(e.slice(1,-1).replace(/\\?_/g,e=>e===`_`?` `:`_`).trim())!==void 0}function Iu(e){let t=ku.get(e);if(t?.config===e.config)return t.classifier;let n=Tl(e.config?.theme??{});return ku.set(e,{config:e.config,classifier:n}),n}function Lu(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 Ru(e,t,n,r,i=Du){let a=e.positionAt(t);return{line:a.line,char:a.character,length:n,type:Tu.get(r)??0,modifiers:i}}function zu(e,t,n,r,i=Du){let a=[],o=0;for(let s=0;s<n.length;s++)(n[s]===`\r`||n[s]===`
33
+ `)&&(s>o&&a.push(Ru(e,t+o,s-o,r,i)),n[s]===`\r`&&n[s+1]===`
34
+ `&&s++,o=s+1);return o<n.length&&a.push(Ru(e,t+o,n.length-o,r,i)),a}function Bu(e,t){return t.isColorValue?.(e)?`enumMember`:Ou.test(e)?`number`:`string`}function Vu(e,t,n){return e.some(e=>e.open===t&&e.close===n-1)}function Hu(e,t,n){let r=[];for(let i of n){r.push(Ru(e,i.open,1,`operator`,Du|(Eu.get(`group`)??0)));for(let n of i.declarations){let{property:i,start:a,colon:o,value:s,valueStart:c}=n;r.push(Ru(e,a,2,`operator`,Du|(Eu.get(`variable`)??0))),r.push(Ru(e,a+2,i.length-2,`property`)),r.push(Ru(e,o,1,`operator`)),s&&r.push(...zu(e,c,s,Bu(s,t)))}r.push(Ru(e,i.close,1,`operator`,Du|(Eu.get(`group`)??0)))}return r}var Uu=class{contextManager;getSettings;logger;autoCompletes=new Map;semanticTokensCache=new Map;featureFailures=new Map;constructor(e){this.getSettings=e.getSettings??(()=>xl),this.logger=e.logger??Au;let t=e.folderPaths?.length?e.folderPaths:[e.rootPath];this.contextManager=new Zc(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&&(Ic(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=dc(e.generator,{matchType:t,throwErrors:!1});return this.autoCompletes.set(e,{matchType:t,autocomplete:r}),r}async resolveTargetContext(e){let t=Hc(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)||kn(t))?null:{ctx:r,id:t,code:n,doc:e.getText()===n?e:N.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 Ic(this.semanticTokensCache,o,u,100),this.clearFeatureFailure(n,e.uri),u.result;let d=await Vc(a.generator,s,o,l),f=Iu(a.generator),p=[],m=new Map,h=kn(o)?w(s):[];for(let[e,t]of d){if(Vu(h,e,t))continue;let n=s.slice(e,t),r=m.get(n);r||(r=su(n,0,f),m.set(n,r));for(let t of r){let n=e+t.start,r=c.positionAt(n),i=Du;for(let e of t.modifiers)i|=Eu.get(e)??0;p.push({line:r.line,char:r.character,length:t.length,type:Tu.get(t.type)??0,modifiers:i})}}h.length&&p.push(...Hu(c,f,h));let g=Lu(p);return Ic(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(kn(r)){let e=n.generator.config?.theme??{},t=C(e);o=v(i,t).filter(e=>e.reason!==`removed-theme`).map(e=>({range:{start:a.positionAt(e.start),end:a.positionAt(e.end)},message:e.message,severity:F.Warning,source:`teacss`,code:e.reason}));let r=y(i);o.push(...r.map(e=>({range:{start:a.positionAt(e.start),end:a.positionAt(e.end)},message:e.message,severity:F.Error,source:`teacss`,code:`entry-config`})));let s=S(i);if(!r.length&&(s.rolePalettes||s.custom.length)){let r=_(s.custom,t).theme;s.rolePalettes&&(r.rolePalettes=s.rolePalettes);try{if(s.rolePalettes&&!n.generator.config.presets.some(e=>e.name===`@teacss/preset-standard`))throw TypeError(`Role palette directives require an explicitly enabled Standard preset`);await xi({presets:n.generator.config.presets,theme:Cr(Cr({},e),r)})}catch(e){let t=T(i).find(e=>g.includes(e.name))??T(i).find(e=>e.name===`custom`);t&&o.push({range:{start:a.positionAt(t.start),end:a.positionAt(t.end)},message:e.message,severity:F.Error,source:`teacss`,code:`role-palettes`})}}}else if(this.getSettings().unmatchedDiagnostics){let e=await fr.extract?.({code:i,id:r,generator:n.generator})??[],t=Nc(i,Array.from(new Set(e)).filter(e=>typeof e==`string`&&e.length>0),[],{excludeRanges:Bi(i,r)}).filter(([e,t])=>ju(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])=>{if(s.matched.has(e))return!1;if(!e.includes(`{`))return!0;let t=ni(Tn(e));return t.length===1&&t[0]===e||!t.every(e=>s.matched.has(e))&&t.some(e=>!s.matched.has(e)&&Ur(e))}),l=new Map;for(let[,,e]of c){let t=Hr(e),r=e.slice(t.length),i=ei(e,n.generator.config,{confirmedIntent:!0})?.map(e=>`${e}${r}`)??[];l.set(e,Array.from(new Set([...Mu(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.flatMap(([e,t,n])=>{let r=(l.get(n)??[]).filter(e=>d.has(e)).slice(0,3);return!r.length&&!Ur(n)&&Hr(n)===n&&!n.includes(`{`)?[]:[{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:F.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:ee.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=>kn(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`)||kn(r),u=(await Vc(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 fr.extract?.({code:i,id:r,generator:n.generator})??[],s=Nc(i,Array.from(new Set(o)).filter(e=>typeof e==`string`&&e.length>0),[],{excludeRanges:Bi(i,r)}),c=new Map;for(let[e,t]of s){let n=Fs(i,Math.max(e+1,t-1)),r=n?.key.toLowerCase();n&&(r?.endsWith(`class`)||r?.endsWith(`classname`))&&c.set(n.valueStart,Nu(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(kn(Hc(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 Vc(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 Xl(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 Vc(i.generator,o,a,n.strictAnnotationMatch),l=[],u=!1;for(let[n,r,a]of c)try{let{color:e}=await Su(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=Wu(n),r=n.slice(0,e),i=n.slice(e),a=r.indexOf(`:`);if(a>0){let e=r.endsWith(`!`)?`!`:``;if(Fu(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 Vc(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=Hc(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:N.create(e.uri,e.languageId,e.version,i),s=await Vc(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)),f=a.getConfigFileList().find(e=>kn(e)),p=a.generator.config.content?.filesystem,g=p??D,_=g.filter(e=>!e.startsWith(`!`)),v=g.filter(e=>e.startsWith(`!`)).map(e=>e.slice(1)),y=f?m(f):a.root,b=bl(void 0,p===void 0?[...M,...v]:v,{resolve:y}),x=p===void 0?new Set([`node_modules`,`dist`,`build`,`storybook-static`]):void 0,S=[];if(_.length)for await(let e of A(_,{cwd:y,exclude:e=>x?.has(e)??!1})){let t=h(y,e);b(t)&&S.push(t)}return S.includes(r)||S.unshift(r),(await Pu(Array.from(new Set(S)),16,async e=>{let t;try{t=e===r?i:await j(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return[];throw e}let s=e===r?o:N.create(k(e).href,``,0,t);return(await Vc(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=Hc(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:N.create(e.uri,e.languageId,e.version,a),c=s.offsetAt(t),l=Ps(a,c)?.match(/^data-css-(primary|neutral|success|warning|failure|general|focused)$/)?.[1];if(l&&hc(a,c)){let e=o.generator.config.theme.rolePalettes?.[l]??[];return e.length?{isIncomplete:!1,items:[...new Set(e)].sort().map(e=>({label:e,kind:P.Value}))}:null}if(kn(i)&&a.slice(0,c).match(/@(primary|neutral|success|warning|failure|general|focused)\s+["'][^"';]*$/)){let e=o.generator.config.theme.colors??{};return{isIncomplete:!1,items:Object.keys(e).filter(t=>!g.includes(t)&&[`100`,`150`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`850`,`900`,`950`].every(n=>typeof e[t]?.[n]==`string`)).sort().map(e=>({label:e,kind:P.Value}))}}if(hc(a,c)||r.autocompleteStrict&&!Kc(a,i,c))return this.clearFeatureFailure(n,e.uri),null;let u=await this.getSuggestionResult({ctx:o,code:a,id:i,offset:c,matchType:r.autocompleteMatchType});if(!u?.suggestions.length)return this.clearFeatureFailure(n,e.uri),null;let d=u.suggestions.slice(0,r.autocompleteMaxItems),f=r.colorPreview?await Pu(d,32,async([e])=>{try{return(await Su(o.generator,e)).colorString}catch{return}}):[],p=[];for(let t=0;t<d.length;t++){let[n,r]=d[t],i=f[t],a=u.resolveReplacement(n),o={label:r,kind:i?P.Color:P.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),p.push(o)}return this.clearFeatureFailure(n,e.uri),{isIncomplete:!0,items:p}}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=Hc(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===P.Color?e.detail=await(await Yl(a.generator,e.data.value,o)).prettified:e.documentation={kind:`markdown`,value:await Xl(a.generator,e.data.value,o)},e}async getSuggestionResult({ctx:e,code:t,id:n,offset:r,matchType:i}){let a=qc(t,n);if(!e.filter(t,n)&&!kn(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 Wu(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 Gu(e,t){let n=qu(t.workspaceFolderPaths||[]),r=n.length?n:qu([t.workspaceRootPath]),i=ve(e).filter(e=>typeof e==`string`&&e.length>0);if(!i.length)return r;let a=qu([t.workspaceFileDir,...n,t.workspaceRootPath]);return qu(i.flatMap(e=>Ku(e,a)))}function Ku(e,t){if(!e)return[];if(Ju(e))return[p.normalize(e)];let n=p.normalize(e),r=t.filter(e=>{let t=p.normalize(e);return t===n||t.endsWith(`${p.sep}${n}`)});if(r.length)return r;let i=t.map(t=>p.resolve(t,e)),a=i.filter(e=>f(e));return a.length?a:i.slice(0,1)}function qu(e){return Array.from(new Set(e.filter(Boolean).map(e=>p.normalize(e))))}function Ju(e){return p.isAbsolute(e)||p.win32.isAbsolute(e)}function Yu(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 Xu=/[\\/](?:node_modules|dist|\.temp|\.cache|\.git)[\\/]/,Zu=new Set([`node_modules`,`dist`,`.temp`,`.cache`,`.git`]),Qu=`**/{${Array.from(new Set(b.map(e=>p.posix.basename(e)))).join(`,`)}}`;function $u(e,t){let n=p.relative(e,t);return n===``||!n.startsWith(`..${p.sep}`)&&n!==`..`&&!p.isAbsolute(n)}function ed(e){return[...e].map(e=>e===`*`?`[*]`:e===`?`?`[?]`:e===`[`?`[[]`:e===`]`?`[]]`:e===`{`?`[{]`:e===`}`?`[}]`:e).join(``)}function td(e){try{let t=JSON.parse(d.readFileSync(p.join(e,`package.json`),`utf8`))?.teacss?.entry;return typeof t==`string`&&t?p.resolve(e,t):void 0}catch{return}}function nd(e){let t=[],n=[e];for(let e of n){let r;try{r=d.readdirSync(e,{withFileTypes:!0})}catch{continue}if(r.some(e=>e.isFile()&&e.name===`package.json`)){let n=td(e);n&&t.push({directory:e,entry:n})}for(let t of r)t.isDirectory()&&!Zu.has(t.name)&&n.push(p.join(e,t.name))}return t.sort((e,t)=>e.directory<t.directory?-1:+(e.directory>t.directory))}function rd(e,t){return t.map(e=>p.normalize(e)).filter(t=>$u(t,e)).sort((e,t)=>t.length-e.length)[0]}function id(e,t){let n=p.dirname(e);for(;$u(t,n);){if(p.normalize(x(n)??``)===e)return!0;if(n===t)break;n=p.dirname(n)}return!1}function ad(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 od(e,t,n){let r=new Map,i=(e,t,i=!0)=>{let a=i?ed(t):t,o={baseUri:k(e).href,pattern:a};r.set(`${o.baseUri}\0${a}`,{globPattern:o,kind:n})};for(let t of e)i(p.dirname(t),p.basename(t));for(let e of t){i(e,Qu,!1);for(let{directory:t,entry:n}of nd(e)){let e=p.relative(t,n);$u(t,n)?i(t,e.split(p.sep).join(`/`)):i(p.dirname(n),p.basename(n))}}return Array.from(r.values())}function sd(e,t,n){let r=new Set(t.map(e=>p.normalize(e))),i=new Set(n.map(td).filter(e=>!!e).map(e=>p.normalize(e))),a=new Set;for(let t of e){let e;try{e=p.normalize(O(t.uri))}catch{return!0}if(r.has(e)||i.has(e))return!0;if(Xu.test(e))continue;let o=rd(e,n);if(!o){a.add(e);continue}if(p.basename(e)===`package.json`)return!0;if(p.extname(e).toLowerCase()!==`.css`){a.add(e);continue}try{if(id(e,o))return!0}catch{return!0}}if(a.size){for(let e of n)for(let{entry:t}of nd(e))if(a.has(p.normalize(t)))return!0}return!1}function cd(e){let t,n,r,i,a=0,o=Promise.resolve();return{update(s){let c=ad(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 ld(e){return e instanceof Error?e.message:String(e)}function ud(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=ld(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 dd(e,t){e.on(`uncaughtExceptionMonitor`,(e,n)=>{t(`[teacss] ${n===`unhandledRejection`?`Unhandled rejection`:`Uncaught exception`}: ${e.message}`)})}function fd(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function pd(e,t){return typeof e==`boolean`?e:t}function md(e,t){if(e!==null)return typeof e==`string`?e:Array.isArray(e)?e.filter(e=>typeof e==`string`):t}function hd(e,t){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:t}function gd(e,t){return typeof e!=`number`||!Number.isFinite(e)?t:Math.min(1e4,Math.max(0,Math.floor(e)))}function _d(e){let t=fd(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 vd(e,t){let n=fd(t),r=fd(n.autocomplete),i=r.matchType;return{root:md(n.root,e.root),colorPreview:pd(n.colorPreview,e.colorPreview),remToPxPreview:pd(n.remToPxPreview,e.remToPxPreview),remToPxRatio:hd(n.remToPxRatio,e.remToPxRatio),syntaxHighlight:pd(n.syntaxHighlight,e.syntaxHighlight),strictAnnotationMatch:pd(n.strictAnnotationMatch,e.strictAnnotationMatch),unmatchedDiagnostics:pd(n.unmatchedDiagnostics,e.unmatchedDiagnostics),autocompleteMatchType:i===`prefix`||i===`fuzzy`?i:e.autocompleteMatchType,autocompleteStrict:pd(r.strict,e.autocompleteStrict),autocompleteMaxItems:gd(r.maxItems,e.autocompleteMaxItems)}}function yd(e){return vd(xl,e)}function bd(e,t){return e.syntaxHighlight!==t.syntaxHighlight||e.strictAnnotationMatch!==t.strictAnnotationMatch}function xd(e,t){let n=new Set(e),r=new Set(t);return n.size!==r.size||[...n].some(e=>!r.has(e))}async function Sd(e,t,n){if(e)try{return await t()}catch(e){n(e);return}}const Q=ae(U.all),Cd=new re(N);let wd=yd(),$,Td=!1,Ed=!1,Dd=!1,Od=!1,kd=!1,Ad=!1,jd=0,Md;const Nd=new Promise(e=>{Md=e}),Pd=ie.Create|ie.Change|ie.Delete,Fd=[{globPattern:`**/*.css`,kind:Pd}],Id={folderPaths:[]};function Ld(e){wd=vd(wd,e)}function Rd(e){return Gu(e,{workspaceRootPath:Id.rootPath,workspaceFileDir:Id.fileDir,workspaceFolderPaths:Id.folderPaths})}function zd(e){return typeof e==`string`?e.length>0:Array.isArray(e)&&e.some(Boolean)}async function Bd(){$&&await Vd(()=>$.contextManager.setRoots(Rd(wd.root)))}async function Vd(e){jd++;try{return await e()}finally{jd--}}function Hd(e,t,n){Id.rootPath=e?Hc(e):void 0,Id.fileDir=n?.workspaceFileDir,Id.folderPaths=n?.workspaceFolderPaths||t?.map(e=>Hc(e.uri))||[]}function Ud(e=Id.rootPath){if(!e)return;let t=new Uu({rootPath:e,folderPaths:Rd(wd.root),logger:{log:e=>Q.console.log(e),warn:e=>Q.console.warn(e)},getSettings:$d});$=t;let n=()=>{jd||(Yd().catch(e=>Xd(`Failed to update config watchers`,e)),Zd(),df())};return t.events.on(`reload`,()=>{jd||Yd().catch(e=>Xd(`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 Wd(e){!$&&e[0]&&await Ud(e[0])?.ready}function Gd(){return $?.contextManager.configSources??[]}function Kd(){return Array.from(new Set([...Rd(wd.root),...$?.contextManager.contextsMap.keys()??[]]))}function qd(){let e=Gd(),t=od(e,Kd(),Pd);return e.length?t:[...Fd,...t]}const Jd=cd(async e=>Q.client.register(ne.type,{watchers:[...e]}));async function Yd(){Td&&Ad&&$&&await Jd.update(qd())}function Xd(e,t){Q.console.error(`[teacss] ${e}: ${t instanceof Error?t.message:String(t)}`)}async function Zd(){Ad&&(kd?await Q.sendNotification(`teacss/semanticTokens/refresh`).catch(e=>Xd(`Failed to refresh semantic token decorations`,e)):Od&&await Q.languages.semanticTokens.refresh().catch(e=>Xd(`Failed to refresh semantic tokens`,e)))}const Qd=ud({async getDiagnostics(e){return await tf(),await $?.getDiagnostics(e)??[]},sendDiagnostics(e,t){return Q.sendDiagnostics({uri:e,diagnostics:[...t]})},reportError(e,t){Xd(`Failed to publish diagnostics for ${e}`,t)}});dd(s,e=>Q.console.error(e));function $d(){return wd}function ef(){return $}function tf(){return Nd}Q.onInitialize(r=>{Td=!!r.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration,Ed=!!r.capabilities.workspace?.configuration,Dd=!!r.capabilities.workspace?.workspaceFolders,Od=!!r.capabilities.workspace?.semanticTokens?.refreshSupport;let o=_d(r.initializationOptions);kd=o?.semanticTokens===`overlay`,`root`in o&&Ld({root:o.root});let s=r.workspaceFolders,c=s?.[0]?.uri||r.rootUri;Hd(c,s,o);let l=c?void 0:Rd(wd.root)[0];return c?Ud():l&&Ud(l),Yu(Q,Cd,ef,tf),t(Q,Cd,ef,tf),i(Q,Cd,ef,tf),e(Q,Cd,ef,tf),n(Q,Cd,ef,tf),a(Q,Cd,ef,tf),{capabilities:{textDocumentSync:W.Incremental,completionProvider:{resolveProvider:!0,triggerCharacters:[`-`,`:`,` `,`"`,`'`]},hoverProvider:!0,codeActionProvider:!0,referencesProvider:!0,colorProvider:!0,...kd?{}:{semanticTokensProvider:{legend:wu,full:!0}},...Dd?{workspace:{workspaceFolders:{supported:!0,changeNotifications:!0}}}:{}}}}),Q.onInitialized(async()=>{Dd&&Q.workspace.onDidChangeWorkspaceFolders(e=>{ff(e).catch(e=>Xd(`Failed to update workspace folders`,e))});try{let e=await Sd(Ed,()=>Q.workspace.getConfiguration(`teacss`),e=>Xd(`Failed to read workspace configuration`,e));e!==void 0&&Ld(e),await Wd(Rd(wd.root)),$&&(await $.ready,await Bd())}catch(e){Xd(`Failed to complete initial setup`,e)}finally{Ad=!0,Md?.(),Md=void 0}Q.console.log(`✅ TeaCSS Language Server initialized`),await Yd().catch(e=>Xd(`Failed to update config watchers`,e)),await Zd()});let nf;Q.onDidChangeWatchedFiles(e=>{sd(e.changes,Gd(),Kd())&&(clearTimeout(nf),nf=setTimeout(()=>{rf().catch(e=>Xd(`Failed to reload config sources`,e))},500))});async function rf(){await tf(),$&&(Q.console.log(`🔄 Config source changed, reloading TeaCSS...`),Bc(),await Vd(()=>$.contextManager.reload()),Q.console.log(`🔵 Reloaded.`),await Yd().catch(e=>Xd(`Failed to update config watchers`,e)),await Zd(),await df())}Q.onDidChangeConfiguration(async e=>{await tf();let t=e.settings?.teacss;if(t!==void 0){let e=wd,n=Rd(e.root);Ld(t);let r=Rd(wd.root),i=xd(n,r);i&&(await Wd(r),$&&await Vd(()=>$.contextManager.setRoots(r)),await Yd().catch(e=>Xd(`Failed to update config watchers`,e)),await df()),!i&&e.unmatchedDiagnostics!==wd.unmatchedDiagnostics&&await df(),(i||bd(e,wd))&&await Zd()}});async function af(){return await tf(),$?(Bc(),await Vd(()=>$.contextManager.reload()),await Yd().catch(e=>Xd(`Failed to update config watchers`,e)),await Zd(),await df(),{success:!0}):{success:!1}}async function of(e){if(await tf(),!$)return{count:0};let t=Cd.get(e.uri);if(!t)return{count:0};let n=Hc(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 sf(e){if(await tf(),!$)return{positions:[]};let t=Cd.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 cf(e){if(await tf(),!$)return null;let t=e.uri?Cd.get(e.uri):Cd.all()[0];return t?$.getProjectStatus(t):null}async function lf(e){if(await tf(),!$)return[];let t=Cd.get(e.uri);return t?$.getClassNameEdits(t):[]}Q.onRequest(`teacss/reloadConfig`,af),Q.onRequest(`teacss/getMatchedCount`,of),Q.onRequest(`teacss/getMatchedPositions`,sf),Q.onRequest(`teacss/projectStatus`,cf),Q.onRequest(`teacss/normalizeClasses`,lf);async function uf(e){$&&await Qd.publish(e)}async function df(){await Promise.all(Cd.all().map(e=>uf(e)))}async function ff(e){await tf();let t=new Set(e.removed.map(e=>Hc(e.uri))),n=Id.folderPaths.filter(e=>!t.has(e));for(let t of e.added){let e=Hc(t.uri);n.includes(e)||n.push(e)}if(Id.folderPaths=n,Id.rootPath=n[0],!$&&Id.rootPath&&(Ud(),await ef()?.ready),!$)return;Bc();let r=zd(wd.root)?Rd(wd.root):Id.folderPaths;await Vd(()=>$.contextManager.setRoots(r)),await Yd().catch(e=>Xd(`Failed to update config watchers`,e)),await Zd(),await df()}Cd.onDidChangeContent(e=>{zc(Hc(e.document.uri)),uf(e.document)}),Cd.onDidClose(e=>{let t=Hc(e.document.uri);zc(t),$?.contextManager.releaseDocument(t),Qd.invalidate(e.document.uri),Q.sendDiagnostics({uri:e.document.uri,diagnostics:[]})}),Cd.listen(Q),Q.listen();export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teacss/language-server",
3
- "version": "0.5.2",
3
+ "version": "0.6.0",
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": "^6.3.0",
33
- "@teacss/config": "0.5.2",
34
- "@teacss/language-service": "0.5.2",
35
- "@teacss/runtime": "0.5.2",
33
+ "@teacss/config": "0.6.0",
34
+ "@teacss/language-service": "0.6.0",
35
+ "@teacss/runtime": "0.6.0",
36
36
  "magic-string": "^1.2.3",
37
37
  "prettier": "^3.9.6",
38
38
  "vscode-languageserver": "^10.1.1",
@@ -40,9 +40,9 @@
40
40
  "vscode-languageserver-types": "^3.18.3"
41
41
  },
42
42
  "devDependencies": {
43
- "@teacss/autocomplete": "0.5.2",
44
- "@teacss/core": "0.5.2",
45
- "@teacss/preset-standard": "0.5.2"
43
+ "@teacss/autocomplete": "0.6.0",
44
+ "@teacss/core": "0.6.0",
45
+ "@teacss/preset-standard": "0.6.0"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=22.12.0"