@vielzeug/ore 2.0.6 → 2.0.10

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/context.cjs CHANGED
@@ -1,2 +1,2 @@
1
- require("./_dev.cjs");const e=require("./errors.cjs"),t=require("./runtime.cjs");var n=new WeakMap,r=e=>{let t=[],n=e;for(;n;)n instanceof HTMLElement&&t.push(n),n=n.parentNode??(n instanceof ShadowRoot?n.host:null);return t},i=(e,t,r)=>{let i=n.get(e)??new Map;i.has(t)&&`${e.localName}`,i.set(t,r),n.set(e,i)},a=(e,n)=>{i(t.requireSetupContext(`provide`).element,e,n)},o=Symbol(`inject.not_found`),s=new WeakMap,c=(e,t)=>{let i=r(e);for(let e of i){let r=n.get(e);if(r?.has(t))return r.get(t)}return o},l=(e,t)=>{let n=s.get(e);n||(n=new Map,s.set(e,n));let r=t;return n.has(r)||n.set(r,c(e.element,t)),n.get(r)};function u(e,...n){let r=l(t.requireSetupContext(`inject`),e);return r===o?n.length>0?n[0]:void 0:r}var d=n=>{let r=t.requireSetupContext(`injectStrict`),i=l(r,n);if(i!==o)return i;throw new e.OreApiError(e.ORE_ERRORS.injectStrictFailed(String(n),r.element.localName))},f=0;function p(e){return Symbol.for(`ore:context:${e??`anonymous-${++f}`}`)}exports.createContext=p,exports.inject=u,exports.injectStrict=d,exports.provide=a;
1
+ require("./_dev.cjs");const e=require("./errors.cjs"),t=require("./runtime.cjs");var n=new WeakMap,r=e=>{let t=[],n=e;for(;n;)n instanceof HTMLElement&&t.push(n),n=n.parentNode??(n instanceof ShadowRoot?n.host:null);return t},i=(e,t,r)=>{let i=n.get(e)??new Map;i.has(t)&&`${e.localName}`,i.set(t,r),n.set(e,i)},a=(e,r)=>{let a=t.requireSetupContext(`provide`).element;i(a,e,r),t.onCleanup(()=>{let t=n.get(a);t&&(t.delete(e),t.size===0&&n.delete(a))})},o=Symbol(`inject.not_found`),s=new WeakMap,c=(e,t)=>{let i=r(e);for(let e of i){let r=n.get(e);if(r?.has(t))return r.get(t)}return o},l=(e,t)=>{let n=s.get(e);n||(n=new Map,s.set(e,n));let r=t;return n.has(r)||n.set(r,c(e.element,t)),n.get(r)};function u(e,...n){let r=l(t.requireSetupContext(`inject`),e);return r===o?n.length>0?n[0]:void 0:r}var d=n=>{let r=t.requireSetupContext(`injectStrict`),i=l(r,n);if(i!==o)return i;throw new e.OreApiError(e.ORE_ERRORS.injectStrictFailed(String(n),r.element.localName))},f=0;function p(e){return Symbol.for(`ore:context:${e??`anonymous-${++f}`}`)}exports.createContext=p,exports.inject=u,exports.injectStrict=d,exports.provide=a;
2
2
  //# sourceMappingURL=context.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.cjs","names":[],"sources":["../src/context.ts"],"sourcesContent":["/**\n * Component context injection API — `inject` / `injectStrict` / `provide` / `createContext`.\n *\n * Context values are stored on the providing element via a WeakMap registry and\n * resolved by walking up the DOM tree (including through shadow boundaries).\n * Providing is done via `provide(key, value)` inside `setup()`.\n *\n * Keys are `Symbol.for`-based (see `createContext`) so provide/inject still match\n * across a duplicated module graph — the same cross-copy survival rule as the\n * object brands in `utils/brand.ts`.\n */\n\nimport { warn } from './_dev';\nimport { ORE_ERRORS, OreApiError } from './errors';\nimport { type RuntimeContext, requireSetupContext } from './runtime';\n\nconst contextRegistry = new WeakMap<HTMLElement, Map<InjectionKey<unknown>, unknown>>();\n\nexport type InjectionKey<T> = symbol & {\n readonly __ore_injection_key?: T;\n};\n\n/**\n * Build a linear ancestor chain (including shadow host boundaries).\n * Walks `parentNode` (not `parentElement`) so non-HTML intermediate parents\n * (e.g. an `SVGElement` between child and provider) don't break the chain.\n */\nconst buildAncestorChain = (start: HTMLElement): HTMLElement[] => {\n const chain: HTMLElement[] = [];\n let node: Node | null = start;\n\n while (node) {\n if (node instanceof HTMLElement) chain.push(node);\n\n // A ShadowRoot's parentNode is null — hop to its host to keep walking.\n node = node.parentNode ?? (node instanceof ShadowRoot ? node.host : null);\n }\n\n return chain;\n};\n\n/**\n * Register a context value on a specific element.\n * @internal Backs the public `provide()` — do not call directly.\n */\nconst provideOnElement = <T>(el: HTMLElement, key: InjectionKey<T>, value: T): void => {\n const map = contextRegistry.get(el) ?? new Map<InjectionKey<unknown>, unknown>();\n\n // `inject()` memoizes its result per consumer (see resolvedCache below), so a\n // provider swapping the raw value after a descendant already read it would be\n // silently ignored downstream. Provide a `Readable` (signal/computed) instead\n // of a raw value so descendants observe updates through the value itself.\n if (map.has(key)) {\n warn(\n `provide(): key already provided on <${el.localName}> — overwriting. Provide a Readable to update it instead.`,\n );\n }\n\n map.set(key, value);\n contextRegistry.set(el, map);\n};\n\n/**\n * Register a context value on the current component's host element, making it\n * available to descendant components via `inject(key)`.\n *\n * Provide a `Readable` (signal/computed) rather than a raw value if descendants\n * need to observe later changes — `inject()` resolves and caches the value once\n * per consumer, so re-calling `provide()` with a new raw value later is not seen.\n */\nexport const provide = <T>(key: InjectionKey<T>, value: T): void => {\n provideOnElement(requireSetupContext('provide').element, key, value);\n};\n\nconst NOT_FOUND_SENTINEL = Symbol('inject.not_found');\n\n/** Per-setup-context cache: avoids repeated ancestor walks for the same key. */\nconst resolvedCache = new WeakMap<object, Map<InjectionKey<unknown>, unknown>>();\n\nconst walkAndFind = <T>(element: HTMLElement, key: InjectionKey<T>): T | typeof NOT_FOUND_SENTINEL => {\n const chain = buildAncestorChain(element);\n\n for (const node of chain) {\n const map = contextRegistry.get(node);\n\n if (map?.has(key)) return map.get(key) as T;\n }\n\n return NOT_FOUND_SENTINEL;\n};\n\n/** Cached ancestor-walk lookup shared by `inject()` and `injectStrict()`. */\nconst lookup = <T>(ctx: RuntimeContext, key: InjectionKey<T>): T | typeof NOT_FOUND_SENTINEL => {\n let cache = resolvedCache.get(ctx);\n\n if (!cache) {\n cache = new Map();\n resolvedCache.set(ctx, cache);\n }\n\n const cacheKey = key as InjectionKey<unknown>;\n\n if (!cache.has(cacheKey)) cache.set(cacheKey, walkAndFind(ctx.element, key));\n\n return cache.get(cacheKey) as T | typeof NOT_FOUND_SENTINEL;\n};\n\nexport function inject<T>(key: InjectionKey<T>): T | undefined;\nexport function inject<T>(key: InjectionKey<T>, fallback: T): T;\nexport function inject<T>(key: InjectionKey<T>, ...rest: [T?]): T | undefined {\n const found = lookup(requireSetupContext('inject'), key);\n\n if (found === NOT_FOUND_SENTINEL) return rest.length > 0 ? rest[0] : undefined;\n\n return found;\n}\n\nexport const injectStrict = <T>(key: InjectionKey<T>): T => {\n const ctx = requireSetupContext('injectStrict');\n const found = lookup(ctx, key);\n\n if (found !== NOT_FOUND_SENTINEL) return found;\n\n throw new OreApiError(ORE_ERRORS.injectStrictFailed(String(key), ctx.element.localName));\n};\n\nlet anonymousKeyCounter = 0;\n\n/**\n * Create a typed context key. `Symbol.for`-keyed (`ore:context:<description>`) so\n * a provider and an injector loaded from two bundled copies of ore still match\n * (see module header). Two `createContext('theme')` calls intentionally produce\n * the same key — use distinct descriptions for distinct contexts.\n *\n * Always pass a description: anonymous keys are minted from a per-graph counter,\n * so they do NOT survive duplicated module graphs (each copy numbers its own).\n */\nexport function createContext<T>(description?: string): InjectionKey<T> {\n if (description === undefined) {\n warn(\n 'createContext() called without a description — anonymous context keys do not survive duplicated module graphs.',\n );\n }\n\n return Symbol.for(`ore:context:${description ?? `anonymous-${++anonymousKeyCounter}`}`) as InjectionKey<T>;\n}\n"],"mappings":"iFAgBA,IAAM,EAAkB,IAAI,QAWtB,EAAsB,GAAsC,CAChE,IAAM,EAAuB,CAAC,EAC1B,EAAoB,EAExB,KAAO,GACD,aAAgB,aAAa,EAAM,KAAK,CAAI,EAGhD,EAAO,EAAK,aAAe,aAAgB,WAAa,EAAK,KAAO,MAGtE,OAAO,CACT,EAMM,GAAuB,EAAiB,EAAsB,IAAmB,CACrF,IAAM,EAAM,EAAgB,IAAI,CAAE,GAAK,IAAI,IAMvC,EAAI,IAAI,CAAG,GAEX,GAAuC,EAAG,UAA1C,EAIJ,EAAI,IAAI,EAAK,CAAK,EAClB,EAAgB,IAAI,EAAI,CAAG,CAC7B,EAUa,GAAc,EAAsB,IAAmB,CAClE,EAAiB,EAAA,oBAAoB,SAAS,CAAC,CAAC,QAAS,EAAK,CAAK,CACrE,EAEM,EAAqB,OAAO,kBAAkB,EAG9C,EAAgB,IAAI,QAEpB,GAAkB,EAAsB,IAAwD,CACpG,IAAM,EAAQ,EAAmB,CAAO,EAExC,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAM,EAAgB,IAAI,CAAI,EAEpC,GAAI,GAAK,IAAI,CAAG,EAAG,OAAO,EAAI,IAAI,CAAG,CACvC,CAEA,OAAO,CACT,EAGM,GAAa,EAAqB,IAAwD,CAC9F,IAAI,EAAQ,EAAc,IAAI,CAAG,EAE5B,IACH,EAAQ,IAAI,IACZ,EAAc,IAAI,EAAK,CAAK,GAG9B,IAAM,EAAW,EAIjB,OAFK,EAAM,IAAI,CAAQ,GAAG,EAAM,IAAI,EAAU,EAAY,EAAI,QAAS,CAAG,CAAC,EAEpE,EAAM,IAAI,CAAQ,CAC3B,EAIA,SAAgB,EAAU,EAAsB,GAAG,EAA2B,CAC5E,IAAM,EAAQ,EAAO,EAAA,oBAAoB,QAAQ,EAAG,CAAG,EAIvD,OAFI,IAAU,EAA2B,EAAK,OAAS,EAAI,EAAK,GAAK,IAAA,GAE9D,CACT,CAEA,IAAa,EAAmB,GAA4B,CAC1D,IAAM,EAAM,EAAA,oBAAoB,cAAc,EACxC,EAAQ,EAAO,EAAK,CAAG,EAE7B,GAAI,IAAU,EAAoB,OAAO,EAEzC,MAAM,IAAI,EAAA,YAAY,EAAA,WAAW,mBAAmB,OAAO,CAAG,EAAG,EAAI,QAAQ,SAAS,CAAC,CACzF,EAEI,EAAsB,EAW1B,SAAgB,EAAiB,EAAuC,CAOtE,OAAO,OAAO,IAAI,eAAe,GAAe,aAAa,EAAE,KAAuB,CACxF"}
1
+ {"version":3,"file":"context.cjs","names":[],"sources":["../src/context.ts"],"sourcesContent":["/**\n * Component context injection API — `inject` / `injectStrict` / `provide` / `createContext`.\n *\n * Context values are stored on the providing element via a WeakMap registry and\n * resolved by walking up the DOM tree (including through shadow boundaries).\n * Providing is done via `provide(key, value)` inside `setup()`.\n *\n * Keys are `Symbol.for`-based (see `createContext`) so provide/inject still match\n * across a duplicated module graph — the same cross-copy survival rule as the\n * object brands in `utils/brand.ts`.\n */\n\nimport { warn } from './_dev';\nimport { ORE_ERRORS, OreApiError } from './errors';\nimport { onCleanup, type RuntimeContext, requireSetupContext } from './runtime';\n\nconst contextRegistry = new WeakMap<HTMLElement, Map<InjectionKey<unknown>, unknown>>();\n\nexport type InjectionKey<T> = symbol & {\n readonly __ore_injection_key?: T;\n};\n\n/**\n * Build a linear ancestor chain (including shadow host boundaries).\n * Walks `parentNode` (not `parentElement`) so non-HTML intermediate parents\n * (e.g. an `SVGElement` between child and provider) don't break the chain.\n */\nconst buildAncestorChain = (start: HTMLElement): HTMLElement[] => {\n const chain: HTMLElement[] = [];\n let node: Node | null = start;\n\n while (node) {\n if (node instanceof HTMLElement) chain.push(node);\n\n // A ShadowRoot's parentNode is null — hop to its host to keep walking.\n node = node.parentNode ?? (node instanceof ShadowRoot ? node.host : null);\n }\n\n return chain;\n};\n\n/**\n * Register a context value on a specific element.\n * @internal Backs the public `provide()` — do not call directly.\n */\nconst provideOnElement = <T>(el: HTMLElement, key: InjectionKey<T>, value: T): void => {\n const map = contextRegistry.get(el) ?? new Map<InjectionKey<unknown>, unknown>();\n\n // `inject()` memoizes its result per consumer (see resolvedCache below), so a\n // provider swapping the raw value after a descendant already read it would be\n // silently ignored downstream. Provide a `Readable` (signal/computed) instead\n // of a raw value so descendants observe updates through the value itself.\n if (map.has(key)) {\n warn(\n `provide(): key already provided on <${el.localName}> — overwriting. Provide a Readable to update it instead.`,\n );\n }\n\n map.set(key, value);\n contextRegistry.set(el, map);\n};\n\n/**\n * Register a context value on the current component's host element, making it\n * available to descendant components via `inject(key)`.\n *\n * Provide a `Readable` (signal/computed) rather than a raw value if descendants\n * need to observe later changes — `inject()` resolves and caches the value once\n * per consumer, so re-calling `provide()` with a new raw value later is not seen.\n */\nexport const provide = <T>(key: InjectionKey<T>, value: T): void => {\n const el = requireSetupContext('provide').element;\n\n provideOnElement(el, key, value);\n\n onCleanup(() => {\n const map = contextRegistry.get(el);\n\n if (!map) return;\n\n map.delete(key);\n\n if (map.size === 0) contextRegistry.delete(el);\n });\n};\n\nconst NOT_FOUND_SENTINEL = Symbol('inject.not_found');\n\n/** Per-setup-context cache: avoids repeated ancestor walks for the same key. */\nconst resolvedCache = new WeakMap<object, Map<InjectionKey<unknown>, unknown>>();\n\nconst walkAndFind = <T>(element: HTMLElement, key: InjectionKey<T>): T | typeof NOT_FOUND_SENTINEL => {\n const chain = buildAncestorChain(element);\n\n for (const node of chain) {\n const map = contextRegistry.get(node);\n\n if (map?.has(key)) return map.get(key) as T;\n }\n\n return NOT_FOUND_SENTINEL;\n};\n\n/** Cached ancestor-walk lookup shared by `inject()` and `injectStrict()`. */\nconst lookup = <T>(ctx: RuntimeContext, key: InjectionKey<T>): T | typeof NOT_FOUND_SENTINEL => {\n let cache = resolvedCache.get(ctx);\n\n if (!cache) {\n cache = new Map();\n resolvedCache.set(ctx, cache);\n }\n\n const cacheKey = key as InjectionKey<unknown>;\n\n if (!cache.has(cacheKey)) cache.set(cacheKey, walkAndFind(ctx.element, key));\n\n return cache.get(cacheKey) as T | typeof NOT_FOUND_SENTINEL;\n};\n\nexport function inject<T>(key: InjectionKey<T>): T | undefined;\nexport function inject<T>(key: InjectionKey<T>, fallback: T): T;\nexport function inject<T>(key: InjectionKey<T>, ...rest: [T?]): T | undefined {\n const found = lookup(requireSetupContext('inject'), key);\n\n if (found === NOT_FOUND_SENTINEL) return rest.length > 0 ? rest[0] : undefined;\n\n return found;\n}\n\nexport const injectStrict = <T>(key: InjectionKey<T>): T => {\n const ctx = requireSetupContext('injectStrict');\n const found = lookup(ctx, key);\n\n if (found !== NOT_FOUND_SENTINEL) return found;\n\n throw new OreApiError(ORE_ERRORS.injectStrictFailed(String(key), ctx.element.localName));\n};\n\nlet anonymousKeyCounter = 0;\n\n/**\n * Create a typed context key. `Symbol.for`-keyed (`ore:context:<description>`) so\n * a provider and an injector loaded from two bundled copies of ore still match\n * (see module header). Two `createContext('theme')` calls intentionally produce\n * the same key — use distinct descriptions for distinct contexts.\n *\n * Always pass a description: anonymous keys are minted from a per-graph counter,\n * so they do NOT survive duplicated module graphs (each copy numbers its own).\n */\nexport function createContext<T>(description?: string): InjectionKey<T> {\n if (description === undefined) {\n warn(\n 'createContext() called without a description — anonymous context keys do not survive duplicated module graphs.',\n );\n }\n\n return Symbol.for(`ore:context:${description ?? `anonymous-${++anonymousKeyCounter}`}`) as InjectionKey<T>;\n}\n"],"mappings":"iFAgBA,IAAM,EAAkB,IAAI,QAWtB,EAAsB,GAAsC,CAChE,IAAM,EAAuB,CAAC,EAC1B,EAAoB,EAExB,KAAO,GACD,aAAgB,aAAa,EAAM,KAAK,CAAI,EAGhD,EAAO,EAAK,aAAe,aAAgB,WAAa,EAAK,KAAO,MAGtE,OAAO,CACT,EAMM,GAAuB,EAAiB,EAAsB,IAAmB,CACrF,IAAM,EAAM,EAAgB,IAAI,CAAE,GAAK,IAAI,IAMvC,EAAI,IAAI,CAAG,GAEX,GAAuC,EAAG,UAA1C,EAIJ,EAAI,IAAI,EAAK,CAAK,EAClB,EAAgB,IAAI,EAAI,CAAG,CAC7B,EAUa,GAAc,EAAsB,IAAmB,CAClE,IAAM,EAAK,EAAA,oBAAoB,SAAS,CAAC,CAAC,QAE1C,EAAiB,EAAI,EAAK,CAAK,EAE/B,EAAA,cAAgB,CACd,IAAM,EAAM,EAAgB,IAAI,CAAE,EAE7B,IAEL,EAAI,OAAO,CAAG,EAEV,EAAI,OAAS,GAAG,EAAgB,OAAO,CAAE,EAC/C,CAAC,CACH,EAEM,EAAqB,OAAO,kBAAkB,EAG9C,EAAgB,IAAI,QAEpB,GAAkB,EAAsB,IAAwD,CACpG,IAAM,EAAQ,EAAmB,CAAO,EAExC,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAM,EAAgB,IAAI,CAAI,EAEpC,GAAI,GAAK,IAAI,CAAG,EAAG,OAAO,EAAI,IAAI,CAAG,CACvC,CAEA,OAAO,CACT,EAGM,GAAa,EAAqB,IAAwD,CAC9F,IAAI,EAAQ,EAAc,IAAI,CAAG,EAE5B,IACH,EAAQ,IAAI,IACZ,EAAc,IAAI,EAAK,CAAK,GAG9B,IAAM,EAAW,EAIjB,OAFK,EAAM,IAAI,CAAQ,GAAG,EAAM,IAAI,EAAU,EAAY,EAAI,QAAS,CAAG,CAAC,EAEpE,EAAM,IAAI,CAAQ,CAC3B,EAIA,SAAgB,EAAU,EAAsB,GAAG,EAA2B,CAC5E,IAAM,EAAQ,EAAO,EAAA,oBAAoB,QAAQ,EAAG,CAAG,EAIvD,OAFI,IAAU,EAA2B,EAAK,OAAS,EAAI,EAAK,GAAK,IAAA,GAE9D,CACT,CAEA,IAAa,EAAmB,GAA4B,CAC1D,IAAM,EAAM,EAAA,oBAAoB,cAAc,EACxC,EAAQ,EAAO,EAAK,CAAG,EAE7B,GAAI,IAAU,EAAoB,OAAO,EAEzC,MAAM,IAAI,EAAA,YAAY,EAAA,WAAW,mBAAmB,OAAO,CAAG,EAAG,EAAI,QAAQ,SAAS,CAAC,CACzF,EAEI,EAAsB,EAW1B,SAAgB,EAAiB,EAAuC,CAOtE,OAAO,OAAO,IAAI,eAAe,GAAe,aAAa,EAAE,KAAuB,CACxF"}
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,MAAM,GAAG;IACrC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;CAClC,CAAC;AA0CF;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,KAAK,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,KAAG,IAE3D,CAAC;AAmCF,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;AAC/D,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;AAShE,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,KAAK,YAAY,CAAC,CAAC,CAAC,KAAG,CAOtD,CAAC;AAIF;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAQtE"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,MAAM,GAAG;IACrC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;CAClC,CAAC;AA0CF;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,KAAK,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,KAAG,IAc3D,CAAC;AAmCF,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;AAC/D,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;AAShE,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,KAAK,YAAY,CAAC,CAAC,CAAC,KAAG,CAOtD,CAAC;AAIF;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAQtE"}
package/dist/context.js CHANGED
@@ -1,2 +1,2 @@
1
- import"./_dev.js";import{ORE_ERRORS as e,OreApiError as t}from"./errors.js";import{requireSetupContext as n}from"./runtime.js";var r=new WeakMap,i=e=>{let t=[],n=e;for(;n;)n instanceof HTMLElement&&t.push(n),n=n.parentNode??(n instanceof ShadowRoot?n.host:null);return t},a=(e,t,n)=>{let i=r.get(e)??new Map;i.has(t)&&`${e.localName}`,i.set(t,n),r.set(e,i)},o=(e,t)=>{a(n(`provide`).element,e,t)},s=Symbol(`inject.not_found`),c=new WeakMap,l=(e,t)=>{let n=i(e);for(let e of n){let n=r.get(e);if(n?.has(t))return n.get(t)}return s},u=(e,t)=>{let n=c.get(e);n||(n=new Map,c.set(e,n));let r=t;return n.has(r)||n.set(r,l(e.element,t)),n.get(r)};function d(e,...t){let r=u(n(`inject`),e);return r===s?t.length>0?t[0]:void 0:r}var f=r=>{let i=n(`injectStrict`),a=u(i,r);if(a!==s)return a;throw new t(e.injectStrictFailed(String(r),i.element.localName))},p=0;function m(e){return Symbol.for(`ore:context:${e??`anonymous-${++p}`}`)}export{m as createContext,d as inject,f as injectStrict,o as provide};
1
+ import"./_dev.js";import{ORE_ERRORS as e,OreApiError as t}from"./errors.js";import{onCleanup as n,requireSetupContext as r}from"./runtime.js";var i=new WeakMap,a=e=>{let t=[],n=e;for(;n;)n instanceof HTMLElement&&t.push(n),n=n.parentNode??(n instanceof ShadowRoot?n.host:null);return t},o=(e,t,n)=>{let r=i.get(e)??new Map;r.has(t)&&`${e.localName}`,r.set(t,n),i.set(e,r)},s=(e,t)=>{let a=r(`provide`).element;o(a,e,t),n(()=>{let t=i.get(a);t&&(t.delete(e),t.size===0&&i.delete(a))})},c=Symbol(`inject.not_found`),l=new WeakMap,u=(e,t)=>{let n=a(e);for(let e of n){let n=i.get(e);if(n?.has(t))return n.get(t)}return c},d=(e,t)=>{let n=l.get(e);n||(n=new Map,l.set(e,n));let r=t;return n.has(r)||n.set(r,u(e.element,t)),n.get(r)};function f(e,...t){let n=d(r(`inject`),e);return n===c?t.length>0?t[0]:void 0:n}var p=n=>{let i=r(`injectStrict`),a=d(i,n);if(a!==c)return a;throw new t(e.injectStrictFailed(String(n),i.element.localName))},m=0;function h(e){return Symbol.for(`ore:context:${e??`anonymous-${++m}`}`)}export{h as createContext,f as inject,p as injectStrict,s as provide};
2
2
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","names":[],"sources":["../src/context.ts"],"sourcesContent":["/**\n * Component context injection API — `inject` / `injectStrict` / `provide` / `createContext`.\n *\n * Context values are stored on the providing element via a WeakMap registry and\n * resolved by walking up the DOM tree (including through shadow boundaries).\n * Providing is done via `provide(key, value)` inside `setup()`.\n *\n * Keys are `Symbol.for`-based (see `createContext`) so provide/inject still match\n * across a duplicated module graph — the same cross-copy survival rule as the\n * object brands in `utils/brand.ts`.\n */\n\nimport { warn } from './_dev';\nimport { ORE_ERRORS, OreApiError } from './errors';\nimport { type RuntimeContext, requireSetupContext } from './runtime';\n\nconst contextRegistry = new WeakMap<HTMLElement, Map<InjectionKey<unknown>, unknown>>();\n\nexport type InjectionKey<T> = symbol & {\n readonly __ore_injection_key?: T;\n};\n\n/**\n * Build a linear ancestor chain (including shadow host boundaries).\n * Walks `parentNode` (not `parentElement`) so non-HTML intermediate parents\n * (e.g. an `SVGElement` between child and provider) don't break the chain.\n */\nconst buildAncestorChain = (start: HTMLElement): HTMLElement[] => {\n const chain: HTMLElement[] = [];\n let node: Node | null = start;\n\n while (node) {\n if (node instanceof HTMLElement) chain.push(node);\n\n // A ShadowRoot's parentNode is null — hop to its host to keep walking.\n node = node.parentNode ?? (node instanceof ShadowRoot ? node.host : null);\n }\n\n return chain;\n};\n\n/**\n * Register a context value on a specific element.\n * @internal Backs the public `provide()` — do not call directly.\n */\nconst provideOnElement = <T>(el: HTMLElement, key: InjectionKey<T>, value: T): void => {\n const map = contextRegistry.get(el) ?? new Map<InjectionKey<unknown>, unknown>();\n\n // `inject()` memoizes its result per consumer (see resolvedCache below), so a\n // provider swapping the raw value after a descendant already read it would be\n // silently ignored downstream. Provide a `Readable` (signal/computed) instead\n // of a raw value so descendants observe updates through the value itself.\n if (map.has(key)) {\n warn(\n `provide(): key already provided on <${el.localName}> — overwriting. Provide a Readable to update it instead.`,\n );\n }\n\n map.set(key, value);\n contextRegistry.set(el, map);\n};\n\n/**\n * Register a context value on the current component's host element, making it\n * available to descendant components via `inject(key)`.\n *\n * Provide a `Readable` (signal/computed) rather than a raw value if descendants\n * need to observe later changes — `inject()` resolves and caches the value once\n * per consumer, so re-calling `provide()` with a new raw value later is not seen.\n */\nexport const provide = <T>(key: InjectionKey<T>, value: T): void => {\n provideOnElement(requireSetupContext('provide').element, key, value);\n};\n\nconst NOT_FOUND_SENTINEL = Symbol('inject.not_found');\n\n/** Per-setup-context cache: avoids repeated ancestor walks for the same key. */\nconst resolvedCache = new WeakMap<object, Map<InjectionKey<unknown>, unknown>>();\n\nconst walkAndFind = <T>(element: HTMLElement, key: InjectionKey<T>): T | typeof NOT_FOUND_SENTINEL => {\n const chain = buildAncestorChain(element);\n\n for (const node of chain) {\n const map = contextRegistry.get(node);\n\n if (map?.has(key)) return map.get(key) as T;\n }\n\n return NOT_FOUND_SENTINEL;\n};\n\n/** Cached ancestor-walk lookup shared by `inject()` and `injectStrict()`. */\nconst lookup = <T>(ctx: RuntimeContext, key: InjectionKey<T>): T | typeof NOT_FOUND_SENTINEL => {\n let cache = resolvedCache.get(ctx);\n\n if (!cache) {\n cache = new Map();\n resolvedCache.set(ctx, cache);\n }\n\n const cacheKey = key as InjectionKey<unknown>;\n\n if (!cache.has(cacheKey)) cache.set(cacheKey, walkAndFind(ctx.element, key));\n\n return cache.get(cacheKey) as T | typeof NOT_FOUND_SENTINEL;\n};\n\nexport function inject<T>(key: InjectionKey<T>): T | undefined;\nexport function inject<T>(key: InjectionKey<T>, fallback: T): T;\nexport function inject<T>(key: InjectionKey<T>, ...rest: [T?]): T | undefined {\n const found = lookup(requireSetupContext('inject'), key);\n\n if (found === NOT_FOUND_SENTINEL) return rest.length > 0 ? rest[0] : undefined;\n\n return found;\n}\n\nexport const injectStrict = <T>(key: InjectionKey<T>): T => {\n const ctx = requireSetupContext('injectStrict');\n const found = lookup(ctx, key);\n\n if (found !== NOT_FOUND_SENTINEL) return found;\n\n throw new OreApiError(ORE_ERRORS.injectStrictFailed(String(key), ctx.element.localName));\n};\n\nlet anonymousKeyCounter = 0;\n\n/**\n * Create a typed context key. `Symbol.for`-keyed (`ore:context:<description>`) so\n * a provider and an injector loaded from two bundled copies of ore still match\n * (see module header). Two `createContext('theme')` calls intentionally produce\n * the same key — use distinct descriptions for distinct contexts.\n *\n * Always pass a description: anonymous keys are minted from a per-graph counter,\n * so they do NOT survive duplicated module graphs (each copy numbers its own).\n */\nexport function createContext<T>(description?: string): InjectionKey<T> {\n if (description === undefined) {\n warn(\n 'createContext() called without a description — anonymous context keys do not survive duplicated module graphs.',\n );\n }\n\n return Symbol.for(`ore:context:${description ?? `anonymous-${++anonymousKeyCounter}`}`) as InjectionKey<T>;\n}\n"],"mappings":"+HAgBA,IAAM,EAAkB,IAAI,QAWtB,EAAsB,GAAsC,CAChE,IAAM,EAAuB,CAAC,EAC1B,EAAoB,EAExB,KAAO,GACD,aAAgB,aAAa,EAAM,KAAK,CAAI,EAGhD,EAAO,EAAK,aAAe,aAAgB,WAAa,EAAK,KAAO,MAGtE,OAAO,CACT,EAMM,GAAuB,EAAiB,EAAsB,IAAmB,CACrF,IAAM,EAAM,EAAgB,IAAI,CAAE,GAAK,IAAI,IAMvC,EAAI,IAAI,CAAG,GAEX,GAAuC,EAAG,UAA1C,EAIJ,EAAI,IAAI,EAAK,CAAK,EAClB,EAAgB,IAAI,EAAI,CAAG,CAC7B,EAUa,GAAc,EAAsB,IAAmB,CAClE,EAAiB,EAAoB,SAAS,CAAC,CAAC,QAAS,EAAK,CAAK,CACrE,EAEM,EAAqB,OAAO,kBAAkB,EAG9C,EAAgB,IAAI,QAEpB,GAAkB,EAAsB,IAAwD,CACpG,IAAM,EAAQ,EAAmB,CAAO,EAExC,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAM,EAAgB,IAAI,CAAI,EAEpC,GAAI,GAAK,IAAI,CAAG,EAAG,OAAO,EAAI,IAAI,CAAG,CACvC,CAEA,OAAO,CACT,EAGM,GAAa,EAAqB,IAAwD,CAC9F,IAAI,EAAQ,EAAc,IAAI,CAAG,EAE5B,IACH,EAAQ,IAAI,IACZ,EAAc,IAAI,EAAK,CAAK,GAG9B,IAAM,EAAW,EAIjB,OAFK,EAAM,IAAI,CAAQ,GAAG,EAAM,IAAI,EAAU,EAAY,EAAI,QAAS,CAAG,CAAC,EAEpE,EAAM,IAAI,CAAQ,CAC3B,EAIA,SAAgB,EAAU,EAAsB,GAAG,EAA2B,CAC5E,IAAM,EAAQ,EAAO,EAAoB,QAAQ,EAAG,CAAG,EAIvD,OAFI,IAAU,EAA2B,EAAK,OAAS,EAAI,EAAK,GAAK,IAAA,GAE9D,CACT,CAEA,IAAa,EAAmB,GAA4B,CAC1D,IAAM,EAAM,EAAoB,cAAc,EACxC,EAAQ,EAAO,EAAK,CAAG,EAE7B,GAAI,IAAU,EAAoB,OAAO,EAEzC,MAAM,IAAI,EAAY,EAAW,mBAAmB,OAAO,CAAG,EAAG,EAAI,QAAQ,SAAS,CAAC,CACzF,EAEI,EAAsB,EAW1B,SAAgB,EAAiB,EAAuC,CAOtE,OAAO,OAAO,IAAI,eAAe,GAAe,aAAa,EAAE,KAAuB,CACxF"}
1
+ {"version":3,"file":"context.js","names":[],"sources":["../src/context.ts"],"sourcesContent":["/**\n * Component context injection API — `inject` / `injectStrict` / `provide` / `createContext`.\n *\n * Context values are stored on the providing element via a WeakMap registry and\n * resolved by walking up the DOM tree (including through shadow boundaries).\n * Providing is done via `provide(key, value)` inside `setup()`.\n *\n * Keys are `Symbol.for`-based (see `createContext`) so provide/inject still match\n * across a duplicated module graph — the same cross-copy survival rule as the\n * object brands in `utils/brand.ts`.\n */\n\nimport { warn } from './_dev';\nimport { ORE_ERRORS, OreApiError } from './errors';\nimport { onCleanup, type RuntimeContext, requireSetupContext } from './runtime';\n\nconst contextRegistry = new WeakMap<HTMLElement, Map<InjectionKey<unknown>, unknown>>();\n\nexport type InjectionKey<T> = symbol & {\n readonly __ore_injection_key?: T;\n};\n\n/**\n * Build a linear ancestor chain (including shadow host boundaries).\n * Walks `parentNode` (not `parentElement`) so non-HTML intermediate parents\n * (e.g. an `SVGElement` between child and provider) don't break the chain.\n */\nconst buildAncestorChain = (start: HTMLElement): HTMLElement[] => {\n const chain: HTMLElement[] = [];\n let node: Node | null = start;\n\n while (node) {\n if (node instanceof HTMLElement) chain.push(node);\n\n // A ShadowRoot's parentNode is null — hop to its host to keep walking.\n node = node.parentNode ?? (node instanceof ShadowRoot ? node.host : null);\n }\n\n return chain;\n};\n\n/**\n * Register a context value on a specific element.\n * @internal Backs the public `provide()` — do not call directly.\n */\nconst provideOnElement = <T>(el: HTMLElement, key: InjectionKey<T>, value: T): void => {\n const map = contextRegistry.get(el) ?? new Map<InjectionKey<unknown>, unknown>();\n\n // `inject()` memoizes its result per consumer (see resolvedCache below), so a\n // provider swapping the raw value after a descendant already read it would be\n // silently ignored downstream. Provide a `Readable` (signal/computed) instead\n // of a raw value so descendants observe updates through the value itself.\n if (map.has(key)) {\n warn(\n `provide(): key already provided on <${el.localName}> — overwriting. Provide a Readable to update it instead.`,\n );\n }\n\n map.set(key, value);\n contextRegistry.set(el, map);\n};\n\n/**\n * Register a context value on the current component's host element, making it\n * available to descendant components via `inject(key)`.\n *\n * Provide a `Readable` (signal/computed) rather than a raw value if descendants\n * need to observe later changes — `inject()` resolves and caches the value once\n * per consumer, so re-calling `provide()` with a new raw value later is not seen.\n */\nexport const provide = <T>(key: InjectionKey<T>, value: T): void => {\n const el = requireSetupContext('provide').element;\n\n provideOnElement(el, key, value);\n\n onCleanup(() => {\n const map = contextRegistry.get(el);\n\n if (!map) return;\n\n map.delete(key);\n\n if (map.size === 0) contextRegistry.delete(el);\n });\n};\n\nconst NOT_FOUND_SENTINEL = Symbol('inject.not_found');\n\n/** Per-setup-context cache: avoids repeated ancestor walks for the same key. */\nconst resolvedCache = new WeakMap<object, Map<InjectionKey<unknown>, unknown>>();\n\nconst walkAndFind = <T>(element: HTMLElement, key: InjectionKey<T>): T | typeof NOT_FOUND_SENTINEL => {\n const chain = buildAncestorChain(element);\n\n for (const node of chain) {\n const map = contextRegistry.get(node);\n\n if (map?.has(key)) return map.get(key) as T;\n }\n\n return NOT_FOUND_SENTINEL;\n};\n\n/** Cached ancestor-walk lookup shared by `inject()` and `injectStrict()`. */\nconst lookup = <T>(ctx: RuntimeContext, key: InjectionKey<T>): T | typeof NOT_FOUND_SENTINEL => {\n let cache = resolvedCache.get(ctx);\n\n if (!cache) {\n cache = new Map();\n resolvedCache.set(ctx, cache);\n }\n\n const cacheKey = key as InjectionKey<unknown>;\n\n if (!cache.has(cacheKey)) cache.set(cacheKey, walkAndFind(ctx.element, key));\n\n return cache.get(cacheKey) as T | typeof NOT_FOUND_SENTINEL;\n};\n\nexport function inject<T>(key: InjectionKey<T>): T | undefined;\nexport function inject<T>(key: InjectionKey<T>, fallback: T): T;\nexport function inject<T>(key: InjectionKey<T>, ...rest: [T?]): T | undefined {\n const found = lookup(requireSetupContext('inject'), key);\n\n if (found === NOT_FOUND_SENTINEL) return rest.length > 0 ? rest[0] : undefined;\n\n return found;\n}\n\nexport const injectStrict = <T>(key: InjectionKey<T>): T => {\n const ctx = requireSetupContext('injectStrict');\n const found = lookup(ctx, key);\n\n if (found !== NOT_FOUND_SENTINEL) return found;\n\n throw new OreApiError(ORE_ERRORS.injectStrictFailed(String(key), ctx.element.localName));\n};\n\nlet anonymousKeyCounter = 0;\n\n/**\n * Create a typed context key. `Symbol.for`-keyed (`ore:context:<description>`) so\n * a provider and an injector loaded from two bundled copies of ore still match\n * (see module header). Two `createContext('theme')` calls intentionally produce\n * the same key — use distinct descriptions for distinct contexts.\n *\n * Always pass a description: anonymous keys are minted from a per-graph counter,\n * so they do NOT survive duplicated module graphs (each copy numbers its own).\n */\nexport function createContext<T>(description?: string): InjectionKey<T> {\n if (description === undefined) {\n warn(\n 'createContext() called without a description — anonymous context keys do not survive duplicated module graphs.',\n );\n }\n\n return Symbol.for(`ore:context:${description ?? `anonymous-${++anonymousKeyCounter}`}`) as InjectionKey<T>;\n}\n"],"mappings":"8IAgBA,IAAM,EAAkB,IAAI,QAWtB,EAAsB,GAAsC,CAChE,IAAM,EAAuB,CAAC,EAC1B,EAAoB,EAExB,KAAO,GACD,aAAgB,aAAa,EAAM,KAAK,CAAI,EAGhD,EAAO,EAAK,aAAe,aAAgB,WAAa,EAAK,KAAO,MAGtE,OAAO,CACT,EAMM,GAAuB,EAAiB,EAAsB,IAAmB,CACrF,IAAM,EAAM,EAAgB,IAAI,CAAE,GAAK,IAAI,IAMvC,EAAI,IAAI,CAAG,GAEX,GAAuC,EAAG,UAA1C,EAIJ,EAAI,IAAI,EAAK,CAAK,EAClB,EAAgB,IAAI,EAAI,CAAG,CAC7B,EAUa,GAAc,EAAsB,IAAmB,CAClE,IAAM,EAAK,EAAoB,SAAS,CAAC,CAAC,QAE1C,EAAiB,EAAI,EAAK,CAAK,EAE/B,MAAgB,CACd,IAAM,EAAM,EAAgB,IAAI,CAAE,EAE7B,IAEL,EAAI,OAAO,CAAG,EAEV,EAAI,OAAS,GAAG,EAAgB,OAAO,CAAE,EAC/C,CAAC,CACH,EAEM,EAAqB,OAAO,kBAAkB,EAG9C,EAAgB,IAAI,QAEpB,GAAkB,EAAsB,IAAwD,CACpG,IAAM,EAAQ,EAAmB,CAAO,EAExC,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAM,EAAgB,IAAI,CAAI,EAEpC,GAAI,GAAK,IAAI,CAAG,EAAG,OAAO,EAAI,IAAI,CAAG,CACvC,CAEA,OAAO,CACT,EAGM,GAAa,EAAqB,IAAwD,CAC9F,IAAI,EAAQ,EAAc,IAAI,CAAG,EAE5B,IACH,EAAQ,IAAI,IACZ,EAAc,IAAI,EAAK,CAAK,GAG9B,IAAM,EAAW,EAIjB,OAFK,EAAM,IAAI,CAAQ,GAAG,EAAM,IAAI,EAAU,EAAY,EAAI,QAAS,CAAG,CAAC,EAEpE,EAAM,IAAI,CAAQ,CAC3B,EAIA,SAAgB,EAAU,EAAsB,GAAG,EAA2B,CAC5E,IAAM,EAAQ,EAAO,EAAoB,QAAQ,EAAG,CAAG,EAIvD,OAFI,IAAU,EAA2B,EAAK,OAAS,EAAI,EAAK,GAAK,IAAA,GAE9D,CACT,CAEA,IAAa,EAAmB,GAA4B,CAC1D,IAAM,EAAM,EAAoB,cAAc,EACxC,EAAQ,EAAO,EAAK,CAAG,EAE7B,GAAI,IAAU,EAAoB,OAAO,EAEzC,MAAM,IAAI,EAAY,EAAW,mBAAmB,OAAO,CAAG,EAAG,EAAI,QAAQ,SAAS,CAAC,CACzF,EAEI,EAAsB,EAW1B,SAAgB,EAAiB,EAAuC,CAOtE,OAAO,OAAO,IAAI,eAAe,GAAe,aAAa,EAAE,KAAuB,CACxF"}
package/dist/ore.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@vielzeug/ripple");var t=class e extends Error{constructor(e,t){super(e,t),this.name=new.target.name,Object.setPrototypeOf(this,new.target.prototype)}static is(t){return t instanceof e}},n=class extends t{},r=class extends t{},i=class extends t{component;phase;constructor(e,t){super(e,{cause:t.cause}),this.component=t.component,this.phase=t.phase}};function a(e,t){`${e.component}${e.phase}`,e.cause,t.dispatchEvent(new CustomEvent(`ore:error`,{bubbles:!0,composed:!0,detail:e}))}var o={asyncSetupUnsupported:`setup() must return an HTMLResult or null; use reactive state for asynchronous work`,defineDuplicate:e=>`define('${e}') called twice — custom element already registered`,defineFieldRequiresFormAssociated:e=>`useField() requires define('${e}', { formAssociated: true })`,defineRequiresTag:`define() requires a tag name`,eachDuplicateKey:(e,t)=>`each() received duplicate key "${e}" at index ${t}`,eventModifiersUnsupported:e=>`@${e}: event modifiers are unsupported; call native event methods in the handler instead`,injectStrictFailed:(e,t)=>`injectStrict() could not resolve key "${e}" in <${t}>`,invariantViolated:e=>`invariant violated: ${e}`,lifecycleOutsideSetup:`Lifecycle hooks must be called during component setup`,listenNullTarget:e=>`listen() called with a null/undefined target for event "${e}" — listener not attached`,propInvalidReflect:`Structured props cannot use reflect:true — use prop.json() with reflect:false`,templateInterpolationInTag:"html`...`: interpolations inside a tag must be named attributes, boolean attributes, events, or refs",useFieldAlreadyCalled:e=>`useField() was already called on <${e}>. Call it only once per component.`,validationFailed:(e,t)=>`Validation failed for <${e}>:\n${t.join(`
2
- `)}`};function s(e,t){if(!e)throw new r(o.invariantViolated(t))}var c=t=>typeof t==`function`?t():(0,e.isReactive)(t)?t.value:t,l=/[;{}]/g,u=e=>e.replace(l,``),d=e=>{for(let t=e.length-1;t>=0;t--)e[t]?.()},f=e=>{for(let t of e)t.remove()},p=()=>{let e=[],t=[];return{clear(){d(t),f(e),t=[],e=[]},get nodes(){return e},registerCleanup(e){t.push(e)},setNodes(t){e=t}}},m=new Set([`action`,`cite`,`codebase`,`data`,`formaction`,`href`,`manifest`,`ping`,`poster`,`src`,`xlink:href`]),h=/^\s*(?:(?:javascript|vbscript|blob):|data:(?:[^,]*\/(?:html|svg\+xml)|application\/(?:xhtml|xml)))/i,g=(e,t,n)=>{let r=t.toLowerCase();if(/^on[a-z]/i.test(t)){`${t}${t.slice(2)}`,e.removeAttribute(t);return}if(r===`srcdoc`){e.removeAttribute(t);return}if(n==null||n===!1){e.removeAttribute(t);return}let i=n===!0?`true`:String(n);if(m.has(r)&&h.test(i)){`${t}`,e.removeAttribute(t);return}e.setAttribute(t,i)},_=(e,t,n,r)=>{if(!e)return o.listenNullTarget(t),()=>{};let i=n;return e.addEventListener(t,i,r),()=>e.removeEventListener(t,i,r)},v=e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),y=e=>Array.isArray(e)||typeof e==`object`&&!!e,b=null,x=e=>({element:e,formResetCallbacks:[],mountCallbacks:[]}),S=0,ee=()=>{S++;let e=!1;return()=>{e||(e=!0,S--)}},C=(e,t)=>{let n=b;b=e;try{return t()}finally{b=n}},w=e=>{if(b)return b;throw new n(`${e}: ${o.lifecycleOutsideSetup}`)},T=()=>w(`getHost`).element,E=t=>b?((0,e.effect)(()=>t),!0):!1,D=e=>{if(!E(e))throw new n(`onCleanup: ${o.lifecycleOutsideSetup}`)},te=e=>{w(`onMounted`).mountCallbacks.push(e)},O=e=>{w(`onFormReset`).formResetCallbacks.push(e)},k=t=>{let n=(0,e.effect)(t),r=()=>n.dispose();return E(r),r};function ne(e,t,n,r){if(w(`onEvent`),!e)return;let i=_(e,t,n,r);E(i)||i()}var re=(e,t)=>k(()=>{let n=e.value;if(n)return t(n)}),A=new WeakMap,ie=e=>{let t=[],n=e;for(;n;)n instanceof HTMLElement&&t.push(n),n=n.parentNode??(n instanceof ShadowRoot?n.host:null);return t},ae=(e,t,n)=>{let r=A.get(e)??new Map;r.has(t)&&`${e.localName}`,r.set(t,n),A.set(e,r)},oe=(e,t)=>{ae(w(`provide`).element,e,t)},j=Symbol(`inject.not_found`),se=new WeakMap,ce=(e,t)=>{let n=ie(e);for(let e of n){let n=A.get(e);if(n?.has(t))return n.get(t)}return j},le=(e,t)=>{let n=se.get(e);n||(n=new Map,se.set(e,n));let r=t;return n.has(r)||n.set(r,ce(e.element,t)),n.get(r)};function ue(e,...t){let n=le(w(`inject`),e);return n===j?t.length>0?t[0]:void 0:n}var de=e=>{let t=w(`injectStrict`),r=le(t,e);if(r!==j)return r;throw new n(o.injectStrictFailed(String(e),t.element.localName))},fe=0;function pe(e){return Symbol.for(`ore:context:${e??`anonymous-${++fe}`}`)}function me(e){return{default:e,parse:()=>e,reflect:!1}}var he={bool(e){return{default:e??!1,parse:e=>e!==null&&e!==`false`,reflect:!0}},data(e){return me(e)},json(e){return{default:e,parse:t=>{if(t==null||t===``)return e;try{return JSON.parse(t)}catch{return e}},reflect:!1}},number(e){let t=e===void 0?void 0:e;return{default:t,parse:e=>{if(e==null)return t;let n=Number(e);return Number.isNaN(n)?(`${e}${String(t)}`,t):n},reflect:!0}},oneOf(e,t){return{default:t,parse:n=>n!=null&&e.includes(n)?n:t,reflect:!0}},string(e){let t=e===void 0?void 0:e;return{default:t,parse:e=>e??t,reflect:!0}}},ge=e=>typeof e==`object`&&!!e&&`default`in e&&`parse`in e;function M(e,t){if(!ge(e))throw new n(`Prop "${t}" must use a prop.* helper (string/number/bool/json/oneOf). Received: ${typeof e}`);let r=e;if(!r.parse)throw new n(`Prop "${t}" must have a parse function. Use prop.* helpers.`);let i=r.reflect??!1;if(i&&y(r.default))throw new n(`Prop "${t}": ${o.propInvalidReflect}`);return{...r,reflect:i}}function _e(e){let t=[];for(let[n,r]of Object.entries(e))try{M(r,n)}catch(e){t.push(e instanceof Error?e.message:String(e))}return t}var N=new WeakMap,P=(e,t)=>N.get(e)?.get(t),F=(e,t)=>typeof e==`string`?t(e):e,ve=(t,n,r,i)=>{let a=N.get(t);a||(a=new Map,N.set(t,a));let{default:o,parse:s,reflect:c=!1}=i,l=(0,e.signal)(o),u=Object.hasOwn(t,n),d=u?t[n]:void 0,f={parse:s,reflect:c,signal:l};return u?(delete t[n],l.value=F(d,s)):t.hasAttribute(r)&&(l.value=s(t.getAttribute(r))),a.set(r,f),Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get:()=>l.value,set:e=>{l.value=F(e,s)}}),c&&k(()=>{let e=l.value;e==null?t.removeAttribute(r):typeof e==`boolean`?t.toggleAttribute(r,e):g(t,r,e)}),l};function ye(e,t){let n={};for(let[r,i]of Object.entries(t))n[r]=ve(e,r,v(r),i);return n}var I=e=>{let t=Symbol.for(e);return{is:e=>typeof e==`object`&&!!e&&t in e,stamp:e=>Object.assign(e,{[t]:!0})}},L=I(`ore:css-result`),be=L.is,xe=function(){return this.content},Se=(e,...t)=>{let n=``;for(let r=0;r<e.length;r++)if(n+=e[r],r<t.length){let e=t[r];n+=be(e)?e.content:String(e)}return L.stamp({content:n.trim(),toString:xe})},R=new Map,Ce=256,we=e=>{if(e instanceof CSSStyleSheet)return e;let t=typeof e==`string`?e:e.content,n=R.get(t);if(n)return R.delete(t),R.set(t,n),n;let r=new CSSStyleSheet;try{r.replaceSync(t)}catch{return r}if(R.set(t,r),R.size>Ce){let e=R.keys().next().value;e!==void 0&&R.delete(e)}return r},z={SETUP_DONE:`setup_done`,SETUP_RUNNING:`setup_running`,UNINITIALIZED:`uninitialized`,UNMOUNTED:`unmounted`},B={CONNECT:`ore:connect`,DISCONNECT:`ore:disconnect`},Te=()=>({formResetCallbacks:[],generation:0,mountCallbacks:[],phase:z.UNINITIALIZED,scope:(0,e.createScope)(),templateResult:null}),Ee=e=>(typeof e==`object`||typeof e==`function`)&&e!==null&&`then`in e&&typeof e.then==`function`,De=class extends HTMLElement{static _definition;static _normalizedPropDefs;static formAssociated=!1;static observedAttributes=[];_component;constructor(){super();let e=this.constructor._definition;e?.shadow!==!1&&this.attachShadow({mode:`open`,...e?.shadow}),this._component=Te()}connectedCallback(){(0,e.untrack)(()=>{this._component.phase===z.UNINITIALIZED&&this._runSetup(),this._init()}),this.dispatchEvent(new CustomEvent(B.CONNECT,{bubbles:!1,composed:!1}))}attributeChangedCallback(t,n,r){if(n===r)return;let i=P(this,t);if(!i)return;let a=i.parse(r);Object.is((0,e.untrack)(()=>i.signal.value),a)||(i.signal.value=a)}disconnectedCallback(){this._component.generation++,this._component.phase=z.UNMOUNTED,this.dispatchEvent(new CustomEvent(B.DISCONNECT,{bubbles:!1,composed:!1})),this._resetSetupState()}_resetSetupState(){this._component.scope.dispose(),this._component.formResetCallbacks=[],this._component.mountCallbacks=[],this._component.phase=z.UNINITIALIZED,this._component.scope=(0,e.createScope)(),this._component.templateResult=null}formResetCallback(){for(let e of this._component.formResetCallbacks)try{e()}catch(e){this._reportLifecycleError(e,`form-reset`)}}_reportLifecycleError(e,t){let n=e instanceof Error?e:Error(String(e));a(new i(`<${this.localName}> failed during ${this._component.phase} (${t})`,{cause:n,component:this.localName,phase:t}),this)}_runSetup(){this._component.phase=z.SETUP_RUNNING;let e=this.constructor._definition,t=this.constructor._normalizedPropDefs,r=x(this);try{let i;if(this._component.scope.run(()=>{i=C(r,()=>{let n=t?ye(this,t):{};return e.setup(n)})}),this._component.mountCallbacks.push(...r.mountCallbacks),this._component.formResetCallbacks.push(...r.formResetCallbacks),Ee(i))throw new n(o.asyncSetupUnsupported);this._component.templateResult=i??null,this._component.phase=z.SETUP_DONE}catch(e){throw this._reportLifecycleError(e,`setup`),this._resetSetupState(),e}}_isStale(e){return this._component.generation!==e||!this.isConnected}_applyResult(e){if(!e)return;let t=this.shadowRoot??this,n=x(this);t.replaceChildren(),this._component.scope.run(()=>{C(n,()=>{e.mount(t,null,D)})})}_init(){this._applyStyles(),this._mountTemplate(),this._component.phase===z.SETUP_DONE&&this._scheduleMountCallbacks()}_applyStyles(){let e=this.constructor._definition;this.shadowRoot&&e?.styles?.length&&(this.shadowRoot.adoptedStyleSheets=e.styles.map(we))}_mountTemplate(){let e=this._component.templateResult;e&&this._applyResult(e)}_scheduleMountCallbacks(){if(this._component.mountCallbacks.length===0)return;let e=this._component.generation,t=ee();queueMicrotask(()=>{try{if(this._isStale(e))return;let t=this._component.mountCallbacks.splice(0);for(let e=0;e<t.length;e++){let n=t[e];try{let e=x(this);this._component.scope.run(()=>{C(e,()=>{let e=n();typeof e==`function`&&D(e)})}),e.mountCallbacks.length>0&&t.push(...e.mountCallbacks),e.formResetCallbacks.length>0&&this._component.formResetCallbacks.push(...e.formResetCallbacks)}catch(e){this._reportLifecycleError(e,`mounted`)}}}finally{t()}})}};function Oe(e,t){let{props:r}=t,i=(()=>{if(!r)return;let t=_e(r);if(t.length>0)throw new n(o.validationFailed(e,t));let i={};for(let[e,t]of Object.entries(r))i[e]=M(t,e);return i})(),a=i?Object.keys(i).map(v):[];return class extends De{static _definition=t;static _normalizedPropDefs=i;static formAssociated=t.formAssociated??!1;static observedAttributes=a}}function ke(e,t){if(!e)throw new n(o.defineRequiresTag);if(customElements.get(e))throw new n(o.defineDuplicate(e));let r=Oe(e,t);Object.defineProperty(r,"name",{value:e}),customElements.define(e,r)}var Ae=t=>(0,e.computed)(()=>Object.entries(t).filter(([,e])=>c(e)).map(([e])=>e.replace(/\s+/g,``)).filter(Boolean).join(` `));function je(){return(0,e.signal)(null)}var V=I(`ore:directive`),H=e=>V.stamp({mount:e}),Me=V.is,U=I(`ore:html-result`),W=U.is;function Ne(e,t){return U.stamp({apply:t,fragment:e,mount:(n,r,i)=>{let a=Array.from(e.childNodes);return n.insertBefore(e,r),t(i),a}})}var Pe=(t,n,r,i,a)=>{let o=(0,e.signal)(t),s=(0,e.signal)(n),c=(0,e.createScope)(),l=[],u=[];return c.run(()=>{u=r(o,s).mount(i,a,e=>l.push(e))}),{cleanups:l,data:o,index:s,key:``,nodes:u,scope:c}},G=e=>{e.scope.dispose(),d(e.cleanups),f(e.nodes)},Fe=(t,r,i,a,s,c)=>{let l=[],u=new Set;for(let e=0;e<r.length;e++){let t=String(i(r[e],e));if(u.has(t))throw new n(o.eachDuplicateKey(t,e));u.add(t),l.push(t)}for(let[e,n]of t)u.has(e)||(G(n),t.delete(e));let d=[];for(let n=0;n<r.length;n++){let i=l[n],o=t.get(i);if(o)(0,e.batch)(()=>{o.data.value=r[n],o.index.value=n}),d.push(o);else{let o=(0,e.untrack)(()=>Pe(r[n],n,a,s,c));o.key=i,t.set(i,o),d.push(o)}}let f=c;for(let e=d.length-1;e>=0;e--){let t=d[e],n=t.nodes[0];if(n&&n!==f.previousSibling)for(let e of t.nodes)s.insertBefore(e,f);f=n??f}return d};function Ie(t,n,r,o){let c=Array.isArray(t)?(0,e.signal)(t):typeof t==`function`?(0,e.computed)(t):t;return H((t,l)=>{let u=t.parentNode;s(u,`each() anchor comment has no parent node`);let p=document.createComment(`each/end`);u.insertBefore(p,t.nextSibling);let m=new Map,h=[],g=null,_=[],v=()=>{o&&(g=o().mount(u,p,e=>_.push(e)))},y=()=>{g&&(d(_),f(g),g=null,_=[])},b=(0,e.effect)(()=>{let o=c.value??[];if(o.length===0){for(let t of(0,e.untrack)(()=>h))G(t);m=new Map,h=[],g||(0,e.untrack)(v);return}y();try{h=(0,e.untrack)(()=>Fe(m,o,n,r,u,p))}catch(e){let n=e instanceof Error?e:Error(String(e));a(new i(`each() failed to reconcile a list update: ${n.message}`,{cause:n,component:`each()`,phase:`each-reconcile`}),t);for(let e of m.values())G(e);m=new Map,h=[]}});l(()=>b.dispose()),l(()=>{y();for(let e of h)G(e);p.remove()})})}var K=I(`ore:live`),Le=e=>K.stamp({source:e}),Re=K.is,ze=e=>{let t=c(e);return t==null||t===!1?``:u(String(t))},Be=t=>(0,e.computed)(()=>{let e=[];for(let[n,r]of Object.entries(t)){let t=ze(r);if(!t)continue;let i=u(v(n));i&&e.push(`${i}:${t}`)}return e.join(`;`)}),q=(e,t,n)=>{let r=document.createElement(`template`);r.innerHTML=e;let i=Array.from(r.content.cloneNode(!0).childNodes);for(let e of i)t.insertBefore(e,n);return i};function Ve(t){if(typeof t==`function`){let n=(0,e.computed)(t);return H((e,t)=>{Ve(n).mount(e,t)})}return H((n,r)=>{let i=n.parentNode;s(i,`unsafeHtml() anchor comment has no parent node`);let a=document.createComment(`unsafe-html/end`);if(i.insertBefore(a,n.nextSibling),(0,e.isReactive)(t)){let n=p(),o=t,s=(0,e.effect)(()=>{n.clear(),n.setNodes(q(o.value,i,a))});r(()=>s.dispose()),r(()=>{n.clear(),a.remove()})}else q(t,i,a),r(()=>a.remove())})}var He=`when() anchor comment has no parent node`;function Ue(t,n,r){return typeof t!=`function`&&!(0,e.isReactive)(t)?H((e,i)=>{let a=t?n():r?r():null;if(!a||!W(a))return;let o=e.parentNode;s(o,He);let c=a.mount(o,e,i);i(()=>f(c))}):H((i,a)=>{let o=(typeof t==`function`?(0,e.computed)(t):null)??t,c=i.parentNode;s(c,He);let l=document.createComment(`when/end`);c.insertBefore(l,i.nextSibling);let u=p(),d=(0,e.effect)(()=>{let t=o.value;u.clear();let i=t?n():r?r():null;!i||!W(i)||u.setNodes((0,e.untrack)(()=>i.mount(c,l,u.registerCleanup)))});a(()=>d.dispose()),a(()=>{u.clear(),l.remove()})})}var We=new WeakMap,J=new WeakSet,Ge=e=>{let t=e.el??T();if(!t.constructor.formAssociated)throw new n(o.defineFieldRequiresFormAssociated(t.localName));if(J.has(t))throw new n(o.useFieldAlreadyCalled(t.localName));let r=We.get(t)??t.attachInternals();We.set(t,r),J.add(t),D(()=>J.delete(t));let i=e.toFormValue??(t=>t==null?e.emptyStringForNull?``:null:t instanceof File||t instanceof FormData?t:String(t));k(()=>{r.setFormValue(i(e.value.value))});let a=e.disabled;if(a&&`states`in r){let e=r.states;k(()=>{a.value?e.add(`disabled`):e.delete(`disabled`)})}return e.validity&&k(()=>{let t=e.validity?.value??{},n=Object.values(t).some(Boolean),i=e.validationMessage?.value??``;if(n&&!i){r.setValidity(t,`Invalid value.`);return}r.setValidity(t,i)}),e.onReset&&O(e.onReset),{checkValidity:()=>r.checkValidity(),internals:r,reportValidity:()=>r.reportValidity(),setCustomValidity:e=>e?r.setValidity({customError:!0},e):r.setValidity({})}},Ke=e=>e===`role`||e.startsWith(`aria-`)?e:e.startsWith(`aria`)?`aria-${e.slice(4).toLowerCase()}`:`aria-${e}`,qe=e=>e===`role`||e.startsWith(`aria-`)?e:e.startsWith(`aria`)?`aria-${e.slice(4).toLowerCase()}`:e,Je=(e,t)=>{let n=t?.target??T(),r=[];if(e.attr)for(let[t,i]of Object.entries(e.attr)){let e=Ze(n,Ye(t),i);e&&r.push(e)}if(e.aria)for(let[t,i]of Object.entries(e.aria)){let e=Ze(n,Ke(t),i);e&&r.push(e)}if(e.class&&r.push($e(n,e.class)),e.style)for(let[t,i]of Object.entries(e.style)){let e=Qe(n,t,i);e&&r.push(e)}if(e.on){let{target:i,...a}=t??{};for(let t of Object.keys(e.on)){let i=e.on[t];i&&r.push(_(n,t,i,a))}}let i=()=>{for(let e of r)e()};return E(i),i},Ye=qe,Xe=(t,n)=>{if(typeof t==`function`)return k(()=>{n(t())});if((0,e.isReactive)(t))return k(()=>{n(t.value)});n(t)};function Ze(e,t,n){return Xe(n,n=>g(e,t,n))}function Qe(e,t,n){let r=u(t.startsWith(`--`)?t:v(t));if(!r)return;let i=!1;return Xe(n,t=>{t!=null&&t!==``?(i=!0,e.style.setProperty(r,u(String(t)))):i&&e.style.removeProperty(r)})}function $e(e,t){let n=typeof t==`function`?t:()=>{let e={};for(let[n,r]of Object.entries(t))e[n]=c(r);return e},r=new Set;return k(()=>{let t=new Set;for(let[i,a]of Object.entries(n()))a&&(t.add(i),r.has(i)||e.classList.add(i));for(let n of r)t.has(n)||e.classList.remove(n);r=t})}var et=(t,n)=>{let r=(0,e.signal)(null),i=new IntersectionObserver(([e])=>{e&&(r.value=e)},n);return i.observe(t),D(()=>i.disconnect()),r},tt=t=>{let n=window.matchMedia(t),r=(0,e.signal)(n.matches),i=e=>{r.value=e.matches};return n.addEventListener(`change`,i),D(()=>n.removeEventListener(`change`,i)),r},nt=(t,n={attributes:!0,characterData:!0,childList:!0,subtree:!0})=>{let r=(0,e.signal)({entries:[],latest:null}),i=new MutationObserver(e=>{r.value={entries:e,latest:e.length>0?e[e.length-1]:null}});return i.observe(t,n),D(()=>i.disconnect()),r},rt=t=>{let n=(0,e.signal)({height:0,width:0}),r=new ResizeObserver(([e])=>{if(!e)return;let t=e.contentBoxSize[0];t&&(n.value={height:t.blockSize,width:t.inlineSize})});return r.observe(t),D(()=>r.disconnect()),n},it=`default`,Y=e=>e||it,at=t=>{let n=new Map,r=new Map,i=new Map,a=t=>{let r=n.get(t);return r||(r={elements:(0,e.signal)([]),presence:(0,e.signal)(!1)},n.set(t,r)),r},o=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},s=e=>{let t=Y(e),n=r.get(t),i=[];if(n)for(let e of n)i.push(...e.assignedElements({flatten:!0}));let s=a(t);o(s.elements.value,i)||(s.elements.value=i);let c=i.length>0;s.presence.value!==c&&(s.presence.value=c)},c=e=>{if(i.has(e))return;let t=Y(e.getAttribute(`name`)),n=r.get(t)??new Set;n.add(e),r.set(t,n);let a=()=>s(t);e.addEventListener(`slotchange`,a),i.set(e,()=>{e.removeEventListener(`slotchange`,a)}),s(t)},l=e=>{let t=i.get(e);if(!t)return;t(),i.delete(e);let n=Y(e.getAttribute(`name`)),a=r.get(n);a&&(a.delete(e),a.size===0&&r.delete(n)),s(n)},u=()=>{t.shadowRoot?.querySelectorAll(`slot`).forEach(e=>c(e))},d=()=>{for(let e of r.keys())s(e)},f=null;return te(()=>{u(),d(),!f&&t.shadowRoot&&(f=new MutationObserver(e=>{for(let t of e)for(let e of t.removedNodes)e instanceof HTMLSlotElement&&l(e);u(),i.size>0&&d()}),f.observe(t.shadowRoot,{childList:!0,subtree:!0}))}),D(()=>{f?.disconnect(),f=null;for(let e of i.values())e();i.clear(),r.clear(),n.clear(),X.delete(t)}),{elements:e=>a(Y(e)).elements,has:e=>a(Y(e)).presence}},X=new WeakMap,ot=()=>{let e=w(`useSlots`),t=X.get(e.element);return t||(t=at(e.element),X.set(e.element,t)),t},st=(t,n,r)=>{let i=(0,e.effect)(()=>{n(t.value)});r(()=>i.dispose())},ct=e=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement,lt=e=>e instanceof HTMLInputElement&&(e.type===`checkbox`||e.type===`radio`),ut=(e,t,n,r={last:void 0})=>{let i=lt(e),a=i?!!t:t==null?``:String(t),o=i?e.checked:e.value;n&&r.last!==void 0&&!Object.is(o,r.last)&&!Object.is(o,a)||(i?e.checked=a:e.value=a,n&&(r.last=a))},dt=(t,n,r,i)=>{let a=y(i)?i:n.parse(r.mode===`bool`?i?``:null:i==null||i===!1?null:String(i));if(Object.is((0,e.untrack)(()=>n.signal.value),a)||(n.signal.value=a),!n.reflect){if(y(i))return;r.mode===`bool`?t.toggleAttribute(r.name,!!i):g(t,r.name,i)}},ft=(t,n)=>{let{el:r,mode:i,name:a,propMeta:o}=t,s={last:void 0},c=n=>{if(o){dt(r,o,t,n);return}if(!(0,e.isReactive)(n)&&y(n)){a!==`__proto__`&&a!==`constructor`&&a!==`prototype`&&(r[a]=n);return}if(a===`value`&&ct(r)||a===`checked`&&r instanceof HTMLInputElement){ut(r,n,t.live,s);return}i===`bool`?r.toggleAttribute(a,!!n):g(r,a,n)};`signal`in t?st(t.signal,c,n):c(t.value)},pt=(e,t)=>{t(_(e.el,e.name,e.handler))},mt=(e,t)=>{let{el:n,ref:r}=e;if(typeof r==`function`){r(n),t(()=>r(null));return}r.value=n,t(()=>{r.value=null})},ht=(e,t,n)=>{let r=[],i=t.parentNode;s(i,`html binding anchor has no parent node`);for(let a of e)if(W(a)){let e=Array.from(a.fragment.childNodes);i.insertBefore(a.fragment,t),a.apply(n),r.push(...e)}else if(a!=null&&a!==!1){let e=document.createTextNode(String(a));i.insertBefore(e,t),r.push(e)}return r},gt=(t,n)=>{let{anchor:r,signal:i}=t,a=p(),o=(0,e.effect)(()=>{let t=i.value;a.clear(),t!=null&&t.length!==0&&(0,e.untrack)(()=>{a.setNodes(ht(t,r,a.registerCleanup))})});n(()=>{o.dispose(),a.clear()})},_t=(e,t)=>{e.directive.mount(e.anchor,t)},vt=(e,t)=>{switch(e.type){case`attr`:ft(e,t);break;case`directive`:_t(e,t);break;case`event`:pt(e,t);break;case`html`:gt(e,t);break;case`ref`:mt(e,t)}},yt=(t,n,r,i)=>{let a=P(t,r);return Re(i)?{el:t,live:!0,mode:n,name:r,propMeta:a,signal:i.source,type:`attr`}:typeof i==`function`?{el:t,mode:n,name:r,propMeta:a,signal:(0,e.computed)(i),type:`attr`}:(0,e.isReactive)(i)?{el:t,mode:n,name:r,propMeta:a,signal:i,type:`attr`}:{el:t,mode:n,name:r,propMeta:a,type:`attr`,value:i}},bt=e=>e==null?``:String(e),Z={ATTR:`attr`,BOOL_ATTR:`boolAttr`,EVENT:`event`,NODE:`node`,REF:`ref`},xt=/\s+@([a-zA-Z_][-a-zA-Z0-9_.-]*)\s*=\s*["']?$/,St=/\s+ref\s*=\s*["']?$/,Ct=/\s+\?([a-zA-Z_][-a-zA-Z0-9_]*)\s*=\s*["']?$/,wt=/\s+([a-zA-Z_][-a-zA-Z0-9_]*)\s*=\s*["']?$/,Tt=e=>{let t;if(t=xt.exec(e)){let r=e.slice(0,-t[0].length),[i,...a]=t[1].split(`.`);if(a.length>0)throw new n(o.eventModifiersUnsupported(t[1]));return{kind:Z.EVENT,name:i,prefix:r}}if(t=St.exec(e))return{kind:Z.REF,prefix:e.slice(0,-t[0].length)};if(t=Ct.exec(e))return{kind:Z.BOOL_ATTR,name:t[1],prefix:e.slice(0,-t[0].length)};if(t=wt.exec(e))return{kind:Z.ATTR,name:t[1],prefix:e.slice(0,-t[0].length)};let r=e.lastIndexOf(`<`);if(r>e.lastIndexOf(`>`)&&e[r+1]!==`/`)throw new n(o.templateInterpolationInTag);return{kind:Z.NODE,prefix:e}},Et=new WeakMap,Dt=/[@?]?[a-zA-Z_][-a-zA-Z0-9_.]*\s*=\s*$/,Ot=e=>{let t=Array.from(e),n=!1;for(let e=0;e<t.length-1;e++){let r=t[e],i=r[r.length-1];for(let e of r)e===`<`?n=!0:e===`>`&&(n=!1);if((i===`"`||i===`'`)&&n&&Dt.test(r.slice(0,-1))){t[e]=r.slice(0,-1);let n=t[e+1];n.startsWith(i)&&(t[e+1]=n.slice(1))}}return t},Q=`data-ore-b`,kt=/^ore:(\d+)$/,At=(e,t,n,r)=>{if(e.nodeType===Node.ELEMENT_NODE){let r=e,i=r.getAttribute(Q);i!==null&&(n.set(Number(i),[...t]),r.removeAttribute(Q))}else if(e.nodeType===Node.COMMENT_NODE){let n=e.nodeValue,i=n===null?null:kt.exec(n);i&&r.set(Number(i[1]),[...t])}let i=e.childNodes;for(let e=0;e<i.length;e++)At(i[e],[...t,e],n,r)},jt=e=>{let t=Ot(e),n=``,r,i=0,a=0,o=[];for(let e=0;e<t.length-1;e++){let s=t[e],c=Tt(s);if(c.kind===Z.NODE)n+=`${c.prefix}<!--ore:${a}-->`,o.push({commentId:a,kind:Z.NODE}),a++,r=void 0;else{r===void 0||c.prefix.lastIndexOf(`<`)>c.prefix.lastIndexOf(`>`)?(r=i++,n+=`${c.prefix} ${Q}="${r}"`):n+=c.prefix;let e=c.kind===Z.BOOL_ATTR?`bool`:c.kind===Z.ATTR?`attr`:void 0;o.push({elementId:r,kind:c.kind,mode:e,name:c.name})}}n+=t[t.length-1]??``;let s=document.createElement(`template`);s.innerHTML=n;let c=new Map,l=new Map,u=s.content.childNodes;for(let e=0;e<u.length;e++)At(u[e],[e],c,l);return{commentPaths:l,element:s,elementPaths:c,slots:o}},Mt=e=>{let t=Et.get(e);return t||(t=jt(e),Et.set(e,t)),t},Nt=(e,t)=>{let n=e;for(let e of t)n=n.childNodes[e];return n},Pt="html`...`: node-slot comment anchor has no parent node",Ft=e=>Array.isArray(e)?e:[e],It=(e,t,n)=>{let r=t.parentNode;for(s(r,Pt);e.fragment.firstChild;)r.insertBefore(e.fragment.firstChild,t);n.push(e.apply.bind(e))},Lt=(t,n)=>{let r=Mt(t),i=r.element.content.cloneNode(!0),a=[],o=[],c=r.slots.map((e,t)=>{let a=n[t];if(e.kind===Z.NODE){let t=e.commentId===void 0?void 0:r.commentPaths.get(e.commentId);return s(t,`compiled template is missing a comment path for node slot ${e.commentId}`),{comment:Nt(i,t),slot:e,value:a}}let o=e.elementId===void 0?void 0:r.elementPaths.get(e.elementId);return s(o,`compiled template is missing an element path for slot ${e.elementId}`),{el:Nt(i,o),slot:e,value:a}});for(let{comment:t,el:n,slot:r,value:i}of c){if(r.kind===Z.NODE){let n=t;if(s(n,`compiled template produced a node slot without a comment anchor`),Me(i)){a.push({anchor:n,directive:i,type:`directive`});continue}if(W(i)){It(i,n,o),n.remove();continue}if(typeof i==`function`||(0,e.isReactive)(i)){let t=typeof i==`function`?(0,e.computed)(()=>Ft(i())):(0,e.computed)(()=>Ft(i.value));a.push({anchor:n,signal:t,type:`html`});continue}if(Array.isArray(i)){for(let e of i)if(W(e))It(e,n,o);else{let t=n.parentNode;s(t,Pt),t.insertBefore(document.createTextNode(bt(e)),n)}n.remove();continue}n.replaceWith(document.createTextNode(bt(i)));continue}if(s(n,`compiled template produced an element slot without an element`),r.kind===Z.EVENT){let t=r.name;if(s(t,`compiled template produced an event slot without an event name`),typeof i==`function`)a.push({el:n,handler:i,name:t,type:`event`});else if((0,e.isReactive)(i)){let e=i;a.push({el:n,handler:t=>{let n=e.value;typeof n==`function`&&n(t)},name:t,type:`event`})}continue}if(r.kind===Z.REF){i&&a.push({el:n,ref:i,type:`ref`});continue}s(r.name,`compiled template produced an attr slot without an attribute name`),a.push(yt(n,r.mode??`attr`,r.name,i))}return Ne(i,e=>{for(let t of a)vt(t,e);for(let t of o)t(e)})},Rt=(e,...t)=>Lt(e,t),zt={bubbles:!0,cancelable:!0,composed:!1},Bt=()=>{let e=T();return((t,...n)=>{let r=n.length>0?{...zt,detail:n[0]}:zt;return e.dispatchEvent(new CustomEvent(String(t),r))})},Vt=0,$=0,Ht=Math.random().toString(36).slice(2,6),Ut=(e=`id`)=>`${e}-${++Vt}`,Wt=(e=`id`)=>`${e}-${Ht}${++$}`,Gt=()=>{$=0};exports.OreApiError=n,exports.OreError=t,exports.OreInternalError=r,exports.OreLifecycleError=i,exports.bind=Je,exports.classMap=Ae,exports.createContext=pe,exports.createId=Ut,exports.createStableId=Wt,exports.css=Se,exports.define=ke,exports.each=Ie,exports.getHost=T,exports.html=Rt,exports.inject=ue,exports.injectStrict=de,exports.intersectionObserver=et,exports.live=Le,exports.mediaObserver=tt,exports.mutationObserver=nt,exports.onCleanup=D,exports.onElement=re,exports.onEvent=ne,exports.onFormReset=O,exports.onMounted=te,exports.prop=he,exports.provide=oe,exports.ref=je,exports.resetStableIdCounter=Gt,exports.resizeObserver=rt,exports.styleMap=Be,exports.unsafeHtml=Ve,exports.useEmit=Bt,exports.useField=Ge,exports.useSlots=ot,exports.watchEffect=k,exports.when=Ue;
2
+ `)}`};function s(e,t){if(!e)throw new r(o.invariantViolated(t))}var c=t=>typeof t==`function`?t():(0,e.isReactive)(t)?t.value:t,l=/[;{}]/g,u=e=>e.replace(l,``),d=e=>{for(let t=e.length-1;t>=0;t--)e[t]?.()},f=e=>{for(let t of e)t.remove()},p=()=>{let e=[],t=[];return{clear(){d(t),f(e),t=[],e=[]},get nodes(){return e},registerCleanup(e){t.push(e)},setNodes(t){e=t}}},m=new Set([`action`,`cite`,`codebase`,`data`,`formaction`,`href`,`manifest`,`ping`,`poster`,`src`,`xlink:href`]),h=/^\s*(?:(?:javascript|vbscript|blob):|data:(?:[^,]*\/(?:html|svg\+xml)|application\/(?:xhtml|xml)))/i,g=(e,t,n)=>{let r=t.toLowerCase();if(/^on[a-z]/i.test(t)){`${t}${t.slice(2)}`,e.removeAttribute(t);return}if(r===`srcdoc`){e.removeAttribute(t);return}if(n==null||n===!1){e.removeAttribute(t);return}let i=n===!0?`true`:String(n);if(m.has(r)&&h.test(i)){`${t}`,e.removeAttribute(t);return}e.setAttribute(t,i)},_=(e,t,n,r)=>{if(!e)return o.listenNullTarget(t),()=>{};let i=n;return e.addEventListener(t,i,r),()=>e.removeEventListener(t,i,r)},v=e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),y=e=>Array.isArray(e)||typeof e==`object`&&!!e,b=null,x=e=>({element:e,formResetCallbacks:[],mountCallbacks:[]}),S=0,ee=()=>{S++;let e=!1;return()=>{e||(e=!0,S--)}},C=(e,t)=>{let n=b;b=e;try{return t()}finally{b=n}},w=e=>{if(b)return b;throw new n(`${e}: ${o.lifecycleOutsideSetup}`)},T=()=>w(`getHost`).element,E=t=>b?((0,e.effect)(()=>t),!0):!1,D=e=>{if(!E(e))throw new n(`onCleanup: ${o.lifecycleOutsideSetup}`)},te=e=>{w(`onMounted`).mountCallbacks.push(e)},O=e=>{w(`onFormReset`).formResetCallbacks.push(e)},k=t=>{let n=(0,e.effect)(t),r=()=>n.dispose();return E(r),r};function ne(e,t,n,r){if(w(`onEvent`),!e)return;let i=_(e,t,n,r);E(i)||i()}var re=(e,t)=>k(()=>{let n=e.value;if(n)return t(n)}),A=new WeakMap,ie=e=>{let t=[],n=e;for(;n;)n instanceof HTMLElement&&t.push(n),n=n.parentNode??(n instanceof ShadowRoot?n.host:null);return t},ae=(e,t,n)=>{let r=A.get(e)??new Map;r.has(t)&&`${e.localName}`,r.set(t,n),A.set(e,r)},oe=(e,t)=>{let n=w(`provide`).element;ae(n,e,t),D(()=>{let t=A.get(n);t&&(t.delete(e),t.size===0&&A.delete(n))})},j=Symbol(`inject.not_found`),se=new WeakMap,ce=(e,t)=>{let n=ie(e);for(let e of n){let n=A.get(e);if(n?.has(t))return n.get(t)}return j},le=(e,t)=>{let n=se.get(e);n||(n=new Map,se.set(e,n));let r=t;return n.has(r)||n.set(r,ce(e.element,t)),n.get(r)};function ue(e,...t){let n=le(w(`inject`),e);return n===j?t.length>0?t[0]:void 0:n}var de=e=>{let t=w(`injectStrict`),r=le(t,e);if(r!==j)return r;throw new n(o.injectStrictFailed(String(e),t.element.localName))},fe=0;function pe(e){return Symbol.for(`ore:context:${e??`anonymous-${++fe}`}`)}function me(e){return{default:e,parse:()=>e,reflect:!1}}var he={bool(e){return{default:e??!1,parse:e=>e!==null&&e!==`false`,reflect:!0}},data(e){return me(e)},json(e){return{default:e,parse:t=>{if(t==null||t===``)return e;try{return JSON.parse(t)}catch{return e}},reflect:!1}},number(e){let t=e===void 0?void 0:e;return{default:t,parse:e=>{if(e==null)return t;let n=Number(e);return Number.isNaN(n)?(`${e}${String(t)}`,t):n},reflect:!0}},oneOf(e,t){return{default:t,parse:n=>n!=null&&e.includes(n)?n:t,reflect:!0}},string(e){let t=e===void 0?void 0:e;return{default:t,parse:e=>e??t,reflect:!0}}},ge=e=>typeof e==`object`&&!!e&&`default`in e&&`parse`in e;function M(e,t){if(!ge(e))throw new n(`Prop "${t}" must use a prop.* helper (string/number/bool/json/oneOf). Received: ${typeof e}`);let r=e;if(!r.parse)throw new n(`Prop "${t}" must have a parse function. Use prop.* helpers.`);let i=r.reflect??!1;if(i&&y(r.default))throw new n(`Prop "${t}": ${o.propInvalidReflect}`);return{...r,reflect:i}}function _e(e){let t=[];for(let[n,r]of Object.entries(e))try{M(r,n)}catch(e){t.push(e instanceof Error?e.message:String(e))}return t}var N=new WeakMap,P=(e,t)=>N.get(e)?.get(t),F=(e,t)=>typeof e==`string`?t(e):e,ve=(t,n,r,i)=>{let a=N.get(t);a||(a=new Map,N.set(t,a));let{default:o,parse:s,reflect:c=!1}=i,l=(0,e.signal)(o),u=a.get(r),d=Object.hasOwn(t,n),f=d?t[n]:void 0,p={parse:s,reflect:c,signal:l};return u?l.value=u.signal.peek():d?(delete t[n],l.value=F(f,s)):t.hasAttribute(r)&&(l.value=s(t.getAttribute(r))),a.set(r,p),Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get:()=>l.value,set:e=>{l.value=F(e,s)}}),c&&k(()=>{let e=l.value;e==null?t.removeAttribute(r):typeof e==`boolean`?t.toggleAttribute(r,e):g(t,r,e)}),l};function ye(e,t){let n={};for(let[r,i]of Object.entries(t))n[r]=ve(e,r,v(r),i);return n}var I=e=>{let t=Symbol.for(e);return{is:e=>typeof e==`object`&&!!e&&t in e,stamp:e=>Object.assign(e,{[t]:!0})}},L=I(`ore:css-result`),be=L.is,xe=function(){return this.content},Se=(e,...t)=>{let n=``;for(let r=0;r<e.length;r++)if(n+=e[r],r<t.length){let e=t[r];n+=be(e)?e.content:String(e)}return L.stamp({content:n.trim(),toString:xe})},R=new Map,Ce=256,we=e=>{if(e instanceof CSSStyleSheet)return e;let t=typeof e==`string`?e:e.content,n=R.get(t);if(n)return R.delete(t),R.set(t,n),n;let r=new CSSStyleSheet;try{r.replaceSync(t)}catch{return r}if(R.set(t,r),R.size>Ce){let e=R.keys().next().value;e!==void 0&&R.delete(e)}return r},z={SETUP_DONE:`setup_done`,SETUP_RUNNING:`setup_running`,UNINITIALIZED:`uninitialized`,UNMOUNTED:`unmounted`},B={CONNECT:`ore:connect`,DISCONNECT:`ore:disconnect`},Te=()=>({formResetCallbacks:[],generation:0,mountCallbacks:[],phase:z.UNINITIALIZED,scope:(0,e.createScope)(),templateResult:null}),Ee=e=>(typeof e==`object`||typeof e==`function`)&&e!==null&&`then`in e&&typeof e.then==`function`,De=class extends HTMLElement{static _definition;static _normalizedPropDefs;static formAssociated=!1;static observedAttributes=[];_component;constructor(){super();let e=this.constructor._definition;e?.shadow!==!1&&this.attachShadow({mode:`open`,...e?.shadow}),this._component=Te()}connectedCallback(){(0,e.untrack)(()=>{this._component.phase===z.UNINITIALIZED&&this._runSetup(),this._init()}),this.dispatchEvent(new CustomEvent(B.CONNECT,{bubbles:!1,composed:!1}))}attributeChangedCallback(t,n,r){if(n===r)return;let i=P(this,t);if(!i)return;let a=i.parse(r);Object.is((0,e.untrack)(()=>i.signal.value),a)||(i.signal.value=a)}disconnectedCallback(){this._component.generation++,this._component.phase=z.UNMOUNTED,this.dispatchEvent(new CustomEvent(B.DISCONNECT,{bubbles:!1,composed:!1})),this._resetSetupState()}_resetSetupState(){this._component.scope.dispose(),this._component.formResetCallbacks=[],this._component.mountCallbacks=[],this._component.phase=z.UNINITIALIZED,this._component.scope=(0,e.createScope)(),this._component.templateResult=null}formResetCallback(){for(let e of this._component.formResetCallbacks)try{e()}catch(e){this._reportLifecycleError(e,`form-reset`)}}_reportLifecycleError(e,t){let n=e instanceof Error?e:Error(String(e));a(new i(`<${this.localName}> failed during ${this._component.phase} (${t})`,{cause:n,component:this.localName,phase:t}),this)}_runSetup(){this._component.phase=z.SETUP_RUNNING;let e=this.constructor._definition,t=this.constructor._normalizedPropDefs,r=x(this);try{let i;if(this._component.scope.run(()=>{i=C(r,()=>{let n=t?ye(this,t):{};return e.setup(n)})}),this._component.mountCallbacks.push(...r.mountCallbacks),this._component.formResetCallbacks.push(...r.formResetCallbacks),Ee(i))throw new n(o.asyncSetupUnsupported);this._component.templateResult=i??null,this._component.phase=z.SETUP_DONE}catch(e){throw this._reportLifecycleError(e,`setup`),this._resetSetupState(),e}}_isStale(e){return this._component.generation!==e||!this.isConnected}_applyResult(e){if(!e)return;let t=this.shadowRoot??this,n=x(this);t.replaceChildren(),this._component.scope.run(()=>{C(n,()=>{e.mount(t,null,D)})})}_init(){this._applyStyles(),this._mountTemplate(),this._component.phase===z.SETUP_DONE&&this._scheduleMountCallbacks()}_applyStyles(){let e=this.constructor._definition;this.shadowRoot&&e?.styles?.length&&(this.shadowRoot.adoptedStyleSheets=e.styles.map(we))}_mountTemplate(){let e=this._component.templateResult;e&&this._applyResult(e)}_scheduleMountCallbacks(){if(this._component.mountCallbacks.length===0)return;let e=this._component.generation,t=ee();queueMicrotask(()=>{try{if(this._isStale(e))return;let t=this._component.mountCallbacks.splice(0);for(let e=0;e<t.length;e++){let n=t[e];try{let e=x(this);this._component.scope.run(()=>{C(e,()=>{let e=n();typeof e==`function`&&D(e)})}),e.mountCallbacks.length>0&&t.push(...e.mountCallbacks),e.formResetCallbacks.length>0&&this._component.formResetCallbacks.push(...e.formResetCallbacks)}catch(e){this._reportLifecycleError(e,`mounted`)}}}finally{t()}})}};function Oe(e,t){let{props:r}=t,i=(()=>{if(!r)return;let t=_e(r);if(t.length>0)throw new n(o.validationFailed(e,t));let i={};for(let[e,t]of Object.entries(r))i[e]=M(t,e);return i})(),a=i?Object.keys(i).map(v):[];return class extends De{static _definition=t;static _normalizedPropDefs=i;static formAssociated=t.formAssociated??!1;static observedAttributes=a}}function ke(e,t){if(!e)throw new n(o.defineRequiresTag);if(customElements.get(e))throw new n(o.defineDuplicate(e));let r=Oe(e,t);Object.defineProperty(r,"name",{value:e}),customElements.define(e,r)}var Ae=t=>(0,e.computed)(()=>Object.entries(t).filter(([,e])=>c(e)).map(([e])=>e.replace(/\s+/g,``)).filter(Boolean).join(` `));function je(){return(0,e.signal)(null)}var V=I(`ore:directive`),H=e=>V.stamp({mount:e}),Me=V.is,U=I(`ore:html-result`),W=U.is;function Ne(e,t){return U.stamp({apply:t,fragment:e,mount:(n,r,i)=>{let a=Array.from(e.childNodes);return n.insertBefore(e,r),t(i),a}})}var Pe=(t,n,r,i,a)=>{let o=(0,e.signal)(t),s=(0,e.signal)(n),c=(0,e.createScope)(),l=[],u=[];return c.run(()=>{u=r(o,s).mount(i,a,e=>l.push(e))}),{cleanups:l,data:o,index:s,key:``,nodes:u,scope:c}},G=e=>{e.scope.dispose(),d(e.cleanups),f(e.nodes)},Fe=(t,r,i,a,s,c)=>{let l=[],u=new Set;for(let e=0;e<r.length;e++){let t=String(i(r[e],e));if(u.has(t))throw new n(o.eachDuplicateKey(t,e));u.add(t),l.push(t)}for(let[e,n]of t)u.has(e)||(G(n),t.delete(e));let d=[];for(let n=0;n<r.length;n++){let i=l[n],o=t.get(i);if(o)(0,e.batch)(()=>{o.data.value=r[n],o.index.value=n}),d.push(o);else{let o=(0,e.untrack)(()=>Pe(r[n],n,a,s,c));o.key=i,t.set(i,o),d.push(o)}}let f=c;for(let e=d.length-1;e>=0;e--){let t=d[e],n=t.nodes[0];if(n&&n!==f.previousSibling)for(let e of t.nodes)s.insertBefore(e,f);f=n??f}return d};function Ie(t,n,r,o){let c=Array.isArray(t)?(0,e.signal)(t):typeof t==`function`?(0,e.computed)(t):t;return H((t,l)=>{let u=t.parentNode;s(u,`each() anchor comment has no parent node`);let p=document.createComment(`each/end`);u.insertBefore(p,t.nextSibling);let m=new Map,h=[],g=null,_=[],v=()=>{o&&(g=o().mount(u,p,e=>_.push(e)))},y=()=>{g&&(d(_),f(g),g=null,_=[])},b=(0,e.effect)(()=>{let o=c.value??[];if(o.length===0){for(let t of(0,e.untrack)(()=>h))G(t);m=new Map,h=[],g||(0,e.untrack)(v);return}y();try{h=(0,e.untrack)(()=>Fe(m,o,n,r,u,p))}catch(e){let n=e instanceof Error?e:Error(String(e));a(new i(`each() failed to reconcile a list update: ${n.message}`,{cause:n,component:`each()`,phase:`each-reconcile`}),t);for(let e of m.values())G(e);m=new Map,h=[]}});l(()=>b.dispose()),l(()=>{y();for(let e of h)G(e);p.remove()})})}var K=I(`ore:live`),Le=e=>K.stamp({source:e}),Re=K.is,ze=e=>{let t=c(e);return t==null||t===!1?``:u(String(t))},Be=t=>(0,e.computed)(()=>{let e=[];for(let[n,r]of Object.entries(t)){let t=ze(r);if(!t)continue;let i=u(v(n));i&&e.push(`${i}:${t}`)}return e.join(`;`)}),q=(e,t,n)=>{let r=document.createElement(`template`);r.innerHTML=e;let i=Array.from(r.content.cloneNode(!0).childNodes);for(let e of i)t.insertBefore(e,n);return i};function Ve(t){if(typeof t==`function`){let n=(0,e.computed)(t);return H((e,t)=>{Ve(n).mount(e,t)})}return H((n,r)=>{let i=n.parentNode;s(i,`unsafeHtml() anchor comment has no parent node`);let a=document.createComment(`unsafe-html/end`);if(i.insertBefore(a,n.nextSibling),(0,e.isReactive)(t)){let n=p(),o=t,s=(0,e.effect)(()=>{n.clear(),n.setNodes(q(o.value,i,a))});r(()=>s.dispose()),r(()=>{n.clear(),a.remove()})}else q(t,i,a),r(()=>a.remove())})}var He=`when() anchor comment has no parent node`;function Ue(t,n,r){return typeof t!=`function`&&!(0,e.isReactive)(t)?H((e,i)=>{let a=t?n():r?r():null;if(!a||!W(a))return;let o=e.parentNode;s(o,He);let c=a.mount(o,e,i);i(()=>f(c))}):H((i,a)=>{let o=(typeof t==`function`?(0,e.computed)(t):null)??t,c=i.parentNode;s(c,He);let l=document.createComment(`when/end`);c.insertBefore(l,i.nextSibling);let u=p(),d=(0,e.effect)(()=>{let t=o.value;u.clear();let i=t?n():r?r():null;!i||!W(i)||u.setNodes((0,e.untrack)(()=>i.mount(c,l,u.registerCleanup)))});a(()=>d.dispose()),a(()=>{u.clear(),l.remove()})})}var We=new WeakMap,J=new WeakSet,Ge=e=>{let t=e.el??T();if(!t.constructor.formAssociated)throw new n(o.defineFieldRequiresFormAssociated(t.localName));if(J.has(t))throw new n(o.useFieldAlreadyCalled(t.localName));let r=We.get(t)??t.attachInternals();We.set(t,r),J.add(t),D(()=>J.delete(t));let i=e.toFormValue??(t=>t==null?e.emptyStringForNull?``:null:t instanceof File||t instanceof FormData?t:String(t));k(()=>{r.setFormValue(i(e.value.value))});let a=e.disabled;if(a&&`states`in r){let e=r.states;k(()=>{a.value?e.add(`disabled`):e.delete(`disabled`)})}return e.validity&&k(()=>{let t=e.validity?.value??{},n=Object.values(t).some(Boolean),i=e.validationMessage?.value??``;if(n&&!i){r.setValidity(t,`Invalid value.`);return}r.setValidity(t,i)}),e.onReset&&O(e.onReset),{checkValidity:()=>r.checkValidity(),internals:r,reportValidity:()=>r.reportValidity(),setCustomValidity:e=>e?r.setValidity({customError:!0},e):r.setValidity({})}},Ke=e=>e===`role`||e.startsWith(`aria-`)?e:e.startsWith(`aria`)?`aria-${e.slice(4).toLowerCase()}`:`aria-${e}`,qe=e=>e===`role`||e.startsWith(`aria-`)?e:e.startsWith(`aria`)?`aria-${e.slice(4).toLowerCase()}`:e,Je=(e,t)=>{let n=t?.target??T(),r=[];if(e.attr)for(let[t,i]of Object.entries(e.attr)){let e=Ze(n,Ye(t),i);e&&r.push(e)}if(e.aria)for(let[t,i]of Object.entries(e.aria)){let e=Ze(n,Ke(t),i);e&&r.push(e)}if(e.class&&r.push($e(n,e.class)),e.style)for(let[t,i]of Object.entries(e.style)){let e=Qe(n,t,i);e&&r.push(e)}if(e.on){let{target:i,...a}=t??{};for(let t of Object.keys(e.on)){let i=e.on[t];i&&r.push(_(n,t,i,a))}}let i=()=>{for(let e of r)e()};return E(i),i},Ye=qe,Xe=(t,n)=>{if(typeof t==`function`)return k(()=>{n(t())});if((0,e.isReactive)(t))return k(()=>{n(t.value)});n(t)};function Ze(e,t,n){return Xe(n,n=>g(e,t,n))}function Qe(e,t,n){let r=u(t.startsWith(`--`)?t:v(t));if(!r)return;let i=!1;return Xe(n,t=>{t!=null&&t!==``?(i=!0,e.style.setProperty(r,u(String(t)))):i&&e.style.removeProperty(r)})}function $e(e,t){let n=typeof t==`function`?t:()=>{let e={};for(let[n,r]of Object.entries(t))e[n]=c(r);return e},r=new Set;return k(()=>{let t=new Set;for(let[i,a]of Object.entries(n()))a&&(t.add(i),r.has(i)||e.classList.add(i));for(let n of r)t.has(n)||e.classList.remove(n);r=t})}var et=(t,n)=>{let r=(0,e.signal)(null),i=new IntersectionObserver(([e])=>{e&&(r.value=e)},n);return i.observe(t),D(()=>i.disconnect()),r},tt=t=>{let n=window.matchMedia(t),r=(0,e.signal)(n.matches),i=e=>{r.value=e.matches};return n.addEventListener(`change`,i),D(()=>n.removeEventListener(`change`,i)),r},nt=(t,n={attributes:!0,characterData:!0,childList:!0,subtree:!0})=>{let r=(0,e.signal)({entries:[],latest:null}),i=new MutationObserver(e=>{r.value={entries:e,latest:e.length>0?e[e.length-1]:null}});return i.observe(t,n),D(()=>i.disconnect()),r},rt=t=>{let n=(0,e.signal)({height:0,width:0}),r=new ResizeObserver(([e])=>{if(!e)return;let t=e.contentBoxSize[0];t&&(n.value={height:t.blockSize,width:t.inlineSize})});return r.observe(t),D(()=>r.disconnect()),n},it=`default`,Y=e=>e||it,at=t=>{let n=new Map,r=new Map,i=new Map,a=t=>{let r=n.get(t);return r||(r={elements:(0,e.signal)([]),presence:(0,e.signal)(!1)},n.set(t,r)),r},o=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},s=e=>{let t=Y(e),n=r.get(t),i=[];if(n)for(let e of n)i.push(...e.assignedElements({flatten:!0}));let s=a(t);o(s.elements.value,i)||(s.elements.value=i);let c=i.length>0;s.presence.value!==c&&(s.presence.value=c)},c=e=>{if(i.has(e))return;let t=Y(e.getAttribute(`name`)),n=r.get(t)??new Set;n.add(e),r.set(t,n);let a=()=>s(t);e.addEventListener(`slotchange`,a),i.set(e,()=>{e.removeEventListener(`slotchange`,a)}),s(t)},l=e=>{let t=i.get(e);if(!t)return;t(),i.delete(e);let n=Y(e.getAttribute(`name`)),a=r.get(n);a&&(a.delete(e),a.size===0&&r.delete(n)),s(n)},u=()=>{t.shadowRoot?.querySelectorAll(`slot`).forEach(e=>{c(e)})},d=()=>{for(let e of r.keys())s(e)},f=null;return te(()=>{u(),d(),!f&&t.shadowRoot&&(f=new MutationObserver(e=>{for(let t of e)for(let e of t.removedNodes)e instanceof HTMLSlotElement&&l(e);u(),i.size>0&&d()}),f.observe(t.shadowRoot,{childList:!0,subtree:!0}))}),D(()=>{f?.disconnect(),f=null;for(let e of i.values())e();i.clear(),r.clear(),n.clear(),X.delete(t)}),{elements:e=>a(Y(e)).elements,has:e=>a(Y(e)).presence}},X=new WeakMap,ot=()=>{let e=w(`useSlots`),t=X.get(e.element);return t||(t=at(e.element),X.set(e.element,t)),t},st=(t,n,r)=>{let i=(0,e.effect)(()=>{n(t.value)});r(()=>i.dispose())},ct=e=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement,lt=e=>e instanceof HTMLInputElement&&(e.type===`checkbox`||e.type===`radio`),ut=(e,t,n,r={last:void 0})=>{let i=lt(e),a=i?!!t:t==null?``:String(t),o=i?e.checked:e.value;n&&r.last!==void 0&&!Object.is(o,r.last)&&!Object.is(o,a)||(i?e.checked=a:e.value=a,n&&(r.last=a))},dt=(t,n,r,i)=>{let a=y(i)?i:n.parse(r.mode===`bool`?i?``:null:i==null||i===!1?null:String(i));if(Object.is((0,e.untrack)(()=>n.signal.value),a)||(n.signal.value=a),!n.reflect){if(y(i))return;r.mode===`bool`?t.toggleAttribute(r.name,!!i):g(t,r.name,i)}},ft=(t,n)=>{let{el:r,mode:i,name:a,propMeta:o}=t,s={last:void 0},c=n=>{if(o){dt(r,o,t,n);return}if(!(0,e.isReactive)(n)&&y(n)){a!==`__proto__`&&a!==`constructor`&&a!==`prototype`&&(r[a]=n);return}if(a===`value`&&ct(r)||a===`checked`&&r instanceof HTMLInputElement){ut(r,n,t.live,s);return}i===`bool`?r.toggleAttribute(a,!!n):g(r,a,n)};`signal`in t?st(t.signal,c,n):c(t.value)},pt=(e,t)=>{t(_(e.el,e.name,e.handler))},mt=(e,t)=>{let{el:n,ref:r}=e;if(typeof r==`function`){r(n),t(()=>r(null));return}r.value=n,t(()=>{r.value=null})},ht=(e,t,n)=>{let r=[],i=t.parentNode;s(i,`html binding anchor has no parent node`);for(let a of e)if(W(a)){let e=Array.from(a.fragment.childNodes);i.insertBefore(a.fragment,t),a.apply(n),r.push(...e)}else if(a!=null&&a!==!1){let e=document.createTextNode(String(a));i.insertBefore(e,t),r.push(e)}return r},gt=(t,n)=>{let{anchor:r,signal:i}=t,a=p(),o=(0,e.effect)(()=>{let t=i.value;a.clear(),t!=null&&t.length!==0&&(0,e.untrack)(()=>{a.setNodes(ht(t,r,a.registerCleanup))})});n(()=>{o.dispose(),a.clear()})},_t=(e,t)=>{e.directive.mount(e.anchor,t)},vt=(e,t)=>{switch(e.type){case`attr`:ft(e,t);break;case`directive`:_t(e,t);break;case`event`:pt(e,t);break;case`html`:gt(e,t);break;case`ref`:mt(e,t)}},yt=(t,n,r,i)=>{let a=P(t,r);return Re(i)?{el:t,live:!0,mode:n,name:r,propMeta:a,signal:i.source,type:`attr`}:typeof i==`function`?{el:t,mode:n,name:r,propMeta:a,signal:(0,e.computed)(i),type:`attr`}:(0,e.isReactive)(i)?{el:t,mode:n,name:r,propMeta:a,signal:i,type:`attr`}:{el:t,mode:n,name:r,propMeta:a,type:`attr`,value:i}},bt=e=>e==null?``:String(e),Z={ATTR:`attr`,BOOL_ATTR:`boolAttr`,EVENT:`event`,NODE:`node`,REF:`ref`},xt=/\s+@([a-zA-Z_][-a-zA-Z0-9_.-]*)\s*=\s*["']?$/,St=/\s+ref\s*=\s*["']?$/,Ct=/\s+\?([a-zA-Z_][-a-zA-Z0-9_]*)\s*=\s*["']?$/,wt=/\s+([a-zA-Z_][-a-zA-Z0-9_]*)\s*=\s*["']?$/,Tt=e=>{let t;if(t=xt.exec(e)){let r=e.slice(0,-t[0].length),[i,...a]=t[1].split(`.`);if(a.length>0)throw new n(o.eventModifiersUnsupported(t[1]));return{kind:Z.EVENT,name:i,prefix:r}}if(t=St.exec(e))return{kind:Z.REF,prefix:e.slice(0,-t[0].length)};if(t=Ct.exec(e))return{kind:Z.BOOL_ATTR,name:t[1],prefix:e.slice(0,-t[0].length)};if(t=wt.exec(e))return{kind:Z.ATTR,name:t[1],prefix:e.slice(0,-t[0].length)};let r=e.lastIndexOf(`<`);if(r>e.lastIndexOf(`>`)&&e[r+1]!==`/`)throw new n(o.templateInterpolationInTag);return{kind:Z.NODE,prefix:e}},Et=new WeakMap,Dt=/[@?]?[a-zA-Z_][-a-zA-Z0-9_.]*\s*=\s*$/,Ot=e=>{let t=Array.from(e),n=!1;for(let e=0;e<t.length-1;e++){let r=t[e],i=r[r.length-1];for(let e of r)e===`<`?n=!0:e===`>`&&(n=!1);if((i===`"`||i===`'`)&&n&&Dt.test(r.slice(0,-1))){t[e]=r.slice(0,-1);let n=t[e+1];n.startsWith(i)&&(t[e+1]=n.slice(1))}}return t},Q=`data-ore-b`,kt=/^ore:(\d+)$/,At=(e,t,n,r)=>{if(e.nodeType===Node.ELEMENT_NODE){let r=e,i=r.getAttribute(Q);i!==null&&(n.set(Number(i),[...t]),r.removeAttribute(Q))}else if(e.nodeType===Node.COMMENT_NODE){let n=e.nodeValue,i=n===null?null:kt.exec(n);i&&r.set(Number(i[1]),[...t])}let i=e.childNodes;for(let e=0;e<i.length;e++)At(i[e],[...t,e],n,r)},jt=e=>{let t=Ot(e),n=``,r,i=0,a=0,o=[];for(let e=0;e<t.length-1;e++){let s=t[e],c=Tt(s);if(c.kind===Z.NODE)n+=`${c.prefix}<!--ore:${a}-->`,o.push({commentId:a,kind:Z.NODE}),a++,r=void 0;else{r===void 0||c.prefix.lastIndexOf(`<`)>c.prefix.lastIndexOf(`>`)?(r=i++,n+=`${c.prefix} ${Q}="${r}"`):n+=c.prefix;let e=c.kind===Z.BOOL_ATTR?`bool`:c.kind===Z.ATTR?`attr`:void 0;o.push({elementId:r,kind:c.kind,mode:e,name:c.name})}}n+=t[t.length-1]??``;let s=document.createElement(`template`);s.innerHTML=n;let c=new Map,l=new Map,u=s.content.childNodes;for(let e=0;e<u.length;e++)At(u[e],[e],c,l);return{commentPaths:l,element:s,elementPaths:c,slots:o}},Mt=e=>{let t=Et.get(e);return t||(t=jt(e),Et.set(e,t)),t},Nt=(e,t)=>{let n=e;for(let e of t)n=n.childNodes[e];return n},Pt="html`...`: node-slot comment anchor has no parent node",Ft=e=>Array.isArray(e)?e:[e],It=(e,t,n)=>{let r=t.parentNode;for(s(r,Pt);e.fragment.firstChild;)r.insertBefore(e.fragment.firstChild,t);n.push(e.apply.bind(e))},Lt=(t,n)=>{let r=Mt(t),i=r.element.content.cloneNode(!0),a=[],o=[],c=r.slots.map((e,t)=>{let a=n[t];if(e.kind===Z.NODE){let t=e.commentId===void 0?void 0:r.commentPaths.get(e.commentId);return s(t,`compiled template is missing a comment path for node slot ${e.commentId}`),{comment:Nt(i,t),slot:e,value:a}}let o=e.elementId===void 0?void 0:r.elementPaths.get(e.elementId);return s(o,`compiled template is missing an element path for slot ${e.elementId}`),{el:Nt(i,o),slot:e,value:a}});for(let{comment:t,el:n,slot:r,value:i}of c){if(r.kind===Z.NODE){let n=t;if(s(n,`compiled template produced a node slot without a comment anchor`),Me(i)){a.push({anchor:n,directive:i,type:`directive`});continue}if(W(i)){It(i,n,o),n.remove();continue}if(typeof i==`function`||(0,e.isReactive)(i)){let t=typeof i==`function`?(0,e.computed)(()=>Ft(i())):(0,e.computed)(()=>Ft(i.value));a.push({anchor:n,signal:t,type:`html`});continue}if(Array.isArray(i)){for(let e of i)if(W(e))It(e,n,o);else{let t=n.parentNode;s(t,Pt),t.insertBefore(document.createTextNode(bt(e)),n)}n.remove();continue}n.replaceWith(document.createTextNode(bt(i)));continue}if(s(n,`compiled template produced an element slot without an element`),r.kind===Z.EVENT){let t=r.name;if(s(t,`compiled template produced an event slot without an event name`),typeof i==`function`)a.push({el:n,handler:i,name:t,type:`event`});else if((0,e.isReactive)(i)){let e=i;a.push({el:n,handler:t=>{let n=e.value;typeof n==`function`&&n(t)},name:t,type:`event`})}continue}if(r.kind===Z.REF){i&&a.push({el:n,ref:i,type:`ref`});continue}s(r.name,`compiled template produced an attr slot without an attribute name`),a.push(yt(n,r.mode??`attr`,r.name,i))}return Ne(i,e=>{for(let t of a)vt(t,e);for(let t of o)t(e)})},Rt=(e,...t)=>Lt(e,t),zt={bubbles:!0,cancelable:!0,composed:!1},Bt=()=>{let e=T();return((t,...n)=>{let r=n.length>0?{...zt,detail:n[0]}:zt;return e.dispatchEvent(new CustomEvent(String(t),r))})},Vt=0,$=0,Ht=Math.random().toString(36).slice(2,6),Ut=(e=`id`)=>`${e}-${++Vt}`,Wt=(e=`id`)=>`${e}-${Ht}${++$}`,Gt=()=>{$=0};exports.OreApiError=n,exports.OreError=t,exports.OreInternalError=r,exports.OreLifecycleError=i,exports.bind=Je,exports.classMap=Ae,exports.createContext=pe,exports.createId=Ut,exports.createStableId=Wt,exports.css=Se,exports.define=ke,exports.each=Ie,exports.getHost=T,exports.html=Rt,exports.inject=ue,exports.injectStrict=de,exports.intersectionObserver=et,exports.live=Le,exports.mediaObserver=tt,exports.mutationObserver=nt,exports.onCleanup=D,exports.onElement=re,exports.onEvent=ne,exports.onFormReset=O,exports.onMounted=te,exports.prop=he,exports.provide=oe,exports.ref=je,exports.resetStableIdCounter=Gt,exports.resizeObserver=rt,exports.styleMap=Be,exports.unsafeHtml=Ve,exports.useEmit=Bt,exports.useField=Ge,exports.useSlots=ot,exports.watchEffect=k,exports.when=Ue;
3
3
  //# sourceMappingURL=ore.cjs.map