sheetom 0.1.0-rc.8 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["generatedEngineAbiIdentity.abiVersion","generatedEngineAbiIdentity.sheetomVersion","generatedEngineAbiIdentity.syntaxEngineSetSha256","#state","#reportDiagnostic","#reservedNestingDepth","#serializationCache","#observableCache","toUnsignedLong","#invalidateSerialization","#children","#setParentage","#parentStyleSheet","#describe","#type","#rules","#resourceBudget","#mediaText","#conditionText","#parameters","#names","#rawHref","#cssText","#block","#style","#selectorText","#keyText","#name","#descriptors","#serializedName","#get","#set","#values","#serializedNames","#fontFamily","#diagnostics","#constructedBaseURL","#reportDiagnostic"],"sources":["../engine-abi.json","../src/internal/engine-binding.ts","../src/internal/native-binding.ts","../src/internal/default-engine-binding.ts","../src/internal/resource-budget.ts","../src/internal/native-declaration-block.ts","../src/internal/css-rule-scanner.ts","../src/internal/native-rule-parser.ts","../src/internal/native-rule-syntax.ts","../src/internal/rule-tree.ts","../src/internal/native-counter-style.ts","../src/internal/serializer.ts","../src/internal/webidl-construction.ts","../src/index.ts"],"sourcesContent":["","import generatedEngineAbiIdentity from \"../../engine-abi.json\" with { type: \"json\" };\n\ntype EngineBudgetArguments = [number, number, number, number, number];\n\nexport interface EngineAbiIdentity {\n abiVersion: number;\n sheetomVersion: string;\n syntaxEngineSetSha256: string;\n}\n\nexport const expectedEngineAbiIdentity: Readonly<EngineAbiIdentity> = Object.freeze({\n abiVersion: generatedEngineAbiIdentity.abiVersion,\n sheetomVersion: generatedEngineAbiIdentity.sheetomVersion,\n syntaxEngineSetSha256: generatedEngineAbiIdentity.syntaxEngineSetSha256,\n});\n\nexport type EngineMutationOutcome =\n | \"applied\"\n | \"invalid-name\"\n | \"invalid-priority\"\n | \"invalid-value\"\n | \"unsupported-shorthand\";\n\nexport interface EngineDeclarationStateHandle {\n readonly length: number;\n readonly cssText: string;\n item(index: number): string;\n getPropertyValue(name: string): string;\n getPropertyPriority(name: string): string;\n setProperty(\n name: string,\n value: string,\n priority: string,\n reservedNestingDepth?: number,\n ): EngineMutationOutcome;\n removeProperty(name: string): string;\n replaceCssText(source: string, reservedNestingDepth?: number): void;\n serializeFormatted(safe: boolean, indent: string, separator: string): string;\n}\n\nexport interface EngineBindingIdentityProvider {\n engineAbiIdentity(): string;\n}\n\n/** Transport-neutral private contract implemented by native and WebAssembly engines. */\nexport interface EngineBinding extends EngineBindingIdentityProvider {\n normalizeMedia(source: string, ...budget: EngineBudgetArguments): string;\n normalizeSelector(source: string, ...budget: EngineBudgetArguments): string;\n normalizeSupports(source: string, ...budget: EngineBudgetArguments): string;\n parseContainerPreludeJson(source: string, ...budget: EngineBudgetArguments): string;\n parseCounterStyleDescriptorValue(\n name: string,\n value: string,\n ...budget: EngineBudgetArguments\n ): string | null;\n parseCounterStyleDescriptorsJson(source: string, ...budget: EngineBudgetArguments): string;\n parseCounterStyleNameJson(source: string, ...budget: EngineBudgetArguments): string | null;\n serializeIdentifierValue(value: string): string;\n serializeFontFamilyValue(value: string): string;\n createDeclarationState(\n context?: \"style\" | \"font-face\" | \"function\",\n ...budget: EngineBudgetArguments\n ): EngineDeclarationStateHandle;\n parseRecoveredRuleTreeJson(source: string, ...budget: EngineBudgetArguments): string;\n parseRecoveredSingleRuleTreeJson(source: string, ...budget: EngineBudgetArguments): string;\n parseStylesheetTreeJson(\n source: string,\n errorRecovery: boolean,\n ...budget: EngineBudgetArguments\n ): string;\n parseScopePreludeJson(source: string, ...budget: EngineBudgetArguments): string;\n scanTopLevelRulesJson(source: string, ...budget: EngineBudgetArguments): string;\n}\n\nexport class SheetOMEngineBindingError extends Error {\n readonly code: \"SHEETOM_ENGINE_ABI_INVALID\" | \"SHEETOM_ENGINE_ABI_MISMATCH\";\n\n constructor(\n code: \"SHEETOM_ENGINE_ABI_INVALID\" | \"SHEETOM_ENGINE_ABI_MISMATCH\",\n message: string,\n options?: ErrorOptions,\n ) {\n super(message, options);\n this.name = \"SheetOMEngineBindingError\";\n this.code = code;\n }\n}\n\nexport function validateEngineBindingIdentity(provider: EngineBindingIdentityProvider): void {\n let parsed: unknown;\n try {\n parsed = JSON.parse(provider.engineAbiIdentity());\n } catch (cause) {\n throw new SheetOMEngineBindingError(\n \"SHEETOM_ENGINE_ABI_INVALID\",\n \"SheetOM could not decode the engine ABI identity.\",\n { cause },\n );\n }\n\n if (!isEngineAbiIdentity(parsed)) {\n throw new SheetOMEngineBindingError(\n \"SHEETOM_ENGINE_ABI_INVALID\",\n \"SheetOM received an invalid engine ABI identity.\",\n );\n }\n if (\n parsed.abiVersion === expectedEngineAbiIdentity.abiVersion\n && parsed.sheetomVersion === expectedEngineAbiIdentity.sheetomVersion\n && parsed.syntaxEngineSetSha256 === expectedEngineAbiIdentity.syntaxEngineSetSha256\n ) return;\n\n throw new SheetOMEngineBindingError(\n \"SHEETOM_ENGINE_ABI_MISMATCH\",\n \"SheetOM refused an incompatible engine binding.\",\n );\n}\n\nfunction isEngineAbiIdentity(value: unknown): value is EngineAbiIdentity {\n if (typeof value !== \"object\" || value === null) return false;\n const identity = value as Partial<EngineAbiIdentity>;\n return Number.isSafeInteger(identity.abiVersion)\n && typeof identity.sheetomVersion === \"string\"\n && /^[0-9a-f]{64}$/u.test(identity.syntaxEngineSetSha256 ?? \"\");\n}\n","import { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport {\n type EngineBinding,\n type EngineDeclarationStateHandle,\n validateEngineBindingIdentity,\n} from \"./engine-binding.js\";\n\ninterface NativeAddonBinding extends Omit<EngineBinding, \"createDeclarationState\"> {\n NativeDeclarationState: new (\n context?: \"style\" | \"font-face\" | \"function\",\n ...budget: [number, number, number, number, number]\n ) => EngineDeclarationStateHandle;\n}\n\nfunction loadBinding(): EngineBinding {\n const moduleDirectory = path.dirname(fileURLToPath(import.meta.url));\n const packageRoot = path.basename(moduleDirectory) === \"dist\"\n ? path.dirname(moduleDirectory)\n : path.resolve(moduleDirectory, \"../..\");\n const require = createRequire(import.meta.url);\n const addon = require(path.join(packageRoot, \"native\", \"index.cjs\")) as NativeAddonBinding;\n validateEngineBindingIdentity(addon);\n return {\n ...addon,\n createDeclarationState: (context, ...budget) => new addon.NativeDeclarationState(\n context,\n ...budget,\n ),\n };\n}\n\nexport const nativeEngineBinding = loadBinding();\n","import type { EngineBinding } from \"./engine-binding.js\";\nimport { nativeEngineBinding } from \"./native-binding.js\";\n\n/** The synchronous root package uses the native adapter exclusively. */\nexport const engineBinding: EngineBinding = nativeEngineBinding;\n","export interface SheetOMResourceBudget {\n maxStylesheetBytes?: number;\n maxDeclarationValueBytes?: number;\n maxSyntaxDepth?: number;\n maxRuleCount?: number;\n maxDeclarationsPerBlock?: number;\n}\n\nexport interface NativeResourceBudget {\n readonly maxStylesheetBytes: number;\n readonly maxDeclarationValueBytes: number;\n readonly maxSyntaxDepth: number;\n readonly maxRuleCount: number;\n readonly maxDeclarationsPerBlock: number;\n}\n\nexport const defaultResourceBudget: NativeResourceBudget = Object.freeze({\n maxStylesheetBytes: 64 * 1024 * 1024,\n maxDeclarationValueBytes: 1024 * 1024,\n maxSyntaxDepth: 4096,\n maxRuleCount: 1_000_000,\n maxDeclarationsPerBlock: 100_000,\n});\n\nconst maximumUnsignedLong = (2 ** 32) - 1;\nconst maximumConfigurableSyntaxDepth = 16_384;\n\nexport function normalizeResourceBudget(\n value: SheetOMResourceBudget | null | undefined,\n): NativeResourceBudget {\n if (\n value !== undefined\n && value !== null\n && (typeof value !== \"object\" || Array.isArray(value))\n ) {\n throw new TypeError(\"resourceBudget must be an object\");\n }\n const input = value ?? {};\n return Object.freeze({\n maxStylesheetBytes: limitValue(\n input.maxStylesheetBytes,\n \"maxStylesheetBytes\",\n defaultResourceBudget.maxStylesheetBytes,\n ),\n maxDeclarationValueBytes: limitValue(\n input.maxDeclarationValueBytes,\n \"maxDeclarationValueBytes\",\n defaultResourceBudget.maxDeclarationValueBytes,\n ),\n maxSyntaxDepth: limitValue(\n input.maxSyntaxDepth,\n \"maxSyntaxDepth\",\n defaultResourceBudget.maxSyntaxDepth,\n maximumConfigurableSyntaxDepth,\n ),\n maxRuleCount: limitValue(\n input.maxRuleCount,\n \"maxRuleCount\",\n defaultResourceBudget.maxRuleCount,\n ),\n maxDeclarationsPerBlock: limitValue(\n input.maxDeclarationsPerBlock,\n \"maxDeclarationsPerBlock\",\n defaultResourceBudget.maxDeclarationsPerBlock,\n ),\n });\n}\n\nexport function nativeBudgetArguments(\n budget: NativeResourceBudget,\n): [number, number, number, number, number] {\n return [\n budget.maxStylesheetBytes,\n budget.maxDeclarationValueBytes,\n budget.maxSyntaxDepth,\n budget.maxRuleCount,\n budget.maxDeclarationsPerBlock,\n ];\n}\n\nexport function rethrowResourceBudgetError(error: unknown): void {\n if (!(error instanceof Error)) return;\n if (!/^SHEETOM_(?:INPUT|DECLARATION|RULE|NESTING)_LIMIT:/u.test(error.message)) return;\n throw new RangeError(error.message);\n}\n\nfunction limitValue(\n value: unknown,\n name: string,\n fallback: number,\n maximum = maximumUnsignedLong,\n): number {\n if (value === undefined) return fallback;\n if (\n typeof value === \"number\"\n && Number.isSafeInteger(value)\n && value >= 0\n && value <= maximum\n ) return value;\n throw new RangeError(`${name} must be an integer between 0 and ${maximum}`);\n}\n","import type { SheetOMDiagnosticCode } from \"../diagnostics.js\";\nimport {\n type EngineDeclarationStateHandle,\n type EngineMutationOutcome,\n} from \"./engine-binding.js\";\nimport { engineBinding } from \"./default-engine-binding.js\";\nimport {\n defaultResourceBudget,\n nativeBudgetArguments,\n rethrowResourceBudgetError,\n type NativeResourceBudget,\n} from \"./resource-budget.js\";\n\ntype ReportDeclarationDiagnostic = (\n code: SheetOMDiagnosticCode,\n property: string,\n input: string,\n) => void;\n\n/** Thin JS ownership boundary around the Rust declaration state machine. */\nexport class NativeDeclarationBlock {\n readonly #state: EngineDeclarationStateHandle;\n readonly #reportDiagnostic: ReportDeclarationDiagnostic;\n readonly #reservedNestingDepth: () => number;\n #observableCache: string | undefined;\n readonly #serializationCache = new Map<string, string>();\n\n constructor(\n reportDiagnostic: ReportDeclarationDiagnostic,\n context: \"style\" | \"font-face\" | \"function\" = \"style\",\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n reservedNestingDepth: () => number = () => 0,\n ) {\n this.#reportDiagnostic = reportDiagnostic;\n this.#reservedNestingDepth = reservedNestingDepth;\n this.#state = engineBinding.createDeclarationState(\n context,\n ...nativeBudgetArguments(resourceBudget),\n );\n }\n\n get cssText(): string {\n this.#observableCache ??= this.#state.cssText;\n return this.#observableCache;\n }\n\n get length(): number {\n return this.#state.length;\n }\n\n item(index: unknown): string {\n return this.#state.item(toUnsignedLong(index));\n }\n\n getPropertyValue(name: string): string {\n return this.#state.getPropertyValue(name);\n }\n\n getPropertyPriority(name: string): string {\n return this.#state.getPropertyPriority(name);\n }\n\n setProperty(name: string, value: string, priority: string): void {\n let outcome: EngineMutationOutcome;\n try {\n outcome = this.#state.setProperty(name, value, priority, this.#reservedNestingDepth());\n } catch (error) {\n rethrowResourceBudgetError(error);\n throw error;\n }\n if (outcome === \"applied\") {\n this.#invalidateSerialization();\n return;\n }\n\n const normalizedName = name.startsWith(\"--\") ? name : name.toLowerCase();\n const [code, input]: [SheetOMDiagnosticCode, string] = outcome === \"invalid-priority\"\n ? [\"INVALID_PRIORITY\", priority]\n : outcome === \"unsupported-shorthand\"\n ? [\"UNSUPPORTED_SHORTHAND_VALUE\", value]\n : [\"INVALID_PROPERTY_VALUE\", value];\n this.#reportDiagnostic(code, normalizedName, input);\n }\n\n removeProperty(name: string): string {\n const removed = this.#state.removeProperty(name);\n this.#invalidateSerialization();\n return removed;\n }\n\n replaceCssText(source: string): void {\n try {\n this.#state.replaceCssText(source, this.#reservedNestingDepth());\n } catch (error) {\n rethrowResourceBudgetError(error);\n throw error;\n }\n this.#invalidateSerialization();\n }\n\n serialize(safe: boolean, indent: string, separator: string): string {\n const cacheKey = `${safe ? \"1\" : \"0\"}\\0${indent}\\0${separator}`;\n const cached = this.#serializationCache.get(cacheKey);\n if (cached !== undefined) return cached;\n const serialized = this.#state.serializeFormatted(safe, indent, separator);\n this.#serializationCache.set(cacheKey, serialized);\n return serialized;\n }\n\n #invalidateSerialization(): void {\n this.#observableCache = undefined;\n this.#serializationCache.clear();\n }\n}\n\nfunction toUnsignedLong(value: unknown): number {\n const numeric = Number(value);\n if (!Number.isFinite(numeric) || numeric === 0) return 0;\n const integer = Math.trunc(numeric);\n return ((integer % (2 ** 32)) + (2 ** 32)) % (2 ** 32);\n}\n","import { engineBinding } from \"./default-engine-binding.js\";\nimport {\n defaultResourceBudget,\n nativeBudgetArguments,\n rethrowResourceBudgetError,\n type NativeResourceBudget,\n} from \"./resource-budget.js\";\n\n/** Consumes top-level CSS Syntax rules and retains their exact UTF-8 spans. */\nexport function scanTopLevelRules(\n css: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): string[] {\n let encoded: string;\n try {\n encoded = engineBinding.scanTopLevelRulesJson(\n css,\n ...nativeBudgetArguments(resourceBudget),\n );\n } catch (error) {\n rethrowResourceBudgetError(error);\n throw error;\n }\n const parsed: unknown = JSON.parse(encoded);\n if (!Array.isArray(parsed) || parsed.some(rule => typeof rule !== \"string\")) {\n throw new TypeError(\"SHEETOM_NATIVE_PROTOCOL: invalid top-level rule scan result\");\n }\n return parsed;\n}\n","import { engineBinding } from \"./default-engine-binding.js\";\nimport {\n defaultResourceBudget,\n nativeBudgetArguments,\n rethrowResourceBudgetError,\n type NativeResourceBudget,\n} from \"./resource-budget.js\";\n\nexport interface NativeRuleDescription {\n kind: string;\n prelude: string;\n declarations: string;\n children: NativeRuleDescription[];\n cssText: string;\n}\n\nexport function parseNativeRule(\n source: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): NativeRuleDescription | null {\n return parseNativeRulePayload(() => engineBinding.parseRecoveredRuleTreeJson(\n source,\n ...nativeBudgetArguments(resourceBudget),\n ));\n}\n\nexport function parseNativeRuleWithErrorRecovery(\n source: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): NativeRuleDescription | null {\n return parseNativeRulePayload(() => engineBinding.parseRecoveredSingleRuleTreeJson(\n source,\n ...nativeBudgetArguments(resourceBudget),\n ));\n}\n\n/*\n * Keep native parse failures as CSS parse failures, but never reinterpret a\n * transport/validation failure as an empty or invalid rule. Doing so would\n * silently drop valid deeply nested CSS during replaceSync().\n */\nfunction parseNativeRulePayload(readPayload: () => string): NativeRuleDescription | null {\n let payload: string;\n try {\n payload = readPayload();\n } catch (error) {\n rethrowResourceBudgetError(error);\n return null;\n }\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(payload);\n } catch (error) {\n throw nativeProtocolError(\"could not decode the owned rule tree\", error);\n }\n\n try {\n return isNativeRuleDescription(parsed) ? parsed : null;\n } catch (error) {\n throw nativeProtocolError(\"could not validate the owned rule tree\", error);\n }\n}\n\nfunction nativeProtocolError(message: string, cause: unknown): Error {\n return new Error(`SHEETOM_NATIVE_PROTOCOL_ERROR: ${message}`, { cause });\n}\n\nfunction isNativeRuleDescription(value: unknown): value is NativeRuleDescription {\n const pending: unknown[] = [value];\n while (pending.length > 0) {\n const current = pending.pop();\n if (typeof current !== \"object\" || current === null) return false;\n const candidate = current as Partial<NativeRuleDescription>;\n if (\n typeof candidate.kind !== \"string\"\n || typeof candidate.prelude !== \"string\"\n || typeof candidate.declarations !== \"string\"\n || typeof candidate.cssText !== \"string\"\n || !Array.isArray(candidate.children)\n ) return false;\n for (const child of candidate.children) pending.push(child);\n }\n return true;\n}\n","import { engineBinding } from \"./default-engine-binding.js\";\nimport {\n defaultResourceBudget,\n nativeBudgetArguments,\n rethrowResourceBudgetError,\n type NativeResourceBudget,\n} from \"./resource-budget.js\";\n\nexport interface NativeContainerPrelude {\n conditionText: string;\n name: string;\n query: string;\n}\n\nexport interface NativeScopePrelude {\n start: string | null;\n end: string | null;\n}\n\nexport function normalizeNativeSelector(\n source: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): string | null {\n return callNative(() => engineBinding.normalizeSelector(\n source,\n ...nativeBudgetArguments(resourceBudget),\n ));\n}\n\nexport function normalizeNativeMedia(\n source: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): string | null {\n return callNative(() => engineBinding.normalizeMedia(\n source,\n ...nativeBudgetArguments(resourceBudget),\n ));\n}\n\nexport function normalizeNativeSupports(\n source: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): string | null {\n return callNative(() => engineBinding.normalizeSupports(\n source,\n ...nativeBudgetArguments(resourceBudget),\n ));\n}\n\nexport function parseNativeContainerPrelude(\n source: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): NativeContainerPrelude | null {\n const parsed = callNative(() => engineBinding.parseContainerPreludeJson(\n source,\n ...nativeBudgetArguments(resourceBudget),\n ));\n if (parsed === null) return null;\n try {\n const value: unknown = JSON.parse(parsed);\n if (typeof value !== \"object\" || value === null) return null;\n const candidate = value as Partial<NativeContainerPrelude>;\n if (\n typeof candidate.conditionText !== \"string\"\n || typeof candidate.name !== \"string\"\n || typeof candidate.query !== \"string\"\n ) return null;\n return candidate as NativeContainerPrelude;\n } catch {\n return null;\n }\n}\n\nexport function parseNativeScopePrelude(\n source: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): NativeScopePrelude | null {\n const parsed = callNative(() => engineBinding.parseScopePreludeJson(\n source,\n ...nativeBudgetArguments(resourceBudget),\n ));\n if (parsed === null) return null;\n try {\n const value: unknown = JSON.parse(parsed);\n if (typeof value !== \"object\" || value === null) return null;\n const candidate = value as Partial<NativeScopePrelude>;\n if (\n candidate.start !== null && typeof candidate.start !== \"string\"\n || candidate.end !== null && typeof candidate.end !== \"string\"\n ) return null;\n return candidate as NativeScopePrelude;\n } catch {\n return null;\n }\n}\n\nfunction callNative(operation: () => string): string | null {\n try {\n return operation();\n } catch (error) {\n rethrowResourceBudgetError(error);\n return null;\n }\n}\n","/** Owns child-list identity and parent propagation for every live rule node. */\nexport class RuleTree<Node extends object, Sheet> {\n readonly #children = new WeakMap<Node, Node[]>();\n readonly #setParentage: (\n node: Node,\n parentRule: Node | null,\n parentStyleSheet: Sheet | null,\n ) => void;\n readonly #parentStyleSheet: (node: Node) => Sheet | null;\n\n constructor(\n setParentage: (\n node: Node,\n parentRule: Node | null,\n parentStyleSheet: Sheet | null,\n ) => void,\n parentStyleSheet: (node: Node) => Sheet | null,\n ) {\n this.#setParentage = setParentage;\n this.#parentStyleSheet = parentStyleSheet;\n }\n\n createChildren(owner: Node): Node[] {\n const children: Node[] = [];\n this.#children.set(owner, children);\n return children;\n }\n\n children(owner: Node): Node[] {\n return this.#children.get(owner) ?? [];\n }\n\n replace(owner: Node, children: Node[]): void {\n const current = this.#children.get(owner);\n if (!current) return;\n\n for (const child of current) {\n this.attach(child, null, null);\n }\n current.splice(0, current.length, ...children);\n for (const child of children) {\n this.attach(child, owner, this.#parentStyleSheet(owner));\n }\n }\n\n attach(node: Node, parentRule: Node | null, parentStyleSheet: Sheet | null): void {\n this.#setParentage(node, parentRule, parentStyleSheet);\n for (const child of this.#children.get(node) ?? []) {\n this.attach(child, node, parentStyleSheet);\n }\n }\n}\n","import { engineBinding } from \"./default-engine-binding.js\";\nimport {\n defaultResourceBudget,\n nativeBudgetArguments,\n rethrowResourceBudgetError,\n type NativeResourceBudget,\n} from \"./resource-budget.js\";\n\nexport interface NativeCounterStyleDescriptor {\n name: string;\n value: string;\n}\n\nexport interface NativeCounterStyleName {\n name: string;\n serialized: string;\n}\n\nexport function parseNativeCounterStyleName(\n source: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): NativeCounterStyleName | null {\n try {\n const encoded = engineBinding.parseCounterStyleNameJson(\n source,\n ...nativeBudgetArguments(resourceBudget),\n );\n if (encoded === null) return null;\n const parsed: unknown = JSON.parse(encoded);\n if (typeof parsed !== \"object\" || parsed === null) return null;\n const candidate = parsed as Partial<NativeCounterStyleName>;\n if (typeof candidate.name !== \"string\" || typeof candidate.serialized !== \"string\") return null;\n return candidate as NativeCounterStyleName;\n } catch (error) {\n rethrowResourceBudgetError(error);\n return null;\n }\n}\n\nexport function serializeNativeIdentifier(value: string): string {\n return engineBinding.serializeIdentifierValue(value);\n}\n\nexport function serializeNativeFontFamily(value: string): string {\n return engineBinding.serializeFontFamilyValue(value);\n}\n\nexport function parseNativeCounterStyleDescriptor(\n name: string,\n value: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): string | null {\n try {\n return engineBinding.parseCounterStyleDescriptorValue(\n name,\n value,\n ...nativeBudgetArguments(resourceBudget),\n );\n } catch (error) {\n rethrowResourceBudgetError(error);\n return null;\n }\n}\n\nexport function parseNativeCounterStyleDescriptors(\n source: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): NativeCounterStyleDescriptor[] {\n try {\n const parsed: unknown = JSON.parse(engineBinding.parseCounterStyleDescriptorsJson(\n source,\n ...nativeBudgetArguments(resourceBudget),\n ));\n if (!Array.isArray(parsed)) return [];\n const descriptors: NativeCounterStyleDescriptor[] = [];\n for (const value of parsed) {\n if (typeof value !== \"object\" || value === null) continue;\n const candidate = value as Partial<NativeCounterStyleDescriptor>;\n if (typeof candidate.name !== \"string\" || typeof candidate.value !== \"string\") continue;\n descriptors.push(candidate as NativeCounterStyleDescriptor);\n }\n return descriptors;\n } catch (error) {\n rethrowResourceBudgetError(error);\n return [];\n }\n}\n","export type RuleSerializationPlan<Node> =\n | { kind: \"raw\"; cssText: string }\n | { kind: \"declarations\"; declarations: string }\n | {\n kind: \"block\";\n header: string;\n declarations?: string;\n children?: readonly Node[];\n };\n\ntype SerializationFrame<Node> =\n | { kind: \"node\"; node: Node; depth: number; child: boolean }\n | { kind: \"declarations\"; value: string; depth: number }\n | { kind: \"text\"; value: string };\n\n/** Formats reparsable CSS from immutable descriptions of live rule state. */\nexport class Serializer<Node> {\n readonly #describe: (node: Node) => RuleSerializationPlan<Node>;\n\n constructor(describe: (node: Node) => RuleSerializationPlan<Node>) {\n this.#describe = describe;\n }\n\n serialize(node: Node): string {\n const chunks: string[] = [];\n const pending: SerializationFrame<Node>[] = [\n { kind: \"node\", node, depth: 0, child: false },\n ];\n while (pending.length > 0) {\n const frame = pending.pop();\n if (!frame) continue;\n if (frame.kind === \"text\") {\n chunks.push(frame.value);\n continue;\n }\n if (frame.kind === \"declarations\") {\n appendIndented(chunks, frame.value, frame.depth);\n continue;\n }\n\n const plan = this.#describe(frame.node);\n if (plan.kind === \"raw\") {\n const value = frame.child ? plan.cssText.trimEnd() : plan.cssText;\n appendIndented(chunks, value, frame.depth);\n if (!frame.child) chunks.push(\"\\n\");\n continue;\n }\n if (plan.kind === \"declarations\") {\n const value = frame.child ? plan.declarations.trimEnd() : plan.declarations;\n if (frame.child) appendIndented(chunks, value, frame.depth);\n else chunks.push(value, value === \"\" ? \"\" : \"\\n\");\n continue;\n }\n\n chunks.push(\" \".repeat(frame.depth), `${plan.header} {\\n`);\n const children = plan.children ?? [];\n const contentCount = (plan.declarations ? 1 : 0) + children.length;\n if (contentCount === 0) {\n appendIndented(chunks, \"}\", frame.depth);\n if (!frame.child) chunks.push(\"\\n\");\n continue;\n }\n\n pending.push({\n kind: \"text\",\n value: `\\n${\" \".repeat(frame.depth)}}${frame.child ? \"\" : \"\\n\"}`,\n });\n for (let index = children.length - 1; index >= 0; index -= 1) {\n const child = children[index];\n if (!child) continue;\n pending.push({ kind: \"node\", node: child, depth: frame.depth + 1, child: true });\n if (index > 0 || plan.declarations) {\n pending.push({ kind: \"text\", value: \"\\n\" });\n }\n }\n if (plan.declarations) {\n pending.push({ kind: \"declarations\", value: plan.declarations, depth: frame.depth });\n }\n }\n return chunks.join(\"\");\n }\n}\n\nfunction appendIndented(chunks: string[], value: string, depth: number): void {\n const indentation = \" \".repeat(depth);\n chunks.push(indentation, value.replaceAll(\"\\n\", `\\n${indentation}`));\n}\n","let internalConstructionDepth = 0;\n\nexport function constructInternally<T>(factory: () => T): T {\n internalConstructionDepth += 1;\n try {\n return factory();\n } finally {\n internalConstructionDepth -= 1;\n }\n}\n\nexport function assertInternalConstructor(name: string): void {\n if (internalConstructionDepth > 0) return;\n throw new TypeError(`Failed to construct '${name}': Illegal constructor`);\n}\n","import type { SheetOMDiagnosticCode } from \"./diagnostics.js\";\nimport type { CSSStyleDeclarationNamedProperties } from \"./generated/css-style-declaration-properties.js\";\nimport { NativeDeclarationBlock } from \"./internal/native-declaration-block.js\";\nimport { scanTopLevelRules } from \"./internal/css-rule-scanner.js\";\nimport {\n parseNativeRule,\n parseNativeRuleWithErrorRecovery,\n type NativeRuleDescription,\n} from \"./internal/native-rule-parser.js\";\nimport {\n normalizeNativeMedia,\n normalizeNativeSelector,\n parseNativeContainerPrelude,\n parseNativeScopePrelude,\n} from \"./internal/native-rule-syntax.js\";\nimport { RuleTree } from \"./internal/rule-tree.js\";\nimport {\n parseNativeCounterStyleDescriptor,\n parseNativeCounterStyleDescriptors,\n parseNativeCounterStyleName,\n serializeNativeIdentifier,\n serializeNativeFontFamily,\n} from \"./internal/native-counter-style.js\";\nimport {\n Serializer,\n type RuleSerializationPlan,\n} from \"./internal/serializer.js\";\nimport {\n assertInternalConstructor,\n constructInternally,\n} from \"./internal/webidl-construction.js\";\nimport {\n defaultResourceBudget,\n normalizeResourceBudget,\n type NativeResourceBudget,\n type SheetOMResourceBudget,\n} from \"./internal/resource-budget.js\";\n\nexport type { SheetOMDiagnosticCode } from \"./diagnostics.js\";\nexport type { SheetOMResourceBudget } from \"./internal/resource-budget.js\";\n\nconst arrayIndexPattern = /^(0|[1-9]\\d*)$/;\nconst regularSheetMetadata = new WeakMap<\n object,\n { href: string | null; baseURL: string }\n>();\nconst ruleParentage = new WeakMap<\n object,\n { parentRule: CSSRule | null; parentStyleSheet: CSSStyleSheet | null }\n>();\nconst ruleResourceBudgets = new WeakMap<object, NativeResourceBudget>();\nconst sheetResourceBudgets = new WeakMap<object, NativeResourceBudget>();\nconst sheetRuleArrays = new WeakMap<object, CSSRule[]>();\nconst sheetRuleCounts = new WeakMap<object, number>();\nconst functionRuleHeaders = new WeakMap<object, string>();\nconst unsignedLongRange = 2 ** 32;\nconst pageMarginRuleNames = new Set([\n \"top-left-corner\",\n \"top-left\",\n \"top-center\",\n \"top-right\",\n \"top-right-corner\",\n \"right-top\",\n \"right-middle\",\n \"right-bottom\",\n \"bottom-right-corner\",\n \"bottom-right\",\n \"bottom-center\",\n \"bottom-left\",\n \"bottom-left-corner\",\n \"left-bottom\",\n \"left-middle\",\n \"left-top\",\n]);\n\n/** A structured explanation for an ignored or recovered mutation. */\nexport interface SheetOMDiagnostic {\n code: SheetOMDiagnosticCode;\n severity: \"warning\";\n operation: \"setProperty\";\n message: string;\n property: string;\n input: string;\n location: null;\n}\n\n/** Options for a constructed SheetOM stylesheet. */\nexport interface CSSStyleSheetOptions {\n baseURL?: string;\n media?: string;\n disabled?: boolean;\n diagnostics?: boolean;\n resourceBudget?: SheetOMResourceBudget | null;\n}\n\n/** Options for forgiving parsing of an existing regular stylesheet. */\nexport interface ParseStyleSheetOptions extends CSSStyleSheetOptions {\n href?: string;\n}\n\n/** One parsed parameter exposed by `CSSFunctionRule.getParameters()`. */\nexport interface FunctionParameter {\n name: string;\n type: string;\n defaultValue?: string;\n}\n\ntype ReportDiagnostic = (diagnostic: SheetOMDiagnostic) => void;\n\nconst ignoreDiagnostic: ReportDiagnostic = () => {};\nconst ruleDiagnostics = new WeakMap<CSSRule, ReportDiagnostic>();\nconst ruleTree = new RuleTree<CSSRule, CSSStyleSheet>(\n (rule, parentRule, parentStyleSheet) => {\n ruleParentage.set(rule, { parentRule, parentStyleSheet });\n },\n rule => rule.parentStyleSheet,\n);\nconst safeSerializer = new Serializer<CSSRule>(describeRuleSafe);\nlet activeConstructionResourceBudget = defaultResourceBudget;\n\nfunction constructWithResourceBudget<T>(\n factory: () => T,\n resourceBudget: NativeResourceBudget,\n): T {\n const previous = activeConstructionResourceBudget;\n activeConstructionResourceBudget = resourceBudget;\n try {\n return constructInternally(factory);\n } finally {\n activeConstructionResourceBudget = previous;\n }\n}\n\nfunction constructWebIDL<T>(constructor: Function, args: readonly unknown[] = []): T {\n return Reflect.construct(constructor, args) as T;\n}\n\nfunction currentConstructionResourceBudget(): NativeResourceBudget {\n return activeConstructionResourceBudget;\n}\n\nfunction namedPropertyToCSS(property: string): string {\n if (property === \"cssFloat\") return \"float\";\n\n let cssName = property.replace(/[A-Z]/g, character => `-${character.toLowerCase()}`);\n if (/^(webkit|moz|ms|o)-/.test(cssName)) cssName = `-${cssName}`;\n return cssName;\n}\n\nfunction normalizeSelectorText(\n value: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): string | null {\n return normalizeNativeSelector(value, resourceBudget);\n}\n\nfunction toUnsignedLong(value: unknown): number {\n const number = Number(value);\n if (!Number.isFinite(number) || number === 0) return 0;\n\n const integer = Math.trunc(number);\n return ((integer % unsignedLongRange) + unsignedLongRange) % unsignedLongRange;\n}\n\nfunction requireArguments(\n actual: number,\n required: number,\n interfaceName: string,\n operation: string,\n): void {\n if (actual >= required) return;\n const noun = required === 1 ? \"argument\" : \"arguments\";\n throw new TypeError(\n `Failed to execute '${operation}' on '${interfaceName}': ${required} ${noun} required, but only ${actual} present.`,\n );\n}\n\nfunction proxyMember(target: object, property: PropertyKey, value: unknown): unknown {\n if (property === \"constructor\" || typeof value !== \"function\") return value;\n return value.bind(target);\n}\n\nfunction lockOwnProperties(target: object, ...properties: string[]): void {\n for (const property of properties) {\n const descriptor = Object.getOwnPropertyDescriptor(target, property);\n if (!descriptor || !(\"value\" in descriptor)) continue;\n Object.defineProperty(target, property, { ...descriptor, writable: false });\n }\n}\n\nfunction declarationSerializationDepth(rule: CSSRule): number {\n let depth = 0;\n let current: CSSRule | null = rule;\n while (current) {\n if (!(current instanceof CSSNestedDeclarations) && !(current instanceof CSSFunctionDeclarations)) {\n depth += 1;\n }\n current = current.parentRule;\n }\n return depth;\n}\n\n/** Base class for live stylesheet rules. */\nexport class CSSRule {\n static readonly STYLE_RULE = 1;\n static readonly CHARSET_RULE = 2;\n static readonly IMPORT_RULE = 3;\n static readonly MEDIA_RULE = 4;\n static readonly FONT_FACE_RULE = 5;\n static readonly PAGE_RULE = 6;\n static readonly KEYFRAMES_RULE = 7;\n static readonly KEYFRAME_RULE = 8;\n static readonly MARGIN_RULE = 9;\n static readonly NAMESPACE_RULE = 10;\n static readonly COUNTER_STYLE_RULE = 11;\n static readonly SUPPORTS_RULE = 12;\n static readonly FONT_FEATURE_VALUES_RULE = 14;\n\n declare readonly STYLE_RULE: 1;\n declare readonly CHARSET_RULE: 2;\n declare readonly IMPORT_RULE: 3;\n declare readonly MEDIA_RULE: 4;\n declare readonly FONT_FACE_RULE: 5;\n declare readonly PAGE_RULE: 6;\n declare readonly KEYFRAMES_RULE: 7;\n declare readonly KEYFRAME_RULE: 8;\n declare readonly MARGIN_RULE: 9;\n declare readonly NAMESPACE_RULE: 10;\n declare readonly COUNTER_STYLE_RULE: 11;\n declare readonly SUPPORTS_RULE: 12;\n declare readonly FONT_FEATURE_VALUES_RULE: 14;\n\n readonly #type: number;\n\n protected constructor(type: number) {\n assertInternalConstructor(new.target.name);\n this.#type = type;\n ruleParentage.set(this, { parentRule: null, parentStyleSheet: null });\n ruleResourceBudgets.set(this, currentConstructionResourceBudget());\n }\n\n get parentRule(): CSSRule | null {\n return ruleParentage.get(this)?.parentRule ?? null;\n }\n\n get type(): number {\n return this.#type;\n }\n\n get parentStyleSheet(): CSSStyleSheet | null {\n return ruleParentage.get(this)?.parentStyleSheet ?? null;\n }\n\n get cssText(): string {\n return \"\";\n }\n\n set cssText(_value: string) {}\n}\n\nfor (const [name, value] of Object.entries({\n STYLE_RULE: CSSRule.STYLE_RULE,\n CHARSET_RULE: CSSRule.CHARSET_RULE,\n IMPORT_RULE: CSSRule.IMPORT_RULE,\n MEDIA_RULE: CSSRule.MEDIA_RULE,\n FONT_FACE_RULE: CSSRule.FONT_FACE_RULE,\n PAGE_RULE: CSSRule.PAGE_RULE,\n KEYFRAMES_RULE: CSSRule.KEYFRAMES_RULE,\n KEYFRAME_RULE: CSSRule.KEYFRAME_RULE,\n MARGIN_RULE: CSSRule.MARGIN_RULE,\n NAMESPACE_RULE: CSSRule.NAMESPACE_RULE,\n COUNTER_STYLE_RULE: CSSRule.COUNTER_STYLE_RULE,\n SUPPORTS_RULE: CSSRule.SUPPORTS_RULE,\n FONT_FEATURE_VALUES_RULE: CSSRule.FONT_FEATURE_VALUES_RULE,\n})) {\n Object.defineProperty(CSSRule.prototype, name, {\n value,\n writable: false,\n enumerable: true,\n configurable: false,\n });\n}\n\n/** A stable, live, indexed collection of rules. */\nexport class CSSRuleList {\n readonly [index: number]: CSSRule | undefined;\n\n readonly #rules: CSSRule[];\n\n private constructor(rules: CSSRule[]) {\n assertInternalConstructor(\"CSSRuleList\");\n this.#rules = rules;\n\n return new Proxy(this, {\n get(target, property) {\n if (typeof property !== \"string\" || !arrayIndexPattern.test(property)) {\n const result = Reflect.get(target, property, target);\n return proxyMember(target, property, result);\n }\n\n return target.#rules[Number(property)];\n },\n set(target, property, value) {\n if (typeof property === \"string\" && arrayIndexPattern.test(property)) return false;\n return Reflect.set(target, property, value, target);\n },\n });\n }\n\n get length(): number {\n return this.#rules.length;\n }\n\n item(index: number): CSSRule | null {\n requireArguments(arguments.length, 1, \"CSSRuleList\", \"item\");\n return this.#rules[toUnsignedLong(index)] ?? null;\n }\n}\n\nfunction normalizeMediaText(\n value: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): string | null {\n return normalizeNativeMedia(value, resourceBudget);\n}\n\ninterface ContainerPrelude {\n conditionText: string;\n name: string;\n query: string;\n}\n\nfunction parseContainerPrelude(\n value: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): ContainerPrelude | null {\n return parseNativeContainerPrelude(value, resourceBudget);\n}\n\nfunction splitMediaQueries(value: string): string[] {\n const queries: string[] = [];\n let start = 0;\n let depth = 0;\n for (let index = 0; index < value.length; index += 1) {\n const character = value[index];\n if (character === \"(\") depth += 1;\n if (character === \")\" && depth > 0) depth -= 1;\n if (character !== \",\" || depth !== 0) continue;\n queries.push(value.slice(start, index).trim());\n start = index + 1;\n }\n queries.push(value.slice(start).trim());\n return queries.filter(query => query !== \"\");\n}\n\n/** A live serialized list of media queries. */\nexport class MediaList {\n readonly [index: number]: string | undefined;\n\n #mediaText: string;\n readonly #resourceBudget: NativeResourceBudget;\n\n private constructor(mediaText = \"\") {\n assertInternalConstructor(\"MediaList\");\n this.#resourceBudget = currentConstructionResourceBudget();\n const input = `${mediaText}`.trim();\n this.#mediaText = input === \"\"\n ? \"\"\n : normalizeMediaText(input, this.#resourceBudget) ?? \"not all\";\n\n return new Proxy(this, {\n get(target, property) {\n if (typeof property !== \"string\" || !arrayIndexPattern.test(property)) {\n const result = Reflect.get(target, property, target);\n return proxyMember(target, property, result);\n }\n return target.item(Number(property)) || undefined;\n },\n set(target, property, value) {\n if (typeof property === \"string\" && arrayIndexPattern.test(property)) return false;\n return Reflect.set(target, property, value, target);\n },\n });\n }\n\n get mediaText(): string {\n return this.#mediaText;\n }\n\n set mediaText(value: string) {\n const input = `${value}`.trim();\n if (input === \"\") {\n this.#mediaText = \"\";\n return;\n }\n const normalized = normalizeMediaText(input, this.#resourceBudget);\n this.#mediaText = normalized ?? \"not all\";\n }\n\n get length(): number {\n return splitMediaQueries(this.#mediaText).length;\n }\n\n item(index: number): string | null {\n requireArguments(arguments.length, 1, \"MediaList\", \"item\");\n return splitMediaQueries(this.#mediaText)[toUnsignedLong(index)] ?? null;\n }\n\n appendMedium(medium: string): void {\n requireArguments(arguments.length, 1, \"MediaList\", \"appendMedium\");\n const normalized = normalizeMediaText(`${medium}`, this.#resourceBudget);\n if (!normalized) return;\n const existing = splitMediaQueries(this.#mediaText);\n if (existing.includes(normalized)) return;\n this.#mediaText = [...existing, normalized].join(\", \");\n }\n\n deleteMedium(medium: string): void {\n requireArguments(arguments.length, 1, \"MediaList\", \"deleteMedium\");\n const normalized = normalizeMediaText(`${medium}`, this.#resourceBudget);\n const existing = splitMediaQueries(this.#mediaText);\n const index = normalized ? existing.indexOf(normalized) : -1;\n if (index === -1) {\n throw new DOMException(\"The medium was not found.\", \"NotFoundError\");\n }\n existing.splice(index, 1);\n this.#mediaText = existing.join(\", \");\n }\n}\n\nfunction indentRuleText(value: string): string {\n return value.split(\"\\n\").map(line => ` ${line}`).join(\"\\n\");\n}\n\nfunction serializeLineGroupCssText(root: CSSGroupingRule, header: string): string {\n type Frame =\n | { kind: \"rule\"; rule: CSSRule; depth: number; rootHeader?: string }\n | { kind: \"text\"; value: string };\n\n const chunks: string[] = [];\n const pending: Frame[] = [{ kind: \"rule\", rule: root, depth: 0, rootHeader: header }];\n while (pending.length > 0) {\n const frame = pending.pop();\n if (!frame) continue;\n if (frame.kind === \"text\") {\n chunks.push(frame.value);\n continue;\n }\n\n const plan = lineGroupCssTextPlan(frame.rule, frame.rootHeader);\n if (!plan) {\n appendRuleTextAtDepth(chunks, frame.rule.cssText, frame.depth);\n continue;\n }\n\n chunks.push(\" \".repeat(frame.depth), `${plan.header} {\\n`);\n const contentCount = (plan.declarations === \"\" ? 0 : 1) + plan.children.length;\n if (contentCount === 0) {\n chunks.push(\" \".repeat(frame.depth), \"}\");\n continue;\n }\n\n pending.push({ kind: \"text\", value: `\\n${\" \".repeat(frame.depth)}}` });\n for (let index = plan.children.length - 1; index >= 0; index -= 1) {\n const child = plan.children[index];\n if (!child) continue;\n pending.push({ kind: \"rule\", rule: child, depth: frame.depth + 1 });\n if (index > 0 || plan.declarations !== \"\") {\n pending.push({ kind: \"text\", value: \"\\n\" });\n }\n }\n if (plan.declarations !== \"\") {\n pending.push({\n kind: \"text\",\n value: indentRuleTextAtDepth(plan.declarations, frame.depth + 1),\n });\n }\n }\n return chunks.join(\"\");\n}\n\nfunction lineGroupCssTextPlan(\n rule: CSSRule,\n rootHeader?: string,\n): { header: string; declarations: string; children: readonly CSSRule[] } | null {\n if (rule instanceof CSSStyleRule) {\n const children = ruleTree.children(rule);\n if (children.length === 0) return null;\n return {\n header: rootHeader ?? rule.selectorText,\n declarations: rule.style.cssText,\n children,\n };\n }\n if (\n !(rule instanceof CSSGroupingRule)\n || rule instanceof CSSFunctionRule\n || rule instanceof CSSPageRule\n ) return null;\n return {\n header: rootHeader ?? groupingRuleHeader(rule),\n declarations: \"\",\n children: ruleTree.children(rule),\n };\n}\n\nfunction appendRuleTextAtDepth(chunks: string[], value: string, depth: number): void {\n chunks.push(indentRuleTextAtDepth(value, depth));\n}\n\nfunction indentRuleTextAtDepth(value: string, depth: number): string {\n const indentation = \" \".repeat(depth);\n return `${indentation}${value.replaceAll(\"\\n\", `\\n${indentation}`)}`;\n}\n\nfunction ruleChildren(rule: CSSRule): CSSRule[] {\n if (rule instanceof CSSGroupingRule || rule instanceof CSSKeyframesRule) {\n return ruleTree.children(rule);\n }\n return [];\n}\n\nfunction ruleForestSize(roots: readonly CSSRule[]): number {\n let count = 0;\n const pending = [...roots];\n while (pending.length > 0) {\n const rule = pending.pop();\n if (!rule) continue;\n count += 1;\n for (const child of ruleChildren(rule)) pending.push(child);\n }\n return count;\n}\n\nfunction assertRuleForestBudget(\n roots: readonly CSSRule[],\n resourceBudget: NativeResourceBudget,\n): void {\n const count = ruleForestSize(roots);\n assertRuleCountBudget(count, resourceBudget);\n}\n\nfunction assertRuleCountBudget(\n count: number,\n resourceBudget: NativeResourceBudget,\n): void {\n if (count <= resourceBudget.maxRuleCount) return;\n throw new RangeError(\n `SHEETOM_RULE_LIMIT: stylesheet has ${count} rules; the limit is ${resourceBudget.maxRuleCount} rules`,\n );\n}\n\nfunction assertRuleInsertionBudget(\n owner: CSSRule | CSSStyleSheet,\n inserted: CSSRule,\n resourceBudget: NativeResourceBudget,\n): number {\n const insertedCount = ruleForestSize([inserted]);\n if (owner instanceof CSSStyleSheet) {\n const roots = sheetRuleArrays.get(owner) ?? [];\n assertRuleCountBudget(\n (sheetRuleCounts.get(owner) ?? ruleForestSize(roots)) + insertedCount,\n resourceBudget,\n );\n return insertedCount;\n }\n const sheet = owner.parentStyleSheet;\n if (sheet) {\n const roots = sheetRuleArrays.get(sheet) ?? [];\n assertRuleCountBudget(\n (sheetRuleCounts.get(sheet) ?? ruleForestSize(roots)) + insertedCount,\n resourceBudget,\n );\n return insertedCount;\n }\n let root = owner;\n while (root.parentRule) root = root.parentRule;\n assertRuleCountBudget(\n ruleForestSize([root]) + insertedCount,\n resourceBudget,\n );\n return insertedCount;\n}\n\nfunction adjustSheetRuleCount(sheet: CSSStyleSheet | null, difference: number): void {\n if (!sheet) return;\n const roots = sheetRuleArrays.get(sheet) ?? [];\n const current = sheetRuleCounts.get(sheet) ?? ruleForestSize(roots);\n sheetRuleCounts.set(sheet, current + difference);\n}\n\n/** A rule containing a live nested rule list. */\nexport class CSSGroupingRule extends CSSRule {\n readonly cssRules: CSSRuleList;\n\n protected constructor(type: number) {\n super(type);\n const rules = ruleTree.createChildren(this);\n this.cssRules = constructWebIDL<CSSRuleList>(CSSRuleList, [rules]);\n lockOwnProperties(this, \"cssRules\");\n }\n\n insertRule(ruleText: string, index = 0): number {\n requireArguments(arguments.length, 1, this.constructor.name, \"insertRule\");\n const rules = ruleTree.children(this);\n const normalizedIndex = toUnsignedLong(index);\n if (normalizedIndex > rules.length) {\n throw new DOMException(\"The index is outside the allowed range.\", \"IndexSizeError\");\n }\n\n const input = `${ruleText}`;\n const resourceBudget = ruleResourceBudgets.get(this) ?? defaultResourceBudget;\n if (\n !(this instanceof CSSPageRule)\n && parseNativeRule(input, resourceBudget)?.kind === \"import\"\n ) {\n throw new DOMException(\n \"@import rules cannot be inserted inside a group rule.\",\n \"HierarchyRequestError\",\n );\n }\n\n const rule = parseStrictRule(\n input,\n ruleDiagnostics.get(this) ?? ignoreDiagnostic,\n false,\n this,\n resourceBudget,\n );\n if (!rule) throw new DOMException(\"The rule could not be parsed.\", \"SyntaxError\");\n\n if (\n this instanceof CSSStyleRule &&\n rule instanceof CSSStyleRule &&\n !rule.selectorText.trimStart().startsWith(\"&\")\n ) {\n rule.selectorText = `& ${rule.selectorText}`;\n }\n\n const insertedCount = assertRuleInsertionBudget(this, rule, resourceBudget);\n rules.splice(normalizedIndex, 0, rule);\n attachRuleTree(rule, this, this.parentStyleSheet);\n adjustSheetRuleCount(this.parentStyleSheet, insertedCount);\n return normalizedIndex;\n }\n\n deleteRule(index: number): void {\n requireArguments(arguments.length, 1, this.constructor.name, \"deleteRule\");\n const rules = ruleTree.children(this);\n const normalizedIndex = toUnsignedLong(index);\n if (normalizedIndex >= rules.length) {\n throw new DOMException(\"The index is outside the allowed range.\", \"IndexSizeError\");\n }\n const [removed] = rules.splice(normalizedIndex, 1);\n if (removed) {\n const removedCount = ruleForestSize([removed]);\n adjustSheetRuleCount(this.parentStyleSheet, -removedCount);\n attachRuleTree(removed, null, null);\n }\n }\n\n protected serializeGroup(header: string): string {\n return serializeLineGroupCssText(this, header);\n }\n}\n\n/** A grouping rule controlled by a serialized condition. */\nexport class CSSConditionRule extends CSSGroupingRule {\n readonly #conditionText: string;\n\n protected constructor(\n type: number,\n conditionText: string,\n ) {\n super(type);\n this.#conditionText = conditionText;\n }\n\n get conditionText(): string {\n return this.#conditionText;\n }\n}\n\n/** A live custom `@function` rule. */\nexport class CSSFunctionRule extends CSSGroupingRule {\n readonly name: string;\n readonly returnType: string;\n readonly #parameters: readonly FunctionParameter[];\n\n private constructor(\n name: string,\n parameters: readonly FunctionParameter[],\n returnType: string,\n ) {\n super(0);\n this.name = name;\n this.returnType = returnType;\n this.#parameters = parameters.map(parameter => ({ ...parameter }));\n functionRuleHeaders.set(\n this,\n serializeFunctionHeader(this.name, this.#parameters, this.returnType),\n );\n lockOwnProperties(this, \"name\", \"returnType\");\n }\n\n getParameters(): FunctionParameter[] {\n return this.#parameters.map(parameter => ({ ...parameter }));\n }\n\n override get cssText(): string {\n const header = functionRuleHeaders.get(this) ?? \"@function\";\n const children = ruleTree.children(this);\n if (children.length === 0) return `${header} { }`;\n return `${header} { ${children.map(child => child.cssText).join(\" \")} }`;\n }\n\n set cssText(_value: string) {}\n}\n\nfunction serializeFunctionHeader(\n name: string,\n parameters: readonly FunctionParameter[],\n returnType: string,\n): string {\n const serializedParameters = parameters.map(parameter => {\n const type = serializeFunctionType(parameter.type);\n const defaultValue = Object.hasOwn(parameter, \"defaultValue\")\n ? `: ${parameter.defaultValue}`\n : \"\";\n return `${serializeNativeIdentifier(parameter.name)}${type}${defaultValue}`;\n }).join(\", \");\n const serializedReturnType = returnType === \"*\"\n ? \"\"\n : ` returns${serializeFunctionType(returnType)}`;\n return `@function ${serializeNativeIdentifier(name)}(${serializedParameters})${serializedReturnType}`;\n}\n\nfunction serializeFunctionType(type: string): string {\n if (type === \"*\") return \"\";\n return type.includes(\" | \") ? ` type(${type})` : ` ${type}`;\n}\n\n/** A live `@media` rule. */\nexport class CSSMediaRule extends CSSConditionRule {\n readonly media: MediaList;\n\n private constructor(conditionText: string) {\n const media = constructWebIDL<MediaList>(MediaList, [conditionText]);\n super(CSSRule.MEDIA_RULE, media.mediaText);\n this.media = media;\n lockOwnProperties(this, \"media\");\n }\n\n override get conditionText(): string {\n return this.media.mediaText;\n }\n\n override get cssText(): string {\n return this.serializeGroup(`@media ${this.media.mediaText}`);\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live `@supports` rule. */\nexport class CSSSupportsRule extends CSSConditionRule {\n private constructor(conditionText: string) {\n super(CSSRule.SUPPORTS_RULE, conditionText.trim());\n }\n\n override get cssText(): string {\n return this.serializeGroup(`@supports ${this.conditionText}`);\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live `@container` rule. */\nexport class CSSContainerRule extends CSSConditionRule {\n readonly containerName: string;\n readonly containerQuery: string;\n\n private constructor(conditionText: string) {\n const parsed = parseContainerPrelude(\n conditionText,\n currentConstructionResourceBudget(),\n );\n const normalizedCondition = parsed?.conditionText ?? conditionText.trim();\n super(0, normalizedCondition);\n this.containerName = parsed?.name ?? \"\";\n this.containerQuery = parsed?.query ?? normalizedCondition;\n lockOwnProperties(this, \"containerName\", \"containerQuery\");\n }\n\n override get cssText(): string {\n return this.serializeGroup(`@container ${this.conditionText}`);\n }\n\n set cssText(_value: string) {}\n}\n\n/** An immutable statement-form `@layer` rule. */\nexport class CSSLayerStatementRule extends CSSRule {\n readonly #names: readonly string[];\n\n private constructor(names: readonly string[]) {\n super(0);\n this.#names = [...names];\n }\n\n get nameList(): readonly string[] {\n return Object.freeze([...this.#names]);\n }\n\n override get cssText(): string {\n return `@layer ${this.#names.join(\", \")};`;\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live block-form `@layer` rule. */\nexport class CSSLayerBlockRule extends CSSGroupingRule {\n readonly name: string;\n\n private constructor(name: string) {\n super(0);\n this.name = name;\n lockOwnProperties(this, \"name\");\n }\n\n override get cssText(): string {\n return this.serializeGroup(`@layer${this.name === \"\" ? \"\" : ` ${this.name}`}`);\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live `@scope` rule. */\nexport class CSSScopeRule extends CSSGroupingRule {\n readonly start: string | null;\n readonly end: string | null;\n\n private constructor(\n start: string | null,\n end: string | null,\n ) {\n super(0);\n this.start = start;\n this.end = end;\n lockOwnProperties(this, \"start\", \"end\");\n }\n\n override get cssText(): string {\n const start = this.start === null ? \"\" : ` (${this.start})`;\n const end = this.end === null ? \"\" : ` to (${this.end})`;\n return this.serializeGroup(`@scope${start}${end}`);\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live `@starting-style` rule. */\nexport class CSSStartingStyleRule extends CSSGroupingRule {\n private constructor() {\n super(0);\n }\n\n override get cssText(): string {\n return this.serializeGroup(\"@starting-style\");\n }\n\n set cssText(_value: string) {}\n}\n\n/** A non-loading `@import` rule with mutable media. */\nexport class CSSImportRule extends CSSRule {\n readonly media: MediaList;\n readonly styleSheet: null = null;\n readonly layerName: string | null;\n readonly supportsText: string | null;\n readonly #rawHref: string;\n\n private constructor(\n href: string,\n mediaText = \"\",\n layerName: string | null = null,\n supportsText: string | null = null,\n ) {\n super(CSSRule.IMPORT_RULE);\n this.#rawHref = href;\n this.media = constructWebIDL<MediaList>(MediaList, [mediaText]);\n this.layerName = layerName;\n this.supportsText = supportsText;\n lockOwnProperties(this, \"media\", \"styleSheet\", \"layerName\", \"supportsText\");\n }\n\n get href(): string {\n const baseURL = this.parentStyleSheet?.baseURL;\n if (!baseURL || baseURL === \"about:blank\") return this.#rawHref;\n try {\n return new URL(this.#rawHref, baseURL).href;\n } catch {\n return this.#rawHref;\n }\n }\n\n override get cssText(): string {\n const href = this.#rawHref.replace(/[\"\\\\]/g, character => `\\\\${character}`);\n const layer = this.layerName === null\n ? \"\"\n : this.layerName === \"\"\n ? \" layer\"\n : ` layer(${this.layerName})`;\n const supports = this.supportsText === null\n ? \"\"\n : ` supports(${this.supportsText})`;\n const media = this.media.mediaText === \"\" ? \"\" : ` ${this.media.mediaText}`;\n return `@import url(\"${href}\")${layer}${supports}${media};`;\n }\n\n set cssText(_value: string) {}\n}\n\n/** An immutable `@namespace` rule. */\nexport class CSSNamespaceRule extends CSSRule {\n readonly namespaceURI: string;\n readonly prefix: string;\n readonly #cssText: string;\n\n private constructor(\n namespaceURI: string,\n prefix: string,\n cssText: string,\n ) {\n super(CSSRule.NAMESPACE_RULE);\n this.namespaceURI = namespaceURI;\n this.prefix = prefix;\n this.#cssText = cssText;\n lockOwnProperties(this, \"namespaceURI\", \"prefix\");\n }\n\n override get cssText(): string {\n return this.#cssText;\n }\n\n set cssText(_value: string) {}\n}\n\nclass CSSGenericRule extends CSSRule {\n readonly #cssText: string;\n\n constructor(\n type: number,\n cssText: string,\n ) {\n super(type);\n this.#cssText = cssText;\n }\n\n override get cssText(): string {\n return this.#cssText;\n }\n\n set cssText(_value: string) {}\n}\n\nclass CSSOpaqueRule extends CSSGenericRule {}\n\n/** An immutable `@property` registration rule. */\nexport class CSSPropertyRule extends CSSRule {\n readonly name: string;\n readonly syntax: string;\n readonly inherits: boolean;\n readonly initialValue: string;\n readonly #cssText: string;\n\n private constructor(\n name: string,\n syntax: string,\n inherits: boolean,\n initialValue: string,\n cssText: string,\n ) {\n super(0);\n this.name = name;\n this.syntax = syntax;\n this.inherits = inherits;\n this.initialValue = initialValue;\n this.#cssText = cssText;\n lockOwnProperties(this, \"name\", \"syntax\", \"inherits\", \"initialValue\");\n }\n\n override get cssText(): string { return this.#cssText; }\n set cssText(_value: string) {}\n}\n\n/** An immutable `@font-palette-values` rule. */\nexport class CSSFontPaletteValuesRule extends CSSRule {\n readonly name: string;\n readonly fontFamily: string;\n readonly basePalette: string;\n readonly overrideColors: string;\n readonly #cssText: string;\n\n private constructor(\n name: string,\n fontFamily: string,\n basePalette: string,\n overrideColors: string,\n cssText: string,\n ) {\n super(0);\n this.name = name;\n this.fontFamily = fontFamily;\n this.basePalette = basePalette;\n this.overrideColors = overrideColors;\n this.#cssText = cssText;\n lockOwnProperties(this, \"name\", \"fontFamily\", \"basePalette\", \"overrideColors\");\n }\n\n override get cssText(): string {\n return this.#cssText;\n }\n\n set cssText(_value: string) {}\n}\n\n/** An immutable `@view-transition` rule. */\nexport class CSSViewTransitionRule extends CSSRule {\n readonly navigation: string;\n readonly types: readonly string[];\n readonly #cssText: string;\n\n private constructor(\n navigation: string,\n types: readonly string[],\n cssText: string,\n ) {\n super(0);\n this.navigation = navigation;\n this.types = Object.freeze([...types]);\n this.#cssText = cssText;\n lockOwnProperties(this, \"navigation\", \"types\");\n }\n\n override get cssText(): string {\n return this.#cssText;\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live declaration block with indexed, named, and method-based access. */\nexport interface CSSStyleDeclaration extends CSSStyleDeclarationNamedProperties {}\nexport class CSSStyleDeclaration {\n readonly [index: number]: string | undefined;\n\n readonly parentRule: CSSRule;\n readonly #block: NativeDeclarationBlock;\n\n protected constructor(parentRule: CSSRule) {\n assertInternalConstructor(\"CSSStyleDeclaration\");\n this.parentRule = parentRule;\n lockOwnProperties(this, \"parentRule\");\n const reportDeclarationDiagnostic = (\n code: SheetOMDiagnosticCode,\n property: string,\n input: string,\n ): void => {\n const priority = code === \"INVALID_PRIORITY\";\n const unsupportedShorthand = code === \"UNSUPPORTED_SHORTHAND_VALUE\";\n (ruleDiagnostics.get(this.parentRule) ?? ignoreDiagnostic)({\n code,\n severity: \"warning\",\n operation: \"setProperty\",\n message: priority\n ? `The mutation was ignored because ${input} is not a valid priority.`\n : unsupportedShorthand\n ? `The value was ignored because the shorthand codec for ${property} cannot expand it.`\n : `The value was ignored because it is invalid for ${property}.`,\n property,\n input,\n location: null,\n });\n };\n this.#block = new NativeDeclarationBlock(\n reportDeclarationDiagnostic,\n parentRule instanceof CSSFontFaceRule\n ? \"font-face\"\n : parentRule instanceof CSSFunctionDeclarations\n ? \"function\"\n : \"style\",\n ruleResourceBudgets.get(parentRule) ?? defaultResourceBudget,\n () => declarationSerializationDepth(parentRule),\n );\n\n return new Proxy(this, {\n get(target, property) {\n if (typeof property === \"string\" && arrayIndexPattern.test(property)) {\n return target.item(Number(property)) || undefined;\n }\n\n if (typeof property === \"string\" && !Reflect.has(target, property)) {\n return target.getPropertyValue(namedPropertyToCSS(property));\n }\n\n const result = Reflect.get(target, property, target);\n return proxyMember(target, property, result);\n },\n set(target, property, value) {\n if (typeof property === \"string\" && !Reflect.has(target, property)) {\n Reflect.apply(target.setProperty, target, [namedPropertyToCSS(property), value]);\n return true;\n }\n\n return Reflect.set(target, property, value, target);\n },\n });\n }\n\n get cssText(): string {\n return this.#block.cssText;\n }\n\n set cssText(value: string) {\n const input = `${value}`;\n this.#block.replaceCssText(input);\n }\n\n get length(): number {\n return this.#block.length;\n }\n\n item(index: number): string {\n requireArguments(arguments.length, 1, \"CSSStyleDeclaration\", \"item\");\n return this.#block.item(index);\n }\n\n getPropertyValue(name: string): string {\n requireArguments(arguments.length, 1, \"CSSStyleDeclaration\", \"getPropertyValue\");\n return this.#block.getPropertyValue(`${name}`);\n }\n\n getPropertyPriority(name: string): string {\n requireArguments(arguments.length, 1, \"CSSStyleDeclaration\", \"getPropertyPriority\");\n return this.#block.getPropertyPriority(`${name}`);\n }\n\n setProperty(name: string, value: string | null, priority = \"\"): void {\n requireArguments(arguments.length, 2, \"CSSStyleDeclaration\", \"setProperty\");\n const stringName = `${name}`;\n const stringValue = value === null ? \"\" : `${value}`;\n const stringPriority = priority === null ? \"\" : `${priority}`;\n this.#block.setProperty(stringName, stringValue, stringPriority);\n }\n\n removeProperty(name: string): string {\n requireArguments(arguments.length, 1, \"CSSStyleDeclaration\", \"removeProperty\");\n return this.#block.removeProperty(`${name}`);\n }\n\n /** @internal */\n serializeSafe(indent: string): string {\n return this.#block.serialize(true, indent, \"\\n\");\n }\n}\n\n/** A live `@font-face` descriptor rule. */\nexport class CSSFontFaceRule extends CSSRule {\n readonly style: CSSStyleDeclaration;\n\n private constructor() {\n super(CSSRule.FONT_FACE_RULE);\n this.style = constructWebIDL<CSSStyleDeclaration>(CSSStyleDeclaration, [this]);\n lockOwnProperties(this, \"style\");\n }\n\n override get cssText(): string {\n return `@font-face {${this.style.cssText === \"\" ? \"\" : ` ${this.style.cssText}`} }`;\n }\n\n set cssText(_value: string) {}\n}\n\n/** Declarations ordered after a nested style rule. */\nexport class CSSNestedDeclarations extends CSSRule {\n readonly #style: CSSStyleDeclaration;\n\n private constructor() {\n super(0);\n this.#style = constructWebIDL<CSSStyleDeclaration>(CSSStyleDeclaration, [this]);\n }\n\n get style(): CSSStyleDeclaration {\n return this.#style;\n }\n\n set style(cssText: string) {\n this.#style.cssText = `${cssText}`;\n }\n\n override get cssText(): string {\n return this.style.cssText;\n }\n\n set cssText(_value: string) {}\n}\n\n/** A run of live descriptors inside a custom function. */\nexport class CSSFunctionDeclarations extends CSSRule {\n readonly #style: CSSFunctionDescriptors;\n\n private constructor() {\n super(0);\n this.#style = constructWebIDL<CSSFunctionDescriptors>(CSSFunctionDescriptors, [this]);\n }\n\n get style(): CSSFunctionDescriptors {\n return this.#style;\n }\n\n set style(cssText: string) {\n this.#style.cssText = `${cssText}`;\n }\n\n override get cssText(): string {\n return this.style.cssText;\n }\n\n set cssText(_value: string) {}\n}\n\n/** The declaration interface used by `CSSFunctionDeclarations`. */\nexport class CSSFunctionDescriptors extends CSSStyleDeclaration {\n get result(): string {\n return this.getPropertyValue(\"result\");\n }\n\n set result(_value: string | null) {}\n}\n\n/** A page-margin rule nested inside `CSSPageRule`. */\nexport class CSSMarginRule extends CSSRule {\n readonly name: string;\n readonly style: CSSStyleDeclaration;\n\n private constructor(name: string) {\n super(CSSRule.MARGIN_RULE);\n this.name = name;\n this.style = constructWebIDL<CSSStyleDeclaration>(CSSStyleDeclaration, [this]);\n lockOwnProperties(this, \"name\", \"style\");\n }\n\n override get cssText(): string {\n return `@${this.name} {${this.style.cssText === \"\" ? \"\" : ` ${this.style.cssText}`} }`;\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live `@page` rule with declarations and margin rules. */\nexport class CSSPageRule extends CSSGroupingRule {\n readonly style: CSSStyleDeclaration;\n #selectorText: string;\n\n private constructor(selectorText: string) {\n super(CSSRule.PAGE_RULE);\n this.#selectorText = selectorText;\n this.style = constructWebIDL<CSSStyleDeclaration>(CSSStyleDeclaration, [this]);\n lockOwnProperties(this, \"style\");\n }\n\n get selectorText(): string {\n return this.#selectorText;\n }\n\n set selectorText(value: string) {\n this.#selectorText = `${value}`.trim();\n }\n\n override get cssText(): string {\n const contents: string[] = [];\n if (this.style.cssText !== \"\") contents.push(this.style.cssText);\n for (const child of ruleTree.children(this)) contents.push(child.cssText);\n const selector = this.selectorText === \"\" ? \"\" : ` ${this.selectorText}`;\n return `@page${selector} {${contents.length === 0 ? \"\" : ` ${contents.join(\" \")}`} }`;\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live `@position-try` declaration rule. */\nexport class CSSPositionTryRule extends CSSRule {\n readonly name: string;\n readonly style: CSSStyleDeclaration;\n\n private constructor(name: string) {\n super(0);\n this.name = name;\n this.style = constructWebIDL<CSSStyleDeclaration>(CSSStyleDeclaration, [this]);\n lockOwnProperties(this, \"name\", \"style\");\n }\n\n override get cssText(): string {\n return `@position-try ${this.name} {${this.style.cssText === \"\" ? \"\" : ` ${this.style.cssText}`} }`;\n }\n\n set cssText(_value: string) {}\n}\n\nfunction normalizeKeyText(value: string): string | null {\n const parts = value.split(\",\").map(part => part.trim());\n if (parts.length === 0 || parts.some(part => part === \"\")) return null;\n const normalized: string[] = [];\n for (const part of parts) {\n const lower = part.toLowerCase();\n if (lower === \"from\") {\n normalized.push(\"0%\");\n continue;\n }\n if (lower === \"to\") {\n normalized.push(\"100%\");\n continue;\n }\n const match = lower.match(/^([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+))%$/);\n if (!match) return null;\n const percentage = Number(match[1]);\n if (percentage < 0 || percentage > 100) return null;\n normalized.push(`${percentage}%`);\n }\n return normalized.join(\", \");\n}\n\n/** One mutable keyframe selector and declaration block. */\nexport class CSSKeyframeRule extends CSSRule {\n readonly style: CSSStyleDeclaration;\n #keyText: string;\n\n private constructor(keyText: string) {\n super(CSSRule.KEYFRAME_RULE);\n this.#keyText = normalizeKeyText(keyText) ?? keyText;\n this.style = constructWebIDL<CSSStyleDeclaration>(CSSStyleDeclaration, [this]);\n lockOwnProperties(this, \"style\");\n }\n\n get keyText(): string {\n return this.#keyText;\n }\n\n set keyText(value: string) {\n const normalized = normalizeKeyText(`${value}`);\n if (normalized !== null) this.#keyText = normalized;\n }\n\n override get cssText(): string {\n return `${this.keyText} {${this.style.cssText === \"\" ? \"\" : ` ${this.style.cssText}`} }`;\n }\n\n set cssText(_value: string) {}\n}\n\n/** A mutable `@keyframes` rule. */\nexport class CSSKeyframesRule extends CSSRule {\n readonly cssRules: CSSRuleList;\n #name: string;\n\n private constructor(name: string) {\n super(CSSRule.KEYFRAMES_RULE);\n this.#name = name;\n const rules = ruleTree.createChildren(this);\n this.cssRules = constructWebIDL<CSSRuleList>(CSSRuleList, [rules]);\n lockOwnProperties(this, \"cssRules\");\n }\n\n get name(): string {\n return this.#name;\n }\n\n set name(value: string) {\n this.#name = `${value}`;\n }\n\n get length(): number {\n return this.cssRules.length;\n }\n\n appendRule(ruleText: string): void {\n requireArguments(arguments.length, 1, \"CSSKeyframesRule\", \"appendRule\");\n const parsed = parseKeyframeRule(\n `${ruleText}`,\n ruleDiagnostics.get(this) ?? ignoreDiagnostic,\n ruleResourceBudgets.get(this) ?? defaultResourceBudget,\n );\n if (!parsed) return;\n const rules = ruleTree.children(this);\n const resourceBudget = ruleResourceBudgets.get(this) ?? defaultResourceBudget;\n const insertedCount = assertRuleInsertionBudget(this, parsed, resourceBudget);\n rules.push(parsed);\n attachRuleTree(parsed, this, this.parentStyleSheet);\n adjustSheetRuleCount(this.parentStyleSheet, insertedCount);\n }\n\n deleteRule(select: string): void {\n requireArguments(arguments.length, 1, \"CSSKeyframesRule\", \"deleteRule\");\n const normalized = normalizeKeyText(`${select}`);\n if (normalized === null) return;\n const rules = ruleTree.children(this);\n let index = -1;\n for (let candidate = rules.length - 1; candidate >= 0; candidate -= 1) {\n const rule = rules[candidate];\n if (!(rule instanceof CSSKeyframeRule) || rule.keyText !== normalized) continue;\n index = candidate;\n break;\n }\n if (index === -1) return;\n const [removed] = rules.splice(index, 1);\n if (removed) {\n adjustSheetRuleCount(this.parentStyleSheet, -1);\n attachRuleTree(removed, null, null);\n }\n }\n\n findRule(select: string): CSSKeyframeRule | null {\n requireArguments(arguments.length, 1, \"CSSKeyframesRule\", \"findRule\");\n const normalized = normalizeKeyText(`${select}`);\n if (normalized === null) return null;\n const rules = ruleTree.children(this);\n for (let index = rules.length - 1; index >= 0; index -= 1) {\n const rule = rules[index];\n if (rule instanceof CSSKeyframeRule && rule.keyText === normalized) return rule;\n }\n return null;\n }\n\n override get cssText(): string {\n const rules = ruleTree.children(this);\n if (rules.length === 0) return `@keyframes ${this.name} { }`;\n return `@keyframes ${this.name} { \\n${rules.map(rule => indentRuleText(rule.cssText)).join(\"\\n\")}\\n}`;\n }\n\n set cssText(_value: string) {}\n}\n\nconst counterDescriptorNames = [\n \"system\",\n \"symbols\",\n \"additive-symbols\",\n \"negative\",\n \"prefix\",\n \"suffix\",\n \"pad\",\n \"range\",\n \"fallback\",\n \"speak-as\",\n] as const;\n\n/** A mutable `@counter-style` descriptor rule. */\nexport class CSSCounterStyleRule extends CSSRule {\n readonly #descriptors = new Map<string, string>();\n #name: string;\n #serializedName: string;\n\n private constructor(name: string) {\n super(CSSRule.COUNTER_STYLE_RULE);\n const parsed = parseNativeCounterStyleName(\n name,\n currentConstructionResourceBudget(),\n );\n this.#name = parsed?.name ?? name;\n this.#serializedName = parsed?.serialized ?? name;\n }\n\n get name(): string { return this.#name; }\n set name(value: string) {\n const parsed = parseNativeCounterStyleName(\n `${value}`,\n ruleResourceBudgets.get(this) ?? defaultResourceBudget,\n );\n if (!parsed) return;\n this.#name = parsed.name;\n this.#serializedName = parsed.serialized;\n }\n\n get system(): string { return this.#get(\"system\"); }\n set system(_value: string) {}\n get symbols(): string { return this.#get(\"symbols\"); }\n set symbols(value: string) { this.#set(\"symbols\", value); }\n get additiveSymbols(): string { return this.#get(\"additive-symbols\"); }\n set additiveSymbols(value: string) { this.#set(\"additive-symbols\", value); }\n get negative(): string { return this.#get(\"negative\"); }\n set negative(value: string) { this.#set(\"negative\", value); }\n get prefix(): string { return this.#get(\"prefix\"); }\n set prefix(value: string) { this.#set(\"prefix\", value); }\n get suffix(): string { return this.#get(\"suffix\"); }\n set suffix(value: string) { this.#set(\"suffix\", value); }\n get range(): string { return this.#get(\"range\"); }\n set range(value: string) { this.#set(\"range\", value); }\n get pad(): string { return this.#get(\"pad\"); }\n set pad(value: string) { this.#set(\"pad\", value); }\n get speakAs(): string { return this.#get(\"speak-as\"); }\n set speakAs(value: string) { this.#set(\"speak-as\", value); }\n get fallback(): string { return this.#get(\"fallback\"); }\n set fallback(value: string) { this.#set(\"fallback\", value); }\n\n #get(name: string): string {\n return this.#descriptors.get(name) ?? \"\";\n }\n\n #set(name: string, value: string): void {\n const text = `${value}`;\n const parsed = parseNativeCounterStyleDescriptor(\n name,\n text,\n ruleResourceBudgets.get(this) ?? defaultResourceBudget,\n );\n if (!parsed) return;\n this.#descriptors.set(name, parsed);\n }\n\n /** @internal */\n setParsedDescriptor(name: string, value: string): void {\n if (!(counterDescriptorNames as readonly string[]).includes(name)) return;\n this.#descriptors.set(name, value);\n }\n\n override get cssText(): string {\n const declarations: string[] = [];\n for (const name of counterDescriptorNames) {\n const value = this.#descriptors.get(name);\n if (value !== undefined) declarations.push(`${name}: ${value};`);\n }\n return `@counter-style ${this.#serializedName} {${declarations.length === 0 ? \"\" : ` ${declarations.join(\" \")}`} }`;\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live map exposed by one font-feature-values category. */\nexport class CSSFontFeatureValuesMap implements Iterable<[string, number[]]> {\n readonly #values = new Map<string, number[]>();\n readonly #serializedNames = new Map<string, string>();\n\n private constructor() {\n assertInternalConstructor(\"CSSFontFeatureValuesMap\");\n }\n\n get size(): number {\n return this.#values.size;\n }\n\n set(featureValueName: string, values: number[]): this {\n requireArguments(arguments.length, 2, \"CSSFontFeatureValuesMap\", \"set\");\n const name = `${featureValueName}`;\n const normalized = Array.from(values, value => toUnsignedLong(value));\n this.#values.set(name, normalized);\n this.#serializedNames.set(name, serializeNativeIdentifier(name));\n return this;\n }\n\n clear(): void {\n this.#values.clear();\n this.#serializedNames.clear();\n }\n delete(name: string): boolean {\n const key = `${name}`;\n this.#serializedNames.delete(key);\n return this.#values.delete(key);\n }\n get(name: string): number[] | undefined {\n const value = this.#values.get(`${name}`);\n return value ? [...value] : undefined;\n }\n has(name: string): boolean { return this.#values.has(`${name}`); }\n entries(): MapIterator<[string, number[]]> {\n return new Map(\n [...this.#values].map(([name, values]) => [name, [...values]]),\n ).entries();\n }\n keys(): MapIterator<string> { return this.#values.keys(); }\n values(): MapIterator<number[]> {\n return new Map(\n [...this.#values].map(([name, values]) => [name, [...values]]),\n ).values();\n }\n forEach(\n callback: (value: number[], key: string, map: CSSFontFeatureValuesMap) => void,\n thisArg?: unknown,\n ): void {\n for (const [name, values] of this.#values) {\n callback.call(thisArg, [...values], name, this);\n }\n }\n [Symbol.iterator](): MapIterator<[string, number[]]> { return this.entries(); }\n\n /** @internal */\n setParsed(name: string, serializedName: string, values: number[]): void {\n this.#values.set(name, [...values]);\n this.#serializedNames.set(name, serializedName);\n }\n\n /** @internal */\n serializedEntries(): Array<[string, number[]]> {\n return [...this.#values].map(([name, values]) => [\n this.#serializedNames.get(name) ?? serializeNativeIdentifier(name),\n values,\n ]);\n }\n}\n\nconst fontFeatureMapNames = [\n \"annotation\",\n \"ornaments\",\n \"stylistic\",\n \"swash\",\n \"character-variant\",\n \"styleset\",\n] as const;\n\n/** A mutable `@font-feature-values` rule. */\nexport class CSSFontFeatureValuesRule extends CSSRule {\n readonly annotation = constructWebIDL<CSSFontFeatureValuesMap>(CSSFontFeatureValuesMap);\n readonly ornaments = constructWebIDL<CSSFontFeatureValuesMap>(CSSFontFeatureValuesMap);\n readonly stylistic = constructWebIDL<CSSFontFeatureValuesMap>(CSSFontFeatureValuesMap);\n readonly swash = constructWebIDL<CSSFontFeatureValuesMap>(CSSFontFeatureValuesMap);\n readonly characterVariant = constructWebIDL<CSSFontFeatureValuesMap>(CSSFontFeatureValuesMap);\n readonly styleset = constructWebIDL<CSSFontFeatureValuesMap>(CSSFontFeatureValuesMap);\n #fontFamily: string;\n\n private constructor(fontFamily: string) {\n super(CSSRule.FONT_FEATURE_VALUES_RULE);\n this.#fontFamily = fontFamily;\n lockOwnProperties(\n this,\n \"annotation\",\n \"ornaments\",\n \"stylistic\",\n \"swash\",\n \"characterVariant\",\n \"styleset\",\n );\n }\n\n get fontFamily(): string { return this.#fontFamily; }\n set fontFamily(value: string) {\n this.#fontFamily = serializeNativeFontFamily(`${value}`);\n }\n\n /** @internal */\n featureMap(name: string): CSSFontFeatureValuesMap | null {\n switch (name) {\n case \"annotation\": return this.annotation;\n case \"ornaments\": return this.ornaments;\n case \"stylistic\": return this.stylistic;\n case \"swash\": return this.swash;\n case \"character-variant\": return this.characterVariant;\n case \"styleset\": return this.styleset;\n default: return null;\n }\n }\n\n override get cssText(): string {\n const blocks: string[] = [];\n for (const name of fontFeatureMapNames) {\n const map = this.featureMap(name);\n if (!map || map.size === 0) continue;\n const declarations = map.serializedEntries()\n .map(([key, values]) => `${key}:${values.length === 0 ? \"\" : ` ${values.join(\" \")}`};`)\n .join(\" \");\n blocks.push(`@${name} { ${declarations} }`);\n }\n return `@font-feature-values ${this.fontFamily} {${blocks.length === 0 ? \"\" : ` ${blocks.join(\" \")}`} }`;\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live style rule with declarations and nested rules. */\nexport class CSSStyleRule extends CSSGroupingRule {\n readonly style: CSSStyleDeclaration;\n #selectorText: string;\n\n private constructor(selectorText: string) {\n super(CSSRule.STYLE_RULE);\n this.#selectorText = normalizeSelectorText(\n `${selectorText}`,\n currentConstructionResourceBudget(),\n )\n ?? `${selectorText}`;\n this.style = constructWebIDL<CSSStyleDeclaration>(CSSStyleDeclaration, [this]);\n lockOwnProperties(this, \"style\");\n }\n\n get selectorText(): string {\n return this.#selectorText;\n }\n\n set selectorText(value: string) {\n const normalized = normalizeSelectorText(\n `${value}`,\n ruleResourceBudgets.get(this) ?? defaultResourceBudget,\n );\n if (normalized === null) return;\n this.#selectorText = normalized;\n }\n\n override get cssText(): string {\n const declarations = this.style.cssText;\n const children = ruleTree.children(this);\n if (children.length === 0) {\n return declarations === \"\"\n ? `${this.selectorText} { }`\n : `${this.selectorText} { ${declarations} }`;\n }\n return serializeLineGroupCssText(this, this.selectorText);\n }\n\n set cssText(_value: string) {}\n\n}\n\nfunction parseKeyframeRule(\n ruleText: string,\n reportDiagnostic: ReportDiagnostic,\n resourceBudget: NativeResourceBudget,\n): CSSKeyframeRule | null {\n const keyframes = parseNativeRule(`@keyframes sheetom { ${ruleText} }`, resourceBudget);\n if (keyframes?.kind !== \"keyframes\" || keyframes.children.length !== 1) return null;\n const frame = createRuleFromNative(\n keyframes.children[0]!,\n reportDiagnostic,\n false,\n resourceBudget,\n );\n return frame instanceof CSSKeyframeRule ? frame : null;\n}\n\nfunction replaceKeyframeRules(rule: CSSKeyframesRule, rules: CSSKeyframeRule[]): void {\n ruleTree.replace(rule, rules);\n}\n\nfunction replaceGroupingRules(group: CSSGroupingRule, rules: CSSRule[]): void {\n ruleTree.replace(group, rules);\n}\n\nfunction attachRuleTree(\n rule: CSSRule,\n parentRule: CSSRule | null,\n parentStyleSheet: CSSStyleSheet | null,\n): void {\n ruleTree.attach(rule, parentRule, parentStyleSheet);\n}\n\nfunction serializeRuleSafe(rule: CSSRule): string {\n return safeSerializer.serialize(rule);\n}\n\nfunction describeRuleSafe(rule: CSSRule): RuleSerializationPlan<CSSRule> {\n if (rule instanceof CSSStyleRule) {\n return {\n kind: \"block\",\n header: rule.selectorText,\n declarations: rule.style.serializeSafe(\" \"),\n children: ruleTree.children(rule),\n };\n }\n if (rule instanceof CSSNestedDeclarations || rule instanceof CSSFunctionDeclarations) {\n return { kind: \"declarations\", declarations: rule.style.serializeSafe(\"\") };\n }\n if (\n rule instanceof CSSFontFaceRule ||\n rule instanceof CSSMarginRule ||\n rule instanceof CSSPositionTryRule ||\n rule instanceof CSSKeyframeRule\n ) {\n const blockIndex = rule.cssText.indexOf(\"{\");\n const header = rule.cssText.slice(0, blockIndex).trimEnd();\n return {\n kind: \"block\",\n header,\n declarations: rule.style.serializeSafe(\" \"),\n };\n }\n if (rule instanceof CSSKeyframesRule) {\n return {\n kind: \"block\",\n header: `@keyframes ${rule.name}`,\n children: ruleTree.children(rule),\n };\n }\n if (rule instanceof CSSPageRule) {\n const selector = rule.selectorText === \"\" ? \"\" : ` ${rule.selectorText}`;\n return {\n kind: \"block\",\n header: `@page${selector}`,\n declarations: rule.style.serializeSafe(\" \"),\n children: ruleTree.children(rule),\n };\n }\n if (!(rule instanceof CSSGroupingRule)) {\n return { kind: \"raw\", cssText: rule.cssText };\n }\n\n return {\n kind: \"block\",\n header: groupingRuleHeader(rule),\n children: ruleTree.children(rule),\n };\n}\n\nfunction groupingRuleHeader(rule: CSSGroupingRule): string {\n if (rule instanceof CSSFunctionRule) {\n return functionRuleHeaders.get(rule) ?? \"@function\";\n }\n if (rule instanceof CSSMediaRule) return `@media ${rule.media.mediaText}`;\n if (rule instanceof CSSSupportsRule) return `@supports ${rule.conditionText}`;\n if (rule instanceof CSSContainerRule) return `@container ${rule.conditionText}`;\n if (rule instanceof CSSLayerBlockRule) {\n return `@layer${rule.name === \"\" ? \"\" : ` ${rule.name}`}`;\n }\n if (rule instanceof CSSScopeRule) {\n const start = rule.start === null ? \"\" : ` (${rule.start})`;\n const end = rule.end === null ? \"\" : ` to (${rule.end})`;\n return `@scope${start}${end}`;\n }\n if (rule instanceof CSSStartingStyleRule) return \"@starting-style\";\n\n const blockIndex = rule.cssText.indexOf(\"{\");\n return blockIndex === -1 ? rule.cssText : rule.cssText.slice(0, blockIndex).trimEnd();\n}\n\nfunction parseScopePrelude(\n prelude: string,\n resourceBudget: NativeResourceBudget,\n): [string | null, string | null] {\n const parsed = parseNativeScopePrelude(prelude, resourceBudget);\n return parsed ? [parsed.start, parsed.end] : [null, null];\n}\n\nfunction parseImportPrelude(\n prelude: string,\n): { href: string; media: string; layer: string | null; supports: string | null } | null {\n const hrefMatch = prelude.match(\n /^(?:url\\(\\s*(?:\"([^\"]*)\"|'([^']*)'|([^)]*))\\s*\\)|\"([^\"]*)\"|'([^']*)')\\s*(.*)$/,\n );\n if (!hrefMatch) return null;\n const href = hrefMatch[1] ?? hrefMatch[2] ?? hrefMatch[3]?.trim() ?? hrefMatch[4] ?? hrefMatch[5];\n if (href === undefined) return null;\n let remainder = hrefMatch[6]?.trim() ?? \"\";\n let layer: string | null = null;\n let supports: string | null = null;\n\n const layerMatch = remainder.match(/^layer(?:\\(([^)]*)\\))?(?:\\s+|$)(.*)$/);\n if (layerMatch) {\n layer = layerMatch[1]?.trim() ?? \"\";\n remainder = layerMatch[2]?.trim() ?? \"\";\n }\n\n if (remainder.startsWith(\"supports(\")) {\n let depth = 0;\n let end = -1;\n for (let index = \"supports\".length; index < remainder.length; index += 1) {\n const character = remainder[index];\n if (character === \"(\") depth += 1;\n if (character !== \")\") continue;\n depth -= 1;\n if (depth !== 0) continue;\n end = index;\n break;\n }\n if (end !== -1) {\n supports = remainder.slice(\"supports(\".length, end).trim();\n remainder = remainder.slice(end + 1).trim();\n }\n }\n\n return { href, media: remainder, layer, supports };\n}\n\nfunction createRuleFromNative(\n description: NativeRuleDescription,\n reportDiagnostic: ReportDiagnostic,\n preserveImports: boolean,\n resourceBudget: NativeResourceBudget,\n): CSSRule | null {\n return constructWithResourceBudget(() =>\n createRuleTreeFromNative(\n description,\n reportDiagnostic,\n preserveImports,\n resourceBudget,\n ),\n resourceBudget,\n );\n}\n\nfunction createRuleTreeFromNative(\n description: NativeRuleDescription,\n reportDiagnostic: ReportDiagnostic,\n preserveImports: boolean,\n resourceBudget: NativeResourceBudget,\n): CSSRule | null {\n const root = createRuleShellFromNative(\n description,\n reportDiagnostic,\n preserveImports,\n resourceBudget,\n );\n if (!root) return null;\n\n const pending = [{ description, rule: root }];\n while (pending.length > 0) {\n const current = pending.pop();\n if (\n !current\n || (\n !(current.rule instanceof CSSGroupingRule)\n && !(current.rule instanceof CSSKeyframesRule)\n )\n ) continue;\n\n const children: CSSRule[] = [];\n const childFrames: { description: NativeRuleDescription; rule: CSSRule }[] = [];\n for (const childDescription of current.description.children) {\n if (isNativeMetadataRule(childDescription)) continue;\n const child = createRuleShellFromNative(\n childDescription,\n reportDiagnostic,\n preserveImports,\n resourceBudget,\n );\n if (!child) continue;\n if (child instanceof CSSFunctionDeclarations && child.style.length === 0) continue;\n if (current.rule instanceof CSSKeyframesRule && !(child instanceof CSSKeyframeRule)) {\n continue;\n }\n children.push(child);\n childFrames.push({ description: childDescription, rule: child });\n }\n\n if (current.rule instanceof CSSKeyframesRule) {\n replaceKeyframeRules(\n current.rule,\n children.filter((candidate): candidate is CSSKeyframeRule =>\n candidate instanceof CSSKeyframeRule\n ),\n );\n } else {\n replaceGroupingRules(current.rule, children);\n }\n for (let index = childFrames.length - 1; index >= 0; index -= 1) {\n const childFrame = childFrames[index];\n if (childFrame) pending.push(childFrame);\n }\n }\n\n return root;\n}\n\nfunction isNativeMetadataRule(description: NativeRuleDescription): boolean {\n return description.kind === \"function-parameter\"\n || description.kind === \"property-descriptor\"\n || description.kind === \"view-transition-type\"\n || description.kind === \"layer-name\";\n}\n\nfunction createRuleShellFromNative(\n description: NativeRuleDescription,\n reportDiagnostic: ReportDiagnostic,\n preserveImports: boolean,\n resourceBudget: NativeResourceBudget,\n): CSSRule | null {\n let rule: CSSRule;\n switch (description.kind) {\n case \"style\": {\n const style = constructWebIDL<CSSStyleRule>(CSSStyleRule, [description.prelude]);\n style.style.cssText = description.declarations;\n rule = style;\n break;\n }\n case \"nested-declarations\": {\n const nested = constructWebIDL<CSSNestedDeclarations>(CSSNestedDeclarations);\n nested.style.cssText = description.declarations;\n rule = nested;\n break;\n }\n case \"function-declarations\": {\n const declarations = constructWebIDL<CSSFunctionDeclarations>(CSSFunctionDeclarations);\n declarations.style.cssText = description.declarations;\n rule = declarations;\n break;\n }\n case \"import\": {\n if (!preserveImports) return null;\n const prelude = description.cssText\n .replace(/^@import\\s+/iu, \"\")\n .replace(/;\\s*$/u, \"\");\n const parsed = parseImportPrelude(prelude);\n if (!parsed) return null;\n rule = constructWebIDL<CSSImportRule>(CSSImportRule, [\n parsed.href,\n parsed.media,\n parsed.layer,\n parsed.supports,\n ]);\n break;\n }\n case \"font-face\": {\n const fontFace = constructWebIDL<CSSFontFaceRule>(CSSFontFaceRule);\n fontFace.style.cssText = description.declarations;\n rule = fontFace;\n break;\n }\n case \"page\": {\n const page = constructWebIDL<CSSPageRule>(CSSPageRule, [description.prelude]);\n page.style.cssText = description.declarations;\n rule = page;\n break;\n }\n case \"margin\": {\n const margin = constructWebIDL<CSSMarginRule>(CSSMarginRule, [description.prelude]);\n margin.style.cssText = description.declarations;\n rule = margin;\n break;\n }\n case \"position-try\": {\n const positionTry = constructWebIDL<CSSPositionTryRule>(CSSPositionTryRule, [description.prelude]);\n positionTry.style.cssText = description.declarations;\n rule = positionTry;\n break;\n }\n case \"keyframes\": {\n rule = constructWebIDL<CSSKeyframesRule>(CSSKeyframesRule, [description.prelude]);\n break;\n }\n case \"keyframe\": {\n const keyframe = constructWebIDL<CSSKeyframeRule>(CSSKeyframeRule, [description.prelude]);\n keyframe.style.cssText = description.declarations;\n rule = keyframe;\n break;\n }\n case \"counter-style\": {\n const counterStyle = constructWebIDL<CSSCounterStyleRule>(CSSCounterStyleRule, [description.prelude]);\n hydrateCounterStyleDescriptors(\n counterStyle,\n description.declarations,\n resourceBudget,\n );\n rule = counterStyle;\n break;\n }\n case \"font-feature-values\": {\n const featureValues = constructWebIDL<CSSFontFeatureValuesRule>(\n CSSFontFeatureValuesRule,\n [description.prelude],\n );\n for (const mapDescription of description.children) {\n if (mapDescription.kind !== \"font-feature-map\") continue;\n const map = featureValues.featureMap(mapDescription.prelude);\n if (!map) continue;\n for (const entry of mapDescription.children) {\n if (entry.kind !== \"font-feature-entry\") continue;\n const values = entry.declarations === \"\"\n ? []\n : entry.declarations.split(\" \").map(value => Number(value));\n map.setParsed(entry.prelude, entry.cssText, values);\n }\n }\n rule = featureValues;\n break;\n }\n case \"property\": {\n return constructWebIDL<CSSPropertyRule>(CSSPropertyRule, [\n description.prelude,\n nativeRuleDescriptor(description, \"syntax\"),\n nativeRuleDescriptor(description, \"inherits\") === \"true\",\n nativeRuleDescriptor(description, \"initial-value\"),\n description.cssText,\n ]);\n }\n case \"font-palette-values\":\n return constructWebIDL<CSSFontPaletteValuesRule>(CSSFontPaletteValuesRule, [\n description.prelude,\n nativeRuleDescriptor(description, \"font-family\"),\n nativeRuleDescriptor(description, \"base-palette\"),\n nativeRuleDescriptor(description, \"override-colors\"),\n description.cssText,\n ]);\n case \"view-transition\":\n return constructWebIDL<CSSViewTransitionRule>(CSSViewTransitionRule, [\n nativeRuleDescriptor(description, \"navigation\"),\n description.children\n .filter(candidate => candidate.kind === \"view-transition-type\")\n .map(candidate => candidate.prelude),\n description.cssText,\n ]);\n case \"function\": {\n const parameters = description.children\n .filter(candidate => candidate.kind === \"function-parameter\")\n .map(candidate => {\n const defaultValue = candidate.children.find(\n child => child.kind === \"property-descriptor\" && child.prelude === \"default-value\",\n );\n return defaultValue\n ? {\n defaultValue: defaultValue.declarations,\n name: candidate.prelude,\n type: candidate.declarations,\n }\n : {\n name: candidate.prelude,\n type: candidate.declarations,\n };\n });\n rule = constructWebIDL<CSSFunctionRule>(CSSFunctionRule, [\n description.prelude,\n parameters,\n description.declarations,\n ]);\n break;\n }\n case \"namespace\":\n return constructWebIDL<CSSNamespaceRule>(CSSNamespaceRule, [\n nativeRuleDescriptor(description, \"namespace-uri\"),\n nativeRuleDescriptor(description, \"prefix\"),\n description.cssText,\n ]);\n case \"media\":\n rule = constructWebIDL<CSSMediaRule>(CSSMediaRule, [description.prelude]);\n break;\n case \"supports\":\n rule = constructWebIDL<CSSSupportsRule>(CSSSupportsRule, [description.prelude]);\n break;\n case \"container\":\n rule = constructWebIDL<CSSContainerRule>(CSSContainerRule, [description.prelude]);\n break;\n case \"layer-block\":\n rule = constructWebIDL<CSSLayerBlockRule>(CSSLayerBlockRule, [description.prelude]);\n break;\n case \"scope\": {\n const [start, end] = parseScopePrelude(description.prelude, resourceBudget);\n rule = constructWebIDL<CSSScopeRule>(CSSScopeRule, [start, end]);\n break;\n }\n case \"starting-style\":\n rule = constructWebIDL<CSSStartingStyleRule>(CSSStartingStyleRule);\n break;\n case \"layer-statement\": {\n const names = description.children\n .filter(candidate => candidate.kind === \"layer-name\")\n .map(candidate => candidate.prelude);\n return constructWebIDL<CSSLayerStatementRule>(CSSLayerStatementRule, [names]);\n }\n default:\n return new CSSGenericRule(\n genericRuleType(description.cssText.match(/^@([^\\s{;]+)/u)?.[1] ?? \"\"),\n description.cssText,\n );\n }\n\n ruleDiagnostics.set(rule, reportDiagnostic);\n return rule;\n}\n\nfunction nativeRuleDescriptor(description: NativeRuleDescription, name: string): string {\n return description.children\n .find(candidate => candidate.kind === \"property-descriptor\" && candidate.prelude === name)\n ?.declarations ?? \"\";\n}\n\nfunction hydrateCounterStyleDescriptors(\n rule: CSSCounterStyleRule,\n declarations: string,\n resourceBudget: NativeResourceBudget,\n): void {\n for (const descriptor of parseNativeCounterStyleDescriptors(\n declarations,\n resourceBudget,\n )) {\n rule.setParsedDescriptor(descriptor.name, descriptor.value);\n }\n}\n\nfunction parseStrictRule(\n ruleText: string,\n reportDiagnostic: ReportDiagnostic,\n preserveImports = false,\n parentRule: CSSGroupingRule | null = null,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): CSSRule | null {\n if (parentRule instanceof CSSPageRule) {\n const page = parseNativeRule(`@page { ${ruleText} }`, resourceBudget);\n if (page?.kind !== \"page\" || page.children.length !== 1) return null;\n const child = page.children[0];\n if (!child || child.kind !== \"margin\" || !pageMarginRuleNames.has(child.prelude)) return null;\n return createRuleFromNative(\n child,\n reportDiagnostic,\n preserveImports,\n resourceBudget,\n );\n }\n const description = parseNativeRule(ruleText, resourceBudget)\n ?? (parentRule && hasFunctionAncestor(parentRule)\n ? parseNativeRuleWithErrorRecovery(ruleText, resourceBudget)\n : null);\n if (!description || (description.kind === \"import\" && !preserveImports)) return null;\n return createRuleFromNative(\n description,\n reportDiagnostic,\n preserveImports,\n resourceBudget,\n );\n}\n\nfunction hasFunctionAncestor(rule: CSSRule): boolean {\n let current: CSSRule | null = rule;\n while (current) {\n if (current instanceof CSSFunctionRule) return true;\n current = current.parentRule;\n }\n return false;\n}\n\nfunction genericRuleType(name: string): number {\n switch (name.toLowerCase()) {\n case \"import\":\n return CSSRule.IMPORT_RULE;\n case \"media\":\n return CSSRule.MEDIA_RULE;\n case \"font-face\":\n return CSSRule.FONT_FACE_RULE;\n case \"page\":\n return CSSRule.PAGE_RULE;\n case \"keyframes\":\n case \"-webkit-keyframes\":\n return CSSRule.KEYFRAMES_RULE;\n case \"namespace\":\n return CSSRule.NAMESPACE_RULE;\n case \"supports\":\n return CSSRule.SUPPORTS_RULE;\n default:\n return 0;\n }\n}\n\nfunction parseStyleSheetRules(\n cssText: string,\n reportDiagnostic: ReportDiagnostic,\n preserveImports: boolean,\n resourceBudget: NativeResourceBudget,\n): CSSRule[] {\n const rules: CSSRule[] = [];\n let parsedRuleCount = 0;\n for (const rawRule of scanTopLevelRules(cssText, resourceBudget)) {\n const rule = parseStrictRule(\n rawRule,\n reportDiagnostic,\n preserveImports,\n null,\n resourceBudget,\n );\n if (rule) {\n parsedRuleCount += ruleForestSize([rule]);\n assertRuleCountBudget(parsedRuleCount, resourceBudget);\n rules.push(rule);\n continue;\n }\n if (!preserveImports) continue;\n const opaque = constructWithResourceBudget(\n () => new CSSOpaqueRule(0, rawRule),\n resourceBudget,\n );\n parsedRuleCount += 1;\n assertRuleCountBudget(parsedRuleCount, resourceBudget);\n rules.push(opaque);\n }\n\n return rules;\n}\n\n/** A mutable, browser-shaped authoring stylesheet. */\nexport class CSSStyleSheet {\n readonly cssRules: CSSRuleList;\n readonly media: MediaList;\n readonly ownerNode: null = null;\n readonly parentStyleSheet: null = null;\n readonly ownerRule: null = null;\n readonly title: null = null;\n readonly type = \"text/css\";\n disabled: boolean;\n\n readonly #rules: CSSRule[] = [];\n readonly #diagnostics: SheetOMDiagnostic[] | null;\n readonly #constructedBaseURL: string;\n\n constructor(options: CSSStyleSheetOptions | null = {}) {\n const normalizedOptions = options ?? {};\n const resourceBudget = normalizeResourceBudget(normalizedOptions.resourceBudget);\n sheetResourceBudgets.set(this, resourceBudget);\n sheetRuleArrays.set(this, this.#rules);\n sheetRuleCounts.set(this, 0);\n this.#diagnostics = Boolean(normalizedOptions.diagnostics) ? [] : null;\n this.#constructedBaseURL = normalizedOptions.baseURL === undefined\n ? \"about:blank\"\n : `${normalizedOptions.baseURL}`;\n const media = normalizedOptions.media === undefined\n ? \"\"\n : `${normalizedOptions.media}`;\n this.media = constructWithResourceBudget(\n () => constructWebIDL<MediaList>(MediaList, [media]),\n resourceBudget,\n );\n this.disabled = Boolean(normalizedOptions.disabled);\n this.cssRules = constructInternally(\n () => constructWebIDL<CSSRuleList>(CSSRuleList, [this.#rules]),\n );\n lockOwnProperties(\n this,\n \"cssRules\",\n \"media\",\n \"ownerNode\",\n \"parentStyleSheet\",\n \"ownerRule\",\n \"title\",\n \"type\",\n );\n }\n\n get href(): string | null {\n return regularSheetMetadata.get(this)?.href ?? null;\n }\n\n get baseURL(): string {\n return regularSheetMetadata.get(this)?.baseURL ?? this.#constructedBaseURL;\n }\n\n readonly #reportDiagnostic: ReportDiagnostic = diagnostic => {\n this.#diagnostics?.push(diagnostic);\n };\n\n insertRule(ruleText: string, index = 0): number {\n requireArguments(arguments.length, 1, \"CSSStyleSheet\", \"insertRule\");\n const normalizedIndex = toUnsignedLong(index);\n if (normalizedIndex > this.#rules.length) {\n throw new DOMException(\"The index is outside the allowed range.\", \"IndexSizeError\");\n }\n\n const regular = regularSheetMetadata.has(this);\n const resourceBudget = sheetResourceBudgets.get(this) ?? defaultResourceBudget;\n const rule = parseStrictRule(\n `${ruleText}`,\n this.#reportDiagnostic,\n regular,\n null,\n resourceBudget,\n );\n if (!rule) throw new DOMException(\"The rule could not be parsed.\", \"SyntaxError\");\n\n const precedingRules = this.#rules.slice(0, normalizedIndex);\n const followingRules = this.#rules.slice(normalizedIndex);\n const invalidImportOrder = rule instanceof CSSImportRule\n ? precedingRules.some(candidate => !(candidate instanceof CSSImportRule))\n : followingRules.some(candidate => candidate instanceof CSSImportRule);\n if (invalidImportOrder) {\n throw new DOMException(\"The rule violates stylesheet ordering.\", \"HierarchyRequestError\");\n }\n\n const insertedCount = assertRuleInsertionBudget(this, rule, resourceBudget);\n attachRuleTree(rule, null, this);\n this.#rules.splice(normalizedIndex, 0, rule);\n adjustSheetRuleCount(this, insertedCount);\n return normalizedIndex;\n }\n\n deleteRule(index: number): void {\n requireArguments(arguments.length, 1, \"CSSStyleSheet\", \"deleteRule\");\n const normalizedIndex = toUnsignedLong(index);\n if (normalizedIndex >= this.#rules.length) {\n throw new DOMException(\"The index is outside the allowed range.\", \"IndexSizeError\");\n }\n\n const [removed] = this.#rules.splice(normalizedIndex, 1);\n if (!removed) return;\n adjustSheetRuleCount(this, -ruleForestSize([removed]));\n attachRuleTree(removed, null, null);\n }\n\n replaceSync(cssText: string): void {\n requireArguments(arguments.length, 1, \"CSSStyleSheet\", \"replaceSync\");\n const replacement = parseStyleSheetRules(\n `${cssText}`,\n this.#reportDiagnostic,\n regularSheetMetadata.has(this),\n sheetResourceBudgets.get(this) ?? defaultResourceBudget,\n );\n\n for (const rule of this.#rules) {\n attachRuleTree(rule, null, null);\n }\n for (const rule of replacement) attachRuleTree(rule, null, this);\n\n this.#rules.splice(0, this.#rules.length, ...replacement);\n sheetRuleCounts.set(this, ruleForestSize(replacement));\n }\n\n async replace(cssText: string): Promise<CSSStyleSheet> {\n requireArguments(arguments.length, 1, \"CSSStyleSheet\", \"replace\");\n this.replaceSync(cssText);\n return this;\n }\n\n /** Serialize current state as reparsable CSS without mutating live objects. */\n serialize(): string {\n return this.#rules.map(serializeRuleSafe).join(\"\");\n }\n\n /** Drain opt-in mutation diagnostics without affecting CSSOM behavior. */\n takeDiagnostics(): SheetOMDiagnostic[] {\n if (!this.#diagnostics) return [];\n return this.#diagnostics.splice(0);\n }\n}\n\n/** Forgivingly parse an existing regular stylesheet without loading imports. */\nexport function parseStyleSheet(\n cssText: string,\n options: ParseStyleSheetOptions = {},\n): CSSStyleSheet {\n const sheet = new CSSStyleSheet(options);\n const href = options.href ?? null;\n regularSheetMetadata.set(sheet, {\n href,\n baseURL: options.baseURL ?? href ?? \"about:blank\",\n });\n sheet.replaceSync(`${cssText}`);\n return sheet;\n}\n"],"mappings":";;;;;ACUA,MAAa,4BAAyD,OAAO,OAAO;CACtEA;CACIC;CACOC;AACzB,CAAC;AA4DD,IAAa,4BAA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,YAAY,OAAO;EACxB,OAAO;CACT;;CAGA,YAAoB;EAClB,OAAO,KAAKA,OAAO,IAAI,iBAAiB,CAAC,CAAC,KAAK,EAAE;CACnD;;CAGA,kBAAuC;EACrC,IAAI,CAAC,KAAKoB,cAAc,OAAO,CAAC;EAChC,OAAO,KAAKA,aAAa,OAAO,CAAC;CACnC;AACF;;AAGA,SAAgB,gBACd,SACA,UAAkC,CAAC,GACpB;CACf,MAAM,QAAQ,IAAI,cAAc,OAAO;CACvC,MAAM,OAAO,QAAQ,QAAQ;CAC7B,qBAAqB,IAAI,OAAO;EAC9B;EACA,SAAS,QAAQ,WAAW,QAAQ;CACtC,CAAC;CACD,MAAM,YAAY,GAAG,SAAS;CAC9B,OAAO;AACT"}
1
+ {"version":3,"file":"index.js","names":["generatedEngineAbiIdentity.abiVersion","generatedEngineAbiIdentity.sheetomVersion","generatedEngineAbiIdentity.syntaxEngineSetSha256","#state","#reportDiagnostic","#reportSerializationDiagnostic","#reservedNestingDepth","#serializationCache","#observableCache","toUnsignedLong","#invalidateSerialization","#diagnosticForOutcome","#reportSerializationIssues","#children","#setParentage","#parentStyleSheet","#describe","#type","#rules","#resourceBudget","#mediaText","#conditionText","#parameters","#names","#rawHref","#cssText","#block","#style","#selectorText","#keyText","#name","#descriptors","#serializedName","#get","#set","#values","#serializedNames","#fontFamily","#diagnostics","#constructedBaseURL","#reportDiagnostic"],"sources":["../engine-abi.json","../src/internal/engine-binding.ts","../src/internal/native-binding.ts","../src/internal/default-engine-binding.ts","../src/internal/resource-budget.ts","../src/serialization-error.ts","../src/internal/native-declaration-block.ts","../src/internal/css-rule-scanner.ts","../src/internal/native-rule-parser.ts","../src/internal/native-rule-syntax.ts","../src/internal/rule-tree.ts","../src/internal/native-counter-style.ts","../src/internal/serializer.ts","../src/internal/webidl-construction.ts","../src/index.ts"],"sourcesContent":["","import generatedEngineAbiIdentity from \"../../engine-abi.json\" with { type: \"json\" };\n\ntype EngineBudgetArguments = [number, number, number, number, number];\n\nexport interface EngineAbiIdentity {\n abiVersion: number;\n sheetomVersion: string;\n syntaxEngineSetSha256: string;\n}\n\nexport const expectedEngineAbiIdentity: Readonly<EngineAbiIdentity> = Object.freeze({\n abiVersion: generatedEngineAbiIdentity.abiVersion,\n sheetomVersion: generatedEngineAbiIdentity.sheetomVersion,\n syntaxEngineSetSha256: generatedEngineAbiIdentity.syntaxEngineSetSha256,\n});\n\nexport type EngineMutationOutcome =\n | \"applied\"\n | \"invalid-name\"\n | \"invalid-priority\"\n | \"invalid-value\"\n | \"unsupported-shorthand\";\n\nexport type EngineDeclarationMutation =\n | { kind: \"set\"; property: string; value: string; priority: string }\n | { kind: \"remove\"; property: string };\n\nexport interface EngineDeclarationStateHandle {\n readonly length: number;\n readonly cssText: string;\n item(index: number): string;\n getPropertyValue(name: string): string;\n getPropertyPriority(name: string): string;\n setProperty(\n name: string,\n value: string,\n priority: string,\n reservedNestingDepth?: number,\n ): EngineMutationOutcome;\n applyMutations(\n kinds: readonly number[],\n properties: readonly string[],\n values: readonly string[],\n priorities: readonly string[],\n reservedNestingDepth?: number,\n ): string[];\n removeProperty(name: string): string;\n replaceCssText(source: string, reservedNestingDepth?: number): void;\n serializeFormatted(safe: boolean, indent: string, separator: string): string;\n serializeFormattedResilient(safe: boolean, indent: string, separator: string): string[];\n}\n\nexport interface EngineBindingIdentityProvider {\n engineAbiIdentity(): string;\n}\n\n/** Transport-neutral private contract implemented by native and WebAssembly engines. */\nexport interface EngineBinding extends EngineBindingIdentityProvider {\n normalizeMedia(source: string, ...budget: EngineBudgetArguments): string;\n normalizeSelector(source: string, ...budget: EngineBudgetArguments): string;\n normalizeSupports(source: string, ...budget: EngineBudgetArguments): string;\n parseContainerPreludeJson(source: string, ...budget: EngineBudgetArguments): string;\n parseCounterStyleDescriptorValue(\n name: string,\n value: string,\n ...budget: EngineBudgetArguments\n ): string | null;\n parseCounterStyleDescriptorsJson(source: string, ...budget: EngineBudgetArguments): string;\n parseCounterStyleNameJson(source: string, ...budget: EngineBudgetArguments): string | null;\n serializeIdentifierValue(value: string): string;\n serializeFontFamilyValue(value: string): string;\n createDeclarationState(\n context?: \"style\" | \"font-face\" | \"function\",\n ...budget: EngineBudgetArguments\n ): EngineDeclarationStateHandle;\n parseRecoveredRuleTreeJson(source: string, ...budget: EngineBudgetArguments): string;\n parseRecoveredSingleRuleTreeJson(source: string, ...budget: EngineBudgetArguments): string;\n parseStylesheetTreeJson(\n source: string,\n errorRecovery: boolean,\n ...budget: EngineBudgetArguments\n ): string;\n parseScopePreludeJson(source: string, ...budget: EngineBudgetArguments): string;\n scanTopLevelRulesJson(source: string, ...budget: EngineBudgetArguments): string;\n}\n\nexport class SheetOMEngineBindingError extends Error {\n readonly code: \"SHEETOM_ENGINE_ABI_INVALID\" | \"SHEETOM_ENGINE_ABI_MISMATCH\";\n\n constructor(\n code: \"SHEETOM_ENGINE_ABI_INVALID\" | \"SHEETOM_ENGINE_ABI_MISMATCH\",\n message: string,\n options?: ErrorOptions,\n ) {\n super(message, options);\n this.name = \"SheetOMEngineBindingError\";\n this.code = code;\n }\n}\n\nexport function validateEngineBindingIdentity(provider: EngineBindingIdentityProvider): void {\n let parsed: unknown;\n try {\n parsed = JSON.parse(provider.engineAbiIdentity());\n } catch (cause) {\n throw new SheetOMEngineBindingError(\n \"SHEETOM_ENGINE_ABI_INVALID\",\n \"SheetOM could not decode the engine ABI identity.\",\n { cause },\n );\n }\n\n if (!isEngineAbiIdentity(parsed)) {\n throw new SheetOMEngineBindingError(\n \"SHEETOM_ENGINE_ABI_INVALID\",\n \"SheetOM received an invalid engine ABI identity.\",\n );\n }\n if (\n parsed.abiVersion === expectedEngineAbiIdentity.abiVersion\n && parsed.sheetomVersion === expectedEngineAbiIdentity.sheetomVersion\n && parsed.syntaxEngineSetSha256 === expectedEngineAbiIdentity.syntaxEngineSetSha256\n ) return;\n\n throw new SheetOMEngineBindingError(\n \"SHEETOM_ENGINE_ABI_MISMATCH\",\n \"SheetOM refused an incompatible engine binding.\",\n );\n}\n\nfunction isEngineAbiIdentity(value: unknown): value is EngineAbiIdentity {\n if (typeof value !== \"object\" || value === null) return false;\n const identity = value as Partial<EngineAbiIdentity>;\n return Number.isSafeInteger(identity.abiVersion)\n && typeof identity.sheetomVersion === \"string\"\n && /^[0-9a-f]{64}$/u.test(identity.syntaxEngineSetSha256 ?? \"\");\n}\n","import { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport {\n type EngineBinding,\n type EngineDeclarationStateHandle,\n validateEngineBindingIdentity,\n} from \"./engine-binding.js\";\n\ninterface NativeAddonBinding extends Omit<EngineBinding, \"createDeclarationState\"> {\n NativeDeclarationState: new (\n context?: \"style\" | \"font-face\" | \"function\",\n ...budget: [number, number, number, number, number]\n ) => EngineDeclarationStateHandle;\n}\n\nfunction loadBinding(): EngineBinding {\n const moduleDirectory = path.dirname(fileURLToPath(import.meta.url));\n const packageRoot = path.basename(moduleDirectory) === \"dist\"\n ? path.dirname(moduleDirectory)\n : path.resolve(moduleDirectory, \"../..\");\n const require = createRequire(import.meta.url);\n const addon = require(path.join(packageRoot, \"native\", \"index.cjs\")) as NativeAddonBinding;\n validateEngineBindingIdentity(addon);\n return {\n ...addon,\n createDeclarationState: (context, ...budget) => new addon.NativeDeclarationState(\n context,\n ...budget,\n ),\n };\n}\n\nexport const nativeEngineBinding = loadBinding();\n","import type { EngineBinding } from \"./engine-binding.js\";\nimport { nativeEngineBinding } from \"./native-binding.js\";\n\n/** The synchronous root package uses the native adapter exclusively. */\nexport const engineBinding: EngineBinding = nativeEngineBinding;\n","export interface SheetOMResourceBudget {\n maxStylesheetBytes?: number;\n maxDeclarationValueBytes?: number;\n maxSyntaxDepth?: number;\n maxRuleCount?: number;\n maxDeclarationsPerBlock?: number;\n}\n\nexport interface NativeResourceBudget {\n readonly maxStylesheetBytes: number;\n readonly maxDeclarationValueBytes: number;\n readonly maxSyntaxDepth: number;\n readonly maxRuleCount: number;\n readonly maxDeclarationsPerBlock: number;\n}\n\nexport const defaultResourceBudget: NativeResourceBudget = Object.freeze({\n maxStylesheetBytes: 64 * 1024 * 1024,\n maxDeclarationValueBytes: 1024 * 1024,\n maxSyntaxDepth: 4096,\n maxRuleCount: 1_000_000,\n maxDeclarationsPerBlock: 100_000,\n});\n\nconst maximumUnsignedLong = (2 ** 32) - 1;\nconst maximumConfigurableSyntaxDepth = 16_384;\n\nexport function normalizeResourceBudget(\n value: SheetOMResourceBudget | null | undefined,\n): NativeResourceBudget {\n if (\n value !== undefined\n && value !== null\n && (typeof value !== \"object\" || Array.isArray(value))\n ) {\n throw new TypeError(\"resourceBudget must be an object\");\n }\n const input = value ?? {};\n return Object.freeze({\n maxStylesheetBytes: limitValue(\n input.maxStylesheetBytes,\n \"maxStylesheetBytes\",\n defaultResourceBudget.maxStylesheetBytes,\n ),\n maxDeclarationValueBytes: limitValue(\n input.maxDeclarationValueBytes,\n \"maxDeclarationValueBytes\",\n defaultResourceBudget.maxDeclarationValueBytes,\n ),\n maxSyntaxDepth: limitValue(\n input.maxSyntaxDepth,\n \"maxSyntaxDepth\",\n defaultResourceBudget.maxSyntaxDepth,\n maximumConfigurableSyntaxDepth,\n ),\n maxRuleCount: limitValue(\n input.maxRuleCount,\n \"maxRuleCount\",\n defaultResourceBudget.maxRuleCount,\n ),\n maxDeclarationsPerBlock: limitValue(\n input.maxDeclarationsPerBlock,\n \"maxDeclarationsPerBlock\",\n defaultResourceBudget.maxDeclarationsPerBlock,\n ),\n });\n}\n\nexport function nativeBudgetArguments(\n budget: NativeResourceBudget,\n): [number, number, number, number, number] {\n return [\n budget.maxStylesheetBytes,\n budget.maxDeclarationValueBytes,\n budget.maxSyntaxDepth,\n budget.maxRuleCount,\n budget.maxDeclarationsPerBlock,\n ];\n}\n\nexport function rethrowResourceBudgetError(error: unknown): void {\n if (!(error instanceof Error)) return;\n if (!/^SHEETOM_(?:INPUT|DECLARATION|RULE|NESTING)_LIMIT:/u.test(error.message)) return;\n throw new RangeError(error.message);\n}\n\nfunction limitValue(\n value: unknown,\n name: string,\n fallback: number,\n maximum = maximumUnsignedLong,\n): number {\n if (value === undefined) return fallback;\n if (\n typeof value === \"number\"\n && Number.isSafeInteger(value)\n && value >= 0\n && value <= maximum\n ) return value;\n throw new RangeError(`${name} must be an integer between 0 and ${maximum}`);\n}\n","export type SheetOMSerializationErrorCode =\n | \"UNREPRESENTABLE_PENDING_SHORTHAND\";\n\n/** A reparsable stylesheet cannot faithfully represent the current CSSOM state. */\nexport class SheetOMSerializationError extends Error {\n readonly code: SheetOMSerializationErrorCode;\n readonly shorthand: string;\n readonly conflictingLonghands: readonly string[];\n\n constructor(\n shorthand: string,\n conflictingLonghands: readonly string[],\n options?: ErrorOptions,\n ) {\n super(\n `SheetOM cannot serialize the pending ${shorthand} shorthand without changing its semantics.`,\n options,\n );\n this.name = \"SheetOMSerializationError\";\n this.code = \"UNREPRESENTABLE_PENDING_SHORTHAND\";\n this.shorthand = shorthand;\n this.conflictingLonghands = Object.freeze([...conflictingLonghands]);\n }\n}\n\nconst unrepresentablePendingShorthandPattern =\n /^SHEETOM_UNREPRESENTABLE_PENDING_SHORTHAND: shorthand=([^;]+); conflicting=([a-z0-9,-]+)$/u;\n\nexport function serializationErrorFrom(error: unknown): SheetOMSerializationError | null {\n if (!(error instanceof Error)) return null;\n const match = unrepresentablePendingShorthandPattern.exec(error.message);\n if (!match) return null;\n const shorthand = match[1];\n const conflicts = match[2];\n if (!shorthand || !conflicts) return null;\n return new SheetOMSerializationError(shorthand, conflicts.split(\",\"), { cause: error });\n}\n\nexport function rethrowSerializationError(error: unknown): void {\n const serializationError = serializationErrorFrom(error);\n if (serializationError) throw serializationError;\n}\n","import type {\n SheetOMDiagnostic,\n SheetOMMutationDiagnosticCode,\n} from \"../diagnostics.js\";\nimport {\n type EngineDeclarationMutation,\n type EngineDeclarationStateHandle,\n type EngineMutationOutcome,\n} from \"./engine-binding.js\";\nimport { engineBinding } from \"./default-engine-binding.js\";\nimport {\n defaultResourceBudget,\n nativeBudgetArguments,\n rethrowResourceBudgetError,\n type NativeResourceBudget,\n} from \"./resource-budget.js\";\nimport { rethrowSerializationError } from \"../serialization-error.js\";\n\ntype ReportDeclarationDiagnostic = (\n code: SheetOMMutationDiagnosticCode,\n property: string,\n input: string,\n) => SheetOMDiagnostic;\n\ntype ReportSerializationDiagnostic = (\n shorthand: string,\n conflictingLonghands: readonly string[],\n) => void;\n\ninterface RecoveredSerialization {\n serialized: string;\n issues: readonly {\n shorthand: string;\n conflictingLonghands: readonly string[];\n }[];\n}\n\ntype CachedSerialization = string | RecoveredSerialization;\n\nexport type NativeDeclarationMutationResult =\n | {\n kind: \"set\";\n accepted: boolean;\n diagnostic: SheetOMDiagnostic | null;\n }\n | { kind: \"remove\"; value: string };\n\n/** Thin JS ownership boundary around the Rust declaration state machine. */\nexport class NativeDeclarationBlock {\n readonly #state: EngineDeclarationStateHandle;\n readonly #reportDiagnostic: ReportDeclarationDiagnostic;\n readonly #reportSerializationDiagnostic: ReportSerializationDiagnostic;\n readonly #reservedNestingDepth: () => number;\n #observableCache: string | undefined;\n readonly #serializationCache = new Map<string, CachedSerialization>();\n\n constructor(\n reportDiagnostic: ReportDeclarationDiagnostic,\n reportSerializationDiagnostic: ReportSerializationDiagnostic,\n context: \"style\" | \"font-face\" | \"function\" = \"style\",\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n reservedNestingDepth: () => number = () => 0,\n ) {\n this.#reportDiagnostic = reportDiagnostic;\n this.#reportSerializationDiagnostic = reportSerializationDiagnostic;\n this.#reservedNestingDepth = reservedNestingDepth;\n this.#state = engineBinding.createDeclarationState(\n context,\n ...nativeBudgetArguments(resourceBudget),\n );\n }\n\n get cssText(): string {\n this.#observableCache ??= this.#state.cssText;\n return this.#observableCache;\n }\n\n get length(): number {\n return this.#state.length;\n }\n\n item(index: unknown): string {\n return this.#state.item(toUnsignedLong(index));\n }\n\n getPropertyValue(name: string): string {\n return this.#state.getPropertyValue(name);\n }\n\n getPropertyPriority(name: string): string {\n return this.#state.getPropertyPriority(name);\n }\n\n setProperty(name: string, value: string, priority: string): void {\n let outcome: EngineMutationOutcome;\n try {\n outcome = this.#state.setProperty(name, value, priority, this.#reservedNestingDepth());\n } catch (error) {\n rethrowResourceBudgetError(error);\n throw error;\n }\n if (outcome === \"applied\") {\n this.#invalidateSerialization();\n return;\n }\n this.#diagnosticForOutcome(outcome, name, value, priority);\n }\n\n applyMutations(\n mutations: readonly EngineDeclarationMutation[],\n ): NativeDeclarationMutationResult[] {\n const kinds: number[] = [];\n const properties: string[] = [];\n const values: string[] = [];\n const priorities: string[] = [];\n for (const mutation of mutations) {\n kinds.push(mutation.kind === \"set\" ? 0 : 1);\n properties.push(mutation.property);\n values.push(mutation.kind === \"set\" ? mutation.value : \"\");\n priorities.push(mutation.kind === \"set\" ? mutation.priority : \"\");\n }\n let outcomes;\n try {\n outcomes = this.#state.applyMutations(\n kinds,\n properties,\n values,\n priorities,\n this.#reservedNestingDepth(),\n );\n } catch (error) {\n rethrowResourceBudgetError(error);\n throw error;\n }\n if (outcomes.length !== mutations.length) {\n throw new Error(\"SheetOM engine returned an incomplete declaration mutation result.\");\n }\n const results: NativeDeclarationMutationResult[] = [];\n let mutated = false;\n for (let index = 0; index < outcomes.length; index += 1) {\n const mutation = mutations[index];\n const outcome = outcomes[index];\n if (!mutation || outcome === undefined) {\n throw new Error(\"SheetOM engine returned a mismatched declaration mutation result.\");\n }\n if (mutation.kind === \"remove\") {\n mutated = true;\n results.push({ kind: \"remove\", value: outcome });\n continue;\n }\n if (outcome === \"applied\") {\n mutated = true;\n results.push({ kind: \"set\", accepted: true, diagnostic: null });\n continue;\n }\n if (!isEngineMutationOutcome(outcome)) {\n throw new Error(\"SheetOM engine returned an invalid declaration mutation outcome.\");\n }\n results.push({\n kind: \"set\",\n accepted: false,\n diagnostic: this.#diagnosticForOutcome(\n outcome,\n mutation.property,\n mutation.value,\n mutation.priority,\n ),\n });\n }\n if (mutated) this.#invalidateSerialization();\n return results;\n }\n\n removeProperty(name: string): string {\n const removed = this.#state.removeProperty(name);\n this.#invalidateSerialization();\n return removed;\n }\n\n replaceCssText(source: string): void {\n try {\n this.#state.replaceCssText(source, this.#reservedNestingDepth());\n } catch (error) {\n rethrowResourceBudgetError(error);\n throw error;\n }\n this.#invalidateSerialization();\n }\n\n serialize(safe: boolean, indent: string, separator: string, strict = false): string {\n const cacheKey = `${safe ? \"1\" : \"0\"}${strict ? \"1\" : \"0\"}\\0${indent}\\0${separator}`;\n const cached = this.#serializationCache.get(cacheKey);\n if (cached !== undefined) {\n if (typeof cached === \"string\") return cached;\n this.#reportSerializationIssues(cached.issues);\n return cached.serialized;\n }\n let result: CachedSerialization;\n try {\n if (strict) {\n result = this.#state.serializeFormatted(safe, indent, separator);\n } else {\n result = parseResilientSerializationResult(\n this.#state.serializeFormattedResilient(safe, indent, separator),\n );\n }\n } catch (error) {\n rethrowResourceBudgetError(error);\n rethrowSerializationError(error);\n throw error;\n }\n this.#serializationCache.set(cacheKey, result);\n if (typeof result === \"string\") return result;\n this.#reportSerializationIssues(result.issues);\n return result.serialized;\n }\n\n #invalidateSerialization(): void {\n this.#observableCache = undefined;\n this.#serializationCache.clear();\n }\n\n #diagnosticForOutcome(\n outcome: Exclude<EngineMutationOutcome, \"applied\">,\n name: string,\n value: string,\n priority: string,\n ): SheetOMDiagnostic {\n const normalizedName = name.startsWith(\"--\") ? name : name.toLowerCase();\n const [code, input]: [SheetOMMutationDiagnosticCode, string] = outcome === \"invalid-priority\"\n ? [\"INVALID_PRIORITY\", priority]\n : outcome === \"unsupported-shorthand\"\n ? [\"UNSUPPORTED_SHORTHAND_VALUE\", value]\n : [\"INVALID_PROPERTY_VALUE\", value];\n return this.#reportDiagnostic(code, normalizedName, input);\n }\n\n #reportSerializationIssues(issues: RecoveredSerialization[\"issues\"]): void {\n for (const issue of issues) {\n this.#reportSerializationDiagnostic(issue.shorthand, issue.conflictingLonghands);\n }\n }\n}\n\nfunction parseResilientSerializationResult(output: readonly string[]): CachedSerialization {\n const serialized = output[0];\n if (serialized === undefined || output.length % 2 === 0) {\n throw new Error(\"SheetOM engine returned an invalid resilient serialization result.\");\n }\n if (output.length === 1) return serialized;\n const issues: RecoveredSerialization[\"issues\"][number][] = [];\n for (let index = 1; index < output.length; index += 2) {\n const shorthand = output[index];\n const conflicts = output[index + 1];\n if (!shorthand || !conflicts) {\n throw new Error(\"SheetOM engine returned an incomplete resilient serialization issue.\");\n }\n issues.push({\n shorthand,\n conflictingLonghands: Object.freeze(conflicts.split(\",\")),\n });\n }\n return { serialized, issues };\n}\n\nfunction isEngineMutationOutcome(\n value: string,\n): value is Exclude<EngineMutationOutcome, \"applied\"> {\n return value === \"invalid-name\"\n || value === \"invalid-priority\"\n || value === \"invalid-value\"\n || value === \"unsupported-shorthand\";\n}\n\nfunction toUnsignedLong(value: unknown): number {\n const numeric = Number(value);\n if (!Number.isFinite(numeric) || numeric === 0) return 0;\n const integer = Math.trunc(numeric);\n return ((integer % (2 ** 32)) + (2 ** 32)) % (2 ** 32);\n}\n","import { engineBinding } from \"./default-engine-binding.js\";\nimport {\n defaultResourceBudget,\n nativeBudgetArguments,\n rethrowResourceBudgetError,\n type NativeResourceBudget,\n} from \"./resource-budget.js\";\n\n/** Consumes top-level CSS Syntax rules and retains their exact UTF-8 spans. */\nexport function scanTopLevelRules(\n css: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): string[] {\n let encoded: string;\n try {\n encoded = engineBinding.scanTopLevelRulesJson(\n css,\n ...nativeBudgetArguments(resourceBudget),\n );\n } catch (error) {\n rethrowResourceBudgetError(error);\n throw error;\n }\n const parsed: unknown = JSON.parse(encoded);\n if (!Array.isArray(parsed) || parsed.some(rule => typeof rule !== \"string\")) {\n throw new TypeError(\"SHEETOM_NATIVE_PROTOCOL: invalid top-level rule scan result\");\n }\n return parsed;\n}\n","import { engineBinding } from \"./default-engine-binding.js\";\nimport {\n defaultResourceBudget,\n nativeBudgetArguments,\n rethrowResourceBudgetError,\n type NativeResourceBudget,\n} from \"./resource-budget.js\";\n\nexport interface NativeRuleDescription {\n kind: string;\n prelude: string;\n declarations: string;\n children: NativeRuleDescription[];\n cssText: string;\n}\n\nexport function parseNativeRule(\n source: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): NativeRuleDescription | null {\n return parseNativeRulePayload(() => engineBinding.parseRecoveredRuleTreeJson(\n source,\n ...nativeBudgetArguments(resourceBudget),\n ));\n}\n\nexport function parseNativeRuleWithErrorRecovery(\n source: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): NativeRuleDescription | null {\n return parseNativeRulePayload(() => engineBinding.parseRecoveredSingleRuleTreeJson(\n source,\n ...nativeBudgetArguments(resourceBudget),\n ));\n}\n\n/*\n * Keep native parse failures as CSS parse failures, but never reinterpret a\n * transport/validation failure as an empty or invalid rule. Doing so would\n * silently drop valid deeply nested CSS during replaceSync().\n */\nfunction parseNativeRulePayload(readPayload: () => string): NativeRuleDescription | null {\n let payload: string;\n try {\n payload = readPayload();\n } catch (error) {\n rethrowResourceBudgetError(error);\n return null;\n }\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(payload);\n } catch (error) {\n throw nativeProtocolError(\"could not decode the owned rule tree\", error);\n }\n\n try {\n return isNativeRuleDescription(parsed) ? parsed : null;\n } catch (error) {\n throw nativeProtocolError(\"could not validate the owned rule tree\", error);\n }\n}\n\nfunction nativeProtocolError(message: string, cause: unknown): Error {\n return new Error(`SHEETOM_NATIVE_PROTOCOL_ERROR: ${message}`, { cause });\n}\n\nfunction isNativeRuleDescription(value: unknown): value is NativeRuleDescription {\n const pending: unknown[] = [value];\n while (pending.length > 0) {\n const current = pending.pop();\n if (typeof current !== \"object\" || current === null) return false;\n const candidate = current as Partial<NativeRuleDescription>;\n if (\n typeof candidate.kind !== \"string\"\n || typeof candidate.prelude !== \"string\"\n || typeof candidate.declarations !== \"string\"\n || typeof candidate.cssText !== \"string\"\n || !Array.isArray(candidate.children)\n ) return false;\n for (const child of candidate.children) pending.push(child);\n }\n return true;\n}\n","import { engineBinding } from \"./default-engine-binding.js\";\nimport {\n defaultResourceBudget,\n nativeBudgetArguments,\n rethrowResourceBudgetError,\n type NativeResourceBudget,\n} from \"./resource-budget.js\";\n\nexport interface NativeContainerPrelude {\n conditionText: string;\n name: string;\n query: string;\n}\n\nexport interface NativeScopePrelude {\n start: string | null;\n end: string | null;\n}\n\nexport function normalizeNativeSelector(\n source: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): string | null {\n return callNative(() => engineBinding.normalizeSelector(\n source,\n ...nativeBudgetArguments(resourceBudget),\n ));\n}\n\nexport function normalizeNativeMedia(\n source: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): string | null {\n return callNative(() => engineBinding.normalizeMedia(\n source,\n ...nativeBudgetArguments(resourceBudget),\n ));\n}\n\nexport function normalizeNativeSupports(\n source: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): string | null {\n return callNative(() => engineBinding.normalizeSupports(\n source,\n ...nativeBudgetArguments(resourceBudget),\n ));\n}\n\nexport function parseNativeContainerPrelude(\n source: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): NativeContainerPrelude | null {\n const parsed = callNative(() => engineBinding.parseContainerPreludeJson(\n source,\n ...nativeBudgetArguments(resourceBudget),\n ));\n if (parsed === null) return null;\n try {\n const value: unknown = JSON.parse(parsed);\n if (typeof value !== \"object\" || value === null) return null;\n const candidate = value as Partial<NativeContainerPrelude>;\n if (\n typeof candidate.conditionText !== \"string\"\n || typeof candidate.name !== \"string\"\n || typeof candidate.query !== \"string\"\n ) return null;\n return candidate as NativeContainerPrelude;\n } catch {\n return null;\n }\n}\n\nexport function parseNativeScopePrelude(\n source: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): NativeScopePrelude | null {\n const parsed = callNative(() => engineBinding.parseScopePreludeJson(\n source,\n ...nativeBudgetArguments(resourceBudget),\n ));\n if (parsed === null) return null;\n try {\n const value: unknown = JSON.parse(parsed);\n if (typeof value !== \"object\" || value === null) return null;\n const candidate = value as Partial<NativeScopePrelude>;\n if (\n candidate.start !== null && typeof candidate.start !== \"string\"\n || candidate.end !== null && typeof candidate.end !== \"string\"\n ) return null;\n return candidate as NativeScopePrelude;\n } catch {\n return null;\n }\n}\n\nfunction callNative(operation: () => string): string | null {\n try {\n return operation();\n } catch (error) {\n rethrowResourceBudgetError(error);\n return null;\n }\n}\n","/** Owns child-list identity and parent propagation for every live rule node. */\nexport class RuleTree<Node extends object, Sheet> {\n readonly #children = new WeakMap<Node, Node[]>();\n readonly #setParentage: (\n node: Node,\n parentRule: Node | null,\n parentStyleSheet: Sheet | null,\n ) => void;\n readonly #parentStyleSheet: (node: Node) => Sheet | null;\n\n constructor(\n setParentage: (\n node: Node,\n parentRule: Node | null,\n parentStyleSheet: Sheet | null,\n ) => void,\n parentStyleSheet: (node: Node) => Sheet | null,\n ) {\n this.#setParentage = setParentage;\n this.#parentStyleSheet = parentStyleSheet;\n }\n\n createChildren(owner: Node): Node[] {\n const children: Node[] = [];\n this.#children.set(owner, children);\n return children;\n }\n\n children(owner: Node): Node[] {\n return this.#children.get(owner) ?? [];\n }\n\n replace(owner: Node, children: Node[]): void {\n const current = this.#children.get(owner);\n if (!current) return;\n\n for (const child of current) {\n this.attach(child, null, null);\n }\n current.splice(0, current.length, ...children);\n for (const child of children) {\n this.attach(child, owner, this.#parentStyleSheet(owner));\n }\n }\n\n attach(node: Node, parentRule: Node | null, parentStyleSheet: Sheet | null): void {\n this.#setParentage(node, parentRule, parentStyleSheet);\n for (const child of this.#children.get(node) ?? []) {\n this.attach(child, node, parentStyleSheet);\n }\n }\n}\n","import { engineBinding } from \"./default-engine-binding.js\";\nimport {\n defaultResourceBudget,\n nativeBudgetArguments,\n rethrowResourceBudgetError,\n type NativeResourceBudget,\n} from \"./resource-budget.js\";\n\nexport interface NativeCounterStyleDescriptor {\n name: string;\n value: string;\n}\n\nexport interface NativeCounterStyleName {\n name: string;\n serialized: string;\n}\n\nexport function parseNativeCounterStyleName(\n source: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): NativeCounterStyleName | null {\n try {\n const encoded = engineBinding.parseCounterStyleNameJson(\n source,\n ...nativeBudgetArguments(resourceBudget),\n );\n if (encoded === null) return null;\n const parsed: unknown = JSON.parse(encoded);\n if (typeof parsed !== \"object\" || parsed === null) return null;\n const candidate = parsed as Partial<NativeCounterStyleName>;\n if (typeof candidate.name !== \"string\" || typeof candidate.serialized !== \"string\") return null;\n return candidate as NativeCounterStyleName;\n } catch (error) {\n rethrowResourceBudgetError(error);\n return null;\n }\n}\n\nexport function serializeNativeIdentifier(value: string): string {\n return engineBinding.serializeIdentifierValue(value);\n}\n\nexport function serializeNativeFontFamily(value: string): string {\n return engineBinding.serializeFontFamilyValue(value);\n}\n\nexport function parseNativeCounterStyleDescriptor(\n name: string,\n value: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): string | null {\n try {\n return engineBinding.parseCounterStyleDescriptorValue(\n name,\n value,\n ...nativeBudgetArguments(resourceBudget),\n );\n } catch (error) {\n rethrowResourceBudgetError(error);\n return null;\n }\n}\n\nexport function parseNativeCounterStyleDescriptors(\n source: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): NativeCounterStyleDescriptor[] {\n try {\n const parsed: unknown = JSON.parse(engineBinding.parseCounterStyleDescriptorsJson(\n source,\n ...nativeBudgetArguments(resourceBudget),\n ));\n if (!Array.isArray(parsed)) return [];\n const descriptors: NativeCounterStyleDescriptor[] = [];\n for (const value of parsed) {\n if (typeof value !== \"object\" || value === null) continue;\n const candidate = value as Partial<NativeCounterStyleDescriptor>;\n if (typeof candidate.name !== \"string\" || typeof candidate.value !== \"string\") continue;\n descriptors.push(candidate as NativeCounterStyleDescriptor);\n }\n return descriptors;\n } catch (error) {\n rethrowResourceBudgetError(error);\n return [];\n }\n}\n","export type RuleSerializationPlan<Node> =\n | { kind: \"raw\"; cssText: string }\n | { kind: \"declarations\"; declarations: string }\n | {\n kind: \"block\";\n header: string;\n declarations?: string;\n children?: readonly Node[];\n };\n\ntype SerializationFrame<Node> =\n | { kind: \"node\"; node: Node; depth: number; child: boolean }\n | { kind: \"declarations\"; value: string; depth: number }\n | { kind: \"text\"; value: string };\n\n/** Formats reparsable CSS from immutable descriptions of live rule state. */\nexport class Serializer<Node> {\n readonly #describe: (node: Node) => RuleSerializationPlan<Node>;\n\n constructor(describe: (node: Node) => RuleSerializationPlan<Node>) {\n this.#describe = describe;\n }\n\n serialize(node: Node): string {\n return this.serializeMany([node]);\n }\n\n serializeMany(nodes: readonly Node[]): string {\n const chunks: string[] = [];\n const pending: SerializationFrame<Node>[] = [];\n for (let index = nodes.length - 1; index >= 0; index -= 1) {\n const node = nodes[index];\n if (node) pending.push({ kind: \"node\", node, depth: 0, child: false });\n }\n while (pending.length > 0) {\n const frame = pending.pop();\n if (!frame) continue;\n if (frame.kind === \"text\") {\n chunks.push(frame.value);\n continue;\n }\n if (frame.kind === \"declarations\") {\n appendIndented(chunks, frame.value, frame.depth);\n continue;\n }\n\n const plan = this.#describe(frame.node);\n if (plan.kind === \"raw\") {\n const value = frame.child ? plan.cssText.trimEnd() : plan.cssText;\n appendIndented(chunks, value, frame.depth);\n if (!frame.child) chunks.push(\"\\n\");\n continue;\n }\n if (plan.kind === \"declarations\") {\n const value = frame.child ? plan.declarations.trimEnd() : plan.declarations;\n if (frame.child) appendIndented(chunks, value, frame.depth);\n else chunks.push(value, value === \"\" ? \"\" : \"\\n\");\n continue;\n }\n\n chunks.push(\" \".repeat(frame.depth), `${plan.header} {\\n`);\n const children = plan.children ?? [];\n const contentCount = (plan.declarations ? 1 : 0) + children.length;\n if (contentCount === 0) {\n appendIndented(chunks, \"}\", frame.depth);\n if (!frame.child) chunks.push(\"\\n\");\n continue;\n }\n\n pending.push({\n kind: \"text\",\n value: `\\n${\" \".repeat(frame.depth)}}${frame.child ? \"\" : \"\\n\"}`,\n });\n for (let index = children.length - 1; index >= 0; index -= 1) {\n const child = children[index];\n if (!child) continue;\n pending.push({ kind: \"node\", node: child, depth: frame.depth + 1, child: true });\n if (index > 0 || plan.declarations) {\n pending.push({ kind: \"text\", value: \"\\n\" });\n }\n }\n if (plan.declarations) {\n pending.push({ kind: \"declarations\", value: plan.declarations, depth: frame.depth });\n }\n }\n return chunks.join(\"\");\n }\n}\n\nfunction appendIndented(chunks: string[], value: string, depth: number): void {\n const indentation = \" \".repeat(depth);\n chunks.push(indentation, value.replaceAll(\"\\n\", `\\n${indentation}`));\n}\n","let internalConstructionDepth = 0;\n\nexport function constructInternally<T>(factory: () => T): T {\n internalConstructionDepth += 1;\n try {\n return factory();\n } finally {\n internalConstructionDepth -= 1;\n }\n}\n\nexport function assertInternalConstructor(name: string): void {\n if (internalConstructionDepth > 0) return;\n throw new TypeError(`Failed to construct '${name}': Illegal constructor`);\n}\n","import type {\n SheetOMDiagnostic,\n SheetOMMutationDiagnosticCode,\n} from \"./diagnostics.js\";\nimport type { CSSStyleDeclarationNamedProperties } from \"./generated/css-style-declaration-properties.js\";\nimport type { EngineDeclarationMutation } from \"./internal/engine-binding.js\";\nimport { NativeDeclarationBlock } from \"./internal/native-declaration-block.js\";\nimport { scanTopLevelRules } from \"./internal/css-rule-scanner.js\";\nimport {\n parseNativeRule,\n parseNativeRuleWithErrorRecovery,\n type NativeRuleDescription,\n} from \"./internal/native-rule-parser.js\";\nimport {\n normalizeNativeMedia,\n normalizeNativeSelector,\n parseNativeContainerPrelude,\n parseNativeScopePrelude,\n} from \"./internal/native-rule-syntax.js\";\nimport { RuleTree } from \"./internal/rule-tree.js\";\nimport {\n parseNativeCounterStyleDescriptor,\n parseNativeCounterStyleDescriptors,\n parseNativeCounterStyleName,\n serializeNativeIdentifier,\n serializeNativeFontFamily,\n} from \"./internal/native-counter-style.js\";\nimport {\n Serializer,\n type RuleSerializationPlan,\n} from \"./internal/serializer.js\";\nimport {\n assertInternalConstructor,\n constructInternally,\n} from \"./internal/webidl-construction.js\";\nimport {\n defaultResourceBudget,\n normalizeResourceBudget,\n type NativeResourceBudget,\n type SheetOMResourceBudget,\n} from \"./internal/resource-budget.js\";\n\nexport type {\n SheetOMDiagnostic,\n SheetOMDiagnosticCode,\n SheetOMMutationDiagnostic,\n SheetOMMutationDiagnosticCode,\n SheetOMSerializationDiagnostic,\n SheetOMSerializationDiagnosticCode,\n} from \"./diagnostics.js\";\nexport type { SheetOMResourceBudget } from \"./internal/resource-budget.js\";\nexport {\n SheetOMSerializationError,\n type SheetOMSerializationErrorCode,\n} from \"./serialization-error.js\";\n\nconst arrayIndexPattern = /^(0|[1-9]\\d*)$/;\nconst regularSheetMetadata = new WeakMap<\n object,\n { href: string | null; baseURL: string }\n>();\nconst ruleParentage = new WeakMap<\n object,\n { parentRule: CSSRule | null; parentStyleSheet: CSSStyleSheet | null }\n>();\nconst ruleResourceBudgets = new WeakMap<object, NativeResourceBudget>();\nconst sheetResourceBudgets = new WeakMap<object, NativeResourceBudget>();\nconst sheetRuleArrays = new WeakMap<object, CSSRule[]>();\nconst sheetRuleCounts = new WeakMap<object, number>();\nconst functionRuleHeaders = new WeakMap<object, string>();\nconst unsignedLongRange = 2 ** 32;\nconst pageMarginRuleNames = new Set([\n \"top-left-corner\",\n \"top-left\",\n \"top-center\",\n \"top-right\",\n \"top-right-corner\",\n \"right-top\",\n \"right-middle\",\n \"right-bottom\",\n \"bottom-right-corner\",\n \"bottom-right\",\n \"bottom-center\",\n \"bottom-left\",\n \"bottom-left-corner\",\n \"left-bottom\",\n \"left-middle\",\n \"left-top\",\n]);\n\n/** One ordered declaration mutation executed by SheetOM's engine extension. */\nexport type CSSDeclarationMutation =\n | {\n kind: \"set\";\n property: string;\n value: string | null;\n priority?: string | null;\n }\n | { kind: \"remove\"; property: string };\n\n/** The result at the matching index of an ordered declaration mutation batch. */\nexport type CSSDeclarationMutationResult =\n | {\n kind: \"set\";\n accepted: boolean;\n diagnostic: SheetOMDiagnostic | null;\n }\n | { kind: \"remove\"; value: string };\n\n/** Options for a constructed SheetOM stylesheet. */\nexport interface CSSStyleSheetOptions {\n baseURL?: string;\n media?: string;\n disabled?: boolean;\n diagnostics?: boolean;\n resourceBudget?: SheetOMResourceBudget | null;\n}\n\n/** Options for forgiving parsing of an existing regular stylesheet. */\nexport interface ParseStyleSheetOptions extends CSSStyleSheetOptions {\n href?: string;\n}\n\n/** One parsed parameter exposed by `CSSFunctionRule.getParameters()`. */\nexport interface FunctionParameter {\n name: string;\n type: string;\n defaultValue?: string;\n}\n\ntype ReportDiagnostic = (diagnostic: SheetOMDiagnostic) => void;\n\nconst ignoreDiagnostic: ReportDiagnostic = () => {};\nconst ruleDiagnostics = new WeakMap<CSSRule, ReportDiagnostic>();\nconst ruleTree = new RuleTree<CSSRule, CSSStyleSheet>(\n (rule, parentRule, parentStyleSheet) => {\n ruleParentage.set(rule, { parentRule, parentStyleSheet });\n },\n rule => rule.parentStyleSheet,\n);\nconst safeSerializer = new Serializer<CSSRule>(rule => describeRuleSafe(rule, false));\nconst strictSerializer = new Serializer<CSSRule>(rule => describeRuleSafe(rule, true));\nlet activeConstructionResourceBudget = defaultResourceBudget;\n\nfunction constructWithResourceBudget<T>(\n factory: () => T,\n resourceBudget: NativeResourceBudget,\n): T {\n const previous = activeConstructionResourceBudget;\n activeConstructionResourceBudget = resourceBudget;\n try {\n return constructInternally(factory);\n } finally {\n activeConstructionResourceBudget = previous;\n }\n}\n\nfunction constructWebIDL<T>(constructor: Function, args: readonly unknown[] = []): T {\n return Reflect.construct(constructor, args) as T;\n}\n\nfunction currentConstructionResourceBudget(): NativeResourceBudget {\n return activeConstructionResourceBudget;\n}\n\nfunction namedPropertyToCSS(property: string): string {\n if (property === \"cssFloat\") return \"float\";\n\n let cssName = property.replace(/[A-Z]/g, character => `-${character.toLowerCase()}`);\n if (/^(webkit|moz|ms|o)-/.test(cssName)) cssName = `-${cssName}`;\n return cssName;\n}\n\nfunction normalizeSelectorText(\n value: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): string | null {\n return normalizeNativeSelector(value, resourceBudget);\n}\n\nfunction toUnsignedLong(value: unknown): number {\n const number = Number(value);\n if (!Number.isFinite(number) || number === 0) return 0;\n\n const integer = Math.trunc(number);\n return ((integer % unsignedLongRange) + unsignedLongRange) % unsignedLongRange;\n}\n\nfunction requireArguments(\n actual: number,\n required: number,\n interfaceName: string,\n operation: string,\n): void {\n if (actual >= required) return;\n const noun = required === 1 ? \"argument\" : \"arguments\";\n throw new TypeError(\n `Failed to execute '${operation}' on '${interfaceName}': ${required} ${noun} required, but only ${actual} present.`,\n );\n}\n\nfunction proxyMember(target: object, property: PropertyKey, value: unknown): unknown {\n if (property === \"constructor\" || typeof value !== \"function\") return value;\n return value.bind(target);\n}\n\nfunction lockOwnProperties(target: object, ...properties: string[]): void {\n for (const property of properties) {\n const descriptor = Object.getOwnPropertyDescriptor(target, property);\n if (!descriptor || !(\"value\" in descriptor)) continue;\n Object.defineProperty(target, property, { ...descriptor, writable: false });\n }\n}\n\nfunction declarationSerializationDepth(rule: CSSRule): number {\n let depth = 0;\n let current: CSSRule | null = rule;\n while (current) {\n if (!(current instanceof CSSNestedDeclarations) && !(current instanceof CSSFunctionDeclarations)) {\n depth += 1;\n }\n current = current.parentRule;\n }\n return depth;\n}\n\n/** Base class for live stylesheet rules. */\nexport class CSSRule {\n static readonly STYLE_RULE = 1;\n static readonly CHARSET_RULE = 2;\n static readonly IMPORT_RULE = 3;\n static readonly MEDIA_RULE = 4;\n static readonly FONT_FACE_RULE = 5;\n static readonly PAGE_RULE = 6;\n static readonly KEYFRAMES_RULE = 7;\n static readonly KEYFRAME_RULE = 8;\n static readonly MARGIN_RULE = 9;\n static readonly NAMESPACE_RULE = 10;\n static readonly COUNTER_STYLE_RULE = 11;\n static readonly SUPPORTS_RULE = 12;\n static readonly FONT_FEATURE_VALUES_RULE = 14;\n\n declare readonly STYLE_RULE: 1;\n declare readonly CHARSET_RULE: 2;\n declare readonly IMPORT_RULE: 3;\n declare readonly MEDIA_RULE: 4;\n declare readonly FONT_FACE_RULE: 5;\n declare readonly PAGE_RULE: 6;\n declare readonly KEYFRAMES_RULE: 7;\n declare readonly KEYFRAME_RULE: 8;\n declare readonly MARGIN_RULE: 9;\n declare readonly NAMESPACE_RULE: 10;\n declare readonly COUNTER_STYLE_RULE: 11;\n declare readonly SUPPORTS_RULE: 12;\n declare readonly FONT_FEATURE_VALUES_RULE: 14;\n\n readonly #type: number;\n\n protected constructor(type: number) {\n assertInternalConstructor(new.target.name);\n this.#type = type;\n ruleParentage.set(this, { parentRule: null, parentStyleSheet: null });\n ruleResourceBudgets.set(this, currentConstructionResourceBudget());\n }\n\n get parentRule(): CSSRule | null {\n return ruleParentage.get(this)?.parentRule ?? null;\n }\n\n get type(): number {\n return this.#type;\n }\n\n get parentStyleSheet(): CSSStyleSheet | null {\n return ruleParentage.get(this)?.parentStyleSheet ?? null;\n }\n\n get cssText(): string {\n return \"\";\n }\n\n set cssText(_value: string) {}\n}\n\nfor (const [name, value] of Object.entries({\n STYLE_RULE: CSSRule.STYLE_RULE,\n CHARSET_RULE: CSSRule.CHARSET_RULE,\n IMPORT_RULE: CSSRule.IMPORT_RULE,\n MEDIA_RULE: CSSRule.MEDIA_RULE,\n FONT_FACE_RULE: CSSRule.FONT_FACE_RULE,\n PAGE_RULE: CSSRule.PAGE_RULE,\n KEYFRAMES_RULE: CSSRule.KEYFRAMES_RULE,\n KEYFRAME_RULE: CSSRule.KEYFRAME_RULE,\n MARGIN_RULE: CSSRule.MARGIN_RULE,\n NAMESPACE_RULE: CSSRule.NAMESPACE_RULE,\n COUNTER_STYLE_RULE: CSSRule.COUNTER_STYLE_RULE,\n SUPPORTS_RULE: CSSRule.SUPPORTS_RULE,\n FONT_FEATURE_VALUES_RULE: CSSRule.FONT_FEATURE_VALUES_RULE,\n})) {\n Object.defineProperty(CSSRule.prototype, name, {\n value,\n writable: false,\n enumerable: true,\n configurable: false,\n });\n}\n\n/** A stable, live, indexed collection of rules. */\nexport class CSSRuleList {\n readonly [index: number]: CSSRule | undefined;\n\n readonly #rules: CSSRule[];\n\n private constructor(rules: CSSRule[]) {\n assertInternalConstructor(\"CSSRuleList\");\n this.#rules = rules;\n\n return new Proxy(this, {\n get(target, property) {\n if (typeof property !== \"string\" || !arrayIndexPattern.test(property)) {\n const result = Reflect.get(target, property, target);\n return proxyMember(target, property, result);\n }\n\n return target.#rules[Number(property)];\n },\n set(target, property, value) {\n if (typeof property === \"string\" && arrayIndexPattern.test(property)) return false;\n return Reflect.set(target, property, value, target);\n },\n });\n }\n\n get length(): number {\n return this.#rules.length;\n }\n\n item(index: number): CSSRule | null {\n requireArguments(arguments.length, 1, \"CSSRuleList\", \"item\");\n return this.#rules[toUnsignedLong(index)] ?? null;\n }\n}\n\nfunction normalizeMediaText(\n value: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): string | null {\n return normalizeNativeMedia(value, resourceBudget);\n}\n\ninterface ContainerPrelude {\n conditionText: string;\n name: string;\n query: string;\n}\n\nfunction parseContainerPrelude(\n value: string,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): ContainerPrelude | null {\n return parseNativeContainerPrelude(value, resourceBudget);\n}\n\nfunction splitMediaQueries(value: string): string[] {\n const queries: string[] = [];\n let start = 0;\n let depth = 0;\n for (let index = 0; index < value.length; index += 1) {\n const character = value[index];\n if (character === \"(\") depth += 1;\n if (character === \")\" && depth > 0) depth -= 1;\n if (character !== \",\" || depth !== 0) continue;\n queries.push(value.slice(start, index).trim());\n start = index + 1;\n }\n queries.push(value.slice(start).trim());\n return queries.filter(query => query !== \"\");\n}\n\n/** A live serialized list of media queries. */\nexport class MediaList {\n readonly [index: number]: string | undefined;\n\n #mediaText: string;\n readonly #resourceBudget: NativeResourceBudget;\n\n private constructor(mediaText = \"\") {\n assertInternalConstructor(\"MediaList\");\n this.#resourceBudget = currentConstructionResourceBudget();\n const input = `${mediaText}`.trim();\n this.#mediaText = input === \"\"\n ? \"\"\n : normalizeMediaText(input, this.#resourceBudget) ?? \"not all\";\n\n return new Proxy(this, {\n get(target, property) {\n if (typeof property !== \"string\" || !arrayIndexPattern.test(property)) {\n const result = Reflect.get(target, property, target);\n return proxyMember(target, property, result);\n }\n return target.item(Number(property)) || undefined;\n },\n set(target, property, value) {\n if (typeof property === \"string\" && arrayIndexPattern.test(property)) return false;\n return Reflect.set(target, property, value, target);\n },\n });\n }\n\n get mediaText(): string {\n return this.#mediaText;\n }\n\n set mediaText(value: string) {\n const input = `${value}`.trim();\n if (input === \"\") {\n this.#mediaText = \"\";\n return;\n }\n const normalized = normalizeMediaText(input, this.#resourceBudget);\n this.#mediaText = normalized ?? \"not all\";\n }\n\n get length(): number {\n return splitMediaQueries(this.#mediaText).length;\n }\n\n item(index: number): string | null {\n requireArguments(arguments.length, 1, \"MediaList\", \"item\");\n return splitMediaQueries(this.#mediaText)[toUnsignedLong(index)] ?? null;\n }\n\n appendMedium(medium: string): void {\n requireArguments(arguments.length, 1, \"MediaList\", \"appendMedium\");\n const normalized = normalizeMediaText(`${medium}`, this.#resourceBudget);\n if (!normalized) return;\n const existing = splitMediaQueries(this.#mediaText);\n if (existing.includes(normalized)) return;\n this.#mediaText = [...existing, normalized].join(\", \");\n }\n\n deleteMedium(medium: string): void {\n requireArguments(arguments.length, 1, \"MediaList\", \"deleteMedium\");\n const normalized = normalizeMediaText(`${medium}`, this.#resourceBudget);\n const existing = splitMediaQueries(this.#mediaText);\n const index = normalized ? existing.indexOf(normalized) : -1;\n if (index === -1) {\n throw new DOMException(\"The medium was not found.\", \"NotFoundError\");\n }\n existing.splice(index, 1);\n this.#mediaText = existing.join(\", \");\n }\n}\n\nfunction indentRuleText(value: string): string {\n return value.split(\"\\n\").map(line => ` ${line}`).join(\"\\n\");\n}\n\nfunction serializeLineGroupCssText(root: CSSGroupingRule, header: string): string {\n type Frame =\n | { kind: \"rule\"; rule: CSSRule; depth: number; rootHeader?: string }\n | { kind: \"text\"; value: string };\n\n const chunks: string[] = [];\n const pending: Frame[] = [{ kind: \"rule\", rule: root, depth: 0, rootHeader: header }];\n while (pending.length > 0) {\n const frame = pending.pop();\n if (!frame) continue;\n if (frame.kind === \"text\") {\n chunks.push(frame.value);\n continue;\n }\n\n const plan = lineGroupCssTextPlan(frame.rule, frame.rootHeader);\n if (!plan) {\n appendRuleTextAtDepth(chunks, frame.rule.cssText, frame.depth);\n continue;\n }\n\n chunks.push(\" \".repeat(frame.depth), `${plan.header} {\\n`);\n const contentCount = (plan.declarations === \"\" ? 0 : 1) + plan.children.length;\n if (contentCount === 0) {\n chunks.push(\" \".repeat(frame.depth), \"}\");\n continue;\n }\n\n pending.push({ kind: \"text\", value: `\\n${\" \".repeat(frame.depth)}}` });\n for (let index = plan.children.length - 1; index >= 0; index -= 1) {\n const child = plan.children[index];\n if (!child) continue;\n pending.push({ kind: \"rule\", rule: child, depth: frame.depth + 1 });\n if (index > 0 || plan.declarations !== \"\") {\n pending.push({ kind: \"text\", value: \"\\n\" });\n }\n }\n if (plan.declarations !== \"\") {\n pending.push({\n kind: \"text\",\n value: indentRuleTextAtDepth(plan.declarations, frame.depth + 1),\n });\n }\n }\n return chunks.join(\"\");\n}\n\nfunction lineGroupCssTextPlan(\n rule: CSSRule,\n rootHeader?: string,\n): { header: string; declarations: string; children: readonly CSSRule[] } | null {\n if (rule instanceof CSSStyleRule) {\n const children = ruleTree.children(rule);\n if (children.length === 0) return null;\n return {\n header: rootHeader ?? rule.selectorText,\n declarations: rule.style.cssText,\n children,\n };\n }\n if (\n !(rule instanceof CSSGroupingRule)\n || rule instanceof CSSFunctionRule\n || rule instanceof CSSPageRule\n ) return null;\n return {\n header: rootHeader ?? groupingRuleHeader(rule),\n declarations: \"\",\n children: ruleTree.children(rule),\n };\n}\n\nfunction appendRuleTextAtDepth(chunks: string[], value: string, depth: number): void {\n chunks.push(indentRuleTextAtDepth(value, depth));\n}\n\nfunction indentRuleTextAtDepth(value: string, depth: number): string {\n const indentation = \" \".repeat(depth);\n return `${indentation}${value.replaceAll(\"\\n\", `\\n${indentation}`)}`;\n}\n\nfunction ruleChildren(rule: CSSRule): CSSRule[] {\n if (rule instanceof CSSGroupingRule || rule instanceof CSSKeyframesRule) {\n return ruleTree.children(rule);\n }\n return [];\n}\n\nfunction ruleForestSize(roots: readonly CSSRule[]): number {\n let count = 0;\n const pending = [...roots];\n while (pending.length > 0) {\n const rule = pending.pop();\n if (!rule) continue;\n count += 1;\n for (const child of ruleChildren(rule)) pending.push(child);\n }\n return count;\n}\n\nfunction assertRuleForestBudget(\n roots: readonly CSSRule[],\n resourceBudget: NativeResourceBudget,\n): void {\n const count = ruleForestSize(roots);\n assertRuleCountBudget(count, resourceBudget);\n}\n\nfunction assertRuleCountBudget(\n count: number,\n resourceBudget: NativeResourceBudget,\n): void {\n if (count <= resourceBudget.maxRuleCount) return;\n throw new RangeError(\n `SHEETOM_RULE_LIMIT: stylesheet has ${count} rules; the limit is ${resourceBudget.maxRuleCount} rules`,\n );\n}\n\nfunction assertRuleInsertionBudget(\n owner: CSSRule | CSSStyleSheet,\n inserted: CSSRule,\n resourceBudget: NativeResourceBudget,\n): number {\n const insertedCount = ruleForestSize([inserted]);\n if (owner instanceof CSSStyleSheet) {\n const roots = sheetRuleArrays.get(owner) ?? [];\n assertRuleCountBudget(\n (sheetRuleCounts.get(owner) ?? ruleForestSize(roots)) + insertedCount,\n resourceBudget,\n );\n return insertedCount;\n }\n const sheet = owner.parentStyleSheet;\n if (sheet) {\n const roots = sheetRuleArrays.get(sheet) ?? [];\n assertRuleCountBudget(\n (sheetRuleCounts.get(sheet) ?? ruleForestSize(roots)) + insertedCount,\n resourceBudget,\n );\n return insertedCount;\n }\n let root = owner;\n while (root.parentRule) root = root.parentRule;\n assertRuleCountBudget(\n ruleForestSize([root]) + insertedCount,\n resourceBudget,\n );\n return insertedCount;\n}\n\nfunction adjustSheetRuleCount(sheet: CSSStyleSheet | null, difference: number): void {\n if (!sheet) return;\n const roots = sheetRuleArrays.get(sheet) ?? [];\n const current = sheetRuleCounts.get(sheet) ?? ruleForestSize(roots);\n sheetRuleCounts.set(sheet, current + difference);\n}\n\n/** A rule containing a live nested rule list. */\nexport class CSSGroupingRule extends CSSRule {\n readonly cssRules: CSSRuleList;\n\n protected constructor(type: number) {\n super(type);\n const rules = ruleTree.createChildren(this);\n this.cssRules = constructWebIDL<CSSRuleList>(CSSRuleList, [rules]);\n lockOwnProperties(this, \"cssRules\");\n }\n\n insertRule(ruleText: string, index = 0): number {\n requireArguments(arguments.length, 1, this.constructor.name, \"insertRule\");\n const rules = ruleTree.children(this);\n const normalizedIndex = toUnsignedLong(index);\n if (normalizedIndex > rules.length) {\n throw new DOMException(\"The index is outside the allowed range.\", \"IndexSizeError\");\n }\n\n const input = `${ruleText}`;\n const resourceBudget = ruleResourceBudgets.get(this) ?? defaultResourceBudget;\n if (\n !(this instanceof CSSPageRule)\n && parseNativeRule(input, resourceBudget)?.kind === \"import\"\n ) {\n throw new DOMException(\n \"@import rules cannot be inserted inside a group rule.\",\n \"HierarchyRequestError\",\n );\n }\n\n const rule = parseStrictRule(\n input,\n ruleDiagnostics.get(this) ?? ignoreDiagnostic,\n false,\n this,\n resourceBudget,\n );\n if (!rule) throw new DOMException(\"The rule could not be parsed.\", \"SyntaxError\");\n\n if (\n this instanceof CSSStyleRule &&\n rule instanceof CSSStyleRule &&\n !rule.selectorText.trimStart().startsWith(\"&\")\n ) {\n rule.selectorText = `& ${rule.selectorText}`;\n }\n\n const insertedCount = assertRuleInsertionBudget(this, rule, resourceBudget);\n rules.splice(normalizedIndex, 0, rule);\n attachRuleTree(rule, this, this.parentStyleSheet);\n adjustSheetRuleCount(this.parentStyleSheet, insertedCount);\n return normalizedIndex;\n }\n\n deleteRule(index: number): void {\n requireArguments(arguments.length, 1, this.constructor.name, \"deleteRule\");\n const rules = ruleTree.children(this);\n const normalizedIndex = toUnsignedLong(index);\n if (normalizedIndex >= rules.length) {\n throw new DOMException(\"The index is outside the allowed range.\", \"IndexSizeError\");\n }\n const [removed] = rules.splice(normalizedIndex, 1);\n if (removed) {\n const removedCount = ruleForestSize([removed]);\n adjustSheetRuleCount(this.parentStyleSheet, -removedCount);\n attachRuleTree(removed, null, null);\n }\n }\n\n protected serializeGroup(header: string): string {\n return serializeLineGroupCssText(this, header);\n }\n}\n\n/** A grouping rule controlled by a serialized condition. */\nexport class CSSConditionRule extends CSSGroupingRule {\n readonly #conditionText: string;\n\n protected constructor(\n type: number,\n conditionText: string,\n ) {\n super(type);\n this.#conditionText = conditionText;\n }\n\n get conditionText(): string {\n return this.#conditionText;\n }\n}\n\n/** A live custom `@function` rule. */\nexport class CSSFunctionRule extends CSSGroupingRule {\n readonly name: string;\n readonly returnType: string;\n readonly #parameters: readonly FunctionParameter[];\n\n private constructor(\n name: string,\n parameters: readonly FunctionParameter[],\n returnType: string,\n ) {\n super(0);\n this.name = name;\n this.returnType = returnType;\n this.#parameters = parameters.map(parameter => ({ ...parameter }));\n functionRuleHeaders.set(\n this,\n serializeFunctionHeader(this.name, this.#parameters, this.returnType),\n );\n lockOwnProperties(this, \"name\", \"returnType\");\n }\n\n getParameters(): FunctionParameter[] {\n return this.#parameters.map(parameter => ({ ...parameter }));\n }\n\n override get cssText(): string {\n const header = functionRuleHeaders.get(this) ?? \"@function\";\n const children = ruleTree.children(this);\n if (children.length === 0) return `${header} { }`;\n return `${header} { ${children.map(child => child.cssText).join(\" \")} }`;\n }\n\n set cssText(_value: string) {}\n}\n\nfunction serializeFunctionHeader(\n name: string,\n parameters: readonly FunctionParameter[],\n returnType: string,\n): string {\n const serializedParameters = parameters.map(parameter => {\n const type = serializeFunctionType(parameter.type);\n const defaultValue = Object.hasOwn(parameter, \"defaultValue\")\n ? `: ${parameter.defaultValue}`\n : \"\";\n return `${serializeNativeIdentifier(parameter.name)}${type}${defaultValue}`;\n }).join(\", \");\n const serializedReturnType = returnType === \"*\"\n ? \"\"\n : ` returns${serializeFunctionType(returnType)}`;\n return `@function ${serializeNativeIdentifier(name)}(${serializedParameters})${serializedReturnType}`;\n}\n\nfunction serializeFunctionType(type: string): string {\n if (type === \"*\") return \"\";\n return type.includes(\" | \") ? ` type(${type})` : ` ${type}`;\n}\n\n/** A live `@media` rule. */\nexport class CSSMediaRule extends CSSConditionRule {\n readonly media: MediaList;\n\n private constructor(conditionText: string) {\n const media = constructWebIDL<MediaList>(MediaList, [conditionText]);\n super(CSSRule.MEDIA_RULE, media.mediaText);\n this.media = media;\n lockOwnProperties(this, \"media\");\n }\n\n override get conditionText(): string {\n return this.media.mediaText;\n }\n\n override get cssText(): string {\n return this.serializeGroup(`@media ${this.media.mediaText}`);\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live `@supports` rule. */\nexport class CSSSupportsRule extends CSSConditionRule {\n private constructor(conditionText: string) {\n super(CSSRule.SUPPORTS_RULE, conditionText.trim());\n }\n\n override get cssText(): string {\n return this.serializeGroup(`@supports ${this.conditionText}`);\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live `@container` rule. */\nexport class CSSContainerRule extends CSSConditionRule {\n readonly containerName: string;\n readonly containerQuery: string;\n\n private constructor(conditionText: string) {\n const parsed = parseContainerPrelude(\n conditionText,\n currentConstructionResourceBudget(),\n );\n const normalizedCondition = parsed?.conditionText ?? conditionText.trim();\n super(0, normalizedCondition);\n this.containerName = parsed?.name ?? \"\";\n this.containerQuery = parsed?.query ?? normalizedCondition;\n lockOwnProperties(this, \"containerName\", \"containerQuery\");\n }\n\n override get cssText(): string {\n return this.serializeGroup(`@container ${this.conditionText}`);\n }\n\n set cssText(_value: string) {}\n}\n\n/** An immutable statement-form `@layer` rule. */\nexport class CSSLayerStatementRule extends CSSRule {\n readonly #names: readonly string[];\n\n private constructor(names: readonly string[]) {\n super(0);\n this.#names = [...names];\n }\n\n get nameList(): readonly string[] {\n return Object.freeze([...this.#names]);\n }\n\n override get cssText(): string {\n return `@layer ${this.#names.join(\", \")};`;\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live block-form `@layer` rule. */\nexport class CSSLayerBlockRule extends CSSGroupingRule {\n readonly name: string;\n\n private constructor(name: string) {\n super(0);\n this.name = name;\n lockOwnProperties(this, \"name\");\n }\n\n override get cssText(): string {\n return this.serializeGroup(`@layer${this.name === \"\" ? \"\" : ` ${this.name}`}`);\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live `@scope` rule. */\nexport class CSSScopeRule extends CSSGroupingRule {\n readonly start: string | null;\n readonly end: string | null;\n\n private constructor(\n start: string | null,\n end: string | null,\n ) {\n super(0);\n this.start = start;\n this.end = end;\n lockOwnProperties(this, \"start\", \"end\");\n }\n\n override get cssText(): string {\n const start = this.start === null ? \"\" : ` (${this.start})`;\n const end = this.end === null ? \"\" : ` to (${this.end})`;\n return this.serializeGroup(`@scope${start}${end}`);\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live `@starting-style` rule. */\nexport class CSSStartingStyleRule extends CSSGroupingRule {\n private constructor() {\n super(0);\n }\n\n override get cssText(): string {\n return this.serializeGroup(\"@starting-style\");\n }\n\n set cssText(_value: string) {}\n}\n\n/** A non-loading `@import` rule with mutable media. */\nexport class CSSImportRule extends CSSRule {\n readonly media: MediaList;\n readonly styleSheet: null = null;\n readonly layerName: string | null;\n readonly supportsText: string | null;\n readonly #rawHref: string;\n\n private constructor(\n href: string,\n mediaText = \"\",\n layerName: string | null = null,\n supportsText: string | null = null,\n ) {\n super(CSSRule.IMPORT_RULE);\n this.#rawHref = href;\n this.media = constructWebIDL<MediaList>(MediaList, [mediaText]);\n this.layerName = layerName;\n this.supportsText = supportsText;\n lockOwnProperties(this, \"media\", \"styleSheet\", \"layerName\", \"supportsText\");\n }\n\n get href(): string {\n const baseURL = this.parentStyleSheet?.baseURL;\n if (!baseURL || baseURL === \"about:blank\") return this.#rawHref;\n try {\n return new URL(this.#rawHref, baseURL).href;\n } catch {\n return this.#rawHref;\n }\n }\n\n override get cssText(): string {\n const href = this.#rawHref.replace(/[\"\\\\]/g, character => `\\\\${character}`);\n const layer = this.layerName === null\n ? \"\"\n : this.layerName === \"\"\n ? \" layer\"\n : ` layer(${this.layerName})`;\n const supports = this.supportsText === null\n ? \"\"\n : ` supports(${this.supportsText})`;\n const media = this.media.mediaText === \"\" ? \"\" : ` ${this.media.mediaText}`;\n return `@import url(\"${href}\")${layer}${supports}${media};`;\n }\n\n set cssText(_value: string) {}\n}\n\n/** An immutable `@namespace` rule. */\nexport class CSSNamespaceRule extends CSSRule {\n readonly namespaceURI: string;\n readonly prefix: string;\n readonly #cssText: string;\n\n private constructor(\n namespaceURI: string,\n prefix: string,\n cssText: string,\n ) {\n super(CSSRule.NAMESPACE_RULE);\n this.namespaceURI = namespaceURI;\n this.prefix = prefix;\n this.#cssText = cssText;\n lockOwnProperties(this, \"namespaceURI\", \"prefix\");\n }\n\n override get cssText(): string {\n return this.#cssText;\n }\n\n set cssText(_value: string) {}\n}\n\nclass CSSGenericRule extends CSSRule {\n readonly #cssText: string;\n\n constructor(\n type: number,\n cssText: string,\n ) {\n super(type);\n this.#cssText = cssText;\n }\n\n override get cssText(): string {\n return this.#cssText;\n }\n\n set cssText(_value: string) {}\n}\n\nclass CSSOpaqueRule extends CSSGenericRule {}\n\n/** An immutable `@property` registration rule. */\nexport class CSSPropertyRule extends CSSRule {\n readonly name: string;\n readonly syntax: string;\n readonly inherits: boolean;\n readonly initialValue: string;\n readonly #cssText: string;\n\n private constructor(\n name: string,\n syntax: string,\n inherits: boolean,\n initialValue: string,\n cssText: string,\n ) {\n super(0);\n this.name = name;\n this.syntax = syntax;\n this.inherits = inherits;\n this.initialValue = initialValue;\n this.#cssText = cssText;\n lockOwnProperties(this, \"name\", \"syntax\", \"inherits\", \"initialValue\");\n }\n\n override get cssText(): string { return this.#cssText; }\n set cssText(_value: string) {}\n}\n\n/** An immutable `@font-palette-values` rule. */\nexport class CSSFontPaletteValuesRule extends CSSRule {\n readonly name: string;\n readonly fontFamily: string;\n readonly basePalette: string;\n readonly overrideColors: string;\n readonly #cssText: string;\n\n private constructor(\n name: string,\n fontFamily: string,\n basePalette: string,\n overrideColors: string,\n cssText: string,\n ) {\n super(0);\n this.name = name;\n this.fontFamily = fontFamily;\n this.basePalette = basePalette;\n this.overrideColors = overrideColors;\n this.#cssText = cssText;\n lockOwnProperties(this, \"name\", \"fontFamily\", \"basePalette\", \"overrideColors\");\n }\n\n override get cssText(): string {\n return this.#cssText;\n }\n\n set cssText(_value: string) {}\n}\n\n/** An immutable `@view-transition` rule. */\nexport class CSSViewTransitionRule extends CSSRule {\n readonly navigation: string;\n readonly types: readonly string[];\n readonly #cssText: string;\n\n private constructor(\n navigation: string,\n types: readonly string[],\n cssText: string,\n ) {\n super(0);\n this.navigation = navigation;\n this.types = Object.freeze([...types]);\n this.#cssText = cssText;\n lockOwnProperties(this, \"navigation\", \"types\");\n }\n\n override get cssText(): string {\n return this.#cssText;\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live declaration block with indexed, named, and method-based access. */\nexport interface CSSStyleDeclaration extends CSSStyleDeclarationNamedProperties {}\nexport class CSSStyleDeclaration {\n readonly [index: number]: string | undefined;\n\n readonly parentRule: CSSRule;\n readonly #block: NativeDeclarationBlock;\n\n protected constructor(parentRule: CSSRule) {\n assertInternalConstructor(\"CSSStyleDeclaration\");\n this.parentRule = parentRule;\n lockOwnProperties(this, \"parentRule\");\n const reportDeclarationDiagnostic = (\n code: SheetOMMutationDiagnosticCode,\n property: string,\n input: string,\n ): SheetOMDiagnostic => {\n const priority = code === \"INVALID_PRIORITY\";\n const unsupportedShorthand = code === \"UNSUPPORTED_SHORTHAND_VALUE\";\n const diagnostic: SheetOMDiagnostic = {\n code,\n severity: \"warning\",\n operation: \"setProperty\",\n message: priority\n ? `The mutation was ignored because ${input} is not a valid priority.`\n : unsupportedShorthand\n ? `The value was ignored because the shorthand codec for ${property} cannot expand it.`\n : `The value was ignored because it is invalid for ${property}.`,\n property,\n input,\n location: null,\n };\n (ruleDiagnostics.get(this.parentRule) ?? ignoreDiagnostic)(diagnostic);\n return diagnostic;\n };\n const reportSerializationDiagnostic = (\n shorthand: string,\n conflictingLonghands: readonly string[],\n ): void => {\n const diagnostic: SheetOMDiagnostic = {\n code: \"UNREPRESENTABLE_PENDING_SHORTHAND\",\n severity: \"warning\",\n operation: \"serialize\",\n message: `The pending ${shorthand} shorthand required a best-effort recovery during serialization.`,\n property: shorthand,\n input: \"\",\n location: null,\n conflictingLonghands: Object.freeze([...conflictingLonghands]),\n };\n (ruleDiagnostics.get(this.parentRule) ?? ignoreDiagnostic)(diagnostic);\n };\n this.#block = new NativeDeclarationBlock(\n reportDeclarationDiagnostic,\n reportSerializationDiagnostic,\n parentRule instanceof CSSFontFaceRule\n ? \"font-face\"\n : parentRule instanceof CSSFunctionDeclarations\n ? \"function\"\n : \"style\",\n ruleResourceBudgets.get(parentRule) ?? defaultResourceBudget,\n () => declarationSerializationDepth(parentRule),\n );\n\n return new Proxy(this, {\n get(target, property) {\n if (typeof property === \"string\" && arrayIndexPattern.test(property)) {\n return target.item(Number(property)) || undefined;\n }\n\n if (typeof property === \"string\" && !Reflect.has(target, property)) {\n return target.getPropertyValue(namedPropertyToCSS(property));\n }\n\n const result = Reflect.get(target, property, target);\n return proxyMember(target, property, result);\n },\n set(target, property, value) {\n if (typeof property === \"string\" && !Reflect.has(target, property)) {\n Reflect.apply(target.setProperty, target, [namedPropertyToCSS(property), value]);\n return true;\n }\n\n return Reflect.set(target, property, value, target);\n },\n });\n }\n\n get cssText(): string {\n return this.#block.cssText;\n }\n\n set cssText(value: string) {\n const input = `${value}`;\n this.#block.replaceCssText(input);\n }\n\n get length(): number {\n return this.#block.length;\n }\n\n item(index: number): string {\n requireArguments(arguments.length, 1, \"CSSStyleDeclaration\", \"item\");\n return this.#block.item(index);\n }\n\n getPropertyValue(name: string): string {\n requireArguments(arguments.length, 1, \"CSSStyleDeclaration\", \"getPropertyValue\");\n return this.#block.getPropertyValue(`${name}`);\n }\n\n getPropertyPriority(name: string): string {\n requireArguments(arguments.length, 1, \"CSSStyleDeclaration\", \"getPropertyPriority\");\n return this.#block.getPropertyPriority(`${name}`);\n }\n\n setProperty(name: string, value: string | null, priority = \"\"): void {\n requireArguments(arguments.length, 2, \"CSSStyleDeclaration\", \"setProperty\");\n const stringName = `${name}`;\n const stringValue = value === null ? \"\" : `${value}`;\n const stringPriority = priority === null ? \"\" : `${priority}`;\n this.#block.setProperty(stringName, stringValue, stringPriority);\n }\n\n /** Apply ordered declaration mutations through one engine boundary crossing. */\n applyMutations(\n mutations: readonly CSSDeclarationMutation[],\n ): CSSDeclarationMutationResult[] {\n requireArguments(arguments.length, 1, \"CSSStyleDeclaration\", \"applyMutations\");\n if (!Array.isArray(mutations)) {\n throw new TypeError(\"CSSStyleDeclaration.applyMutations requires an array.\");\n }\n const normalized: EngineDeclarationMutation[] = [];\n for (let index = 0; index < mutations.length; index += 1) {\n const mutation = mutations[index];\n if (typeof mutation !== \"object\" || mutation === null) {\n throw new TypeError(`Declaration mutation at index ${index} must be an object.`);\n }\n if (mutation.kind !== \"set\" && mutation.kind !== \"remove\") {\n throw new TypeError(`Declaration mutation at index ${index} has an invalid kind.`);\n }\n if (typeof mutation.property !== \"string\") {\n throw new TypeError(`Declaration mutation at index ${index} requires a string property.`);\n }\n if (mutation.kind === \"remove\") {\n normalized.push({ kind: \"remove\", property: mutation.property });\n continue;\n }\n if (typeof mutation.value !== \"string\" && mutation.value !== null) {\n throw new TypeError(`Declaration mutation at index ${index} requires a string or null value.`);\n }\n if (\n mutation.priority !== undefined\n && mutation.priority !== null\n && typeof mutation.priority !== \"string\"\n ) {\n throw new TypeError(`Declaration mutation at index ${index} requires a string priority.`);\n }\n normalized.push({\n kind: \"set\",\n property: mutation.property,\n value: mutation.value ?? \"\",\n priority: mutation.priority ?? \"\",\n });\n }\n return this.#block.applyMutations(normalized);\n }\n\n removeProperty(name: string): string {\n requireArguments(arguments.length, 1, \"CSSStyleDeclaration\", \"removeProperty\");\n return this.#block.removeProperty(`${name}`);\n }\n\n /** @internal */\n serializeSafe(indent: string, strict = false): string {\n return this.#block.serialize(true, indent, \"\\n\", strict);\n }\n}\n\n/** A live `@font-face` descriptor rule. */\nexport class CSSFontFaceRule extends CSSRule {\n readonly style: CSSStyleDeclaration;\n\n private constructor() {\n super(CSSRule.FONT_FACE_RULE);\n this.style = constructWebIDL<CSSStyleDeclaration>(CSSStyleDeclaration, [this]);\n lockOwnProperties(this, \"style\");\n }\n\n override get cssText(): string {\n return `@font-face {${this.style.cssText === \"\" ? \"\" : ` ${this.style.cssText}`} }`;\n }\n\n set cssText(_value: string) {}\n}\n\n/** Declarations ordered after a nested style rule. */\nexport class CSSNestedDeclarations extends CSSRule {\n readonly #style: CSSStyleDeclaration;\n\n private constructor() {\n super(0);\n this.#style = constructWebIDL<CSSStyleDeclaration>(CSSStyleDeclaration, [this]);\n }\n\n get style(): CSSStyleDeclaration {\n return this.#style;\n }\n\n set style(cssText: string) {\n this.#style.cssText = `${cssText}`;\n }\n\n override get cssText(): string {\n return this.style.cssText;\n }\n\n set cssText(_value: string) {}\n}\n\n/** A run of live descriptors inside a custom function. */\nexport class CSSFunctionDeclarations extends CSSRule {\n readonly #style: CSSFunctionDescriptors;\n\n private constructor() {\n super(0);\n this.#style = constructWebIDL<CSSFunctionDescriptors>(CSSFunctionDescriptors, [this]);\n }\n\n get style(): CSSFunctionDescriptors {\n return this.#style;\n }\n\n set style(cssText: string) {\n this.#style.cssText = `${cssText}`;\n }\n\n override get cssText(): string {\n return this.style.cssText;\n }\n\n set cssText(_value: string) {}\n}\n\n/** The declaration interface used by `CSSFunctionDeclarations`. */\nexport class CSSFunctionDescriptors extends CSSStyleDeclaration {\n get result(): string {\n return this.getPropertyValue(\"result\");\n }\n\n set result(_value: string | null) {}\n}\n\n/** A page-margin rule nested inside `CSSPageRule`. */\nexport class CSSMarginRule extends CSSRule {\n readonly name: string;\n readonly style: CSSStyleDeclaration;\n\n private constructor(name: string) {\n super(CSSRule.MARGIN_RULE);\n this.name = name;\n this.style = constructWebIDL<CSSStyleDeclaration>(CSSStyleDeclaration, [this]);\n lockOwnProperties(this, \"name\", \"style\");\n }\n\n override get cssText(): string {\n return `@${this.name} {${this.style.cssText === \"\" ? \"\" : ` ${this.style.cssText}`} }`;\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live `@page` rule with declarations and margin rules. */\nexport class CSSPageRule extends CSSGroupingRule {\n readonly style: CSSStyleDeclaration;\n #selectorText: string;\n\n private constructor(selectorText: string) {\n super(CSSRule.PAGE_RULE);\n this.#selectorText = selectorText;\n this.style = constructWebIDL<CSSStyleDeclaration>(CSSStyleDeclaration, [this]);\n lockOwnProperties(this, \"style\");\n }\n\n get selectorText(): string {\n return this.#selectorText;\n }\n\n set selectorText(value: string) {\n this.#selectorText = `${value}`.trim();\n }\n\n override get cssText(): string {\n const contents: string[] = [];\n if (this.style.cssText !== \"\") contents.push(this.style.cssText);\n for (const child of ruleTree.children(this)) contents.push(child.cssText);\n const selector = this.selectorText === \"\" ? \"\" : ` ${this.selectorText}`;\n return `@page${selector} {${contents.length === 0 ? \"\" : ` ${contents.join(\" \")}`} }`;\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live `@position-try` declaration rule. */\nexport class CSSPositionTryRule extends CSSRule {\n readonly name: string;\n readonly style: CSSStyleDeclaration;\n\n private constructor(name: string) {\n super(0);\n this.name = name;\n this.style = constructWebIDL<CSSStyleDeclaration>(CSSStyleDeclaration, [this]);\n lockOwnProperties(this, \"name\", \"style\");\n }\n\n override get cssText(): string {\n return `@position-try ${this.name} {${this.style.cssText === \"\" ? \"\" : ` ${this.style.cssText}`} }`;\n }\n\n set cssText(_value: string) {}\n}\n\nfunction normalizeKeyText(value: string): string | null {\n const parts = value.split(\",\").map(part => part.trim());\n if (parts.length === 0 || parts.some(part => part === \"\")) return null;\n const normalized: string[] = [];\n for (const part of parts) {\n const lower = part.toLowerCase();\n if (lower === \"from\") {\n normalized.push(\"0%\");\n continue;\n }\n if (lower === \"to\") {\n normalized.push(\"100%\");\n continue;\n }\n const match = lower.match(/^([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+))%$/);\n if (!match) return null;\n const percentage = Number(match[1]);\n if (percentage < 0 || percentage > 100) return null;\n normalized.push(`${percentage}%`);\n }\n return normalized.join(\", \");\n}\n\n/** One mutable keyframe selector and declaration block. */\nexport class CSSKeyframeRule extends CSSRule {\n readonly style: CSSStyleDeclaration;\n #keyText: string;\n\n private constructor(keyText: string) {\n super(CSSRule.KEYFRAME_RULE);\n this.#keyText = normalizeKeyText(keyText) ?? keyText;\n this.style = constructWebIDL<CSSStyleDeclaration>(CSSStyleDeclaration, [this]);\n lockOwnProperties(this, \"style\");\n }\n\n get keyText(): string {\n return this.#keyText;\n }\n\n set keyText(value: string) {\n const normalized = normalizeKeyText(`${value}`);\n if (normalized !== null) this.#keyText = normalized;\n }\n\n override get cssText(): string {\n return `${this.keyText} {${this.style.cssText === \"\" ? \"\" : ` ${this.style.cssText}`} }`;\n }\n\n set cssText(_value: string) {}\n}\n\n/** A mutable `@keyframes` rule. */\nexport class CSSKeyframesRule extends CSSRule {\n readonly cssRules: CSSRuleList;\n #name: string;\n\n private constructor(name: string) {\n super(CSSRule.KEYFRAMES_RULE);\n this.#name = name;\n const rules = ruleTree.createChildren(this);\n this.cssRules = constructWebIDL<CSSRuleList>(CSSRuleList, [rules]);\n lockOwnProperties(this, \"cssRules\");\n }\n\n get name(): string {\n return this.#name;\n }\n\n set name(value: string) {\n this.#name = `${value}`;\n }\n\n get length(): number {\n return this.cssRules.length;\n }\n\n appendRule(ruleText: string): void {\n requireArguments(arguments.length, 1, \"CSSKeyframesRule\", \"appendRule\");\n const parsed = parseKeyframeRule(\n `${ruleText}`,\n ruleDiagnostics.get(this) ?? ignoreDiagnostic,\n ruleResourceBudgets.get(this) ?? defaultResourceBudget,\n );\n if (!parsed) return;\n const rules = ruleTree.children(this);\n const resourceBudget = ruleResourceBudgets.get(this) ?? defaultResourceBudget;\n const insertedCount = assertRuleInsertionBudget(this, parsed, resourceBudget);\n rules.push(parsed);\n attachRuleTree(parsed, this, this.parentStyleSheet);\n adjustSheetRuleCount(this.parentStyleSheet, insertedCount);\n }\n\n deleteRule(select: string): void {\n requireArguments(arguments.length, 1, \"CSSKeyframesRule\", \"deleteRule\");\n const normalized = normalizeKeyText(`${select}`);\n if (normalized === null) return;\n const rules = ruleTree.children(this);\n let index = -1;\n for (let candidate = rules.length - 1; candidate >= 0; candidate -= 1) {\n const rule = rules[candidate];\n if (!(rule instanceof CSSKeyframeRule) || rule.keyText !== normalized) continue;\n index = candidate;\n break;\n }\n if (index === -1) return;\n const [removed] = rules.splice(index, 1);\n if (removed) {\n adjustSheetRuleCount(this.parentStyleSheet, -1);\n attachRuleTree(removed, null, null);\n }\n }\n\n findRule(select: string): CSSKeyframeRule | null {\n requireArguments(arguments.length, 1, \"CSSKeyframesRule\", \"findRule\");\n const normalized = normalizeKeyText(`${select}`);\n if (normalized === null) return null;\n const rules = ruleTree.children(this);\n for (let index = rules.length - 1; index >= 0; index -= 1) {\n const rule = rules[index];\n if (rule instanceof CSSKeyframeRule && rule.keyText === normalized) return rule;\n }\n return null;\n }\n\n override get cssText(): string {\n const rules = ruleTree.children(this);\n if (rules.length === 0) return `@keyframes ${this.name} { }`;\n return `@keyframes ${this.name} { \\n${rules.map(rule => indentRuleText(rule.cssText)).join(\"\\n\")}\\n}`;\n }\n\n set cssText(_value: string) {}\n}\n\nconst counterDescriptorNames = [\n \"system\",\n \"symbols\",\n \"additive-symbols\",\n \"negative\",\n \"prefix\",\n \"suffix\",\n \"pad\",\n \"range\",\n \"fallback\",\n \"speak-as\",\n] as const;\n\n/** A mutable `@counter-style` descriptor rule. */\nexport class CSSCounterStyleRule extends CSSRule {\n readonly #descriptors = new Map<string, string>();\n #name: string;\n #serializedName: string;\n\n private constructor(name: string) {\n super(CSSRule.COUNTER_STYLE_RULE);\n const parsed = parseNativeCounterStyleName(\n name,\n currentConstructionResourceBudget(),\n );\n this.#name = parsed?.name ?? name;\n this.#serializedName = parsed?.serialized ?? name;\n }\n\n get name(): string { return this.#name; }\n set name(value: string) {\n const parsed = parseNativeCounterStyleName(\n `${value}`,\n ruleResourceBudgets.get(this) ?? defaultResourceBudget,\n );\n if (!parsed) return;\n this.#name = parsed.name;\n this.#serializedName = parsed.serialized;\n }\n\n get system(): string { return this.#get(\"system\"); }\n set system(_value: string) {}\n get symbols(): string { return this.#get(\"symbols\"); }\n set symbols(value: string) { this.#set(\"symbols\", value); }\n get additiveSymbols(): string { return this.#get(\"additive-symbols\"); }\n set additiveSymbols(value: string) { this.#set(\"additive-symbols\", value); }\n get negative(): string { return this.#get(\"negative\"); }\n set negative(value: string) { this.#set(\"negative\", value); }\n get prefix(): string { return this.#get(\"prefix\"); }\n set prefix(value: string) { this.#set(\"prefix\", value); }\n get suffix(): string { return this.#get(\"suffix\"); }\n set suffix(value: string) { this.#set(\"suffix\", value); }\n get range(): string { return this.#get(\"range\"); }\n set range(value: string) { this.#set(\"range\", value); }\n get pad(): string { return this.#get(\"pad\"); }\n set pad(value: string) { this.#set(\"pad\", value); }\n get speakAs(): string { return this.#get(\"speak-as\"); }\n set speakAs(value: string) { this.#set(\"speak-as\", value); }\n get fallback(): string { return this.#get(\"fallback\"); }\n set fallback(value: string) { this.#set(\"fallback\", value); }\n\n #get(name: string): string {\n return this.#descriptors.get(name) ?? \"\";\n }\n\n #set(name: string, value: string): void {\n const text = `${value}`;\n const parsed = parseNativeCounterStyleDescriptor(\n name,\n text,\n ruleResourceBudgets.get(this) ?? defaultResourceBudget,\n );\n if (!parsed) return;\n this.#descriptors.set(name, parsed);\n }\n\n /** @internal */\n setParsedDescriptor(name: string, value: string): void {\n if (!(counterDescriptorNames as readonly string[]).includes(name)) return;\n this.#descriptors.set(name, value);\n }\n\n override get cssText(): string {\n const declarations: string[] = [];\n for (const name of counterDescriptorNames) {\n const value = this.#descriptors.get(name);\n if (value !== undefined) declarations.push(`${name}: ${value};`);\n }\n return `@counter-style ${this.#serializedName} {${declarations.length === 0 ? \"\" : ` ${declarations.join(\" \")}`} }`;\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live map exposed by one font-feature-values category. */\nexport class CSSFontFeatureValuesMap implements Iterable<[string, number[]]> {\n readonly #values = new Map<string, number[]>();\n readonly #serializedNames = new Map<string, string>();\n\n private constructor() {\n assertInternalConstructor(\"CSSFontFeatureValuesMap\");\n }\n\n get size(): number {\n return this.#values.size;\n }\n\n set(featureValueName: string, values: number[]): this {\n requireArguments(arguments.length, 2, \"CSSFontFeatureValuesMap\", \"set\");\n const name = `${featureValueName}`;\n const normalized = Array.from(values, value => toUnsignedLong(value));\n this.#values.set(name, normalized);\n this.#serializedNames.set(name, serializeNativeIdentifier(name));\n return this;\n }\n\n clear(): void {\n this.#values.clear();\n this.#serializedNames.clear();\n }\n delete(name: string): boolean {\n const key = `${name}`;\n this.#serializedNames.delete(key);\n return this.#values.delete(key);\n }\n get(name: string): number[] | undefined {\n const value = this.#values.get(`${name}`);\n return value ? [...value] : undefined;\n }\n has(name: string): boolean { return this.#values.has(`${name}`); }\n entries(): MapIterator<[string, number[]]> {\n return new Map(\n [...this.#values].map(([name, values]) => [name, [...values]]),\n ).entries();\n }\n keys(): MapIterator<string> { return this.#values.keys(); }\n values(): MapIterator<number[]> {\n return new Map(\n [...this.#values].map(([name, values]) => [name, [...values]]),\n ).values();\n }\n forEach(\n callback: (value: number[], key: string, map: CSSFontFeatureValuesMap) => void,\n thisArg?: unknown,\n ): void {\n for (const [name, values] of this.#values) {\n callback.call(thisArg, [...values], name, this);\n }\n }\n [Symbol.iterator](): MapIterator<[string, number[]]> { return this.entries(); }\n\n /** @internal */\n setParsed(name: string, serializedName: string, values: number[]): void {\n this.#values.set(name, [...values]);\n this.#serializedNames.set(name, serializedName);\n }\n\n /** @internal */\n serializedEntries(): Array<[string, number[]]> {\n return [...this.#values].map(([name, values]) => [\n this.#serializedNames.get(name) ?? serializeNativeIdentifier(name),\n values,\n ]);\n }\n}\n\nconst fontFeatureMapNames = [\n \"annotation\",\n \"ornaments\",\n \"stylistic\",\n \"swash\",\n \"character-variant\",\n \"styleset\",\n] as const;\n\n/** A mutable `@font-feature-values` rule. */\nexport class CSSFontFeatureValuesRule extends CSSRule {\n readonly annotation = constructWebIDL<CSSFontFeatureValuesMap>(CSSFontFeatureValuesMap);\n readonly ornaments = constructWebIDL<CSSFontFeatureValuesMap>(CSSFontFeatureValuesMap);\n readonly stylistic = constructWebIDL<CSSFontFeatureValuesMap>(CSSFontFeatureValuesMap);\n readonly swash = constructWebIDL<CSSFontFeatureValuesMap>(CSSFontFeatureValuesMap);\n readonly characterVariant = constructWebIDL<CSSFontFeatureValuesMap>(CSSFontFeatureValuesMap);\n readonly styleset = constructWebIDL<CSSFontFeatureValuesMap>(CSSFontFeatureValuesMap);\n #fontFamily: string;\n\n private constructor(fontFamily: string) {\n super(CSSRule.FONT_FEATURE_VALUES_RULE);\n this.#fontFamily = fontFamily;\n lockOwnProperties(\n this,\n \"annotation\",\n \"ornaments\",\n \"stylistic\",\n \"swash\",\n \"characterVariant\",\n \"styleset\",\n );\n }\n\n get fontFamily(): string { return this.#fontFamily; }\n set fontFamily(value: string) {\n this.#fontFamily = serializeNativeFontFamily(`${value}`);\n }\n\n /** @internal */\n featureMap(name: string): CSSFontFeatureValuesMap | null {\n switch (name) {\n case \"annotation\": return this.annotation;\n case \"ornaments\": return this.ornaments;\n case \"stylistic\": return this.stylistic;\n case \"swash\": return this.swash;\n case \"character-variant\": return this.characterVariant;\n case \"styleset\": return this.styleset;\n default: return null;\n }\n }\n\n override get cssText(): string {\n const blocks: string[] = [];\n for (const name of fontFeatureMapNames) {\n const map = this.featureMap(name);\n if (!map || map.size === 0) continue;\n const declarations = map.serializedEntries()\n .map(([key, values]) => `${key}:${values.length === 0 ? \"\" : ` ${values.join(\" \")}`};`)\n .join(\" \");\n blocks.push(`@${name} { ${declarations} }`);\n }\n return `@font-feature-values ${this.fontFamily} {${blocks.length === 0 ? \"\" : ` ${blocks.join(\" \")}`} }`;\n }\n\n set cssText(_value: string) {}\n}\n\n/** A live style rule with declarations and nested rules. */\nexport class CSSStyleRule extends CSSGroupingRule {\n readonly style: CSSStyleDeclaration;\n #selectorText: string;\n\n private constructor(selectorText: string) {\n super(CSSRule.STYLE_RULE);\n this.#selectorText = normalizeSelectorText(\n `${selectorText}`,\n currentConstructionResourceBudget(),\n )\n ?? `${selectorText}`;\n this.style = constructWebIDL<CSSStyleDeclaration>(CSSStyleDeclaration, [this]);\n lockOwnProperties(this, \"style\");\n }\n\n get selectorText(): string {\n return this.#selectorText;\n }\n\n set selectorText(value: string) {\n const normalized = normalizeSelectorText(\n `${value}`,\n ruleResourceBudgets.get(this) ?? defaultResourceBudget,\n );\n if (normalized === null) return;\n this.#selectorText = normalized;\n }\n\n override get cssText(): string {\n const declarations = this.style.cssText;\n const children = ruleTree.children(this);\n if (children.length === 0) {\n return declarations === \"\"\n ? `${this.selectorText} { }`\n : `${this.selectorText} { ${declarations} }`;\n }\n return serializeLineGroupCssText(this, this.selectorText);\n }\n\n set cssText(_value: string) {}\n\n}\n\nfunction parseKeyframeRule(\n ruleText: string,\n reportDiagnostic: ReportDiagnostic,\n resourceBudget: NativeResourceBudget,\n): CSSKeyframeRule | null {\n const keyframes = parseNativeRule(`@keyframes sheetom { ${ruleText} }`, resourceBudget);\n if (keyframes?.kind !== \"keyframes\" || keyframes.children.length !== 1) return null;\n const frame = createRuleFromNative(\n keyframes.children[0]!,\n reportDiagnostic,\n false,\n resourceBudget,\n );\n return frame instanceof CSSKeyframeRule ? frame : null;\n}\n\nfunction replaceKeyframeRules(rule: CSSKeyframesRule, rules: CSSKeyframeRule[]): void {\n ruleTree.replace(rule, rules);\n}\n\nfunction replaceGroupingRules(group: CSSGroupingRule, rules: CSSRule[]): void {\n ruleTree.replace(group, rules);\n}\n\nfunction attachRuleTree(\n rule: CSSRule,\n parentRule: CSSRule | null,\n parentStyleSheet: CSSStyleSheet | null,\n): void {\n ruleTree.attach(rule, parentRule, parentStyleSheet);\n}\n\nfunction describeRuleSafe(rule: CSSRule, strict: boolean): RuleSerializationPlan<CSSRule> {\n if (rule instanceof CSSStyleRule) {\n return {\n kind: \"block\",\n header: rule.selectorText,\n declarations: rule.style.serializeSafe(\" \", strict),\n children: ruleTree.children(rule),\n };\n }\n if (rule instanceof CSSNestedDeclarations || rule instanceof CSSFunctionDeclarations) {\n return { kind: \"declarations\", declarations: rule.style.serializeSafe(\"\", strict) };\n }\n if (\n rule instanceof CSSFontFaceRule ||\n rule instanceof CSSMarginRule ||\n rule instanceof CSSPositionTryRule ||\n rule instanceof CSSKeyframeRule\n ) {\n const blockIndex = rule.cssText.indexOf(\"{\");\n const header = rule.cssText.slice(0, blockIndex).trimEnd();\n return {\n kind: \"block\",\n header,\n declarations: rule.style.serializeSafe(\" \", strict),\n };\n }\n if (rule instanceof CSSKeyframesRule) {\n return {\n kind: \"block\",\n header: `@keyframes ${rule.name}`,\n children: ruleTree.children(rule),\n };\n }\n if (rule instanceof CSSPageRule) {\n const selector = rule.selectorText === \"\" ? \"\" : ` ${rule.selectorText}`;\n return {\n kind: \"block\",\n header: `@page${selector}`,\n declarations: rule.style.serializeSafe(\" \", strict),\n children: ruleTree.children(rule),\n };\n }\n if (!(rule instanceof CSSGroupingRule)) {\n return { kind: \"raw\", cssText: rule.cssText };\n }\n\n return {\n kind: \"block\",\n header: groupingRuleHeader(rule),\n children: ruleTree.children(rule),\n };\n}\n\nfunction groupingRuleHeader(rule: CSSGroupingRule): string {\n if (rule instanceof CSSFunctionRule) {\n return functionRuleHeaders.get(rule) ?? \"@function\";\n }\n if (rule instanceof CSSMediaRule) return `@media ${rule.media.mediaText}`;\n if (rule instanceof CSSSupportsRule) return `@supports ${rule.conditionText}`;\n if (rule instanceof CSSContainerRule) return `@container ${rule.conditionText}`;\n if (rule instanceof CSSLayerBlockRule) {\n return `@layer${rule.name === \"\" ? \"\" : ` ${rule.name}`}`;\n }\n if (rule instanceof CSSScopeRule) {\n const start = rule.start === null ? \"\" : ` (${rule.start})`;\n const end = rule.end === null ? \"\" : ` to (${rule.end})`;\n return `@scope${start}${end}`;\n }\n if (rule instanceof CSSStartingStyleRule) return \"@starting-style\";\n\n const blockIndex = rule.cssText.indexOf(\"{\");\n return blockIndex === -1 ? rule.cssText : rule.cssText.slice(0, blockIndex).trimEnd();\n}\n\nfunction parseScopePrelude(\n prelude: string,\n resourceBudget: NativeResourceBudget,\n): [string | null, string | null] {\n const parsed = parseNativeScopePrelude(prelude, resourceBudget);\n return parsed ? [parsed.start, parsed.end] : [null, null];\n}\n\nfunction parseImportPrelude(\n prelude: string,\n): { href: string; media: string; layer: string | null; supports: string | null } | null {\n const hrefMatch = prelude.match(\n /^(?:url\\(\\s*(?:\"([^\"]*)\"|'([^']*)'|([^)]*))\\s*\\)|\"([^\"]*)\"|'([^']*)')\\s*(.*)$/,\n );\n if (!hrefMatch) return null;\n const href = hrefMatch[1] ?? hrefMatch[2] ?? hrefMatch[3]?.trim() ?? hrefMatch[4] ?? hrefMatch[5];\n if (href === undefined) return null;\n let remainder = hrefMatch[6]?.trim() ?? \"\";\n let layer: string | null = null;\n let supports: string | null = null;\n\n const layerMatch = remainder.match(/^layer(?:\\(([^)]*)\\))?(?:\\s+|$)(.*)$/);\n if (layerMatch) {\n layer = layerMatch[1]?.trim() ?? \"\";\n remainder = layerMatch[2]?.trim() ?? \"\";\n }\n\n if (remainder.startsWith(\"supports(\")) {\n let depth = 0;\n let end = -1;\n for (let index = \"supports\".length; index < remainder.length; index += 1) {\n const character = remainder[index];\n if (character === \"(\") depth += 1;\n if (character !== \")\") continue;\n depth -= 1;\n if (depth !== 0) continue;\n end = index;\n break;\n }\n if (end !== -1) {\n supports = remainder.slice(\"supports(\".length, end).trim();\n remainder = remainder.slice(end + 1).trim();\n }\n }\n\n return { href, media: remainder, layer, supports };\n}\n\nfunction createRuleFromNative(\n description: NativeRuleDescription,\n reportDiagnostic: ReportDiagnostic,\n preserveImports: boolean,\n resourceBudget: NativeResourceBudget,\n): CSSRule | null {\n return constructWithResourceBudget(() =>\n createRuleTreeFromNative(\n description,\n reportDiagnostic,\n preserveImports,\n resourceBudget,\n ),\n resourceBudget,\n );\n}\n\nfunction createRuleTreeFromNative(\n description: NativeRuleDescription,\n reportDiagnostic: ReportDiagnostic,\n preserveImports: boolean,\n resourceBudget: NativeResourceBudget,\n): CSSRule | null {\n const root = createRuleShellFromNative(\n description,\n reportDiagnostic,\n preserveImports,\n resourceBudget,\n );\n if (!root) return null;\n\n const pending = [{ description, rule: root }];\n while (pending.length > 0) {\n const current = pending.pop();\n if (\n !current\n || (\n !(current.rule instanceof CSSGroupingRule)\n && !(current.rule instanceof CSSKeyframesRule)\n )\n ) continue;\n\n const children: CSSRule[] = [];\n const childFrames: { description: NativeRuleDescription; rule: CSSRule }[] = [];\n for (const childDescription of current.description.children) {\n if (isNativeMetadataRule(childDescription)) continue;\n const child = createRuleShellFromNative(\n childDescription,\n reportDiagnostic,\n preserveImports,\n resourceBudget,\n );\n if (!child) continue;\n if (child instanceof CSSFunctionDeclarations && child.style.length === 0) continue;\n if (current.rule instanceof CSSKeyframesRule && !(child instanceof CSSKeyframeRule)) {\n continue;\n }\n children.push(child);\n childFrames.push({ description: childDescription, rule: child });\n }\n\n if (current.rule instanceof CSSKeyframesRule) {\n replaceKeyframeRules(\n current.rule,\n children.filter((candidate): candidate is CSSKeyframeRule =>\n candidate instanceof CSSKeyframeRule\n ),\n );\n } else {\n replaceGroupingRules(current.rule, children);\n }\n for (let index = childFrames.length - 1; index >= 0; index -= 1) {\n const childFrame = childFrames[index];\n if (childFrame) pending.push(childFrame);\n }\n }\n\n return root;\n}\n\nfunction isNativeMetadataRule(description: NativeRuleDescription): boolean {\n return description.kind === \"function-parameter\"\n || description.kind === \"property-descriptor\"\n || description.kind === \"view-transition-type\"\n || description.kind === \"layer-name\";\n}\n\nfunction createRuleShellFromNative(\n description: NativeRuleDescription,\n reportDiagnostic: ReportDiagnostic,\n preserveImports: boolean,\n resourceBudget: NativeResourceBudget,\n): CSSRule | null {\n let rule: CSSRule;\n switch (description.kind) {\n case \"style\": {\n const style = constructWebIDL<CSSStyleRule>(CSSStyleRule, [description.prelude]);\n style.style.cssText = description.declarations;\n rule = style;\n break;\n }\n case \"nested-declarations\": {\n const nested = constructWebIDL<CSSNestedDeclarations>(CSSNestedDeclarations);\n nested.style.cssText = description.declarations;\n rule = nested;\n break;\n }\n case \"function-declarations\": {\n const declarations = constructWebIDL<CSSFunctionDeclarations>(CSSFunctionDeclarations);\n declarations.style.cssText = description.declarations;\n rule = declarations;\n break;\n }\n case \"import\": {\n if (!preserveImports) return null;\n const prelude = description.cssText\n .replace(/^@import\\s+/iu, \"\")\n .replace(/;\\s*$/u, \"\");\n const parsed = parseImportPrelude(prelude);\n if (!parsed) return null;\n rule = constructWebIDL<CSSImportRule>(CSSImportRule, [\n parsed.href,\n parsed.media,\n parsed.layer,\n parsed.supports,\n ]);\n break;\n }\n case \"font-face\": {\n const fontFace = constructWebIDL<CSSFontFaceRule>(CSSFontFaceRule);\n fontFace.style.cssText = description.declarations;\n rule = fontFace;\n break;\n }\n case \"page\": {\n const page = constructWebIDL<CSSPageRule>(CSSPageRule, [description.prelude]);\n page.style.cssText = description.declarations;\n rule = page;\n break;\n }\n case \"margin\": {\n const margin = constructWebIDL<CSSMarginRule>(CSSMarginRule, [description.prelude]);\n margin.style.cssText = description.declarations;\n rule = margin;\n break;\n }\n case \"position-try\": {\n const positionTry = constructWebIDL<CSSPositionTryRule>(CSSPositionTryRule, [description.prelude]);\n positionTry.style.cssText = description.declarations;\n rule = positionTry;\n break;\n }\n case \"keyframes\": {\n rule = constructWebIDL<CSSKeyframesRule>(CSSKeyframesRule, [description.prelude]);\n break;\n }\n case \"keyframe\": {\n const keyframe = constructWebIDL<CSSKeyframeRule>(CSSKeyframeRule, [description.prelude]);\n keyframe.style.cssText = description.declarations;\n rule = keyframe;\n break;\n }\n case \"counter-style\": {\n const counterStyle = constructWebIDL<CSSCounterStyleRule>(CSSCounterStyleRule, [description.prelude]);\n hydrateCounterStyleDescriptors(\n counterStyle,\n description.declarations,\n resourceBudget,\n );\n rule = counterStyle;\n break;\n }\n case \"font-feature-values\": {\n const featureValues = constructWebIDL<CSSFontFeatureValuesRule>(\n CSSFontFeatureValuesRule,\n [description.prelude],\n );\n for (const mapDescription of description.children) {\n if (mapDescription.kind !== \"font-feature-map\") continue;\n const map = featureValues.featureMap(mapDescription.prelude);\n if (!map) continue;\n for (const entry of mapDescription.children) {\n if (entry.kind !== \"font-feature-entry\") continue;\n const values = entry.declarations === \"\"\n ? []\n : entry.declarations.split(\" \").map(value => Number(value));\n map.setParsed(entry.prelude, entry.cssText, values);\n }\n }\n rule = featureValues;\n break;\n }\n case \"property\": {\n return constructWebIDL<CSSPropertyRule>(CSSPropertyRule, [\n description.prelude,\n nativeRuleDescriptor(description, \"syntax\"),\n nativeRuleDescriptor(description, \"inherits\") === \"true\",\n nativeRuleDescriptor(description, \"initial-value\"),\n description.cssText,\n ]);\n }\n case \"font-palette-values\":\n return constructWebIDL<CSSFontPaletteValuesRule>(CSSFontPaletteValuesRule, [\n description.prelude,\n nativeRuleDescriptor(description, \"font-family\"),\n nativeRuleDescriptor(description, \"base-palette\"),\n nativeRuleDescriptor(description, \"override-colors\"),\n description.cssText,\n ]);\n case \"view-transition\":\n return constructWebIDL<CSSViewTransitionRule>(CSSViewTransitionRule, [\n nativeRuleDescriptor(description, \"navigation\"),\n description.children\n .filter(candidate => candidate.kind === \"view-transition-type\")\n .map(candidate => candidate.prelude),\n description.cssText,\n ]);\n case \"function\": {\n const parameters = description.children\n .filter(candidate => candidate.kind === \"function-parameter\")\n .map(candidate => {\n const defaultValue = candidate.children.find(\n child => child.kind === \"property-descriptor\" && child.prelude === \"default-value\",\n );\n return defaultValue\n ? {\n defaultValue: defaultValue.declarations,\n name: candidate.prelude,\n type: candidate.declarations,\n }\n : {\n name: candidate.prelude,\n type: candidate.declarations,\n };\n });\n rule = constructWebIDL<CSSFunctionRule>(CSSFunctionRule, [\n description.prelude,\n parameters,\n description.declarations,\n ]);\n break;\n }\n case \"namespace\":\n return constructWebIDL<CSSNamespaceRule>(CSSNamespaceRule, [\n nativeRuleDescriptor(description, \"namespace-uri\"),\n nativeRuleDescriptor(description, \"prefix\"),\n description.cssText,\n ]);\n case \"media\":\n rule = constructWebIDL<CSSMediaRule>(CSSMediaRule, [description.prelude]);\n break;\n case \"supports\":\n rule = constructWebIDL<CSSSupportsRule>(CSSSupportsRule, [description.prelude]);\n break;\n case \"container\":\n rule = constructWebIDL<CSSContainerRule>(CSSContainerRule, [description.prelude]);\n break;\n case \"layer-block\":\n rule = constructWebIDL<CSSLayerBlockRule>(CSSLayerBlockRule, [description.prelude]);\n break;\n case \"scope\": {\n const [start, end] = parseScopePrelude(description.prelude, resourceBudget);\n rule = constructWebIDL<CSSScopeRule>(CSSScopeRule, [start, end]);\n break;\n }\n case \"starting-style\":\n rule = constructWebIDL<CSSStartingStyleRule>(CSSStartingStyleRule);\n break;\n case \"layer-statement\": {\n const names = description.children\n .filter(candidate => candidate.kind === \"layer-name\")\n .map(candidate => candidate.prelude);\n return constructWebIDL<CSSLayerStatementRule>(CSSLayerStatementRule, [names]);\n }\n default:\n return new CSSGenericRule(\n genericRuleType(description.cssText.match(/^@([^\\s{;]+)/u)?.[1] ?? \"\"),\n description.cssText,\n );\n }\n\n ruleDiagnostics.set(rule, reportDiagnostic);\n return rule;\n}\n\nfunction nativeRuleDescriptor(description: NativeRuleDescription, name: string): string {\n return description.children\n .find(candidate => candidate.kind === \"property-descriptor\" && candidate.prelude === name)\n ?.declarations ?? \"\";\n}\n\nfunction hydrateCounterStyleDescriptors(\n rule: CSSCounterStyleRule,\n declarations: string,\n resourceBudget: NativeResourceBudget,\n): void {\n for (const descriptor of parseNativeCounterStyleDescriptors(\n declarations,\n resourceBudget,\n )) {\n rule.setParsedDescriptor(descriptor.name, descriptor.value);\n }\n}\n\nfunction parseStrictRule(\n ruleText: string,\n reportDiagnostic: ReportDiagnostic,\n preserveImports = false,\n parentRule: CSSGroupingRule | null = null,\n resourceBudget: NativeResourceBudget = defaultResourceBudget,\n): CSSRule | null {\n if (parentRule instanceof CSSPageRule) {\n const page = parseNativeRule(`@page { ${ruleText} }`, resourceBudget);\n if (page?.kind !== \"page\" || page.children.length !== 1) return null;\n const child = page.children[0];\n if (!child || child.kind !== \"margin\" || !pageMarginRuleNames.has(child.prelude)) return null;\n return createRuleFromNative(\n child,\n reportDiagnostic,\n preserveImports,\n resourceBudget,\n );\n }\n const description = parseNativeRule(ruleText, resourceBudget)\n ?? (parentRule && hasFunctionAncestor(parentRule)\n ? parseNativeRuleWithErrorRecovery(ruleText, resourceBudget)\n : null);\n if (!description || (description.kind === \"import\" && !preserveImports)) return null;\n return createRuleFromNative(\n description,\n reportDiagnostic,\n preserveImports,\n resourceBudget,\n );\n}\n\nfunction hasFunctionAncestor(rule: CSSRule): boolean {\n let current: CSSRule | null = rule;\n while (current) {\n if (current instanceof CSSFunctionRule) return true;\n current = current.parentRule;\n }\n return false;\n}\n\nfunction genericRuleType(name: string): number {\n switch (name.toLowerCase()) {\n case \"import\":\n return CSSRule.IMPORT_RULE;\n case \"media\":\n return CSSRule.MEDIA_RULE;\n case \"font-face\":\n return CSSRule.FONT_FACE_RULE;\n case \"page\":\n return CSSRule.PAGE_RULE;\n case \"keyframes\":\n case \"-webkit-keyframes\":\n return CSSRule.KEYFRAMES_RULE;\n case \"namespace\":\n return CSSRule.NAMESPACE_RULE;\n case \"supports\":\n return CSSRule.SUPPORTS_RULE;\n default:\n return 0;\n }\n}\n\nfunction parseStyleSheetRules(\n cssText: string,\n reportDiagnostic: ReportDiagnostic,\n preserveImports: boolean,\n resourceBudget: NativeResourceBudget,\n): CSSRule[] {\n const rules: CSSRule[] = [];\n let parsedRuleCount = 0;\n for (const rawRule of scanTopLevelRules(cssText, resourceBudget)) {\n const rule = parseStrictRule(\n rawRule,\n reportDiagnostic,\n preserveImports,\n null,\n resourceBudget,\n );\n if (rule) {\n parsedRuleCount += ruleForestSize([rule]);\n assertRuleCountBudget(parsedRuleCount, resourceBudget);\n rules.push(rule);\n continue;\n }\n if (!preserveImports) continue;\n const opaque = constructWithResourceBudget(\n () => new CSSOpaqueRule(0, rawRule),\n resourceBudget,\n );\n parsedRuleCount += 1;\n assertRuleCountBudget(parsedRuleCount, resourceBudget);\n rules.push(opaque);\n }\n\n return rules;\n}\n\n/** A mutable, browser-shaped authoring stylesheet. */\nexport class CSSStyleSheet {\n readonly cssRules: CSSRuleList;\n readonly media: MediaList;\n readonly ownerNode: null = null;\n readonly parentStyleSheet: null = null;\n readonly ownerRule: null = null;\n readonly title: null = null;\n readonly type = \"text/css\";\n disabled: boolean;\n\n readonly #rules: CSSRule[] = [];\n readonly #diagnostics: SheetOMDiagnostic[] | null;\n readonly #constructedBaseURL: string;\n\n constructor(options: CSSStyleSheetOptions | null = {}) {\n const normalizedOptions = options ?? {};\n const resourceBudget = normalizeResourceBudget(normalizedOptions.resourceBudget);\n sheetResourceBudgets.set(this, resourceBudget);\n sheetRuleArrays.set(this, this.#rules);\n sheetRuleCounts.set(this, 0);\n this.#diagnostics = Boolean(normalizedOptions.diagnostics) ? [] : null;\n this.#constructedBaseURL = normalizedOptions.baseURL === undefined\n ? \"about:blank\"\n : `${normalizedOptions.baseURL}`;\n const media = normalizedOptions.media === undefined\n ? \"\"\n : `${normalizedOptions.media}`;\n this.media = constructWithResourceBudget(\n () => constructWebIDL<MediaList>(MediaList, [media]),\n resourceBudget,\n );\n this.disabled = Boolean(normalizedOptions.disabled);\n this.cssRules = constructInternally(\n () => constructWebIDL<CSSRuleList>(CSSRuleList, [this.#rules]),\n );\n lockOwnProperties(\n this,\n \"cssRules\",\n \"media\",\n \"ownerNode\",\n \"parentStyleSheet\",\n \"ownerRule\",\n \"title\",\n \"type\",\n );\n }\n\n get href(): string | null {\n return regularSheetMetadata.get(this)?.href ?? null;\n }\n\n get baseURL(): string {\n return regularSheetMetadata.get(this)?.baseURL ?? this.#constructedBaseURL;\n }\n\n readonly #reportDiagnostic: ReportDiagnostic = diagnostic => {\n this.#diagnostics?.push(diagnostic);\n };\n\n insertRule(ruleText: string, index = 0): number {\n requireArguments(arguments.length, 1, \"CSSStyleSheet\", \"insertRule\");\n const normalizedIndex = toUnsignedLong(index);\n if (normalizedIndex > this.#rules.length) {\n throw new DOMException(\"The index is outside the allowed range.\", \"IndexSizeError\");\n }\n\n const regular = regularSheetMetadata.has(this);\n const resourceBudget = sheetResourceBudgets.get(this) ?? defaultResourceBudget;\n const rule = parseStrictRule(\n `${ruleText}`,\n this.#reportDiagnostic,\n regular,\n null,\n resourceBudget,\n );\n if (!rule) throw new DOMException(\"The rule could not be parsed.\", \"SyntaxError\");\n\n const precedingRules = this.#rules.slice(0, normalizedIndex);\n const followingRules = this.#rules.slice(normalizedIndex);\n const invalidImportOrder = rule instanceof CSSImportRule\n ? precedingRules.some(candidate => !(candidate instanceof CSSImportRule))\n : followingRules.some(candidate => candidate instanceof CSSImportRule);\n if (invalidImportOrder) {\n throw new DOMException(\"The rule violates stylesheet ordering.\", \"HierarchyRequestError\");\n }\n\n const insertedCount = assertRuleInsertionBudget(this, rule, resourceBudget);\n attachRuleTree(rule, null, this);\n this.#rules.splice(normalizedIndex, 0, rule);\n adjustSheetRuleCount(this, insertedCount);\n return normalizedIndex;\n }\n\n deleteRule(index: number): void {\n requireArguments(arguments.length, 1, \"CSSStyleSheet\", \"deleteRule\");\n const normalizedIndex = toUnsignedLong(index);\n if (normalizedIndex >= this.#rules.length) {\n throw new DOMException(\"The index is outside the allowed range.\", \"IndexSizeError\");\n }\n\n const [removed] = this.#rules.splice(normalizedIndex, 1);\n if (!removed) return;\n adjustSheetRuleCount(this, -ruleForestSize([removed]));\n attachRuleTree(removed, null, null);\n }\n\n replaceSync(cssText: string): void {\n requireArguments(arguments.length, 1, \"CSSStyleSheet\", \"replaceSync\");\n const replacement = parseStyleSheetRules(\n `${cssText}`,\n this.#reportDiagnostic,\n regularSheetMetadata.has(this),\n sheetResourceBudgets.get(this) ?? defaultResourceBudget,\n );\n\n for (const rule of this.#rules) {\n attachRuleTree(rule, null, null);\n }\n for (const rule of replacement) attachRuleTree(rule, null, this);\n\n this.#rules.splice(0, this.#rules.length, ...replacement);\n sheetRuleCounts.set(this, ruleForestSize(replacement));\n }\n\n async replace(cssText: string): Promise<CSSStyleSheet> {\n requireArguments(arguments.length, 1, \"CSSStyleSheet\", \"replace\");\n this.replaceSync(cssText);\n return this;\n }\n\n /** Serialize current state as reparsable CSS without mutating live objects. */\n serialize(): string {\n return safeSerializer.serializeMany(this.#rules);\n }\n\n /** Serialize current state only when its CSS semantics can be preserved exactly. */\n serializeStrict(): string {\n return strictSerializer.serializeMany(this.#rules);\n }\n\n /** Drain opt-in mutation and serialization diagnostics without affecting CSSOM behavior. */\n takeDiagnostics(): SheetOMDiagnostic[] {\n if (!this.#diagnostics) return [];\n return this.#diagnostics.splice(0);\n }\n}\n\n/** Forgivingly parse an existing regular stylesheet without loading imports. */\nexport function parseStyleSheet(\n cssText: string,\n options: ParseStyleSheetOptions = {},\n): CSSStyleSheet {\n const sheet = new CSSStyleSheet(options);\n const href = options.href ?? null;\n regularSheetMetadata.set(sheet, {\n href,\n baseURL: options.baseURL ?? href ?? \"about:blank\",\n });\n sheet.replaceSync(`${cssText}`);\n return sheet;\n}\n"],"mappings":";;;;;ACUA,MAAa,4BAAyD,OAAO,OAAO;CACtEA;CACIC;CACOC;AACzB,CAAC;AAwED,IAAa,4BAAb,cAA+C,MAAM;CACnD;CAEA,YACE,MACA,SACA,SACA;EACA,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;EACZ,KAAK,OAAO;CACd;AACF;AAEA,SAAgB,8BAA8B,UAA+C;CAC3F,IAAI;CACJ,IAAI;EACF,SAAS,KAAK,MAAM,SAAS,kBAAkB,CAAC;CAClD,SAAS,OAAO;EACd,MAAM,IAAI,0BACR,8BACA,qDACA,EAAE,MAAM,CACV;CACF;CAEA,IAAI,CAAC,oBAAoB,MAAM,GAC7B,MAAM,IAAI,0BACR,8BACA,kDAC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