@teacss/config 0.10.14 → 0.10.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -51,22 +51,32 @@ export type CssDialect = "css" | "braced" | "less" | "indented";
51
51
  /** The dialect a file is written in, by its extension or a `lang.<extension>` query. */
52
52
  export declare function cssDialectOf(file: string | undefined): CssDialect;
53
53
  /**
54
- * @internal Where the value of the custom property declared at `start` ends: at the `;` or `}` that closes
55
- * it, or in an indented dialect at a line break, outside brackets, strings and comments. `start`
56
- * when no custom property is declared there, and always in Less. Its value is kept as written, so a `//` there is text.
54
+ * @internal Where the one-token brace pair opened at `open` closes, as teacss-rs reads it: its content
55
+ * is not empty and holds no ASCII whitespace, `{`, `}`, `:`, `;`, backslash, quote, parenthesis,
56
+ * `&`, `@` or `/`. `undefined` when `open` holds no such pair.
57
57
  */
58
- export declare function customPropertyValueEnd(css: string, start: number, dialect: CssDialect): number;
58
+ export declare function stylusTokenEnd(text: string, open: number, limit: number): number | undefined;
59
59
  /**
60
- * @internal Whether a declaration may start after `char` in a forward scan, given whether one could
61
- * before it: `{`, `}` and `;` end a statement, and so does a line break in an indented dialect.
62
- * Whitespace keeps the state and anything else clears it. Comments are not passed in.
60
+ * @internal Where the Stylus interpolation opened at `open` closes: a one-token brace pair, unless it is
61
+ * detached, with whitespace or nothing before its `{` and only spaces and tabs between its `}` and
62
+ * a line break, `;`, `}` or the end of the text, which makes it a block such as `b {c}`.
63
63
  */
64
- export declare function declarationStartsAfter(char: string, startsBefore: boolean, dialect: CssDialect): boolean;
64
+ export declare function stylusInterpolationEnd(text: string, open: number, limit: number): number | undefined;
65
65
  /**
66
- * @internal `css` with each `//` comment blanked, offset for offset. A string, a block comment, a
67
- * `url()` and a custom property's value hold none.
66
+ * @internal Where the value of the custom property declared at `start` ends, as teacss-rs reads it:
67
+ * at the `;` or `}` that closes it, or in an indented dialect at a line break, outside brackets,
68
+ * strings and comments; a string ends at its quote or a line break. `start` when no custom
69
+ * property is declared there, and always in Less. Its value is kept as written, so a `//` there is
70
+ * text, unless `blanksValue` names the property: `--at-apply` holds a list TeaCSS reads.
68
71
  */
69
- export declare function blankLineComments(css: string, dialect?: CssDialect): string;
72
+ export declare function customPropertyValueEnd(css: string, start: number, dialect: CssDialect, blanksValue?: (name: string) => boolean): number;
73
+ /**
74
+ * @internal `css` with each `//` comment blanked, offset for offset, as teacss-rs blanks it. A
75
+ * string, which ends at its quote or a line break, a block comment, an unquoted `url()` and a
76
+ * custom property's value hold none; `blanksValue` names the custom properties whose value does.
77
+ * The `}` that closes a Sass `#{…}` starts no declaration, so `#{$b}--primary:hover` is a selector.
78
+ */
79
+ export declare function blankLineComments(css: string, dialect?: CssDialect, blanksValue?: (name: string) => boolean): string;
70
80
  /**
71
81
  * Scan complete top-level at-rules without matching text in comments, strings, or nested CSS. As in
72
82
  * teacss-rs, an at sign opens an at-rule only where a statement starts: at the start of the text or
@@ -112,6 +122,8 @@ export declare class EntryConfigError extends SyntaxError {
112
122
  }
113
123
  /** Literal module names: commas separate items; CSS escapes are not decoded. */
114
124
  export declare function parseEntryList(prelude: string): string[];
125
+ /** Palette, alias and mode names: one lowercase kebab-case word. */
126
+ export declare const isLowerKebab: (name: string) => boolean;
115
127
  /** Recoverable diagnostics for editors; build callers reject these before loading. */
116
128
  export declare function diagnoseEntry(source: string, dialect?: CssDialect): EntryDiagnostic[];
117
129
  export declare function assertEntryDirectives(css: string, file?: string): void;
@@ -136,7 +148,7 @@ export interface EntryCustomBlock {
136
148
  mode?: string;
137
149
  declarations: EntryCustomDecl[];
138
150
  }
139
- /** The retired leading word theme is never interpreted as a mode. */
151
+ /** A `@custom` block names one lowercase kebab-case mode, or none for the base values. */
140
152
  export type CustomPrelude = {
141
153
  kind: "base";
142
154
  } | {
@@ -239,7 +251,7 @@ export interface CustomDiagnostic {
239
251
  /** Offset range of the property name (or the at-rule header) in the source (for mapping to an editor range). */
240
252
  start: number;
241
253
  end: number;
242
- reason: "unknown-prefix" | "illegal-color-step" | "mode-non-color" | "removed-theme";
254
+ reason: "unknown-prefix" | "illegal-color-step" | "mode-non-color";
243
255
  message: string;
244
256
  }
245
257
  /** Position-aware custom-property diagnostics shared by builds and editors. */
@@ -277,9 +289,9 @@ export declare function resolveEntryConfig(entryCss: string, base: string, entry
277
289
  declare function getPresetSourcesFromError(error: unknown): string[];
278
290
  /**
279
291
  * Resolve `@presets` specifiers into preset objects for `createGenerator`.
280
- * Relative paths resolve against the CSS entry directory; bare names use Node
281
- * resolution after mapping the exact built-in name `standard` to
282
- * `@teacss/preset-standard`. Local preset modules are evaluated without a
292
+ * Relative paths resolve against the CSS entry directory; `standard`, `icons` and
293
+ * `official` map to their packages, which cannot be named directly; other bare
294
+ * names use Node resolution. Local preset modules are evaluated without a
283
295
  * persistent runtime module cache so edits to either the entry or its bounded
284
296
  * local dependency graph take effect on the next resolution. There is no
285
297
  * implicit default preset.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{A as e,B as t,D as n,E as r,F as i,G as a,H as o,I as s,J as c,K as l,L as u,M as d,N as f,O as p,P as m,R as h,U as g,V as _,W as v,X as y,Y as b,Z as x,a as S,i as C,j as w,k as T,n as E,q as D,r as O,t as k,z as A}from"./recovery-CL4We79v.js";import j from"node:process";const M=x.join(` `);function N(e,t){switch(t){case`unknown-prefix`:return`@custom var "${e}" matches no theme namespace — ignored (not registered and not emitted); define application variables in native CSS.`;case`illegal-color-step`:return`@custom var "${e}" has an illegal color step — palette steps are ${M}.`;case`mode-non-color`:return`@custom var "${e}" is ignored in a mode block (not registered and not emitted); mode blocks change colors only.`;case`removed-theme`:return`@custom ${e}: named themes were removed; use global / mode values and data-css-<role> palette selectors.`}}function P(e,t){let n=l(t),r=[],i=o(e);for(let e of i){let t=T(e.mode);if(t.kind===`invalid`){r.push({property:e.mode,start:e.start,end:e.open,reason:`removed-theme`,message:N(e.mode,`removed-theme`)});continue}for(let i of e.declarations){let{property:e,start:a,end:o}=i,s=D(e.slice(2),n),c=s.ok?t.kind===`mode`&&!b(s)?`mode-non-color`:void 0:s.reason;c&&r.push({property:e,start:a,end:o,reason:c,message:N(e,c)})}}return r}async function F(e,t,n,r){let i=await S(e,t,n,r);if(i.status===`failed`)throw i.cause;return i.result}function I(){let e=k(!0);return(t=j.cwd(),n=t,r={})=>e(t,n,r)}export{w as EntryConfigError,d as ROLE_DIRECTIVES,f as STRING_OR_COMMENT_RE,m as assertEntryDirectives,u as blankLineComments,l as buildNamespaces,D as classifyCustomVar,I as createRecoveryConfigLoader,h as cssDialectOf,A as customPropertyValueEnd,c as customToTheme,t as declarationStartsAfter,P as diagnoseCustom,i as diagnoseEntry,E as entryDiscoveryFiles,O as findEntry,n as getConfigSourcesFromError,_ as hasTopLevelDirective,b as isColorScale,C as loadConfig,T as parseCustomPrelude,e as parseEntry,s as parseEntryList,r as resolveCustomTheme,F as resolveEntryConfig,p as resolvePresets,y as scaleThemeKeys,o as scanCustomBlocks,g as scanQuotedDirectives,v as scanTopLevelAtRules,a as skipUnquotedUrl};
1
+ import{$ as e,A as t,B as n,D as r,E as i,F as a,G as o,H as s,I as c,J as l,K as u,L as d,M as f,N as p,O as m,P as h,Q as g,R as _,U as v,V as y,W as b,X as x,Y as S,Z as C,a as w,i as T,j as E,k as D,n as O,q as k,r as A,t as j,z as M}from"./recovery-BrrXSsA8.js";import N from"node:process";const P=e.join(` `);function F(e,t){switch(t){case`unknown-prefix`:return`@custom var "${e}" matches no theme namespace — ignored (not registered and not emitted); define application variables in native CSS.`;case`illegal-color-step`:return`@custom var "${e}" has an illegal color step — palette steps are ${P}.`;case`mode-non-color`:return`@custom var "${e}" is ignored in a mode block (not registered and not emitted); mode blocks change colors only.`}}function I(e,t){let n=l(t),r=[],i=s(e);for(let e of i){let t=D(e.mode);if(t.kind!==`invalid`)for(let i of e.declarations){let{property:e,start:a,end:o}=i,s=S(e.slice(2),n),c=s.ok?t.kind===`mode`&&!C(s)?`mode-non-color`:void 0:s.reason;c&&r.push({property:e,start:a,end:o,reason:c,message:F(e,c)})}}return r}async function L(e,t,n,r){let i=await w(e,t,n,r);if(i.status===`failed`)throw i.cause;return i.result}function R(){let e=j(!0);return(t=N.cwd(),n=t,r={})=>e(t,n,r)}export{E as EntryConfigError,f as ROLE_DIRECTIVES,p as STRING_OR_COMMENT_RE,h as assertEntryDirectives,_ as blankLineComments,l as buildNamespaces,S as classifyCustomVar,R as createRecoveryConfigLoader,M as cssDialectOf,n as customPropertyValueEnd,x as customToTheme,I as diagnoseCustom,a as diagnoseEntry,O as entryDiscoveryFiles,A as findEntry,r as getConfigSourcesFromError,y as hasTopLevelDirective,C as isColorScale,c as isLowerKebab,T as loadConfig,D as parseCustomPrelude,t as parseEntry,d as parseEntryList,i as resolveCustomTheme,L as resolveEntryConfig,m as resolvePresets,g as scaleThemeKeys,s as scanCustomBlocks,v as scanQuotedDirectives,b as scanTopLevelAtRules,o as skipUnquotedUrl,u as stylusInterpolationEnd,k as stylusTokenEnd};
@@ -1 +1 @@
1
- import{C as e,S as t,T as n,_ as r,b as i,c as a,d as o,f as s,g as c,h as l,l as u,m as d,o as f,p,s as m,t as h,u as g,v as _,w as v,x as y,y as b}from"../recovery-CL4We79v.js";import{isAbsolute as x,relative as S,resolve as C,sep as w}from"node:path";function T(e,t){let n=S(e,t);return n===``||n!==`..`&&!n.startsWith(`..${w}`)&&!x(n)}var E=class{createWatcher;onChange;onError;#e=!1;#t=new Map;#n=new Map;constructor(e,t,n){this.createWatcher=e,this.onChange=t,this.onError=n}get roots(){return[...this.#n.values()].map(({plan:e})=>e.directory)}reconcile(t){if(this.#e)return;let n=[...t.plans].sort((e,t)=>e.directory.length-t.directory.length||e.directory.localeCompare(t.directory)),r=n.filter((e,t)=>!e.recursive||!n.slice(0,t).some(t=>t.recursive&&T(t.directory,e.directory))),i=!1,a=[],o=new Map;try{for(let t of r){let n=JSON.stringify(t);if(this.#n.has(n))continue;let r;try{r=this.createWatcher(t.directory,(i,a)=>{if(this.#e||this.#n.get(n)?.handle!==r||!e(t,a))return;let o=a==null?t.recursive?[t.directory]:t.children.map(e=>C(t.directory,e)):[C(t.directory,a.toString())];for(let[e,t]of this.#t){let n=t.recursive?[t.directory]:t.children.map(e=>C(t.directory,e));o.some(e=>n.some(t=>{let n=e.normalize(`NFC`).toLowerCase(),r=t.normalize(`NFC`).toLowerCase();return T(n,r)||T(r,n)}))&&this.#t.delete(e)}this.onChange(a==null?void 0:C(t.directory,a.toString()))},t.recursive);let i=r;r.on(`error`,e=>{if(this.#e||this.#n.get(n)?.handle!==i)return;this.#n.delete(n);let r=!this.#t.has(n);this.#t.set(n,t),this.closeWatcher(i),this.onError(e),r&&!this.#e&&this.#t.has(n)&&this.onChange(void 0)}),o.set(n,{plan:t,handle:r})}catch(e){r&&this.closeWatcher(r);let o=e?.code;if(o===`ENOENT`||o===`ENOTDIR`||o===`ELOOP`){i=!0;continue}if(!r&&o===`EACCES`){a.push({key:n,plan:t,error:e});continue}throw e}}}catch(e){for(let{handle:e}of o.values())this.closeWatcher(e);throw e}if(this.#e){for(let{handle:e}of o.values())this.closeWatcher(e);return}let s=new Map;for(let e of r){let t=JSON.stringify(e),n=this.#n.get(t)??o.get(t);n&&s.set(t,n)}let c=new Set(r.map(e=>JSON.stringify(e)));for(let e of this.#t.keys())c.has(e)||this.#t.delete(e);let l=this.#n;this.#n=s;for(let[e,{handle:t}]of l)s.has(e)||this.closeWatcher(t);if(this.#e||this.#n!==s)return;let u=a.filter(({key:e})=>!this.#t.has(e)).map(({key:e})=>e);for(let{key:e,plan:t}of a)this.#t.set(e,t);for(let e of[...t.permissionErrors,...a.map(({error:e})=>e)]){if(this.#e||this.#n!==s)return;this.onError(e)}!this.#e&&this.#n===s&&(i||u.some(e=>this.#t.has(e)))&&this.onChange(void 0)}retire(){if(this.#e)return;this.#e=!0,this.#t.clear();let e=this.#n;this.#n=new Map;for(let{handle:t}of e.values())this.closeWatcher(t)}closeWatcher(e){try{e.close()}catch(e){this.onError(e)}}};export{E as SourceWatchRegistry,f as attachSourceDeclarations,m as copySourceDeclarations,h as createAcceptedConfigLoader,a as createSourceDeclarationCheck,u as directorySources,g as expandDirectorySources,o as observeSourceDeclarations,s as planSourceWatches,p as probeSourceDeclarations,d as recoverSourceDeclarations,l as scanSourceFiles,c as sourceDeclarationIntent,r as sourceDeclarationIntentsOf,_ as sourceDeclarationMemberPaths,b as sourceDeclarationSnapshot,i as sourceDeclarationStateOf,y as sourceDeclarationWatchTargets,t as sourceDeclarationsOf,e as sourceWatchEventRelevant,v as sourceWatchTargets,n as stageSourceDeclarations};
1
+ import{C as e,S as t,T as n,_ as r,b as i,c as a,d as o,f as s,g as c,h as l,l as u,m as d,o as f,p,s as m,t as h,u as g,v as _,w as v,x as y,y as b}from"../recovery-BrrXSsA8.js";import{isAbsolute as x,relative as S,resolve as C,sep as w}from"node:path";function T(e,t){let n=S(e,t);return n===``||n!==`..`&&!n.startsWith(`..${w}`)&&!x(n)}var E=class{createWatcher;onChange;onError;#e=!1;#t=new Map;#n=new Map;constructor(e,t,n){this.createWatcher=e,this.onChange=t,this.onError=n}get roots(){return[...this.#n.values()].map(({plan:e})=>e.directory)}reconcile(t){if(this.#e)return;let n=[...t.plans].sort((e,t)=>e.directory.length-t.directory.length||e.directory.localeCompare(t.directory)),r=n.filter((e,t)=>!e.recursive||!n.slice(0,t).some(t=>t.recursive&&T(t.directory,e.directory))),i=!1,a=[],o=new Map;try{for(let t of r){let n=JSON.stringify(t);if(this.#n.has(n))continue;let r;try{r=this.createWatcher(t.directory,(i,a)=>{if(this.#e||this.#n.get(n)?.handle!==r||!e(t,a))return;let o=a==null?t.recursive?[t.directory]:t.children.map(e=>C(t.directory,e)):[C(t.directory,a.toString())];for(let[e,t]of this.#t){let n=t.recursive?[t.directory]:t.children.map(e=>C(t.directory,e));o.some(e=>n.some(t=>{let n=e.normalize(`NFC`).toLowerCase(),r=t.normalize(`NFC`).toLowerCase();return T(n,r)||T(r,n)}))&&this.#t.delete(e)}this.onChange(a==null?void 0:C(t.directory,a.toString()))},t.recursive);let i=r;r.on(`error`,e=>{if(this.#e||this.#n.get(n)?.handle!==i)return;this.#n.delete(n);let r=!this.#t.has(n);this.#t.set(n,t),this.closeWatcher(i),this.onError(e),r&&!this.#e&&this.#t.has(n)&&this.onChange(void 0)}),o.set(n,{plan:t,handle:r})}catch(e){r&&this.closeWatcher(r);let o=e?.code;if(o===`ENOENT`||o===`ENOTDIR`||o===`ELOOP`){i=!0;continue}if(!r&&o===`EACCES`){a.push({key:n,plan:t,error:e});continue}throw e}}}catch(e){for(let{handle:e}of o.values())this.closeWatcher(e);throw e}if(this.#e){for(let{handle:e}of o.values())this.closeWatcher(e);return}let s=new Map;for(let e of r){let t=JSON.stringify(e),n=this.#n.get(t)??o.get(t);n&&s.set(t,n)}let c=new Set(r.map(e=>JSON.stringify(e)));for(let e of this.#t.keys())c.has(e)||this.#t.delete(e);let l=this.#n;this.#n=s;for(let[e,{handle:t}]of l)s.has(e)||this.closeWatcher(t);if(this.#e||this.#n!==s)return;let u=a.filter(({key:e})=>!this.#t.has(e)).map(({key:e})=>e);for(let{key:e,plan:t}of a)this.#t.set(e,t);for(let e of[...t.permissionErrors,...a.map(({error:e})=>e)]){if(this.#e||this.#n!==s)return;this.onError(e)}!this.#e&&this.#n===s&&(i||u.some(e=>this.#t.has(e)))&&this.onChange(void 0)}retire(){if(this.#e)return;this.#e=!0,this.#t.clear();let e=this.#n;this.#n=new Map;for(let{handle:t}of e.values())this.closeWatcher(t)}closeWatcher(e){try{e.close()}catch(e){this.onError(e)}}};export{E as SourceWatchRegistry,f as attachSourceDeclarations,m as copySourceDeclarations,h as createAcceptedConfigLoader,a as createSourceDeclarationCheck,u as directorySources,g as expandDirectorySources,o as observeSourceDeclarations,s as planSourceWatches,p as probeSourceDeclarations,d as recoverSourceDeclarations,l as scanSourceFiles,c as sourceDeclarationIntent,r as sourceDeclarationIntentsOf,_ as sourceDeclarationMemberPaths,b as sourceDeclarationSnapshot,i as sourceDeclarationStateOf,y as sourceDeclarationWatchTargets,t as sourceDeclarationsOf,e as sourceWatchEventRelevant,v as sourceWatchTargets,n as stageSourceDeclarations};
@@ -0,0 +1,5 @@
1
+ import{createRequire as e}from"node:module";import{expandClassGroups as t,isCssNameCharacter as n,mergeContentOptions as r,mergeDeep as i,resolveConfig as a,splitClassTokens as o}from"@teacss/core";import*as s from"node:fs";import c,{existsSync as l,lstatSync as u,readFileSync as d,readlinkSync as f,realpathSync as p,statSync as m}from"node:fs";import*as h from"node:path";import{dirname as g,extname as _,isAbsolute as v,join as y,relative as b,resolve as x,sep as S}from"node:path";import ee from"node:process";import{consola as C}from"consola";import{Buffer as w}from"node:buffer";import{readFile as T,stat as te}from"node:fs/promises";import{fileURLToPath as E,pathToFileURL as D}from"node:url";import{AsyncLocalStorage as ne}from"node:async_hooks";import re from"picomatch";import{glob as ie,isDynamicPattern as ae}from"tinyglobby";const oe=[`000`,`100`,`150`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`850`,`900`,`950`],se=new Set(oe);function ce(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function le(e){return Object.keys(e).filter(t=>{if(t===`modes`||t===`defaultMode`)return!1;let n=e[t];return typeof n!=`object`||!n?!1:t===`colors`||Object.values(n).every(e=>e==null||typeof e==`string`||typeof e==`number`||Array.isArray(e))})}function ue(e){return e.map(e=>({key:e,prefix:e===`colors`||e===`semanticColors`?`color`:ce(e),twoLevel:e===`colors`,semanticColor:e===`semanticColors`})).sort((e,t)=>t.prefix.length-e.prefix.length)}function de(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}function fe(e,t){let n=Object.hasOwn(e,t)?e[t]:void 0;if(typeof n==`object`&&n&&!Array.isArray(n))return n;let r={};return de(e,t,r),r}function pe(e,t){if(![...e].every(n))return{ok:!1,reason:`unknown-prefix`};let r=t.filter(t=>e===t.prefix||e.startsWith(`${t.prefix}-`)),i=r.find(e=>e.key===`colors`),a=r.find(e=>e.semanticColor);if(i&&a){let t=e===`color`?``:e.slice(6),n=t.lastIndexOf(`-`),r=n>0?t.slice(0,n):``,o=n>0?t.slice(n+1):``;return r&&se.has(o)?{ok:!0,nsKey:i.key,twoLevel:!0,rest:t,colorName:r,step:o}:r&&/^\d+$/.test(o)?{ok:!1,reason:`illegal-color-step`}:t?{ok:!0,nsKey:a.key,twoLevel:!1,rest:t}:{ok:!1,reason:`unknown-prefix`}}let o=r[0];if(!o)return{ok:!1,reason:`unknown-prefix`};let s=e===o.prefix?``:e.slice(o.prefix.length+1);if(o.twoLevel){let e=s.lastIndexOf(`-`),t=e>0?s.slice(0,e):``,n=e>0?s.slice(e+1):``;return!t||!se.has(n)?{ok:!1,reason:`illegal-color-step`}:{ok:!0,nsKey:o.key,twoLevel:!0,rest:s,colorName:t,step:n}}return{ok:!0,nsKey:o.key,twoLevel:!1,rest:s}}function me(e){return e.nsKey===`colors`||e.nsKey===`semanticColors`}function he(e,t){let n=ue(t),r={},i=[],a=e=>{let t=pe(e.startsWith(`--`)?e.slice(2):e,n);return t.ok||i.push(e),t},o=(e,t,n)=>{let r=fe(e,t.nsKey);t.twoLevel?de(fe(r,t.colorName),t.step,n):de(r,t.rest||`DEFAULT`,n)};for(let t of e){let e=t.mode?fe(fe(r,`modes`),t.mode):r;for(let{property:n,value:r}of t.declarations){let s=a(n);s.ok&&(t.mode&&!me(s)?i.push(n):o(e,s,r))}}return{theme:r,unknown:i}}function ge(e){if(e.terminator!==`;`)return`expected @custom <name> "<family>"; without a mode or block`;let t=/^(\S+)\s+(["'])([^"']*)\2$/.exec(e.prelude);if(!t)return`expected one name and one complete quoted target without extra arguments`;if(!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(t[1])||/^\d+$/.test(t[1].split(`-`).at(-1)))return`alias names must use lowercase kebab-case with a nonnumeric final segment`;if(!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(t[3]))return`target must be one lowercase kebab-case palette name, without a list`}function _e(e,t,n){if(ge(t))return;let r=e.slice(t.start,t.end).replace(/(["'])(?:\\.|(?!\1)[\s\S])*?\1|\/\*[\s\S]*?\*\//g,e=>e.startsWith(`/*`)?e.replace(/[^\r\n]/g,` `):e),i=/^@custom\s+(\S+)\s+(["'])([^"']*)\2\s*;?$/.exec(r);if(!i)return;let a=t.start+r.indexOf(i[1],7),o=t.start+r.indexOf(i[2],a-t.start+i[1].length)+1;return{name:i[1],family:i[3],statement:{file:n,start:t.start,end:t.end},nameRange:{file:n,start:a,end:a+i[1].length},familyRange:{file:n,start:o,end:o+i[3].length}}}function ve(e){return oe.map(t=>({property:`--color-${e.name}-${t}`,value:`var(--color-${e.family}-${t}${t===`000`?`, white`:``})`}))}const ye=/[\w-]/,be=/[\w.#-]/,O=/\s/;function k(e,t,n){let r=e.indexOf(`*/`,t+2);return r<0||r>=n?n:r+2}function A(e,t,n){let r=e[t];for(let i=t+1;i<n;i++)if(e[i]===`\\`)i++;else if(e[i]===r)return i+1;return n}function j(e,t){if(e.slice(t,t+4).toLowerCase()!==`url(`||be.test(e[t-1]??``))return t;let n=t+4;for(;O.test(e[n]??``);)n++;if(e[n]===`"`||e[n]===`'`)return t;for(;n<e.length;n++)if(e[n]===`\\`)n++;else if(e[n]===`)`)return n+1;return t}function M(e,t,n){let r=``;for(let i=t;i<n;i++)if(e[i]===`/`&&e[i+1]===`*`)i=k(e,i,n)-1,r+=` `;else if(e[i]===`"`||e[i]===`'`){let t=A(e,i,n);r+=e.slice(i,t),i=t-1}else if(j(e,i)>i){let t=Math.min(j(e,i),n);r+=e.slice(i,t),i=t-1}else r+=e[i];return r.trim()}function xe(e,t){let n=[],r=t.startsWith(`@`)?t.slice(1):t;for(let t of I(e)){if(t.name!==r||t.terminator!==`;`)continue;let e=t.prelude[0];if(e!==`"`&&e!==`'`)continue;let i=A(t.prelude,0,t.prelude.length);i!==t.prelude.length||i<=1||t.prelude[i-1]!==e||n.push(t.prelude.slice(1,i-1))}return n}function Se(e,t){let n=t.startsWith(`@`)?t.slice(1):t;return I(e).some(e=>e.name===n)}function N(e){let t=e?.split(`?`).flatMap(e=>/\.(scss|less|sass|styl|stylus)$/i.exec(e)?.[1]?.toLowerCase()??[])[0];return t?t===`scss`?`braced`:t===`less`?`less`:`indented`:`css`}const P=e=>e===`
2
+ `||e===`\r`||e===`\f`;function Ce(e,t){let n=t;for(;n<e.length&&!P(e[n]);)n++;return n}const we=e=>e!==void 0&&(/[\w-]/.test(e)||e.charCodeAt(0)>=128);function Te(e,t){return t>=3&&e.slice(t-3,t).toLowerCase()===`url`&&!we(e[t-4])}const Ee=e=>e===` `||e===` `||e===`
3
+ `||e===`\f`||e===`\r`;function De(e,t,n){if(e[t]===`{`)for(let r=t+1;r<n;r++){let n=e[r];if(Ee(n)||`{}:;\\"'()&@/`.includes(n))return n===`}`&&r>t+1?r:void 0}}function Oe(e,t,n){let r=De(e,t,n);if(r===void 0)return;let i=t===0||Ee(e[t-1]),a=r+1;for(;a<n&&(e[a]===` `||e[a]===` `);)a++;let o=a>=n||`
4
+ \r\f;}`.includes(e[a]);return i&&o?void 0:r}function ke(e,t,n){if(e[t]!==`#`||e[t+1]!==`{`)return n===`indented`?Oe(e,t,e.length):void 0;let r=0;for(let n=t+1;n<e.length;n++){let t=e[n];if(t===`\\`)n++;else if(t===`"`||t===`'`)for(n++;n<e.length&&e[n]!==t;){if(P(e[n]))return;n+=e[n]===`\\`?2:1}else if(t===`{`)r++;else if(t===`}`&&--r===0)return n;else if(t===`;`||P(t))return}}const Ae=e=>e===`--at-apply`;function je(e,t,n,r=Ae){if(n===`less`||e[t]!==`-`||e[t+1]!==`-`)return t;let i=t+2;for(;i<e.length;)if(we(e[i]))i++;else{let t=ke(e,i,n);if(t===void 0)break;i=t+1}if(r(e.slice(t,i)))return t;let a=i;for(;a<e.length&&/\s/.test(e[a]);)a++;if(e[a]!==`:`)return t;let o=0;for(let t=a+1;t<e.length;t++){let r=e[t];if(r===`\\`)t++;else if(r===`"`||r===`'`)for(t++;t<e.length&&e[t]!==r&&!P(e[t]);)t+=e[t]===`\\`?2:1;else if(r===`/`&&e[t+1]===`*`){let n=e.indexOf(`*/`,t+2);t=n===-1?e.length:n+1}else if(r===`(`||r===`[`||r===`{`)o++;else if((r===`)`||r===`]`||r===`}`)&&o>0)o--;else if(o===0&&(r===`;`||r===`}`||n===`indented`&&P(r)))return t}return e.length}function F(e,t=`braced`,n=Ae){let r=``,i=0,a,o=0,s=!0,c=[],l=0;for(;l<e.length;){let u=e[l],d=!1;if(a)u===`\\`?l++:(u===a||P(u))&&(a=void 0);else if(u===`/`&&e[l+1]===`*`){let t=e.indexOf(`*/`,l+2);l=t===-1?e.length:t+2;continue}else if(u===`/`&&e[l+1]===`/`&&o===0){let t=Ce(e,l);r+=e.slice(i,l)+` `.repeat(t-l),i=t,l=t;continue}else if(s&&o===0&&je(e,l,t,n)>l){l=je(e,l,t,n),s=!1;continue}else if(u===`\\`)l++;else if(u===`"`||u===`'`)a=u;else if(u===`(`&&o>0)o++;else if(u===`(`&&Te(e,l))o=1;else if(u===`)`)o=Math.max(0,o-1);else if(u===`#`&&e[l+1]===`{`)c.push(!0),l++;else if(u===`{`){let n=t===`indented`?Oe(e,l,e.length):void 0;n===void 0?c.push(!1):(d=!0,l=n)}else u===`}`&&(d=c.pop()===!0);let f=t===`indented`&&P(u);(!/\s/.test(u)||f)&&(s=f||(u===`{`||u===`;`||u===`}`)&&!d),l++}return i?r+e.slice(i):e}function Me(e,t){let n=t;for(;n<e.length;)if(O.test(e[n]))n++;else if(e[n]===`/`&&e[n+1]===`*`)n=k(e,n,e.length);else break;return n}function Ne(e,t){for(let n=t;n<e.length;n++)if(e[n]===`/`&&e[n+1]===`*`)n=k(e,n,e.length)-1;else if(e[n]===`"`||e[n]===`'`)n=A(e,n,e.length)-1;else if(e[n]===`{`)return n;else if(e[n]===`;`||e[n]===`}`)return-1;return-1}function Pe(e,t){let n=1;for(let r=t+1;r<e.length;r++)if(e[r]===`/`&&e[r+1]===`*`)r=k(e,r,e.length)-1;else if(e[r]===`"`||e[r]===`'`)r=A(e,r,e.length)-1;else if(e[r]===`\\`)r++;else if(j(e,r)>r)r=j(e,r)-1;else if(e[r]===`{`)n++;else if(e[r]===`}`&&--n===0)return r;return-1}function I(e,t=!1,n=`css`){let r=n===`css`?e:F(e,n),i=[],a=0,o=!0;for(let e=0;e<r.length;e++){if(r[e]===`/`&&r[e+1]===`*`){e=k(r,e,r.length)-1;continue}if(n===`indented`&&P(r[e])){o=!0;continue}if(O.test(r[e]))continue;if(n===`css`&&a===0&&o&&r[e]===`/`&&r[e+1]===`/`){e=Ce(r,e)-1;continue}let s=o;if(o=!1,r[e]===`"`||r[e]===`'`){e=A(r,e,r.length)-1;continue}if(r[e]===`\\`){e++;continue}let c=j(r,e);if(c>e){e=c-1;continue}if(r[e]===`{`){a++,o=!0;continue}if(r[e]===`}`){a=Math.max(0,a-1),o=!0;continue}if(r[e]===`;`){o=!0;continue}if(!t&&a!==0||r[e]!==`@`||!s)continue;let l=e,u=l+1;for(;ye.test(r[u]??``);)u++;if(u===l+1||r[Me(r,u)]===`:`)continue;let d=r.slice(l+1,u),f=[],p=!1;for(let s=u;s<r.length;s++){let c=r[s];if(c===`/`&&r[s+1]===`*`)s=k(r,s,r.length)-1;else if(c===`"`||c===`'`)s=A(r,s,r.length)-1;else if(c===`\\`)s++;else if(j(r,s)>s)s=j(r,s)-1;else if(c===`(`)f.push(`)`);else if(c===`[`)f.push(`]`);else if(c===f.at(-1))f.pop();else if(f.length===0&&c===`;`){i.push({name:d,prelude:M(r,u,s),start:l,end:s+1,terminator:`;`,...t?{depth:a}:{}}),e=s,o=!0,p=!0;break}else if(f.length===0&&n===`indented`&&P(c)){i.push({name:d,prelude:M(r,u,s),start:l,end:s,terminator:`;`,...t?{depth:a}:{}}),e=s-1,p=!0;break}else if(f.length===0&&c===`}`){i.push({name:d,prelude:M(r,u,s),start:l,end:s,terminator:`}`,...t?{depth:a}:{}}),e=s-1,p=!0;break}else if(f.length===0&&c===`{`){let n=Pe(r,s);(n>=0||t)&&(i.push({name:d,prelude:M(r,u,s),start:l,end:n<0?r.length:n+1,terminator:`block`,...t?{depth:a}:{}}),e=t?s:n,t&&a++,o=!0,p=!0);break}}if(!p){i.push({name:d,prelude:M(r,u,r.length),start:l,end:r.length,terminator:`eof`,...t?{depth:a}:{}});break}}return i}function Fe(e,t,n){let r=[];for(let i=t;i<n;i++){let t=e[i];if(t===`/`&&e[i+1]===`*`)i=k(e,i,n)-1;else if(t===`"`||t===`'`)i=A(e,i,n)-1;else if(t===`\\`)i++;else if(j(e,i)>i)i=j(e,i)-1;else if(t===`(`)r.push(`)`);else if(t===`[`)r.push(`]`);else if(t===`{`)r.push(`}`);else if(t===r.at(-1))r.pop();else if(t===`;`&&r.length===0)return i}return n}function Ie(e,t,n){let r=[];for(let i=t;i<n;){for(;i<n;)if(/\s/.test(e[i]))i++;else if(e[i]===`/`&&e[i+1]===`*`)i=k(e,i,n);else break;let t=Fe(e,i,n);if(e[i]!==`-`||e[i+1]!==`-`){i=t+1;continue}let a=i+2;for(;a<n&&e[a]!==`:`&&!O.test(e[a])&&!e.startsWith(`/*`,a);)a++;let o=a;for(;o<n;)if(/\s/.test(e[o]))o++;else if(e[o]===`/`&&e[o+1]===`*`)o=k(e,o,n);else break;if(e[o]!==`:`){i=t+1;continue}let s=o+1,c=e.slice(s,t),l=c.trim(),u=s+c.length-c.trimStart().length,d=u+l.length;r.push({property:e.slice(i,a),value:l,start:i,end:a,colon:o,valueStart:u,valueEnd:d}),i=t+1}return r}function Le(e,t=`css`){let n=[];for(let r of I(e,!1,t)){if(r.name!==`custom`||r.terminator!==`block`)continue;let t=Ne(e,r.start+7);if(t<0)continue;let i=r.end-1;n.push({mode:r.prelude||void 0,declarations:Ie(e,t+1,i),start:r.start,open:t,close:i})}return n}const Re=[`primary`,`neutral`,`success`,`warning`,`failure`,`general`],ze=new Set([`source`,`shortcut`,`safelist`]),Be=/(?<![\w-])theme\(/,Ve=/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\/\*[\s\S]*?\*\//g;var L=class extends SyntaxError{diagnostics;constructor(e){super(e.map(e=>e.message).join(`
5
+ `)),this.diagnostics=e,this.name=`EntryConfigError`}};function R(e){let t=e[0];if(t!==`"`&&t!==`'`)throw Error(`expected one quoted comma-separated list`);let n=1;for(;n<e.length;n++)if(e[n]===`\\`)n++;else if(e[n]===t)break;if(n!==e.length-1||e[n]!==t)throw Error(`expected one complete quoted list without extra arguments`);let r=e.slice(1,-1);if(r.includes(`\\,`))throw Error(`commas cannot be escaped; re-export the preset from a path without commas`);let i=r.split(`,`).map(e=>e.trim());if(i.some(e=>!e))throw Error(`empty lists, empty items and trailing commas are not allowed`);return i}const z=e=>/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(e);function He(e,t=`css`){let n=t===`css`?e:F(e,t),r=[];for(let e of I(n,!0,t)){let t,n=Re.includes(e.name);if(e.name===`custom`&&e.terminator===`block`)t=!e.depth&&e.prelude!==``&&!z(e.prelude)?`expected one lowercase kebab-case mode name before the block, as in @custom dark { }`:void 0;else if(e.name===`custom`&&e.terminator!==`block`)t=e.depth?`configuration directives must be top-level`:ge(e);else if(e.name===`presets`||n){if(e.depth)t=`configuration directives must be top-level`;else if(e.terminator!==`;`)t=`expected a quoted list ending with a semicolon, without a block`;else try{let r=R(e.prelude);n&&r.some(e=>!z(e))&&(t=`palette names must use lowercase kebab-case`)}catch(e){t=e.message}}else ze.has(e.name.toLowerCase())&&!e.depth&&e.terminator===`eof`&&(t=`expected a statement ending with a semicolon`);t&&r.push({start:e.start,end:e.end,message:`@${e.name}: ${t}`})}for(let{declarations:e}of Le(n,t))for(let{start:t,valueEnd:n,value:i}of e)Be.test(i.replace(Ve,``))&&r.push({start:t,end:n,message:`@custom: theme() cannot be resolved in a @custom value; write the value itself`});return r}function Ue(e,t){let n=He(e,N(t));if(n.length)throw new L(n.map(e=>({...e,file:t})))}function We(e){return e?z(e)?{kind:`mode`,mode:e}:{kind:`invalid`}:{kind:`base`}}function Ge(e){let t,n=0,r=null;for(let i=0;i<e.length;i++){let a=e[i];if(r)a===`\\`?i++:a===r&&(r=null);else if(a===`"`||a===`'`)r=a;else if(a===`\\`)i++;else if(j(e,i)>i)i=j(e,i)-1;else if(a===`/`&&e[i+1]===`*`){let r=e.indexOf(`*/`,i+2),a=r<0?e.length:r+2;(t??=[]).push(e.slice(n,i),` `),n=a,i=a-1}}return t?`${t.join(``)}${e.slice(n)}`:e}function Ke(e){let t=e[0];if(t===`"`||t===`'`)for(let n=1;n<e.length;n++){let r=e[n];if(r===`\\`)n++;else if(r===t)return n===e.length-1?e.slice(1,n):void 0}}function B(e,t,n=`css`){let r=n===`css`?e:F(e,n),i=I(r,!1,n),a=[],o={},s=[],c=[],l=[],u=[],d=!1;for(let e of i){if(e.name===`teacss`&&e.prelude===``&&e.terminator!==`block`&&(d=!0),e.terminator!==`;`)continue;if(e.name===`custom`){let n=_e(r,e,t);n&&u.push({start:e.start,block:{alias:n,declarations:ve(n)}});continue}if(Re.includes(e.name)){try{let t=e.name,n=R(e.prelude);o[t]=[...new Set([...o[t]??[],...n])].sort()}catch{}continue}if(e.name===`shortcut`){let t=e.prelude.search(/\s/);if(t<=0)continue;let n=e.prelude.slice(0,t);if(!/^[A-Za-z_][\w-]*$/.test(n))continue;let r=Ke(e.prelude.slice(t).trimStart())?.trim();r&&c.push({name:n,expansion:r});continue}if(e.name!==`presets`&&e.name!==`source`&&e.name!==`safelist`)continue;let n=Ke(e.prelude)?.trim();if(!n)continue;if(e.name===`presets`){try{a.push(...R(e.prelude))}catch{}continue}if(e.name===`safelist`){l.push(n);continue}let i=n.startsWith(`!`),f=i?n.slice(1):n;f&&s.push({glob:f,exclude:i})}u.push(...Le(r,n).flatMap(({start:e,mode:t,declarations:n})=>{let r=We(t);return r.kind===`invalid`?[]:[{start:e,block:{mode:r.kind===`base`?void 0:r.mode,declarations:n.map(({property:e,value:t})=>({property:e,value:Ge(t).trim()}))}}]}));let f=u.sort((e,t)=>e.start-t.start).map(({block:e})=>e);return{presets:a,...Object.keys(o).length?{rolePalettes:o}:{},sources:s,custom:f,shortcuts:c,safelist:l,hasTeacss:d}}let qe;function Je(){return qe??=import(`jiti`).then(({createJiti:e})=>({createJiti:e,transformer:e(import.meta.url,{fsCache:!1,interopDefault:!0,moduleCache:!1})}))}const V=new Map,Ye=new WeakMap,Xe=16777216,H=new Map;let U=0;const Ze={icons:`@teacss/preset-icons`,official:`@teacss/preset-official`,standard:`@teacss/preset-standard`};function Qe(t,n){if(t.startsWith(`.`)||v(t))return x(n,t);let r=e(x(n,`_`));if(Object.hasOwn(Ze,t))return r.resolve(Ze[t]);if(Object.values(Ze).includes(t))throw Error(`@presets "${t}" is not a built-in preset name; use "standard", "icons" or "official"`);return r.resolve(t)}function W(e){return e.startsWith(`.`)||v(e)}function G(e){try{return p(e)}catch{return x(e)}}function $e(e,t){let n=g(e),r=[];for(;;){if(t.has(n)){let e=t.get(n);for(let n of r)t.set(n,e);return e}if(r.push(n),l(x(n,`package.json`))){for(let e of r)t.set(e,n);return n}let e=g(n);if(e===n){for(let e of r)t.set(e,void 0);return}n=e}}function et(e,t){let n=b(t,e);return n===``||!v(n)&&n!==`..`&&!n.startsWith(`..${S}`)}function K(e,t,n){let r=$e(e,n);return t.packageRoot===void 0?r===void 0&&et(e,t.fallbackRoot):r===t.packageRoot}function tt(e,t,n,r,i){if(!e||n.has(e)||(n.add(e),!v(e.filename)))return;let a=G(e.filename);if(K(a,r,i)){t.add(a);for(let a of e.children)tt(a,t,n,r,i)}}function nt(e){if(!e||typeof e!=`object`)return;let t,n,r;try{t=Reflect.get(e,`path`),n=Reflect.get(e,`url`),r=Reflect.get(e,`message`)}catch{return}if(typeof t==`string`&&v(t))return G(t);if(typeof n==`string`&&n.startsWith(`file:`))return G(E(n));if(typeof r!=`string`)return;let i=/Cannot find module ['"]([^'"]+)['"] from ['"]([^'"]+)['"]/.exec(r),a=/Cannot find module ['"]([^'"]+)['"][\s\S]*?Require stack:\s*\n- ([^\n]+)/.exec(r),o=i??a;if(!o)return;let s=o[1],c=o[2];if(s&&c&&(s.startsWith(`.`)||v(s)))return G(v(s)?s:x(g(c),s))}async function rt(e,t){let n=V.get(e)??Promise.resolve(),r,i=new Promise(e=>{r=e}),a=n.then(()=>i);V.set(e,a),await n;try{return{evaluation:t()}}finally{r(),V.get(e)===a&&V.delete(e)}}function it(e){return()=>({visitor:{AwaitExpression(t){t.getFunctionParent()||(e.hasTopLevelAwait=!0)},CallExpression(t){t.node.callee?.type===`Identifier`&&t.node.callee.name===`jitiImport`&&(e.hasDynamicImport=!0);let n=t.node.arguments?.[0];if(t.node.callee?.type!==`Identifier`||t.node.callee.name!==`require`)return;let r=n?.type===`StringLiteral`&&typeof n.value==`string`;r&&e.dependencies.add(n.value),typeof t.node.start==`number`&&(r?t.getFunctionParent()?e.hasNestedRequire=!0:e.hasTopLevelRequire=!0:e.hasNonLiteralRequire=!0)},ForOfStatement(t){t.node.await&&!t.getFunctionParent()&&(e.hasTopLevelAwait=!0)}}})}function at(e,t,n){if(e.hasDynamicImport)throw Error(`Dynamic imports are not supported in local preset modules: "${t}". Use static imports so TeaCSS can track and reload the complete graph.`);if(e.hasNonLiteralRequire)throw Error(`CommonJS require() specifiers must be string literals in local preset modules: "${t}".`);if(e.hasNestedRequire)throw Error(`CommonJS require() is only supported at module top level in local preset modules: "${t}".`);if(e.hasTopLevelRequire&&e.hasTopLevelAwait)throw Error(`CommonJS require() cannot be combined with top-level await in a local preset module: "${t}". Use a static import instead.`);if(t!==n&&e.hasTopLevelAwait)throw Error(`Top-level await is only supported in the local preset entry module: "${t}".`)}const q=Symbol(`uncacheable transform option`);function ot(e,t=new Set){if(e===null)return`n`;if(typeof e==`string`)return`s${JSON.stringify(e)}`;if(typeof e==`boolean`)return e?`b1`:`b0`;if(typeof e==`number`)return Number.isNaN(e)?`dNaN`:e===1/0?`dInfinity`:e===-1/0?`d-Infinity`:Object.is(e,-0)?`d-0`:`d${JSON.stringify(e)}`;if(e===void 0)return`u`;if(typeof e!=`object`||t.has(e))throw q;t.add(e);try{if(Array.isArray(e)){for(let t of Reflect.ownKeys(e)){if(t===`length`)continue;if(typeof t!=`string`)throw q;let n=Number(t),r=Object.getOwnPropertyDescriptor(e,t);if(!Number.isSafeInteger(n)||n<0||String(n)!==t||n>=e.length||!r?.enumerable||!(`value`in r))throw q}let n=Array.from({length:e.length},(n,r)=>{let i=Object.getOwnPropertyDescriptor(e,String(r));return i&&`value`in i?ot(i.value,t):`h`});return`a${e.length}[${n.join(`,`)}]`}if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw q;return`o{${Reflect.ownKeys(e).map(t=>{if(typeof t!=`string`)throw q;let n=Object.getOwnPropertyDescriptor(e,t);if(!n?.enumerable||!(`value`in n))throw q;return[t,n.value]}).sort(([e],[t])=>e.localeCompare(t)).map(([e,n])=>`${JSON.stringify(e)}:${ot(n,t)}`).join(`,`)}}`}finally{t.delete(e)}}function st(e,t){return{...t,async:!1,interopDefault:t.interopDefault??!0,jsx:t.jsx??e.options.jsx,retainLines:t.retainLines??e.options.transformOptions?.retainLines}}function ct(e){if(!(e&&Object.getPrototypeOf(e)===Object.prototype&&Reflect.ownKeys(e).length===0))return e}function lt(e){try{return ot({babel:ct(e.babel),interopDefault:e.interopDefault,jsx:e.jsx,retainLines:e.retainLines,ts:e.ts})}catch{return}}function ut(e,t,n,r){let i=w.byteLength(e)+w.byteLength(t)+w.byteLength(n);for(let e of r.dependencies)i+=w.byteLength(e);return i}function dt(e,t){let n=H.get(e);n&&(U-=n.bytes,H.delete(e));let r=ut(e,t.source,t.code,t.facts);if(!(r>Xe))for(H.set(e,{...t,bytes:r}),U+=r;H.size>256||U>Xe;){let e=H.keys().next();if(e.done)break;let t=H.get(e.value);H.delete(e.value),t&&(U-=t.bytes)}}function ft(e){return{...e,dependencies:Array.from(e.dependencies)}}function pt(e,t,n,r,i,a){let o=t.filename?G(t.filename):n,s=st(e,t),c=lt(s),l=c===void 0?void 0:`${o}\0${c}`,u=l===void 0?void 0:H.get(l);if(l!==void 0&&u?.source===s.source)return H.delete(l),H.set(l,u),K(o,r,i)&&at(u.facts,o,n),{code:u.code,dependencies:u.facts.dependencies};let d=c===void 0?void 0:{filename:o,mode:c,source:s.source},f=d===void 0?void 0:a?.read(d);if(l!==void 0&&f){let e={...f.facts,dependencies:new Set(f.facts.dependencies)};return dt(l,{code:f.code,facts:e,source:s.source}),K(o,r,i)&&at(e,o,n),{code:f.code,dependencies:e.dependencies}}let p={dependencies:new Set,hasDynamicImport:!1,hasNestedRequire:!1,hasNonLiteralRequire:!1,hasTopLevelAwait:!1,hasTopLevelRequire:!1},m=it(p),h=Error.prepareStackTrace,g=Error.stackTraceLimit;try{let t=e.transform({...s,babel:{...s.babel,plugins:[...Array.isArray(s.babel?.plugins)?s.babel.plugins:[],m]}});return l!==void 0&&dt(l,{code:t,facts:p,source:s.source}),K(o,r,i)&&at(p,o,n),d!==void 0&&a?.write(d,{code:t,facts:ft(p)}),{code:t,dependencies:p.dependencies}}finally{Error.prepareStackTrace=h,Error.stackTraceLimit=g}}const mt=/\.[cm]?[jt]sx?$/;function ht(e,t,n){let r=G(v(n)?n:x(g(t),n));if(_(r))return[r];let i=Array.from(new Set([``,...e.options.extensions??[],`.json`])),a=[r,x(r,`index`)].flatMap(e=>i.map(t=>`${e}${t}`));return a.push(x(r,`package.json`)),a}function gt(t,n,r){if(r.startsWith(`node:`))return[];try{let i=W(r)?t.esmResolve(r,{parentURL:D(n).href,try:!0}):e(n).resolve(r);if(!i)return W(r)?ht(t,n,r):[];let a=i.startsWith(`file:`)?E(i):i;return v(a)?[G(a)]:[]}catch{return W(r)?ht(t,n,r):[]}}async function _t(e,t,n,r,i,a,o){let s=[e],c;for(let l=0;l<s.length;l++){let u=s[l];if(!u||!mt.test(_(u)))continue;let d;try{d=await T(u,`utf8`)}catch(e){if(e.code===`ENOENT`)continue;throw e}u===e&&(c=d);let{dependencies:f}=pt(n,{source:d,filename:u,async:u===e,ts:/\.[cm]?tsx?$/.test(u)},e,r,i,o);for(let e of f)for(let n of gt(t,u,e))!a.has(n)&&K(n,r,i)&&(a.add(n),s.push(n))}return c}async function vt(e,t){try{let{createPresetTransformDiskCache:n}=await import(`./presetTransformDiskCache-BNUNLsPo.js`);return n(e,import.meta.url,t)}catch{return}}function J(e,t){if(!e||typeof e!=`object`)return;let n=Ye.get(e)??[];Ye.set(e,Array.from(new Set([...n,...t])))}function yt(e){return e&&typeof e==`object`?[...Ye.get(e)??[]]:[]}async function bt(t,n,r){let i=G(t),a=e(i),o=Object.create(null),s=new Set([i]),c=new Map,l={packageRoot:$e(i,c),fallbackRoot:g(i)},[{createJiti:u,transformer:d},f]=await Promise.all([Je(),vt(i,r)]),p=u(i,{fsCache:!1,interopDefault:!0,moduleCache:!1,tryNative:!1,transform:e=>{let{code:t}=pt(d,e,i,l,c,f);return{code:t}}}),m=()=>{let e=new Set;for(let t of Object.values(o))tt(t,s,e,l,c);for(let t of s)tt(a.cache[t],s,e,l,c)};try{let e=await _t(i,p,d,l,c,s,f)??await T(i,`utf8`),{evaluation:t}=await rt(l.packageRoot??l.fallbackRoot,()=>{for(let e of s)delete a.cache[e];return p.evalModule(e,{async:!0,cache:o,filename:i,forceTranspile:!0})}),r=await t,u=r?.__esModule?r.default:r;if(u==null)throw Error(`@presets "${n}" has no default export (expected a Preset or preset factory)`);let h=typeof u==`function`?await u():u;return m(),{preset:h,sources:Array.from(s)}}catch(e){m();let t=nt(e);throw J(e,t&&K(t,l,c)?[...s,t]:Array.from(s)),e}}async function xt(e){let t=await te(e),n=D(e);return n.searchParams.set(`version`,`${t.mtimeMs}:${t.ctimeMs}:${t.size}:${t.ino}`),(await import(n.href)).default}async function St(e,t){let n=[],r=new Set,i={protectedSlotsByDirectory:new Map};for(let a of e){let e;try{e=Qe(a,t);let o;if(W(a)){let t=await bt(e,a,i);for(let e of t.sources)r.add(e);n.push(t.preset);continue}if(r.add(G(e)),o=await xt(e),o==null)throw Error(`@presets "${a}" has no default export (expected a Preset or preset factory)`);n.push(typeof o==`function`?await o():o)}catch(t){throw J(t,e!==void 0&&W(a)?[...r,G(e)]:r),t}}return{presets:n,sources:Array.from(r)}}async function Ct(e,t){return(await St(e,t)).presets}function wt(e){let t=e,n=/^url\(\s*([^)]*?)\s*\)$/i.exec(t);if(n)t=n[1];else if(/^url\(/i.test(t))return;let r=t[0];if(r===`"`||r===`'`){if(t.length<2||t[t.length-1]!==r)return;let e=t.slice(1,-1);return e.includes(r)?void 0:e}return n?t:void 0}function Tt(e){return!(!e||e.startsWith(`//`)||/^[a-z][\w+.-]*:/i.test(e))}function Et(e){return e.split(`\\`).join(`/`)}function Dt(e,t,n,r){if(!Tt(e)||v(e)||!r&&!e.startsWith(`./`)&&!e.startsWith(`../`))return e;let i=Et(b(n,x(t,e)));return i.startsWith(`.`)?i:`./${i}`}function Ot(e,t){if(t.length===0)return e;t.sort((e,t)=>e.start-t.start);let n=``,r=0;for(let i of t)n+=e.slice(r,i.start)+i.replacement,r=i.end;return n+e.slice(r)}function kt(e){let t=e.length;for(;;){for(;t>0&&/\s/.test(e[t-1]);)t--;let n=e.endsWith(`*/`,t)?e.lastIndexOf(`/*`,t-3):-1;if(n===-1)break;t=n}return t>0&&e[t-1]!==`;`&&e[t-1]!==`}`}function At(e,t,n){if(t===`indented`==(n===`indented`))return e;let r=[];for(let n of I(e,!1,t))t===`indented`?(r.push({start:n.start,end:n.start,replacement:`;`}),n.terminator===`;`&&e[n.end-1]!==`;`&&r.push({start:n.end,end:n.end,replacement:`;`})):r.push({start:n.start,end:n.end,replacement:e.slice(n.start,n.end).replace(/[\n\r\f]/g,` `)});return Ot(e,r)}function jt(e,t,n,r){if(t===n)return e;let i=[];for(let a of I(e,!1,r)){if(a.terminator!==`;`||a.name!==`presets`&&a.name!==`source`)continue;let r=a.prelude[0];if(r!==`"`&&r!==`'`||a.prelude[a.prelude.length-1]!==r)continue;if(a.name===`presets`){let e=R(a.prelude).map(e=>{let r=Dt(e,t,n,!1);if(r.includes(`,`))throw SyntaxError(`@presets: rebased module paths cannot contain commas; re-export from a path without commas`);return r});i.push({start:a.start,end:a.end,replacement:`@presets ${r}${e.join(`,`)}${r};`});continue}let o=a.prelude.slice(1,-1).trim(),s=a.name===`source`&&o.startsWith(`!`),c=s?o.slice(1):o,l=Dt(c,t,n,a.name===`source`);if(l===c)continue;let u=[...e.slice(a.start,a.end).matchAll(Ve)].find(e=>!e[0].startsWith(`/*`)),d=a.start+u.index;i.push({start:d,end:d+u[0].length,replacement:`${r}${s?`!`:``}${l}${r}`})}return Ot(e,i)}function Mt(e,t,n,r,i,a,o,c,l){let u=N(l),d=u===`css`?e:F(e,u);if(Ue(d,l),o>32){for(let e of I(d,!1,u)){if(e.name!==`custom`||e.terminator!==`;`)continue;let t=_e(d,e,l);t&&a.push(t)}return d}let f=[];for(let e of I(d,!1,u)){if(e.name===`custom`&&e.terminator===`;`){let t=_e(d,e,l);t&&a.push(t)}if(e.name.toLowerCase()!==`import`||e.terminator!==`;`&&e.terminator!==`eof`)continue;let p=wt(e.prelude);if(p===void 0||!Tt(p))continue;let m=x(t,p);if(!c?.has(m))try{if(!s.statSync(m).isFile())continue}catch{i.push(m);continue}if(n.has(m)){f.push({start:e.start,end:e.end,replacement:``});continue}n.add(m),r.push(m);let h=g(m),_=Mt(c?.get(m)??s.readFileSync(m,`utf8`),h,n,r,i,a,o+1,c,m),v=N(m);_=At(jt(_,h,t,v),v,u);let y=I(_,!1,u).at(-1)?.terminator===`eof`||u!==`indented`&&kt(_);f.push({start:e.start,end:e.end,replacement:y?`${_};`:_})}return Ot(d,f)}function Nt(e,t,n,r){let i=[],a=[],o=[],s=new Set(n?[x(t,n)]:[]);try{return{css:Mt(e,t,s,i,a,o,0,r,n?x(t,n):void 0),files:i,missing:a,aliases:o}}catch(e){throw J(e,[...i,...a]),e}}function Pt(e,t){return e!=null&&Object.hasOwn(e,t)?e[t]:void 0}function Ft(e,t){let n=Pt(e,t);return oe.filter(e=>e!==`000`).every(e=>{let t=Pt(n,e);return typeof t==`string`&&!!t.trim()&&t!==`initial`})}function It(e,t){let n=le(t.theme),r=e.filter(e=>!e.alias),a=i(i({},t.theme),he(r,n).theme),o=new Set([...t.aliases??[],...e.flatMap(e=>e.alias?[e.alias.name]:[])]),s=new Set(t.aliases),c=new Set(t.physicalPalettes),l=new Set([...Re,`focused`]),u=[],d=[],f=(e,t)=>d.push({...e,message:`@custom: ${t}`});for(let r of e){let e=r.alias;if(!e){u.push(r);continue}let{name:d,family:p}=e,m=i(i({},t.theme),he(u,n).theme);!l.has(d)&&(c.has(d)||s.has(d)||Ft(m.colors,d))&&f(e.nameRange,`${d} is already a palette or alias`),s.add(d),(d!==`focused`||p!==`primary`&&p!==`neutral`)&&(l.has(p)?f(e.familyRange,`role ${p} cannot be a target (only focused may follow primary or neutral)`):o.has(p)?f(e.familyRange,`${p} is an alias and cannot be a target`):(!Ft(a.colors,p)||Object.values(a.modes??{}).some(e=>!Ft(i(i({},a.colors??{}),Pt(e,`colors`)??{}),p)))&&f(e.familyRange,`${p} must provide all 12 steps in every mode`))}if(d.length)throw new L(d);return{...he(e,n),aliases:Object.freeze([...o])}}const Lt=e=>e.replace(/\\(.)/gs,`$1`);function Y(e,t,n,r=h){if(!e||e[0]===`!`&&e[1]!==`(`)return;let i=e.endsWith(`/`)?e.slice(0,-1):e;n&&!i.endsWith(`*`)&&(i+=`/**`);let a=r.parse(i).root||r.parse(Lt(i)).root,o=h.posix.normalize(i);(a.startsWith(`\\\\`)||a.startsWith(`//`))&&!o.startsWith(`//`)&&(o=`/${o}`);let s=re.scan(o,{parts:!0}).parts,c=s?.length?s:[o],l=[];for(let e of c.slice(0,-1)){if(ae(e))break;l.push(Lt(e))}return{root:r.resolve(t,a||`.`,l.join(`/`)||`.`),literal:ae(o)?void 0:r.resolve(t,Lt(o))}}function Rt(e,t=h){let n=[];for(let r=e;;){let e=t.dirname(r);if(e===r)return n;n.push({parent:e,name:t.basename(r)}),r=e}}function zt(e,t,n){return Ht(e,t,n)}async function Bt(e,t,n){let r={routes:[],failure:void 0};try{let i=await Ht(e,t,n,r),a=[...r.routes];return r.failure?{status:`failed`,cause:r.failure.cause,routes:a}:{status:`complete`,files:i,routes:a}}catch(e){return{status:`failed`,cause:r.failure?.cause??e,routes:[...r.routes]}}}function Vt(e,t){e&&!e.failure&&t&&t.code!==`ENOENT`&&t.code!==`ENOTDIR`&&t.code!==`ELOOP`&&(e.failure={cause:t})}async function Ht(e,t,n,r){let i=new Set;for(let a of Ut(e,t))for(let e of await Wt(a,t,n,r))i.add(e);return[...i]}function Ut(e,t){let{skipBelowBase:n}=t;if(!n)return[e];let r=h.resolve(t.cwd),i=[],a=[];for(let n of e){let e=Y(n,r,t.expandDirectories);e?i.push({pattern:n,base:e.literal??e.root}):a.push(n)}let o=(e,t)=>t.startsWith(e.endsWith(h.sep)?e:`${e}${h.sep}`)&&h.relative(e,t).split(h.sep).some(n),s=[],c=i;for(;c.length;){let e=c.filter(e=>!c.some(t=>o(t.base,e.base)));s.push([...e.map(({pattern:e})=>e),...a]),c=c.filter(t=>!e.includes(t))}return s}async function Wt(e,t,n,r){let i={...s,...n},a=h.resolve(t.cwd),o=new Set,c=new Set,l=new Map,u=new Map,d=new Map,f=e=>{let t=u.get(e);return t||(t=new Promise(t=>i.realpath(e,(n,i)=>{r&&!n&&e!==i&&d.set(e,{lexical:e,physical:i,admitted:new Set}),t(n?void 0:i)})),u.set(e,t)),t};for(let n of e){let e=Y(n,a,t.expandDirectories);e&&(e.literal?c.add(e.literal):o.add(e.root))}if(!o.size&&!c.size)return[];for(let e of[...o,...c])for(let{parent:t,name:n}of Rt(e))for(let e of new Set([t,await f(t)])){if(!e)continue;let t=l.get(e);t||l.set(e,t=new Set),t.add(n)}let p=new Set([...o,...[...o,...c].flatMap(e=>Rt(e).map(({parent:e})=>e))]),m=new Map,g=e=>{let t=m.get(e);return t||(t=new Promise(t=>i.lstat(e,(n,r)=>{if(n||!r.isSymbolicLink())return t(!1);i.stat(e,(e,n)=>t(!e&&n.isDirectory()))})),m.set(e,t)),t},_=new ne,v=e=>[...o,..._.getStore()?.targets??[]].some(t=>e===t||e.startsWith(t.endsWith(h.sep)?t:`${t}${h.sep}`)),y=n?.realpathNative??s.realpath.native,b=new Map,x=e=>{let t=b.get(e);return t||(t=new Promise((t,n)=>i.readdir(e,{withFileTypes:!0},(e,r)=>e?n(e):t(r))),b.set(e,t)),t},S=async(e,t)=>{let n=async()=>(await x(e)).filter(e=>t.has(e.name));if(t.size!==1)return n();let r=[...t][0],a=h.join(e,r);try{let t=await new Promise((e,t)=>i.lstat(a,(n,r)=>n?t(n):e(r)));if(!t.isDirectory()||t.isSymbolicLink()||!/^[\x20-\x7e]+$/.test(r)||!/[A-Za-z]/.test(r))return n();let o=r.replace(/[A-Za-z]/g,e=>e===e.toLowerCase()?e.toUpperCase():e.toLowerCase()),s=e=>new Promise((t,n)=>y(e,(e,r)=>e?n(e):t(r))),c=await s(a),l=h.basename(c);if(!/^[\x20-\x7e]+$/.test(l)||l.toLowerCase()!==r.toLowerCase())return n();try{if(await s(h.join(e,o))!==c)return n()}catch(e){if(e.code!==`ENOENT`||l!==r)return n();l=r}return[{name:l,parentPath:e,isFile:()=>t.isFile(),isDirectory:()=>t.isDirectory(),isSymbolicLink:()=>t.isSymbolicLink(),isBlockDevice:()=>t.isBlockDevice(),isCharacterDevice:()=>t.isCharacterDevice(),isFIFO:()=>t.isFIFO(),isSocket:()=>t.isSocket()}]}catch{return n()}},ee=(e,n,a)=>{let s=h.resolve(e);if(v(s)){let o=_.getStore()?.link;if(!o&&r){let e=[...d.keys()].filter(e=>s.startsWith(`${e}${h.sep}`)).sort((e,t)=>t.length-e.length)[0];e&&(o=d.get(e))}if(o&&r){let e=s===o.physical?s:h.resolve(o.physical,h.relative(o.lexical,s));[...o.admitted].some(t=>e===t||e.startsWith(`${t}${h.sep}`))||(o.admitted.add(e),r.routes.push({lexical:s===o.physical?o.lexical:s,physical:e,status:`entered`}))}return i.readdir(e,n,(e,n)=>{Vt(r,e),e&&e.code!==`ENOENT`&&e.code!==`ENOTDIR`&&t.onUnreadableDirectory?.(s);let{skipBelowBase:i}=t;a(e,n&&i?n.filter(e=>!i(e.name)):n)})}let c=_.getStore()?.ancestor,u=c?.directory===s?c.children:l.get(s);if(!u?.size)return a(null,[]);S(s,u).then(async e=>Promise.all(e.map(async e=>{let t=h.join(s,e.name);if(!e.isSymbolicLink()||o.has(t)||!l.has(t))return e;try{if(!await g(t))return e;let n=[...p].filter(e=>e.startsWith(`${t}${h.sep}`)),r=await f(t);return!r||!(await Promise.all(n.map(async e=>await g(e)?f(e):void 0))).some(e=>e?.startsWith(`${r}${h.sep}`))?e:{...e,isDirectory:()=>!0,isSymbolicLink:()=>!1,isFile:()=>!1,isBlockDevice:()=>e.isBlockDevice(),isCharacterDevice:()=>e.isCharacterDevice(),isFIFO:()=>e.isFIFO(),isSocket:()=>e.isSocket()}}catch{return e}}))).then(e=>a(null,e),e=>{Vt(r,e),a(e,[])})},C=(e,t)=>{let n=_.getStore(),a=n?.targets??[],o=v(h.resolve(e)),s=l.get(h.resolve(e));i.realpath(e,(c,l)=>{if(Vt(r,c),r&&c&&(c.code===`ENOENT`||c.code===`ENOTDIR`||c.code===`ELOOP`))return i.readlink(e,(n,i)=>{n||r.routes.push({lexical:h.resolve(e),physical:h.resolve(h.dirname(e),i),status:`unresolved`}),t(c,l)});_.run({targets:!c&&o?[...a,h.resolve(l)]:a,link:c?n?.link:{lexical:h.resolve(e),physical:h.resolve(l),admitted:new Set},ancestor:!c&&s?{directory:h.resolve(l),children:s}:n?.ancestor},t,c,l)})},w=((e,t)=>i.stat(e,(e,n)=>{Vt(r,e),t(e,n)}));try{return await ie(e,{...t,absolute:!0,fs:{...i,stat:w,readdir:ee,realpath:C}})}finally{_.disable()}}function Gt(e,t){return zt(e,t)}const X=Symbol.for(`@teacss/config/source-declarations`);function Z(e){return e[X]}function Kt(e){return Z(e)?.consumed}function qt(e,t){return Object.defineProperty(e,X,{value:{consumed:t,attempted:t,recovered:!1},configurable:!0}),e}function Q(e,t){let n=Z(t);return n&&Object.defineProperty(e,X,{value:n,configurable:!0}),e}function Jt(e,t,n){return Object.defineProperty(e,X,{value:{consumed:t&&Kt(t),attempted:n,recovered:t!==void 0},configurable:!0}),e}function Yt(e,t){let n=Z(e),r={consumed:t,attempted:n?.attempted,recovered:n?.recovered??!1};return Object.defineProperty(e,X,{value:r,configurable:!0}),r}function $(e){return JSON.stringify([e.base,e.patterns,e.ignore,e.inlined])}function Xt(e){let t=new Map;for(let n of[e?.consumed,e?.attempted])n&&t.set($(n),n);return[...t.values()]}function Zt(e){return[...new Set([e?.consumed,e?.attempted].flatMap(e=>e?.status===`read`?e.members.map(e=>e.path):[]))]}function Qt(e){return[...Xt(e).flatMap(({patterns:e,base:t})=>cn(e,t)),...Zt(e).map(e=>({kind:`exact`,path:e})),...[e?.consumed,e?.attempted].flatMap(e=>[...e?.status===`failed`&&e.operation===`read`&&e.path?[{kind:`exact`,path:e.path}]:[],...(e?.routes??[]).map(e=>({kind:e.status===`entered`?`tree`:`exact`,path:e.physical}))])]}function $t(e,t,n,r=[]){return Object.freeze({base:e,patterns:Object.freeze([...t]),ignore:Object.freeze([...r]),inlined:Object.freeze([...n])})}function en(e,t,n,r,i=[],a=[]){return{...$t(e,t,n,i),status:`read`,members:r,routes:a,signature:JSON.stringify([e,t,i,n,`read`,r,a])}}const tn=e=>e===`node_modules`||e.startsWith(`.`),nn=(e,t)=>b(e,t).split(S).some(e=>e!==`..`&&e.startsWith(`.`));function rn(e,t){return e.filter(e=>{let n=Y(e,t,!1);return!n||!nn(t,n.literal??n.root)})}async function an(e,t){let n=[],r=()=>n.sort((e,t)=>e.lexical.localeCompare(t.lexical)||e.physical.localeCompare(t.physical)||e.status.localeCompare(t.status)),i=`enumerate`,a;try{let o=await Bt(ln(rn(e.patterns,e.base),e.base),{cwd:e.base,ignore:e.ignore,expandDirectories:!1,skipBelowBase:tn});if(n.push(...o.routes),o.status===`failed`)throw o.cause;let s=o.files.filter(t=>t.endsWith(`.css`)&&!e.inlined.includes(t)).sort();i=`read`;let c=s.map(e=>(a=e,{path:e,contents:t?.get(e)??d(e,`utf8`)}));return en(e.base,e.patterns,e.inlined,c,e.ignore,r())}catch(t){let o=t,s=[typeof t,o?.name,o?.message??String(t),o?.code];return{...e,status:`failed`,operation:i,path:a,cause:t,routes:r(),signature:JSON.stringify([$(e),`failed`,i,a,s,n])}}}async function on(e,t=!1,n){let r=Xt(e),i=await Promise.all(r.map(r=>{if(t){if(r===e?.attempted)return r;let t=n?.attempts.find(e=>$(e)===$(r));if(t)return t}return an(r)}));return{attempts:i,signature:JSON.stringify(i.map(e=>e.signature))}}function sn(e,t,n){let r=!1,i,a=Promise.resolve(),o;function s(){o=setTimeout(()=>{a=(async()=>{let n=e(),a=i??await on(n,!0),o=await on(n);r||n!==e()||(i=o,o.signature!==a.signature&&await t(o))})().catch(async e=>{r||await n(e)}).finally(()=>{r||s()})},500)}function c(){r=!0,clearTimeout(o)}return s(),{retire:c,async close(){c(),await a}}}function cn(e,t,n=!1){let r=rn(e,t),i=new Set(un(r,t).map(({pattern:e})=>e));return r.flatMap(e=>{let r=Y(e,t,n);return r?[{kind:r.literal&&!i.has(e)?`exact`:`tree`,path:r.literal??r.root}]:[]})}function ln(e,t){let n=new Set(un(e,t).map(({pattern:e})=>e));return e.map(e=>n.has(e)?`${e.replace(/\/+$/,``)}/**`:e)}function un(e,t){return e.flatMap(e=>{let n=Y(e,t,!1)?.literal;if(!n)return[];try{return m(n).isDirectory()?[{pattern:e,directory:n}]:[]}catch{return[]}})}function dn(e){let t=new Map,n=[],r=new Map,i=e=>{if(r.has(e))return r.get(e);let t;try{let n=m(e);n.isDirectory()&&(t=n)}catch(e){let t=e.code;if(t===`EACCES`)n.push(e);else if(t!==`ENOENT`&&t!==`ENOTDIR`&&t!==`ELOOP`)throw e}return r.set(e,t),t},a=(e,n,r)=>{let a=i(e);if(!a)return;let o=`${a.dev}:${a.ino}`,s=`${n}:${o}`,c=t.get(s);t.set(s,{directory:c?.directory??e,recursive:n,identity:o,children:r?[...new Set([...c?.children??[],r])].sort():[]})},o=e.map(e=>({path:e.path,links:new Set})),s=new Set;for(let t of e)t.kind===`tree`&&a(t.path,!0);for(let e of o){if(s.has(e.path))continue;s.add(e.path);let t=Rt(e.path);for(let{parent:e,name:n}of t)a(e,!1,n);for(let{parent:r,name:i}of t.reverse()){let t=y(r,i);try{let n=u(t);if(!n.isSymbolicLink())continue;let i=`${n.dev}:${n.ino}`;if(e.links.has(i))break;o.push({path:x(r,f(t),b(t,e.path)),links:new Set([...e.links,i])});break}catch(e){let t=e.code;if(t===`EACCES`){n.push(e);break}if(t!==`ENOENT`&&t!==`ENOTDIR`&&t!==`ELOOP`)throw e}}}return{plans:[...t.values()],permissionErrors:n}}function fn(e,t){if(e.recursive||t===null)return!0;let n=t.toString().split(S)[0].normalize(`NFC`).toLowerCase();return e.children.some(e=>e.normalize(`NFC`).toLowerCase()===n)}function pn(e){let t=e.members.map(e=>e.path),n=[],r=[];for(let{contents:t}of e.members){if(!t.includes(`@shortcut`)&&!t.includes(`@safelist`))continue;let e=B(t);n.push(...e.shortcuts),r.push(...e.safelist)}return{shortcuts:n,safelist:r,files:t,snapshot:e}}function mn(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r===`\\`){if(++n>=e.length)return`dangling '\\'`}else if(r===`{`)t++;else if(r===`}`){if(t--===0)return`unopened alternate group; missing '{' (maybe escape '}' with '[}]'?)`}else if(r===`[`){let t=n+1;(e[t]===`!`||e[t]===`^`)&&t++;let r=!0,i,a;for(;;t++){let n=e[t];if(n===void 0)return`unclosed character class; missing ']'`;if(n===`]`&&!r)break;if(n===`-`&&!r&&i===void 0)i=a;else{if(i!==void 0&&n<i)return`invalid character range`;i=void 0,a=n}r=!1}n=t}}if(t>0)return`unclosed alternate group; missing '}' (maybe escape '{' with '[{]'?)`}function hn(e,t){for(let{glob:n,exclude:r}of e){let e=mn(n);if(e)return[{file:t,start:0,end:0,message:`@source "${r?`!`:``}${n}" is not a glob: ${e}`}]}return[]}async function gn(e,n,r,s,c){let l=Nt(e,n,r,s),u=[...l.files,...l.missing],d=N(r),f=B(l.css,void 0,d),p=0;for(let e of f.custom)e.alias&&=l.aliases[p++];let m=hn(f.sources,r);if(m.length){let e=new L(m);throw J(e,u),e}let h=an($t(n,f.sources.filter(e=>!e.exclude).map(e=>e.glob),r===void 0?l.files:[...l.files,x(n,r)],f.sources.filter(e=>e.exclude).map(e=>e.glob)),s).then(e=>{if(c.attempt=e,e.status===`failed`)throw e.cause;return pn(e)}),[g,_]=await Promise.all([f.presets.length?St(f.presets,n):{presets:[],sources:[]},h]).catch(async e=>{throw await h.catch(()=>void 0),J(e,u),e}),v=g.presets,y={},b=[],S=[],ee=Object.freeze(Object.fromEntries(Object.entries(f.rolePalettes??{}).map(([e,t])=>[e,Object.freeze([...t])]))),C={name:`@teacss/config/role-palettes`,configResolved(e){Object.defineProperty(e,Symbol.for(`@teacss/config/role-palettes`),{value:ee,configurable:!0}),Object.defineProperty(e,Symbol.for(`@teacss/config/color-aliases`),{value:S,configurable:!0})}};await a({presets:v,configResolved(e){let t=e;if({theme:y,unknown:b,aliases:S}=It(f.custom,{theme:e.theme,physicalPalettes:t[Symbol.for(`@teacss/preset-standard/physical-palettes`)],aliases:t[Symbol.for(`@teacss/config/color-aliases`)]}),f.rolePalettes&&!e.presets.some(e=>e.name===`@teacss/preset-standard`))throw TypeError(`Role palette directives require an explicitly enabled Standard preset`);e.theme=i(e.theme,y),(f.rolePalettes||S.length)&&C.configResolved?.(e)}}).catch(e=>{throw J(e,[...u,..._.files,...g.sources]),e});let w=[...f.sources.filter(e=>!e.exclude).map(e=>e.glob),...f.sources.filter(e=>e.exclude).map(e=>`!${e.glob}`)],T=[..._.shortcuts,...f.shortcuts],te=Object.fromEntries(T.map(({name:e,expansion:t})=>[e,t])),E=[...new Set([..._.safelist,...f.safelist].flatMap(e=>o(t(e))))],D={presets:f.rolePalettes||S.length?[...v,C]:v,theme:y,...f.sources.length?{content:{filesystem:w}}:{},...T.length?{shortcuts:te}:{},...E.length?{safelist:E}:{}},ne=Object.freeze({base:n,entryFile:r,entryCss:r===void 0?void 0:e,derivedKeys:Object.keys(D)});return Object.defineProperty(D,Symbol.for(`@teacss/config/entry-provenance`),{value:ne,configurable:!0}),qt(D,_.snapshot),qt({config:D,unknown:b,hasTeacss:l.files.length===0?f.hasTeacss:B(e,void 0,d).hasTeacss,sources:[...u,..._.files,...g.sources]},_.snapshot)}async function _n(e,t,n,r){let i={};try{return{status:`resolved`,result:await gn(e,t,n,r,i)}}catch(e){return{status:`failed`,cause:e,attempt:i.attempt}}}const vn=Symbol.for(`@teacss/config/entry-provenance`);function yn(e,t){let n=Object.getOwnPropertyDescriptor(t,vn);return n&&Object.defineProperty(e,vn,{value:n.value,configurable:!0}),e}const bn=Object.freeze([`package.json`,`index.css`,`src/index.css`]),[xn,...Sn]=bn;function Cn(e,t){let n={...e};for(let i of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(t,i)?.enumerable)continue;let a=Reflect.get(t,i);a!==void 0&&(i===`content`&&e.content&&(a=r([e.content,a])),Object.defineProperty(n,i,{value:a,configurable:!0,enumerable:!0,writable:!0}))}return n}function wn(e){try{let t=c.readFileSync(e,`utf8`);return t.includes(`@teacss`)?I(t,!1,N(e)).some(e=>e.name===`teacss`&&e.prelude===``&&e.terminator!==`block`):!1}catch(e){if(e.code===`ENOENT`)return!1;throw e}}function Tn(e){try{let t=JSON.parse(c.readFileSync(y(e,xn),`utf8`))?.teacss?.entry;return typeof t==`string`?t:void 0}catch(e){if(e.code===`ENOENT`)return;throw e}}function En(e){let t=Tn(e);if(t){let n=x(e,t);if(c.existsSync(n)&&c.statSync(n).isFile())return n}for(let t of Sn){let n=y(e,t);if(c.existsSync(n)&&c.statSync(n).isFile()&&wn(n))return n}}async function Dn(e,t,n,r){if(typeof t!=`string`)return{config:Cn(n,t),sources:[]};let i=x(e,t),a=c.existsSync(i)&&c.statSync(i).isFile()?i:En(i);if(!a)return{config:{...n},sources:[]};let o;try{o=c.readFileSync(a,`utf8`)}catch(e){throw J(e,[a]),e}let s=await _n(o,g(a),a);if(s.status===`failed`)throw r.attempt=s.attempt,J(s.cause,[a]),s.cause;let l=s.result,{config:u}=l,d=Cn(n,u);return Q(d,u),yn(d,u),u.presets?.length||(n.presets?.length?d.presets=n.presets:C.warn(`[@teacss/config] ${a}: the entry selects no preset, so no class matches; add @presets "standard"; (built-in presets: standard, icons, official)`)),Q({config:d,sources:Array.from(new Set([a,...l.sources]))},l)}async function On(e,t,n){let r={};try{return{status:`resolved`,result:await Dn(e,t,n,r)}}catch(e){return{status:`failed`,cause:e,attempt:r.attempt}}}async function kn(e=ee.cwd(),t=e,n={}){let r=await On(e,t,n);if(r.status===`failed`)throw r.cause;return r.result}function An(e){let t=e instanceof Error?`${e.name}:${e.message}`:`${typeof e}:${String(e)}`,n=Array.from(new Set(yt(e))).sort().map(e=>{try{let t=c.statSync(e);return`${e}:${t.mtimeMs}:${t.ctimeMs}:${t.size}:${t.ino}`}catch(t){let n=t.code;return`${e}:${n===`ENOENT`?`missing`:`unreadable:${n??String(t)}`}`}});return JSON.stringify([t,n])}function jn(e=!1){let t=new Map,n=new WeakMap,r=new WeakMap,i=(i=ee.cwd(),a=i,o={})=>{let s;if(typeof a==`string`){let e=x(i,a);s=t.get(e),s||t.set(e,s={version:0})}else typeof a==`object`&&a&&(s=n.get(a),s||n.set(a,s={version:0}));let c=s??{version:0},l=++c.version,u=On(i,a,o).then(async t=>{if(t.status===`resolved`)return e||r.set(t.result,{slot:c,version:l}),c.version===l&&(c.reportedFailure=void 0,e&&(c.accepted=t.result)),Q(u,t.result),t.result;if(c.version!==l)for(;;){let e=c.version,t=c.latest;try{let n=await t;if(c.version!==e)continue;return Q(u,t),n}catch(n){if(c.version!==e)continue;throw Q(u,t),n}}let n=c.accepted;if(!n)throw Jt(u,void 0,t.attempt),t.cause;let i=An(t.cause);c.reportedFailure!==i&&(C.error(`[@teacss/config] Error resolving config from the CSS entry:`,t.cause),c.reportedFailure=i);let a=Array.from(new Set([...n.sources,...yt(t.cause)])),o=Jt({...n,sources:a},n,t.attempt);return Q(u,o),o});return c.latest=u,u};return i.accept=(e,t=e)=>{let n=r.get(e);n&&n.version===n.slot.version&&(r.delete(e),n.slot.accepted=Q({...t,sources:[...t.sources]},t))},i}export{oe as $,B as A,je as B,fn as C,yt as D,It as E,He as F,j as G,Le as H,z as I,ue as J,Oe as K,R as L,Re as M,Ve as N,Ct as O,Ue as P,le as Q,F as R,Kt as S,Yt as T,xe as U,Se as V,I as W,he as X,pe as Y,me as Z,Xt as _,_n as a,Z as b,sn as c,an as d,dn as f,$t as g,Gt as h,kn as i,L as j,We as k,un as l,Jt as m,bn as n,qt as o,on as p,De as q,En as r,Q as s,jn as t,ln as u,Zt as v,cn as w,Qt as x,en as y,N as z};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teacss/config",
3
- "version": "0.10.14",
3
+ "version": "0.10.16",
4
4
  "description": "TeaCSS config loader — discovers the CSS entry and resolves its directives into a config (no teacss.config file).",
5
5
  "homepage": "https://css.teasim.com",
6
6
  "funding": "https://github.com/sponsors/billgo",
@@ -23,7 +23,7 @@
23
23
  "dev": "tsdown --watch"
24
24
  },
25
25
  "dependencies": {
26
- "@teacss/core": "0.10.14",
26
+ "@teacss/core": "0.10.16",
27
27
  "consola": "^3.4.2",
28
28
  "jiti": "^2.7.0",
29
29
  "picomatch": "4.0.7",
@@ -1,3 +0,0 @@
1
- import{createRequire as e}from"node:module";import{expandClassGroups as t,isCssNameCharacter as n,mergeContentOptions as r,mergeDeep as i,resolveConfig as a,splitClassTokens as o}from"@teacss/core";import*as s from"node:fs";import c,{existsSync as l,lstatSync as u,readFileSync as d,readlinkSync as f,realpathSync as p,statSync as m}from"node:fs";import*as h from"node:path";import{dirname as g,extname as _,isAbsolute as v,join as y,relative as b,resolve as x,sep as S}from"node:path";import ee from"node:process";import{consola as C}from"consola";import{Buffer as w}from"node:buffer";import{readFile as T,stat as te}from"node:fs/promises";import{fileURLToPath as E,pathToFileURL as D}from"node:url";import{AsyncLocalStorage as ne}from"node:async_hooks";import re from"picomatch";import{glob as ie,isDynamicPattern as ae}from"tinyglobby";const O=[`000`,`100`,`150`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`850`,`900`,`950`],oe=new Set(O);function se(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function ce(e){return Object.keys(e).filter(t=>{if(t===`modes`||t===`defaultMode`||t===`rolePalettes`)return!1;let n=e[t];return typeof n!=`object`||!n?!1:t===`colors`||Object.values(n).every(e=>e==null||typeof e==`string`||typeof e==`number`||Array.isArray(e))})}function le(e){return e.map(e=>({key:e,prefix:e===`colors`||e===`semanticColors`?`color`:se(e),twoLevel:e===`colors`,semanticColor:e===`semanticColors`})).sort((e,t)=>t.prefix.length-e.prefix.length)}function ue(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}function k(e,t){let n=Object.hasOwn(e,t)?e[t]:void 0;if(typeof n==`object`&&n&&!Array.isArray(n))return n;let r={};return ue(e,t,r),r}function de(e,t){if(![...e].every(n))return{ok:!1,reason:`unknown-prefix`};let r=t.filter(t=>e===t.prefix||e.startsWith(`${t.prefix}-`)),i=r.find(e=>e.key===`colors`),a=r.find(e=>e.semanticColor);if(i&&a){let t=e===`color`?``:e.slice(6),n=t.lastIndexOf(`-`),r=n>0?t.slice(0,n):``,o=n>0?t.slice(n+1):``;return r&&oe.has(o)?{ok:!0,nsKey:i.key,twoLevel:!0,rest:t,colorName:r,step:o}:r&&/^\d+$/.test(o)?{ok:!1,reason:`illegal-color-step`}:t?{ok:!0,nsKey:a.key,twoLevel:!1,rest:t}:{ok:!1,reason:`unknown-prefix`}}let o=r[0];if(!o)return{ok:!1,reason:`unknown-prefix`};let s=e===o.prefix?``:e.slice(o.prefix.length+1);if(o.twoLevel){let e=s.lastIndexOf(`-`),t=e>0?s.slice(0,e):``,n=e>0?s.slice(e+1):``;return!t||!oe.has(n)?{ok:!1,reason:`illegal-color-step`}:{ok:!0,nsKey:o.key,twoLevel:!0,rest:s,colorName:t,step:n}}return{ok:!0,nsKey:o.key,twoLevel:!1,rest:s}}function fe(e){return e.nsKey===`colors`||e.nsKey===`semanticColors`}function pe(e,t){let n=le(t),r={},i=[],a=e=>{let t=de(e.startsWith(`--`)?e.slice(2):e,n);return t.ok||i.push(e),t},o=(e,t,n)=>{let r=k(e,t.nsKey);t.twoLevel?ue(k(r,t.colorName),t.step,n):ue(r,t.rest||`DEFAULT`,n)};for(let t of e){let e=t.mode?k(k(r,`modes`),t.mode):r;for(let{property:n,value:r}of t.declarations){let s=a(n);s.ok&&(t.mode&&!fe(s)?i.push(n):o(e,s,r))}}return{theme:r,unknown:i}}function me(e){if(e.terminator!==`;`)return`expected @custom <name> "<family>"; without a mode or block`;let t=/^(\S+)\s+(["'])([^"']*)\2$/.exec(e.prelude);if(!t)return`expected one name and one complete quoted target without extra arguments`;if(!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(t[1])||/^\d+$/.test(t[1].split(`-`).at(-1)))return`alias names must use lowercase kebab-case with a nonnumeric final segment`;if(!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(t[3]))return`target must be one lowercase kebab-case palette name, without a list`}function he(e,t,n){if(me(t))return;let r=e.slice(t.start,t.end).replace(/(["'])(?:\\.|(?!\1)[\s\S])*?\1|\/\*[\s\S]*?\*\//g,e=>e.startsWith(`/*`)?e.replace(/[^\r\n]/g,` `):e),i=/^@custom\s+(\S+)\s+(["'])([^"']*)\2\s*;?$/.exec(r);if(!i)return;let a=t.start+r.indexOf(i[1],7),o=t.start+r.indexOf(i[2],a-t.start+i[1].length)+1;return{name:i[1],family:i[3],statement:{file:n,start:t.start,end:t.end},nameRange:{file:n,start:a,end:a+i[1].length},familyRange:{file:n,start:o,end:o+i[3].length}}}function ge(e){return O.map(t=>({property:`--color-${e.name}-${t}`,value:`var(--color-${e.family}-${t}${t===`000`?`, white`:``})`}))}const _e=/[\w-]/,ve=/[\w.#-]/,A=/\s/;function j(e,t,n){let r=e.indexOf(`*/`,t+2);return r<0||r>=n?n:r+2}function M(e,t,n){let r=e[t];for(let i=t+1;i<n;i++)if(e[i]===`\\`)i++;else if(e[i]===r)return i+1;return n}function N(e,t){if(e.slice(t,t+4).toLowerCase()!==`url(`||ve.test(e[t-1]??``))return t;let n=t+4;for(;A.test(e[n]??``);)n++;if(e[n]===`"`||e[n]===`'`)return t;for(;n<e.length;n++)if(e[n]===`\\`)n++;else if(e[n]===`)`)return n+1;return t}function P(e,t,n){let r=``;for(let i=t;i<n;i++)if(e[i]===`/`&&e[i+1]===`*`)i=j(e,i,n)-1,r+=` `;else if(e[i]===`"`||e[i]===`'`){let t=M(e,i,n);r+=e.slice(i,t),i=t-1}else if(N(e,i)>i){let t=Math.min(N(e,i),n);r+=e.slice(i,t),i=t-1}else r+=e[i];return r.trim()}function ye(e,t){let n=[],r=t.startsWith(`@`)?t.slice(1):t;for(let t of R(e)){if(t.name!==r||t.terminator!==`;`)continue;let e=t.prelude[0];if(e!==`"`&&e!==`'`)continue;let i=M(t.prelude,0,t.prelude.length);i!==t.prelude.length||i<=1||t.prelude[i-1]!==e||n.push(t.prelude.slice(1,i-1))}return n}function be(e,t){let n=t.startsWith(`@`)?t.slice(1):t;return R(e).some(e=>e.name===n)}function F(e){let t=e?.split(`?`).flatMap(e=>/\.(scss|less|sass|styl|stylus)$/i.exec(e)?.[1]?.toLowerCase()??[])[0];return t?t===`scss`?`braced`:t===`less`?`less`:`indented`:`css`}const xe=/--[\w-]*\s*:/y,I=e=>e===`
2
- `||e===`\r`||e===`\f`;function Se(e,t){let n=t;for(;n<e.length&&!I(e[n]);)n++;return n}function Ce(e,t){if(e[t]!==`}`)return!1;let n=0;for(let r=t;r>=0;r--)if(e[r]===`}`)n++;else if(e[r]===`{`&&--n===0)return e[r-1]===`#`||e[r-1]===`@`;else if(e[r]===`;`)return!1;return!1}function we(e,t,n){if(n===`less`||e[t]!==`-`||e[t+1]!==`-`||_e.test(e[t-1]??``)||Ce(e,t-1)||(xe.lastIndex=t,!xe.test(e)))return t;let r=0;for(let t=xe.lastIndex;t<e.length;t++){let i=e[t];if(i===`/`&&e[t+1]===`*`)t=j(e,t,e.length)-1;else if(i===`"`||i===`'`)t=M(e,t,e.length)-1;else if(i===`\\`)t++;else if(i===`(`||i===`[`||i===`{`)r++;else if((i===`)`||i===`]`||i===`}`)&&r>0)r--;else if(r===0&&(i===`;`||i===`}`||n===`indented`&&I(i)))return t}return e.length}function Te(e,t,n){return e===`{`||e===`}`||e===`;`||n===`indented`&&I(e)?!0:t&&A.test(e)}function L(e,t=`braced`){let n=``,r=0,i=!0;for(let a=0;a<e.length;a++)if(e[a]===`/`&&e[a+1]===`*`)a=j(e,a,e.length)-1;else if(e[a]===`/`&&e[a+1]===`/`){let t=Se(e,a);n+=e.slice(r,a)+` `.repeat(t-a),r=t,a=t-1}else i&&we(e,a,t)>a?(a=we(e,a,t)-1,i=!1):(i=Te(e[a],i,t),e[a]===`"`||e[a]===`'`?a=M(e,a,e.length)-1:e[a]===`\\`?a++:N(e,a)>a&&(a=N(e,a)-1));return r?n+e.slice(r):e}function Ee(e,t){let n=t;for(;n<e.length;)if(A.test(e[n]))n++;else if(e[n]===`/`&&e[n+1]===`*`)n=j(e,n,e.length);else break;return n}function De(e,t){for(let n=t;n<e.length;n++)if(e[n]===`/`&&e[n+1]===`*`)n=j(e,n,e.length)-1;else if(e[n]===`"`||e[n]===`'`)n=M(e,n,e.length)-1;else if(e[n]===`{`)return n;else if(e[n]===`;`||e[n]===`}`)return-1;return-1}function Oe(e,t){let n=1;for(let r=t+1;r<e.length;r++)if(e[r]===`/`&&e[r+1]===`*`)r=j(e,r,e.length)-1;else if(e[r]===`"`||e[r]===`'`)r=M(e,r,e.length)-1;else if(e[r]===`\\`)r++;else if(N(e,r)>r)r=N(e,r)-1;else if(e[r]===`{`)n++;else if(e[r]===`}`&&--n===0)return r;return-1}function R(e,t=!1,n=`css`){let r=n===`css`?e:L(e,n),i=[],a=0,o=!0;for(let e=0;e<r.length;e++){if(r[e]===`/`&&r[e+1]===`*`){e=j(r,e,r.length)-1;continue}if(n===`indented`&&I(r[e])){o=!0;continue}if(A.test(r[e]))continue;if(n===`css`&&a===0&&o&&r[e]===`/`&&r[e+1]===`/`){e=Se(r,e)-1;continue}let s=o;if(o=!1,r[e]===`"`||r[e]===`'`){e=M(r,e,r.length)-1;continue}if(r[e]===`\\`){e++;continue}let c=N(r,e);if(c>e){e=c-1;continue}if(r[e]===`{`){a++,o=!0;continue}if(r[e]===`}`){a=Math.max(0,a-1),o=!0;continue}if(r[e]===`;`){o=!0;continue}if(!t&&a!==0||r[e]!==`@`||!s)continue;let l=e,u=l+1;for(;_e.test(r[u]??``);)u++;if(u===l+1||r[Ee(r,u)]===`:`)continue;let d=r.slice(l+1,u),f=[],p=!1;for(let s=u;s<r.length;s++){let c=r[s];if(c===`/`&&r[s+1]===`*`)s=j(r,s,r.length)-1;else if(c===`"`||c===`'`)s=M(r,s,r.length)-1;else if(c===`\\`)s++;else if(N(r,s)>s)s=N(r,s)-1;else if(c===`(`)f.push(`)`);else if(c===`[`)f.push(`]`);else if(c===f.at(-1))f.pop();else if(f.length===0&&c===`;`){i.push({name:d,prelude:P(r,u,s),start:l,end:s+1,terminator:`;`,...t?{depth:a}:{}}),e=s,o=!0,p=!0;break}else if(f.length===0&&n===`indented`&&I(c)){i.push({name:d,prelude:P(r,u,s),start:l,end:s,terminator:`;`,...t?{depth:a}:{}}),e=s-1,p=!0;break}else if(f.length===0&&c===`}`){i.push({name:d,prelude:P(r,u,s),start:l,end:s,terminator:`}`,...t?{depth:a}:{}}),e=s-1,p=!0;break}else if(f.length===0&&c===`{`){let n=Oe(r,s);(n>=0||t)&&(i.push({name:d,prelude:P(r,u,s),start:l,end:n<0?r.length:n+1,terminator:`block`,...t?{depth:a}:{}}),e=t?s:n,t&&a++,o=!0,p=!0);break}}if(!p){i.push({name:d,prelude:P(r,u,r.length),start:l,end:r.length,terminator:`eof`,...t?{depth:a}:{}});break}}return i}function ke(e,t,n){let r=[];for(let i=t;i<n;i++){let t=e[i];if(t===`/`&&e[i+1]===`*`)i=j(e,i,n)-1;else if(t===`"`||t===`'`)i=M(e,i,n)-1;else if(t===`\\`)i++;else if(N(e,i)>i)i=N(e,i)-1;else if(t===`(`)r.push(`)`);else if(t===`[`)r.push(`]`);else if(t===`{`)r.push(`}`);else if(t===r.at(-1))r.pop();else if(t===`;`&&r.length===0)return i}return n}function Ae(e,t,n){let r=[];for(let i=t;i<n;){for(;i<n;)if(/\s/.test(e[i]))i++;else if(e[i]===`/`&&e[i+1]===`*`)i=j(e,i,n);else break;let t=ke(e,i,n);if(e[i]!==`-`||e[i+1]!==`-`){i=t+1;continue}let a=i+2;for(;a<n&&e[a]!==`:`&&!A.test(e[a])&&!e.startsWith(`/*`,a);)a++;let o=a;for(;o<n;)if(/\s/.test(e[o]))o++;else if(e[o]===`/`&&e[o+1]===`*`)o=j(e,o,n);else break;if(e[o]!==`:`){i=t+1;continue}let s=o+1,c=e.slice(s,t),l=c.trim(),u=s+c.length-c.trimStart().length,d=u+l.length;r.push({property:e.slice(i,a),value:l,start:i,end:a,colon:o,valueStart:u,valueEnd:d}),i=t+1}return r}function je(e,t=`css`){let n=[];for(let r of R(e,!1,t)){if(r.name!==`custom`||r.terminator!==`block`)continue;let t=De(e,r.start+7);if(t<0)continue;let i=r.end-1;n.push({mode:r.prelude||void 0,declarations:Ae(e,t+1,i),start:r.start,open:t,close:i})}return n}const z=[`primary`,`neutral`,`success`,`warning`,`failure`,`general`],Me=new Set([`source`,`shortcut`,`safelist`]),Ne=/(?<![\w-])theme\(/,Pe=/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\/\*[\s\S]*?\*\//g;var B=class extends SyntaxError{diagnostics;constructor(e){super(e.map(e=>e.message).join(`
3
- `)),this.diagnostics=e,this.name=`EntryConfigError`}};function V(e){let t=e[0];if(t!==`"`&&t!==`'`)throw Error(`expected one quoted comma-separated list`);let n=1;for(;n<e.length;n++)if(e[n]===`\\`)n++;else if(e[n]===t)break;if(n!==e.length-1||e[n]!==t)throw Error(`expected one complete quoted list without extra arguments`);let r=e.slice(1,-1);if(r.includes(`\\,`))throw Error(`commas cannot be escaped; re-export the preset from a path without commas`);let i=r.split(`,`).map(e=>e.trim());if(i.some(e=>!e))throw Error(`empty lists, empty items and trailing commas are not allowed`);return i}function Fe(e,t=`css`){let n=t===`css`?e:L(e,t),r=[];for(let e of R(n,!0,t)){let t,n=z.includes(e.name);if(e.name===`preset`)t=`@preset was removed; use @presets "standard,icons,official";`;else if(e.name===`focused`)t=`removed; the site binds focus once with @custom focused "<family>";`;else if(e.name===`custom`&&e.terminator===`block`&&e.prelude.split(/\s+/)[0]===`theme`)t=`named themes were removed; use global / mode @custom values and data-css-<role> palette selectors`;else if(e.name===`custom`&&e.terminator!==`block`)t=e.depth?`configuration directives must be top-level`:me(e);else if(e.name===`presets`||n){if(e.depth)t=`configuration directives must be top-level`;else if(e.terminator!==`;`)t=`expected a quoted list ending with a semicolon, without a block`;else try{let r=V(e.prelude);n&&r.some(e=>!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(e))&&(t=`palette names must use lowercase kebab-case`)}catch(e){t=e.message}}else Me.has(e.name.toLowerCase())&&!e.depth&&e.terminator===`eof`&&(t=`expected a statement ending with a semicolon`);t&&r.push({start:e.start,end:e.end,message:`@${e.name}: ${t}`})}for(let{declarations:e}of je(n,t))for(let{start:t,valueEnd:n,value:i}of e)Ne.test(i.replace(Pe,``))&&r.push({start:t,end:n,message:`@custom: theme() cannot be resolved in a @custom value; write the value itself`});return r}function Ie(e,t){let n=Fe(e,F(t));if(n.length)throw new B(n.map(e=>({...e,file:t})))}function Le(e){return e?e.split(/\s+/)[0]===`theme`?{kind:`invalid`}:{kind:`mode`,mode:e}:{kind:`base`}}function Re(e){let t,n=0,r=null;for(let i=0;i<e.length;i++){let a=e[i];if(r)a===`\\`?i++:a===r&&(r=null);else if(a===`"`||a===`'`)r=a;else if(a===`\\`)i++;else if(N(e,i)>i)i=N(e,i)-1;else if(a===`/`&&e[i+1]===`*`){let r=e.indexOf(`*/`,i+2),a=r<0?e.length:r+2;(t??=[]).push(e.slice(n,i),` `),n=a,i=a-1}}return t?`${t.join(``)}${e.slice(n)}`:e}function ze(e){let t=e[0];if(t===`"`||t===`'`)for(let n=1;n<e.length;n++){let r=e[n];if(r===`\\`)n++;else if(r===t)return n===e.length-1?e.slice(1,n):void 0}}function H(e,t,n=`css`){let r=n===`css`?e:L(e,n),i=R(r,!1,n),a=[],o={},s=[],c=[],l=[],u=[],d=!1;for(let e of i){if(e.name===`teacss`&&e.prelude===``&&e.terminator!==`block`&&(d=!0),e.terminator!==`;`)continue;if(e.name===`custom`){let n=he(r,e,t);n&&u.push({start:e.start,block:{alias:n,declarations:ge(n)}});continue}if(z.includes(e.name)){try{let t=e.name,n=V(e.prelude);o[t]=[...new Set([...o[t]??[],...n])].sort()}catch{}continue}if(e.name===`shortcut`){let t=e.prelude.search(/\s/);if(t<=0)continue;let n=e.prelude.slice(0,t);if(!/^[A-Za-z_][\w-]*$/.test(n))continue;let r=ze(e.prelude.slice(t).trimStart())?.trim();r&&c.push({name:n,expansion:r});continue}if(e.name!==`presets`&&e.name!==`source`&&e.name!==`safelist`)continue;let n=ze(e.prelude)?.trim();if(!n)continue;if(e.name===`presets`){try{a.push(...V(e.prelude))}catch{}continue}if(e.name===`safelist`){l.push(n);continue}let i=n.startsWith(`!`),f=i?n.slice(1):n;f&&s.push({glob:f,exclude:i})}u.push(...je(r,n).flatMap(({start:e,mode:t,declarations:n})=>{let r=Le(t);return r.kind===`invalid`?[]:[{start:e,block:{mode:r.kind===`base`?void 0:r.mode,declarations:n.map(({property:e,value:t})=>({property:e,value:Re(t).trim()}))}}]}));let f=u.sort((e,t)=>e.start-t.start).map(({block:e})=>e);return{presets:a,...Object.keys(o).length?{rolePalettes:o}:{},sources:s,custom:f,shortcuts:c,safelist:l,hasTeacss:d}}let Be;function Ve(){return Be??=import(`jiti`).then(({createJiti:e})=>({createJiti:e,transformer:e(import.meta.url,{fsCache:!1,interopDefault:!0,moduleCache:!1})}))}const U=new Map,He=new WeakMap,Ue=16777216,W=new Map;let G=0;const We={icons:`@teacss/preset-icons`,official:`@teacss/preset-official`,standard:`@teacss/preset-standard`};function Ge(t,n){if(t.startsWith(`.`)||v(t))return x(n,t);let r=e(x(n,`_`)),i=Object.hasOwn(We,t)?We[t]:void 0;return r.resolve(i??t)}function K(e){return e.startsWith(`.`)||v(e)}function q(e){try{return p(e)}catch{return x(e)}}function Ke(e,t){let n=g(e),r=[];for(;;){if(t.has(n)){let e=t.get(n);for(let n of r)t.set(n,e);return e}if(r.push(n),l(x(n,`package.json`))){for(let e of r)t.set(e,n);return n}let e=g(n);if(e===n){for(let e of r)t.set(e,void 0);return}n=e}}function qe(e,t){let n=b(t,e);return n===``||!v(n)&&n!==`..`&&!n.startsWith(`..${S}`)}function J(e,t,n){let r=Ke(e,n);return t.packageRoot===void 0?r===void 0&&qe(e,t.fallbackRoot):r===t.packageRoot}function Je(e,t,n,r,i){if(!e||n.has(e)||(n.add(e),!v(e.filename)))return;let a=q(e.filename);if(J(a,r,i)){t.add(a);for(let a of e.children)Je(a,t,n,r,i)}}function Ye(e){if(!e||typeof e!=`object`)return;let t,n,r;try{t=Reflect.get(e,`path`),n=Reflect.get(e,`url`),r=Reflect.get(e,`message`)}catch{return}if(typeof t==`string`&&v(t))return q(t);if(typeof n==`string`&&n.startsWith(`file:`))return q(E(n));if(typeof r!=`string`)return;let i=/Cannot find module ['"]([^'"]+)['"] from ['"]([^'"]+)['"]/.exec(r),a=/Cannot find module ['"]([^'"]+)['"][\s\S]*?Require stack:\s*\n- ([^\n]+)/.exec(r),o=i??a;if(!o)return;let s=o[1],c=o[2];if(s&&c&&(s.startsWith(`.`)||v(s)))return q(v(s)?s:x(g(c),s))}async function Xe(e,t){let n=U.get(e)??Promise.resolve(),r,i=new Promise(e=>{r=e}),a=n.then(()=>i);U.set(e,a),await n;try{return{evaluation:t()}}finally{r(),U.get(e)===a&&U.delete(e)}}function Ze(e){return()=>({visitor:{AwaitExpression(t){t.getFunctionParent()||(e.hasTopLevelAwait=!0)},CallExpression(t){t.node.callee?.type===`Identifier`&&t.node.callee.name===`jitiImport`&&(e.hasDynamicImport=!0);let n=t.node.arguments?.[0];if(t.node.callee?.type!==`Identifier`||t.node.callee.name!==`require`)return;let r=n?.type===`StringLiteral`&&typeof n.value==`string`;r&&e.dependencies.add(n.value),typeof t.node.start==`number`&&(r?t.getFunctionParent()?e.hasNestedRequire=!0:e.hasTopLevelRequire=!0:e.hasNonLiteralRequire=!0)},ForOfStatement(t){t.node.await&&!t.getFunctionParent()&&(e.hasTopLevelAwait=!0)}}})}function Qe(e,t,n){if(e.hasDynamicImport)throw Error(`Dynamic imports are not supported in local preset modules: "${t}". Use static imports so TeaCSS can track and reload the complete graph.`);if(e.hasNonLiteralRequire)throw Error(`CommonJS require() specifiers must be string literals in local preset modules: "${t}".`);if(e.hasNestedRequire)throw Error(`CommonJS require() is only supported at module top level in local preset modules: "${t}".`);if(e.hasTopLevelRequire&&e.hasTopLevelAwait)throw Error(`CommonJS require() cannot be combined with top-level await in a local preset module: "${t}". Use a static import instead.`);if(t!==n&&e.hasTopLevelAwait)throw Error(`Top-level await is only supported in the local preset entry module: "${t}".`)}const Y=Symbol(`uncacheable transform option`);function $e(e,t=new Set){if(e===null)return`n`;if(typeof e==`string`)return`s${JSON.stringify(e)}`;if(typeof e==`boolean`)return e?`b1`:`b0`;if(typeof e==`number`)return Number.isNaN(e)?`dNaN`:e===1/0?`dInfinity`:e===-1/0?`d-Infinity`:Object.is(e,-0)?`d-0`:`d${JSON.stringify(e)}`;if(e===void 0)return`u`;if(typeof e!=`object`||t.has(e))throw Y;t.add(e);try{if(Array.isArray(e)){for(let t of Reflect.ownKeys(e)){if(t===`length`)continue;if(typeof t!=`string`)throw Y;let n=Number(t),r=Object.getOwnPropertyDescriptor(e,t);if(!Number.isSafeInteger(n)||n<0||String(n)!==t||n>=e.length||!r?.enumerable||!(`value`in r))throw Y}let n=Array.from({length:e.length},(n,r)=>{let i=Object.getOwnPropertyDescriptor(e,String(r));return i&&`value`in i?$e(i.value,t):`h`});return`a${e.length}[${n.join(`,`)}]`}if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw Y;return`o{${Reflect.ownKeys(e).map(t=>{if(typeof t!=`string`)throw Y;let n=Object.getOwnPropertyDescriptor(e,t);if(!n?.enumerable||!(`value`in n))throw Y;return[t,n.value]}).sort(([e],[t])=>e.localeCompare(t)).map(([e,n])=>`${JSON.stringify(e)}:${$e(n,t)}`).join(`,`)}}`}finally{t.delete(e)}}function et(e,t){return{...t,async:!1,interopDefault:t.interopDefault??!0,jsx:t.jsx??e.options.jsx,retainLines:t.retainLines??e.options.transformOptions?.retainLines}}function tt(e){if(!(e&&Object.getPrototypeOf(e)===Object.prototype&&Reflect.ownKeys(e).length===0))return e}function nt(e){try{return $e({babel:tt(e.babel),interopDefault:e.interopDefault,jsx:e.jsx,retainLines:e.retainLines,ts:e.ts})}catch{return}}function rt(e,t,n,r){let i=w.byteLength(e)+w.byteLength(t)+w.byteLength(n);for(let e of r.dependencies)i+=w.byteLength(e);return i}function it(e,t){let n=W.get(e);n&&(G-=n.bytes,W.delete(e));let r=rt(e,t.source,t.code,t.facts);if(!(r>Ue))for(W.set(e,{...t,bytes:r}),G+=r;W.size>256||G>Ue;){let e=W.keys().next();if(e.done)break;let t=W.get(e.value);W.delete(e.value),t&&(G-=t.bytes)}}function at(e){return{...e,dependencies:Array.from(e.dependencies)}}function ot(e,t,n,r,i,a){let o=t.filename?q(t.filename):n,s=et(e,t),c=nt(s),l=c===void 0?void 0:`${o}\0${c}`,u=l===void 0?void 0:W.get(l);if(l!==void 0&&u?.source===s.source)return W.delete(l),W.set(l,u),J(o,r,i)&&Qe(u.facts,o,n),{code:u.code,dependencies:u.facts.dependencies};let d=c===void 0?void 0:{filename:o,mode:c,source:s.source},f=d===void 0?void 0:a?.read(d);if(l!==void 0&&f){let e={...f.facts,dependencies:new Set(f.facts.dependencies)};return it(l,{code:f.code,facts:e,source:s.source}),J(o,r,i)&&Qe(e,o,n),{code:f.code,dependencies:e.dependencies}}let p={dependencies:new Set,hasDynamicImport:!1,hasNestedRequire:!1,hasNonLiteralRequire:!1,hasTopLevelAwait:!1,hasTopLevelRequire:!1},m=Ze(p),h=Error.prepareStackTrace,g=Error.stackTraceLimit;try{let t=e.transform({...s,babel:{...s.babel,plugins:[...Array.isArray(s.babel?.plugins)?s.babel.plugins:[],m]}});return l!==void 0&&it(l,{code:t,facts:p,source:s.source}),J(o,r,i)&&Qe(p,o,n),d!==void 0&&a?.write(d,{code:t,facts:at(p)}),{code:t,dependencies:p.dependencies}}finally{Error.prepareStackTrace=h,Error.stackTraceLimit=g}}const st=/\.[cm]?[jt]sx?$/;function ct(e,t,n){let r=q(v(n)?n:x(g(t),n));if(_(r))return[r];let i=Array.from(new Set([``,...e.options.extensions??[],`.json`])),a=[r,x(r,`index`)].flatMap(e=>i.map(t=>`${e}${t}`));return a.push(x(r,`package.json`)),a}function lt(t,n,r){if(r.startsWith(`node:`))return[];try{let i=K(r)?t.esmResolve(r,{parentURL:D(n).href,try:!0}):e(n).resolve(r);if(!i)return K(r)?ct(t,n,r):[];let a=i.startsWith(`file:`)?E(i):i;return v(a)?[q(a)]:[]}catch{return K(r)?ct(t,n,r):[]}}async function ut(e,t,n,r,i,a,o){let s=[e],c;for(let l=0;l<s.length;l++){let u=s[l];if(!u||!st.test(_(u)))continue;let d;try{d=await T(u,`utf8`)}catch(e){if(e.code===`ENOENT`)continue;throw e}u===e&&(c=d);let{dependencies:f}=ot(n,{source:d,filename:u,async:u===e,ts:/\.[cm]?tsx?$/.test(u)},e,r,i,o);for(let e of f)for(let n of lt(t,u,e))!a.has(n)&&J(n,r,i)&&(a.add(n),s.push(n))}return c}async function dt(e,t){try{let{createPresetTransformDiskCache:n}=await import(`./presetTransformDiskCache-BNUNLsPo.js`);return n(e,import.meta.url,t)}catch{return}}function X(e,t){if(!e||typeof e!=`object`)return;let n=He.get(e)??[];He.set(e,Array.from(new Set([...n,...t])))}function ft(e){return e&&typeof e==`object`?[...He.get(e)??[]]:[]}async function pt(t,n,r){let i=q(t),a=e(i),o=Object.create(null),s=new Set([i]),c=new Map,l={packageRoot:Ke(i,c),fallbackRoot:g(i)},[{createJiti:u,transformer:d},f]=await Promise.all([Ve(),dt(i,r)]),p=u(i,{fsCache:!1,interopDefault:!0,moduleCache:!1,tryNative:!1,transform:e=>{let{code:t}=ot(d,e,i,l,c,f);return{code:t}}}),m=()=>{let e=new Set;for(let t of Object.values(o))Je(t,s,e,l,c);for(let t of s)Je(a.cache[t],s,e,l,c)};try{let e=await ut(i,p,d,l,c,s,f)??await T(i,`utf8`),{evaluation:t}=await Xe(l.packageRoot??l.fallbackRoot,()=>{for(let e of s)delete a.cache[e];return p.evalModule(e,{async:!0,cache:o,filename:i,forceTranspile:!0})}),r=await t,u=r?.__esModule?r.default:r;if(u==null)throw Error(`@presets "${n}" has no default export (expected a Preset or preset factory)`);let h=typeof u==`function`?await u():u;return m(),{preset:h,sources:Array.from(s)}}catch(e){m();let t=Ye(e);throw X(e,t&&J(t,l,c)?[...s,t]:Array.from(s)),e}}async function mt(e){let t=await te(e),n=D(e);return n.searchParams.set(`version`,`${t.mtimeMs}:${t.ctimeMs}:${t.size}:${t.ino}`),(await import(n.href)).default}async function ht(e,t){let n=[],r=new Set,i={protectedSlotsByDirectory:new Map};for(let a of e){let e;try{e=Ge(a,t);let o;if(K(a)){let t=await pt(e,a,i);for(let e of t.sources)r.add(e);n.push(t.preset);continue}if(r.add(q(e)),o=await mt(e),o==null)throw Error(`@presets "${a}" has no default export (expected a Preset or preset factory)`);n.push(typeof o==`function`?await o():o)}catch(t){throw X(t,e!==void 0&&K(a)?[...r,q(e)]:r),t}}return{presets:n,sources:Array.from(r)}}async function gt(e,t){return(await ht(e,t)).presets}function _t(e){let t=e,n=/^url\(\s*([^)]*?)\s*\)$/i.exec(t);if(n)t=n[1];else if(/^url\(/i.test(t))return;let r=t[0];if(r===`"`||r===`'`){if(t.length<2||t[t.length-1]!==r)return;let e=t.slice(1,-1);return e.includes(r)?void 0:e}return n?t:void 0}function vt(e){return!(!e||e.startsWith(`//`)||/^[a-z][\w+.-]*:/i.test(e))}function yt(e){return e.split(`\\`).join(`/`)}function bt(e,t,n,r){if(!vt(e)||v(e)||!r&&!e.startsWith(`./`)&&!e.startsWith(`../`))return e;let i=yt(b(n,x(t,e)));return i.startsWith(`.`)?i:`./${i}`}function xt(e,t){if(t.length===0)return e;t.sort((e,t)=>e.start-t.start);let n=``,r=0;for(let i of t)n+=e.slice(r,i.start)+i.replacement,r=i.end;return n+e.slice(r)}function St(e){let t=e.length;for(;;){for(;t>0&&/\s/.test(e[t-1]);)t--;let n=e.endsWith(`*/`,t)?e.lastIndexOf(`/*`,t-3):-1;if(n===-1)break;t=n}return t>0&&e[t-1]!==`;`&&e[t-1]!==`}`}function Ct(e,t,n){if(t===`indented`==(n===`indented`))return e;let r=[];for(let n of R(e,!1,t))t===`indented`?(r.push({start:n.start,end:n.start,replacement:`;`}),n.terminator===`;`&&e[n.end-1]!==`;`&&r.push({start:n.end,end:n.end,replacement:`;`})):r.push({start:n.start,end:n.end,replacement:e.slice(n.start,n.end).replace(/[\n\r\f]/g,` `)});return xt(e,r)}function wt(e,t,n,r){if(t===n)return e;let i=[];for(let a of R(e,!1,r)){if(a.terminator!==`;`||a.name!==`presets`&&a.name!==`source`)continue;let r=a.prelude[0];if(r!==`"`&&r!==`'`||a.prelude[a.prelude.length-1]!==r)continue;if(a.name===`presets`){let e=V(a.prelude).map(e=>{let r=bt(e,t,n,!1);if(r.includes(`,`))throw SyntaxError(`@presets: rebased module paths cannot contain commas; re-export from a path without commas`);return r});i.push({start:a.start,end:a.end,replacement:`@presets ${r}${e.join(`,`)}${r};`});continue}let o=a.prelude.slice(1,-1).trim(),s=a.name===`source`&&o.startsWith(`!`),c=s?o.slice(1):o,l=bt(c,t,n,a.name===`source`);if(l===c)continue;let u=[...e.slice(a.start,a.end).matchAll(Pe)].find(e=>!e[0].startsWith(`/*`)),d=a.start+u.index;i.push({start:d,end:d+u[0].length,replacement:`${r}${s?`!`:``}${l}${r}`})}return xt(e,i)}function Tt(e,t,n,r,i,a,o,c,l){let u=F(l),d=u===`css`?e:L(e,u);if(Ie(d,l),o>32){for(let e of R(d,!1,u)){if(e.name!==`custom`||e.terminator!==`;`)continue;let t=he(d,e,l);t&&a.push(t)}return d}let f=[];for(let e of R(d,!1,u)){if(e.name===`custom`&&e.terminator===`;`){let t=he(d,e,l);t&&a.push(t)}if(e.name.toLowerCase()!==`import`||e.terminator!==`;`&&e.terminator!==`eof`)continue;let p=_t(e.prelude);if(p===void 0||!vt(p))continue;let m=x(t,p);if(!c?.has(m))try{if(!s.statSync(m).isFile())continue}catch{i.push(m);continue}if(n.has(m)){f.push({start:e.start,end:e.end,replacement:``});continue}n.add(m),r.push(m);let h=g(m),_=Tt(c?.get(m)??s.readFileSync(m,`utf8`),h,n,r,i,a,o+1,c,m),v=F(m);_=Ct(wt(_,h,t,v),v,u);let y=R(_,!1,u).at(-1)?.terminator===`eof`||u!==`indented`&&St(_);f.push({start:e.start,end:e.end,replacement:y?`${_};`:_})}return xt(d,f)}function Et(e,t,n,r){let i=[],a=[],o=[],s=new Set(n?[x(t,n)]:[]);try{return{css:Tt(e,t,s,i,a,o,0,r,n?x(t,n):void 0),files:i,missing:a,aliases:o}}catch(e){throw X(e,[...i,...a]),e}}function Dt(e,t){return e!=null&&Object.hasOwn(e,t)?e[t]:void 0}function Ot(e,t){let n=Dt(e,t);return O.filter(e=>e!==`000`).every(e=>{let t=Dt(n,e);return typeof t==`string`&&!!t.trim()&&t!==`initial`})}function kt(e,t){let n=ce(t.theme),r=e.filter(e=>!e.alias),a=i(i({},t.theme),pe(r,n).theme),o=new Set([...t.aliases??[],...e.flatMap(e=>e.alias?[e.alias.name]:[])]),s=new Set(t.aliases),c=new Set(t.physicalPalettes),l=new Set([...z,`focused`]),u=[],d=[],f=(e,t)=>d.push({...e,message:`@custom: ${t}`});for(let r of e){let e=r.alias;if(!e){u.push(r);continue}let{name:d,family:p}=e,m=i(i({},t.theme),pe(u,n).theme);!l.has(d)&&(c.has(d)||s.has(d)||Ot(m.colors,d))&&f(e.nameRange,`${d} is already a palette or alias`),s.add(d),(d!==`focused`||p!==`primary`&&p!==`neutral`)&&(l.has(p)?f(e.familyRange,`role ${p} cannot be a target (only focused may follow primary or neutral)`):o.has(p)?f(e.familyRange,`${p} is an alias and cannot be a target`):(!Ot(a.colors,p)||Object.values(a.modes??{}).some(e=>!Ot(i(i({},a.colors??{}),Dt(e,`colors`)??{}),p)))&&f(e.familyRange,`${p} must provide all 12 steps in every mode`))}if(d.length)throw new B(d);return{...pe(e,n),aliases:Object.freeze([...o])}}const At=e=>e.replace(/\\(.)/gs,`$1`);function Z(e,t,n,r=h){if(!e||e[0]===`!`&&e[1]!==`(`)return;let i=e.endsWith(`/`)?e.slice(0,-1):e;n&&!i.endsWith(`*`)&&(i+=`/**`);let a=r.parse(i).root||r.parse(At(i)).root,o=h.posix.normalize(i);(a.startsWith(`\\\\`)||a.startsWith(`//`))&&!o.startsWith(`//`)&&(o=`/${o}`);let s=re.scan(o,{parts:!0}).parts,c=s?.length?s:[o],l=[];for(let e of c.slice(0,-1)){if(ae(e))break;l.push(At(e))}return{root:r.resolve(t,a||`.`,l.join(`/`)||`.`),literal:ae(o)?void 0:r.resolve(t,At(o))}}function jt(e,t=h){let n=[];for(let r=e;;){let e=t.dirname(r);if(e===r)return n;n.push({parent:e,name:t.basename(r)}),r=e}}function Mt(e,t,n){return Ft(e,t,n)}async function Nt(e,t,n){let r={routes:[],failure:void 0};try{let i=await Ft(e,t,n,r),a=[...r.routes];return r.failure?{status:`failed`,cause:r.failure.cause,routes:a}:{status:`complete`,files:i,routes:a}}catch(e){return{status:`failed`,cause:r.failure?.cause??e,routes:[...r.routes]}}}function Pt(e,t){e&&!e.failure&&t&&t.code!==`ENOENT`&&t.code!==`ENOTDIR`&&t.code!==`ELOOP`&&(e.failure={cause:t})}async function Ft(e,t,n,r){let i=new Set;for(let a of It(e,t))for(let e of await Lt(a,t,n,r))i.add(e);return[...i]}function It(e,t){let{skipBelowBase:n}=t;if(!n)return[e];let r=h.resolve(t.cwd),i=[],a=[];for(let n of e){let e=Z(n,r,t.expandDirectories);e?i.push({pattern:n,base:e.literal??e.root}):a.push(n)}let o=(e,t)=>t.startsWith(e.endsWith(h.sep)?e:`${e}${h.sep}`)&&h.relative(e,t).split(h.sep).some(n),s=[],c=i;for(;c.length;){let e=c.filter(e=>!c.some(t=>o(t.base,e.base)));s.push([...e.map(({pattern:e})=>e),...a]),c=c.filter(t=>!e.includes(t))}return s}async function Lt(e,t,n,r){let i={...s,...n},a=h.resolve(t.cwd),o=new Set,c=new Set,l=new Map,u=new Map,d=new Map,f=e=>{let t=u.get(e);return t||(t=new Promise(t=>i.realpath(e,(n,i)=>{r&&!n&&e!==i&&d.set(e,{lexical:e,physical:i,admitted:new Set}),t(n?void 0:i)})),u.set(e,t)),t};for(let n of e){let e=Z(n,a,t.expandDirectories);e&&(e.literal?c.add(e.literal):o.add(e.root))}if(!o.size&&!c.size)return[];for(let e of[...o,...c])for(let{parent:t,name:n}of jt(e))for(let e of new Set([t,await f(t)])){if(!e)continue;let t=l.get(e);t||l.set(e,t=new Set),t.add(n)}let p=new Set([...o,...[...o,...c].flatMap(e=>jt(e).map(({parent:e})=>e))]),m=new Map,g=e=>{let t=m.get(e);return t||(t=new Promise(t=>i.lstat(e,(n,r)=>{if(n||!r.isSymbolicLink())return t(!1);i.stat(e,(e,n)=>t(!e&&n.isDirectory()))})),m.set(e,t)),t},_=new ne,v=e=>[...o,..._.getStore()?.targets??[]].some(t=>e===t||e.startsWith(t.endsWith(h.sep)?t:`${t}${h.sep}`)),y=n?.realpathNative??s.realpath.native,b=new Map,x=e=>{let t=b.get(e);return t||(t=new Promise((t,n)=>i.readdir(e,{withFileTypes:!0},(e,r)=>e?n(e):t(r))),b.set(e,t)),t},S=async(e,t)=>{let n=async()=>(await x(e)).filter(e=>t.has(e.name));if(t.size!==1)return n();let r=[...t][0],a=h.join(e,r);try{let t=await new Promise((e,t)=>i.lstat(a,(n,r)=>n?t(n):e(r)));if(!t.isDirectory()||t.isSymbolicLink()||!/^[\x20-\x7e]+$/.test(r)||!/[A-Za-z]/.test(r))return n();let o=r.replace(/[A-Za-z]/g,e=>e===e.toLowerCase()?e.toUpperCase():e.toLowerCase()),s=e=>new Promise((t,n)=>y(e,(e,r)=>e?n(e):t(r))),c=await s(a),l=h.basename(c);if(!/^[\x20-\x7e]+$/.test(l)||l.toLowerCase()!==r.toLowerCase())return n();try{if(await s(h.join(e,o))!==c)return n()}catch(e){if(e.code!==`ENOENT`||l!==r)return n();l=r}return[{name:l,parentPath:e,isFile:()=>t.isFile(),isDirectory:()=>t.isDirectory(),isSymbolicLink:()=>t.isSymbolicLink(),isBlockDevice:()=>t.isBlockDevice(),isCharacterDevice:()=>t.isCharacterDevice(),isFIFO:()=>t.isFIFO(),isSocket:()=>t.isSocket()}]}catch{return n()}},ee=(e,n,a)=>{let s=h.resolve(e);if(v(s)){let o=_.getStore()?.link;if(!o&&r){let e=[...d.keys()].filter(e=>s.startsWith(`${e}${h.sep}`)).sort((e,t)=>t.length-e.length)[0];e&&(o=d.get(e))}if(o&&r){let e=s===o.physical?s:h.resolve(o.physical,h.relative(o.lexical,s));[...o.admitted].some(t=>e===t||e.startsWith(`${t}${h.sep}`))||(o.admitted.add(e),r.routes.push({lexical:s===o.physical?o.lexical:s,physical:e,status:`entered`}))}return i.readdir(e,n,(e,n)=>{Pt(r,e),e&&e.code!==`ENOENT`&&e.code!==`ENOTDIR`&&t.onUnreadableDirectory?.(s);let{skipBelowBase:i}=t;a(e,n&&i?n.filter(e=>!i(e.name)):n)})}let c=_.getStore()?.ancestor,u=c?.directory===s?c.children:l.get(s);if(!u?.size)return a(null,[]);S(s,u).then(async e=>Promise.all(e.map(async e=>{let t=h.join(s,e.name);if(!e.isSymbolicLink()||o.has(t)||!l.has(t))return e;try{if(!await g(t))return e;let n=[...p].filter(e=>e.startsWith(`${t}${h.sep}`)),r=await f(t);return!r||!(await Promise.all(n.map(async e=>await g(e)?f(e):void 0))).some(e=>e?.startsWith(`${r}${h.sep}`))?e:{...e,isDirectory:()=>!0,isSymbolicLink:()=>!1,isFile:()=>!1,isBlockDevice:()=>e.isBlockDevice(),isCharacterDevice:()=>e.isCharacterDevice(),isFIFO:()=>e.isFIFO(),isSocket:()=>e.isSocket()}}catch{return e}}))).then(e=>a(null,e),e=>{Pt(r,e),a(e,[])})},C=(e,t)=>{let n=_.getStore(),a=n?.targets??[],o=v(h.resolve(e)),s=l.get(h.resolve(e));i.realpath(e,(c,l)=>{if(Pt(r,c),r&&c&&(c.code===`ENOENT`||c.code===`ENOTDIR`||c.code===`ELOOP`))return i.readlink(e,(n,i)=>{n||r.routes.push({lexical:h.resolve(e),physical:h.resolve(h.dirname(e),i),status:`unresolved`}),t(c,l)});_.run({targets:!c&&o?[...a,h.resolve(l)]:a,link:c?n?.link:{lexical:h.resolve(e),physical:h.resolve(l),admitted:new Set},ancestor:!c&&s?{directory:h.resolve(l),children:s}:n?.ancestor},t,c,l)})},w=((e,t)=>i.stat(e,(e,n)=>{Pt(r,e),t(e,n)}));try{return await ie(e,{...t,absolute:!0,fs:{...i,stat:w,readdir:ee,realpath:C}})}finally{_.disable()}}function Rt(e,t){return Mt(e,t)}const Q=Symbol.for(`@teacss/config/source-declarations`);function zt(e){return e[Q]}function Bt(e){return zt(e)?.consumed}function Vt(e,t){return Object.defineProperty(e,Q,{value:{consumed:t,attempted:t,recovered:!1},configurable:!0}),e}function $(e,t){let n=zt(t);return n&&Object.defineProperty(e,Q,{value:n,configurable:!0}),e}function Ht(e,t,n){return Object.defineProperty(e,Q,{value:{consumed:t&&Bt(t),attempted:n,recovered:t!==void 0},configurable:!0}),e}function Ut(e,t){let n=zt(e),r={consumed:t,attempted:n?.attempted,recovered:n?.recovered??!1};return Object.defineProperty(e,Q,{value:r,configurable:!0}),r}function Wt(e){return JSON.stringify([e.base,e.patterns,e.ignore,e.inlined])}function Gt(e){let t=new Map;for(let n of[e?.consumed,e?.attempted])n&&t.set(Wt(n),n);return[...t.values()]}function Kt(e){return[...new Set([e?.consumed,e?.attempted].flatMap(e=>e?.status===`read`?e.members.map(e=>e.path):[]))]}function qt(e){return[...Gt(e).flatMap(({patterns:e,base:t})=>nn(e,t)),...Kt(e).map(e=>({kind:`exact`,path:e})),...[e?.consumed,e?.attempted].flatMap(e=>[...e?.status===`failed`&&e.operation===`read`&&e.path?[{kind:`exact`,path:e.path}]:[],...(e?.routes??[]).map(e=>({kind:e.status===`entered`?`tree`:`exact`,path:e.physical}))])]}function Jt(e,t,n,r=[]){return Object.freeze({base:e,patterns:Object.freeze([...t]),ignore:Object.freeze([...r]),inlined:Object.freeze([...n])})}function Yt(e,t,n,r,i=[],a=[]){return{...Jt(e,t,n,i),status:`read`,members:r,routes:a,signature:JSON.stringify([e,t,i,n,`read`,r,a])}}const Xt=e=>e===`node_modules`||e.startsWith(`.`),Zt=(e,t)=>b(e,t).split(S).some(e=>e!==`..`&&e.startsWith(`.`));function Qt(e,t){return e.filter(e=>{let n=Z(e,t,!1);return!n||!Zt(t,n.literal??n.root)})}async function $t(e,t){let n=[],r=()=>n.sort((e,t)=>e.lexical.localeCompare(t.lexical)||e.physical.localeCompare(t.physical)||e.status.localeCompare(t.status)),i=`enumerate`,a;try{let o=await Nt(rn(Qt(e.patterns,e.base),e.base),{cwd:e.base,ignore:e.ignore,expandDirectories:!1,skipBelowBase:Xt});if(n.push(...o.routes),o.status===`failed`)throw o.cause;let s=o.files.filter(t=>t.endsWith(`.css`)&&!e.inlined.includes(t)).sort();i=`read`;let c=s.map(e=>(a=e,{path:e,contents:t?.get(e)??d(e,`utf8`)}));return Yt(e.base,e.patterns,e.inlined,c,e.ignore,r())}catch(t){let o=t,s=[typeof t,o?.name,o?.message??String(t),o?.code];return{...e,status:`failed`,operation:i,path:a,cause:t,routes:r(),signature:JSON.stringify([Wt(e),`failed`,i,a,s,n])}}}async function en(e,t=!1,n){let r=Gt(e),i=await Promise.all(r.map(r=>{if(t){if(r===e?.attempted)return r;let t=n?.attempts.find(e=>Wt(e)===Wt(r));if(t)return t}return $t(r)}));return{attempts:i,signature:JSON.stringify(i.map(e=>e.signature))}}function tn(e,t,n){let r=!1,i,a=Promise.resolve(),o;function s(){o=setTimeout(()=>{a=(async()=>{let n=e(),a=i??await en(n,!0),o=await en(n);r||n!==e()||(i=o,o.signature!==a.signature&&await t(o))})().catch(async e=>{r||await n(e)}).finally(()=>{r||s()})},500)}function c(){r=!0,clearTimeout(o)}return s(),{retire:c,async close(){c(),await a}}}function nn(e,t,n=!1){let r=Qt(e,t),i=new Set(an(r,t).map(({pattern:e})=>e));return r.flatMap(e=>{let r=Z(e,t,n);return r?[{kind:r.literal&&!i.has(e)?`exact`:`tree`,path:r.literal??r.root}]:[]})}function rn(e,t){let n=new Set(an(e,t).map(({pattern:e})=>e));return e.map(e=>n.has(e)?`${e.replace(/\/+$/,``)}/**`:e)}function an(e,t){return e.flatMap(e=>{let n=Z(e,t,!1)?.literal;if(!n)return[];try{return m(n).isDirectory()?[{pattern:e,directory:n}]:[]}catch{return[]}})}function on(e){let t=new Map,n=[],r=new Map,i=e=>{if(r.has(e))return r.get(e);let t;try{let n=m(e);n.isDirectory()&&(t=n)}catch(e){let t=e.code;if(t===`EACCES`)n.push(e);else if(t!==`ENOENT`&&t!==`ENOTDIR`&&t!==`ELOOP`)throw e}return r.set(e,t),t},a=(e,n,r)=>{let a=i(e);if(!a)return;let o=`${a.dev}:${a.ino}`,s=`${n}:${o}`,c=t.get(s);t.set(s,{directory:c?.directory??e,recursive:n,identity:o,children:r?[...new Set([...c?.children??[],r])].sort():[]})},o=e.map(e=>({path:e.path,links:new Set})),s=new Set;for(let t of e)t.kind===`tree`&&a(t.path,!0);for(let e of o){if(s.has(e.path))continue;s.add(e.path);let t=jt(e.path);for(let{parent:e,name:n}of t)a(e,!1,n);for(let{parent:r,name:i}of t.reverse()){let t=y(r,i);try{let n=u(t);if(!n.isSymbolicLink())continue;let i=`${n.dev}:${n.ino}`;if(e.links.has(i))break;o.push({path:x(r,f(t),b(t,e.path)),links:new Set([...e.links,i])});break}catch(e){let t=e.code;if(t===`EACCES`){n.push(e);break}if(t!==`ENOENT`&&t!==`ENOTDIR`&&t!==`ELOOP`)throw e}}}return{plans:[...t.values()],permissionErrors:n}}function sn(e,t){if(e.recursive||t===null)return!0;let n=t.toString().split(S)[0].normalize(`NFC`).toLowerCase();return e.children.some(e=>e.normalize(`NFC`).toLowerCase()===n)}function cn(e){let t=e.members.map(e=>e.path),n=[],r=[];for(let{contents:t}of e.members){if(!t.includes(`@shortcut`)&&!t.includes(`@safelist`))continue;let e=H(t);n.push(...e.shortcuts),r.push(...e.safelist)}return{shortcuts:n,safelist:r,files:t,snapshot:e}}function ln(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r===`\\`){if(++n>=e.length)return`dangling '\\'`}else if(r===`{`)t++;else if(r===`}`){if(t--===0)return`unopened alternate group; missing '{' (maybe escape '}' with '[}]'?)`}else if(r===`[`){let t=n+1;(e[t]===`!`||e[t]===`^`)&&t++;let r=!0,i,a;for(;;t++){let n=e[t];if(n===void 0)return`unclosed character class; missing ']'`;if(n===`]`&&!r)break;if(n===`-`&&!r&&i===void 0)i=a;else{if(i!==void 0&&n<i)return`invalid character range`;i=void 0,a=n}r=!1}n=t}}if(t>0)return`unclosed alternate group; missing '}' (maybe escape '{' with '[{]'?)`}function un(e,t){for(let{glob:n,exclude:r}of e){let e=ln(n);if(e)return[{file:t,start:0,end:0,message:`@source "${r?`!`:``}${n}" is not a glob: ${e}`}]}return[]}async function dn(e,n,r,s,c){let l=Et(e,n,r,s),u=[...l.files,...l.missing],d=F(r),f=H(l.css,void 0,d),p=0;for(let e of f.custom)e.alias&&=l.aliases[p++];let m=un(f.sources,r);if(m.length){let e=new B(m);throw X(e,u),e}let h=$t(Jt(n,f.sources.filter(e=>!e.exclude).map(e=>e.glob),r===void 0?l.files:[...l.files,x(n,r)],f.sources.filter(e=>e.exclude).map(e=>e.glob)),s).then(e=>{if(c.attempt=e,e.status===`failed`)throw e.cause;return cn(e)}),[g,_]=await Promise.all([f.presets.length?ht(f.presets,n):{presets:[],sources:[]},h]).catch(async e=>{throw await h.catch(()=>void 0),X(e,u),e}),v=g.presets,y={},b=[],S=[],ee=Object.freeze(Object.fromEntries(Object.entries(f.rolePalettes??{}).map(([e,t])=>[e,Object.freeze([...t])]))),C={name:`@teacss/config/role-palettes`,configResolved(e){Object.defineProperty(e,Symbol.for(`@teacss/config/role-palettes`),{value:ee,configurable:!0}),Object.defineProperty(e,Symbol.for(`@teacss/config/color-aliases`),{value:S,configurable:!0})}};await a({presets:v,configResolved(e){let t=e;if({theme:y,unknown:b,aliases:S}=kt(f.custom,{theme:e.theme,physicalPalettes:t[Symbol.for(`@teacss/preset-standard/physical-palettes`)],aliases:t[Symbol.for(`@teacss/config/color-aliases`)]}),f.rolePalettes&&!e.presets.some(e=>e.name===`@teacss/preset-standard`))throw TypeError(`Role palette directives require an explicitly enabled Standard preset`);e.theme=i(e.theme,y),(f.rolePalettes||S.length)&&C.configResolved?.(e)}}).catch(e=>{throw X(e,[...u,..._.files,...g.sources]),e});let w=[...f.sources.filter(e=>!e.exclude).map(e=>e.glob),...f.sources.filter(e=>e.exclude).map(e=>`!${e.glob}`)],T=[..._.shortcuts,...f.shortcuts],te=Object.fromEntries(T.map(({name:e,expansion:t})=>[e,t])),E=[...new Set([..._.safelist,...f.safelist].flatMap(e=>o(t(e))))],D={presets:f.rolePalettes||S.length?[...v,C]:v,theme:y,...f.sources.length?{content:{filesystem:w}}:{},...T.length?{shortcuts:te}:{},...E.length?{safelist:E}:{}},ne=Object.freeze({base:n,entryFile:r,entryCss:r===void 0?void 0:e,derivedKeys:Object.keys(D)});return Object.defineProperty(D,Symbol.for(`@teacss/config/entry-provenance`),{value:ne,configurable:!0}),Vt(D,_.snapshot),Vt({config:D,unknown:b,hasTeacss:l.files.length===0?f.hasTeacss:H(e,void 0,d).hasTeacss,sources:[...u,..._.files,...g.sources]},_.snapshot)}async function fn(e,t,n,r){let i={};try{return{status:`resolved`,result:await dn(e,t,n,r,i)}}catch(e){return{status:`failed`,cause:e,attempt:i.attempt}}}const pn=Symbol.for(`@teacss/config/entry-provenance`);function mn(e,t){let n=Object.getOwnPropertyDescriptor(t,pn);return n&&Object.defineProperty(e,pn,{value:n.value,configurable:!0}),e}const hn=Object.freeze([`package.json`,`index.css`,`src/index.css`]),[gn,..._n]=hn;function vn(e,t){let n={...e};for(let i of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(t,i)?.enumerable)continue;let a=Reflect.get(t,i);a!==void 0&&(i===`content`&&e.content&&(a=r([e.content,a])),Object.defineProperty(n,i,{value:a,configurable:!0,enumerable:!0,writable:!0}))}return n}function yn(e){try{let t=c.readFileSync(e,`utf8`);return t.includes(`@teacss`)?R(t,!1,F(e)).some(e=>e.name===`teacss`&&e.prelude===``&&e.terminator!==`block`):!1}catch(e){if(e.code===`ENOENT`)return!1;throw e}}function bn(e){try{let t=JSON.parse(c.readFileSync(y(e,gn),`utf8`))?.teacss?.entry;return typeof t==`string`?t:void 0}catch(e){if(e.code===`ENOENT`)return;throw e}}function xn(e){let t=bn(e);if(t){let n=x(e,t);if(c.existsSync(n)&&c.statSync(n).isFile())return n}for(let t of _n){let n=y(e,t);if(c.existsSync(n)&&c.statSync(n).isFile()&&yn(n))return n}}async function Sn(e,t,n,r){if(typeof t!=`string`)return{config:vn(n,t),sources:[]};let i=x(e,t),a=c.existsSync(i)&&c.statSync(i).isFile()?i:xn(i);if(!a)return{config:{...n},sources:[]};let o;try{o=c.readFileSync(a,`utf8`)}catch(e){throw X(e,[a]),e}let s=await fn(o,g(a),a);if(s.status===`failed`)throw r.attempt=s.attempt,X(s.cause,[a]),s.cause;let l=s.result,{config:u}=l,d=vn(n,u);return $(d,u),mn(d,u),u.presets?.length||(n.presets?.length?d.presets=n.presets:C.warn(`[@teacss/config] "${a}" declares no @presets — no utilities will be generated. Add one, e.g. \`@presets "standard";\``)),$({config:d,sources:Array.from(new Set([a,...l.sources]))},l)}async function Cn(e,t,n){let r={};try{return{status:`resolved`,result:await Sn(e,t,n,r)}}catch(e){return{status:`failed`,cause:e,attempt:r.attempt}}}async function wn(e=ee.cwd(),t=e,n={}){let r=await Cn(e,t,n);if(r.status===`failed`)throw r.cause;return r.result}function Tn(e){let t=e instanceof Error?`${e.name}:${e.message}`:`${typeof e}:${String(e)}`,n=Array.from(new Set(ft(e))).sort().map(e=>{try{let t=c.statSync(e);return`${e}:${t.mtimeMs}:${t.ctimeMs}:${t.size}:${t.ino}`}catch(t){let n=t.code;return`${e}:${n===`ENOENT`?`missing`:`unreadable:${n??String(t)}`}`}});return JSON.stringify([t,n])}function En(e=!1){let t=new Map,n=new WeakMap,r=new WeakMap,i=(i=ee.cwd(),a=i,o={})=>{let s;if(typeof a==`string`){let e=x(i,a);s=t.get(e),s||t.set(e,s={version:0})}else typeof a==`object`&&a&&(s=n.get(a),s||n.set(a,s={version:0}));let c=s??{version:0},l=++c.version,u=Cn(i,a,o).then(async t=>{if(t.status===`resolved`)return e||r.set(t.result,{slot:c,version:l}),c.version===l&&(c.reportedFailure=void 0,e&&(c.accepted=t.result)),$(u,t.result),t.result;if(c.version!==l)for(;;){let e=c.version,t=c.latest;try{let n=await t;if(c.version!==e)continue;return $(u,t),n}catch(n){if(c.version!==e)continue;throw $(u,t),n}}let n=c.accepted;if(!n)throw Ht(u,void 0,t.attempt),t.cause;let i=Tn(t.cause);c.reportedFailure!==i&&(C.error(`[@teacss/config] Error resolving config from the CSS entry:`,t.cause),c.reportedFailure=i);let a=Array.from(new Set([...n.sources,...ft(t.cause)])),o=Ht({...n,sources:a},n,t.attempt);return $(u,o),o});return c.latest=u,u};return i.accept=(e,t=e)=>{let n=r.get(e);n&&n.version===n.slot.version&&(r.delete(e),n.slot.accepted=$({...t,sources:[...t.sources]},t))},i}export{H as A,Te as B,sn as C,ft as D,kt as E,Fe as F,N as G,je as H,V as I,pe as J,le as K,L,z as M,Pe as N,gt as O,Ie as P,F as R,Bt as S,Ut as T,ye as U,be as V,R as W,ce as X,fe as Y,O as Z,Gt as _,fn as a,zt as b,tn as c,$t as d,on as f,Jt as g,Rt as h,wn as i,B as j,Le as k,an as l,Ht as m,hn as n,Vt as o,en as p,de as q,xn as r,$ as s,En as t,rn as u,Kt as v,nn as w,qt as x,Yt as y,we as z};