@verajs/renderer 0.3.0 → 0.3.1

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.
Files changed (33) hide show
  1. package/README.md +52 -6
  2. package/dist/development/vera-renderer-elements.js.map +1 -1
  3. package/dist/development/vera-renderer-hydrate-slots.js +1 -1
  4. package/dist/development/vera-renderer-hydrate-slots.js.map +1 -1
  5. package/dist/development/vera-renderer-hydration.d.ts.map +1 -1
  6. package/dist/development/vera-renderer-hydration.js +42 -4
  7. package/dist/development/vera-renderer-hydration.js.map +1 -1
  8. package/dist/development/vera-renderer-portal.js +1 -1
  9. package/dist/development/vera-renderer-portal.js.map +1 -1
  10. package/dist/development/vera-renderer-profiler.d.ts.map +1 -1
  11. package/dist/development/vera-renderer-profiler.js +304 -97
  12. package/dist/development/vera-renderer-profiler.js.map +1 -1
  13. package/dist/development/vera-renderer-slots.js +1 -1
  14. package/dist/development/vera-renderer-slots.js.map +1 -1
  15. package/dist/development/vera-renderer-spread.js.map +1 -1
  16. package/dist/development/vera-renderer-tag.js.map +1 -1
  17. package/dist/development/vera-renderer.d.ts.map +1 -1
  18. package/dist/development/vera-renderer.js +304 -97
  19. package/dist/development/vera-renderer.js.map +1 -1
  20. package/dist/vera-renderer-elements.min.js.map +1 -1
  21. package/dist/vera-renderer-hydrate-slots.min.js +1 -1
  22. package/dist/vera-renderer-hydrate-slots.min.js.map +1 -1
  23. package/dist/vera-renderer-hydration.min.js +1 -1
  24. package/dist/vera-renderer-hydration.min.js.map +1 -1
  25. package/dist/vera-renderer-portal.min.js +1 -1
  26. package/dist/vera-renderer-portal.min.js.map +1 -1
  27. package/dist/vera-renderer-slots.min.js +1 -1
  28. package/dist/vera-renderer-slots.min.js.map +1 -1
  29. package/dist/vera-renderer-spread.min.js.map +1 -1
  30. package/dist/vera-renderer-tag.min.js.map +1 -1
  31. package/dist/vera-renderer.min.js +1 -1
  32. package/dist/vera-renderer.min.js.map +1 -1
  33. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"vera-renderer-elements.min.js","sources":["../src/elements.ts","../../shared-utils/src/utils.ts"],"sourcesContent":["/**\n * **`@verajs/renderer/elements` — attach behavior to elements in templates.**\n *\n * ```js\n * const autofocus = { mount: (element) => element.focus() };\n * wire([renderer, elements, { on: 'element', fn: (el) => (el.hasAttribute('autofocus') ? autofocus : undefined) }]);\n * ```\n *\n * Every `'element'` claimant is asked about each element of a template ONCE, as the template is BUILT — on its\n * canonical content, so a tag and its static attributes are real and no binding is ever applied (a hydrated first\n * instance, whose elements are the server's with bound values in them, changes nothing). The answers are two flat\n * lists shared by every instance: element positions in document pre-order, and their behaviors. A template nobody\n * claimed anything in gets no instance hook at all. Each instance finds its claimed elements with one short walk to\n * those positions; once the render that created it has finished, each behavior's `mount` runs, and what it returns is\n * handed to `unmount` at teardown. Nothing runs per update.\n *\n * Built on the renderer's `'template'` insert and instance hook (`InstanceHook`); it imports nothing — the registry\n * arrives through its connector. An app that does not wire it pays nothing.\n */\nimport type { ElementBehavior, InstanceHook } from './types.js';\nimport { diagnostic, hostOf, reportTo } from '@verajs/shared-utils';\nimport { PROSE } from './elements-diagnostics.js';\n\ntype Claim = (element: Element) => ElementBehavior | undefined;\n\nlet registered: Map<string, unknown[]> | null = null;\n\n/**\n * **A claim's callbacks follow the ref rule** (Brian, 2026-10-09): user code a render calls is caught AT ITS CALL SITE\n * — so a template with no claims runs exactly the path it did — reported to the app's `'error'` chain with the\n * component it belongs to (else as uncaught), and the render, the other claims and the teardown carry on. A mid-commit\n * throw once left a component's root empty for good; `mount` propagating aborted every later claim's mount.\n */\nconst report = (error: unknown, root: Node | null, line: string) => reportTo(registered?.get('error'), error, hostOf(root), line);\n\n/**\n * **The next element of an instance in document pre-order, never leaving it.** A root is a fragment, or — for a\n * single-root template — its one element, which is then position 0. Bounded by the root rather than by the tree it\n * sits in, because a hydrated instance is already in the page.\n */\nconst firstIn = (root: Node): Element | null => (root.nodeType === 1 ? (root as Element) : (root as ParentNode).firstElementChild);\nconst nextIn = (node: Element, root: Node): Element | null => {\n if (node.firstElementChild !== null) return node.firstElementChild;\n for (let at: Element | null = node; at !== null && at !== root; at = at.parentElement)\n if (at.nextElementSibling !== null) return at.nextElementSibling;\n return null;\n};\n\n/**\n * One instance's claims until it mounts — its claimed elements and their behaviors, interleaved, where it rendered,\n * whether it was adopted — and then only what `unmount` needs. **The elements are released at mount**: per-instance\n * state that keeps DOM references past the moment it needs them costs every operation on the page (measured: ~7% on\n * select and swap of a table whose every row was claimed, operations that never touch it).\n */\ntype State = { f: (Element | ElementBehavior)[] | null; r: Node | null; a: boolean; k: unknown[] | undefined; d: boolean };\n\n/** The instance hook for one template, from the positions and behaviors its claimants answered. */\nconst hookFor = (positions: number[], behaviors: ElementBehavior[]): InstanceHook => ({\n $c: (instance, root, adopted) => {\n const found: (Element | ElementBehavior)[] = [];\n /**\n * ADOPTED, the instance arrives as its elements in template order (hydration pairs them): its live root already\n * holds what its nested parts rendered, so counting there would land on the wrong element.\n */\n const listed = Array.isArray(instance);\n let node = listed ? null : firstIn(instance as Node);\n let at = 0;\n for (let k = 0; k < positions.length; k++) {\n if (listed) node = (instance as readonly Element[])[positions[k]];\n else for (; at < positions[k]; at++) node = nextIn(node!, instance as Node);\n /**\n * At creation — before the first update, and before the instance is connected anywhere. A claim whose `create`\n * throws is reported and DROPPED for this instance (it never mounts or unmounts, being half made); the element\n * stays as the template built it — a claim inserts nothing — and every other claim carries on. The ref rule.\n */\n try {\n behaviors[k].create?.(node!, adopted);\n } catch (error) {\n report(error, root, __DEV__ ? diagnostic('elements', 'an element claim', 'claim-threw', __DEV__ && PROSE['claim-threw']('create', 'the render continued without it')) : '[vera] claim-threw');\n continue;\n }\n found.push(node!, behaviors[k]);\n }\n return { f: found, r: root, a: adopted, k: undefined, d: false } as State;\n },\n $m: (given) => {\n const state = given as State;\n /** Torn down before its render finished: it never mounts. */\n if (state.d) return;\n const found = state.f!;\n const context = { root: state.r, adopted: state.a };\n state.f = null;\n for (let i = 0; i < found.length; i += 2) {\n const behavior = found[i + 1] as ElementBehavior;\n let value;\n try {\n value = behavior.mount?.(found[i] as Element, context);\n } catch (error) {\n report(error, state.r, __DEV__ ? diagnostic('elements', 'an element claim', 'claim-threw', __DEV__ && PROSE['claim-threw']('mount', 'the others still mounted')) : '[vera] claim-threw');\n continue;\n }\n if (value !== undefined && behavior.unmount !== undefined) (state.k ??= []).push(found[i], behavior, value);\n }\n },\n $q: (given) => {\n const state = given as State;\n state.d = true;\n const kept = state.k;\n if (kept !== undefined)\n for (let i = 0; i < kept.length; i += 3)\n try {\n (kept[i + 1] as ElementBehavior).unmount!(kept[i + 2], kept[i] as Element);\n } catch (error) {\n report(error, state.r, __DEV__ ? diagnostic('elements', 'an element claim', 'claim-threw', __DEV__ && PROSE['claim-threw']('unmount', 'the rest of the teardown ran')) : '[vera] claim-threw');\n }\n },\n});\n\n/**\n * Asks the claimants about the template's canonical content, once, as it is built — and gives it an instance hook\n * only if something was claimed. The content is READ, never changed (see the `'template'` insert's contract).\n */\nconst claimTemplate = (built: object, _result: unknown, _readScope: unknown, root: Node) => {\n const claims = registered?.get('element') as Claim[] | undefined;\n if (claims === undefined || claims.length === 0) return;\n const template = built as { _$inst$?: InstanceHook };\n if (__DEV__ && template._$inst$ !== undefined)\n console.warn(diagnostic('elements', 'template', 'elements-hook-replaced', __DEV__ && PROSE['elements-hook-replaced']()));\n const positions: number[] = [];\n const behaviors: ElementBehavior[] = [];\n let at = 0;\n for (let node = firstIn(root); node !== null; node = nextIn(node, root), at++)\n for (let i = 0; i < claims.length; i++) {\n const behavior = claims[i](node);\n if (behavior !== undefined) {\n positions.push(at);\n behaviors.push(behavior);\n }\n }\n if (positions.length > 0) template._$inst$ = hookFor(positions, behaviors);\n};\n\n/** Wire it as `wire([renderer, elements, …claims])`. A bare module: it has no options. */\nexport const elements = [\n (registry: Map<string, unknown[]>) => {\n registered = registry;\n },\n { name: '@verajs/renderer/elements', on: 'template' as const, fn: claimTemplate, priority: 10 },\n];\n\nexport type { ElementBehavior } from './types.js';\n","import type { HandlerHolder, Untracked } from './types.js';\nimport { diagnostic } from './diagnostic.js';\nimport * as SHARED from './diagnostics.js';\n\n/**\n * Get an object's type.\n *\n * @param obj The object\n * @return The type\n */\nexport const getType = (obj: unknown) => Object.prototype.toString.call(obj).slice(8, -1).toLowerCase();\n\n/**\n * Weak collections need their per-key dependencies stored weakly, or tracking `weakMap.get(obj)`\n * holds `obj` and defeats the whole point of the type. Checked by type string rather than\n * `instanceof`, which fails across realms (iframes, `vm`).\n */\n/**\n * A WeakMap or WeakSet (or WeakRef) — read from `Symbol.toStringTag`, the tag `Object.prototype.toString` itself reads, so\n * the answer is the same (another realm's collections included) without building and lower-casing a string on every first\n * tracked read of every object.\n */\nexport const isWeakCollection = (item: unknown) => {\n const tag = (item as { [Symbol.toStringTag]?: unknown } | null)?.[Symbol.toStringTag];\n return typeof tag === 'string' && (tag[0] === 'W' || tag[0] === 'w');\n};\n\n/**\n * Remove a trailing slash from an url if its not root url (`/`).\n *\n * @param str String to remove trailing slash from\n */\nexport const stripTrailingSlash = (str: string) => (str !== '/' && str.endsWith('/') ? str.slice(0, -1) : str);\n\n/**\n * **Reports an error nothing else handled, the way the platform reports one.** `reportError` fires\n * the window's `error` event — what `window.onerror`, error trackers and test runners listen for —\n * without unwinding the caller, so one failing hook or ref never stops its siblings. A bare\n * `console.error` reached none of those: a component could stop updating while every page-error\n * listener stayed silent. Off-browser (Node has no `reportError`) the console is all there is.\n * `line` is the framework's own line, printed beside the error — a CODED one (2026-10-09):\n * each caller passes `'[vera] <code>'` in production and its table's `diagnostic()` sentence in development, both\n * literal codes at the call site, so the static checks read them. The subject is fixed wording too (`a hook`, `an\n * element ref`), never a tag name: this line is the console's FORMAT (no `'%s'`, which measured +2–3 B on the renderer\n * bundles), so nothing from outside may reach it — the element goes to the `'error'` handlers instead. Production prints it only where the platform has no\n * `reportError` (Node); in a browser, `reportError` alone reports.\n *\n * Shared by core (a hook threw) and the renderer (a ref threw) so the fallback is one rule.\n */\nexport const reportUncaught = (error: unknown, line: string) => {\n if (typeof reportError !== 'function') console.error(line, error);\n else {\n if (__DEV__) console.error(line, error);\n reportError(error);\n }\n};\n\n/**\n * **Reports what user code a render called threw — to the app's `'error'` chain, else as uncaught.** One rule for\n * every callback the framework runs on the user's behalf and survives: a hook (core), an element ref, and an element\n * claim's `create`/`mount`/`unmount` (the renderer). The caller catches at the call site and carries on, so one\n * failing callback never stops its siblings or leaves a commit half applied. `element` is the component the error\n * belongs to, handed to each handler. Every throw is reported — nothing is deduped, as a hook's never was.\n * **Core keeps a deliberate twin** (`reportHookError`, the same rule as a `forEach`): routed through here it measured\n * +11 B gzip on `vera.min.js` (2026-10-09). A change to the rule changes both.\n */\nexport const reportTo = (handlers: readonly unknown[] | undefined, error: unknown, element: Element | undefined, line: string) => {\n if (handlers?.length) for (const handler of handlers) (handler as (error: unknown, element?: Element) => void)(error, element);\n else reportUncaught(error, line);\n};\n\n/** The component a render root belongs to: a shadow root's host, or a light root itself. */\nexport const hostOf = (root: Node | null | undefined): Element | undefined =>\n root == null ? undefined : root.nodeType === 11 ? (root as ShadowRoot).host : (root as Element);\n\n/** `fn(a, b, c)`, tracked as the caller is — the stand-in for core's `untracked` when no core was wired. */\nexport const call: Untracked = (fn, a, b, c) => fn(a!, b!, c!);\n\n/**\n * **Runs a bound handler, and its callers run it UNTRACKED**: the renderer's template `@event` and spread's event key,\n * each through `untracked(dispatch, holder, event)` (2026-10-09). An effect that fires an event synchronously\n * (`el.click()`, `focus()`, `dispatchEvent`) runs the handler INSIDE itself, and the handler's reads subscribed the\n * effect: a handler doing `state.n++` made the effect re-run on every click, a self-feeding loop held to one round per\n * frame, forever (measured). A handler's reads are event-time decisions, never a hook's inputs. The directives engine's\n * delegated `listen` makes the same choice its own way. A function is called with the element as `this`; an object\n * through its `handleEvent`. One function for both callers (Brian's size-audit ruling, 2026-11-13): it was two\n * identical copies, so a fix had two addresses; each bundle still inlines its own.\n */\nexport const dispatch = (holder: HandlerHolder, event: Event) => {\n const handler = holder._handler as EventListener | EventListenerObject | null;\n if (typeof handler === 'function') handler.call(holder._element as never, event);\n else if (typeof handler?.handleEvent === 'function') handler.handleEvent(event);\n};\n\n/**\n * **Whether a property binding is a `<select>`'s SELECTION** — `value` or `selectedIndex` — which the renderer and\n * `spread` both treat as live: re-asserted every render and compared against the live value (as `!value` is), because\n * a select's options can be replaced under an unchanged value, which drops the selection. One rule, asked once per\n * binding by both, so a template and a spread key cannot disagree about it.\n *\n * In development it names the one shape it cannot serve: on a `<select multiple>` both properties read and set a\n * SINGLE selection, so a selection the user adds is kept rather than controlled. Always writing there was measured\n * 2–3% slower on every table with a select per row, to serve an API that does not fit — hence a warning, not a cost.\n */\nexport const isSelection = (element: Element, name: unknown) => {\n if ((name !== 'value' && name !== 'selectedIndex') || element.localName !== 'select') return false;\n return true;\n};\n\n/**\n * Development: the one shape a selection binding cannot serve, named by the module the user wired (`side`). Called only\n * behind `__DEV__` at each call site, so production keeps `isSelection` exactly as small as it was (a `side` argument on\n * it measured +1 B, a default +9 B on vera-renderer.min.js — 2026-10-09).\n */\nexport const saySelectMultiple = (element: Element, name: unknown, side: string) => {\n if (element.hasAttribute('multiple'))\n console.warn(diagnostic(side, '<select multiple>', 'select-multiple', __DEV__ && SHARED.selectMultiple(String(name))));\n};\n\n/**\n * `target[key]`, as a function — how a component's GETTER is read through `untracked`. Not `Reflect.get`: `untracked`\n * passes three arguments, and `Reflect.get`'s third is the RECEIVER — `undefined` there runs the getter with no `this`.\n */\nexport const read = (target: object, key: string) => (target as Record<string, unknown>)[key];\n\n/**\n * **What a thrown value says, whatever was thrown — and it never throws itself.** A caught value comes from author\n * code (a `resolve` option, a motion tick or vocabulary function), and JavaScript can throw anything: `null`, an object\n * with no prototype (`String()` finds no `toString`), one whose `toString` or `message` getter throws, a Proxy whose\n * traps throw. Formatting it naively replaced the real failure with an unrelated TypeError from inside the framework.\n * Anything unreadable becomes a fixed phrase; `Object.prototype.toString` is no fallback, since it reads\n * `Symbol.toStringTag` through a Proxy's trap too.\n *\n * **A deliberate duplicate of `thrownMessage` in `packages/ssr/src/vera/escaping.ts` — fix both copies.** `@verajs/ssr`\n * is compiled per file with no bundling, so it cannot import this private, unpublished package at run time;\n * `tests/thrown-message-copies.test.mjs` runs one table of thrown values against both, so they cannot drift.\n */\nexport const thrownMessage = (error: unknown): string => {\n try {\n if (error instanceof Error) return String(error.message);\n const message = (error as { message?: unknown } | null)?.message;\n return typeof message === 'string' ? message : String(error);\n } catch {\n return '[unprintable value thrown]';\n }\n};\n"],"names":["registered","report","error","root","line","handlers","element","length","handler","reportError","console","reportUncaught","reportTo","get","undefined","nodeType","host","hostOf","firstIn","firstElementChild","nextIn","node","at","parentElement","nextElementSibling","elements","registry","name","on","fn","built","_result","_readScope","claims","template","positions","behaviors","i","behavior","push","_$inst$","$c","instance","adopted","found","listed","Array","isArray","k","create","f","r","a","d","$m","given","state","context","value","mount","unmount","$q","kept","hookFor","priority"],"mappings":"AAyBA,IAAIA,EAA4C,KAQhD,MAAMC,EAAS,CAACC,EAAgBC,EAAmBC,ICiC3B,EAACC,EAA0CH,EAAgBI,EAA8BF,KAC/G,GAAIC,GAAUE,OAAQ,IAAK,MAAMC,KAAWH,EAAWG,EAAwDN,EAAOI,OAlB1F,EAACJ,EAAgBE,KAClB,mBAAhBK,YAA4BC,QAAQR,MAAME,EAAMF,GAGzDO,YAAYP,EACd,EAcKS,CAAeT,EAAOE,EAAK,EDnCkCQ,CAASZ,GAAYa,IAAI,SAAUX,ECuCjF,CAACC,GACb,MAARA,OAAeW,EAA8B,KAAlBX,EAAKY,SAAmBZ,EAAoBa,KAAQb,EDxC6Bc,CAAOd,GAAOC,GAOtHc,EAAWf,GAAkD,IAAlBA,EAAKY,SAAkBZ,EAAoBA,EAAoBgB,kBAC1GC,EAAS,CAACC,EAAelB,KAC7B,GAA+B,OAA3BkB,EAAKF,kBAA4B,OAAOE,EAAKF,k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AO,CAAEE,EAAGN,EAAOO,EAAGhD,EAAMiD,EAAGT,EAASK,OAAGlC,EAAWuC,GAAG,EAAgB,EAE3EC,GAAKC,IACH,MAAMC,EAAQD,EAEd,GAAIC,EAAMH,EAAG,OACb,MAAMT,EAAQY,EAAMN,EACdO,EAAU,CAAEtD,KAAMqD,EAAML,EAAGR,QAASa,EAAMJ,GAChDI,EAAMN,EAAI,KACV,IAAK,IAAIb,EAAI,EAAGA,EAAIO,EAAMrC,OAAQ8B,GAAK,EAAG,CACxC,MAAMC,EAAWM,EAAMP,EAAI,GAC3B,IAAIqB,EACJ,IACEA,EAAQpB,EAASqB,QAAQf,EAAMP,GAAeoB,EAChD,CAAE,MAAOvD,GACPD,EAAOC,EAAOsD,EAAML,EAA+I,sBACnK,QACF,MACcrC,IAAV4C,QAA4C5C,IAArBwB,EAASsB,UAAwBJ,EAAMR,IAAM,IAAIT,KAAKK,EAAMP,GAAIC,EAAUoB,EACvG,GAEFG,GAAKN,IACH,MAAMC,EAAQD,EACdC,EAAMH,GAAI,EACV,MAAMS,EAAON,EAAMR,EACnB,QAAalC,IAATgD,EACF,IAAK,IAAIzB,EAAI,EAAGA,EAAIyB,EAAKvD,OAAQ8B,GAAK,EACpC,IACGyB,EAAKzB,EAAI,GAAuBuB,QAASE,EAAKzB,EAAI,GAAIyB,EAAKzB,GAC9D,CAAE,MAAOnC,GACPD,EAAOC,EAAOsD,EAAML,EAAqJ,qBAC3K,KAyBuCY,CAAQ5B,EAAWC,GAAU,EAQO4B,SAAU"}
1
+ {"version":3,"file":"vera-renderer-elements.min.js","sources":["../src/elements.ts","../../shared-utils/src/utils.ts"],"sourcesContent":["/**\n * **`@verajs/renderer/elements` — attach behavior to elements in templates.**\n *\n * ```js\n * const autofocus = { mount: (element) => element.focus() };\n * wire([renderer, elements, { on: 'element', fn: (el) => (el.hasAttribute('autofocus') ? autofocus : undefined) }]);\n * ```\n *\n * Every `'element'` claimant is asked about each element of a template ONCE, as the template is BUILT — on its\n * canonical content, so a tag and its static attributes are real and no binding is ever applied (a hydrated first\n * instance, whose elements are the server's with bound values in them, changes nothing). The answers are two flat\n * lists shared by every instance: element positions in document pre-order, and their behaviors. A template nobody\n * claimed anything in gets no instance hook at all. Each instance finds its claimed elements with one short walk to\n * those positions; once the render that created it has finished, each behavior's `mount` runs, and what it returns is\n * handed to `unmount` at teardown. Nothing runs per update.\n *\n * Built on the renderer's `'template'` insert and instance hook (`InstanceHook`); it imports nothing — the registry\n * arrives through its connector. An app that does not wire it pays nothing.\n */\nimport type { ElementBehavior, InstanceHook } from './types.js';\nimport { diagnostic, hostOf, reportTo } from '@verajs/shared-utils';\nimport { PROSE } from './elements-diagnostics.js';\n\ntype Claim = (element: Element) => ElementBehavior | undefined;\n\nlet registered: Map<string, unknown[]> | null = null;\n\n/**\n * **A claim's callbacks follow the ref rule** (Brian, 2026-10-09): user code a render calls is caught AT ITS CALL SITE\n * — so a template with no claims runs exactly the path it did — reported to the app's `'error'` chain with the\n * component it belongs to (else as uncaught), and the render, the other claims and the teardown carry on. A mid-commit\n * throw once left a component's root empty for good; `mount` propagating aborted every later claim's mount.\n */\nconst report = (error: unknown, root: Node | null, line: string) => reportTo(registered?.get('error'), error, hostOf(root), line);\n\n/**\n * **The next element of an instance in document pre-order, never leaving it.** A root is a fragment, or — for a\n * single-root template — its one element, which is then position 0. Bounded by the root rather than by the tree it\n * sits in, because a hydrated instance is already in the page.\n */\nconst firstIn = (root: Node): Element | null => (root.nodeType === 1 ? (root as Element) : (root as ParentNode).firstElementChild);\nconst nextIn = (node: Element, root: Node): Element | null => {\n if (node.firstElementChild !== null) return node.firstElementChild;\n for (let at: Element | null = node; at !== null && at !== root; at = at.parentElement)\n if (at.nextElementSibling !== null) return at.nextElementSibling;\n return null;\n};\n\n/**\n * One instance's claims until it mounts — its claimed elements and their behaviors, interleaved, where it rendered,\n * whether it was adopted — and then only what `unmount` needs. **The elements are released at mount**: per-instance\n * state that keeps DOM references past the moment it needs them costs every operation on the page (measured: ~7% on\n * select and swap of a table whose every row was claimed, operations that never touch it).\n */\ntype State = { f: (Element | ElementBehavior)[] | null; r: Node | null; a: boolean; k: unknown[] | undefined; d: boolean };\n\n/** The instance hook for one template, from the positions and behaviors its claimants answered. */\nconst hookFor = (positions: number[], behaviors: ElementBehavior[]): InstanceHook => ({\n $c: (instance, root, adopted) => {\n const found: (Element | ElementBehavior)[] = [];\n /**\n * ADOPTED, the instance arrives as its elements in template order (hydration pairs them): its live root already\n * holds what its nested parts rendered, so counting there would land on the wrong element.\n */\n const listed = Array.isArray(instance);\n let node = listed ? null : firstIn(instance as Node);\n let at = 0;\n for (let k = 0; k < positions.length; k++) {\n if (listed) node = (instance as readonly Element[])[positions[k]];\n else for (; at < positions[k]; at++) node = nextIn(node!, instance as Node);\n /**\n * At creation — before the first update, and before the instance is connected anywhere. A claim whose `create`\n * throws is reported and DROPPED for this instance (it never mounts or unmounts, being half made); the element\n * stays as the template built it — a claim inserts nothing — and every other claim carries on. The ref rule.\n */\n try {\n behaviors[k].create?.(node!, adopted);\n } catch (error) {\n report(error, root, __DEV__ ? diagnostic('elements', 'an element claim', 'claim-threw', __DEV__ && PROSE['claim-threw']('create', 'the render continued without it')) : '[vera] claim-threw');\n continue;\n }\n found.push(node!, behaviors[k]);\n }\n return { f: found, r: root, a: adopted, k: undefined, d: false } as State;\n },\n $m: (given) => {\n const state = given as State;\n /** Torn down before its render finished: it never mounts. */\n if (state.d) return;\n const found = state.f!;\n const context = { root: state.r, adopted: state.a };\n state.f = null;\n for (let i = 0; i < found.length; i += 2) {\n const behavior = found[i + 1] as ElementBehavior;\n let value;\n try {\n value = behavior.mount?.(found[i] as Element, context);\n } catch (error) {\n report(error, state.r, __DEV__ ? diagnostic('elements', 'an element claim', 'claim-threw', __DEV__ && PROSE['claim-threw']('mount', 'the others still mounted')) : '[vera] claim-threw');\n continue;\n }\n if (value !== undefined && behavior.unmount !== undefined) (state.k ??= []).push(found[i], behavior, value);\n }\n },\n $q: (given) => {\n const state = given as State;\n state.d = true;\n const kept = state.k;\n if (kept !== undefined)\n for (let i = 0; i < kept.length; i += 3)\n try {\n (kept[i + 1] as ElementBehavior).unmount!(kept[i + 2], kept[i] as Element);\n } catch (error) {\n report(error, state.r, __DEV__ ? diagnostic('elements', 'an element claim', 'claim-threw', __DEV__ && PROSE['claim-threw']('unmount', 'the rest of the teardown ran')) : '[vera] claim-threw');\n }\n },\n});\n\n/**\n * Asks the claimants about the template's canonical content, once, as it is built — and gives it an instance hook\n * only if something was claimed. The content is READ, never changed (see the `'template'` insert's contract).\n */\nconst claimTemplate = (built: object, _result: unknown, _readScope: unknown, root: Node) => {\n const claims = registered?.get('element') as Claim[] | undefined;\n if (claims === undefined || claims.length === 0) return;\n const template = built as { _$inst$?: InstanceHook };\n if (__DEV__ && template._$inst$ !== undefined)\n console.warn(diagnostic('elements', 'template', 'elements-hook-replaced', __DEV__ && PROSE['elements-hook-replaced']()));\n const positions: number[] = [];\n const behaviors: ElementBehavior[] = [];\n let at = 0;\n for (let node = firstIn(root); node !== null; node = nextIn(node, root), at++)\n for (let i = 0; i < claims.length; i++) {\n const behavior = claims[i](node);\n if (behavior !== undefined) {\n positions.push(at);\n behaviors.push(behavior);\n }\n }\n if (positions.length > 0) template._$inst$ = hookFor(positions, behaviors);\n};\n\n/** Wire it as `wire([renderer, elements, …claims])`. A bare module: it has no options. */\nexport const elements = [\n (registry: Map<string, unknown[]>) => {\n registered = registry;\n },\n { name: '@verajs/renderer/elements', on: 'template' as const, fn: claimTemplate, priority: 10 },\n];\n\nexport type { ElementBehavior } from './types.js';\n","import type { HandlerHolder, Untracked } from './types.js';\nimport { diagnostic } from './diagnostic.js';\nimport * as SHARED from './diagnostics.js';\n\n/**\n * Get an object's type.\n *\n * @param obj The object\n * @return The type\n */\nexport const getType = (obj: unknown) => Object.prototype.toString.call(obj).slice(8, -1).toLowerCase();\n\n/**\n * Weak collections need their per-key dependencies stored weakly, or tracking `weakMap.get(obj)`\n * holds `obj` and defeats the whole point of the type. Checked by type string rather than\n * `instanceof`, which fails across realms (iframes, `vm`).\n */\n/**\n * A WeakMap or WeakSet (or WeakRef) — read from `Symbol.toStringTag`, the tag `Object.prototype.toString` itself reads, so\n * the answer is the same (another realm's collections included) without building and lower-casing a string on every first\n * tracked read of every object.\n */\nexport const isWeakCollection = (item: unknown) => {\n const tag = (item as { [Symbol.toStringTag]?: unknown } | null)?.[Symbol.toStringTag];\n return typeof tag === 'string' && (tag[0] === 'W' || tag[0] === 'w');\n};\n\n/**\n * Remove a trailing slash from an url if its not root url (`/`).\n *\n * @param str String to remove trailing slash from\n */\nexport const stripTrailingSlash = (str: string) => (str !== '/' && str.endsWith('/') ? str.slice(0, -1) : str);\n\n/**\n * **Reports an error nothing else handled, the way the platform reports one.** `reportError` fires\n * the window's `error` event — what `window.onerror`, error trackers and test runners listen for —\n * without unwinding the caller, so one failing hook or ref never stops its siblings. A bare\n * `console.error` reached none of those: a component could stop updating while every page-error\n * listener stayed silent. Off-browser (Node has no `reportError`) the console is all there is.\n * `line` is the framework's own line, printed beside the error — a CODED one (2026-10-09):\n * each caller passes `'[vera] <code>'` in production and its table's `diagnostic()` sentence in development, both\n * literal codes at the call site, so the static checks read them. The subject is fixed wording too (`a hook`, `an\n * element ref`), never a tag name: this line is the console's FORMAT (no `'%s'`, which measured +2–3 B on the renderer\n * bundles), so nothing from outside may reach it — the element goes to the `'error'` handlers instead. Production prints it only where the platform has no\n * `reportError` (Node); in a browser, `reportError` alone reports.\n *\n * Shared by core (a hook threw) and the renderer (a ref threw) so the fallback is one rule.\n */\nexport const reportUncaught = (error: unknown, line: string) => {\n if (typeof reportError !== 'function') console.error(line, error);\n else {\n if (__DEV__) console.error(line, error);\n reportError(error);\n }\n};\n\n/**\n * **Reports what user code a render called threw — to the app's `'error'` chain, else as uncaught.** One rule for\n * every callback the framework runs on the user's behalf and survives: a hook (core), an element ref, and an element\n * claim's `create`/`mount`/`unmount` (the renderer). The caller catches at the call site and carries on, so one\n * failing callback never stops its siblings or leaves a commit half applied. `element` is the component the error\n * belongs to, handed to each handler. Every throw is reported — nothing is deduped, as a hook's never was.\n * **Core keeps a deliberate twin** (`reportHookError`, the same rule as a `forEach`): routed through here it measured\n * +11 B gzip on `vera.min.js` (2026-10-09). A change to the rule changes both.\n */\nexport const reportTo = (handlers: readonly unknown[] | undefined, error: unknown, element: Element | undefined, line: string) => {\n if (handlers?.length) for (const handler of handlers) (handler as (error: unknown, element?: Element) => void)(error, element);\n else reportUncaught(error, line);\n};\n\n/** The component a render root belongs to: a shadow root's host, or a light root itself. */\nexport const hostOf = (root: Node | null | undefined): Element | undefined =>\n root == null ? undefined : root.nodeType === 11 ? (root as ShadowRoot).host : (root as Element);\n\n/** `fn(a, b, c)`, tracked as the caller is — the stand-in for core's `untracked` when no core was wired. */\nexport const call: Untracked = (fn, a, b, c) => fn(a!, b!, c!);\n\n/**\n * **Runs a bound handler, and its callers run it UNTRACKED**: the renderer's template `@event` and spread's event key,\n * each through `untracked(dispatch, holder, event)` (2026-10-09). An effect that fires an event synchronously\n * (`el.click()`, `focus()`, `dispatchEvent`) runs the handler INSIDE itself, and the handler's reads subscribed the\n * effect: a handler doing `state.n++` made the effect re-run on every click, a self-feeding loop held to one round per\n * frame, forever (measured). A handler's reads are event-time decisions, never a hook's inputs. The directives engine's\n * delegated `listen` makes the same choice its own way. A function is called with the element as `this`; an object\n * through its `handleEvent`. One function for both callers (Brian's size-audit ruling, 2026-11-13): it was two\n * identical copies, so a fix had two addresses; each bundle still inlines its own.\n */\nexport const dispatch = (holder: HandlerHolder, event: Event) => {\n const handler = holder._handler as EventListener | EventListenerObject | null;\n if (typeof handler === 'function') handler.call(holder._element as never, event);\n else if (typeof handler?.handleEvent === 'function') handler.handleEvent(event);\n};\n\n/**\n * **Whether a property binding is a `<select>`'s SELECTION** — `value` or `selectedIndex` — which the renderer and\n * `spread` both treat as live: re-asserted every render and compared against the live value (as `!value` is), because\n * a select's options can be replaced under an unchanged value, which drops the selection. One rule, asked once per\n * binding by both, so a template and a spread key cannot disagree about it.\n *\n * In development it names the one shape it cannot serve: on a `<select multiple>` both properties read and set a\n * SINGLE selection, so a selection the user adds is kept rather than controlled. Always writing there was measured\n * 2–3% slower on every table with a select per row, to serve an API that does not fit — hence a warning, not a cost.\n */\nexport const isSelection = (element: Element, name: unknown) => {\n if ((name !== 'value' && name !== 'selectedIndex') || element.localName !== 'select') return false;\n return true;\n};\n\n/**\n * Development: the one shape a selection binding cannot serve, named by the module the user wired (`side`). Called only\n * behind `__DEV__` at each call site, so production keeps `isSelection` exactly as small as it was (a `side` argument on\n * it measured +1 B, a default +9 B on vera-renderer.min.js — 2026-10-09).\n */\nexport const saySelectMultiple = (element: Element, name: unknown, side: string) => {\n if (element.hasAttribute('multiple'))\n console.warn(diagnostic(side, '<select multiple>', 'select-multiple', __DEV__ && SHARED.selectMultiple(String(name))));\n};\n\n/**\n * `target[key]`, as a function — how a component's GETTER is read through `untracked`. Not `Reflect.get`: `untracked`\n * passes three arguments, and `Reflect.get`'s third is the RECEIVER — `undefined` there runs the getter with no `this`.\n */\nexport const read = (target: object, key: string) => (target as Record<string, unknown>)[key];\n\n/**\n * **What a thrown value says, whatever was thrown — and it never throws itself.** A caught value comes from author\n * code (a `resolve` option, a motion tick or vocabulary function), and JavaScript can throw anything: `null`, an object\n * with no prototype (`String()` finds no `toString`), one whose `toString` or `message` getter throws, a Proxy whose\n * traps throw. Formatting it naively replaced the real failure with an unrelated TypeError from inside the framework.\n * Anything unreadable becomes a fixed phrase; `Object.prototype.toString` is no fallback, since it reads\n * `Symbol.toStringTag` through a Proxy's trap too.\n *\n * **A deliberate duplicate of `thrownMessage` in `packages/ssr/src/vera/escaping.ts` — fix both copies.** `@verajs/ssr`\n * is compiled per file with no bundling, so it cannot import this private, unpublished package at run time;\n * `tests/thrown-message-copies.test.mjs` runs one table of thrown values against both, so they cannot drift.\n */\nexport const thrownMessage = (error: unknown): string => {\n try {\n if (error instanceof Error) return String(error.message);\n const message = (error as { message?: unknown } | null)?.message;\n return typeof message === 'string' ? message : String(error);\n } catch {\n return '[unprintable value thrown]';\n }\n};\n\n/** `data-tone` → `dataTone`: the prop an observed attribute arrives as, in every package that defines components (`@verajs/core`'s `define`, its checks, `@verajs/lite`). */\nexport const camel = (name: string) => name.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase());\n"],"names":["registered","report","error","root","line","handlers","element","length","handler","reportError","console","reportUncaught","reportTo","get","undefined","nodeType","host","hostOf","firstIn","firstElementChild","nextIn","node","at","parentElement","nextElementSibling","elements","registry","name","on","fn","built","_result","_readScope","claims","template","positions","behaviors","i","behavior","push","_$inst$","$c","instance","adopted","found","listed","Array","isArray","k","create","f","r","a","d","$m","given","state","context","value","mount","unmount","$q","kept","hookFor","priority"],"mappings":"AAyBA,IAAIA,EAA4C,KAQhD,MAAMC,EAAS,CAACC,EAAgBC,EAAmBC,ICiC3B,EAACC,EAA0CH,EAAgBI,EAA8BF,KAC/G,GAAIC,GAAUE,OAAQ,IAAK,MAAMC,KAAWH,EAAWG,EAAwDN,EAAOI,OAlB1F,EAACJ,EAAgBE,KAClB,mBAAhBK,YAA4BC,QAAQR,MAAME,EAAMF,GAGzDO,YAAYP,EACd,EAcKS,CAAeT,EAAOE,EAAK,EDnCkCQ,CAASZ,GAAYa,IAAI,SAAUX,ECuCjF,CAACC,GACb,MAARA,OAAeW,EAA8B,KAAlBX,EAAKY,SAAmBZ,EAAoBa,KAAQb,EDxC6Bc,CAAOd,GAAOC,GAOtHc,EAAWf,GAAkD,IAAlBA,EAAKY,SAAkBZ,EAAoBA,EAAoBgB,kBAC1GC,EAAS,CAACC,EAAelB,KAC7B,GAA+B,OAA3BkB,EAAKF,kBAA4B,OAAOE,EAAKF,kBACjD,IAAK,IAAIG,EAAqBD,EAAa,OAAPC,GAAeA,IAAOnB,EAAMmB,EAAKA,EAAGC,cACtE,GAA8B,OAA1BD,EAAGE,mBAA6B,OAAOF,EAAGE,mBAChD,OAAO,IAAI,EAkGAC,EAAW,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,EAAMN,EACdO,EAAU,CAAEtD,KAAMqD,EAAML,EAAGR,QAASa,EAAMJ,GAChDI,EAAMN,EAAI,KACV,IAAK,IAAIb,EAAI,EAAGA,EAAIO,EAAMrC,OAAQ8B,GAAK,EAAG,CACxC,MAAMC,EAAWM,EAAMP,EAAI,GAC3B,IAAIqB,EACJ,IACEA,EAAQpB,EAASqB,QAAQf,EAAMP,GAAeoB,EAChD,CAAE,MAAOvD,GACPD,EAAOC,EAAOsD,EAAML,EAA+I,sBACnK,QACF,MACcrC,IAAV4C,QAA4C5C,IAArBwB,EAASsB,UAAwBJ,EAAMR,IAAM,IAAIT,KAAKK,EAAMP,GAAIC,EAAUoB,EACvG,GAEFG,GAAKN,IACH,MAAMC,EAAQD,EACdC,EAAMH,GAAI,EACV,MAAMS,EAAON,EAAMR,EACnB,QAAalC,IAATgD,EACF,IAAK,IAAIzB,EAAI,EAAGA,EAAIyB,EAAKvD,OAAQ8B,GAAK,EACpC,IACGyB,EAAKzB,EAAI,GAAuBuB,QAASE,EAAKzB,EAAI,GAAIyB,EAAKzB,GAC9D,CAAE,MAAOnC,GACPD,EAAOC,EAAOsD,EAAML,EAAqJ,qBAC3K,KAyBuCY,CAAQ5B,EAAWC,GAAU,EAQO4B,SAAU"}
@@ -1,2 +1,2 @@
1
- const n="data-vm-light",l=(n,l)=>8===n.nodeType&&n.data===l,t=(n,l)=>{const t=[];for(let r=n;null!==r&&r!==l;r=r.nextSibling)8!==r.nodeType&&t.push(r);return t},r=(n,l)=>{const t=[];for(const r of""===n?[]:n.split(",")){const[n,o="1"]=r.split("*"),u=l[+n];for(let n=+o;n>0;n--){let n=u?.shift();if(void 0===n)return null;for(t.push(n);3===n.nodeType&&void 0!==u[0]&&u[0]===n.nextSibling&&3===u[0].nodeType;)t.push(n=u.shift())}}return l.every((n=>0===n.length))?t:null},o=n=>{let t=n.nextSibling;for(;null!==t&&!l(t,"]")&&!l(t,"[");)t=t.nextSibling;return null!==t&&l(t,"]")?t:null},u=new WeakSet,e=(r,s,c)=>{for(let f=r.firstChild;null!==f;f=f.nextSibling)if(f!==c)if(l(f,"[")){const n=o(f);null!==n&&(s.push(t(f.nextSibling,n)),f=n)}else 1!==f.nodeType||f.hasAttribute(n)||u.has(f)||e(f,s,null)},s=n=>{const l=n.firstChild;return null!==l&&1===l.nodeType&&l.hasAttribute("data-vm-unassigned")?l:null},c=n=>{const l=null===n?-1:n.indexOf(":");return l<0||"1"!==n.slice(0,l)?null:n.slice(l+1)},f=(n,l)=>{const r=[];return e(n,r,l),null!==l&&r.push(t(l.firstChild,null)),r},i=l=>{const t=c(l.getAttribute(n));return null===t?null:r(t,f(l,s(l)))};let a,d;const _=(l,t)=>{d=t;const r=a._$capture$;if(void 0===r)throw new Error("[vera] hydrate-slots-unwired");const o=l.getAttribute(n);l.removeAttribute(n),u.add(l),1!==r[0]&&d("protocol",l,!1);const e=c(o),f={l:l,t:e??"",carrier:s(l),o:[],u:r[1]};return null===e&&(m(f),d("format",l,(()=>"update @verajs/ssr and @verajs/renderer together"))),f},p=(n,r,u)=>{if("slot"!==n.localName)return null;const e=0===r.offset?r.node:null;if(null===e||!l(e,"["))return null;const s=o(e);if(null===s)return d("slot",e,!1);u.o.push(t(e.nextSibling,s));const c=r.parent.ownerDocument.importNode(n,!0);return c._$region$=[e,s],r.node=s.nextSibling,c};let v=[];const h=n=>{const{parent:l,i:t,t:r,end:o}=n,u=l;t.length!==4*r&&d("run",u,!1);const[,e,c,f,_,p,v]=a._$capture$,h=(0===o?c(u):i(u))??d("run",u,!1),g=n=>null===n?h.length:h.indexOf(n);0!==o&&e(u,null,h,s(u),!0);const m=f.get(u),{holding:w}=m,j=w.lastChild,k=u.ownerDocument;for(let n=0;n<t.length;n+=4){const l=g(t[n+1]),r=h.slice(l,g(t[n+3])),o=m.units.findIndex((n=>n.a===h[l]));m.units=m.units.filter((n=>!r.includes(n.a)));const u={a:k.createComment(""),z:k.createComment("")};w.insertBefore(u.a,j),w.insertBefore(t[n],j);for(const n of r)n.parentNode===w?(w.insertBefore(n,j),p.set(n,null)):(_(n,w,j),p.has(n)||p.set(n,v));w.insertBefore(t[n+2],j),w.insertBefore(u.z,j),m.units.splice(o<0?m.units.length:o,0,u)}},g=n=>{for(const n of v)h(n);if(v=[],null===n)return;const l=n,{l:o,carrier:u,o:e}=l;null!==u&&e.push(t(u.firstChild,null)),l.u(o,null,r(l.t,e)??d("slots",o,!1),u)},m=n=>{if(v=[],null===n)return;const{l:l,t:t,u:o,carrier:u}=n,e=f(l,u),s=e.flat();o(l,null,r(t,e)??s,u)},w=(n,l,t,r)=>{if(null===l.firstChild||!n.localName.includes("-"))return null;let o=0;for(let n=l.firstChild;null!==n;n=n.nextSibling)if(3===n.nodeType){const l=t.get(n);void 0!==l&&null!=r[l[0]]&&"object"==typeof r[l[0]]&&o++}const u=a._$capture$,e=1===u?.[0]?u[2](n):null;if(null!==e)return j(n,e,0,o);const s=i(n);return null===s?null:j(n,s,s.length,o)},j=(n,l,t,r)=>{const o={parent:n,node:l[0]??null,offset:0,light:l,at:0,end:t,t:r,i:[]};return r>0&&v.push(o),o},k=(n,l)=>{n.offset>0&&(n.node=n.node.splitText(n.offset),n.offset=0);const t=n.node;3===l.nodeType?(null===t?n.parent:t.parentNode).insertBefore(l,t):n.i.push(l,t)},y=(n,l)=>{const t=n.light;return void 0===t?l.nextSibling:t[++n.at]??null},b=n=>{a=n,n._$hydrateSlots$=[1,_,p,g,m,w,y,k]};export{b as hydrateSlots};
1
+ const n="data-vm-light",l=(n,l)=>8===n.nodeType&&n.data===l,t=(n,l)=>{const t=[];for(let r=n;null!==r&&r!==l;r=r.nextSibling)8!==r.nodeType&&t.push(r);return t},r=(n,l)=>{const t=[];for(const r of""===n?[]:n.split(",")){const[n,o="1"]=r.split("*"),u=l[+n];for(let n=+o;n>0;n--){let n=u?.shift();if(void 0===n)return null;for(t.push(n);3===n.nodeType&&void 0!==u[0]&&u[0]===n.nextSibling&&3===u[0].nodeType;)t.push(n=u.shift())}}return l.every((n=>0===n.length))?t:null},o=n=>{let t=n.nextSibling;for(;null!==t&&!l(t,"]")&&!l(t,"[");)t=t.nextSibling;return null!==t&&l(t,"]")?t:null},u=new WeakSet,e=(r,s,c)=>{for(let f=r.firstChild;null!==f;f=f.nextSibling)if(f!==c)if(l(f,"[")){const n=o(f);null!==n&&(s.push(t(f.nextSibling,n)),f=n)}else 1!==f.nodeType||f.hasAttribute(n)||u.has(f)||e(f,s,null)},s=n=>{const l=n.firstChild;return null!==l&&1===l.nodeType&&l.hasAttribute("data-vm-unassigned")?l:null},c=n=>{const l=null===n?-1:n.indexOf(":");return l<0||"1"!==n.slice(0,l)?null:n.slice(l+1)},f=(n,l)=>{const r=[];return e(n,r,l),null!==l&&r.push(t(l.firstChild,null)),r},i=l=>{const t=c(l.getAttribute(n));return null===t?null:r(t,f(l,s(l)))};let a,d;const _=(l,t)=>{d=t;const r=a._$capture$;if(void 0===r)throw new Error("[vera] hydrate-slots-unwired");const o=l.getAttribute(n);l.removeAttribute(n),u.add(l),2!==r[0]&&d("protocol",l,!1);const e=c(o),f={l:l,t:e??"",carrier:s(l),o:[],u:r[1]};return null===e&&(m(f),d("format",l,(()=>"update @verajs/ssr and @verajs/renderer together"))),f},p=(n,r,u)=>{if("slot"!==n.localName)return null;const e=0===r.offset?r.node:null;if(null===e||!l(e,"["))return null;const s=o(e);if(null===s)return d("slot",e,!1);u.o.push(t(e.nextSibling,s));const c=r.parent.ownerDocument.importNode(n,!0);return c._$region$=[e,s],r.node=s.nextSibling,c};let v=[];const h=n=>{const{parent:l,i:t,t:r,end:o}=n,u=l;t.length!==4*r&&d("run",u,!1);const[,e,c,f,_,p,v]=a._$capture$,h=(0===o?c(u):i(u))??d("run",u,!1),g=n=>null===n?h.length:h.indexOf(n);0!==o&&e(u,null,h,s(u),!0);const m=f.get(u),{holding:w}=m,j=w.lastChild,k=u.ownerDocument;for(let n=0;n<t.length;n+=4){const l=g(t[n+1]),r=h.slice(l,g(t[n+3])),o=m.units.findIndex((n=>n.a===h[l]));m.units=m.units.filter((n=>!r.includes(n.a)));const u={a:k.createComment(""),z:k.createComment("")};w.insertBefore(u.a,j),w.insertBefore(t[n],j);for(const n of r)n.parentNode===w?(w.insertBefore(n,j),p.set(n,null)):(_(n,w,j),p.has(n)||p.set(n,v));w.insertBefore(t[n+2],j),w.insertBefore(u.z,j),m.units.splice(o<0?m.units.length:o,0,u)}},g=n=>{for(const n of v)h(n);if(v=[],null===n)return;const l=n,{l:o,carrier:u,o:e}=l;null!==u&&e.push(t(u.firstChild,null)),l.u(o,null,r(l.t,e)??d("slots",o,!1),u)},m=n=>{if(v=[],null===n)return;const{l:l,t:t,u:o,carrier:u}=n,e=f(l,u),s=e.flat();o(l,null,r(t,e)??s,u)},w=(n,l,t,r)=>{if(null===l.firstChild||!n.localName.includes("-"))return null;let o=0;for(let n=l.firstChild;null!==n;n=n.nextSibling)if(3===n.nodeType){const l=t.get(n);void 0!==l&&null!=r[l[0]]&&"object"==typeof r[l[0]]&&o++}const u=a._$capture$,e=2===u?.[0]?u[2](n):null;if(null!==e)return j(n,e,0,o);const s=i(n);return null===s?null:j(n,s,s.length,o)},j=(n,l,t,r)=>{const o={parent:n,node:l[0]??null,offset:0,light:l,at:0,end:t,t:r,i:[]};return r>0&&v.push(o),o},k=(n,l)=>{n.offset>0&&(n.node=n.node.splitText(n.offset),n.offset=0);const t=n.node;3===l.nodeType?(null===t?n.parent:t.parentNode).insertBefore(l,t):n.i.push(l,t)},y=(n,l)=>{const t=n.light;return void 0===t?l.nextSibling:t[++n.at]??null},b=n=>{a=n,n._$hydrateSlots$=[2,_,p,g,m,w,y,k]};export{b as hydrateSlots};
2
2
  //# sourceMappingURL=vera-renderer-hydrate-slots.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vera-renderer-hydrate-slots.min.js","sources":["../src/kinds.ts","../src/hydrate-slots.ts"],"sourcesContent":["/**\n * **The renderer's binding kinds and child-part modes** — numbers both `renderer.ts` and the separately bundled\n * `hydration.ts` read, from ONE source (each bundle inlines them; they are literals in the output). A change here\n * changes the hand-off's protocol: bump `$V` in `renderer.ts`.\n */\n/** A binding's kind, resolved once per template. */\nexport const IGNORED = 0; // consumed, nothing rendered: inside a comment, the later values of a multi-part attribute\nexport const CHILD = 1; // anchored on a primed empty text node the template carries\nexport const SOLE = 2; // its element's only content: no anchor in the template, the first commit writes `textContent`\nexport const ATTR = 3;\nexport const PROPERTY = 4;\nexport const BOOLEAN = 5;\n/** `EVENT` through `ADOPT` hold a `Slot` record in their node slot — one range test, in `instantiate` and `commit`. */\nexport const EVENT = 6;\n/** An element-position expression: a ref, or a value that applies itself (`_$apply$`). */\nexport const REF = 7;\n/** An element-position expression ON a `<select>`: a value applying itself there (a spread) waits for `flush`. */\nexport const SELECT_REF = 8;\n/** `.name` on a custom element — see `adoptProperty` in shared-utils. */\nexport const ADOPT = 9;\n/**\n * Kinds from here on re-assert on EVERY render, so the update loop never skips them as unchanged:\n * `!name` writes from the live DOM's point of view (a sibling radio's click unchecks this one with no\n * event on it), and a `<select>`'s selection is re-applied after its options exist — see `flush`.\n */\nexport const LIVE = 10;\n/** A `<select>`'s selection — `value` or `selectedIndex` (`isSelection`) — written when the pass ends: see `flush`. */\nexport const SELECT = 11;\n/** `!name` on a custom element: compared against the LIVE value — read through `untracked`, it is the component's getter. */\nexport const LIVE_CUSTOM = 12;\n/** A binding that must never write — and, from here on, the kinds `commit` handles before anything is computed. */\nexport const REFUSED = 13;\n/** A `<select>`'s `selectedIndex` — the rare spelling of its selection, queued as `SELECT` is (see `flush`). */\nexport const SELECT_INDEX = 14;\n\n\n/** A child part's mode: what its range currently holds. */\nexport const EMPTY = 0;\nexport const TEXT = 1;\nexport const TEMPLATE = 2;\nexport const LIST = 3;\nexport const NODE = 4;\n\n/**\n * **The hydration hand-off's positions** — the renderer sets `$H` to an array at `connect`, and `hydration.ts` reads\n * it by these. An array, not an object of named fields: the names cost every app bytes (−35 B gzipped measured,\n * 2026-10-02), and these constants inline to literals in both bundles. The first two are FROZEN across protocols — a\n * hydration from another release reads the protocol at 0 and, on a mismatch, can still install its clearing hook at 1.\n * Any other change here is a protocol change: bump `PROTOCOL`.\n */\n/**\n * **The protocol of this package's first-party seams** — the renderer's hand-off (`$H`, at `HANDOFF_PROTOCOL`) and slots'\n * capture (`_$capture$`), both read by hydration. One number for both: the three ship in one package, and a change to\n * either seam bumps it. A hydration that meets another number declines (the page renders fresh) and says so.\n */\nexport const PROTOCOL = 1;\n/** The protocol number — FROZEN at 0. */\nexport const HANDOFF_PROTOCOL = 0;\n/** The first-render hook's setter — FROZEN at 1. */\nexport const HANDOFF_ADOPTER = 1;\nexport const HANDOFF_GET_TEMPLATE = 2;\nexport const HANDOFF_CHILD_PART = 3;\nexport const HANDOFF_INSTANCE = 4;\nexport const HANDOFF_SLOT = 5;\nexport const HANDOFF_UNSET = 6;\nexport const HANDOFF_UPGRADED = 7;\nexport const HANDOFF_COMMIT = 8;\nexport const HANDOFF_COMMIT_AS = 9;\nexport const HANDOFF_HOOK_UP = 10;\nexport const HANDOFF_RESOLVE = 11;\nexport const HANDOFF_ROOTS = 12;\nexport const HANDOFF_TO_TEXT = 13;\nexport const HANDOFF_REMOVAL_WORK = 14;\n","/**\n * **`@verajs/renderer/hydrate-slots` — hydrating light-DOM slots.** `wire([renderer, hydration, slots, hydrateSlots])`.\n *\n * Everything only a page that HYDRATES LIGHT SLOTS runs, kept out of both modules so neither pays for the other (Brian,\n * 2026-10-07): the server's format (`data-vm-light` — its number, the light order — and the carrier), each filled slot's\n * range and detached copy, and the rescue. Hydration calls it through `_$hydrateSlots$`;\n * it captures through slots' `_$capture$`. Slots' own distribution then recomputes every assignment from the nodes'\n * names, so the server's placement decides at most WHETHER a node moves, never where it ends up.\n *\n * Without it, hydration refuses a served light host before touching anything (`hydration-slots`): the page stands as\n * served, and a component boundary reports it once.\n */\nimport { PROTOCOL } from './kinds.js';\nimport { diagnostic } from '@verajs/shared-utils';\nimport { PROSE } from './hydrate-slots-diagnostics.js';\nimport type { CaptureSeam, HydrateSlots, HydrationCursor, HydrationFail, LightCapture, ServedHost } from './types.js';\n\n/** The registry as this module uses it — `get` named so `wire`'s registry is assignable (a type of optional members alone is \"weak\"). */\ntype Registry = { get(name: string): unknown[] | undefined; _$capture$?: CaptureSeam; _$hydrateSlots$?: HydrateSlots };\n/** A served host being adopted: what hydration sees (`ServedHost`), and what this module keeps beside it. */\n/** `_`-named where only this module reads them — the minifier shortens those; `carrier` is hydration's to read too. */\ntype Served = ServedHost & { _host: Element; _runs: string; carrier: HTMLElement | null; _pools: Node[][]; _capture: LightCapture };\n\n/** What `@verajs/ssr` writes — a deliberate second address of its writer; `slots-ssr-client-parity` holds them together. */\nconst FORMAT = '1';\nconst LIGHT_ATTR = 'data-vm-light';\nconst UNASSIGNED = 'data-vm-unassigned';\nconst isMark = (node: Node, data: string) => node.nodeType === 8 && (node as Comment).data === data;\n/** The slottable nodes from `from` up to `to` — comments are never light content. */\nconst pool = (from: Node | null, to: Node | null): Node[] => {\n const out: Node[] = [];\n for (let node = from; node !== null && node !== to; node = node.nextSibling) if (node.nodeType !== 8) out.push(node);\n return out;\n};\n/**\n * The pools' nodes in light order, as the statement gives it — `null` unless it accounts for every one, exactly. The\n * statement counts a run of adjacent TEXT as one light child, as the parser makes it; a walk may since have split it\n * (an outer template's static text beside its value), so the pieces that follow one taken are taken with it.\n */\nconst ordered = (runs: string, pools: Node[][]): Node[] | null => {\n const order: Node[] = [];\n for (const run of runs === '' ? [] : runs.split(',')) {\n const [index, count = '1'] = run.split('*');\n const nodes = pools[+index];\n for (let k = +count; k > 0; k--) {\n let node = nodes?.shift();\n if (node === undefined) return null;\n order.push(node);\n while (node.nodeType === 3 && nodes![0] !== undefined && nodes![0] === node.nextSibling && nodes![0].nodeType === 3) order.push((node = nodes!.shift()!));\n }\n }\n return pools.every((nodes) => nodes.length === 0) ? order : null;\n};\n/** The `]` that closes the range `start` opens — `null` if another `[` or the parent's end comes first: not well-formed. */\nconst endOf = (start: Node): ChildNode | null => {\n let end = start.nextSibling;\n while (end !== null && !isMark(end, ']') && !isMark(end, '[')) end = end.nextSibling;\n return end !== null && isMark(end, ']') ? end : null;\n};\nconst SERVED = new WeakSet<Node>();\n/** Every well-formed range under `parent`, in document order — never entering a range, the carrier, or a served host. */\nconst scan = (parent: Node, out: Node[][], skip: Node | null) => {\n for (let node = parent.firstChild; node !== null; node = node.nextSibling) {\n if (node === skip) continue;\n if (isMark(node, '[')) {\n const end = endOf(node);\n if (end !== null) {\n out.push(pool(node.nextSibling, end));\n node = end;\n }\n } else if (node.nodeType === 1 && !(node as Element).hasAttribute(LIGHT_ATTR) && !SERVED.has(node)) scan(node, out, null);\n }\n};\n\n/** The server's carrier — the host's first child, when it is `<ins data-vm-unassigned>` — or `null`. */\nconst carrierOf = (host: Element): HTMLElement | null => {\n const first = host.firstChild;\n return first !== null && first.nodeType === 1 && (first as Element).hasAttribute(UNASSIGNED) ? (first as HTMLElement) : null;\n};\n/** The statement's runs (after its format number), or `null` for another format or none. */\nconst statementOf = (spec: string | null): string | null => {\n const colon = spec === null ? -1 : spec.indexOf(':');\n return colon < 0 || spec!.slice(0, colon) !== FORMAT ? null : spec!.slice(colon + 1);\n};\n/** Every well-formed range's light nodes, then the carrier's — the pools a statement indexes, found by structure. */\nconst poolsOf = (host: Element, carrier: Node | null): Node[][] => {\n const pools: Node[][] = [];\n scan(host, pools, carrier);\n if (carrier !== null) pools.push(pool(carrier.firstChild, null));\n return pools;\n};\n/** A served host not yet adopted: its light children in light order, read fresh from its statement — or `null`. */\nconst stated = (host: Element): Node[] | null => {\n const runs = statementOf(host.getAttribute(LIGHT_ATTR));\n return runs === null ? null : ordered(runs, poolsOf(host, carrierOf(host)));\n};\n\nlet registry: Registry;\n/** Hydration's mismatch, handed over at `open`. */\nlet fail: HydrationFail;\n\n/** A served host, read: its statement, its carrier. Slots must be wired, and of this release. */\nconst open = (host: Element, failWith: HydrationFail): Served => {\n fail = failWith;\n const seam = registry._$capture$;\n /**\n * A wiring state (the diagnostic shape). Production prints the code alone: the code-and-link shape measured +14 B, the\n * bare code 0 B — Brian's byte rule (a production line carries its code where the bundle is not larger), 2026-10-09.\n */\n if (seam === undefined)\n throw new Error(\n __DEV__ ? diagnostic('hydrate-slots', `<${host.localName}>`, 'hydrate-slots-unwired', __DEV__ && PROSE['hydrate-slots-unwired']()) : '[vera] hydrate-slots-unwired'\n );\n const spec = host.getAttribute(LIGHT_ATTR)!;\n host.removeAttribute(LIGHT_ATTR);\n SERVED.add(host);\n if (seam[0] !== PROTOCOL) fail('protocol', host, __DEV__ && (() => `slots protocol ${seam[0]}, expected ${PROTOCOL}`));\n const runs = statementOf(spec);\n const served = { _host: host, _runs: runs ?? '', carrier: carrierOf(host), _pools: [], _capture: seam[1] };\n /** Another release's server: rescued HERE — hydration holds no state for this host until `open` returns. */\n if (runs === null) {\n rescue(served);\n /** Named in every build (Brian, 2026-10-02): a deploy, not a developer, meets it. */\n fail('format', host, () => `${__DEV__ ? `server format ${JSON.stringify(spec.split(':')[0])}, expected ${FORMAT}: ` : ''}update @verajs/ssr and @verajs/renderer together`);\n }\n return served;\n};\n\n/** At a canonical `<slot>`: a range at the cursor is its region — the slot itself a detached copy, as the client keeps it. */\nconst slot = (canonical: Element, cursor: HydrationCursor, served: ServedHost): Element | null => {\n if (canonical.localName !== 'slot') return null;\n const rs = cursor.offset === 0 ? cursor.node : null;\n if (rs === null || !isMark(rs, '[')) return null;\n const re = endOf(rs);\n if (re === null) return fail('slot', rs, __DEV__ && (() => `a filled slot's range here is not well-formed`));\n (served as Served)._pools.push(pool(rs.nextSibling, re));\n const copy = cursor.parent.ownerDocument!.importNode(canonical, true) as Element & { _$region$?: [Comment, Comment] };\n copy._$region$ = [rs as Comment, re as Comment];\n cursor.node = re.nextSibling;\n return copy;\n};\n\n/** Light hosts a template placed RUNS into, walked in this adoption: captured (or converted) at its close. */\nlet pending: HydrationCursor[] = [];\n\n/**\n * **A light host a template wrote runs into, seated** — whoever walks a light host's content first captures it. Its\n * light children become units in light order: each node outside a run a static, each run `[start, nodes, end]` (its part's\n * anchors, held by `insert`, and the light nodes between them). The statement's order: captured now, waiting for the\n * host's own slots (`wait`). The live record's: each run made one unit of it (`runOf`). Anchors that do not pair up as\n * the template's runs — a run whose items are not each one element — decline.\n */\nconst seat = (cursor: HydrationCursor) => {\n const { parent, _marks: marks, _runs: runs, end } = cursor as Required<HydrationCursor>;\n const host = parent as Element;\n if (marks.length !== runs * 4)\n fail('run', host, __DEV__ && (() => `a list or value this template writes into a light-slot component is not one element per item`));\n const [, capture, lightNodes, records, standIn, placed, adopted] = registry._$capture$!;\n /**\n * The light children NOW, not as the walk began: a text child the walk split is several light children, as a client\n * render makes it — read as the walk began, its pieces were never captured and the next distribution dropped them.\n */\n const nodes = (end === 0 ? lightNodes(host) : stated(host)) ?? fail('run', host, false);\n const index = (node: unknown) => (node === null ? nodes.length : nodes.indexOf(node as Node));\n /** The statement's order: every light child captured as a static first, waiting for the host's own slots. */\n if (end !== 0) capture(host, null, nodes, carrierOf(host), true);\n const record = records.get(host)!;\n const { holding } = record;\n const ref = holding.lastChild;\n const doc = host.ownerDocument;\n for (let m = 0; m < marks.length; m += 4) {\n const k = index(marks[m + 1]);\n const run = nodes.slice(k, index(marks[m + 3]));\n /**\n * **The run, as the client keeps one**, in place of the statics its nodes were: its unit's two comments in holding,\n * its part's anchors inside them, and at each node's place a stand-in if a slot holds it (it stays there), or the\n * node itself if it waits unassigned. Only holding and the record change; no slotted node moves.\n */\n const at = record.units.findIndex((unit) => unit.a === nodes[k]);\n record.units = record.units.filter((unit) => !run.includes(unit.a));\n const unit = { a: doc.createComment(''), z: doc.createComment('') };\n holding.insertBefore(unit.a, ref);\n holding.insertBefore(marks[m] as Node, ref);\n for (const node of run)\n if (node.parentNode === holding) {\n holding.insertBefore(node, ref);\n placed.set(node, null);\n } else {\n standIn(node, holding, ref);\n if (!placed.has(node)) placed.set(node, adopted);\n }\n holding.insertBefore(marks[m + 2] as Node, ref);\n holding.insertBefore(unit.z, ref);\n record.units.splice(at < 0 ? record.units.length : at, 0, unit);\n }\n /** Nothing to mark: holding is watched, so slots notes these writes as it notes any other. */\n};\n\n/** The walk matched: the light children, in light order, captured where they stand — before anything commits. */\nconst close = (adopted: ServedHost | null) => {\n for (const cursor of pending) seat(cursor);\n pending = [];\n if (adopted === null) return;\n const served = adopted as Served;\n const { _host: host, carrier, _pools: pools } = served;\n if (carrier !== null) pools.push(pool(carrier.firstChild, null));\n served._capture(host, null, ordered(served._runs, pools) ?? fail('slots', host, __DEV__ && (() => `its light-slot statement does not account for what its slots hold`)), carrier);\n};\n\n/**\n * It did not: every well-formed range's nodes and the carrier's, captured where they stand before the clear. The clear\n * detaches them with the old markup and the fresh render's end places each by identity, slotted or held — moving them\n * into the carrier first only moved each light node twice more (measured: three disconnect/connect pairs for one).\n */\nconst rescue = (served: ServedHost | null) => {\n pending = [];\n if (served === null) return;\n const { _host: host, _runs: runs, _capture: capture, carrier } = served as Served;\n const pools = poolsOf(host, carrier);\n /** Every node first: `ordered` consumes the pools, and one that fails partway has taken some. */\n const all = pools.flat();\n capture(host, null, ordered(runs, pools) ?? all, carrier);\n};\n\n/**\n * **A light host a template places content into** (the outer walk's light cursor): its children in light order. Slots'\n * live record is the one source once it exists — a node the page added since is in it, and the template need not\n * account for it; before that (the host not yet adopted), the server's statement, read fresh and never cached, which the\n * template must account for exactly. Neither: `null`, and the walk reads the host's DOM.\n */\nconst light = (host: Element, canonical: Element, plan: ReadonlyMap<Node, readonly number[]>, values: readonly unknown[]): HydrationCursor | null => {\n /** Only a custom element the template places content into can be a light host. */\n if (canonical.firstChild === null || !host.localName.includes('-')) return null;\n /** RUNS the template writes directly among those children: a value that is not text (a text value is claimed in place). */\n let runs = 0;\n for (let node: Node | null = canonical.firstChild; node !== null; node = node.nextSibling)\n if (node.nodeType === 3) {\n const owned = plan.get(node);\n if (owned !== undefined && values[owned[0]] != null && typeof values[owned[0]] === 'object') runs++;\n }\n const seam = registry._$capture$;\n const live = seam?.[0] === PROTOCOL ? seam[2](host) : null;\n if (live !== null) return walker(host, live, 0, runs);\n const nodes = stated(host);\n return nodes === null ? null : walker(host, nodes, nodes.length, runs);\n};\n/**\n * A cursor over `nodes` — the walk must account for the first `end` of them (all of a statement's, none of a record's);\n * with runs, held until the adoption's close seats it.\n */\nconst walker = (host: Element, nodes: Node[], end: number, runs: number): HydrationCursor => {\n const cursor = { parent: host, node: nodes[0] ?? null, offset: 0, light: nodes, at: 0, end, _runs: runs, _marks: [] };\n if (runs > 0) pending.push(cursor);\n return cursor;\n};\n\n/**\n * An insert on a light walk. A run's anchor is held, with the node it stands before, for the unit `seat` builds — split\n * first if the walk stands inside a text child, as a plain insert would; text (an empty value's anchor) goes in place.\n */\nconst insert = (cursor: HydrationCursor, node: Node) => {\n if (cursor.offset > 0) {\n cursor.node = (cursor.node as Text).splitText(cursor.offset);\n cursor.offset = 0;\n }\n const at = cursor.node;\n if (node.nodeType === 3) (at === null ? cursor.parent : at.parentNode!).insertBefore(node, at);\n else cursor._marks!.push(node, at);\n};\n\n/** The walk's step, once this piece is wired: on a light cursor the next light child, else the next sibling. */\nconst next = (cursor: HydrationCursor, node: Node): Node | null => {\n const nodes = cursor.light;\n return nodes === undefined ? node.nextSibling : (nodes[++cursor.at!] ?? null);\n};\n\n/** `wire([renderer, hydration, slots, hydrateSlots])`. */\nexport const hydrateSlots = (given: Registry) => {\n registry = given;\n given._$hydrateSlots$ = [PROTOCOL, open, slot, close, rescue, light, next, insert];\n};\n"],"names":["LIGHT_ATTR","isMark","node","data","nodeType","pool","from","to","out","nextSibling","push","ordered","runs","pools","order","run","split","index","count","nodes","k","shift","undefined","every","length","endOf","start","end","SERVED","WeakSet","scan","parent","skip","firstChild","hasAttribute","has","carrierOf","host","first","statementOf","spec","colon","indexOf","slice","poolsOf","carrier","stated","getAttribute","registry","fail","open","failWith","seam","_$capture$","Error","removeAttribute","add","served","_host","_runs","_pools","_capture","rescue","slot","canonical","cursor","localName","rs","offset","re","copy","ownerDocument","importNode","_$region$","pending","seat","_marks","marks","capture","lightNodes","records","standIn","placed","adopted","record","get","holding","ref","lastChild","doc","m","at","units","findIndex","unit","a","filter","includes","createComment","z","insertBefore","parentNode","set","splice","close","all","flat","light","plan","values","owned","live","walker","insert","splitText","next","hydrateSlots","given","_$hydrateSlots$"],"mappings":"AAuDO,MC9BDA,EAAa,gBAEbC,EAAS,CAACC,EAAYC,IAAmC,IAAlBD,EAAKE,UAAmBF,EAAiBC,OAASA,EAEzFE,EAAO,CAACC,EAAmBC,KAC/B,MAAMC,EAAc,GACpB,IAAK,IAAIN,EAAOI,EAAe,OAATJ,GAAiBA,IAASK,EAAIL,EAAOA,EAAKO,YAAmC,IAAlBP,EAAKE,UAAgBI,EAAIE,KAAKR,GAC/G,OAAOM,CAAG,EAONG,EAAU,CAACC,EAAcC,KAC7B,MAAMC,EAAgB,GACtB,IAAK,MAAMC,IAAgB,KAATH,EAAc,GAAKA,EAAKI,MAAM,KAAM,CACpD,MAAOC,EAAOC,EAAQ,KAAOH,EAAIC,MAAM,KACjCG,EAAQN,GAAOI,GACrB,IAAK,IAAIG,GAAKF,EAAOE,EAAI,EAAGA,IAAK,CAC/B,IAAIlB,EAAOiB,GAAOE,QAClB,QAAaC,IAATpB,EAAoB,OAAO,KAE/B,IADAY,EAAMJ,KAAKR,GACc,IAAlBA,EAAKE,eAAgCkB,IAAdH,EAAO,IAAoBA,EAAO,KAAOjB,EAAKO,aAAsC,IAAvBU,EAAO,GAAGf,UAAgBU,EAAMJ,KAAMR,EAAOiB,EAAOE,QACjJ,CACF,CACA,OAAOR,EAAMU,OAAOJ,GAA2B,IAAjBA,EAAMK,SAAgBV,EAAQ,IAAI,EAG5DW,EAASC,IACb,IAAIC,EAAMD,EAAMjB,YAChB,KAAe,OAARkB,IAAiB1B,EAAO0B,EAAK,OAAS1B,EAAO0B,EAAK,MAAMA,EAAMA,EAAIlB,YACzE,OAAe,OAARkB,GAAgB1B,EAAO0B,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IhE,EAAO,GAAG8D,EAAQhE,KAAKuD,GACpBA,CAAM,EAOTgD,EAAS,CAAChD,EAAyB/D,KACnC+D,EAAOG,OAAS,IAClBH,EAAO/D,KAAQ+D,EAAO/D,KAAcgH,UAAUjD,EAAOG,QACrDH,EAAOG,OAAS,GAElB,MAAMuB,EAAK1B,EAAO/D,KACI,IAAlBA,EAAKE,UAAwB,OAAPuF,EAAc1B,EAAOlC,OAAS4D,EAAGU,YAAaD,aAAalG,EAAMyF,GACtF1B,EAAOW,EAAQlE,KAAKR,EAAMyF,EAAG,EAI9BwB,EAAO,CAAClD,EAAyB/D,KACrC,MAAMiB,EAAQ8C,EAAO0C,MACrB,YAAiBrF,IAAVH,EAAsBjB,EAAKO,YAAeU,IAAQ8C,EAAO0B,KAAQ,IAAK,EAIlEyB,EAAgBC,IAC3BrE,EAAWqE,EACXA,EAAMC,gBAAkB,CDhOF,ECgOapE,EAAMa,EAAMyC,EAAO1C,EAAQ6C,EAAOQ,EAAMF,EAAO"}
1
+ {"version":3,"file":"vera-renderer-hydrate-slots.min.js","sources":["../src/kinds.ts","../src/hydrate-slots.ts"],"sourcesContent":["/**\n * **The renderer's binding kinds and child-part modes** — numbers both `renderer.ts` and the separately bundled\n * `hydration.ts` read, from ONE source (each bundle inlines them; they are literals in the output). A change here\n * changes the hand-off's protocol: bump `$V` in `renderer.ts`.\n */\n/** A binding's kind, resolved once per template. */\nexport const IGNORED = 0; // consumed, nothing rendered: inside a comment, the later values of a multi-part attribute\nexport const CHILD = 1; // anchored on a primed empty text node the template carries\nexport const SOLE = 2; // its element's only content: no anchor in the template, the first commit writes `textContent`\nexport const ATTR = 3;\nexport const PROPERTY = 4;\nexport const BOOLEAN = 5;\n/** `EVENT` through `ADOPT` hold a `Slot` record in their node slot — one range test, in `instantiate` and `commit`. */\nexport const EVENT = 6;\n/** An element-position expression: a ref, or a value that applies itself (`_$apply$`). */\nexport const REF = 7;\n/** An element-position expression ON a `<select>`: a value applying itself there (a spread) waits for `flush`. */\nexport const SELECT_REF = 8;\n/** `.name` on a custom element — see `adoptProperty` in shared-utils. */\nexport const ADOPT = 9;\n/**\n * Kinds from here on re-assert on EVERY render, so the update loop never skips them as unchanged:\n * `!name` writes from the live DOM's point of view (a sibling radio's click unchecks this one with no\n * event on it), and a `<select>`'s selection is re-applied after its options exist — see `flush`.\n */\nexport const LIVE = 10;\n/** A `<select>`'s selection — `value` or `selectedIndex` (`isSelection`) — written when the pass ends: see `flush`. */\nexport const SELECT = 11;\n/** `!name` on a custom element: compared against the LIVE value — read through `untracked`, it is the component's getter. */\nexport const LIVE_CUSTOM = 12;\n/** A binding that must never write — and, from here on, the kinds `commit` handles before anything is computed. */\nexport const REFUSED = 13;\n/** A `<select>`'s `selectedIndex` — the rare spelling of its selection, queued as `SELECT` is (see `flush`). */\nexport const SELECT_INDEX = 14;\n/**\n * **An HTML `<style>`'s or JSON data block's whole text** — ONE binding (the element's first value; the others are\n * consumed, as a multi-part attribute's are) composes the statics and values and writes the element's text when it\n * changed. Its text is serialized VERBATIM (BROWSER-LEDGER), so it is written unable to end its element, as the server\n * writes it: in a style each `</style` as `<\\/style`, in a JSON block every `<` as `\\u003c` — on the COMPOSED text, since\n * a closer can form across a hole. Committed in `commit`'s cold branch: the hot text line is untouched.\n */\nexport const RAW_STYLE = 15;\nexport const RAW_JSON = 16;\n/**\n * **An element whose content is never shown** (`<iframe>`, `<noscript>`, `<xmp>`, `<noembed>`, `<noframes>`,\n * `<plaintext>`): its statics and its values composed as text, each VALUE fully encoded (every ASCII non-word character\n * as a character reference), so a page saved from the DOM and parsed again — with scripting on (raw text) or off\n * (markup) — holds no value that can end the element or add an attribute.\n */\nexport const RAW_ENCODED = 17;\n\n\n/** A child part's mode: what its range currently holds. */\nexport const EMPTY = 0;\nexport const TEXT = 1;\nexport const TEMPLATE = 2;\nexport const LIST = 3;\nexport const NODE = 4;\n\n/**\n * **The hydration hand-off's positions** — the renderer sets `$H` to an array at `connect`, and `hydration.ts` reads\n * it by these. An array, not an object of named fields: the names cost every app bytes (−35 B gzipped measured,\n * 2026-10-02), and these constants inline to literals in both bundles. The first two are FROZEN across protocols — a\n * hydration from another release reads the protocol at 0 and, on a mismatch, can still install its clearing hook at 1.\n * Any other change here is a protocol change: bump `PROTOCOL`.\n */\n/**\n * **The protocol of this package's first-party seams** — the renderer's hand-off (`$H`, at `HANDOFF_PROTOCOL`) and slots'\n * capture (`_$capture$`), both read by hydration. One number for both: the three ship in one package, and a change to\n * either seam bumps it. A hydration that meets another number declines (the page renders fresh) and says so.\n */\nexport const PROTOCOL = 2;\n/** The protocol number — FROZEN at 0. */\nexport const HANDOFF_PROTOCOL = 0;\n/** The first-render hook's setter — FROZEN at 1. */\nexport const HANDOFF_ADOPTER = 1;\nexport const HANDOFF_GET_TEMPLATE = 2;\nexport const HANDOFF_CHILD_PART = 3;\nexport const HANDOFF_INSTANCE = 4;\nexport const HANDOFF_SLOT = 5;\nexport const HANDOFF_UNSET = 6;\nexport const HANDOFF_UPGRADED = 7;\nexport const HANDOFF_COMMIT = 8;\nexport const HANDOFF_COMMIT_AS = 9;\nexport const HANDOFF_HOOK_UP = 10;\nexport const HANDOFF_RESOLVE = 11;\nexport const HANDOFF_ROOTS = 12;\nexport const HANDOFF_TO_TEXT = 13;\nexport const HANDOFF_REMOVAL_WORK = 14;\n","/**\n * **`@verajs/renderer/hydrate-slots` — hydrating light-DOM slots.** `wire([renderer, hydration, slots, hydrateSlots])`.\n *\n * Everything only a page that HYDRATES LIGHT SLOTS runs, kept out of both modules so neither pays for the other (Brian,\n * 2026-10-07): the server's format (`data-vm-light` — its number, the light order — and the carrier), each filled slot's\n * range and detached copy, and the rescue. Hydration calls it through `_$hydrateSlots$`;\n * it captures through slots' `_$capture$`. Slots' own distribution then recomputes every assignment from the nodes'\n * names, so the server's placement decides at most WHETHER a node moves, never where it ends up.\n *\n * Without it, hydration refuses a served light host before touching anything (`hydration-slots`): the page stands as\n * served, and a component boundary reports it once.\n */\nimport { PROTOCOL } from './kinds.js';\nimport { diagnostic } from '@verajs/shared-utils';\nimport { PROSE } from './hydrate-slots-diagnostics.js';\nimport type { CaptureSeam, HydrateSlots, HydrationCursor, HydrationFail, LightCapture, ServedHost } from './types.js';\n\n/** The registry as this module uses it — `get` named so `wire`'s registry is assignable (a type of optional members alone is \"weak\"). */\ntype Registry = { get(name: string): unknown[] | undefined; _$capture$?: CaptureSeam; _$hydrateSlots$?: HydrateSlots };\n/** A served host being adopted: what hydration sees (`ServedHost`), and what this module keeps beside it. */\n/** `_`-named where only this module reads them — the minifier shortens those; `carrier` is hydration's to read too. */\ntype Served = ServedHost & { _host: Element; _runs: string; carrier: HTMLElement | null; _pools: Node[][]; _capture: LightCapture };\n\n/** What `@verajs/ssr` writes — a deliberate second address of its writer; `slots-ssr-client-parity` holds them together. */\nconst FORMAT = '1';\nconst LIGHT_ATTR = 'data-vm-light';\nconst UNASSIGNED = 'data-vm-unassigned';\nconst isMark = (node: Node, data: string) => node.nodeType === 8 && (node as Comment).data === data;\n/** The slottable nodes from `from` up to `to` — comments are never light content. */\nconst pool = (from: Node | null, to: Node | null): Node[] => {\n const out: Node[] = [];\n for (let node = from; node !== null && node !== to; node = node.nextSibling) if (node.nodeType !== 8) out.push(node);\n return out;\n};\n/**\n * The pools' nodes in light order, as the statement gives it — `null` unless it accounts for every one, exactly. The\n * statement counts a run of adjacent TEXT as one light child, as the parser makes it; a walk may since have split it\n * (an outer template's static text beside its value), so the pieces that follow one taken are taken with it.\n */\nconst ordered = (runs: string, pools: Node[][]): Node[] | null => {\n const order: Node[] = [];\n for (const run of runs === '' ? [] : runs.split(',')) {\n const [index, count = '1'] = run.split('*');\n const nodes = pools[+index];\n for (let k = +count; k > 0; k--) {\n let node = nodes?.shift();\n if (node === undefined) return null;\n order.push(node);\n while (node.nodeType === 3 && nodes![0] !== undefined && nodes![0] === node.nextSibling && nodes![0].nodeType === 3) order.push((node = nodes!.shift()!));\n }\n }\n return pools.every((nodes) => nodes.length === 0) ? order : null;\n};\n/** The `]` that closes the range `start` opens — `null` if another `[` or the parent's end comes first: not well-formed. */\nconst endOf = (start: Node): ChildNode | null => {\n let end = start.nextSibling;\n while (end !== null && !isMark(end, ']') && !isMark(end, '[')) end = end.nextSibling;\n return end !== null && isMark(end, ']') ? end : null;\n};\nconst SERVED = new WeakSet<Node>();\n/** Every well-formed range under `parent`, in document order — never entering a range, the carrier, or a served host. */\nconst scan = (parent: Node, out: Node[][], skip: Node | null) => {\n for (let node = parent.firstChild; node !== null; node = node.nextSibling) {\n if (node === skip) continue;\n if (isMark(node, '[')) {\n const end = endOf(node);\n if (end !== null) {\n out.push(pool(node.nextSibling, end));\n node = end;\n }\n } else if (node.nodeType === 1 && !(node as Element).hasAttribute(LIGHT_ATTR) && !SERVED.has(node)) scan(node, out, null);\n }\n};\n\n/** The server's carrier — the host's first child, when it is `<ins data-vm-unassigned>` — or `null`. */\nconst carrierOf = (host: Element): HTMLElement | null => {\n const first = host.firstChild;\n return first !== null && first.nodeType === 1 && (first as Element).hasAttribute(UNASSIGNED) ? (first as HTMLElement) : null;\n};\n/** The statement's runs (after its format number), or `null` for another format or none. */\nconst statementOf = (spec: string | null): string | null => {\n const colon = spec === null ? -1 : spec.indexOf(':');\n return colon < 0 || spec!.slice(0, colon) !== FORMAT ? null : spec!.slice(colon + 1);\n};\n/** Every well-formed range's light nodes, then the carrier's — the pools a statement indexes, found by structure. */\nconst poolsOf = (host: Element, carrier: Node | null): Node[][] => {\n const pools: Node[][] = [];\n scan(host, pools, carrier);\n if (carrier !== null) pools.push(pool(carrier.firstChild, null));\n return pools;\n};\n/** A served host not yet adopted: its light children in light order, read fresh from its statement — or `null`. */\nconst stated = (host: Element): Node[] | null => {\n const runs = statementOf(host.getAttribute(LIGHT_ATTR));\n return runs === null ? null : ordered(runs, poolsOf(host, carrierOf(host)));\n};\n\nlet registry: Registry;\n/** Hydration's mismatch, handed over at `open`. */\nlet fail: HydrationFail;\n\n/** A served host, read: its statement, its carrier. Slots must be wired, and of this release. */\nconst open = (host: Element, failWith: HydrationFail): Served => {\n fail = failWith;\n const seam = registry._$capture$;\n /**\n * A wiring state (the diagnostic shape). Production prints the code alone: the code-and-link shape measured +14 B, the\n * bare code 0 B — Brian's byte rule (a production line carries its code where the bundle is not larger), 2026-10-09.\n */\n if (seam === undefined)\n throw new Error(\n __DEV__ ? diagnostic('hydrate-slots', `<${host.localName}>`, 'hydrate-slots-unwired', __DEV__ && PROSE['hydrate-slots-unwired']()) : '[vera] hydrate-slots-unwired'\n );\n const spec = host.getAttribute(LIGHT_ATTR)!;\n host.removeAttribute(LIGHT_ATTR);\n SERVED.add(host);\n if (seam[0] !== PROTOCOL) fail('protocol', host, __DEV__ && (() => `slots protocol ${seam[0]}, expected ${PROTOCOL}`));\n const runs = statementOf(spec);\n const served = { _host: host, _runs: runs ?? '', carrier: carrierOf(host), _pools: [], _capture: seam[1] };\n /** Another release's server: rescued HERE — hydration holds no state for this host until `open` returns. */\n if (runs === null) {\n rescue(served);\n /** Named in every build (Brian, 2026-10-02): a deploy, not a developer, meets it. */\n fail('format', host, () => `${__DEV__ ? `server format ${JSON.stringify(spec.split(':')[0])}, expected ${FORMAT}: ` : ''}update @verajs/ssr and @verajs/renderer together`);\n }\n return served;\n};\n\n/** At a canonical `<slot>`: a range at the cursor is its region — the slot itself a detached copy, as the client keeps it. */\nconst slot = (canonical: Element, cursor: HydrationCursor, served: ServedHost): Element | null => {\n if (canonical.localName !== 'slot') return null;\n const rs = cursor.offset === 0 ? cursor.node : null;\n if (rs === null || !isMark(rs, '[')) return null;\n const re = endOf(rs);\n if (re === null) return fail('slot', rs, __DEV__ && (() => `a filled slot's range here is not well-formed`));\n (served as Served)._pools.push(pool(rs.nextSibling, re));\n const copy = cursor.parent.ownerDocument!.importNode(canonical, true) as Element & { _$region$?: [Comment, Comment] };\n copy._$region$ = [rs as Comment, re as Comment];\n cursor.node = re.nextSibling;\n return copy;\n};\n\n/** Light hosts a template placed RUNS into, walked in this adoption: captured (or converted) at its close. */\nlet pending: HydrationCursor[] = [];\n\n/**\n * **A light host a template wrote runs into, seated** — whoever walks a light host's content first captures it. Its\n * light children become units in light order: each node outside a run a static, each run `[start, nodes, end]` (its part's\n * anchors, held by `insert`, and the light nodes between them). The statement's order: captured now, waiting for the\n * host's own slots (`wait`). The live record's: each run made one unit of it (`runOf`). Anchors that do not pair up as\n * the template's runs — a run whose items are not each one element — decline.\n */\nconst seat = (cursor: HydrationCursor) => {\n const { parent, _marks: marks, _runs: runs, end } = cursor as Required<HydrationCursor>;\n const host = parent as Element;\n if (marks.length !== runs * 4)\n fail('run', host, __DEV__ && (() => `a list or value this template writes into a light-slot component is not one element per item`));\n const [, capture, lightNodes, records, standIn, placed, adopted] = registry._$capture$!;\n /**\n * The light children NOW, not as the walk began: a text child the walk split is several light children, as a client\n * render makes it — read as the walk began, its pieces were never captured and the next distribution dropped them.\n */\n const nodes = (end === 0 ? lightNodes(host) : stated(host)) ?? fail('run', host, false);\n const index = (node: unknown) => (node === null ? nodes.length : nodes.indexOf(node as Node));\n /** The statement's order: every light child captured as a static first, waiting for the host's own slots. */\n if (end !== 0) capture(host, null, nodes, carrierOf(host), true);\n const record = records.get(host)!;\n const { holding } = record;\n const ref = holding.lastChild;\n const doc = host.ownerDocument;\n for (let m = 0; m < marks.length; m += 4) {\n const k = index(marks[m + 1]);\n const run = nodes.slice(k, index(marks[m + 3]));\n /**\n * **The run, as the client keeps one**, in place of the statics its nodes were: its unit's two comments in holding,\n * its part's anchors inside them, and at each node's place a stand-in if a slot holds it (it stays there), or the\n * node itself if it waits unassigned. Only holding and the record change; no slotted node moves.\n */\n const at = record.units.findIndex((unit) => unit.a === nodes[k]);\n record.units = record.units.filter((unit) => !run.includes(unit.a));\n const unit = { a: doc.createComment(''), z: doc.createComment('') };\n holding.insertBefore(unit.a, ref);\n holding.insertBefore(marks[m] as Node, ref);\n for (const node of run)\n if (node.parentNode === holding) {\n holding.insertBefore(node, ref);\n placed.set(node, null);\n } else {\n standIn(node, holding, ref);\n if (!placed.has(node)) placed.set(node, adopted);\n }\n holding.insertBefore(marks[m + 2] as Node, ref);\n holding.insertBefore(unit.z, ref);\n record.units.splice(at < 0 ? record.units.length : at, 0, unit);\n }\n /** Nothing to mark: holding is watched, so slots notes these writes as it notes any other. */\n};\n\n/** The walk matched: the light children, in light order, captured where they stand — before anything commits. */\nconst close = (adopted: ServedHost | null) => {\n for (const cursor of pending) seat(cursor);\n pending = [];\n if (adopted === null) return;\n const served = adopted as Served;\n const { _host: host, carrier, _pools: pools } = served;\n if (carrier !== null) pools.push(pool(carrier.firstChild, null));\n served._capture(host, null, ordered(served._runs, pools) ?? fail('slots', host, __DEV__ && (() => `its light-slot statement does not account for what its slots hold`)), carrier);\n};\n\n/**\n * It did not: every well-formed range's nodes and the carrier's, captured where they stand before the clear. The clear\n * detaches them with the old markup and the fresh render's end places each by identity, slotted or held — moving them\n * into the carrier first only moved each light node twice more (measured: three disconnect/connect pairs for one).\n */\nconst rescue = (served: ServedHost | null) => {\n pending = [];\n if (served === null) return;\n const { _host: host, _runs: runs, _capture: capture, carrier } = served as Served;\n const pools = poolsOf(host, carrier);\n /** Every node first: `ordered` consumes the pools, and one that fails partway has taken some. */\n const all = pools.flat();\n capture(host, null, ordered(runs, pools) ?? all, carrier);\n};\n\n/**\n * **A light host a template places content into** (the outer walk's light cursor): its children in light order. Slots'\n * live record is the one source once it exists — a node the page added since is in it, and the template need not\n * account for it; before that (the host not yet adopted), the server's statement, read fresh and never cached, which the\n * template must account for exactly. Neither: `null`, and the walk reads the host's DOM.\n */\nconst light = (host: Element, canonical: Element, plan: ReadonlyMap<Node, readonly number[]>, values: readonly unknown[]): HydrationCursor | null => {\n /** Only a custom element the template places content into can be a light host. */\n if (canonical.firstChild === null || !host.localName.includes('-')) return null;\n /** RUNS the template writes directly among those children: a value that is not text (a text value is claimed in place). */\n let runs = 0;\n for (let node: Node | null = canonical.firstChild; node !== null; node = node.nextSibling)\n if (node.nodeType === 3) {\n const owned = plan.get(node);\n if (owned !== undefined && values[owned[0]] != null && typeof values[owned[0]] === 'object') runs++;\n }\n const seam = registry._$capture$;\n const live = seam?.[0] === PROTOCOL ? seam[2](host) : null;\n if (live !== null) return walker(host, live, 0, runs);\n const nodes = stated(host);\n return nodes === null ? null : walker(host, nodes, nodes.length, runs);\n};\n/**\n * A cursor over `nodes` — the walk must account for the first `end` of them (all of a statement's, none of a record's);\n * with runs, held until the adoption's close seats it.\n */\nconst walker = (host: Element, nodes: Node[], end: number, runs: number): HydrationCursor => {\n const cursor = { parent: host, node: nodes[0] ?? null, offset: 0, light: nodes, at: 0, end, _runs: runs, _marks: [] };\n if (runs > 0) pending.push(cursor);\n return cursor;\n};\n\n/**\n * An insert on a light walk. A run's anchor is held, with the node it stands before, for the unit `seat` builds — split\n * first if the walk stands inside a text child, as a plain insert would; text (an empty value's anchor) goes in place.\n */\nconst insert = (cursor: HydrationCursor, node: Node) => {\n if (cursor.offset > 0) {\n cursor.node = (cursor.node as Text).splitText(cursor.offset);\n cursor.offset = 0;\n }\n const at = cursor.node;\n if (node.nodeType === 3) (at === null ? cursor.parent : at.parentNode!).insertBefore(node, at);\n else cursor._marks!.push(node, at);\n};\n\n/** The walk's step, once this piece is wired: on a light cursor the next light child, else the next sibling. */\nconst next = (cursor: HydrationCursor, node: Node): Node | null => {\n const nodes = cursor.light;\n return nodes === undefined ? node.nextSibling : (nodes[++cursor.at!] ?? null);\n};\n\n/** `wire([renderer, hydration, slots, hydrateSlots])`. */\nexport const hydrateSlots = (given: Registry) => {\n registry = given;\n given._$hydrateSlots$ = [PROTOCOL, open, slot, close, rescue, light, next, insert];\n};\n"],"names":["LIGHT_ATTR","isMark","node","data","nodeType","pool","from","to","out","nextSibling","push","ordered","runs","pools","order","run","split","index","count","nodes","k","shift","undefined","every","length","endOf","start","end","SERVED","WeakSet","scan","parent","skip","firstChild","hasAttribute","has","carrierOf","host","first","statementOf","spec","colon","indexOf","slice","poolsOf","carrier","stated","getAttribute","registry","fail","open","failWith","seam","_$capture$","Error","removeAttribute","add","served","_host","_runs","_pools","_capture","rescue","slot","canonical","cursor","localName","rs","offset","re","copy","ownerDocument","importNode","_$region$","pending","seat","_marks","marks","capture","lightNodes","records","standIn","placed","adopted","record","get","holding","ref","lastChild","doc","m","at","units","findIndex","unit","a","filter","includes","createComment","z","insertBefore","parentNode","set","splice","close","all","flat","light","plan","values","owned","live","walker","insert","splitText","next","hydrateSlots","given","_$hydrateSlots$"],"mappings":"AAuEO,MC9CDA,EAAa,gBAEbC,EAAS,CAACC,EAAYC,IAAmC,IAAlBD,EAAKE,UAAmBF,EAAiBC,OAASA,EAEzFE,EAAO,CAACC,EAAmBC,KAC/B,MAAMC,EAAc,GACpB,IAAK,IAAIN,EAAOI,EAAe,OAATJ,GAAiBA,IAASK,EAAIL,EAAOA,EAAKO,YAAmC,IAAlBP,EAAKE,UAAgBI,EAAIE,KAAKR,GAC/G,OAAOM,CAAG,EAONG,EAAU,CAACC,EAAcC,KAC7B,MAAMC,EAAgB,GACtB,IAAK,MAAMC,IAAgB,KAATH,EAAc,GAAKA,EAAKI,MAAM,KAAM,CACpD,MAAOC,EAAOC,EAAQ,KAAOH,EAAIC,MAAM,KACjCG,EAAQN,GAAOI,GACrB,IAAK,IAAIG,GAAKF,EAAOE,EAAI,EAAGA,IAAK,CAC/B,IAAIlB,EAAOiB,GAAOE,QAClB,QAAaC,IAATpB,EAAoB,OAAO,KAE/B,IADAY,EAAMJ,KAAKR,GACc,IAAlBA,EAAKE,eAAgCkB,IAAdH,EAAO,IAAoBA,EAAO,KAAOjB,EAAKO,aAAsC,IAAvBU,EAAO,GAAGf,UAAgBU,EAAMJ,KAAMR,EAAOiB,EAAOE,QACjJ,CACF,CACA,OAAOR,EAAMU,OAAOJ,GAA2B,IAAjBA,EAAMK,SAAgBV,EAAQ,IAAI,EAG5DW,EAASC,IACb,IAAIC,EAAMD,EAAMjB,YAChB,KAAe,OAARkB,IAAiB1B,EAAO0B,EAAK,OAAS1B,EAAO0B,E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EAAOwE,GAAI,EAAGhE,MAAKgC,EAAO/C,EAAMgE,EAAQ,IAEjH,OADIhE,EAAO,GAAG8D,EAAQhE,KAAKuD,GACpBA,CAAM,EAOTgD,EAAS,CAAChD,EAAyB/D,KACnC+D,EAAOG,OAAS,IAClBH,EAAO/D,KAAQ+D,EAAO/D,KAAcgH,UAAUjD,EAAOG,QACrDH,EAAOG,OAAS,GAElB,MAAMuB,EAAK1B,EAAO/D,KACI,IAAlBA,EAAKE,UAAwB,OAAPuF,EAAc1B,EAAOlC,OAAS4D,EAAGU,YAAaD,aAAalG,EAAMyF,GACtF1B,EAAOW,EAAQlE,KAAKR,EAAMyF,EAAG,EAI9BwB,EAAO,CAAClD,EAAyB/D,KACrC,MAAMiB,EAAQ8C,EAAO0C,MACrB,YAAiBrF,IAAVH,EAAsBjB,EAAKO,YAAeU,IAAQ8C,EAAO0B,KAAQ,IAAK,EAIlEyB,EAAgBC,IAC3BrE,EAAWqE,EACXA,EAAMC,gBAAkB,CDhNF,ECgNapE,EAAMa,EAAMyC,EAAO1C,EAAQ6C,EAAOQ,EAAMF,EAAO"}
@@ -1,3 +1,3 @@
1
1
  //# allFunctionsCalledOnLoad
2
- const n=(n,t,e,o)=>`[vera] ${n}: ${t} — https://verajs.dev/e/${e}`,t=/^(?:textContent|innerHTML|innerText|outerHTML|outerText)$/;let e,o,l,r,i=null,u=!1;const s=new Set,f=(n,t,e)=>{s.has(n)||(0===s.size&&queueMicrotask((()=>s.clear())),s.add(n),void 0===e?console.warn(t):console.warn("%s",t,e))},c=[],d=(n,t,e,o,l,r)=>{c.push(n,t,e,o,l,r)};let a="";const v={};let y="";const p=(n,t,e)=>{throw y=n,a=e?e():`${n}: found ${h(t)}`,v},h=n=>null===n?"nothing":1===n.nodeType?`<${n.localName}>`:3===n.nodeType?`the text ${JSON.stringify(n.data.slice(0,30))}`:8===n.nodeType?"a comment":`a ${n.nodeName} node`,w=n=>e[13](n),$=n=>void 0!==n.strings,b=new WeakMap,x=n=>{let t=b.get(n);if(void 0===t){b.set(n,t=new Map);const e=n.$K;for(let o=0;o<e.length;o++){if(0===e[o])continue;let l=n.$R;for(const t of n.$P[o]){l=l.firstChild;for(let n=t;n>0;n--)l=l.nextSibling}const r=t.get(l);void 0===r?t.set(l,[o]):r.push(o)}}return t};let j=(n,t)=>t.nextSibling;const m=n=>{for(;0===n.offset&&null!==n.node&&8===n.node.nodeType;)n.node=j(n,n.node)},k=n=>(n.offset>0&&(n.node=n.node.splitText(n.offset),n.offset=0),n.node),M=(n,t)=>n.parent.insertBefore(t,k(n));let S=M;const g=(n,t)=>void 0===n.light?M(n,t):l[7](n,t),T=(n,t)=>{for(;""!==t;){m(n);const e=n.node;if(null===e||3!==e.nodeType)return p("text",e,!1);const o=e.data,l=Math.min(o.length-n.offset,t.length);if(o.slice(n.offset,n.offset+l)!==t.slice(0,l))return p("text",e,!1);t=t.slice(l),n.offset+=l,n.offset===o.length&&(n.node=j(n,e),n.offset=0)}},A=(n,t)=>{if(""===t){const t=n.parent.ownerDocument.createTextNode("");return S(n,t),t}m(n);const e=k(n);if(null===e||3!==e.nodeType)return p("value",e,!1);const o=e.data;return o.startsWith(t)?(n.node=o.length>t.length?e.splitText(t.length):j(n,e),e):p("value",e,!1)},O=(n,t)=>{m(n);const e=n.offset>0?null:n.node;return null===e||1!==e.nodeType||e.localName!==t?p("element",n.offset>0?n.node:e,!1):(n.node=j(n,e),e)},H=(n,t=!1)=>{m(n),(n.offset>0||null!==n.node&&(void 0===n.light||n.at<n.end))&&p("extra",n.node,!1)},L=(n,t)=>null===i||u?null:l[2](n,t,i),q=(n,t,e,o)=>{u=!0;try{z(n,t,e,o)}finally{u=!1}},C=(n,t,o)=>{n.bindings[2*t]=o,n.bindings[2*t+1]=2===n.template.$K[t]?e[6]:"",d(0,n.template,n.bindings,t,n.template.$K[t],n.values)},E=(n,t,e)=>{for(let o=n;null!==o;o=o.nextSibling){const n=o.nodeType;if(8===n)continue;const l=e.plan.get(o);if(3===n)void 0!==l?D(e,l[0],t):T(t,o.data);else{const n=L(o,t);null===n?z(o,O(t,o.localName),e,l):q(o,n,e,l)}}},J=/^(?:value|checked|selected|open)$/,N=n=>null===n||"object"!=typeof n&&"function"!=typeof n,W=(n,t,o,l)=>{const{template:r,bindings:i,values:u}=n,s=2*t,f=r.$N[t];i[s]=o>=6&&o<=9?new e[5](l):l,i[s+1]=e[6];const c=u[t];if(11===o||14===o||(10===o||4===o)&&J.test(f))i[s+1]=c;else{if((7===o||8===o)&&null!=c&&"function"==typeof c._$apply$)return i[s+1]=c,void d(1,c,l,i[s]);if(3===o){const n=r.$J[t];let o;if(null===n)o=N(c)?null==c?null:e[13](c):void 0;else{o=n[0];for(let l=1;l<n.length;l++){const r=u[t+l-1];if(!N(r)){o=void 0;break}o+=e[13](r)+n[l]}}if(void 0!==o){const e=l.getAttribute(f);if(e===o){if(i[s+1]=null===n?c:o,0===r.$L[t])return}else null===o&&(i[s+1]=e)}}else if(5===o&&l.hasAttribute(f)===!!c&&(i[s+1]=c,0===r.$L[t]))return;d(0,r,i,t,o,u)}},z=(n,e,o,r)=>{null!==o.found&&o.found.push(e);let i=-1,u=!1;if(void 0!==r)for(const n of r){const l=o.template.$K[n];2===l?i=n:(4!==l&&10!==l||!t.test(o.template.$N[n])||(u=!0),W(o,n,l,e))}const s=l?.[5](e,n,o.plan,o.values)??{parent:e,node:e.firstChild,offset:0};if(i>=0)F(o,i,e,s);else{if(null===n.firstChild&&(u||"textarea"===e.localName||e.localName.includes("-")||e.hasAttribute("is")))return;E(n.firstChild,s,o)}H(s)},B=n=>null!=n&&"object"!=typeof n,D=(n,t,o)=>{if(u){const e=o.node;return o.node=e.nextSibling,C(n,t,e)}const l=n.values[t];if(B(l))return n.bindings[2*t]=A(o,w(l)),void(n.bindings[2*t+1]=l);const r=new e[3](o.parent.ownerDocument.createComment(""),o.parent.ownerDocument.createComment(""));S(o,r.$s),I(r,l,o),null===r.$e.parentNode&&S(o,r.$e),n.bindings[2*t]=r,n.bindings[2*t+1]=e[7]},F=(n,t,o,l)=>{const r=n.values[t];if(u)return C(n,t,o);if(B(r))return n.bindings[2*t]=A(l,w(r)),void(n.bindings[2*t+1]=r);const i=new e[3](null,null);i.$w=o,I(i,r,l),n.bindings[2*t]=i,n.bindings[2*t+1]=e[7]},G=(n,t)=>{let o=e[2](n);o.$X&&(o=e[11](o,t.parent));const l={template:o,bindings:new Array(2*o.$K.length+(o.$X?1:0)),values:n.values,plan:x(o),found:void 0===o._$inst$?null:[]},r=o.$R,i=1===r.nodeType,u=i?L(r,t):null,s=u??(i?O(t,r.localName):t.parent.ownerDocument.createDocumentFragment()),f=new e[4](o,n.strings,s,l.bindings);return null!==l.found&&d(2,f,l.found),null!==u?q(r,u,l,l.plan.get(r)):i?z(r,s,l,l.plan.get(r)):E(r.firstChild,t,l),f},I=(n,t,e)=>{if(null==t)return;if("object"!=typeof t)return n.$l=A(e,w(t)),n.$v=t,void(n.$o=1);const l=t.$h;if(void 0!==l||$(t))return n.$n=G(l??t,e),void(n.$o=2);const r=o.get("value"),i=void 0===r?-1:c.length;void 0!==r&&d(4,n,t,r,0),K(n,t,e),i>=0&&(c[i+4]=c.length)},K=(n,t,e)=>{if(Array.isArray(t)||"function"==typeof t[Symbol.iterator]&&void 0===t.nodeType){const o=Array.isArray(t)?t:[...t],l=[];for(let n=0;n<o.length;n++)l.push(P(o[n],e));return n.$i=l,void(n.$o=3)}const o=t._$child$;if(void 0!==o)return null!=n.$w&&null!==e.node&&(n.$o=4,e.node=null,e.offset=0),null!==n.$e&&null===n.$e.parentNode&&S(e,n.$e),n.$a=o,n.$R=e.parent,void d(3,o,t,n);if(void 0!==t.nodeType){const o=e.parent.ownerDocument.createComment("");return S(e,o),d(5,e.parent,t,o),n.$v=t,void(n.$o=4)}n.$l=A(e,w(t)),n.$v=t,n.$o=1},P=(n,t)=>{if(null!==n&&"object"==typeof n&&$(n)&&1===((n,t)=>{const o=e[2](n);return(o.$X?e[11](o,t.parent):o).$R})(n,t).nodeType){const e=G(n,t);return e.$k=n.key,e}const o=new e[3](t.parent.ownerDocument.createComment(""),t.parent.ownerDocument.createComment(""));return S(t,o.$s),I(o,n,t),null===o.$e.parentNode&&S(t,o.$e),o.$k=n?.key,o},Q=(n,t,o)=>{const l={...n},r=[];for(let t=null===n.$s?n.$w.firstChild:n.$s.nextSibling;null!==t&&t!==n.$e;t=t.nextSibling)r.push(t);Object.assign(n,new e[3](n.$s,n.$e),{$w:l.$w,$k:l.$k});for(let e=0;e<o.length;e++){const i=o[e](n,t,l);if(2===i)break;if(i){for(const n of r)n.parentNode?.removeChild(n);return!0}}return Object.assign(n,l),!1},R="data-vm-light",U=n=>null!==n&&1===n.nodeType&&n.hasAttribute("data-vm-sheet"),V=n=>{for(let t=n.firstChild;null!==t;){const e=t.nextSibling;U(t)||n.removeChild(t),t=e}},X=(n,t)=>{if(null===n||"object"!=typeof n||!$(n))return!1;const e=c.length,r=[a,y,i];l=o._$hydrateSlots$,void 0!==l&&(j=l[6],S=g);try{return Y(n,t,e)}finally{c.length=e,[a,y,i]=r}},Y=(t,u,s)=>{const d=u.ownerDocument??u;i=null;let h,w=null,$=null;const b=1===u.nodeType?u:null,x=null===b?null:b.getAttribute(R);if(null===x&&void 0!==o._$capture$&&b?.localName.includes("-"))return!1;try{if(x?.endsWith(":")&&void 0===l)b.removeAttribute(R);else if(null!==x){if(void 0===l)throw new Error(n("hydration","no hydrateSlots","hydration-slots"));1!==l[0]&&p("protocol",u,(()=>`hydrateSlots protocol ${l[0]}, expected 1`)),i=l[1](u,p)}let o=u.firstChild;for(;U(o)||null!==o&&o===i?.carrier;)o=o.nextSibling;if(null===o&&null===i)return!1;w=d.createComment(""),u.insertBefore(w,o),$=u.appendChild(d.createComment("")),h=new e[3](w,$);const r={parent:u,node:o,offset:0};I(h,t,r),H(r,!0),l?.[3](i)}catch(t){if(w?.remove(),$?.remove(),t!==v)throw t;return l?.[4](i),f(y,n("hydration",a,"hydration-fallback"),u),V(u),!1}const j=c.length;return e[9](u,{$p:()=>((n,t)=>{const o=c;for(let l=n;l<t;l+=6){const n=o[l];if(0===n)e[8](o[l+1],o[l+2],o[l+3],o[l+4],o[l+5]);else if(1===n)e[14](),o[l+1]._$apply$(o[l+2],o[l+3],r,!0);else if(2===n)e[10](o[l+1],o[l+2],!0);else if(3===n){const n=o[l+1],t=o[l+3];void 0!==n._$detach$&&e[14](),t.$z=n.call(o[l+2],t,void 0,!0)}else 4===n?Q(o[l+1],o[l+2],o[l+3])&&(l=o[l+4]-6):(o[l+1].insertBefore(o[l+2],o[l+3]),o[l+3].remove())}})(s,j)},void 0,u),e[12].set(u,h),!0},Z=t=>{const l=t.$H;if(void 0!==l){if(1!==l[0])return f("protocol",n("hydration",`protocol ${l[0]}, expected 1`,"hydration-protocol")),void l[1](((n,t)=>(V(t),!1)));e=l,o=t,t._$hydrating$=!0,r=t.$t??((n,...t)=>n(...t)),l[1](X)}else console.warn(n("hydration","no renderer","hydration-no-renderer"))};export{Z as hydration};
2
+ const n=(n,t,e,o)=>`[vera] ${n}: ${t} — https://verajs.dev/e/${e}`,t=(n,t)=>t?n.replace(/</g,"\\u003c"):n.replace(/<\/(style)/gi,"<\\/$1"),e=/^(?:textContent|innerHTML|innerText|outerHTML|outerText)$/;let o,l,r,i,u=null,s=!1;const f=new Set,c=(n,t,e)=>{f.has(n)||(0===f.size&&queueMicrotask((()=>f.clear())),f.add(n),void 0===e?console.warn(t):console.warn("%s",t,e))},d=[],v=(n,t,e,o,l,r)=>{d.push(n,t,e,o,l,r)};let a="";const y={};let p="";const h=(n,t,e)=>{throw p=n,a=e?e():`${n}: found ${w(t)}`,y},w=n=>null===n?"nothing":1===n.nodeType?`<${n.localName}>`:3===n.nodeType?`the text ${JSON.stringify(n.data.slice(0,30))}`:8===n.nodeType?"a comment":`a ${n.nodeName} node`,$=n=>o[13](n),b=n=>void 0!==n.strings,x=new WeakMap,j=n=>{let t=x.get(n);if(void 0===t){x.set(n,t=new Map);const e=n.$K;for(let o=0;o<e.length;o++){if(0===e[o])continue;let l=n.$R;for(const t of n.$P[o]){l=l.firstChild;for(let n=t;n>0;n--)l=l.nextSibling}const r=t.get(l);void 0===r?t.set(l,[o]):r.push(o)}}return t};let m=(n,t)=>t.nextSibling;const k=n=>{for(;0===n.offset&&null!==n.node&&8===n.node.nodeType;)n.node=m(n,n.node)},g=n=>(n.offset>0&&(n.node=n.node.splitText(n.offset),n.offset=0),n.node),M=(n,t)=>n.parent.insertBefore(t,g(n));let S=M;const T=(n,t)=>void 0===n.light?M(n,t):r[7](n,t),A=(n,t)=>{for(;""!==t;){k(n);const e=n.node;if(null===e||3!==e.nodeType)return h("text",e,!1);const o=e.data,l=Math.min(o.length-n.offset,t.length);if(o.slice(n.offset,n.offset+l)!==t.slice(0,l))return h("text",e,!1);t=t.slice(l),n.offset+=l,n.offset===o.length&&(n.node=m(n,e),n.offset=0)}},O=(n,t)=>{if(""===t){const t=n.parent.ownerDocument.createTextNode("");return S(n,t),t}k(n);const e=g(n);if(null===e||3!==e.nodeType)return h("value",e,!1);const o=e.data;return o.startsWith(t)?(n.node=o.length>t.length?e.splitText(t.length):m(n,e),e):h("value",e,!1)},H=(n,t)=>{k(n);const e=n.offset>0?null:n.node;return null===e||1!==e.nodeType||e.localName!==t?h("element",n.offset>0?n.node:e,!1):(n.node=m(n,e),e)},L=(n,t=!1)=>{k(n),(n.offset>0||null!==n.node&&(void 0===n.light||n.at<n.end))&&h("extra",n.node,!1)},q=(n,t)=>null===u||s?null:r[2](n,t,u),C=(n,t,e,o)=>{s=!0;try{B(n,t,e,o)}finally{s=!1}},E=(n,t,e)=>{n.bindings[2*t]=e,n.bindings[2*t+1]=2===n.template.$K[t]?o[6]:"",v(0,n.template,n.bindings,t,n.template.$K[t],n.values)},J=(n,t,e)=>{for(let o=n;null!==o;o=o.nextSibling){const n=o.nodeType;if(8===n)continue;const l=e.plan.get(o);if(3===n)void 0!==l?F(e,l[0],t):A(t,o.data);else{const n=q(o,t);null===n?B(o,H(t,o.localName),e,l):C(o,n,e,l)}}},N=/^(?:value|checked|selected|open)$/,W=n=>null===n||"object"!=typeof n&&"function"!=typeof n,z=(n,e,l,r)=>{const{template:i,bindings:u,values:s}=n,f=2*e,c=i.$N[e];u[f]=l>=6&&l<=9?new o[5](r):r,u[f+1]=o[6];const d=s[e];if(11===l||14===l||(10===l||4===l)&&N.test(c))u[f+1]=d;else{if((7===l||8===l)&&null!=d&&"function"==typeof d._$apply$)return u[f+1]=d,void v(1,d,r,u[f]);if(3===l||l>=15){const n=i.$J[e];let v;if(null===n)v=W(d)?null==d?null:o[13](d):void 0;else{v=n[0];for(let t=1;t<n.length;t++){const l=s[e+t-1];if(!W(l)){v=void 0;break}v+=o[13](l)+n[t]}}if(3!==l){if(void 0!==v&&17!==l&&r.textContent===/*@__NOINLINE__*/t(v??"",16===l))return void(u[f+1]=null===n?d:v)}else if(void 0!==v){const t=r.getAttribute(c);if(t===v){if(u[f+1]=null===n?d:v,0===i.$L[e])return}else null===v&&(u[f+1]=t)}}else if(5===l&&r.hasAttribute(c)===!!d&&(u[f+1]=d,0===i.$L[e]))return;v(0,i,u,e,l,s)}},B=(n,t,o,l)=>{null!==o.found&&o.found.push(t);let i=-1,u=!1;if(void 0!==l)for(const n of l){const l=o.template.$K[n];2===l?i=n:(((4===l||10===l)&&e.test(o.template.$N[n])||l>=15)&&(u=!0),z(o,n,l,t))}const s=r?.[5](t,n,o.plan,o.values)??{parent:t,node:t.firstChild,offset:0};if(i>=0)G(o,i,t,s);else{if(null===n.firstChild&&(u||"textarea"===t.localName||t.localName.includes("-")||t.hasAttribute("is")))return;J(n.firstChild,s,o)}L(s)},D=n=>null!=n&&"object"!=typeof n,F=(n,t,e)=>{if(s){const o=e.node;return e.node=o.nextSibling,E(n,t,o)}const l=n.values[t];if(D(l))return n.bindings[2*t]=O(e,$(l)),void(n.bindings[2*t+1]=l);const r=new o[3](e.parent.ownerDocument.createComment(""),e.parent.ownerDocument.createComment(""));S(e,r.$s),K(r,l,e),null===r.$e.parentNode&&S(e,r.$e),n.bindings[2*t]=r,n.bindings[2*t+1]=o[7]},G=(n,t,e,l)=>{const r=n.values[t];if(s)return E(n,t,e);if(D(r))return n.bindings[2*t]=O(l,$(r)),void(n.bindings[2*t+1]=r);const i=new o[3](null,null);i.$w=e,K(i,r,l),n.bindings[2*t]=i,n.bindings[2*t+1]=o[7]},I=(n,t)=>{let e=o[2](n);e.$X&&(e=o[11](e,t.parent));const l={template:e,bindings:new Array(2*e.$K.length+(e.$X?1:0)),values:n.values,plan:j(e),found:void 0===e._$inst$?null:[]},r=e.$R,i=1===r.nodeType,u=i?q(r,t):null,s=u??(i?H(t,r.localName):t.parent.ownerDocument.createDocumentFragment()),f=new o[4](e,n.strings,s,l.bindings);return null!==l.found&&v(2,f,l.found),null!==u?C(r,u,l,l.plan.get(r)):i?B(r,s,l,l.plan.get(r)):J(r.firstChild,t,l),f},K=(n,t,e)=>{if(null==t)return;if("object"!=typeof t)return n.$l=O(e,$(t)),n.$v=t,void(n.$o=1);const o=t.$h;if(void 0!==o||b(t))return n.$n=I(o??t,e),void(n.$o=2);const r=l.get("value"),i=void 0===r?-1:d.length;void 0!==r&&v(4,n,t,r,0),P(n,t,e),i>=0&&(d[i+4]=d.length)},P=(n,t,e)=>{if(Array.isArray(t)||"function"==typeof t[Symbol.iterator]&&void 0===t.nodeType){const o=Array.isArray(t)?t:[...t],l=[];for(let n=0;n<o.length;n++)l.push(Q(o[n],e));return n.$i=l,void(n.$o=3)}const o=t._$child$;if(void 0!==o)return null!=n.$w&&null!==e.node&&(n.$o=4,e.node=null,e.offset=0),null!==n.$e&&null===n.$e.parentNode&&S(e,n.$e),n.$a=o,n.$R=e.parent,void v(3,o,t,n);if(void 0!==t.nodeType){const o=e.parent.ownerDocument.createComment("");return S(e,o),v(5,e.parent,t,o),n.$v=t,void(n.$o=4)}n.$l=O(e,$(t)),n.$v=t,n.$o=1},Q=(n,t)=>{if(null!==n&&"object"==typeof n&&b(n)&&1===((n,t)=>{const e=o[2](n);return(e.$X?o[11](e,t.parent):e).$R})(n,t).nodeType){const e=I(n,t);return e.$k=n.key,e}const e=new o[3](t.parent.ownerDocument.createComment(""),t.parent.ownerDocument.createComment(""));return S(t,e.$s),K(e,n,t),null===e.$e.parentNode&&S(t,e.$e),e.$k=n?.key,e},R=(n,t,e)=>{const l={...n},r=[];for(let t=null===n.$s?n.$w.firstChild:n.$s.nextSibling;null!==t&&t!==n.$e;t=t.nextSibling)r.push(t);Object.assign(n,new o[3](n.$s,n.$e),{$w:l.$w,$k:l.$k});for(let o=0;o<e.length;o++){const i=e[o](n,t,l);if(2===i)break;if(i){for(const n of r)n.parentNode?.removeChild(n);return!0}}return Object.assign(n,l),!1},U="data-vm-light",V=n=>null!==n&&1===n.nodeType&&n.hasAttribute("data-vm-sheet"),X=n=>{for(let t=n.firstChild;null!==t;){const e=t.nextSibling;V(t)||n.removeChild(t),t=e}},Y=(n,t)=>{if(null===n||"object"!=typeof n||!b(n))return!1;const e=d.length,o=[a,p,u];r=l._$hydrateSlots$,void 0!==r&&(m=r[6],S=T);try{return Z(n,t,e)}finally{d.length=e,[a,p,u]=o}},Z=(t,e,s)=>{const f=e.ownerDocument??e;u=null;let v,w=null,$=null;const b=1===e.nodeType?e:null,x=null===b?null:b.getAttribute(U);if(null===x&&void 0!==l._$capture$&&b?.localName.includes("-"))return!1;try{if(x?.endsWith(":")&&void 0===r)b.removeAttribute(U);else if(null!==x){if(void 0===r)throw new Error(n("hydration","no hydrateSlots","hydration-slots"));2!==r[0]&&h("protocol",e,(()=>`hydrateSlots protocol ${r[0]}, expected 2`)),u=r[1](e,h)}let l=e.firstChild;for(;V(l)||null!==l&&l===u?.carrier;)l=l.nextSibling;if(null===l&&null===u)return!1;w=f.createComment(""),e.insertBefore(w,l),$=e.appendChild(f.createComment("")),v=new o[3](w,$);const i={parent:e,node:l,offset:0};K(v,t,i),L(i,!0),r?.[3](u)}catch(t){if(w?.remove(),$?.remove(),t!==y)throw t;return r?.[4](u),c(p,n("hydration",a,"hydration-fallback"),e),X(e),!1}const j=d.length;return o[9](e,{$p:()=>((n,t)=>{const e=d;for(let l=n;l<t;l+=6){const n=e[l];if(0===n)o[8](e[l+1],e[l+2],e[l+3],e[l+4],e[l+5]);else if(1===n)o[14](),e[l+1]._$apply$(e[l+2],e[l+3],i,!0);else if(2===n)o[10](e[l+1],e[l+2],!0);else if(3===n){const n=e[l+1],t=e[l+3];void 0!==n._$detach$&&o[14](),t.$z=n.call(e[l+2],t,void 0,!0)}else 4===n?R(e[l+1],e[l+2],e[l+3])&&(l=e[l+4]-6):(e[l+1].insertBefore(e[l+2],e[l+3]),e[l+3].remove())}})(s,j)},void 0,e),o[12].set(e,v),!0},_=t=>{const e=t.$H;if(void 0!==e){if(2!==e[0])return c("protocol",n("hydration",`protocol ${e[0]}, expected 2`,"hydration-protocol")),void e[1](((n,t)=>(X(t),!1)));o=e,l=t,t._$hydrating$=!0,i=t.$t??((n,...t)=>n(...t)),e[1](Y)}else console.warn(n("hydration","no renderer","hydration-no-renderer"))};export{_ as hydration};
3
3
  //# sourceMappingURL=vera-renderer-hydration.min.js.map