@teacss/language-server 0.3.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.
- package/LICENSE +22 -0
- package/README.md +49 -0
- package/bin/teacss-language-server.js +2 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +1 -0
- package/dist/semanticTokens-Doz6lLwt.js +1 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.js +15 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021-PRESENT Anthony Fu <https://github.com/antfu>
|
|
4
|
+
Copyright (c) 2026-PRESENT Billgo <hi@billgo.me>
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @teacss/language-server
|
|
2
|
+
|
|
3
|
+
**LSP server for TeaCSS editor features.**
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
The server wraps `@teacss/language-service` as a Language Server Protocol host.
|
|
8
|
+
Its standalone `server` entry can run over stdio, while the bundled VS Code
|
|
9
|
+
host runs the same server over Node IPC.
|
|
10
|
+
|
|
11
|
+
Use this package when an editor client needs a standalone TeaCSS Language
|
|
12
|
+
Server Protocol process or when an editor adapter needs the exported capability
|
|
13
|
+
registrars. It owns LSP transport, workspace settings, document synchronization,
|
|
14
|
+
and config watchers; `@teacss/language-service` owns the transport-neutral
|
|
15
|
+
feature calculations, while `@teacss/vscode` supplies the ready-made VS Code
|
|
16
|
+
host.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
teacss-language-server --stdio
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
It provides completion, hover previews, color support, references, diagnostics,
|
|
25
|
+
and token-level semantic highlighting.
|
|
26
|
+
|
|
27
|
+
Settings live under the `teacss` namespace, including `teacss.syntaxHighlight`,
|
|
28
|
+
`teacss.colorPreview`, and `teacss.autocomplete.maxItems`.
|
|
29
|
+
Settings are normalized at the server boundary. Incremental updates preserve
|
|
30
|
+
omitted values, including sibling fields under `autocomplete`. Completion
|
|
31
|
+
limits are whole numbers from `0` through `10,000`, rem preview ratios must be
|
|
32
|
+
finite positive numbers, and malformed types or unsupported enums safely
|
|
33
|
+
retain the current setting. Finite completion limits are floored and clamped
|
|
34
|
+
to the documented range.
|
|
35
|
+
|
|
36
|
+
The server watches active entry and preset sources directly. Before any entry
|
|
37
|
+
exists, a broad CSS fallback supports discovery without reloading for unrelated
|
|
38
|
+
stylesheets. Once configured, root-scoped entry-topology watchers and exact
|
|
39
|
+
targets from nested `package.json#teacss.entry` declarations keep nearest-entry
|
|
40
|
+
resolution live without retaining the broad CSS subscription. Nested-manifest
|
|
41
|
+
scans and entry-topology reload filtering skip `node_modules`, `dist`, `.temp`,
|
|
42
|
+
`.cache`, and `.git`; active config sources remain watched even there.
|
|
43
|
+
Workspace-folder additions and removals update active roots without restarting
|
|
44
|
+
the server. Config reloads and root changes republish diagnostics for open CSS
|
|
45
|
+
documents. Unrelated settings do not refresh semantic tokens.
|
|
46
|
+
|
|
47
|
+
## Status
|
|
48
|
+
|
|
49
|
+
Pre-1.0. Used by the TeaCSS VS Code extension.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TextDocument } from "vscode-languageserver-textdocument";
|
|
2
|
+
import { TeacssLanguageService } from "@teacss/language-service";
|
|
3
|
+
import { Connection, TextDocuments } from "vscode-languageserver";
|
|
4
|
+
//#region src/capabilities/initialization.d.ts
|
|
5
|
+
type WaitUntilInitialized = () => PromiseLike<void>;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/capabilities/colorProvider.d.ts
|
|
8
|
+
/** Thin LSP adapter: forwards document-color requests to the language service. */
|
|
9
|
+
declare function registerColorProvider(connection: Connection, documents: TextDocuments<TextDocument>, getService: () => TeacssLanguageService | undefined, waitUntilInitialized?: WaitUntilInitialized): void;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/capabilities/completion.d.ts
|
|
12
|
+
/**
|
|
13
|
+
* Thin LSP adapter: forwards completion + completion-resolve requests to the
|
|
14
|
+
* language service. The service owns the autocomplete instances and their cache.
|
|
15
|
+
*/
|
|
16
|
+
declare function registerCompletion(connection: Connection, documents: TextDocuments<TextDocument>, getService: () => TeacssLanguageService | undefined, waitUntilInitialized?: WaitUntilInitialized): void;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/capabilities/hover.d.ts
|
|
19
|
+
/** Thin LSP adapter: forwards `textDocument/hover` to the language service. */
|
|
20
|
+
declare function registerHover(connection: Connection, documents: TextDocuments<TextDocument>, getService: () => TeacssLanguageService | undefined, waitUntilInitialized?: WaitUntilInitialized): void;
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/capabilities/references.d.ts
|
|
23
|
+
/** Thin LSP adapter: forwards `textDocument/references` to the language service. */
|
|
24
|
+
declare function registerReferences(connection: Connection, documents: TextDocuments<TextDocument>, getService: () => TeacssLanguageService | undefined, waitUntilInitialized?: WaitUntilInitialized): void;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/capabilities/semanticTokens.d.ts
|
|
27
|
+
/**
|
|
28
|
+
* Thin LSP adapter: forwards a `textDocument/semanticTokens/full` request to the
|
|
29
|
+
* language service, which produces TeaCSS token-part highlighting.
|
|
30
|
+
*/
|
|
31
|
+
declare function registerSemanticTokens(connection: Connection, documents: TextDocuments<TextDocument>, getService: () => TeacssLanguageService | undefined, waitUntilInitialized?: WaitUntilInitialized): void;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { registerColorProvider, registerCompletion, registerHover, registerReferences, registerSemanticTokens };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"./semanticTokens-Doz6lLwt.js";export{e as registerColorProvider,t as registerCompletion,r as registerHover,n as registerReferences,i as registerSemanticTokens};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=()=>Promise.resolve();function t(t,n,r,i=e){t.onDocumentColor(async e=>{await i();let t=r();if(!t)return[];let a=n.get(e.textDocument.uri);return a?t.getDocumentColors(a):[]}),t.onColorPresentation(async e=>{await i();let t=r();return t?t.getColorPresentations(e.color):[]})}function n(t,n,r,i=e){t.onCompletion(async e=>{await i();let t=r();if(!t)return null;let a=n.get(e.textDocument.uri);return a?t.getCompletions(a,e.position):null}),t.onCompletionResolve(async e=>{await i();let t=r();if(!t)return e;let a=e.data?.uri?n.get(e.data.uri):void 0;return t.resolveCompletion(e,a)})}function r(t,n,r,i=e){t.onHover(async e=>{await i();let t=r();if(!t)return null;let a=n.get(e.textDocument.uri);return a?t.getHover(a,e.position):null})}function i(t,n,r,i=e){t.onReferences(async e=>{await i();let t=r();if(!t)return null;let a=n.get(e.textDocument.uri);return a?t.getReferences(a,e.position):null})}const a={data:[]};function o(t,n,r,i=e){t.languages.semanticTokens.on(async e=>{await i();let t=r();if(!t)return a;let o=n.get(e.textDocument.uri);return o?t.getSemanticTokens(o):a})}export{t as a,n as i,i as n,r,o as t};
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"./semanticTokens-Doz6lLwt.js";import{createRequire as a}from"node:module";import o from"node:process";import s from"magic-string";import c,{existsSync as l}from"node:fs";import u from"node:path";import{diagnoseCustom as d,entryDiscoveryFiles as f,findEntry as p,scanCustomBlocks as m}from"@teacss/config";import{createContext as h}from"@teacss/runtime";import{fileURLToPath as g,pathToFileURL as _}from"node:url";import{channel as v,tracingChannel as y}from"node:diagnostics_channel";import{CompletionItemKind as b,DiagnosticSeverity as x}from"vscode-languageserver-types";import{colordx as S,extend as C}from"@colordx/core";import w from"@colordx/core/plugins/cmyk";import T from"@colordx/core/plugins/hwb";import E from"@colordx/core/plugins/lab";import ee from"@colordx/core/plugins/lch";import te from"@colordx/core/plugins/names";import ne from"@colordx/core/plugins/p3";import{DidChangeWatchedFilesNotification as D,ProposedFeatures as O,TextDocumentSyncKind as k,TextDocuments as re,WatchKind as ie,createConnection as ae}from"vscode-languageserver/node";import{TextDocument as oe}from"vscode-languageserver-textdocument";var A=a(import.meta.url);function se(e=void 0){if(e===void 0)return[];if(!Array.isArray(e))return[e];for(let t=0;t<e.length;t++){if(Object.hasOwn(e,t))continue;let n=[],r=0;for(let t=0;t<e.length;t++)Object.hasOwn(e,t)&&Object.defineProperty(n,r++,{configurable:!0,enumerable:!0,value:e[t],writable:!0});return n}return e}function ce(e){return Array.from(new Set(se(e)))}function le(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function ue(e,t){let n=e.length;n in e?le(e,n,t):e[n]=t}function de(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&&c===`\\`){s++;continue}if(t.length>0&&(c===`"`||c===`'`)){n=c;continue}if(t.length>0&&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),ue(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;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;ue(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 fe=`utilities`;Object.freeze({imports:-200,properties:-150,preflights:-100,shortcuts:-50,primitives:-10,[fe]:0});function j(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const pe=/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/;function M(e){return pe.test(e)}function me(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 he(){return{events:Object.create(null),emit(e,...t){let n=Object.hasOwn(this.events,e)?this.events[e]:void 0,r=se(Array.isArray(n)?n:[]).map(e=>e);for(let e of r)e(...t)},on(e,t){let n=this.events,r=Object.hasOwn(n,e)?n[e]:void 0,i=Array.isArray(r)?r:[];return Array.isArray(r)||me(n,e,i),Object.defineProperty(i,i.length,{configurable:!0,enumerable:!0,value:t,writable:!0}),()=>{let r=Object.hasOwn(n,e)?n[e]:void 0;me(n,e,se(Array.isArray(r)?r:[]).filter(e=>e!==t))}}}}const ge=/^\[(.+?)~?="(.*)"\]$/,_e=/[\w\u00A0-\uFFFF%-?]/;new RegExp(ge.source,ge.flags),new RegExp(_e.source,_e.flags);function ve(e){return e.match(ge)}function ye(e){return e!=null}const be=`@teacss-skip-start`,xe=`@teacss-skip-end`;RegExp(`(//\\s*?${be}\\s*?|\\/\\*\\s*?${be}\\s*?\\*\\/|<!--\\s*?${be}\\s*?-->)[\\s\\S]*?(//\\s*?${xe}\\s*?|\\/\\*\\s*?${xe}\\s*?\\*\\/|<!--\\s*?${xe}\\s*?-->)`,`g`);const Se=RegExp(`(//\\s*?${be}\\s*?|\\/\\*\\s*?${be}\\s*?\\*\\/|<!--\\s*?${be}\\s*?-->)[\\s\\S]*?(//\\s*?${xe}\\s*?|\\/\\*\\s*?${xe}\\s*?\\*\\/|<!--\\s*?${xe}\\s*?-->)`,`g`);function Ce(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}return e.length}function we(e){let t=[];for(let n=0;n<e.length;){let r=e[n];if(r===`"`||r===`'`||r==="`"){n=Ce(e,n,r);continue}if(e.startsWith(`{/*`,n)){let r=e.indexOf(`*/}`,n+3);t.push([n,r<0?e.length:r+3]),n=t[t.length-1][1];continue}if(e.startsWith(`<!--`,n)){let r=e.indexOf(`-->`,n+4);t.push([n,r<0?e.length:r+3]),n=t[t.length-1][1];continue}if(e.startsWith(`/*`,n)){let r=e.indexOf(`*/`,n+2);t.push([n,r<0?e.length:r+2]),n=t[t.length-1][1];continue}if(e.startsWith(`//`,n)){let r=e.slice(n+2).search(/[\n\r]/),i=r<0?e.length:n+2+r;t.push([n,i]),n=t[t.length-1][1];continue}n++}return t}const Te=[/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|`(?:\\[\s\S]|[^`\\])*`/g,/<[^/?<>0-9$_!"'](?:"[^"]*"|'[^']*'|[^>])+>/g,/(@apply|--at-apply)[^;]*;/g],Ee=[Se],De=/([\\:]?[\s"'`;<>]|:\(|\)"|\)\s)/g,Oe=/(?:[\w&:[\]-]|\[\S{1,64}=\S{1,64}\]){1,64}\[\\?['"]?\S{0,64}?['"]\]\]?[\w:@-]{0,64}/g,ke=/\[(\\\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 Ae(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 je(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 Me(e,t){let n=e.flags.includes(`g`)?e.flags:`${e.flags}g`;return t.matchAll(new RegExp(e.source,n))}function Ne(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 Pe(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 Fe(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 Ie(e){return e===void 0||/[\s'"`;<>]/.test(e)}function Le(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(!Ie(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&&Ie(e[n+1])&&r.push([t,n+1,i.value])}}return r}function Re(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 ze(e,t,n){if(!n)return[];let r=[],i=RegExp(`(^|[^\\w:-])${j(t)}\\s*=\\s*(['"])`,`g`);for(let t of e.matchAll(i)){let i=t.index+t[0].length-1,a=Re(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 Be(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 Ve(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 He(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 Ue(e,t,n){let r=Be(e,t);if(r<0)return null;let i=He(e.slice(t+1,r));if(!i.length)return null;let{suffix:a,end:o}=Ve(e,r+1);return i.every(e=>n.has(e)||n.has(`${e}${a}`))?[t,o,e.slice(t,o)]:null}function We(e,t,n=[],r={}){let i=[],a=[],o=new Set,s=new Set,c=[];if(r.excludeRanges&&(e=Ne(e,r.excludeRanges)),r.excludeRegex)for(let t of r.excludeRegex){let n=Array.from(Me(t,e),e=>[e.index,e.index+e[0].length]);e=Ne(e,n)}if(r.includeRegex)for(let t of r.includeRegex)for(let n of Me(t,e))c.push([n.index,n.index+n[0].length]);else c.push([0,e.length]);let l=Pe(c);Array.from(t).forEach(e=>{let t=ve(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(...Le(e,s));let u=0;e.split(De).forEach(e=>{let t=u+e.length;r.isPug?i.push(...je(e,o,u)):o.has(e)&&i.push([u,t,e]),u=t});for(let t of e.matchAll(Oe)){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(ke)){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 ze(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=Ue(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])=>Fe(l,e,t)).filter(([e,t,n])=>{let r=`${e}:${t}:${n}`;return f.has(r)?!1:(f.add(r),!0)}).sort((e,t)=>e[0]-t[0])}const Ge=[`@teacss/directives`,`@teacss/transformer-compile-class`];async function Ke(e,t,n=``,r={}){let i=new s(t),a={generator:e,tokens:new Set},o=e.config.transformers?.filter(e=>!Ge.includes(e.name)),c=[];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&&c.push(...e)}let{pug:l,code:u}=await Ae(e,i.toString(),n);return We(t,[...(await e.generate(l?u:i.toString(),{preflights:!1,safelist:!1})).matched],c,{isPug:l,...r})}function N(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 qe(e,t,n,r){let i=e.get(t);if(i)return N(e,t,i,n),i;let a;return a=r().catch(n=>{throw e.get(t)===a&&e.delete(t),n}),N(e,t,a,n),a}const Je=new Map;function Ye(e){Je.delete(e)}function Xe(){Je.clear()}function Ze(e,t,n,r=!1,i=!1){i&&Je.delete(n);let a=Je.get(n);if(a&&a.code===t&&a.config===e.config&&a.generator===e&&a.strictAnnotationMatch===r)return N(Je,n,a,100),a.result;let o=Ke(e,t,n,{excludeRanges:we(t),excludeRegex:Ee,...r?{includeRegex:Te}:null});return N(Je,n,{code:t,config:e.config,generator:e,strictAnnotationMatch:r,result:o},100),o}
|
|
2
|
+
/** @license
|
|
3
|
+
* fzf v0.5.2
|
|
4
|
+
* Copyright (c) 2021 Ajit
|
|
5
|
+
* Licensed under BSD 3-Clause
|
|
6
|
+
*/
|
|
7
|
+
const Qe={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&&(Qe[n]=e)}}const $e={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(let e of Object.keys($e)){let t=e.toUpperCase();for(let n=$e[e][0];n<=$e[e][1];++n)Qe[n]=n%2==0?t:e}function et(e){if(e<192||e>8580)return e;let t=Qe[e];return t===void 0?e:t.codePointAt(0)}function tt(e){return e}function nt(e){return e}function P(e,t){return e>t?e:t}const rt=e=>e.split(``).map(e=>e.codePointAt(0)),it=new Set(` \f
|
|
8
|
+
\r \v\xA0á\u2028\u2029â¯âãīģŋ`.split(``).map(e=>e.codePointAt(0)));for(let e=`â`.codePointAt(0);e<=`â`.codePointAt(0);e++)it.add(e);const at=``.codePointAt(0),ot=`A`.codePointAt(0),st=`Z`.codePointAt(0),ct=`a`.codePointAt(0),lt=`z`.codePointAt(0),ut=`0`.codePointAt(0),dt=`9`.codePointAt(0);function ft(e,t,n){return n?e:t-e-1}function pt(e){return e?new Set:null}function mt(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 ht(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 gt(e){return e>=ct&&e<=lt?1:e>=ot&&e<=st?2:e>=ut&&e<=dt?4:0}function _t(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 vt(e){return e<=at?gt(e):_t(e)}function yt(e,t){return e===0&&t!==0?8:e===1&&t===2||e!==4&&t===4?7:t===0?8:0}function bt(e,t){return t===0?8:yt(vt(e[t-1]),vt(e[t]))}function xt(e,t,n,r){let i=e.slice(r),a=i.indexOf(n);if(a===0)return r;if(!t&&n>=ct&&n<=lt){a>0&&(i=i.slice(0,a));let e=i.indexOf(n-32);e>=0&&(a=e)}return a<0?-1:r+a}function St(e){for(let t of e)if(t>=128)return!1;return!0}function Ct(e,t,n){if(!St(e))return 0;if(!St(t))return-1;let r=0,i=0;for(let a=0;a<t.length;a++){if(i=xt(e,n,t[a],i),i<0)return-1;a===0&&i>0&&(r=i-1),i++}return r}const wt=(e,t,n,r,i,a,o)=>{let s=i.length;if(s===0)return[{start:0,end:0,score:0},pt(a)];let c=r.length;if(o!==null&&c*s>o.i16.length)return Et(e,t,n,r,i,a);let l=Ct(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]=mt(u,o,c),[u,p]=mt(u,o,c),[u,m]=mt(u,o,c),[d,h]=ht(d,o,s);let[,g]=ht(d,o,c);for(let e=0;e<g.length;e++)g[e]=r[e];let _=tt(0),v=0,y=0,b=0,x=i[0],S=i[0],C=tt(0),w=0,T=!1,E=g.subarray(l),ee=f.subarray(l).subarray(0,E.length),te=p.subarray(l).subarray(0,E.length),ne=m.subarray(l).subarray(0,E.length);for(let[r,a]of E.entries()){let o=null;a<=at?(o=gt(a),!e&&o===2&&(a+=32)):(o=_t(a),!e&&o===2&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0)),t&&(a=et(a))),E[r]=a;let c=yt(w,o);if(ne[r]=c,w=o,a===S&&(y<s&&(h[y]=nt(l+r),y++,S=i[Math.min(y,s-1)]),b=l+r),a===x){let e=16+c*2;if(ee[r]=e,te[r]=1,s===1&&(n&&e>_||!n&&e>=_)&&(_=e,v=l+r,n&&c===8))break;T=!1}else T?ee[r]=P(C+-1,0):ee[r]=P(C+-3,0),te[r]=0,T=!0;C=ee[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 D=h[0],O=b-D+1,k=null;[u,k]=mt(u,o,O*s);{let e=f.subarray(D,b+1);for(let[t,n]of e.entries())k[t]=n}let[,re]=mt(u,o,O*s);{let e=p.subarray(D,b+1);for(let[t,n]of e.entries())re[t]=n}let ie=h.subarray(1),ae=i.slice(1).slice(0,ie.length);for(let[e,t]of ie.entries()){let r=!1,i=ae[e],a=e+1,o=a*O,c=g.subarray(t,b+1),l=m.subarray(t).subarray(0,c.length),u=re.subarray(o+t-D).subarray(0,c.length),d=re.subarray(o+t-D-1-O).subarray(0,c.length),f=k.subarray(o+t-D).subarray(0,c.length),p=k.subarray(o+t-D-1-O).subarray(0,c.length),h=k.subarray(o+t-D-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=P(t,P(4,m[c-b+1]))),g+t<y?(g+=l[e],b=0):g+=t}u[e]=b,r=g<y;let x=P(P(g,y),0);a===s-1&&(n&&x>_||!n&&x>=_)&&(_=x,v=c),f[e]=x}}let oe=pt(a),A=D;if(a&&oe!==null){let e=s-1;A=v;let t=!0;for(;;){let n=e*O,r=A-D,i=k[n+r],a=0,o=0;if(e>0&&A>=h[e]&&(a=k[n-O+r-1]),A>h[e]&&(o=k[n+r-1]),i>a&&(i>o||i===o&&t)){if(oe.add(A),e===0)break;e--}t=re[n+r]>1||n+O+r+1<re.length&&re[n+O+r+1]>0,A--}}return[{start:A,end:v+1,score:_},oe]};function Tt(e,t,n,r,i,a,o){let s=0,c=0,l=!1,u=0,d=tt(0),f=pt(o),p=0;i>0&&(p=vt(n[i-1]));for(let m=i;m<a;m++){let i=n[m],a=vt(i);if(e||(i>=ot&&i<=st?i+=32:i>at&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),t&&(i=et(i)),i===r[s]){o&&f!==null&&f.add(m),c+=16;let e=yt(p,a);u===0?d=e:(e===8&&(d=e),e=P(P(e,d),4)),s===0?c+=e*2:c+=e,l=!1,u++,s++}else l?c+=-1:c+=-3,l=!0,u=0,d=0;p=a}return[c,f]}const Et=(e,t,n,r,i,a,o)=>{if(i.length===0)return[{start:0,end:0,score:0},null];if(Ct(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[ft(a,u,n)];e||(o>=ot&&o<=st?o+=32:o>at&&(o=String.fromCodePoint(o).toLowerCase().codePointAt(0))),t&&(o=et(o));let f=i[ft(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[ft(t,u,n)];e||(a>=ot&&a<=st?a+=32:a>at&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0)));let o=i[ft(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]=Tt(e,t,r,i,c,l,a);return[{start:c,end:l,score:o},f]}return[{start:-1,end:-1,score:0},null]},Dt=(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||Ct(r,i,e)<0)return[{start:-1,end:-1,score:0},null];let l=0,u=-1,d=tt(0),f=tt(-1);for(let a=0;a<s;a++){let o=ft(a,s,n),p=r[o];e||(p>=ot&&p<=st?p+=32:p>at&&(p=String.fromCodePoint(p).toLowerCase().codePointAt(0))),t&&(p=et(p));let m=ft(l,c,n);if(i[m]===p){if(m===0&&(d=bt(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]=Tt(e,t,r,i,a,o,!1);return[{start:a,end:o,score:l},null]}return[{start:-1,end:-1,score:0},null]};function Ot(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}const kt=Ot(102400,2048),At=(e,t,n)=>{let r=!1;switch(t){case`smart-case`:e.toLowerCase()!==e&&(r=!0);break;case`case-sensitive`:r=!0;break;case`case-insensitive`:e=e.toLowerCase(),r=!1;break}let i=rt(e);return n&&(i=i.map(et)),{queryRunes:i,caseSensitive:r}};function jt(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 Mt(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,kt);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 Nt(e){let{queryRunes:t,caseSensitive:n}=At(e,this.opts.casing,this.opts.normalize),r={},i=Mt.bind(this)(r,t,n);for(let e=0,t=this.runesList.length;e<t;++e)i(e);return jt(r,this.opts.limit)}const Pt={limit:1/0,selector:e=>e,casing:`smart-case`,normalize:!0,fuzzy:`v2`,tiebreakers:[],sort:!0,forward:!0};var Ft=class{constructor(e,...t){switch(this.opts={...Pt,...t[0]},this.items=e,this.runesList=e.map(e=>rt(this.opts.selector(e).normalize())),this.algoFn=Dt,this.opts.fuzzy){case`v2`:this.algoFn=wt;break;case`v1`:this.algoFn=Et;break}}};const It={...Pt,match:Nt};var Lt=class extends Ft{constructor(e,...t){super(e,...t),this.opts={...It,...t[0]}}find(e){return e.length===0||this.items.length===0?this.items.slice(0,this.opts.limit).map(Rt):(e=e.normalize(),zt(this.opts.match.bind(this)(e),this.opts))}};({...Pt});const Rt=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function zt(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 Bt(e,t,n){return n(e.item).length-n(t.item).length}function Vt(e,t){return e.start-t.start}var Ht=class{constructor(e,...t){this.finder=new Lt(e,...t),this.find=this.finder.find.bind(this.finder)}},F=v(`lru-cache:metrics`),Ut=y(`lru-cache`),Wt=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date,Gt=()=>F.hasSubscribers||Ut.hasSubscribers,Kt=new Set,qt=typeof process==`object`&&process?process:{},Jt=(e,t,n,r)=>{typeof qt.emitWarning==`function`?qt.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},Yt=e=>!Kt.has(e),I=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),Xt=e=>I(e)?e<=2**8?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?Zt:null:null,Zt=class extends Array{constructor(e){super(e),this.fill(0)}},Qt=class e{heap;length;static#e=!1;static create(t){let n=Xt(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]}},$t=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??Wt,n!==0&&!I(n))throw TypeError(`max option must be a nonnegative integer`);let E=n?Xt(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.#_=Qt.create(n),this.#c=0,this.#l=0,typeof l==`function`&&(this.#n=l),typeof u==`function`&&(this.#r=u),typeof d==`function`?(this.#i=d,this.#v=[]):(this.#i=void 0,this.#v=void 0),this.#C=!!this.#n,this.#E=!!this.#r,this.#T=!!this.#i,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!C,this.maxEntrySize!==0){if(this.#t!==0&&!I(this.#t))throw TypeError(`maxSize must be a positive integer if specified`);if(!I(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);this.#M()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!s,this.ttlResolution=I(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!I(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);this.#D()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t=`LRU_CACHE_UNBOUNDED`;Yt(t)&&(Kt.add(t),Jt(`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 Zt(this.#e),t=new Zt(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 Zt(this.#e);this.#l=0,this.#y=e,this.#N=t=>{this.#l-=e[t],e[t]=0},this.#F=(e,t,n,r)=>{if(!I(n)){if(this.#W(t))return this.backgroundFetchSize;if(r){if(typeof r!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=r(t,e),!I(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}else throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`)}return n},this.#P=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#l>n;)this.#B(!0)}this.#l+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#l)}}#N=e=>{};#P=(e,t,n)=>{};#F=(e,t,n,r)=>{if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`);return 0};*#I({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;this.#R(t)&&((e||!this.#j(t))&&(yield t),t!==this.#h);)t=this.#m[t]}*#L({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#h;this.#R(t)&&((e||!this.#j(t))&&(yield t),t!==this.#g);)t=this.#p[t]}#R(e){return e!==void 0&&this.#u.get(this.#d[e])===e}*entries(){for(let e of this.#I())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#W(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*rentries(){for(let e of this.#L())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#W(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*keys(){for(let e of this.#I()){let t=this.#d[e];t!==void 0&&!this.#W(this.#f[e])&&(yield t)}}*rkeys(){for(let e of this.#L()){let t=this.#d[e];t!==void 0&&!this.#W(this.#f[e])&&(yield t)}}*values(){for(let e of this.#I())this.#f[e]!==void 0&&!this.#W(this.#f[e])&&(yield this.#f[e])}*rvalues(){for(let e of this.#L())this.#f[e]!==void 0&&!this.#W(this.#f[e])&&(yield this.#f[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]=`LRUCache`;find(e,t={}){for(let n of this.#I()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;if(i!==void 0&&e(i,this.#d[n],this))return this.#J(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#I()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#L()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#L({allowStale:!0}))this.#j(t)&&(this.#Z(this.#d[t],`expire`),e=!0);return e}info(e){let t=this.#u.get(e);if(t===void 0)return;let n=this.#f[t],r=this.#W(n)?n.__staleWhileFetching:n;if(r===void 0)return;let i={value:r};if(this.#x&&this.#b){let e=this.#x[t],n=this.#b[t];e&&n&&(i.ttl=e-(this.#s.now()-n),i.start=Date.now())}return this.#y&&(i.size=this.#y[t]),i}dump(){let e=[];for(let t of this.#I({allowStale:!0})){let n=this.#d[t],r=this.#f[t],i=this.#W(r)?r.__staleWhileFetching:r;if(i===void 0||n===void 0)continue;let a={value:i};if(this.#x&&this.#b){a.ttl=this.#x[t];let e=this.#s.now()-this.#b[t];a.start=Math.floor(Date.now()-e)}this.#y&&(a.size=this.#y[t]),e.unshift([n,a])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=this.#s.now()-e}this.#z(t,n.value,n)}}set(e,t,n={}){let{status:r=F.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&&F.hasSubscribers&&F.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=F.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`has`,n.key=e,n.cache=this);let r=this.#V(e,t);return F.hasSubscribers&&F.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=Gt()?{}:void 0}=t;n&&(n.op=`peek`,n.key=e,n.cache=this),t.status=n;let r=this.#H(e,t);return F.hasSubscribers&&F.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=Ut.hasSubscribers,{status:r=Gt()?{}: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,Ut.tracePromise(()=>i,r).catch(()=>{})),i}async#G(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:m,forceRefresh:h=!1,status:g,signal:_}=t;if(g&&(g.op=`fetch`,g.key=e,h&&(g.forceRefresh=!0),g.cache=this),!this.#w)return g&&(g.fetch=`get`),this.#J(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:g});let v={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:a,noDisposeOnSet:o,size:s,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:p,ignoreFetchAbort:f,status:g,signal:_},y=this.#u.get(e);if(y===void 0){g&&(g.fetch=`miss`);let t=this.#U(e,y,v,m);return t.__returned=t}else{let t=this.#f[y];if(this.#W(t)){let e=n&&t.__staleWhileFetching!==void 0;return g&&(g.fetch=`inflight`,e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#j(y);if(!h&&!i)return g&&(g.fetch=`hit`),this.#X(y),r&&this.#O(y),g&&this.#k(g,y),t;let a=this.#U(e,y,v,m),o=a.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=i?`stale`:`refresh`,o&&i&&(g.returnedStale=!0)),o?a.__staleWhileFetching:a.__returned=a}}forceFetch(e,t={}){let n=Ut.hasSubscribers,{status:r=Gt()?{}: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,Ut.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=F.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),F.hasSubscribers&&F.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=F.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),F.hasSubscribers&&F.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){F.hasSubscribers&&F.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)}}},en=`@teacss/autocomplete`;const tn=2e6,nn=5e4,rn=4096,an=1e3,on=5e7,sn=1e5,cn=new Map(Array.from(`ÃÃÃÃÃÃ
ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ ÃĄÃĸÃŖÃ¤ÃĨçèÊÃĒÃĢÃŦÃÃŽÃ¯ÃąÃ˛ÃŗÃ´ÃĩÃļøÚÃēÃģÃŧÃŊÃŋÄÄÄÄÄÄ
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄĄÄĸĪĤÄĨħĨĊÄĒÄĢÄŦÄÄŽÄ¯Ä°ÄąÄ´ÄĩÄļġĚÄēÄģÄŧÄŊÄžÅÅÅÅÅ
ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅĄÅĸŪŤÅĨŧŨŊÅĒÅĢÅŦÅÅŽÅ¯Å°ÅąÅ˛ÅŗÅ´ÅĩÅļÅˇÅ¸ÅšÅēÅģÅŧÅŊÅžÅŋÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆ ÆĄÆĨÆĢÆÆŽÆ¯Æ°Æ˛Æ´ÆļĮĮĮĮĮĮĮĮĮĮĮĮĨĮĻĮ§Į¨ĮŠĮĒĮĢĮ°Į´ĮĩĮ¸ĮšČČČČČČ
ČČČČČČČČČČČČČČČČČČČČČČČČČ ČĄČĨČĻČ§Č¨ČŠČŽČ¯Č˛ČŗČ´ČĩČļȡČēČģČŧČŊČžČŋÉÉÉÉ
ÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉ ÉĄÉĸÉĨÉĻɨÉĒÉĢÉŦÉÉ¯É°ÉąÉ˛ÉŗÉ´ÉĩÉšÉēÉģÉŧÉŊÉžÉŋĘĘĘĘĘĘĘĘĘĘĘĘĘĘĘĘĘĘĘĘĘĘ ĘŽÍŖÍ¤ÍĨÍĻͧͨ͊ÍĒÍĢÍŦÍ͎ͯá´á´á´á´
á´á´á´á´á´á´á´á´á´á´á´á´á´á´á´á´á´á´á´á´á´á´á´á´ á´Ąá´ĸáĩĸáĩŖáĩ¤áĩĨá¸á¸á¸á¸á¸á¸
á¸á¸á¸á¸á¸á¸á¸á¸á¸á¸á¸á¸á¸á¸á¸á¸á¸á¸á¸ ḥá¸ĸá¸Ŗá¸¤á¸Ĩá¸ĻḧḨḊá¸Ēá¸Ģá¸Ŧá¸á¸Žá¸¯á¸°á¸ąá¸˛á¸ŗá¸´á¸ĩá¸ļḡá¸ēá¸ģá¸ŧá¸ŊḞá¸ŋášášášášášáš
ášášášášášášášášášášášášášášášášáš ᚥášĸášŖášĒášĢášŦášášŽáš¯áš°ášąáš˛ášŗáš´ášĩášļᚡášŧášŊášžášŋáēáēáēáēáēáē
áēáēáēáēáēáēáēáēáēáēáēáēáēáēáēáēáēáēáēáēáēáēáē áēĄáēĸáēŖáē¤áēĨáēĻáē§áē¨áēŠáēĒáēĢáēŦáēáēŽáē¯áē°áēąáē˛áēŗáē´áēĩáēļáēˇáē¸áēšáēēáēģáēŧáēŊáēžáēŋáģáģáģáģáģáģ
áģáģáģáģáģáģáģáģáģáģáģáģáģáģáģáģáģáģáģáģáģáģáģáģáģáģáģ áģĄáģĸáģŖáģ¤áģĨáģĻáģ§áģ¨áģŠáģĒáģĢáģŦáģáģŽáģ¯áģ°áģąáģ˛áģŗáģ´áģĩáģļáģˇáģ¸áģšâąâââââââââ`,(e,t)=>[e,`AAAAAACEEEEIIIINOOOOOOUUUUYsaaaaaaceeeeiiiinoooooouuuuyyAaAaAaCcCcCcCcDddEeEeEeEeEeGgGgGgGgHhhIiIiIiIiIiJjKkLlLlLlllNnNnNnOoOoOoRrRrRrSsSsSsSsTtTttUuUuUuUuUuUuWwYyYZzZzZzsbBbOcDDdEEfGIklMNnOOopttTUuVyzAaIiOoUuUuegGgKkOojGgNnAaAaEeEeIiIiOoOoRrRrUuUuSsTtHhNdzAaEeOoYylntjACcLTszBUVEeJjQqRrYyaabocddeeeeejggGhhiIlllmmmnnNorrrrrrrRRsttuvvwyYzzcBeGHjkLqhaeioucdhmrtvxABCDEeiJKLMNOOoooooPRRTUuumVWZiruvAaBbBbBbDdDdDdDdDdEeEeFfGgHhHhHhHhHhIiIiKkKkKkLlLlLlMmMmMmNnNnNnNnPpPpRrRrRrSsSsTtTtTtTtUuUuUuVvVvWwWwWwWwWwXxXxYyZzZzZzhtwyasAaAaAaAaAaAaAaAaAaAaAaAaEeEeEeEeEeEeEeEeIiIiOoOoOoOoOoOoOoOoOoOoOoOoUuUuUuUuUuUuUuYyYyYyYyihklmnpstc`[t]])),L={maxAttempts:nn,maxCandidateLength:rn,maxCandidates:5e4,maxCharacters:tn,maxScans:sn,maxScannedCharacters:5e7},ln={...L,maxCandidateLength:tn,maxCandidates:an};function un(){return{suggestions:[],attempts:0,candidates:0,characters:0,scans:0,truncated:!1}}const dn=new WeakMap,fn=new WeakMap;function pn(e,t,n){let r=dn.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 mn(e,t,n){let r=fn.get(e);return r?r(t,n):pn(e,t,n)}var hn=class extends Error{template;constructor(e,t){super(e),this.template=t,this.name=en,this.template=t}toString(){return`â ī¸ [${this.name}]: ${this.message}. ${this.template?`Template: ${this.template}.`:``}`}};const gn={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(`|`)})`},_n=[`DEFAULT`];function vn(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)}function yn(e,t={},n={}){let r=[],i=[],a={...gn,...n};e=e.replace(/<([\w-]+)>/g,(e,t,n,r)=>Object.hasOwn(a,t)?a[t]:(i.push(new hn(`Unknown template shorthand: <${t}>`,r)),e)),c(e),i.length&&(r.length=0);let o={parts:r,suggest:l,errors:i};return dn.set(o,d),fn.set(o,u),o;function s(e){vn(e,/\$([\w.|-]+)/g,e=>{r.push({type:`theme`,objects:e[1].split(`|`).map(n=>n.split(`.`).reduce((t,n)=>!n||typeof t!=`object`||!t||!Object.hasOwn(t,n)||!t[n]?(i.push(new hn(`Invalid theme key: ${n}`,e.input)),{}):t[n],t))})},e=>{r.push({type:`static`,value:e})})}function c(e){vn(e,/\((.*?)\)/g,e=>{if(!e[1].includes(`|`)){r.push({type:`static`,value:e[0]});return}r.push({type:`group`,values:e[1].split(`|`)})},e=>{s(e)})}function l(e,t=`prefix`){if(e.length>1&&t===`fuzzy`){let t=e!==e.toLowerCase(),n=B(e,t),i=d(e,{maxCandidates:an}).suggestions.filter(e=>En(n,B(e,t),e,0));if(n.length>rn)return i;let a=lr(r,{},e).candidates;if(i.length){let e=new Set(i);if(a.every(t=>e.has(t)))return i}if(Tn(e,a.reduce((e,t)=>e+t.length,0))){let t=Cn(a,e),n=t.filter(t=>jn(t,e));return n.length?ir(n,[...i,...t]):ir(i,t)}return ir(i,new Ht(a,{fuzzy:`v1`,limit:an}).find(e).map(e=>e.item))}return u(e).suggestions}function u(e,t={}){let n={...ln,...t},i=R(e);if(i.length>n.maxCandidateLength)return un();let a=bn(r);if(a){let t=xn(r,0,a.index);if(!Hn(t,e)&&!Hn(R(t),i))return un();let o=xn(r,a.index+1,r.length);return Un(a.part,t,o,e,a.suppressPartialRoots,n)}let o=Sn(r);return o&&!Hn(o,e)&&!Hn(R(o),R(e))?un():Nn(r,e,n)}function d(e,t={}){let n={...L,...t},i=u(e,n),a=Sn(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 bn(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 xn(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 Sn(e){let t=e.findIndex(e=>e.type!==`static`);return xn(e,0,t<0?e.length:t)}function R(e){return e.replace(/-/g,``)}function Cn(e,t){return z(e,t)}function z(e,t,n={}){let r={...L,maxCandidates:an,...n};if(!t)return wn(e,r);let i=t!==t.toLowerCase(),a=B(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=En(a,B(t,i),t,n);d&&Dn(o,d,r.maxCandidates,r.maxCharacters)}return o.items.sort(An).map(({candidate:e})=>e)}function wn(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 Tn(e,t){return e.length*t>on}function En(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 Dn(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,On(e.items,e.items.length-1)):e.items.length&&An(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),kn(e.items,0)))}function On(e,t){for(;t>0;){let n=t-1>>>1;if(An(e[t],e[n])<=0)return;[e[n],e[t]]=[e[t],e[n]],t=n}}function kn(e,t){for(;;){let n=t*2+1;if(n>=e.length)return;let r=n+1,i=n;if(r<e.length&&An(e[r],e[n])>0&&(i=r),An(e[i],e[t])<=0)return;[e[t],e[i]]=[e[i],e[t]],t=i}}function An(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 jn(e,t){let n=t!==t.toLowerCase();return B(e,n)===B(t,n)}function B(e,t){let n=e.normalize(),r=Mn(n)?n:Array.from(n,e=>cn.get(e)??e).join(``);return t?r:r.toLowerCase()}function Mn(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>127)return!1;return!0}function Nn(e,t,n={}){let r={...L,...n};if(r.maxAttempts<=0||r.maxCandidates<=0||r.maxCharacters<=0)return un();let i=R(t),a=Pn(),o=Pn(),s=r.maxCandidates,c=Kn(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&&Fn(a,e,m,s,r),c&&Fn(o,e,m,s,r))}_--;continue}if(g>=r.maxAttempts)break;let n=l[_];n||(n={choiceIndex:0,iterator:ar(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:Vn(t,f[_],b,!1),C=p[_]<0?-1:Vn(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)=>Bn(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 Pn(){return{characters:0,entries:[],indices:new Map}}function Fn(e,t,n,r,i){let a=e.indices.get(t);if(a!==void 0){let t=e.entries[a];Bn(n,t.path)<0&&(t.path=n.slice(),Rn(e,a));return}if(r<=0||t.length>i.maxCharacters)return;let o={candidate:t,path:n.slice()};if(e.entries.length>=r){if(Bn(o.path,e.entries[0].path)>=0)return;In(e)}for(;e.entries.length&&e.characters+t.length>i.maxCharacters;){if(Bn(o.path,e.entries[0].path)>=0)return;In(e)}e.characters+t.length>i.maxCharacters||(e.indices.set(t,e.entries.length),e.entries.push(o),e.characters+=t.length,Ln(e,e.entries.length-1))}function In(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),Rn(e,0))}function Ln(e,t){for(;t>0;){let n=t-1>>>1;if(Bn(e.entries[t].path,e.entries[n].path)<=0)return;zn(e,n,t),t=n}}function Rn(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&&Bn(e.entries[r].path,e.entries[n].path)>0&&(i=r),Bn(e.entries[i].path,e.entries[t].path)<=0)return;zn(e,i,t),t=i}}function zn(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 Bn(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 Vn(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 Hn(e,t){return e.length<=t.length?t.startsWith(e):e.startsWith(t)}function Un(e,t,n,r,i,a){let o={...L,...a};if(t.length+1>o.maxCandidateLength)return un();let s=Kn(o.maxScans),c=Yn(e.objects,s),l=Xn(r,!1,o),u=Xn(R(r),!0,o);Wn(c,t,n,o.maxCandidateLength,i,l,u,s);let d=Qn(l,s);if(d.suggestions.length||!d.exhausted)return d;let f=Qn(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 Wn(e,t,n,r,i,a,o,s){for(let c of e){let e=t+c.key,l=$n(e,a.input,!1),u=$n(e,o.input,!0);if(l===`none`&&u===`none`)continue;let d=tr(c.objects,e,n,a.input,o.input,r),f=l===`partial`||u===`partial`?nr(d,s):void 0,p=f!==void 0;if(er(a,l,c.hasLeaf,p,e,n,i),er(o,u,c.hasLeaf,p,e,n,i),a.blocked)return;for(f??=nr(d,s);f;){if((l===`reached`||i&&l===`partial`)&&Zn(a,f.candidate,f.rawMatch),(u===`reached`||i&&u===`partial`)&&Zn(o,f.candidate,f.normalizedMatch),a.blocked)return;f=nr(d,s)}if(s.truncated||a.blocked)return}}function Gn(e){return!!e&&e[0]!==`_`&&!_n.includes(e)}function Kn(e=sn){let t=Math.max(0,e);return{initial:t,remaining:t,truncated:!1}}function qn(e){return e.remaining<=0?(e.truncated=!0,!1):(e.remaining--,!0)}function*Jn(e){yield*Object.keys(e)}function Yn(e,t){let n=new Map;outer:for(let r of e)for(let e of Jn(r)){if(!qn(t))break outer;if(!Gn(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 Xn(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 Zn(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 Qn(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 $n(e,t,n){let r=n?R(e):e;return t.startsWith(r)?`reached`:r.startsWith(t)?`partial`:`none`}function er(e,t,n,r,i,a,o){if(t===`none`)return;if(t===`partial`&&r){(n||!o)&&Zn(e,i,!0);return}if(!n)return;let s=i+a;Zn(e,s,(e.normalize?R(s):s).startsWith(e.input))}function tr(e,t,n,r,i,a){return{base:t,fragments:[],frames:[],maxCandidateLength:a,normalizedInput:i,normalizedMatchedLength:Vn(i,0,t,!0),objectIndex:0,objects:e,rawInput:r,rawMatchedLength:Vn(r,0,t,!1),staticSuffix:n}}function nr(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:Jn(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(!qn(t))return;let i=r.value;if(!Gn(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:Vn(e.rawInput,n.rawMatchedLength,s,!1),l=n.normalizedMatchedLength<0?-1:Vn(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:Jn(u),normalizedMatchedLength:l,object:u,rawMatchedLength:c,valueLength:o}),!(!u||Object.hasOwn(u,`DEFAULT`)&&u.DEFAULT!==null&&u.DEFAULT!==void 0))continue;let d=rr(e.rawInput,c,e.staticSuffix,!1),f=rr(e.normalizedInput,l,e.staticSuffix,!0);if(!(!d&&!f))return{candidate:`${e.base}-${e.fragments.join(`-`)}${e.staticSuffix}`,normalizedMatch:f,rawMatch:d}}}function rr(e,t,n,r){return t<0?!1:Vn(e,t,n,r)>=e.length}function ir(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>rn)){if(i+a.length>tn)return;r.add(a),n.push(a),i+=a.length}}};return a(e,t.length?750:an),a(t,an),a(e,an),n}function*ar(e,t,n){e.type===`theme`?yield*sr(e.objects,t,n):yield*or(e,t,n)}function*or(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(!qn(n))return;r.length<=t&&(yield r)}}function*sr(e,t,n){let r=[];for(let i of e){r.length=0;let e=[{depth:0,iterator:Jn(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(!qn(n))return;let o=a.value;if(!Gn(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:Jn(l),object:l,valueLength:c}),(!l||Object.hasOwn(l,`DEFAULT`)&&l.DEFAULT!==null&&l.DEFAULT!==void 0)&&(yield r.join(`-`))}}}function cr(e,t){let n=Kn(t.maxScans),r=e.map(e=>({done:!1,iterator:ar(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 lr(e,t={},n=``){let r={...L,...t},i=cr(e,r),a=i.values,o=i.scans,s,c=()=>{if(s===void 0){let t=ur(a,n,r);s=t?{combination:t,scans:0}:dr(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=pr(r),n={remaining:r.maxAttempts};return V(t,n,0)&&H(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=pr(r),n={remaining:r.maxAttempts};return V(t,n,0)&&H(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=pr(r);return vr(e,a,u,p),{candidates:[...e.candidates],truncated:!1,attempts:r.maxAttempts-p.remaining,scans:o}}let m=pr(r),h=a.map(e=>e[0]),g=a.flatMap((e,t)=>e.length>1?[t]:[]),_=c().combination;_&&V(m,p,0)&&H(m,_),V(m,p,0)&&H(m,h);let v=Math.min(nn,Math.max(0,p.remaining));return e.length&&v>on/e.length?{candidates:[...m.candidates],truncated:!0,attempts:r.maxAttempts-p.remaining,scans:o}:(mr(m,a,h,g,p),gr(m,a,h,g,p),hr(m,a,h,g,p),_r(m,a,h,g,p),vr(m,a,r.maxAttempts,p,!0),{candidates:[...m.candidates],truncated:!0,attempts:r.maxAttempts-p.remaining,scans:o})}function ur(e,t,n){if(!t||e.some(e=>!e.length))return;let r=t!==t.toLowerCase(),i=B(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=fr(i,l,B(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(En(i,B(u,r),u,0))return s}function dr(e,t,n,r){let i=Kn(r),a=e=>({combination:e,scans:i.initial-i.remaining});if(!t)return a();let o=t!==t.toLowerCase(),s=B(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 ar(t,c,i)){if(n.has(r))continue;n.add(r);let t={normalized:B(r,o),raw:r};for(let n of l){if(d++,u+=t.normalized.length,d>nn||u>on)return a();let r=n.characters+t.raw.length;if(r>c)continue;let i=fr(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 En(s,B(h,o),h,0)?a(p):a()}function fr(e,t,n){for(let r=0;r<n.length&&t<e.length;r++)n[r]===e[t]&&t++;return t}function pr(e){return{candidates:new Set,characters:0,maxCandidateLength:e.maxCandidateLength,maxCandidates:e.maxCandidates,maxCharacters:e.maxCharacters}}function V(e,t,n){return n>=nn||t.remaining<=0||e.candidates.size>=e.maxCandidates||e.characters>=e.maxCharacters?!1:(t.remaining--,!0)}function mr(e,t,n,r,i){let a=0;for(let o of r){if(!V(e,i,a))return;a++;let r=n.slice();r[o]=t[o].at(-1),H(e,r)}}function hr(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(!V(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),H(e,u)}}function gr(e,t,n,r,i){let a=0;for(let o of r)for(let r=1;r<t[o].length-1;r++){if(!V(e,i,a))return;a++;let s=n.slice();s[o]=t[o][r],H(e,s)}}function _r(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(!V(e,i,a))return;a++;let s=n.slice();s[c]=t[c][r],s[l]=t[l][o],H(e,s)}}}function vr(e,t,n,r,i=!1){if(!t.length){V(e,r,0)&&H(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,nn);for(let n=0;n<c;n++){if(!V(e,r,n))return;if(H(e,t.map((e,t)=>e[a[t]])),!s())break}}function H(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 yr(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=Or(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 br=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(` `)),xr=new Set(`=([{,:;!?&|>~`);function Sr(e){return e>=65&&e<=90||e>=97&&e<=122}function Cr(e){return Sr(e)||e===95}function wr(e){return Cr(e)||e>=48&&e<=57||e===36||e===45||e===46||e===58}function Tr(e,t,n){let r=t-n.length;return r<0||e.slice(r,t)!==n?!1:r===0||!wr(e.charCodeAt(r-1))}function Er(e,t,n,r){if(br.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||xr.has(e.charAt(i))?!0:Tr(e,i+1,`return`)}function Dr(e){let t,n=!1,r,i=0;for(;i<e.length;){if(t){let a=e.charAt(i);r?a===`\\`?i++:a===r&&(r=void 0):a===`"`||a===`'`?r=a:a===`>`&&(t=void 0,n=!0),i++;continue}if(e.charAt(i)===`;`&&(n=!1),e.charCodeAt(i)!==60){i++;continue}let a=i++;if(!Cr(e.charCodeAt(i)))continue;let o=i;for(;i<e.length&&wr(e.charCodeAt(i));)i++;if(i<e.length&&!/[\s/>]/.test(e.charAt(i)))continue;let s=e.slice(o,i);Er(e,a,s,n)&&(t={name:s,start:a})}return t}function Or(e,t){let n=e.substring(0,t),r=Dr(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 kr(e,t){return Or(e,t)?.key}const U=1e3,Ar=6e5,jr=5e7,Mr=6e4,Nr=3e5,Pr=5e4,Fr=2e5,Ir=5e3,W={...L,maxAttempts:15e3,maxCandidates:15e3,maxCharacters:6e5,maxScans:3e5};function Lr(){return{active:0,waiters:[]}}function Rr(e){return e>=48&&e<=57}function zr(e){for(let t=0;t<e.length;t++)if(Rr(e.charCodeAt(t)))return!0;return!1}function Br(e,t){let n=0,r=0;for(;n<e.length&&r<t.length;){let i=e.charCodeAt(n),a=t.charCodeAt(r),o=Rr(i),s=Rr(a);if(o&&s){let i=n+1,a=r+1;for(;i<e.length&&Rr(e.charCodeAt(i));)i++;for(;a<t.length&&Rr(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 Vr(e,t){let n=zr(e);return n===zr(t)?Br(e,t)||(e===t?0:e<t?-1:1):n?1:-1}function Hr(e,t=Nr,n=jr){return{attempts:0,heap:[],limit:e,maxAttempts:t,maxScannedCharacters:n,retained:new Set,scannedCharacters:0}}function Ur(e){return e.attempts<e.maxAttempts&&e.scannedCharacters<e.maxScannedCharacters}function Wr(e,t){return Ur(e)?(e.attempts++,!t||e.retained.has(t)||t.length>Mr||t.length>e.maxScannedCharacters-e.scannedCharacters?!0:(e.scannedCharacters+=t.length,Gr(e,t),!0)):!1}function Gr(e,t){if(!(!t||e.retained.has(t)||t.length>Mr)){if(e.heap.length<e.limit){e.heap.push(t),e.retained.add(t),Kr(e.heap,e.heap.length-1);return}Vr(t,e.heap[0])>=0||(e.retained.delete(e.heap[0]),e.heap[0]=t,e.retained.add(t),qr(e.heap,0))}}function Kr(e,t){let n=t;for(;n>0;){let t=Math.floor((n-1)/2);if(Vr(e[t],e[n])>=0)return;[e[t],e[n]]=[e[n],e[t]],n=t}}function qr(e,t){let n=t;for(;;){let t=n*2+1;if(t>=e.length)return;let r=t+1,i=r<e.length&&Vr(e[r],e[t])>0?r:t;if(Vr(e[n],e[i])>=0)return;[e[n],e[i]]=[e[i],e[n]],n=i}}function Jr(e){let t=[],n=0;for(let r of e.heap.sort(Vr))n+r.length>Ar||(t.push(r),n+=r.length);return t}function Yr(e,t,n,r){return Math.floor((t+n)*e/r)-Math.floor(t*e/r)}function*Xr(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*Zr(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 Qr(e){let t=``;for(let n of e.parts){if(n.type!==`static`)break;t+=n.value}return t}function $r(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=Qr(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 ei(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 ti(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 ni(e,t=U){let n=Hr(t);for(let t of e)if(!Wr(n,t))break;return Jr(n)}function ri(e,t){let n=[],r=new Set,i=0,a=0;for(let o of e)if(o.startsWith(t)){if(i===Nr||n.length===U||a>=Ar)break;i++,!(!o||r.has(o)||o.length>Mr||a+o.length>Ar)&&(r.add(o),n.push(o),a+=o.length)}return n}function ii(e,t={}){let n=new Map,r=new $t({max:Ir,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,_=Lr(),{matchType:v=`prefix`,throwErrors:y=!0}=t;return de(),{suggest:S,suggestInFile:w,templates:m,cache:r,errorCache:i,reset:de,enumerate:b};async function b(){let e=Array.from(`abcdefghijklmnopqrstuvwxyz`),t=[...e,`-`],n=e.flatMap(e=>[e,...t.map(t=>`${e}${t}`)]);for(;;){fe();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 pe(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(fe(),!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(;;){fe();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 pe(e.matchVariants(l),i,s);if(u.stale)continue;let d=await pe(Promise.all(u.value.map(async([,e])=>{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),ne(e,i,s),te(e),ee(e)]:[E(e,i,s),ee(e),te(e),ne(e,i,s)];return M(await Promise.all(o),r,a)})),i,s);if(d.stale)continue;let f=d.value.flat();if(f=v===`fuzzy`?ae(z(f,t,{maxCandidates:W.maxCandidates,maxCharacters:W.maxCharacters}),t):ni(f),!j(i,s))return r.set(t,f),f}}async function w(e,t){fe();let n=a,r=o,i=kr(e,t)!==void 0,s=await pe(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(j(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=yr(e,t,n.presets.some(e=>e.name===`@teacss/preset-attributify`));if(!l)return;let u=await S(l.content,i);return j(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&&!j(n,r)&&(p.delete(t),p.add(t),p.size>Ir&&p.delete(p.values().next().value)),i?[t]:[]}async function ee(e){if(v===`fuzzy`){let t=oe(),n=ae(u,e,t,d),r=z(A(),e,{maxAttempts:Nr,maxCandidates:750,maxCharacters:6e4});return z([...n,...r],e,{maxCandidates:U,maxCharacters:W.maxCharacters})}return c??=[...s].sort(Vr),ri(c,e)}async function te(t){return ni(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 ne(e,t,n){let r=m.filter(e=>typeof e==`function`);if(v!==`fuzzy`){let i=le(e),a=await D(r,e,t,n);return[...i,...a]}let i=ue(e),a=await O(r,e,t,n);return[...i,...a]}async function D(e,t,n,r){if(!e.length)return[];let i=Hr(U),a=Hr(U);for(let o=0;o<e.length;o+=8){let s=await ti(e.slice(o,o+8),8,e=>k(e,t,n,r));if(j(n,r))return[];let c=Yr(Nr,o,s.length,e.length),l=Yr(jr,o,s.length,e.length),u=Hr(U,c,l),d=Xr(s.filter(e=>!!e?.length));for(;Ur(u);){let e=d.next();if(e.done)break;Wr(u,e.value)}for(let e of Jr(u))Gr(i,e);let f=Hr(U,c,l);for(;Ur(f);){let e=d.next();if(e.done)break;Wr(f,e.value)}for(let e of Jr(f))Gr(i,e);for(;Ur(a);){let e=d.next();if(e.done)break;Wr(a,e.value)}}for(let e of Jr(a))Gr(i,e);return Jr(i)}async function O(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 ti(e.slice(s,s+32),32,e=>k(e,t,n,r));if(j(n,r))return[];let l=Xr(c.filter(e=>!!e?.length)),u=Yr(Nr,s,c.length,e.length),d=Yr(L.maxScannedCharacters,s,c.length,e.length),f=z(l,t,{maxAttempts:u,maxCandidates:U,maxCharacters:W.maxCharacters,maxScannedCharacters:d});i=z([...i,...f],t,{maxAttempts:i.length+f.length,maxCandidates:U,maxCharacters:W.maxCharacters});let p=z(Zr(l,a,{attempts:0,characters:0},u,d,L.maxCandidateLength),t,{maxAttempts:u,maxCandidates:750,maxCharacters:W.maxCharacters,maxScannedCharacters:d});i=z([...i,...p],t,{maxAttempts:i.length+p.length,maxCandidates:U,maxCharacters:W.maxCharacters});let m=z(Zr(l,a,{attempts:0,characters:0},u,d,L.maxCandidateLength),t,{maxAttempts:u,maxCandidates:750,maxCharacters:W.maxCharacters,maxScannedCharacters:d});i=z([...i,...m],t,{maxAttempts:i.length+m.length,maxCandidates:U,maxCharacters:W.maxCharacters});let h=z(Zr(l,a,o,Nr,L.maxScannedCharacters,L.maxCandidateLength),t,{maxAttempts:Nr-o.attempts,maxCandidates:750,maxCharacters:W.maxCharacters,maxScannedCharacters:L.maxScannedCharacters-o.characters});i=z([...i,...h],t,{maxAttempts:i.length+h.length,maxCandidates:U,maxCharacters:W.maxCharacters})}return i}async function k(e,t,n,r){let i=_;await re(i);try{if(j(n,r))return;try{return await e(t)}catch{return}}finally{ie(i)}}async function re(e){if(e.active<128){e.active++;return}await new Promise(t=>e.waiters.push(t))}function ie(e){let t=e.waiters.shift();t?t():e.active--}function ae(e,t,n,r){return Tn(t,r??e.reduce((e,t)=>e+t.length,0))?z(e,t,{maxCandidates:U,maxCharacters:W.maxCharacters}):(n??new Ht(e,{fuzzy:`v1`,limit:U,tiebreakers:[Vt,Bt]})).find(t).map(e=>e.item)}function oe(){if(l)return l;let e=new Set,t=0,n=0,r=n=>!n||e.has(n)||n.length>W.maxCandidateLength||e.size===W.maxCandidates||t+n.length>W.maxCharacters?!1:(e.add(n),t+=n.length,!0),i=0;for(;i<s.length&&n<W.maxAttempts&&e.size<W.maxCandidates&&t<W.maxCharacters;){let e=s[i++];n++,r(e)&&f.add(e)}return u=[...e],d=t,l=new Ht(u,{fuzzy:`v1`,limit:U,tiebreakers:[Vt,Bt]}),l}function*A(){for(let e of s)f.has(e)||(yield e)}function le(e){let t=Hr(U),r=0,i=0,a=0,o=$r([...n.values()],e).templates.slice(0,Pr);for(let n=0;n<o.length;n++){let s=Nr-r,c=jr-i,l=Fr-a;if(c<=0||s<=0||l<=0||!Ur(t))break;let u=o.length-n,d=Math.max(1,Math.floor(s/u)),f=mn(o[n],e,{maxAttempts:d,maxCandidateLength:Mr,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(!Wr(t,e))break}return Jr(t)}function ue(e){let t=[],r=new Set,i=0,a=0,o=0,s=0,c=$r([...n.values()],e).templates.slice(0,Pr),l=e=>{!e||r.has(e)||e.length>L.maxCandidateLength||o>=W.maxCandidates||i+e.length>W.maxCharacters||(r.add(e),t.push(e),o++,i+=e.length)},u=0;for(let t of z(f(),e,{maxAttempts:Pr,maxCandidates:750,maxCharacters:W.maxCharacters}))l(t);let d=ei(c,Math.max(1,Math.floor(Math.min(W.maxAttempts,W.maxCandidates-o)/2)));for(let t=0;t<d.length;t++){let n=W.maxAttempts-a,r=W.maxCandidates-o,c=W.maxCharacters-i,u=W.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=mn(d[t],e,p);m=n.suggestions,a+=n.attempts,s+=n.scans}else{let n=lr(d[t].parts,p,e);m=n.candidates,a+=n.attempts,s+=n.scans}for(let e of m)l(e)}return z(t,e,{maxAttempts:W.maxAttempts,maxCandidates:750,maxCharacters:W.maxCharacters});function*f(){for(let t=0;t<c.length;t++){let n=Fr-u;if(n<=0)return;let r=c.length-t,i=(e.length<=1?mn:pn)(c[t],e,{maxAttempts:1,maxCandidates:1,maxCharacters:L.maxCandidateLength,maxScans:Math.max(1,Math.floor(n/r))});u+=i.scans,yield*i.suggestions}}}function de(){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=>se(e?.[2]?.autocomplete||[])),...t.shortcuts.flatMap(e=>se(e?.[2]?.autocomplete||[])),...t.variants.flatMap(e=>se(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=yn(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(`
|
|
9
|
+
`);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(),_=Lr(),i.clear();for(let[e,t]of S)i.set(e,t);l=void 0,u=[],d=0,f.clear(),p.clear()}function fe(){a!==e.config&&de()}function j(t,n){return t!==e.config||n!==o}function pe(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))}),j(n,r)&&c()})}function M(t,n=``,r=``){let i=ce(t.flat()).filter(t=>!!(t&&!t.endsWith(`-`)&&!e.isBlocked(t)&&!e.isBlocked(n+t+r)));v!==`fuzzy`&&i.sort(Vr);let a=i.map(e=>n+e+r);return v===`fuzzy`?a:ni(a)}}function G(e){try{return g(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 ai=/<style[^>]*>[\s\S]*?(?:<\/style>|<\/>|$)/g,oi=/(?:<\/style>|<\/>)$/,si=/<template\b[^>]*\slang\s*=\s*(?:'pug'|"pug")[^>]*>/i;function ci(e,t,n){let r=t.match(/\.(svelte|vue|astro|marko)$/);if(r&&li(e,t)){let t=e.slice(0,n);if(/\.$/.test(t)||/\.\S+$/.test(t))return!0}if(!r||[...e.matchAll(ai)].some(t=>{let r=t.index,i=r+t[0].length,a=i===e.length&&!oi.test(t[0]);return n>r&&(n<i||a&&n===i)})||kr(e,n)!==void 0)return!0;let i=e.slice(n).replace(/"[^"]*"|\{[^}]*\}|'[^']*'/g,``);return/^[^<>]*>/.test(i)}function li(e,t){return t.endsWith(`.vue`)&&si.test(e)}function ui(e,t){let n=u.relative(e,t);return n!==``&&n!==`..`&&!n.startsWith(`..${u.sep}`)&&!u.isAbsolute(n)}const di={log(){},warn(){}},fi=/[\\/](?:node_modules|dist|\.temp|\.cache)[\\/]/;var pi=class{cwd;logger;ready;contextsMap=new Map;configSources=[];fileContextCache=new Map;configExistsCache=new Map;loadingContexts=new Map;contextLoadVersions=new Map;contextReloadDisposers=new Map;discoveredConfigs=new Set;yarnPnpSetupFailures=new Set;lifecycleVersion=0;workspaceRoots;events=he();constructor(e,t=di,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=>ui(t,e))}get contexts(){return Array.from(new Set(this.contextsMap.values())).filter(ye)}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.syncConfigSources(),r&&(this.disposeContextReload(r),this.clearFileContextCache(r),this.events.emit(t,r),t===`contextUnload`&&this.events.emit(`reload`)))}syncConfigSources(){let e=Array.from(new Set(this.contexts.flatMap(e=>e.getConfigFileList())));this.configSources.splice(0,this.configSources.length,...e)}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=u.dirname(e),n=this.getWorkspaceBoundary(t);if(n)for(;t===n||ui(n,t);){if(this.configExistsCache.delete(t),t===n)return;t=u.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=h(e,{},e=>{e.config.details=!0}),i=[];try{i=(await r.updateRoot(e)).sources}catch(r){return this.isLoadCurrent(e,t,n)?(this.warn(`â ī¸ Error on loading config. Config directory: ${e}`),this.warn(String(r.stack??r)),this.finishLoading(e,null,t,n)):void 0}if(!this.isLoadCurrent(e,t,n))return;if(!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=u.join(e,t);if(l(n))try{A(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(`
|
|
10
|
+
`)}`;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(fi.test(t))return;if(this.fileContextCache.has(t)){let e=this.fileContextCache.get(t);return N(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||!ui(n,t))&&(i.filter(e,t)||M(t)))return N(this.fileContextCache,t,i,100),i;for(let[e,n]of r)if(n&&ui(e,t))return N(this.fileContextCache,t,n,100),n}async discoverAndLoadConfig(e){let t=this.lifecycleVersion,n=await this.findConfigDirectory(u.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&&N(this.fileContextCache,e,i,100),i}async findConfigDirectory(e,t){let n=this.configExistsCache.get(e);if(n!==void 0)return N(this.configExistsCache,e,n,100),n||void 0;let r=this.getWorkspaceBoundary(e);if(!r)return;let i=u.parse(e).root,a=[],o=e;for(;o!==i&&(ui(r,o)||o===r);){a.push(o);let e=this.configExistsCache.get(o);if(e!==void 0)return N(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=u.dirname(o)}this.cacheSearchPath(a,!1)}getWorkspaceBoundary(e){return[...this.workspaceRoots,...this.contextsMap.keys()].filter(t=>t===e||ui(t,e)).sort((e,t)=>t.length-e.length)[0]}async hasConfigFiles(e){return!!p(e)}cacheSearchPath(e,t){for(let n of e)N(this.configExistsCache,n,t,100)}};const mi={root:void 0,colorPreview:!1,remToPxPreview:!0,remToPxRatio:16,syntaxHighlight:!0,strictAnnotationMatch:!1,autocompleteMatchType:`prefix`,autocompleteStrict:!1,autocompleteMaxItems:1e3},hi=/^#(?:[0-9a-f]{3,8})$/i,gi=/^(?:rgb|rgba|hsl|hsla|hwb|oklch|oklab|lab|lch|device-cmyk|color)\(/i,_i=/^(?:media|supports|container)\b/;function vi(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`||hi.test(n)||gi.test(n))return!0;let r=n.split(`/`)[0].split(`-`)[0];return t.has(r)},isBreakpoint(e){if(_i.test(e))return!0;let t=e.replace(/^(?:max|min)-/,``).split(/[^a-z0-9]/i)[0];return n.has(t)}}}const yi=/(-?[\d.]+)rem(\s+!important)?;/;let bi;function xi(e){return e.default??e}function Si(){return bi??=Promise.all([import(`prettier/standalone`),import(`prettier/parser-postcss`)]).then(([e,t])=>({prettier:xi(e),parserCSS:xi(t)}))}function Ci(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(yi);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 wi(e,t,n){let[r,{prettier:i,parserCSS:a}]=await Promise.all([e.generate(new Set(se(t)),{preflights:!1,safelist:!1}),Si()]),o=Ci(r.css,n),s=await i.format(o,{parser:`css`,plugins:[a]});return{...r,prettified:s}}async function Ti(e,t,n){return`\`\`\`css\n${(await wi(e,t,n)).prettified.trimEnd()}\n\`\`\``}const Ei=[`property`,`class`,`keyword`,`number`,`enumMember`,`string`,`operator`,`type`],Di=[`important`,`pseudoClass`,`pseudoElement`,`query`,`selector`,`variable`,`combinator`,`bracket`,`group`,`condition`],Oi=/^-?(?:\d+\.?\d*|\.\d+)[a-z%]*$/i,ki=/^[>+~_[&.#*: ]/,Ai=/^[>+~_.#]/;function ji(e,t){return t?.isColorValue?.(e)?`enumMember`:e.startsWith(`[`)?`string`:Oi.test(e)?`number`:`keyword`}function Mi(e,t){return e.startsWith(`::`)?{type:`type`,modifier:`pseudoElement`,symbolLen:0}:Ai.test(e)?{type:`type`,modifier:`selector`,symbolLen:1}:ki.test(e)?{type:`type`,modifier:`selector`,symbolLen:0}:t?.isBreakpoint?.(e)?{type:`keyword`,modifier:`query`,symbolLen:0}:{type:`keyword`,modifier:`pseudoClass`,symbolLen:0}}function Ni(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}=Mi(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 Pi(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 Fi(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(`[`)){Pi(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:ji(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(`[`)?Pi(e,s,r):e.push({start:r,length:s.length,type:ji(s,i),modifiers:[]})}return}let s=r===`property`?`property`:ji(o,i);e.push({start:n+a,length:o.length,type:s,modifiers:[]})}function Ii(e,t,n){if(!e)return[];if(e.startsWith(`{`)&&e.includes(`}`))return Li(e,t,n);let r=de(e),i=[];if(r.keyword)r.body.length&&(r.body.startsWith(`[`)?Pi(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&&Fi(i,e,t,`property`,n),i.push({start:t+e.length,length:1,type:`operator`,modifiers:[]}),a.length&&Fi(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=Ni(i,e,a,n);return i}function Li(e,t,n){let r=[],i=e.indexOf(`}`);r.push({start:t,length:1,type:`operator`,modifiers:[`group`]});let a=t+1;e.slice(1,i).split(`;`).forEach((e,t)=>{if(t>0&&(r.push({start:a,length:1,type:`operator`,modifiers:[`group`]}),a+=1),e.length){for(let t of Ii(e,a,n))r.push(t);a+=e.length}}),r.push({start:t+i,length:1,type:`operator`,modifiers:[`group`]});let o=t+i+1,s=e.slice(i+1);if(s.startsWith(`!`)&&(r.push({start:o,length:1,type:`operator`,modifiers:[`important`]}),o+=1,s=s.slice(1)),s.startsWith(`@`))for(let e of s.slice(1).split(`@`))o=Ni(r,e,o,n);return r}C([w,T,E,ee,te,ne]);const Ri=/var\((?<cssVarName>--[^,|)]+)(?:,(?<fallback>[^)]+))?\)/g,zi=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)\([^)]*\)`,Bi=new RegExp(zi,`g`),Vi=/var\((--[^,|)]+)(?:,([^)]+))?\)/,Hi=String.raw`(?:^|[;{]\s*)(?:[\w-]+-color|color|fill|stroke)\s*:\s*(?<value>[^;}{]+)`,Ui=new RegExp(Hi,`gm`),Wi=/(?:^|[;{])\s*--[^\s:;{}]+\s*:/m,Gi=new RegExp(zi,`i`),Ki=new RegExp(Hi,`m`),qi=new RegExp(String.raw`color-mix\([^,]+,\s*(?<color>${zi})\s+(?<weight>\d+(?:\.\d+)?%)\s*,\s*transparent\s*\)`,`i`);function Ji(e){return Wi.test(e)||Ki.test(e)||Yi(e)}function Yi(e){return Gi.test(e)}function Xi(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 Zi(e,t){let n=e.trim(),r=new Set;for(;n.startsWith(`var(`);){let e=n.match(Vi);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 Qi(e,t){let n=e;for(let r of e.matchAll(Ri)){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,Zi(o,t)??a??`1`):a&&(n=n.replaceAll(e,a))}return n.replaceAll(/,?\s+var\(--.*?\)/g,``)}function $i(e,t){let n=Qi(e,t),r=n.match(qi);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(Bi)?.[0];if(!i){let e=n.trim().replace(/\s*!important$/,``);return S(e).isValid()?e:void 0}return/\/\)/.test(i)&&(i=i.replace(/ \/\)/g,`/ 1)`)),i}function ea(e){let t=Xi(e);for(let n of e.matchAll(Ui)){let e=n.groups?.value;if(!e)continue;let r=$i(e,t);if(r)return r}return $i(e,t)}function ta(e){let t=S(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 na=new Map,ra=new WeakMap;function ia(e,t){let n=Number.parseFloat(e);return t===`rem`||t===`em`?n*16:n}function aa(e){let t=e.match(/\(min-width:\s*([\d.]+)(px|rem|em)?\s*\)/);if(t)return ia(t[1],t[2]);let n=e.match(/\(max-width:\s*([\d.]+)(px|rem|em)?\s*\)/);if(n)return-ia(n[1],n[2])}function oa(e,t){return e<t?-1:+(e>t)}function sa(e,t){return oa(e??``,t??``)}function ca(e,t,n){let r=(e.get(t)??0)-(e.get(n)??0);if(r)return r;let i=aa(t),a=aa(n);return i!==void 0&&a!==void 0&&i!==a?i-a:oa(t,n)}function la(e,t){return e[0]-t[0]||(e[4]?.sort??0)-(t[4]?.sort??0)||sa(e[5]?.currentSelector,t[5]?.currentSelector)||sa(e[1],t[1])||oa(e[2],t[2])}function ua(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 da(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 fa(e){let t=na.get(e);if(t!==void 0)return t;let n=Ji(e);return N(na,e,n,2048),n}function pa(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 ma(e,t,n){let r=e.sort(la).map(([,e,t,,n,,r])=>{let i=e&&!n?.noScope?ua(e):e;return[i==null?[]:[[i,n?.sort??0]],t,!!(r??n?.noMerge)]});t&&pa(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]||oa(e[0],t[0])),a=[...new Set(t.map(([e])=>e).filter(Boolean))].join(`,
|
|
11
|
+
`)),i.push(a?`${a}{${n}}`:n)}let a=[...new Set(i)].reverse();return(n?a:a.filter(fa)).join(`
|
|
12
|
+
`)}function ha(e,t,n){let r=new Map,i=new Set([fe]);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)||oa(e,t))),s=[];for(let n of o){let i=r.get(n);if(i)for(let n of[...i.keys()].sort((e,n)=>ca(t,e,n))){let t=ma(i.get(n),e.mergeSelectors,fa(n));if(t)if(!n)s.push(t);else{let e=da(n);s.push(`${e.join(`{`)}{${t}${`}`.repeat(e.length)}`)}}}return s.join(`
|
|
13
|
+
`)}async function ga(e,t){let n=e.config,r=await e.parseToken(t);if(e.config!==n)return ga(e,t);if(r?.length)return ea(ha(n,new Map(e.parentOrders),r))}async function _a(e,t){let n=ra.get(e);return(!n||n.config!==e.config)&&(n={config:e.config,values:new Map},ra.set(e,n)),qe(n.values,t,1e3,()=>ga(e,t).then(e=>e?{colorString:e,color:ta(e)}:{}))}const va=[...Di,`teacss`],ya={tokenTypes:[...Ei],tokenModifiers:va},ba=new Map(Ei.map((e,t)=>[e,t])),xa=new Map(va.map((e,t)=>[e,1<<t])),Sa=xa.get(`teacss`)??0,Ca=/^-?(?:\d+\.?\d*|\.\d+)[a-z%]*$/i,wa=new WeakMap,Ta={log(){},warn(){}};async function Ea(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 Da(e){let t=wa.get(e);if(t?.config===e.config)return t.classifier;let n=vi(e.config?.theme??{});return wa.set(e,{config:e.config,classifier:n}),n}function Oa(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 ka(e,t,n,r,i=Sa){let a=e.positionAt(t);return{line:a.line,char:a.character,length:n,type:ba.get(r)??0,modifiers:i}}function Aa(e,t,n,r,i=Sa){let a=[],o=0;for(let s=0;s<n.length;s++)(n[s]===`\r`||n[s]===`
|
|
14
|
+
`)&&(s>o&&a.push(ka(e,t+o,s-o,r,i)),n[s]===`\r`&&n[s+1]===`
|
|
15
|
+
`&&s++,o=s+1);return o<n.length&&a.push(ka(e,t+o,n.length-o,r,i)),a}function ja(e,t){return t.isColorValue?.(e)?`enumMember`:Ca.test(e)?`number`:`string`}function Ma(e,t,n){return e.some(e=>e.open===t&&e.close===n-1)}function Na(e,t,n){let r=[];for(let i of n){r.push(ka(e,i.open,1,`operator`,Sa|(xa.get(`group`)??0)));for(let n of i.declarations){let{property:i,start:a,colon:o,value:s,valueStart:c}=n;r.push(ka(e,a,2,`operator`,Sa|(xa.get(`variable`)??0))),r.push(ka(e,a+2,i.length-2,`property`)),r.push(ka(e,o,1,`operator`)),s&&r.push(...Aa(e,c,s,ja(s,t)))}r.push(ka(e,i.close,1,`operator`,Sa|(xa.get(`group`)??0)))}return r}var Pa=class{contextManager;getSettings;logger;autoCompletes=new Map;semanticTokensCache=new Map;featureFailures=new Map;constructor(e){this.getSettings=e.getSettings??(()=>mi),this.logger=e.logger??Ta;let t=e.folderPaths?.length?e.folderPaths:[e.rootPath];this.contextManager=new pi(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&&(N(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=ii(e.generator,{matchType:t,throwErrors:!1});return this.autoCompletes.set(e,{matchType:t,autocomplete:r}),r}async resolveTargetContext(e){let t=G(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)||M(t))?null:{ctx:r,id:t,code: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}=i,c=r.strictAnnotationMatch,l=this.semanticTokensCache.get(o);if(l&&l.code===s&&l.generator===a.generator&&l.strictAnnotationMatch===c)return N(this.semanticTokensCache,o,l,100),this.clearFeatureFailure(n,e.uri),l.result;let u=await Ze(a.generator,s,o,c),d=Da(a.generator),f=[],p=new Map,h=M(o)?m(s):[];for(let[t,n]of u){if(Ma(h,t,n))continue;let r=s.slice(t,n),i=p.get(r);i||(i=Ii(r,0,d),p.set(r,i));for(let n of i){let r=t+n.start,i=e.positionAt(r),a=Sa;for(let e of n.modifiers)a|=xa.get(e)??0;f.push({line:i.line,char:i.character,length:n.length,type:ba.get(n.type)??0,modifiers:a})}}h.length&&f.push(...Na(e,d,h));let g=Oa(f);return N(this.semanticTokensCache,o,{code:s,generator:a.generator,strictAnnotationMatch:c,result:g},100),this.clearFeatureFailure(n,e.uri),g}catch(r){return this.reportFeatureFailure(n,e.uri,r),t}}async getDiagnostics(e){try{if(!M(G(e.uri)))return this.clearFeatureFailure(`diagnostics`,e.uri),[];let t=await this.resolveTargetContext(e);if(!t)return this.clearFeatureFailure(`diagnostics`,e.uri),[];let{ctx:n,code:r}=t,i=n.generator.config?.theme??{},a=d(r,Object.keys(i).filter(e=>e!==`modes`&&e!==`defaultMode`&&i[e]!=null&&typeof i[e]==`object`)).map(t=>({range:{start:e.positionAt(t.start),end:e.positionAt(t.end)},message:t.message,severity:x.Warning,source:`teacss`,code:t.reason}));return this.clearFeatureFailure(`diagnostics`,e.uri),a}catch(t){return this.reportFeatureFailure(`diagnostics`,e.uri,t),[]}}async getHover(e,t){let n=`hover`;try{if(M(G(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}=i,c=e.offsetAt(t),l=(await Ze(a.generator,s,o,r.strictAnnotationMatch)).find(([e,t])=>c>=e&&c<t);if(!l)return this.clearFeatureFailure(n,e.uri),null;let u=r.remToPxPreview?r.remToPxRatio:-1,d={contents:{kind:`markdown`,value:await Ti(a.generator,l[2],u)},range:{start:e.positionAt(l[0]),end:e.positionAt(l[1])}};return this.clearFeatureFailure(n,e.uri),d}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}=r,s=await Ze(i.generator,o,a,n.strictAnnotationMatch),c=[],l=!1;for(let[n,r,a]of s)try{let{color:t}=await _a(i.generator,a);t&&c.push({range:{start:e.positionAt(n),end:e.positionAt(r)},color:{...t}})}catch(n){l=!0,this.reportFeatureFailure(t,e.uri,n)}return l||this.clearFeatureFailure(t,e.uri),c}catch(n){return this.reportFeatureFailure(t,e.uri,n),[]}}getColorPresentations(e){let t=Math.round(e.red*255),n=Math.round(e.green*255),r=Math.round(e.blue*255),i=Math.min(1,Math.max(0,e.alpha));return[{label:i<1?`rgb(${t} ${n} ${r} / ${Number(i.toFixed(3))})`:`rgb(${t} ${n} ${r})`}]}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 Ze(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=G(e.uri),i=e.getText(),a=await this.contextManager.resolveClosestContext(i,r);if(!a?.filter(i,r))return null;let o=await Ze(a.generator,i,r,n.strictAnnotationMatch),s=e.offsetAt(t),c=o.find(e=>e[0]<=s&&s<e[1]);if(!c?.[2])return null;let l=c[2],u=new Set(a.generator.getCachedEquivalentTokens(l));return o.filter(e=>u.has(e[2])).map(t=>({uri:e.uri,range:{start:e.positionAt(t[0]),end:e.positionAt(t[1])}}))}async getCompletions(e,t){let n=`completions`;try{let r=this.getSettings(),i=G(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.offsetAt(t);if(r.autocompleteStrict&&!ci(a,i,s))return this.clearFeatureFailure(n,e.uri),null;let c=await this.getSuggestionResult({ctx:o,code:a,id:i,offset:s,matchType:r.autocompleteMatchType});if(!c?.suggestions.length)return this.clearFeatureFailure(n,e.uri),null;let l=c.suggestions.slice(0,r.autocompleteMaxItems),u=r.colorPreview?await Ea(l,32,async([e])=>{try{return(await _a(o.generator,e)).colorString}catch{return}}):[],d=[];for(let t=0;t<l.length;t++){let[n,r]=l[t],i=u[t],a=c.resolveReplacement(n),o={label:r,kind:i?b.Color:b.EnumMember,sortText:i?/-\d$/.test(r)?`1`:`2`:void 0,data:{value:n,uri:e.uri},textEdit:{range:{start:e.positionAt(a.start),end:e.positionAt(a.end)},newText:a.replacement}};i&&(o.documentation=i),d.push(o)}return this.clearFeatureFailure(n,e.uri),{isIncomplete:!0,items:d}}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=G(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===b.Color?e.detail=await(await wi(a.generator,e.data.value,o)).prettified:e.documentation={kind:`markdown`,value:await Ti(a.generator,e.data.value,o)},e}async getSuggestionResult({ctx:e,code:t,id:n,offset:r,matchType:i}){let a=li(t,n);if(!e.filter(t,n)&&!M(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 Fa(e,t){let n=La(t.workspaceFolderPaths||[]),r=n.length?n:La([t.workspaceRootPath]),i=se(e).filter(e=>typeof e==`string`&&e.length>0);if(!i.length)return r;let a=La([t.workspaceFileDir,...n,t.workspaceRootPath]);return La(i.flatMap(e=>Ia(e,a)))}function Ia(e,t){if(!e)return[];if(Ra(e))return[u.normalize(e)];let n=u.normalize(e),r=t.filter(e=>{let t=u.normalize(e);return t===n||t.endsWith(`${u.sep}${n}`)});if(r.length)return r;let i=t.map(t=>u.resolve(t,e)),a=i.filter(e=>l(e));return a.length?a:i.slice(0,1)}function La(e){return Array.from(new Set(e.filter(Boolean).map(e=>u.normalize(e))))}function Ra(e){return u.isAbsolute(e)||u.win32.isAbsolute(e)}const za=/[\\/](?:node_modules|dist|\.temp|\.cache|\.git)[\\/]/,Ba=new Set([`node_modules`,`dist`,`.temp`,`.cache`,`.git`]),Va=`**/{${Array.from(new Set(f.map(e=>u.posix.basename(e)))).join(`,`)}}`;function Ha(e,t){let n=u.relative(e,t);return n===``||!n.startsWith(`..${u.sep}`)&&n!==`..`&&!u.isAbsolute(n)}function Ua(e){return[...e].map(e=>e===`*`?`[*]`:e===`?`?`[?]`:e===`[`?`[[]`:e===`]`?`[]]`:e===`{`?`[{]`:e===`}`?`[}]`:e).join(``)}function Wa(e){try{let t=JSON.parse(c.readFileSync(u.join(e,`package.json`),`utf8`))?.teacss?.entry;return typeof t==`string`&&t?u.resolve(e,t):void 0}catch{return}}function Ga(e){let t=[],n=[e];for(let e of n){let r;try{r=c.readdirSync(e,{withFileTypes:!0})}catch{continue}if(r.some(e=>e.isFile()&&e.name===`package.json`)){let n=Wa(e);n&&t.push({directory:e,entry:n})}for(let t of r)t.isDirectory()&&!Ba.has(t.name)&&n.push(u.join(e,t.name))}return t.sort((e,t)=>e.directory<t.directory?-1:+(e.directory>t.directory))}function Ka(e,t){return t.map(e=>u.normalize(e)).filter(t=>Ha(t,e)).sort((e,t)=>t.length-e.length)[0]}function qa(e,t){let n=u.dirname(e);for(;Ha(t,n);){if(u.normalize(p(n)??``)===e)return!0;if(n===t)break;n=u.dirname(n)}return!1}function Ja(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 Ya(e,t,n){let r=new Map,i=(e,t,i=!0)=>{let a=i?Ua(t):t,o={baseUri:_(e).href,pattern:a};r.set(`${o.baseUri}\0${a}`,{globPattern:o,kind:n})};for(let t of e)i(u.dirname(t),u.basename(t));for(let e of t){i(e,Va,!1);for(let{directory:t,entry:n}of Ga(e)){let e=u.relative(t,n);Ha(t,n)?i(t,e.split(u.sep).join(`/`)):i(u.dirname(n),u.basename(n))}}return Array.from(r.values())}function Xa(e,t,n){let r=new Set(t.map(e=>u.normalize(e))),i=new Set(n.map(Wa).filter(e=>!!e).map(e=>u.normalize(e))),a=new Set;for(let t of e){let e;try{e=u.normalize(g(t.uri))}catch{return!0}if(r.has(e)||i.has(e))return!0;if(za.test(e))continue;let o=Ka(e,n);if(!o){a.add(e);continue}if(u.basename(e)===`package.json`)return!0;if(u.extname(e).toLowerCase()!==`.css`){a.add(e);continue}try{if(qa(e,o))return!0}catch{return!0}}if(a.size){for(let e of n)for(let{entry:t}of Ga(e))if(a.has(u.normalize(t)))return!0}return!1}function Za(e){let t,n,r,i,a=0,o=Promise.resolve();return{update(s){let c=Ja(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 Qa(e){return e instanceof Error?e.message:String(e)}function $a(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=Qa(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 eo(e,t){e.on(`uncaughtExceptionMonitor`,(e,n)=>{t(`[teacss] ${n===`unhandledRejection`?`Unhandled rejection`:`Uncaught exception`}: ${e.message}`)})}function to(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function no(e,t){return typeof e==`boolean`?e:t}function ro(e,t){if(e!==null)return typeof e==`string`?e:Array.isArray(e)?e.filter(e=>typeof e==`string`):t}function io(e,t){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:t}function ao(e,t){return typeof e!=`number`||!Number.isFinite(e)?t:Math.min(1e4,Math.max(0,Math.floor(e)))}function oo(e){let t=to(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 so(e,t){let n=to(t),r=to(n.autocomplete),i=r.matchType;return{root:ro(n.root,e.root),colorPreview:no(n.colorPreview,e.colorPreview),remToPxPreview:no(n.remToPxPreview,e.remToPxPreview),remToPxRatio:io(n.remToPxRatio,e.remToPxRatio),syntaxHighlight:no(n.syntaxHighlight,e.syntaxHighlight),strictAnnotationMatch:no(n.strictAnnotationMatch,e.strictAnnotationMatch),autocompleteMatchType:i===`prefix`||i===`fuzzy`?i:e.autocompleteMatchType,autocompleteStrict:no(r.strict,e.autocompleteStrict),autocompleteMaxItems:ao(r.maxItems,e.autocompleteMaxItems)}}function co(e){return so(mi,e)}function lo(e,t){return e.syntaxHighlight!==t.syntaxHighlight||e.strictAnnotationMatch!==t.strictAnnotationMatch}function uo(e,t){let n=new Set(e),r=new Set(t);return n.size!==r.size||[...n].some(e=>!r.has(e))}async function fo(e,t,n){if(e)try{return await t()}catch(e){n(e);return}}const K=ae(O.all),q=new re(oe);let J=co(),Y,po=!1,mo=!1,ho=!1,go=!1,_o=!1,vo=!1,yo=0,bo;const xo=new Promise(e=>{bo=e}),So=ie.Create|ie.Change|ie.Delete,Co=[{globPattern:`**/*.css`,kind:So}],X={folderPaths:[]};function wo(e){J=so(J,e)}function Z(e){return Fa(e,{workspaceRootPath:X.rootPath,workspaceFileDir:X.fileDir,workspaceFolderPaths:X.folderPaths})}function To(e){return typeof e==`string`?e.length>0:Array.isArray(e)&&e.some(Boolean)}async function Eo(){Y&&await Do(()=>Y.contextManager.setRoots(Z(J.root)))}async function Do(e){yo++;try{return await e()}finally{yo--}}function Oo(e,t,n){X.rootPath=e?G(e):void 0,X.fileDir=n?.workspaceFileDir,X.folderPaths=n?.workspaceFolderPaths||t?.map(e=>G(e.uri))||[]}function ko(e=X.rootPath){if(!e)return;let t=new Pa({rootPath:e,folderPaths:Z(J.root),logger:{log:e=>K.console.log(e),warn:e=>K.console.warn(e)},getSettings:Ro});Y=t;let n=()=>{yo||(Fo().catch(e=>Q(`Failed to update config watchers`,e)),Io(),Ko())};return t.events.on(`contextLoaded`,n),t.events.on(`contextReload`,n),t.events.on(`contextUnload`,n),t.events.on(`unload`,n),t}async function Ao(e){Y||!e[0]||await ko(e[0])?.ready}function jo(){return Y?.contextManager.contexts.flatMap(e=>e.getConfigFileList())??[]}function Mo(){return Array.from(new Set([...Z(J.root),...Y?.contextManager.contextsMap.keys()??[]]))}function No(){let e=jo(),t=Ya(e,Mo(),So);return e.length?t:[...Co,...t]}const Po=Za(async e=>K.client.register(D.type,{watchers:[...e]}));async function Fo(){!po||!vo||!Y||await Po.update(No())}function Q(e,t){K.console.error(`[teacss] ${e}: ${t instanceof Error?t.message:String(t)}`)}async function Io(){vo&&(_o?await K.sendNotification(`teacss/semanticTokens/refresh`).catch(e=>Q(`Failed to refresh semantic token decorations`,e)):go&&await K.languages.semanticTokens.refresh().catch(e=>Q(`Failed to refresh semantic tokens`,e)))}const Lo=$a({async getDiagnostics(e){return await $(),await Y?.getDiagnostics(e)??[]},sendDiagnostics(e,t){return K.sendDiagnostics({uri:e,diagnostics:[...t]})},reportError(e,t){Q(`Failed to publish diagnostics for ${e}`,t)}});eo(o,e=>K.console.error(e));function Ro(){return J}function zo(){return Y}function $(){return xo}K.onInitialize(a=>{po=!!a.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration,mo=!!a.capabilities.workspace?.configuration,ho=!!a.capabilities.workspace?.workspaceFolders,go=!!a.capabilities.workspace?.semanticTokens?.refreshSupport;let o=oo(a.initializationOptions);_o=o?.semanticTokens===`overlay`,`root`in o&&wo({root:o.root});let s=a.workspaceFolders,c=s?.[0]?.uri||a.rootUri;Oo(c,s,o);let l=c?void 0:Z(J.root)[0];return c?ko():l&&ko(l),t(K,q,zo,$),r(K,q,zo,$),e(K,q,zo,$),n(K,q,zo,$),i(K,q,zo,$),{capabilities:{textDocumentSync:k.Incremental,completionProvider:{resolveProvider:!0,triggerCharacters:[`-`,`:`,` `,`"`,`'`]},hoverProvider:!0,referencesProvider:!0,colorProvider:!0,..._o?{}:{semanticTokensProvider:{legend:ya,full:!0}},...ho?{workspace:{workspaceFolders:{supported:!0,changeNotifications:!0}}}:{}}}}),K.onInitialized(async()=>{ho&&K.workspace.onDidChangeWorkspaceFolders(e=>{qo(e).catch(e=>Q(`Failed to update workspace folders`,e))});try{let e=await fo(mo,()=>K.workspace.getConfiguration(`teacss`),e=>Q(`Failed to read workspace configuration`,e));e!==void 0&&wo(e),await Ao(Z(J.root)),Y&&(await Y.ready,await Eo())}catch(e){Q(`Failed to complete initial setup`,e)}finally{vo=!0,bo?.(),bo=void 0}K.console.log(`â
TeaCSS Language Server initialized`),await Fo().catch(e=>Q(`Failed to update config watchers`,e)),await Io()});let Bo;K.onDidChangeWatchedFiles(e=>{Xa(e.changes,jo(),Mo())&&(clearTimeout(Bo),Bo=setTimeout(()=>{Vo().catch(e=>Q(`Failed to reload config sources`,e))},500))});async function Vo(){await $(),Y&&(K.console.log(`đ Config source changed, reloading TeaCSS...`),Xe(),await Do(()=>Y.contextManager.reload()),K.console.log(`đĩ Reloaded.`),await Fo().catch(e=>Q(`Failed to update config watchers`,e)),await Io(),await Ko())}K.onDidChangeConfiguration(async e=>{await $();let t=e.settings?.teacss;if(t!==void 0){let e=J,n=Z(e.root);wo(t);let r=Z(J.root),i=uo(n,r);i&&(await Ao(r),Y&&await Do(()=>Y.contextManager.setRoots(r)),await Fo().catch(e=>Q(`Failed to update config watchers`,e)),await Ko()),(i||lo(e,J))&&await Io()}});async function Ho(){return await $(),Y?(Xe(),await Do(()=>Y.contextManager.reload()),await Fo().catch(e=>Q(`Failed to update config watchers`,e)),await Io(),await Ko(),{success:!0}):{success:!1}}async function Uo(e){if(await $(),!Y)return{count:0};let t=q.get(e.uri);if(!t)return{count:0};let n=G(e.uri),r=t.getText(),i=await Y.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 Wo(e){if(await $(),!Y)return{positions:[]};let t=q.get(e.uri);return t?{positions:(await Y.getMatchedPositions(t)).map(e=>({start:t.positionAt(e.start),end:t.positionAt(e.end),className:e.text}))}:{positions:[]}}K.onRequest(`teacss/reloadConfig`,Ho),K.onRequest(`teacss/getMatchedCount`,Uo),K.onRequest(`teacss/getMatchedPositions`,Wo);async function Go(e){!Y||!M(G(e.uri))||await Lo.publish(e)}async function Ko(){await Promise.all(q.all().map(e=>Go(e)))}async function qo(e){await $();let t=new Set(e.removed.map(e=>G(e.uri))),n=X.folderPaths.filter(e=>!t.has(e));for(let t of e.added){let e=G(t.uri);n.includes(e)||n.push(e)}if(X.folderPaths=n,X.rootPath=n[0],!Y&&X.rootPath&&(ko(),await zo()?.ready),!Y)return;Xe();let r=To(J.root)?Z(J.root):X.folderPaths;await Do(()=>Y.contextManager.setRoots(r)),await Fo().catch(e=>Q(`Failed to update config watchers`,e)),await Io(),await Ko()}q.onDidChangeContent(e=>{Ye(G(e.document.uri)),Go(e.document)}),q.onDidClose(e=>{let t=G(e.document.uri);Ye(t),Y?.contextManager.releaseDocument(t),Lo.invalidate(e.document.uri),K.sendDiagnostics({uri:e.document.uri,diagnostics:[]})}),q.listen(K),K.listen();export{};
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@teacss/language-server",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Standalone LSP server for TeaCSS â completion, hover, color, and token highlighting over stdio.",
|
|
5
|
+
"homepage": "https://css.teasim.com",
|
|
6
|
+
"funding": "https://github.com/sponsors/billgo",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": "Billgo <hi@billgo.me>",
|
|
9
|
+
"sideEffects": [
|
|
10
|
+
"./dist/server.js"
|
|
11
|
+
],
|
|
12
|
+
"type": "module",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": "./dist/index.js",
|
|
15
|
+
"./server": "./dist/server.js",
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"bin": {
|
|
20
|
+
"teacss-language-server": "./bin/teacss-language-server.js"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"bin",
|
|
24
|
+
"dist",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "bunx rimraf dist && NODE_OPTIONS=--max-old-space-size=8192 bunx tsdown --config tsdown.config.mts",
|
|
29
|
+
"dev": "tsdown --watch"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@colordx/core": "^5.5.0",
|
|
33
|
+
"@teacss/config": "0.3.0",
|
|
34
|
+
"@teacss/language-service": "0.3.0",
|
|
35
|
+
"@teacss/runtime": "0.3.0",
|
|
36
|
+
"magic-string": "^1.1.0",
|
|
37
|
+
"prettier": "^3.9.6",
|
|
38
|
+
"vscode-languageserver": "^10.1.0",
|
|
39
|
+
"vscode-languageserver-textdocument": "^1.0.12",
|
|
40
|
+
"vscode-languageserver-types": "^3.18.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@teacss/autocomplete": "0.3.0",
|
|
44
|
+
"@teacss/core": "0.3.0",
|
|
45
|
+
"@teacss/preset-standard": "0.3.0"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=22.12.0"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
53
|
+
"inlinedDependencies": {
|
|
54
|
+
"fzf": "0.5.2",
|
|
55
|
+
"lru-cache": "11.5.2"
|
|
56
|
+
}
|
|
57
|
+
}
|