@teacss/core 0.4.2 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -300,6 +300,34 @@ declare function transformSkipCode(code: string, map: Map<string, string>, SKIP_
300
300
  declare function restoreSkipCode(code: string, map: Map<string, string>): string;
301
301
  declare function replaceAsync(string: string, searchValue: RegExp, replacer: (substring: string, ...args: any[]) => Promise<string>): Promise<string>;
302
302
  //#endregion
303
+ //#region src/utils/unmatched-diagnostics.d.ts
304
+ /** The structural slice of a resolved config the suggestion index reads. */
305
+ interface SuggestionSource {
306
+ rulesStaticMap: Record<string, StaticRule | undefined>;
307
+ rulesDynamic: readonly (readonly [RegExp, ...unknown[]])[];
308
+ }
309
+ /**
310
+ * Strip trailing `@…` condition chains: the base ends at the first `@` that
311
+ * sits outside brackets, parentheses, and quotes.
312
+ */
313
+ declare function tokenConditionBase(token: string): string;
314
+ /**
315
+ * Extracted source text is mostly not TeaCSS. Only candidates that read as a
316
+ * `prefix:value` token (optionally behind a condition chain) are diagnosed —
317
+ * plain words, framework class names, import specifiers, and URLs never are.
318
+ */
319
+ declare function isTokenShaped(token: string): boolean;
320
+ /**
321
+ * Decide whether an unmatched, token-shaped candidate deserves a diagnostic
322
+ * and compute its suggestions in one pass. Returns `undefined` for candidates
323
+ * the vocabulary cannot say anything useful about — extracted source text is
324
+ * full of `word:word` shapes, and silence beats noise when no known or
325
+ * near-known prefix is involved.
326
+ */
327
+ declare function diagnoseUnmatchedToken(token: string, config: SuggestionSource, options?: {
328
+ confirmedIntent?: boolean;
329
+ }): string[] | undefined;
330
+ //#endregion
303
331
  //#region src/utils/variant-group.d.ts
304
332
  declare function makeRegexClassGroup(separators?: string[]): RegExp;
305
333
  interface VariantGroup {
@@ -416,11 +444,11 @@ declare class TeacssGeneratorInternal<Theme extends object = object> {
416
444
  private dispatchConfig;
417
445
  private clearRuntimeCaches;
418
446
  private ensureRuleIndexesCurrent;
419
- private collectParentOrders;
447
+ private collectValidatedParentOrders;
420
448
  private transferOutputOrder;
421
449
  private recordStringifiedContext;
422
450
  private copyStringifiedUtil;
423
- private copyStringifiedUtils;
451
+ private copyValidatedStringifiedUtils;
424
452
  private getDynamicIndex;
425
453
  protected constructor(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>);
426
454
  protected ensureInitialized(): Promise<void>;
@@ -1633,4 +1661,4 @@ interface ParsedClassToken {
1633
1661
  */
1634
1662
  declare function parseClassToken(raw: string): ParsedClassToken;
1635
1663
  //#endregion
1636
- export { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BaseContext, BetterMap, BlocklistMeta, BlocklistRule, BlocklistValue, BuiltConditionSelector, CSSEntries, CSSEntriesInput, CSSEntry, CSSObject, CSSObjectInput, CSSValue, CSSValueInput, CSSValues, CSS_PLACEHOLDER, CliEntryItem, CliOptions, ComparableWidth, ConditionKind, ConditionResolveContext, ConditionResolver, ConditionVariantOptions, ConfigBase, ContentOptions, ControlSymbols, ControlSymbolsEntry, ControlSymbolsValue, CountableSet, DEFAULT_LAYERS, DeepPartial, DynamicExpansionMatcher, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, Emitter, ExpansionInlineValue, ExpansionValue, ExtendedTokenInfo, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateDiagnostics, GenerateOptions, GenerateResult, GeneratorOptions, HighlightAnnotation, IGNORE_COMMENT, INCLUDE_COMMENT, INCLUDE_COMMENT_IDE, LAYER_IMPORTS, LAYER_MARK_ALL, LAYER_PREFLIGHTS, LAYER_PRIMITIVES, LAYER_PROPERTIES, LAYER_SHORTCUTS, LAYER_UTILITIES, LoadConfigResult, MagicStringLike, NormalizeArbitraryOptions, ObjectToEntry, OutputCssLayersOptions, ParsedClassToken, ParsedCondition, ParsedUtil, PartialByKeys, PluginOptions, Postprocessor, Preflight, PreflightContext, PreparedGeneratorConfig, PreparedRule, Preprocessor, Preset, PresetFactory, PresetFactoryAwaitable, PresetOptions, PresetOrFactory, PresetOrFactoryAwaitable, RESET_KEY, RawUtil, Replacement, RequiredByKey, ResolveConditionsResult, ResolvedCondition, ResolvedConfig, RestArgs, Rule, RuleContext, RuleMeta, SKIP_COMMENT_RE, SKIP_END_COMMENT, SKIP_START_COMMENT, SafeListContext, Shift, Shortcut, ShortcutInlineValue, ShortcutValue, SourceCodeTransformer, SourceCodeTransformerEnforce, SourceMap, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, SuggestResult, TeacssGenerator, TeacssPluginContext, ThemeExtender, ToArray, TwoKeyMap, UnmatchedTokenDiagnostic, Unsubscribe, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, UtilObject, VIRTUAL_ENTRY_ALIAS, Variant, VariantContext, VariantFunction, VariantHandler, VariantHandlerContext, VariantMatchedResult, VariantObject, VirtualKey, attributifyRE, buildConditionSelector, clearIdenticalEntries, clone, collapseVariantGroup, comparableWidth, compareParentAtRules, createConditionVariant, createGenerator, createNanoEvents, cssIdRE, defaultSplitRE, definePreset, e, entriesToCss, escapeRegExp, escapeSelector, expandClassGroups, expandGroups, expandUnderscores, expandVariantGroup, extractorSplit as extractorDefault, extractorSplit, getEnvFlags, getHash, getPath, hasScopePlaceholder, hash, isArbitrary, isAttributifySelector, isCountableSet, isCssId, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isThenable, isValidSelector, isValidTargetSelector, makeRegexClassGroup, mergeConfigs, mergeDeep, noop, normalizeArbitraryValue, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseClassToken, parseCondition, parseConditions, parseVariantGroup, regexScopePlaceholder, replaceAsync, resolveConditions, resolveConfig, resolvePreset, resolvePresets, resolveShortcuts, restoreSkipCode, spaceCalcOperators, splitClassTokens, splitWithVariantGroupRE, symbols, toArray, toEscapedSelector, transformSkipCode, uniq, uniqueBy, validateFilterRE, warnOnce, withLayer };
1664
+ export { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BaseContext, BetterMap, BlocklistMeta, BlocklistRule, BlocklistValue, BuiltConditionSelector, CSSEntries, CSSEntriesInput, CSSEntry, CSSObject, CSSObjectInput, CSSValue, CSSValueInput, CSSValues, CSS_PLACEHOLDER, CliEntryItem, CliOptions, ComparableWidth, ConditionKind, ConditionResolveContext, ConditionResolver, ConditionVariantOptions, ConfigBase, ContentOptions, ControlSymbols, ControlSymbolsEntry, ControlSymbolsValue, CountableSet, DEFAULT_LAYERS, DeepPartial, DynamicExpansionMatcher, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, Emitter, ExpansionInlineValue, ExpansionValue, ExtendedTokenInfo, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateDiagnostics, GenerateOptions, GenerateResult, GeneratorOptions, HighlightAnnotation, IGNORE_COMMENT, INCLUDE_COMMENT, INCLUDE_COMMENT_IDE, LAYER_IMPORTS, LAYER_MARK_ALL, LAYER_PREFLIGHTS, LAYER_PRIMITIVES, LAYER_PROPERTIES, LAYER_SHORTCUTS, LAYER_UTILITIES, LoadConfigResult, MagicStringLike, NormalizeArbitraryOptions, ObjectToEntry, OutputCssLayersOptions, ParsedClassToken, ParsedCondition, ParsedUtil, PartialByKeys, PluginOptions, Postprocessor, Preflight, PreflightContext, PreparedGeneratorConfig, PreparedRule, Preprocessor, Preset, PresetFactory, PresetFactoryAwaitable, PresetOptions, PresetOrFactory, PresetOrFactoryAwaitable, RESET_KEY, RawUtil, Replacement, RequiredByKey, ResolveConditionsResult, ResolvedCondition, ResolvedConfig, RestArgs, Rule, RuleContext, RuleMeta, SKIP_COMMENT_RE, SKIP_END_COMMENT, SKIP_START_COMMENT, SafeListContext, Shift, Shortcut, ShortcutInlineValue, ShortcutValue, SourceCodeTransformer, SourceCodeTransformerEnforce, SourceMap, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, SuggestResult, TeacssGenerator, TeacssPluginContext, ThemeExtender, ToArray, TwoKeyMap, UnmatchedTokenDiagnostic, Unsubscribe, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, UtilObject, VIRTUAL_ENTRY_ALIAS, Variant, VariantContext, VariantFunction, VariantHandler, VariantHandlerContext, VariantMatchedResult, VariantObject, VirtualKey, attributifyRE, buildConditionSelector, clearIdenticalEntries, clone, collapseVariantGroup, comparableWidth, compareParentAtRules, createConditionVariant, createGenerator, createNanoEvents, cssIdRE, defaultSplitRE, definePreset, diagnoseUnmatchedToken, e, entriesToCss, escapeRegExp, escapeSelector, expandClassGroups, expandGroups, expandUnderscores, expandVariantGroup, extractorSplit as extractorDefault, extractorSplit, getEnvFlags, getHash, getPath, hasScopePlaceholder, hash, isArbitrary, isAttributifySelector, isCountableSet, isCssId, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isThenable, isTokenShaped, isValidSelector, isValidTargetSelector, makeRegexClassGroup, mergeConfigs, mergeDeep, noop, normalizeArbitraryValue, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseClassToken, parseCondition, parseConditions, parseVariantGroup, regexScopePlaceholder, replaceAsync, resolveConditions, resolveConfig, resolvePreset, resolvePresets, resolveShortcuts, restoreSkipCode, spaceCalcOperators, splitClassTokens, splitWithVariantGroupRE, symbols, toArray, toEscapedSelector, tokenConditionBase, transformSkipCode, uniq, uniqueBy, validateFilterRE, warnOnce, withLayer };
package/dist/index.js CHANGED
@@ -1,21 +1,21 @@
1
- import e from"node:crypto";const t=[`:before`,`:after`,`:first-line`,`:first-letter`];function n(e){if(!e)return!1;let t=e.codePointAt(0);return e===`-`||e===`_`||e===`\\`||t!==void 0&&(t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t>=128)}function r(e,r){for(let i of t)if(e.slice(r,r+i.length).toLowerCase()===i&&!n(e[r+i.length]))return!0;return!1}function i(e,t){let n=0,i=0,a;for(let o=0;o<e.length;o++){let s=e[o];if(a)s===`\\`?o++:s===a&&(a=void 0);else if(s===`\\`)o++;else if(s===`/`&&e[o+1]===`*`){let t=e.indexOf(`*/`,o+2);if(t===-1)return;o=t+1}else if(s===`"`||s===`'`)a=s;else if(s===`[`)n++;else if(s===`]`)n>0&&n--;else if(s===`(`)i++;else if(s===`)`)i>0&&i--;else if(s===`:`&&n===0&&i===0){if(e[o+1]===`:`){if(t(o))return;o++}else if(r(e,o)&&t(o))return}}}function a(e){let t=-1;return i(e,e=>(t=e,!0)),t}function o(e){let t=!0;return i(e,n=>c(e,n)?!1:(t=!1,!0)),t}function s(e){let t=0;return i(e,()=>(t++,!1)),t}function c(e,t){let n=t+(e[t+1]===`:`?2:1);for(;e[n]===`/`&&e[n+1]===`*`;){let t=e.indexOf(`*/`,n+2);if(t===-1)return;n=t+2}let r=n;for(;/[a-z0-9_-]/i.test(e[n]??``);)n++;return n===r?void 0:{end:n,name:e.slice(r,n).toLowerCase()}}function l(e,t,n){let r=0,i;for(let a=t;a<n;a++){let o=e[a];if(i){o===`\\`?a++:o===i&&(i=void 0);continue}if(o===`\\`)a++;else if(o===`/`&&e[a+1]===`*`){let t=e.indexOf(`*/`,a+2);if(t===-1||t>=n)return!1;a=t+1}else if(o===`"`||o===`'`)i=o;else if(o===`(`)r++;else if(o===`)`){if(r--,r===0)return e.slice(t+1,a).replaceAll(/\/\*[\s\S]*?\*\//g,``).trim().length>0&&e.slice(a+1,n).trim().length===0;if(r<0)return!1}}return!1}function u(e){let t=[],n=0,r=!1;if(i(e,i=>{n++;let a=c(e,i);return a?t.push({...a,index:i}):r=!0,n>2}),n<=1)return!0;if(r||n!==2||t.length!==2)return!1;let[a,o]=t,s=a.name,u=o.name;return s!==`part`&&s!==`slotted`||e[a.index+1]!==`:`||e[a.end]!==`(`||!l(e,a.end,o.index)?!1:u===`before`||u===`after`||u===`marker`||u===`placeholder`||u===`file-selector-button`||s===`part`&&(u===`first-line`||u===`first-letter`)}function d(e=void 0){if(e===void 0)return[];if(!Array.isArray(e))return[e];for(let t=0;t<e.length;t++){if(Object.hasOwn(e,t))continue;let n=[],r=0;for(let t=0;t<e.length;t++)Object.hasOwn(e,t)&&Object.defineProperty(n,r++,{configurable:!0,enumerable:!0,value:e[t],writable:!0});return n}return e}function f(e){return Array.from(new Set(d(e)))}function p(e,t){return d(e).reduce((e,n)=>(e.findIndex(e=>t(n,e))===-1&&Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:n,writable:!0}),e),[])}function m(e){return typeof e==`string`}const h=new Set([`>`,`+`,`~`]);function g(e){if(e===void 0)return!1;let t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||e===`-`||e===`_`||t>=128}function _(e){if(e===void 0)return!1;let t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||e===`_`||t>=128}function v(e,t){let n=e[t];if(n===`-`){let n=e[t+1];return n===`-`||n===`\\`||_(n)}return _(n)}function y(e,t){let n=t;if(e[n]===`\\`)n+=2;else if(v(e,n))n++;else return;for(;n<e.length;){if(e[n]===`\\`){n+=2;continue}if(!g(e[n]))break;n++}return n>t?n:void 0}function b(e,t,n,r){if(e[t]!==n)return;let i=0,a;for(let o=t;o<e.length;o++){let t=e[o];if(a){t===`\\`?o++:t===a&&(a=void 0);continue}if(t===`\\`)o++;else if(t===`"`||t===`'`)a=t;else if(t===n)i++;else if(t===r&&--i===0)return o+1}}function x(e,t){let n=t;for(;e[n]===`/`&&e[n+1]===`*`;){let t=e.indexOf(`*/`,n+2);if(t===-1)return n;n=t+2}return n}function S(e,t){let n=x(e,t),r=n;if(e[n]===`*`&&!(e[n+1]===`/`&&n>t))n++;else{let t=y(e,n);t!==void 0&&(n=t)}let i=+(n>r);for(;n<e.length;){let t=x(e,n);if(t!==n){n=t;continue}let r=e[n];if(r===`.`||r===`#`){let t=y(e,n+1);if(t===void 0)return;n=t}else if(r===`[`){let t=b(e,n,`[`,`]`);if(t===void 0)return;n=t}else if(r===`:`){let t=y(e,n+1);if(t===void 0)return;if(n=t,e[n]===`(`){let t=b(e,n,`(`,`)`);if(t===void 0)return;n=t}}else break;i++}return i>0?n:void 0}function C(e){if(!e)return!1;let t=0;for(;;){let n=S(e,t);if(n===void 0)return!1;if(t=x(e,n),t===e.length)return!0;if(!h.has(e[t])||(t=x(e,t+1),t===e.length))return!1}}function w(e,t){let n=e;for(;n!==null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}const T={">":` > `,_:` `,"+":` + `,"~":` ~ `};function E(e){let t=e[0];return t!==void 0&&Object.hasOwn(T,t)?T[t]:void 0}function D(e){let t=e.startsWith(`!`),n=t?e.slice(1):e,r;return r=n.startsWith(`::`)?`pseudo-element`:n[0]===`.`||n[0]===`#`?`self`:E(n)===void 0?n[0]===`[`?`arbitrary`:`named`:`target`,{raw:e,kind:r,negate:t,value:n}}function O(e){return d(e).map(D)}function k(e){let t=[],n;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(i===`\\`){if(r+1>=e.length)return!1;r++}else i===n&&(n=void 0);continue}if(i===`\\`){if(r+1>=e.length)return!1;r++;continue}if(i===`/`&&e[r+1]===`*`){let t=e.indexOf(`*/`,r+2);if(t===-1)return!1;r=t+1;continue}if(i===`"`||i===`'`){n=i;continue}if(i===`[`){t.push(i);continue}if(i===`]`){if(t.pop()!==`[`)return!1;continue}if(i===`(`){t.push(i);continue}if(i===`)`){if(t.pop()!==`(`)return!1;continue}if(t.length===0&&(i===`,`||i===`;`||i===`{`||i===`}`||i===`>`||i===`+`||i===`~`||/\s/.test(i)))return!1}return n===void 0&&t.length===0}function A(e){if(e.kind!==`self`&&e.kind!==`pseudo-element`&&e.kind!==`target`)return!1;let t=e.kind===`target`?e.value.slice(1):e.value;return!t||e.kind===`self`&&t.length===1||!o(t)||!k(t)||e.kind===`self`&&e.negate&&a(t)!==-1}function j(e){switch(e.kind){case`self`:{if(e.negate)return{suffix:`:not(${e.value})`};let t=a(e.value);return t===-1?{suffix:e.value}:{suffix:e.value.slice(0,t),pseudoElement:e.value.slice(t)}}case`pseudo-element`:return{pseudoElement:e.value};case`target`:{let t=E(e.value);if(t===void 0)return;let n=e.value.slice(1),r=a(n);return C(r===-1?n:n.slice(0,r))?r===-1?{combinator:`${t}${n}`}:{combinator:`${t}${n.slice(0,r)}`,pseudoElement:n.slice(r)}:void 0}default:return}}function ee(e){let t={},n=w(e,`prefix`),r=w(e,`suffix`),i=w(e,`combinator`),a=w(e,`pseudoElement`),o=w(e,`parent`);return Object.defineProperties(t,{prefix:{configurable:!0,enumerable:n!==void 0,value:n,writable:!0},suffix:{configurable:!0,enumerable:r!==void 0,value:r,writable:!0},combinator:{configurable:!0,enumerable:i!==void 0,value:i,writable:!0},pseudoElement:{configurable:!0,enumerable:a!==void 0,value:a,writable:!0},parent:{configurable:!0,enumerable:o!==void 0,value:o,writable:!0}}),t}function M(e){let t=e.suffix;if(!t)return e;let n=a(t);return n===-1?e:{...e,suffix:t.slice(0,n)||void 0,pseudoElement:`${t.slice(n)}${e.pseudoElement??``}`}}function N(e){let t=e.pseudoElement;if(!t)return e;let n=s(t);if(n>1&&!u(t))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${n}`);return e}function P(e,t=[],n){let r=d(e),i=d(t),a={conditions:r,theme:n},o=[],c=[];for(let e of r){if(A(e)||e.negate&&(e.kind===`pseudo-element`||e.kind===`target`)){c.push(e);continue}if(e.kind===`self`||e.kind===`pseudo-element`||e.kind===`target`){let t=e.kind===`target`?e.value.slice(1):e.value,n=s(t);if(n>1&&!u(t))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${n}`)}let t=j(e);if(!t){for(let n of i)if(t=n(e,a),t||e.negate&&n({...e,raw:e.value,negate:!1},a))break}t?o.push(N(M(ee(t)))):c.push(e)}let l=o.map(e=>e.pseudoElement??``).join(``),f=s(l);if(f>1&&!u(l))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${f}`);return{resolved:o,unresolved:c}}function F(e,t){let n=d(t).map(ee),r=n.map(e=>e.prefix).filter(Boolean),i=n.map(e=>e.suffix).filter(Boolean),a=n.map(e=>e.combinator).filter(Boolean),o=n.map(e=>e.pseudoElement).filter(Boolean),s=n.map(e=>e.parent).filter(Boolean);return{selector:`${r.join(``)}${e}${i.join(``)}${a.join(``)}${o.join(``)}`,parents:s}}const I=1e4;function te(e,t){return e===t||Object.is(e,t)}var ne=class{nodes=new Map;oldest;newest;get size(){return this.nodes.size}peek(){return this.oldest?{done:!1,value:this.oldest.key}:{done:!0,value:void 0}}add(e){if(this.nodes.has(e))return;let t=e===0?0:e,n={key:t,older:this.newest};this.nodes.set(t,n),this.newest?this.newest.newer=n:this.oldest=n,this.newest=n}clear(){this.nodes.clear(),this.oldest=void 0,this.newest=void 0}delete(e){let t=this.nodes.get(e);return t?(this.nodes.delete(e),this.unlink(t),!0):!1}shift(){let e=this.oldest;return e?(this.nodes.delete(e.key),this.unlink(e),{done:!1,value:e.key}):{done:!0,value:void 0}}reset(e){this.clear();for(let t of e)this.add(t)}touch(e){let t=this.nodes.get(e);!t||t===this.newest||(this.unlink(t),t.older=this.newest,this.newest?this.newest.newer=t:this.oldest=t,this.newest=t)}unlink(e){e.older?e.older.newer=e.newer:this.oldest=e.newer,e.newer?e.newer.older=e.older:this.newest=e.older,e.older=void 0,e.newer=void 0}},re=class extends Map{assumeNoPrototypeBypass;maxEntries;order=new ne;retained=new Set;_revision=0;constructor(e=I,t,n=!1){if(super(),this.assumeNoPrototypeBypass=n,this.maxEntries=e,t)for(let[e,n]of t)this.set(e,n)}get revision(){return this._revision}get retainedSize(){return this.retained.size}isRetained(e){return this.retained.has(e)}clear(){super.clear(),this.order.clear(),this.retained.clear(),this._revision++}delete(e){this.reconcileOrder();let t=super.delete(e);return this.order.delete(e),this.retained.delete(e),this._revision++,t}set(e,t){this.reconcileOrder();let n=super.has(e);for(super.set(e,t),!n&&!this.retained.has(e)&&this.order.add(e),this._revision++;this.order.size>this.maxEntries&&this.deleteOldest(););return this}getOrInsert(e,t){this.reconcileOrder();let n=super.get(e);return n!==void 0||super.has(e)?(this.enforceInstanceLimit(),n):(this.set(e,t),t)}getOrInsertComputed(e,t){this.reconcileOrder();let n=super.get(e);if(n!==void 0||super.has(e))return this.enforceInstanceLimit(),n;let r=t(e);return this.set(e,r),r}setAndTouch(e,t,n=this.maxEntries){return this.reconcileOrder(),this.retained.has(e)?super.set(e,t):super.delete(e)?(super.set(e,t),this.order.touch(e)):(super.set(e,t),this.order.add(e)),this.order.size>n&&this.deleteOldest(),this}replaceRetained(e,t){if(this._revision!==t)return!1;let n=new Map(e);if(this._revision!==t)return!1;this.reconcileOrder();for(let e of this.retained)n.has(e)||(super.delete(e),this.retained.delete(e));for(let[e,t]of n)this.order.delete(e),super.set(e,t),this.retained.add(e);return this.enforceInstanceLimit(),!0}deleteOldest(){this.reconcileEvictionOrder();let e=this.order.shift();for(;!e.done;){if(super.delete(e.value))return!0;this.resetOrder(),e=this.order.shift()}let t=this.firstOrdinaryKey();return!t.done&&super.delete(t.value)}enforceInstanceLimit(){for(;this.order.size>this.maxEntries&&this.deleteOldest(););}reconcileOrder(){if(!this.assumeNoPrototypeBypass)for(let e of this.retained)super.has(e)||this.retained.delete(e);this.order.size!==this.size-this.retained.size&&this.resetOrder()}reconcileEvictionOrder(){if(this.assumeNoPrototypeBypass)return;let e=this.order.peek(),t=this.firstOrdinaryKey();(e.done!==t.done||!e.done&&!t.done&&!te(e.value,t.value))&&this.resetOrder()}firstOrdinaryKey(){for(let e of super.keys())if(!this.retained.has(e))return{done:!1,value:e};return{done:!0,value:void 0}}resetOrder(){this.order.reset(Array.from(super.keys()).filter(e=>!this.retained.has(e)))}},ie=class extends Set{assumeNoPrototypeBypass;maxEntries;order=new ne;constructor(e=I,t,n=!1){if(super(),this.assumeNoPrototypeBypass=n,this.maxEntries=e,t)for(let e of t)this.add(e)}add(e){this.reconcileOrder();let t=super.has(e);for(super.add(e),t||this.order.add(e);this.size>this.maxEntries&&this.size&&this.deleteOldest(););return this}addAndTouch(e,t=this.maxEntries){return this.reconcileOrder(),super.delete(e)?(super.add(e),this.order.touch(e)):(super.add(e),this.order.add(e)),this.size>t&&this.deleteOldest(),this}clear(){super.clear(),this.order.clear()}delete(e){this.reconcileOrder();let t=super.delete(e);return this.order.delete(e),t}deleteOldest(){this.reconcileEvictionOrder();let e=this.order.shift();for(;!e.done;){if(super.delete(e.value))return!0;this.order.reset(super.values()),e=this.order.shift()}let t=super.values().next();return!t.done&&super.delete(t.value)}reconcileOrder(){this.order.size!==this.size&&this.order.reset(super.values())}reconcileEvictionOrder(){if(this.assumeNoPrototypeBypass)return;let e=this.order.peek(),t=super.values().next();(e.done!==t.done||!e.done&&!t.done&&!te(e.value,t.value))&&this.order.reset(super.values())}};function ae(e){let t=e.keys().next();t.done||e.delete(t.value)}function L(e,t,n,r){if(e instanceof re){e.setAndTouch(t,n,r??e.maxEntries);return}e.delete(t),e.set(t,n),e.size>(r??1e4)&&ae(e)}function R(e,t,n){if(e instanceof ie){e.addAndTouch(t,n??e.maxEntries);return}e.delete(t),e.add(t),e.size>(n??1e4)&&ae(e)}const oe=new WeakMap,se=new WeakMap;function ce(e,t){se.set(e,t)}function le(e){return e&&se.get(e)}function ue(e){return(t,n)=>{let r=[e.parent,t.parent].filter(Boolean).join(` $$ `)||t.parent;return n({...t,prefix:`${e.prefix}${t.prefix}`,selector:`${t.selector}${e.suffix}${e.combinator}`,pseudo:`${e.pseudoElement}${t.pseudo}`,parent:r,parentOrder:r===t.parent?t.parentOrder:void 0})}}function de(e,t){return oe.set(e,t),e}function fe(e){return oe.has(e)}function pe(e,t){let n=oe.get(e),r=oe.get(t);if(!n||!r)return;let i=`${r.pseudoElement}${n.pseudoElement}`,a=s(i);if(a>1&&!u(i))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${a}`);let o={prefix:`${n.prefix}${r.prefix}`,suffix:`${n.suffix}${r.suffix}`,combinator:`${n.combinator}${r.combinator}`,pseudoElement:i,parent:[n.parent,r.parent].filter(Boolean).join(` $$ `)||void 0};return de({handle:ue(o)},o)}function me(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function he(e,t){let n=e.length;n in e?me(e,n,t):e[n]=t}function ge(e){let t=``,n,r=-1,i=-1,a=-1,o=[];for(let s=0;s<e.length;s++){let c=e[s];if(n){c===`\\`?s++:c===n&&(n=void 0);continue}if(t.length>0&&c===`\\`){s++;continue}if(t.length>0&&(c===`"`||c===`'`)){n=c;continue}if(t.length>0&&c===`/`&&e[s+1]===`*`){let t=e.indexOf(`*/`,s+2);if(t<0)break;s=t+1;continue}c===`(`||c===`[`?t+=c===`(`?`)`:`]`:c===t.at(-1)?t=t.slice(0,-1):t.length===0&&(c===`@`?(i===-1&&(i=s),he(o,s)):i===-1&&(c===`:`&&r===-1?r=s:c===`!`&&(a=s)))}let s=i===-1?e.length:i,c=e.slice(0,s),l=!1;s>0&&a===s-1&&(l=!0,c=c.slice(0,-1));let u=[];for(let t=0;t<o.length;t++){let n=o[t]+1,r=t+1<o.length?o[t+1]:e.length;he(u,e.slice(n,r))}return r!==-1&&r<s?{raw:e,body:c,property:e.slice(0,r),value:c.slice(r+1),keyword:!1,important:l,conditions:u}:{raw:e,body:c,keyword:!0,important:l,conditions:u}}function _e(e,t={}){let{name:n=`at-condition`}=t,r={},i=new WeakMap,a=e=>{let t=e??r,n=i.get(t);return n||(n=new re(I,void 0,!0),i.set(t,n)),n},o=(t,n,r)=>{let i=t.map(e=>`${e.length}:${e}`).join(``),o=a(r??n),s=o.get(i);if(s!==void 0)return L(o,i,s),s;let{resolved:c,unresolved:l}=P(O(t),e,n);if(l.length>0||c.length===0)return L(o,i,null),null;let u=e=>c.map(t=>t[e]).filter(Boolean).join(``),d={prefix:u(`prefix`),suffix:u(`suffix`),combinator:u(`combinator`),pseudoElement:u(`pseudoElement`),parent:c.map(e=>e.parent).filter(Boolean).join(` $$ `)||void 0},f={...d,handle:ue(d)};return L(o,i,f),f};return{name:n,match(e,t){if(!e.includes(`@`))return;let n=ge(e);if(n.conditions.length===0)return;let r=o(n.conditions,t?.theme,le(t));if(r)return de({matcher:`${n.body}${n.important?`!`:``}`,handle:r.handle},r)},multiPass:!1}}const ve=`imports`,ye=`primitives`,be=`properties`,xe=`preflights`,Se=`shortcuts`,Ce=`utilities`,we=Object.freeze({[ve]:-200,[be]:-150,[xe]:-100,[Se]:-50,[ye]:-10,[Ce]:0});function z(e,t){let n=e.length;n in e?Object.defineProperty(e,n,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[n]=t}function Te(e,t,n=!1,r=t+1){let i=e[t];if(i!==`[`&&i!==`(`)return;let a=i===`[`?`]`:`)`,o=!1,s;for(let i=t+1;i<e.length;i++){let t=e[i];if(t===`
2
- `||t===`\r`||t===`\u2028`||t===`\u2029`)return;if(o){t===`*`&&e[i+1]===`/`&&(o=!1,i++);continue}if(s){t===`\\`?i++:t===s&&(s=void 0);continue}if(i>=r&&/\s/.test(t))return;if(t===`\\`)i++;else if(t===`/`&&e[i+1]===`*`)o=!0,i++;else if(t===`"`||t===`'`||n&&t==="`")s=t;else if(t===`[`||t===`(`)a+=t===`[`?`]`:`)`;else if(t===a.at(-1)&&(a=a.slice(0,-1),!a))return i+1}}function Ee(e,t){let n=0;for(;e[t-n-1]===`\\`;)n++;return n%2==1}const De=/^(?:[\p{ID_Continue}$-]|\u200C|\u200D)+$/u,Oe=/^(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?|\d(?:_?\d)*\.|\.\d(?:_?\d)*)(?:e[+-]?\d(?:_?\d)*)?$/i;function ke(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;return n>=0&&`{,`.includes(e[n])}function Ae(e,t,n){let r=t+1;for(;/\s/.test(e[r]??``);)r++;if(e[r]!==`/`||e[r+1]===`/`||e[r+1]===`*`)return!1;let i=!1;for(r++;r<n;r++){let t=e[r];if(t===`
3
- `||t===`\r`||t===`\u2028`||t===`\u2029`)return!1;if(t===`\\`)r++;else if(t===`[`)i=!0;else if(t===`]`&&i)i=!1;else if(t===`/`&&!i){for(r++;/[a-z]/i.test(e[r]??``);)r++;for(;/\s/.test(e[r]??``);)r++;return r===n}}return!1}function je(e,t){let n=0,r;for(let i=t;i>=0;i--){let a=e[i];if(r)a===r&&!Ee(e,i)&&(r=void 0);else if(a===`"`||a===`'`||a==="`")r=a;else if(a===`]`)n++;else if(a===`[`&&(n--,ke(e,i)&&(n===0||Ae(e,i,t))))return i}}function Me(e,t){let n=e[t];if(n===`"`||n===`'`||n==="`"){for(let r=t-1;r>=0;r--)if(e[r]===n&&!Ee(e,r))return r;return}if(n===`]`)return je(e,t);let r=t;for(;r>0&&!/\s/.test(e[r-1])&&!`({,[`.includes(e[r-1]);)r--;let i=e.slice(r,t+1);return De.test(i)||Oe.test(i)?r:void 0}function Ne(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;if(n<0)return!1;if(`=({,[`.includes(e[n]))return!0;if(e[n]!==`:`)return!1;for(n--;n>=0&&/\s/.test(e[n]);)n--;let r=Me(e,n);if(r===void 0)return!1;for(n=r-1;n>=0&&/\s/.test(e[n]);)n--;return n>=0&&`{,[?`.includes(e[n])}function Pe(e,t){return Ne(e,t)}function Fe(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e[n]!==`"`&&e[n]!==`'`&&e[n]!=="`"?!1:Pe(e,t)}function Ie(e,t,n){if(!Fe(e,t))return!1;let r=t+1,i=0;for(;r<n-1;){for(;/\s/.test(e[r]??``);)r++;let t=e[r];if(t!==`"`&&t!==`'`&&t!=="`")return!1;r++;let a=!1;for(;r<n-1;){let n=e[r];if(n===`\\`)r+=2;else if(n===t){r++,a=!0;break}else r++}if(!a)return!1;for(i++;/\s/.test(e[r]??``);)r++;if(r===n-1)break;if(e[r]!==`,`)return!1;for(r++;/\s/.test(e[r]??``);)r++;if(r===n-1)break}return i!==0}function Le(e){let t=[],n=[],r=new Map,i=!1,a,o;for(let s=0;s<e.length;s++){let c=e[s];if(n.length===0){c===`\\`?(/\s/.test(e[s+1]??``)&&(a=void 0),s++):/\s/.test(c)?a=void 0:c===`"`||c===`'`?a=a===c?void 0:a??c:!a&&c===`[`&&z(n,s);continue}if((o||i)&&c===`[`&&/[:@\s]/.test(e[s-1])){z(n,s),r.set(s,o??i),i=!1,o=void 0;continue}if(i){c===`*`&&e[s+1]===`/`&&(i=!1,s++);continue}if(o){c===`\\`?s++:c===o&&(o=void 0);continue}if(c===`/`&&e[s+1]===`*`)i=!0,s++;else if(c===`"`||c===`'`)o=c;else if(c===`\\`)s++;else if(c===`[`)z(n,s);else if(c===`]`){let a=n.pop(),c=r.get(a);(/[:@]/.test(e[a-1])||e[s+1]===`:`)&&z(t,{end:s+1,start:a}),c===!0?i=!0:c&&(o=c)}}let s=[];for(let e of t.sort((e,t)=>e.start-t.start||t.end-e.end))(!s.length||e.start>=s.at(-1).end)&&z(s,e);return s}function B(e,t,n){let r=e[t];if(n.blockComment)return r===`*`&&e[t+1]===`/`?(n.blockComment=!1,t+1):t;if(n.quote)return r===`\\`?t+1:(r===n.quote&&(n.quote=void 0),t);if(n.closers.length>0&&r===`/`&&e[t+1]===`*`)return n.blockComment=!0,t+1;if(n.closers.length>0&&(r===`"`||r===`'`))return n.quote=r,t;if(n.closers.length>0&&r===`\\`)return t+1;if(r===`(`||r===`[`)return V(n.closers,r===`(`?`)`:`]`),t;if(r===n.closers.at(-1))return n.closers.pop(),t}function Re(e,t,n=e.length){let r={closers:[]};for(let i=t+1;i<n;i++){let t=e[i],n=B(e,i,r);if(n!==void 0){i=n;continue}if(r.closers.length===0){if(t===`}`)return{index:i,kind:`close`};if(t===`{`)return{index:i,kind:`open`}}}return{index:n,kind:`limit`}}function ze(e,t,n=e.length){let r={closers:[]},i=It();for(let a=t+1;a<n;a++){let t=e[a],n=B(e,a,r);if(n!==void 0){a=n;continue}if(!(r.closers.length>0)){if(t===`}`)return{index:a,kind:`close`};if(t===`{`)return{index:a,kind:`open`};if(t===`'`||t===`"`||t==="`"||t===`/`&&(e[a+1]===`/`||e[a+1]===`*`||Gt(e,a,i.forceRegex,i.canEnd)))return{index:a,kind:`host`};/\s/.test(t)||(i.forceRegex=!1),i.canEnd=Wt(e,a,i.canEnd,i)}}return{index:n,kind:`limit`}}const Be=/[\s'"`;{},\])]/;function Ve(e,t,n=e.length){if(e[t]!==`@`)return{conds:``,end:t};let r={closers:[]},i=t;for(;i<n;i++){let t=e[i],n=B(e,i,r);if(n!==void 0){i=n;continue}if(t===`/`&&(e[i+1]===`/`||e[i+1]===`*`)&&r.closers.length===0||Be.test(t)&&r.closers.length===0)break}return{conds:e.slice(t,i),end:i}}function He(e){let t=[],n={closers:[]},r=0;for(let i=0;i<e.length;i++){let a=e[i],o=B(e,i,n);if(o!==void 0){i=o;continue}a===`;`&&n.closers.length===0&&(V(t,e.slice(r,i)),r=i+1)}return V(t,e.slice(r)),t.map(e=>e.trim()).filter(Boolean)}function Ue(e){let t={closers:[]},n=!1,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=B(e,i,t);if(o!==void 0){i=o;continue}if(!(t.closers.length>0)){if(a===`<`&&qt(e,i))return!1;if(a===`;`)return!0;a===`:`?n=!0:a===`?`&&(r=!0)}}return n&&!r}function We(e,t){let n=ze(e,t);if(n.kind!==`close`)return;let r=e.slice(t+1,n.index);if(!Ue(r))return;let i=He(r);if(i.length===0)return;let{conds:a,end:o}=Ve(e,n.index+1);return{end:o,value:i.map(e=>`${e}${a}`).join(` `)}}function V(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function H(e,t,n=!1){let r=t+1;if(r>=e.length)return e.length;if(e[r]===`\r`&&e[r+1]===`
4
- `||n&&e[r]===`$`&&e[r+1]===`{`)return r+2;if(e[r]===`u`&&e[r+1]===`{`){let t=r+2;for(;/[0-9a-f]/i.test(e[t]??``);)t++;if(t>r+2&&e[t]===`}`)return t+1}return r+1}function Ge(e,t,n){let r=e[t];return n.lineComment?((r===`
5
- `||r===`\r`||r===`\u2028`||r===`\u2029`)&&(n.lineComment=!1),t+1):n.blockComment?r===`*`&&e[t+1]===`/`?(n.blockComment=!1,t+2):t+1:n.quote?r===`\\`?H(e,t):(r===n.quote&&(n.quote=void 0),t+1):r===`\\`?H(e,t):r===`/`&&e[t+1]===`*`?(n.blockComment=!0,t+2):r===`/`&&e[t+1]===`/`&&n.parenDepth===0?(n.lineComment=!0,t+2):(r===`'`||r===`"`?n.quote=r:r===`(`?n.parenDepth++:r===`)`&&n.parenDepth>0?n.parenDepth--:r===`{`&&n.parenDepth===0?n.depth++:r===`}`&&n.parenDepth===0&&n.depth--,t+1)}function Ke(e,t,n){let r={blockComment:!1,depth:1,lineComment:!1,parenDepth:0};for(let i=t+1;i<n;){let t=i;if(i=Ge(e,i,r),r.depth===0)return t}return-1}const qe=`=([{,:>)$?|&.!~+-*/%^<`,Je=new Set(`as.assert.await.case.catch.class.const.default.delete.do.else.export.extends.finally.implements.import.in.instanceof.is.keyof.let.new.of.return.satisfies.static.throw.type.typeof.try.var.void.with.yield`.split(`.`)),Ye=new Set([`await`,`case`,`delete`,`do`,`else`,`in`,`new`,`of`,`return`,`throw`,`typeof`,`void`,`yield`]),Xe=new Set([`catch`,`for`,`if`,`switch`,`while`,`with`]),Ze=/^(?:a|abbr|address|animate|animateMotion|animateTransform|annotation|area|article|aside|audio|b|base|bdi|bdo|blockquote|body|br|button|canvas|caption|circle|cite|clipPath|code|col|colgroup|data|datalist|dd|defs|del|desc|details|dfn|dialog|discard|div|dl|dt|ellipse|em|embed|feBlend|feColorMatrix|feComponentTransfer|feComposite|feConvolveMatrix|feDiffuseLighting|feDisplacementMap|feDistantLight|feDropShadow|feFlood|feFuncA|feFuncB|feFuncG|feFuncR|feGaussianBlur|feImage|feMerge|feMergeNode|feMorphology|feOffset|fePointLight|feSpecularLighting|feSpotLight|feTile|feTurbulence|fieldset|figcaption|figure|filter|footer|foreignObject|form|g|h[1-6]|head|header|hgroup|hr|html|i|iframe|image|img|input|ins|kbd|label|legend|li|line|linearGradient|link|maction|maligngroup|malignmark|main|map|mark|marker|mask|math|menu|meta|metadata|meter|menclose|merror|mfenced|mfrac|mglyph|mi|mlabeledtr|mlongdiv|mmultiscripts|mn|mo|mover|mpadded|mpath|mphantom|mprescripts|mroot|mrow|ms|mscarries|mscarry|msgroup|msline|mspace|msqrt|msrow|mstack|mstyle|msub|msubsup|msup|mtable|mtd|mtext|mtr|munder|munderover|nav|noscript|object|ol|optgroup|option|output|p|path|pattern|picture|polygon|polyline|pre|progress|q|radialGradient|rect|rp|rt|ruby|s|samp|script|search|section|select|selectedcontent|semantics|set|slot|small|source|span|stop|strong|style|sub|summary|sup|svg|switch|symbol|table|tbody|td|template|text|textPath|textarea|tfoot|th|thead|time|title|tr|track|tspan|u|ul|use|var|video|view|wbr|[a-z][-\w]*-[\w-]+)$/i,Qe=/^(?:--|-?)[_a-z][-\w]*$/i,$e=/^[+-]?(?:(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)%$/i;function et(e){if(/^(?:from|to)$/i.test(e)||$e.test(e))return!0;let t=e.search(/\s/u);if(t<1)return!1;let n=e.slice(t).trim();return Qe.test(e.slice(0,t))&&$e.test(n)}function tt(e,t,n=0){let r=e.slice(n,t);return/(?:^|[;}\n\r])\s*(?:(?:export|default|declare|async)\s+)*function(?:\s*\*)?[\s\S]*$/.test(r)}function nt(e,t,n=0){return/\bfunction(?:\s*\*)?[\s\S]*$/.test(e.slice(n,t))}function rt(e,t,n=0){let r=e.slice(n,t);return/(?:^|[;{}\n\r])\s*(?:(?:export|default|declare|abstract)\s+)*(?:class|interface|namespace|enum|module|global)\b[^{};]*$/.test(r)}function it(e,t,n=0){return/(?:^|[^\w$])(?:abstract\s+)?class\b[^{};]*$/.test(e.slice(n,t))}function at(e,t,n=0){return rt(e,t,n)||it(e,t,n)||nt(e,t,n)}function ot(e,t){let n=-1,r=0,i=0,a=0,o;for(let s=0;s<e.length;s++){let c=e[s];if(o){c===`\\`?s++:c===o&&(o=void 0);continue}if(i>0){c===`\\`?s++:c===`'`||c===`"`?o=c:c===`{`?i++:c===`}`&&i--;continue}if((t&&c===`$`||c===`#`||c===`@`)&&e[s+1]===`{`){i=1,s++;continue}if(c===`\\`){s++;continue}if(c===`'`||c===`"`){o=c;continue}c===`[`?r++:c===`]`&&r>0?r--:c===`(`?a++:c===`)`&&a>0?a--:r===0&&a===0&&(c===`;`||c===`{`||c===`}`||c===`
6
- `||c===`\r`||t&&c==="`")&&(n=s)}return n}function st(e){for(let t of e)if((t.codePointAt(0)??0)>127)return!0;return!1}function ct(e,t,n=!1,r=0){let i=e.slice(r,t),a=ot(i,n),o=i.slice(a+1).trim();if(o.length===0)return!1;let s=o.split(/\s*(?:,|>|\+|~)\s*|\s+/).filter(Boolean),c=o.split(`,`).map(e=>e.trim());return/^@(?:-[a-z]+-)?[a-z][-\w]*\b/i.test(o)||/^%[-_a-z][-\w]*$/i.test(o)||/(?:^|[\s>+~,])(?:&|[-_a-z][-\w]*|\*)?(?:[.#](?=\S)|\[[^\]]*\])/i.test(o)||/(?:^|[\s>+~,])(?:\*|[-\w]+)\|(?:\*|[-\w]+)(?=$|[\s.#:[>+~,])/i.test(o)||/^(?:(?:[a-z][-\w]*)?|&):{1,2}[-\w(]/i.test(o)||/(?:^|[\s>+~,])\\[0-9a-f]{1,6}\s?/i.test(o)||st(o)||n&&o.includes("${")||o.includes(`#{`)||o.includes(`@{`)||c.every(et)||s.length>0&&s.every(e=>e===`*`||Ze.test(e))}function lt(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;let r=e[n];if(r!==`'`&&r!==`"`)return!1;for(n++;n<e.length;n++){let t=e[n];if(t===`\\`)n++;else if(t===r){for(n++;/\s/.test(e[n]??``);)n++;return e[n]===`:`}}return!1}function ut(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e.startsWith(`...`,n)}function dt(e,t){let n=0;for(t--;t>=0&&e[t]===`\\`;t--)n++;return n%2==1}function ft(e,t,n=0){let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;if(r<0)return!1;if(qe.includes(e[r]))return!0;let i=r+1;for(;r>=0&&/[\w$]/.test(e[r]);)r--;let a=e.slice(r+1,i);return Je.has(a)||at(e,t,n)}const pt=new Set([`catch`,`class`,`do`,`else`,`finally`,`switch`,`try`]),mt=/^(?:(?:await\s+)?using|break|class|const|continue|debugger|declare|do|enum|export|for|function|if|import|interface|let|namespace|return|switch|throw|try|type|var|while|with)(?=$|[\s;(){}])/,ht=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*(?:\s*(?:(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*|(?:\?\.)?\[[^\]]+\]))*\s*(?:(?:\?\.)?\(|\+\+|--|[-+*/%&|^]?=(?!=|>))/u,gt=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*\s*(?:(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*)+\s*$/u,_t=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*(?:\s*(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*)*\s*(?:\?\.)?\[[^\]]+\]\s*$/u,vt=/^new\s+(?:class\b|function\b|[$_\p{ID_Start}])/u,yt=/^\([\s\S]*\)$/,bt=/^\([\s\S]*\)\s*(?:\(|\?\.|\.)/,xt=/^(?:(?:await|delete|typeof|void)\s+\S|yield(?:\s+\S|\s*\*\s*\S))/u,St=/^(?:\+\+|--|!|~)\s*\S/u,Ct=/^\[[\s\S]*\]\s*=(?!=|>)/,wt=new Set([`as`,`in`,`instanceof`,`satisfies`]),Tt=/^(?:=(?!=|>)|\+=|-=|\*\*=|\*=|\/=|%=|&&=|&=|\|\|=|\|=|\^=|\?\?=|<<=|>>>=|>>=)/,Et=/^(?:(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[bB][01](?:_?[01])*|0[oO][0-7](?:_?[0-7])*)n?|(?:\d(?:_?\d)*)n|(?:\d(?:_?\d)*\.(?:\d(?:_?\d)*)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|\d(?:_?\d)*(?:[eE][+-]?\d(?:_?\d)*)?)/;function Dt(e){let t={closers:[]},n=!1,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=t.closers.length===0,s=B(e,i,t);if(s!==void 0){o&&(a===`(`||a===`[`)&&(n=!0),i=s;continue}if(!(t.closers.length>0)){if(a===`:`||a===`@`)return!n||r?void 0:a===`:`?`declaration`:`condition`;if(a===`!`&&i===e.length-1)return!n||r?void 0:`important`;/\s/u.test(a)?r=!0:n=!0}}}function Ot(e,t){if(xt.test(e))return!0;if(!St.test(e))return!1;let n=Dt(e);return n===void 0||t&&n===`important`}function kt(e,t){if(!Ct.test(e))return!1;let n=Dt(e);return n===void 0||t&&n===`important`}function At(e,t){let n={closers:[]};for(let r=t;r<e.length;r++){let t=B(e,r,n);if(t!==void 0&&(r=t,n.closers.length===0))return r+1}}function jt(e){let t={closers:[]},n=-1;for(let r=0;r<e.length;r++){let i=B(e,r,t);if(i!==void 0){r=i;continue}if(!(t.closers.length>0)){if(/\s/u.test(e[r]))return-1;n===-1&&(e[r]===`:`||e[r]===`@`)&&r>0&&(n=r)}}return n}function Mt(e,t){let n=t=>{for(;t<e.length&&/\s/u.test(e[t]);)t++;return t},r=0;for(;e[r]===`+`||e[r]===`-`;)r=n(r+1);let i=rn(e,r);i?.value===`await`&&/\s/u.test(e[i.end]??``)&&(r=n(i.end),i=rn(e,r));let a;if(i!==void 0)a=`identifier`,r=i.end;else if(e[r]===`[`||e[r]===`(`){let t=At(e,r);if(t===void 0)return!1;a=e[r]===`[`?`array`:`parenthesized`,r=t}else{let t=Et.exec(e.slice(r));if(t===null)return!1;a=`number`,r+=t[0].length}let o=!1,s=!1;for(;r<e.length;){let t=r;if(r=n(r),e[r]===`!`&&e[r+1]!==`=`){s=!0,r++;continue}if(e[r]===`(`||e.startsWith(`?.(`,r))return!0;if(e.startsWith(`?.`,r))r=n(r+2);else if(e[r]===`.`)r=n(r+1);else if(e[r]!==`[`){r=t;break}if(e[r]===`[`){let t=At(e,r);if(t===void 0)return!1;o=!0,s=!1,r=t;continue}if(e[r]===`#`&&r++,i=rn(e,r),i===void 0)return!1;o=!0,s=!1,r=i.end}if(r=n(r),e[r]===`(`||e.startsWith(`?.(`,r))return!0;if(o&&e.slice(r).trim().length===0)return!s||Dt(e)!==`important`||t;if(a===`array`&&!o)return!1;if(e.startsWith(`++`,r)||e.startsWith(`--`,r))return e.slice(r+2).trim().length===0;let c=Tt.exec(e.slice(r));return c!==null&&e.slice(r+c[0].length).trim().length>0}function Nt(e){let t=jt(e),n=(t,n)=>{let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;let i=t+n;for(;i<e.length&&/\s/.test(e[i]);)i++;return r>=0&&e[r]!==`:`&&i<e.length},r=(t,r,i)=>{let a=e[r-1]??``,o=e[i]??``;return!/\s/u.test(a)&&!`)!]`.includes(a)||!/\s/u.test(o)&&!`([`.includes(o)&&!((t===`in`||t===`instanceof`)&&`!~+-`.includes(o))&&(t!==`as`&&t!==`satisfies`||o!==`-`)?!1:n(r,i-r)},i={closers:[]};for(let a=0;a<e.length;a++){let o=e[a],s=B(e,a,i);if(s!==void 0){a=s;continue}if(i.closers.length>0||t>=0&&a>t)continue;let c=e[a+1],l=rn(e,a);if(l!==void 0){if(wt.has(l.value)&&r(l.value,a,l.end))return!0;a=l.end-1;continue}if((o===`?`||o===`<`||o===`>`)&&n(a,c===o||c===`=`||o===`?`&&c===`.`?2:1)||(o===`=`&&c===`=`||o===`!`&&c===`=`||o===`&`&&c===`&`||o===`|`&&c===`|`||o===`*`&&c===`*`)&&n(a,2)||`+-*/%&|^`.includes(o)&&(/\s/.test(e[a-1]??``)||/\s/.test(c??``))&&n(a,1)||o===`,`&&(/\s/.test(e[a-1]??``)||/\s/.test(c??``))&&n(a,1))return!0}return!1}function Pt(e,t){let n=ze(e,t);if(n.kind===`open`)return!0;if(n.kind!==`close`)return!1;let r=He(e.slice(t+1,n.index));if(r.length===0)return!0;let i=r.length===1;return r.some(e=>mt.test(e)||ht.test(e)||gt.test(e)||_t.test(e)||Mt(e,i)||vt.test(e)||yt.test(e)||bt.test(e)||Ot(e,i)||kt(e,i)||Nt(e))}function Ft(e,t,n=0,r=0,i=``){if(`:|&=,(`.includes(i))return!1;let a=t-1;for(;a>=0&&/\s/.test(e[a]);)a--;let o=e.slice(n,t);if(nt(e,t,n))return r>0||`:|&=,(`.includes(e[a]??``)?!1:tt(e,t,n);if(/\bclass\b[^;]*$/.test(o))return rt(e,t,n);if(e[a]===`)`||e[a]===`>`)return e.slice(Math.max(n,a-1),a+1)!==`=>`;let s=a+1;for(;a>=0&&/[\w$]/.test(e[a]);)a--;let c=e.slice(a+1,s);return pt.has(c)?!0:at(e,t,n)}function It(){return{angleDepth:0,canEnd:!1,classParenRoles:[],forceRegex:!1,labelCandidate:!1,labelColon:-1,lastSignificant:``,lastWord:``,parenKinds:[],pendingFunctions:[],restrictedLineStatement:!1,statementStart:!0,typeDeclaration:!1}}const Lt=new Set([`abstract`,`async`,`declare`,`default`,`export`]),Rt=new Set([`abstract`,`asserts`,`extends`,`in`,`infer`,`is`,`keyof`,`new`,`readonly`,`typeof`,`unique`]);function zt(e,t){let n=e.pendingFunctions.at(-1);n?.phase===`return-type`&&(n.typeCanEnd=!Rt.has(t))}function U(e,t,n){let r=e.pendingFunctions.at(-1);r?.phase===`return-type`&&(`|&?:=,(`.includes(t)||t===`[`||t===`<`?r.typeCanEnd=!1:(n||t===`]`||t===`>`||t===`)`)&&(r.typeCanEnd=!0))}function Bt(e){let t=e.pendingFunctions.at(-1);if(t)return t.phase===`after-params`?(e.pendingFunctions.pop(),t.kind):t.phase===`return-type`?t.typeCanEnd?(e.pendingFunctions.pop(),t.kind):`T`:`O`}function Vt(e,t){return!e.restrictedLineStatement&&!(e.typeDeclaration&&t===0&&e.canEnd)?!1:(e.canEnd=!1,e.forceRegex=!0,e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=``,e.lastWord=``,e.restrictedLineStatement=!1,e.statementStart=!0,e.typeDeclaration=!1,!0)}function Ht(e,t=!1){e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=`;`,e.lastWord=``,t||(e.pendingFunctions.length=0),e.restrictedLineStatement=!1,e.statementStart=!0,e.typeDeclaration=!1}function W(e,t){e.canEnd=!0,e.forceRegex=!1,e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=t,e.lastWord=``,e.statementStart=!1,U(e,t,!0)}function Ut(e,t,n){if(!n||/\s/.test(e[t-1]??``))return!1;let r=t+1;for(;/\s/.test(e[r]??``);)r++;return/[A-Z_$\p{ID_Start}]/u.test(e[r]??``)}function Wt(e,t,n,r){let i=e[t],a=r?.lastWord??``;if(/\s/.test(i??``))return n;if(/[\w$\p{ID_Continue}]/u.test(i??``)){if(/[\w$\p{ID_Continue}]/u.test(e[t+1]??``))return n;let i=t;for(;i>0&&/[\w$\p{ID_Continue}]/u.test(e[i-1]??``);)i--;let a=e.slice(i,t+1),o=i-1;for(;o>=0&&/\s/.test(e[o]??``);)o--;let s=e[o]===`.`||e[o]===`#`;if(r){let e=r.statementStart;r.labelCandidate=e,r.labelColon=-1,r.lastSignificant=`word`,r.lastWord=s?``:a,!s&&a===`function`?V(r.pendingFunctions,{kind:e?`B`:`O`,phase:`before-params`,typeCanEnd:!1}):s||zt(r,a),!s&&e&&(a===`type`||a===`import`||a===`interface`||a===`declare`||a===`export`)&&(r.typeDeclaration=!0),!s&&e&&(a===`break`||a===`continue`||a===`debugger`)&&(r.restrictedLineStatement=!0),r.statementStart=!s&&e&&Lt.has(a)}return s||!(Je.has(a)||Xe.has(a))}if(r&&(i!==`:`&&(r.labelCandidate=!1),i!==`{`&&(r.labelColon=-1),r.lastWord=``,r.statementStart=!1),/\d/.test(i??``)||i===`.`&&n&&/\d/.test(e[t-1]??``))return r&&(r.lastSignificant=`number`,U(r,i,!0)),!0;if(i===`]`)return r&&(r.lastSignificant=i,U(r,i,!0)),!0;if(i===`[`)return r&&(r.lastSignificant=i,U(r,i,!1)),!1;if(i===`(`){if(r){let e=r.pendingFunctions.at(-1);V(r.classParenRoles,a===`cn`?`C`:n||e?.phase===`before-params`||Xe.has(a)?`O`:`T`),e?.phase===`before-params`?(e.phase=`params`,V(r.parenKinds,`F`)):V(r.parenKinds,Xe.has(a)?`1`:`0`),r.forceRegex=!1,r.lastSignificant=i,U(r,i,!1)}return!1}if(i===`)`){if(r){r.classParenRoles.pop();let e=r.parenKinds.pop();if(r.forceRegex=e===`1`,e===`F`){let e=r.pendingFunctions.at(-1);e?.phase===`params`&&(e.phase=`after-params`)}r.lastSignificant=i,U(r,i,!0)}return!0}if(i===`<`)return r&&(Ut(e,t,n)&&r.angleDepth++,r.lastSignificant=i,U(r,i,!1)),!1;if(i===`>`)return r?.angleDepth?(r.angleDepth--,r.lastSignificant=i,U(r,i,!0),!0):(r&&(r.lastSignificant=i,U(r,i,!1)),!1);if(i===`+`||i===`-`)return r&&(r.lastSignificant=i),e[t-1]===i||e[t+1]===i?(r&&U(r,i,n),n):(r&&U(r,i,!1),!1);if(i===`:`&&r){let e=r.pendingFunctions.at(-1);return e?.phase===`after-params`&&(e.phase=`return-type`,e.typeCanEnd=!1),r.labelCandidate&&(r.labelColon=t),r.lastSignificant=i,U(r,i,!1),!1}return i===`!`&&e[t+1]!==`=`?(r&&(r.lastSignificant=i,U(r,i,n)),n):i===`}`||i===`'`||i===`"`||i==="`"?(r&&(r.lastSignificant=i,U(r,i,!0)),!0):(r&&(r.lastSignificant=i,U(r,i,!1)),!1)}function Gt(e,t,n=!1,r){if(e[t+1]===`/`||e[t+1]===`*`)return!1;if(n)return!0;if(r!==void 0)return!r;let i=t-1;for(;i>=0&&/\s/.test(e[i]);)i--;if(i<0)return!0;if((e[i]===`+`||e[i]===`-`)&&e[i-1]===e[i]||e[i]===`!`&&i>0&&/[\w$)\]]/.test(e[i-1]??``)||e[i]===`>`&&i>0&&/[\w$)>]/.test(e[i-1]??``))return!1;if(`=([{,:;!?&|+-*%^~<>`.includes(e[i]))return!0;let a=i+1;for(;i>=0&&/[\w$]/.test(e[i]);)i--;return Ye.has(e.slice(i+1,a))}function Kt(e,t){let n=!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`
7
- `||t===`\r`||t===`\u2028`||t===`\u2029`)return{end:-1,failedUntil:r};if(t===`\\`)r++;else if(t===`[`)n=!0;else if(t===`]`)n=!1;else if(t===`/`&&!n){for(r++;/[a-z]/i.test(e[r]??``);)r++;return{end:r,failedUntil:r}}}return{end:-1,failedUntil:e.length}}function qt(e,t){let n=e[t+1]===`/`,r=t+(n?2:1),i=r;if(e[r]!==`>`){let t=e.codePointAt(r);if(t===void 0)return;let a=String.fromCodePoint(t);if(!en.test(a))return;for(i+=a.length;i<e.length;){let t=e.codePointAt(i);if(t===void 0)break;let n=String.fromCodePoint(t);if(!tn.test(n)&&!`:.-`.includes(n))break;i+=n.length}let o=e[i];if(!/[\s/>]/.test(o??``)&&!(o===`<`&&!n))return}return{closing:n,name:e.slice(r,i),nameEnd:i}}function Jt(e,t,n){let r=n.get(t);if(r!==void 0)return r;let i=!1,a=!1,o=[],s;for(let r=t;r<e.length;r++){let c=e[r],l=e[r+1];if(a)(c===`
8
- `||c===`\r`||c===`\u2028`||c===`\u2029`)&&(a=!1);else if(i)c===`*`&&l===`/`&&(i=!1,r++);else if(s)c===`\\`?r++:c===s&&(s=void 0);else if(c===`/`&&l===`/`)a=!0,r++;else if(c===`/`&&l===`*`)i=!0,r++;else if(c===`'`||c===`"`||c==="`")s=c;else if(c===`<`)V(o,r);else if(c===`>`&&e[r-1]!==`=`){let e=o.pop();if(e!==void 0&&(n.set(e,r),e===t))return r}}for(let e of o)n.set(e,-1);return-1}function Yt(e,t,n){return!t.closing&&e[t.nameEnd]===`<`?Jt(e,t.nameEnd,n):-1}function Xt(e,t=0){return{blockComment:!1,braceDepth:+!!e,braceKinds:[],declarationBoundary:t,expression:It(),failedRegexUntil:-1,kind:`host`,lineComment:!1,terminating:e}}function Zt(e){let t=e.at(-1);t?.kind===`host`&&W(t.expression,`jsx`)}function Qt(e,t,n){for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`\\`)r=H(e,r,n==="`")-1;else if(t===n)return r+1}return-1}const $t=new Set(`break.case.catch.class.const.continue.debugger.default.delete.do.else.enum.export.extends.false.finally.for.function.if.import.in.instanceof.new.null.return.super.switch.this.throw.true.try.typeof.var.void.while.with`.split(`.`)),en=/^[$_\p{ID_Start}]$/u,tn=/^(?:[$\p{ID_Continue}]|\u200c|\u200d)$/u;function nn(e,t){if(e[t]!==`\\`||e[t+1]!==`u`)return;if(e[t+2]===`{`){let n=0,r=t+3,i=0;for(;/^[0-9a-f]$/i.test(e[r]??``);){if(i=i*16+Number.parseInt(e[r],16),i>1114111)return;n++,r++}return n===0||e[r]!==`}`?void 0:{character:String.fromCodePoint(i),end:r+1}}let n=e.slice(t+2,t+6);if(/^[0-9a-f]{4}$/i.test(n))return{character:String.fromCodePoint(Number.parseInt(n,16)),end:t+6}}function rn(e,t){let n=[],r=!1,i=t,a=!0;for(;i<e.length;){let t=nn(e,i),o=t?.character??String.fromCodePoint(e.codePointAt(i));if(!(a?en.test(o):tn.test(o)))break;V(n,o),r||=t!==void 0,i=t?.end??i+o.length,a=!1}return a?void 0:{end:i,escaped:r,value:n.join(``)}}function an(e,t,n){let r=[],i=!1,a=!1,o=!1,s=!0,c=!1,l=`start`,u=!1,d;for(let f=t+1;f<n;f++){let t=e[f],n=e[f+1];if(o){(t===`
9
- `||t===`\r`||t===`\u2028`||t===`\u2029`)&&(o=!1);continue}if(i){t===`*`&&n===`/`&&(i=!1,f++);continue}if(d){t===`\\`?f++:t===d&&(d=void 0);continue}if(t===`/`&&n===`/`){o=!0,f++;continue}if(t===`/`&&n===`*`){i=!0,f++;continue}if(t===`'`||t===`"`||t==="`"){if(r.length===0&&l!==`constraint`&&l!=="default")return!1;d=t,u=!0;continue}if(t===`(`||t===`[`||t===`{`||t===`<`){if(r.length===0&&l!==`constraint`&&l!=="default")return!1;V(r,t===`(`?`)`:t===`[`?`]`:t===`{`?`}`:`>`),u=!0;continue}if(t===r.at(-1)){r.pop();continue}if(r.length>0||/\s/.test(t))continue;if(t===`,`)return!(l===`start`||l===`after-const`||(l===`constraint`||l==="default")&&!u);if(t===`=`){if(n===`>`){if(l!==`constraint`&&l!=="default")return!1;u=!0,f++;continue}if(l===`constraint`&&!u||l!==`after-name`&&l!==`constraint`)return!1;a=!0,l=`default`,u=!1;continue}let p=rn(e,f);if(p){let e=p.value;if(l===`start`)!p.escaped&&e===`const`?l=`after-const`:(c=!0,s=!$t.has(e),l=`after-name`);else if(l===`after-const`)c=!0,s=!$t.has(e),l=`after-name`;else if(l===`after-name`){if(p.escaped||e!==`extends`)return!1;a=!0,l=`constraint`,u=!1}else u=!0;f=p.end-1}else{if(t===`/`||l!==`constraint`&&l!=="default")return!1;u=!0}}return!c||!s||!a||l===`after-const`||(l===`constraint`||l==="default")&&!u?!1:l===`after-name`||l===`constraint`||l==="default"}function on(e,t){let n=t;for(;n<e.length;)if(/\s/.test(e[n]))n++;else if(e[n]===`/`&&e[n+1]===`/`)for(n+=2;n<e.length&&e[n]!==`
10
- `&&e[n]!==`\r`&&e[n]!==`\u2028`&&e[n]!==`\u2029`;)n++;else if(e[n]===`/`&&e[n+1]===`*`){let t=e.indexOf(`*/`,n+2);if(t===-1)return e.length;n=t+2}else break;return n}function sn(e,t,n){let r=Jt(e,t,n);return r===-1||!an(e,t,r)?-1:e[on(e,r+1)]===`(`?r:-1}function cn(e,t,n){let r=new Set,i=[Xt(!1)],a=0;for(;a<e.length;){let o=i.at(-1),s=e[a],c=e[a+1];if(o.kind===`template`){s===`\\`?a=H(e,a,!0):s==="`"?(i.pop(),Zt(i),a++):s===`$`&&c===`{`?(V(i,Xt(!0)),a+=2):a++;continue}if(o.kind===`element`){if(n===`auto`&&(s===`'`||s===`"`||s==="`")&&a>=o.failedQuoteUntil[s]){let t=Qt(e,a,s);if(t!==-1){a=t;continue}o.failedQuoteUntil[s]=e.length}if(n===`auto`&&s===`/`&&c===`*`&&a>=o.failedBlockCommentUntil){let t=e.indexOf(`*/`,a+2);if(t!==-1){a=t+2;continue}o.failedBlockCommentUntil=e.length}if(s===`{`){V(i,Xt(!0,a+1)),a++;continue}if(s!==`<`){a++;continue}let r=qt(e,a);if(!r){a++;continue}V(i,{blockComment:!1,closing:r.closing,kind:`tag`,name:r.name,opening:a,typeEnd:Yt(e,r,t)}),a=r.nameEnd;continue}if(o.kind===`tag`){if(o.blockComment){s===`*`&&c===`/`?(o.blockComment=!1,a+=2):a++;continue}if(o.quote){s===`\\`?a=H(e,a):(s===o.quote&&(o.quote=void 0),a++);continue}if(s===`/`&&c===`*`){o.blockComment=!0,a+=2;continue}if(s===`'`||s===`"`){o.quote=s,a++;continue}if(a<=o.typeEnd){a++;continue}if(s===`<`){i.pop();continue}if(s===`{`){V(i,Xt(!0,a+1)),a++;continue}if(s!==`>`){a++;continue}let t=a-1;for(;/\s/.test(e[t]??``);)t--;let n=!o.closing&&e[t]===`/`;if(i.pop(),o.closing){let e=i.at(-1);e?.kind===`element`&&e.name===o.name&&(i.pop(),r.add(e.opening),Zt(i))}else n?(r.add(o.opening),Zt(i)):V(i,{failedBlockCommentUntil:-1,failedQuoteUntil:{'"':-1,"'":-1,"`":-1},kind:`element`,name:o.name,opening:o.opening});a++;continue}if(o.lineComment){(s===`
11
- `||s===`\r`||s===`\u2028`||s===`\u2029`)&&(o.lineComment=!1,Vt(o.expression,o.braceDepth)),a++;continue}if(o.blockComment){s===`*`&&c===`/`?(o.blockComment=!1,a+=2):a++;continue}if(o.quote){s===`\\`?a=H(e,a):(s===o.quote&&(o.quote=void 0,W(o.expression,`string`)),a++);continue}if(s===`/`&&c===`/`){o.lineComment=!0,a+=2;continue}if(s===`/`&&c===`*`){o.blockComment=!0,a+=2;continue}if(s===`'`||s===`"`){o.quote=s,a++;continue}if(s==="`"){V(i,{kind:`template`}),a++;continue}if(s===`\\`){let t=nn(e,a);if(t){a=t.end,W(o.expression,`word`);continue}}if(s===`/`&&a>=o.failedRegexUntil&&Gt(e,a,o.expression.forceRegex,o.expression.canEnd)){let t=Kt(e,a);if(t.end!==-1){a=t.end,W(o.expression,`regex`);continue}o.failedRegexUntil=t.failedUntil}if(s===`<`&&!o.expression.canEnd){let r=qt(e,a);if(r&&!r.closing){let o=n===`tsx`?sn(e,a,t):-1;if(o!==-1){a=o+1;continue}V(i,{blockComment:!1,closing:!1,kind:`tag`,name:r.name,opening:a,typeEnd:Yt(e,r,t)}),a=r.nameEnd;continue}}if(s===`{`){let t=Bt(o.expression),n=o.expression.labelColon>=0,r=o.expression.statementStart&&(o.braceKinds.at(-1)===`B`||o.declarationBoundary>0||o.braceKinds.length===0&&Pt(e,a)),i=o.expression.forceRegex||n||r?`B`:t??(Ft(e,a,o.declarationBoundary,o.expression.parenKinds.length,o.expression.lastSignificant)?`B`:`O`);V(o.braceKinds,i),o.braceDepth++,o.expression.canEnd=!1,o.expression.forceRegex=!1,o.expression.labelCandidate=!1,o.expression.labelColon=-1,o.expression.lastSignificant=`{`,o.expression.lastWord=``,o.expression.statementStart=i===`B`,a++;continue}if(s===`}`&&o.braceDepth>0){if(o.braceDepth--,o.terminating&&o.braceDepth===0)i.pop();else{let e=o.braceKinds.pop();o.expression.canEnd=e!==`B`,o.expression.forceRegex=e===`B`,o.expression.labelCandidate=!1,o.expression.labelColon=-1,o.expression.lastSignificant=`}`,o.expression.lastWord=``,o.expression.statementStart=e===`B`,e===`B`&&(o.declarationBoundary=a+1)}a++;continue}if((s===`
12
- `||s===`\r`||s===`\u2028`||s===`\u2029`)&&Vt(o.expression,o.braceDepth)){a++;continue}/\s/.test(s)||(o.expression.forceRegex=!1),o.expression.canEnd=Wt(e,a,o.expression.canEnd,o.expression),s===`;`&&(Ht(o.expression,o.braceKinds.at(-1)===`T`),o.braceKinds.length===0&&(o.declarationBoundary=a+1)),a++}return r}function ln(e,t,n){return!t&&n.has(e)}function un(e,t){for(;t>=0&&/\s/.test(e[t]??``);)t--;if(e[t]!==`=`)return!1;for(t--;t>=0&&/\s/.test(e[t]??``);)t--;let n=t+1;for(;t>=0&&/[\w$-]/.test(e[t]??``);)t--;let r=e.slice(t+1,n);return r===`class`||r===`className`}function dn(e,t){return un(e,t-1)}function fn(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]??``);)n--;return e[n]===`{`?un(e,n-1):un(e,n)}function pn(e){for(let t=e.classParenRoles.length-1;t>=0;t--){let n=e.classParenRoles[t];if(n!==`T`)return n===`C`}return!1}function mn(e,t,n){let r=t-1;for(;r>=0&&/\s/.test(e[r]??``);)r--;return e[r]===`(`?n.classParenRoles.at(-1)===`T`:e[r]===`[`||e[r]===`?`||e[r]===`:`||e[r]===`&`&&e[r-1]===`&`||e[r]===`|`&&e[r-1]===`|`}function hn(e,t,n,r,i){if(r===`block`){let n=e.indexOf(`*/`,t);return n===-1?e.length:n}if(r===`line`){for(let n=t;n<e.length;n++){let t=e[n];if(t===`
13
- `||t===`\r`||t===`\u2028`||t===`\u2029`)return n}return e.length}if(n){for(let r=t;r<e.length;r++){let t=e[r];if(t===`\\`)r=H(e,r)-1;else if(t===n||t===`
14
- `||t===`\r`||t===`\u2028`||t===`\u2029`)return r}return e.length}if(i)for(let n=t;n<e.length;n++){let t=e[n];if(t===`\\`)n=H(e,n,!0)-1;else if(t==="`"||t===`$`&&e[n+1]===`{`)return n}return e.length}function gn(e,t,n){if(!e.includes(`{`))return e;let r=new Map,i=t!==`none`&&e.includes(`<`)?cn(e,r,t):new Set,a=``,o=0,s,c,l=!1,u=-1,d=0,f=[],p=0,m=-1,h=It(),g,_=0,v=!1,y=0,b=0,x,S=-1,C=[],w=[],T=[],E=[],D=-1;for(;o<e.length;){let O=e[o];if(g){let t=Ge(e,o,g);a+=e.slice(o,t),o=t,g.depth===0&&(g=void 0,_=t);continue}if(c){if(c===`line`&&(O===`
15
- `||O===`\r`||O===`\u2028`||O===`\u2029`)){c=void 0,u=-1,d=0,Vt(h,f.length)&&(p=o+1),a+=O,o++;continue}if(c===`block`&&O===`*`&&e[o+1]===`/`){c=void 0,u=-1,d=0,a+=`*/`,o+=2;continue}if(O!==`{`){a+=O,o++;continue}}else if(s){if(O===`
16
- `||O===`\r`||O===`\u2028`||O===`\u2029`){s=void 0,l=!1,u=-1,d=0,W(h,`string`),a+=O,o++;continue}if(O===`\\`){let t=H(e,o);a+=e.slice(o,t),o=t;continue}if(O===s){s=void 0,l=!1,u=-1,d=0,W(h,`string`),a+=O,o++;continue}if(O!==`{`){a+=O,o++;continue}}else if(E.at(-1)?.inText){let t=E.at(-1);if(O===`\\`){let t=H(e,o,!0);a+=e.slice(o,t),o=t;continue}if(O==="`"){E.pop(),W(h,`template`),a+=O,o++;continue}if(O===`{`&&e[o-1]===`$`){t.groupLimit=-1,t.inText=!1,t.interpolationDepth=1,V(f,`I`),h.canEnd=!1,h.forceRegex=!1,h.lastSignificant=`{`,h.lastWord=``,a+=O,o++;continue}if(t.css){let n=Ge(e,o,t.css);a+=e.slice(o,n),o=n,t.css.depth===0&&(t.css=void 0,t.cssBoundary=n);continue}if(O!==`{`){a+=O,o++;continue}}else if(x===`text`){if(O===`{`){let n=t===`auto`?We(e,o):void 0;if(n){D===o&&a.length>0&&!/\s/.test(a.at(-1))&&(a+=` `),a+=n.value,D=n.end,o=n.end;continue}V(w,`T`),x=void 0,V(f,`J`),b++,V(C,!1),h.canEnd=!1,h.forceRegex=!1,h.lastSignificant=`{`,h.lastWord=``}else if(O===`<`&&(e[o+1]===`/`||e[o+1]===`>`||/[A-Z_$a-z]/.test(e[o+1]??``))){v=e[o+1]===`/`,x=`tag`;let t=qt(e,o);S=t?Yt(e,t,r):-1}a+=O,o++;continue}else if(x===`tag`&&o<=S){a+=O,o++;continue}else if(x===`tag`&&O===`{`){V(w,`G`),x=void 0,V(f,`J`),b++,V(C,dn(e,o)),h.canEnd=!1,h.forceRegex=!1,h.lastSignificant=`{`,h.lastWord=``,a+=O,o++;continue}else if(x===`tag`&&O===`>`){let t=o-1;for(;/\s/.test(e[t]??``);)t--;let n=e[t]===`/`;v?y=Math.max(0,y-1):n||y++;let r=T.at(-1);r&&y===r.baseDepth&&(v||n)?(T.pop(),x=r.resumeExpression?void 0:y>0?`text`:void 0,W(h,`jsx`)):x=`text`,v=!1,S=-1,a+=O,o++;continue}else if(x===`tag`&&O!==`'`&&O!==`"`){a+=O,o++;continue}else if(O===`<`&&ln(o,h.canEnd,i)){V(T,{baseDepth:y,resumeExpression:b>0}),v=!1,x=`tag`;let t=qt(e,o);S=t?Yt(e,t,r):-1,a+=O,o++;continue}else if(O===`\\`){let t=nn(e,o);if(t){a+=e.slice(o,t.end),o=t.end,W(h,`word`);continue}}else if(O===`'`||O===`"`){s=O,l=fn(e,o)||pn(h)||x===void 0&&C.at(-1)===!0&&mn(e,o,h),u=-1,d=o+1,a+=O,o++;continue}else if(O==="`"){V(E,{classLiteral:fn(e,o)||pn(h)||x===void 0&&C.at(-1)===!0&&mn(e,o,h),cssBoundary:o+1,groupLimit:-1,inText:!0,interpolationDepth:0}),a+=O,o++;continue}else if(O===`/`&&e[o+1]===`/`){c=`line`,u=-1,d=o+2,a+=`//`,o+=2;continue}else if(O===`/`&&e[o+1]===`*`){c=`block`,u=-1,d=o+2,a+=`/*`,o+=2;continue}else if(O===`/`&&o>=m&&Gt(e,o,h.forceRegex,h.canEnd)){let t=Kt(e,o);if(t.end!==-1){a+=e.slice(o,t.end),o=t.end,W(h,`regex`);continue}m=t.failedUntil}if(O===`}`){let e=f.pop(),t=E.at(-1);if(t&&!t.inText&&(t.interpolationDepth--,t.interpolationDepth===0&&(t.groupLimit=-1,t.inText=!0)),e===`J`&&(b--,C.pop(),x=w.at(-1)===`G`?`tag`:`text`,w.pop()),e===`T`){let e=h.pendingFunctions.at(-1);e?.phase===`return-type`&&(e.typeCanEnd=!0)}h.canEnd=e!==`B`,h.forceRegex=e===`B`,h.labelCandidate=!1,h.labelColon=-1,h.lastSignificant=`}`,h.lastWord=``,h.statementStart=e===`B`,e===`B`&&(p=o+1),a+=O,o++;continue}if(O!==`{`){(O===`
17
- `||O===`\r`||O===`\u2028`||O===`\u2029`)&&Vt(h,f.length)&&(p=o+1),/\s/.test(O)||(h.forceRegex=!1),h.canEnd=Wt(e,o,h.canEnd,h),O===`;`&&(Ht(h,f.at(-1)===`T`),f.length===0&&(p=o+1)),a+=O,o++;continue}let k=c===void 0&&s===void 0&&!E.at(-1)?.inText,A=k?Bt(h):void 0,j=k&&h.labelColon>=0,ee=k&&h.statementStart&&(f.at(-1)===`B`||p>0||f.length===0&&Pt(e,o));if(k&&(f.length>0||A!==void 0||j||ee||h.forceRegex||h.lastSignificant&&qe.includes(h.lastSignificant)||Je.has(h.lastWord)||ft(e,o,Math.max(p,_))||lt(e,o)||ut(e,o))){let t=h.forceRegex||j||ee?`B`:A??(Ft(e,o,p,h.parenKinds.length,h.lastSignificant)?`B`:`O`);V(f,t);let n=E.at(-1);n&&!n.inText&&n.interpolationDepth++,h.canEnd=!1,h.forceRegex=!1,h.labelCandidate=!1,h.labelColon=-1,h.lastSignificant=`{`,h.lastWord=``,h.statementStart=t===`B`,a+=O,o++;continue}let M=E.at(-1),N=e.length;if(s||c?(u<o&&(u=hn(e,o+1,s,c,!1)),N=u):M?.inText&&(M.groupLimit<o&&(M.groupLimit=hn(e,o+1,void 0,void 0,!0)),N=M.groupLimit),(e[o-1]===`#`||e[o-1]===`@`)&&!dt(e,o-1)){let t=Ke(e,o,N);if(t!==-1){a+=e.slice(o,t+1),o=t+1;continue}}let P=M?.inText===!0,F=s===void 0&&c===void 0&&!P?ze(e,o,N):Re(e,o,N),I=F.kind===`close`?F.index:-1,te=M===void 0||P||s!==void 0||c!==void 0,ne=P?M.cssBoundary:s||c?d:_,re=te&&!l&&!(P&&M.classLiteral)&&ct(e,o,P,ne),ie=re?Ke(e,o,N):-1;if(re&&(s===void 0&&c===void 0||ie!==-1)&&(ie===-1||e[ie+1]!==`@`)){let e={blockComment:!1,depth:1,lineComment:!1,parenDepth:0};P?M.css=e:g=e,a+=O,o++;continue}if(F.kind!==`close`){F.kind===`open`&&n&&(n.seen=!0),a+=e.slice(o,F.index),o=F.index,P?M.cssBoundary=F.index:s||c?d=F.index:_=F.index;continue}let ae=e.slice(o+1,I),{conds:L,end:R}=Ve(e,I+1,N),oe=He(ae);if(oe.length===0){a+=O,o++;continue}D===o&&a.length>0&&!/\s/.test(a.at(-1))&&(a+=` `),a+=oe.map(e=>`${e}${L}`).join(` `),D=R,P?M.cssBoundary=R:s||c?d=R:_=R,o=R}return a}function _n(e){return gn(e,`auto`)}function vn(e,t){let n={seen:!1};return{code:gn(e,t,n),nestedOpening:n.seen}}const yn=/^(?:--?[\w-]+|[A-Z_$][\w$-]*|@teacss-skip-bracket-[\da-z]{6})$/i;function bn(e,t){let n=t;for(;n>0&&/[\w-]/.test(e[n-1]);)n--;if(n===t||e[n-1]!==`:`)return!1;let r=n-1,i=r;for(;i>0&&/[\w$@-]/.test(e[i-1]);)i--;if(!yn.test(e.slice(i,r)))return!1;let a=i-1;for(;a>=0&&/\s/.test(e[a]);)a--;return a<0||!`{,?`.includes(e[a])}function xn(e){let t=[],n=[],r=[],i=!1,a;for(let o=0;o<e.length;o++){let s=e[o],c=e[o+1];if(n.length===0){s===`(`&&bn(e,o)&&V(n,{attached:!0,start:o});continue}if(i)s===`*`&&c===`/`&&(i=!1,o++);else if(a)s===`\\`?o++:s===a&&(a=void 0);else if(s===`\\`)o++;else if(s===`/`&&c===`*`)i=!0,o++;else if(s===`'`||s===`"`||s==="`")a=s;else if(r.length>0)s===`[`||s===`(`?V(r,s===`[`?`]`:`)`):s===r.at(-1)&&r.pop();else if(s===`[`)V(r,`]`);else if(s===`(`)V(n,{attached:bn(e,o),start:o});else if(s===`)`){let e=n.pop();e.attached&&V(t,{end:o+1,start:e.start})}}let o=[];for(let e of t.sort((e,t)=>e.start-t.start||t.end-e.end))(o.length===0||e.start>=o.at(-1).end)&&V(o,e);return o}function Sn(e){let t={seen:!1},n=Cn(e,t);for(let e=1;e<5&&t.seen;e++){t.seen=!1;let e=Cn(n,t);if(e===n)break;n=e}return n}function Cn(e,t){if(!e.includes(`{`))return e;let n=``,r=0,i=-1,a=0,o=0,s=e.includes(`[`)?Le(e):[],c=e.includes(`(`)?xn(e):[],l={closers:[]};for(;r<e.length;){for(;a<s.length&&s[a].end<=r;)a++;for(;o<c.length&&c[o].end<=r;)o++;let u=a<s.length?s[a]:void 0,d=o<c.length?c[o]:void 0,f=u?.start===r?u:d?.start===r?d:void 0;if(f&&l.blockComment!==!0&&l.quote===void 0){n+=e.slice(r,f.end),r=f.end;continue}l.closers.length>0&&/\s/.test(e[r])&&(l.blockComment=!1,l.closers.length=0,l.quote=void 0);let p=B(e,r,l);if(p!==void 0){n+=e.slice(r,p+1),r=p+1;continue}let m=e[r];if(l.closers.length>0||m!==`{`){n+=m,r++;continue}let h=Re(e,r);if(h.kind!==`close`){h.kind===`open`&&t&&(t.seen=!0),n+=e.slice(r,h.index),r=h.index;continue}let g=h.index,_=e.slice(r+1,g),{conds:v,end:y}=Ve(e,g+1),b=He(_);if(b.length===0){n+=m,r++;continue}i===r&&n.length>0&&!/\s/.test(n.at(-1))&&(n+=` `),n+=b.map(e=>`${e}${v}`).join(` `),i=y,r=y}return n}function wn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Tn(e){let t=e.length,n=-1,r,i=``,a=e.charCodeAt(0);for(;++n<t;){if(r=e.charCodeAt(n),r===0){i+=`�`;continue}if(r===37){i+=`\\%`;continue}if(r===44){i+=`\\,`;continue}if(r>=1&&r<=31||r===127||n===0&&r>=48&&r<=57||n===1&&r>=48&&r<=57&&a===45){i+=`\\${r.toString(16)} `;continue}if(n===0&&t===1&&r===45){i+=`\\${e.charAt(n)}`;continue}if(r>=128||r===45||r===95||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122){i+=e.charAt(n);continue}i+=`\\${e.charAt(n)}`}return i}const En=Tn,Dn=/^[\da-z]{6}$/,On=/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/;function kn(e){return e.replace(/\?.*$/,``)}function An(e){return On.test(e)}function jn(e){let t,n,r=2166136261;for(t=0,n=e.length;t<n;t++)r^=e.charCodeAt(t),r+=(r<<1)+(r<<4)+(r<<7)+(r<<8)+(r<<24);return`00000${(r>>>0).toString(36)}`.slice(-6)}function Mn(e,t){let n=new Set,r=t.length+6;for(let i=0;i+r<=e.length;){let a=e.indexOf(t,i);if(a===-1||a+r>e.length)break;let o=e.slice(a,a+r);Dn.test(o.slice(t.length))&&n.add(o),i=a+1}return n}function Nn(e){let t=e.keys().next().value;if(t===void 0||t.length<6)return;let n=t.slice(0,-6);if(!(!n||/[\da-z]/.test(n[0]))){for(let t of e.keys())if(t.length!==n.length+6||!t.startsWith(n)||!Dn.test(t.slice(n.length)))return;return RegExp(`${wn(n)}[\\da-z]{6}`,`g`)}}function Pn(e,t,n,r){let i=Mn(e,r),a=new Set([...t.keys(),...i]);return e.replace(n,e=>{let n=0,o;for(;o=`${r}${jn(n?`${e}:${n}`:e)}`,n++,!(t.get(o)===e&&!i.has(o)||!a.has(o)););return a.add(o),t.set(o,e),o})}function Fn(e,t){let n=Nn(t);if(n!==void 0)return e.replace(n,e=>t.get(e)??e);let r=[...t.keys()].filter(Boolean).sort((e,t)=>t.length-e.length);if(!r.length)return e;let i=new RegExp(r.map(wn).join(`|`),`g`);return e.replace(i,e=>t.get(e)??e)}function In(e,t,n){try{let r=[];return String.prototype.replace.call(e,t,(...e)=>{let t=e.length>0&&typeof e.at(-1)==`object`,n=e[e.length-(t?3:2)];return Object.defineProperty(r,r.length,{configurable:!0,enumerable:!0,value:{args:e,end:n+String(e[0]).length,start:n},writable:!0}),e[0]}),Promise.all(r.map(({args:e})=>Promise.resolve(n(e[0],...e.slice(1))))).then(t=>{let n=0,i=``;for(let a=0;a<r.length;a++){let o=r[a];o.start<n||(i+=e.slice(n,o.start)+t[a],n=o.end)}return i+e.slice(n)})}catch(e){return Promise.reject(e)}}const Ln=/[\\:]?[\s'"`;{}]+/g,Rn=new RegExp(Ln.source,Ln.flags),zn=/([\\:]?[\s"'`;<>]|:\(|\)"|\)\s)/g,Bn=`@teacss-skip-bracket-`,Vn=/@teacss-skip-bracket-[\da-z]{6}/g,Hn=/[\s'"`;{}]/;function Un(e,t){return e[t+1]!==`/`&&/[A-Z_$]/i.test(e[t+1]??``)}function Wn(e,t,n){if(n>0)return!0;if(!/\s/.test(e[t-1]??``))return!1;let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;return e[r]!==`=`}function Gn(e){return e!==void 0&&/\.html?$/i.test(e.split(/[?#]/,1)[0])}function Kn(e){return e!==void 0&&/\.(?:[cm]?[jt]sx?|mdx)$/i.test(e.split(/[?#]/,1)[0])}function qn(e){if(e===void 0)return`auto`;let t=e.split(/[?#]/,1)[0];return/\.(?:[cm]?ts)$/i.test(t)?`none`:/\.tsx$/i.test(t)?`tsx`:/\.(?:jsx|mdx)$/i.test(t)?`raw`:`auto`}function Jn(e,t){let n=[],r=[],i=!1,a=0,o=!1,s=!1,c;for(let l=0;l<e.length;l++){let u=e[l],d=e[l+1];if(!o){if(e.startsWith(`<!--`,l)){let t=e.indexOf(`-->`,l+4);if(t===-1)break;l=t+2}else u===`<`&&Un(e,l)&&(o=!0,r=[]);continue}if(s){(u===`
18
- `||u===`\r`||u===`\u2028`||u===`\u2029`)&&(s=!1);continue}if(i){u===`*`&&d===`/`&&(i=!1,l++);continue}if(c){u===`\\`?l++:u===c&&(c=void 0);continue}if(u===`/`&&d===`*`&&Wn(e,l,a)){i=!0,l++;continue}if(u===`/`&&d===`/`&&Wn(e,l,a)){s=!0,l++;continue}if(u===`"`||u===`'`||u==="`"){c=u;continue}if(a>0){u===`{`?a++:u===`}`&&a--;continue}if(u===`{`){a=1;continue}if(u===`>`){for(let e of r)z(n,e);r=[],o=!1;continue}if(!/\s/.test(e[l-1]??``)||e.slice(l,l+5).toLowerCase()!==`class`)continue;let f=l+5;for(;/\s/.test(e[f]??``);)f++;if(e[f]!==`=`)continue;for(f++;/\s/.test(e[f]??``);)f++;if(!e[f]||(t?/[\s"'`=<>]/:/[\s"'`={<>]/).test(e[f]))continue;let p=f+1;for(;p<e.length&&!/[\s"'`=<>]/.test(e[p]);)p++;z(r,{end:p,start:l,valueStart:f}),l=p-1}if(n.length===0)return e;let l=[],u=0;for(let{end:t,start:r,valueStart:i}of n){let n=e.slice(i,t);z(l,e.slice(u,r)),z(l,` `.repeat(t-r-n.length-2)),z(l,`"${n}"`),u=t}return z(l,e.slice(u)),l.join(``)}function Yn(e){if(!e)return!1;let t=e.charCodeAt(0);switch(t){case 9:case 10:case 11:case 12:case 13:case 32:case 34:case 39:case 59:case 96:case 123:case 125:return!0;default:return t>127&&Hn.test(e)}}function Xn(e){let t=e?.charCodeAt(0);return t===10||t===13||t===8232||t===8233}function Zn(e,t){return e[t+1]===`\r`&&e[t+2]===`
19
- `?t+2:t+1}function Qn(e,t){let n=t;for(;/\s/.test(e[n]??``);)n++;if(e[n]!==`:`)return!1;for(n++;/\s/.test(e[n]??``);)n++;return e[n]===`[`&&Fe(e,n)}const $n=new Set([`await`,`break`,`case`,`continue`,`debugger`,`delete`,`do`,`else`,`in`,`instanceof`,`new`,`of`,`return`,`throw`,`typeof`,`void`,`yield`]),er=new Set([`for`,`if`,`while`,`with`]);function tr(e,t){let n=0;for(;t>0&&e[--t]===`\\`;)n++;return n%2==1}function nr(e,t){let n=0;for(let r=t;r>=0;r--){let t=e[r];if(t===`"`||t===`'`||t==="`"){let n=r-1;for(;n>=0&&(e[n]!==t||tr(e,n));)n--;if(n<0)return!1;r=n}else if(t===`/`&&e[r-1]===`*`){let t=e.lastIndexOf(`/*`,r-2);if(t<0)return!1;r=t}else if(t===`)`)n++;else if(t===`(`){if(n--,n!==0)continue;let t=r;for(;t>0&&/\s/.test(e[t-1]);)t--;let i=t;for(;i>0&&/[\w$]/.test(e[i-1]);)i--;return i>0&&/[\w$.]/.test(e[i-1])?!1:er.has(e.slice(i,t))}}return!1}function rr(e,t){let n=0;for(let r=t;r>=0;r--){let t=e[r];if(t===`"`||t===`'`||t==="`"){let n=r-1;for(;n>=0&&(e[n]!==t||tr(e,n));)n--;if(n<0)return-1;r=n}else if(t===`/`&&e[r-1]===`*`){let t=e.lastIndexOf(`/*`,r-2);if(t<0)return-1;r=t}else if(t===`}`)n++;else if(t===`{`&&(n--,n===0))return r}return-1}function ir(e,t){for(;t>0&&/\s/.test(e[t-1]);)t--;let n=t;for(;n>0&&/[\w$]/.test(e[n-1]);)n--;return{start:n,value:e.slice(n,t)}}function ar(e,t){let n=rr(e,t);if(n<0)return!1;let r=n;for(;r>0&&/\s/.test(e[r-1]);)r--;if(r===0)return!0;let i=e[r-1];if(i===`)`||i===`>`&&e[r-2]===`=`||`;{}:`.includes(i))return!0;let a=ir(e,r);return[`catch`,`class`,`do`,`else`,`finally`,`static`,`try`].includes(a.value)?!0:a.value?ir(e,a.start).value===`class`:!1}function or(e,t){if(e[t+1]===`/`||e[t+1]===`*`||e[t-1]===`<`&&(e[t+1]===`>`||/[A-Z_$]/i.test(e[t+1]??``)))return!1;let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;if(n<0)return!0;if((e[n]===`+`||e[n]===`-`)&&e[n-1]===e[n]||e[n]===`!`&&n>0&&/[\w$)\]]/.test(e[n-1]??``)||e[n]===`>`&&n>0&&/[\w$)>]/.test(e[n-1]??``))return!1;if(`=([{,:;!?&|+-*%^~<>`.includes(e[n])||e[n]===`)`&&nr(e,n)||e[n]===`}`&&ar(e,n))return!0;let r=n+1;for(;n>=0&&/[\w$]/.test(e[n]);)n--;let i=e.slice(n+1,r);return $n.has(i)?!0:i==="default"&&ir(e,n+1).value===`export`}function sr(e,t){let n=!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(Xn(t))return-1;if(t===`\\`)r++;else if(t===`[`)n=!0;else if(t===`]`)n=!1;else if(t===`/`&&!n){for(r++;/[a-z]/i.test(e[r]??``);)r++;return r}}return-1}function cr(e,t=!1){let n=[],r=[],i=[],a=!1,o=!1,s,c=-1,l,u=-1,d=!1;for(let f=0;f<e.length;f++){let p=e[f];if(!a&&!s&&p===`/`&&or(e,f)){let t=sr(e,f);if(t!==-1){f=t-1,d=!1;continue}}if(n.length===0){Yn(p)?d=!1:p===`/`&&(d=!0),p===`[`&&(z(n,f),o=d&&e[f-1]!==`:`&&e[f-1]!==`@`,i=[],l=void 0);continue}if(Yn(p)&&(u=f),Xn(p)){n.length=0,i=[],a=!1,o=!1,s=void 0,c=-1,l=void 0;continue}if((a||s)&&/\s/.test(p)&&(l??=Te(e,n.at(-1),!1,f),l===void 0)){n.length=0,i=[],a=!1,o=!1,s=void 0,c=-1;continue}if(!a&&!s&&p===`/`&&o){n.length=0,i=[],o=!1,c=-1;continue}if(a){p===`*`&&e[f+1]===`/`&&(a=!1,f++);continue}if(s){p===`\\`?(Xn(e[f+1])?(n.length=0,i=[],a=!1,s=void 0,c=-1):Yn(e[f+1])&&(u=f+1),f++):p===s&&(z(i,[c+1,f]),s=void 0,c=-1);continue}if(p===`/`&&e[f+1]===`*`)a=!0,f++;else if(p===`"`||p===`'`)s=p,c=f;else if(p===`\\`)Xn(e[f+1])&&(n.length=0,i=[],a=!1,s=void 0,c=-1),Yn(e[f+1])&&(u=f+1),f++;else if(p===`[`)z(n,f);else if(p===`]`){let a=n.pop(),s=f+1,c=!1;if(s!==a+2&&u>a){let n=e[a-1]===`:`||e[a-1]===`@`,i=e[s]===`:`&&!!e[s+1]&&!Hn.test(e[s+1]);c=n&&!Pe(e,a)||i&&!(t&&Qn(e,s)),c&&z(r,[a,s])}if(n.length===0){if(o=!1,l=void 0,!c)for(let[t,n]of i)for(let[i,a]of cr(e.slice(t,n)))z(r,[t+i,t+a]);i=[]}}}let f=[];for(let e of r.sort(([e,t],[n,r])=>e-n||r-t))(f.length===0||e[0]>=f.at(-1)[1])&&z(f,e);return f}const lr=/^(?:--?[\w-]+|[A-Z_$][\w$-]*|@teacss-skip-bracket-[\da-z]{6})$/i;function ur(e,t){let n=t;for(;n>0&&/[\w-]/.test(e[n-1]);)n--;if(n===t||e[n-1]!==`:`)return!1;let r=n-1,i=r;for(;i>0&&/[\w$@-]/.test(e[i-1]);)i--;if(!lr.test(e.slice(i,r)))return!1;let a=i-1;for(;a>=0&&/\s/.test(e[a]);)a--;return a<0||!`{,?`.includes(e[a])}function dr(e){let t=[],n=[],r=[],i=!1,a,o,s=-1,c,l=()=>{if(s<0||n.length===0)return;let e=n.at(-1);e.attached&&e.containsGroupBrace&&z(t,[e.start,s+1]),s=-1};for(let u=0;u<e.length;u++){let d=e[u];if(n.length===0){a?a!=="`"&&Xn(d)?a=void 0:d===`\\`?u=Zn(e,u):d===a?a=void 0:d===`(`&&ur(e,u)&&(z(n,{attached:!0,containsGroupBrace:!1,outerQuote:a,start:u}),c=void 0):d===`"`||d===`'`||d==="`"?a=d:d===`(`&&ur(e,u)&&(z(n,{attached:!0,containsGroupBrace:!1,outerQuote:void 0,start:u}),c=void 0);continue}if(Xn(d)){l(),n.length=0,r.length=0,i=!1,o=void 0,a!=="`"&&(a=void 0),c=void 0;continue}if((o||i)&&/\s/.test(d)&&(c??=Te(e,n.at(-1).start,!0,u),c===void 0)){n.length=0,r.length=0,i=!1,o=void 0,s=-1;continue}if(o){d===`\\`?u=Zn(e,u):d===o?o=void 0:d===`{`&&(n.at(-1).containsGroupBrace=!0);continue}if(i){d===`*`&&e[u+1]===`/`&&(i=!1,u++);continue}let f=n[0].outerQuote;if(d===`/`&&e[u+1]===`*`)i=!0,u++;else if(f&&d===f)l(),n.length=0,r.length=0,i=!1,a=void 0;else if(d===`"`||d===`'`||d==="`")o=d;else if(d===`\\`)u=Zn(e,u);else if(r.length>0)d===`[`?z(r,`]`):d===`(`?z(r,`)`):d===r.at(-1)?(r.pop(),r.length===0?s=-1:d===`)`&&(s=u)):d===`{`&&(n.at(-1).containsGroupBrace=!0);else if(d===`[`)z(r,`]`);else if(d===`{`)n.at(-1).containsGroupBrace=!0;else if(d===`(`)z(n,{attached:ur(e,u),containsGroupBrace:!1,outerQuote:f,start:u});else if(d===`)`){let e=n.pop();e.attached&&e.containsGroupBrace&&z(t,[e.start,u+1]),e.containsGroupBrace&&n.length>0&&(n.at(-1).containsGroupBrace=!0),n.length===0&&(c=void 0)}}l();let u=[];for(let e of t.sort(([e,t],[n,r])=>e-n||r-t))(u.length===0||e[0]>=u.at(-1)[1])&&z(u,e);return u}function fr(e,t,n){if(!t.length)return e;let r=new Set([...e.matchAll(Vn)].map(e=>e[0])),i=new Set([...n.keys(),...r]),a=[],o=0;for(let[s,c]of t){let t=e.slice(s,c),l=0,u;for(;u=`${Bn}${jn(l?`${t}:${l}`:t)}`,l++,!(n.get(u)===t&&!r.has(u)||!i.has(u)););i.add(u),n.set(u,t),z(a,e.slice(o,s)),z(a,u),o=c}return z(a,e.slice(o)),a.join(``)}function pr(e,t,n=!1){return fr(e,cr(e,n),t)}function mr(e,t){return fr(e,dr(e),t)}function hr(e,t){let n=e;for(let e=0;e<t.size&&n.includes(Bn);e++){let e=n.replace(Vn,e=>t.get(e)??e);if(e===n)break;n=e}return n}function gr(e,t){let n=new Map;e.includes(`[`)&&(e=pr(e,n,!0)),e.includes(`(`)&&(e=mr(e,n));let r=vn(e,t);e=r.code;for(let i=1;i<5&&r.nestedOpening;i++){let i=e;if(i.includes(`[`)&&(i=pr(i,n)),i.includes(`(`)&&(i=mr(i,n)),r=vn(i,t),r.code===i)break;e=r.code}e.includes(`[`)&&(e=pr(e,n)),e.includes(`(`)&&(e=mr(e,n));let i=e.split(Ln);return n.size?i.map(e=>e.includes(Bn)?hr(e,n):e):i}const _r={name:`@teacss/core/extractor-split`,order:0,extract({code:e,id:t}){return gr(Kn(t)?e:Jn(e,Gn(t)),qn(t))}};var vr=class extends Set{_map=new Map;constructor(e){if(super(),e)for(let t of e)this.add(t)}add(e){return this._map.set(e,(this._map.get(e)??0)+1),super.add(e)}delete(e){return this._map.has(e)?(this._map.delete(e),super.delete(e)):!1}clear(){this._map.clear(),super.clear()}getCount(e){return this._map.get(e)??0}setCount(e,t){return this._map.set(e,t),super.add(e)}};function G(e){return e instanceof vr}function yr(e,t,n){if(Object.hasOwn(e,t)){if(!Reflect.set(e,t,n))throw TypeError(`Cannot assign event "${String(t)}"`)}else Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}function br(){return{events:Object.create(null),emit(e,...t){let n=Object.hasOwn(this.events,e)?this.events[e]:void 0,r=d(Array.isArray(n)?n:[]).map(e=>e);for(let e of r)e(...t)},on(e,t){let n=this.events,r=Object.hasOwn(n,e)?n[e]:void 0,i=Array.isArray(r)?r:[];return Array.isArray(r)||yr(n,e,i),Object.defineProperty(i,i.length,{configurable:!0,enumerable:!0,value:t,writable:!0}),()=>{let r=Object.hasOwn(n,e)?n[e]:void 0;yr(n,e,d(Array.isArray(r)?r:[]).filter(e=>e!==t))}}}}const xr=/^\[(.+?)~?="(.*)"\]$/,Sr=/[\w\u00A0-\uFFFF%-?]/,Cr=new RegExp(xr.source,xr.flags),wr=/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/,Tr=new RegExp(Sr.source,Sr.flags);function Er(e){return e.match(xr)}function Dr(e=``){return Sr.test(e)}function Or(e){return typeof e==`function`?{match:e}:e}function kr(e){return e.length===3&&Object.hasOwn(e,0)&&Object.hasOwn(e,1)&&Object.hasOwn(e,2)}function Ar(e){return e!=null}function jr(e){return e!=null&&typeof e.then==`function`}function Mr(){}function Nr(e,t){for(let n=0;n<t.length;n++){if(!Object.hasOwn(t,n))continue;let r=t[n],i=Object.hasOwn(r,2),a=i?r[2]:void 0;if(a){let t=a;for(;t!==null&&t!==Object.prototype&&!Object.hasOwn(t,`layer`);)t=Object.getPrototypeOf(t);if(t!==null&&t!==Object.prototype){if(!Reflect.set(a,`layer`,e))throw TypeError(`Cannot assign rule layer`)}else Object.defineProperty(a,"layer",{configurable:!0,enumerable:!0,value:e,writable:!0})}else if(i){if(!Reflect.set(r,2,{layer:e}))throw TypeError(`Cannot assign rule metadata`)}else Object.defineProperty(r,2,{configurable:!0,enumerable:!0,value:{layer:e},writable:!0})}return t}var Pr=class{_map=new Map;get(e,t){let n=this._map.get(e);if(n)return n.get(t)}getFallback(e,t,n){let r=this._map.get(e);return r||(r=new Map,this._map.set(e,r)),r.has(t)||r.set(t,n),r.get(t)}set(e,t,n){let r=this._map.get(e);return r||(r=new Map,this._map.set(e,r)),r.set(t,n),this}has(e,t){return this._map.get(e)?.has(t)??!1}delete(e,t){let n=this._map.get(e);if(!n)return!1;let r=n.delete(t);return r&&n.size===0&&this._map.delete(e),r}deleteTop(e){return this._map.delete(e)}map(e){return Array.from(this._map.entries()).flatMap(([t,n])=>Array.from(n.entries()).map(([n,r])=>e(r,t,n)))}},Fr=class extends Map{getFallback(e,t){let n=this.get(e);return n===void 0&&!this.has(e)?(this.set(e,t),t):n}map(e){let t=[];return this.forEach((n,r)=>{Object.defineProperty(t,t.length,{configurable:!0,enumerable:!0,value:e(n,r),writable:!0})}),t}flatMap(e){let t=[];return this.forEach((n,r)=>{for(let i of d(e(n,r)))Object.defineProperty(t,t.length,{configurable:!0,enumerable:!0,value:i,writable:!0})}),t}};function Ir(e){if(!Object.hasOwn(e,0))return;let t=e[0];if(typeof t==`string`||typeof t==`symbol`)return[t,Object.hasOwn(e,1)?e[1]:void 0]}function Lr(e){return Reflect.ownKeys(e).filter(t=>Object.getOwnPropertyDescriptor(e,t)?.enumerable)}function Rr(e,t){if(Object.getOwnPropertyDescriptor(e,t)?.enumerable)return{value:Reflect.get(e,t)}}function zr(e){let t=[];for(let n of Lr(e)){let r=Rr(e,n);r&&Object.defineProperty(t,t.length,{configurable:!0,enumerable:!0,value:[n,r.value],writable:!0})}return t}function Br(e){return m(e)?e:(Array.isArray(e)?d(e):zr(e)).filter(e=>{let t=Ir(e);return t!==void 0&&t[1]!=null})}function Vr(e){if(Array.isArray(e)){let t=d(e);return t.every(e=>Array.isArray(e)&&e.length>0&&!Array.isArray(Object.hasOwn(e,0)?e[0]:void 0))||t.length===0?[t]:t.map(e=>Br(e))}else return[Br(e)]}function Hr(e){let t=[],n,r;for(let i=0;i<e.length;i++){if(!Object.hasOwn(e,i))continue;let a=e[i],o=Ir(a);if(!o)continue;let[s,c]=o;typeof s==`string`&&(s.startsWith(`$$`)||(s===`__virtual_key__`||n!==s||r!==c)&&(Object.defineProperty(t,t.length,{configurable:!0,enumerable:!0,value:a,writable:!0}),n=s,r=c))}return t}const Ur=`__virtual_key__`;function Wr(e,t){return t==null||typeof t==`function`||typeof e!=`string`?``:e===`__virtual_key__`?t?String(t):``:`${e}:${t};`}function Gr(e){if(e==null||e.length===0)return``;let t=``,n,r;for(let i=0;i<e.length;i++){if(!Object.hasOwn(e,i))continue;let a=Ir(e[i]);if(!a)continue;let[o,s]=a;typeof o==`string`&&(o.startsWith(`$$`)||(o===`__virtual_key__`||n!==o||r!==s)&&(t+=Wr(o,s),n=o,r=s))}return t}function K(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}const Kr=`$reset`;function qr(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}function Jr(e,t,n=!1){let r=e,i=t;if(Array.isArray(i))return n&&Array.isArray(r)?[...d(r),...d(i)]:[...d(i)];if(K(i)&&Object.hasOwn(i,`$reset`)&&i.$reset){let{[Kr]:e,...t}=i;return Yr(t)}if(!K(i))return i;if(!K(r))return Yr(i);let a={...r};return Lr(i).forEach(e=>{if(e===`$reset`)return;let t=Rr(i,e);if(!t)return;let o=t.value,s=Object.hasOwn(r,e)?Reflect.get(r,e):void 0;if(K(o)&&Object.hasOwn(o,`$reset`)&&o.$reset){let{[Kr]:t,...n}=o;qr(a,e,Yr(n))}else K(s)&&K(o)||Array.isArray(s)&&Array.isArray(o)?qr(a,e,Jr(s,o,n)):qr(a,e,o)}),a}function Yr(e){if(Array.isArray(e))return d(e).map(Yr);if(K(e)){let t={};for(let n of Lr(e)){if(n===`$reset`)continue;let r=Rr(e,n);r&&qr(t,n,Yr(r.value))}return t}return e}function Xr(e){return typeof e!=`object`||!e?e:Zr(e)}function Zr(e){if(Array.isArray(e)){let t=Array.from({length:e.length});for(let n=e.length-1;n>=0;n--)t[n]=Object.hasOwn(e,n)?Xr(e[n]):void 0;return t}if(K(e)){let t=e,n={};for(let e of Lr(t)){let r=Rr(t,e);r&&qr(n,e,Xr(r.value))}return n}return e}function Qr(e){return Object.hasOwn(e,0)&&m(e[0])}function $r(e){return Object.hasOwn(e,0)&&m(e[0])}function ei(e){let t=e.split(/\s+/);return t[0]===``&&t.shift(),t.at(-1)===``&&t.pop(),t}function ti(e){if(!e.includes(`[`))return ei(e);let t=Le(e);if(t.length===0)return ei(e);let n=[],r=0,i=-1;for(let a=0;a<e.length;a++){let o=t[r];if(o&&a===o.start){i<0&&(i=a),a=o.end-1,r++;continue}/\s/.test(e[a])?(i>=0&&z(n,e.slice(i,a)),i=-1):i<0&&(i=a)}return i>=0&&z(n,e.slice(i)),n}function ni(e){let t=``,n=0,r;for(let i=0;i<e.length;i++){let a=e[i];if(a===`\\`&&e[i+1]===`_`){t+=`_`,i++;continue}if(a===`\\`&&i+1<e.length){t+=a+e[++i];continue}if(r){a===r&&(r=void 0),t+=a===`_`&&n===0?` `:a;continue}if(a===`/`&&e[i+1]===`*`){let n=e.indexOf(`*/`,i+2);if(n===-1){t+=e.slice(i);break}t+=e.slice(i,n+2),i=n+1;continue}if(a===`"`||a===`'`){r=a,t+=a;continue}if(a===`(`?n++:a===`)`&&n>0&&n--,a===`_`&&n===0){t+=` `;continue}t+=a}return t}const ri=new Set([`calc`,`clamp`,`max`,`min`]);function ii(e){return e==null?!1:e===`\\`||/[-_a-zA-Z0-9]/.test(e)||e.charCodeAt(0)>=128}function ai(e,t){if(t>0&&ii(e[t-1])||!/[-_a-zA-Z]/.test(e[t]))return;let n=t+1;for(;/[-_a-zA-Z0-9]/.test(e[n]??``);)n++;return e[n]===`(`?{name:e.slice(t,n),open:n}:void 0}function oi(e){let t=new Map,n=[],r=!1,i;for(let a=0;a<e.length;a++){let o=e[a];if(r){o===`*`&&e[a+1]===`/`&&(r=!1,a++);continue}if(i){o===`\\`?a++:o===i&&(i=void 0);continue}if(o===`\\`){a++;continue}if(o===`"`||o===`'`){i=o;continue}if(o===`/`&&e[a+1]===`*`){r=!0,a++;continue}o===`(`?z(n,a):o===`)`&&n.length>0&&t.set(n.pop(),a)}return t}function si(e,t){let n=e[t];if(n===`"`||n===`'`){for(let r=t+1;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===n)return r+1;return e.length}if(n===`/`&&e[t+1]===`*`){let n=e.indexOf(`*/`,t+2);return n<0?e.length:n+2}}function ci(e){let t=e.trimEnd();for(;t.endsWith(`*/`);){let e=t.lastIndexOf(`/*`);if(e<0)break;t=t.slice(0,e).trimEnd()}if(t.endsWith(`)`)||/(?:^|[\s,(+\-*/])(?:e|pi|nan|-?infinity)$/i.test(t))return!0;let n=/[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?(?:%|[a-z]+)?$/i.exec(t);if(n==null)return!1;let r=n.index;return r===0?!0:n[0].startsWith(`-`)&&t[r-1]===`-`?!1:/[\s,(+\-*/]/.test(t[r-1])}function li(e,t,n){return e[t]!==`+`&&e[t]!==`-`||!/\d/.test(e[t+1]??``)?!1:/(?:^|[^-_a-zA-Z0-9.])(?:\d+(?:\.\d*)?|\.\d+)[eE]$/.test(n.trimEnd())}function ui(e){if(!e.includes(`(`))return e;let t=oi(e),n=[],r=``;for(let i=0;i<e.length;){let a=si(e,i);if(a!=null){r+=e.slice(i,a),i=a;continue}let o=ai(e,i);if(o!=null){let a=t.get(o.open);if(a==null){r+=e.slice(i);break}let s=o.name.toLowerCase();if(s===`url`){r+=e.slice(i,a+1),i=a+1;continue}if(ri.has(s)){r+=`${o.name}(`,z(n,a),i=o.open+1;continue}r+=o.name,i=o.open;continue}let s=e[i],c=s===`+`||s===`-`||s===`*`||s===`/`,l=s===`/`&&e[i+1]===`*`;n.length>0&&c&&!l&&!li(e,i,r)&&ci(r)?(/\s/.test(r.at(-1)??``)||(r+=` `),r+=s,/\s/.test(e[i+1]??``)||(r+=` `)):r+=s,i===n.at(-1)&&n.pop(),i++}return r}function di(e){return e.length>=2&&e[0]===`[`&&e[e.length-1]===`]`}function fi(e,t={}){let{calc:n=!0}=t,r=e;return di(r)&&(r=ni(r.slice(1,-1))),n&&(r=ui(r)),r}const pi=new re(256,void 0,!0);function mi(e){return d(e).map(e=>e)}function hi(e,t,n){return n.some(n=>e.startsWith(n,t))}function gi(e,t,n){let r=t-1;for(;r>0&&/[\w$-]/.test(e[r-1]);)r--;let i=r-1;for(;i>=0&&/\s/.test(e[i]);)i--;return e[i]===`(`&&n.some(t=>e.slice(i-t.length,i)===t)}function _i(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e[n]===`"`||e[n]===`'`||e[n]==="`"}function vi(e,t){let n=new Set,r=[],i=[],a=[],o,s=()=>{let e=o?.bracketStarts.at(-1);if(e)e.containsCandidate=!0;else{let e=i.at(-1);e&&(e.containsCandidate=!0)}};for(let c=0;c<e.length;c++){let l=e[c],u=l===`[`&&(e[c-1]===`:`||e[c-1]===`@`);if(u||l===`[`&&!o){_i(e,c)&&(!u||Fe(e,c)&&!gi(e,c,t))&&n.add(c),i.push({containsCandidate:!1,parentQuote:o,start:c}),o=void 0;continue}if(i.length!==0){if(o){if(l===`\\`)c++;else if(l===o.character){if(o.bracketStarts.some(e=>e.containsCandidate)){for(let e of o.bracketStarts)e.containsCandidate&&n.add(e.start);let e=i.at(-1);e&&(e.containsCandidate=!0)}o=void 0}else if(l===`[`)o.bracketStarts.push({containsCandidate:!1,start:c});else if(l===`]`){let i=o.bracketStarts.pop();i&&hi(e,c+1,t)?(r.push({start:i.start,end:c+1}),n.delete(i.start),s()):i?.containsCandidate&&(n.add(i.start),s())}}else if(l===`"`||l===`'`||l==="`")o={bracketStarts:[],character:l},a.push(o);else if(l===`\\`)c++;else if(l===`]`){let a=i.pop(),l=a.start,u=c+1,d=n.has(l)||Ie(e,l,u)&&!gi(e,l,t),f=(e[l-1]===`:`||e[l-1]===`@`||hi(e,u,t))&&!d;f?(r.push({start:l,end:u}),n.delete(l)):a.containsCandidate&&n.add(l),o=a.parentQuote,(f||a.containsCandidate)&&s()}}}for(let e of i)e.containsCandidate&&n.add(e.start);for(let e of a)for(let t of e.bracketStarts)t.containsCandidate&&n.add(t.start);let c=[];for(let e of r.sort((e,t)=>e.start-t.start||t.end-e.end))(!c.length||e.start>=c.at(-1).end)&&c.push(e);return{barrierStarts:n,ranges:c}}function yi(e,t){let{barrierStarts:n,ranges:r}=vi(e,t);if(r.length===0&&n.size===0)return e;let i=e.split(``);for(let e of n)i[e]=`$`;for(let e of r)for(let t=e.start+1;t<e.end-1;t++)i[t]=`$`;return i.join(``)}function bi(e){let t=JSON.stringify(e),n=[...e].sort((e,t)=>t.length-e.length).map(wn).join(`|`),r=`\\[[^\\]]*?\\]`,i=pi.getOrInsert(t,RegExp(n?`((?:[!@*<~\\w+:_-]|${r})+?)(${n})\\(((?:[~!@<>\\w\\s:/\\\\,%#.$?-]|${r})+?)\\)(?!\\s*?=>)`:`(?!)`,`gm`));return i.lastIndex=0,i}function xi(e=[`-`,`:`]){let t=bi(mi(e));return new RegExp(t.source,t.flags)}function Si(e,t=[`-`,`:`],n=5){let r=mi(t),i=bi(r),a=!1,o=typeof e==`string`?e:e.original,s=o,c=new Set,l=new Map;if(n>0){let e=yi(s,r),t;if(r.some(t=>e.includes(`${t}(`)))do{t=!1;let o=``,u=0;i.lastIndex=0;let d;for(;d=i.exec(e);){let e=d.index,[n,r,i,f]=d;a=!0,t=!0;let p=s.slice(e,e+n.length),m=s.slice(e,e+r.length);c.add(m+i);let h=e+m.length+i.length+1,g=s.slice(h,h+f.length),_={length:p.length,items:[]};l.set(e,_);let v=0;for(let e of ti(g)){let t=g.indexOf(e,v),n=h+t;v=t+e.length;let r=l.get(n)?.items;r?l.delete(n):r=[{offset:n,length:e.length,className:e}];for(let e of r)e.className=e.className===`~`?i===`:`?`${m}${i}~`:m:e.className.replace(/^(!?)(.*)/,(e,t,n)=>`${t}${m}${i}${n}`),_.items.push(e)}o+=s.slice(u,e),o+=`$`.repeat(p.length),u=e+p.length}t&&(s=o+s.slice(u)),--n,t&&n&&(e=yi(s,r))}while(t&&n)}let u=[...l].sort(([e],[t])=>e-t),d;if(typeof e==`string`){d=``;let t=0;for(let[n,r]of u)d+=e.slice(t,n),d+=r.items.map(e=>e.className).join(` `),t=n+r.length;d+=e.slice(t)}else{d=e;for(let[e,t]of u){if(d.slice(e,e+t.length)!==o.slice(e,e+t.length))throw Error(`Cannot expand a variant group that overlaps an existing MagicString edit`);d.overwrite(e,e+t.length,t.items.map(e=>e.className).join(` `))}}return{prefixes:Array.from(c),hasChanged:a,groupsByOffset:new Map(u),get expanded(){return d.toString()}}}function Ci(e,t){let n=new Map,r=mi(t).sort((e,t)=>t.length-e.length),i=ti(e).map(e=>{let t=r.find(t=>e.startsWith(t));if(!t)return e;let i=e.slice(t.length);if(n.has(t))return n.get(t).push(i),null;{let e=[i];return n.set(t,e),{prefix:t,items:e}}}).filter(Ar).map(e=>typeof e==`string`?e:`${e.prefix}(${e.items.join(` `)})`).join(` `);return i?`${/^\s/.test(e)?` `:``}${i}${/\s$/.test(e)?` `:``}`:e?` `:``}function wi(e,t=[`-`,`:`],n=5){let r=Si(e,t,n);return typeof e==`string`?r.expanded:e}const Ti=new Set;function Ei(e){if(!Ti.has(e)){Ti.add(e);try{console.warn(`[Teacss]`,e)}catch(t){throw Ti.delete(e),t}}}function Di(e,t,n){let r=e;for(;r!==null&&r!==Object.prototype&&!Object.hasOwn(r,t);)r=Object.getPrototypeOf(r);if(r!==null&&r!==Object.prototype){if(!Reflect.set(e,t,n))throw TypeError(`Cannot assign rule metadata "${String(t)}"`)}else Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function Oi(e,t){let n=e;for(;n!==null&&n!==Object.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function ki(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Ai(e){if(!Object.hasOwn(e,0)||!Object.hasOwn(e,1))throw TypeError(`[Teacss] invalid rule or shortcut entry: matcher and body must be own tuple values`);let t=[e[0],e[1],void 0],n=Object.hasOwn(e,2)?e[2]:void 0;if(n!==void 0){let e={...n},r=Object.hasOwn(e,`prefix`)?e.prefix:void 0;Array.isArray(r)&&Di(e,`prefix`,[...d(r)]),t[2]=e}return t}function ji(e){let t=Object.create(null),n=[];for(let[r,i]of e.entries()){let e=Object.hasOwn(i,2)?i[2]:void 0;if(e===void 0)if(e={},Object.hasOwn(i,2)){if(!Reflect.set(i,2,e))throw TypeError(`Cannot assign rule metadata`)}else Object.defineProperty(i,2,{configurable:!0,enumerable:!0,value:e,writable:!0});if(Di(e,`__index`,r),Qr(i)){let n=d(Oi(e,`prefix`)??``);for(let e of n)t[e+i[0]]=i}else ki(n,i)}return n.reverse(),{rulesSize:e.length,rulesDynamic:n,rulesStaticMap:t}}function Mi(e){let t=d(e.rules).map(Ai),n=ji(t);e.rules=t,e.rulesSize=n.rulesSize,e.rulesDynamic=n.rulesDynamic,e.rulesStaticMap=n.rulesStaticMap}function q(e,t){return e!=null&&Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function Ni(e,t){let n=e;for(;n!==null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function Pi(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Fi(e,t){for(let t=e.length;t>0;t--)Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:e[t-1],writable:!0});Object.defineProperty(e,0,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Ii(e){let t=new Set,n=[];for(let r of e){let e=r.name;t.has(e)||(t.add(e),Pi(n,r))}return n}function Li(e){return Array.from(e,(e,t)=>({index:t,order:Ni(e,`order`)||0,value:e})).sort((e,t)=>e.order-t.order||e.index-t.index).map(({value:e})=>e)}function Ri(e,t){let n={...e};for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(t,e)?.enumerable)continue;let r=Reflect.get(t,e);r!==void 0&&Object.defineProperty(n,e,{value:r,configurable:!0,enumerable:!0,writable:!0})}return n}function zi(e){return d(e).flatMap(e=>Array.isArray(e)?[e]:Object.entries(e))}const Bi=new WeakSet;function Vi(e,t){let n={};for(let t of Reflect.ownKeys(e)){if(t===`name`||!Object.getOwnPropertyDescriptor(e,t)?.enumerable)continue;let r=Reflect.get(e,t);Object.defineProperty(n,t,{value:t===`prefix`&&Array.isArray(r)?[...d(r)]:r,configurable:!0,enumerable:!0,writable:!0})}return Object.defineProperty(n,"name",{value:t,configurable:!0,enumerable:!0,writable:!0}),n}async function Hi(e){let t=typeof e==`function`?await e():await e;if(typeof t!=`object`||!t||Array.isArray(t))throw TypeError(`Invalid TeaCSS preset: expected an object, received ${t===null?`null`:Array.isArray(t)?`array`:typeof t}.`);let n=Object.hasOwn(t,`name`)?Reflect.get(t,`name`):void 0;if(typeof n!=`string`||n.trim()===``)throw TypeError(`Invalid TeaCSS preset: expected a non-empty string name.`);if(Bi.has(t))return t;t=Vi(t,n),Bi.add(t);let r=q(t,`shortcuts`),i=q(t,`rules`),a=r?zi(r).map(Ai):void 0;t.shortcuts=a,t.rules=i?d(i).map(Ai):void 0;let o=q(t,`prefix`),s=q(t,`layer`);if(o||s){let e=e=>{e[2]||={};let t=e[2];Ni(t,`prefix`)==null&&o&&Object.defineProperty(t,"prefix",{configurable:!0,enumerable:!0,value:[...d(o)],writable:!0}),Ni(t,`layer`)==null&&s&&Object.defineProperty(t,"layer",{configurable:!0,enumerable:!0,value:s,writable:!0})};a?.forEach(e),t.rules?.forEach(e)}return t}async function Ui(e){return Wi(e,new Set)}async function Wi(e,t){if(t.has(e))throw TypeError(`Circular TeaCSS preset reference detected.`);let n=new Set(t);n.add(e);let r=await Hi(e),i=q(r,`presets`);if(!i)return[r];let a=d(i).flatMap(e=>Array.isArray(e)?[...e]:[e]);return[r,...(await Promise.all(a.map(e=>Wi(e,n)))).flat()]}function Gi(e){if(e.length===0)return{};let t=[],n=[],r=!1,i=!1,a=[],o=[];for(let s of e){let e=q(s,`pipeline`),c=q(s,`filesystem`),l=q(s,`inline`),u=e&&q(e,`include`),d=e&&q(e,`exclude`);e===!1?(i=!0,r=!0):r||(e!==void 0&&(i=!0),u&&Pi(t,u),d&&Pi(n,d)),c&&Pi(a,c),l&&Pi(o,l)}let s={};return r?s.pipeline=!1:i&&(s.pipeline={},t.length&&(s.pipeline.include=f(na(...t))),n.length&&(s.pipeline.exclude=f(na(...n)))),a.length&&(s.filesystem=f(a.flatMap(e=>d(e)))),o.length&&(s.inline=f(o.flatMap(e=>d(e)))),s}async function Ki(e={},t={}){let n=Ri(t,e),r=q(n,`presets`)??[],i=Ii((await Promise.all(d(r).flatMap(e=>d(e)).map(e=>Ui(e)))).flat()),a=Array.from(i,e=>({enforce:q(e,`enforce`),preset:e})),o=[...a.filter(({enforce:e})=>e===`pre`),...a.filter(({enforce:e})=>e==null),...a.filter(({enforce:e})=>e===`post`)].map(({preset:e})=>e),s=[...o,n],c=[...s].reverse(),l=s.reduce((e,t)=>({...e,...q(t,`layers`)}),{...we});function u(e){return f(s.flatMap(t=>d(q(t,e))))}let p=u(`extractors`),m=c.map(e=>q(e,`extractorDefault`)).find(e=>e!==void 0);m===void 0&&(m=_r),m&&!p.includes(m)&&Fi(p,m);let h=Li(p),g=u(`rules`).map(Ai),{rulesSize:_,rulesStaticMap:v,rulesDynamic:y}=ji(g),b=s.map(e=>q(e,`autocomplete`)),x=e=>b.flatMap(t=>{let n=q(t,e);return n===void 0?[]:Array.isArray(n)?[...n]:[n]}),S={templates:f(x(`templates`)),extractors:Li(x(`extractors`)),shorthands:ta(b.map(e=>q(e,`shorthands`)||{}))},C=u(`separators`);C.length||(C=[`:`,`-`]);let w=Gi(u(`content`)),T=c.map(e=>q(e,`details`)).find(e=>e!==void 0),E=c.map(e=>q(e,`outputToCssLayers`)).find(e=>e!==void 0),D=c.map(e=>q(e,`sortLayers`)).find(e=>e!==void 0),O=q(n,`envMode`)||`build`,k={...n,mergeSelectors:q(n,`mergeSelectors`)??!0,warn:q(n,`warn`)??!0,unmatched:q(n,`unmatched`)??`off`,outputToCssLayers:E,sortLayers:D??(e=>e),blocklist:u(`blocklist`),presets:o,envMode:O,shortcutsLayer:q(n,`shortcutsLayer`)||`shortcuts`,layers:l,theme:ea(s.map(e=>q(e,`theme`))),rules:g,rulesSize:_,rulesDynamic:y,rulesStaticMap:v,preprocess:u(`preprocess`),postprocess:u(`postprocess`),preflights:u(`preflights`),autocomplete:S,variants:Li(u(`variants`).map(Or)),shortcuts:zi(u(`shortcuts`)).map(Ai).reverse(),extractors:h,safelist:u(`safelist`),separators:C,details:T??O===`dev`,content:w,transformers:Ii(u(`transformers`))},A=u(`extendTheme`);for(let e of A)k.theme=e(k.theme,k)||k.theme;let j=!1;for(let e of s){let t=q(e,`configResolved`);t!=null&&(j=!0,t(k))}return j&&Mi(k),k}function qi(e){let t={};for(let n of Reflect.ownKeys(e))Object.getOwnPropertyDescriptor(e,n)?.enumerable&&Object.defineProperty(t,n,{configurable:!0,enumerable:!0,value:Reflect.get(e,n),writable:!0});return t}function Ji(e,t,n){return Object.hasOwn(t,n)?Reflect.get(t,n):q(e,n)}function Yi(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function Xi(e){let t=qi(e);if(Object.hasOwn(e,`templates`)){let n=Ji(e,t,`templates`);n===void 0?delete t.templates:Yi(t,`templates`,d(n))}if(Object.hasOwn(e,`extractors`)){let n=Ji(e,t,`extractors`);n===void 0?delete t.extractors:Yi(t,`extractors`,d(n))}if(Object.hasOwn(e,`shorthands`)){let n=Ji(e,t,`shorthands`);n===void 0?delete t.shorthands:Yi(t,`shorthands`,n)}return t}function Zi(e={},t={}){let n=q(e,`shorthands`),r=q(t,`shorthands`),i={...e},a={...t};delete i.shorthands,delete a.shorthands;let o=Jr(i,a,!0);return(n!==void 0||r!==void 0)&&Object.defineProperty(o,"shorthands",{configurable:!0,enumerable:!0,value:{...n??{},...r??{}},writable:!0}),o}function Qi(e){let t=qi(e);if(Object.hasOwn(e,`entry`)){let n=Ji(e,t,`entry`);n===void 0?delete t.entry:Yi(t,`entry`,d(n))}return t}function $i(e){let t=[`shortcuts`,`preprocess`,`postprocess`,`extendTheme`,`separators`];return d(e).map(e=>Object.entries(e).reduce((e,[n,r])=>{if(r===void 0)return e;let i=n===`autocomplete`&&r?Xi(r):n===`cli`&&r?Qi(r):t.includes(n)?d(r):r;return{...e,[n]:i}},{})).reduce((e,t)=>{let n=q(e,`autocomplete`),r=q(t,`autocomplete`),i=q(e,`content`),a=q(t,`content`),o=q(e,`extractorDefault`),s=q(t,`extractorDefault`),c=q(e,`theme`),l=q(t,`theme`),u={...e},d={...t};delete u.autocomplete,delete u.content,delete u.extractorDefault,delete u.theme,delete d.autocomplete,delete d.content,delete d.extractorDefault,delete d.theme;let f=Jr(u,d,!0);return(n||r)&&Object.defineProperty(f,"autocomplete",{configurable:!0,enumerable:!0,value:Zi(n,r),writable:!0}),(c||l)&&Object.defineProperty(f,"theme",{configurable:!0,enumerable:!0,value:ea([c,l]),writable:!0}),(i||a)&&Object.defineProperty(f,"content",{configurable:!0,enumerable:!0,value:Gi([i||{},a||{}]),writable:!0}),(o!==void 0||s!==void 0)&&Yi(f,`extractorDefault`,s===void 0?o:s),f},{})}function ea(e){return e.reduce((e,t)=>{if(!t)return e;let n=Zr(t);if(!K(n))return n;if(!K(e)){if(!Reflect.ownKeys(n).some(e=>Object.getOwnPropertyDescriptor(n,e)?.enumerable))return e;if(Object.hasOwn(n,`$reset`)&&Reflect.get(n,`$reset`))return Jr({},n);throw TypeError(`[Teacss] cannot safely merge a plain theme into a non-plain theme; use extendTheme for a class-aware merge or $reset to replace it.`)}return Jr(e,n)},{})}function ta(e){return e.reduce((e,t)=>{let n=Object.create(null);for(let e of Object.keys(t)){let r=t[e];if(Array.isArray(r)){let t=d(r);n[e]=t.length===1?t[0]??``:`(${t.join(`|`)})`}else n[e]=r}return{...e,...n}},{})}function na(...e){return e.flatMap(e=>d(ra(e)))}function ra(e){return Array.isArray(e)?e:e?[e]:[]}function ia(e){return e}function aa(){let e=typeof process<`u`&&!!process.stdout;return{isNode:e,isVSCode:e&&!!process.env.VSCODE_CWD,isESLint:e&&!!process.env.ESLINT}}var oa=`0.4.2`;const sa=Object.getOwnPropertyDescriptor(RegExp.prototype,`source`).get,ca=[[`d`,Object.getOwnPropertyDescriptor(RegExp.prototype,`hasIndices`)?.get],[`g`,Object.getOwnPropertyDescriptor(RegExp.prototype,`global`)?.get],[`i`,Object.getOwnPropertyDescriptor(RegExp.prototype,`ignoreCase`)?.get],[`m`,Object.getOwnPropertyDescriptor(RegExp.prototype,`multiline`)?.get],[`s`,Object.getOwnPropertyDescriptor(RegExp.prototype,`dotAll`)?.get],[`u`,Object.getOwnPropertyDescriptor(RegExp.prototype,`unicode`)?.get],[`v`,Object.getOwnPropertyDescriptor(RegExp.prototype,`unicodeSets`)?.get],[`y`,Object.getOwnPropertyDescriptor(RegExp.prototype,`sticky`)?.get]],la=RegExp.prototype.exec;function J(e){return Reflect.apply(sa,e,[])}function Y(e){let t=``;for(let[n,r]of ca)r&&Reflect.apply(r,e,[])&&(t+=n);return t}const ua=/[a-zA-Z0-9_-]/;function da(e,t){let n=e;for(;n!=null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function fa(e,t){if(t.length>0&&e.length>256/t.length)return null;let n=[];for(let r of e)for(let e of t)n.push(r+e);return n}function pa(e){let t=!1,n=0,r=!1;for(let i=1;i<e.length;i++){let a=e[i];if(t)t=!1;else if(a===`\\`)t=!0;else if(r)a===`]`&&(r=!1);else if(a===`[`)r=!0;else if(a===`(`)n++;else if(a===`)`)n>0&&n--;else if(a===`|`&&n===0)return!0}return!1}function ma(e,t){return e[t]===`:`&&!/[?*+{]/.test(e[t+1]??``)}function ha(e){if(!e.startsWith(`^`)||pa(e))return null;let t=1;for(;t<e.length&&ua.test(e[t]);)t++;if(t>1&&ma(e,t))return[e.slice(1,t)];let n=ga(e,1,`:`);if(!n||!ma(e,n.end)||n.combos.some(e=>e.length===0||e.includes(`:`)))return null;let r=[...new Set(n.combos)];return r.length?r:null}function ga(e,t,n){let r=[``];for(;t<e.length;){let i=e[t];if(n.includes(i))break;if(ua.test(i)){let n=``;for(;t<e.length&&ua.test(e[t]);)n+=e[t++];r=r.map(e=>e+n);continue}let a=null;if(i===`(`)a=_a(e,t);else if(i===`[`)a=va(e,t);else return null;if(!a)return null;t=a.end;let o=a.combos;if(e[t]===`?`)o=[``,...o],t++;else if(e[t]===`*`||e[t]===`+`||e[t]===`{`)return null;let s=fa(r,o);if(!s)return null;r=s}return{combos:r,end:t}}function _a(e,t){if(t++,e.startsWith(`?:`,t))t+=2;else if(e[t]===`?`)return null;let n=[];for(;;){let r=ga(e,t,`|)`);if(!r||(n.push(...r.combos),n.length>256))return null;if(t=r.end,e[t]===`|`){t++;continue}return e[t]===`)`?{combos:n,end:t+1}:null}}function va(e,t){if(t++,e[t]===`^`)return null;let n=[];for(;t<e.length&&e[t]!==`]`;){let r=e[t];if(r===`\\`||r===`-`||(n.push(r),n.length>256))return null;t++}return e[t]===`]`?{combos:n,end:t+1}:null}function ya(e){if(da(e[2],`prefix`))return null;let[t]=e;return!(t instanceof RegExp)||Object.hasOwn(t,`exec`)||Object.getPrototypeOf(t)!==RegExp.prototype||t.exec!==la||Y(t)?null:ha(J(t))}function ba(e){let t=e.map(e=>[e,ya(e)]),n=new Map;for(let[,e]of t)if(e!==null)for(let t of e)n.has(t)||n.set(t,[]);let r=[];for(let[e,i]of t){if(i===null){r.push(e);for(let t of n.values())t.push(e);continue}for(let t of i)n.get(t).push(e)}return{map:n,fallback:r}}const xa=/^[a-z][a-z0-9-]*$/,Sa={minAffix:4,maxDistance:1,minDistanceLength:6,segmentAffix:!0},Ca={minAffix:3,maxDistance:2,minDistanceLength:0,segmentAffix:!1},wa=new Set([`about`,`blob`,`bun`,`chrome`,`data`,`deno`,`file`,`ftp`,`http`,`https`,`jsr`,`mailto`,`node`,`npm`,`tel`,`urn`,`vscode`,`virtual`,`ws`,`wss`]);function Ta(e){let t=0,n;for(let r=0;r<e.length;r++){let i=e[r];if(n){i===`\\`?r++:i===n&&(n=void 0);continue}if(i===`"`||i===`'`)n=i;else if(i===`\\`)r++;else if(i===`[`||i===`(`)t++;else if(i===`]`||i===`)`)t--;else if(i===`@`&&t===0)return e.slice(0,r)}return e}function Ea(e){let t=Ta(e);if(!t||t.startsWith(`$`)||t.startsWith(`[`))return!1;let n=t.indexOf(`:`);if(n<=0||n===t.length-1)return!1;let r=t.slice(0,n);return!xa.test(r)||t.startsWith(`//`,n+1)?!1:!wa.has(r)}function Da(e){if(e.flags)return;let t=e.source;if(!t.startsWith(`^`))return;let n=1;for(;n<t.length&&/[A-Za-z0-9_-]/.test(t[n]);)n++;return t[n]===`:`&&n>1?t.slice(1,n):void 0}const Oa=new WeakMap;function ka(e){let t=Oa.get(e.rulesStaticMap);if(t)return t;let n=new Map,r=new Set;for(let t of Object.keys(e.rulesStaticMap)){let e=t.indexOf(`:`);if(e<=0)continue;let r=t.slice(0,e),i=n.get(r);i||(i=new Set,n.set(r,i)),i.add(t.slice(e+1))}for(let t of e.rulesDynamic){let e=Da(t[0]);e!=null&&!n.has(e)&&r.add(e)}let i={prefixValues:n,dynamicPrefixes:r};return Oa.set(e.rulesStaticMap,i),i}function Aa(e,t,n){if(e===t)return 0;if(Math.abs(e.length-t.length)>n)return 1/0;let r=Array.from({length:t.length+1},(e,t)=>t);for(let i=1;i<=e.length;i++){let a=[i],o=i;for(let n=1;n<=t.length;n++){let s=e[i-1]===t[n-1]?0:1;a[n]=Math.min(r[n]+1,a[n-1]+1,r[n-1]+s),a[n]<o&&(o=a[n])}if(o>n)return 1/0;r=a}return r[t.length]<=n?r[t.length]:1/0}function ja(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return r}function Ma(e,t){return(t.startsWith(e)?t[e.length]===`-`:t.endsWith(e)&&t[t.length-e.length-1]===`-`)&&(e.includes(`-`)||e.length>=6)}function Na(e,t,n){if(e.length>=n.minDistanceLength){let r=Aa(e,t,n.maxDistance);if(r!==1/0)return r}let r=e.length<=t.length?e:t,i=e.length<=t.length?t:e;if(r.length>=n.minAffix&&(n.segmentAffix?Ma(r,i):i.startsWith(r)||i.endsWith(r)||i.includes(r)))return 3+(i.length-r.length)/100;if(!n.segmentAffix&&ja(e,t)>=n.minAffix)return 5+Math.abs(e.length-t.length)/100}function Pa(e,t){let n=Ta(e),r=n.indexOf(`:`);if(r<=0)return;let i=n.slice(0,r),a=n.slice(r+1),{prefixValues:o,dynamicPrefixes:s}=ka(t),c=[];if(o.has(i)||s.has(i))for(let e of o.get(i)??[]){if(e===a)continue;let t=Na(a,e,Ca);t!==void 0&&c.push({suggestion:`${i}:${e}`,score:t})}else{if(i.length<3)return;let e=new Set([...o.keys(),...s]);for(let t of e){let e=Na(i,t,Sa);if(e===void 0)continue;let n=o.get(t)?.has(a)||s.has(t);c.push({suggestion:`${t}:${a}`,score:n?e:e+10})}if(c.length===0)return}c.sort((e,t)=>e.score-t.score||(e.suggestion<t.suggestion?-1:1));let l=new Set,u=[];for(let{suggestion:e}of c)if(!(l.has(e)||e===n)&&(l.add(e),u.push(e),u.length===3))break;return u}const X=Object.freeze({shortcutsNoMerge:Symbol.for(`@teacss/core/shortcut-no-merge`),noMerge:Symbol.for(`@teacss/core/no-merge`),noScope:Symbol.for(`@teacss/core/no-scope`),variants:Symbol.for(`@teacss/core/variants`),parent:Symbol.for(`@teacss/core/parent`),selector:Symbol.for(`@teacss/core/selector`),layer:Symbol.for(`@teacss/core/layer`),sort:Symbol.for(`@teacss/core/sort`),body:Symbol.for(`@teacss/core/body`)}),Fa={px:1,rem:16,em:16,in:96,pt:96/72,pc:16,cm:96/2.54,mm:96/25.4,q:96/101.6},Ia=`vw.vh.vi.vb.vmin.vmax.svw.svh.svmin.svmax.lvw.lvh.lvmin.lvmax.dvw.dvh.dvmin.dvmax.cqw.cqh.cqi.cqb.cqmin.cqmax.ch.ex.cap.ic.lh.rlh.%`.split(`.`),La=RegExp(`^([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:e[+-]?\\d+)?)(${[...Object.keys(Fa),...Ia].sort((e,t)=>t.length-e.length).join(`|`)})?$`,`i`);function Ra(e){let t=La.exec(e.trim());if(!t)return null;let n=Number.parseFloat(t[1]);if(!Number.isFinite(n))return null;let r=(t[2]??`px`).toLowerCase();if(!Object.hasOwn(Fa,r))return{unit:r,value:n};let i=Math.round(n*Fa[r]*1e6)/1e6;return{unit:`px`,value:Number.isFinite(i)?i:n*Fa[r]}}function za(e){let t=e.indexOf(` $$ `),n=t<0?e:e.slice(0,t);if(!/^@media\b/i.test(n)||/\bnot\b/i.test(n))return null;for(let e of n.matchAll(/\(\s*min-width\s*:\s*([^)]*?)\s*\)/gi)){let t=Ra(e[1]);if(t)return t}for(let e of n.matchAll(/\(\s*max-width\s*:\s*([^)]*?)\s*\)/gi)){let t=Ra(e[1]);if(t)return{unit:t.unit,value:-t.value}}return null}function Ba(e,t){return e<t?-1:+(e>t)}function Va(e,t){return Ba(e??``,t??``)}function Z(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Ha(e,t){for(let n of t)Z(e,n)}function Ua(e,t){for(let t=e.length;t>0;t--)Object.hasOwn(e,t-1)?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:e[t-1],writable:!0}):delete e[t];Object.defineProperty(e,0,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Wa(e){let t=new vr;for(let n of e)t.setCount(n,e.getCount(n));return t}function Ga(e){return G(e)?Wa(e):new Set(e)}function Ka(e,t,n){if(G(e)&&G(t)&&G(n)){let r=new Set([...t,...n]);for(let i of r){let r=e.getCount(i)+n.getCount(i)-t.getCount(i);r>0?e.setCount(i,r):e.delete(i)}return}for(let r of t)n.has(r)||e.delete(r);for(let r of n)t.has(r)||e.add(r)}function*qa(e,t){for(let n=0;n<e.length;n++){let r=t[n];r!=null&&(yield[e[n],r])}}function Ja(e){if(e!==void 0&&(!Number.isSafeInteger(e)||e<1))throw RangeError(`tokenConcurrency must be a positive integer`)}function Ya(e,t){return Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function Q(e,t){let n=e;for(;n!==null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function Xa(e,t){if(Object.hasOwn(e,t))return Reflect.get(e,t);let n=Object.getPrototypeOf(e);if(n===null||n===Object.prototype)return;let r=Object.getOwnPropertyDescriptor(n,`constructor`)?.value;if(typeof r==`function`&&r!==Object)for(;n!==null&&n!==Object.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function $(e,t){return e?Q(e,t):void 0}function Za(e,t){return Ya(e,t)}function Qa(e){return{body:Q(e,`body`),handle:Q(e,`handle`),layer:Q(e,`layer`),order:Q(e,`order`),parent:Q(e,`parent`),selector:Q(e,`selector`),sort:Q(e,`sort`),source:e}}async function $a(e,t,n){if(t===void 0||t>=e.length)return await Promise.all(e.map(n));let r=Array(e.length),i=0,a=!1,o=Array.from({length:Math.min(t,e.length)},async()=>{for(;!a&&i<e.length;){let t=i++;try{let i=await n(e[t]);Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:i,writable:!0})}catch(e){throw a=!0,e}}});return await Promise.all(o),r}function eo(e,t){return e?.replaceAll(qo(t),`&`)}function to(e,t){let n=t.exec,r=Y(t);if(!r.includes(`g`)&&!r.includes(`y`))return n.call(t,e);if(Object.getOwnPropertyDescriptor(t,`lastIndex`)?.writable===!1){if(n!==la)return n.call(t,e);let i=new RegExp(J(t),r);return la.call(i,e)}t.lastIndex=0;try{return n.call(t,e)}finally{Object.getOwnPropertyDescriptor(t,`lastIndex`)?.writable!==!1&&(t.lastIndex=0)}}function no(e,t,n,r){let i=d(e).filter(ro),a=d(n).filter(ro);if(i.length!==a.length)return!1;for(let e=0;e<i.length;e++){let n=i[e],o=a[e];if(n[2]!==o[2]||eo(n[1],t)!==eo(o[1],r)||n[3]!==o[3]||$(n[4],`layer`)!==$(o[4],`layer`)||$(n[4],`sort`)!==$(o[4],`sort`)||!!$(n[4],`noScope`)!=!!$(o[4],`noScope`)||!!(n[6]??$(n[4],`noMerge`))!=!!(o[6]??$(o[4],`noMerge`)))return!1}return!0}function ro(e){return Array.isArray(e)&&Object.hasOwn(e,0)&&Object.hasOwn(e,1)&&Object.hasOwn(e,2)&&Object.hasOwn(e,3)&&Object.hasOwn(e,4)&&Object.hasOwn(e,5)&&Object.hasOwn(e,6)}function io(e){return Object.hasOwn(e,0)&&e[0]===X.shortcutsNoMerge}function ao(e){for(let t=e.length-1;t>=0;t--){if(!Object.hasOwn(e,t))continue;let n=e[t];if(io(n))return Object.hasOwn(n,1)?n[1]:void 0}}function oo(e,t){let n=[...e,...t],r=[];for(let e=t.length-1;e>=0;e--)fe(t[e])&&Z(r,t[e]);for(let t=e.length-1;t>=0;t--)fe(e[t])&&Z(r,e[t]);if(r.length<2)return n;let i=r[0];for(let e=1;e<r.length;e++)i=pe(i,r[e])??i;let a=[],o=!1;for(let e of n)fe(e)?o||=(Z(a,i),!0):Z(a,e);return a}function so(e){let t;for(let n of e)n.includes(`{`)&&(t??=[],t.push(n));if(!t)return e;for(let n of t){let t=ti(Sn(n));if(t.length===1&&t[0]===n)continue;let r=G(e)?e.getCount(n):1;e.delete(n);for(let n of t)G(e)?e.setCount(n,e.getCount(n)+r):e.add(n)}return e}const co=/(?<!\\)::?-[a-zA-Z]/;function lo(e){let t=new Map,n=new Map,r=0,i;for(let a of e){let[o,s,c]=a;if(i!==void 0&&s!==i&&(t.clear(),n.clear()),i=s,c){e[r++]=a;continue}let l=o.length>0,u=l?t:n,d=u.get(s);if(!d){u.set(s,a),e[r++]=a;continue}l&&Ha(d[0],o)}e.length=r}function uo(e,t,n){let r=(e.get(t)??0)-(e.get(n)??0);if(r)return r;let i=za(t),a=za(n);if(i==null!=(a==null))return i==null?-1:1;if(i!=null&&a!=null){if(i.unit!==a.unit)return Ba(i.unit,a.unit);if(i.value!==a.value)return i.value-a.value}return Ba(t,n)}function fo(e,t,n=``){let r=po(e);return`${r.join(`{`)}{${n}${t}${n}${`}`.repeat(r.length)}`}function po(e){let t=[],n=0,r=!1,i=0,a,o=0;for(let s=0;s<e.length;s++){let c=e[s];r?c===`*`&&e[s+1]===`/`&&(r=!1,s++):a?c===`\\`?s++:c===a&&(a=void 0):c===`/`&&e[s+1]===`*`?(r=!0,s++):c===`"`||c===`'`?a=c:c===`(`?i++:c===`)`?i>0&&i--:c===`[`?n++:c===`]`?n>0&&n--:n===0&&i===0&&e.startsWith(` $$ `,s)&&(Z(t,e.slice(o,s)),s+=3,o=s+1)}return Z(t,e.slice(o)),t}function mo(e){let t=[],n=!1,r;for(let i=0;i<e.length;i++){let a=e[i];if(n){a===`*`&&e[i+1]===`/`&&(n=!1,i++);continue}if(r){a===`\\`?i++:a===r&&(r=void 0);continue}if(a===`/`&&e[i+1]===`*`){n=!0,i++;continue}if(a===`\\`){i++;continue}if(a===`"`||a===`'`){r=a;continue}if(!/\s/.test(a)||e[i+1]!==`$`||e[i+2]!==`$`||!/\s/.test(e[i+3]??``))continue;let o=i+4;for(;o<e.length&&/\s/.test(e[o]);)o++;Z(t,[i,o]),i=o-1}return t}function ho(e,t){let n=mo(e);if(!n.length)return e;let r=0,i=``;for(let[a,o]of n)i+=e.slice(r,a),i+=a===0||e[a-1]===`{`||e[a-1]===`,`?t?`${t} `:``:t?` ${t} `:` `,r=o;return i+e.slice(r)}const go=new Set([Function.prototype,Object.getPrototypeOf(async()=>{}),Object.getPrototypeOf(function*(){}),Object.getPrototypeOf(async function*(){})]),_o=new Set([`arguments`,`caller`,`length`,`name`,`prototype`]);function vo(e){return Reflect.ownKeys(e).every(e=>_o.has(e))}function yo(e){let t=e;for(;t!==null;){let e=Object.getOwnPropertyDescriptor(t,`exec`);if(e)return{configurable:!!e.configurable,enumerable:!!e.enumerable,get:`get`in e?e.get:void 0,owner:t,set:`set`in e?e.set:void 0,value:`value`in e?e.value:void 0,writable:`value`in e?!!e.writable:void 0};t=Object.getPrototypeOf(t)}}function bo(e,t){let n=yo(e);return n?.owner===t?.owner&&n?.configurable===t?.configurable&&n?.enumerable===t?.enumerable&&n?.get===t?.get&&n?.set===t?.set&&n?.value===t?.value&&n?.writable===t?.writable}function xo(e){return Reflect.ownKeys(e).every(e=>e===`lastIndex`)}function So(e,t=new WeakMap,n={}){if(e===null||typeof e!=`object`&&typeof e!=`function`)return{kind:`primitive`,value:e};if(n.functionsByIdentity&&typeof e==`function`)return{complete:vo(e),kind:`identity`,value:e};if(n.ignoreRegExpLastIndex&&e instanceof RegExp){let t=yo(e);return{complete:t?.owner===RegExp.prototype&&t.value===la&&Object.getPrototypeOf(e)===RegExp.prototype&&xo(e),exec:t,flags:Y(e),kind:`regexp-identity`,source:J(e),value:e}}let r=t.get(e);if(r)return r;let i=Object.getPrototypeOf(e),a=i===RegExp.prototype?e:void 0,o={complete:i===null||i===Object.prototype||i===Array.prototype||go.has(i)||i===RegExp.prototype,kind:`object`,properties:[],prototype:i,regexpFlags:a&&Y(a),regexpSource:a&&J(a),value:e};t.set(e,o);for(let r of Reflect.ownKeys(e)){if(n.ignoreRegExpLastIndex&&a&&r===`lastIndex`)continue;let i=Object.getOwnPropertyDescriptor(e,r);if(!i)continue;let s={configurable:!!i.configurable,enumerable:!!i.enumerable,key:r};if(`value`in i){s.value=So(i.value,t,n),wo(s.value)||(o.complete=!1);try{let a=Reflect.get(e,r);s.observedValue=So(a,t,n),(!Object.is(a,i.value)||!wo(s.observedValue))&&(o.complete=!1)}catch{o.complete=!1}s.writable=!!i.writable}else o.complete=!1,s.get=i.get,s.set=i.set;Z(o.properties,s)}return o}function Co(e,t,n=new Map){if(t.kind===`primitive`)return Object.is(e,t.value);if(t.kind===`identity`)return e===t.value&&(!t.complete||vo(t.value));if(t.kind===`regexp-identity`)return e===t.value&&e instanceof RegExp&&bo(e,t.exec)&&J(e)===t.source&&Y(e)===t.flags&&(!t.complete||xo(e));if(e!==t.value||e===null||typeof e!=`object`&&typeof e!=`function`||Object.getPrototypeOf(e)!==t.prototype||t.regexpSource!==void 0&&(J(e)!==t.regexpSource||Y(e)!==t.regexpFlags))return!1;let r=n.get(t);if(r)return r===e;n.set(t,e);let i=Reflect.ownKeys(e).filter(e=>!(t.regexpSource!==void 0&&e===`lastIndex`&&!t.properties.some(t=>t.key===e)));if(i.length!==t.properties.length)return!1;for(let r=0;r<i.length;r++){let a=t.properties[r],o=i[r];if(o!==a.key)return!1;let s=Object.getOwnPropertyDescriptor(e,o);if(!s||!!s.configurable!==a.configurable||!!s.enumerable!==a.enumerable)return!1;if(`value`in s){if(a.value===void 0||!!s.writable!==a.writable||!Co(s.value,a.value,n))return!1;if(a.observedValue!==void 0){let t;try{t=Reflect.get(e,o)}catch{return!1}if(!Co(t,a.observedValue,n))return!1}}else if(a.value!==void 0||s.get!==a.get||s.set!==a.set)return!1}return!0}function wo(e){return e.kind===`primitive`||e.complete}function To(e){let t=Array(e.length);for(let n=0;n<e.length;n++){if(!Object.hasOwn(e,n))continue;let r=e[n],i=Object.hasOwn(r,2),a=i?r[2]:void 0,o=So(r[0],void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0}),s={body:r[1],bodySnapshot:So(r[1],void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0}),matcherFlags:r[0]instanceof RegExp?Y(r[0]):void 0,matcherSnapshot:o,matcherSource:r[0]instanceof RegExp?J(r[0]):void 0,matcher:r[0],meta:a,metaOwn:i,metaSnapshot:So(a,void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0}),rule:r};Object.defineProperty(t,n,{configurable:!0,enumerable:!0,value:s,writable:!0})}return t}function Eo(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=Object.hasOwn(e,n);if(r!==Object.hasOwn(t,n))return!1;if(!r)continue;let i=e[n],a=t[n],o=Object.hasOwn(i,2),s=o?i[2]:void 0;if(!Object.hasOwn(i,0)||!Object.hasOwn(i,1)||o!==a.metaOwn||i!==a.rule||i[0]!==a.matcher||i[1]!==a.body||s!==a.meta||!Co(i[0],a.matcherSnapshot)||i[0]instanceof RegExp&&(J(i[0])!==a.matcherSource||Y(i[0])!==a.matcherFlags)||!Co(i[1],a.bodySnapshot)||!Co(s,a.metaSnapshot))return!1}return!0}function Do(e){for(let t=0;t<e.length;t++){if(!Object.hasOwn(e,t))continue;let{bodySnapshot:n,matcherSnapshot:r,metaSnapshot:i}=e[t];if(!wo(n)||!wo(r)||!wo(i))return!1}return!0}const Oo=[`blocklist`,`details`,`envMode`,`extractors`,`layers`,`mergeSelectors`,`outputToCssLayers`,`postprocess`,`preflights`,`preprocess`,`safelist`,`separators`,`shortcuts`,`shortcutsLayer`,`sortLayers`,`theme`,`unmatched`,`variants`,`warn`];function ko(e,t,n={}){let r=So(e[t],void 0,n);return{complete:wo(r),isCurrent:e=>Co(e[t],r),key:t}}function Ao(e,t){let n=e;for(;n!==null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return{descriptor:e,owner:n};n=Object.getPrototypeOf(n)}}function jo(e,t){let n=Ao(e,t);if(!n)return{complete:!0,value:So(void 0)};let{descriptor:r,owner:i}=n;if(!(`value`in r))return{complete:!1,configurable:!!r.configurable,enumerable:!!r.enumerable,get:r.get,owner:i,set:r.set};let a=So(r.value,void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0});return{complete:wo(a),configurable:!!r.configurable,enumerable:!!r.enumerable,owner:i,value:a,writable:!!r.writable}}function Mo(e,t,n){let r=Ao(e,t);if(!r)return n.owner===void 0&&n.value!==void 0&&Co(void 0,n.value);let{descriptor:i,owner:a}=r;return a!==n.owner||!!i.configurable!==n.configurable||!!i.enumerable!==n.enumerable?!1:`value`in i?n.value!==void 0&&!!i.writable===n.writable&&Co(i.value,n.value):n.value===void 0&&i.get===n.get&&i.set===n.set}function No(e,t,n){let r=e[t];if(!Array.isArray(r))return ko(e,t,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0});let i=Array.from({length:r.length},(e,t)=>{let i=Object.hasOwn(r,t),a=i?r[t]:void 0;return{entry:a,own:i,values:i&&a!=null&&(typeof a==`object`||typeof a==`function`)?n.map(e=>jo(a,e)):n.map(()=>jo(Object.create(null),``))}}),a=new Set(n),o=i.every(({entry:e,own:t,values:n})=>{if(!t||e==null||typeof e!=`object`&&typeof e!=`function`)return!0;let r=Object.getPrototypeOf(e);return(r===Object.prototype||r===null)&&Reflect.ownKeys(e).every(e=>a.has(e))&&n.every(e=>e.complete)});return{complete:o,isCurrent(e){let s=e[t];if(s!==r||!Array.isArray(s)||s.length!==i.length)return!1;for(let e=0;e<i.length;e++){let t=i[e];if(Object.hasOwn(s,e)!==t.own)return!1;if(!t.own)continue;let r=s[e];if(r!==t.entry)return!1;if(r!=null&&(typeof r==`object`||typeof r==`function`)){if(o&&(Object.getPrototypeOf(r)!==Object.prototype&&Object.getPrototypeOf(r)!==null||!Reflect.ownKeys(r).every(e=>a.has(e))))return!1;for(let e=0;e<n.length;e++)if(!Mo(r,n[e],t.values[e]))return!1}}return!0},key:t}}function Po(e,t,n){let r=e[t];if(r==null||typeof r!=`object`&&typeof r!=`function`)return{complete:!0,isCurrent:e=>Object.is(e[t],r),key:t};let i=n.map(e=>jo(r,e)),a=new Set(n),o=Object.getPrototypeOf(r),s=(o===Object.prototype||o===null)&&Reflect.ownKeys(r).every(e=>a.has(e))&&i.every(e=>e.complete);return{complete:s,isCurrent(e){let o=e[t];return o!==r||o==null||typeof o!=`object`&&typeof o!=`function`||s&&(Object.getPrototypeOf(o)!==Object.prototype&&Object.getPrototypeOf(o)!==null||!Reflect.ownKeys(o).every(e=>a.has(e)))?!1:n.every((e,t)=>Mo(o,e,i[t]))},key:t}}function Fo(e){return Oo.map(t=>{switch(t){case`extractors`:return No(e,t,[`name`,`order`,`extract`]);case`preflights`:return No(e,t,[`getCSS`,`layer`]);case`variants`:return No(e,t,[`match`,`multiPass`,`order`]);case`outputToCssLayers`:return Po(e,t,[`allLayers`,`cssLayerName`]);case`shortcuts`:{let n=e.shortcuts,r=To(n);return{complete:Do(r),isCurrent:t=>t.shortcuts===e.shortcuts&&Eo(t.shortcuts,r),key:t}}case`sortLayers`:return ko(e,t,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0});case`blocklist`:case`postprocess`:case`preprocess`:case`safelist`:return ko(e,t,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0});default:return ko(e,t)}})}function Io(e,t){return t.every(t=>t.isCurrent(e))}function Lo(e){return e.every(({complete:e})=>e)}function Ro({authoredOutputOrders:e,config:t,currentSelectors:n,layerSet:r,matched:i,minify:a,parentOrders:o,preflights:s,preflightsMap:c,scope:l,sheet:u,shortcutMergeOrders:p,resolveUnmatched:m}){let h=a?``:`
20
- `,g={...t.layers},_=t.mergeSelectors,v=t.sortLayers,y=e=>Object.hasOwn(g,e)?g[e]??0:0,b=e=>d(v.call(t,e.sort((e,t)=>y(e)-y(t)||Ba(e,t)))).map(e=>e),x=b(Array.from(r)),S=Object.create(null),C=r.size===1?r.values().next().value:void 0,w,T,E=t.outputToCssLayers,D=typeof E==`object`?Xa(E,`cssLayerName`):void 0,O=typeof E==`object`&&Xa(E,`allLayers`)?b(Object.keys(g)):void 0,k=new Map,A=e=>{let t=k.get(e);if(t!==void 0||k.has(e))return t;let n=e;D&&typeof E==`object`&&(n=D.call(E,e));let r=n===null?null:n??e;return k.set(e,r),r};if(E)for(let e of f([...x,...O??[]]))A(e);let j=t=>{let r=(e,t)=>e.ruleIndex-t.ruleIndex||e.sort-t.sort||Va(e.currentSelector,t.currentSelector)||Number(t.noScope)-Number(e.noScope)||Number(t.noMerge)-Number(e.noMerge)||Va(e.selector,t.selector)||Va(e.body,t.body)||0,i=(e,t)=>e.ruleIndex===t.ruleIndex&&e.sort===t.sort,a=[],o=new Map,s=t.flatMap(e=>p.get(e)?.components??[e]);for(let t of s){let s={authored:e.get(t),body:t[2],currentSelector:n.get(t)??t[5]?.currentSelector,item:t,noMerge:!!(t[6]??$(t[4],`noMerge`)),noScope:!!$(t[4],`noScope`),ruleIndex:t[0],selector:t[1],sort:$(t[4],`sort`)||0},c=s.authored?.group;if(!c){Z(a,{authoredGroup:void 0,records:[s],representative:s});continue}let l=o.get(c),u=l?.find(e=>i(e.records[0],s));if(u)Z(u.records,s),r(s,u.representative)<0&&(u.representative=s);else{let e={authoredGroup:c,records:[s],representative:s};Z(a,e),l?Z(l,e):o.set(c,[e])}}for(let e of a)e.authoredGroup&&e.records.sort((e,t)=>e.authored.index-t.authored.index||r(e,t));a.sort((e,t)=>{let n=r(e.representative,t.representative);if(n)return n;let i=[...e.records].sort(r),a=[...t.records].sort(r),o=Math.min(i.length,a.length);for(let e=0;e<o;e++){let t=r(i[e],a[e]);if(t)return t}if(i.length!==a.length)return i.length-a.length;for(let n=0;n<e.records.length;n++){let i=r(e.records[n],t.records[n]);if(i)return i}return 0});let c=a.flatMap(e=>e.records.map(e=>e.item)),l=new Map;for(let e=0;e<c.length;e++){let t=c[e];l.set(t,e)}let u=new Set;for(let e of c){let t=p.get(e),n=t?.components;if(!t?.flatten||!t.original||!n?.length||u.has(t.group))continue;let r=l.get(n[0]);r!==void 0&&n.every((e,t)=>c[r+t]===e)&&u.add(t.group)}let d=new Set,f=[];for(let e of c){let t=p.get(e);if(!t||!u.has(t.group)){Z(f,e);continue}d.has(t.group)||(d.add(t.group),Z(f,t.original))}return f},ee=()=>{if(T)return T;let e=new Map,t=Array.from(u).sort((e,t)=>uo(o,e[0]||``,t[0]||``));for(let[n,r]of t)for(let t of r){let r=$(t[4],`layer`)||`utilities`,i=e.get(r),a=i?.[i.length-1];a?.[0]===n?Z(a[1],t):i?Z(i,[n,[t]]):e.set(r,[[n,[t]]])}return u.clear(),T=e,e},M=e=>{if(C===void 0)return ee().get(e)||[];if(e!==C)return[];if(w)return w;let t=Array.from(u).sort((e,t)=>uo(o,e[0]||``,t[0]||``));return u.clear(),w=t,t},N=(e=Ce)=>{if(Object.hasOwn(S,e))return S[e];let t=M(e).map(([e,t])=>{let n=[];for(let[,e,r,,i,,a]of j(t)){if(e===``)continue;let t=$(i,`noScope`)?void 0:l,o=e&&Go(e,t);Z(n,[o==null?[]:[[o,$(i,`sort`)??0]],r,!!(a??$(i,`noMerge`))||o!=null&&co.test(o)])}if(!n.length)return;_&&lo(n);let r=[];for(let e=n.length-1;e>=0;e--){let[t,i]=n[e],a=t.length===1?t[0][0]:``;if(t.length>1){t.sort((e,t)=>e[1]-t[1]||Va(e[0],t[0]));let e=new Set,n=[];for(let[r]of t)!r||e.has(r)||(e.add(r),Z(n,r));a=n.join(`,${h}`)}let o=a?`${a}{${i}}`:i;o&&Z(r,o)}let i=Array.from(new Set(r)).reverse().join(h);return e?fo(e,i,h):i}).filter(Boolean).join(h);s&&(t=[c[e],t].filter(Boolean).join(h));let n;E&&t&&(n=A(e),n!==null&&(t=`@layer ${n}{${h}${t}${h}}`));let r=a?``:`/* layer: ${e}${n&&n!==e?`, alias: ${n}`:``} */${h}`;return S[e]=t?r+t:``},P=(e=x,t)=>{let n=d(e).map(e=>e),r=new Set(d(t).map(e=>e)),i=n.filter(e=>!r.has(e)),a=i.map(N).filter(Boolean);if(E){let e=i;O&&(e=O);let t=f(e.map(A).filter(Ar));t.length>0&&Ua(a,`@layer ${t.join(`, `)};`)}return a.join(h)},F=async(e,t)=>{let n=await t(N(e));return S[e]=n,n},I;return{get css(){return P()},layers:[...x],matched:i,getLayers:P,getLayer:N,setLayer:F,get diagnostics(){return I??={unmatched:m()},I}}}var zo=class e{userConfig;defaults;version=oa;events=br();config=void 0;cache=new re(I,void 0,!0);blocked=new ie(I,void 0,!0);_warnedUnmatched=new ie(I);parentOrders=new Map;activatedRules=new Set;_dynamicIndex;_contextConfigs=new WeakMap;_expansionPrefixes=new WeakMap;_generationContexts=new WeakSet;_configVersion=0;_collectionGeneration=0;_preparedConfigs=new WeakSet;_indexedRules;_indexedRuleSnapshot;_preparedCacheSnapshot;_preparedConfigMutable=!1;_preparedCacheReliable=!0;_startingGenerationParse=0;_runtimeRevision=0;_variantCacheOwner={};_initialization;_constructedCSSResults=new WeakMap;_constructedCSSSequence=0;_parsedOutputOrders=new WeakMap;_rawUtilMetadata=new WeakMap;_stringifiedCurrentSelectors=new WeakMap;_stringifiedOutputOrders=new WeakMap;_stringifiedParentOrders=new WeakMap;_shortcutMergeOrders=new WeakMap;_utilParentOrders=new WeakMap;reportConfigObserverErrors(e){console.error(`[@teacss/core] Configuration observer failed:`,AggregateError(e,`Configuration observers failed`))}dispatchConfig(e){let t=Object.hasOwn(this.events.events,`config`)?this.events.events.config:void 0,n=Array.isArray(t)?d(t).map(e=>e):[],r=[];for(let t of n)try{let n=t(e);jr(n)&&Promise.resolve(n).catch(e=>{this.reportConfigObserverErrors([e])})}catch(e){Z(r,e)}r.length&&this.reportConfigObserverErrors(r)}clearRuntimeCaches(e){e&&this._runtimeRevision++,this._variantCacheOwner={},this.blocked.clear(),this._warnedUnmatched.clear(),this.parentOrders.clear(),this.activatedRules.clear(),this.cache.clear()}ensureRuleIndexesCurrent(e=!1){let t=!1,n=!1,r=!0;this._preparedConfigMutable&&e&&this._preparedCacheSnapshot&&(Io(this.config,this._preparedCacheSnapshot)||(n=!0,this._preparedCacheSnapshot=Fo(this.config),t=!0),r=Lo(this._preparedCacheSnapshot));let i=this._indexedRules===this.config.rules;if(!e&&i)return;let a=i&&!!this._indexedRuleSnapshot&&Eo(this.config.rules,this._indexedRuleSnapshot);(!i||!a)&&(n||=!!this._indexedRules,Mi(this.config),this._indexedRules=this.config.rules,this._indexedRuleSnapshot=To(this.config.rules),this._dynamicIndex=void 0,t=!0),this._preparedConfigMutable&&(r=r&&!!this._indexedRuleSnapshot&&Do(this._indexedRuleSnapshot),this._preparedCacheReliable=r),t&&this.clearRuntimeCaches(n)}collectParentOrders(e,t){for(let n of d(e).filter(ro)){let e=n[3],r=this._stringifiedParentOrders.get(n);if(e!=null&&r!=null){let n=t.get(e);(n===void 0||r<n)&&t.set(e,r)}}}transferOutputOrder(e,t){let n=this._parsedOutputOrders.get(e);n&&this._stringifiedOutputOrders.set(t,n)}recordStringifiedContext(e,t){t?.currentSelector!==void 0&&this._stringifiedCurrentSelectors.set(e,t.currentSelector)}copyStringifiedUtil(e,t,n=!1){let r=e[4],i;if(r){let e=Object.getOwnPropertyDescriptors(r);if(n)for(let t of Reflect.ownKeys(e)){let n=Object.getOwnPropertyDescriptor(r,t);if(!n){delete e[t];continue}let i=`value`in n?n.value:Reflect.get(r,t);e[t]={configurable:!!n.configurable,enumerable:!!n.enumerable,value:i,writable:!0}}let t=e.prefix;t&&`value`in t&&Array.isArray(t.value)&&(t.value=[...d(t.value)]);let a=e.autocomplete;a&&`value`in a&&Array.isArray(a.value)&&(a.value=[...d(a.value)]),i=Object.defineProperties(Object.create(null),e)}let a=e[5],o=a?{...a,theme:Zr(a.theme),variantHandlers:[...d(a.variantHandlers)],variantMatch:[a.variantMatch[0],a.variantMatch[1],[...d(a.variantMatch[2])],new Set(a.variantMatch[3])]}:void 0;a&&o&&(Object.hasOwn(a,`rules`)?o.rules=a.rules?Zr(d(a.rules)):a.rules:delete o.rules,Object.hasOwn(a,`shortcuts`)?o.shortcuts=a.shortcuts?Zr(d(a.shortcuts)):a.shortcuts:delete o.shortcuts,Object.hasOwn(a,`variants`)?o.variants=a.variants?Zr(d(a.variants)):a.variants:delete o.variants);let s=[e[0],e[1],e[2],e[3],i,o,e[6]];if(t){let t=this._stringifiedCurrentSelectors.get(e);t!==void 0&&this._stringifiedCurrentSelectors.set(s,t);let n=this._stringifiedOutputOrders.get(e);n&&this._stringifiedOutputOrders.set(s,n);let r=this._stringifiedParentOrders.get(e);r!==void 0&&this._stringifiedParentOrders.set(s,r)}return s}copyStringifiedUtils(e,t,n=!1){let r=d(e).filter(ro),i=r.map(e=>this.copyStringifiedUtil(e,t,n));if(t){let e=new Map;for(let t=0;t<r.length;t++)e.set(r[t],i[t]);let t=new Map;for(let a=0;a<r.length;a++){let o=this._shortcutMergeOrders.get(r[a]);if(!o)continue;let s=t.get(o.group);if(!s){let r=t=>{let r=e.get(t);return r||(r=this.copyStringifiedUtil(t,!0,n),e.set(t,r)),r},i=o.components?.map(r),a=o.original?r(o.original):void 0;s={...o,components:i,group:{},original:a},t.set(o.group,s);for(let e of i??[])this._shortcutMergeOrders.set(e,s);a&&this._shortcutMergeOrders.set(a,s)}this._shortcutMergeOrders.set(i[a],s)}}return i}getDynamicIndex(e){return this._dynamicIndex?.config!==e&&(this._dynamicIndex={config:e,...ba(e.rulesDynamic)}),this._dynamicIndex}constructor(e={},t={}){this.userConfig=e,this.defaults=t}async ensureInitialized(){this.config||(this._initialization||=(async()=>{let e=await Ki(this.userConfig,this.defaults);this.config||(this.config=e,this._indexedRules=e.rules,this._indexedRuleSnapshot=To(e.rules),this.dispatchConfig(e))})(),await this._initialization)}static constructPublic(e,t){return new Bo(e,t)}static async create(t={},n={}){let r=e.constructPublic(t,n);return await r.ensureInitialized(),r}async setConfig(e,t){if(await this.ensureInitialized(),!e)return;let n=await this.prepareConfig(e,t);this.commitConfig(n)}async prepareConfig(t,n){await this.ensureInitialized();let r=++this._configVersion,i=n??this.defaults,a=await Ki(t,i),o=e.constructPublic(t,i);o.config=a,o._indexedRules=a.rules,o._indexedRuleSnapshot=To(a.rules),o._preparedCacheSnapshot=Fo(a),o._preparedConfigMutable=!0,o._preparedCacheReliable=Lo(o._preparedCacheSnapshot)&&Do(o._indexedRuleSnapshot);let s=Object.freeze({config:a,defaults:i,generator:o,userConfig:t,version:r});return this._preparedConfigs.add(s),s}commitConfig(e){if(!this._preparedConfigs.delete(e)||e.version!==this._configVersion||e.generator.config!==e.config)return!1;let t=e.generator;return t.ensureRuleIndexesCurrent(!0),this.defaults=e.defaults,this.userConfig=e.userConfig,this.clearRuntimeCaches(!0),this.config=e.config,this._indexedRules=t._indexedRules,this._indexedRuleSnapshot=t._indexedRuleSnapshot,this._preparedCacheSnapshot=t._preparedCacheSnapshot,this._preparedConfigMutable=t._preparedConfigMutable,this._preparedCacheReliable=t._preparedCacheReliable,this._dynamicIndex=void 0,this.dispatchConfig(this.config),!0}async applyExtractors(e,t,n=new Set){return this.applyExtractorsCurrent(e,t,n,!1)}async applyExtractorsCurrent(e,t,n,r){await this.ensureInitialized(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable);let i=this.config,a=this._runtimeRevision,o=Ga(n),s=Ga(o),c;try{c=await this.applyExtractorsForConfig(i,e,t,s)}catch(r){if(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==i||this._runtimeRevision!==a)return this.applyExtractorsCurrent(e,t,n,!0);throw r}return this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==i||this._runtimeRevision!==a?this.applyExtractorsCurrent(e,t,n,!0):(Ka(n,o,c),n)}async applyExtractorsForConfig(e,t,n,r){let i={original:t,code:t,id:n,extracted:r,envMode:e.envMode};for(let t of d(e.extractors)){let e=await Q(t,`extract`)?.call(t,i);if(!(!e||e===r))if(G(e)&&G(r))for(let t of e)r.setCount(t,r.getCount(t)+e.getCount(t));else for(let t of Array.isArray(e)?d(e):e)r.add(t)}return r}requireInitialized(e){if(this.config)return this.config;throw Error(`[Teacss] TeacssGenerator is not initialized; use await createGenerator() before calling ${e}().`)}makeContextForConfig(e,t,n){let r={rawSelector:e,currentSelector:t[1],theme:n.theme,generator:this,symbols:X,variantHandlers:t[2],constructCSS:(...e)=>this.constructCustomCSS(r,...e),variantMatch:t};return this._contextConfigs.set(r,n),r}makeContext(e,t){return this.makeContextForConfig(e,t,this.requireInitialized(`makeContext`))}getContextConfig(e){return e&&this._contextConfigs.get(e)||this.requireInitialized(`this synchronous entrypoint`)}async parseToken(e,t){let n=this._startingGenerationParse>0,r=await this.parseTokenInternal(e,t,n,!1);return r&&!n?this.copyStringifiedUtils(r,!0):r}async parseTokenInternal(e,t,n,r){await this.ensureInitialized(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable&&!n);let i=this.config,a=this._runtimeRevision,o=!this._preparedConfigMutable||this._preparedCacheReliable,s=o&&!t,c=()=>this.config!==i||this._runtimeRevision!==a,l=()=>(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),c()),u=()=>this.parseTokenInternal(e,t,n,!0);if(o&&this.blocked.has(e)){R(this.blocked,e);return}let f=e,p=s?this.cache.get(f):void 0;if(s&&(p!==void 0||this.cache.has(f))){L(this.cache,f,p);let e=p&&d(p);if(!e||e.length===0)return e;let t=e.filter(ro);if(t.length>0)return n||this.collectParentOrders(t,this.parentOrders),t;this.cache.delete(f)}let m=e,h=m;for(let t of d(i.preprocess)){let n;try{n=t(h)}catch(e){if(l())return u();throw e}if(c())return u();if(!n){s&&(R(this.blocked,e),L(this.cache,f,null));return}h=n}let g;try{g=this.isBlocked(h)}catch(e){if(l())return u();throw e}if(c())return u();if(g){s&&(R(this.blocked,e),L(this.cache,f,null));return}let _;try{_=await this.matchVariantsForConfig(m,h,i)}catch(e){if(l())return u();throw e}if(c())return u();let v;try{v=_.every(e=>!e||this.isBlocked(e[1]))}catch(e){if(l())return u();throw e}if(c())return u();if(v){s&&(R(this.blocked,e),L(this.cache,f,null));return}let y=async e=>{let r=this.makeContextForConfig(m,[t||e[0],e[1],e[2],e[3]],i);n&&this._generationContexts.add(r),i.details&&(r.variants=[...e[3]]);let a=await this.expandMatchedShortcut(r),o=a?await this.stringifyShortcuts(r.variantMatch,r,a[0],a[1],a[2]):(await this.parseUtil(r.variantMatch,r))?.flatMap(e=>this.stringifyUtil(e,r)).filter(Ar);return{direct:!a,utils:o}},b;try{b=_.length===1?[await y(_[0])]:await Promise.all(_.map(e=>y(e)))}catch(e){if(l())return u();throw e}if(c()||this._preparedConfigMutable&&!n&&(this.ensureRuleIndexesCurrent(!0),c()))return u();let x=[],S={},C=0;for(let{direct:e,utils:t}of b)for(let n of t??[])e&&this._stringifiedOutputOrders.set(n,{group:S,index:C++}),Z(x,n);if(x?.length)return n||this.collectParentOrders(x,this.parentOrders),s&&L(this.cache,f,x),x;s&&L(this.cache,f,null)}parseTokenForGeneration(e){this._startingGenerationParse++;try{return this.parseToken(e)}finally{this._startingGenerationParse--}}getCachedEquivalentTokens(e){this.config&&this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0);let t=this.cache.get(e);if(!t)return[e];let n=new Set([e]);for(let[r,i]of this.cache.entries())i&&!r.endsWith(` -`)&&no(i,r,t,e)&&n.add(r);return[...n]}generate(e,t={}){let n=m(e)?void 0:++this._collectionGeneration;return this.generateInternal(e,t,!1,n)}async generateInternal(e,t,n,r){await this.ensureInitialized(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable);let i=this.config,a=this._runtimeRevision,o=!this._preparedConfigMutable||this._preparedCacheReliable,s=()=>this.config!==i||this._runtimeRevision!==a,c=()=>(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),s()),l=new Map,u=!o||r===void 0||!(this.cache instanceof re)?void 0:this.cache,f=u?.revision,p=Za(t,`id`),h=Za(t,`scope`),g=Za(t,`preflights`),_=Za(t,`safelist`),v=Za(t,`minify`),y=Za(t,`extendedInfo`),b=Za(t,`tokenConcurrency`),x=g===void 0||g,S=_===void 0||_,C=v!==void 0&&v,w=y!==void 0&&y,T=()=>this.generateInternal(e,t,!0,r);Ja(b);let E;try{E=m(e)?await this.applyExtractorsForConfig(i,e,p,w?new vr:new Set):Array.isArray(e)?so(new Set(d(e))):G(e)?so(Wa(e)):so(new Set(e))}catch(e){if(c())return T();throw e}if(s())return T();try{if(S){let e={generator:this,theme:i.theme};for(let t=0;t<i.safelist.length;t++){if(!Object.hasOwn(i.safelist,t))continue;let n=i.safelist[t],r=typeof n==`function`?n(e):n;for(let e of d(r)){let t=e.trim();t&&!E.has(t)&&E.add(t)}}}}catch(e){if(c())return T();throw e}if(s())return T();let D=C?``:`
21
- `,O=new Set([Ce]),k=w?new Map:new Set,A=new Map,j=[],ee=new Map,M=Object.create(null),N=Array.from(E),P;try{P=await $a(N,b,e=>this.parseTokenForGeneration(e))}catch(e){if(c())return T();throw e}if(s())return T();let F=0,I=u!==void 0,te=i.unmatched===`warn`||i.unmatched===`error`,ne=[];try{for(let e=0;e<N.length;e++){let t=N[e],n=P[e];if(n==null){te&&Ea(t)&&!this.blocked.has(t)&&!this.isBlocked(t)&&!Object.hasOwn(i.rulesStaticMap,Ta(t))&&Z(ne,t);continue}let r=this.copyStringifiedUtils(n,!0,!0);F++,I&&!u.isRetained(t)&&(I=!1),k instanceof Map?k.set(t,{data:this.copyStringifiedUtils(r,!1),count:G(E)?E.getCount(t):-1}):k.add(t),this.collectParentOrders(r,ee);for(let e of r){Z(j,e);let t=e[3]||``,n=$(e[4],`layer`);A.has(t)||A.set(t,[]),Z(A.get(t),e),n&&O.add(n)}}}catch(e){if(c())return T();throw e}if(s())return T();for(let[e,t]of ee){l.set(e,t);let n=this.parentOrders.get(e);(n===void 0||t<n)&&this.parentOrders.set(e,t)}try{await(async()=>{let e=d(i.preflights);if(!x||!e.length)return;let t={generator:this,generated:this.copyStringifiedUtils(j,!1),theme:i.theme},n=new Set,r=new Map;for(let t of e){let e=Q(t,`layer`)||`preflights`;O.add(e),n.add(e);let i=r.get(e);i?Z(i,t):r.set(e,[t])}M=Object.assign(Object.create(null),Object.fromEntries(await Promise.all(Array.from(n).map(async e=>[e,(await Promise.all(d(r.get(e)||[]).map(async e=>{let n=Q(e,`getCSS`);return n?await n.call(e,t):void 0}))).filter(Boolean).join(D)]))))})()}catch(e){if(c())return T();throw e}if(s())return T();let ie,ae=()=>(ie??=ne.flatMap(e=>{let t=Pa(e,i);return t===void 0?[]:[{token:e,suggestions:t}]}),ie);if(ne.length&&i.unmatched!==`off`&&i.unmatched!==void 0){let e=ae(),t=({token:e,suggestions:t})=>t.length?`"${e}" (did you mean ${t.map(e=>`"${e}"`).join(`, `)}?)`:`"${e}"`;if(i.unmatched===`error`){if(e.length)throw Error(`[@teacss/core] ${e.length} token${e.length===1?``:`s`} matched no rule: ${e.map(t).join(`; `)}`)}else if(i.warn)for(let n of e)this._warnedUnmatched.has(n.token)||(R(this._warnedUnmatched,n.token),console.warn(`[Teacss]`,`unmatched token ${t(n)}`))}let L;try{L=Ro({authoredOutputOrders:this._stringifiedOutputOrders,config:i,currentSelectors:this._stringifiedCurrentSelectors,layerSet:O,matched:k,minify:C,parentOrders:l,preflights:x,preflightsMap:M,scope:h,sheet:A,shortcutMergeOrders:this._shortcutMergeOrders,resolveUnmatched:ae}),await Promise.resolve(),this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0)}catch(e){if(c())return T();throw e}return s()?T():(u&&f!==void 0&&this.cache===u&&r===this._collectionGeneration&&(!I||F!==u.retainedSize)&&u.replaceRetained(qa(N,P),f),L)}async matchVariants(e,t){return this.matchVariantsCurrent(e,t,!1)}async matchVariantsCurrent(e,t,n){await this.ensureInitialized(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable);let r=this.config,i=this._runtimeRevision,a;try{a=await this.matchVariantsForConfig(e,t,r)}catch(n){if(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==r||this._runtimeRevision!==i)return this.matchVariantsCurrent(e,t,!0);throw n}return this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==r||this._runtimeRevision!==i?this.matchVariantsCurrent(e,t,!0):a}async matchVariantsForConfig(e,t,n){let r={rawSelector:e,theme:n.theme,generator:this};ce(r,this._variantCacheOwner);let i=d(n.variants),a=async t=>{let n=!0,[,,o,s]=t;for(;n;){n=!1;let c=t[1];for(let e of i){let i=Q(e,`multiPass`)??!1;if(!i&&s.has(e))continue;let l=Q(e,`match`);if(!l)continue;let u=l.call(e,c,r),f=jr(u)?await u:u;if(f){if(m(f)){if(f===c)continue;f={matcher:f}}if(Array.isArray(f)){let n=d(f).map(e=>e);if(!n.length)continue;if(n.length===1)f=n[0];else{if(i)throw Error(`multiPass can not be used together with array return variants`);let r=n.map(n=>{let r=Q(n,`matcher`)??c,i=[n,...o],a=new Set(s);return a.add(e),[t[0],r,i,a]});return(await Promise.all(r.map(e=>a(e)))).flat()}}t[1]=Q(f,`matcher`)??c,Ua(o,f),s.add(e),n=!0;break}}if(!n)break;if(o.length>500)throw Error(`Too many variants applied to "${e}"`)}return[t]};return await a([e,t||e,[],new Set])}applyVariants(e,t=e[4],n=e[1],r=qo(n),i){let a=d(t).map(Qa),o=a.length>1?a.sort((e,t)=>(e.order||0)-(t.order||0)):a,s={prefix:``,selector:r,pseudo:``,entries:e[2]},c=o.length?o.reduceRight((e,t)=>n=>{let r=Q(n,`entries`)??[],i=Q(n,`parent`),a=Q(n,`parentOrder`),o=Q(n,`selector`)??``,s=t.body?.call(t.source,r)||r,c=Array.isArray(t.parent)?Object.hasOwn(t.parent,0)?t.parent[0]:void 0:t.parent,l=Array.isArray(t.parent)&&Object.hasOwn(t.parent,1)?t.parent[1]:void 0,u=c||i,d=t.selector?.call(t.source,o,s);return(t.handle??Jo).call(t.source,{...n,entries:s,selector:d??o,parent:u,parentOrder:l??(u===i?a:void 0),layer:t.layer||Q(n,`layer`),sort:t.sort??Q(n,`sort`)},e)},e=>e)(s):s,l=Q(c,`parent`),u=Q(c,`parentOrder`),f=this.getContextConfig(i),p={selector:[Q(c,`prefix`)??``,Q(c,`selector`)??``,Q(c,`pseudo`)??``].join(``),entries:Q(c,`entries`)??[],parent:l,layer:Q(c,`layer`),sort:Q(c,`sort`),noMerge:Q(c,`noMerge`)};l!=null&&u!=null&&this._utilParentOrders.set(p,u);let m=d(f.postprocess);return m.length?m.reduce((e,t)=>{let n=[];for(let r of e){let e=this._utilParentOrders.get(r),i=r.parent;e!=null&&this._utilParentOrders.delete(r);let a=t(r);if(Array.isArray(a))for(let t of d(a).filter(Ar))e!=null&&t.parent===i&&this._utilParentOrders.set(t,e),Z(n,t);else{let t=a||r;e!=null&&t.parent===i&&this._utilParentOrders.set(t,e),Z(n,t)}}return n},[p]):[p]}constructCustomCSS(e,t,n){let r=Br(t);return this.constructNormalizedCSS(e,r,n)}constructNormalizedCSS(e,t,n){if(m(t))return t;let r=[];for(let e=0;e<t.length;e++){if(!Object.hasOwn(t,e))continue;let n=t[e];if(!Object.hasOwn(n,0))continue;let i=n[0];typeof i==`string`?Z(r,n):i===X.body&&Z(r,[Ur,Object.hasOwn(n,1)?n[1]:void 0])}let i=this.applyVariants([0,n||e.rawSelector,r,void 0,e.variantHandlers],void 0,void 0,void 0,e).map(e=>{let{selector:t,entries:n,parent:r,layer:i,sort:a,noMerge:o}=e;return{body:Gr(n),layer:i,noMerge:o,parent:r,parentOrder:this._utilParentOrders.get(e),selector:t,sort:a}}).filter(e=>!!e.body);if(!i.length)return``;let a=i.map(e=>{let t=`${e.selector}{${e.body}}`;return e.parent?fo(e.parent,t):t}).join(``),o=e,s=this._constructedCSSResults.get(o);s||(s=new Map,this._constructedCSSResults.set(o,s));let c=a;return s.has(c)&&(c=`${a}\n${(++this._constructedCSSSequence).toString(2).replaceAll(`0`,` `).replaceAll(`1`,` `)}\n`),s.set(c,i),c}async parseUtil(e,t,n=!1,r){await this.ensureInitialized();let i=Object.hasOwn(t,`rules`),a=t.rules,o=a?.length,s=()=>{a&&o!==void 0?(a.length=o,t.rules=a):i?t.rules=a:delete t.rules};this.getContextConfig(t)===this.config&&this._preparedConfigMutable&&!this._generationContexts.has(t)&&this.ensureRuleIndexesCurrent(!0);let c=this.getContextConfig(t),l=c===this.config&&this._preparedConfigMutable&&!this._generationContexts.has(t),u=this._runtimeRevision,f=m(e)?await this.matchVariantsForConfig(e,void 0,c):[e],p=async([e,i,a])=>{c.details&&(t.rules=t.rules??[]);let o={...t,variantHandlers:a};this._contextConfigs.set(o,this.getContextConfig(t));let s;o.constructCSS=(...e)=>{if(!n||!t.variantHandlers.length)return this.constructCustomCSS(o,...e);let r=Br(e[0]);if(!m(r)&&ao(r))return this.constructNormalizedCSS(o,r,e[1]);s||(s={...o,variantHandlers:oo(o.variantHandlers,t.variantHandlers)},this._contextConfigs.set(s,this.getContextConfig(t)));let i=this.constructNormalizedCSS(s,r,e[1]),a=this._constructedCSSResults.get(s)?.get(i);if(a){let e=this._constructedCSSResults.get(o);e||(e=new Map,this._constructedCSSResults.set(o,e)),e.set(i,a)}return i};let l=c.rulesStaticMap[i];if(r){l=void 0;let e=d(r);for(let t=c.rules.length-1;t>=0;t--){let n=c.rules[t];if(!Qr(n)||n[0]!==i)continue;let r=$(n[2],`prefix`);if(!r||d(r).some(t=>e.includes(t))){l=n;break}}}let u=l,f=()=>{let t=u;if(u=void 0,!(!t?.[1]||!n&&$(t[2],`internal`)))return this.resolveCSSResult(e,t[1],t,o)},p=i.indexOf(`:`),h=this.getDynamicIndex(c),g=p>0&&h.map.get(i.slice(0,p))||h.fallback;for(let t of g){let[a,s,c]=t;if(($(u?.[2],`__index`)??-1)>($(c,`__index`)??-1)){let e=f();if(e)return e}if($(c,`internal`)&&!n)continue;let l=[i],p=$(c,`prefix`);if(p){let e=d(p);if(r){let t=d(r);if(!e.some(e=>t.includes(e)))continue}else if(l=e.filter(e=>i.startsWith(e)).map(e=>i.slice(e.length)),!l.length)continue}for(let n of l){let r=to(n,a);if(!r)continue;let i=s(r,o),c=jr(i)?await i:i;if(!c)continue;if(typeof c!=`string`&&(typeof c==`object`||typeof c==`function`)){let e=Array.isArray(c)?void 0:Q(c,Symbol.asyncIterator),t=Array.isArray(c)?void 0:Q(c,Symbol.iterator);if(e){let t=[],n=e.call(c);for(;;){let e=await n.next();if(e.done)break;e.value&&Z(t,e.value)}c=t}else if(t){let e=[],n=t.call(c);for(;;){let t=n.next();if(t.done)break;t.value!=null&&Z(e,t.value)}c=e}}let l=this.resolveCSSResult(e,c,t,o);if(l)return l}}return f()},h=f.length===1?await p(f[0])??[]:(await Promise.all(f.map(e=>p(e)))).flat().filter(e=>!!e);if(l&&(this.ensureRuleIndexesCurrent(!0),this.config===c&&this._runtimeRevision!==u))return s(),this.parseUtil(e,t,n,r);if(h.length)return h}resolveCSSResult=(e,t,n,r)=>{let i=Vr(t).filter(e=>e.length);if(i.length){let t=this.getContextConfig(r);t.details&&Z(r.rules,n),t===this.config&&r.generator.activatedRules.add(n);let a=n[2],o={},s=0,c=e=>(this._parsedOutputOrders.set(e,{group:o,index:s++}),e);return i.flatMap(t=>{let n;if(m(t)){let e=this._constructedCSSResults.get(r)?.get(t);return e?e.map(e=>{let t=[$(a,`__index`),e.body,a];return this._rawUtilMetadata.set(t,e),c(t)}):(n=[$(a,`__index`),t,a],[c(n)])}let i=[],o=r.variantHandlers,s=a,l=e=>{o=[e,...o]},u=e=>{s={...s,...e}};for(let e=0;e<t.length;e++){if(!Object.hasOwn(t,e))continue;let n=t[e],r=Object.hasOwn(n,0)?n[0]:void 0,a=()=>Object.hasOwn(n,1)?n[1]:void 0;switch(r){case X.variants:{let e=a();if(typeof e==`function`){let t=e(o);t&&(o=d(t).map(e=>e))}else o=[...d(e),...o];break}case X.parent:l({parent:a()});break;case X.selector:l({selector:a()});break;case X.layer:l({layer:a()});break;case X.sort:u({sort:a()});break;case X.noMerge:u({noMerge:a()});break;case X.noScope:u({noScope:a()});break;case X.shortcutsNoMerge:Z(i,n);break;case X.body:Z(i,[Ur,a()]);break;default:typeof r==`string`&&Z(i,n)}}return n=[$(a,`__index`),e,i,s,o],[c(n)]})}};stringifyUtil(e,t){if(!e)return;let n=this.getContextConfig(t);if(kr(e)){let r=this._rawUtilMetadata.get(e),i=e[2];if(r?.layer!==void 0||r?.sort!==void 0){let t={...e[2]??{}},n=$(e[2],`layer`),a=$(e[2],`sort`);delete t.layer,delete t.sort,i={...t,layer:r.layer??n,sort:r.sort??a}}let a=[e[0],r?.selector,r?.body??e[1],r?.parent,i,n.details?t:void 0,r?.noMerge];return this.transferOutputOrder(e,a),this.recordStringifiedContext(a,t),r?.parent!=null&&r.parentOrder!=null&&this._stringifiedParentOrders.set(a,r.parentOrder),[a]}let r=this.applyVariants(e,void 0,void 0,void 0,t),i=[];for(let a of r){let{selector:r,entries:o,parent:s,layer:c,sort:l,noMerge:u}=a,d=Gr(o);if(!d)continue;let f=e[3];if(c!==void 0||l!==void 0){let{layer:t,sort:n,...r}=e[3]??{};f={...r,layer:c??t,sort:l??n}}let p=[e[0],r,d,s,f,n.details?t:void 0,u];this.transferOutputOrder(e,p),this.recordStringifiedContext(p,t);let m=this._utilParentOrders.get(a);s!=null&&m!=null&&this._stringifiedParentOrders.set(p,m),Z(i,p)}return i}async expandShortcut(e,t,n=5){return await this.ensureInitialized(),this.expandConfiguredExpansions(e,t,n,this.getContextConfig(t).shortcuts,`shortcut`)}async expandMatchedShortcut(e,t=5){return this.expandConfiguredExpansionsForInput(e.variantMatch,e,t,this.getContextConfig(e).shortcuts,`shortcut`)}async expandConfiguredExpansions(e,t,n,r,i,a,o){await this.ensureInitialized();let s=await this.expandConfiguredExpansionsForInput(e,t,n,r,i,a,o);if(!s)return;let c=[s[0],s[1]];return this._expansionPrefixes.set(c,s[2]),this._expansionPrefixes.set(c[0],s[2]),c}async expandConfiguredExpansionsForInput(e,t,n,r,i,a,o){let s=d(r);if(n<=0||!s.length)return;let c=this.getContextConfig(t),l=m(e)?e:e[1],u=c.details?e=>{t.shortcuts=t.shortcuts??[],Z(t.shortcuts,e)}:Mr,f,p,h,g,_=o;expansionLoop:for(let e of s){if(!Array.isArray(e)||!Object.hasOwn(e,0)||!Object.hasOwn(e,1))continue;let n=Object.hasOwn(e,2)?e[2]:void 0,r=[{prefix:o,value:l}];if(n?.prefix){let e=d(n.prefix);if(r=e.filter(e=>l.startsWith(e)).map(e=>({prefix:e,value:l.slice(e.length)})),o&&e.includes(o)&&Z(r,{prefix:o,value:l}),!r.length)continue}for(let i of r){if(m(e[0])){if(e[0]!==i.value)continue;p=e[1]}else{let n=to(i.value,e[0]);n&&(p=e[1](n,t))}if(p){_=i.prefix,f||=n,u(e);break expansionLoop}}}if(p){let e=m(p)?[p]:d(p);h=e.filter(e=>m(e)).flatMap(e=>ti(wi(e.trim(),c.separators))).map(e=>({prefix:_,value:e})),g=e.filter(e=>!m(e)).map(e=>({handles:[],value:e}))}if(!p&&m(e)){let s=await this.matchVariantsForConfig(e,void 0,c);for(let e of s){let[s,c,l]=e;if(s!==c){let e=await this.expandConfiguredExpansions(c,t,n-1,r,i,a,o);if(e){let t=this._expansionPrefixes.get(e)??[];h??=[];for(let n=0;n<e[0].length;n++){let r=e[0][n];m(r)&&Z(h,{prefix:t[n]??o,value:s.replace(c,()=>r)})}g??=[],Ha(g,e[0].filter(e=>!m(e)).map(e=>({handles:[...e.handles,...l],value:e.value})))}}}}if(!h?.length&&!g?.length)return;let v=new Map,y=(h??[]).filter(({prefix:e,value:t})=>{let n=v.get(e);return n||(n=new Set,v.set(e,n)),n.has(t)?!1:(n.add(t),!0)}),b=[...(await Promise.all(y.map(async({prefix:e,value:o})=>{let s=await this.expandConfiguredExpansions(o,t,n-1,r,i,a,e),c=s?void 0:await a?.(o,t,n-1),l=s??c;if(!l)return[{prefix:e,value:o}];let u=this._expansionPrefixes.get(l)??[];return l[0].map((t,n)=>({prefix:u[n]??e,value:t}))}))).flat(),...(g??[]).map(e=>({prefix:_,value:e}))].filter(({value:e})=>!!e);return[b.map(({value:e})=>e),f,b.map(({prefix:e})=>e)]}async stringifyShortcuts(e,t,n,r,i){await this.ensureInitialized();let a=this.getContextConfig(t);r={...r,layer:$(r,`layer`)??a.shortcutsLayer};let o=i??this._expansionPrefixes.get(n)??[],s=new Fr,c=(await Promise.all(n.map(async(n,i)=>{let s=m(n)?await this.parseUtil(n,t,!0,o[i]??$(r,`prefix`)):[[1/0,`{inline}`,Br(n.value),void 0,n.handles]];return!s&&a.warn&&Ei(`unmatched utility "${n}" in shortcut "${e[1]}"`),s||[]}))).flat(1).filter(Boolean).sort((e,t)=>e[0]-t[0]);a.details&&t.rules&&t.rules.length>1&&t.rules.sort((e,t)=>($(e[2],`__index`)??1/0)-($(t[2],`__index`)??1/0));let[l,,u]=e,f=c.some(kr),p={},h=0,g=[],_=e=>{let t=this._shortcutMergeOrders.get(e)?.components;if(!t?.length){this._stringifiedOutputOrders.set(e,{group:p,index:h++});return}let n;for(let e of t){let t={group:p,index:h++};n??=t,this._stringifiedOutputOrders.set(e,t)}n&&this._stringifiedOutputOrders.set(e,n)};for(let e of c){if(kr(e)){let n=this._rawUtilMetadata.get(e),i={...e[2],...r,layer:n?.layer??$(r,`layer`),sort:n?.sort??$(r,`sort`)??$(e[2],`sort`)},o=[e[0],n?.selector,n?.body??e[1],n?.parent,i,a.details?t:void 0,n?.noMerge];this.recordStringifiedContext(o,t),n?.parent!=null&&n.parentOrder!=null&&this._stringifiedParentOrders.set(o,n.parentOrder),_(o),Z(g,o);continue}let n=ao(e[2]),i=n?e[4]:oo(e[4],u);for(let o of this.applyVariants(e,i,l,void 0,t)){let{selector:i,entries:c,parent:l,sort:u,noMerge:d,layer:p}=o,m=!!(d??$(r,`noMerge`)??$(e[3],`noMerge`)),h=!!($(r,`noScope`)??$(e[3],`noScope`)),v=$(r,`sort`),y=$(r,`layer`),b=n?v??0:u??v??$(e[3],`sort`)??0;if(f){let n=Gr(c);if(!n)continue;let s=[e[0],i,n,l,{...r,noMerge:m,noScope:h,sort:b,layer:p??y},a.details?t:void 0,void 0];this.recordStringifiedContext(s,t);let u=this._utilParentOrders.get(o);l!=null&&u!=null&&this._stringifiedParentOrders.set(s,u),_(s),Z(g,s);continue}let x=s.getFallback(p??y,{ordered:[],streams:new Map}),S=x.streams.get(l);S||(S=[],x.streams.set(l,S));let C=S[S.length-1];(!C||C.selector!==i||C.noScope!==h)&&(C={entries:[],noScope:h,parent:l,parentOrder:void 0,selector:i},Z(S,C),Z(x.ordered,C)),Z(C.entries,[c,m,b,e[0]]);let w=this._utilParentOrders.get(o);w!=null&&(C.parentOrder==null||w<C.parentOrder)&&(C.parentOrder=w)}}let v=s.flatMap((e,n)=>e.ordered.map(({entries:e,noScope:i,parentOrder:o,selector:s,parent:c})=>{let l=(e,l,u)=>{if(!u.length)return[];let d=Math.max(...u.map(e=>e[1])),f=Math.max(...u.map(e=>e[2])),p=e&&u.length>1?u.map(([e,t,n])=>[e.map(e=>[e[0],e[1]]),t,n]):u,m=p.map(e=>e[0]);return(e?[m.flat(1)]:m).map((u,m)=>{let h=Gr(u);if(h){let u={...r,noMerge:l,noScope:i,sort:d,layer:n},g=[f,s,h,c,u,a.details?t:void 0,void 0];this.recordStringifiedContext(g,t),c!=null&&o!=null&&this._stringifiedParentOrders.set(g,o);let _=e?p:[p[m]],v={flatten:e,group:{}};return v.components=e&&_.length>1?_.map(([n,r,i])=>{let l=e?Gr(n):h;if(!l)return;let d=[i,s,l,c,{...u,sort:r},a.details?t:void 0,void 0];return this.recordStringifiedContext(d,t),c!=null&&o!=null&&this._stringifiedParentOrders.set(d,o),this._shortcutMergeOrders.set(d,v),d}).filter(Ar):void 0,v.original=g,this._shortcutMergeOrders.set(g,v),g}})},u=[],f=[],p=[],m=[];for(let[t,n,r,i]of e){let e=d(t).some(io);Z(n?e?u:f:e?p:m,[t,r,i])}return[...l(!1,!0,u),...l(!0,!0,f),...l(!1,!1,p),...l(!0,!1,m)].filter(Ar)}).flat(1).filter(Boolean));for(let e of v)_(e);return g.concat(v)}isBlocked(e){if(!e)return!0;let{blocklist:t}=this.requireInitialized(`isBlocked`);for(let n=0;n<t.length;n++){if(!Object.hasOwn(t,n))continue;let r=t[n],i=Array.isArray(r)?Object.hasOwn(r,0)?r[0]:void 0:r;if(i!==void 0&&this.matchesBlocklist(i,e))return!0}return!1}getBlocked(e){let{blocklist:t}=this.requireInitialized(`getBlocked`);for(let n=0;n<t.length;n++){if(!Object.hasOwn(t,n))continue;let r=t[n],i=Array.isArray(r)?Object.hasOwn(r,0)?r[0]:void 0:r;if(!(i===void 0||!this.matchesBlocklist(i,e)))return[i,Array.isArray(r)&&Object.hasOwn(r,1)?r[1]:void 0]}}matchesBlocklist(e,t){return typeof e==`function`?!!e(t):m(e)?e===t:to(t,e)!==null}},Bo=class extends zo{constructor(e={},t={}){super(e,t)}};async function Vo(e,t){return await zo.create(e,t)}const Ho=/\s\$\$\s+/g;function Uo(e){return mo(e).length>0}function Wo(e){let t=[],n=0,r=!1,i=0,a,o=0;for(let s=0;s<e.length;s++){let c=e[s];r?c===`*`&&e[s+1]===`/`&&(r=!1,s++):a?c===`\\`?s++:c===a&&(a=void 0):c===`/`&&e[s+1]===`*`?(r=!0,s++):c===`\\`?s++:c===`"`||c===`'`?a=c:c===`[`?n++:c===`]`?n>0&&n--:c===`(`?i++:c===`)`?i>0&&i--:c===`,`&&n===0&&i===0&&(Z(t,e.slice(o,s).trim()),o=s+1)}return Z(t,e.slice(o).trim()),t}function Go(e,t){return Wo(e).map(e=>{let n=e.startsWith(`$$`)&&/\s/.test(e[2]??``)?` ${e}`:e;return t?Uo(n)?ho(n,t):`${t} ${e}`:ho(n)}).join(`,`)}const Ko=/^\[(.+?)(~?=)"(.*)"\]$/;function qo(e){return Ko.test(e)?e.replace(Ko,(e,t,n,r)=>`[${En(t)}${n}"${En(r)}"]`):`.${En(e)}`}function Jo(e,t){return t(e)}const Yo=e.hash??((t,n,r)=>e.createHash(t).update(n).digest(r));function Xo(e,t=8){return Yo(`sha256`,e,`hex`).substring(0,t)}const Zo=`@teacss-include`,Qo=`@teacss-ignore`,$o=`@teacss-ide-include`,es=`@teacss-placeholder`,ts=`@teacss-skip-start`,ns=`@teacss-skip-end`,rs=RegExp(`(//\\s*?${ts}\\s*?|\\/\\*\\s*?${ts}\\s*?\\*\\/|<!--\\s*?${ts}\\s*?-->)[\\s\\S]*?(//\\s*?${ns}\\s*?|\\/\\*\\s*?${ns}\\s*?\\*\\/|<!--\\s*?${ns}\\s*?-->)`,`g`),is=[/^(?:virtual:)?tea(?::(.+))?\.css(\?.*)?$/],as=`__ALL__`;export{Fr as BetterMap,es as CSS_PLACEHOLDER,vr as CountableSet,we as DEFAULT_LAYERS,Qo as IGNORE_COMMENT,Zo as INCLUDE_COMMENT,$o as INCLUDE_COMMENT_IDE,ve as LAYER_IMPORTS,as as LAYER_MARK_ALL,xe as LAYER_PREFLIGHTS,ye as LAYER_PRIMITIVES,be as LAYER_PROPERTIES,Se as LAYER_SHORTCUTS,Ce as LAYER_UTILITIES,Kr as RESET_KEY,rs as SKIP_COMMENT_RE,ns as SKIP_END_COMMENT,ts as SKIP_START_COMMENT,Bo as TeacssGenerator,Pr as TwoKeyMap,is as VIRTUAL_ENTRY_ALIAS,Ur as VirtualKey,Cr as attributifyRE,F as buildConditionSelector,Hr as clearIdenticalEntries,Zr as clone,Ci as collapseVariantGroup,Ra as comparableWidth,uo as compareParentAtRules,_e as createConditionVariant,Vo as createGenerator,br as createNanoEvents,wr as cssIdRE,Rn as defaultSplitRE,ia as definePreset,En as e,Gr as entriesToCss,wn as escapeRegExp,Tn as escapeSelector,Sn as expandClassGroups,_n as expandGroups,ni as expandUnderscores,wi as expandVariantGroup,_r as extractorDefault,_r as extractorSplit,aa as getEnvFlags,Xo as getHash,kn as getPath,Uo as hasScopePlaceholder,jn as hash,di as isArbitrary,Er as isAttributifySelector,G as isCountableSet,An as isCssId,K as isObject,kr as isRawUtil,Qr as isStaticRule,$r as isStaticShortcut,m as isString,jr as isThenable,Dr as isValidSelector,C as isValidTargetSelector,xi as makeRegexClassGroup,$i as mergeConfigs,Jr as mergeDeep,Mr as noop,fi as normalizeArbitraryValue,Br as normalizeCSSEntries,Vr as normalizeCSSValues,Or as normalizeVariant,Ar as notNull,ge as parseClassToken,D as parseCondition,O as parseConditions,Si as parseVariantGroup,Ho as regexScopePlaceholder,In as replaceAsync,P as resolveConditions,Ki as resolveConfig,Hi as resolvePreset,Ui as resolvePresets,zi as resolveShortcuts,Fn as restoreSkipCode,ui as spaceCalcOperators,ti as splitClassTokens,zn as splitWithVariantGroupRE,X as symbols,d as toArray,qo as toEscapedSelector,Pn as transformSkipCode,f as uniq,p as uniqueBy,Tr as validateFilterRE,Ei as warnOnce,Nr as withLayer};
1
+ import e from"node:crypto";const t=[`:before`,`:after`,`:first-line`,`:first-letter`];function n(e){if(!e)return!1;let t=e.codePointAt(0);return e===`-`||e===`_`||e===`\\`||t!==void 0&&(t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t>=128)}function r(e,r){for(let i of t)if(e.slice(r,r+i.length).toLowerCase()===i&&!n(e[r+i.length]))return!0;return!1}function i(e,t){let n=0,i=0,a;for(let o=0;o<e.length;o++){let s=e[o];if(a)s===`\\`?o++:s===a&&(a=void 0);else if(s===`\\`)o++;else if(s===`/`&&e[o+1]===`*`){let t=e.indexOf(`*/`,o+2);if(t===-1)return;o=t+1}else if(s===`"`||s===`'`)a=s;else if(s===`[`)n++;else if(s===`]`)n>0&&n--;else if(s===`(`)i++;else if(s===`)`)i>0&&i--;else if(s===`:`&&n===0&&i===0){if(e[o+1]===`:`){if(t(o))return;o++}else if(r(e,o)&&t(o))return}}}function a(e){let t=-1;return i(e,e=>(t=e,!0)),t}function o(e){let t=!0;return i(e,n=>c(e,n)?!1:(t=!1,!0)),t}function s(e){let t=0;return i(e,()=>(t++,!1)),t}function c(e,t){let n=t+(e[t+1]===`:`?2:1);for(;e[n]===`/`&&e[n+1]===`*`;){let t=e.indexOf(`*/`,n+2);if(t===-1)return;n=t+2}let r=n;for(;/[a-z0-9_-]/i.test(e[n]??``);)n++;return n===r?void 0:{end:n,name:e.slice(r,n).toLowerCase()}}function l(e,t,n){let r=0,i;for(let a=t;a<n;a++){let o=e[a];if(i){o===`\\`?a++:o===i&&(i=void 0);continue}if(o===`\\`)a++;else if(o===`/`&&e[a+1]===`*`){let t=e.indexOf(`*/`,a+2);if(t===-1||t>=n)return!1;a=t+1}else if(o===`"`||o===`'`)i=o;else if(o===`(`)r++;else if(o===`)`){if(r--,r===0)return e.slice(t+1,a).replaceAll(/\/\*[\s\S]*?\*\//g,``).trim().length>0&&e.slice(a+1,n).trim().length===0;if(r<0)return!1}}return!1}function u(e){let t=[],n=0,r=!1;if(i(e,i=>{n++;let a=c(e,i);return a?t.push({...a,index:i}):r=!0,n>2}),n<=1)return!0;if(r||n!==2||t.length!==2)return!1;let[a,o]=t,s=a.name,u=o.name;return s!==`part`&&s!==`slotted`||e[a.index+1]!==`:`||e[a.end]!==`(`||!l(e,a.end,o.index)?!1:u===`before`||u===`after`||u===`marker`||u===`placeholder`||u===`file-selector-button`||s===`part`&&(u===`first-line`||u===`first-letter`)}function d(e=void 0){if(e===void 0)return[];if(!Array.isArray(e))return[e];for(let t=0;t<e.length;t++){if(Object.hasOwn(e,t))continue;let n=[],r=0;for(let t=0;t<e.length;t++)Object.hasOwn(e,t)&&Object.defineProperty(n,r++,{configurable:!0,enumerable:!0,value:e[t],writable:!0});return n}return e}function f(e){return Array.from(new Set(d(e)))}function p(e,t){return d(e).reduce((e,n)=>(e.findIndex(e=>t(n,e))===-1&&Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:n,writable:!0}),e),[])}function m(e){return typeof e==`string`}const h=new Set([`>`,`+`,`~`]);function g(e){if(e===void 0)return!1;let t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||e===`-`||e===`_`||t>=128}function _(e){if(e===void 0)return!1;let t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||e===`_`||t>=128}function v(e,t){let n=e[t];if(n===`-`){let n=e[t+1];return n===`-`||n===`\\`||_(n)}return _(n)}function y(e,t){let n=t;if(e[n]===`\\`)n+=2;else if(v(e,n))n++;else return;for(;n<e.length;){if(e[n]===`\\`){n+=2;continue}if(!g(e[n]))break;n++}return n>t?n:void 0}function b(e,t,n,r){if(e[t]!==n)return;let i=0,a;for(let o=t;o<e.length;o++){let t=e[o];if(a){t===`\\`?o++:t===a&&(a=void 0);continue}if(t===`\\`)o++;else if(t===`"`||t===`'`)a=t;else if(t===n)i++;else if(t===r&&--i===0)return o+1}}function x(e,t){let n=t;for(;e[n]===`/`&&e[n+1]===`*`;){let t=e.indexOf(`*/`,n+2);if(t===-1)return n;n=t+2}return n}function S(e,t){let n=x(e,t),r=n;if(e[n]===`*`&&!(e[n+1]===`/`&&n>t))n++;else{let t=y(e,n);t!==void 0&&(n=t)}let i=+(n>r);for(;n<e.length;){let t=x(e,n);if(t!==n){n=t;continue}let r=e[n];if(r===`.`||r===`#`){let t=y(e,n+1);if(t===void 0)return;n=t}else if(r===`[`){let t=b(e,n,`[`,`]`);if(t===void 0)return;n=t}else if(r===`:`){let t=y(e,n+1);if(t===void 0)return;if(n=t,e[n]===`(`){let t=b(e,n,`(`,`)`);if(t===void 0)return;n=t}}else break;i++}return i>0?n:void 0}function C(e){if(!e)return!1;let t=0;for(;;){let n=S(e,t);if(n===void 0)return!1;if(t=x(e,n),t===e.length)return!0;if(!h.has(e[t])||(t=x(e,t+1),t===e.length))return!1}}function w(e,t){let n=e;for(;n!==null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}const T={">":` > `,_:` `,"+":` + `,"~":` ~ `};function E(e){let t=e[0];return t!==void 0&&Object.hasOwn(T,t)?T[t]:void 0}function D(e){let t=e.startsWith(`!`),n=t?e.slice(1):e,r;return r=n.startsWith(`::`)?`pseudo-element`:n[0]===`.`||n[0]===`#`?`self`:E(n)===void 0?n[0]===`[`?`arbitrary`:`named`:`target`,{raw:e,kind:r,negate:t,value:n}}function O(e){return d(e).map(D)}function k(e){let t=[],n;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(i===`\\`){if(r+1>=e.length)return!1;r++}else i===n&&(n=void 0);continue}if(i===`\\`){if(r+1>=e.length)return!1;r++;continue}if(i===`/`&&e[r+1]===`*`){let t=e.indexOf(`*/`,r+2);if(t===-1)return!1;r=t+1;continue}if(i===`"`||i===`'`){n=i;continue}if(i===`[`){t.push(i);continue}if(i===`]`){if(t.pop()!==`[`)return!1;continue}if(i===`(`){t.push(i);continue}if(i===`)`){if(t.pop()!==`(`)return!1;continue}if(t.length===0&&(i===`,`||i===`;`||i===`{`||i===`}`||i===`>`||i===`+`||i===`~`||/\s/.test(i)))return!1}return n===void 0&&t.length===0}function A(e){if(e.kind!==`self`&&e.kind!==`pseudo-element`&&e.kind!==`target`)return!1;let t=e.kind===`target`?e.value.slice(1):e.value;return!t||e.kind===`self`&&t.length===1||!o(t)||!k(t)||e.kind===`self`&&e.negate&&a(t)!==-1}function j(e){switch(e.kind){case`self`:{if(e.negate)return{suffix:`:not(${e.value})`};let t=a(e.value);return t===-1?{suffix:e.value}:{suffix:e.value.slice(0,t),pseudoElement:e.value.slice(t)}}case`pseudo-element`:return{pseudoElement:e.value};case`target`:{let t=E(e.value);if(t===void 0)return;let n=e.value.slice(1),r=a(n);return C(r===-1?n:n.slice(0,r))?r===-1?{combinator:`${t}${n}`}:{combinator:`${t}${n.slice(0,r)}`,pseudoElement:n.slice(r)}:void 0}default:return}}function ee(e){let t={},n=w(e,`prefix`),r=w(e,`suffix`),i=w(e,`combinator`),a=w(e,`pseudoElement`),o=w(e,`parent`);return Object.defineProperties(t,{prefix:{configurable:!0,enumerable:n!==void 0,value:n,writable:!0},suffix:{configurable:!0,enumerable:r!==void 0,value:r,writable:!0},combinator:{configurable:!0,enumerable:i!==void 0,value:i,writable:!0},pseudoElement:{configurable:!0,enumerable:a!==void 0,value:a,writable:!0},parent:{configurable:!0,enumerable:o!==void 0,value:o,writable:!0}}),t}function M(e){let t=e.suffix;if(!t)return e;let n=a(t);return n===-1?e:{...e,suffix:t.slice(0,n)||void 0,pseudoElement:`${t.slice(n)}${e.pseudoElement??``}`}}function N(e){let t=e.pseudoElement;if(!t)return e;let n=s(t);if(n>1&&!u(t))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${n}`);return e}function P(e,t=[],n){let r=d(e),i=d(t),a={conditions:r,theme:n},o=[],c=[];for(let e of r){if(A(e)||e.negate&&(e.kind===`pseudo-element`||e.kind===`target`)){c.push(e);continue}if(e.kind===`self`||e.kind===`pseudo-element`||e.kind===`target`){let t=e.kind===`target`?e.value.slice(1):e.value,n=s(t);if(n>1&&!u(t))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${n}`)}let t=j(e);if(!t){for(let n of i)if(t=n(e,a),t||e.negate&&n({...e,raw:e.value,negate:!1},a))break}t?o.push(N(M(ee(t)))):c.push(e)}let l=o.map(e=>e.pseudoElement??``).join(``),f=s(l);if(f>1&&!u(l))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${f}`);return{resolved:o,unresolved:c}}function F(e,t){let n=d(t).map(ee),r=n.map(e=>e.prefix).filter(Boolean),i=n.map(e=>e.suffix).filter(Boolean),a=n.map(e=>e.combinator).filter(Boolean),o=n.map(e=>e.pseudoElement).filter(Boolean),s=n.map(e=>e.parent).filter(Boolean);return{selector:`${r.join(``)}${e}${i.join(``)}${a.join(``)}${o.join(``)}`,parents:s}}const I=1e4;function te(e,t){return e===t||Object.is(e,t)}var ne=class{nodes=new Map;oldest;newest;get size(){return this.nodes.size}peek(){return this.oldest?{done:!1,value:this.oldest.key}:{done:!0,value:void 0}}add(e){if(this.nodes.has(e))return;let t=e===0?0:e,n={key:t,older:this.newest};this.nodes.set(t,n),this.newest?this.newest.newer=n:this.oldest=n,this.newest=n}clear(){this.nodes.clear(),this.oldest=void 0,this.newest=void 0}delete(e){let t=this.nodes.get(e);return t?(this.nodes.delete(e),this.unlink(t),!0):!1}shift(){let e=this.oldest;return e?(this.nodes.delete(e.key),this.unlink(e),{done:!1,value:e.key}):{done:!0,value:void 0}}reset(e){this.clear();for(let t of e)this.add(t)}touch(e){let t=this.nodes.get(e);!t||t===this.newest||(this.unlink(t),t.older=this.newest,this.newest?this.newest.newer=t:this.oldest=t,this.newest=t)}unlink(e){e.older?e.older.newer=e.newer:this.oldest=e.newer,e.newer?e.newer.older=e.older:this.newest=e.older,e.older=void 0,e.newer=void 0}},re=class extends Map{assumeNoPrototypeBypass;maxEntries;order=new ne;retained=new Set;_revision=0;constructor(e=I,t,n=!1){if(super(),this.assumeNoPrototypeBypass=n,this.maxEntries=e,t)for(let[e,n]of t)this.set(e,n)}get revision(){return this._revision}get retainedSize(){return this.retained.size}isRetained(e){return this.retained.has(e)}clear(){super.clear(),this.order.clear(),this.retained.clear(),this._revision++}delete(e){this.reconcileOrder();let t=super.delete(e);return this.order.delete(e),this.retained.delete(e),this._revision++,t}set(e,t){this.reconcileOrder();let n=super.has(e);for(super.set(e,t),!n&&!this.retained.has(e)&&this.order.add(e),this._revision++;this.order.size>this.maxEntries&&this.deleteOldest(););return this}getOrInsert(e,t){this.reconcileOrder();let n=super.get(e);return n!==void 0||super.has(e)?(this.enforceInstanceLimit(),n):(this.set(e,t),t)}getOrInsertComputed(e,t){this.reconcileOrder();let n=super.get(e);if(n!==void 0||super.has(e))return this.enforceInstanceLimit(),n;let r=t(e);return this.set(e,r),r}setAndTouch(e,t,n=this.maxEntries){return this.reconcileOrder(),this.retained.has(e)?super.set(e,t):super.delete(e)?(super.set(e,t),this.order.touch(e)):(super.set(e,t),this.order.add(e)),this.order.size>n&&this.deleteOldest(),this}replaceRetained(e,t){if(this._revision!==t)return!1;let n=new Map(e);if(this._revision!==t)return!1;this.reconcileOrder();for(let e of this.retained)n.has(e)||(super.delete(e),this.retained.delete(e));for(let[e,t]of n)this.order.delete(e),super.set(e,t),this.retained.add(e);return this.enforceInstanceLimit(),!0}deleteOldest(){this.reconcileEvictionOrder();let e=this.order.shift();for(;!e.done;){if(super.delete(e.value))return!0;this.resetOrder(),e=this.order.shift()}let t=this.firstOrdinaryKey();return!t.done&&super.delete(t.value)}enforceInstanceLimit(){for(;this.order.size>this.maxEntries&&this.deleteOldest(););}reconcileOrder(){if(!this.assumeNoPrototypeBypass)for(let e of this.retained)super.has(e)||this.retained.delete(e);this.order.size!==this.size-this.retained.size&&this.resetOrder()}reconcileEvictionOrder(){if(this.assumeNoPrototypeBypass)return;let e=this.order.peek(),t=this.firstOrdinaryKey();(e.done!==t.done||!e.done&&!t.done&&!te(e.value,t.value))&&this.resetOrder()}firstOrdinaryKey(){for(let e of super.keys())if(!this.retained.has(e))return{done:!1,value:e};return{done:!0,value:void 0}}resetOrder(){this.order.reset(Array.from(super.keys()).filter(e=>!this.retained.has(e)))}},L=class extends Set{assumeNoPrototypeBypass;maxEntries;order=new ne;constructor(e=I,t,n=!1){if(super(),this.assumeNoPrototypeBypass=n,this.maxEntries=e,t)for(let e of t)this.add(e)}add(e){this.reconcileOrder();let t=super.has(e);for(super.add(e),t||this.order.add(e);this.size>this.maxEntries&&this.size&&this.deleteOldest(););return this}addAndTouch(e,t=this.maxEntries){return this.reconcileOrder(),super.delete(e)?(super.add(e),this.order.touch(e)):(super.add(e),this.order.add(e)),this.size>t&&this.deleteOldest(),this}clear(){super.clear(),this.order.clear()}delete(e){this.reconcileOrder();let t=super.delete(e);return this.order.delete(e),t}deleteOldest(){this.reconcileEvictionOrder();let e=this.order.shift();for(;!e.done;){if(super.delete(e.value))return!0;this.order.reset(super.values()),e=this.order.shift()}let t=super.values().next();return!t.done&&super.delete(t.value)}reconcileOrder(){this.order.size!==this.size&&this.order.reset(super.values())}reconcileEvictionOrder(){if(this.assumeNoPrototypeBypass)return;let e=this.order.peek(),t=super.values().next();(e.done!==t.done||!e.done&&!t.done&&!te(e.value,t.value))&&this.order.reset(super.values())}};function ie(e){let t=e.keys().next();t.done||e.delete(t.value)}function R(e,t,n,r){if(e instanceof re){e.setAndTouch(t,n,r??e.maxEntries);return}e.delete(t),e.set(t,n),e.size>(r??1e4)&&ie(e)}function z(e,t,n){if(e instanceof L){e.addAndTouch(t,n??e.maxEntries);return}e.delete(t),e.add(t),e.size>(n??1e4)&&ie(e)}const ae=new WeakMap,oe=new WeakMap;function se(e,t){oe.set(e,t)}function ce(e){return e&&oe.get(e)}function le(e){return(t,n)=>{let r=[e.parent,t.parent].filter(Boolean).join(` $$ `)||t.parent;return n({...t,prefix:`${e.prefix}${t.prefix}`,selector:`${t.selector}${e.suffix}${e.combinator}`,pseudo:`${e.pseudoElement}${t.pseudo}`,parent:r,parentOrder:r===t.parent?t.parentOrder:void 0})}}function ue(e,t){return ae.set(e,t),e}function de(e){return ae.has(e)}function fe(e,t){let n=ae.get(e),r=ae.get(t);if(!n||!r)return;let i=`${r.pseudoElement}${n.pseudoElement}`,a=s(i);if(a>1&&!u(i))throw Error(`[Teacss] a token may use at most one pseudo-element, found ${a}`);let o={prefix:`${n.prefix}${r.prefix}`,suffix:`${n.suffix}${r.suffix}`,combinator:`${n.combinator}${r.combinator}`,pseudoElement:i,parent:[n.parent,r.parent].filter(Boolean).join(` $$ `)||void 0};return ue({handle:le(o)},o)}function pe(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function me(e,t){let n=e.length;n in e?pe(e,n,t):e[n]=t}function he(e){let t=``,n,r=-1,i=-1,a=-1,o=[];for(let s=0;s<e.length;s++){let c=e[s];if(n){c===`\\`?s++:c===n&&(n=void 0);continue}if(t.length>0&&c===`\\`){s++;continue}if(t.length>0&&(c===`"`||c===`'`)){n=c;continue}if(t.length>0&&c===`/`&&e[s+1]===`*`){let t=e.indexOf(`*/`,s+2);if(t<0)break;s=t+1;continue}c===`(`||c===`[`?t+=c===`(`?`)`:`]`:c===t.at(-1)?t=t.slice(0,-1):t.length===0&&(c===`@`?(i===-1&&(i=s),me(o,s)):i===-1&&(c===`:`&&r===-1?r=s:c===`!`&&(a=s)))}let s=i===-1?e.length:i,c=e.slice(0,s),l=!1;s>0&&a===s-1&&(l=!0,c=c.slice(0,-1));let u=[];for(let t=0;t<o.length;t++){let n=o[t]+1,r=t+1<o.length?o[t+1]:e.length;me(u,e.slice(n,r))}return r!==-1&&r<s?{raw:e,body:c,property:e.slice(0,r),value:c.slice(r+1),keyword:!1,important:l,conditions:u}:{raw:e,body:c,keyword:!0,important:l,conditions:u}}function ge(e,t={}){let{name:n=`at-condition`}=t,r={},i=new WeakMap,a=e=>{let t=e??r,n=i.get(t);return n||(n=new re(I,void 0,!0),i.set(t,n)),n},o=(t,n,r)=>{let i=t.map(e=>`${e.length}:${e}`).join(``),o=a(r??n),s=o.get(i);if(s!==void 0)return R(o,i,s),s;let{resolved:c,unresolved:l}=P(O(t),e,n);if(l.length>0||c.length===0)return R(o,i,null),null;let u=e=>c.map(t=>t[e]).filter(Boolean).join(``),d={prefix:u(`prefix`),suffix:u(`suffix`),combinator:u(`combinator`),pseudoElement:u(`pseudoElement`),parent:c.map(e=>e.parent).filter(Boolean).join(` $$ `)||void 0},f={...d,handle:le(d)};return R(o,i,f),f};return{name:n,match(e,t){if(!e.includes(`@`))return;let n=he(e);if(n.conditions.length===0)return;let r=o(n.conditions,t?.theme,ce(t));if(r)return ue({matcher:`${n.body}${n.important?`!`:``}`,handle:r.handle},r)},multiPass:!1}}const _e=`imports`,ve=`primitives`,ye=`properties`,be=`preflights`,xe=`shortcuts`,Se=`utilities`,Ce=Object.freeze({[_e]:-200,[ye]:-150,[be]:-100,[xe]:-50,[ve]:-10,[Se]:0});function B(e,t){let n=e.length;n in e?Object.defineProperty(e,n,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[n]=t}function we(e,t,n=!1,r=t+1){let i=e[t];if(i!==`[`&&i!==`(`)return;let a=i===`[`?`]`:`)`,o=!1,s;for(let i=t+1;i<e.length;i++){let t=e[i];if(t===`
2
+ `||t===`\r`||t===`\u2028`||t===`\u2029`)return;if(o){t===`*`&&e[i+1]===`/`&&(o=!1,i++);continue}if(s){t===`\\`?i++:t===s&&(s=void 0);continue}if(i>=r&&/\s/.test(t))return;if(t===`\\`)i++;else if(t===`/`&&e[i+1]===`*`)o=!0,i++;else if(t===`"`||t===`'`||n&&t==="`")s=t;else if(t===`[`||t===`(`)a+=t===`[`?`]`:`)`;else if(t===a.at(-1)&&(a=a.slice(0,-1),!a))return i+1}}function Te(e,t){let n=0;for(;e[t-n-1]===`\\`;)n++;return n%2==1}const Ee=/^(?:[\p{ID_Continue}$-]|\u200C|\u200D)+$/u,De=/^(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?|\d(?:_?\d)*\.|\.\d(?:_?\d)*)(?:e[+-]?\d(?:_?\d)*)?$/i;function Oe(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;return n>=0&&`{,`.includes(e[n])}function ke(e,t,n){let r=t+1;for(;/\s/.test(e[r]??``);)r++;if(e[r]!==`/`||e[r+1]===`/`||e[r+1]===`*`)return!1;let i=!1;for(r++;r<n;r++){let t=e[r];if(t===`
3
+ `||t===`\r`||t===`\u2028`||t===`\u2029`)return!1;if(t===`\\`)r++;else if(t===`[`)i=!0;else if(t===`]`&&i)i=!1;else if(t===`/`&&!i){for(r++;/[a-z]/i.test(e[r]??``);)r++;for(;/\s/.test(e[r]??``);)r++;return r===n}}return!1}function Ae(e,t){let n=0,r;for(let i=t;i>=0;i--){let a=e[i];if(r)a===r&&!Te(e,i)&&(r=void 0);else if(a===`"`||a===`'`||a==="`")r=a;else if(a===`]`)n++;else if(a===`[`&&(n--,Oe(e,i)&&(n===0||ke(e,i,t))))return i}}function je(e,t){let n=e[t];if(n===`"`||n===`'`||n==="`"){for(let r=t-1;r>=0;r--)if(e[r]===n&&!Te(e,r))return r;return}if(n===`]`)return Ae(e,t);let r=t;for(;r>0&&!/\s/.test(e[r-1])&&!`({,[`.includes(e[r-1]);)r--;let i=e.slice(r,t+1);return Ee.test(i)||De.test(i)?r:void 0}function Me(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;if(n<0)return!1;if(`=({,[`.includes(e[n]))return!0;if(e[n]!==`:`)return!1;for(n--;n>=0&&/\s/.test(e[n]);)n--;let r=je(e,n);if(r===void 0)return!1;for(n=r-1;n>=0&&/\s/.test(e[n]);)n--;return n>=0&&`{,[?`.includes(e[n])}function Ne(e,t){return Me(e,t)}function Pe(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e[n]!==`"`&&e[n]!==`'`&&e[n]!=="`"?!1:Ne(e,t)}function Fe(e,t,n){if(!Pe(e,t))return!1;let r=t+1,i=0;for(;r<n-1;){for(;/\s/.test(e[r]??``);)r++;let t=e[r];if(t!==`"`&&t!==`'`&&t!=="`")return!1;r++;let a=!1;for(;r<n-1;){let n=e[r];if(n===`\\`)r+=2;else if(n===t){r++,a=!0;break}else r++}if(!a)return!1;for(i++;/\s/.test(e[r]??``);)r++;if(r===n-1)break;if(e[r]!==`,`)return!1;for(r++;/\s/.test(e[r]??``);)r++;if(r===n-1)break}return i!==0}function Ie(e){let t=[],n=[],r=new Map,i=!1,a,o;for(let s=0;s<e.length;s++){let c=e[s];if(n.length===0){c===`\\`?(/\s/.test(e[s+1]??``)&&(a=void 0),s++):/\s/.test(c)?a=void 0:c===`"`||c===`'`?a=a===c?void 0:a??c:!a&&c===`[`&&B(n,s);continue}if((o||i)&&c===`[`&&/[:@\s]/.test(e[s-1])){B(n,s),r.set(s,o??i),i=!1,o=void 0;continue}if(i){c===`*`&&e[s+1]===`/`&&(i=!1,s++);continue}if(o){c===`\\`?s++:c===o&&(o=void 0);continue}if(c===`/`&&e[s+1]===`*`)i=!0,s++;else if(c===`"`||c===`'`)o=c;else if(c===`\\`)s++;else if(c===`[`)B(n,s);else if(c===`]`){let a=n.pop(),c=r.get(a);(/[:@]/.test(e[a-1])||e[s+1]===`:`)&&B(t,{end:s+1,start:a}),c===!0?i=!0:c&&(o=c)}}let s=[];for(let e of t.sort((e,t)=>e.start-t.start||t.end-e.end))(!s.length||e.start>=s.at(-1).end)&&B(s,e);return s}function V(e,t,n){let r=e[t];if(n.blockComment)return r===`*`&&e[t+1]===`/`?(n.blockComment=!1,t+1):t;if(n.quote)return r===`\\`?t+1:(r===n.quote&&(n.quote=void 0),t);if(n.closers.length>0&&r===`/`&&e[t+1]===`*`)return n.blockComment=!0,t+1;if(n.closers.length>0&&(r===`"`||r===`'`))return n.quote=r,t;if(n.closers.length>0&&r===`\\`)return t+1;if(r===`(`||r===`[`)return H(n.closers,r===`(`?`)`:`]`),t;if(r===n.closers.at(-1))return n.closers.pop(),t}function Le(e,t,n=e.length){let r={closers:[]};for(let i=t+1;i<n;i++){let t=e[i],n=V(e,i,r);if(n!==void 0){i=n;continue}if(r.closers.length===0){if(t===`}`)return{index:i,kind:`close`};if(t===`{`)return{index:i,kind:`open`}}}return{index:n,kind:`limit`}}function Re(e,t,n=e.length){let r={closers:[]},i=Ft();for(let a=t+1;a<n;a++){let t=e[a],n=V(e,a,r);if(n!==void 0){a=n;continue}if(!(r.closers.length>0)){if(t===`}`)return{index:a,kind:`close`};if(t===`{`)return{index:a,kind:`open`};if(t===`'`||t===`"`||t==="`"||t===`/`&&(e[a+1]===`/`||e[a+1]===`*`||Wt(e,a,i.forceRegex,i.canEnd)))return{index:a,kind:`host`};/\s/.test(t)||(i.forceRegex=!1),i.canEnd=Ut(e,a,i.canEnd,i)}}return{index:n,kind:`limit`}}const ze=/[\s'"`;{},\])]/;function Be(e,t,n=e.length){if(e[t]!==`@`)return{conds:``,end:t};let r={closers:[]},i=t;for(;i<n;i++){let t=e[i],n=V(e,i,r);if(n!==void 0){i=n;continue}if(t===`/`&&(e[i+1]===`/`||e[i+1]===`*`)&&r.closers.length===0||ze.test(t)&&r.closers.length===0)break}return{conds:e.slice(t,i),end:i}}function Ve(e){let t=[],n={closers:[]},r=0;for(let i=0;i<e.length;i++){let a=e[i],o=V(e,i,n);if(o!==void 0){i=o;continue}a===`;`&&n.closers.length===0&&(H(t,e.slice(r,i)),r=i+1)}return H(t,e.slice(r)),t.map(e=>e.trim()).filter(Boolean)}function He(e){let t={closers:[]},n=!1,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=V(e,i,t);if(o!==void 0){i=o;continue}if(!(t.closers.length>0)){if(a===`<`&&Kt(e,i))return!1;if(a===`;`)return!0;a===`:`?n=!0:a===`?`&&(r=!0)}}return n&&!r}function Ue(e,t){let n=Re(e,t);if(n.kind!==`close`)return;let r=e.slice(t+1,n.index);if(!He(r))return;let i=Ve(r);if(i.length===0)return;let{conds:a,end:o}=Be(e,n.index+1);return{end:o,value:i.map(e=>`${e}${a}`).join(` `)}}function H(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function U(e,t,n=!1){let r=t+1;if(r>=e.length)return e.length;if(e[r]===`\r`&&e[r+1]===`
4
+ `||n&&e[r]===`$`&&e[r+1]===`{`)return r+2;if(e[r]===`u`&&e[r+1]===`{`){let t=r+2;for(;/[0-9a-f]/i.test(e[t]??``);)t++;if(t>r+2&&e[t]===`}`)return t+1}return r+1}function We(e,t,n){let r=e[t];return n.lineComment?((r===`
5
+ `||r===`\r`||r===`\u2028`||r===`\u2029`)&&(n.lineComment=!1),t+1):n.blockComment?r===`*`&&e[t+1]===`/`?(n.blockComment=!1,t+2):t+1:n.quote?r===`\\`?U(e,t):(r===n.quote&&(n.quote=void 0),t+1):r===`\\`?U(e,t):r===`/`&&e[t+1]===`*`?(n.blockComment=!0,t+2):r===`/`&&e[t+1]===`/`&&n.parenDepth===0?(n.lineComment=!0,t+2):(r===`'`||r===`"`?n.quote=r:r===`(`?n.parenDepth++:r===`)`&&n.parenDepth>0?n.parenDepth--:r===`{`&&n.parenDepth===0?n.depth++:r===`}`&&n.parenDepth===0&&n.depth--,t+1)}function Ge(e,t,n){let r={blockComment:!1,depth:1,lineComment:!1,parenDepth:0};for(let i=t+1;i<n;){let t=i;if(i=We(e,i,r),r.depth===0)return t}return-1}const Ke=`=([{,:>)$?|&.!~+-*/%^<`,qe=new Set(`as.assert.await.case.catch.class.const.default.delete.do.else.export.extends.finally.implements.import.in.instanceof.is.keyof.let.new.of.return.satisfies.static.throw.type.typeof.try.var.void.with.yield`.split(`.`)),Je=new Set([`await`,`case`,`delete`,`do`,`else`,`in`,`new`,`of`,`return`,`throw`,`typeof`,`void`,`yield`]),Ye=new Set([`catch`,`for`,`if`,`switch`,`while`,`with`]),Xe=/^(?:a|abbr|address|animate|animateMotion|animateTransform|annotation|area|article|aside|audio|b|base|bdi|bdo|blockquote|body|br|button|canvas|caption|circle|cite|clipPath|code|col|colgroup|data|datalist|dd|defs|del|desc|details|dfn|dialog|discard|div|dl|dt|ellipse|em|embed|feBlend|feColorMatrix|feComponentTransfer|feComposite|feConvolveMatrix|feDiffuseLighting|feDisplacementMap|feDistantLight|feDropShadow|feFlood|feFuncA|feFuncB|feFuncG|feFuncR|feGaussianBlur|feImage|feMerge|feMergeNode|feMorphology|feOffset|fePointLight|feSpecularLighting|feSpotLight|feTile|feTurbulence|fieldset|figcaption|figure|filter|footer|foreignObject|form|g|h[1-6]|head|header|hgroup|hr|html|i|iframe|image|img|input|ins|kbd|label|legend|li|line|linearGradient|link|maction|maligngroup|malignmark|main|map|mark|marker|mask|math|menu|meta|metadata|meter|menclose|merror|mfenced|mfrac|mglyph|mi|mlabeledtr|mlongdiv|mmultiscripts|mn|mo|mover|mpadded|mpath|mphantom|mprescripts|mroot|mrow|ms|mscarries|mscarry|msgroup|msline|mspace|msqrt|msrow|mstack|mstyle|msub|msubsup|msup|mtable|mtd|mtext|mtr|munder|munderover|nav|noscript|object|ol|optgroup|option|output|p|path|pattern|picture|polygon|polyline|pre|progress|q|radialGradient|rect|rp|rt|ruby|s|samp|script|search|section|select|selectedcontent|semantics|set|slot|small|source|span|stop|strong|style|sub|summary|sup|svg|switch|symbol|table|tbody|td|template|text|textPath|textarea|tfoot|th|thead|time|title|tr|track|tspan|u|ul|use|var|video|view|wbr|[a-z][-\w]*-[\w-]+)$/i,Ze=/^(?:--|-?)[_a-z][-\w]*$/i,Qe=/^[+-]?(?:(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)%$/i;function $e(e){if(/^(?:from|to)$/i.test(e)||Qe.test(e))return!0;let t=e.search(/\s/u);if(t<1)return!1;let n=e.slice(t).trim();return Ze.test(e.slice(0,t))&&Qe.test(n)}function et(e,t,n=0){let r=e.slice(n,t);return/(?:^|[;}\n\r])\s*(?:(?:export|default|declare|async)\s+)*function(?:\s*\*)?[\s\S]*$/.test(r)}function tt(e,t,n=0){return/\bfunction(?:\s*\*)?[\s\S]*$/.test(e.slice(n,t))}function nt(e,t,n=0){let r=e.slice(n,t);return/(?:^|[;{}\n\r])\s*(?:(?:export|default|declare|abstract)\s+)*(?:class|interface|namespace|enum|module|global)\b[^{};]*$/.test(r)}function rt(e,t,n=0){return/(?:^|[^\w$])(?:abstract\s+)?class\b[^{};]*$/.test(e.slice(n,t))}function it(e,t,n=0){return nt(e,t,n)||rt(e,t,n)||tt(e,t,n)}function at(e,t){let n=-1,r=0,i=0,a=0,o;for(let s=0;s<e.length;s++){let c=e[s];if(o){c===`\\`?s++:c===o&&(o=void 0);continue}if(i>0){c===`\\`?s++:c===`'`||c===`"`?o=c:c===`{`?i++:c===`}`&&i--;continue}if((t&&c===`$`||c===`#`||c===`@`)&&e[s+1]===`{`){i=1,s++;continue}if(c===`\\`){s++;continue}if(c===`'`||c===`"`){o=c;continue}c===`[`?r++:c===`]`&&r>0?r--:c===`(`?a++:c===`)`&&a>0?a--:r===0&&a===0&&(c===`;`||c===`{`||c===`}`||c===`
6
+ `||c===`\r`||t&&c==="`")&&(n=s)}return n}function ot(e){for(let t of e)if((t.codePointAt(0)??0)>127)return!0;return!1}function st(e,t,n=!1,r=0){let i=e.slice(r,t),a=at(i,n),o=i.slice(a+1).trim();if(o.length===0)return!1;let s=o.split(/\s*(?:,|>|\+|~)\s*|\s+/).filter(Boolean),c=o.split(`,`).map(e=>e.trim());return/^@(?:-[a-z]+-)?[a-z][-\w]*\b/i.test(o)||/^%[-_a-z][-\w]*$/i.test(o)||/(?:^|[\s>+~,])(?:&|[-_a-z][-\w]*|\*)?(?:[.#](?=\S)|\[[^\]]*\])/i.test(o)||/(?:^|[\s>+~,])(?:\*|[-\w]+)\|(?:\*|[-\w]+)(?=$|[\s.#:[>+~,])/i.test(o)||/^(?:(?:[a-z][-\w]*)?|&):{1,2}[-\w(]/i.test(o)||/(?:^|[\s>+~,])\\[0-9a-f]{1,6}\s?/i.test(o)||ot(o)||n&&o.includes("${")||o.includes(`#{`)||o.includes(`@{`)||c.every($e)||s.length>0&&s.every(e=>e===`*`||Xe.test(e))}function ct(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;let r=e[n];if(r!==`'`&&r!==`"`)return!1;for(n++;n<e.length;n++){let t=e[n];if(t===`\\`)n++;else if(t===r){for(n++;/\s/.test(e[n]??``);)n++;return e[n]===`:`}}return!1}function lt(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e.startsWith(`...`,n)}function ut(e,t){let n=0;for(t--;t>=0&&e[t]===`\\`;t--)n++;return n%2==1}function dt(e,t,n=0){let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;if(r<0)return!1;if(Ke.includes(e[r]))return!0;let i=r+1;for(;r>=0&&/[\w$]/.test(e[r]);)r--;let a=e.slice(r+1,i);return qe.has(a)||it(e,t,n)}const ft=new Set([`catch`,`class`,`do`,`else`,`finally`,`switch`,`try`]),pt=/^(?:(?:await\s+)?using|break|class|const|continue|debugger|declare|do|enum|export|for|function|if|import|interface|let|namespace|return|switch|throw|try|type|var|while|with)(?=$|[\s;(){}])/,mt=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*(?:\s*(?:(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*|(?:\?\.)?\[[^\]]+\]))*\s*(?:(?:\?\.)?\(|\+\+|--|[-+*/%&|^]?=(?!=|>))/u,ht=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*\s*(?:(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*)+\s*$/u,gt=/^(?:await\s+)?[$_\p{ID_Start}][$\p{ID_Continue}]*(?:\s*(?:\.|\?\.)\s*#?[$_\p{ID_Start}][$\p{ID_Continue}]*)*\s*(?:\?\.)?\[[^\]]+\]\s*$/u,_t=/^new\s+(?:class\b|function\b|[$_\p{ID_Start}])/u,vt=/^\([\s\S]*\)$/,yt=/^\([\s\S]*\)\s*(?:\(|\?\.|\.)/,bt=/^(?:(?:await|delete|typeof|void)\s+\S|yield(?:\s+\S|\s*\*\s*\S))/u,xt=/^(?:\+\+|--|!|~)\s*\S/u,St=/^\[[\s\S]*\]\s*=(?!=|>)/,Ct=new Set([`as`,`in`,`instanceof`,`satisfies`]),wt=/^(?:=(?!=|>)|\+=|-=|\*\*=|\*=|\/=|%=|&&=|&=|\|\|=|\|=|\^=|\?\?=|<<=|>>>=|>>=)/,Tt=/^(?:(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[bB][01](?:_?[01])*|0[oO][0-7](?:_?[0-7])*)n?|(?:\d(?:_?\d)*)n|(?:\d(?:_?\d)*\.(?:\d(?:_?\d)*)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|\d(?:_?\d)*(?:[eE][+-]?\d(?:_?\d)*)?)/;function Et(e){let t={closers:[]},n=!1,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=t.closers.length===0,s=V(e,i,t);if(s!==void 0){o&&(a===`(`||a===`[`)&&(n=!0),i=s;continue}if(!(t.closers.length>0)){if(a===`:`||a===`@`)return!n||r?void 0:a===`:`?`declaration`:`condition`;if(a===`!`&&i===e.length-1)return!n||r?void 0:`important`;/\s/u.test(a)?r=!0:n=!0}}}function Dt(e,t){if(bt.test(e))return!0;if(!xt.test(e))return!1;let n=Et(e);return n===void 0||t&&n===`important`}function Ot(e,t){if(!St.test(e))return!1;let n=Et(e);return n===void 0||t&&n===`important`}function kt(e,t){let n={closers:[]};for(let r=t;r<e.length;r++){let t=V(e,r,n);if(t!==void 0&&(r=t,n.closers.length===0))return r+1}}function At(e){let t={closers:[]},n=-1;for(let r=0;r<e.length;r++){let i=V(e,r,t);if(i!==void 0){r=i;continue}if(!(t.closers.length>0)){if(/\s/u.test(e[r]))return-1;n===-1&&(e[r]===`:`||e[r]===`@`)&&r>0&&(n=r)}}return n}function jt(e,t){let n=t=>{for(;t<e.length&&/\s/u.test(e[t]);)t++;return t},r=0;for(;e[r]===`+`||e[r]===`-`;)r=n(r+1);let i=nn(e,r);i?.value===`await`&&/\s/u.test(e[i.end]??``)&&(r=n(i.end),i=nn(e,r));let a;if(i!==void 0)a=`identifier`,r=i.end;else if(e[r]===`[`||e[r]===`(`){let t=kt(e,r);if(t===void 0)return!1;a=e[r]===`[`?`array`:`parenthesized`,r=t}else{let t=Tt.exec(e.slice(r));if(t===null)return!1;a=`number`,r+=t[0].length}let o=!1,s=!1;for(;r<e.length;){let t=r;if(r=n(r),e[r]===`!`&&e[r+1]!==`=`){s=!0,r++;continue}if(e[r]===`(`||e.startsWith(`?.(`,r))return!0;if(e.startsWith(`?.`,r))r=n(r+2);else if(e[r]===`.`)r=n(r+1);else if(e[r]!==`[`){r=t;break}if(e[r]===`[`){let t=kt(e,r);if(t===void 0)return!1;o=!0,s=!1,r=t;continue}if(e[r]===`#`&&r++,i=nn(e,r),i===void 0)return!1;o=!0,s=!1,r=i.end}if(r=n(r),e[r]===`(`||e.startsWith(`?.(`,r))return!0;if(o&&e.slice(r).trim().length===0)return!s||Et(e)!==`important`||t;if(a===`array`&&!o)return!1;if(e.startsWith(`++`,r)||e.startsWith(`--`,r))return e.slice(r+2).trim().length===0;let c=wt.exec(e.slice(r));return c!==null&&e.slice(r+c[0].length).trim().length>0}function Mt(e){let t=At(e),n=(t,n)=>{let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;let i=t+n;for(;i<e.length&&/\s/.test(e[i]);)i++;return r>=0&&e[r]!==`:`&&i<e.length},r=(t,r,i)=>{let a=e[r-1]??``,o=e[i]??``;return!/\s/u.test(a)&&!`)!]`.includes(a)||!/\s/u.test(o)&&!`([`.includes(o)&&!((t===`in`||t===`instanceof`)&&`!~+-`.includes(o))&&(t!==`as`&&t!==`satisfies`||o!==`-`)?!1:n(r,i-r)},i={closers:[]};for(let a=0;a<e.length;a++){let o=e[a],s=V(e,a,i);if(s!==void 0){a=s;continue}if(i.closers.length>0||t>=0&&a>t)continue;let c=e[a+1],l=nn(e,a);if(l!==void 0){if(Ct.has(l.value)&&r(l.value,a,l.end))return!0;a=l.end-1;continue}if((o===`?`||o===`<`||o===`>`)&&n(a,c===o||c===`=`||o===`?`&&c===`.`?2:1)||(o===`=`&&c===`=`||o===`!`&&c===`=`||o===`&`&&c===`&`||o===`|`&&c===`|`||o===`*`&&c===`*`)&&n(a,2)||`+-*/%&|^`.includes(o)&&(/\s/.test(e[a-1]??``)||/\s/.test(c??``))&&n(a,1)||o===`,`&&(/\s/.test(e[a-1]??``)||/\s/.test(c??``))&&n(a,1))return!0}return!1}function Nt(e,t){let n=Re(e,t);if(n.kind===`open`)return!0;if(n.kind!==`close`)return!1;let r=Ve(e.slice(t+1,n.index));if(r.length===0)return!0;let i=r.length===1;return r.some(e=>pt.test(e)||mt.test(e)||ht.test(e)||gt.test(e)||jt(e,i)||_t.test(e)||vt.test(e)||yt.test(e)||Dt(e,i)||Ot(e,i)||Mt(e))}function Pt(e,t,n=0,r=0,i=``){if(`:|&=,(`.includes(i))return!1;let a=t-1;for(;a>=0&&/\s/.test(e[a]);)a--;let o=e.slice(n,t);if(tt(e,t,n))return r>0||`:|&=,(`.includes(e[a]??``)?!1:et(e,t,n);if(/\bclass\b[^;]*$/.test(o))return nt(e,t,n);if(e[a]===`)`||e[a]===`>`)return e.slice(Math.max(n,a-1),a+1)!==`=>`;let s=a+1;for(;a>=0&&/[\w$]/.test(e[a]);)a--;let c=e.slice(a+1,s);return ft.has(c)?!0:it(e,t,n)}function Ft(){return{angleDepth:0,canEnd:!1,classParenRoles:[],forceRegex:!1,labelCandidate:!1,labelColon:-1,lastSignificant:``,lastWord:``,parenKinds:[],pendingFunctions:[],restrictedLineStatement:!1,statementStart:!0,typeDeclaration:!1}}const It=new Set([`abstract`,`async`,`declare`,`default`,`export`]),Lt=new Set([`abstract`,`asserts`,`extends`,`in`,`infer`,`is`,`keyof`,`new`,`readonly`,`typeof`,`unique`]);function Rt(e,t){let n=e.pendingFunctions.at(-1);n?.phase===`return-type`&&(n.typeCanEnd=!Lt.has(t))}function W(e,t,n){let r=e.pendingFunctions.at(-1);r?.phase===`return-type`&&(`|&?:=,(`.includes(t)||t===`[`||t===`<`?r.typeCanEnd=!1:(n||t===`]`||t===`>`||t===`)`)&&(r.typeCanEnd=!0))}function zt(e){let t=e.pendingFunctions.at(-1);if(t)return t.phase===`after-params`?(e.pendingFunctions.pop(),t.kind):t.phase===`return-type`?t.typeCanEnd?(e.pendingFunctions.pop(),t.kind):`T`:`O`}function Bt(e,t){return!e.restrictedLineStatement&&!(e.typeDeclaration&&t===0&&e.canEnd)?!1:(e.canEnd=!1,e.forceRegex=!0,e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=``,e.lastWord=``,e.restrictedLineStatement=!1,e.statementStart=!0,e.typeDeclaration=!1,!0)}function Vt(e,t=!1){e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=`;`,e.lastWord=``,t||(e.pendingFunctions.length=0),e.restrictedLineStatement=!1,e.statementStart=!0,e.typeDeclaration=!1}function G(e,t){e.canEnd=!0,e.forceRegex=!1,e.labelCandidate=!1,e.labelColon=-1,e.lastSignificant=t,e.lastWord=``,e.statementStart=!1,W(e,t,!0)}function Ht(e,t,n){if(!n||/\s/.test(e[t-1]??``))return!1;let r=t+1;for(;/\s/.test(e[r]??``);)r++;return/[A-Z_$\p{ID_Start}]/u.test(e[r]??``)}function Ut(e,t,n,r){let i=e[t],a=r?.lastWord??``;if(/\s/.test(i??``))return n;if(/[\w$\p{ID_Continue}]/u.test(i??``)){if(/[\w$\p{ID_Continue}]/u.test(e[t+1]??``))return n;let i=t;for(;i>0&&/[\w$\p{ID_Continue}]/u.test(e[i-1]??``);)i--;let a=e.slice(i,t+1),o=i-1;for(;o>=0&&/\s/.test(e[o]??``);)o--;let s=e[o]===`.`||e[o]===`#`;if(r){let e=r.statementStart;r.labelCandidate=e,r.labelColon=-1,r.lastSignificant=`word`,r.lastWord=s?``:a,!s&&a===`function`?H(r.pendingFunctions,{kind:e?`B`:`O`,phase:`before-params`,typeCanEnd:!1}):s||Rt(r,a),!s&&e&&(a===`type`||a===`import`||a===`interface`||a===`declare`||a===`export`)&&(r.typeDeclaration=!0),!s&&e&&(a===`break`||a===`continue`||a===`debugger`)&&(r.restrictedLineStatement=!0),r.statementStart=!s&&e&&It.has(a)}return s||!(qe.has(a)||Ye.has(a))}if(r&&(i!==`:`&&(r.labelCandidate=!1),i!==`{`&&(r.labelColon=-1),r.lastWord=``,r.statementStart=!1),/\d/.test(i??``)||i===`.`&&n&&/\d/.test(e[t-1]??``))return r&&(r.lastSignificant=`number`,W(r,i,!0)),!0;if(i===`]`)return r&&(r.lastSignificant=i,W(r,i,!0)),!0;if(i===`[`)return r&&(r.lastSignificant=i,W(r,i,!1)),!1;if(i===`(`){if(r){let e=r.pendingFunctions.at(-1);H(r.classParenRoles,a===`cn`?`C`:n||e?.phase===`before-params`||Ye.has(a)?`O`:`T`),e?.phase===`before-params`?(e.phase=`params`,H(r.parenKinds,`F`)):H(r.parenKinds,Ye.has(a)?`1`:`0`),r.forceRegex=!1,r.lastSignificant=i,W(r,i,!1)}return!1}if(i===`)`){if(r){r.classParenRoles.pop();let e=r.parenKinds.pop();if(r.forceRegex=e===`1`,e===`F`){let e=r.pendingFunctions.at(-1);e?.phase===`params`&&(e.phase=`after-params`)}r.lastSignificant=i,W(r,i,!0)}return!0}if(i===`<`)return r&&(Ht(e,t,n)&&r.angleDepth++,r.lastSignificant=i,W(r,i,!1)),!1;if(i===`>`)return r?.angleDepth?(r.angleDepth--,r.lastSignificant=i,W(r,i,!0),!0):(r&&(r.lastSignificant=i,W(r,i,!1)),!1);if(i===`+`||i===`-`)return r&&(r.lastSignificant=i),e[t-1]===i||e[t+1]===i?(r&&W(r,i,n),n):(r&&W(r,i,!1),!1);if(i===`:`&&r){let e=r.pendingFunctions.at(-1);return e?.phase===`after-params`&&(e.phase=`return-type`,e.typeCanEnd=!1),r.labelCandidate&&(r.labelColon=t),r.lastSignificant=i,W(r,i,!1),!1}return i===`!`&&e[t+1]!==`=`?(r&&(r.lastSignificant=i,W(r,i,n)),n):i===`}`||i===`'`||i===`"`||i==="`"?(r&&(r.lastSignificant=i,W(r,i,!0)),!0):(r&&(r.lastSignificant=i,W(r,i,!1)),!1)}function Wt(e,t,n=!1,r){if(e[t+1]===`/`||e[t+1]===`*`)return!1;if(n)return!0;if(r!==void 0)return!r;let i=t-1;for(;i>=0&&/\s/.test(e[i]);)i--;if(i<0)return!0;if((e[i]===`+`||e[i]===`-`)&&e[i-1]===e[i]||e[i]===`!`&&i>0&&/[\w$)\]]/.test(e[i-1]??``)||e[i]===`>`&&i>0&&/[\w$)>]/.test(e[i-1]??``))return!1;if(`=([{,:;!?&|+-*%^~<>`.includes(e[i]))return!0;let a=i+1;for(;i>=0&&/[\w$]/.test(e[i]);)i--;return Je.has(e.slice(i+1,a))}function Gt(e,t){let n=!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`
7
+ `||t===`\r`||t===`\u2028`||t===`\u2029`)return{end:-1,failedUntil:r};if(t===`\\`)r++;else if(t===`[`)n=!0;else if(t===`]`)n=!1;else if(t===`/`&&!n){for(r++;/[a-z]/i.test(e[r]??``);)r++;return{end:r,failedUntil:r}}}return{end:-1,failedUntil:e.length}}function Kt(e,t){let n=e[t+1]===`/`,r=t+(n?2:1),i=r;if(e[r]!==`>`){let t=e.codePointAt(r);if(t===void 0)return;let a=String.fromCodePoint(t);if(!$t.test(a))return;for(i+=a.length;i<e.length;){let t=e.codePointAt(i);if(t===void 0)break;let n=String.fromCodePoint(t);if(!en.test(n)&&!`:.-`.includes(n))break;i+=n.length}let o=e[i];if(!/[\s/>]/.test(o??``)&&!(o===`<`&&!n))return}return{closing:n,name:e.slice(r,i),nameEnd:i}}function qt(e,t,n){let r=n.get(t);if(r!==void 0)return r;let i=!1,a=!1,o=[],s;for(let r=t;r<e.length;r++){let c=e[r],l=e[r+1];if(a)(c===`
8
+ `||c===`\r`||c===`\u2028`||c===`\u2029`)&&(a=!1);else if(i)c===`*`&&l===`/`&&(i=!1,r++);else if(s)c===`\\`?r++:c===s&&(s=void 0);else if(c===`/`&&l===`/`)a=!0,r++;else if(c===`/`&&l===`*`)i=!0,r++;else if(c===`'`||c===`"`||c==="`")s=c;else if(c===`<`)H(o,r);else if(c===`>`&&e[r-1]!==`=`){let e=o.pop();if(e!==void 0&&(n.set(e,r),e===t))return r}}for(let e of o)n.set(e,-1);return-1}function Jt(e,t,n){return!t.closing&&e[t.nameEnd]===`<`?qt(e,t.nameEnd,n):-1}function Yt(e,t=0){return{blockComment:!1,braceDepth:+!!e,braceKinds:[],declarationBoundary:t,expression:Ft(),failedRegexUntil:-1,kind:`host`,lineComment:!1,terminating:e}}function Xt(e){let t=e.at(-1);t?.kind===`host`&&G(t.expression,`jsx`)}function Zt(e,t,n){for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`\\`)r=U(e,r,n==="`")-1;else if(t===n)return r+1}return-1}const Qt=new Set(`break.case.catch.class.const.continue.debugger.default.delete.do.else.enum.export.extends.false.finally.for.function.if.import.in.instanceof.new.null.return.super.switch.this.throw.true.try.typeof.var.void.while.with`.split(`.`)),$t=/^[$_\p{ID_Start}]$/u,en=/^(?:[$\p{ID_Continue}]|\u200c|\u200d)$/u;function tn(e,t){if(e[t]!==`\\`||e[t+1]!==`u`)return;if(e[t+2]===`{`){let n=0,r=t+3,i=0;for(;/^[0-9a-f]$/i.test(e[r]??``);){if(i=i*16+Number.parseInt(e[r],16),i>1114111)return;n++,r++}return n===0||e[r]!==`}`?void 0:{character:String.fromCodePoint(i),end:r+1}}let n=e.slice(t+2,t+6);if(/^[0-9a-f]{4}$/i.test(n))return{character:String.fromCodePoint(Number.parseInt(n,16)),end:t+6}}function nn(e,t){let n=[],r=!1,i=t,a=!0;for(;i<e.length;){let t=tn(e,i),o=t?.character??String.fromCodePoint(e.codePointAt(i));if(!(a?$t.test(o):en.test(o)))break;H(n,o),r||=t!==void 0,i=t?.end??i+o.length,a=!1}return a?void 0:{end:i,escaped:r,value:n.join(``)}}function rn(e,t,n){let r=[],i=!1,a=!1,o=!1,s=!0,c=!1,l=`start`,u=!1,d;for(let f=t+1;f<n;f++){let t=e[f],n=e[f+1];if(o){(t===`
9
+ `||t===`\r`||t===`\u2028`||t===`\u2029`)&&(o=!1);continue}if(i){t===`*`&&n===`/`&&(i=!1,f++);continue}if(d){t===`\\`?f++:t===d&&(d=void 0);continue}if(t===`/`&&n===`/`){o=!0,f++;continue}if(t===`/`&&n===`*`){i=!0,f++;continue}if(t===`'`||t===`"`||t==="`"){if(r.length===0&&l!==`constraint`&&l!=="default")return!1;d=t,u=!0;continue}if(t===`(`||t===`[`||t===`{`||t===`<`){if(r.length===0&&l!==`constraint`&&l!=="default")return!1;H(r,t===`(`?`)`:t===`[`?`]`:t===`{`?`}`:`>`),u=!0;continue}if(t===r.at(-1)){r.pop();continue}if(r.length>0||/\s/.test(t))continue;if(t===`,`)return!(l===`start`||l===`after-const`||(l===`constraint`||l==="default")&&!u);if(t===`=`){if(n===`>`){if(l!==`constraint`&&l!=="default")return!1;u=!0,f++;continue}if(l===`constraint`&&!u||l!==`after-name`&&l!==`constraint`)return!1;a=!0,l=`default`,u=!1;continue}let p=nn(e,f);if(p){let e=p.value;if(l===`start`)!p.escaped&&e===`const`?l=`after-const`:(c=!0,s=!Qt.has(e),l=`after-name`);else if(l===`after-const`)c=!0,s=!Qt.has(e),l=`after-name`;else if(l===`after-name`){if(p.escaped||e!==`extends`)return!1;a=!0,l=`constraint`,u=!1}else u=!0;f=p.end-1}else{if(t===`/`||l!==`constraint`&&l!=="default")return!1;u=!0}}return!c||!s||!a||l===`after-const`||(l===`constraint`||l==="default")&&!u?!1:l===`after-name`||l===`constraint`||l==="default"}function an(e,t){let n=t;for(;n<e.length;)if(/\s/.test(e[n]))n++;else if(e[n]===`/`&&e[n+1]===`/`)for(n+=2;n<e.length&&e[n]!==`
10
+ `&&e[n]!==`\r`&&e[n]!==`\u2028`&&e[n]!==`\u2029`;)n++;else if(e[n]===`/`&&e[n+1]===`*`){let t=e.indexOf(`*/`,n+2);if(t===-1)return e.length;n=t+2}else break;return n}function on(e,t,n){let r=qt(e,t,n);return r===-1||!rn(e,t,r)?-1:e[an(e,r+1)]===`(`?r:-1}function sn(e,t,n){let r=new Set,i=[Yt(!1)],a=0;for(;a<e.length;){let o=i.at(-1),s=e[a],c=e[a+1];if(o.kind===`template`){s===`\\`?a=U(e,a,!0):s==="`"?(i.pop(),Xt(i),a++):s===`$`&&c===`{`?(H(i,Yt(!0)),a+=2):a++;continue}if(o.kind===`element`){if(n===`auto`&&(s===`'`||s===`"`||s==="`")&&a>=o.failedQuoteUntil[s]){let t=Zt(e,a,s);if(t!==-1){a=t;continue}o.failedQuoteUntil[s]=e.length}if(n===`auto`&&s===`/`&&c===`*`&&a>=o.failedBlockCommentUntil){let t=e.indexOf(`*/`,a+2);if(t!==-1){a=t+2;continue}o.failedBlockCommentUntil=e.length}if(s===`{`){H(i,Yt(!0,a+1)),a++;continue}if(s!==`<`){a++;continue}let r=Kt(e,a);if(!r){a++;continue}H(i,{blockComment:!1,closing:r.closing,kind:`tag`,name:r.name,opening:a,typeEnd:Jt(e,r,t)}),a=r.nameEnd;continue}if(o.kind===`tag`){if(o.blockComment){s===`*`&&c===`/`?(o.blockComment=!1,a+=2):a++;continue}if(o.quote){s===`\\`?a=U(e,a):(s===o.quote&&(o.quote=void 0),a++);continue}if(s===`/`&&c===`*`){o.blockComment=!0,a+=2;continue}if(s===`'`||s===`"`){o.quote=s,a++;continue}if(a<=o.typeEnd){a++;continue}if(s===`<`){i.pop();continue}if(s===`{`){H(i,Yt(!0,a+1)),a++;continue}if(s!==`>`){a++;continue}let t=a-1;for(;/\s/.test(e[t]??``);)t--;let n=!o.closing&&e[t]===`/`;if(i.pop(),o.closing){let e=i.at(-1);e?.kind===`element`&&e.name===o.name&&(i.pop(),r.add(e.opening),Xt(i))}else n?(r.add(o.opening),Xt(i)):H(i,{failedBlockCommentUntil:-1,failedQuoteUntil:{'"':-1,"'":-1,"`":-1},kind:`element`,name:o.name,opening:o.opening});a++;continue}if(o.lineComment){(s===`
11
+ `||s===`\r`||s===`\u2028`||s===`\u2029`)&&(o.lineComment=!1,Bt(o.expression,o.braceDepth)),a++;continue}if(o.blockComment){s===`*`&&c===`/`?(o.blockComment=!1,a+=2):a++;continue}if(o.quote){s===`\\`?a=U(e,a):(s===o.quote&&(o.quote=void 0,G(o.expression,`string`)),a++);continue}if(s===`/`&&c===`/`){o.lineComment=!0,a+=2;continue}if(s===`/`&&c===`*`){o.blockComment=!0,a+=2;continue}if(s===`'`||s===`"`){o.quote=s,a++;continue}if(s==="`"){H(i,{kind:`template`}),a++;continue}if(s===`\\`){let t=tn(e,a);if(t){a=t.end,G(o.expression,`word`);continue}}if(s===`/`&&a>=o.failedRegexUntil&&Wt(e,a,o.expression.forceRegex,o.expression.canEnd)){let t=Gt(e,a);if(t.end!==-1){a=t.end,G(o.expression,`regex`);continue}o.failedRegexUntil=t.failedUntil}if(s===`<`&&!o.expression.canEnd){let r=Kt(e,a);if(r&&!r.closing){let o=n===`tsx`?on(e,a,t):-1;if(o!==-1){a=o+1;continue}H(i,{blockComment:!1,closing:!1,kind:`tag`,name:r.name,opening:a,typeEnd:Jt(e,r,t)}),a=r.nameEnd;continue}}if(s===`{`){let t=zt(o.expression),n=o.expression.labelColon>=0,r=o.expression.statementStart&&(o.braceKinds.at(-1)===`B`||o.declarationBoundary>0||o.braceKinds.length===0&&Nt(e,a)),i=o.expression.forceRegex||n||r?`B`:t??(Pt(e,a,o.declarationBoundary,o.expression.parenKinds.length,o.expression.lastSignificant)?`B`:`O`);H(o.braceKinds,i),o.braceDepth++,o.expression.canEnd=!1,o.expression.forceRegex=!1,o.expression.labelCandidate=!1,o.expression.labelColon=-1,o.expression.lastSignificant=`{`,o.expression.lastWord=``,o.expression.statementStart=i===`B`,a++;continue}if(s===`}`&&o.braceDepth>0){if(o.braceDepth--,o.terminating&&o.braceDepth===0)i.pop();else{let e=o.braceKinds.pop();o.expression.canEnd=e!==`B`,o.expression.forceRegex=e===`B`,o.expression.labelCandidate=!1,o.expression.labelColon=-1,o.expression.lastSignificant=`}`,o.expression.lastWord=``,o.expression.statementStart=e===`B`,e===`B`&&(o.declarationBoundary=a+1)}a++;continue}if((s===`
12
+ `||s===`\r`||s===`\u2028`||s===`\u2029`)&&Bt(o.expression,o.braceDepth)){a++;continue}/\s/.test(s)||(o.expression.forceRegex=!1),o.expression.canEnd=Ut(e,a,o.expression.canEnd,o.expression),s===`;`&&(Vt(o.expression,o.braceKinds.at(-1)===`T`),o.braceKinds.length===0&&(o.declarationBoundary=a+1)),a++}return r}function cn(e,t,n){return!t&&n.has(e)}function ln(e,t){for(;t>=0&&/\s/.test(e[t]??``);)t--;if(e[t]!==`=`)return!1;for(t--;t>=0&&/\s/.test(e[t]??``);)t--;let n=t+1;for(;t>=0&&/[\w$-]/.test(e[t]??``);)t--;let r=e.slice(t+1,n);return r===`class`||r===`className`}function un(e,t){return ln(e,t-1)}function dn(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]??``);)n--;return e[n]===`{`?ln(e,n-1):ln(e,n)}function fn(e){for(let t=e.classParenRoles.length-1;t>=0;t--){let n=e.classParenRoles[t];if(n!==`T`)return n===`C`}return!1}function pn(e,t,n){let r=t-1;for(;r>=0&&/\s/.test(e[r]??``);)r--;return e[r]===`(`?n.classParenRoles.at(-1)===`T`:e[r]===`[`||e[r]===`?`||e[r]===`:`||e[r]===`&`&&e[r-1]===`&`||e[r]===`|`&&e[r-1]===`|`}function mn(e,t,n,r,i){if(r===`block`){let n=e.indexOf(`*/`,t);return n===-1?e.length:n}if(r===`line`){for(let n=t;n<e.length;n++){let t=e[n];if(t===`
13
+ `||t===`\r`||t===`\u2028`||t===`\u2029`)return n}return e.length}if(n){for(let r=t;r<e.length;r++){let t=e[r];if(t===`\\`)r=U(e,r)-1;else if(t===n||t===`
14
+ `||t===`\r`||t===`\u2028`||t===`\u2029`)return r}return e.length}if(i)for(let n=t;n<e.length;n++){let t=e[n];if(t===`\\`)n=U(e,n,!0)-1;else if(t==="`"||t===`$`&&e[n+1]===`{`)return n}return e.length}function hn(e,t,n){if(!e.includes(`{`))return e;let r=new Map,i=t!==`none`&&e.includes(`<`)?sn(e,r,t):new Set,a=``,o=0,s,c,l=!1,u=-1,d=0,f=[],p=0,m=-1,h=Ft(),g,_=0,v=!1,y=0,b=0,x,S=-1,C=[],w=[],T=[],E=[],D=-1;for(;o<e.length;){let O=e[o];if(g){let t=We(e,o,g);a+=e.slice(o,t),o=t,g.depth===0&&(g=void 0,_=t);continue}if(c){if(c===`line`&&(O===`
15
+ `||O===`\r`||O===`\u2028`||O===`\u2029`)){c=void 0,u=-1,d=0,Bt(h,f.length)&&(p=o+1),a+=O,o++;continue}if(c===`block`&&O===`*`&&e[o+1]===`/`){c=void 0,u=-1,d=0,a+=`*/`,o+=2;continue}if(O!==`{`){a+=O,o++;continue}}else if(s){if(O===`
16
+ `||O===`\r`||O===`\u2028`||O===`\u2029`){s=void 0,l=!1,u=-1,d=0,G(h,`string`),a+=O,o++;continue}if(O===`\\`){let t=U(e,o);a+=e.slice(o,t),o=t;continue}if(O===s){s=void 0,l=!1,u=-1,d=0,G(h,`string`),a+=O,o++;continue}if(O!==`{`){a+=O,o++;continue}}else if(E.at(-1)?.inText){let t=E.at(-1);if(O===`\\`){let t=U(e,o,!0);a+=e.slice(o,t),o=t;continue}if(O==="`"){E.pop(),G(h,`template`),a+=O,o++;continue}if(O===`{`&&e[o-1]===`$`){t.groupLimit=-1,t.inText=!1,t.interpolationDepth=1,H(f,`I`),h.canEnd=!1,h.forceRegex=!1,h.lastSignificant=`{`,h.lastWord=``,a+=O,o++;continue}if(t.css){let n=We(e,o,t.css);a+=e.slice(o,n),o=n,t.css.depth===0&&(t.css=void 0,t.cssBoundary=n);continue}if(O!==`{`){a+=O,o++;continue}}else if(x===`text`){if(O===`{`){let n=t===`auto`?Ue(e,o):void 0;if(n){D===o&&a.length>0&&!/\s/.test(a.at(-1))&&(a+=` `),a+=n.value,D=n.end,o=n.end;continue}H(w,`T`),x=void 0,H(f,`J`),b++,H(C,!1),h.canEnd=!1,h.forceRegex=!1,h.lastSignificant=`{`,h.lastWord=``}else if(O===`<`&&(e[o+1]===`/`||e[o+1]===`>`||/[A-Z_$a-z]/.test(e[o+1]??``))){v=e[o+1]===`/`,x=`tag`;let t=Kt(e,o);S=t?Jt(e,t,r):-1}a+=O,o++;continue}else if(x===`tag`&&o<=S){a+=O,o++;continue}else if(x===`tag`&&O===`{`){H(w,`G`),x=void 0,H(f,`J`),b++,H(C,un(e,o)),h.canEnd=!1,h.forceRegex=!1,h.lastSignificant=`{`,h.lastWord=``,a+=O,o++;continue}else if(x===`tag`&&O===`>`){let t=o-1;for(;/\s/.test(e[t]??``);)t--;let n=e[t]===`/`;v?y=Math.max(0,y-1):n||y++;let r=T.at(-1);r&&y===r.baseDepth&&(v||n)?(T.pop(),x=r.resumeExpression?void 0:y>0?`text`:void 0,G(h,`jsx`)):x=`text`,v=!1,S=-1,a+=O,o++;continue}else if(x===`tag`&&O!==`'`&&O!==`"`){a+=O,o++;continue}else if(O===`<`&&cn(o,h.canEnd,i)){H(T,{baseDepth:y,resumeExpression:b>0}),v=!1,x=`tag`;let t=Kt(e,o);S=t?Jt(e,t,r):-1,a+=O,o++;continue}else if(O===`\\`){let t=tn(e,o);if(t){a+=e.slice(o,t.end),o=t.end,G(h,`word`);continue}}else if(O===`'`||O===`"`){s=O,l=dn(e,o)||fn(h)||x===void 0&&C.at(-1)===!0&&pn(e,o,h),u=-1,d=o+1,a+=O,o++;continue}else if(O==="`"){H(E,{classLiteral:dn(e,o)||fn(h)||x===void 0&&C.at(-1)===!0&&pn(e,o,h),cssBoundary:o+1,groupLimit:-1,inText:!0,interpolationDepth:0}),a+=O,o++;continue}else if(O===`/`&&e[o+1]===`/`){c=`line`,u=-1,d=o+2,a+=`//`,o+=2;continue}else if(O===`/`&&e[o+1]===`*`){c=`block`,u=-1,d=o+2,a+=`/*`,o+=2;continue}else if(O===`/`&&o>=m&&Wt(e,o,h.forceRegex,h.canEnd)){let t=Gt(e,o);if(t.end!==-1){a+=e.slice(o,t.end),o=t.end,G(h,`regex`);continue}m=t.failedUntil}if(O===`}`){let e=f.pop(),t=E.at(-1);if(t&&!t.inText&&(t.interpolationDepth--,t.interpolationDepth===0&&(t.groupLimit=-1,t.inText=!0)),e===`J`&&(b--,C.pop(),x=w.at(-1)===`G`?`tag`:`text`,w.pop()),e===`T`){let e=h.pendingFunctions.at(-1);e?.phase===`return-type`&&(e.typeCanEnd=!0)}h.canEnd=e!==`B`,h.forceRegex=e===`B`,h.labelCandidate=!1,h.labelColon=-1,h.lastSignificant=`}`,h.lastWord=``,h.statementStart=e===`B`,e===`B`&&(p=o+1),a+=O,o++;continue}if(O!==`{`){(O===`
17
+ `||O===`\r`||O===`\u2028`||O===`\u2029`)&&Bt(h,f.length)&&(p=o+1),/\s/.test(O)||(h.forceRegex=!1),h.canEnd=Ut(e,o,h.canEnd,h),O===`;`&&(Vt(h,f.at(-1)===`T`),f.length===0&&(p=o+1)),a+=O,o++;continue}let k=c===void 0&&s===void 0&&!E.at(-1)?.inText,A=k?zt(h):void 0,j=k&&h.labelColon>=0,ee=k&&h.statementStart&&(f.at(-1)===`B`||p>0||f.length===0&&Nt(e,o));if(k&&(f.length>0||A!==void 0||j||ee||h.forceRegex||h.lastSignificant&&Ke.includes(h.lastSignificant)||qe.has(h.lastWord)||dt(e,o,Math.max(p,_))||ct(e,o)||lt(e,o))){let t=h.forceRegex||j||ee?`B`:A??(Pt(e,o,p,h.parenKinds.length,h.lastSignificant)?`B`:`O`);H(f,t);let n=E.at(-1);n&&!n.inText&&n.interpolationDepth++,h.canEnd=!1,h.forceRegex=!1,h.labelCandidate=!1,h.labelColon=-1,h.lastSignificant=`{`,h.lastWord=``,h.statementStart=t===`B`,a+=O,o++;continue}let M=E.at(-1),N=e.length;if(s||c?(u<o&&(u=mn(e,o+1,s,c,!1)),N=u):M?.inText&&(M.groupLimit<o&&(M.groupLimit=mn(e,o+1,void 0,void 0,!0)),N=M.groupLimit),(e[o-1]===`#`||e[o-1]===`@`)&&!ut(e,o-1)){let t=Ge(e,o,N);if(t!==-1){a+=e.slice(o,t+1),o=t+1;continue}}let P=M?.inText===!0,F=s===void 0&&c===void 0&&!P?Re(e,o,N):Le(e,o,N),I=F.kind===`close`?F.index:-1,te=M===void 0||P||s!==void 0||c!==void 0,ne=P?M.cssBoundary:s||c?d:_,re=te&&!l&&!(P&&M.classLiteral)&&st(e,o,P,ne),L=re?Ge(e,o,N):-1;if(re&&(s===void 0&&c===void 0||L!==-1)&&(L===-1||e[L+1]!==`@`)){let e={blockComment:!1,depth:1,lineComment:!1,parenDepth:0};P?M.css=e:g=e,a+=O,o++;continue}if(F.kind!==`close`){F.kind===`open`&&n&&(n.seen=!0),a+=e.slice(o,F.index),o=F.index,P?M.cssBoundary=F.index:s||c?d=F.index:_=F.index;continue}let ie=e.slice(o+1,I),{conds:R,end:z}=Be(e,I+1,N),ae=Ve(ie);if(ae.length===0){a+=O,o++;continue}D===o&&a.length>0&&!/\s/.test(a.at(-1))&&(a+=` `),a+=ae.map(e=>`${e}${R}`).join(` `),D=z,P?M.cssBoundary=z:s||c?d=z:_=z,o=z}return a}function gn(e){return hn(e,`auto`)}function _n(e,t){let n={seen:!1};return{code:hn(e,t,n),nestedOpening:n.seen}}const vn=/^(?:--?[\w-]+|[A-Z_$][\w$-]*|@teacss-skip-bracket-[\da-z]{6})$/i;function yn(e,t){let n=t;for(;n>0&&/[\w-]/.test(e[n-1]);)n--;if(n===t||e[n-1]!==`:`)return!1;let r=n-1,i=r;for(;i>0&&/[\w$@-]/.test(e[i-1]);)i--;if(!vn.test(e.slice(i,r)))return!1;let a=i-1;for(;a>=0&&/\s/.test(e[a]);)a--;return a<0||!`{,?`.includes(e[a])}function bn(e){let t=[],n=[],r=[],i=!1,a;for(let o=0;o<e.length;o++){let s=e[o],c=e[o+1];if(n.length===0){s===`(`&&yn(e,o)&&H(n,{attached:!0,start:o});continue}if(i)s===`*`&&c===`/`&&(i=!1,o++);else if(a)s===`\\`?o++:s===a&&(a=void 0);else if(s===`\\`)o++;else if(s===`/`&&c===`*`)i=!0,o++;else if(s===`'`||s===`"`||s==="`")a=s;else if(r.length>0)s===`[`||s===`(`?H(r,s===`[`?`]`:`)`):s===r.at(-1)&&r.pop();else if(s===`[`)H(r,`]`);else if(s===`(`)H(n,{attached:yn(e,o),start:o});else if(s===`)`){let e=n.pop();e.attached&&H(t,{end:o+1,start:e.start})}}let o=[];for(let e of t.sort((e,t)=>e.start-t.start||t.end-e.end))(o.length===0||e.start>=o.at(-1).end)&&H(o,e);return o}function xn(e){let t={seen:!1},n=Sn(e,t);for(let e=1;e<5&&t.seen;e++){t.seen=!1;let e=Sn(n,t);if(e===n)break;n=e}return n}function Sn(e,t){if(!e.includes(`{`))return e;let n=``,r=0,i=-1,a=0,o=0,s=e.includes(`[`)?Ie(e):[],c=e.includes(`(`)?bn(e):[],l={closers:[]};for(;r<e.length;){for(;a<s.length&&s[a].end<=r;)a++;for(;o<c.length&&c[o].end<=r;)o++;let u=a<s.length?s[a]:void 0,d=o<c.length?c[o]:void 0,f=u?.start===r?u:d?.start===r?d:void 0;if(f&&l.blockComment!==!0&&l.quote===void 0){n+=e.slice(r,f.end),r=f.end;continue}l.closers.length>0&&/\s/.test(e[r])&&(l.blockComment=!1,l.closers.length=0,l.quote=void 0);let p=V(e,r,l);if(p!==void 0){n+=e.slice(r,p+1),r=p+1;continue}let m=e[r];if(l.closers.length>0||m!==`{`){n+=m,r++;continue}let h=Le(e,r);if(h.kind!==`close`){h.kind===`open`&&t&&(t.seen=!0),n+=e.slice(r,h.index),r=h.index;continue}let g=h.index,_=e.slice(r+1,g),{conds:v,end:y}=Be(e,g+1),b=Ve(_);if(b.length===0){n+=m,r++;continue}i===r&&n.length>0&&!/\s/.test(n.at(-1))&&(n+=` `),n+=b.map(e=>`${e}${v}`).join(` `),i=y,r=y}return n}function Cn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function wn(e){let t=e.length,n=-1,r,i=``,a=e.charCodeAt(0);for(;++n<t;){if(r=e.charCodeAt(n),r===0){i+=`�`;continue}if(r===37){i+=`\\%`;continue}if(r===44){i+=`\\,`;continue}if(r>=1&&r<=31||r===127||n===0&&r>=48&&r<=57||n===1&&r>=48&&r<=57&&a===45){i+=`\\${r.toString(16)} `;continue}if(n===0&&t===1&&r===45){i+=`\\${e.charAt(n)}`;continue}if(r>=128||r===45||r===95||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122){i+=e.charAt(n);continue}i+=`\\${e.charAt(n)}`}return i}const Tn=wn,En=/^[\da-z]{6}$/,Dn=/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/;function On(e){return e.replace(/\?.*$/,``)}function kn(e){return Dn.test(e)}function An(e){let t,n,r=2166136261;for(t=0,n=e.length;t<n;t++)r^=e.charCodeAt(t),r+=(r<<1)+(r<<4)+(r<<7)+(r<<8)+(r<<24);return`00000${(r>>>0).toString(36)}`.slice(-6)}function jn(e,t){let n=new Set,r=t.length+6;for(let i=0;i+r<=e.length;){let a=e.indexOf(t,i);if(a===-1||a+r>e.length)break;let o=e.slice(a,a+r);En.test(o.slice(t.length))&&n.add(o),i=a+1}return n}function Mn(e){let t=e.keys().next().value;if(t===void 0||t.length<6)return;let n=t.slice(0,-6);if(!(!n||/[\da-z]/.test(n[0]))){for(let t of e.keys())if(t.length!==n.length+6||!t.startsWith(n)||!En.test(t.slice(n.length)))return;return RegExp(`${Cn(n)}[\\da-z]{6}`,`g`)}}function Nn(e,t,n,r){let i=jn(e,r),a=new Set([...t.keys(),...i]);return e.replace(n,e=>{let n=0,o;for(;o=`${r}${An(n?`${e}:${n}`:e)}`,n++,!(t.get(o)===e&&!i.has(o)||!a.has(o)););return a.add(o),t.set(o,e),o})}function Pn(e,t){let n=Mn(t);if(n!==void 0)return e.replace(n,e=>t.get(e)??e);let r=[...t.keys()].filter(Boolean).sort((e,t)=>t.length-e.length);if(!r.length)return e;let i=new RegExp(r.map(Cn).join(`|`),`g`);return e.replace(i,e=>t.get(e)??e)}function Fn(e,t,n){try{let r=[];return String.prototype.replace.call(e,t,(...e)=>{let t=e.length>0&&typeof e.at(-1)==`object`,n=e[e.length-(t?3:2)];return Object.defineProperty(r,r.length,{configurable:!0,enumerable:!0,value:{args:e,end:n+String(e[0]).length,start:n},writable:!0}),e[0]}),Promise.all(r.map(({args:e})=>Promise.resolve(n(e[0],...e.slice(1))))).then(t=>{let n=0,i=``;for(let a=0;a<r.length;a++){let o=r[a];o.start<n||(i+=e.slice(n,o.start)+t[a],n=o.end)}return i+e.slice(n)})}catch(e){return Promise.reject(e)}}const In=/[\\:]?[\s'"`;{}]+/g,Ln=new RegExp(In.source,In.flags),Rn=/([\\:]?[\s"'`;<>]|:\(|\)"|\)\s)/g,zn=`@teacss-skip-bracket-`,Bn=/@teacss-skip-bracket-[\da-z]{6}/g,Vn=/[\s'"`;{}]/;function Hn(e,t){return e[t+1]!==`/`&&/[A-Z_$]/i.test(e[t+1]??``)}function Un(e,t,n){if(n>0)return!0;if(!/\s/.test(e[t-1]??``))return!1;let r=t-1;for(;r>=0&&/\s/.test(e[r]);)r--;return e[r]!==`=`}function Wn(e){return e!==void 0&&/\.html?$/i.test(e.split(/[?#]/,1)[0])}function Gn(e){return e!==void 0&&/\.(?:[cm]?[jt]sx?|mdx)$/i.test(e.split(/[?#]/,1)[0])}function Kn(e){if(e===void 0)return`auto`;let t=e.split(/[?#]/,1)[0];return/\.(?:[cm]?ts)$/i.test(t)?`none`:/\.tsx$/i.test(t)?`tsx`:/\.(?:jsx|mdx)$/i.test(t)?`raw`:`auto`}function qn(e,t){let n=[],r=[],i=!1,a=0,o=!1,s=!1,c;for(let l=0;l<e.length;l++){let u=e[l],d=e[l+1];if(!o){if(e.startsWith(`<!--`,l)){let t=e.indexOf(`-->`,l+4);if(t===-1)break;l=t+2}else u===`<`&&Hn(e,l)&&(o=!0,r=[]);continue}if(s){(u===`
18
+ `||u===`\r`||u===`\u2028`||u===`\u2029`)&&(s=!1);continue}if(i){u===`*`&&d===`/`&&(i=!1,l++);continue}if(c){u===`\\`?l++:u===c&&(c=void 0);continue}if(u===`/`&&d===`*`&&Un(e,l,a)){i=!0,l++;continue}if(u===`/`&&d===`/`&&Un(e,l,a)){s=!0,l++;continue}if(u===`"`||u===`'`||u==="`"){c=u;continue}if(a>0){u===`{`?a++:u===`}`&&a--;continue}if(u===`{`){a=1;continue}if(u===`>`){for(let e of r)B(n,e);r=[],o=!1;continue}if(!/\s/.test(e[l-1]??``)||e.slice(l,l+5).toLowerCase()!==`class`)continue;let f=l+5;for(;/\s/.test(e[f]??``);)f++;if(e[f]!==`=`)continue;for(f++;/\s/.test(e[f]??``);)f++;if(!e[f]||(t?/[\s"'`=<>]/:/[\s"'`={<>]/).test(e[f]))continue;let p=f+1;for(;p<e.length&&!/[\s"'`=<>]/.test(e[p]);)p++;B(r,{end:p,start:l,valueStart:f}),l=p-1}if(n.length===0)return e;let l=[],u=0;for(let{end:t,start:r,valueStart:i}of n){let n=e.slice(i,t);B(l,e.slice(u,r)),B(l,` `.repeat(t-r-n.length-2)),B(l,`"${n}"`),u=t}return B(l,e.slice(u)),l.join(``)}function Jn(e){if(!e)return!1;let t=e.charCodeAt(0);switch(t){case 9:case 10:case 11:case 12:case 13:case 32:case 34:case 39:case 59:case 96:case 123:case 125:return!0;default:return t>127&&Vn.test(e)}}function Yn(e){let t=e?.charCodeAt(0);return t===10||t===13||t===8232||t===8233}function Xn(e,t){return e[t+1]===`\r`&&e[t+2]===`
19
+ `?t+2:t+1}function Zn(e,t){let n=t;for(;/\s/.test(e[n]??``);)n++;if(e[n]!==`:`)return!1;for(n++;/\s/.test(e[n]??``);)n++;return e[n]===`[`&&Pe(e,n)}const Qn=new Set([`await`,`break`,`case`,`continue`,`debugger`,`delete`,`do`,`else`,`in`,`instanceof`,`new`,`of`,`return`,`throw`,`typeof`,`void`,`yield`]),$n=new Set([`for`,`if`,`while`,`with`]);function er(e,t){let n=0;for(;t>0&&e[--t]===`\\`;)n++;return n%2==1}function tr(e,t){let n=0;for(let r=t;r>=0;r--){let t=e[r];if(t===`"`||t===`'`||t==="`"){let n=r-1;for(;n>=0&&(e[n]!==t||er(e,n));)n--;if(n<0)return!1;r=n}else if(t===`/`&&e[r-1]===`*`){let t=e.lastIndexOf(`/*`,r-2);if(t<0)return!1;r=t}else if(t===`)`)n++;else if(t===`(`){if(n--,n!==0)continue;let t=r;for(;t>0&&/\s/.test(e[t-1]);)t--;let i=t;for(;i>0&&/[\w$]/.test(e[i-1]);)i--;return i>0&&/[\w$.]/.test(e[i-1])?!1:$n.has(e.slice(i,t))}}return!1}function nr(e,t){let n=0;for(let r=t;r>=0;r--){let t=e[r];if(t===`"`||t===`'`||t==="`"){let n=r-1;for(;n>=0&&(e[n]!==t||er(e,n));)n--;if(n<0)return-1;r=n}else if(t===`/`&&e[r-1]===`*`){let t=e.lastIndexOf(`/*`,r-2);if(t<0)return-1;r=t}else if(t===`}`)n++;else if(t===`{`&&(n--,n===0))return r}return-1}function rr(e,t){for(;t>0&&/\s/.test(e[t-1]);)t--;let n=t;for(;n>0&&/[\w$]/.test(e[n-1]);)n--;return{start:n,value:e.slice(n,t)}}function ir(e,t){let n=nr(e,t);if(n<0)return!1;let r=n;for(;r>0&&/\s/.test(e[r-1]);)r--;if(r===0)return!0;let i=e[r-1];if(i===`)`||i===`>`&&e[r-2]===`=`||`;{}:`.includes(i))return!0;let a=rr(e,r);return[`catch`,`class`,`do`,`else`,`finally`,`static`,`try`].includes(a.value)?!0:a.value?rr(e,a.start).value===`class`:!1}function ar(e,t){if(e[t+1]===`/`||e[t+1]===`*`||e[t-1]===`<`&&(e[t+1]===`>`||/[A-Z_$]/i.test(e[t+1]??``)))return!1;let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n--;if(n<0)return!0;if((e[n]===`+`||e[n]===`-`)&&e[n-1]===e[n]||e[n]===`!`&&n>0&&/[\w$)\]]/.test(e[n-1]??``)||e[n]===`>`&&n>0&&/[\w$)>]/.test(e[n-1]??``))return!1;if(`=([{,:;!?&|+-*%^~<>`.includes(e[n])||e[n]===`)`&&tr(e,n)||e[n]===`}`&&ir(e,n))return!0;let r=n+1;for(;n>=0&&/[\w$]/.test(e[n]);)n--;let i=e.slice(n+1,r);return Qn.has(i)?!0:i==="default"&&rr(e,n+1).value===`export`}function or(e,t){let n=!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(Yn(t))return-1;if(t===`\\`)r++;else if(t===`[`)n=!0;else if(t===`]`)n=!1;else if(t===`/`&&!n){for(r++;/[a-z]/i.test(e[r]??``);)r++;return r}}return-1}function sr(e,t=!1){let n=[],r=[],i=[],a=!1,o=!1,s,c=-1,l,u=-1,d=!1;for(let f=0;f<e.length;f++){let p=e[f];if(!a&&!s&&p===`/`&&ar(e,f)){let t=or(e,f);if(t!==-1){f=t-1,d=!1;continue}}if(n.length===0){Jn(p)?d=!1:p===`/`&&(d=!0),p===`[`&&(B(n,f),o=d&&e[f-1]!==`:`&&e[f-1]!==`@`,i=[],l=void 0);continue}if(Jn(p)&&(u=f),Yn(p)){n.length=0,i=[],a=!1,o=!1,s=void 0,c=-1,l=void 0;continue}if((a||s)&&/\s/.test(p)&&(l??=we(e,n.at(-1),!1,f),l===void 0)){n.length=0,i=[],a=!1,o=!1,s=void 0,c=-1;continue}if(!a&&!s&&p===`/`&&o){n.length=0,i=[],o=!1,c=-1;continue}if(a){p===`*`&&e[f+1]===`/`&&(a=!1,f++);continue}if(s){p===`\\`?(Yn(e[f+1])?(n.length=0,i=[],a=!1,s=void 0,c=-1):Jn(e[f+1])&&(u=f+1),f++):p===s&&(B(i,[c+1,f]),s=void 0,c=-1);continue}if(p===`/`&&e[f+1]===`*`)a=!0,f++;else if(p===`"`||p===`'`)s=p,c=f;else if(p===`\\`)Yn(e[f+1])&&(n.length=0,i=[],a=!1,s=void 0,c=-1),Jn(e[f+1])&&(u=f+1),f++;else if(p===`[`)B(n,f);else if(p===`]`){let a=n.pop(),s=f+1,c=!1;if(s!==a+2&&u>a){let n=e[a-1]===`:`||e[a-1]===`@`,i=e[s]===`:`&&!!e[s+1]&&!Vn.test(e[s+1]);c=n&&!Ne(e,a)||i&&!(t&&Zn(e,s)),c&&B(r,[a,s])}if(n.length===0){if(o=!1,l=void 0,!c)for(let[t,n]of i)for(let[i,a]of sr(e.slice(t,n)))B(r,[t+i,t+a]);i=[]}}}let f=[];for(let e of r.sort(([e,t],[n,r])=>e-n||r-t))(f.length===0||e[0]>=f.at(-1)[1])&&B(f,e);return f}const cr=/^(?:--?[\w-]+|[A-Z_$][\w$-]*|@teacss-skip-bracket-[\da-z]{6})$/i;function lr(e,t){let n=t;for(;n>0&&/[\w-]/.test(e[n-1]);)n--;if(n===t||e[n-1]!==`:`)return!1;let r=n-1,i=r;for(;i>0&&/[\w$@-]/.test(e[i-1]);)i--;if(!cr.test(e.slice(i,r)))return!1;let a=i-1;for(;a>=0&&/\s/.test(e[a]);)a--;return a<0||!`{,?`.includes(e[a])}function ur(e){let t=[],n=[],r=[],i=!1,a,o,s=-1,c,l=()=>{if(s<0||n.length===0)return;let e=n.at(-1);e.attached&&e.containsGroupBrace&&B(t,[e.start,s+1]),s=-1};for(let u=0;u<e.length;u++){let d=e[u];if(n.length===0){a?a!=="`"&&Yn(d)?a=void 0:d===`\\`?u=Xn(e,u):d===a?a=void 0:d===`(`&&lr(e,u)&&(B(n,{attached:!0,containsGroupBrace:!1,outerQuote:a,start:u}),c=void 0):d===`"`||d===`'`||d==="`"?a=d:d===`(`&&lr(e,u)&&(B(n,{attached:!0,containsGroupBrace:!1,outerQuote:void 0,start:u}),c=void 0);continue}if(Yn(d)){l(),n.length=0,r.length=0,i=!1,o=void 0,a!=="`"&&(a=void 0),c=void 0;continue}if((o||i)&&/\s/.test(d)&&(c??=we(e,n.at(-1).start,!0,u),c===void 0)){n.length=0,r.length=0,i=!1,o=void 0,s=-1;continue}if(o){d===`\\`?u=Xn(e,u):d===o?o=void 0:d===`{`&&(n.at(-1).containsGroupBrace=!0);continue}if(i){d===`*`&&e[u+1]===`/`&&(i=!1,u++);continue}let f=n[0].outerQuote;if(d===`/`&&e[u+1]===`*`)i=!0,u++;else if(f&&d===f)l(),n.length=0,r.length=0,i=!1,a=void 0;else if(d===`"`||d===`'`||d==="`")o=d;else if(d===`\\`)u=Xn(e,u);else if(r.length>0)d===`[`?B(r,`]`):d===`(`?B(r,`)`):d===r.at(-1)?(r.pop(),r.length===0?s=-1:d===`)`&&(s=u)):d===`{`&&(n.at(-1).containsGroupBrace=!0);else if(d===`[`)B(r,`]`);else if(d===`{`)n.at(-1).containsGroupBrace=!0;else if(d===`(`)B(n,{attached:lr(e,u),containsGroupBrace:!1,outerQuote:f,start:u});else if(d===`)`){let e=n.pop();e.attached&&e.containsGroupBrace&&B(t,[e.start,u+1]),e.containsGroupBrace&&n.length>0&&(n.at(-1).containsGroupBrace=!0),n.length===0&&(c=void 0)}}l();let u=[];for(let e of t.sort(([e,t],[n,r])=>e-n||r-t))(u.length===0||e[0]>=u.at(-1)[1])&&B(u,e);return u}function dr(e,t,n){if(!t.length)return e;let r=new Set([...e.matchAll(Bn)].map(e=>e[0])),i=new Set([...n.keys(),...r]),a=[],o=0;for(let[s,c]of t){let t=e.slice(s,c),l=0,u;for(;u=`${zn}${An(l?`${t}:${l}`:t)}`,l++,!(n.get(u)===t&&!r.has(u)||!i.has(u)););i.add(u),n.set(u,t),B(a,e.slice(o,s)),B(a,u),o=c}return B(a,e.slice(o)),a.join(``)}function fr(e,t,n=!1){return dr(e,sr(e,n),t)}function pr(e,t){return dr(e,ur(e),t)}function mr(e,t){let n=e;for(let e=0;e<t.size&&n.includes(zn);e++){let e=n.replace(Bn,e=>t.get(e)??e);if(e===n)break;n=e}return n}function hr(e,t){let n=new Map;e.includes(`[`)&&(e=fr(e,n,!0)),e.includes(`(`)&&(e=pr(e,n));let r=_n(e,t);e=r.code;for(let i=1;i<5&&r.nestedOpening;i++){let i=e;if(i.includes(`[`)&&(i=fr(i,n)),i.includes(`(`)&&(i=pr(i,n)),r=_n(i,t),r.code===i)break;e=r.code}e.includes(`[`)&&(e=fr(e,n)),e.includes(`(`)&&(e=pr(e,n));let i=e.split(In);return n.size?i.map(e=>e.includes(zn)?mr(e,n):e):i}const gr={name:`@teacss/core/extractor-split`,order:0,extract({code:e,id:t}){return hr(Gn(t)?e:qn(e,Wn(t)),Kn(t))}};var _r=class extends Set{_map=new Map;constructor(e){if(super(),e)for(let t of e)this.add(t)}add(e){return this._map.set(e,(this._map.get(e)??0)+1),super.add(e)}delete(e){return this._map.has(e)?(this._map.delete(e),super.delete(e)):!1}clear(){this._map.clear(),super.clear()}getCount(e){return this._map.get(e)??0}setCount(e,t){return this._map.set(e,t),super.add(e)}};function K(e){return e instanceof _r}function vr(e,t,n){if(Object.hasOwn(e,t)){if(!Reflect.set(e,t,n))throw TypeError(`Cannot assign event "${String(t)}"`)}else Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}function yr(){return{events:Object.create(null),emit(e,...t){let n=Object.hasOwn(this.events,e)?this.events[e]:void 0,r=d(Array.isArray(n)?n:[]).map(e=>e);for(let e of r)e(...t)},on(e,t){let n=this.events,r=Object.hasOwn(n,e)?n[e]:void 0,i=Array.isArray(r)?r:[];return Array.isArray(r)||vr(n,e,i),Object.defineProperty(i,i.length,{configurable:!0,enumerable:!0,value:t,writable:!0}),()=>{let r=Object.hasOwn(n,e)?n[e]:void 0;vr(n,e,d(Array.isArray(r)?r:[]).filter(e=>e!==t))}}}}const br=/^\[(.+?)~?="(.*)"\]$/,xr=/[\w\u00A0-\uFFFF%-?]/,Sr=new RegExp(br.source,br.flags),Cr=/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/,wr=new RegExp(xr.source,xr.flags);function Tr(e){return e.match(br)}function Er(e=``){return xr.test(e)}function Dr(e){return typeof e==`function`?{match:e}:e}function Or(e){return e.length===3&&Object.hasOwn(e,0)&&Object.hasOwn(e,1)&&Object.hasOwn(e,2)}function kr(e){return e!=null}function Ar(e){return e!=null&&typeof e.then==`function`}function jr(){}function Mr(e,t){for(let n=0;n<t.length;n++){if(!Object.hasOwn(t,n))continue;let r=t[n],i=Object.hasOwn(r,2),a=i?r[2]:void 0;if(a){let t=a;for(;t!==null&&t!==Object.prototype&&!Object.hasOwn(t,`layer`);)t=Object.getPrototypeOf(t);if(t!==null&&t!==Object.prototype){if(!Reflect.set(a,`layer`,e))throw TypeError(`Cannot assign rule layer`)}else Object.defineProperty(a,"layer",{configurable:!0,enumerable:!0,value:e,writable:!0})}else if(i){if(!Reflect.set(r,2,{layer:e}))throw TypeError(`Cannot assign rule metadata`)}else Object.defineProperty(r,2,{configurable:!0,enumerable:!0,value:{layer:e},writable:!0})}return t}var Nr=class{_map=new Map;get(e,t){let n=this._map.get(e);if(n)return n.get(t)}getFallback(e,t,n){let r=this._map.get(e);return r||(r=new Map,this._map.set(e,r)),r.has(t)||r.set(t,n),r.get(t)}set(e,t,n){let r=this._map.get(e);return r||(r=new Map,this._map.set(e,r)),r.set(t,n),this}has(e,t){return this._map.get(e)?.has(t)??!1}delete(e,t){let n=this._map.get(e);if(!n)return!1;let r=n.delete(t);return r&&n.size===0&&this._map.delete(e),r}deleteTop(e){return this._map.delete(e)}map(e){return Array.from(this._map.entries()).flatMap(([t,n])=>Array.from(n.entries()).map(([n,r])=>e(r,t,n)))}},Pr=class extends Map{getFallback(e,t){let n=this.get(e);return n===void 0&&!this.has(e)?(this.set(e,t),t):n}map(e){let t=[];return this.forEach((n,r)=>{Object.defineProperty(t,t.length,{configurable:!0,enumerable:!0,value:e(n,r),writable:!0})}),t}flatMap(e){let t=[];return this.forEach((n,r)=>{for(let i of d(e(n,r)))Object.defineProperty(t,t.length,{configurable:!0,enumerable:!0,value:i,writable:!0})}),t}};function Fr(e){if(!Object.hasOwn(e,0))return;let t=e[0];if(typeof t==`string`||typeof t==`symbol`)return[t,Object.hasOwn(e,1)?e[1]:void 0]}function Ir(e){return Reflect.ownKeys(e).filter(t=>Object.getOwnPropertyDescriptor(e,t)?.enumerable)}function Lr(e,t){if(Object.getOwnPropertyDescriptor(e,t)?.enumerable)return{value:Reflect.get(e,t)}}function Rr(e){let t=[];for(let n of Ir(e)){let r=Lr(e,n);r&&Object.defineProperty(t,t.length,{configurable:!0,enumerable:!0,value:[n,r.value],writable:!0})}return t}function zr(e){return m(e)?e:(Array.isArray(e)?d(e):Rr(e)).filter(e=>{let t=Fr(e);return t!==void 0&&t[1]!=null})}function Br(e){if(Array.isArray(e)){let t=d(e);return t.every(e=>Array.isArray(e)&&e.length>0&&!Array.isArray(Object.hasOwn(e,0)?e[0]:void 0))||t.length===0?[t]:t.map(e=>zr(e))}else return[zr(e)]}function Vr(e){let t=[],n,r;for(let i=0;i<e.length;i++){if(!Object.hasOwn(e,i))continue;let a=e[i],o=Fr(a);if(!o)continue;let[s,c]=o;typeof s==`string`&&(s.startsWith(`$$`)||(s===`__virtual_key__`||n!==s||r!==c)&&(Object.defineProperty(t,t.length,{configurable:!0,enumerable:!0,value:a,writable:!0}),n=s,r=c))}return t}const Hr=`__virtual_key__`;function Ur(e,t){return t==null||typeof t==`function`||typeof e!=`string`?``:e===`__virtual_key__`?t?String(t):``:`${e}:${t};`}function Wr(e){if(e==null||e.length===0)return``;let t=``,n,r;for(let i=0;i<e.length;i++){if(!Object.hasOwn(e,i))continue;let a=Fr(e[i]);if(!a)continue;let[o,s]=a;typeof o==`string`&&(o.startsWith(`$$`)||(o===`__virtual_key__`||n!==o||r!==s)&&(t+=Ur(o,s),n=o,r=s))}return t}function q(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}const Gr=`$reset`;function Kr(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}function qr(e,t,n=!1){let r=e,i=t;if(Array.isArray(i))return n&&Array.isArray(r)?[...d(r),...d(i)]:[...d(i)];if(q(i)&&Object.hasOwn(i,`$reset`)&&i.$reset){let{[Gr]:e,...t}=i;return Jr(t)}if(!q(i))return i;if(!q(r))return Jr(i);let a={...r};return Ir(i).forEach(e=>{if(e===`$reset`)return;let t=Lr(i,e);if(!t)return;let o=t.value,s=Object.hasOwn(r,e)?Reflect.get(r,e):void 0;if(q(o)&&Object.hasOwn(o,`$reset`)&&o.$reset){let{[Gr]:t,...n}=o;Kr(a,e,Jr(n))}else q(s)&&q(o)||Array.isArray(s)&&Array.isArray(o)?Kr(a,e,qr(s,o,n)):Kr(a,e,o)}),a}function Jr(e){if(Array.isArray(e))return d(e).map(Jr);if(q(e)){let t={};for(let n of Ir(e)){if(n===`$reset`)continue;let r=Lr(e,n);r&&Kr(t,n,Jr(r.value))}return t}return e}function Yr(e){return typeof e!=`object`||!e?e:Xr(e)}function Xr(e){if(Array.isArray(e)){let t=Array.from({length:e.length});for(let n=e.length-1;n>=0;n--)t[n]=Object.hasOwn(e,n)?Yr(e[n]):void 0;return t}if(q(e)){let t=e,n={};for(let e of Ir(t)){let r=Lr(t,e);r&&Kr(n,e,Yr(r.value))}return n}return e}function Zr(e){return Object.hasOwn(e,0)&&m(e[0])}function Qr(e){return Object.hasOwn(e,0)&&m(e[0])}const $r=/^[a-z][a-z0-9-]*$/,ei={minAffix:4,maxDistance:1,minDistanceLength:6,segmentAffix:!0},ti={minAffix:3,maxDistance:1,minDistanceLength:0,segmentAffix:!1},ni={minAffix:3,maxDistance:2,minDistanceLength:0,segmentAffix:!1},ri=new Set([`about`,`blob`,`bun`,`chrome`,`data`,`deno`,`file`,`ftp`,`http`,`https`,`jsr`,`mailto`,`node`,`npm`,`tel`,`urn`,`vscode`,`virtual`,`ws`,`wss`]);function ii(e){let t=0,n;for(let r=0;r<e.length;r++){let i=e[r];if(n){i===`\\`?r++:i===n&&(n=void 0);continue}if(i===`"`||i===`'`)n=i;else if(i===`\\`)r++;else if(i===`[`||i===`(`)t++;else if(i===`]`||i===`)`)t--;else if(i===`@`&&t===0)return e.slice(0,r)}return e}function ai(e){let t=ii(e);if(!t||t.startsWith(`$`)||t.startsWith(`[`))return!1;let n=t.indexOf(`:`);if(n<=0||n===t.length-1)return!1;let r=t.slice(0,n);return!$r.test(r)||t.startsWith(`//`,n+1)?!1:!ri.has(r)}function oi(e){if(e.flags)return;let t=e.source;if(!t.startsWith(`^`))return;let n=1;for(;n<t.length&&/[A-Za-z0-9_-]/.test(t[n]);)n++;return t[n]===`:`&&n>1?t.slice(1,n):void 0}function si(e,t){for(let n of t){let t=n[0];if((t.global||t.sticky)&&(t.lastIndex=0),t.test(e))return!0}return!1}const ci=new WeakMap;function li(e){let t=ci.get(e.rulesStaticMap);if(t)return t;let n=new Map,r=new Set;for(let t of Object.keys(e.rulesStaticMap)){let e=t.indexOf(`:`);if(e<=0)continue;let r=t.slice(0,e),i=n.get(r);i||(i=new Set,n.set(r,i)),i.add(t.slice(e+1))}for(let t of e.rulesDynamic){let e=oi(t[0]);e!=null&&!n.has(e)&&r.add(e)}let i={prefixValues:n,dynamicPrefixes:r};return ci.set(e.rulesStaticMap,i),i}function ui(e,t,n){if(e===t)return 0;if(Math.abs(e.length-t.length)>n)return 1/0;let r=Array.from({length:t.length+1},(e,t)=>t);for(let i=1;i<=e.length;i++){let a=[i],o=i;for(let n=1;n<=t.length;n++){let s=e[i-1]===t[n-1]?0:1;a[n]=Math.min(r[n]+1,a[n-1]+1,r[n-1]+s),a[n]<o&&(o=a[n])}if(o>n)return 1/0;r=a}return r[t.length]<=n?r[t.length]:1/0}function di(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return r}function fi(e,t){return(t.startsWith(e)?t[e.length]===`-`:t.endsWith(e)&&t[t.length-e.length-1]===`-`)&&(e.includes(`-`)||e.length>=6)}function pi(e,t,n){if(e.length>=n.minDistanceLength){let r=ui(e,t,n.maxDistance);if(r!==1/0)return r}let r=e.length<=t.length?e:t,i=e.length<=t.length?t:e;if(r.length>=n.minAffix&&(n.segmentAffix?fi(r,i):i.startsWith(r)||i.endsWith(r)||i.includes(r)))return 3+(i.length-r.length)/100;if(!n.segmentAffix&&di(e,t)>=n.minAffix)return 5+Math.abs(e.length-t.length)/100}function mi(e,t,n={}){let r=ii(e),i=r.indexOf(`:`);if(i<=0)return;let a=r.slice(0,i),o=r.slice(i+1),{prefixValues:s,dynamicPrefixes:c}=li(t),l=[];if(s.has(a)||c.has(a)||si(r,t.rulesDynamic))for(let e of s.get(a)??[]){if(e===o)continue;let t=pi(o,e,ni);t!==void 0&&l.push({suggestion:`${a}:${e}`,score:t})}else{if(!n.confirmedIntent&&a.length<3)return;let e=new Set([...s.keys(),...c]);for(let t of e){let e=pi(a,t,n.confirmedIntent?ti:ei);if(e===void 0)continue;let r=s.get(t)?.has(o)||c.has(t);l.push({suggestion:`${t}:${o}`,score:r?e:e+10})}if(l.length===0)return}l.sort((e,t)=>e.score-t.score||(e.suggestion<t.suggestion?-1:1));let u=new Set,d=[];for(let{suggestion:e}of l)if(!(u.has(e)||e===r)&&(u.add(e),d.push(e),d.length===3))break;return d}function hi(e){let t=e.split(/\s+/);return t[0]===``&&t.shift(),t.at(-1)===``&&t.pop(),t}function gi(e){if(!e.includes(`[`))return hi(e);let t=Ie(e);if(t.length===0)return hi(e);let n=[],r=0,i=-1;for(let a=0;a<e.length;a++){let o=t[r];if(o&&a===o.start){i<0&&(i=a),a=o.end-1,r++;continue}/\s/.test(e[a])?(i>=0&&B(n,e.slice(i,a)),i=-1):i<0&&(i=a)}return i>=0&&B(n,e.slice(i)),n}function _i(e){let t=``,n=0,r;for(let i=0;i<e.length;i++){let a=e[i];if(a===`\\`&&e[i+1]===`_`){t+=`_`,i++;continue}if(a===`\\`&&i+1<e.length){t+=a+e[++i];continue}if(r){a===r&&(r=void 0),t+=a===`_`&&n===0?` `:a;continue}if(a===`/`&&e[i+1]===`*`){let n=e.indexOf(`*/`,i+2);if(n===-1){t+=e.slice(i);break}t+=e.slice(i,n+2),i=n+1;continue}if(a===`"`||a===`'`){r=a,t+=a;continue}if(a===`(`?n++:a===`)`&&n>0&&n--,a===`_`&&n===0){t+=` `;continue}t+=a}return t}const vi=new Set([`calc`,`clamp`,`max`,`min`]);function yi(e){return e==null?!1:e===`\\`||/[-_a-zA-Z0-9]/.test(e)||e.charCodeAt(0)>=128}function bi(e,t){if(t>0&&yi(e[t-1])||!/[-_a-zA-Z]/.test(e[t]))return;let n=t+1;for(;/[-_a-zA-Z0-9]/.test(e[n]??``);)n++;return e[n]===`(`?{name:e.slice(t,n),open:n}:void 0}function xi(e){let t=new Map,n=[],r=!1,i;for(let a=0;a<e.length;a++){let o=e[a];if(r){o===`*`&&e[a+1]===`/`&&(r=!1,a++);continue}if(i){o===`\\`?a++:o===i&&(i=void 0);continue}if(o===`\\`){a++;continue}if(o===`"`||o===`'`){i=o;continue}if(o===`/`&&e[a+1]===`*`){r=!0,a++;continue}o===`(`?B(n,a):o===`)`&&n.length>0&&t.set(n.pop(),a)}return t}function Si(e,t){let n=e[t];if(n===`"`||n===`'`){for(let r=t+1;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===n)return r+1;return e.length}if(n===`/`&&e[t+1]===`*`){let n=e.indexOf(`*/`,t+2);return n<0?e.length:n+2}}function Ci(e){let t=e.trimEnd();for(;t.endsWith(`*/`);){let e=t.lastIndexOf(`/*`);if(e<0)break;t=t.slice(0,e).trimEnd()}if(t.endsWith(`)`)||/(?:^|[\s,(+\-*/])(?:e|pi|nan|-?infinity)$/i.test(t))return!0;let n=/[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?(?:%|[a-z]+)?$/i.exec(t);if(n==null)return!1;let r=n.index;return r===0?!0:n[0].startsWith(`-`)&&t[r-1]===`-`?!1:/[\s,(+\-*/]/.test(t[r-1])}function wi(e,t,n){return e[t]!==`+`&&e[t]!==`-`||!/\d/.test(e[t+1]??``)?!1:/(?:^|[^-_a-zA-Z0-9.])(?:\d+(?:\.\d*)?|\.\d+)[eE]$/.test(n.trimEnd())}function Ti(e){if(!e.includes(`(`))return e;let t=xi(e),n=[],r=``;for(let i=0;i<e.length;){let a=Si(e,i);if(a!=null){r+=e.slice(i,a),i=a;continue}let o=bi(e,i);if(o!=null){let a=t.get(o.open);if(a==null){r+=e.slice(i);break}let s=o.name.toLowerCase();if(s===`url`){r+=e.slice(i,a+1),i=a+1;continue}if(vi.has(s)){r+=`${o.name}(`,B(n,a),i=o.open+1;continue}r+=o.name,i=o.open;continue}let s=e[i],c=s===`+`||s===`-`||s===`*`||s===`/`,l=s===`/`&&e[i+1]===`*`;n.length>0&&c&&!l&&!wi(e,i,r)&&Ci(r)?(/\s/.test(r.at(-1)??``)||(r+=` `),r+=s,/\s/.test(e[i+1]??``)||(r+=` `)):r+=s,i===n.at(-1)&&n.pop(),i++}return r}function Ei(e){return e.length>=2&&e[0]===`[`&&e[e.length-1]===`]`}function Di(e,t={}){let{calc:n=!0}=t,r=e;return Ei(r)&&(r=_i(r.slice(1,-1))),n&&(r=Ti(r)),r}const Oi=new re(256,void 0,!0);function ki(e){return d(e).map(e=>e)}function Ai(e,t,n){return n.some(n=>e.startsWith(n,t))}function ji(e,t,n){let r=t-1;for(;r>0&&/[\w$-]/.test(e[r-1]);)r--;let i=r-1;for(;i>=0&&/\s/.test(e[i]);)i--;return e[i]===`(`&&n.some(t=>e.slice(i-t.length,i)===t)}function Mi(e,t){let n=t+1;for(;/\s/.test(e[n]??``);)n++;return e[n]===`"`||e[n]===`'`||e[n]==="`"}function Ni(e,t){let n=new Set,r=[],i=[],a=[],o,s=()=>{let e=o?.bracketStarts.at(-1);if(e)e.containsCandidate=!0;else{let e=i.at(-1);e&&(e.containsCandidate=!0)}};for(let c=0;c<e.length;c++){let l=e[c],u=l===`[`&&(e[c-1]===`:`||e[c-1]===`@`);if(u||l===`[`&&!o){Mi(e,c)&&(!u||Pe(e,c)&&!ji(e,c,t))&&n.add(c),i.push({containsCandidate:!1,parentQuote:o,start:c}),o=void 0;continue}if(i.length!==0){if(o){if(l===`\\`)c++;else if(l===o.character){if(o.bracketStarts.some(e=>e.containsCandidate)){for(let e of o.bracketStarts)e.containsCandidate&&n.add(e.start);let e=i.at(-1);e&&(e.containsCandidate=!0)}o=void 0}else if(l===`[`)o.bracketStarts.push({containsCandidate:!1,start:c});else if(l===`]`){let i=o.bracketStarts.pop();i&&Ai(e,c+1,t)?(r.push({start:i.start,end:c+1}),n.delete(i.start),s()):i?.containsCandidate&&(n.add(i.start),s())}}else if(l===`"`||l===`'`||l==="`")o={bracketStarts:[],character:l},a.push(o);else if(l===`\\`)c++;else if(l===`]`){let a=i.pop(),l=a.start,u=c+1,d=n.has(l)||Fe(e,l,u)&&!ji(e,l,t),f=(e[l-1]===`:`||e[l-1]===`@`||Ai(e,u,t))&&!d;f?(r.push({start:l,end:u}),n.delete(l)):a.containsCandidate&&n.add(l),o=a.parentQuote,(f||a.containsCandidate)&&s()}}}for(let e of i)e.containsCandidate&&n.add(e.start);for(let e of a)for(let t of e.bracketStarts)t.containsCandidate&&n.add(t.start);let c=[];for(let e of r.sort((e,t)=>e.start-t.start||t.end-e.end))(!c.length||e.start>=c.at(-1).end)&&c.push(e);return{barrierStarts:n,ranges:c}}function Pi(e,t){let{barrierStarts:n,ranges:r}=Ni(e,t);if(r.length===0&&n.size===0)return e;let i=e.split(``);for(let e of n)i[e]=`$`;for(let e of r)for(let t=e.start+1;t<e.end-1;t++)i[t]=`$`;return i.join(``)}function Fi(e){let t=JSON.stringify(e),n=[...e].sort((e,t)=>t.length-e.length).map(Cn).join(`|`),r=`\\[[^\\]]*?\\]`,i=Oi.getOrInsert(t,RegExp(n?`((?:[!@*<~\\w+:_-]|${r})+?)(${n})\\(((?:[~!@<>\\w\\s:/\\\\,%#.$?-]|${r})+?)\\)(?!\\s*?=>)`:`(?!)`,`gm`));return i.lastIndex=0,i}function Ii(e=[`-`,`:`]){let t=Fi(ki(e));return new RegExp(t.source,t.flags)}function Li(e,t=[`-`,`:`],n=5){let r=ki(t),i=Fi(r),a=!1,o=typeof e==`string`?e:e.original,s=o,c=new Set,l=new Map;if(n>0){let e=Pi(s,r),t;if(r.some(t=>e.includes(`${t}(`)))do{t=!1;let o=``,u=0;i.lastIndex=0;let d;for(;d=i.exec(e);){let e=d.index,[n,r,i,f]=d;a=!0,t=!0;let p=s.slice(e,e+n.length),m=s.slice(e,e+r.length);c.add(m+i);let h=e+m.length+i.length+1,g=s.slice(h,h+f.length),_={length:p.length,items:[]};l.set(e,_);let v=0;for(let e of gi(g)){let t=g.indexOf(e,v),n=h+t;v=t+e.length;let r=l.get(n)?.items;r?l.delete(n):r=[{offset:n,length:e.length,className:e}];for(let e of r)e.className=e.className===`~`?i===`:`?`${m}${i}~`:m:e.className.replace(/^(!?)(.*)/,(e,t,n)=>`${t}${m}${i}${n}`),_.items.push(e)}o+=s.slice(u,e),o+=`$`.repeat(p.length),u=e+p.length}t&&(s=o+s.slice(u)),--n,t&&n&&(e=Pi(s,r))}while(t&&n)}let u=[...l].sort(([e],[t])=>e-t),d;if(typeof e==`string`){d=``;let t=0;for(let[n,r]of u)d+=e.slice(t,n),d+=r.items.map(e=>e.className).join(` `),t=n+r.length;d+=e.slice(t)}else{d=e;for(let[e,t]of u){if(d.slice(e,e+t.length)!==o.slice(e,e+t.length))throw Error(`Cannot expand a variant group that overlaps an existing MagicString edit`);d.overwrite(e,e+t.length,t.items.map(e=>e.className).join(` `))}}return{prefixes:Array.from(c),hasChanged:a,groupsByOffset:new Map(u),get expanded(){return d.toString()}}}function Ri(e,t){let n=new Map,r=ki(t).sort((e,t)=>t.length-e.length),i=gi(e).map(e=>{let t=r.find(t=>e.startsWith(t));if(!t)return e;let i=e.slice(t.length);if(n.has(t))return n.get(t).push(i),null;{let e=[i];return n.set(t,e),{prefix:t,items:e}}}).filter(kr).map(e=>typeof e==`string`?e:`${e.prefix}(${e.items.join(` `)})`).join(` `);return i?`${/^\s/.test(e)?` `:``}${i}${/\s$/.test(e)?` `:``}`:e?` `:``}function zi(e,t=[`-`,`:`],n=5){let r=Li(e,t,n);return typeof e==`string`?r.expanded:e}const Bi=new Set;function Vi(e){if(!Bi.has(e)){Bi.add(e);try{console.warn(`[Teacss]`,e)}catch(t){throw Bi.delete(e),t}}}function Hi(e,t,n){let r=e;for(;r!==null&&r!==Object.prototype&&!Object.hasOwn(r,t);)r=Object.getPrototypeOf(r);if(r!==null&&r!==Object.prototype){if(!Reflect.set(e,t,n))throw TypeError(`Cannot assign rule metadata "${String(t)}"`)}else Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function Ui(e,t){let n=e;for(;n!==null&&n!==Object.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function Wi(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Gi(e){if(!Object.hasOwn(e,0)||!Object.hasOwn(e,1))throw TypeError(`[Teacss] invalid rule or shortcut entry: matcher and body must be own tuple values`);let t=[e[0],e[1],void 0],n=Object.hasOwn(e,2)?e[2]:void 0;if(n!==void 0){let e={...n},r=Object.hasOwn(e,`prefix`)?e.prefix:void 0;Array.isArray(r)&&Hi(e,`prefix`,[...d(r)]),t[2]=e}return t}function Ki(e){let t=Object.create(null),n=[];for(let[r,i]of e.entries()){let e=Object.hasOwn(i,2)?i[2]:void 0;if(e===void 0)if(e={},Object.hasOwn(i,2)){if(!Reflect.set(i,2,e))throw TypeError(`Cannot assign rule metadata`)}else Object.defineProperty(i,2,{configurable:!0,enumerable:!0,value:e,writable:!0});if(Hi(e,`__index`,r),Zr(i)){let n=d(Ui(e,`prefix`)??``);for(let e of n)t[e+i[0]]=i}else Wi(n,i)}return n.reverse(),{rulesSize:e.length,rulesDynamic:n,rulesStaticMap:t}}function qi(e){let t=d(e.rules).map(Gi),n=Ki(t);e.rules=t,e.rulesSize=n.rulesSize,e.rulesDynamic=n.rulesDynamic,e.rulesStaticMap=n.rulesStaticMap}function J(e,t){return e!=null&&Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function Ji(e,t){let n=e;for(;n!==null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function Yi(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Xi(e,t){for(let t=e.length;t>0;t--)Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:e[t-1],writable:!0});Object.defineProperty(e,0,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Zi(e){let t=new Set,n=[];for(let r of e){let e=r.name;t.has(e)||(t.add(e),Yi(n,r))}return n}function Qi(e){return Array.from(e,(e,t)=>({index:t,order:Ji(e,`order`)||0,value:e})).sort((e,t)=>e.order-t.order||e.index-t.index).map(({value:e})=>e)}function $i(e,t){let n={...e};for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(t,e)?.enumerable)continue;let r=Reflect.get(t,e);r!==void 0&&Object.defineProperty(n,e,{value:r,configurable:!0,enumerable:!0,writable:!0})}return n}function ea(e){return d(e).flatMap(e=>Array.isArray(e)?[e]:Object.entries(e))}const ta=new WeakSet;function na(e,t){let n={};for(let t of Reflect.ownKeys(e)){if(t===`name`||!Object.getOwnPropertyDescriptor(e,t)?.enumerable)continue;let r=Reflect.get(e,t);Object.defineProperty(n,t,{value:t===`prefix`&&Array.isArray(r)?[...d(r)]:r,configurable:!0,enumerable:!0,writable:!0})}return Object.defineProperty(n,"name",{value:t,configurable:!0,enumerable:!0,writable:!0}),n}async function ra(e){let t=typeof e==`function`?await e():await e;if(typeof t!=`object`||!t||Array.isArray(t))throw TypeError(`Invalid TeaCSS preset: expected an object, received ${t===null?`null`:Array.isArray(t)?`array`:typeof t}.`);let n=Object.hasOwn(t,`name`)?Reflect.get(t,`name`):void 0;if(typeof n!=`string`||n.trim()===``)throw TypeError(`Invalid TeaCSS preset: expected a non-empty string name.`);if(ta.has(t))return t;t=na(t,n),ta.add(t);let r=J(t,`shortcuts`),i=J(t,`rules`),a=r?ea(r).map(Gi):void 0;t.shortcuts=a,t.rules=i?d(i).map(Gi):void 0;let o=J(t,`prefix`),s=J(t,`layer`);if(o||s){let e=e=>{e[2]||={};let t=e[2];Ji(t,`prefix`)==null&&o&&Object.defineProperty(t,"prefix",{configurable:!0,enumerable:!0,value:[...d(o)],writable:!0}),Ji(t,`layer`)==null&&s&&Object.defineProperty(t,"layer",{configurable:!0,enumerable:!0,value:s,writable:!0})};a?.forEach(e),t.rules?.forEach(e)}return t}async function ia(e){return aa(e,new Set)}async function aa(e,t){if(t.has(e))throw TypeError(`Circular TeaCSS preset reference detected.`);let n=new Set(t);n.add(e);let r=await ra(e),i=J(r,`presets`);if(!i)return[r];let a=d(i).flatMap(e=>Array.isArray(e)?[...e]:[e]);return[r,...(await Promise.all(a.map(e=>aa(e,n)))).flat()]}function oa(e){if(e.length===0)return{};let t=[],n=[],r=!1,i=!1,a=[],o=[];for(let s of e){let e=J(s,`pipeline`),c=J(s,`filesystem`),l=J(s,`inline`),u=e&&J(e,`include`),d=e&&J(e,`exclude`);e===!1?(i=!0,r=!0):r||(e!==void 0&&(i=!0),u&&Yi(t,u),d&&Yi(n,d)),c&&Yi(a,c),l&&Yi(o,l)}let s={};return r?s.pipeline=!1:i&&(s.pipeline={},t.length&&(s.pipeline.include=f(_a(...t))),n.length&&(s.pipeline.exclude=f(_a(...n)))),a.length&&(s.filesystem=f(a.flatMap(e=>d(e)))),o.length&&(s.inline=f(o.flatMap(e=>d(e)))),s}async function sa(e={},t={}){let n=$i(t,e),r=J(n,`presets`)??[],i=Zi((await Promise.all(d(r).flatMap(e=>d(e)).map(e=>ia(e)))).flat()),a=Array.from(i,e=>({enforce:J(e,`enforce`),preset:e})),o=[...a.filter(({enforce:e})=>e===`pre`),...a.filter(({enforce:e})=>e==null),...a.filter(({enforce:e})=>e===`post`)].map(({preset:e})=>e),s=[...o,n],c=[...s].reverse(),l=s.reduce((e,t)=>({...e,...J(t,`layers`)}),{...Ce});function u(e){return f(s.flatMap(t=>d(J(t,e))))}let p=u(`extractors`),m=c.map(e=>J(e,`extractorDefault`)).find(e=>e!==void 0);m===void 0&&(m=gr),m&&!p.includes(m)&&Xi(p,m);let h=Qi(p),g=u(`rules`).map(Gi),{rulesSize:_,rulesStaticMap:v,rulesDynamic:y}=Ki(g),b=s.map(e=>J(e,`autocomplete`)),x=e=>b.flatMap(t=>{let n=J(t,e);return n===void 0?[]:Array.isArray(n)?[...n]:[n]}),S={templates:f(x(`templates`)),extractors:Qi(x(`extractors`)),shorthands:ga(b.map(e=>J(e,`shorthands`)||{}))},C=u(`separators`);C.length||(C=[`:`,`-`]);let w=oa(u(`content`)),T=c.map(e=>J(e,`details`)).find(e=>e!==void 0),E=c.map(e=>J(e,`outputToCssLayers`)).find(e=>e!==void 0),D=c.map(e=>J(e,`sortLayers`)).find(e=>e!==void 0),O=J(n,`envMode`)||`build`,k={...n,mergeSelectors:J(n,`mergeSelectors`)??!0,warn:J(n,`warn`)??!0,unmatched:J(n,`unmatched`)??`off`,outputToCssLayers:E,sortLayers:D??(e=>e),blocklist:u(`blocklist`),presets:o,envMode:O,shortcutsLayer:J(n,`shortcutsLayer`)||`shortcuts`,layers:l,theme:ha(s.map(e=>J(e,`theme`))),rules:g,rulesSize:_,rulesDynamic:y,rulesStaticMap:v,preprocess:u(`preprocess`),postprocess:u(`postprocess`),preflights:u(`preflights`),autocomplete:S,variants:Qi(u(`variants`).map(Dr)),shortcuts:ea(u(`shortcuts`)).map(Gi).reverse(),extractors:h,safelist:u(`safelist`),separators:C,details:T??O===`dev`,content:w,transformers:Zi(u(`transformers`))},A=u(`extendTheme`);for(let e of A)k.theme=e(k.theme,k)||k.theme;let j=!1;for(let e of s){let t=J(e,`configResolved`);t!=null&&(j=!0,t(k))}return j&&qi(k),k}function ca(e){let t={};for(let n of Reflect.ownKeys(e))Object.getOwnPropertyDescriptor(e,n)?.enumerable&&Object.defineProperty(t,n,{configurable:!0,enumerable:!0,value:Reflect.get(e,n),writable:!0});return t}function la(e,t,n){return Object.hasOwn(t,n)?Reflect.get(t,n):J(e,n)}function ua(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function da(e){let t=ca(e);if(Object.hasOwn(e,`templates`)){let n=la(e,t,`templates`);n===void 0?delete t.templates:ua(t,`templates`,d(n))}if(Object.hasOwn(e,`extractors`)){let n=la(e,t,`extractors`);n===void 0?delete t.extractors:ua(t,`extractors`,d(n))}if(Object.hasOwn(e,`shorthands`)){let n=la(e,t,`shorthands`);n===void 0?delete t.shorthands:ua(t,`shorthands`,n)}return t}function fa(e={},t={}){let n=J(e,`shorthands`),r=J(t,`shorthands`),i={...e},a={...t};delete i.shorthands,delete a.shorthands;let o=qr(i,a,!0);return(n!==void 0||r!==void 0)&&Object.defineProperty(o,"shorthands",{configurable:!0,enumerable:!0,value:{...n??{},...r??{}},writable:!0}),o}function pa(e){let t=ca(e);if(Object.hasOwn(e,`entry`)){let n=la(e,t,`entry`);n===void 0?delete t.entry:ua(t,`entry`,d(n))}return t}function ma(e){let t=[`shortcuts`,`preprocess`,`postprocess`,`extendTheme`,`separators`];return d(e).map(e=>Object.entries(e).reduce((e,[n,r])=>{if(r===void 0)return e;let i=n===`autocomplete`&&r?da(r):n===`cli`&&r?pa(r):t.includes(n)?d(r):r;return{...e,[n]:i}},{})).reduce((e,t)=>{let n=J(e,`autocomplete`),r=J(t,`autocomplete`),i=J(e,`content`),a=J(t,`content`),o=J(e,`extractorDefault`),s=J(t,`extractorDefault`),c=J(e,`theme`),l=J(t,`theme`),u={...e},d={...t};delete u.autocomplete,delete u.content,delete u.extractorDefault,delete u.theme,delete d.autocomplete,delete d.content,delete d.extractorDefault,delete d.theme;let f=qr(u,d,!0);return(n||r)&&Object.defineProperty(f,"autocomplete",{configurable:!0,enumerable:!0,value:fa(n,r),writable:!0}),(c||l)&&Object.defineProperty(f,"theme",{configurable:!0,enumerable:!0,value:ha([c,l]),writable:!0}),(i||a)&&Object.defineProperty(f,"content",{configurable:!0,enumerable:!0,value:oa([i||{},a||{}]),writable:!0}),(o!==void 0||s!==void 0)&&ua(f,`extractorDefault`,s===void 0?o:s),f},{})}function ha(e){return e.reduce((e,t)=>{if(!t)return e;let n=Xr(t);if(!q(n))return n;if(!q(e)){if(!Reflect.ownKeys(n).some(e=>Object.getOwnPropertyDescriptor(n,e)?.enumerable))return e;if(Object.hasOwn(n,`$reset`)&&Reflect.get(n,`$reset`))return qr({},n);throw TypeError(`[Teacss] cannot safely merge a plain theme into a non-plain theme; use extendTheme for a class-aware merge or $reset to replace it.`)}return qr(e,n)},{})}function ga(e){return e.reduce((e,t)=>{let n=Object.create(null);for(let e of Object.keys(t)){let r=t[e];if(Array.isArray(r)){let t=d(r);n[e]=t.length===1?t[0]??``:`(${t.join(`|`)})`}else n[e]=r}return{...e,...n}},{})}function _a(...e){return e.flatMap(e=>d(va(e)))}function va(e){return Array.isArray(e)?e:e?[e]:[]}function ya(e){return e}function ba(){let e=typeof process<`u`&&!!process.stdout;return{isNode:e,isVSCode:e&&!!process.env.VSCODE_CWD,isESLint:e&&!!process.env.ESLINT}}var xa=`0.4.4`;const Sa=Object.getOwnPropertyDescriptor(RegExp.prototype,`source`).get,Ca=[[`d`,Object.getOwnPropertyDescriptor(RegExp.prototype,`hasIndices`)?.get],[`g`,Object.getOwnPropertyDescriptor(RegExp.prototype,`global`)?.get],[`i`,Object.getOwnPropertyDescriptor(RegExp.prototype,`ignoreCase`)?.get],[`m`,Object.getOwnPropertyDescriptor(RegExp.prototype,`multiline`)?.get],[`s`,Object.getOwnPropertyDescriptor(RegExp.prototype,`dotAll`)?.get],[`u`,Object.getOwnPropertyDescriptor(RegExp.prototype,`unicode`)?.get],[`v`,Object.getOwnPropertyDescriptor(RegExp.prototype,`unicodeSets`)?.get],[`y`,Object.getOwnPropertyDescriptor(RegExp.prototype,`sticky`)?.get]],wa=RegExp.prototype.exec;function Y(e){return Reflect.apply(Sa,e,[])}function Ta(e){let t=``;for(let[n,r]of Ca)r&&Reflect.apply(r,e,[])&&(t+=n);return t}const Ea=/[a-zA-Z0-9_-]/;function Da(e,t){let n=e;for(;n!=null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function Oa(e,t){if(t.length>0&&e.length>256/t.length)return null;let n=[];for(let r of e)for(let e of t)n.push(r+e);return n}function ka(e){let t=!1,n=0,r=!1;for(let i=1;i<e.length;i++){let a=e[i];if(t)t=!1;else if(a===`\\`)t=!0;else if(r)a===`]`&&(r=!1);else if(a===`[`)r=!0;else if(a===`(`)n++;else if(a===`)`)n>0&&n--;else if(a===`|`&&n===0)return!0}return!1}function Aa(e,t){return e[t]===`:`&&!/[?*+{]/.test(e[t+1]??``)}function ja(e){if(!e.startsWith(`^`)||ka(e))return null;let t=1;for(;t<e.length&&Ea.test(e[t]);)t++;if(t>1&&Aa(e,t))return[e.slice(1,t)];let n=Ma(e,1,`:`);if(!n||!Aa(e,n.end)||n.combos.some(e=>e.length===0||e.includes(`:`)))return null;let r=[...new Set(n.combos)];return r.length?r:null}function Ma(e,t,n){let r=[``];for(;t<e.length;){let i=e[t];if(n.includes(i))break;if(Ea.test(i)){let n=``;for(;t<e.length&&Ea.test(e[t]);)n+=e[t++];r=r.map(e=>e+n);continue}let a=null;if(i===`(`)a=Na(e,t);else if(i===`[`)a=Pa(e,t);else return null;if(!a)return null;t=a.end;let o=a.combos;if(e[t]===`?`)o=[``,...o],t++;else if(e[t]===`*`||e[t]===`+`||e[t]===`{`)return null;let s=Oa(r,o);if(!s)return null;r=s}return{combos:r,end:t}}function Na(e,t){if(t++,e.startsWith(`?:`,t))t+=2;else if(e[t]===`?`)return null;let n=[];for(;;){let r=Ma(e,t,`|)`);if(!r||(n.push(...r.combos),n.length>256))return null;if(t=r.end,e[t]===`|`){t++;continue}return e[t]===`)`?{combos:n,end:t+1}:null}}function Pa(e,t){if(t++,e[t]===`^`)return null;let n=[];for(;t<e.length&&e[t]!==`]`;){let r=e[t];if(r===`\\`||r===`-`||(n.push(r),n.length>256))return null;t++}return e[t]===`]`?{combos:n,end:t+1}:null}function Fa(e){if(Da(e[2],`prefix`))return null;let[t]=e;return!(t instanceof RegExp)||Object.hasOwn(t,`exec`)||Object.getPrototypeOf(t)!==RegExp.prototype||t.exec!==wa||Ta(t)?null:ja(Y(t))}function Ia(e){let t=e.map(e=>[e,Fa(e)]),n=new Map;for(let[,e]of t)if(e!==null)for(let t of e)n.has(t)||n.set(t,[]);let r=[];for(let[e,i]of t){if(i===null){r.push(e);for(let t of n.values())t.push(e);continue}for(let t of i)n.get(t).push(e)}return{map:n,fallback:r}}const X=Object.freeze({shortcutsNoMerge:Symbol.for(`@teacss/core/shortcut-no-merge`),noMerge:Symbol.for(`@teacss/core/no-merge`),noScope:Symbol.for(`@teacss/core/no-scope`),variants:Symbol.for(`@teacss/core/variants`),parent:Symbol.for(`@teacss/core/parent`),selector:Symbol.for(`@teacss/core/selector`),layer:Symbol.for(`@teacss/core/layer`),sort:Symbol.for(`@teacss/core/sort`),body:Symbol.for(`@teacss/core/body`)}),La={px:1,rem:16,em:16,in:96,pt:96/72,pc:16,cm:96/2.54,mm:96/25.4,q:96/101.6},Ra=`vw.vh.vi.vb.vmin.vmax.svw.svh.svmin.svmax.lvw.lvh.lvmin.lvmax.dvw.dvh.dvmin.dvmax.cqw.cqh.cqi.cqb.cqmin.cqmax.ch.ex.cap.ic.lh.rlh.%`.split(`.`),za=RegExp(`^([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:e[+-]?\\d+)?)(${[...Object.keys(La),...Ra].sort((e,t)=>t.length-e.length).join(`|`)})?$`,`i`);function Ba(e){let t=za.exec(e.trim());if(!t)return null;let n=Number.parseFloat(t[1]);if(!Number.isFinite(n))return null;let r=(t[2]??`px`).toLowerCase();if(!Object.hasOwn(La,r))return{unit:r,value:n};let i=Math.round(n*La[r]*1e6)/1e6;return{unit:`px`,value:Number.isFinite(i)?i:n*La[r]}}function Va(e){let t=e.indexOf(` $$ `),n=t<0?e:e.slice(0,t);if(!/^@media\b/i.test(n)||/\bnot\b/i.test(n))return null;for(let e of n.matchAll(/\(\s*min-width\s*:\s*([^)]*?)\s*\)/gi)){let t=Ba(e[1]);if(t)return t}for(let e of n.matchAll(/\(\s*max-width\s*:\s*([^)]*?)\s*\)/gi)){let t=Ba(e[1]);if(t)return{unit:t.unit,value:-t.value}}return null}function Ha(e,t){return e<t?-1:+(e>t)}function Ua(e,t){return Ha(e??``,t??``)}function Z(e,t){Object.defineProperty(e,e.length,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Wa(e,t){for(let n of t)Z(e,n)}function Ga(e,t){for(let t=e.length;t>0;t--)Object.hasOwn(e,t-1)?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:e[t-1],writable:!0}):delete e[t];Object.defineProperty(e,0,{configurable:!0,enumerable:!0,value:t,writable:!0})}function Ka(e){let t=new _r;for(let n of e)t.setCount(n,e.getCount(n));return t}function qa(e){return K(e)?Ka(e):new Set(e)}function Ja(e,t,n){if(K(e)&&K(t)&&K(n)){let r=new Set([...t,...n]);for(let i of r){let r=e.getCount(i)+n.getCount(i)-t.getCount(i);r>0?e.setCount(i,r):e.delete(i)}return}for(let r of t)n.has(r)||e.delete(r);for(let r of n)t.has(r)||e.add(r)}function*Ya(e,t){for(let n=0;n<e.length;n++){let r=t[n];r!=null&&(yield[e[n],r])}}function Xa(e){if(e!==void 0&&(!Number.isSafeInteger(e)||e<1))throw RangeError(`tokenConcurrency must be a positive integer`)}function Za(e,t){return Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function Q(e,t){let n=e;for(;n!==null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function Qa(e,t){if(Object.hasOwn(e,t))return Reflect.get(e,t);let n=Object.getPrototypeOf(e);if(n===null||n===Object.prototype)return;let r=Object.getOwnPropertyDescriptor(n,`constructor`)?.value;if(typeof r==`function`&&r!==Object)for(;n!==null&&n!==Object.prototype;){if(Object.hasOwn(n,t))return Reflect.get(e,t);n=Object.getPrototypeOf(n)}}function $(e,t){return e?Q(e,t):void 0}function $a(e,t){return Za(e,t)}function eo(e){return{body:Q(e,`body`),handle:Q(e,`handle`),layer:Q(e,`layer`),order:Q(e,`order`),parent:Q(e,`parent`),selector:Q(e,`selector`),sort:Q(e,`sort`),source:e}}async function to(e,t,n){if(t===void 0||t>=e.length)return await Promise.all(e.map(n));let r=Array(e.length),i=0,a=!1,o=Array.from({length:Math.min(t,e.length)},async()=>{for(;!a&&i<e.length;){let t=i++;try{let i=await n(e[t]);Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:i,writable:!0})}catch(e){throw a=!0,e}}});return await Promise.all(o),r}function no(e,t){return e?.replaceAll(Yo(t),`&`)}function ro(e,t){let n=t.exec,r=Ta(t);if(!r.includes(`g`)&&!r.includes(`y`))return n.call(t,e);if(Object.getOwnPropertyDescriptor(t,`lastIndex`)?.writable===!1){if(n!==wa)return n.call(t,e);let i=new RegExp(Y(t),r);return wa.call(i,e)}t.lastIndex=0;try{return n.call(t,e)}finally{Object.getOwnPropertyDescriptor(t,`lastIndex`)?.writable!==!1&&(t.lastIndex=0)}}function io(e,t,n,r){let i=d(e).filter(ao),a=d(n).filter(ao);if(i.length!==a.length)return!1;for(let e=0;e<i.length;e++){let n=i[e],o=a[e];if(n[2]!==o[2]||no(n[1],t)!==no(o[1],r)||n[3]!==o[3]||$(n[4],`layer`)!==$(o[4],`layer`)||$(n[4],`sort`)!==$(o[4],`sort`)||!!$(n[4],`noScope`)!=!!$(o[4],`noScope`)||!!(n[6]??$(n[4],`noMerge`))!=!!(o[6]??$(o[4],`noMerge`)))return!1}return!0}function ao(e){return Array.isArray(e)&&Object.hasOwn(e,0)&&Object.hasOwn(e,1)&&Object.hasOwn(e,2)&&Object.hasOwn(e,3)&&Object.hasOwn(e,4)&&Object.hasOwn(e,5)&&Object.hasOwn(e,6)}function oo(e){return Object.hasOwn(e,0)&&e[0]===X.shortcutsNoMerge}function so(e){for(let t=e.length-1;t>=0;t--){if(!Object.hasOwn(e,t))continue;let n=e[t];if(oo(n))return Object.hasOwn(n,1)?n[1]:void 0}}function co(e,t){let n=[...e,...t],r=[];for(let e=t.length-1;e>=0;e--)de(t[e])&&Z(r,t[e]);for(let t=e.length-1;t>=0;t--)de(e[t])&&Z(r,e[t]);if(r.length<2)return n;let i=r[0];for(let e=1;e<r.length;e++)i=fe(i,r[e])??i;let a=[],o=!1;for(let e of n)de(e)?o||=(Z(a,i),!0):Z(a,e);return a}function lo(e){let t;for(let n of e)n.includes(`{`)&&(t??=[],t.push(n));if(!t)return e;for(let n of t){let t=gi(xn(n));if(t.length===1&&t[0]===n)continue;let r=K(e)?e.getCount(n):1;e.delete(n);for(let n of t)K(e)?e.setCount(n,e.getCount(n)+r):e.add(n)}return e}const uo=/(?<!\\)::?-[a-zA-Z]/;function fo(e){let t=new Map,n=new Map,r=0,i;for(let a of e){let[o,s,c]=a;if(i!==void 0&&s!==i&&(t.clear(),n.clear()),i=s,c){e[r++]=a;continue}let l=o.length>0,u=l?t:n,d=u.get(s);if(!d){u.set(s,a),e[r++]=a;continue}l&&Wa(d[0],o)}e.length=r}function po(e,t,n){let r=(e.get(t)??0)-(e.get(n)??0);if(r)return r;let i=Va(t),a=Va(n);if(i==null!=(a==null))return i==null?-1:1;if(i!=null&&a!=null){if(i.unit!==a.unit)return Ha(i.unit,a.unit);if(i.value!==a.value)return i.value-a.value}return Ha(t,n)}function mo(e,t,n=``){let r=ho(e);return`${r.join(`{`)}{${n}${t}${n}${`}`.repeat(r.length)}`}function ho(e){let t=[],n=0,r=!1,i=0,a,o=0;for(let s=0;s<e.length;s++){let c=e[s];r?c===`*`&&e[s+1]===`/`&&(r=!1,s++):a?c===`\\`?s++:c===a&&(a=void 0):c===`/`&&e[s+1]===`*`?(r=!0,s++):c===`"`||c===`'`?a=c:c===`(`?i++:c===`)`?i>0&&i--:c===`[`?n++:c===`]`?n>0&&n--:n===0&&i===0&&e.startsWith(` $$ `,s)&&(Z(t,e.slice(o,s)),s+=3,o=s+1)}return Z(t,e.slice(o)),t}function go(e){let t=[],n=!1,r;for(let i=0;i<e.length;i++){let a=e[i];if(n){a===`*`&&e[i+1]===`/`&&(n=!1,i++);continue}if(r){a===`\\`?i++:a===r&&(r=void 0);continue}if(a===`/`&&e[i+1]===`*`){n=!0,i++;continue}if(a===`\\`){i++;continue}if(a===`"`||a===`'`){r=a;continue}if(!/\s/.test(a)||e[i+1]!==`$`||e[i+2]!==`$`||!/\s/.test(e[i+3]??``))continue;let o=i+4;for(;o<e.length&&/\s/.test(e[o]);)o++;Z(t,[i,o]),i=o-1}return t}function _o(e,t){let n=go(e);if(!n.length)return e;let r=0,i=``;for(let[a,o]of n)i+=e.slice(r,a),i+=a===0||e[a-1]===`{`||e[a-1]===`,`?t?`${t} `:``:t?` ${t} `:` `,r=o;return i+e.slice(r)}const vo=new Set([Function.prototype,Object.getPrototypeOf(async()=>{}),Object.getPrototypeOf(function*(){}),Object.getPrototypeOf(async function*(){})]),yo=new Set([`arguments`,`caller`,`length`,`name`,`prototype`]);function bo(e){return Reflect.ownKeys(e).every(e=>yo.has(e))}function xo(e){let t=e;for(;t!==null;){let e=Object.getOwnPropertyDescriptor(t,`exec`);if(e)return{configurable:!!e.configurable,enumerable:!!e.enumerable,get:`get`in e?e.get:void 0,owner:t,set:`set`in e?e.set:void 0,value:`value`in e?e.value:void 0,writable:`value`in e?!!e.writable:void 0};t=Object.getPrototypeOf(t)}}function So(e,t){let n=xo(e);return n?.owner===t?.owner&&n?.configurable===t?.configurable&&n?.enumerable===t?.enumerable&&n?.get===t?.get&&n?.set===t?.set&&n?.value===t?.value&&n?.writable===t?.writable}function Co(e){return Reflect.ownKeys(e).every(e=>e===`lastIndex`)}function wo(e,t=new WeakMap,n={}){if(e===null||typeof e!=`object`&&typeof e!=`function`)return{kind:`primitive`,value:e};if(n.functionsByIdentity&&typeof e==`function`)return{complete:bo(e),kind:`identity`,value:e};if(n.ignoreRegExpLastIndex&&e instanceof RegExp){let t=xo(e);return{complete:t?.owner===RegExp.prototype&&t.value===wa&&Object.getPrototypeOf(e)===RegExp.prototype&&Co(e),exec:t,flags:Ta(e),kind:`regexp-identity`,source:Y(e),value:e}}let r=t.get(e);if(r)return r;let i=Object.getPrototypeOf(e),a=i===RegExp.prototype?e:void 0,o={complete:i===null||i===Object.prototype||i===Array.prototype||vo.has(i)||i===RegExp.prototype,kind:`object`,properties:[],prototype:i,regexpFlags:a&&Ta(a),regexpSource:a&&Y(a),value:e};t.set(e,o);for(let r of Reflect.ownKeys(e)){if(n.ignoreRegExpLastIndex&&a&&r===`lastIndex`)continue;let i=Object.getOwnPropertyDescriptor(e,r);if(!i)continue;let s={configurable:!!i.configurable,enumerable:!!i.enumerable,key:r};if(`value`in i){s.value=wo(i.value,t,n),Eo(s.value)||(o.complete=!1);try{let a=Reflect.get(e,r);s.observedValue=wo(a,t,n),(!Object.is(a,i.value)||!Eo(s.observedValue))&&(o.complete=!1)}catch{o.complete=!1}s.writable=!!i.writable}else o.complete=!1,s.get=i.get,s.set=i.set;Z(o.properties,s)}return o}function To(e,t,n=new Map){if(t.kind===`primitive`)return Object.is(e,t.value);if(t.kind===`identity`)return e===t.value&&(!t.complete||bo(t.value));if(t.kind===`regexp-identity`)return e===t.value&&e instanceof RegExp&&So(e,t.exec)&&Y(e)===t.source&&Ta(e)===t.flags&&(!t.complete||Co(e));if(e!==t.value||e===null||typeof e!=`object`&&typeof e!=`function`||Object.getPrototypeOf(e)!==t.prototype||t.regexpSource!==void 0&&(Y(e)!==t.regexpSource||Ta(e)!==t.regexpFlags))return!1;let r=n.get(t);if(r)return r===e;n.set(t,e);let i=Reflect.ownKeys(e).filter(e=>!(t.regexpSource!==void 0&&e===`lastIndex`&&!t.properties.some(t=>t.key===e)));if(i.length!==t.properties.length)return!1;for(let r=0;r<i.length;r++){let a=t.properties[r],o=i[r];if(o!==a.key)return!1;let s=Object.getOwnPropertyDescriptor(e,o);if(!s||!!s.configurable!==a.configurable||!!s.enumerable!==a.enumerable)return!1;if(`value`in s){if(a.value===void 0||!!s.writable!==a.writable||!To(s.value,a.value,n))return!1;if(a.observedValue!==void 0){let t;try{t=Reflect.get(e,o)}catch{return!1}if(!To(t,a.observedValue,n))return!1}}else if(a.value!==void 0||s.get!==a.get||s.set!==a.set)return!1}return!0}function Eo(e){return e.kind===`primitive`||e.complete}function Do(e){let t=Array(e.length);for(let n=0;n<e.length;n++){if(!Object.hasOwn(e,n))continue;let r=e[n],i=Object.hasOwn(r,2),a=i?r[2]:void 0,o=wo(r[0],void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0}),s={body:r[1],bodySnapshot:wo(r[1],void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0}),matcherFlags:r[0]instanceof RegExp?Ta(r[0]):void 0,matcherSnapshot:o,matcherSource:r[0]instanceof RegExp?Y(r[0]):void 0,matcher:r[0],meta:a,metaOwn:i,metaSnapshot:wo(a,void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0}),rule:r};Object.defineProperty(t,n,{configurable:!0,enumerable:!0,value:s,writable:!0})}return t}function Oo(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=Object.hasOwn(e,n);if(r!==Object.hasOwn(t,n))return!1;if(!r)continue;let i=e[n],a=t[n],o=Object.hasOwn(i,2),s=o?i[2]:void 0;if(!Object.hasOwn(i,0)||!Object.hasOwn(i,1)||o!==a.metaOwn||i!==a.rule||i[0]!==a.matcher||i[1]!==a.body||s!==a.meta||!To(i[0],a.matcherSnapshot)||i[0]instanceof RegExp&&(Y(i[0])!==a.matcherSource||Ta(i[0])!==a.matcherFlags)||!To(i[1],a.bodySnapshot)||!To(s,a.metaSnapshot))return!1}return!0}function ko(e){for(let t=0;t<e.length;t++){if(!Object.hasOwn(e,t))continue;let{bodySnapshot:n,matcherSnapshot:r,metaSnapshot:i}=e[t];if(!Eo(n)||!Eo(r)||!Eo(i))return!1}return!0}const Ao=[`blocklist`,`details`,`envMode`,`extractors`,`layers`,`mergeSelectors`,`outputToCssLayers`,`postprocess`,`preflights`,`preprocess`,`safelist`,`separators`,`shortcuts`,`shortcutsLayer`,`sortLayers`,`theme`,`unmatched`,`variants`,`warn`];function jo(e,t,n={}){let r=wo(e[t],void 0,n);return{complete:Eo(r),isCurrent:e=>To(e[t],r),key:t}}function Mo(e,t){let n=e;for(;n!==null&&n!==Object.prototype&&n!==Array.prototype&&n!==Function.prototype;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return{descriptor:e,owner:n};n=Object.getPrototypeOf(n)}}function No(e,t){let n=Mo(e,t);if(!n)return{complete:!0,value:wo(void 0)};let{descriptor:r,owner:i}=n;if(!(`value`in r))return{complete:!1,configurable:!!r.configurable,enumerable:!!r.enumerable,get:r.get,owner:i,set:r.set};let a=wo(r.value,void 0,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0});return{complete:Eo(a),configurable:!!r.configurable,enumerable:!!r.enumerable,owner:i,value:a,writable:!!r.writable}}function Po(e,t,n){let r=Mo(e,t);if(!r)return n.owner===void 0&&n.value!==void 0&&To(void 0,n.value);let{descriptor:i,owner:a}=r;return a!==n.owner||!!i.configurable!==n.configurable||!!i.enumerable!==n.enumerable?!1:`value`in i?n.value!==void 0&&!!i.writable===n.writable&&To(i.value,n.value):n.value===void 0&&i.get===n.get&&i.set===n.set}function Fo(e,t,n){let r=e[t];if(!Array.isArray(r))return jo(e,t,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0});let i=Array.from({length:r.length},(e,t)=>{let i=Object.hasOwn(r,t),a=i?r[t]:void 0;return{entry:a,own:i,values:i&&a!=null&&(typeof a==`object`||typeof a==`function`)?n.map(e=>No(a,e)):n.map(()=>No(Object.create(null),``))}}),a=new Set(n),o=i.every(({entry:e,own:t,values:n})=>{if(!t||e==null||typeof e!=`object`&&typeof e!=`function`)return!0;let r=Object.getPrototypeOf(e);return(r===Object.prototype||r===null)&&Reflect.ownKeys(e).every(e=>a.has(e))&&n.every(e=>e.complete)});return{complete:o,isCurrent(e){let s=e[t];if(s!==r||!Array.isArray(s)||s.length!==i.length)return!1;for(let e=0;e<i.length;e++){let t=i[e];if(Object.hasOwn(s,e)!==t.own)return!1;if(!t.own)continue;let r=s[e];if(r!==t.entry)return!1;if(r!=null&&(typeof r==`object`||typeof r==`function`)){if(o&&(Object.getPrototypeOf(r)!==Object.prototype&&Object.getPrototypeOf(r)!==null||!Reflect.ownKeys(r).every(e=>a.has(e))))return!1;for(let e=0;e<n.length;e++)if(!Po(r,n[e],t.values[e]))return!1}}return!0},key:t}}function Io(e,t,n){let r=e[t];if(r==null||typeof r!=`object`&&typeof r!=`function`)return{complete:!0,isCurrent:e=>Object.is(e[t],r),key:t};let i=n.map(e=>No(r,e)),a=new Set(n),o=Object.getPrototypeOf(r),s=(o===Object.prototype||o===null)&&Reflect.ownKeys(r).every(e=>a.has(e))&&i.every(e=>e.complete);return{complete:s,isCurrent(e){let o=e[t];return o!==r||o==null||typeof o!=`object`&&typeof o!=`function`||s&&(Object.getPrototypeOf(o)!==Object.prototype&&Object.getPrototypeOf(o)!==null||!Reflect.ownKeys(o).every(e=>a.has(e)))?!1:n.every((e,t)=>Po(o,e,i[t]))},key:t}}function Lo(e){return Ao.map(t=>{switch(t){case`extractors`:return Fo(e,t,[`name`,`order`,`extract`]);case`preflights`:return Fo(e,t,[`getCSS`,`layer`]);case`variants`:return Fo(e,t,[`match`,`multiPass`,`order`]);case`outputToCssLayers`:return Io(e,t,[`allLayers`,`cssLayerName`]);case`shortcuts`:{let n=e.shortcuts,r=Do(n);return{complete:ko(r),isCurrent:t=>t.shortcuts===e.shortcuts&&Oo(t.shortcuts,r),key:t}}case`sortLayers`:return jo(e,t,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0});case`blocklist`:case`postprocess`:case`preprocess`:case`safelist`:return jo(e,t,{functionsByIdentity:!0,ignoreRegExpLastIndex:!0});default:return jo(e,t)}})}function Ro(e,t){return t.every(t=>t.isCurrent(e))}function zo(e){return e.every(({complete:e})=>e)}function Bo({authoredOutputOrders:e,config:t,currentSelectors:n,layerSet:r,matched:i,minify:a,parentOrders:o,preflights:s,preflightsMap:c,scope:l,sheet:u,shortcutMergeOrders:p,resolveUnmatched:m}){let h=a?``:`
20
+ `,g={...t.layers},_=t.mergeSelectors,v=t.sortLayers,y=e=>Object.hasOwn(g,e)?g[e]??0:0,b=e=>d(v.call(t,e.sort((e,t)=>y(e)-y(t)||Ha(e,t)))).map(e=>e),x=b(Array.from(r)),S=Object.create(null),C=r.size===1?r.values().next().value:void 0,w,T,E=t.outputToCssLayers,D=typeof E==`object`?Qa(E,`cssLayerName`):void 0,O=typeof E==`object`&&Qa(E,`allLayers`)?b(Object.keys(g)):void 0,k=new Map,A=e=>{let t=k.get(e);if(t!==void 0||k.has(e))return t;let n=e;D&&typeof E==`object`&&(n=D.call(E,e));let r=n===null?null:n??e;return k.set(e,r),r};if(E)for(let e of f([...x,...O??[]]))A(e);let j=t=>{let r=(e,t)=>e.ruleIndex-t.ruleIndex||e.sort-t.sort||Ua(e.currentSelector,t.currentSelector)||Number(t.noScope)-Number(e.noScope)||Number(t.noMerge)-Number(e.noMerge)||Ua(e.selector,t.selector)||Ua(e.body,t.body)||0,i=(e,t)=>e.ruleIndex===t.ruleIndex&&e.sort===t.sort,a=[],o=new Map,s=t.flatMap(e=>p.get(e)?.components??[e]);for(let t of s){let s={authored:e.get(t),body:t[2],currentSelector:n.get(t)??t[5]?.currentSelector,item:t,noMerge:!!(t[6]??$(t[4],`noMerge`)),noScope:!!$(t[4],`noScope`),ruleIndex:t[0],selector:t[1],sort:$(t[4],`sort`)||0},c=s.authored?.group;if(!c){Z(a,{authoredGroup:void 0,records:[s],representative:s});continue}let l=o.get(c),u=l?.find(e=>i(e.records[0],s));if(u)Z(u.records,s),r(s,u.representative)<0&&(u.representative=s);else{let e={authoredGroup:c,records:[s],representative:s};Z(a,e),l?Z(l,e):o.set(c,[e])}}for(let e of a)e.authoredGroup&&e.records.sort((e,t)=>e.authored.index-t.authored.index||r(e,t));a.sort((e,t)=>{let n=r(e.representative,t.representative);if(n)return n;let i=[...e.records].sort(r),a=[...t.records].sort(r),o=Math.min(i.length,a.length);for(let e=0;e<o;e++){let t=r(i[e],a[e]);if(t)return t}if(i.length!==a.length)return i.length-a.length;for(let n=0;n<e.records.length;n++){let i=r(e.records[n],t.records[n]);if(i)return i}return 0});let c=a.flatMap(e=>e.records.map(e=>e.item)),l=new Map;for(let e=0;e<c.length;e++){let t=c[e];l.set(t,e)}let u=new Set;for(let e of c){let t=p.get(e),n=t?.components;if(!t?.flatten||!t.original||!n?.length||u.has(t.group))continue;let r=l.get(n[0]);r!==void 0&&n.every((e,t)=>c[r+t]===e)&&u.add(t.group)}let d=new Set,f=[];for(let e of c){let t=p.get(e);if(!t||!u.has(t.group)){Z(f,e);continue}d.has(t.group)||(d.add(t.group),Z(f,t.original))}return f},ee=()=>{if(T)return T;let e=new Map,t=Array.from(u).sort((e,t)=>po(o,e[0]||``,t[0]||``));for(let[n,r]of t)for(let t of r){let r=$(t[4],`layer`)||`utilities`,i=e.get(r),a=i?.[i.length-1];a?.[0]===n?Z(a[1],t):i?Z(i,[n,[t]]):e.set(r,[[n,[t]]])}return u.clear(),T=e,e},M=e=>{if(C===void 0)return ee().get(e)||[];if(e!==C)return[];if(w)return w;let t=Array.from(u).sort((e,t)=>po(o,e[0]||``,t[0]||``));return u.clear(),w=t,t},N=(e=Se)=>{if(Object.hasOwn(S,e))return S[e];let t=M(e).map(([e,t])=>{let n=[];for(let[,e,r,,i,,a]of j(t)){if(e===``)continue;let t=$(i,`noScope`)?void 0:l,o=e&&qo(e,t);Z(n,[o==null?[]:[[o,$(i,`sort`)??0]],r,!!(a??$(i,`noMerge`))||o!=null&&uo.test(o)])}if(!n.length)return;_&&fo(n);let r=[];for(let e=n.length-1;e>=0;e--){let[t,i]=n[e],a=t.length===1?t[0][0]:``;if(t.length>1){t.sort((e,t)=>e[1]-t[1]||Ua(e[0],t[0]));let e=new Set,n=[];for(let[r]of t)!r||e.has(r)||(e.add(r),Z(n,r));a=n.join(`,${h}`)}let o=a?`${a}{${i}}`:i;o&&Z(r,o)}let i=Array.from(new Set(r)).reverse().join(h);return e?mo(e,i,h):i}).filter(Boolean).join(h);s&&(t=[c[e],t].filter(Boolean).join(h));let n;E&&t&&(n=A(e),n!==null&&(t=`@layer ${n}{${h}${t}${h}}`));let r=a?``:`/* layer: ${e}${n&&n!==e?`, alias: ${n}`:``} */${h}`;return S[e]=t?r+t:``},P=(e=x,t)=>{let n=d(e).map(e=>e),r=new Set(d(t).map(e=>e)),i=n.filter(e=>!r.has(e)),a=i.map(N).filter(Boolean);if(E){let e=i;O&&(e=O);let t=f(e.map(A).filter(kr));t.length>0&&Ga(a,`@layer ${t.join(`, `)};`)}return a.join(h)},F=async(e,t)=>{let n=await t(N(e));return S[e]=n,n},I;return{get css(){return P()},layers:[...x],matched:i,getLayers:P,getLayer:N,setLayer:F,get diagnostics(){return I??={unmatched:m()},I}}}var Vo=class e{userConfig;defaults;version=xa;events=yr();config=void 0;cache=new re(I,void 0,!0);blocked=new L(I,void 0,!0);_warnedUnmatched=new L(I);parentOrders=new Map;activatedRules=new Set;_dynamicIndex;_contextConfigs=new WeakMap;_expansionPrefixes=new WeakMap;_generationContexts=new WeakSet;_configVersion=0;_collectionGeneration=0;_preparedConfigs=new WeakSet;_indexedRules;_indexedRuleSnapshot;_preparedCacheSnapshot;_preparedConfigMutable=!1;_preparedCacheReliable=!0;_startingGenerationParse=0;_runtimeRevision=0;_variantCacheOwner={};_initialization;_constructedCSSResults=new WeakMap;_constructedCSSSequence=0;_parsedOutputOrders=new WeakMap;_rawUtilMetadata=new WeakMap;_stringifiedCurrentSelectors=new WeakMap;_stringifiedOutputOrders=new WeakMap;_stringifiedParentOrders=new WeakMap;_shortcutMergeOrders=new WeakMap;_utilParentOrders=new WeakMap;reportConfigObserverErrors(e){console.error(`[@teacss/core] Configuration observer failed:`,AggregateError(e,`Configuration observers failed`))}dispatchConfig(e){let t=Object.hasOwn(this.events.events,`config`)?this.events.events.config:void 0,n=Array.isArray(t)?d(t).map(e=>e):[],r=[];for(let t of n)try{let n=t(e);Ar(n)&&Promise.resolve(n).catch(e=>{this.reportConfigObserverErrors([e])})}catch(e){Z(r,e)}r.length&&this.reportConfigObserverErrors(r)}clearRuntimeCaches(e){e&&this._runtimeRevision++,this._variantCacheOwner={},this.blocked.clear(),this._warnedUnmatched.clear(),this.parentOrders.clear(),this.activatedRules.clear(),this.cache.clear()}ensureRuleIndexesCurrent(e=!1){let t=!1,n=!1,r=!0;this._preparedConfigMutable&&e&&this._preparedCacheSnapshot&&(Ro(this.config,this._preparedCacheSnapshot)||(n=!0,this._preparedCacheSnapshot=Lo(this.config),t=!0),r=zo(this._preparedCacheSnapshot));let i=this._indexedRules===this.config.rules;if(!e&&i)return;let a=i&&!!this._indexedRuleSnapshot&&Oo(this.config.rules,this._indexedRuleSnapshot);(!i||!a)&&(n||=!!this._indexedRules,qi(this.config),this._indexedRules=this.config.rules,this._indexedRuleSnapshot=Do(this.config.rules),this._dynamicIndex=void 0,t=!0),this._preparedConfigMutable&&(r=r&&!!this._indexedRuleSnapshot&&ko(this._indexedRuleSnapshot),this._preparedCacheReliable=r),t&&this.clearRuntimeCaches(n)}collectValidatedParentOrders(e,t){for(let n of e){let e=n[3],r=this._stringifiedParentOrders.get(n);if(e!=null&&r!=null){let n=t.get(e);(n===void 0||r<n)&&t.set(e,r)}}}transferOutputOrder(e,t){let n=this._parsedOutputOrders.get(e);n&&this._stringifiedOutputOrders.set(t,n)}recordStringifiedContext(e,t){t?.currentSelector!==void 0&&this._stringifiedCurrentSelectors.set(e,t.currentSelector)}copyStringifiedUtil(e,t,n=!1){let r=e[4],i;if(r){let e=Object.create(null);for(let t of Reflect.ownKeys(r)){let i=Object.getOwnPropertyDescriptor(r,t);if(!i)continue;let a=i;n&&(a={configurable:!!a.configurable,enumerable:!!a.enumerable,value:`value`in a?a.value:Reflect.get(r,t),writable:!0}),(t===`prefix`||t===`autocomplete`)&&`value`in a&&Array.isArray(a.value)&&(a={...a,value:[...d(a.value)]}),e[t]=a}i=Object.defineProperties(Object.create(null),e)}let a=e[5],o=a?{...a,theme:Xr(a.theme),variantHandlers:[...d(a.variantHandlers)],variantMatch:[a.variantMatch[0],a.variantMatch[1],[...d(a.variantMatch[2])],new Set(a.variantMatch[3])]}:void 0;a&&o&&(Object.hasOwn(a,`rules`)?o.rules=a.rules?Xr(d(a.rules)):a.rules:delete o.rules,Object.hasOwn(a,`shortcuts`)?o.shortcuts=a.shortcuts?Xr(d(a.shortcuts)):a.shortcuts:delete o.shortcuts,Object.hasOwn(a,`variants`)?o.variants=a.variants?Xr(d(a.variants)):a.variants:delete o.variants);let s=[e[0],e[1],e[2],e[3],i,o,e[6]];if(t){let t=this._stringifiedCurrentSelectors.get(e);t!==void 0&&this._stringifiedCurrentSelectors.set(s,t);let n=this._stringifiedOutputOrders.get(e);n&&this._stringifiedOutputOrders.set(s,n);let r=this._stringifiedParentOrders.get(e);r!==void 0&&this._stringifiedParentOrders.set(s,r)}return s}copyValidatedStringifiedUtils(e,t,n=!1){let r=e,i=r.map(e=>this.copyStringifiedUtil(e,t,n));if(t){let e=new Map;for(let t=0;t<r.length;t++)e.set(r[t],i[t]);let t=new Map;for(let a=0;a<r.length;a++){let o=this._shortcutMergeOrders.get(r[a]);if(!o)continue;let s=t.get(o.group);if(!s){let r=t=>{let r=e.get(t);return r||(r=this.copyStringifiedUtil(t,!0,n),e.set(t,r)),r},i=o.components?.map(r),a=o.original?r(o.original):void 0;s={...o,components:i,group:{},original:a},t.set(o.group,s);for(let e of i??[])this._shortcutMergeOrders.set(e,s);a&&this._shortcutMergeOrders.set(a,s)}this._shortcutMergeOrders.set(i[a],s)}}return i}getDynamicIndex(e){return this._dynamicIndex?.config!==e&&(this._dynamicIndex={config:e,...Ia(e.rulesDynamic)}),this._dynamicIndex}constructor(e={},t={}){this.userConfig=e,this.defaults=t}async ensureInitialized(){this.config||(this._initialization||=(async()=>{let e=await sa(this.userConfig,this.defaults);this.config||(this.config=e,this._indexedRules=e.rules,this._indexedRuleSnapshot=Do(e.rules),this.dispatchConfig(e))})(),await this._initialization)}static constructPublic(e,t){return new Ho(e,t)}static async create(t={},n={}){let r=e.constructPublic(t,n);return await r.ensureInitialized(),r}async setConfig(e,t){if(await this.ensureInitialized(),!e)return;let n=await this.prepareConfig(e,t);this.commitConfig(n)}async prepareConfig(t,n){await this.ensureInitialized();let r=++this._configVersion,i=n??this.defaults,a=await sa(t,i),o=e.constructPublic(t,i);o.config=a,o._indexedRules=a.rules,o._indexedRuleSnapshot=Do(a.rules),o._preparedCacheSnapshot=Lo(a),o._preparedConfigMutable=!0,o._preparedCacheReliable=zo(o._preparedCacheSnapshot)&&ko(o._indexedRuleSnapshot);let s=Object.freeze({config:a,defaults:i,generator:o,userConfig:t,version:r});return this._preparedConfigs.add(s),s}commitConfig(e){if(!this._preparedConfigs.delete(e)||e.version!==this._configVersion||e.generator.config!==e.config)return!1;let t=e.generator;return t.ensureRuleIndexesCurrent(!0),this.defaults=e.defaults,this.userConfig=e.userConfig,this.clearRuntimeCaches(!0),this.config=e.config,this._indexedRules=t._indexedRules,this._indexedRuleSnapshot=t._indexedRuleSnapshot,this._preparedCacheSnapshot=t._preparedCacheSnapshot,this._preparedConfigMutable=t._preparedConfigMutable,this._preparedCacheReliable=t._preparedCacheReliable,this._dynamicIndex=void 0,this.dispatchConfig(this.config),!0}async applyExtractors(e,t,n=new Set){return this.applyExtractorsCurrent(e,t,n,!1)}async applyExtractorsCurrent(e,t,n,r){await this.ensureInitialized(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable);let i=this.config,a=this._runtimeRevision,o=qa(n),s=qa(o),c;try{c=await this.applyExtractorsForConfig(i,e,t,s)}catch(r){if(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==i||this._runtimeRevision!==a)return this.applyExtractorsCurrent(e,t,n,!0);throw r}return this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==i||this._runtimeRevision!==a?this.applyExtractorsCurrent(e,t,n,!0):(Ja(n,o,c),n)}async applyExtractorsForConfig(e,t,n,r){let i={original:t,code:t,id:n,extracted:r,envMode:e.envMode};for(let t of d(e.extractors)){let e=await Q(t,`extract`)?.call(t,i);if(!(!e||e===r))if(K(e)&&K(r))for(let t of e)r.setCount(t,r.getCount(t)+e.getCount(t));else for(let t of Array.isArray(e)?d(e):e)r.add(t)}return r}requireInitialized(e){if(this.config)return this.config;throw Error(`[Teacss] TeacssGenerator is not initialized; use await createGenerator() before calling ${e}().`)}makeContextForConfig(e,t,n){let r={rawSelector:e,currentSelector:t[1],theme:n.theme,generator:this,symbols:X,variantHandlers:t[2],constructCSS:(...e)=>this.constructCustomCSS(r,...e),variantMatch:t};return this._contextConfigs.set(r,n),r}makeContext(e,t){return this.makeContextForConfig(e,t,this.requireInitialized(`makeContext`))}getContextConfig(e){return e&&this._contextConfigs.get(e)||this.requireInitialized(`this synchronous entrypoint`)}async parseToken(e,t){let n=this._startingGenerationParse>0,r=await this.parseTokenInternal(e,t,n,!1);return r&&!n?this.copyValidatedStringifiedUtils(r,!0):r}async parseTokenInternal(e,t,n,r){await this.ensureInitialized(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable&&!n);let i=this.config,a=this._runtimeRevision,o=!this._preparedConfigMutable||this._preparedCacheReliable,s=o&&!t,c=()=>this.config!==i||this._runtimeRevision!==a,l=()=>(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),c()),u=()=>this.parseTokenInternal(e,t,n,!0);if(o&&this.blocked.has(e)){z(this.blocked,e);return}let f=e,p=s?this.cache.get(f):void 0;if(s&&(p!==void 0||this.cache.has(f))){R(this.cache,f,p);let e=p&&d(p);if(!e||e.length===0)return e;let t=e.filter(ao);if(t.length>0)return n||this.collectValidatedParentOrders(t,this.parentOrders),t;this.cache.delete(f)}let m=e,h=m;for(let t of d(i.preprocess)){let n;try{n=t(h)}catch(e){if(l())return u();throw e}if(c())return u();if(!n){s&&(z(this.blocked,e),R(this.cache,f,null));return}h=n}let g;try{g=this.isBlocked(h)}catch(e){if(l())return u();throw e}if(c())return u();if(g){s&&(z(this.blocked,e),R(this.cache,f,null));return}let _;try{_=await this.matchVariantsForConfig(m,h,i)}catch(e){if(l())return u();throw e}if(c())return u();let v;try{v=_.every(e=>!e||this.isBlocked(e[1]))}catch(e){if(l())return u();throw e}if(c())return u();if(v){s&&(z(this.blocked,e),R(this.cache,f,null));return}let y=async e=>{let r=this.makeContextForConfig(m,[t||e[0],e[1],e[2],e[3]],i);n&&this._generationContexts.add(r),i.details&&(r.variants=[...e[3]]);let a=await this.expandMatchedShortcut(r),o=a?await this.stringifyShortcuts(r.variantMatch,r,a[0],a[1],a[2]):(await this.parseUtil(r.variantMatch,r))?.flatMap(e=>this.stringifyUtil(e,r)).filter(kr);return{direct:!a,utils:o}},b;try{b=_.length===1?[await y(_[0])]:await Promise.all(_.map(e=>y(e)))}catch(e){if(l())return u();throw e}if(c()||this._preparedConfigMutable&&!n&&(this.ensureRuleIndexesCurrent(!0),c()))return u();let x=[],S={},C=0;for(let{direct:e,utils:t}of b)for(let n of t??[])e&&this._stringifiedOutputOrders.set(n,{group:S,index:C++}),Z(x,n);if(x?.length)return n||this.collectValidatedParentOrders(x,this.parentOrders),s&&R(this.cache,f,x),x;s&&R(this.cache,f,null)}parseTokenForGeneration(e){this._startingGenerationParse++;try{return this.parseToken(e)}finally{this._startingGenerationParse--}}getCachedEquivalentTokens(e){this.config&&this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0);let t=this.cache.get(e);if(!t)return[e];let n=new Set([e]);for(let[r,i]of this.cache.entries())i&&!r.endsWith(` -`)&&io(i,r,t,e)&&n.add(r);return[...n]}generate(e,t={}){let n=m(e)?void 0:++this._collectionGeneration;return this.generateInternal(e,t,!1,n)}async generateInternal(e,t,n,r){await this.ensureInitialized(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable);let i=this.config,a=this._runtimeRevision,o=!this._preparedConfigMutable||this._preparedCacheReliable,s=()=>this.config!==i||this._runtimeRevision!==a,c=()=>(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),s()),l=new Map,u=!o||r===void 0||!(this.cache instanceof re)?void 0:this.cache,f=u?.revision,p=$a(t,`id`),h=$a(t,`scope`),g=$a(t,`preflights`),_=$a(t,`safelist`),v=$a(t,`minify`),y=$a(t,`extendedInfo`),b=$a(t,`tokenConcurrency`),x=g===void 0||g,S=_===void 0||_,C=v!==void 0&&v,w=y!==void 0&&y,T=()=>this.generateInternal(e,t,!0,r);Xa(b);let E;try{E=m(e)?await this.applyExtractorsForConfig(i,e,p,w?new _r:new Set):Array.isArray(e)?lo(new Set(d(e))):K(e)?lo(Ka(e)):lo(new Set(e))}catch(e){if(c())return T();throw e}if(s())return T();try{if(S){let e={generator:this,theme:i.theme};for(let t=0;t<i.safelist.length;t++){if(!Object.hasOwn(i.safelist,t))continue;let n=i.safelist[t],r=typeof n==`function`?n(e):n;for(let e of d(r)){let t=e.trim();t&&!E.has(t)&&E.add(t)}}}}catch(e){if(c())return T();throw e}if(s())return T();let D=C?``:`
21
+ `,O=new Set([Se]),k=w?new Map:new Set,A=new Map,j=[],ee=new Map,M=Object.create(null),N=Array.from(E),P;try{P=await to(N,b,e=>this.parseTokenForGeneration(e))}catch(e){if(c())return T();throw e}if(s())return T();let F=0,I=u!==void 0,te=i.unmatched===`warn`||i.unmatched===`error`,ne=[];try{for(let e=0;e<N.length;e++){let t=N[e],n=P[e];if(n==null){te&&ai(t)&&!this.blocked.has(t)&&!this.isBlocked(t)&&!Object.hasOwn(i.rulesStaticMap,ii(t))&&Z(ne,t);continue}let r=this.copyValidatedStringifiedUtils(n,!0,!0);F++,I&&!u.isRetained(t)&&(I=!1),k instanceof Map?k.set(t,{data:this.copyValidatedStringifiedUtils(r,!1),count:K(E)?E.getCount(t):-1}):k.add(t),this.collectValidatedParentOrders(r,ee);for(let e of r){Z(j,e);let t=e[3]||``,n=$(e[4],`layer`);A.has(t)||A.set(t,[]),Z(A.get(t),e),n&&O.add(n)}}}catch(e){if(c())return T();throw e}if(s())return T();for(let[e,t]of ee){l.set(e,t);let n=this.parentOrders.get(e);(n===void 0||t<n)&&this.parentOrders.set(e,t)}try{await(async()=>{let e=d(i.preflights);if(!x||!e.length)return;let t={generator:this,generated:this.copyValidatedStringifiedUtils(j,!1),theme:i.theme},n=new Set,r=new Map;for(let t of e){let e=Q(t,`layer`)||`preflights`;O.add(e),n.add(e);let i=r.get(e);i?Z(i,t):r.set(e,[t])}M=Object.assign(Object.create(null),Object.fromEntries(await Promise.all(Array.from(n).map(async e=>[e,(await Promise.all(d(r.get(e)||[]).map(async e=>{let n=Q(e,`getCSS`);return n?await n.call(e,t):void 0}))).filter(Boolean).join(D)]))))})()}catch(e){if(c())return T();throw e}if(s())return T();let L,ie=()=>(L??=ne.flatMap(e=>{let t=mi(e,i);return t===void 0?[]:[{token:e,suggestions:t}]}),L);if(ne.length&&i.unmatched!==`off`&&i.unmatched!==void 0){let e=ie(),t=({token:e,suggestions:t})=>t.length?`"${e}" (did you mean ${t.map(e=>`"${e}"`).join(`, `)}?)`:`"${e}"`;if(i.unmatched===`error`){if(e.length)throw Error(`[@teacss/core] ${e.length} token${e.length===1?``:`s`} matched no rule: ${e.map(t).join(`; `)}`)}else if(i.warn)for(let n of e)this._warnedUnmatched.has(n.token)||(z(this._warnedUnmatched,n.token),console.warn(`[Teacss]`,`unmatched token ${t(n)}`))}let R;try{R=Bo({authoredOutputOrders:this._stringifiedOutputOrders,config:i,currentSelectors:this._stringifiedCurrentSelectors,layerSet:O,matched:k,minify:C,parentOrders:l,preflights:x,preflightsMap:M,scope:h,sheet:A,shortcutMergeOrders:this._shortcutMergeOrders,resolveUnmatched:ie}),await Promise.resolve(),this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0)}catch(e){if(c())return T();throw e}return s()?T():(u&&f!==void 0&&this.cache===u&&r===this._collectionGeneration&&(!I||F!==u.retainedSize)&&u.replaceRetained(Ya(N,P),f),R)}async matchVariants(e,t){return this.matchVariantsCurrent(e,t,!1)}async matchVariantsCurrent(e,t,n){await this.ensureInitialized(),this.ensureRuleIndexesCurrent(this._preparedConfigMutable);let r=this.config,i=this._runtimeRevision,a;try{a=await this.matchVariantsForConfig(e,t,r)}catch(n){if(this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==r||this._runtimeRevision!==i)return this.matchVariantsCurrent(e,t,!0);throw n}return this._preparedConfigMutable&&this.ensureRuleIndexesCurrent(!0),this.config!==r||this._runtimeRevision!==i?this.matchVariantsCurrent(e,t,!0):a}async matchVariantsForConfig(e,t,n){let r={rawSelector:e,theme:n.theme,generator:this};se(r,this._variantCacheOwner);let i=d(n.variants),a=async t=>{let n=!0,[,,o,s]=t;for(;n;){n=!1;let c=t[1];for(let e of i){let i=Q(e,`multiPass`)??!1;if(!i&&s.has(e))continue;let l=Q(e,`match`);if(!l)continue;let u=l.call(e,c,r),f=Ar(u)?await u:u;if(f){if(m(f)){if(f===c)continue;f={matcher:f}}if(Array.isArray(f)){let n=d(f).map(e=>e);if(!n.length)continue;if(n.length===1)f=n[0];else{if(i)throw Error(`multiPass can not be used together with array return variants`);let r=n.map(n=>{let r=Q(n,`matcher`)??c,i=[n,...o],a=new Set(s);return a.add(e),[t[0],r,i,a]});return(await Promise.all(r.map(e=>a(e)))).flat()}}t[1]=Q(f,`matcher`)??c,Ga(o,f),s.add(e),n=!0;break}}if(!n)break;if(o.length>500)throw Error(`Too many variants applied to "${e}"`)}return[t]};return await a([e,t||e,[],new Set])}applyVariants(e,t=e[4],n=e[1],r=Yo(n),i){let a=d(t).map(eo),o=a.length>1?a.sort((e,t)=>(e.order||0)-(t.order||0)):a,s={prefix:``,selector:r,pseudo:``,entries:e[2]},c=o.length?o.reduceRight((e,t)=>n=>{let r=Q(n,`entries`)??[],i=Q(n,`parent`),a=Q(n,`parentOrder`),o=Q(n,`selector`)??``,s=t.body?.call(t.source,r)||r,c=Array.isArray(t.parent)?Object.hasOwn(t.parent,0)?t.parent[0]:void 0:t.parent,l=Array.isArray(t.parent)&&Object.hasOwn(t.parent,1)?t.parent[1]:void 0,u=c||i,d=t.selector?.call(t.source,o,s);return(t.handle??Xo).call(t.source,{...n,entries:s,selector:d??o,parent:u,parentOrder:l??(u===i?a:void 0),layer:t.layer||Q(n,`layer`),sort:t.sort??Q(n,`sort`)},e)},e=>e)(s):s,l=Q(c,`parent`),u=Q(c,`parentOrder`),f=this.getContextConfig(i),p={selector:[Q(c,`prefix`)??``,Q(c,`selector`)??``,Q(c,`pseudo`)??``].join(``),entries:Q(c,`entries`)??[],parent:l,layer:Q(c,`layer`),sort:Q(c,`sort`),noMerge:Q(c,`noMerge`)};l!=null&&u!=null&&this._utilParentOrders.set(p,u);let m=d(f.postprocess);return m.length?m.reduce((e,t)=>{let n=[];for(let r of e){let e=this._utilParentOrders.get(r),i=r.parent;e!=null&&this._utilParentOrders.delete(r);let a=t(r);if(Array.isArray(a))for(let t of d(a).filter(kr))e!=null&&t.parent===i&&this._utilParentOrders.set(t,e),Z(n,t);else{let t=a||r;e!=null&&t.parent===i&&this._utilParentOrders.set(t,e),Z(n,t)}}return n},[p]):[p]}constructCustomCSS(e,t,n){let r=zr(t);return this.constructNormalizedCSS(e,r,n)}constructNormalizedCSS(e,t,n){if(m(t))return t;let r=[];for(let e=0;e<t.length;e++){if(!Object.hasOwn(t,e))continue;let n=t[e];if(!Object.hasOwn(n,0))continue;let i=n[0];typeof i==`string`?Z(r,n):i===X.body&&Z(r,[Hr,Object.hasOwn(n,1)?n[1]:void 0])}let i=this.applyVariants([0,n||e.rawSelector,r,void 0,e.variantHandlers],void 0,void 0,void 0,e).map(e=>{let{selector:t,entries:n,parent:r,layer:i,sort:a,noMerge:o}=e;return{body:Wr(n),layer:i,noMerge:o,parent:r,parentOrder:this._utilParentOrders.get(e),selector:t,sort:a}}).filter(e=>!!e.body);if(!i.length)return``;let a=i.map(e=>{let t=`${e.selector}{${e.body}}`;return e.parent?mo(e.parent,t):t}).join(``),o=e,s=this._constructedCSSResults.get(o);s||(s=new Map,this._constructedCSSResults.set(o,s));let c=a;return s.has(c)&&(c=`${a}\n${(++this._constructedCSSSequence).toString(2).replaceAll(`0`,` `).replaceAll(`1`,` `)}\n`),s.set(c,i),c}async parseUtil(e,t,n=!1,r){await this.ensureInitialized();let i=Object.hasOwn(t,`rules`),a=t.rules,o=a?.length,s=()=>{a&&o!==void 0?(a.length=o,t.rules=a):i?t.rules=a:delete t.rules};this.getContextConfig(t)===this.config&&this._preparedConfigMutable&&!this._generationContexts.has(t)&&this.ensureRuleIndexesCurrent(!0);let c=this.getContextConfig(t),l=c===this.config&&this._preparedConfigMutable&&!this._generationContexts.has(t),u=this._runtimeRevision,f=m(e)?await this.matchVariantsForConfig(e,void 0,c):[e],p=async([e,i,a])=>{c.details&&(t.rules=t.rules??[]);let o={...t,variantHandlers:a};this._contextConfigs.set(o,this.getContextConfig(t));let s;o.constructCSS=(...e)=>{if(!n||!t.variantHandlers.length)return this.constructCustomCSS(o,...e);let r=zr(e[0]);if(!m(r)&&so(r))return this.constructNormalizedCSS(o,r,e[1]);s||(s={...o,variantHandlers:co(o.variantHandlers,t.variantHandlers)},this._contextConfigs.set(s,this.getContextConfig(t)));let i=this.constructNormalizedCSS(s,r,e[1]),a=this._constructedCSSResults.get(s)?.get(i);if(a){let e=this._constructedCSSResults.get(o);e||(e=new Map,this._constructedCSSResults.set(o,e)),e.set(i,a)}return i};let l=c.rulesStaticMap[i];if(r){l=void 0;let e=d(r);for(let t=c.rules.length-1;t>=0;t--){let n=c.rules[t];if(!Zr(n)||n[0]!==i)continue;let r=$(n[2],`prefix`);if(!r||d(r).some(t=>e.includes(t))){l=n;break}}}let u=l,f=()=>{let t=u;if(u=void 0,!(!t?.[1]||!n&&$(t[2],`internal`)))return this.resolveCSSResult(e,t[1],t,o)},p=i.indexOf(`:`),h=this.getDynamicIndex(c),g=p>0&&h.map.get(i.slice(0,p))||h.fallback;for(let t of g){let[a,s,c]=t;if(($(u?.[2],`__index`)??-1)>($(c,`__index`)??-1)){let e=f();if(e)return e}if($(c,`internal`)&&!n)continue;let l=[i],p=$(c,`prefix`);if(p){let e=d(p);if(r){let t=d(r);if(!e.some(e=>t.includes(e)))continue}else if(l=e.filter(e=>i.startsWith(e)).map(e=>i.slice(e.length)),!l.length)continue}for(let n of l){let r=ro(n,a);if(!r)continue;let i=s(r,o),c=Ar(i)?await i:i;if(!c)continue;if(typeof c!=`string`&&(typeof c==`object`||typeof c==`function`)){let e=Array.isArray(c)?void 0:Q(c,Symbol.asyncIterator),t=Array.isArray(c)?void 0:Q(c,Symbol.iterator);if(e){let t=[],n=e.call(c);for(;;){let e=await n.next();if(e.done)break;e.value&&Z(t,e.value)}c=t}else if(t){let e=[],n=t.call(c);for(;;){let t=n.next();if(t.done)break;t.value!=null&&Z(e,t.value)}c=e}}let l=this.resolveCSSResult(e,c,t,o);if(l)return l}}return f()},h=f.length===1?await p(f[0])??[]:(await Promise.all(f.map(e=>p(e)))).flat().filter(e=>!!e);if(l&&(this.ensureRuleIndexesCurrent(!0),this.config===c&&this._runtimeRevision!==u))return s(),this.parseUtil(e,t,n,r);if(h.length)return h}resolveCSSResult=(e,t,n,r)=>{let i=Br(t).filter(e=>e.length);if(i.length){let t=this.getContextConfig(r);t.details&&Z(r.rules,n),t===this.config&&r.generator.activatedRules.add(n);let a=n[2],o={},s=0,c=e=>(this._parsedOutputOrders.set(e,{group:o,index:s++}),e);return i.flatMap(t=>{let n;if(m(t)){let e=this._constructedCSSResults.get(r)?.get(t);return e?e.map(e=>{let t=[$(a,`__index`),e.body,a];return this._rawUtilMetadata.set(t,e),c(t)}):(n=[$(a,`__index`),t,a],[c(n)])}let i=[],o=r.variantHandlers,s=a,l=e=>{o=[e,...o]},u=e=>{o=[...o,e]},f=e=>{s={...s,...e}};for(let e=0;e<t.length;e++){if(!Object.hasOwn(t,e))continue;let n=t[e],r=Object.hasOwn(n,0)?n[0]:void 0,a=()=>Object.hasOwn(n,1)?n[1]:void 0;switch(r){case X.variants:{let e=a();if(typeof e==`function`){let t=e(o);t&&(o=d(t).map(e=>e))}else o=[...d(e),...o];break}case X.parent:l({parent:a()});break;case X.selector:u({selector:a()});break;case X.layer:l({layer:a()});break;case X.sort:f({sort:a()});break;case X.noMerge:f({noMerge:a()});break;case X.noScope:f({noScope:a()});break;case X.shortcutsNoMerge:Z(i,n);break;case X.body:Z(i,[Hr,a()]);break;default:typeof r==`string`&&Z(i,n)}}return n=[$(a,`__index`),e,i,s,o],[c(n)]})}};stringifyUtil(e,t){if(!e)return;let n=this.getContextConfig(t);if(Or(e)){let r=this._rawUtilMetadata.get(e),i=e[2];if(r?.layer!==void 0||r?.sort!==void 0){let t={...e[2]??{}},n=$(e[2],`layer`),a=$(e[2],`sort`);delete t.layer,delete t.sort,i={...t,layer:r.layer??n,sort:r.sort??a}}let a=[e[0],r?.selector,r?.body??e[1],r?.parent,i,n.details?t:void 0,r?.noMerge];return this.transferOutputOrder(e,a),this.recordStringifiedContext(a,t),r?.parent!=null&&r.parentOrder!=null&&this._stringifiedParentOrders.set(a,r.parentOrder),[a]}let r=this.applyVariants(e,void 0,void 0,void 0,t),i=[];for(let a of r){let{selector:r,entries:o,parent:s,layer:c,sort:l,noMerge:u}=a,d=Wr(o);if(!d)continue;let f=e[3];if(c!==void 0||l!==void 0){let{layer:t,sort:n,...r}=e[3]??{};f={...r,layer:c??t,sort:l??n}}let p=[e[0],r,d,s,f,n.details?t:void 0,u];this.transferOutputOrder(e,p),this.recordStringifiedContext(p,t);let m=this._utilParentOrders.get(a);s!=null&&m!=null&&this._stringifiedParentOrders.set(p,m),Z(i,p)}return i}async expandShortcut(e,t,n=5){return await this.ensureInitialized(),this.expandConfiguredExpansions(e,t,n,this.getContextConfig(t).shortcuts,`shortcut`)}async expandMatchedShortcut(e,t=5){return this.expandConfiguredExpansionsForInput(e.variantMatch,e,t,this.getContextConfig(e).shortcuts,`shortcut`)}async expandConfiguredExpansions(e,t,n,r,i,a,o){await this.ensureInitialized();let s=await this.expandConfiguredExpansionsForInput(e,t,n,r,i,a,o);if(!s)return;let c=[s[0],s[1]];return this._expansionPrefixes.set(c,s[2]),this._expansionPrefixes.set(c[0],s[2]),c}async expandConfiguredExpansionsForInput(e,t,n,r,i,a,o){let s=d(r);if(n<=0||!s.length)return;let c=this.getContextConfig(t),l=m(e)?e:e[1],u=c.details?e=>{t.shortcuts=t.shortcuts??[],Z(t.shortcuts,e)}:jr,f,p,h,g,_=o;expansionLoop:for(let e of s){if(!Array.isArray(e)||!Object.hasOwn(e,0)||!Object.hasOwn(e,1))continue;let n=Object.hasOwn(e,2)?e[2]:void 0,r=[{prefix:o,value:l}];if(n?.prefix){let e=d(n.prefix);if(r=e.filter(e=>l.startsWith(e)).map(e=>({prefix:e,value:l.slice(e.length)})),o&&e.includes(o)&&Z(r,{prefix:o,value:l}),!r.length)continue}for(let i of r){if(m(e[0])){if(e[0]!==i.value)continue;p=e[1]}else{let n=ro(i.value,e[0]);n&&(p=e[1](n,t))}if(p){_=i.prefix,f||=n,u(e);break expansionLoop}}}if(p){let e=m(p)?[p]:d(p);h=e.filter(e=>m(e)).flatMap(e=>gi(zi(e.trim(),c.separators))).map(e=>({prefix:_,value:e})),g=e.filter(e=>!m(e)).map(e=>({handles:[],value:e}))}if(!p&&m(e)){let s=await this.matchVariantsForConfig(e,void 0,c);for(let e of s){let[s,c,l]=e;if(s!==c){let e=await this.expandConfiguredExpansions(c,t,n-1,r,i,a,o);if(e){let t=this._expansionPrefixes.get(e)??[];h??=[];for(let n=0;n<e[0].length;n++){let r=e[0][n];m(r)&&Z(h,{prefix:t[n]??o,value:s.replace(c,()=>r)})}g??=[],Wa(g,e[0].filter(e=>!m(e)).map(e=>({handles:[...e.handles,...l],value:e.value})))}}}}if(!h?.length&&!g?.length)return;let v=new Map,y=(h??[]).filter(({prefix:e,value:t})=>{let n=v.get(e);return n||(n=new Set,v.set(e,n)),n.has(t)?!1:(n.add(t),!0)}),b=[...(await Promise.all(y.map(async({prefix:e,value:o})=>{let s=await this.expandConfiguredExpansions(o,t,n-1,r,i,a,e),c=s?void 0:await a?.(o,t,n-1),l=s??c;if(!l)return[{prefix:e,value:o}];let u=this._expansionPrefixes.get(l)??[];return l[0].map((t,n)=>({prefix:u[n]??e,value:t}))}))).flat(),...(g??[]).map(e=>({prefix:_,value:e}))].filter(({value:e})=>!!e);return[b.map(({value:e})=>e),f,b.map(({prefix:e})=>e)]}async stringifyShortcuts(e,t,n,r,i){await this.ensureInitialized();let a=this.getContextConfig(t);r={...r,layer:$(r,`layer`)??a.shortcutsLayer};let o=i??this._expansionPrefixes.get(n)??[],s=new Pr,c=(await Promise.all(n.map(async(n,i)=>{let s=m(n)?await this.parseUtil(n,t,!0,o[i]??$(r,`prefix`)):[[1/0,`{inline}`,zr(n.value),void 0,n.handles]];return!s&&a.warn&&Vi(`unmatched utility "${n}" in shortcut "${e[1]}"`),s||[]}))).flat(1).filter(Boolean).sort((e,t)=>e[0]-t[0]);a.details&&t.rules&&t.rules.length>1&&t.rules.sort((e,t)=>($(e[2],`__index`)??1/0)-($(t[2],`__index`)??1/0));let[l,,u]=e,f=c.some(Or),p={},h=0,g=[],_=e=>{let t=this._shortcutMergeOrders.get(e)?.components;if(!t?.length){this._stringifiedOutputOrders.set(e,{group:p,index:h++});return}let n;for(let e of t){let t={group:p,index:h++};n??=t,this._stringifiedOutputOrders.set(e,t)}n&&this._stringifiedOutputOrders.set(e,n)};for(let e of c){if(Or(e)){let n=this._rawUtilMetadata.get(e),i={...e[2],...r,layer:n?.layer??$(r,`layer`),sort:n?.sort??$(r,`sort`)??$(e[2],`sort`)},o=[e[0],n?.selector,n?.body??e[1],n?.parent,i,a.details?t:void 0,n?.noMerge];this.recordStringifiedContext(o,t),n?.parent!=null&&n.parentOrder!=null&&this._stringifiedParentOrders.set(o,n.parentOrder),_(o),Z(g,o);continue}let n=so(e[2]),i=n?e[4]:co(e[4],u);for(let o of this.applyVariants(e,i,l,void 0,t)){let{selector:i,entries:c,parent:l,sort:u,noMerge:d,layer:p}=o,m=!!(d??$(r,`noMerge`)??$(e[3],`noMerge`)),h=!!($(r,`noScope`)??$(e[3],`noScope`)),v=$(r,`sort`),y=$(r,`layer`),b=n?v??0:u??v??$(e[3],`sort`)??0;if(f){let n=Wr(c);if(!n)continue;let s=[e[0],i,n,l,{...r,noMerge:m,noScope:h,sort:b,layer:p??y},a.details?t:void 0,void 0];this.recordStringifiedContext(s,t);let u=this._utilParentOrders.get(o);l!=null&&u!=null&&this._stringifiedParentOrders.set(s,u),_(s),Z(g,s);continue}let x=s.getFallback(p??y,{ordered:[],streams:new Map}),S=x.streams.get(l);S||(S=[],x.streams.set(l,S));let C=S[S.length-1];(!C||C.selector!==i||C.noScope!==h)&&(C={entries:[],noScope:h,parent:l,parentOrder:void 0,selector:i},Z(S,C),Z(x.ordered,C)),Z(C.entries,[c,m,b,e[0]]);let w=this._utilParentOrders.get(o);w!=null&&(C.parentOrder==null||w<C.parentOrder)&&(C.parentOrder=w)}}let v=s.flatMap((e,n)=>e.ordered.map(({entries:e,noScope:i,parentOrder:o,selector:s,parent:c})=>{let l=(e,l,u)=>{if(!u.length)return[];let d=Math.max(...u.map(e=>e[1])),f=Math.max(...u.map(e=>e[2])),p=e&&u.length>1?u.map(([e,t,n])=>[e.map(e=>[e[0],e[1]]),t,n]):u,m=p.map(e=>e[0]);return(e?[m.flat(1)]:m).map((u,m)=>{let h=Wr(u);if(h){let u={...r,noMerge:l,noScope:i,sort:d,layer:n},g=[f,s,h,c,u,a.details?t:void 0,void 0];this.recordStringifiedContext(g,t),c!=null&&o!=null&&this._stringifiedParentOrders.set(g,o);let _=e?p:[p[m]],v={flatten:e,group:{}};return v.components=e&&_.length>1?_.map(([n,r,i])=>{let l=e?Wr(n):h;if(!l)return;let d=[i,s,l,c,{...u,sort:r},a.details?t:void 0,void 0];return this.recordStringifiedContext(d,t),c!=null&&o!=null&&this._stringifiedParentOrders.set(d,o),this._shortcutMergeOrders.set(d,v),d}).filter(kr):void 0,v.original=g,this._shortcutMergeOrders.set(g,v),g}})},u=[],f=[],p=[],m=[];for(let[t,n,r,i]of e){let e=d(t).some(oo);Z(n?e?u:f:e?p:m,[t,r,i])}return[...l(!1,!0,u),...l(!0,!0,f),...l(!1,!1,p),...l(!0,!1,m)].filter(kr)}).flat(1).filter(Boolean));for(let e of v)_(e);return g.concat(v)}isBlocked(e){if(!e)return!0;let{blocklist:t}=this.requireInitialized(`isBlocked`);for(let n=0;n<t.length;n++){if(!Object.hasOwn(t,n))continue;let r=t[n],i=Array.isArray(r)?Object.hasOwn(r,0)?r[0]:void 0:r;if(i!==void 0&&this.matchesBlocklist(i,e))return!0}return!1}getBlocked(e){let{blocklist:t}=this.requireInitialized(`getBlocked`);for(let n=0;n<t.length;n++){if(!Object.hasOwn(t,n))continue;let r=t[n],i=Array.isArray(r)?Object.hasOwn(r,0)?r[0]:void 0:r;if(!(i===void 0||!this.matchesBlocklist(i,e)))return[i,Array.isArray(r)&&Object.hasOwn(r,1)?r[1]:void 0]}}matchesBlocklist(e,t){return typeof e==`function`?!!e(t):m(e)?e===t:ro(t,e)!==null}},Ho=class extends Vo{constructor(e={},t={}){super(e,t)}};async function Uo(e,t){return await Vo.create(e,t)}const Wo=/\s\$\$\s+/g;function Go(e){return go(e).length>0}function Ko(e){let t=[],n=0,r=!1,i=0,a,o=0;for(let s=0;s<e.length;s++){let c=e[s];r?c===`*`&&e[s+1]===`/`&&(r=!1,s++):a?c===`\\`?s++:c===a&&(a=void 0):c===`/`&&e[s+1]===`*`?(r=!0,s++):c===`\\`?s++:c===`"`||c===`'`?a=c:c===`[`?n++:c===`]`?n>0&&n--:c===`(`?i++:c===`)`?i>0&&i--:c===`,`&&n===0&&i===0&&(Z(t,e.slice(o,s).trim()),o=s+1)}return Z(t,e.slice(o).trim()),t}function qo(e,t){return Ko(e).map(e=>{let n=e.startsWith(`$$`)&&/\s/.test(e[2]??``)?` ${e}`:e;return t?Go(n)?_o(n,t):`${t} ${e}`:_o(n)}).join(`,`)}const Jo=/^\[(.+?)(~?=)"(.*)"\]$/;function Yo(e){return Jo.test(e)?e.replace(Jo,(e,t,n,r)=>`[${Tn(t)}${n}"${Tn(r)}"]`):`.${Tn(e)}`}function Xo(e,t){return t(e)}const Zo=e.hash??((t,n,r)=>e.createHash(t).update(n).digest(r));function Qo(e,t=8){return Zo(`sha256`,e,`hex`).substring(0,t)}const $o=`@teacss-include`,es=`@teacss-ignore`,ts=`@teacss-ide-include`,ns=`@teacss-placeholder`,rs=`@teacss-skip-start`,is=`@teacss-skip-end`,as=RegExp(`(//\\s*?${rs}\\s*?|\\/\\*\\s*?${rs}\\s*?\\*\\/|<!--\\s*?${rs}\\s*?-->)[\\s\\S]*?(//\\s*?${is}\\s*?|\\/\\*\\s*?${is}\\s*?\\*\\/|<!--\\s*?${is}\\s*?-->)`,`g`),os=[/^(?:virtual:)?tea(?::(.+))?\.css(\?.*)?$/],ss=`__ALL__`;export{Pr as BetterMap,ns as CSS_PLACEHOLDER,_r as CountableSet,Ce as DEFAULT_LAYERS,es as IGNORE_COMMENT,$o as INCLUDE_COMMENT,ts as INCLUDE_COMMENT_IDE,_e as LAYER_IMPORTS,ss as LAYER_MARK_ALL,be as LAYER_PREFLIGHTS,ve as LAYER_PRIMITIVES,ye as LAYER_PROPERTIES,xe as LAYER_SHORTCUTS,Se as LAYER_UTILITIES,Gr as RESET_KEY,as as SKIP_COMMENT_RE,is as SKIP_END_COMMENT,rs as SKIP_START_COMMENT,Ho as TeacssGenerator,Nr as TwoKeyMap,os as VIRTUAL_ENTRY_ALIAS,Hr as VirtualKey,Sr as attributifyRE,F as buildConditionSelector,Vr as clearIdenticalEntries,Xr as clone,Ri as collapseVariantGroup,Ba as comparableWidth,po as compareParentAtRules,ge as createConditionVariant,Uo as createGenerator,yr as createNanoEvents,Cr as cssIdRE,Ln as defaultSplitRE,ya as definePreset,mi as diagnoseUnmatchedToken,Tn as e,Wr as entriesToCss,Cn as escapeRegExp,wn as escapeSelector,xn as expandClassGroups,gn as expandGroups,_i as expandUnderscores,zi as expandVariantGroup,gr as extractorDefault,gr as extractorSplit,ba as getEnvFlags,Qo as getHash,On as getPath,Go as hasScopePlaceholder,An as hash,Ei as isArbitrary,Tr as isAttributifySelector,K as isCountableSet,kn as isCssId,q as isObject,Or as isRawUtil,Zr as isStaticRule,Qr as isStaticShortcut,m as isString,Ar as isThenable,ai as isTokenShaped,Er as isValidSelector,C as isValidTargetSelector,Ii as makeRegexClassGroup,ma as mergeConfigs,qr as mergeDeep,jr as noop,Di as normalizeArbitraryValue,zr as normalizeCSSEntries,Br as normalizeCSSValues,Dr as normalizeVariant,kr as notNull,he as parseClassToken,D as parseCondition,O as parseConditions,Li as parseVariantGroup,Wo as regexScopePlaceholder,Fn as replaceAsync,P as resolveConditions,sa as resolveConfig,ra as resolvePreset,ia as resolvePresets,ea as resolveShortcuts,Pn as restoreSkipCode,Ti as spaceCalcOperators,gi as splitClassTokens,Rn as splitWithVariantGroupRE,X as symbols,d as toArray,Yo as toEscapedSelector,ii as tokenConditionBase,Nn as transformSkipCode,f as uniq,p as uniqueBy,wr as validateFilterRE,Vi as warnOnce,Mr as withLayer};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teacss/core",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "TeaCSS engine core — token parsing, condition resolution, rule matching, and CSS generation.",
5
5
  "homepage": "https://css.teasim.com",
6
6
  "funding": "https://github.com/sponsors/billgo",